@spooky-sync/cli 0.0.1-canary.314 → 0.0.1-canary.315

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 +968 -926
  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$v = codegen;
16373
- const code_1$a = code$1;
16372
+ const codegen_1$p = codegen;
16373
+ const code_1$9 = 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$v._)`${schema}`;
16426
+ return (0, codegen_1$p._)`${schema}`;
16427
16427
  }
16428
- return (0, codegen_1$v._)`${topSchemaRef}${schemaPath}${(0, codegen_1$v.getProperty)(keyword2)}`;
16428
+ return (0, codegen_1$p._)`${topSchemaRef}${schemaPath}${(0, codegen_1$p.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$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;
16460
+ const res = to === void 0 ? from : to instanceof codegen_1$p.Name ? (from instanceof codegen_1$p.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1$p.Name ? (mergeToName(gen, to, from), from) : mergeValues2(from, to);
16461
+ return toName === codegen_1$p.Name && !(res instanceof codegen_1$p.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$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})`));
16466
+ mergeNames: (gen, from, to) => gen.if((0, codegen_1$p._)`${to} !== true && ${from} !== undefined`, () => {
16467
+ gen.if((0, codegen_1$p._)`${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1$p._)`${to} || {}`).code((0, codegen_1$p._)`Object.assign(${to}, ${from})`));
16468
16468
  }),
16469
- mergeToName: (gen, from, to) => gen.if((0, codegen_1$v._)`${to} !== true`, () => {
16469
+ mergeToName: (gen, from, to) => gen.if((0, codegen_1$p._)`${to} !== true`, () => {
16470
16470
  if (from === true) {
16471
16471
  gen.assign(to, true);
16472
16472
  } else {
16473
- gen.assign(to, (0, codegen_1$v._)`${to} || {}`);
16473
+ gen.assign(to, (0, codegen_1$p._)`${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$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}`)),
16481
+ mergeNames: (gen, from, to) => gen.if((0, codegen_1$p._)`${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1$p._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
16482
+ mergeToName: (gen, from, to) => gen.if((0, codegen_1$p._)`${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1$p._)`${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$v._)`{}`);
16490
+ const props = gen.var("props", (0, codegen_1$p._)`{}`);
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$v._)`${props}${(0, codegen_1$v.getProperty)(p)}`, true));
16497
+ Object.keys(ps).forEach((p) => gen.assign((0, codegen_1$p._)`${props}${(0, codegen_1$p.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$a._Code(f.code))
16504
+ code: snippets[f.code] || (snippets[f.code] = new code_1$9._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$v.Name) {
16514
+ if (dataProp instanceof codegen_1$p.Name) {
16515
16515
  const isNumber = dataPropType === Type.Num;
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")`;
16516
+ return jsPropertySyntax ? isNumber ? (0, codegen_1$p._)`"[" + ${dataProp} + "]"` : (0, codegen_1$p._)`"['" + ${dataProp} + "']"` : isNumber ? (0, codegen_1$p._)`"/" + ${dataProp}` : (0, codegen_1$p._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
16517
16517
  }
16518
- return jsPropertySyntax ? (0, codegen_1$v.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
16518
+ return jsPropertySyntax ? (0, codegen_1$p.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$u = codegen;
16532
+ const codegen_1$o = codegen;
16533
16533
  const names = {
16534
16534
  // validation function arguments
16535
- data: new codegen_1$u.Name("data"),
16535
+ data: new codegen_1$o.Name("data"),
16536
16536
  // data passed to validation function
16537
16537
  // args passed from referencing schema
16538
- valCxt: new codegen_1$u.Name("valCxt"),
16538
+ valCxt: new codegen_1$o.Name("valCxt"),
16539
16539
  // validation/data context - should not be used directly, it is destructured to the names below
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"),
16540
+ instancePath: new codegen_1$o.Name("instancePath"),
16541
+ parentData: new codegen_1$o.Name("parentData"),
16542
+ parentDataProperty: new codegen_1$o.Name("parentDataProperty"),
16543
+ rootData: new codegen_1$o.Name("rootData"),
16544
16544
  // root data - same as the data passed to the first/top validation function
16545
- dynamicAnchors: new codegen_1$u.Name("dynamicAnchors"),
16545
+ dynamicAnchors: new codegen_1$o.Name("dynamicAnchors"),
16546
16546
  // used to support recursiveRef and dynamicRef
16547
16547
  // function scoped variables
16548
- vErrors: new codegen_1$u.Name("vErrors"),
16548
+ vErrors: new codegen_1$o.Name("vErrors"),
16549
16549
  // null or array of validation errors
16550
- errors: new codegen_1$u.Name("errors"),
16550
+ errors: new codegen_1$o.Name("errors"),
16551
16551
  // counter of validation errors
16552
- this: new codegen_1$u.Name("this"),
16552
+ this: new codegen_1$o.Name("this"),
16553
16553
  // "globals"
16554
- self: new codegen_1$u.Name("self"),
16555
- scope: new codegen_1$u.Name("scope"),
16554
+ self: new codegen_1$o.Name("self"),
16555
+ scope: new codegen_1$o.Name("scope"),
16556
16556
  // JTD serialize/parse name for JSON string and position
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")
16557
+ json: new codegen_1$o.Name("json"),
16558
+ jsonPos: new codegen_1$o.Name("jsonPos"),
16559
+ jsonLen: new codegen_1$o.Name("jsonLen"),
16560
+ jsonPart: new codegen_1$o.Name("jsonPart")
16561
16561
  };
16562
16562
  names$1.default = names;
16563
16563
  (function(exports) {
@@ -16677,49 +16677,55 @@ names$1.default = names;
16677
16677
  keyValues.push([E.propertyName, propertyName]);
16678
16678
  }
16679
16679
  })(errors);
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);
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
+ }
16697
16702
  }
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);
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
+ }
16707
16712
  }
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);
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);
16727
+ }
16728
+ return boolSchema;
16723
16729
  }
