@keymanapp/common-types
Version:
Keyman Developer keyboard file types
565 lines (563 loc) • 68.7 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]="e1d7c7da-0235-5cb1-a271-6472ed54713a")}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/ldml-keyboardtest3.schema.validator.cjs
var require_ldml_keyboardtest3_schema_validator = __commonJS({
"obj/schemas/ldml-keyboardtest3.schema.validator.cjs"(exports, module) {
module.exports = validate20;
module.exports.default = validate20;
var schema22 = { "$schema": "http://json-schema.org/schema#", "additionalProperties": false, "definitions": { "any": { "type": "string" }, "backspace": { "type": "string" }, "check": { "additionalProperties": false, "properties": { "result": { "type": "string" } }, "required": ["result"], "type": "object" }, "emit": { "additionalProperties": false, "properties": { "to": { "type": "string" } }, "required": ["to"], "type": "object" }, "info": { "additionalProperties": false, "properties": { "author": { "type": "string" }, "keyboard": { "type": "string" }, "name": { "type": "string" } }, "required": ["keyboard", "name"], "type": "object" }, "keystroke": { "additionalProperties": false, "properties": { "flick": { "type": "string" }, "key": { "type": "string" }, "longPress": { "type": "string" }, "tapCount": { "type": "string" } }, "required": ["key"], "type": "object" }, "repertoire": { "additionalProperties": false, "properties": { "chars": { "type": "string" }, "name": { "type": "string" }, "type": { "enum": ["default", "simple", "gesture", "flick", "longPress", "multiTap", "hardware"], "type": "string" } }, "required": ["chars", "name"], "type": "object" }, "special": { "$ref": "#/definitions/any" }, "startContext": { "additionalProperties": false, "properties": { "to": { "type": "string" } }, "required": ["to"], "type": "object" }, "test": { "additionalProperties": false, "properties": { "backspace": { "$ref": "#/definitions/backspace" }, "check": { "$ref": "#/definitions/check" }, "emit": { "$ref": "#/definitions/emit" }, "keystroke": { "$ref": "#/definitions/keystroke" }, "name": { "type": "string" }, "special": { "items": { "$ref": "#/definitions/special" }, "type": "array" }, "startContext": { "$ref": "#/definitions/startContext" } }, "required": ["name"], "type": "object" }, "tests": { "additionalProperties": false, "properties": { "name": { "type": "string" }, "special": { "items": { "$ref": "#/definitions/special" }, "type": "array" }, "test": { "items": { "$ref": "#/definitions/test" }, "minItems": 1, "type": "array" } }, "required": ["test", "name"], "type": "object" } }, "properties": { "keyboardTest3": { "additionalProperties": false, "properties": { "conformsTo": { "enum": ["techpreview"], "type": "string" }, "info": { "$ref": "#/definitions/info" }, "repertoire": { "items": { "$ref": "#/definitions/repertoire" }, "type": "array" }, "special": { "items": { "$ref": "#/definitions/special" }, "type": "array" }, "tests": { "items": { "$ref": "#/definitions/tests" }, "type": "array" }, "xmlns": { "type": "string" } }, "required": ["info", "conformsTo"], "type": "object" } }, "required": ["keyboardTest3"], "title": "46/dtd/ldmlKeyboardTest3.xsd", "type": "object" };
var schema24 = { "additionalProperties": false, "properties": { "chars": { "type": "string" }, "name": { "type": "string" }, "type": { "enum": ["default", "simple", "gesture", "flick", "longPress", "multiTap", "hardware"], "type": "string" } }, "required": ["chars", "name"], "type": "object" };
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.name === void 0 && (missing0 = "name")) {
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 === "backspace" || key0 === "check" || key0 === "emit" || key0 === "keystroke" || key0 === "name" || key0 === "special" || key0 === "startContext")) {
validate22.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
return false;
break;
}
}
if (_errs1 === errors) {
if (data.backspace !== void 0) {
const _errs2 = errors;
if (typeof data.backspace !== "string") {
validate22.errors = [{ instancePath: instancePath + "/backspace", schemaPath: "#/definitions/backspace/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid0 = _errs2 === errors;
}
else {
var valid0 = true;
}
if (valid0) {
if (data.check !== void 0) {
let data1 = data.check;
const _errs5 = errors;
const _errs6 = errors;
if (errors === _errs6) {
if (data1 && typeof data1 == "object" && !Array.isArray(data1)) {
let missing1;
if (data1.result === void 0 && (missing1 = "result")) {
validate22.errors = [{ instancePath: instancePath + "/check", schemaPath: "#/definitions/check/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
return false;
}
else {
const _errs8 = errors;
for (const key1 in data1) {
if (!(key1 === "result")) {
validate22.errors = [{ instancePath: instancePath + "/check", schemaPath: "#/definitions/check/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }];
return false;
break;
}
}
if (_errs8 === errors) {
if (data1.result !== void 0) {
if (typeof data1.result !== "string") {
validate22.errors = [{ instancePath: instancePath + "/check/result", schemaPath: "#/definitions/check/properties/result/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
}
}
}
}
else {
validate22.errors = [{ instancePath: instancePath + "/check", schemaPath: "#/definitions/check/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
return false;
}
}
var valid0 = _errs5 === errors;
}
else {
var valid0 = true;
}
if (valid0) {
if (data.emit !== void 0) {
let data3 = data.emit;
const _errs11 = errors;
const _errs12 = errors;
if (errors === _errs12) {
if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
let missing2;
if (data3.to === void 0 && (missing2 = "to")) {
validate22.errors = [{ instancePath: instancePath + "/emit", schemaPath: "#/definitions/emit/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }];
return false;
}
else {
const _errs14 = errors;
for (const key2 in data3) {
if (!(key2 === "to")) {
validate22.errors = [{ instancePath: instancePath + "/emit", schemaPath: "#/definitions/emit/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" }];
return false;
break;
}
}
if (_errs14 === errors) {
if (data3.to !== void 0) {
if (typeof data3.to !== "string") {
validate22.errors = [{ instancePath: instancePath + "/emit/to", schemaPath: "#/definitions/emit/properties/to/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
}
}
}
}
else {
validate22.errors = [{ instancePath: instancePath + "/emit", schemaPath: "#/definitions/emit/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
return false;
}
}
var valid0 = _errs11 === errors;
}
else {
var valid0 = true;
}
if (valid0) {
if (data.keystroke !== void 0) {
let data5 = data.keystroke;
const _errs17 = errors;
const _errs18 = errors;
if (errors === _errs18) {
if (data5 && typeof data5 == "object" && !Array.isArray(data5)) {
let missing3;
if (data5.key === void 0 && (missing3 = "key")) {
validate22.errors = [{ instancePath: instancePath + "/keystroke", schemaPath: "#/definitions/keystroke/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" }];
return false;
}
else {
const _errs20 = errors;
for (const key3 in data5) {
if (!(key3 === "flick" || key3 === "key" || key3 === "longPress" || key3 === "tapCount")) {
validate22.errors = [{ instancePath: instancePath + "/keystroke", schemaPath: "#/definitions/keystroke/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" }];
return false;
break;
}
}
if (_errs20 === errors) {
if (data5.flick !== void 0) {
const _errs21 = errors;
if (typeof data5.flick !== "string") {
validate22.errors = [{ instancePath: instancePath + "/keystroke/flick", schemaPath: "#/definitions/keystroke/properties/flick/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid7 = _errs21 === errors;
}
else {
var valid7 = true;
}
if (valid7) {
if (data5.key !== void 0) {
const _errs23 = errors;
if (typeof data5.key !== "string") {
validate22.errors = [{ instancePath: instancePath + "/keystroke/key", schemaPath: "#/definitions/keystroke/properties/key/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid7 = _errs23 === errors;
}
else {
var valid7 = true;
}
if (valid7) {
if (data5.longPress !== void 0) {
const _errs25 = errors;
if (typeof data5.longPress !== "string") {
validate22.errors = [{ instancePath: instancePath + "/keystroke/longPress", schemaPath: "#/definitions/keystroke/properties/longPress/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid7 = _errs25 === errors;
}
else {
var valid7 = true;
}
if (valid7) {
if (data5.tapCount !== void 0) {
const _errs27 = errors;
if (typeof data5.tapCount !== "string") {
validate22.errors = [{ instancePath: instancePath + "/keystroke/tapCount", schemaPath: "#/definitions/keystroke/properties/tapCount/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid7 = _errs27 === errors;
}
else {
var valid7 = true;
}
}
}
}
}
}
}
else {
validate22.errors = [{ instancePath: instancePath + "/keystroke", schemaPath: "#/definitions/keystroke/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
return false;
}
}
var valid0 = _errs17 === errors;
}
else {
var valid0 = true;
}
if (valid0) {
if (data.name !== void 0) {
const _errs29 = errors;
if (typeof data.name !== "string") {
validate22.errors = [{ instancePath: instancePath + "/name", schemaPath: "#/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid0 = _errs29 === errors;
}
else {
var valid0 = true;
}
if (valid0) {
if (data.special !== void 0) {
let data11 = data.special;
const _errs31 = errors;
if (errors === _errs31) {
if (Array.isArray(data11)) {
var valid8 = true;
const len0 = data11.length;
for (let i0 = 0; i0 < len0; i0++) {
const _errs33 = errors;
if (typeof data11[i0] !== "string") {
validate22.errors = [{ instancePath: instancePath + "/special/" + i0, schemaPath: "#/definitions/special/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid8 = _errs33 === errors;
if (!valid8) {
break;
}
}
}
else {
validate22.errors = [{ instancePath: instancePath + "/special", schemaPath: "#/properties/special/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
return false;
}
}
var valid0 = _errs31 === errors;
}
else {
var valid0 = true;
}
if (valid0) {
if (data.startContext !== void 0) {
let data13 = data.startContext;
const _errs36 = errors;
const _errs37 = errors;
if (errors === _errs37) {
if (data13 && typeof data13 == "object" && !Array.isArray(data13)) {
let missing4;
if (data13.to === void 0 && (missing4 = "to")) {
validate22.errors = [{ instancePath: instancePath + "/startContext", schemaPath: "#/definitions/startContext/required", keyword: "required", params: { missingProperty: missing4 }, message: "must have required property '" + missing4 + "'" }];
return false;
}
else {
const _errs39 = errors;
for (const key4 in data13) {
if (!(key4 === "to")) {
validate22.errors = [{ instancePath: instancePath + "/startContext", schemaPath: "#/definitions/startContext/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key4 }, message: "must NOT have additional properties" }];
return false;
break;
}
}
if (_errs39 === errors) {
if (data13.to !== void 0) {
if (typeof data13.to !== "string") {
validate22.errors = [{ instancePath: instancePath + "/startContext/to", schemaPath: "#/definitions/startContext/properties/to/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
}
}
}
}
else {
validate22.errors = [{ instancePath: instancePath + "/startContext", schemaPath: "#/definitions/startContext/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
return false;
}
}
var valid0 = _errs36 === 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.test === void 0 && (missing0 = "test") || data.name === void 0 && (missing0 = "name")) {
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 === "name" || key0 === "special" || key0 === "test")) {
validate21.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") {
validate21.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.special !== void 0) {
let data1 = data.special;
const _errs4 = errors;
if (errors === _errs4) {
if (Array.isArray(data1)) {
var valid1 = true;
const len0 = data1.length;
for (let i0 = 0; i0 < len0; i0++) {
const _errs6 = errors;
if (typeof data1[i0] !== "string") {
validate21.errors = [{ instancePath: instancePath + "/special/" + i0, schemaPath: "#/definitions/special/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid1 = _errs6 === errors;
if (!valid1) {
break;
}
}
}
else {
validate21.errors = [{ instancePath: instancePath + "/special", schemaPath: "#/properties/special/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
return false;
}
}
var valid0 = _errs4 === errors;
}
else {
var valid0 = true;
}
if (valid0) {
if (data.test !== void 0) {
let data3 = data.test;
const _errs9 = errors;
if (errors === _errs9) {
if (Array.isArray(data3)) {
if (data3.length < 1) {
validate21.errors = [{ instancePath: instancePath + "/test", schemaPath: "#/properties/test/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" }];
return false;
}
else {
var valid3 = true;
const len1 = data3.length;
for (let i1 = 0; i1 < len1; i1++) {
const _errs11 = errors;
if (!validate22(data3[i1], { instancePath: instancePath + "/test/" + i1, parentData: data3, parentDataProperty: i1, rootData })) {
vErrors = vErrors === null ? validate22.errors : vErrors.concat(validate22.errors);
errors = vErrors.length;
}
var valid3 = _errs11 === errors;
if (!valid3) {
break;
}
}
}
}
else {
validate21.errors = [{ instancePath: instancePath + "/test", schemaPath: "#/properties/test/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
return false;
}
}
var valid0 = _errs9 === 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;
}
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.keyboardTest3 === void 0 && (missing0 = "keyboardTest3")) {
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 === "keyboardTest3")) {
validate20.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
return false;
break;
}
}
if (_errs1 === errors) {
if (data.keyboardTest3 !== void 0) {
let data0 = data.keyboardTest3;
const _errs2 = errors;
if (errors === _errs2) {
if (data0 && typeof data0 == "object" && !Array.isArray(data0)) {
let missing1;
if (data0.info === void 0 && (missing1 = "info") || data0.conformsTo === void 0 && (missing1 = "conformsTo")) {
validate20.errors = [{ instancePath: instancePath + "/keyboardTest3", schemaPath: "#/properties/keyboardTest3/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 === "conformsTo" || key1 === "info" || key1 === "repertoire" || key1 === "special" || key1 === "tests" || key1 === "xmlns")) {
validate20.errors = [{ instancePath: instancePath + "/keyboardTest3", schemaPath: "#/properties/keyboardTest3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }];
return false;
break;
}
}
if (_errs4 === errors) {
if (data0.conformsTo !== void 0) {
let data1 = data0.conformsTo;
const _errs5 = errors;
if (typeof data1 !== "string") {
validate20.errors = [{ instancePath: instancePath + "/keyboardTest3/conformsTo", schemaPath: "#/properties/keyboardTest3/properties/conformsTo/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
if (!(data1 === "techpreview")) {
validate20.errors = [{ instancePath: instancePath + "/keyboardTest3/conformsTo", schemaPath: "#/properties/keyboardTest3/properties/conformsTo/enum", keyword: "enum", params: { allowedValues: schema22.properties.keyboardTest3.properties.conformsTo.enum }, message: "must be equal to one of the allowed values" }];
return false;
}
var valid1 = _errs5 === errors;
}
else {
var valid1 = true;
}
if (valid1) {
if (data0.info !== void 0) {
let data2 = data0.info;
const _errs7 = errors;
const _errs8 = errors;
if (errors === _errs8) {
if (data2 && typeof data2 == "object" && !Array.isArray(data2)) {
let missing2;
if (data2.keyboard === void 0 && (missing2 = "keyboard") || data2.name === void 0 && (missing2 = "name")) {
validate20.errors = [{ instancePath: instancePath + "/keyboardTest3/info", schemaPath: "#/definitions/info/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }];
return false;
}
else {
const _errs10 = errors;
for (const key2 in data2) {
if (!(key2 === "author" || key2 === "keyboard" || key2 === "name")) {
validate20.errors = [{ instancePath: instancePath + "/keyboardTest3/info", schemaPath: "#/definitions/info/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" }];
return false;
break;
}
}
if (_errs10 === errors) {
if (data2.author !== void 0) {
const _errs11 = errors;
if (typeof data2.author !== "string") {
validate20.errors = [{ instancePath: instancePath + "/keyboardTest3/info/author", schemaPath: "#/definitions/info/properties/author/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid3 = _errs11 === errors;
}
else {
var valid3 = true;
}
if (valid3) {
if (data2.keyboard !== void 0) {
const _errs13 = errors;
if (typeof data2.keyboard !== "string") {
validate20.errors = [{ instancePath: instancePath + "/keyboardTest3/info/keyboard", schemaPath: "#/definitions/info/properties/keyboard/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid3 = _errs13 === errors;
}
else {
var valid3 = true;
}
if (valid3) {
if (data2.name !== void 0) {
const _errs15 = errors;
if (typeof data2.name !== "string") {
validate20.errors = [{ instancePath: instancePath + "/keyboardTest3/info/name", schemaPath: "#/definitions/info/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid3 = _errs15 === errors;
}
else {
var valid3 = true;
}
}
}
}
}
}
else {
validate20.errors = [{ instancePath: instancePath + "/keyboardTest3/info", schemaPath: "#/definitions/info/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
return false;
}
}
var valid1 = _errs7 === errors;
}
else {
var valid1 = true;
}
if (valid1) {
if (data0.repertoire !== void 0) {
let data6 = data0.repertoire;
const _errs17 = errors;
if (errors === _errs17) {
if (Array.isArray(data6)) {
var valid4 = true;
const len0 = data6.length;
for (let i0 = 0; i0 < len0; i0++) {
let data7 = data6[i0];
const _errs19 = errors;
const _errs20 = errors;
if (errors === _errs20) {
if (data7 && typeof data7 == "object" && !Array.isArray(data7)) {
let missing3;