UNPKG

@keymanapp/common-types

Version:

Keyman Developer keyboard file types

551 lines (550 loc) 58.6 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]="1a1116a7-e7ea-541b-ab97-f2cdec2ef7fb")}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/kpj-9.0.schema.validator.cjs var require_kpj_9_0_schema_validator = __commonJS({ "obj/schemas/kpj-9.0.schema.validator.cjs"(exports, module) { module.exports = validate20; module.exports.default = validate20; var pattern0 = new RegExp("^(True|False)$", "u"); var pattern3 = new RegExp("^(keyboard|lexicalmodel)$", "u"); var pattern4 = new RegExp("^(1\\.0|2\\.0)$", "u"); var schema25 = { "type": "object", "properties": { "ID": { "type": "string" }, "Filename": { "type": "string" }, "Filepath": { "type": "string" }, "FileVersion": { "type": "string" }, "FileType": { "type": "string" }, "Details": { "$ref": "#/definitions/FileDetails" }, "ParentFileID": { "type": "string" }, "FullPath": { "type": "string", "$comment": "Keyman Developer 9, no longer used in modern .kpj files" }, "IDEState": { "type": "object", "$comment": "Keyman Developer 9, no longer used in modern .kpj files" } }, "required": ["Filename"], "additionalProperties": false }; 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)) { let missing0; if (data.Filename === void 0 && (missing0 = "Filename")) { validate22.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(schema25.properties, key0)) { validate22.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs1 === errors) { if (data.ID !== void 0) { const _errs2 = errors; if (typeof data.ID !== "string") { validate22.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.Filename !== void 0) { const _errs4 = errors; if (typeof data.Filename !== "string") { validate22.errors = [{ instancePath: instancePath + "/Filename", schemaPath: "#/properties/Filename/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs4 === errors; } else { var valid0 = true; } if (valid0) { if (data.Filepath !== void 0) { const _errs6 = errors; if (typeof data.Filepath !== "string") { validate22.errors = [{ instancePath: instancePath + "/Filepath", schemaPath: "#/properties/Filepath/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs6 === errors; } else { var valid0 = true; } if (valid0) { if (data.FileVersion !== void 0) { const _errs8 = errors; if (typeof data.FileVersion !== "string") { validate22.errors = [{ instancePath: instancePath + "/FileVersion", schemaPath: "#/properties/FileVersion/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs8 === errors; } else { var valid0 = true; } if (valid0) { if (data.FileType !== void 0) { const _errs10 = errors; if (typeof data.FileType !== "string") { validate22.errors = [{ instancePath: instancePath + "/FileType", schemaPath: "#/properties/FileType/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs10 === errors; } else { var valid0 = true; } if (valid0) { if (data.Details !== void 0) { let data5 = data.Details; const _errs12 = errors; const _errs13 = errors; if (errors === _errs13) { if (data5 && typeof data5 == "object" && !Array.isArray(data5)) { const _errs15 = errors; for (const key1 in data5) { if (!(key1 === "Name" || key1 === "Copyright" || key1 === "Message" || key1 === "Version" || key1 === "Debug")) { validate22.errors = [{ instancePath: instancePath + "/Details", schemaPath: "#/definitions/FileDetails/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs15 === errors) { if (data5.Name !== void 0) { const _errs16 = errors; if (typeof data5.Name !== "string") { validate22.errors = [{ instancePath: instancePath + "/Details/Name", schemaPath: "#/definitions/FileDetails/properties/Name/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid2 = _errs16 === errors; } else { var valid2 = true; } if (valid2) { if (data5.Copyright !== void 0) { const _errs18 = errors; if (typeof data5.Copyright !== "string") { validate22.errors = [{ instancePath: instancePath + "/Details/Copyright", schemaPath: "#/definitions/FileDetails/properties/Copyright/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid2 = _errs18 === errors; } else { var valid2 = true; } if (valid2) { if (data5.Message !== void 0) { const _errs20 = errors; if (typeof data5.Message !== "string") { validate22.errors = [{ instancePath: instancePath + "/Details/Message", schemaPath: "#/definitions/FileDetails/properties/Message/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid2 = _errs20 === errors; } else { var valid2 = true; } if (valid2) { if (data5.Version !== void 0) { const _errs22 = errors; if (typeof data5.Version !== "string") { validate22.errors = [{ instancePath: instancePath + "/Details/Version", schemaPath: "#/definitions/FileDetails/properties/Version/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid2 = _errs22 === errors; } else { var valid2 = true; } if (valid2) { if (data5.Debug !== void 0) { const _errs24 = errors; if (typeof data5.Debug !== "string") { validate22.errors = [{ instancePath: instancePath + "/Details/Debug", schemaPath: "#/definitions/FileDetails/properties/Debug/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid2 = _errs24 === errors; } else { var valid2 = true; } } } } } } } else { validate22.errors = [{ instancePath: instancePath + "/Details", schemaPath: "#/definitions/FileDetails/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } var valid0 = _errs12 === errors; } else { var valid0 = true; } if (valid0) { if (data.ParentFileID !== void 0) { const _errs27 = errors; if (typeof data.ParentFileID !== "string") { validate22.errors = [{ instancePath: instancePath + "/ParentFileID", schemaPath: "#/properties/ParentFileID/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs27 === errors; } else { var valid0 = true; } if (valid0) { if (data.FullPath !== void 0) { const _errs29 = errors; if (typeof data.FullPath !== "string") { validate22.errors = [{ instancePath: instancePath + "/FullPath", schemaPath: "#/properties/FullPath/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs29 === errors; } else { var valid0 = true; } if (valid0) { if (data.IDEState !== void 0) { let data13 = data.IDEState; const _errs32 = errors; if (!(data13 && typeof data13 == "object" && !Array.isArray(data13))) { validate22.errors = [{ instancePath: instancePath + "/IDEState", schemaPath: "#/properties/IDEState/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } var valid0 = _errs32 === 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.File === void 0 && (missing0 = "File")) { 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 === "File")) { validate21.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs1 === errors) { if (data.File !== void 0) { let data0 = data.File; 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 (!validate22(data0[i0], { instancePath: instancePath + "/File/" + i0, parentData: data0, parentDataProperty: i0, rootData })) { vErrors = vErrors === null ? validate22.errors : vErrors.concat(validate22.errors); errors = vErrors.length; } var valid1 = _errs4 === errors; if (!valid1) { break; } } } else { validate21.errors = [{ instancePath: instancePath + "/File", schemaPath: "#/properties/File/type", keyword: "type", params: { type: "array" }, message: "must be array" }]; return false; } } } } } } else { validate21.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } validate21.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.KeymanDeveloperProject === void 0 && (missing0 = "KeymanDeveloperProject")) { 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 === "KeymanDeveloperProject")) { validate20.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs1 === errors) { if (data.KeymanDeveloperProject !== void 0) { let data0 = data.KeymanDeveloperProject; const _errs2 = errors; if (errors === _errs2) { if (data0 && typeof data0 == "object" && !Array.isArray(data0)) { const _errs4 = errors; for (const key1 in data0) { if (!(key1 === "Options" || key1 === "Files" || key1 === "templatepath" || key1 === "stringspath" || key1 === "state" || key1 === "Modules" || key1 === "MRU")) { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject", schemaPath: "#/properties/KeymanDeveloperProject/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs4 === errors) { if (data0.Options !== void 0) { let data1 = data0.Options; const _errs5 = errors; const _errs6 = errors; if (errors === _errs6) { if (data1 && typeof data1 == "object" && !Array.isArray(data1)) { const _errs8 = errors; for (const key2 in data1) { if (!(key2 === "BuildPath" || key2 === "SourcePath" || key2 === "CompilerWarningsAsErrors" || key2 === "WarnDeprecatedCode" || key2 === "CheckFilenameConventions" || key2 === "ProjectType" || key2 === "Version")) { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options", schemaPath: "#/definitions/Options/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs8 === errors) { if (data1.BuildPath !== void 0) { const _errs9 = errors; if (typeof data1.BuildPath !== "string") { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options/BuildPath", schemaPath: "#/definitions/Options/properties/BuildPath/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid3 = _errs9 === errors; } else { var valid3 = true; } if (valid3) { if (data1.SourcePath !== void 0) { const _errs11 = errors; if (typeof data1.SourcePath !== "string") { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options/SourcePath", schemaPath: "#/definitions/Options/properties/SourcePath/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid3 = _errs11 === errors; } else { var valid3 = true; } if (valid3) { if (data1.CompilerWarningsAsErrors !== void 0) { let data4 = data1.CompilerWarningsAsErrors; const _errs13 = errors; if (errors === _errs13) { if (typeof data4 === "string") { if (!pattern0.test(data4)) { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options/CompilerWarningsAsErrors", schemaPath: "#/definitions/Options/properties/CompilerWarningsAsErrors/pattern", keyword: "pattern", params: { pattern: "^(True|False)$" }, message: 'must match pattern "^(True|False)$"' }]; return false; } } else { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options/CompilerWarningsAsErrors", schemaPath: "#/definitions/Options/properties/CompilerWarningsAsErrors/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } } var valid3 = _errs13 === errors; } else { var valid3 = true; } if (valid3) { if (data1.WarnDeprecatedCode !== void 0) { let data5 = data1.WarnDeprecatedCode; const _errs15 = errors; if (errors === _errs15) { if (typeof data5 === "string") { if (!pattern0.test(data5)) { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options/WarnDeprecatedCode", schemaPath: "#/definitions/Options/properties/WarnDeprecatedCode/pattern", keyword: "pattern", params: { pattern: "^(True|False)$" }, message: 'must match pattern "^(True|False)$"' }]; return false; } } else { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options/WarnDeprecatedCode", schemaPath: "#/definitions/Options/properties/WarnDeprecatedCode/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } } var valid3 = _errs15 === errors; } else { var valid3 = true; } if (valid3) { if (data1.CheckFilenameConventions !== void 0) { let data6 = data1.CheckFilenameConventions; const _errs17 = errors; if (errors === _errs17) { if (typeof data6 === "string") { if (!pattern0.test(data6)) { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options/CheckFilenameConventions", schemaPath: "#/definitions/Options/properties/CheckFilenameConventions/pattern", keyword: "pattern", params: { pattern: "^(True|False)$" }, message: 'must match pattern "^(True|False)$"' }]; return false; } } else { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options/CheckFilenameConventions", schemaPath: "#/definitions/Options/properties/CheckFilenameConventions/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } } var valid3 = _errs17 === errors; } else { var valid3 = true; } if (valid3) { if (data1.ProjectType !== void 0) { let data7 = data1.ProjectType; const _errs19 = errors; if (errors === _errs19) { if (typeof data7 === "string") { if (!pattern3.test(data7)) { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options/ProjectType", schemaPath: "#/definitions/Options/properties/ProjectType/pattern", keyword: "pattern", params: { pattern: "^(keyboard|lexicalmodel)$" }, message: 'must match pattern "^(keyboard|lexicalmodel)$"' }]; return false; } } else { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options/ProjectType", schemaPath: "#/definitions/Options/properties/ProjectType/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } } var valid3 = _errs19 === errors; } else { var valid3 = true; } if (valid3) { if (data1.Version !== void 0) { let data8 = data1.Version; const _errs21 = errors; if (errors === _errs21) { if (typeof data8 === "string") { if (!pattern4.test(data8)) { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options/Version", schemaPath: "#/definitions/Options/properties/Version/pattern", keyword: "pattern", params: { pattern: "^(1\\.0|2\\.0)$" }, message: 'must match pattern "^(1\\.0|2\\.0)$"' }]; return false; } } else { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options/Version", schemaPath: "#/definitions/Options/properties/Version/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } } var valid3 = _errs21 === errors; } else { var valid3 = true; } } } } } } } } } else { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options", schemaPath: "#/definitions/Options/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } var valid1 = _errs5 === errors; } else { var valid1 = true; } if (valid1) { if (data0.Files !== void 0) { const _errs23 = errors; if (!validate21(data0.Files, { instancePath: instancePath + "/KeymanDeveloperProject/Files", parentData: data0, parentDataProperty: "Files", rootData })) { vErrors = vErrors === null ? validate21.errors : vErrors.concat(validate21.errors); errors = vErrors.length; } var valid1 = _errs23 === errors; } else { var valid1 = true; } if (valid1) { if (data0.templatepath !== void 0) { const _errs24 = errors; if (typeof data0.templatepath !== "string") { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/templatepath", schemaPath: "#/properties/KeymanDeveloperProject/properties/templatepath/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid1 = _errs24 === errors; } else { var valid1 = true; } if (valid1) { if (data0.stringspath !== void 0) { const _errs27 = errors; if (typeof data0.stringspath !== "string") { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/stringspath", schemaPath: "#/properties/KeymanDeveloperProject/properties/stringspath/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid1 = _errs27 === errors; } else { var valid1 = true; } if (valid1) { if (data0.state !== void 0) { const _errs30 = errors; if (typeof data0.state !== "string") { validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/state", schemaPath: "#/properties/KeymanDeveloperProject/properties/state/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid1 = _errs30 === errors; } else { var valid1 = true; } if (valid1) { if (data0.Modules !== void 0) { let data13 = data0.Modules; const _errs33 = errors; const _errs35 = errors; let valid4 = false; let passing0 = null; const _errs36 = errors; if (!(data13 && typeof data13 == "object" && !Array.isArray(data13))) { const err0 = { instancePath: instancePath + "/KeymanDeveloperProject/Modules", schemaPath: "#/properties/KeymanDeveloperProject/properties/Modules/oneOf/0/type", keyword: "type", params: { type: "object" }, message: