@keymanapp/common-types
Version:
Keyman Developer keyboard file types
518 lines (516 loc) • 46.4 kB
JavaScript
!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]="79cda272-aa69-5708-a0ed-c302d2c09e44")}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.schema.validator.cjs
var require_kpj_schema_validator = __commonJS({
"obj/schemas/kpj.schema.validator.cjs"(exports, module) {
module.exports = validate20;
module.exports.default = validate20;
var pattern0 = new RegExp("^(True|False)$", "u");
var pattern4 = new RegExp("^(keyboard|lexicalmodel)$", "u");
var pattern5 = new RegExp("^(1\\.0|2\\.0)$", "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)) {
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 (!(key0 === "ID" || key0 === "Filename" || key0 === "Filepath" || key0 === "FileVersion" || key0 === "FileType" || key0 === "Details" || key0 === "ParentFileID")) {
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")) {
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;
}
}
}
}
}
}
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 _errs24 = 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 = _errs24 === 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)) {
let missing1;
if (data0.Options === void 0 && (missing1 = "Options")) {
validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject", schemaPath: "#/properties/KeymanDeveloperProject/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 === "Options" || key1 === "Files")) {
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 === "SkipMetadataFiles" || 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.SkipMetadataFiles !== void 0) {
let data7 = data1.SkipMetadataFiles;
const _errs19 = errors;
if (errors === _errs19) {
if (typeof data7 === "string") {
if (!pattern0.test(data7)) {
validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options/SkipMetadataFiles", schemaPath: "#/definitions/Options/properties/SkipMetadataFiles/pattern", keyword: "pattern", params: { pattern: "^(True|False)$" }, message: 'must match pattern "^(True|False)$"' }];
return false;
}
}
else {
validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject/Options/SkipMetadataFiles", schemaPath: "#/definitions/Options/properties/SkipMetadataFiles/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
}
var valid3 = _errs19 === errors;
}
else {
var valid3 = true;
}
if (valid3) {
if (data1.ProjectType !== void 0) {
let data8 = data1.ProjectType;
const _errs21 = errors;
if (errors === _errs21) {
if (typeof data8 === "string") {
if (!pattern4.test(data8)) {
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 = _errs21 === errors;
}
else {
var valid3 = true;
}
if (valid3) {
if (data1.Version !== void 0) {
let data9 = data1.Version;
const _errs23 = errors;
if (errors === _errs23) {
if (typeof data9 === "string") {
if (!pattern5.test(data9)) {
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 = _errs23 === 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 _errs25 = 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 = _errs25 === errors;
}
else {
var valid1 = true;
}
}
}
}
}
else {
validate20.errors = [{ instancePath: instancePath + "/KeymanDeveloperProject", schemaPath: "#/properties/KeymanDeveloperProject/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_kpj_schema_validator();
//# sourceMappingURL=kpj.schema.validator.mjs.map
//# debugId=79cda272-aa69-5708-a0ed-c302d2c09e44