@spooky-sync/cli 0.0.1-canary.376 → 0.0.1-canary.378

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/devtools-mcp/index.js +839 -881
  2. package/package.json +6 -6
@@ -16369,8 +16369,8 @@ var scope = {};
16369
16369
  var util = {};
16370
16370
  Object.defineProperty(util, "__esModule", { value: true });
16371
16371
  util.checkStrictMode = util.getErrorPath = util.Type = util.useFunc = util.setEvaluated = util.evaluatedPropsToName = util.mergeEvaluated = util.eachItem = util.unescapeJsonPointer = util.escapeJsonPointer = util.escapeFragment = util.unescapeFragment = util.schemaRefOrVal = util.schemaHasRulesButRef = util.schemaHasRules = util.checkUnknownRules = util.alwaysValidSchema = util.toHash = void 0;
16372
- const codegen_1$q = codegen;
16373
- const code_1$9 = code$1;
16372
+ const codegen_1$v = codegen;
16373
+ const code_1$a = code$1;
16374
16374
  function toHash(arr) {
16375
16375
  const hash = {};
16376
16376
  for (const item of arr)
@@ -16423,9 +16423,9 @@ function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword2, $data) {
16423
16423
  if (typeof schema == "number" || typeof schema == "boolean")
16424
16424
  return schema;
16425
16425
  if (typeof schema == "string")
16426
- return (0, codegen_1$q._)`${schema}`;
16426
+ return (0, codegen_1$v._)`${schema}`;
16427
16427
  }
16428
- return (0, codegen_1$q._)`${topSchemaRef}${schemaPath}${(0, codegen_1$q.getProperty)(keyword2)}`;
16428
+ return (0, codegen_1$v._)`${topSchemaRef}${schemaPath}${(0, codegen_1$v.getProperty)(keyword2)}`;
16429
16429
  }
16430
16430
  util.schemaRefOrVal = schemaRefOrVal;