16724
16730
  var dataType = {};
16725
16731
  var rules = {};
@@ -16767,10 +16773,10 @@ applicability.shouldUseRule = shouldUseRule;
16767
16773
  Object.defineProperty(dataType, "__esModule", { value: true });
16768
16774
  dataType.reportTypeError = dataType.checkDataTypes = dataType.checkDataType = dataType.coerceAndCheckDataType = dataType.getJSONTypes = dataType.getSchemaTypes = dataType.DataType = void 0;
16769
16775
  const rules_1 = rules;
16770
- const applicability_1$1 = applicability;
16771
- const errors_1$2 = errors;
16772
- const codegen_1$s = codegen;
16773
- const util_1$r = util;
16776
+ const applicability_1 = applicability;
16777
+ const errors_1 = errors;
16778
+ const codegen_1$n = codegen;
16779
+ const util_1$n = util;
16774
16780
  var DataType;
16775
16781
  (function(DataType2) {
16776
16782
  DataType2[DataType2["Correct"] = 0] = "Correct";
@@ -16802,7 +16808,7 @@ dataType.getJSONTypes = getJSONTypes;
16802
16808
  function coerceAndCheckDataType(it, types2) {
16803
16809
  const { gen, data, opts } = it;
16804
16810
  const coerceTo = coerceToTypes(types2, opts.coerceTypes);
16805
- const checkTypes = types2.length > 0 && !(coerceTo.length === 0 && types2.length === 1 && (0, applicability_1$1.schemaHasRulesForType)(it, types2[0]));
16811
+ const checkTypes = types2.length > 0 && !(coerceTo.length === 0 && types2.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types2[0]));
16806
16812
  if (checkTypes) {
16807
16813
  const wrongType = checkDataTypes(types2, data, opts.strictNumbers, DataType.Wrong);
16808
16814
  gen.if(wrongType, () => {
@@ -16821,12 +16827,12 @@ function coerceToTypes(types2, coerceTypes) {
16821
16827
  }
16822
16828
  function coerceData(it, types2, coerceTo) {
16823
16829
  const { gen, data, opts } = it;
16824
- const dataType2 = gen.let("dataType", (0, codegen_1$s._)`typeof ${data}`);
16825
- const coerced = gen.let("coerced", (0, codegen_1$s._)`undefined`);
16830
+ const dataType2 = gen.let("dataType", (0, codegen_1$n._)`typeof ${data}`);
16831
+ const coerced = gen.let("coerced", (0, codegen_1$n._)`undefined`);
16826
16832
  if (opts.coerceTypes === "array") {
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)));
16833
+ gen.if((0, codegen_1$n._)`${dataType2} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1$n._)`${data}[0]`).assign(dataType2, (0, codegen_1$n._)`typeof ${data}`).if(checkDataTypes(types2, data, opts.strictNumbers), () => gen.assign(coerced, data)));
16828
16834
  }
16829
- gen.if((0, codegen_1$s._)`${coerced} !== undefined`);
16835
+ gen.if((0, codegen_1$n._)`${coerced} !== undefined`);
16830
16836
  for (const t of coerceTo) {
16831
16837
  if (COERCIBLE.has(t) || t === "array" && opts.coerceTypes === "array") {
16832
16838
  coerceSpecificType(t);
@@ -16835,63 +16841,63 @@ function coerceData(it, types2, coerceTo) {
16835
16841
  gen.else();
16836
16842
  reportTypeError(it);
16837
16843
  gen.endIf();
16838
- gen.if((0, codegen_1$s._)`${coerced} !== undefined`, () => {
16844
+ gen.if((0, codegen_1$n._)`${coerced} !== undefined`, () => {
16839
16845
  gen.assign(data, coerced);
16840
16846
  assignParentData(it, coerced);
16841
16847
  });
16842
16848
  function coerceSpecificType(t) {
16843
16849
  switch (t) {
16844
16850
  case "string":
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._)`""`);
16851
+ gen.elseIf((0, codegen_1$n._)`${dataType2} == "number" || ${dataType2} == "boolean"`).assign(coerced, (0, codegen_1$n._)`"" + ${data}`).elseIf((0, codegen_1$n._)`${data} === null`).assign(coerced, (0, codegen_1$n._)`""`);
16846
16852
  return;
16847
16853
  case "number":
16848
- gen.elseIf((0, codegen_1$s._)`${dataType2} == "boolean" || ${data} === null
16849
- || (${dataType2} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1$s._)`+${data}`);
16854
+ gen.elseIf((0, codegen_1$n._)`${dataType2} == "boolean" || ${data} === null
16855
+ || (${dataType2} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1$n._)`+${data}`);
16850
16856
  return;
16851
16857
  case "integer":
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}`);
16858
+ gen.elseIf((0, codegen_1$n._)`${dataType2} === "boolean" || ${data} === null
16859
+ || (${dataType2} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`).assign(coerced, (0, codegen_1$n._)`+${data}`);
16854
16860
  return;
16855
16861
  case "boolean":
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);
16862
+ gen.elseIf((0, codegen_1$n._)`${data} === "false" || ${data} === 0 || ${data} === null`).assign(coerced, false).elseIf((0, codegen_1$n._)`${data} === "true" || ${data} === 1`).assign(coerced, true);
16857
16863
  return;
16858
16864
  case "null":
16859
- gen.elseIf((0, codegen_1$s._)`${data} === "" || ${data} === 0 || ${data} === false`);
16865
+ gen.elseIf((0, codegen_1$n._)`${data} === "" || ${data} === 0 || ${data} === false`);
16860
16866
  gen.assign(coerced, null);
16861
16867
  return;
16862
16868
  case "array":
16863
- gen.elseIf((0, codegen_1$s._)`${dataType2} === "string" || ${dataType2} === "number"
16864
- || ${dataType2} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1$s._)`[${data}]`);
16869
+ gen.elseIf((0, codegen_1$n._)`${dataType2} === "string" || ${dataType2} === "number"
16870
+ || ${dataType2} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1$n._)`[${data}]`);
16865
16871
  }
16866
16872
  }
