UNPKG

@keymanapp/common-types

Version:

Keyman Developer keyboard file types

550 lines (549 loc) 139 kB
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f14785aa-752a-56d4-92eb-5bd9f4af215d")}catch(e){}}(); var __getOwnPropNames = Object.getOwnPropertyNames; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; // obj/schemas/kmp.schema.validator.cjs var require_kmp_schema_validator = __commonJS({ "obj/schemas/kmp.schema.validator.cjs"(exports, module) { module.exports = validate20; module.exports.default = validate20; var schema23 = { "type": "object", "properties": { "system": { "$ref": "#/definitions/system" }, "options": { "$ref": "#/definitions/options" }, "startMenu": { "$ref": "#/definitions/startMenu" }, "strings": { "$ref": "#/definitions/strings" }, "files": { "$ref": "#/definitions/files" }, "keyboards": { "$ref": "#/definitions/keyboards" }, "lexicalModels": { "$ref": "#/definitions/lexicalModels" }, "info": { "$ref": "#/definitions/info" }, "relatedPackages": { "type": "array", "items": { "$ref": "#/definitions/relatedPackage" } } }, "additionalProperties": false, "required": ["options", "system"] }; var schema45 = { "type": "object", "properties": { "id": { "type": "string" }, "relationship": { "type": "string", "enum": ["deprecates", "related"] } }, "additionalProperties": false, "required": ["id", "relationship"] }; var func4 = Object.prototype.hasOwnProperty; function validate22(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (errors === 0) { if (data && typeof data == "object" && !Array.isArray(data)) { const _errs1 = errors; for (const key0 in data) { if (!(key0 === "folder" || key0 === "addUninstallEntry" || key0 === "items")) { validate22.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs1 === errors) { if (data.folder !== void 0) { const _errs2 = errors; if (typeof data.folder !== "string") { validate22.errors = [{ instancePath: instancePath + "/folder", schemaPath: "#/properties/folder/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs2 === errors; } else { var valid0 = true; } if (valid0) { if (data.addUninstallEntry !== void 0) { const _errs4 = errors; if (typeof data.addUninstallEntry !== "boolean") { validate22.errors = [{ instancePath: instancePath + "/addUninstallEntry", schemaPath: "#/properties/addUninstallEntry/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" }]; return false; } var valid0 = _errs4 === errors; } else { var valid0 = true; } if (valid0) { if (data.items !== void 0) { let data2 = data.items; const _errs6 = errors; if (errors === _errs6) { if (Array.isArray(data2)) { var valid1 = true; const len0 = data2.length; for (let i0 = 0; i0 < len0; i0++) { let data3 = data2[i0]; const _errs8 = errors; const _errs9 = errors; if (errors === _errs9) { if (data3 && typeof data3 == "object" && !Array.isArray(data3)) { let missing0; if (data3.name === void 0 && (missing0 = "name") || data3.filename === void 0 && (missing0 = "filename")) { validate22.errors = [{ instancePath: instancePath + "/items/" + i0, schemaPath: "#/definitions/startMenuItem/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }]; return false; } else { const _errs11 = errors; for (const key1 in data3) { if (!(key1 === "name" || key1 === "filename" || key1 === "arguments" || key1 === "icon" || key1 === "location")) { validate22.errors = [{ instancePath: instancePath + "/items/" + i0, schemaPath: "#/definitions/startMenuItem/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs11 === errors) { if (data3.name !== void 0) { const _errs12 = errors; if (typeof data3.name !== "string") { validate22.errors = [{ instancePath: instancePath + "/items/" + i0 + "/name", schemaPath: "#/definitions/startMenuItem/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid3 = _errs12 === errors; } else { var valid3 = true; } if (valid3) { if (data3.filename !== void 0) { const _errs14 = errors; if (typeof data3.filename !== "string") { validate22.errors = [{ instancePath: instancePath + "/items/" + i0 + "/filename", schemaPath: "#/definitions/startMenuItem/properties/filename/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid3 = _errs14 === errors; } else { var valid3 = true; } if (valid3) { if (data3.arguments !== void 0) { const _errs16 = errors; if (typeof data3.arguments !== "string") { validate22.errors = [{ instancePath: instancePath + "/items/" + i0 + "/arguments", schemaPath: "#/definitions/startMenuItem/properties/arguments/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid3 = _errs16 === errors; } else { var valid3 = true; } if (valid3) { if (data3.icon !== void 0) { const _errs18 = errors; if (typeof data3.icon !== "string") { validate22.errors = [{ instancePath: instancePath + "/items/" + i0 + "/icon", schemaPath: "#/definitions/startMenuItem/properties/icon/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid3 = _errs18 === errors; } else { var valid3 = true; } if (valid3) { if (data3.location !== void 0) { let data8 = data3.location; const _errs20 = errors; if (!(typeof data8 == "number" && isFinite(data8))) { validate22.errors = [{ instancePath: instancePath + "/items/" + i0 + "/location", schemaPath: "#/definitions/startMenuItem/properties/location/type", keyword: "type", params: { type: "number" }, message: "must be number" }]; return false; } var valid3 = _errs20 === errors; } else { var valid3 = true; } } } } } } } } else { validate22.errors = [{ instancePath: instancePath + "/items/" + i0, schemaPath: "#/definitions/startMenuItem/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } var valid1 = _errs8 === errors; if (!valid1) { break; } } } else { validate22.errors = [{ instancePath: instancePath + "/items", schemaPath: "#/properties/items/type", keyword: "type", params: { type: "array" }, message: "must be array" }]; return false; } } var valid0 = _errs6 === errors; } else { var valid0 = true; } } } } } else { validate22.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } validate22.errors = vErrors; return errors === 0; } function validate24(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (errors === 0) { if (Array.isArray(data)) { var valid0 = true; const len0 = data.length; for (let i0 = 0; i0 < len0; i0++) { let data0 = data[i0]; const _errs1 = errors; const _errs2 = errors; if (errors === _errs2) { if (data0 && typeof data0 == "object" && !Array.isArray(data0)) { let missing0; if (data0.name === void 0 && (missing0 = "name") || data0.description === void 0 && (missing0 = "description")) { validate24.errors = [{ instancePath: instancePath + "/" + i0, schemaPath: "#/definitions/file/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }]; return false; } else { const _errs4 = errors; for (const key0 in data0) { if (!(key0 === "name" || key0 === "description" || key0 === "copyLocation")) { validate24.errors = [{ instancePath: instancePath + "/" + i0, schemaPath: "#/definitions/file/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs4 === errors) { if (data0.name !== void 0) { const _errs5 = errors; if (typeof data0.name !== "string") { validate24.errors = [{ instancePath: instancePath + "/" + i0 + "/name", schemaPath: "#/definitions/file/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid2 = _errs5 === errors; } else { var valid2 = true; } if (valid2) { if (data0.description !== void 0) { const _errs7 = errors; if (typeof data0.description !== "string") { validate24.errors = [{ instancePath: instancePath + "/" + i0 + "/description", schemaPath: "#/definitions/file/properties/description/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid2 = _errs7 === errors; } else { var valid2 = true; } if (valid2) { if (data0.copyLocation !== void 0) { let data3 = data0.copyLocation; const _errs9 = errors; if (!(typeof data3 == "number" && isFinite(data3))) { validate24.errors = [{ instancePath: instancePath + "/" + i0 + "/copyLocation", schemaPath: "#/definitions/file/properties/copyLocation/type", keyword: "type", params: { type: "number" }, message: "must be number" }]; return false; } var valid2 = _errs9 === errors; } else { var valid2 = true; } } } } } } else { validate24.errors = [{ instancePath: instancePath + "/" + i0, schemaPath: "#/definitions/file/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } var valid0 = _errs1 === errors; if (!valid0) { break; } } } else { validate24.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "array" }, message: "must be array" }]; return false; } } validate24.errors = vErrors; return errors === 0; } var schema32 = { "type": "object", "properties": { "name": { "type": "string" }, "id": { "type": "string" }, "version": { "type": "string" }, "oskFont": { "type": "string" }, "displayFont": { "type": "string" }, "rtl": { "type": "boolean" }, "languages": { "type": "array", "items": { "$ref": "#/definitions/keyboardLanguage" } }, "examples": { "type": "array", "items": { "$ref": "#/definitions/keyboardExample" } }, "webOskFonts": { "type": "array", "items": { "type": "string" } }, "webDisplayFonts": { "type": "array", "items": { "type": "string" } } }, "additionalProperties": false, "required": ["name", "id", "version"] }; function validate27(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (errors === 0) { if (data && typeof data == "object" && !Array.isArray(data)) { let missing0; if (data.name === void 0 && (missing0 = "name") || data.id === void 0 && (missing0 = "id") || data.version === void 0 && (missing0 = "version")) { validate27.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 (!func4.call(schema32.properties, key0)) { validate27.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs1 === errors) { if (data.name !== void 0) { const _errs2 = errors; if (typeof data.name !== "string") { validate27.errors = [{ instancePath: instancePath + "/name", schemaPath: "#/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs2 === errors; } else { var valid0 = true; } if (valid0) { if (data.id !== void 0) { const _errs4 = errors; if (typeof data.id !== "string") { validate27.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs4 === errors; } else { var valid0 = true; } if (valid0) { if (data.version !== void 0) { const _errs6 = errors; if (typeof data.version !== "string") { validate27.errors = [{ instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs6 === errors; } else { var valid0 = true; } if (valid0) { if (data.oskFont !== void 0) { const _errs8 = errors; if (typeof data.oskFont !== "string") { validate27.errors = [{ instancePath: instancePath + "/oskFont", schemaPath: "#/properties/oskFont/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs8 === errors; } else { var valid0 = true; } if (valid0) { if (data.displayFont !== void 0) { const _errs10 = errors; if (typeof data.displayFont !== "string") { validate27.errors = [{ instancePath: instancePath + "/displayFont", schemaPath: "#/properties/displayFont/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs10 === errors; } else { var valid0 = true; } if (valid0) { if (data.rtl !== void 0) { const _errs12 = errors; if (typeof data.rtl !== "boolean") { validate27.errors = [{ instancePath: instancePath + "/rtl", schemaPath: "#/properties/rtl/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" }]; return false; } var valid0 = _errs12 === errors; } else { var valid0 = true; } if (valid0) { if (data.languages !== void 0) { let data6 = data.languages; const _errs14 = errors; if (errors === _errs14) { if (Array.isArray(data6)) { var valid1 = true; const len0 = data6.length; for (let i0 = 0; i0 < len0; i0++) { let data7 = data6[i0]; const _errs16 = errors; const _errs17 = errors; if (errors === _errs17) { if (data7 && typeof data7 == "object" && !Array.isArray(data7)) { let missing1; if (data7.id === void 0 && (missing1 = "id") || data7.name === void 0 && (missing1 = "name")) { validate27.errors = [{ instancePath: instancePath + "/languages/" + i0, schemaPath: "#/definitions/keyboardLanguage/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }]; return false; } else { const _errs19 = errors; for (const key1 in data7) { if (!(key1 === "name" || key1 === "id")) { validate27.errors = [{ instancePath: instancePath + "/languages/" + i0, schemaPath: "#/definitions/keyboardLanguage/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs19 === errors) { if (data7.name !== void 0) { const _errs20 = errors; if (typeof data7.name !== "string") { validate27.errors = [{ instancePath: instancePath + "/languages/" + i0 + "/name", schemaPath: "#/definitions/keyboardLanguage/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid3 = _errs20 === errors; } else { var valid3 = true; } if (valid3) { if (data7.id !== void 0) { const _errs22 = errors; if (typeof data7.id !== "string") { validate27.errors = [{ instancePath: instancePath + "/languages/" + i0 + "/id", schemaPath: "#/definitions/keyboardLanguage/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid3 = _errs22 === errors; } else { var valid3 = true; } } } } } else { validate27.errors = [{ instancePath: instancePath + "/languages/" + i0, schemaPath: "#/definitions/keyboardLanguage/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } var valid1 = _errs16 === errors; if (!valid1) { break; } } } else { validate27.errors = [{ instancePath: instancePath + "/languages", schemaPath: "#/properties/languages/type", keyword: "type", params: { type: "array" }, message: "must be array" }]; return false; } } var valid0 = _errs14 === errors; } else { var valid0 = true; } if (valid0) { if (data.examples !== void 0) { let data10 = data.examples; const _errs24 = errors; if (errors === _errs24) { if (Array.isArray(data10)) { var valid4 = true; const len1 = data10.length; for (let i1 = 0; i1 < len1; i1++) { let data11 = data10[i1]; const _errs26 = errors; const _errs27 = errors; if (errors === _errs27) { if (data11 && typeof data11 == "object" && !Array.isArray(data11)) { let missing2; if (data11.id === void 0 && (missing2 = "id") || data11.keys === void 0 && (missing2 = "keys")) { validate27.errors = [{ instancePath: instancePath + "/examples/" + i1, schemaPath: "#/definitions/keyboardExample/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }]; return false; } else { const _errs29 = errors; for (const key2 in data11) { if (!(key2 === "id" || key2 === "keys" || key2 === "text" || key2 === "note")) { validate27.errors = [{ instancePath: instancePath + "/examples/" + i1, schemaPath: "#/definitions/keyboardExample/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs29 === errors) { if (data11.id !== void 0) { const _errs30 = errors; if (typeof data11.id !== "string") { validate27.errors = [{ instancePath: instancePath + "/examples/" + i1 + "/id", schemaPath: "#/definitions/keyboardExample/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid6 = _errs30 === errors; } else { var valid6 = true; } if (valid6) { if (data11.keys !== void 0) { const _errs32 = errors; if (typeof data11.keys !== "string") { validate27.errors = [{ instancePath: instancePath + "/examples/" + i1 + "/keys", schemaPath: "#/definitions/keyboardExample/properties/keys/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid6 = _errs32 === errors; } else { var valid6 = true; } if (valid6) { if (data11.text !== void 0) { const _errs34 = errors; if (typeof data11.text !== "string") { validate27.errors = [{ instancePath: instancePath + "/examples/" + i1 + "/text", schemaPath: "#/definitions/keyboardExample/properties/text/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid6 = _errs34 === errors; } else { var valid6 = true; } if (valid6) { if (data11.note !== void 0) { const _errs36 = errors; if (typeof data11.note !== "string") { validate27.errors = [{ instancePath: instancePath + "/examples/" + i1 + "/note", schemaPath: "#/definitions/keyboardExample/properties/note/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid6 = _errs36 === errors; } else { var valid6 = true; } } } } } } } else { validate27.errors = [{ instancePath: instancePath + "/examples/" + i1, schemaPath: "#/definitions/keyboardExample/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } var valid4 = _errs26 === errors; if (!valid4) { break; } } } else { validate27.errors = [{ instancePath: instancePath + "/examples", schemaPath: "#/properties/examples/type", keyword: "type", params: { type: "array" }, message: "must be array" }]; return false; } } var valid0 = _errs24 === errors; } else { var valid0 = true; } if (valid0) { if (data.webOskFonts !== void 0) { let data16 = data.webOskFonts; const _errs38 = errors; if (errors === _errs38) { if (Array.isArray(data16)) { var valid7 = true; const len2 = data16.length; for (let i2 = 0; i2 < len2; i2++) { const _errs40 = errors