UNPKG

@keymanapp/common-types

Version:

Keyman Developer keyboard file types

628 lines (626 loc) 46.4 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]="bc58d758-9353-5a5d-bb1e-6fe4aa08b826")}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/kvks.schema.validator.cjs var require_kvks_schema_validator = __commonJS({ "obj/schemas/kvks.schema.validator.cjs"(exports, module) { module.exports = validate20; module.exports.default = validate20; var schema24 = { "type": "string", "pattern": "(\\d+\\.)+(\\d+)", "enum": ["10.0"] }; var pattern0 = new RegExp("(\\d+\\.)+(\\d+)", "u"); 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 === "key102" || key0 === "displayunderlying" || key0 === "usealtgr" || key0 === "useunderlying")) { validate22.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs1 === errors) { if (data.key102 !== void 0) { const _errs2 = errors; if (typeof data.key102 !== "string") { validate22.errors = [{ instancePath: instancePath + "/key102", schemaPath: "#/definitions/km-empty/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs2 === errors; } else { var valid0 = true; } if (valid0) { if (data.displayunderlying !== void 0) { const _errs5 = errors; if (typeof data.displayunderlying !== "string") { validate22.errors = [{ instancePath: instancePath + "/displayunderlying", schemaPath: "#/definitions/km-empty/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs5 === errors; } else { var valid0 = true; } if (valid0) { if (data.usealtgr !== void 0) { const _errs8 = errors; if (typeof data.usealtgr !== "string") { validate22.errors = [{ instancePath: instancePath + "/usealtgr", schemaPath: "#/definitions/km-empty/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs8 === errors; } else { var valid0 = true; } if (valid0) { if (data.useunderlying !== void 0) { const _errs11 = errors; if (typeof data.useunderlying !== "string") { validate22.errors = [{ instancePath: instancePath + "/useunderlying", schemaPath: "#/definitions/km-empty/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs11 === 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 validate21(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.version === void 0 && (missing0 = "version")) { validate21.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 === "version" || key0 === "kbdname" || key0 === "flags" || key0 === "layout")) { validate21.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs1 === errors) { if (data.version !== void 0) { let data0 = data.version; const _errs2 = errors; const _errs3 = errors; if (!(data0 === "10.0")) { validate21.errors = [{ instancePath: instancePath + "/version", schemaPath: "#/definitions/kvk-version/enum", keyword: "enum", params: { allowedValues: schema24.enum }, message: "must be equal to one of the allowed values" }]; return false; } if (errors === _errs3) { if (typeof data0 === "string") { if (!pattern0.test(data0)) { validate21.errors = [{ instancePath: instancePath + "/version", schemaPath: "#/definitions/kvk-version/pattern", keyword: "pattern", params: { pattern: "(\\d+\\.)+(\\d+)" }, message: 'must match pattern "(\\d+\\.)+(\\d+)"' }]; return false; } } else { validate21.errors = [{ instancePath: instancePath + "/version", schemaPath: "#/definitions/kvk-version/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } } var valid0 = _errs2 === errors; } else { var valid0 = true; } if (valid0) { if (data.kbdname !== void 0) { const _errs5 = errors; if (typeof data.kbdname !== "string") { validate21.errors = [{ instancePath: instancePath + "/kbdname", schemaPath: "#/properties/kbdname/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs5 === errors; } else { var valid0 = true; } if (valid0) { if (data.flags !== void 0) { const _errs7 = errors; if (!validate22(data.flags, { instancePath: instancePath + "/flags", parentData: data, parentDataProperty: "flags", rootData })) { vErrors = vErrors === null ? validate22.errors : vErrors.concat(validate22.errors); errors = vErrors.length; } var valid0 = _errs7 === errors; } else { var valid0 = true; } if (valid0) { if (data.layout !== void 0) { const _errs8 = errors; if (typeof data.layout !== "string") { validate21.errors = [{ instancePath: instancePath + "/layout", schemaPath: "#/properties/layout/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs8 === errors; } else { var valid0 = true; } } } } } } } else { validate21.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } validate21.errors = vErrors; return errors === 0; } var schema34 = { "type": "string", "enum": ["ansi", "unicode"] }; var pattern1 = new RegExp("S?(C|LC|RC)?(A|LA|RA)?", "u"); function validate26(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.$ === void 0 && (missing0 = "$")) { validate26.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 === "key" || key0 === "$")) { validate26.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs1 === errors) { if (data.key !== void 0) { let data0 = data.key; const _errs2 = errors; if (errors === _errs2) { if (Array.isArray(data0)) { var valid1 = true; const len0 = data0.length; for (let i0 = 0; i0 < len0; i0++) { let data1 = data0[i0]; const _errs4 = errors; const _errs5 = errors; if (errors === _errs5) { if (data1 && typeof data1 == "object" && !Array.isArray(data1)) { let missing1; if (data1.$ === void 0 && (missing1 = "$")) { validate26.errors = [{ instancePath: instancePath + "/key/" + i0, schemaPath: "#/definitions/kvk-key/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }]; return false; } else { const _errs7 = errors; for (const key1 in data1) { if (!(key1 === "bitmap" || key1 === "$" || key1 === "_")) { validate26.errors = [{ instancePath: instancePath + "/key/" + i0, schemaPath: "#/definitions/kvk-key/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs7 === errors) { if (data1.bitmap !== void 0) { const _errs8 = errors; if (typeof data1.bitmap !== "string") { validate26.errors = [{ instancePath: instancePath + "/key/" + i0 + "/bitmap", schemaPath: "#/definitions/kvk-key/properties/bitmap/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid3 = _errs8 === errors; } else { var valid3 = true; } if (valid3) { if (data1.$ !== void 0) { let data3 = data1.$; const _errs10 = errors; if (errors === _errs10) { if (data3 && typeof data3 == "object" && !Array.isArray(data3)) { let missing2; if (data3.vkey === void 0 && (missing2 = "vkey")) { validate26.errors = [{ instancePath: instancePath + "/key/" + i0 + "/$", schemaPath: "#/definitions/kvk-key/properties/%24/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }]; return false; } else { const _errs12 = errors; for (const key2 in data3) { if (!(key2 === "vkey")) { validate26.errors = [{ instancePath: instancePath + "/key/" + i0 + "/$", schemaPath: "#/definitions/kvk-key/properties/%24/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs12 === errors) { if (data3.vkey !== void 0) { if (typeof data3.vkey !== "string") { validate26.errors = [{ instancePath: instancePath + "/key/" + i0 + "/$/vkey", schemaPath: "#/definitions/kvk-key/properties/%24/properties/vkey/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } } } } } else { validate26.errors = [{ instancePath: instancePath + "/key/" + i0 + "/$", schemaPath: "#/definitions/kvk-key/properties/%24/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } var valid3 = _errs10 === errors; } else { var valid3 = true; } if (valid3) { if (data1._ !== void 0) { const _errs15 = errors; if (typeof data1._ !== "string") { validate26.errors = [{ instancePath: instancePath + "/key/" + i0 + "/_", schemaPath: "#/definitions/kvk-key/properties/_/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid3 = _errs15 === errors; } else { var valid3 = true; } } } } } } else { validate26.errors = [{ instancePath: instancePath + "/key/" + i0, schemaPath: "#/definitions/kvk-key/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } var valid1 = _errs4 === errors; if (!valid1) { break; } } } else { validate26.errors = [{ instancePath: instancePath + "/key", schemaPath: "#/properties/key/type", keyword: "type", params: { type: "array" }, message: "must be array" }]; return false; } } var valid0 = _errs2 === errors; } else { var valid0 = true; } if (valid0) { if (data.$ !== void 0) { let data6 = data.$; const _errs17 = errors; if (errors === _errs17) { if (data6 && typeof data6 == "object" && !Array.isArray(data6)) { let missing3; if (data6.shift === void 0 && (missing3 = "shift")) { validate26.errors = [{ instancePath: instancePath + "/$", schemaPath: "#/properties/%24/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" }]; return false; } else { const _errs19 = errors; for (const key3 in data6) { if (!(key3 === "shift")) { validate26.errors = [{ instancePath: instancePath + "/$", schemaPath: "#/properties/%24/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs19 === errors) { if (data6.shift !== void 0) { let data7 = data6.shift; const _errs21 = errors; if (errors === _errs21) { if (typeof data7 === "string") { if (!pattern1.test(data7)) { validate26.errors = [{ instancePath: instancePath + "/$/shift", schemaPath: "#/definitions/kvk-layer-shift/pattern", keyword: "pattern", params: { pattern: "S?(C|LC|RC)?(A|LA|RA)?" }, message: 'must match pattern "S?(C|LC|RC)?(A|LA|RA)?"' }]; return false; } } else { validate26.errors = [{ instancePath: instancePath + "/$/shift", schemaPath: "#/definitions/kvk-layer-shift/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } } } } } } else { validate26.errors = [{ instancePath: instancePath + "/$", schemaPath: "#/properties/%24/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } var valid0 = _errs17 === errors; } else { var valid0 = true; } } } } } else { validate26.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } validate26.errors = vErrors; return errors === 0; } function validate25(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.$ === void 0 && (missing0 = "$")) { validate25.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 === "layer" || key0 === "$")) { validate25.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs1 === errors) { if (data.layer !== void 0) { let data0 = data.layer; const _errs2 = errors; if (errors === _errs2) { if (Array.isArray(data0)) { var valid1 = true; const len0 = data0.length; for (let i0 = 0; i0 < len0; i0++) { const _errs4 = errors; if (!validate26(data0[i0], { instancePath: instancePath + "/layer/" + i0, parentData: data0, parentDataProperty: i0, rootData })) { vErrors = vErrors === null ? validate26.errors : vErrors.concat(validate26.errors); errors = vErrors.length; } var valid1 = _errs4 === errors; if (!valid1) { break; } } } else { validate25.errors = [{ instancePath: instancePath + "/layer", schemaPath: "#/properties/layer/type", keyword: "type", params: { type: "array" }, message: "must be array" }]; return false; } } var valid0 = _errs2 === errors; } else { var valid0 = true; } if (valid0) { if (data.$ !== void 0) { let data2 = data.$; const _errs5 = errors; if (errors === _errs5) { if (data2 && typeof data2 == "object" && !Array.isArray(data2)) { let missing1; if (data2.name === void 0 && (missing1 = "name")) { validate25.errors = [{ instancePath: instancePath + "/$", schemaPath: "#/properties/%24/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }]; return false; } else { const _errs7 = errors; for (const key1 in data2) { if (!(key1 === "name" || key1 === "fontname" || key1 === "fontsize")) { validate25.errors = [{ instancePath: instancePath + "/$", schemaPath: "#/properties/%24/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs7 === errors) { if (data2.name !== void 0) { let data3 = data2.name; const _errs8 = errors; if (typeof data3 !== "string") { validate25.errors = [{ instancePath: instancePath + "/$/name", schemaPath: "#/definitions/kvk-encoding-name/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } if (!(data3 === "ansi" || data3 === "unicode")) { validate25.errors = [{ instancePath: instancePath + "/$/name", schemaPath: "#/definitions/kvk-encoding-name/enum", keyword: "enum", params: { allowedValues: schema34.enum }, message: "must be equal to one of the allowed values" }]; return false; } var valid2 = _errs8 === errors; } else { var valid2 = true; } if (valid2) { if (data2.fontname !== void 0) { const _errs11 = errors; if (typeof data2.fontname !== "string") { validate25.errors = [{ instancePath: instancePath + "/$/fontname", schemaPath: "#/properties/%24/properties/fontname/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid2 = _errs11 === errors; } else { var valid2 = true; } if (valid2) { if (data2.fontsize !== void 0) { const _errs13 = errors; if (typeof data2.fontsize !== "string") { validate25.errors = [{ instancePath: instancePath + "/$/fontsize", schemaPath: "#/properties/%24/properties/fontsize/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid2 = _errs13 === errors; } else { var valid2 = true; } } } } } } else { validate25.errors = [{ instancePath: instancePath + "/$", schemaPath: "#/properties/%24/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } var valid0 = _errs5 === errors; } else { var valid0 = true; } } } } } else { validate25.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } validate25.errors = vErrors; return errors === 0; } function validate20(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.visualkeyboard === void 0 && (missing0 = "visualkeyboard")) { validate20.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 === "visualkeyboard")) { validate20.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs1 === errors) { if (data.visualkeyboard !== void 0) { let data0 = data.visualkeyboard; const _errs2 = errors; if (errors === _errs2) { if (data0 && typeof data0 == "object" && !Array.isArray(data0)) { let missing1; if (data0.header === void 0 && (missing1 = "header")) { validate20.errors = [{ instancePath: instancePath + "/visualkeyboard", schemaPath: "#/properties/visualkeyboard/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }]; return false; } else { const _errs4 = errors; for (const key1 in data0) { if (!(key1 === "header" || key1 === "encoding")) { validate20.errors = [{ instancePath: instancePath + "/visualkeyboard", schemaPath: "#/properties/visualkeyboard/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs4 === errors) { if (data0.header !== void 0) { const _errs5 = errors; if (!validate21(data0.header, { instancePath: instancePath + "/visualkeyboard/header", parentData: data0, parentDataProperty: "header", rootData })) { vErrors = vErrors === null ? validate21.errors : vErrors.concat(validate21.errors); errors = vErrors.length; } var valid1 = _errs5 === errors; } else { var valid1 = true; } if (valid1) { if (data0.encoding !== void 0) { let data2 = data0.encoding; const _errs6 = errors; if (errors === _errs6) { if (Array.isArray(data2)) { var valid2 = true; const len0 = data2.length; for (let i0 = 0; i0 < len0; i0++) { const _errs8 = errors; if (!validate25(data2[i0], { instancePath: instancePath + "/visualkeyboard/encoding/" + i0, parentData: data2, parentDataProperty: i0, rootData })) { vErrors = vErrors === null ? validate25.errors : vErrors.concat(validate25.errors); errors = vErrors.length; } var valid2 = _errs8 === errors; if (!valid2) { break; } } } else { validate20.errors = [{ instancePath: instancePath + "/visualkeyboard/encoding", schemaPath: "#/properties/visualkeyboard/properties/encoding/type", keyword: "type", params: { type: "array" }, message: "must be array" }]; return false; } } var valid1 = _errs6 === errors; } else { var valid1 = true; } } } } } else { validate20.errors = [{ instancePath: instancePath + "/visualkeyboard", schemaPath: "#/properties/visualkeyboard/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } } } } } else { validate20.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } validate20.errors = vErrors; return errors === 0; } } }); export default require_kvks_schema_validator(); //# sourceMappingURL=kvks.schema.validator.mjs.map //# debugId=bc58d758-9353-5a5d-bb1e-6fe4aa08b826