16867
16873
  }
16868
16874
  function assignParentData({ gen, parentData, parentDataProperty }, expr) {
16869
- gen.if((0, codegen_1$s._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1$s._)`${parentData}[${parentDataProperty}]`, expr));
16875
+ gen.if((0, codegen_1$n._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1$n._)`${parentData}[${parentDataProperty}]`, expr));
16870
16876
  }
16871
16877
  function checkDataType(dataType2, data, strictNums, correct = DataType.Correct) {
16872
- const EQ = correct === DataType.Correct ? codegen_1$s.operators.EQ : codegen_1$s.operators.NEQ;
16878
+ const EQ = correct === DataType.Correct ? codegen_1$n.operators.EQ : codegen_1$n.operators.NEQ;
16873
16879
  let cond;
16874
16880
  switch (dataType2) {
16875
16881
  case "null":
16876
- return (0, codegen_1$s._)`${data} ${EQ} null`;
16882
+ return (0, codegen_1$n._)`${data} ${EQ} null`;
16877
16883
  case "array":
16878
- cond = (0, codegen_1$s._)`Array.isArray(${data})`;
16884
+ cond = (0, codegen_1$n._)`Array.isArray(${data})`;
16879
16885
  break;
16880
16886
  case "object":
16881
- cond = (0, codegen_1$s._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
16887
+ cond = (0, codegen_1$n._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
16882
16888
  break;
16883
16889
  case "integer":
16884
- cond = numCond((0, codegen_1$s._)`!(${data} % 1) && !isNaN(${data})`);
16890
+ cond = numCond((0, codegen_1$n._)`!(${data} % 1) && !isNaN(${data})`);
16885
16891
  break;
16886
16892
  case "number":
16887
16893
  cond = numCond();
16888
16894
  break;
16889
16895
  default:
16890
- return (0, codegen_1$s._)`typeof ${data} ${EQ} ${dataType2}`;
16896
+ return (0, codegen_1$n._)`typeof ${data} ${EQ} ${dataType2}`;
16891
16897
  }
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);
16898
+ return correct === DataType.Correct ? cond : (0, codegen_1$n.not)(cond);
16899
+ function numCond(_cond = codegen_1$n.nil) {
16900
+ return (0, codegen_1$n.and)((0, codegen_1$n._)`typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1$n._)`isFinite(${data})` : codegen_1$n.nil);
16895
16901
  }
16896
16902
  }
16897
16903
  dataType.checkDataType = checkDataType;
@@ -16900,35 +16906,35 @@ function checkDataTypes(dataTypes, data, strictNums, correct) {
16900
16906
  return checkDataType(dataTypes[0], data, strictNums, correct);
16901
16907
  }
16902
16908
  let cond;
16903
- const types2 = (0, util_1$r.toHash)(dataTypes);
16909
+ const types2 = (0, util_1$n.toHash)(dataTypes);
16904
16910
  if (types2.array && types2.object) {
16905
- const notObj = (0, codegen_1$s._)`typeof ${data} != "object"`;
16906
- cond = types2.null ? notObj : (0, codegen_1$s._)`!${data} || ${notObj}`;
16911
+ const notObj = (0, codegen_1$n._)`typeof ${data} != "object"`;
16912
+ cond = types2.null ? notObj : (0, codegen_1$n._)`!${data} || ${notObj}`;
16907
16913
  delete types2.null;
16908
16914
  delete types2.array;
16909
16915
  delete types2.object;
16910
16916
  } else {
16911
- cond = codegen_1$s.nil;
16917
+ cond = codegen_1$n.nil;
16912
16918
  }
16913
16919
  if (types2.number)
16914
16920
  delete types2.integer;
16915
16921
  for (const t in types2)
16916
- cond = (0, codegen_1$s.and)(cond, checkDataType(t, data, strictNums, correct));
16922
+ cond = (0, codegen_1$n.and)(cond, checkDataType(t, data, strictNums, correct));
16917
16923
  return cond;
16918
16924
  }
16919
16925
  dataType.checkDataTypes = checkDataTypes;
16920
16926
  const typeError = {
16921
16927
  message: ({ schema }) => `must be ${schema}`,
16922
- params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1$s._)`{type: ${schema}}` : (0, codegen_1$s._)`{type: ${schemaValue}}`
16928
+ params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1$n._)`{type: ${schema}}` : (0, codegen_1$n._)`{type: ${schemaValue}}`
16923
16929
  };
16924
16930
  function reportTypeError(it) {
16925
16931
  const cxt = getTypeErrorContext(it);
16926
- (0, errors_1$2.reportError)(cxt, typeError);
16932
+ (0, errors_1.reportError)(cxt, typeError);
16927
16933
  }
16928
16934
  dataType.reportTypeError = reportTypeError;
16929
16935
  function getTypeErrorContext(it) {
16930
16936
  const { gen, data, schema } = it;
16931
- const schemaCode = (0, util_1$r.schemaRefOrVal)(it, schema, "type");
16937
+ const schemaCode = (0, util_1$n.schemaRefOrVal)(it, schema, "type");
16932
16938
  return {
16933
16939
  gen,
16934
16940
  keyword: "type",
@@ -16942,352 +16948,376 @@ function getTypeErrorContext(it) {
16942
16948
  };
16943
16949
  }
16944
16950
  var defaults = {};
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;
16951
+ var hasRequiredDefaults;
16952
+ function requireDefaults() {
16953
+ if (hasRequiredDefaults) return defaults;
16954
+ hasRequiredDefaults = 1;
16955
+ Object.defineProperty(defaults, "__esModule", { value: true });
16956
+ defaults.assignDefaults = void 0;
16957
+ const codegen_12 = codegen;
16958
+ const util_12 = util;
16959
+ function assignDefaults(it, ty) {
16960
+ const { properties: properties2, items: items2 } = it.schema;
16961
+ if (ty === "object" && properties2) {
16962
+ for (const key in properties2) {
16963
+ assignDefault(it, key, properties2[key].default);
16964
+ }
16965
+ } else if (ty === "array" && Array.isArray(items2)) {
16966
+ items2.forEach((sch, i) => assignDefault(it, i, sch.default));
16967
+ }
16968
16968
  }
16969
- let condition = (0, codegen_1$r._)`${childData} === undefined`;
16970
- if (opts.useDefaults === "empty") {
16971
- condition = (0, codegen_1$r._)`${condition} || ${childData} === null || ${childData} === ""`;
16969
+ defaults.assignDefaults = assignDefaults;
16970
+ function assignDefault(it, prop, defaultValue) {
16971
+ const { gen, compositeRule, data, opts } = it;
16972
+ if (defaultValue === void 0)
16973
+ return;
16974
+ const childData = (0, codegen_12._)`${data}${(0, codegen_12.getProperty)(prop)}`;
16975
+ if (compositeRule) {
16976
+ (0, util_12.checkStrictMode)(it, `default is ignored for: ${childData}`);
16977
+ return;
16978
+ }
16979
+ let condition = (0, codegen_12._)`${childData} === undefined`;
16980
+ if (opts.useDefaults === "empty") {
16981
+ condition = (0, codegen_12._)`${condition} || ${childData} === null || ${childData} === ""`;
16982
+ }
16983
+ gen.if(condition, (0, codegen_12._)`${childData} = ${(0, codegen_12.stringify)(defaultValue)}`);
16972
16984
  }
16973
- gen.if(condition, (0, codegen_1$r._)`${childData} = ${(0, codegen_1$r.stringify)(defaultValue)}`);
16985
+ return defaults;
16974
16986
  }
16975
16987
  var keyword = {};
16976
16988
  var code = {};
16977
- Object.defineProperty(code, "__esModule", { value: true });
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;
16979
- const codegen_1$q = codegen;
16980
- const util_1$p = util;
16981
- const names_1$5 = names$1;
16982
- const util_2$1 = util;
16983
- function checkReportMissingProp(cxt, prop) {
16984
- const { gen, data, it } = cxt;
16985
- gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
16986
- cxt.setParams({ missingProperty: (0, codegen_1$q._)`${prop}` }, true);
16987
- cxt.error();
16988
- });
16989
- }
16990
- code.checkReportMissingProp = checkReportMissingProp;
16991
- function checkMissingProp({ gen, data, it: { opts } }, properties2, missing) {
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}`)));
16993
- }
16994
- code.checkMissingProp = checkMissingProp;
16995
- function reportMissingProp(cxt, missing) {
16996
- cxt.setParams({ missingProperty: missing }, true);
16997
- cxt.error();
16998
- }
16999
- code.reportMissingProp = reportMissingProp;
17000
- function hasPropFunc(gen) {
17001
- return gen.scopeValue("func", {
17002
- // eslint-disable-next-line @typescript-eslint/unbound-method
17003
- ref: Object.prototype.hasOwnProperty,
17004
- code: (0, codegen_1$q._)`Object.prototype.hasOwnProperty`
17005
- });
17006
- }
17007
- code.hasPropFunc = hasPropFunc;
17008
- function isOwnProperty(gen, data, property) {
17009
- return (0, codegen_1$q._)`${hasPropFunc(gen)}.call(${data}, ${property})`;
17010
- }
17011
- code.isOwnProperty = isOwnProperty;
17012
- function propertyInData(gen, data, property, ownProperties) {
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;
17015
- }
17016
- code.propertyInData = propertyInData;
17017
- function noPropertyInData(gen, data, property, ownProperties) {
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;
17020
- }
17021
- code.noPropertyInData = noPropertyInData;
17022
- function allSchemaProperties(schemaMap) {
17023
- return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : [];
17024
- }
17025
- code.allSchemaProperties = allSchemaProperties;
17026
- function schemaProperties(it, schemaMap) {
17027
- return allSchemaProperties(schemaMap).filter((p) => !(0, util_1$p.alwaysValidSchema)(it, schemaMap[p]));
17028
- }
17029
- code.schemaProperties = schemaProperties;
17030
- function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) {
17031
- const dataAndSchema = passSchema ? (0, codegen_1$q._)`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
17032
- const valCxt = [
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]
17037
- ];
17038
- if (it.opts.dynamicRef)
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})`;
17042
- }
17043
- code.callValidateCode = callValidateCode;
17044
- const newRegExp = (0, codegen_1$q._)`new RegExp`;
17045
- function usePattern({ gen, it: { opts } }, pattern2) {
17046
- const u = opts.unicodeRegExp ? "u" : "";
17047
- const { regExp } = opts.code;
17048
- const rx = regExp(pattern2, u);
17049
- return gen.scopeValue("pattern", {
17050
- key: rx.toString(),
17051
- ref: rx,
17052
- code: (0, codegen_1$q._)`${regExp.code === "new RegExp" ? newRegExp : (0, util_2$1.useFunc)(gen, regExp)}(${pattern2}, ${u})`
17053
- });
17054
- }
17055
- code.usePattern = usePattern;
17056
- function validateArray(cxt) {
17057
- const { gen, data, keyword: keyword2, it } = cxt;
17058
- const valid = gen.name("valid");
17059
- if (it.allErrors) {
17060
- const validArr = gen.let("valid", true);
17061
- validateItems(() => gen.assign(validArr, false));
17062
- return validArr;
17063
- }
17064
- gen.var(valid, true);
17065
- validateItems(() => gen.break());
17066
- return valid;
17067
- function validateItems(notValid) {
17068
- const len = gen.const("len", (0, codegen_1$q._)`${data}.length`);
17069
- gen.forRange("i", 0, len, (i) => {
17070
- cxt.subschema({
17071
- keyword: keyword2,
17072
- dataProp: i,
17073
- dataPropType: util_1$p.Type.Num
17074
- }, valid);
17075
- gen.if((0, codegen_1$q.not)(valid), notValid);
16989
+ var hasRequiredCode;
16990
+ function requireCode() {
16991
+ if (hasRequiredCode) return code;
16992
+ hasRequiredCode = 1;
16993
+ Object.defineProperty(code, "__esModule", { value: true });
16994
+ 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;
16995
+ const codegen_12 = codegen;
16996
+ const util_12 = util;
16997
+ const names_12 = names$1;
16998
+ const util_22 = util;
16999
+ function checkReportMissingProp(cxt, prop) {
17000
+ const { gen, data, it } = cxt;
17001
+ gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
17002
+ cxt.setParams({ missingProperty: (0, codegen_12._)`${prop}` }, true);
17003
+ cxt.error();
17076
17004
  });
17077
17005
  }
17078
- }
17079
- code.validateArray = validateArray;
17080
- function validateUnion(cxt) {
17081
- const { gen, schema, keyword: keyword2, it } = cxt;
17082
- if (!Array.isArray(schema))
17083
- throw new Error("ajv implementation error");
17084
- const alwaysValid = schema.some((sch) => (0, util_1$p.alwaysValidSchema)(it, sch));
17085
- if (alwaysValid && !it.opts.unevaluated)
17086
- return;
17087
- const valid = gen.let("valid", false);
17088
- const schValid = gen.name("_valid");
17089
- gen.block(() => schema.forEach((_sch, i) => {
17090
- const schCxt = cxt.subschema({
17091
- keyword: keyword2,
17092
- schemaProp: i,
17093
- compositeRule: true
17094
- }, schValid);
17095
- gen.assign(valid, (0, codegen_1$q._)`${valid} || ${schValid}`);
17096
- const merged = cxt.mergeValidEvaluated(schCxt, schValid);
17097
- if (!merged)
17098
- gen.if((0, codegen_1$q.not)(valid));
17099
- }));
17100
- cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
17101
- }
17102
- code.validateUnion = validateUnion;
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));
17146
- }
17006
+ code.checkReportMissingProp = checkReportMissingProp;
17007
+ function checkMissingProp({ gen, data, it: { opts } }, properties2, missing) {
17008
+ return (0, codegen_12.or)(...properties2.map((prop) => (0, codegen_12.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_12._)`${missing} = ${prop}`)));
17147
17009
  }
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;
17010
+ code.checkMissingProp = checkMissingProp;
17011
+ function reportMissingProp(cxt, missing) {
17012
+ cxt.setParams({ missingProperty: missing }, true);
17013
+ cxt.error();
17152
17014
  }
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;
17015
+ code.reportMissingProp = reportMissingProp;
17016
+ function hasPropFunc(gen) {
17017
+ return gen.scopeValue("func", {
17018
+ // eslint-disable-next-line @typescript-eslint/unbound-method
17019
+ ref: Object.prototype.hasOwnProperty,
17020
+ code: (0, codegen_12._)`Object.prototype.hasOwnProperty`
17021
+ });
17158
17022
  }
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);
17023
+ code.hasPropFunc = hasPropFunc;
17024
+ function isOwnProperty(gen, data, property) {
17025
+ return (0, codegen_12._)`${hasPropFunc(gen)}.call(${data}, ${property})`;
17026
+ }
17027
+ code.isOwnProperty = isOwnProperty;
17028
+ function propertyInData(gen, data, property, ownProperties) {
17029
+ const cond = (0, codegen_12._)`${data}${(0, codegen_12.getProperty)(property)} !== undefined`;
17030
+ return ownProperties ? (0, codegen_12._)`${cond} && ${isOwnProperty(gen, data, property)}` : cond;
17031
+ }
17032
+ code.propertyInData = propertyInData;
17033
+ function noPropertyInData(gen, data, property, ownProperties) {
17034
+ const cond = (0, codegen_12._)`${data}${(0, codegen_12.getProperty)(property)} === undefined`;
17035
+ return ownProperties ? (0, codegen_12.or)(cond, (0, codegen_12.not)(isOwnProperty(gen, data, property))) : cond;
17036
+ }
17037
+ code.noPropertyInData = noPropertyInData;
17038
+ function allSchemaProperties(schemaMap) {
17039
+ return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : [];
17040
+ }
17041
+ code.allSchemaProperties = allSchemaProperties;
17042
+ function schemaProperties(it, schemaMap) {
17043
+ return allSchemaProperties(schemaMap).filter((p) => !(0, util_12.alwaysValidSchema)(it, schemaMap[p]));
17044
+ }
17045
+ code.schemaProperties = schemaProperties;
17046
+ function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) {
17047
+ const dataAndSchema = passSchema ? (0, codegen_12._)`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
17048
+ const valCxt = [
17049
+ [names_12.default.instancePath, (0, codegen_12.strConcat)(names_12.default.instancePath, errorPath)],
17050
+ [names_12.default.parentData, it.parentData],
17051
+ [names_12.default.parentDataProperty, it.parentDataProperty],
17052
+ [names_12.default.rootData, names_12.default.rootData]
17053
+ ];
17054
+ if (it.opts.dynamicRef)
17055
+ valCxt.push([names_12.default.dynamicAnchors, names_12.default.dynamicAnchors]);
17056
+ const args = (0, codegen_12._)`${dataAndSchema}, ${gen.object(...valCxt)}`;
17057
+ return context !== codegen_12.nil ? (0, codegen_12._)`${func}.call(${context}, ${args})` : (0, codegen_12._)`${func}(${args})`;
17058
+ }
17059
+ code.callValidateCode = callValidateCode;
17060
+ const newRegExp = (0, codegen_12._)`new RegExp`;
17061
+ function usePattern({ gen, it: { opts } }, pattern2) {
17062
+ const u = opts.unicodeRegExp ? "u" : "";
17063
+ const { regExp } = opts.code;
17064
+ const rx = regExp(pattern2, u);
17065
+ return gen.scopeValue("pattern", {
17066
+ key: rx.toString(),
17067
+ ref: rx,
17068
+ code: (0, codegen_12._)`${regExp.code === "new RegExp" ? newRegExp : (0, util_22.useFunc)(gen, regExp)}(${pattern2}, ${u})`
17069
+ });
17163
17070
  }
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);
17071
+ code.usePattern = usePattern;
17072
+ function validateArray(cxt) {
17073
+ const { gen, data, keyword: keyword2, it } = cxt;
17074
+ const valid = gen.name("valid");
17075
+ if (it.allErrors) {
17076
+ const validArr = gen.let("valid", true);
17077
+ validateItems(() => gen.assign(validArr, false));
17078
+ return validArr;
17079
+ }
17080
+ gen.var(valid, true);
17081
+ validateItems(() => gen.break());
17082
+ return valid;
17083
+ function validateItems(notValid) {
17084
+ const len = gen.const("len", (0, codegen_12._)`${data}.length`);
17085
+ gen.forRange("i", 0, len, (i) => {
17086
+ cxt.subschema({
17087
+ keyword: keyword2,
17088
+ dataProp: i,
17089
+ dataPropType: util_12.Type.Num
17090
+ }, valid);
17091
+ gen.if((0, codegen_12.not)(valid), notValid);
17092
+ });
17093
+ }
17167
17094
  }
17095
+ code.validateArray = validateArray;
17096
+ function validateUnion(cxt) {
17097
+ const { gen, schema, keyword: keyword2, it } = cxt;
17098
+ if (!Array.isArray(schema))
17099
+ throw new Error("ajv implementation error");
17100
+ const alwaysValid = schema.some((sch) => (0, util_12.alwaysValidSchema)(it, sch));
17101
+ if (alwaysValid && !it.opts.unevaluated)
17102
+ return;
17103
+ const valid = gen.let("valid", false);
17104
+ const schValid = gen.name("_valid");
17105
+ gen.block(() => schema.forEach((_sch, i) => {
17106
+ const schCxt = cxt.subschema({
17107
+ keyword: keyword2,
17108
+ schemaProp: i,
17109
+ compositeRule: true
17110
+ }, schValid);
17111
+ gen.assign(valid, (0, codegen_12._)`${valid} || ${schValid}`);
17112
+ const merged = cxt.mergeValidEvaluated(schCxt, schValid);
17113
+ if (!merged)
17114
+ gen.if((0, codegen_12.not)(valid));
17115
+ }));
17116
+ cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
17117
+ }
17118
+ code.validateUnion = validateUnion;
17119
+ return code;
17168
17120
  }
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);
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 = requireCode();
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);
17189
+ }
17190
+ }
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
+ }
17210
17233
  }
17211
17234
  }
17235
+ keyword.validateKeywordUsage = validateKeywordUsage;
17236
+ return keyword;
17212
17237
  }
17213
- keyword.validateKeywordUsage = validateKeywordUsage;
17214
17238
  var subschema = {};
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"');
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');
17238
17250
  }
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;
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
+ };
17273
+ }
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
+ }
17291
17321
  var resolve$2 = {};
17292
17322
  var fastDeepEqual = function equal(a, b) {
17293
17323
  if (a === b) return true;
@@ -17402,7 +17432,7 @@ function escapeJsonPtr(str) {
17402
17432
  var jsonSchemaTraverseExports = jsonSchemaTraverse.exports;
17403
17433
  Object.defineProperty(resolve$2, "__esModule", { value: true });
17404
17434
  resolve$2.getSchemaRefs = resolve$2.resolveUrl = resolve$2.normalizeId = resolve$2._getFullPath = resolve$2.getFullPath = resolve$2.inlineRef = void 0;
17405
- const util_1$n = util;
17435
+ const util_1$m = util;
17406
17436
  const equal$3 = fastDeepEqual;
17407
17437
  const traverse = jsonSchemaTraverseExports;
17408
17438
  const SIMPLE_INLINED = /* @__PURE__ */ new Set([
@@ -17461,7 +17491,7 @@ function countKeys(schema) {
17461
17491
  if (SIMPLE_INLINED.has(key))
17462
17492
  continue;
17463
17493
  if (typeof schema[key] == "object") {
17464
- (0, util_1$n.eachItem)(schema[key], (sch) => count += countKeys(sch));
17494
+ (0, util_1$m.eachItem)(schema[key], (sch) => count += countKeys(sch));
17465
17495
  }
17466
17496
  if (count === Infinity)
17467
17497
  return Infinity;
@@ -17549,516 +17579,528 @@ function getSchemaRefs(schema, baseId) {
17549
17579
  }
17550
17580
  }
17551
17581
  resolve$2.getSchemaRefs = getSchemaRefs;
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;
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 = applicability;
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
+ }
17572
17607
  }
17608
+ validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
17573
17609
  }
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);
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._)`{}`);
17583
17640
  });
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, () => {
17641
+ }
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);
17654
+ });
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;
17611
17690
  if (opts.$comment && schema.$comment)
17612
17691
  commentKeyword(it);
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);
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));
17638
17762
  return;
17639
17763
  }
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
+ }
17640
17788
  }
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;
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
+ });
17729
17800
  }
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))
17801
+ function checkStrictTypes(it, types2) {
17802
+ if (it.schemaEnv.meta || !it.opts.strictTypes)
17739
17803
  return;
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);
17804
+ checkContextTypes(it, types2);
17805
+ if (!it.opts.allowUnionTypes)
17806
+ checkMultipleTypes(it, types2);
17807
+ checkKeywordTypes(it, it.dataTypes);
17808
+ }
17809
+ function checkContextTypes(it, types2) {
17810
+ if (!types2.length)
17811
+ return;
17812
+ if (!it.dataTypes.length) {
17813
+ it.dataTypes = types2;
17814
+ return;
17815
+ }
17816
+ types2.forEach((t) => {
17817
+ if (!includesType(it.dataTypes, t)) {
17818
+ strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
17746
17819
  }
17747
- gen.endIf();
17748
- } else {
17749
- iterateKeywords(it, group);
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");
17750
17826
  }
17751
- if (!allErrors)
17752
- gen.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${errsCount || 0}`);
17753
17827
  }
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);
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
+ }
17763
17837
  }