16431
16431
  function unescapeFragment(str) {
@@ -16457,20 +16457,20 @@ function eachItem(xs, f) {
16457
16457
  util.eachItem = eachItem;
16458
16458
  function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues: mergeValues2, resultToName }) {
16459
16459
  return (gen, from, to, toName) => {
16460
- const res = to === void 0 ? from : to instanceof codegen_1$q.Name ? (from instanceof codegen_1$q.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1$q.Name ? (mergeToName(gen, to, from), from) : mergeValues2(from, to);
16461
- return toName === codegen_1$q.Name && !(res instanceof codegen_1$q.Name) ? resultToName(gen, res) : res;
16460
+ const res = to === void 0 ? from : to instanceof codegen_1$v.Name ? (from instanceof codegen_1$v.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1$v.Name ? (mergeToName(gen, to, from), from) : mergeValues2(from, to);
16461
+ return toName === codegen_1$v.Name && !(res instanceof codegen_1$v.Name) ? resultToName(gen, res) : res;
16462
16462
  };
16463
16463
  }
16464
16464
  util.mergeEvaluated = {
16465
16465
  props: makeMergeEvaluated({
16466
- mergeNames: (gen, from, to) => gen.if((0, codegen_1$q._)`${to} !== true && ${from} !== undefined`, () => {
16467
- gen.if((0, codegen_1$q._)`${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1$q._)`${to} || {}`).code((0, codegen_1$q._)`Object.assign(${to}, ${from})`));
16466
+ mergeNames: (gen, from, to) => gen.if((0, codegen_1$v._)`${to} !== true && ${from} !== undefined`, () => {
16467
+ gen.if((0, codegen_1$v._)`${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1$v._)`${to} || {}`).code((0, codegen_1$v._)`Object.assign(${to}, ${from})`));
16468
16468
  }),
16469
- mergeToName: (gen, from, to) => gen.if((0, codegen_1$q._)`${to} !== true`, () => {
16469
+ mergeToName: (gen, from, to) => gen.if((0, codegen_1$v._)`${to} !== true`, () => {
16470
16470
  if (from === true) {
16471
16471
  gen.assign(to, true);
16472
16472
  } else {
16473
- gen.assign(to, (0, codegen_1$q._)`${to} || {}`);
16473
+ gen.assign(to, (0, codegen_1$v._)`${to} || {}`);
16474
16474
  setEvaluated(gen, to, from);
16475
16475
  }
16476
16476
  }),
@@ -16478,8 +16478,8 @@ util.mergeEvaluated = {
16478
16478
  resultToName: evaluatedPropsToName
16479
16479
  }),
16480
16480
  items: makeMergeEvaluated({
16481
- mergeNames: (gen, from, to) => gen.if((0, codegen_1$q._)`${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1$q._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
16482
- mergeToName: (gen, from, to) => gen.if((0, codegen_1$q._)`${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1$q._)`${to} > ${from} ? ${to} : ${from}`)),
16481
+ mergeNames: (gen, from, to) => gen.if((0, codegen_1$v._)`${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1$v._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
16482
+ mergeToName: (gen, from, to) => gen.if((0, codegen_1$v._)`${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1$v._)`${to} > ${from} ? ${to} : ${from}`)),
16483
16483
  mergeValues: (from, to) => from === true ? true : Math.max(from, to),
16484
16484
  resultToName: (gen, items2) => gen.var("items", items2)
16485
16485
  })
@@ -16487,21 +16487,21 @@ util.mergeEvaluated = {
16487
16487
  function evaluatedPropsToName(gen, ps) {
16488
16488
  if (ps === true)
16489
16489
  return gen.var("props", true);
16490
- const props = gen.var("props", (0, codegen_1$q._)`{}`);
16490
+ const props = gen.var("props", (0, codegen_1$v._)`{}`);
16491
16491
  if (ps !== void 0)
16492
16492
  setEvaluated(gen, props, ps);
16493
16493
  return props;
16494
16494
  }
16495
16495
  util.evaluatedPropsToName = evaluatedPropsToName;
16496
16496
  function setEvaluated(gen, props, ps) {
16497
- Object.keys(ps).forEach((p) => gen.assign((0, codegen_1$q._)`${props}${(0, codegen_1$q.getProperty)(p)}`, true));
16497
+ Object.keys(ps).forEach((p) => gen.assign((0, codegen_1$v._)`${props}${(0, codegen_1$v.getProperty)(p)}`, true));
16498
16498
  }
16499
16499
  util.setEvaluated = setEvaluated;
16500
16500
  const snippets = {};
16501
16501
  function useFunc(gen, f) {
16502
16502
  return gen.scopeValue("func", {
16503
16503
  ref: f,
16504
- code: snippets[f.code] || (snippets[f.code] = new code_1$9._Code(f.code))
16504
+ code: snippets[f.code] || (snippets[f.code] = new code_1$a._Code(f.code))
16505
16505
  });
16506
16506
  }
16507
16507
  util.useFunc = useFunc;
@@ -16511,11 +16511,11 @@ var Type;
16511
16511
  Type2[Type2["Str"] = 1] = "Str";
16512
16512
  })(Type || (util.Type = Type = {}));
16513
16513
  function getErrorPath(dataProp, dataPropType, jsPropertySyntax) {
16514
- if (dataProp instanceof codegen_1$q.Name) {
16514
+ if (dataProp instanceof codegen_1$v.Name) {
16515
16515
  const isNumber = dataPropType === Type.Num;
16516
- return jsPropertySyntax ? isNumber ? (0, codegen_1$q._)`"[" + ${dataProp} + "]"` : (0, codegen_1$q._)`"['" + ${dataProp} + "']"` : isNumber ? (0, codegen_1$q._)`"/" + ${dataProp}` : (0, codegen_1$q._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
16516
+ return jsPropertySyntax ? isNumber ? (0, codegen_1$v._)`"[" + ${dataProp} + "]"` : (0, codegen_1$v._)`"['" + ${dataProp} + "']"` : isNumber ? (0, codegen_1$v._)`"/" + ${dataProp}` : (0, codegen_1$v._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
16517
16517
  }
16518
- return jsPropertySyntax ? (0, codegen_1$q.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
16518
+ return jsPropertySyntax ? (0, codegen_1$v.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
16519
16519
  }
16520
16520
  util.getErrorPath = getErrorPath;
16521
16521
  function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
@@ -16529,35 +16529,35 @@ function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
16529
16529
  util.checkStrictMode = checkStrictMode;
16530
16530
  var names$1 = {};
16531
16531
  Object.defineProperty(names$1, "__esModule", { value: true });
16532
- const codegen_1$p = codegen;
16532
+ const codegen_1$u = codegen;
16533
16533
  const names = {
16534
16534
  // validation function arguments
16535
- data: new codegen_1$p.Name("data"),
16535
+ data: new codegen_1$u.Name("data"),
16536
16536
  // data passed to validation function
16537
16537
  // args passed from referencing schema
16538
- valCxt: new codegen_1$p.Name("valCxt"),
16538
+ valCxt: new codegen_1$u.Name("valCxt"),
16539
16539
  // validation/data context - should not be used directly, it is destructured to the names below
16540
- instancePath: new codegen_1$p.Name("instancePath"),
16541
- parentData: new codegen_1$p.Name("parentData"),
16542
- parentDataProperty: new codegen_1$p.Name("parentDataProperty"),
16543
- rootData: new codegen_1$p.Name("rootData"),
16540
+ instancePath: new codegen_1$u.Name("instancePath"),
16541
+ parentData: new codegen_1$u.Name("parentData"),
16542
+ parentDataProperty: new codegen_1$u.Name("parentDataProperty"),
16543
+ rootData: new codegen_1$u.Name("rootData"),
16544
16544
  // root data - same as the data passed to the first/top validation function
16545
- dynamicAnchors: new codegen_1$p.Name("dynamicAnchors"),
16545
+ dynamicAnchors: new codegen_1$u.Name("dynamicAnchors"),
16546
16546
  // used to support recursiveRef and dynamicRef
16547
16547
  // function scoped variables
16548
- vErrors: new codegen_1$p.Name("vErrors"),
16548
+ vErrors: new codegen_1$u.Name("vErrors"),
16549
16549
  // null or array of validation errors
16550
- errors: new codegen_1$p.Name("errors"),
16550
+ errors: new codegen_1$u.Name("errors"),
16551
16551
  // counter of validation errors
16552
- this: new codegen_1$p.Name("this"),
16552
+ this: new codegen_1$u.Name("this"),
16553
16553
  // "globals"
16554
- self: new codegen_1$p.Name("self"),
16555
- scope: new codegen_1$p.Name("scope"),
16554
+ self: new codegen_1$u.Name("self"),
16555
+ scope: new codegen_1$u.Name("scope"),
16556
16556
  // JTD serialize/parse name for JSON string and position
16557
- json: new codegen_1$p.Name("json"),
16558
- jsonPos: new codegen_1$p.Name("jsonPos"),
16559
- jsonLen: new codegen_1$p.Name("jsonLen"),
16560
- jsonPart: new codegen_1$p.Name("jsonPart")
16557
+ json: new codegen_1$u.Name("json"),
16558
+ jsonPos: new codegen_1$u.Name("jsonPos"),
16559
+ jsonLen: new codegen_1$u.Name("jsonLen"),
16560
+ jsonPart: new codegen_1$u.Name("jsonPart")
16561
16561
  };
16562
16562
  names$1.default = names;
16563
16563
  (function(exports) {
@@ -16677,55 +16677,49 @@ names$1.default = names;
16677
16677
  keyValues.push([E.propertyName, propertyName]);
16678
16678
  }
16679
16679
  })(errors);
16680
- var hasRequiredBoolSchema;
16681
- function requireBoolSchema() {
16682
- if (hasRequiredBoolSchema) return boolSchema;
16683
- hasRequiredBoolSchema = 1;
16684
- Object.defineProperty(boolSchema, "__esModule", { value: true });
16685
- boolSchema.boolOrEmptySchema = boolSchema.topBoolOrEmptySchema = void 0;
16686
- const errors_12 = errors;
16687
- const codegen_12 = codegen;
16688
- const names_12 = names$1;
16689
- const boolError = {
16690
- message: "boolean schema is false"
16691
- };
16692
- function topBoolOrEmptySchema(it) {
16693
- const { gen, schema, validateName } = it;
16694
- if (schema === false) {
16695
- falseSchemaError(it, false);
16696
- } else if (typeof schema == "object" && schema.$async === true) {
16697
- gen.return(names_12.default.data);
16698
- } else {
16699
- gen.assign((0, codegen_12._)`${validateName}.errors`, null);
16700
- gen.return(true);
16701
- }
16702
- }
16703
- boolSchema.topBoolOrEmptySchema = topBoolOrEmptySchema;
16704
- function boolOrEmptySchema(it, valid) {
16705
- const { gen, schema } = it;
16706
- if (schema === false) {
16707
- gen.var(valid, false);
16708
- falseSchemaError(it);
16709
- } else {
16710
- gen.var(valid, true);
16711
- }
16680
+ Object.defineProperty(boolSchema, "__esModule", { value: true });
16681
+ boolSchema.boolOrEmptySchema = boolSchema.topBoolOrEmptySchema = void 0;
16682
+ const errors_1$3 = errors;
16683
+ const codegen_1$t = codegen;
16684
+ const names_1$6 = names$1;
16685
+ const boolError = {
16686
+ message: "boolean schema is false"
16687
+ };
16688
+ function topBoolOrEmptySchema(it) {
16689
+ const { gen, schema, validateName } = it;
16690
+ if (schema === false) {
16691
+ falseSchemaError(it, false);
16692
+ } else if (typeof schema == "object" && schema.$async === true) {
16693
+ gen.return(names_1$6.default.data);
16694
+ } else {
16695
+ gen.assign((0, codegen_1$t._)`${validateName}.errors`, null);
16696
+ gen.return(true);
16712
16697
  }
16713
- boolSchema.boolOrEmptySchema = boolOrEmptySchema;
16714
- function falseSchemaError(it, overrideAllErrors) {
16715
- const { gen, data } = it;
16716
- const cxt = {
16717
- gen,
16718
- keyword: "false schema",
16719
- data,
16720
- schema: false,
16721
- schemaCode: false,
16722
- schemaValue: false,
16723
- params: {},
16724
- it
16725
- };
16726
- (0, errors_12.reportError)(cxt, boolError, void 0, overrideAllErrors);
16698
+ }
16699
+ boolSchema.topBoolOrEmptySchema = topBoolOrEmptySchema;
16700
+ function boolOrEmptySchema(it, valid) {
16701
+ const { gen, schema } = it;
16702
+ if (schema === false) {
16703
+ gen.var(valid, false);
16704
+ falseSchemaError(it);
16705
+ } else {
16706
+ gen.var(valid, true);
16727
16707
  }
16728
- return boolSchema;
16708
+ }
16709
+ boolSchema.boolOrEmptySchema = boolOrEmptySchema;
16710
+ function falseSchemaError(it, overrideAllErrors) {
16711
+ const { gen, data } = it;
16712
+ const cxt = {
16713
+ gen,
16714
+ keyword: "false schema",
16715
+ data,
16716
+ schema: false,
16717
+ schemaCode: false,
16718
+ schemaValue: false,
16719
+ params: {},
16720
+ it
16721
+ };
16722
+ (0, errors_1$3.reportError)(cxt, boolError, void 0, overrideAllErrors);
16729
16723
  }
16730
16724
  var dataType = {};
16731
16725
  var rules = {};
@@ -16754,35 +16748,29 @@ function getRules() {
16754
16748
  }
16755
16749
  rules.getRules = getRules;
16756
16750
  var applicability = {};
16757
- var hasRequiredApplicability;
16758
- function requireApplicability() {
16759
- if (hasRequiredApplicability) return applicability;
16760
- hasRequiredApplicability = 1;
16761
- Object.defineProperty(applicability, "__esModule", { value: true });
16762
- applicability.shouldUseRule = applicability.shouldUseGroup = applicability.schemaHasRulesForType = void 0;
16763
- function schemaHasRulesForType({ schema, self }, type2) {
16764
- const group = self.RULES.types[type2];
16765
- return group && group !== true && shouldUseGroup(schema, group);
16766
- }
16767
- applicability.schemaHasRulesForType = schemaHasRulesForType;
16768
- function shouldUseGroup(schema, group) {
16769
- return group.rules.some((rule) => shouldUseRule(schema, rule));
16770
- }
16771
- applicability.shouldUseGroup = shouldUseGroup;
16772
- function shouldUseRule(schema, rule) {
16773
- var _a;
16774
- return schema[rule.keyword] !== void 0 || ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== void 0));
16775
- }
16776
- applicability.shouldUseRule = shouldUseRule;
16777
- return applicability;
16751
+ Object.defineProperty(applicability, "__esModule", { value: true });
16752
+ applicability.shouldUseRule = applicability.shouldUseGroup = applicability.schemaHasRulesForType = void 0;
16753
+ function schemaHasRulesForType({ schema, self }, type2) {
16754
+ const group = self.RULES.types[type2];
16755
+ return group && group !== true && shouldUseGroup(schema, group);
16756
+ }
16757
+ applicability.schemaHasRulesForType = schemaHasRulesForType;
16758
+ function shouldUseGroup(schema, group) {
16759
+ return group.rules.some((rule) => shouldUseRule(schema, rule));
16760
+ }
16761
+ applicability.shouldUseGroup = shouldUseGroup;
16762
+ function shouldUseRule(schema, rule) {
16763
+ var _a;
16764
+ return schema[rule.keyword] !== void 0 || ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== void 0));
16778
16765
  }
16766
+ applicability.shouldUseRule = shouldUseRule;
16779
16767
  Object.defineProperty(dataType, "__esModule", { value: true });
16780
16768
  dataType.reportTypeError = dataType.checkDataTypes = dataType.checkDataType = dataType.coerceAndCheckDataType = dataType.getJSONTypes = dataType.getSchemaTypes = dataType.DataType = void 0;
16781
16769
  const rules_1 = rules;
16782
- const applicability_1 = requireApplicability();
16783
- const errors_1 = errors;
16784
- const codegen_1$o = codegen;
16785
- const util_1$o = util;
16770
+ const applicability_1$1 = applicability;
16771
+ const errors_1$2 = errors;
16772
+ const codegen_1$s = codegen;
16773
+ const util_1$r = util;
16786
16774
  var DataType;
16787
16775
  (function(DataType2) {
16788
16776
  DataType2[DataType2["Correct"] = 0] = "Correct";
@@ -16814,7 +16802,7 @@ dataType.getJSONTypes = getJSONTypes;
16814
16802
  function coerceAndCheckDataType(it, types2) {
16815
16803
  const { gen, data, opts } = it;
16816
16804
  const coerceTo = coerceToTypes(types2, opts.coerceTypes);
16817
- const checkTypes = types2.length > 0 && !(coerceTo.length === 0 && types2.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types2[0]));
16805
+ const checkTypes = types2.length > 0 && !(coerceTo.length === 0 && types2.length === 1 && (0, applicability_1$1.schemaHasRulesForType)(it, types2[0]));
16818
16806
  if (checkTypes) {
16819
16807
  const wrongType = checkDataTypes(types2, data, opts.strictNumbers, DataType.Wrong);
16820
16808
  gen.if(wrongType, () => {
@@ -16833,12 +16821,12 @@ function coerceToTypes(types2, coerceTypes) {
16833
16821
  }
16834
16822
  function coerceData(it, types2, coerceTo) {
16835
16823
  const { gen, data, opts } = it;
16836
- const dataType2 = gen.let("dataType", (0, codegen_1$o._)`typeof ${data}`);
16837
- const coerced = gen.let("coerced", (0, codegen_1$o._)`undefined`);
16824
+ const dataType2 = gen.let("dataType", (0, codegen_1$s._)`typeof ${data}`);
16825
+ const coerced = gen.let("coerced", (0, codegen_1$s._)`undefined`);
16838
16826
  if (opts.coerceTypes === "array") {
16839
- gen.if((0, codegen_1$o._)`${dataType2} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1$o._)`${data}[0]`).assign(dataType2, (0, codegen_1$o._)`typeof ${data}`).if(checkDataTypes(types2, data, opts.strictNumbers), () => gen.assign(coerced, data)));
16827
+ gen.if((0, codegen_1$s._)`${dataType2} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1$s._)`${data}[0]`).assign(dataType2, (0, codegen_1$s._)`typeof ${data}`).if(checkDataTypes(types2, data, opts.strictNumbers), () => gen.assign(coerced, data)));
16840
16828
  }
16841
- gen.if((0, codegen_1$o._)`${coerced} !== undefined`);
16829
+ gen.if((0, codegen_1$s._)`${coerced} !== undefined`);
16842
16830
  for (const t of coerceTo) {
16843
16831
  if (COERCIBLE.has(t) || t === "array" && opts.coerceTypes === "array") {
16844
16832
  coerceSpecificType(t);
@@ -16847,63 +16835,63 @@ function coerceData(it, types2, coerceTo) {
16847
16835
  gen.else();
16848
16836
  reportTypeError(it);
16849
16837
  gen.endIf();
16850
- gen.if((0, codegen_1$o._)`${coerced} !== undefined`, () => {
16838
+ gen.if((0, codegen_1$s._)`${coerced} !== undefined`, () => {
16851
16839
  gen.assign(data, coerced);
16852
16840
  assignParentData(it, coerced);
16853
16841
  });
16854
16842
  function coerceSpecificType(t) {
16855
16843
  switch (t) {
16856
16844
  case "string":
16857
- gen.elseIf((0, codegen_1$o._)`${dataType2} == "number" || ${dataType2} == "boolean"`).assign(coerced, (0, codegen_1$o._)`"" + ${data}`).elseIf((0, codegen_1$o._)`${data} === null`).assign(coerced, (0, codegen_1$o._)`""`);
16845
+ gen.elseIf((0, codegen_1$s._)`${dataType2} == "number" || ${dataType2} == "boolean"`).assign(coerced, (0, codegen_1$s._)`"" + ${data}`).elseIf((0, codegen_1$s._)`${data} === null`).assign(coerced, (0, codegen_1$s._)`""`);
16858
16846
  return;
16859
16847
  case "number":
16860
- gen.elseIf((0, codegen_1$o._)`${dataType2} == "boolean" || ${data} === null
16861
- || (${dataType2} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1$o._)`+${data}`);
16848
+ gen.elseIf((0, codegen_1$s._)`${dataType2} == "boolean" || ${data} === null
16849
+ || (${dataType2} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1$s._)`+${data}`);
16862
16850
  return;
16863
16851
  case "integer":
16864
- gen.elseIf((0, codegen_1$o._)`${dataType2} === "boolean" || ${data} === null
16865
- || (${dataType2} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`).assign(coerced, (0, codegen_1$o._)`+${data}`);
16852
+ gen.elseIf((0, codegen_1$s._)`${dataType2} === "boolean" || ${data} === null
16853
+ || (${dataType2} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`).assign(coerced, (0, codegen_1$s._)`+${data}`);
16866
16854
  return;
16867
16855
  case "boolean":
16868
- gen.elseIf((0, codegen_1$o._)`${data} === "false" || ${data} === 0 || ${data} === null`).assign(coerced, false).elseIf((0, codegen_1$o._)`${data} === "true" || ${data} === 1`).assign(coerced, true);
16856
+ gen.elseIf((0, codegen_1$s._)`${data} === "false" || ${data} === 0 || ${data} === null`).assign(coerced, false).elseIf((0, codegen_1$s._)`${data} === "true" || ${data} === 1`).assign(coerced, true);
16869
16857
  return;
16870
16858
  case "null":
16871
- gen.elseIf((0, codegen_1$o._)`${data} === "" || ${data} === 0 || ${data} === false`);
16859
+ gen.elseIf((0, codegen_1$s._)`${data} === "" || ${data} === 0 || ${data} === false`);
16872
16860
  gen.assign(coerced, null);
16873
16861
  return;
16874
16862
  case "array":
16875
- gen.elseIf((0, codegen_1$o._)`${dataType2} === "string" || ${dataType2} === "number"
16876
- || ${dataType2} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1$o._)`[${data}]`);
16863
+ gen.elseIf((0, codegen_1$s._)`${dataType2} === "string" || ${dataType2} === "number"
16864
+ || ${dataType2} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1$s._)`[${data}]`);
16877
16865
  }
16878
16866
  }
16879
16867
  }
16880
16868
  function assignParentData({ gen, parentData, parentDataProperty }, expr) {
16881
- gen.if((0, codegen_1$o._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1$o._)`${parentData}[${parentDataProperty}]`, expr));
16869
+ gen.if((0, codegen_1$s._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1$s._)`${parentData}[${parentDataProperty}]`, expr));
16882
16870
  }
16883
16871
  function checkDataType(dataType2, data, strictNums, correct = DataType.Correct) {
16884
- const EQ = correct === DataType.Correct ? codegen_1$o.operators.EQ : codegen_1$o.operators.NEQ;
16872
+ const EQ = correct === DataType.Correct ? codegen_1$s.operators.EQ : codegen_1$s.operators.NEQ;
16885
16873
  let cond;
16886
16874
  switch (dataType2) {
16887
16875
  case "null":
16888
- return (0, codegen_1$o._)`${data} ${EQ} null`;
16876
+ return (0, codegen_1$s._)`${data} ${EQ} null`;
16889
16877
  case "array":
16890
- cond = (0, codegen_1$o._)`Array.isArray(${data})`;
16878
+ cond = (0, codegen_1$s._)`Array.isArray(${data})`;
16891
16879
  break;
16892
16880
  case "object":
16893
- cond = (0, codegen_1$o._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
16881
+ cond = (0, codegen_1$s._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
16894
16882
  break;
16895
16883
  case "integer":
16896
- cond = numCond((0, codegen_1$o._)`!(${data} % 1) && !isNaN(${data})`);
16884
+ cond = numCond((0, codegen_1$s._)`!(${data} % 1) && !isNaN(${data})`);
16897
16885
  break;
16898
16886
  case "number":
16899
16887
  cond = numCond();
16900
16888
  break;
16901
16889
  default:
16902
- return (0, codegen_1$o._)`typeof ${data} ${EQ} ${dataType2}`;
16890
+ return (0, codegen_1$s._)`typeof ${data} ${EQ} ${dataType2}`;
16903
16891
  }
16904
- return correct === DataType.Correct ? cond : (0, codegen_1$o.not)(cond);
16905
- function numCond(_cond = codegen_1$o.nil) {
16906
- return (0, codegen_1$o.and)((0, codegen_1$o._)`typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1$o._)`isFinite(${data})` : codegen_1$o.nil);
16892
+ return correct === DataType.Correct ? cond : (0, codegen_1$s.not)(cond);
16893
+ function numCond(_cond = codegen_1$s.nil) {
16894
+ return (0, codegen_1$s.and)((0, codegen_1$s._)`typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1$s._)`isFinite(${data})` : codegen_1$s.nil);
16907
16895
  }
16908
16896
  }
16909
16897
  dataType.checkDataType = checkDataType;
@@ -16912,35 +16900,35 @@ function checkDataTypes(dataTypes, data, strictNums, correct) {
16912
16900
  return checkDataType(dataTypes[0], data, strictNums, correct);
16913
16901
  }
16914
16902
  let cond;
16915
- const types2 = (0, util_1$o.toHash)(dataTypes);
16903
+ const types2 = (0, util_1$r.toHash)(dataTypes);
16916
16904
  if (types2.array && types2.object) {
16917
- const notObj = (0, codegen_1$o._)`typeof ${data} != "object"`;
16918
- cond = types2.null ? notObj : (0, codegen_1$o._)`!${data} || ${notObj}`;
16905
+ const notObj = (0, codegen_1$s._)`typeof ${data} != "object"`;
16906
+ cond = types2.null ? notObj : (0, codegen_1$s._)`!${data} || ${notObj}`;
16919
16907
  delete types2.null;
16920
16908
  delete types2.array;
16921
16909
  delete types2.object;
16922
16910
  } else {
16923
- cond = codegen_1$o.nil;
16911
+ cond = codegen_1$s.nil;
16924
16912
  }
16925
16913
  if (types2.number)
16926
16914
  delete types2.integer;
16927
16915
  for (const t in types2)
16928
- cond = (0, codegen_1$o.and)(cond, checkDataType(t, data, strictNums, correct));
16916
+ cond = (0, codegen_1$s.and)(cond, checkDataType(t, data, strictNums, correct));
16929
16917
  return cond;
16930
16918
  }
16931
16919
  dataType.checkDataTypes = checkDataTypes;
16932
16920
  const typeError = {
16933
16921
  message: ({ schema }) => `must be ${schema}`,
16934
- params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1$o._)`{type: ${schema}}` : (0, codegen_1$o._)`{type: ${schemaValue}}`
16922
+ params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1$s._)`{type: ${schema}}` : (0, codegen_1$s._)`{type: ${schemaValue}}`
16935
16923
  };
16936
16924
  function reportTypeError(it) {
16937
16925
  const cxt = getTypeErrorContext(it);
16938
- (0, errors_1.reportError)(cxt, typeError);
16926
+ (0, errors_1$2.reportError)(cxt, typeError);
16939
16927
  }
16940
16928
  dataType.reportTypeError = reportTypeError;
16941
16929
  function getTypeErrorContext(it) {
16942
16930
  const { gen, data, schema } = it;
16943
- const schemaCode = (0, util_1$o.schemaRefOrVal)(it, schema, "type");
16931
+ const schemaCode = (0, util_1$r.schemaRefOrVal)(it, schema, "type");
16944
16932
  return {
16945
16933
  gen,
16946
16934
  keyword: "type",
@@ -16954,60 +16942,54 @@ function getTypeErrorContext(it) {
16954
16942
  };
16955
16943
  }
16956
16944
  var defaults = {};
16957
- var hasRequiredDefaults;
16958
- function requireDefaults() {
16959
- if (hasRequiredDefaults) return defaults;
16960
- hasRequiredDefaults = 1;
16961
- Object.defineProperty(defaults, "__esModule", { value: true });
16962
- defaults.assignDefaults = void 0;
16963
- const codegen_12 = codegen;
16964
- const util_12 = util;
16965
- function assignDefaults(it, ty) {
16966
- const { properties: properties2, items: items2 } = it.schema;
16967
- if (ty === "object" && properties2) {
16968
- for (const key in properties2) {
16969
- assignDefault(it, key, properties2[key].default);
16970
- }
16971
- } else if (ty === "array" && Array.isArray(items2)) {
16972
- items2.forEach((sch, i) => assignDefault(it, i, sch.default));
16973
- }
16945
+ Object.defineProperty(defaults, "__esModule", { value: true });
16946
+ defaults.assignDefaults = void 0;
16947
+ const codegen_1$r = codegen;
16948
+ const util_1$q = util;
16949
+ function assignDefaults(it, ty) {
16950
+ const { properties: properties2, items: items2 } = it.schema;
16951
+ if (ty === "object" && properties2) {
16952
+ for (const key in properties2) {
16953
+ assignDefault(it, key, properties2[key].default);
16954
+ }
16955
+ } else if (ty === "array" && Array.isArray(items2)) {
16956
+ items2.forEach((sch, i) => assignDefault(it, i, sch.default));
16957
+ }
16958
+ }
16959
+ defaults.assignDefaults = assignDefaults;
16960
+ function assignDefault(it, prop, defaultValue) {
16961
+ const { gen, compositeRule, data, opts } = it;
16962
+ if (defaultValue === void 0)
16963
+ return;
16964
+ const childData = (0, codegen_1$r._)`${data}${(0, codegen_1$r.getProperty)(prop)}`;
16965
+ if (compositeRule) {
16966
+ (0, util_1$q.checkStrictMode)(it, `default is ignored for: ${childData}`);
16967
+ return;
16974
16968
  }
16975
- defaults.assignDefaults = assignDefaults;
16976
- function assignDefault(it, prop, defaultValue) {
16977
- const { gen, compositeRule, data, opts } = it;
16978
- if (defaultValue === void 0)
16979
- return;
16980
- const childData = (0, codegen_12._)`${data}${(0, codegen_12.getProperty)(prop)}`;
16981
- if (compositeRule) {
16982
- (0, util_12.checkStrictMode)(it, `default is ignored for: ${childData}`);
16983
- return;
16984
- }
16985
- let condition = (0, codegen_12._)`${childData} === undefined`;
16986
- if (opts.useDefaults === "empty") {
16987
- condition = (0, codegen_12._)`${condition} || ${childData} === null || ${childData} === ""`;
16988
- }
16989
- gen.if(condition, (0, codegen_12._)`${childData} = ${(0, codegen_12.stringify)(defaultValue)}`);
16969
+ let condition = (0, codegen_1$r._)`${childData} === undefined`;
16970
+ if (opts.useDefaults === "empty") {
16971
+ condition = (0, codegen_1$r._)`${condition} || ${childData} === null || ${childData} === ""`;
16990
16972
  }
16991
- return defaults;
16973
+ gen.if(condition, (0, codegen_1$r._)`${childData} = ${(0, codegen_1$r.stringify)(defaultValue)}`);
16992
16974
  }
16993
16975
  var keyword = {};
16994
16976
  var code = {};
16995
16977
  Object.defineProperty(code, "__esModule", { value: true });
16996
16978
  code.validateUnion = code.validateArray = code.usePattern = code.callValidateCode = code.schemaProperties = code.allSchemaProperties = code.noPropertyInData = code.propertyInData = code.isOwnProperty = code.hasPropFunc = code.reportMissingProp = code.checkMissingProp = code.checkReportMissingProp = void 0;
16997
- const codegen_1$n = codegen;
16998
- const util_1$n = util;
16999
- const names_1$3 = names$1;
16979
+ const codegen_1$q = codegen;
16980
+ const util_1$p = util;
16981
+ const names_1$5 = names$1;
17000
16982
  const util_2$1 = util;
17001
16983
  function checkReportMissingProp(cxt, prop) {
17002
16984
  const { gen, data, it } = cxt;
17003
16985
  gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
17004
- cxt.setParams({ missingProperty: (0, codegen_1$n._)`${prop}` }, true);
16986
+ cxt.setParams({ missingProperty: (0, codegen_1$q._)`${prop}` }, true);
17005
16987
  cxt.error();
17006
16988
  });
17007
16989
  }
17008
16990
  code.checkReportMissingProp = checkReportMissingProp;
17009
16991
  function checkMissingProp({ gen, data, it: { opts } }, properties2, missing) {
17010
- return (0, codegen_1$n.or)(...properties2.map((prop) => (0, codegen_1$n.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1$n._)`${missing} = ${prop}`)));
16992
+ return (0, codegen_1$q.or)(...properties2.map((prop) => (0, codegen_1$q.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1$q._)`${missing} = ${prop}`)));
17011
16993
  }
17012
16994
  code.checkMissingProp = checkMissingProp;
17013
16995
  function reportMissingProp(cxt, missing) {
@@ -17019,22 +17001,22 @@ function hasPropFunc(gen) {
17019
17001
  return gen.scopeValue("func", {
17020
17002
  // eslint-disable-next-line @typescript-eslint/unbound-method
17021
17003
  ref: Object.prototype.hasOwnProperty,
17022
- code: (0, codegen_1$n._)`Object.prototype.hasOwnProperty`
17004
+ code: (0, codegen_1$q._)`Object.prototype.hasOwnProperty`
17023
17005
  });
17024
17006
  }
17025
17007
  code.hasPropFunc = hasPropFunc;
17026
17008
  function isOwnProperty(gen, data, property) {
17027
- return (0, codegen_1$n._)`${hasPropFunc(gen)}.call(${data}, ${property})`;
17009
+ return (0, codegen_1$q._)`${hasPropFunc(gen)}.call(${data}, ${property})`;
17028
17010
  }
17029
17011
  code.isOwnProperty = isOwnProperty;
17030
17012
  function propertyInData(gen, data, property, ownProperties) {
17031
- const cond = (0, codegen_1$n._)`${data}${(0, codegen_1$n.getProperty)(property)} !== undefined`;
17032
- return ownProperties ? (0, codegen_1$n._)`${cond} && ${isOwnProperty(gen, data, property)}` : cond;
17013
+ const cond = (0, codegen_1$q._)`${data}${(0, codegen_1$q.getProperty)(property)} !== undefined`;
17014
+ return ownProperties ? (0, codegen_1$q._)`${cond} && ${isOwnProperty(gen, data, property)}` : cond;
17033
17015
  }
17034
17016
  code.propertyInData = propertyInData;
17035
17017
  function noPropertyInData(gen, data, property, ownProperties) {
17036
- const cond = (0, codegen_1$n._)`${data}${(0, codegen_1$n.getProperty)(property)} === undefined`;
17037
- return ownProperties ? (0, codegen_1$n.or)(cond, (0, codegen_1$n.not)(isOwnProperty(gen, data, property))) : cond;
17018
+ const cond = (0, codegen_1$q._)`${data}${(0, codegen_1$q.getProperty)(property)} === undefined`;
17019
+ return ownProperties ? (0, codegen_1$q.or)(cond, (0, codegen_1$q.not)(isOwnProperty(gen, data, property))) : cond;
17038
17020
  }
17039
17021
  code.noPropertyInData = noPropertyInData;
17040
17022
  function allSchemaProperties(schemaMap) {
@@ -17042,24 +17024,24 @@ function allSchemaProperties(schemaMap) {
17042
17024
  }
17043
17025
  code.allSchemaProperties = allSchemaProperties;
17044
17026
  function schemaProperties(it, schemaMap) {
17045
- return allSchemaProperties(schemaMap).filter((p) => !(0, util_1$n.alwaysValidSchema)(it, schemaMap[p]));
17027
+ return allSchemaProperties(schemaMap).filter((p) => !(0, util_1$p.alwaysValidSchema)(it, schemaMap[p]));
17046
17028
  }
17047
17029
  code.schemaProperties = schemaProperties;
17048
17030
  function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) {
17049
- const dataAndSchema = passSchema ? (0, codegen_1$n._)`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
17031
+ const dataAndSchema = passSchema ? (0, codegen_1$q._)`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
17050
17032
  const valCxt = [
17051
- [names_1$3.default.instancePath, (0, codegen_1$n.strConcat)(names_1$3.default.instancePath, errorPath)],
17052
- [names_1$3.default.parentData, it.parentData],
17053
- [names_1$3.default.parentDataProperty, it.parentDataProperty],
17054
- [names_1$3.default.rootData, names_1$3.default.rootData]
17033
+ [names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, errorPath)],
17034
+ [names_1$5.default.parentData, it.parentData],
17035
+ [names_1$5.default.parentDataProperty, it.parentDataProperty],
17036
+ [names_1$5.default.rootData, names_1$5.default.rootData]
17055
17037
  ];
17056
17038
  if (it.opts.dynamicRef)
17057
- valCxt.push([names_1$3.default.dynamicAnchors, names_1$3.default.dynamicAnchors]);
17058
- const args = (0, codegen_1$n._)`${dataAndSchema}, ${gen.object(...valCxt)}`;
17059
- return context !== codegen_1$n.nil ? (0, codegen_1$n._)`${func}.call(${context}, ${args})` : (0, codegen_1$n._)`${func}(${args})`;
17039
+ valCxt.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
17040
+ const args = (0, codegen_1$q._)`${dataAndSchema}, ${gen.object(...valCxt)}`;
17041
+ return context !== codegen_1$q.nil ? (0, codegen_1$q._)`${func}.call(${context}, ${args})` : (0, codegen_1$q._)`${func}(${args})`;
17060
17042
  }
17061
17043
  code.callValidateCode = callValidateCode;
17062
- const newRegExp = (0, codegen_1$n._)`new RegExp`;
17044
+ const newRegExp = (0, codegen_1$q._)`new RegExp`;
17063
17045
  function usePattern({ gen, it: { opts } }, pattern2) {
17064
17046
  const u = opts.unicodeRegExp ? "u" : "";
17065
17047
  const { regExp } = opts.code;
@@ -17067,7 +17049,7 @@ function usePattern({ gen, it: { opts } }, pattern2) {
17067
17049
  return gen.scopeValue("pattern", {
17068
17050
  key: rx.toString(),
17069
17051
  ref: rx,
17070
- code: (0, codegen_1$n._)`${regExp.code === "new RegExp" ? newRegExp : (0, util_2$1.useFunc)(gen, regExp)}(${pattern2}, ${u})`
17052
+ code: (0, codegen_1$q._)`${regExp.code === "new RegExp" ? newRegExp : (0, util_2$1.useFunc)(gen, regExp)}(${pattern2}, ${u})`
17071
17053
  });
17072
17054
  }
17073
17055
  code.usePattern = usePattern;
@@ -17083,14 +17065,14 @@ function validateArray(cxt) {
17083
17065
  validateItems(() => gen.break());
17084
17066
  return valid;
17085
17067
  function validateItems(notValid) {
17086
- const len = gen.const("len", (0, codegen_1$n._)`${data}.length`);
17068
+ const len = gen.const("len", (0, codegen_1$q._)`${data}.length`);
17087
17069
  gen.forRange("i", 0, len, (i) => {
17088
17070
  cxt.subschema({
17089
17071
  keyword: keyword2,
17090
17072
  dataProp: i,
17091
- dataPropType: util_1$n.Type.Num
17073
+ dataPropType: util_1$p.Type.Num
17092
17074
  }, valid);
17093
- gen.if((0, codegen_1$n.not)(valid), notValid);
17075
+ gen.if((0, codegen_1$q.not)(valid), notValid);
17094
17076
  });
17095
17077
  }
17096
17078
  }
@@ -17099,7 +17081,7 @@ function validateUnion(cxt) {
17099
17081
  const { gen, schema, keyword: keyword2, it } = cxt;
17100
17082
  if (!Array.isArray(schema))
17101
17083
  throw new Error("ajv implementation error");
17102
- const alwaysValid = schema.some((sch) => (0, util_1$n.alwaysValidSchema)(it, sch));
17084
+ const alwaysValid = schema.some((sch) => (0, util_1$p.alwaysValidSchema)(it, sch));
17103
17085
  if (alwaysValid && !it.opts.unevaluated)
17104
17086
  return;
17105
17087
  const valid = gen.let("valid", false);
@@ -17110,214 +17092,202 @@ function validateUnion(cxt) {
17110
17092
  schemaProp: i,
17111
17093
  compositeRule: true
17112
17094
  }, schValid);
17113
- gen.assign(valid, (0, codegen_1$n._)`${valid} || ${schValid}`);
17095
+ gen.assign(valid, (0, codegen_1$q._)`${valid} || ${schValid}`);
17114
17096
  const merged = cxt.mergeValidEvaluated(schCxt, schValid);
17115
17097
  if (!merged)
17116
- gen.if((0, codegen_1$n.not)(valid));
17098
+ gen.if((0, codegen_1$q.not)(valid));
17117
17099
  }));
17118
17100
  cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
17119
17101
  }
17120
17102
  code.validateUnion = validateUnion;
17121
- var hasRequiredKeyword;
17122
- function requireKeyword() {
17123
- if (hasRequiredKeyword) return keyword;
17124
- hasRequiredKeyword = 1;
17125
- Object.defineProperty(keyword, "__esModule", { value: true });
17126
- keyword.validateKeywordUsage = keyword.validSchemaType = keyword.funcKeywordCode = keyword.macroKeywordCode = void 0;
17127
- const codegen_12 = codegen;
17128
- const names_12 = names$1;
17129
- const code_12 = code;
17130
- const errors_12 = errors;
17131
- function macroKeywordCode(cxt, def2) {
17132
- const { gen, keyword: keyword2, schema, parentSchema, it } = cxt;
17133
- const macroSchema = def2.macro.call(it.self, schema, parentSchema, it);
17134
- const schemaRef = useKeyword(gen, keyword2, macroSchema);
17135
- if (it.opts.validateSchema !== false)
17136
- it.self.validateSchema(macroSchema, true);
17137
- const valid = gen.name("valid");
17138
- cxt.subschema({
17139
- schema: macroSchema,
17140
- schemaPath: codegen_12.nil,
17141
- errSchemaPath: `${it.errSchemaPath}/${keyword2}`,
17142
- topSchemaRef: schemaRef,
17143
- compositeRule: true
17144
- }, valid);
17145
- cxt.pass(valid, () => cxt.error(true));
17146
- }
17147
- keyword.macroKeywordCode = macroKeywordCode;
17148
- function funcKeywordCode(cxt, def2) {
17149
- var _a;
17150
- const { gen, keyword: keyword2, schema, parentSchema, $data, it } = cxt;
17151
- checkAsyncKeyword(it, def2);
17152
- const validate2 = !$data && def2.compile ? def2.compile.call(it.self, schema, parentSchema, it) : def2.validate;
17153
- const validateRef = useKeyword(gen, keyword2, validate2);
17154
- const valid = gen.let("valid");
17155
- cxt.block$data(valid, validateKeyword);
17156
- cxt.ok((_a = def2.valid) !== null && _a !== void 0 ? _a : valid);
17157
- function validateKeyword() {
17158
- if (def2.errors === false) {
17159
- assignValid();
17160
- if (def2.modifying)
17161
- modifyData(cxt);
17162
- reportErrs(() => cxt.error());
17163
- } else {
17164
- const ruleErrs = def2.async ? validateAsync() : validateSync();
17165
- if (def2.modifying)
17166
- modifyData(cxt);
17167
- reportErrs(() => addErrs(cxt, ruleErrs));
17168
- }
17169
- }
17170
- function validateAsync() {
17171
- const ruleErrs = gen.let("ruleErrs", null);
17172
- gen.try(() => assignValid((0, codegen_12._)`await `), (e) => gen.assign(valid, false).if((0, codegen_12._)`${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_12._)`${e}.errors`), () => gen.throw(e)));
17173
- return ruleErrs;
17174
- }
17175
- function validateSync() {
17176
- const validateErrs = (0, codegen_12._)`${validateRef}.errors`;
17177
- gen.assign(validateErrs, null);
17178
- assignValid(codegen_12.nil);
17179
- return validateErrs;
17180
- }
17181
- function assignValid(_await = def2.async ? (0, codegen_12._)`await ` : codegen_12.nil) {
17182
- const passCxt = it.opts.passContext ? names_12.default.this : names_12.default.self;
17183
- const passSchema = !("compile" in def2 && !$data || def2.schema === false);
17184
- gen.assign(valid, (0, codegen_12._)`${_await}${(0, code_12.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def2.modifying);
17185
- }
17186
- function reportErrs(errors2) {
17187
- var _a2;
17188
- gen.if((0, codegen_12.not)((_a2 = def2.valid) !== null && _a2 !== void 0 ? _a2 : valid), errors2);
17103
+ Object.defineProperty(keyword, "__esModule", { value: true });
17104
+ keyword.validateKeywordUsage = keyword.validSchemaType = keyword.funcKeywordCode = keyword.macroKeywordCode = void 0;
17105
+ const codegen_1$p = codegen;
17106
+ const names_1$4 = names$1;
17107
+ const code_1$9 = code;
17108
+ const errors_1$1 = errors;
17109
+ function macroKeywordCode(cxt, def2) {
17110
+ const { gen, keyword: keyword2, schema, parentSchema, it } = cxt;
17111
+ const macroSchema = def2.macro.call(it.self, schema, parentSchema, it);
17112
+ const schemaRef = useKeyword(gen, keyword2, macroSchema);
17113
+ if (it.opts.validateSchema !== false)
17114
+ it.self.validateSchema(macroSchema, true);
17115
+ const valid = gen.name("valid");
17116
+ cxt.subschema({
17117
+ schema: macroSchema,
17118
+ schemaPath: codegen_1$p.nil,
17119
+ errSchemaPath: `${it.errSchemaPath}/${keyword2}`,
17120
+ topSchemaRef: schemaRef,
17121
+ compositeRule: true
17122
+ }, valid);
17123
+ cxt.pass(valid, () => cxt.error(true));
17124
+ }
17125
+ keyword.macroKeywordCode = macroKeywordCode;
17126
+ function funcKeywordCode(cxt, def2) {
17127
+ var _a;
17128
+ const { gen, keyword: keyword2, schema, parentSchema, $data, it } = cxt;
17129
+ checkAsyncKeyword(it, def2);
17130
+ const validate2 = !$data && def2.compile ? def2.compile.call(it.self, schema, parentSchema, it) : def2.validate;
17131
+ const validateRef = useKeyword(gen, keyword2, validate2);
17132
+ const valid = gen.let("valid");
17133
+ cxt.block$data(valid, validateKeyword);
17134
+ cxt.ok((_a = def2.valid) !== null && _a !== void 0 ? _a : valid);
17135
+ function validateKeyword() {
17136
+ if (def2.errors === false) {
17137
+ assignValid();
17138
+ if (def2.modifying)
17139
+ modifyData(cxt);
17140
+ reportErrs(() => cxt.error());
17141
+ } else {
17142
+ const ruleErrs = def2.async ? validateAsync() : validateSync();
17143
+ if (def2.modifying)
17144
+ modifyData(cxt);
17145
+ reportErrs(() => addErrs(cxt, ruleErrs));
17189
17146
  }
17190
17147
  }
17191
- keyword.funcKeywordCode = funcKeywordCode;
17192
- function modifyData(cxt) {
17193
- const { gen, data, it } = cxt;
17194
- gen.if(it.parentData, () => gen.assign(data, (0, codegen_12._)`${it.parentData}[${it.parentDataProperty}]`));
17195
- }
17196
- function addErrs(cxt, errs) {
17197
- const { gen } = cxt;
17198
- gen.if((0, codegen_12._)`Array.isArray(${errs})`, () => {
17199
- gen.assign(names_12.default.vErrors, (0, codegen_12._)`${names_12.default.vErrors} === null ? ${errs} : ${names_12.default.vErrors}.concat(${errs})`).assign(names_12.default.errors, (0, codegen_12._)`${names_12.default.vErrors}.length`);
17200
- (0, errors_12.extendErrors)(cxt);
17201
- }, () => cxt.error());
17202
- }
17203
- function checkAsyncKeyword({ schemaEnv }, def2) {
17204
- if (def2.async && !schemaEnv.$async)
17205
- throw new Error("async keyword in sync schema");
17206
- }
17207
- function useKeyword(gen, keyword2, result) {
17208
- if (result === void 0)
17209
- throw new Error(`keyword "${keyword2}" failed to compile`);
17210
- return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_12.stringify)(result) });
17211
- }
17212
- function validSchemaType(schema, schemaType, allowUndefined = false) {
17213
- 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");
17214
- }
17215
- keyword.validSchemaType = validSchemaType;
17216
- function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def2, keyword2) {
17217
- if (Array.isArray(def2.keyword) ? !def2.keyword.includes(keyword2) : def2.keyword !== keyword2) {
17218
- throw new Error("ajv implementation error");
17219
- }
17220
- const deps = def2.dependencies;
17221
- if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) {
17222
- throw new Error(`parent schema must have dependencies of ${keyword2}: ${deps.join(",")}`);
17223
- }
17224
- if (def2.validateSchema) {
17225
- const valid = def2.validateSchema(schema[keyword2]);
17226
- if (!valid) {
17227
- const msg = `keyword "${keyword2}" value is invalid at path "${errSchemaPath}": ` + self.errorsText(def2.validateSchema.errors);
17228
- if (opts.validateSchema === "log")
17229
- self.logger.error(msg);
17230
- else
17231
- throw new Error(msg);
17232
- }
17148
+ function validateAsync() {
17149
+ const ruleErrs = gen.let("ruleErrs", null);
17150
+ gen.try(() => assignValid((0, codegen_1$p._)`await `), (e) => gen.assign(valid, false).if((0, codegen_1$p._)`${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1$p._)`${e}.errors`), () => gen.throw(e)));
17151
+ return ruleErrs;
17152
+ }
17153
+ function validateSync() {
17154
+ const validateErrs = (0, codegen_1$p._)`${validateRef}.errors`;
17155
+ gen.assign(validateErrs, null);
17156
+ assignValid(codegen_1$p.nil);
17157
+ return validateErrs;
17158
+ }
17159
+ function assignValid(_await = def2.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
17160
+ const passCxt = it.opts.passContext ? names_1$4.default.this : names_1$4.default.self;
17161
+ const passSchema = !("compile" in def2 && !$data || def2.schema === false);
17162
+ gen.assign(valid, (0, codegen_1$p._)`${_await}${(0, code_1$9.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def2.modifying);
17163
+ }
17164
+ function reportErrs(errors2) {
17165
+ var _a2;
17166
+ gen.if((0, codegen_1$p.not)((_a2 = def2.valid) !== null && _a2 !== void 0 ? _a2 : valid), errors2);
17167
+ }
17168
+ }
17169
+ keyword.funcKeywordCode = funcKeywordCode;
17170
+ function modifyData(cxt) {
17171
+ const { gen, data, it } = cxt;
17172
+ gen.if(it.parentData, () => gen.assign(data, (0, codegen_1$p._)`${it.parentData}[${it.parentDataProperty}]`));
17173
+ }
17174
+ function addErrs(cxt, errs) {
17175
+ const { gen } = cxt;
17176
+ gen.if((0, codegen_1$p._)`Array.isArray(${errs})`, () => {
17177
+ gen.assign(names_1$4.default.vErrors, (0, codegen_1$p._)`${names_1$4.default.vErrors} === null ? ${errs} : ${names_1$4.default.vErrors}.concat(${errs})`).assign(names_1$4.default.errors, (0, codegen_1$p._)`${names_1$4.default.vErrors}.length`);
17178
+ (0, errors_1$1.extendErrors)(cxt);
17179
+ }, () => cxt.error());
17180
+ }
17181
+ function checkAsyncKeyword({ schemaEnv }, def2) {
17182
+ if (def2.async && !schemaEnv.$async)
17183
+ throw new Error("async keyword in sync schema");
17184
+ }
17185
+ function useKeyword(gen, keyword2, result) {
17186
+ if (result === void 0)
17187
+ throw new Error(`keyword "${keyword2}" failed to compile`);
17188
+ return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1$p.stringify)(result) });
17189
+ }
17190
+ function validSchemaType(schema, schemaType, allowUndefined = false) {
17191
+ 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");
17192
+ }
17193
+ keyword.validSchemaType = validSchemaType;
17194
+ function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def2, keyword2) {
17195
+ if (Array.isArray(def2.keyword) ? !def2.keyword.includes(keyword2) : def2.keyword !== keyword2) {
17196
+ throw new Error("ajv implementation error");
17197
+ }
17198
+ const deps = def2.dependencies;
17199
+ if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) {
17200
+ throw new Error(`parent schema must have dependencies of ${keyword2}: ${deps.join(",")}`);
17201
+ }
17202
+ if (def2.validateSchema) {
17203
+ const valid = def2.validateSchema(schema[keyword2]);
17204
+ if (!valid) {
17205
+ const msg = `keyword "${keyword2}" value is invalid at path "${errSchemaPath}": ` + self.errorsText(def2.validateSchema.errors);
17206
+ if (opts.validateSchema === "log")
17207
+ self.logger.error(msg);
17208
+ else
17209
+ throw new Error(msg);
17233
17210
  }
17234
17211
  }
17235
- keyword.validateKeywordUsage = validateKeywordUsage;
17236
- return keyword;
17237
17212
  }
17213
+ keyword.validateKeywordUsage = validateKeywordUsage;
17238
17214
  var subschema = {};
17239
- var hasRequiredSubschema;
17240
- function requireSubschema() {
17241
- if (hasRequiredSubschema) return subschema;
17242
- hasRequiredSubschema = 1;
17243
- Object.defineProperty(subschema, "__esModule", { value: true });
17244
- subschema.extendSubschemaMode = subschema.extendSubschemaData = subschema.getSubschema = void 0;
17245
- const codegen_12 = codegen;
17246
- const util_12 = util;
17247
- function getSubschema(it, { keyword: keyword2, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
17248
- if (keyword2 !== void 0 && schema !== void 0) {
17249
- throw new Error('both "keyword" and "schema" passed, only one allowed');
17250
- }
17251
- if (keyword2 !== void 0) {
17252
- const sch = it.schema[keyword2];
17253
- return schemaProp === void 0 ? {
17254
- schema: sch,
17255
- schemaPath: (0, codegen_12._)`${it.schemaPath}${(0, codegen_12.getProperty)(keyword2)}`,
17256
- errSchemaPath: `${it.errSchemaPath}/${keyword2}`
17257
- } : {
17258
- schema: sch[schemaProp],
17259
- schemaPath: (0, codegen_12._)`${it.schemaPath}${(0, codegen_12.getProperty)(keyword2)}${(0, codegen_12.getProperty)(schemaProp)}`,
17260
- errSchemaPath: `${it.errSchemaPath}/${keyword2}/${(0, util_12.escapeFragment)(schemaProp)}`
17261
- };
17262
- }
17263
- if (schema !== void 0) {
17264
- if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
17265
- throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
17266
- }
17267
- return {
17268
- schema,
17269
- schemaPath,
17270
- topSchemaRef,
17271
- errSchemaPath
17272
- };
17215
+ Object.defineProperty(subschema, "__esModule", { value: true });
17216
+ subschema.extendSubschemaMode = subschema.extendSubschemaData = subschema.getSubschema = void 0;
17217
+ const codegen_1$o = codegen;
17218
+ const util_1$o = util;
17219
+ function getSubschema(it, { keyword: keyword2, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
17220
+ if (keyword2 !== void 0 && schema !== void 0) {
17221
+ throw new Error('both "keyword" and "schema" passed, only one allowed');
17222
+ }
17223
+ if (keyword2 !== void 0) {
17224
+ const sch = it.schema[keyword2];
17225
+ return schemaProp === void 0 ? {
17226
+ schema: sch,
17227
+ schemaPath: (0, codegen_1$o._)`${it.schemaPath}${(0, codegen_1$o.getProperty)(keyword2)}`,
17228
+ errSchemaPath: `${it.errSchemaPath}/${keyword2}`
17229
+ } : {
17230
+ schema: sch[schemaProp],
17231
+ schemaPath: (0, codegen_1$o._)`${it.schemaPath}${(0, codegen_1$o.getProperty)(keyword2)}${(0, codegen_1$o.getProperty)(schemaProp)}`,
17232
+ errSchemaPath: `${it.errSchemaPath}/${keyword2}/${(0, util_1$o.escapeFragment)(schemaProp)}`
17233
+ };
17234
+ }
17235
+ if (schema !== void 0) {
17236
+ if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
17237
+ throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
17273
17238
  }
17274
- throw new Error('either "keyword" or "schema" must be passed');
17275
- }
17276
- subschema.getSubschema = getSubschema;
17277
- function extendSubschemaData(subschema2, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) {
17278
- if (data !== void 0 && dataProp !== void 0) {
17279
- throw new Error('both "data" and "dataProp" passed, only one allowed');
17280
- }
17281
- const { gen } = it;
17282
- if (dataProp !== void 0) {
17283
- const { errorPath, dataPathArr, opts } = it;
17284
- const nextData = gen.let("data", (0, codegen_12._)`${it.data}${(0, codegen_12.getProperty)(dataProp)}`, true);
17285
- dataContextProps(nextData);
17286
- subschema2.errorPath = (0, codegen_12.str)`${errorPath}${(0, util_12.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`;
17287
- subschema2.parentDataProperty = (0, codegen_12._)`${dataProp}`;
17288
- subschema2.dataPathArr = [...dataPathArr, subschema2.parentDataProperty];
17289
- }
17290
- if (data !== void 0) {
17291
- const nextData = data instanceof codegen_12.Name ? data : gen.let("data", data, true);
17292
- dataContextProps(nextData);
17293
- if (propertyName !== void 0)
17294
- subschema2.propertyName = propertyName;
17295
- }
17296
- if (dataTypes)
17297
- subschema2.dataTypes = dataTypes;
17298
- function dataContextProps(_nextData) {
17299
- subschema2.data = _nextData;
17300
- subschema2.dataLevel = it.dataLevel + 1;
17301
- subschema2.dataTypes = [];
17302
- it.definedProperties = /* @__PURE__ */ new Set();
17303
- subschema2.parentData = it.data;
17304
- subschema2.dataNames = [...it.dataNames, _nextData];
17305
- }
17306
- }
17307
- subschema.extendSubschemaData = extendSubschemaData;
17308
- function extendSubschemaMode(subschema2, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) {
17309
- if (compositeRule !== void 0)
17310
- subschema2.compositeRule = compositeRule;
17311
- if (createErrors !== void 0)
17312
- subschema2.createErrors = createErrors;
17313
- if (allErrors !== void 0)
17314
- subschema2.allErrors = allErrors;
17315
- subschema2.jtdDiscriminator = jtdDiscriminator;
17316
- subschema2.jtdMetadata = jtdMetadata;
17317
- }
17318
- subschema.extendSubschemaMode = extendSubschemaMode;
17319
- return subschema;
17320
- }
17239
+ return {
17240
+ schema,
17241
+ schemaPath,
17242
+ topSchemaRef,
17243
+ errSchemaPath
17244
+ };
17245
+ }
17246
+ throw new Error('either "keyword" or "schema" must be passed');
17247
+ }
17248
+ subschema.getSubschema = getSubschema;
17249
+ function extendSubschemaData(subschema2, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) {
17250
+ if (data !== void 0 && dataProp !== void 0) {
17251
+ throw new Error('both "data" and "dataProp" passed, only one allowed');
17252
+ }
17253
+ const { gen } = it;
17254
+ if (dataProp !== void 0) {
17255
+ const { errorPath, dataPathArr, opts } = it;
17256
+ const nextData = gen.let("data", (0, codegen_1$o._)`${it.data}${(0, codegen_1$o.getProperty)(dataProp)}`, true);
17257
+ dataContextProps(nextData);
17258
+ subschema2.errorPath = (0, codegen_1$o.str)`${errorPath}${(0, util_1$o.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`;
17259
+ subschema2.parentDataProperty = (0, codegen_1$o._)`${dataProp}`;
17260
+ subschema2.dataPathArr = [...dataPathArr, subschema2.parentDataProperty];
17261
+ }
17262
+ if (data !== void 0) {
17263
+ const nextData = data instanceof codegen_1$o.Name ? data : gen.let("data", data, true);
17264
+ dataContextProps(nextData);
17265
+ if (propertyName !== void 0)
17266
+ subschema2.propertyName = propertyName;
17267
+ }
17268
+ if (dataTypes)
17269
+ subschema2.dataTypes = dataTypes;
17270
+ function dataContextProps(_nextData) {
17271
+ subschema2.data = _nextData;
17272
+ subschema2.dataLevel = it.dataLevel + 1;
17273
+ subschema2.dataTypes = [];
17274
+ it.definedProperties = /* @__PURE__ */ new Set();
17275
+ subschema2.parentData = it.data;
17276
+ subschema2.dataNames = [...it.dataNames, _nextData];
17277
+ }
17278
+ }
17279
+ subschema.extendSubschemaData = extendSubschemaData;
17280
+ function extendSubschemaMode(subschema2, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) {
17281
+ if (compositeRule !== void 0)
17282
+ subschema2.compositeRule = compositeRule;
17283
+ if (createErrors !== void 0)
17284
+ subschema2.createErrors = createErrors;
17285
+ if (allErrors !== void 0)
17286
+ subschema2.allErrors = allErrors;
17287
+ subschema2.jtdDiscriminator = jtdDiscriminator;
17288
+ subschema2.jtdMetadata = jtdMetadata;
17289
+ }
17290
+ subschema.extendSubschemaMode = extendSubschemaMode;
17321
17291
  var resolve$2 = {};
17322
17292
  var fastDeepEqual = function equal(a, b) {
17323
17293
  if (a === b) return true;
@@ -17432,7 +17402,7 @@ function escapeJsonPtr(str) {
17432
17402
  var jsonSchemaTraverseExports = jsonSchemaTraverse.exports;
17433
17403
  Object.defineProperty(resolve$2, "__esModule", { value: true });
17434
17404
  resolve$2.getSchemaRefs = resolve$2.resolveUrl = resolve$2.normalizeId = resolve$2._getFullPath = resolve$2.getFullPath = resolve$2.inlineRef = void 0;
17435
- const util_1$m = util;
17405
+ const util_1$n = util;
17436
17406
  const equal$3 = fastDeepEqual;
17437
17407
  const traverse = jsonSchemaTraverseExports;
17438
17408
  const SIMPLE_INLINED = /* @__PURE__ */ new Set([
@@ -17491,7 +17461,7 @@ function countKeys(schema) {
17491
17461
  if (SIMPLE_INLINED.has(key))
17492
17462
  continue;
17493
17463
  if (typeof schema[key] == "object") {
17494
- (0, util_1$m.eachItem)(schema[key], (sch) => count += countKeys(sch));
17464
+ (0, util_1$n.eachItem)(schema[key], (sch) => count += countKeys(sch));
17495
17465
  }
17496
17466
  if (count === Infinity)
17497
17467
  return Infinity;
@@ -17579,528 +17549,516 @@ function getSchemaRefs(schema, baseId) {
17579
17549
  }
17580
17550
  }
17581
17551
  resolve$2.getSchemaRefs = getSchemaRefs;
17582
- var hasRequiredValidate;
17583
- function requireValidate() {
17584
- if (hasRequiredValidate) return validate;
17585
- hasRequiredValidate = 1;
17586
- Object.defineProperty(validate, "__esModule", { value: true });
17587
- validate.getData = validate.KeywordCxt = validate.validateFunctionCode = void 0;
17588
- const boolSchema_1 = requireBoolSchema();
17589
- const dataType_12 = dataType;
17590
- const applicability_12 = requireApplicability();
17591
- const dataType_2 = dataType;
17592
- const defaults_1 = requireDefaults();
17593
- const keyword_1 = requireKeyword();
17594
- const subschema_1 = requireSubschema();
17595
- const codegen_12 = codegen;
17596
- const names_12 = names$1;
17597
- const resolve_12 = resolve$2;
17598
- const util_12 = util;
17599
- const errors_12 = errors;
17600
- function validateFunctionCode(it) {
17601
- if (isSchemaObj(it)) {
17602
- checkKeywords(it);
17603
- if (schemaCxtHasRules(it)) {
17604
- topSchemaObjCode(it);
17605
- return;
17606
- }
17552
+ Object.defineProperty(validate, "__esModule", { value: true });
17553
+ validate.getData = validate.KeywordCxt = validate.validateFunctionCode = void 0;
17554
+ const boolSchema_1 = boolSchema;
17555
+ const dataType_1$1 = dataType;
17556
+ const applicability_1 = applicability;
17557
+ const dataType_2 = dataType;
17558
+ const defaults_1 = defaults;
17559
+ const keyword_1 = keyword;
17560
+ const subschema_1 = subschema;
17561
+ const codegen_1$n = codegen;
17562
+ const names_1$3 = names$1;
17563
+ const resolve_1$2 = resolve$2;
17564
+ const util_1$m = util;
17565
+ const errors_1 = errors;
17566
+ function validateFunctionCode(it) {
17567
+ if (isSchemaObj(it)) {
17568
+ checkKeywords(it);
17569
+ if (schemaCxtHasRules(it)) {
17570
+ topSchemaObjCode(it);
17571
+ return;
17607
17572
  }
17608
- validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
17609
- }
17610
- validate.validateFunctionCode = validateFunctionCode;
17611
- function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) {
17612
- if (opts.code.es5) {
17613
- gen.func(validateName, (0, codegen_12._)`${names_12.default.data}, ${names_12.default.valCxt}`, schemaEnv.$async, () => {
17614
- gen.code((0, codegen_12._)`"use strict"; ${funcSourceUrl(schema, opts)}`);
17615
- destructureValCxtES5(gen, opts);
17616
- gen.code(body);
17617
- });
17618
- } else {
17619
- gen.func(validateName, (0, codegen_12._)`${names_12.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
17620
- }
17621
- }
17622
- function destructureValCxt(opts) {
17623
- return (0, codegen_12._)`{${names_12.default.instancePath}="", ${names_12.default.parentData}, ${names_12.default.parentDataProperty}, ${names_12.default.rootData}=${names_12.default.data}${opts.dynamicRef ? (0, codegen_12._)`, ${names_12.default.dynamicAnchors}={}` : codegen_12.nil}}={}`;
17624
- }
17625
- function destructureValCxtES5(gen, opts) {
17626
- gen.if(names_12.default.valCxt, () => {
17627
- gen.var(names_12.default.instancePath, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.instancePath}`);
17628
- gen.var(names_12.default.parentData, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.parentData}`);
17629
- gen.var(names_12.default.parentDataProperty, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.parentDataProperty}`);
17630
- gen.var(names_12.default.rootData, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.rootData}`);
17631
- if (opts.dynamicRef)
17632
- gen.var(names_12.default.dynamicAnchors, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.dynamicAnchors}`);
17633
- }, () => {
17634
- gen.var(names_12.default.instancePath, (0, codegen_12._)`""`);
17635
- gen.var(names_12.default.parentData, (0, codegen_12._)`undefined`);
17636
- gen.var(names_12.default.parentDataProperty, (0, codegen_12._)`undefined`);
17637
- gen.var(names_12.default.rootData, names_12.default.data);
17638
- if (opts.dynamicRef)
17639
- gen.var(names_12.default.dynamicAnchors, (0, codegen_12._)`{}`);
17640
- });
17641
17573
  }
17642
- function topSchemaObjCode(it) {
17643
- const { schema, opts, gen } = it;
17644
- validateFunction(it, () => {
17645
- if (opts.$comment && schema.$comment)
17646
- commentKeyword(it);
17647
- checkNoDefault(it);
17648
- gen.let(names_12.default.vErrors, null);
17649
- gen.let(names_12.default.errors, 0);
17650
- if (opts.unevaluated)
17651
- resetEvaluated(it);
17652
- typeAndKeywords(it);
17653
- returnResults(it);
17574
+ validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
17575
+ }
17576
+ validate.validateFunctionCode = validateFunctionCode;
17577
+ function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) {
17578
+ if (opts.code.es5) {
17579
+ gen.func(validateName, (0, codegen_1$n._)`${names_1$3.default.data}, ${names_1$3.default.valCxt}`, schemaEnv.$async, () => {
17580
+ gen.code((0, codegen_1$n._)`"use strict"; ${funcSourceUrl(schema, opts)}`);
17581
+ destructureValCxtES5(gen, opts);
17582
+ gen.code(body);
17654
17583
  });
17655
- return;
17656
- }
17657
- function resetEvaluated(it) {
17658
- const { gen, validateName } = it;
17659
- it.evaluated = gen.const("evaluated", (0, codegen_12._)`${validateName}.evaluated`);
17660
- gen.if((0, codegen_12._)`${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_12._)`${it.evaluated}.props`, (0, codegen_12._)`undefined`));
17661
- gen.if((0, codegen_12._)`${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_12._)`${it.evaluated}.items`, (0, codegen_12._)`undefined`));
17662
- }
17663
- function funcSourceUrl(schema, opts) {
17664
- const schId = typeof schema == "object" && schema[opts.schemaId];
17665
- return schId && (opts.code.source || opts.code.process) ? (0, codegen_12._)`/*# sourceURL=${schId} */` : codegen_12.nil;
17666
- }
17667
- function subschemaCode(it, valid) {
17668
- if (isSchemaObj(it)) {
17669
- checkKeywords(it);
17670
- if (schemaCxtHasRules(it)) {
17671
- subSchemaObjCode(it, valid);
17672
- return;
17673
- }
17674
- }
17675
- (0, boolSchema_1.boolOrEmptySchema)(it, valid);
17676
- }
17677
- function schemaCxtHasRules({ schema, self }) {
17678
- if (typeof schema == "boolean")
17679
- return !schema;
17680
- for (const key in schema)
17681
- if (self.RULES.all[key])
17682
- return true;
17683
- return false;
17684
- }
17685
- function isSchemaObj(it) {
17686
- return typeof it.schema != "boolean";
17687
- }
17688
- function subSchemaObjCode(it, valid) {
17689
- const { schema, gen, opts } = it;
17584
+ } else {
17585
+ gen.func(validateName, (0, codegen_1$n._)`${names_1$3.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
17586
+ }
17587
+ }
17588
+ function destructureValCxt(opts) {
17589
+ return (0, codegen_1$n._)`{${names_1$3.default.instancePath}="", ${names_1$3.default.parentData}, ${names_1$3.default.parentDataProperty}, ${names_1$3.default.rootData}=${names_1$3.default.data}${opts.dynamicRef ? (0, codegen_1$n._)`, ${names_1$3.default.dynamicAnchors}={}` : codegen_1$n.nil}}={}`;
17590
+ }
17591
+ function destructureValCxtES5(gen, opts) {
17592
+ gen.if(names_1$3.default.valCxt, () => {
17593
+ gen.var(names_1$3.default.instancePath, (0, codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.instancePath}`);
17594
+ gen.var(names_1$3.default.parentData, (0, codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.parentData}`);
17595
+ gen.var(names_1$3.default.parentDataProperty, (0, codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.parentDataProperty}`);
17596
+ gen.var(names_1$3.default.rootData, (0, codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.rootData}`);
17597
+ if (opts.dynamicRef)
17598
+ gen.var(names_1$3.default.dynamicAnchors, (0, codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.dynamicAnchors}`);
17599
+ }, () => {
17600
+ gen.var(names_1$3.default.instancePath, (0, codegen_1$n._)`""`);
17601
+ gen.var(names_1$3.default.parentData, (0, codegen_1$n._)`undefined`);
17602
+ gen.var(names_1$3.default.parentDataProperty, (0, codegen_1$n._)`undefined`);
17603
+ gen.var(names_1$3.default.rootData, names_1$3.default.data);
17604
+ if (opts.dynamicRef)
17605
+ gen.var(names_1$3.default.dynamicAnchors, (0, codegen_1$n._)`{}`);
17606
+ });
17607
+ }
17608
+ function topSchemaObjCode(it) {
17609
+ const { schema, opts, gen } = it;
17610
+ validateFunction(it, () => {
17690
17611
  if (opts.$comment && schema.$comment)
17691
17612
  commentKeyword(it);
17692
- updateContext(it);
17693
- checkAsyncSchema(it);
17694
- const errsCount = gen.const("_errs", names_12.default.errors);
17695
- typeAndKeywords(it, errsCount);
17696
- gen.var(valid, (0, codegen_12._)`${errsCount} === ${names_12.default.errors}`);
17697
- }
17698
- function checkKeywords(it) {
17699
- (0, util_12.checkUnknownRules)(it);
17700
- checkRefsAndKeywords(it);
17701
- }
17702
- function typeAndKeywords(it, errsCount) {
17703
- if (it.opts.jtd)
17704
- return schemaKeywords(it, [], false, errsCount);
17705
- const types2 = (0, dataType_12.getSchemaTypes)(it.schema);
17706
- const checkedTypes = (0, dataType_12.coerceAndCheckDataType)(it, types2);
17707
- schemaKeywords(it, types2, !checkedTypes, errsCount);
17708
- }
17709
- function checkRefsAndKeywords(it) {
17710
- const { schema, errSchemaPath, opts, self } = it;
17711
- if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_12.schemaHasRulesButRef)(schema, self.RULES)) {
17712
- self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
17713
- }
17714
- }
17715
- function checkNoDefault(it) {
17716
- const { schema, opts } = it;
17717
- if (schema.default !== void 0 && opts.useDefaults && opts.strictSchema) {
17718
- (0, util_12.checkStrictMode)(it, "default is ignored in the schema root");
17719
- }
17720
- }
17721
- function updateContext(it) {
17722
- const schId = it.schema[it.opts.schemaId];
17723
- if (schId)
17724
- it.baseId = (0, resolve_12.resolveUrl)(it.opts.uriResolver, it.baseId, schId);
17725
- }
17726
- function checkAsyncSchema(it) {
17727
- if (it.schema.$async && !it.schemaEnv.$async)
17728
- throw new Error("async schema in sync schema");
17729
- }
17730
- function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {
17731
- const msg = schema.$comment;
17732
- if (opts.$comment === true) {
17733
- gen.code((0, codegen_12._)`${names_12.default.self}.logger.log(${msg})`);
17734
- } else if (typeof opts.$comment == "function") {
17735
- const schemaPath = (0, codegen_12.str)`${errSchemaPath}/$comment`;
17736
- const rootName = gen.scopeValue("root", { ref: schemaEnv.root });
17737
- gen.code((0, codegen_12._)`${names_12.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);
17738
- }
17739
- }
17740
- function returnResults(it) {
17741
- const { gen, schemaEnv, validateName, ValidationError, opts } = it;
17742
- if (schemaEnv.$async) {
17743
- gen.if((0, codegen_12._)`${names_12.default.errors} === 0`, () => gen.return(names_12.default.data), () => gen.throw((0, codegen_12._)`new ${ValidationError}(${names_12.default.vErrors})`));
17744
- } else {
17745
- gen.assign((0, codegen_12._)`${validateName}.errors`, names_12.default.vErrors);
17746
- if (opts.unevaluated)
17747
- assignEvaluated(it);
17748
- gen.return((0, codegen_12._)`${names_12.default.errors} === 0`);
17749
- }
17750
- }
17751
- function assignEvaluated({ gen, evaluated, props, items: items2 }) {
17752
- if (props instanceof codegen_12.Name)
17753
- gen.assign((0, codegen_12._)`${evaluated}.props`, props);
17754
- if (items2 instanceof codegen_12.Name)
17755
- gen.assign((0, codegen_12._)`${evaluated}.items`, items2);
17756
- }
17757
- function schemaKeywords(it, types2, typeErrors, errsCount) {
17758
- const { gen, schema, data, allErrors, opts, self } = it;
17759
- const { RULES } = self;
17760
- if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_12.schemaHasRulesButRef)(schema, RULES))) {
17761
- gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
17613
+ checkNoDefault(it);
17614
+ gen.let(names_1$3.default.vErrors, null);
17615
+ gen.let(names_1$3.default.errors, 0);
17616
+ if (opts.unevaluated)
17617
+ resetEvaluated(it);
17618
+ typeAndKeywords(it);
17619
+ returnResults(it);
17620
+ });
17621
+ return;
17622
+ }
17623
+ function resetEvaluated(it) {
17624
+ const { gen, validateName } = it;
17625
+ it.evaluated = gen.const("evaluated", (0, codegen_1$n._)`${validateName}.evaluated`);
17626
+ gen.if((0, codegen_1$n._)`${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1$n._)`${it.evaluated}.props`, (0, codegen_1$n._)`undefined`));
17627
+ gen.if((0, codegen_1$n._)`${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1$n._)`${it.evaluated}.items`, (0, codegen_1$n._)`undefined`));
17628
+ }
17629
+ function funcSourceUrl(schema, opts) {
17630
+ const schId = typeof schema == "object" && schema[opts.schemaId];
17631
+ return schId && (opts.code.source || opts.code.process) ? (0, codegen_1$n._)`/*# sourceURL=${schId} */` : codegen_1$n.nil;
17632
+ }
17633
+ function subschemaCode(it, valid) {
17634
+ if (isSchemaObj(it)) {
17635
+ checkKeywords(it);
17636
+ if (schemaCxtHasRules(it)) {
17637
+ subSchemaObjCode(it, valid);
17762
17638
  return;
17763
17639
  }
17764
- if (!opts.jtd)
17765
- checkStrictTypes(it, types2);
17766
- gen.block(() => {
17767
- for (const group of RULES.rules)
17768
- groupKeywords(group);
17769
- groupKeywords(RULES.post);
17770
- });
17771
- function groupKeywords(group) {
17772
- if (!(0, applicability_12.shouldUseGroup)(schema, group))
17773
- return;
17774
- if (group.type) {
17775
- gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
17776
- iterateKeywords(it, group);
17777
- if (types2.length === 1 && types2[0] === group.type && typeErrors) {
17778
- gen.else();
17779
- (0, dataType_2.reportTypeError)(it);
17780
- }
17781
- gen.endIf();
17782
- } else {
17783
- iterateKeywords(it, group);
17784
- }
17785
- if (!allErrors)
17786
- gen.if((0, codegen_12._)`${names_12.default.errors} === ${errsCount || 0}`);
17787
- }
17788
17640
  }
17789
- function iterateKeywords(it, group) {
17790
- const { gen, schema, opts: { useDefaults } } = it;
17791
- if (useDefaults)
17792
- (0, defaults_1.assignDefaults)(it, group.type);
17793
- gen.block(() => {
17794
- for (const rule of group.rules) {
17795
- if ((0, applicability_12.shouldUseRule)(schema, rule)) {
17796
- keywordCode(it, rule.keyword, rule.definition, group.type);
17797
- }
17798
- }
17799
- });
17800
- }
17801
- function checkStrictTypes(it, types2) {
17802
- if (it.schemaEnv.meta || !it.opts.strictTypes)
17803
- return;
17804
- checkContextTypes(it, types2);
17805
- if (!it.opts.allowUnionTypes)
17806
- checkMultipleTypes(it, types2);
17807
- checkKeywordTypes(it, it.dataTypes);
17641
+ (0, boolSchema_1.boolOrEmptySchema)(it, valid);
17642
+ }
17643
+ function schemaCxtHasRules({ schema, self }) {
17644
+ if (typeof schema == "boolean")
17645
+ return !schema;
17646
+ for (const key in schema)
17647
+ if (self.RULES.all[key])
17648
+ return true;
17649
+ return false;
17650
+ }
17651
+ function isSchemaObj(it) {
17652
+ return typeof it.schema != "boolean";
17653
+ }
17654
+ function subSchemaObjCode(it, valid) {
17655
+ const { schema, gen, opts } = it;
17656
+ if (opts.$comment && schema.$comment)
17657
+ commentKeyword(it);
17658
+ updateContext(it);
17659
+ checkAsyncSchema(it);
17660
+ const errsCount = gen.const("_errs", names_1$3.default.errors);
17661
+ typeAndKeywords(it, errsCount);
17662
+ gen.var(valid, (0, codegen_1$n._)`${errsCount} === ${names_1$3.default.errors}`);
17663
+ }
17664
+ function checkKeywords(it) {
17665
+ (0, util_1$m.checkUnknownRules)(it);
17666
+ checkRefsAndKeywords(it);
17667
+ }
17668
+ function typeAndKeywords(it, errsCount) {
17669
+ if (it.opts.jtd)
17670
+ return schemaKeywords(it, [], false, errsCount);
17671
+ const types2 = (0, dataType_1$1.getSchemaTypes)(it.schema);
17672
+ const checkedTypes = (0, dataType_1$1.coerceAndCheckDataType)(it, types2);
17673
+ schemaKeywords(it, types2, !checkedTypes, errsCount);
17674
+ }
17675
+ function checkRefsAndKeywords(it) {
17676
+ const { schema, errSchemaPath, opts, self } = it;
17677
+ if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1$m.schemaHasRulesButRef)(schema, self.RULES)) {
17678
+ self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
17679
+ }
17680
+ }
17681
+ function checkNoDefault(it) {
17682
+ const { schema, opts } = it;
17683
+ if (schema.default !== void 0 && opts.useDefaults && opts.strictSchema) {
17684
+ (0, util_1$m.checkStrictMode)(it, "default is ignored in the schema root");
17685
+ }
17686
+ }
17687
+ function updateContext(it) {
17688
+ const schId = it.schema[it.opts.schemaId];
17689
+ if (schId)
17690
+ it.baseId = (0, resolve_1$2.resolveUrl)(it.opts.uriResolver, it.baseId, schId);
17691
+ }
17692
+ function checkAsyncSchema(it) {
17693
+ if (it.schema.$async && !it.schemaEnv.$async)
17694
+ throw new Error("async schema in sync schema");
17695
+ }
17696
+ function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {
17697
+ const msg = schema.$comment;
17698
+ if (opts.$comment === true) {
17699
+ gen.code((0, codegen_1$n._)`${names_1$3.default.self}.logger.log(${msg})`);
17700
+ } else if (typeof opts.$comment == "function") {
17701
+ const schemaPath = (0, codegen_1$n.str)`${errSchemaPath}/$comment`;
17702
+ const rootName = gen.scopeValue("root", { ref: schemaEnv.root });
17703
+ gen.code((0, codegen_1$n._)`${names_1$3.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);
17704
+ }
17705
+ }
17706
+ function returnResults(it) {
17707
+ const { gen, schemaEnv, validateName, ValidationError: ValidationError2, opts } = it;
17708
+ if (schemaEnv.$async) {
17709
+ gen.if((0, codegen_1$n._)`${names_1$3.default.errors} === 0`, () => gen.return(names_1$3.default.data), () => gen.throw((0, codegen_1$n._)`new ${ValidationError2}(${names_1$3.default.vErrors})`));
17710
+ } else {
17711
+ gen.assign((0, codegen_1$n._)`${validateName}.errors`, names_1$3.default.vErrors);
17712
+ if (opts.unevaluated)
17713
+ assignEvaluated(it);
17714
+ gen.return((0, codegen_1$n._)`${names_1$3.default.errors} === 0`);
17715
+ }
17716
+ }
17717
+ function assignEvaluated({ gen, evaluated, props, items: items2 }) {
17718
+ if (props instanceof codegen_1$n.Name)
17719
+ gen.assign((0, codegen_1$n._)`${evaluated}.props`, props);
17720
+ if (items2 instanceof codegen_1$n.Name)
17721
+ gen.assign((0, codegen_1$n._)`${evaluated}.items`, items2);
17722
+ }
17723
+ function schemaKeywords(it, types2, typeErrors, errsCount) {
17724
+ const { gen, schema, data, allErrors, opts, self } = it;
17725
+ const { RULES } = self;
17726
+ if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1$m.schemaHasRulesButRef)(schema, RULES))) {
17727
+ gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
17728
+ return;
17808
17729
  }
17809
- function checkContextTypes(it, types2) {
17810
- if (!types2.length)
17811
- return;
17812
- if (!it.dataTypes.length) {
17813
- it.dataTypes = types2;
17730
+ if (!opts.jtd)
17731
+ checkStrictTypes(it, types2);
17732
+ gen.block(() => {
17733
+ for (const group of RULES.rules)
17734
+ groupKeywords(group);
17735
+ groupKeywords(RULES.post);
17736
+ });
17737
+ function groupKeywords(group) {
17738
+ if (!(0, applicability_1.shouldUseGroup)(schema, group))
17814
17739
  return;
17815
- }
17816
- types2.forEach((t) => {
17817
- if (!includesType(it.dataTypes, t)) {
17818
- strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
17740
+ if (group.type) {
17741
+ gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
17742
+ iterateKeywords(it, group);
17743
+ if (types2.length === 1 && types2[0] === group.type && typeErrors) {
17744
+ gen.else();
17745
+ (0, dataType_2.reportTypeError)(it);
17819
17746
  }
17820
- });
17821
- narrowSchemaTypes(it, types2);
17822
- }
17823
- function checkMultipleTypes(it, ts) {
17824
- if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
17825
- strictTypesError(it, "use allowUnionTypes to allow union type keyword");
17747
+ gen.endIf();
17748
+ } else {
17749
+ iterateKeywords(it, group);
17826
17750
  }
17751
+ if (!allErrors)
17752
+ gen.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${errsCount || 0}`);
17827
17753
  }
17828
- function checkKeywordTypes(it, ts) {
17829
- const rules2 = it.self.RULES.all;
17830
- for (const keyword2 in rules2) {
17831
- const rule = rules2[keyword2];
17832
- if (typeof rule == "object" && (0, applicability_12.shouldUseRule)(it.schema, rule)) {
17833
- const { type: type2 } = rule.definition;
17834
- if (type2.length && !type2.some((t) => hasApplicableType(ts, t))) {
17835
- strictTypesError(it, `missing type "${type2.join(",")}" for keyword "${keyword2}"`);
17836
- }
17754
+ }
17755
+ function iterateKeywords(it, group) {
17756
+ const { gen, schema, opts: { useDefaults } } = it;
17757
+ if (useDefaults)
17758
+ (0, defaults_1.assignDefaults)(it, group.type);
17759
+ gen.block(() => {
17760
+ for (const rule of group.rules) {
17761
+ if ((0, applicability_1.shouldUseRule)(schema, rule)) {
17762
+ keywordCode(it, rule.keyword, rule.definition, group.type);
17837
17763
  }
17838
17764
  }
17765
+ });
17766
+ }
17767
+ function checkStrictTypes(it, types2) {
17768
+ if (it.schemaEnv.meta || !it.opts.strictTypes)
17769
+ return;
17770
+ checkContextTypes(it, types2);
17771
+ if (!it.opts.allowUnionTypes)
17772
+ checkMultipleTypes(it, types2);
17773
+ checkKeywordTypes(it, it.dataTypes);
17774
+ }
17775
+ function checkContextTypes(it, types2) {
17776
+ if (!types2.length)
17777
+ return;
17778
+ if (!it.dataTypes.length) {
17779
+ it.dataTypes = types2;
17780
+ return;
17839
17781
  }
17840
- function hasApplicableType(schTs, kwdT) {
17841
- return schTs.includes(kwdT) || kwdT === "number" && schTs.includes("integer");
17842
- }
17843
- function includesType(ts, t) {
17844
- return ts.includes(t) || t === "integer" && ts.includes("number");
17845
- }
17846
- function narrowSchemaTypes(it, withTypes) {
17847
- const ts = [];
17848
- for (const t of it.dataTypes) {
17849
- if (includesType(withTypes, t))
17850
- ts.push(t);
17851
- else if (withTypes.includes("integer") && t === "number")
17852
- ts.push("integer");
17853
- }
17854
- it.dataTypes = ts;
17855
- }
17856
- function strictTypesError(it, msg) {
17857
- const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
17858
- msg += ` at "${schemaPath}" (strictTypes)`;
17859
- (0, util_12.checkStrictMode)(it, msg, it.opts.strictTypes);
17860
- }
17861
- class KeywordCxt {
17862
- constructor(it, def2, keyword2) {
17863
- (0, keyword_1.validateKeywordUsage)(it, def2, keyword2);
17864
- this.gen = it.gen;
17865
- this.allErrors = it.allErrors;
17866
- this.keyword = keyword2;
17867
- this.data = it.data;
17868
- this.schema = it.schema[keyword2];
17869
- this.$data = def2.$data && it.opts.$data && this.schema && this.schema.$data;
17870
- this.schemaValue = (0, util_12.schemaRefOrVal)(it, this.schema, keyword2, this.$data);
17871
- this.schemaType = def2.schemaType;
17872
- this.parentSchema = it.schema;
17873
- this.params = {};
17874
- this.it = it;
17875
- this.def = def2;
17876
- if (this.$data) {
17877
- this.schemaCode = it.gen.const("vSchema", getData(this.$data, it));
17878
- } else {
17879
- this.schemaCode = this.schemaValue;
17880
- if (!(0, keyword_1.validSchemaType)(this.schema, def2.schemaType, def2.allowUndefined)) {
17881
- throw new Error(`${keyword2} value must be ${JSON.stringify(def2.schemaType)}`);
17882
- }
17883
- }
17884
- if ("code" in def2 ? def2.trackErrors : def2.errors !== false) {
17885
- this.errsCount = it.gen.const("_errs", names_12.default.errors);
17886
- }
17782
+ types2.forEach((t) => {
17783
+ if (!includesType(it.dataTypes, t)) {
17784
+ strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
17887
17785
  }
17888
- result(condition, successAction, failAction) {
17889
- this.failResult((0, codegen_12.not)(condition), successAction, failAction);
17890
- }
17891
- failResult(condition, successAction, failAction) {
17892
- this.gen.if(condition);
17893
- if (failAction)
17894
- failAction();
17895
- else
17896
- this.error();
17897
- if (successAction) {
17898
- this.gen.else();
17899
- successAction();
17900
- if (this.allErrors)
17901
- this.gen.endIf();
17902
- } else {
17903
- if (this.allErrors)
17904
- this.gen.endIf();
17905
- else
17906
- this.gen.else();
17786
+ });
17787
+ narrowSchemaTypes(it, types2);
17788
+ }
17789
+ function checkMultipleTypes(it, ts) {
17790
+ if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
17791
+ strictTypesError(it, "use allowUnionTypes to allow union type keyword");
17792
+ }
17793
+ }
17794
+ function checkKeywordTypes(it, ts) {
17795
+ const rules2 = it.self.RULES.all;
17796
+ for (const keyword2 in rules2) {
17797
+ const rule = rules2[keyword2];
17798
+ if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) {
17799
+ const { type: type2 } = rule.definition;
17800
+ if (type2.length && !type2.some((t) => hasApplicableType(ts, t))) {
17801
+ strictTypesError(it, `missing type "${type2.join(",")}" for keyword "${keyword2}"`);
17802
+ }
17803
+ }
17804
+ }
17805
+ }
17806
+ function hasApplicableType(schTs, kwdT) {
17807
+ return schTs.includes(kwdT) || kwdT === "number" && schTs.includes("integer");
17808
+ }
17809
+ function includesType(ts, t) {
17810
+ return ts.includes(t) || t === "integer" && ts.includes("number");
17811
+ }
17812
+ function narrowSchemaTypes(it, withTypes) {
17813
+ const ts = [];
17814
+ for (const t of it.dataTypes) {
17815
+ if (includesType(withTypes, t))
17816
+ ts.push(t);
17817
+ else if (withTypes.includes("integer") && t === "number")
17818
+ ts.push("integer");
17819
+ }
17820
+ it.dataTypes = ts;
17821
+ }
17822
+ function strictTypesError(it, msg) {
17823
+ const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
17824
+ msg += ` at "${schemaPath}" (strictTypes)`;
17825
+ (0, util_1$m.checkStrictMode)(it, msg, it.opts.strictTypes);
17826
+ }
17827
+ class KeywordCxt {
17828
+ constructor(it, def2, keyword2) {
17829
+ (0, keyword_1.validateKeywordUsage)(it, def2, keyword2);
17830
+ this.gen = it.gen;
17831
+ this.allErrors = it.allErrors;
17832
+ this.keyword = keyword2;
17833
+ this.data = it.data;
17834
+ this.schema = it.schema[keyword2];
17835
+ this.$data = def2.$data && it.opts.$data && this.schema && this.schema.$data;
17836
+ this.schemaValue = (0, util_1$m.schemaRefOrVal)(it, this.schema, keyword2, this.$data);
17837
+ this.schemaType = def2.schemaType;
17838
+ this.parentSchema = it.schema;
17839
+ this.params = {};
17840
+ this.it = it;
17841
+ this.def = def2;
17842
+ if (this.$data) {
17843
+ this.schemaCode = it.gen.const("vSchema", getData(this.$data, it));
17844
+ } else {
17845
+ this.schemaCode = this.schemaValue;
17846
+ if (!(0, keyword_1.validSchemaType)(this.schema, def2.schemaType, def2.allowUndefined)) {
17847
+ throw new Error(`${keyword2} value must be ${JSON.stringify(def2.schemaType)}`);
17907
17848
  }
17908
17849
  }
17909
- pass(condition, failAction) {
17910
- this.failResult((0, codegen_12.not)(condition), void 0, failAction);
17850
+ if ("code" in def2 ? def2.trackErrors : def2.errors !== false) {
17851
+ this.errsCount = it.gen.const("_errs", names_1$3.default.errors);
17911
17852
  }
17912
- fail(condition) {
17913
- if (condition === void 0) {
17914
- this.error();
17915
- if (!this.allErrors)
17916
- this.gen.if(false);
17917
- return;
17918
- }
17919
- this.gen.if(condition);
17853
+ }
17854
+ result(condition, successAction, failAction) {
17855
+ this.failResult((0, codegen_1$n.not)(condition), successAction, failAction);
17856
+ }
17857
+ failResult(condition, successAction, failAction) {
17858
+ this.gen.if(condition);
17859
+ if (failAction)
17860
+ failAction();
17861
+ else
17920
17862
  this.error();
17863
+ if (successAction) {
17864
+ this.gen.else();
17865
+ successAction();
17866
+ if (this.allErrors)
17867
+ this.gen.endIf();
17868
+ } else {
17921
17869
  if (this.allErrors)
17922
17870
  this.gen.endIf();
17923
17871
  else
17924
17872
  this.gen.else();
17925
17873
  }
17926
- fail$data(condition) {
17927
- if (!this.$data)
17928
- return this.fail(condition);
17929
- const { schemaCode } = this;
17930
- this.fail((0, codegen_12._)`${schemaCode} !== undefined && (${(0, codegen_12.or)(this.invalid$data(), condition)})`);
17931
- }
17932
- error(append, errorParams, errorPaths) {
17933
- if (errorParams) {
17934
- this.setParams(errorParams);
17935
- this._error(append, errorPaths);
17936
- this.setParams({});
17937
- return;
17938
- }
17939
- this._error(append, errorPaths);
17940
- }
17941
- _error(append, errorPaths) {
17942
- (append ? errors_12.reportExtraError : errors_12.reportError)(this, this.def.error, errorPaths);
17943
- }
17944
- $dataError() {
17945
- (0, errors_12.reportError)(this, this.def.$dataError || errors_12.keyword$DataError);
17946
- }
17947
- reset() {
17948
- if (this.errsCount === void 0)
17949
- throw new Error('add "trackErrors" to keyword definition');
17950
- (0, errors_12.resetErrorsCount)(this.gen, this.errsCount);
17951
- }
17952
- ok(cond) {
17874
+ }
17875
+ pass(condition, failAction) {
17876
+ this.failResult((0, codegen_1$n.not)(condition), void 0, failAction);
17877
+ }
17878
+ fail(condition) {
17879
+ if (condition === void 0) {
17880
+ this.error();
17953
17881
  if (!this.allErrors)
17954
- this.gen.if(cond);
17882
+ this.gen.if(false);
17883
+ return;
17955
17884
  }
17956
- setParams(obj, assign) {
17957
- if (assign)
17958
- Object.assign(this.params, obj);
17959
- else
17960
- this.params = obj;
17885
+ this.gen.if(condition);
17886
+ this.error();
17887
+ if (this.allErrors)
17888
+ this.gen.endIf();
17889
+ else
17890
+ this.gen.else();
17891
+ }
17892
+ fail$data(condition) {
17893
+ if (!this.$data)
17894
+ return this.fail(condition);
17895
+ const { schemaCode } = this;
17896
+ this.fail((0, codegen_1$n._)`${schemaCode} !== undefined && (${(0, codegen_1$n.or)(this.invalid$data(), condition)})`);
17897
+ }
17898
+ error(append, errorParams, errorPaths) {
17899
+ if (errorParams) {
17900
+ this.setParams(errorParams);
17901
+ this._error(append, errorPaths);
17902
+ this.setParams({});
17903
+ return;
17961
17904
  }
17962
- block$data(valid, codeBlock, $dataValid = codegen_12.nil) {
17963
- this.gen.block(() => {
17964
- this.check$data(valid, $dataValid);
17965
- codeBlock();
17966
- });
17905
+ this._error(append, errorPaths);
17906
+ }
17907
+ _error(append, errorPaths) {
17908
+ (append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error, errorPaths);
17909
+ }
17910
+ $dataError() {
17911
+ (0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError);
17912
+ }
17913
+ reset() {
17914
+ if (this.errsCount === void 0)
17915
+ throw new Error('add "trackErrors" to keyword definition');
17916
+ (0, errors_1.resetErrorsCount)(this.gen, this.errsCount);
17917
+ }
17918
+ ok(cond) {
17919
+ if (!this.allErrors)
17920
+ this.gen.if(cond);
17921
+ }
17922
+ setParams(obj, assign) {
17923
+ if (assign)
17924
+ Object.assign(this.params, obj);
17925
+ else
17926
+ this.params = obj;
17927
+ }
17928
+ block$data(valid, codeBlock, $dataValid = codegen_1$n.nil) {
17929
+ this.gen.block(() => {
17930
+ this.check$data(valid, $dataValid);
17931
+ codeBlock();
17932
+ });
17933
+ }
17934
+ check$data(valid = codegen_1$n.nil, $dataValid = codegen_1$n.nil) {
17935
+ if (!this.$data)
17936
+ return;
17937
+ const { gen, schemaCode, schemaType, def: def2 } = this;
17938
+ gen.if((0, codegen_1$n.or)((0, codegen_1$n._)`${schemaCode} === undefined`, $dataValid));
17939
+ if (valid !== codegen_1$n.nil)
17940
+ gen.assign(valid, true);
17941
+ if (schemaType.length || def2.validateSchema) {
17942
+ gen.elseIf(this.invalid$data());
17943
+ this.$dataError();
17944
+ if (valid !== codegen_1$n.nil)
17945
+ gen.assign(valid, false);
17967
17946
  }
17968
- check$data(valid = codegen_12.nil, $dataValid = codegen_12.nil) {
17969
- if (!this.$data)
17970
- return;
17971
- const { gen, schemaCode, schemaType, def: def2 } = this;
17972
- gen.if((0, codegen_12.or)((0, codegen_12._)`${schemaCode} === undefined`, $dataValid));
17973
- if (valid !== codegen_12.nil)
17974
- gen.assign(valid, true);
17975
- if (schemaType.length || def2.validateSchema) {
17976
- gen.elseIf(this.invalid$data());
17977
- this.$dataError();
17978
- if (valid !== codegen_12.nil)
17979
- gen.assign(valid, false);
17947
+ gen.else();
17948
+ }
17949
+ invalid$data() {
17950
+ const { gen, schemaCode, schemaType, def: def2, it } = this;
17951
+ return (0, codegen_1$n.or)(wrong$DataType(), invalid$DataSchema());
17952
+ function wrong$DataType() {
17953
+ if (schemaType.length) {
17954
+ if (!(schemaCode instanceof codegen_1$n.Name))
17955
+ throw new Error("ajv implementation error");
17956
+ const st = Array.isArray(schemaType) ? schemaType : [schemaType];
17957
+ return (0, codegen_1$n._)`${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`;
17980
17958
  }
17981
- gen.else();
17959
+ return codegen_1$n.nil;
17982
17960
  }
17983
- invalid$data() {
17984
- const { gen, schemaCode, schemaType, def: def2, it } = this;
17985
- return (0, codegen_12.or)(wrong$DataType(), invalid$DataSchema());
17986
- function wrong$DataType() {
17987
- if (schemaType.length) {
17988
- if (!(schemaCode instanceof codegen_12.Name))
17989
- throw new Error("ajv implementation error");
17990
- const st = Array.isArray(schemaType) ? schemaType : [schemaType];
17991
- return (0, codegen_12._)`${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`;
17992
- }
17993
- return codegen_12.nil;
17961
+ function invalid$DataSchema() {
17962
+ if (def2.validateSchema) {
17963
+ const validateSchemaRef = gen.scopeValue("validate$data", { ref: def2.validateSchema });
17964
+ return (0, codegen_1$n._)`!${validateSchemaRef}(${schemaCode})`;
17994
17965
  }
17995
- function invalid$DataSchema() {
17996
- if (def2.validateSchema) {
17997
- const validateSchemaRef = gen.scopeValue("validate$data", { ref: def2.validateSchema });
17998
- return (0, codegen_12._)`!${validateSchemaRef}(${schemaCode})`;
17999
- }
18000
- return codegen_12.nil;
18001
- }
18002
- }
18003
- subschema(appl, valid) {
18004
- const subschema2 = (0, subschema_1.getSubschema)(this.it, appl);
18005
- (0, subschema_1.extendSubschemaData)(subschema2, this.it, appl);
18006
- (0, subschema_1.extendSubschemaMode)(subschema2, appl);
18007
- const nextContext = { ...this.it, ...subschema2, items: void 0, props: void 0 };
18008
- subschemaCode(nextContext, valid);
18009
- return nextContext;
17966
+ return codegen_1$n.nil;
18010
17967
  }
18011
- mergeEvaluated(schemaCxt, toName) {
18012
- const { it, gen } = this;
18013
- if (!it.opts.unevaluated)
18014
- return;
18015
- if (it.props !== true && schemaCxt.props !== void 0) {
18016
- it.props = util_12.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName);
18017
- }
18018
- if (it.items !== true && schemaCxt.items !== void 0) {
18019
- it.items = util_12.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName);
18020
- }
17968
+ }
17969
+ subschema(appl, valid) {
17970
+ const subschema2 = (0, subschema_1.getSubschema)(this.it, appl);
17971
+ (0, subschema_1.extendSubschemaData)(subschema2, this.it, appl);
17972
+ (0, subschema_1.extendSubschemaMode)(subschema2, appl);
17973
+ const nextContext = { ...this.it, ...subschema2, items: void 0, props: void 0 };
17974
+ subschemaCode(nextContext, valid);
17975
+ return nextContext;
17976
+ }
17977
+ mergeEvaluated(schemaCxt, toName) {
17978
+ const { it, gen } = this;
17979
+ if (!it.opts.unevaluated)
17980
+ return;
17981
+ if (it.props !== true && schemaCxt.props !== void 0) {
17982
+ it.props = util_1$m.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName);
18021
17983
  }
18022
- mergeValidEvaluated(schemaCxt, valid) {
18023
- const { it, gen } = this;
18024
- if (it.opts.unevaluated && (it.props !== true || it.items !== true)) {
18025
- gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_12.Name));
18026
- return true;
18027
- }
17984
+ if (it.items !== true && schemaCxt.items !== void 0) {
17985
+ it.items = util_1$m.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName);
18028
17986
  }
18029
17987
  }
18030
- validate.KeywordCxt = KeywordCxt;
18031
- function keywordCode(it, keyword2, def2, ruleType) {
18032
- const cxt = new KeywordCxt(it, def2, keyword2);
18033
- if ("code" in def2) {
18034
- def2.code(cxt, ruleType);
18035
- } else if (cxt.$data && def2.validate) {
18036
- (0, keyword_1.funcKeywordCode)(cxt, def2);
18037
- } else if ("macro" in def2) {
18038
- (0, keyword_1.macroKeywordCode)(cxt, def2);
18039
- } else if (def2.compile || def2.validate) {
18040
- (0, keyword_1.funcKeywordCode)(cxt, def2);
18041
- }
18042
- }
18043
- const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
18044
- const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
18045
- function getData($data, { dataLevel, dataNames, dataPathArr }) {
18046
- let jsonPointer;
18047
- let data;
18048
- if ($data === "")
18049
- return names_12.default.rootData;
18050
- if ($data[0] === "/") {
18051
- if (!JSON_POINTER.test($data))
18052
- throw new Error(`Invalid JSON-pointer: ${$data}`);
18053
- jsonPointer = $data;
18054
- data = names_12.default.rootData;
18055
- } else {
18056
- const matches = RELATIVE_JSON_POINTER.exec($data);
18057
- if (!matches)
18058
- throw new Error(`Invalid JSON-pointer: ${$data}`);
18059
- const up = +matches[1];
18060
- jsonPointer = matches[2];
18061
- if (jsonPointer === "#") {
18062
- if (up >= dataLevel)
18063
- throw new Error(errorMsg("property/index", up));
18064
- return dataPathArr[dataLevel - up];
18065
- }
18066
- if (up > dataLevel)
18067
- throw new Error(errorMsg("data", up));
18068
- data = dataNames[dataLevel - up];
18069
- if (!jsonPointer)
18070
- return data;
18071
- }
18072
- let expr = data;
18073
- const segments = jsonPointer.split("/");
18074
- for (const segment of segments) {
18075
- if (segment) {
18076
- data = (0, codegen_12._)`${data}${(0, codegen_12.getProperty)((0, util_12.unescapeJsonPointer)(segment))}`;
18077
- expr = (0, codegen_12._)`${expr} && ${data}`;
18078
- }
17988
+ mergeValidEvaluated(schemaCxt, valid) {
17989
+ const { it, gen } = this;
17990
+ if (it.opts.unevaluated && (it.props !== true || it.items !== true)) {
17991
+ gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1$n.Name));
17992
+ return true;
18079
17993
  }
18080
- return expr;
18081
- function errorMsg(pointerType, up) {
18082
- return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
17994
+ }
17995
+ }
17996
+ validate.KeywordCxt = KeywordCxt;
17997
+ function keywordCode(it, keyword2, def2, ruleType) {
17998
+ const cxt = new KeywordCxt(it, def2, keyword2);
17999
+ if ("code" in def2) {
18000
+ def2.code(cxt, ruleType);
18001
+ } else if (cxt.$data && def2.validate) {
18002
+ (0, keyword_1.funcKeywordCode)(cxt, def2);
18003
+ } else if ("macro" in def2) {
18004
+ (0, keyword_1.macroKeywordCode)(cxt, def2);
18005
+ } else if (def2.compile || def2.validate) {
18006
+ (0, keyword_1.funcKeywordCode)(cxt, def2);
18007
+ }
18008
+ }
18009
+ const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
18010
+ const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
18011
+ function getData($data, { dataLevel, dataNames, dataPathArr }) {
18012
+ let jsonPointer;
18013
+ let data;
18014
+ if ($data === "")
18015
+ return names_1$3.default.rootData;
18016
+ if ($data[0] === "/") {
18017
+ if (!JSON_POINTER.test($data))
18018
+ throw new Error(`Invalid JSON-pointer: ${$data}`);
18019
+ jsonPointer = $data;
18020
+ data = names_1$3.default.rootData;
18021
+ } else {
18022
+ const matches = RELATIVE_JSON_POINTER.exec($data);
18023
+ if (!matches)
18024
+ throw new Error(`Invalid JSON-pointer: ${$data}`);
18025
+ const up = +matches[1];
18026
+ jsonPointer = matches[2];
18027
+ if (jsonPointer === "#") {
18028
+ if (up >= dataLevel)
18029
+ throw new Error(errorMsg("property/index", up));
18030
+ return dataPathArr[dataLevel - up];
18031
+ }
18032
+ if (up > dataLevel)
18033
+ throw new Error(errorMsg("data", up));
18034
+ data = dataNames[dataLevel - up];
18035
+ if (!jsonPointer)
18036
+ return data;
18037
+ }
18038
+ let expr = data;
18039
+ const segments = jsonPointer.split("/");
18040
+ for (const segment of segments) {
18041
+ if (segment) {
18042
+ data = (0, codegen_1$n._)`${data}${(0, codegen_1$n.getProperty)((0, util_1$m.unescapeJsonPointer)(segment))}`;
18043
+ expr = (0, codegen_1$n._)`${expr} && ${data}`;
18083
18044
  }
18084
18045
  }
18085
- validate.getData = getData;
18086
- return validate;
18046
+ return expr;
18047
+ function errorMsg(pointerType, up) {
18048
+ return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
18049
+ }
18087
18050
  }
18051
+ validate.getData = getData;
18088
18052
  var validation_error = {};
18089
- var hasRequiredValidation_error;
18090
- function requireValidation_error() {
18091
- if (hasRequiredValidation_error) return validation_error;
18092
- hasRequiredValidation_error = 1;
18093
- Object.defineProperty(validation_error, "__esModule", { value: true });
18094
- class ValidationError extends Error {
18095
- constructor(errors2) {
18096
- super("validation failed");
18097
- this.errors = errors2;
18098
- this.ajv = this.validation = true;
18099
- }
18053
+ Object.defineProperty(validation_error, "__esModule", { value: true });
18054
+ class ValidationError extends Error {
18055
+ constructor(errors2) {
18056
+ super("validation failed");
18057
+ this.errors = errors2;
18058
+ this.ajv = this.validation = true;
18100
18059
  }
18101
- validation_error.default = ValidationError;
18102
- return validation_error;
18103
18060
  }
18061
+ validation_error.default = ValidationError;
18104
18062
  var ref_error = {};
18105
18063
  Object.defineProperty(ref_error, "__esModule", { value: true });
18106
18064
  const resolve_1$1 = resolve$2;
@@ -18116,11 +18074,11 @@ var compile = {};
18116
18074
  Object.defineProperty(compile, "__esModule", { value: true });
18117
18075
  compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compile.compileSchema = compile.SchemaEnv = void 0;
18118
18076
  const codegen_1$m = codegen;
18119
- const validation_error_1 = requireValidation_error();
18077
+ const validation_error_1 = validation_error;
18120
18078
  const names_1$2 = names$1;
18121
18079
  const resolve_1 = resolve$2;
18122
18080
  const util_1$l = util;
18123
- const validate_1$1 = requireValidate();
18081
+ const validate_1$1 = validate;
18124
18082
  class SchemaEnv {
18125
18083
  constructor(env) {
18126
18084
  var _a;
@@ -19049,7 +19007,7 @@ uri$1.default = uri;
19049
19007
  (function(exports) {
19050
19008
  Object.defineProperty(exports, "__esModule", { value: true });
19051
19009
  exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
19052
- var validate_12 = requireValidate();
19010
+ var validate_12 = validate;
19053
19011
  Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
19054
19012
  return validate_12.KeywordCxt;
19055
19013
  } });
@@ -19072,7 +19030,7 @@ uri$1.default = uri;
19072
19030
  Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() {
19073
19031
  return codegen_12.CodeGen;
19074
19032
  } });
19075
- const validation_error_12 = requireValidation_error();
19033
+ const validation_error_12 = validation_error;
19076
19034
  const ref_error_12 = ref_error;
19077
19035
  const rules_12 = rules;
19078
19036
  const compile_12 = compile;
@@ -20660,7 +20618,7 @@ const def$a = {
20660
20618
  additionalProperties.default = def$a;
20661
20619
  var properties$1 = {};
20662
20620
  Object.defineProperty(properties$1, "__esModule", { value: true });
20663
- const validate_1 = requireValidate();
20621
+ const validate_1 = validate;
20664
20622
  const code_1$2 = code;
20665
20623
  const util_1$7 = util;
20666
20624
  const additionalProperties_1$1 = additionalProperties;
@@ -21511,7 +21469,7 @@ const require$$3 = {
21511
21469
  module.exports.Ajv = Ajv2;
21512
21470
  Object.defineProperty(exports, "__esModule", { value: true });
21513
21471
  exports.default = Ajv2;
21514
- var validate_12 = requireValidate();
21472
+ var validate_12 = validate;
21515
21473
  Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
21516
21474
  return validate_12.KeywordCxt;
21517
21475
  } });
@@ -21534,7 +21492,7 @@ const require$$3 = {
21534
21492
  Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() {
21535
21493
  return codegen_12.CodeGen;
21536
21494
  } });
21537
- var validation_error_12 = requireValidation_error();
21495
+ var validation_error_12 = validation_error;
21538
21496
  Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function() {
21539
21497
  return validation_error_12.default;
21540
21498
  } });