@adobe/ccweb-add-on-manifest
Version:
Manifest models and validation rules for Adobe Creative Cloud Web Add-on.
539 lines (538 loc) • 358 kB
JavaScript
"use strict";
export const validateSchemaV1 = validate10;
const schema11 = { "$id": "#/definitions/manifestSchemaV1", "type": "object", "properties": { "id": { "type": "string" }, "name": { "anyOf": [{ "type": "string" }, { "type": "object", "properties": { "default": { "type": "string" } }, "required": ["default"], "additionalProperties": true }] }, "version": { "type": "string" }, "manifestVersion": { "type": "number" }, "requirements": { "type": "object", "properties": { "apps": { "type": "array", "items": { "type": "string", "pattern": "^(Express)$" } }, "experimentalApis": { "type": "boolean" } }, "required": ["apps"], "additionalProperties": false }, "icon": { "anyOf": [{ "type": "object", "properties": { "width": { "type": "number" }, "height": { "type": "number" }, "href": { "type": "string" }, "theme": { "type": "array", "items": { "type": "string", "pattern": "^(lightest|light|medium|dark|darkest|all)$" } }, "scale": { "type": "array", "items": { "type": "number" } } }, "required": ["href", "theme"], "additionalProperties": false }, { "type": "array", "items": { "type": "object", "properties": { "width": { "type": "number" }, "height": { "type": "number" }, "href": { "type": "string" }, "theme": { "type": "array", "items": { "type": "string", "pattern": "^(lightest|light|medium|dark|darkest|all)$" } }, "scale": { "type": "array", "items": { "type": "number" } } }, "required": ["href", "theme"], "additionalProperties": false } }] }, "entryPoints": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "pattern": "^(panel|script|share|content-hub|content-hub-home|mobile.your-stuff.files|mobile.media.audio|mobile.more|schedule|contextual.replace|contextual.upload|contextual.bulk-create|command|import-hub|quick-action)$" }, "id": { "type": "string" }, "main": { "type": "string" }, "label": { "anyOf": [{ "type": "string" }, { "type": "object", "properties": { "default": { "type": "string" } }, "required": ["default"], "additionalProperties": true }] }, "permissions": { "type": "object", "properties": { "sandbox": { "type": "array", "items": { "type": "string", "pattern": "^(allow-popups|allow-presentation|allow-downloads|allow-popups-to-escape-sandbox|allow-forms)$" } }, "oauth": { "type": "array", "items": { "type": "string" } }, "microphone": { "type": "string" }, "camera": { "type": "string" } }, "required": [], "additionalProperties": false }, "defaultSize": { "type": "object", "properties": { "width": { "type": "number" }, "height": { "type": "number" } }, "required": ["width", "height"], "additionalProperties": false } }, "required": ["type", "id", "label", "main"], "additionalProperties": false } }, "authorInfo": { "type": "object", "properties": { "name": { "type": "string" }, "email": { "type": "string" }, "url": { "type": "string" } }, "required": ["name", "email"], "additionalProperties": false } }, "required": ["id", "name", "version", "manifestVersion", "requirements", "icon", "entryPoints"], "additionalProperties": false };
const pattern0 = new RegExp("^(Express)$", "u");
const pattern1 = new RegExp("^(lightest|light|medium|dark|darkest|all)$", "u");
const pattern3 = new RegExp("^(panel|script|share|content-hub|content-hub-home|mobile.your-stuff.files|mobile.media.audio|mobile.more|schedule|contextual.replace|contextual.upload|contextual.bulk-create|command|import-hub|quick-action)$", "u");
const pattern4 = new RegExp("^(allow-popups|allow-presentation|allow-downloads|allow-popups-to-escape-sandbox|allow-forms)$", "u");
function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { /*# sourceURL="#/definitions/manifestSchemaV1" */ ; let vErrors = null; let errors = 0; if (errors === 0) {
if (data && typeof data == "object" && !Array.isArray(data)) {
let missing0;
if ((((((((data.id === undefined) && (missing0 = "id")) || ((data.name === undefined) && (missing0 = "name"))) || ((data.version === undefined) && (missing0 = "version"))) || ((data.manifestVersion === undefined) && (missing0 = "manifestVersion"))) || ((data.requirements === undefined) && (missing0 = "requirements"))) || ((data.icon === undefined) && (missing0 = "icon"))) || ((data.entryPoints === undefined) && (missing0 = "entryPoints"))) {
validate10.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
return false;
}
else {
const _errs1 = errors;
for (const key0 in data) {
if (!((((((((key0 === "id") || (key0 === "name")) || (key0 === "version")) || (key0 === "manifestVersion")) || (key0 === "requirements")) || (key0 === "icon")) || (key0 === "entryPoints")) || (key0 === "authorInfo"))) {
validate10.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
return false;
break;
}
}
if (_errs1 === errors) {
if (data.id !== undefined) {
const _errs2 = errors;
if (typeof data.id !== "string") {
validate10.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid0 = _errs2 === errors;
}
else {
var valid0 = true;
}
if (valid0) {
if (data.name !== undefined) {
let data1 = data.name;
const _errs4 = errors;
const _errs5 = errors;
let valid1 = false;
const _errs6 = errors;
if (typeof data1 !== "string") {
const err0 = { instancePath: instancePath + "/name", schemaPath: "#/properties/name/anyOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" };
if (vErrors === null) {
vErrors = [err0];
}
else {
vErrors.push(err0);
}
errors++;
}
var _valid0 = _errs6 === errors;
valid1 = valid1 || _valid0;
if (!valid1) {
const _errs8 = errors;
if (errors === _errs8) {
if (data1 && typeof data1 == "object" && !Array.isArray(data1)) {
let missing1;
if ((data1.default === undefined) && (missing1 = "default")) {
const err1 = { instancePath: instancePath + "/name", schemaPath: "#/properties/name/anyOf/1/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" };
if (vErrors === null) {
vErrors = [err1];
}
else {
vErrors.push(err1);
}
errors++;
}
else {
if (data1.default !== undefined) {
if (typeof data1.default !== "string") {
const err2 = { instancePath: instancePath + "/name/default", schemaPath: "#/properties/name/anyOf/1/properties/default/type", keyword: "type", params: { type: "string" }, message: "must be string" };
if (vErrors === null) {
vErrors = [err2];
}
else {
vErrors.push(err2);
}
errors++;
}
}
}
}
else {
const err3 = { instancePath: instancePath + "/name", schemaPath: "#/properties/name/anyOf/1/type", keyword: "type", params: { type: "object" }, message: "must be object" };
if (vErrors === null) {
vErrors = [err3];
}
else {
vErrors.push(err3);
}
errors++;
}
}
var _valid0 = _errs8 === errors;
valid1 = valid1 || _valid0;
}
if (!valid1) {
const err4 = { instancePath: instancePath + "/name", schemaPath: "#/properties/name/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
if (vErrors === null) {
vErrors = [err4];
}
else {
vErrors.push(err4);
}
errors++;
validate10.errors = vErrors;
return false;
}
else {
errors = _errs5;
if (vErrors !== null) {
if (_errs5) {
vErrors.length = _errs5;
}
else {
vErrors = null;
}
}
}
var valid0 = _errs4 === errors;
}
else {
var valid0 = true;
}
if (valid0) {
if (data.version !== undefined) {
const _errs13 = errors;
if (typeof data.version !== "string") {
validate10.errors = [{ instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid0 = _errs13 === errors;
}
else {
var valid0 = true;
}
if (valid0) {
if (data.manifestVersion !== undefined) {
let data4 = data.manifestVersion;
const _errs15 = errors;
if (!((typeof data4 == "number") && (isFinite(data4)))) {
validate10.errors = [{ instancePath: instancePath + "/manifestVersion", schemaPath: "#/properties/manifestVersion/type", keyword: "type", params: { type: "number" }, message: "must be number" }];
return false;
}
var valid0 = _errs15 === errors;
}
else {
var valid0 = true;
}
if (valid0) {
if (data.requirements !== undefined) {
let data5 = data.requirements;
const _errs17 = errors;
if (errors === _errs17) {
if (data5 && typeof data5 == "object" && !Array.isArray(data5)) {
let missing2;
if ((data5.apps === undefined) && (missing2 = "apps")) {
validate10.errors = [{ instancePath: instancePath + "/requirements", schemaPath: "#/properties/requirements/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }];
return false;
}
else {
const _errs19 = errors;
for (const key1 in data5) {
if (!((key1 === "apps") || (key1 === "experimentalApis"))) {
validate10.errors = [{ instancePath: instancePath + "/requirements", schemaPath: "#/properties/requirements/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }];
return false;
break;
}
}
if (_errs19 === errors) {
if (data5.apps !== undefined) {
let data6 = data5.apps;
const _errs20 = errors;
if (errors === _errs20) {
if (Array.isArray(data6)) {
var valid4 = true;
const len0 = data6.length;
for (let i0 = 0; i0 < len0; i0++) {
let data7 = data6[i0];
const _errs22 = errors;
if (errors === _errs22) {
if (typeof data7 === "string") {
if (!pattern0.test(data7)) {
validate10.errors = [{ instancePath: instancePath + "/requirements/apps/" + i0, schemaPath: "#/properties/requirements/properties/apps/items/pattern", keyword: "pattern", params: { pattern: "^(Express)$" }, message: "must match pattern \"" + "^(Express)$" + "\"" }];
return false;
}
}
else {
validate10.errors = [{ instancePath: instancePath + "/requirements/apps/" + i0, schemaPath: "#/properties/requirements/properties/apps/items/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
}
var valid4 = _errs22 === errors;
if (!valid4) {
break;
}
}
}
else {
validate10.errors = [{ instancePath: instancePath + "/requirements/apps", schemaPath: "#/properties/requirements/properties/apps/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
return false;
}
}
var valid3 = _errs20 === errors;
}
else {
var valid3 = true;
}
if (valid3) {
if (data5.experimentalApis !== undefined) {
const _errs24 = errors;
if (typeof data5.experimentalApis !== "boolean") {
validate10.errors = [{ instancePath: instancePath + "/requirements/experimentalApis", schemaPath: "#/properties/requirements/properties/experimentalApis/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" }];
return false;
}
var valid3 = _errs24 === errors;
}
else {
var valid3 = true;
}
}
}
}
}
else {
validate10.errors = [{ instancePath: instancePath + "/requirements", schemaPath: "#/properties/requirements/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
return false;
}
}
var valid0 = _errs17 === errors;
}
else {
var valid0 = true;
}
if (valid0) {
if (data.icon !== undefined) {
let data9 = data.icon;
const _errs26 = errors;
const _errs27 = errors;
let valid5 = false;
const _errs28 = errors;
if (errors === _errs28) {
if (data9 && typeof data9 == "object" && !Array.isArray(data9)) {
let missing3;
if (((data9.href === undefined) && (missing3 = "href")) || ((data9.theme === undefined) && (missing3 = "theme"))) {
const err5 = { instancePath: instancePath + "/icon", schemaPath: "#/properties/icon/anyOf/0/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" };
if (vErrors === null) {
vErrors = [err5];
}
else {
vErrors.push(err5);
}
errors++;
}
else {
const _errs30 = errors;
for (const key2 in data9) {
if (!(((((key2 === "width") || (key2 === "height")) || (key2 === "href")) || (key2 === "theme")) || (key2 === "scale"))) {
const err6 = { instancePath: instancePath + "/icon", schemaPath: "#/properties/icon/anyOf/0/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" };
if (vErrors === null) {
vErrors = [err6];
}
else {
vErrors.push(err6);
}
errors++;
break;
}
}
if (_errs30 === errors) {
if (data9.width !== undefined) {
let data10 = data9.width;
const _errs31 = errors;
if (!((typeof data10 == "number") && (isFinite(data10)))) {
const err7 = { instancePath: instancePath + "/icon/width", schemaPath: "#/properties/icon/anyOf/0/properties/width/type", keyword: "type", params: { type: "number" }, message: "must be number" };
if (vErrors === null) {
vErrors = [err7];
}
else {
vErrors.push(err7);
}
errors++;
}
var valid6 = _errs31 === errors;
}
else {
var valid6 = true;
}
if (valid6) {
if (data9.height !== undefined) {
let data11 = data9.height;
const _errs33 = errors;
if (!((typeof data11 == "number") && (isFinite(data11)))) {
const err8 = { instancePath: instancePath + "/icon/height", schemaPath: "#/properties/icon/anyOf/0/properties/height/type", keyword: "type", params: { type: "number" }, message: "must be number" };
if (vErrors === null) {
vErrors = [err8];
}
else {
vErrors.push(err8);
}
errors++;
}
var valid6 = _errs33 === errors;
}
else {
var valid6 = true;
}
if (valid6) {
if (data9.href !== undefined) {
const _errs35 = errors;
if (typeof data9.href !== "string") {
const err9 = { instancePath: instancePath + "/icon/href", schemaPath: "#/properties/icon/anyOf/0/properties/href/type", keyword: "type", params: { type: "string" }, message: "must be string" };
if (vErrors === null) {
vErrors = [err9];
}
else {
vErrors.push(err9);
}
errors++;
}
var valid6 = _errs35 === errors;
}
else {
var valid6 = true;
}
if (valid6) {
if (data9.theme !== undefined) {
let data13 = data9.theme;
const _errs37 = errors;
if (errors === _errs37) {
if (Array.isArray(data13)) {
var valid7 = true;
const len1 = data13.length;
for (let i1 = 0; i1 < len1; i1++) {
let data14 = data13[i1];
const _errs39 = errors;
if (errors === _errs39) {
if (typeof data14 === "string") {
if (!pattern1.test(data14)) {
const err10 = { instancePath: instancePath + "/icon/theme/" + i1, schemaPath: "#/properties/icon/anyOf/0/properties/theme/items/pattern", keyword: "pattern", params: { pattern: "^(lightest|light|medium|dark|darkest|all)$" }, message: "must match pattern \"" + "^(lightest|light|medium|dark|darkest|all)$" + "\"" };
if (vErrors === null) {
vErrors = [err10];
}
else {
vErrors.push(err10);
}
errors++;
}
}
else {
const err11 = { instancePath: instancePath + "/icon/theme/" + i1, schemaPath: "#/properties/icon/anyOf/0/properties/theme/items/type", keyword: "type", params: { type: "string" }, message: "must be string" };
if (vErrors === null) {
vErrors = [err11];
}
else {
vErrors.push(err11);
}
errors++;
}
}
var valid7 = _errs39 === errors;
if (!valid7) {
break;
}
}
}
else {
const err12 = { instancePath: instancePath + "/icon/theme", schemaPath: "#/properties/icon/anyOf/0/properties/theme/type", keyword: "type", params: { type: "array" }, message: "must be array" };
if (vErrors === null) {
vErrors = [err12];
}
else {
vErrors.push(err12);
}
errors++;
}
}
var valid6 = _errs37 === errors;
}
else {
var valid6 = true;
}
if (valid6) {
if (data9.scale !== undefined) {
let data15 = data9.scale;
const _errs41 = errors;
if (errors === _errs41) {
if (Array.isArray(data15)) {
var valid8 = true;
const len2 = data15.length;
for (let i2 = 0; i2 < len2; i2++) {
let data16 = data15[i2];
const _errs43 = errors;
if (!((typeof data16 == "number") && (isFinite(data16)))) {
const err13 = { instancePath: instancePath + "/icon/scale/" + i2, schemaPath: "#/properties/icon/anyOf/0/properties/scale/items/type", keyword: "type", params: { type: "number" }, message: "must be number" };
if (vErrors === null) {
vErrors = [err13];
}
else {
vErrors.push(err13);
}
errors++;
}
var valid8 = _errs43 === errors;
if (!valid8) {
break;
}
}
}
else {
const err14 = { instancePath: instancePath + "/icon/scale", schemaPath: "#/properties/icon/anyOf/0/properties/scale/type", keyword: "type", params: { type: "array" }, message: "must be array" };
if (vErrors === null) {
vErrors = [err14];
}
else {
vErrors.push(err14);
}
errors++;
}
}
var valid6 = _errs41 === errors;
}
else {
var valid6 = true;
}
}
}
}
}
}
}
}
else {
const err15 = { instancePath: instancePath + "/icon", schemaPath: "#/properties/icon/anyOf/0/type", keyword: "type", params: { type: "object" }, message: "must be object" };
if (vErrors === null) {
vErrors = [err15];
}
else {
vErrors.push(err15);
}
errors++;
}
}
var _valid1 = _errs28 === errors;
valid5 = valid5 || _valid1;
if (!valid5) {
const _errs45 = errors;
if (errors === _errs45) {
if (Array.isArray(data9)) {
var valid9 = true;
const len3 = data9.length;
for (let i3 = 0; i3 < len3; i3++) {
let data17 = data9[i3];
const _errs47 = errors;
if (errors === _errs47) {
if (data17 && typeof data17 == "object" && !Array.isArray(data17)) {
let missing4;
if (((data17.href === undefined) && (missing4 = "href")) || ((data17.theme === undefined) && (missing4 = "theme"))) {
const err16 = { instancePath: instancePath + "/icon/" + i3, schemaPath: "#/properties/icon/anyOf/1/items/required", keyword: "required", params: { missingProperty: missing4 }, message: "must have required property '" + missing4 + "'" };
if (vErrors === null) {
vErrors = [err16];
}
else {
vErrors.push(err16);
}
errors++;
}
else {
const _errs49 = errors;
for (const key3 in data17) {
if (!(((((key3 === "width") || (key3 === "height")) || (key3 === "href")) || (key3 === "theme")) || (key3 === "scale"))) {
const err17 = { instancePath: instancePath + "/icon/" + i3, schemaPath: "#/properties/icon/anyOf/1/items/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
if (vErrors === null) {
vErrors = [err17];
}
else {
vErrors.push(err17);
}
errors++;
break;
}
}
if (_errs49 === errors) {
if (data17.width !== undefined) {
let data18 = data17.width;
const _errs50 = errors;
if (!((typeof data18 == "number") && (isFinite(data18)))) {
const err18 = { instancePath: instancePath + "/icon/" + i3 + "/width", schemaPath: "#/properties/icon/anyOf/1/items/properties/width/type", keyword: "type", params: { type: "number" }, message: "must be number" };
if (vErrors === null) {
vErrors = [err18];
}
else {
vErrors.push(err18);
}
errors++;
}
var valid10 = _errs50 === errors;
}
else {
var valid10 = true;
}
if (valid10) {
if (data17.height !== undefined) {
let data19 = data17.height;
const _errs52 = errors;
if (!((typeof data19 == "number") && (isFinite(data19)))) {
const err19 = { instancePath: instancePath + "/icon/" + i3 + "/height", schemaPath: "#/properties/icon/anyOf/1/items/properties/height/type", keyword: "type", params: { type: "number" }, message: "must be number" };
if (vErrors === null) {
vErrors = [err19];
}
else {
vErrors.push(err19);
}
errors++;
}
var valid10 = _errs52 === errors;
}
else {
var valid10 = true;
}
if (valid10) {
if (data17.href !== undefined) {
const _errs54 = errors;
if (typeof data17.href !== "string") {
const err20 = { instancePath: instancePath + "/icon/" + i3 + "/href", schemaPath: "#/properties/icon/anyOf/1/items/properties/href/type", keyword: "type", params: { type: "string" }, message: "must be string" };
if (vErrors === null) {
vErrors = [err20];
}
else {
vErrors.push(err20);
}
errors++;
}
var valid10 = _errs54 === errors;
}
else {