17764
17838
  }
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;
17781
17839
  }
17782
- types2.forEach((t) => {
17783
- if (!includesType(it.dataTypes, t)) {
17784
- strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
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
+ }
17785
17887
  }
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)}`);
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();
17848
17907
  }
17849
17908
  }
17850
- if ("code" in def2 ? def2.trackErrors : def2.errors !== false) {
17851
- this.errsCount = it.gen.const("_errs", names_1$3.default.errors);
17909
+ pass(condition, failAction) {
17910
+ this.failResult((0, codegen_12.not)(condition), void 0, failAction);
17852
17911
  }
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
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);
17862
17920
  this.error();
17863
- if (successAction) {
17864
- this.gen.else();
17865
- successAction();
17866
- if (this.allErrors)
17867
- this.gen.endIf();
17868
- } else {
17869
17921
  if (this.allErrors)
17870
17922
  this.gen.endIf();
17871
17923
  else
17872
17924
  this.gen.else();
17873
17925
  }
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();
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) {
17881
17953
  if (!this.allErrors)
17882
- this.gen.if(false);
17883
- return;
17954
+ this.gen.if(cond);
17884
17955
  }
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;
17956
+ setParams(obj, assign) {
17957
+ if (assign)
17958
+ Object.assign(this.params, obj);
17959
+ else
17960
+ this.params = obj;
17904
17961
  }
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);
17962
+ block$data(valid, codeBlock, $dataValid = codegen_12.nil) {
17963
+ this.gen.block(() => {
17964
+ this.check$data(valid, $dataValid);
17965
+ codeBlock();
17966
+ });
17946
17967
  }
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)}`;
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);
17958
17980
  }
