Fix European trip return heuristic for weekend location tracking
Adjust European short trip heuristic from >3 days to >1 day to correctly detect when user has returned home from European trips. This fixes the April 29-30, 2023 case where the location incorrectly showed "Sankt Georg, Hamburg" instead of "Bristol" when the user was free (no events scheduled) after the foss-north trip ended on April 27. The previous logic required more than 3 days to pass before assuming return home from European countries, but for short European trips by rail/ferry, users typically return within 1-2 days. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
663dc479c2
commit
ea4980a5d7
6407 changed files with 1072847 additions and 18 deletions
6
node_modules/ajv/dist/compile/validate/applicability.d.ts
generated
vendored
Normal file
6
node_modules/ajv/dist/compile/validate/applicability.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import type { AnySchemaObject } from "../../types";
|
||||
import type { SchemaObjCxt } from "..";
|
||||
import type { JSONType, RuleGroup, Rule } from "../rules";
|
||||
export declare function schemaHasRulesForType({ schema, self }: SchemaObjCxt, type: JSONType): boolean | undefined;
|
||||
export declare function shouldUseGroup(schema: AnySchemaObject, group: RuleGroup): boolean;
|
||||
export declare function shouldUseRule(schema: AnySchemaObject, rule: Rule): boolean | undefined;
|
||||
19
node_modules/ajv/dist/compile/validate/applicability.js
generated
vendored
Normal file
19
node_modules/ajv/dist/compile/validate/applicability.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0;
|
||||
function schemaHasRulesForType({ schema, self }, type) {
|
||||
const group = self.RULES.types[type];
|
||||
return group && group !== true && shouldUseGroup(schema, group);
|
||||
}
|
||||
exports.schemaHasRulesForType = schemaHasRulesForType;
|
||||
function shouldUseGroup(schema, group) {
|
||||
return group.rules.some((rule) => shouldUseRule(schema, rule));
|
||||
}
|
||||
exports.shouldUseGroup = shouldUseGroup;
|
||||
function shouldUseRule(schema, rule) {
|
||||
var _a;
|
||||
return (schema[rule.keyword] !== undefined ||
|
||||
((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== undefined)));
|
||||
}
|
||||
exports.shouldUseRule = shouldUseRule;
|
||||
//# sourceMappingURL=applicability.js.map
|
||||
1
node_modules/ajv/dist/compile/validate/applicability.js.map
generated
vendored
Normal file
1
node_modules/ajv/dist/compile/validate/applicability.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"applicability.js","sourceRoot":"","sources":["../../../lib/compile/validate/applicability.ts"],"names":[],"mappings":";;;AAIA,SAAgB,qBAAqB,CACnC,EAAC,MAAM,EAAE,IAAI,EAAe,EAC5B,IAAc;IAEd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACpC,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,IAAI,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AACjE,CAAC;AAND,sDAMC;AAED,SAAgB,cAAc,CAAC,MAAuB,EAAE,KAAgB;IACtE,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;AAChE,CAAC;AAFD,wCAEC;AAED,SAAgB,aAAa,CAAC,MAAuB,EAAE,IAAU;;IAC/D,OAAO,CACL,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,SAAS;SAClC,MAAA,IAAI,CAAC,UAAU,CAAC,UAAU,0CAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAA,CACrE,CAAA;AACH,CAAC;AALD,sCAKC"}
|
||||
4
node_modules/ajv/dist/compile/validate/boolSchema.d.ts
generated
vendored
Normal file
4
node_modules/ajv/dist/compile/validate/boolSchema.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import type { SchemaCxt } from "..";
|
||||
import { Name } from "../codegen";
|
||||
export declare function topBoolOrEmptySchema(it: SchemaCxt): void;
|
||||
export declare function boolOrEmptySchema(it: SchemaCxt, valid: Name): void;
|
||||
50
node_modules/ajv/dist/compile/validate/boolSchema.js
generated
vendored
Normal file
50
node_modules/ajv/dist/compile/validate/boolSchema.js
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0;
|
||||
const errors_1 = require("../errors");
|
||||
const codegen_1 = require("../codegen");
|
||||
const names_1 = require("../names");
|
||||
const boolError = {
|
||||
message: "boolean schema is false",
|
||||
};
|
||||
function topBoolOrEmptySchema(it) {
|
||||
const { gen, schema, validateName } = it;
|
||||
if (schema === false) {
|
||||
falseSchemaError(it, false);
|
||||
}
|
||||
else if (typeof schema == "object" && schema.$async === true) {
|
||||
gen.return(names_1.default.data);
|
||||
}
|
||||
else {
|
||||
gen.assign((0, codegen_1._) `${validateName}.errors`, null);
|
||||
gen.return(true);
|
||||
}
|
||||
}
|
||||
exports.topBoolOrEmptySchema = topBoolOrEmptySchema;
|
||||
function boolOrEmptySchema(it, valid) {
|
||||
const { gen, schema } = it;
|
||||
if (schema === false) {
|
||||
gen.var(valid, false); // TODO var
|
||||
falseSchemaError(it);
|
||||
}
|
||||
else {
|
||||
gen.var(valid, true); // TODO var
|
||||
}
|
||||
}
|
||||
exports.boolOrEmptySchema = boolOrEmptySchema;
|
||||
function falseSchemaError(it, overrideAllErrors) {
|
||||
const { gen, data } = it;
|
||||
// TODO maybe some other interface should be used for non-keyword validation errors...
|
||||
const cxt = {
|
||||
gen,
|
||||
keyword: "false schema",
|
||||
data,
|
||||
schema: false,
|
||||
schemaCode: false,
|
||||
schemaValue: false,
|
||||
params: {},
|
||||
it,
|
||||
};
|
||||
(0, errors_1.reportError)(cxt, boolError, undefined, overrideAllErrors);
|
||||
}
|
||||
//# sourceMappingURL=boolSchema.js.map
|
||||
1
node_modules/ajv/dist/compile/validate/boolSchema.js.map
generated
vendored
Normal file
1
node_modules/ajv/dist/compile/validate/boolSchema.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"boolSchema.js","sourceRoot":"","sources":["../../../lib/compile/validate/boolSchema.ts"],"names":[],"mappings":";;;AAEA,sCAAqC;AACrC,wCAAkC;AAClC,oCAAwB;AAExB,MAAM,SAAS,GAA2B;IACxC,OAAO,EAAE,yBAAyB;CACnC,CAAA;AAED,SAAgB,oBAAoB,CAAC,EAAa;IAChD,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAC,GAAG,EAAE,CAAA;IACtC,IAAI,MAAM,KAAK,KAAK,EAAE;QACpB,gBAAgB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;KAC5B;SAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,EAAE;QAC9D,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,IAAI,CAAC,CAAA;KACnB;SAAM;QACL,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,YAAY,SAAS,EAAE,IAAI,CAAC,CAAA;QAC3C,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;KACjB;AACH,CAAC;AAVD,oDAUC;AAED,SAAgB,iBAAiB,CAAC,EAAa,EAAE,KAAW;IAC1D,MAAM,EAAC,GAAG,EAAE,MAAM,EAAC,GAAG,EAAE,CAAA;IACxB,IAAI,MAAM,KAAK,KAAK,EAAE;QACpB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA,CAAC,WAAW;QACjC,gBAAgB,CAAC,EAAE,CAAC,CAAA;KACrB;SAAM;QACL,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA,CAAC,WAAW;KACjC;AACH,CAAC;AARD,8CAQC;AAED,SAAS,gBAAgB,CAAC,EAAa,EAAE,iBAA2B;IAClE,MAAM,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IACtB,sFAAsF;IACtF,MAAM,GAAG,GAAoB;QAC3B,GAAG;QACH,OAAO,EAAE,cAAc;QACvB,IAAI;QACJ,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,EAAE;QACV,EAAE;KACH,CAAA;IACD,IAAA,oBAAW,EAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAA;AAC3D,CAAC"}
|
||||
17
node_modules/ajv/dist/compile/validate/dataType.d.ts
generated
vendored
Normal file
17
node_modules/ajv/dist/compile/validate/dataType.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import type { ErrorObject, AnySchemaObject } from "../../types";
|
||||
import type { SchemaObjCxt } from "..";
|
||||
import { JSONType } from "../rules";
|
||||
import { Code, Name } from "../codegen";
|
||||
export declare enum DataType {
|
||||
Correct = 0,
|
||||
Wrong = 1
|
||||
}
|
||||
export declare function getSchemaTypes(schema: AnySchemaObject): JSONType[];
|
||||
export declare function getJSONTypes(ts: unknown | unknown[]): JSONType[];
|
||||
export declare function coerceAndCheckDataType(it: SchemaObjCxt, types: JSONType[]): boolean;
|
||||
export declare function checkDataType(dataType: JSONType, data: Name, strictNums?: boolean | "log", correct?: DataType): Code;
|
||||
export declare function checkDataTypes(dataTypes: JSONType[], data: Name, strictNums?: boolean | "log", correct?: DataType): Code;
|
||||
export type TypeError = ErrorObject<"type", {
|
||||
type: string;
|
||||
}>;
|
||||
export declare function reportTypeError(it: SchemaObjCxt): void;
|
||||
202
node_modules/ajv/dist/compile/validate/dataType.js
generated
vendored
Normal file
202
node_modules/ajv/dist/compile/validate/dataType.js
generated
vendored
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0;
|
||||
const rules_1 = require("../rules");
|
||||
const applicability_1 = require("./applicability");
|
||||
const errors_1 = require("../errors");
|
||||
const codegen_1 = require("../codegen");
|
||||
const util_1 = require("../util");
|
||||
var DataType;
|
||||
(function (DataType) {
|
||||
DataType[DataType["Correct"] = 0] = "Correct";
|
||||
DataType[DataType["Wrong"] = 1] = "Wrong";
|
||||
})(DataType = exports.DataType || (exports.DataType = {}));
|
||||
function getSchemaTypes(schema) {
|
||||
const types = getJSONTypes(schema.type);
|
||||
const hasNull = types.includes("null");
|
||||
if (hasNull) {
|
||||
if (schema.nullable === false)
|
||||
throw new Error("type: null contradicts nullable: false");
|
||||
}
|
||||
else {
|
||||
if (!types.length && schema.nullable !== undefined) {
|
||||
throw new Error('"nullable" cannot be used without "type"');
|
||||
}
|
||||
if (schema.nullable === true)
|
||||
types.push("null");
|
||||
}
|
||||
return types;
|
||||
}
|
||||
exports.getSchemaTypes = getSchemaTypes;
|
||||
function getJSONTypes(ts) {
|
||||
const types = Array.isArray(ts) ? ts : ts ? [ts] : [];
|
||||
if (types.every(rules_1.isJSONType))
|
||||
return types;
|
||||
throw new Error("type must be JSONType or JSONType[]: " + types.join(","));
|
||||
}
|
||||
exports.getJSONTypes = getJSONTypes;
|
||||
function coerceAndCheckDataType(it, types) {
|
||||
const { gen, data, opts } = it;
|
||||
const coerceTo = coerceToTypes(types, opts.coerceTypes);
|
||||
const checkTypes = types.length > 0 &&
|
||||
!(coerceTo.length === 0 && types.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types[0]));
|
||||
if (checkTypes) {
|
||||
const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong);
|
||||
gen.if(wrongType, () => {
|
||||
if (coerceTo.length)
|
||||
coerceData(it, types, coerceTo);
|
||||
else
|
||||
reportTypeError(it);
|
||||
});
|
||||
}
|
||||
return checkTypes;
|
||||
}
|
||||
exports.coerceAndCheckDataType = coerceAndCheckDataType;
|
||||
const COERCIBLE = new Set(["string", "number", "integer", "boolean", "null"]);
|
||||
function coerceToTypes(types, coerceTypes) {
|
||||
return coerceTypes
|
||||
? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === "array" && t === "array"))
|
||||
: [];
|
||||
}
|
||||
function coerceData(it, types, coerceTo) {
|
||||
const { gen, data, opts } = it;
|
||||
const dataType = gen.let("dataType", (0, codegen_1._) `typeof ${data}`);
|
||||
const coerced = gen.let("coerced", (0, codegen_1._) `undefined`);
|
||||
if (opts.coerceTypes === "array") {
|
||||
gen.if((0, codegen_1._) `${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen
|
||||
.assign(data, (0, codegen_1._) `${data}[0]`)
|
||||
.assign(dataType, (0, codegen_1._) `typeof ${data}`)
|
||||
.if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data)));
|
||||
}
|
||||
gen.if((0, codegen_1._) `${coerced} !== undefined`);
|
||||
for (const t of coerceTo) {
|
||||
if (COERCIBLE.has(t) || (t === "array" && opts.coerceTypes === "array")) {
|
||||
coerceSpecificType(t);
|
||||
}
|
||||
}
|
||||
gen.else();
|
||||
reportTypeError(it);
|
||||
gen.endIf();
|
||||
gen.if((0, codegen_1._) `${coerced} !== undefined`, () => {
|
||||
gen.assign(data, coerced);
|
||||
assignParentData(it, coerced);
|
||||
});
|
||||
function coerceSpecificType(t) {
|
||||
switch (t) {
|
||||
case "string":
|
||||
gen
|
||||
.elseIf((0, codegen_1._) `${dataType} == "number" || ${dataType} == "boolean"`)
|
||||
.assign(coerced, (0, codegen_1._) `"" + ${data}`)
|
||||
.elseIf((0, codegen_1._) `${data} === null`)
|
||||
.assign(coerced, (0, codegen_1._) `""`);
|
||||
return;
|
||||
case "number":
|
||||
gen
|
||||
.elseIf((0, codegen_1._) `${dataType} == "boolean" || ${data} === null
|
||||
|| (${dataType} == "string" && ${data} && ${data} == +${data})`)
|
||||
.assign(coerced, (0, codegen_1._) `+${data}`);
|
||||
return;
|
||||
case "integer":
|
||||
gen
|
||||
.elseIf((0, codegen_1._) `${dataType} === "boolean" || ${data} === null
|
||||
|| (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`)
|
||||
.assign(coerced, (0, codegen_1._) `+${data}`);
|
||||
return;
|
||||
case "boolean":
|
||||
gen
|
||||
.elseIf((0, codegen_1._) `${data} === "false" || ${data} === 0 || ${data} === null`)
|
||||
.assign(coerced, false)
|
||||
.elseIf((0, codegen_1._) `${data} === "true" || ${data} === 1`)
|
||||
.assign(coerced, true);
|
||||
return;
|
||||
case "null":
|
||||
gen.elseIf((0, codegen_1._) `${data} === "" || ${data} === 0 || ${data} === false`);
|
||||
gen.assign(coerced, null);
|
||||
return;
|
||||
case "array":
|
||||
gen
|
||||
.elseIf((0, codegen_1._) `${dataType} === "string" || ${dataType} === "number"
|
||||
|| ${dataType} === "boolean" || ${data} === null`)
|
||||
.assign(coerced, (0, codegen_1._) `[${data}]`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function assignParentData({ gen, parentData, parentDataProperty }, expr) {
|
||||
// TODO use gen.property
|
||||
gen.if((0, codegen_1._) `${parentData} !== undefined`, () => gen.assign((0, codegen_1._) `${parentData}[${parentDataProperty}]`, expr));
|
||||
}
|
||||
function checkDataType(dataType, data, strictNums, correct = DataType.Correct) {
|
||||
const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ;
|
||||
let cond;
|
||||
switch (dataType) {
|
||||
case "null":
|
||||
return (0, codegen_1._) `${data} ${EQ} null`;
|
||||
case "array":
|
||||
cond = (0, codegen_1._) `Array.isArray(${data})`;
|
||||
break;
|
||||
case "object":
|
||||
cond = (0, codegen_1._) `${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
|
||||
break;
|
||||
case "integer":
|
||||
cond = numCond((0, codegen_1._) `!(${data} % 1) && !isNaN(${data})`);
|
||||
break;
|
||||
case "number":
|
||||
cond = numCond();
|
||||
break;
|
||||
default:
|
||||
return (0, codegen_1._) `typeof ${data} ${EQ} ${dataType}`;
|
||||
}
|
||||
return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond);
|
||||
function numCond(_cond = codegen_1.nil) {
|
||||
return (0, codegen_1.and)((0, codegen_1._) `typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1._) `isFinite(${data})` : codegen_1.nil);
|
||||
}
|
||||
}
|
||||
exports.checkDataType = checkDataType;
|
||||
function checkDataTypes(dataTypes, data, strictNums, correct) {
|
||||
if (dataTypes.length === 1) {
|
||||
return checkDataType(dataTypes[0], data, strictNums, correct);
|
||||
}
|
||||
let cond;
|
||||
const types = (0, util_1.toHash)(dataTypes);
|
||||
if (types.array && types.object) {
|
||||
const notObj = (0, codegen_1._) `typeof ${data} != "object"`;
|
||||
cond = types.null ? notObj : (0, codegen_1._) `!${data} || ${notObj}`;
|
||||
delete types.null;
|
||||
delete types.array;
|
||||
delete types.object;
|
||||
}
|
||||
else {
|
||||
cond = codegen_1.nil;
|
||||
}
|
||||
if (types.number)
|
||||
delete types.integer;
|
||||
for (const t in types)
|
||||
cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct));
|
||||
return cond;
|
||||
}
|
||||
exports.checkDataTypes = checkDataTypes;
|
||||
const typeError = {
|
||||
message: ({ schema }) => `must be ${schema}`,
|
||||
params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1._) `{type: ${schema}}` : (0, codegen_1._) `{type: ${schemaValue}}`,
|
||||
};
|
||||
function reportTypeError(it) {
|
||||
const cxt = getTypeErrorContext(it);
|
||||
(0, errors_1.reportError)(cxt, typeError);
|
||||
}
|
||||
exports.reportTypeError = reportTypeError;
|
||||
function getTypeErrorContext(it) {
|
||||
const { gen, data, schema } = it;
|
||||
const schemaCode = (0, util_1.schemaRefOrVal)(it, schema, "type");
|
||||
return {
|
||||
gen,
|
||||
keyword: "type",
|
||||
data,
|
||||
schema: schema.type,
|
||||
schemaCode,
|
||||
schemaValue: schemaCode,
|
||||
parentSchema: schema,
|
||||
params: {},
|
||||
it,
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=dataType.js.map
|
||||
1
node_modules/ajv/dist/compile/validate/dataType.js.map
generated
vendored
Normal file
1
node_modules/ajv/dist/compile/validate/dataType.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/ajv/dist/compile/validate/defaults.d.ts
generated
vendored
Normal file
2
node_modules/ajv/dist/compile/validate/defaults.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { SchemaObjCxt } from "..";
|
||||
export declare function assignDefaults(it: SchemaObjCxt, ty?: string): void;
|
||||
35
node_modules/ajv/dist/compile/validate/defaults.js
generated
vendored
Normal file
35
node_modules/ajv/dist/compile/validate/defaults.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.assignDefaults = void 0;
|
||||
const codegen_1 = require("../codegen");
|
||||
const util_1 = require("../util");
|
||||
function assignDefaults(it, ty) {
|
||||
const { properties, items } = it.schema;
|
||||
if (ty === "object" && properties) {
|
||||
for (const key in properties) {
|
||||
assignDefault(it, key, properties[key].default);
|
||||
}
|
||||
}
|
||||
else if (ty === "array" && Array.isArray(items)) {
|
||||
items.forEach((sch, i) => assignDefault(it, i, sch.default));
|
||||
}
|
||||
}
|
||||
exports.assignDefaults = assignDefaults;
|
||||
function assignDefault(it, prop, defaultValue) {
|
||||
const { gen, compositeRule, data, opts } = it;
|
||||
if (defaultValue === undefined)
|
||||
return;
|
||||
const childData = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(prop)}`;
|
||||
if (compositeRule) {
|
||||
(0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`);
|
||||
return;
|
||||
}
|
||||
let condition = (0, codegen_1._) `${childData} === undefined`;
|
||||
if (opts.useDefaults === "empty") {
|
||||
condition = (0, codegen_1._) `${condition} || ${childData} === null || ${childData} === ""`;
|
||||
}
|
||||
// `${childData} === undefined` +
|
||||
// (opts.useDefaults === "empty" ? ` || ${childData} === null || ${childData} === ""` : "")
|
||||
gen.if(condition, (0, codegen_1._) `${childData} = ${(0, codegen_1.stringify)(defaultValue)}`);
|
||||
}
|
||||
//# sourceMappingURL=defaults.js.map
|
||||
1
node_modules/ajv/dist/compile/validate/defaults.js.map
generated
vendored
Normal file
1
node_modules/ajv/dist/compile/validate/defaults.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../lib/compile/validate/defaults.ts"],"names":[],"mappings":";;;AACA,wCAAoD;AACpD,kCAAuC;AAEvC,SAAgB,cAAc,CAAC,EAAgB,EAAE,EAAW;IAC1D,MAAM,EAAC,UAAU,EAAE,KAAK,EAAC,GAAG,EAAE,CAAC,MAAM,CAAA;IACrC,IAAI,EAAE,KAAK,QAAQ,IAAI,UAAU,EAAE;QACjC,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;YAC5B,aAAa,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAA;SAChD;KACF;SAAM,IAAI,EAAE,KAAK,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAS,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;KACrE;AACH,CAAC;AATD,wCASC;AAED,SAAS,aAAa,CAAC,EAAgB,EAAE,IAAqB,EAAE,YAAqB;IACnF,MAAM,EAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IAC3C,IAAI,YAAY,KAAK,SAAS;QAAE,OAAM;IACtC,MAAM,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,IAAI,CAAC,EAAE,CAAA;IAChD,IAAI,aAAa,EAAE;QACjB,IAAA,sBAAe,EAAC,EAAE,EAAE,2BAA2B,SAAS,EAAE,CAAC,CAAA;QAC3D,OAAM;KACP;IAED,IAAI,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,SAAS,gBAAgB,CAAA;IAC7C,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,EAAE;QAChC,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,SAAS,OAAO,SAAS,gBAAgB,SAAS,SAAS,CAAA;KAC5E;IACD,iCAAiC;IACjC,2FAA2F;IAC3F,GAAG,CAAC,EAAE,CAAC,SAAS,EAAE,IAAA,WAAC,EAAA,GAAG,SAAS,MAAM,IAAA,mBAAS,EAAC,YAAY,CAAC,EAAE,CAAC,CAAA;AACjE,CAAC"}
|
||||
42
node_modules/ajv/dist/compile/validate/index.d.ts
generated
vendored
Normal file
42
node_modules/ajv/dist/compile/validate/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import type { AddedKeywordDefinition, AnySchemaObject, KeywordErrorCxt, KeywordCxtParams } from "../../types";
|
||||
import type { SchemaCxt, SchemaObjCxt } from "..";
|
||||
import { SubschemaArgs } from "./subschema";
|
||||
import { Code, Name, CodeGen } from "../codegen";
|
||||
import type { JSONType } from "../rules";
|
||||
import { ErrorPaths } from "../errors";
|
||||
export declare function validateFunctionCode(it: SchemaCxt): void;
|
||||
export declare class KeywordCxt implements KeywordErrorCxt {
|
||||
readonly gen: CodeGen;
|
||||
readonly allErrors?: boolean;
|
||||
readonly keyword: string;
|
||||
readonly data: Name;
|
||||
readonly $data?: string | false;
|
||||
schema: any;
|
||||
readonly schemaValue: Code | number | boolean;
|
||||
readonly schemaCode: Code | number | boolean;
|
||||
readonly schemaType: JSONType[];
|
||||
readonly parentSchema: AnySchemaObject;
|
||||
readonly errsCount?: Name;
|
||||
params: KeywordCxtParams;
|
||||
readonly it: SchemaObjCxt;
|
||||
readonly def: AddedKeywordDefinition;
|
||||
constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string);
|
||||
result(condition: Code, successAction?: () => void, failAction?: () => void): void;
|
||||
failResult(condition: Code, successAction?: () => void, failAction?: () => void): void;
|
||||
pass(condition: Code, failAction?: () => void): void;
|
||||
fail(condition?: Code): void;
|
||||
fail$data(condition: Code): void;
|
||||
error(append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths): void;
|
||||
private _error;
|
||||
$dataError(): void;
|
||||
reset(): void;
|
||||
ok(cond: Code | boolean): void;
|
||||
setParams(obj: KeywordCxtParams, assign?: true): void;
|
||||
block$data(valid: Name, codeBlock: () => void, $dataValid?: Code): void;
|
||||
check$data(valid?: Name, $dataValid?: Code): void;
|
||||
invalid$data(): Code;
|
||||
subschema(appl: SubschemaArgs, valid: Name): SchemaCxt;
|
||||
mergeEvaluated(schemaCxt: SchemaCxt, toName?: typeof Name): void;
|
||||
mergeValidEvaluated(schemaCxt: SchemaCxt, valid: Name): boolean | void;
|
||||
}
|
||||
export declare function getData($data: string, { dataLevel, dataNames, dataPathArr }: SchemaCxt): Code | number;
|
||||
520
node_modules/ajv/dist/compile/validate/index.js
generated
vendored
Normal file
520
node_modules/ajv/dist/compile/validate/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,520 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getData = exports.KeywordCxt = exports.validateFunctionCode = void 0;
|
||||
const boolSchema_1 = require("./boolSchema");
|
||||
const dataType_1 = require("./dataType");
|
||||
const applicability_1 = require("./applicability");
|
||||
const dataType_2 = require("./dataType");
|
||||
const defaults_1 = require("./defaults");
|
||||
const keyword_1 = require("./keyword");
|
||||
const subschema_1 = require("./subschema");
|
||||
const codegen_1 = require("../codegen");
|
||||
const names_1 = require("../names");
|
||||
const resolve_1 = require("../resolve");
|
||||
const util_1 = require("../util");
|
||||
const errors_1 = require("../errors");
|
||||
// schema compilation - generates validation function, subschemaCode (below) is used for subschemas
|
||||
function validateFunctionCode(it) {
|
||||
if (isSchemaObj(it)) {
|
||||
checkKeywords(it);
|
||||
if (schemaCxtHasRules(it)) {
|
||||
topSchemaObjCode(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
|
||||
}
|
||||
exports.validateFunctionCode = validateFunctionCode;
|
||||
function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) {
|
||||
if (opts.code.es5) {
|
||||
gen.func(validateName, (0, codegen_1._) `${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {
|
||||
gen.code((0, codegen_1._) `"use strict"; ${funcSourceUrl(schema, opts)}`);
|
||||
destructureValCxtES5(gen, opts);
|
||||
gen.code(body);
|
||||
});
|
||||
}
|
||||
else {
|
||||
gen.func(validateName, (0, codegen_1._) `${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
|
||||
}
|
||||
}
|
||||
function destructureValCxt(opts) {
|
||||
return (0, codegen_1._) `{${names_1.default.instancePath}="", ${names_1.default.parentData}, ${names_1.default.parentDataProperty}, ${names_1.default.rootData}=${names_1.default.data}${opts.dynamicRef ? (0, codegen_1._) `, ${names_1.default.dynamicAnchors}={}` : codegen_1.nil}}={}`;
|
||||
}
|
||||
function destructureValCxtES5(gen, opts) {
|
||||
gen.if(names_1.default.valCxt, () => {
|
||||
gen.var(names_1.default.instancePath, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.instancePath}`);
|
||||
gen.var(names_1.default.parentData, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.parentData}`);
|
||||
gen.var(names_1.default.parentDataProperty, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.parentDataProperty}`);
|
||||
gen.var(names_1.default.rootData, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.rootData}`);
|
||||
if (opts.dynamicRef)
|
||||
gen.var(names_1.default.dynamicAnchors, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.dynamicAnchors}`);
|
||||
}, () => {
|
||||
gen.var(names_1.default.instancePath, (0, codegen_1._) `""`);
|
||||
gen.var(names_1.default.parentData, (0, codegen_1._) `undefined`);
|
||||
gen.var(names_1.default.parentDataProperty, (0, codegen_1._) `undefined`);
|
||||
gen.var(names_1.default.rootData, names_1.default.data);
|
||||
if (opts.dynamicRef)
|
||||
gen.var(names_1.default.dynamicAnchors, (0, codegen_1._) `{}`);
|
||||
});
|
||||
}
|
||||
function topSchemaObjCode(it) {
|
||||
const { schema, opts, gen } = it;
|
||||
validateFunction(it, () => {
|
||||
if (opts.$comment && schema.$comment)
|
||||
commentKeyword(it);
|
||||
checkNoDefault(it);
|
||||
gen.let(names_1.default.vErrors, null);
|
||||
gen.let(names_1.default.errors, 0);
|
||||
if (opts.unevaluated)
|
||||
resetEvaluated(it);
|
||||
typeAndKeywords(it);
|
||||
returnResults(it);
|
||||
});
|
||||
return;
|
||||
}
|
||||
function resetEvaluated(it) {
|
||||
// TODO maybe some hook to execute it in the end to check whether props/items are Name, as in assignEvaluated
|
||||
const { gen, validateName } = it;
|
||||
it.evaluated = gen.const("evaluated", (0, codegen_1._) `${validateName}.evaluated`);
|
||||
gen.if((0, codegen_1._) `${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._) `${it.evaluated}.props`, (0, codegen_1._) `undefined`));
|
||||
gen.if((0, codegen_1._) `${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._) `${it.evaluated}.items`, (0, codegen_1._) `undefined`));
|
||||
}
|
||||
function funcSourceUrl(schema, opts) {
|
||||
const schId = typeof schema == "object" && schema[opts.schemaId];
|
||||
return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._) `/*# sourceURL=${schId} */` : codegen_1.nil;
|
||||
}
|
||||
// schema compilation - this function is used recursively to generate code for sub-schemas
|
||||
function subschemaCode(it, valid) {
|
||||
if (isSchemaObj(it)) {
|
||||
checkKeywords(it);
|
||||
if (schemaCxtHasRules(it)) {
|
||||
subSchemaObjCode(it, valid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
(0, boolSchema_1.boolOrEmptySchema)(it, valid);
|
||||
}
|
||||
function schemaCxtHasRules({ schema, self }) {
|
||||
if (typeof schema == "boolean")
|
||||
return !schema;
|
||||
for (const key in schema)
|
||||
if (self.RULES.all[key])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
function isSchemaObj(it) {
|
||||
return typeof it.schema != "boolean";
|
||||
}
|
||||
function subSchemaObjCode(it, valid) {
|
||||
const { schema, gen, opts } = it;
|
||||
if (opts.$comment && schema.$comment)
|
||||
commentKeyword(it);
|
||||
updateContext(it);
|
||||
checkAsyncSchema(it);
|
||||
const errsCount = gen.const("_errs", names_1.default.errors);
|
||||
typeAndKeywords(it, errsCount);
|
||||
// TODO var
|
||||
gen.var(valid, (0, codegen_1._) `${errsCount} === ${names_1.default.errors}`);
|
||||
}
|
||||
function checkKeywords(it) {
|
||||
(0, util_1.checkUnknownRules)(it);
|
||||
checkRefsAndKeywords(it);
|
||||
}
|
||||
function typeAndKeywords(it, errsCount) {
|
||||
if (it.opts.jtd)
|
||||
return schemaKeywords(it, [], false, errsCount);
|
||||
const types = (0, dataType_1.getSchemaTypes)(it.schema);
|
||||
const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types);
|
||||
schemaKeywords(it, types, !checkedTypes, errsCount);
|
||||
}
|
||||
function checkRefsAndKeywords(it) {
|
||||
const { schema, errSchemaPath, opts, self } = it;
|
||||
if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema, self.RULES)) {
|
||||
self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
|
||||
}
|
||||
}
|
||||
function checkNoDefault(it) {
|
||||
const { schema, opts } = it;
|
||||
if (schema.default !== undefined && opts.useDefaults && opts.strictSchema) {
|
||||
(0, util_1.checkStrictMode)(it, "default is ignored in the schema root");
|
||||
}
|
||||
}
|
||||
function updateContext(it) {
|
||||
const schId = it.schema[it.opts.schemaId];
|
||||
if (schId)
|
||||
it.baseId = (0, resolve_1.resolveUrl)(it.opts.uriResolver, it.baseId, schId);
|
||||
}
|
||||
function checkAsyncSchema(it) {
|
||||
if (it.schema.$async && !it.schemaEnv.$async)
|
||||
throw new Error("async schema in sync schema");
|
||||
}
|
||||
function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {
|
||||
const msg = schema.$comment;
|
||||
if (opts.$comment === true) {
|
||||
gen.code((0, codegen_1._) `${names_1.default.self}.logger.log(${msg})`);
|
||||
}
|
||||
else if (typeof opts.$comment == "function") {
|
||||
const schemaPath = (0, codegen_1.str) `${errSchemaPath}/$comment`;
|
||||
const rootName = gen.scopeValue("root", { ref: schemaEnv.root });
|
||||
gen.code((0, codegen_1._) `${names_1.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);
|
||||
}
|
||||
}
|
||||
function returnResults(it) {
|
||||
const { gen, schemaEnv, validateName, ValidationError, opts } = it;
|
||||
if (schemaEnv.$async) {
|
||||
// TODO assign unevaluated
|
||||
gen.if((0, codegen_1._) `${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._) `new ${ValidationError}(${names_1.default.vErrors})`));
|
||||
}
|
||||
else {
|
||||
gen.assign((0, codegen_1._) `${validateName}.errors`, names_1.default.vErrors);
|
||||
if (opts.unevaluated)
|
||||
assignEvaluated(it);
|
||||
gen.return((0, codegen_1._) `${names_1.default.errors} === 0`);
|
||||
}
|
||||
}
|
||||
function assignEvaluated({ gen, evaluated, props, items }) {
|
||||
if (props instanceof codegen_1.Name)
|
||||
gen.assign((0, codegen_1._) `${evaluated}.props`, props);
|
||||
if (items instanceof codegen_1.Name)
|
||||
gen.assign((0, codegen_1._) `${evaluated}.items`, items);
|
||||
}
|
||||
function schemaKeywords(it, types, typeErrors, errsCount) {
|
||||
const { gen, schema, data, allErrors, opts, self } = it;
|
||||
const { RULES } = self;
|
||||
if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema, RULES))) {
|
||||
gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition)); // TODO typecast
|
||||
return;
|
||||
}
|
||||
if (!opts.jtd)
|
||||
checkStrictTypes(it, types);
|
||||
gen.block(() => {
|
||||
for (const group of RULES.rules)
|
||||
groupKeywords(group);
|
||||
groupKeywords(RULES.post);
|
||||
});
|
||||
function groupKeywords(group) {
|
||||
if (!(0, applicability_1.shouldUseGroup)(schema, group))
|
||||
return;
|
||||
if (group.type) {
|
||||
gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
|
||||
iterateKeywords(it, group);
|
||||
if (types.length === 1 && types[0] === group.type && typeErrors) {
|
||||
gen.else();
|
||||
(0, dataType_2.reportTypeError)(it);
|
||||
}
|
||||
gen.endIf();
|
||||
}
|
||||
else {
|
||||
iterateKeywords(it, group);
|
||||
}
|
||||
// TODO make it "ok" call?
|
||||
if (!allErrors)
|
||||
gen.if((0, codegen_1._) `${names_1.default.errors} === ${errsCount || 0}`);
|
||||
}
|
||||
}
|
||||
function iterateKeywords(it, group) {
|
||||
const { gen, schema, opts: { useDefaults }, } = it;
|
||||
if (useDefaults)
|
||||
(0, defaults_1.assignDefaults)(it, group.type);
|
||||
gen.block(() => {
|
||||
for (const rule of group.rules) {
|
||||
if ((0, applicability_1.shouldUseRule)(schema, rule)) {
|
||||
keywordCode(it, rule.keyword, rule.definition, group.type);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function checkStrictTypes(it, types) {
|
||||
if (it.schemaEnv.meta || !it.opts.strictTypes)
|
||||
return;
|
||||
checkContextTypes(it, types);
|
||||
if (!it.opts.allowUnionTypes)
|
||||
checkMultipleTypes(it, types);
|
||||
checkKeywordTypes(it, it.dataTypes);
|
||||
}
|
||||
function checkContextTypes(it, types) {
|
||||
if (!types.length)
|
||||
return;
|
||||
if (!it.dataTypes.length) {
|
||||
it.dataTypes = types;
|
||||
return;
|
||||
}
|
||||
types.forEach((t) => {
|
||||
if (!includesType(it.dataTypes, t)) {
|
||||
strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
|
||||
}
|
||||
});
|
||||
narrowSchemaTypes(it, types);
|
||||
}
|
||||
function checkMultipleTypes(it, ts) {
|
||||
if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
|
||||
strictTypesError(it, "use allowUnionTypes to allow union type keyword");
|
||||
}
|
||||
}
|
||||
function checkKeywordTypes(it, ts) {
|
||||
const rules = it.self.RULES.all;
|
||||
for (const keyword in rules) {
|
||||
const rule = rules[keyword];
|
||||
if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) {
|
||||
const { type } = rule.definition;
|
||||
if (type.length && !type.some((t) => hasApplicableType(ts, t))) {
|
||||
strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function hasApplicableType(schTs, kwdT) {
|
||||
return schTs.includes(kwdT) || (kwdT === "number" && schTs.includes("integer"));
|
||||
}
|
||||
function includesType(ts, t) {
|
||||
return ts.includes(t) || (t === "integer" && ts.includes("number"));
|
||||
}
|
||||
function narrowSchemaTypes(it, withTypes) {
|
||||
const ts = [];
|
||||
for (const t of it.dataTypes) {
|
||||
if (includesType(withTypes, t))
|
||||
ts.push(t);
|
||||
else if (withTypes.includes("integer") && t === "number")
|
||||
ts.push("integer");
|
||||
}
|
||||
it.dataTypes = ts;
|
||||
}
|
||||
function strictTypesError(it, msg) {
|
||||
const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
|
||||
msg += ` at "${schemaPath}" (strictTypes)`;
|
||||
(0, util_1.checkStrictMode)(it, msg, it.opts.strictTypes);
|
||||
}
|
||||
class KeywordCxt {
|
||||
constructor(it, def, keyword) {
|
||||
(0, keyword_1.validateKeywordUsage)(it, def, keyword);
|
||||
this.gen = it.gen;
|
||||
this.allErrors = it.allErrors;
|
||||
this.keyword = keyword;
|
||||
this.data = it.data;
|
||||
this.schema = it.schema[keyword];
|
||||
this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data;
|
||||
this.schemaValue = (0, util_1.schemaRefOrVal)(it, this.schema, keyword, this.$data);
|
||||
this.schemaType = def.schemaType;
|
||||
this.parentSchema = it.schema;
|
||||
this.params = {};
|
||||
this.it = it;
|
||||
this.def = def;
|
||||
if (this.$data) {
|
||||
this.schemaCode = it.gen.const("vSchema", getData(this.$data, it));
|
||||
}
|
||||
else {
|
||||
this.schemaCode = this.schemaValue;
|
||||
if (!(0, keyword_1.validSchemaType)(this.schema, def.schemaType, def.allowUndefined)) {
|
||||
throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`);
|
||||
}
|
||||
}
|
||||
if ("code" in def ? def.trackErrors : def.errors !== false) {
|
||||
this.errsCount = it.gen.const("_errs", names_1.default.errors);
|
||||
}
|
||||
}
|
||||
result(condition, successAction, failAction) {
|
||||
this.failResult((0, codegen_1.not)(condition), successAction, failAction);
|
||||
}
|
||||
failResult(condition, successAction, failAction) {
|
||||
this.gen.if(condition);
|
||||
if (failAction)
|
||||
failAction();
|
||||
else
|
||||
this.error();
|
||||
if (successAction) {
|
||||
this.gen.else();
|
||||
successAction();
|
||||
if (this.allErrors)
|
||||
this.gen.endIf();
|
||||
}
|
||||
else {
|
||||
if (this.allErrors)
|
||||
this.gen.endIf();
|
||||
else
|
||||
this.gen.else();
|
||||
}
|
||||
}
|
||||
pass(condition, failAction) {
|
||||
this.failResult((0, codegen_1.not)(condition), undefined, failAction);
|
||||
}
|
||||
fail(condition) {
|
||||
if (condition === undefined) {
|
||||
this.error();
|
||||
if (!this.allErrors)
|
||||
this.gen.if(false); // this branch will be removed by gen.optimize
|
||||
return;
|
||||
}
|
||||
this.gen.if(condition);
|
||||
this.error();
|
||||
if (this.allErrors)
|
||||
this.gen.endIf();
|
||||
else
|
||||
this.gen.else();
|
||||
}
|
||||
fail$data(condition) {
|
||||
if (!this.$data)
|
||||
return this.fail(condition);
|
||||
const { schemaCode } = this;
|
||||
this.fail((0, codegen_1._) `${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition)})`);
|
||||
}
|
||||
error(append, errorParams, errorPaths) {
|
||||
if (errorParams) {
|
||||
this.setParams(errorParams);
|
||||
this._error(append, errorPaths);
|
||||
this.setParams({});
|
||||
return;
|
||||
}
|
||||
this._error(append, errorPaths);
|
||||
}
|
||||
_error(append, errorPaths) {
|
||||
;
|
||||
(append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error, errorPaths);
|
||||
}
|
||||
$dataError() {
|
||||
(0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError);
|
||||
}
|
||||
reset() {
|
||||
if (this.errsCount === undefined)
|
||||
throw new Error('add "trackErrors" to keyword definition');
|
||||
(0, errors_1.resetErrorsCount)(this.gen, this.errsCount);
|
||||
}
|
||||
ok(cond) {
|
||||
if (!this.allErrors)
|
||||
this.gen.if(cond);
|
||||
}
|
||||
setParams(obj, assign) {
|
||||
if (assign)
|
||||
Object.assign(this.params, obj);
|
||||
else
|
||||
this.params = obj;
|
||||
}
|
||||
block$data(valid, codeBlock, $dataValid = codegen_1.nil) {
|
||||
this.gen.block(() => {
|
||||
this.check$data(valid, $dataValid);
|
||||
codeBlock();
|
||||
});
|
||||
}
|
||||
check$data(valid = codegen_1.nil, $dataValid = codegen_1.nil) {
|
||||
if (!this.$data)
|
||||
return;
|
||||
const { gen, schemaCode, schemaType, def } = this;
|
||||
gen.if((0, codegen_1.or)((0, codegen_1._) `${schemaCode} === undefined`, $dataValid));
|
||||
if (valid !== codegen_1.nil)
|
||||
gen.assign(valid, true);
|
||||
if (schemaType.length || def.validateSchema) {
|
||||
gen.elseIf(this.invalid$data());
|
||||
this.$dataError();
|
||||
if (valid !== codegen_1.nil)
|
||||
gen.assign(valid, false);
|
||||
}
|
||||
gen.else();
|
||||
}
|
||||
invalid$data() {
|
||||
const { gen, schemaCode, schemaType, def, it } = this;
|
||||
return (0, codegen_1.or)(wrong$DataType(), invalid$DataSchema());
|
||||
function wrong$DataType() {
|
||||
if (schemaType.length) {
|
||||
/* istanbul ignore if */
|
||||
if (!(schemaCode instanceof codegen_1.Name))
|
||||
throw new Error("ajv implementation error");
|
||||
const st = Array.isArray(schemaType) ? schemaType : [schemaType];
|
||||
return (0, codegen_1._) `${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`;
|
||||
}
|
||||
return codegen_1.nil;
|
||||
}
|
||||
function invalid$DataSchema() {
|
||||
if (def.validateSchema) {
|
||||
const validateSchemaRef = gen.scopeValue("validate$data", { ref: def.validateSchema }); // TODO value.code for standalone
|
||||
return (0, codegen_1._) `!${validateSchemaRef}(${schemaCode})`;
|
||||
}
|
||||
return codegen_1.nil;
|
||||
}
|
||||
}
|
||||
subschema(appl, valid) {
|
||||
const subschema = (0, subschema_1.getSubschema)(this.it, appl);
|
||||
(0, subschema_1.extendSubschemaData)(subschema, this.it, appl);
|
||||
(0, subschema_1.extendSubschemaMode)(subschema, appl);
|
||||
const nextContext = { ...this.it, ...subschema, items: undefined, props: undefined };
|
||||
subschemaCode(nextContext, valid);
|
||||
return nextContext;
|
||||
}
|
||||
mergeEvaluated(schemaCxt, toName) {
|
||||
const { it, gen } = this;
|
||||
if (!it.opts.unevaluated)
|
||||
return;
|
||||
if (it.props !== true && schemaCxt.props !== undefined) {
|
||||
it.props = util_1.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName);
|
||||
}
|
||||
if (it.items !== true && schemaCxt.items !== undefined) {
|
||||
it.items = util_1.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName);
|
||||
}
|
||||
}
|
||||
mergeValidEvaluated(schemaCxt, valid) {
|
||||
const { it, gen } = this;
|
||||
if (it.opts.unevaluated && (it.props !== true || it.items !== true)) {
|
||||
gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1.Name));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.KeywordCxt = KeywordCxt;
|
||||
function keywordCode(it, keyword, def, ruleType) {
|
||||
const cxt = new KeywordCxt(it, def, keyword);
|
||||
if ("code" in def) {
|
||||
def.code(cxt, ruleType);
|
||||
}
|
||||
else if (cxt.$data && def.validate) {
|
||||
(0, keyword_1.funcKeywordCode)(cxt, def);
|
||||
}
|
||||
else if ("macro" in def) {
|
||||
(0, keyword_1.macroKeywordCode)(cxt, def);
|
||||
}
|
||||
else if (def.compile || def.validate) {
|
||||
(0, keyword_1.funcKeywordCode)(cxt, def);
|
||||
}
|
||||
}
|
||||
const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
|
||||
const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
|
||||
function getData($data, { dataLevel, dataNames, dataPathArr }) {
|
||||
let jsonPointer;
|
||||
let data;
|
||||
if ($data === "")
|
||||
return names_1.default.rootData;
|
||||
if ($data[0] === "/") {
|
||||
if (!JSON_POINTER.test($data))
|
||||
throw new Error(`Invalid JSON-pointer: ${$data}`);
|
||||
jsonPointer = $data;
|
||||
data = names_1.default.rootData;
|
||||
}
|
||||
else {
|
||||
const matches = RELATIVE_JSON_POINTER.exec($data);
|
||||
if (!matches)
|
||||
throw new Error(`Invalid JSON-pointer: ${$data}`);
|
||||
const up = +matches[1];
|
||||
jsonPointer = matches[2];
|
||||
if (jsonPointer === "#") {
|
||||
if (up >= dataLevel)
|
||||
throw new Error(errorMsg("property/index", up));
|
||||
return dataPathArr[dataLevel - up];
|
||||
}
|
||||
if (up > dataLevel)
|
||||
throw new Error(errorMsg("data", up));
|
||||
data = dataNames[dataLevel - up];
|
||||
if (!jsonPointer)
|
||||
return data;
|
||||
}
|
||||
let expr = data;
|
||||
const segments = jsonPointer.split("/");
|
||||
for (const segment of segments) {
|
||||
if (segment) {
|
||||
data = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment))}`;
|
||||
expr = (0, codegen_1._) `${expr} && ${data}`;
|
||||
}
|
||||
}
|
||||
return expr;
|
||||
function errorMsg(pointerType, up) {
|
||||
return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
|
||||
}
|
||||
}
|
||||
exports.getData = getData;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/ajv/dist/compile/validate/index.js.map
generated
vendored
Normal file
1
node_modules/ajv/dist/compile/validate/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/ajv/dist/compile/validate/keyword.d.ts
generated
vendored
Normal file
8
node_modules/ajv/dist/compile/validate/keyword.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import type { KeywordCxt } from ".";
|
||||
import type { AddedKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition } from "../../types";
|
||||
import type { SchemaObjCxt } from "..";
|
||||
import type { JSONType } from "../rules";
|
||||
export declare function macroKeywordCode(cxt: KeywordCxt, def: MacroKeywordDefinition): void;
|
||||
export declare function funcKeywordCode(cxt: KeywordCxt, def: FuncKeywordDefinition): void;
|
||||
export declare function validSchemaType(schema: unknown, schemaType: JSONType[], allowUndefined?: boolean): boolean;
|
||||
export declare function validateKeywordUsage({ schema, opts, self, errSchemaPath }: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string): void;
|
||||
124
node_modules/ajv/dist/compile/validate/keyword.js
generated
vendored
Normal file
124
node_modules/ajv/dist/compile/validate/keyword.js
generated
vendored
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.validateKeywordUsage = exports.validSchemaType = exports.funcKeywordCode = exports.macroKeywordCode = void 0;
|
||||
const codegen_1 = require("../codegen");
|
||||
const names_1 = require("../names");
|
||||
const code_1 = require("../../vocabularies/code");
|
||||
const errors_1 = require("../errors");
|
||||
function macroKeywordCode(cxt, def) {
|
||||
const { gen, keyword, schema, parentSchema, it } = cxt;
|
||||
const macroSchema = def.macro.call(it.self, schema, parentSchema, it);
|
||||
const schemaRef = useKeyword(gen, keyword, macroSchema);
|
||||
if (it.opts.validateSchema !== false)
|
||||
it.self.validateSchema(macroSchema, true);
|
||||
const valid = gen.name("valid");
|
||||
cxt.subschema({
|
||||
schema: macroSchema,
|
||||
schemaPath: codegen_1.nil,
|
||||
errSchemaPath: `${it.errSchemaPath}/${keyword}`,
|
||||
topSchemaRef: schemaRef,
|
||||
compositeRule: true,
|
||||
}, valid);
|
||||
cxt.pass(valid, () => cxt.error(true));
|
||||
}
|
||||
exports.macroKeywordCode = macroKeywordCode;
|
||||
function funcKeywordCode(cxt, def) {
|
||||
var _a;
|
||||
const { gen, keyword, schema, parentSchema, $data, it } = cxt;
|
||||
checkAsyncKeyword(it, def);
|
||||
const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
|
||||
const validateRef = useKeyword(gen, keyword, validate);
|
||||
const valid = gen.let("valid");
|
||||
cxt.block$data(valid, validateKeyword);
|
||||
cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid);
|
||||
function validateKeyword() {
|
||||
if (def.errors === false) {
|
||||
assignValid();
|
||||
if (def.modifying)
|
||||
modifyData(cxt);
|
||||
reportErrs(() => cxt.error());
|
||||
}
|
||||
else {
|
||||
const ruleErrs = def.async ? validateAsync() : validateSync();
|
||||
if (def.modifying)
|
||||
modifyData(cxt);
|
||||
reportErrs(() => addErrs(cxt, ruleErrs));
|
||||
}
|
||||
}
|
||||
function validateAsync() {
|
||||
const ruleErrs = gen.let("ruleErrs", null);
|
||||
gen.try(() => assignValid((0, codegen_1._) `await `), (e) => gen.assign(valid, false).if((0, codegen_1._) `${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1._) `${e}.errors`), () => gen.throw(e)));
|
||||
return ruleErrs;
|
||||
}
|
||||
function validateSync() {
|
||||
const validateErrs = (0, codegen_1._) `${validateRef}.errors`;
|
||||
gen.assign(validateErrs, null);
|
||||
assignValid(codegen_1.nil);
|
||||
return validateErrs;
|
||||
}
|
||||
function assignValid(_await = def.async ? (0, codegen_1._) `await ` : codegen_1.nil) {
|
||||
const passCxt = it.opts.passContext ? names_1.default.this : names_1.default.self;
|
||||
const passSchema = !(("compile" in def && !$data) || def.schema === false);
|
||||
gen.assign(valid, (0, codegen_1._) `${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
|
||||
}
|
||||
function reportErrs(errors) {
|
||||
var _a;
|
||||
gen.if((0, codegen_1.not)((_a = def.valid) !== null && _a !== void 0 ? _a : valid), errors);
|
||||
}
|
||||
}
|
||||
exports.funcKeywordCode = funcKeywordCode;
|
||||
function modifyData(cxt) {
|
||||
const { gen, data, it } = cxt;
|
||||
gen.if(it.parentData, () => gen.assign(data, (0, codegen_1._) `${it.parentData}[${it.parentDataProperty}]`));
|
||||
}
|
||||
function addErrs(cxt, errs) {
|
||||
const { gen } = cxt;
|
||||
gen.if((0, codegen_1._) `Array.isArray(${errs})`, () => {
|
||||
gen
|
||||
.assign(names_1.default.vErrors, (0, codegen_1._) `${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`)
|
||||
.assign(names_1.default.errors, (0, codegen_1._) `${names_1.default.vErrors}.length`);
|
||||
(0, errors_1.extendErrors)(cxt);
|
||||
}, () => cxt.error());
|
||||
}
|
||||
function checkAsyncKeyword({ schemaEnv }, def) {
|
||||
if (def.async && !schemaEnv.$async)
|
||||
throw new Error("async keyword in sync schema");
|
||||
}
|
||||
function useKeyword(gen, keyword, result) {
|
||||
if (result === undefined)
|
||||
throw new Error(`keyword "${keyword}" failed to compile`);
|
||||
return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1.stringify)(result) });
|
||||
}
|
||||
function validSchemaType(schema, schemaType, allowUndefined = false) {
|
||||
// TODO add tests
|
||||
return (!schemaType.length ||
|
||||
schemaType.some((st) => st === "array"
|
||||
? Array.isArray(schema)
|
||||
: st === "object"
|
||||
? schema && typeof schema == "object" && !Array.isArray(schema)
|
||||
: typeof schema == st || (allowUndefined && typeof schema == "undefined")));
|
||||
}
|
||||
exports.validSchemaType = validSchemaType;
|
||||
function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def, keyword) {
|
||||
/* istanbul ignore if */
|
||||
if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) {
|
||||
throw new Error("ajv implementation error");
|
||||
}
|
||||
const deps = def.dependencies;
|
||||
if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) {
|
||||
throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`);
|
||||
}
|
||||
if (def.validateSchema) {
|
||||
const valid = def.validateSchema(schema[keyword]);
|
||||
if (!valid) {
|
||||
const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` +
|
||||
self.errorsText(def.validateSchema.errors);
|
||||
if (opts.validateSchema === "log")
|
||||
self.logger.error(msg);
|
||||
else
|
||||
throw new Error(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.validateKeywordUsage = validateKeywordUsage;
|
||||
//# sourceMappingURL=keyword.js.map
|
||||
1
node_modules/ajv/dist/compile/validate/keyword.js.map
generated
vendored
Normal file
1
node_modules/ajv/dist/compile/validate/keyword.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
47
node_modules/ajv/dist/compile/validate/subschema.d.ts
generated
vendored
Normal file
47
node_modules/ajv/dist/compile/validate/subschema.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import type { AnySchema } from "../../types";
|
||||
import type { SchemaObjCxt } from "..";
|
||||
import { Code, Name } from "../codegen";
|
||||
import { Type } from "../util";
|
||||
import type { JSONType } from "../rules";
|
||||
export interface SubschemaContext {
|
||||
schema: AnySchema;
|
||||
schemaPath: Code;
|
||||
errSchemaPath: string;
|
||||
topSchemaRef?: Code;
|
||||
errorPath?: Code;
|
||||
dataLevel?: number;
|
||||
dataTypes?: JSONType[];
|
||||
data?: Name;
|
||||
parentData?: Name;
|
||||
parentDataProperty?: Code | number;
|
||||
dataNames?: Name[];
|
||||
dataPathArr?: (Code | number)[];
|
||||
propertyName?: Name;
|
||||
jtdDiscriminator?: string;
|
||||
jtdMetadata?: boolean;
|
||||
compositeRule?: true;
|
||||
createErrors?: boolean;
|
||||
allErrors?: boolean;
|
||||
}
|
||||
export type SubschemaArgs = Partial<{
|
||||
keyword: string;
|
||||
schemaProp: string | number;
|
||||
schema: AnySchema;
|
||||
schemaPath: Code;
|
||||
errSchemaPath: string;
|
||||
topSchemaRef: Code;
|
||||
data: Name | Code;
|
||||
dataProp: Code | string | number;
|
||||
dataTypes: JSONType[];
|
||||
definedProperties: Set<string>;
|
||||
propertyName: Name;
|
||||
dataPropType: Type;
|
||||
jtdDiscriminator: string;
|
||||
jtdMetadata: boolean;
|
||||
compositeRule: true;
|
||||
createErrors: boolean;
|
||||
allErrors: boolean;
|
||||
}>;
|
||||
export declare function getSubschema(it: SchemaObjCxt, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }: SubschemaArgs): SubschemaContext;
|
||||
export declare function extendSubschemaData(subschema: SubschemaContext, it: SchemaObjCxt, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }: SubschemaArgs): void;
|
||||
export declare function extendSubschemaMode(subschema: SubschemaContext, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }: SubschemaArgs): void;
|
||||
81
node_modules/ajv/dist/compile/validate/subschema.js
generated
vendored
Normal file
81
node_modules/ajv/dist/compile/validate/subschema.js
generated
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = void 0;
|
||||
const codegen_1 = require("../codegen");
|
||||
const util_1 = require("../util");
|
||||
function getSubschema(it, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
|
||||
if (keyword !== undefined && schema !== undefined) {
|
||||
throw new Error('both "keyword" and "schema" passed, only one allowed');
|
||||
}
|
||||
if (keyword !== undefined) {
|
||||
const sch = it.schema[keyword];
|
||||
return schemaProp === undefined
|
||||
? {
|
||||
schema: sch,
|
||||
schemaPath: (0, codegen_1._) `${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}`,
|
||||
errSchemaPath: `${it.errSchemaPath}/${keyword}`,
|
||||
}
|
||||
: {
|
||||
schema: sch[schemaProp],
|
||||
schemaPath: (0, codegen_1._) `${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}${(0, codegen_1.getProperty)(schemaProp)}`,
|
||||
errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`,
|
||||
};
|
||||
}
|
||||
if (schema !== undefined) {
|
||||
if (schemaPath === undefined || errSchemaPath === undefined || topSchemaRef === undefined) {
|
||||
throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
|
||||
}
|
||||
return {
|
||||
schema,
|
||||
schemaPath,
|
||||
topSchemaRef,
|
||||
errSchemaPath,
|
||||
};
|
||||
}
|
||||
throw new Error('either "keyword" or "schema" must be passed');
|
||||
}
|
||||
exports.getSubschema = getSubschema;
|
||||
function extendSubschemaData(subschema, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) {
|
||||
if (data !== undefined && dataProp !== undefined) {
|
||||
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
||||
}
|
||||
const { gen } = it;
|
||||
if (dataProp !== undefined) {
|
||||
const { errorPath, dataPathArr, opts } = it;
|
||||
const nextData = gen.let("data", (0, codegen_1._) `${it.data}${(0, codegen_1.getProperty)(dataProp)}`, true);
|
||||
dataContextProps(nextData);
|
||||
subschema.errorPath = (0, codegen_1.str) `${errorPath}${(0, util_1.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`;
|
||||
subschema.parentDataProperty = (0, codegen_1._) `${dataProp}`;
|
||||
subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty];
|
||||
}
|
||||
if (data !== undefined) {
|
||||
const nextData = data instanceof codegen_1.Name ? data : gen.let("data", data, true); // replaceable if used once?
|
||||
dataContextProps(nextData);
|
||||
if (propertyName !== undefined)
|
||||
subschema.propertyName = propertyName;
|
||||
// TODO something is possibly wrong here with not changing parentDataProperty and not appending dataPathArr
|
||||
}
|
||||
if (dataTypes)
|
||||
subschema.dataTypes = dataTypes;
|
||||
function dataContextProps(_nextData) {
|
||||
subschema.data = _nextData;
|
||||
subschema.dataLevel = it.dataLevel + 1;
|
||||
subschema.dataTypes = [];
|
||||
it.definedProperties = new Set();
|
||||
subschema.parentData = it.data;
|
||||
subschema.dataNames = [...it.dataNames, _nextData];
|
||||
}
|
||||
}
|
||||
exports.extendSubschemaData = extendSubschemaData;
|
||||
function extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) {
|
||||
if (compositeRule !== undefined)
|
||||
subschema.compositeRule = compositeRule;
|
||||
if (createErrors !== undefined)
|
||||
subschema.createErrors = createErrors;
|
||||
if (allErrors !== undefined)
|
||||
subschema.allErrors = allErrors;
|
||||
subschema.jtdDiscriminator = jtdDiscriminator; // not inherited
|
||||
subschema.jtdMetadata = jtdMetadata; // not inherited
|
||||
}
|
||||
exports.extendSubschemaMode = extendSubschemaMode;
|
||||
//# sourceMappingURL=subschema.js.map
|
||||
1
node_modules/ajv/dist/compile/validate/subschema.js.map
generated
vendored
Normal file
1
node_modules/ajv/dist/compile/validate/subschema.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"subschema.js","sourceRoot":"","sources":["../../../lib/compile/validate/subschema.ts"],"names":[],"mappings":"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"}
|
||||
Loading…
Add table
Add a link
Reference in a new issue