17959
- return codegen_1$n.nil;
17981
+ gen.else();
17960
17982
  }
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})`;
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;
17994
+ }
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;
17965
18001
  }
17966
- return codegen_1$n.nil;
17967
18002
  }
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);
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;
17983
18010
  }
17984
- if (it.items !== true && schemaCxt.items !== void 0) {
17985
- it.items = util_1$m.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName);
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
+ }
17986
18021
  }
17987
- }
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;
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
+ }
17993
18028
  }
17994
18029
  }
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}`;
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
+ }
18079
+ }
18080
+ return expr;
18081
+ function errorMsg(pointerType, up) {
18082
+ return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
18044
18083
  }
18045
18084
  }
18046
- return expr;
18047
- function errorMsg(pointerType, up) {
18048
- return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
18049
- }
18085
+ validate.getData = getData;
18086
+ return validate;
18050
18087
  }
18051
- validate.getData = getData;
18052
18088
  var validation_error = {};
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;
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
+ }
18059
18100
  }
18101
+ validation_error.default = ValidationError;
18102
+ return validation_error;
18060
18103
  }
18061
- validation_error.default = ValidationError;
18062
18104
  var ref_error = {};
18063
18105
  Object.defineProperty(ref_error, "__esModule", { value: true });
18064
18106
  const resolve_1$1 = resolve$2;
@@ -18074,11 +18116,11 @@ var compile = {};
18074
18116
  Object.defineProperty(compile, "__esModule", { value: true });
18075
18117
  compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compile.compileSchema = compile.SchemaEnv = void 0;
18076
18118
  const codegen_1$m = codegen;
18077
- const validation_error_1 = validation_error;
18119
+ const validation_error_1 = requireValidation_error();
18078
18120
  const names_1$2 = names$1;
18079
18121
  const resolve_1 = resolve$2;
18080
18122
  const util_1$l = util;
18081
- const validate_1$1 = validate;
18123
+ const validate_1$1 = requireValidate();
18082
18124
  class SchemaEnv {
18083
18125
  constructor(env) {
18084
18126
  var _a;
@@ -19007,7 +19049,7 @@ uri$1.default = uri;
19007
19049
  (function(exports) {
19008
19050
  Object.defineProperty(exports, "__esModule", { value: true });
19009
19051
  exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
19010
- var validate_12 = validate;
19052
+ var validate_12 = requireValidate();
19011
19053
  Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
19012
19054
  return validate_12.KeywordCxt;
19013
19055
  } });
@@ -19030,7 +19072,7 @@ uri$1.default = uri;
19030
19072
  Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() {
19031
19073
  return codegen_12.CodeGen;
19032
19074
  } });
19033
- const validation_error_12 = validation_error;
19075
+ const validation_error_12 = requireValidation_error();
19034
19076
  const ref_error_12 = ref_error;
19035
19077
  const rules_12 = rules;
19036
19078
  const compile_12 = compile;
@@ -19625,7 +19667,7 @@ var ref = {};
19625
19667
  Object.defineProperty(ref, "__esModule", { value: true });
19626
19668
  ref.callRef = ref.getValidate = void 0;
19627
19669
  const ref_error_1$1 = ref_error;
19628
- const code_1$8 = code;
19670
+ const code_1$8 = requireCode();
19629
19671
  const codegen_1$l = codegen;
19630
19672
  const names_1$1 = names$1;
19631
19673
  const compile_1$1 = compile;
@@ -19848,7 +19890,7 @@ const def$o = {
19848
19890
  limitLength.default = def$o;
19849
19891
  var pattern = {};
19850
19892
  Object.defineProperty(pattern, "__esModule", { value: true });
19851
- const code_1$7 = code;
19893
+ const code_1$7 = requireCode();
19852
19894
  const util_1$i = util;
19853
19895
  const codegen_1$h = codegen;
19854
19896
  const error$f = {
@@ -19902,7 +19944,7 @@ const def$m = {
19902
19944
  limitProperties.default = def$m;
19903
19945
  var required = {};
19904
19946
  Object.defineProperty(required, "__esModule", { value: true });
19905
- const code_1$6 = code;
19947
+ const code_1$6 = requireCode();
19906
19948
  const codegen_1$f = codegen;
19907
19949
  const util_1$h = util;
19908
19950
  const error$d = {
@@ -20216,7 +20258,7 @@ Object.defineProperty(items, "__esModule", { value: true });
20216
20258
  items.validateTuple = void 0;
20217
20259
  const codegen_1$9 = codegen;
20218
20260
  const util_1$c = util;
20219
- const code_1$5 = code;
20261
+ const code_1$5 = requireCode();
20220
20262
  const def$f = {
20221
20263
  keyword: "items",
20222
20264
  type: "array",
@@ -20276,7 +20318,7 @@ var items2020 = {};
20276
20318
  Object.defineProperty(items2020, "__esModule", { value: true });
20277
20319
  const codegen_1$8 = codegen;
20278
20320
  const util_1$b = util;
20279
- const code_1$4 = code;
20321
+ const code_1$4 = requireCode();
20280
20322
  const additionalItems_1$1 = additionalItems;
20281
20323
  const error$7 = {
20282
20324
  message: ({ params: { len } }) => (0, codegen_1$8.str)`must NOT have more than ${len} items`,
@@ -20395,7 +20437,7 @@ var dependencies = {};
20395
20437
  exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0;
20396
20438
  const codegen_12 = codegen;
20397
20439
  const util_12 = util;
20398
- const code_12 = code;
20440
+ const code_12 = requireCode();
20399
20441
  exports.error = {
20400
20442
  message: ({ params: { property, depsCount, deps } }) => {
20401
20443
  const property_ies = depsCount === 1 ? "property" : "properties";
@@ -20518,7 +20560,7 @@ const def$b = {
20518
20560
  propertyNames.default = def$b;
20519
20561
  var additionalProperties = {};
20520
20562
  Object.defineProperty(additionalProperties, "__esModule", { value: true });
20521
- const code_1$3 = code;
20563
+ const code_1$3 = requireCode();
20522
20564
  const codegen_1$5 = codegen;
20523
20565
  const names_1 = names$1;
20524
20566
  const util_1$8 = util;
@@ -20618,8 +20660,8 @@ const def$a = {
20618
20660
  additionalProperties.default = def$a;
20619
20661
  var properties$1 = {};
20620
20662
  Object.defineProperty(properties$1, "__esModule", { value: true });
20621
- const validate_1 = validate;
20622
- const code_1$2 = code;
20663
+ const validate_1 = requireValidate();
20664
+ const code_1$2 = requireCode();
20623
20665
  const util_1$7 = util;
20624
20666
  const additionalProperties_1$1 = additionalProperties;
20625
20667
  const def$9 = {
@@ -20670,7 +20712,7 @@ const def$9 = {
20670
20712
  properties$1.default = def$9;
20671
20713
  var patternProperties = {};
20672
20714
  Object.defineProperty(patternProperties, "__esModule", { value: true });
20673
- const code_1$1 = code;
20715
+ const code_1$1 = requireCode();
20674
20716
  const codegen_1$4 = codegen;
20675
20717
  const util_1$6 = util;
20676
20718
  const util_2 = util;
@@ -20763,7 +20805,7 @@ const def$7 = {
20763
20805
  not.default = def$7;
20764
20806
  var anyOf = {};
20765
20807
  Object.defineProperty(anyOf, "__esModule", { value: true });
20766
- const code_1 = code;
20808
+ const code_1 = requireCode();
20767
20809
  const def$6 = {
20768
20810
  keyword: "anyOf",
20769
20811
  schemaType: "array",
@@ -21469,7 +21511,7 @@ const require$$3 = {
21469
21511
  module.exports.Ajv = Ajv2;
21470
21512
  Object.defineProperty(exports, "__esModule", { value: true });
21471
21513
  exports.default = Ajv2;
21472
- var validate_12 = validate;
21514
+ var validate_12 = requireValidate();
21473
21515
  Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
21474
21516
  return validate_12.KeywordCxt;
21475
21517
  } });
@@ -21492,7 +21534,7 @@ const require$$3 = {
21492
21534
  Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() {
21493
21535
  return codegen_12.CodeGen;
21494
21536
  } });
21495
- var validation_error_12 = validation_error;
21537
+ var validation_error_12 = requireValidation_error();
21496
21538
  Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function() {
21497
21539
  return validation_error_12.default;
21498
21540
  } });