@forgeax/engine-profiler 0.1.20 → 0.1.23

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.
package/dist/index.mjs CHANGED
@@ -4498,1121 +4498,811 @@ var require_core = __commonJS({
4498
4498
  }
4499
4499
  });
4500
4500
 
4501
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js
4502
- var require_id = __commonJS({
4503
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js"(exports) {
4504
- Object.defineProperty(exports, "__esModule", { value: true });
4505
- var def = {
4506
- keyword: "id",
4507
- code() {
4508
- throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID');
4509
- }
4510
- };
4511
- exports.default = def;
4512
- }
4513
- });
4514
-
4515
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js
4516
- var require_ref = __commonJS({
4517
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js"(exports) {
4518
- Object.defineProperty(exports, "__esModule", { value: true });
4519
- exports.callRef = exports.getValidate = void 0;
4520
- var ref_error_1 = require_ref_error();
4521
- var code_1 = require_code2();
4522
- var codegen_1 = require_codegen();
4523
- var names_1 = require_names();
4524
- var compile_1 = require_compile();
4525
- var util_1 = require_util();
4526
- var def = {
4527
- keyword: "$ref",
4528
- schemaType: "string",
4529
- code(cxt) {
4530
- const { gen, schema: $ref, it } = cxt;
4531
- const { baseId, schemaEnv: env, validateName, opts, self } = it;
4532
- const { root } = env;
4533
- if (($ref === "#" || $ref === "#/") && baseId === root.baseId)
4534
- return callRootRef();
4535
- const schOrEnv = compile_1.resolveRef.call(self, root, baseId, $ref);
4536
- if (schOrEnv === void 0)
4537
- throw new ref_error_1.default(it.opts.uriResolver, baseId, $ref);
4538
- if (schOrEnv instanceof compile_1.SchemaEnv)
4539
- return callValidate(schOrEnv);
4540
- return inlineRefSchema(schOrEnv);
4541
- function callRootRef() {
4542
- if (env === root)
4543
- return callRef(cxt, validateName, env, env.$async);
4544
- const rootName = gen.scopeValue("root", { ref: root });
4545
- return callRef(cxt, (0, codegen_1._)`${rootName}.validate`, root, root.$async);
4546
- }
4547
- function callValidate(sch) {
4548
- const v = getValidate(cxt, sch);
4549
- callRef(cxt, v, sch, sch.$async);
4550
- }
4551
- function inlineRefSchema(sch) {
4552
- const schName = gen.scopeValue("schema", opts.code.source === true ? { ref: sch, code: (0, codegen_1.stringify)(sch) } : { ref: sch });
4553
- const valid = gen.name("valid");
4554
- const schCxt = cxt.subschema({
4555
- schema: sch,
4556
- dataTypes: [],
4557
- schemaPath: codegen_1.nil,
4558
- topSchemaRef: schName,
4559
- errSchemaPath: $ref
4560
- }, valid);
4561
- cxt.mergeEvaluated(schCxt);
4562
- cxt.ok(valid);
4563
- }
4564
- }
4565
- };
4566
- function getValidate(cxt, sch) {
4567
- const { gen } = cxt;
4568
- return sch.validate ? gen.scopeValue("validate", { ref: sch.validate }) : (0, codegen_1._)`${gen.scopeValue("wrapper", { ref: sch })}.validate`;
4569
- }
4570
- exports.getValidate = getValidate;
4571
- function callRef(cxt, v, sch, $async) {
4572
- const { gen, it } = cxt;
4573
- const { allErrors, schemaEnv: env, opts } = it;
4574
- const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil;
4575
- if ($async)
4576
- callAsyncRef();
4577
- else
4578
- callSyncRef();
4579
- function callAsyncRef() {
4580
- if (!env.$async)
4581
- throw new Error("async schema referenced by sync schema");
4582
- const valid = gen.let("valid");
4583
- gen.try(() => {
4584
- gen.code((0, codegen_1._)`await ${(0, code_1.callValidateCode)(cxt, v, passCxt)}`);
4585
- addEvaluatedFrom(v);
4586
- if (!allErrors)
4587
- gen.assign(valid, true);
4588
- }, (e) => {
4589
- gen.if((0, codegen_1._)`!(${e} instanceof ${it.ValidationError})`, () => gen.throw(e));
4590
- addErrorsFrom(e);
4591
- if (!allErrors)
4592
- gen.assign(valid, false);
4593
- });
4594
- cxt.ok(valid);
4595
- }
4596
- function callSyncRef() {
4597
- cxt.result((0, code_1.callValidateCode)(cxt, v, passCxt), () => addEvaluatedFrom(v), () => addErrorsFrom(v));
4598
- }
4599
- function addErrorsFrom(source) {
4600
- const errs = (0, codegen_1._)`${source}.errors`;
4601
- gen.assign(names_1.default.vErrors, (0, codegen_1._)`${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`);
4602
- gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
4603
- }
4604
- function addEvaluatedFrom(source) {
4605
- var _a;
4606
- if (!it.opts.unevaluated)
4607
- return;
4608
- const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated;
4609
- if (it.props !== true) {
4610
- if (schEvaluated && !schEvaluated.dynamicProps) {
4611
- if (schEvaluated.props !== void 0) {
4612
- it.props = util_1.mergeEvaluated.props(gen, schEvaluated.props, it.props);
4613
- }
4614
- } else {
4615
- const props = gen.var("props", (0, codegen_1._)`${source}.evaluated.props`);
4616
- it.props = util_1.mergeEvaluated.props(gen, props, it.props, codegen_1.Name);
4617
- }
4618
- }
4619
- if (it.items !== true) {
4620
- if (schEvaluated && !schEvaluated.dynamicItems) {
4621
- if (schEvaluated.items !== void 0) {
4622
- it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items);
4623
- }
4624
- } else {
4625
- const items = gen.var("items", (0, codegen_1._)`${source}.evaluated.items`);
4626
- it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name);
4627
- }
4501
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json
4502
+ var require_schema = __commonJS({
4503
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json"(exports, module) {
4504
+ module.exports = {
4505
+ $schema: "https://json-schema.org/draft/2020-12/schema",
4506
+ $id: "https://json-schema.org/draft/2020-12/schema",
4507
+ $vocabulary: {
4508
+ "https://json-schema.org/draft/2020-12/vocab/core": true,
4509
+ "https://json-schema.org/draft/2020-12/vocab/applicator": true,
4510
+ "https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
4511
+ "https://json-schema.org/draft/2020-12/vocab/validation": true,
4512
+ "https://json-schema.org/draft/2020-12/vocab/meta-data": true,
4513
+ "https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
4514
+ "https://json-schema.org/draft/2020-12/vocab/content": true
4515
+ },
4516
+ $dynamicAnchor: "meta",
4517
+ title: "Core and Validation specifications meta-schema",
4518
+ allOf: [
4519
+ { $ref: "meta/core" },
4520
+ { $ref: "meta/applicator" },
4521
+ { $ref: "meta/unevaluated" },
4522
+ { $ref: "meta/validation" },
4523
+ { $ref: "meta/meta-data" },
4524
+ { $ref: "meta/format-annotation" },
4525
+ { $ref: "meta/content" }
4526
+ ],
4527
+ type: ["object", "boolean"],
4528
+ $comment: "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",
4529
+ properties: {
4530
+ definitions: {
4531
+ $comment: '"definitions" has been replaced by "$defs".',
4532
+ type: "object",
4533
+ additionalProperties: { $dynamicRef: "#meta" },
4534
+ deprecated: true,
4535
+ default: {}
4536
+ },
4537
+ dependencies: {
4538
+ $comment: '"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',
4539
+ type: "object",
4540
+ additionalProperties: {
4541
+ anyOf: [{ $dynamicRef: "#meta" }, { $ref: "meta/validation#/$defs/stringArray" }]
4542
+ },
4543
+ deprecated: true,
4544
+ default: {}
4545
+ },
4546
+ $recursiveAnchor: {
4547
+ $comment: '"$recursiveAnchor" has been replaced by "$dynamicAnchor".',
4548
+ $ref: "meta/core#/$defs/anchorString",
4549
+ deprecated: true
4550
+ },
4551
+ $recursiveRef: {
4552
+ $comment: '"$recursiveRef" has been replaced by "$dynamicRef".',
4553
+ $ref: "meta/core#/$defs/uriReferenceString",
4554
+ deprecated: true
4628
4555
  }
4629
4556
  }
4630
- }
4631
- exports.callRef = callRef;
4632
- exports.default = def;
4633
- }
4634
- });
4635
-
4636
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js
4637
- var require_core2 = __commonJS({
4638
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js"(exports) {
4639
- Object.defineProperty(exports, "__esModule", { value: true });
4640
- var id_1 = require_id();
4641
- var ref_1 = require_ref();
4642
- var core = [
4643
- "$schema",
4644
- "$id",
4645
- "$defs",
4646
- "$vocabulary",
4647
- { keyword: "$comment" },
4648
- "definitions",
4649
- id_1.default,
4650
- ref_1.default
4651
- ];
4652
- exports.default = core;
4653
- }
4654
- });
4655
-
4656
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js
4657
- var require_limitNumber = __commonJS({
4658
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js"(exports) {
4659
- Object.defineProperty(exports, "__esModule", { value: true });
4660
- var codegen_1 = require_codegen();
4661
- var ops = codegen_1.operators;
4662
- var KWDs = {
4663
- maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
4664
- minimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT },
4665
- exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
4666
- exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }
4667
- };
4668
- var error2 = {
4669
- message: ({ keyword, schemaCode }) => (0, codegen_1.str)`must be ${KWDs[keyword].okStr} ${schemaCode}`,
4670
- params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
4671
- };
4672
- var def = {
4673
- keyword: Object.keys(KWDs),
4674
- type: "number",
4675
- schemaType: "number",
4676
- $data: true,
4677
- error: error2,
4678
- code(cxt) {
4679
- const { keyword, data, schemaCode } = cxt;
4680
- cxt.fail$data((0, codegen_1._)`${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`);
4681
- }
4682
- };
4683
- exports.default = def;
4684
- }
4685
- });
4686
-
4687
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js
4688
- var require_multipleOf = __commonJS({
4689
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js"(exports) {
4690
- Object.defineProperty(exports, "__esModule", { value: true });
4691
- var codegen_1 = require_codegen();
4692
- var error2 = {
4693
- message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`,
4694
- params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}`
4695
- };
4696
- var def = {
4697
- keyword: "multipleOf",
4698
- type: "number",
4699
- schemaType: "number",
4700
- $data: true,
4701
- error: error2,
4702
- code(cxt) {
4703
- const { gen, data, schemaCode, it } = cxt;
4704
- const prec = it.opts.multipleOfPrecision;
4705
- const res = gen.let("res");
4706
- const invalid = prec ? (0, codegen_1._)`Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` : (0, codegen_1._)`${res} !== parseInt(${res})`;
4707
- cxt.fail$data((0, codegen_1._)`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`);
4708
- }
4709
4557
  };
4710
- exports.default = def;
4711
4558
  }
4712
4559
  });
4713
4560
 
4714
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js
4715
- var require_ucs2length = __commonJS({
4716
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js"(exports) {
4717
- Object.defineProperty(exports, "__esModule", { value: true });
4718
- function ucs2length(str) {
4719
- const len = str.length;
4720
- let length = 0;
4721
- let pos = 0;
4722
- let value;
4723
- while (pos < len) {
4724
- length++;
4725
- value = str.charCodeAt(pos++);
4726
- if (value >= 55296 && value <= 56319 && pos < len) {
4727
- value = str.charCodeAt(pos);
4728
- if ((value & 64512) === 56320)
4729
- pos++;
4730
- }
4731
- }
4732
- return length;
4733
- }
4734
- exports.default = ucs2length;
4735
- ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default';
4736
- }
4737
- });
4738
-
4739
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js
4740
- var require_limitLength = __commonJS({
4741
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js"(exports) {
4742
- Object.defineProperty(exports, "__esModule", { value: true });
4743
- var codegen_1 = require_codegen();
4744
- var util_1 = require_util();
4745
- var ucs2length_1 = require_ucs2length();
4746
- var error2 = {
4747
- message({ keyword, schemaCode }) {
4748
- const comp = keyword === "maxLength" ? "more" : "fewer";
4749
- return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} characters`;
4561
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json
4562
+ var require_applicator = __commonJS({
4563
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json"(exports, module) {
4564
+ module.exports = {
4565
+ $schema: "https://json-schema.org/draft/2020-12/schema",
4566
+ $id: "https://json-schema.org/draft/2020-12/meta/applicator",
4567
+ $vocabulary: {
4568
+ "https://json-schema.org/draft/2020-12/vocab/applicator": true
4750
4569
  },
4751
- params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}`
4752
- };
4753
- var def = {
4754
- keyword: ["maxLength", "minLength"],
4755
- type: "string",
4756
- schemaType: "number",
4757
- $data: true,
4758
- error: error2,
4759
- code(cxt) {
4760
- const { keyword, data, schemaCode, it } = cxt;
4761
- const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT;
4762
- const len = it.opts.unicode === false ? (0, codegen_1._)`${data}.length` : (0, codegen_1._)`${(0, util_1.useFunc)(cxt.gen, ucs2length_1.default)}(${data})`;
4763
- cxt.fail$data((0, codegen_1._)`${len} ${op} ${schemaCode}`);
4764
- }
4765
- };
4766
- exports.default = def;
4767
- }
4768
- });
4769
-
4770
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js
4771
- var require_pattern = __commonJS({
4772
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js"(exports) {
4773
- Object.defineProperty(exports, "__esModule", { value: true });
4774
- var code_1 = require_code2();
4775
- var util_1 = require_util();
4776
- var codegen_1 = require_codegen();
4777
- var error2 = {
4778
- message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
4779
- params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}`
4780
- };
4781
- var def = {
4782
- keyword: "pattern",
4783
- type: "string",
4784
- schemaType: "string",
4785
- $data: true,
4786
- error: error2,
4787
- code(cxt) {
4788
- const { gen, data, $data, schema, schemaCode, it } = cxt;
4789
- const u = it.opts.unicodeRegExp ? "u" : "";
4790
- if ($data) {
4791
- const { regExp } = it.opts.code;
4792
- const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
4793
- const valid = gen.let("valid");
4794
- gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
4795
- cxt.fail$data((0, codegen_1._)`!${valid}`);
4796
- } else {
4797
- const regExp = (0, code_1.usePattern)(cxt, schema);
4798
- cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
4570
+ $dynamicAnchor: "meta",
4571
+ title: "Applicator vocabulary meta-schema",
4572
+ type: ["object", "boolean"],
4573
+ properties: {
4574
+ prefixItems: { $ref: "#/$defs/schemaArray" },
4575
+ items: { $dynamicRef: "#meta" },
4576
+ contains: { $dynamicRef: "#meta" },
4577
+ additionalProperties: { $dynamicRef: "#meta" },
4578
+ properties: {
4579
+ type: "object",
4580
+ additionalProperties: { $dynamicRef: "#meta" },
4581
+ default: {}
4582
+ },
4583
+ patternProperties: {
4584
+ type: "object",
4585
+ additionalProperties: { $dynamicRef: "#meta" },
4586
+ propertyNames: { format: "regex" },
4587
+ default: {}
4588
+ },
4589
+ dependentSchemas: {
4590
+ type: "object",
4591
+ additionalProperties: { $dynamicRef: "#meta" },
4592
+ default: {}
4593
+ },
4594
+ propertyNames: { $dynamicRef: "#meta" },
4595
+ if: { $dynamicRef: "#meta" },
4596
+ then: { $dynamicRef: "#meta" },
4597
+ else: { $dynamicRef: "#meta" },
4598
+ allOf: { $ref: "#/$defs/schemaArray" },
4599
+ anyOf: { $ref: "#/$defs/schemaArray" },
4600
+ oneOf: { $ref: "#/$defs/schemaArray" },
4601
+ not: { $dynamicRef: "#meta" }
4602
+ },
4603
+ $defs: {
4604
+ schemaArray: {
4605
+ type: "array",
4606
+ minItems: 1,
4607
+ items: { $dynamicRef: "#meta" }
4799
4608
  }
4800
4609
  }
4801
4610
  };
4802
- exports.default = def;
4803
4611
  }
4804
4612
  });
4805
4613
 
4806
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js
4807
- var require_limitProperties = __commonJS({
4808
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js"(exports) {
4809
- Object.defineProperty(exports, "__esModule", { value: true });
4810
- var codegen_1 = require_codegen();
4811
- var error2 = {
4812
- message({ keyword, schemaCode }) {
4813
- const comp = keyword === "maxProperties" ? "more" : "fewer";
4814
- return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} properties`;
4614
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json
4615
+ var require_unevaluated = __commonJS({
4616
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json"(exports, module) {
4617
+ module.exports = {
4618
+ $schema: "https://json-schema.org/draft/2020-12/schema",
4619
+ $id: "https://json-schema.org/draft/2020-12/meta/unevaluated",
4620
+ $vocabulary: {
4621
+ "https://json-schema.org/draft/2020-12/vocab/unevaluated": true
4815
4622
  },
4816
- params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}`
4817
- };
4818
- var def = {
4819
- keyword: ["maxProperties", "minProperties"],
4820
- type: "object",
4821
- schemaType: "number",
4822
- $data: true,
4823
- error: error2,
4824
- code(cxt) {
4825
- const { keyword, data, schemaCode } = cxt;
4826
- const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT;
4827
- cxt.fail$data((0, codegen_1._)`Object.keys(${data}).length ${op} ${schemaCode}`);
4828
- }
4829
- };
4830
- exports.default = def;
4831
- }
4832
- });
4833
-
4834
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js
4835
- var require_required = __commonJS({
4836
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js"(exports) {
4837
- Object.defineProperty(exports, "__esModule", { value: true });
4838
- var code_1 = require_code2();
4839
- var codegen_1 = require_codegen();
4840
- var util_1 = require_util();
4841
- var error2 = {
4842
- message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
4843
- params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
4844
- };
4845
- var def = {
4846
- keyword: "required",
4847
- type: "object",
4848
- schemaType: "array",
4849
- $data: true,
4850
- error: error2,
4851
- code(cxt) {
4852
- const { gen, schema, schemaCode, data, $data, it } = cxt;
4853
- const { opts } = it;
4854
- if (!$data && schema.length === 0)
4855
- return;
4856
- const useLoop = schema.length >= opts.loopRequired;
4857
- if (it.allErrors)
4858
- allErrorsMode();
4859
- else
4860
- exitOnErrorMode();
4861
- if (opts.strictRequired) {
4862
- const props = cxt.parentSchema.properties;
4863
- const { definedProperties } = cxt.it;
4864
- for (const requiredKey of schema) {
4865
- if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === void 0 && !definedProperties.has(requiredKey)) {
4866
- const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
4867
- const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)`;
4868
- (0, util_1.checkStrictMode)(it, msg, it.opts.strictRequired);
4869
- }
4870
- }
4871
- }
4872
- function allErrorsMode() {
4873
- if (useLoop || $data) {
4874
- cxt.block$data(codegen_1.nil, loopAllRequired);
4875
- } else {
4876
- for (const prop of schema) {
4877
- (0, code_1.checkReportMissingProp)(cxt, prop);
4878
- }
4879
- }
4880
- }
4881
- function exitOnErrorMode() {
4882
- const missing = gen.let("missing");
4883
- if (useLoop || $data) {
4884
- const valid = gen.let("valid", true);
4885
- cxt.block$data(valid, () => loopUntilMissing(missing, valid));
4886
- cxt.ok(valid);
4887
- } else {
4888
- gen.if((0, code_1.checkMissingProp)(cxt, schema, missing));
4889
- (0, code_1.reportMissingProp)(cxt, missing);
4890
- gen.else();
4891
- }
4892
- }
4893
- function loopAllRequired() {
4894
- gen.forOf("prop", schemaCode, (prop) => {
4895
- cxt.setParams({ missingProperty: prop });
4896
- gen.if((0, code_1.noPropertyInData)(gen, data, prop, opts.ownProperties), () => cxt.error());
4897
- });
4898
- }
4899
- function loopUntilMissing(missing, valid) {
4900
- cxt.setParams({ missingProperty: missing });
4901
- gen.forOf(missing, schemaCode, () => {
4902
- gen.assign(valid, (0, code_1.propertyInData)(gen, data, missing, opts.ownProperties));
4903
- gen.if((0, codegen_1.not)(valid), () => {
4904
- cxt.error();
4905
- gen.break();
4906
- });
4907
- }, codegen_1.nil);
4908
- }
4623
+ $dynamicAnchor: "meta",
4624
+ title: "Unevaluated applicator vocabulary meta-schema",
4625
+ type: ["object", "boolean"],
4626
+ properties: {
4627
+ unevaluatedItems: { $dynamicRef: "#meta" },
4628
+ unevaluatedProperties: { $dynamicRef: "#meta" }
4909
4629
  }
4910
4630
  };
4911
- exports.default = def;
4912
4631
  }
4913
4632
  });
4914
4633
 
4915
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js
4916
- var require_limitItems = __commonJS({
4917
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js"(exports) {
4918
- Object.defineProperty(exports, "__esModule", { value: true });
4919
- var codegen_1 = require_codegen();
4920
- var error2 = {
4921
- message({ keyword, schemaCode }) {
4922
- const comp = keyword === "maxItems" ? "more" : "fewer";
4923
- return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} items`;
4634
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json
4635
+ var require_content = __commonJS({
4636
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json"(exports, module) {
4637
+ module.exports = {
4638
+ $schema: "https://json-schema.org/draft/2020-12/schema",
4639
+ $id: "https://json-schema.org/draft/2020-12/meta/content",
4640
+ $vocabulary: {
4641
+ "https://json-schema.org/draft/2020-12/vocab/content": true
4924
4642
  },
4925
- params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}`
4926
- };
4927
- var def = {
4928
- keyword: ["maxItems", "minItems"],
4929
- type: "array",
4930
- schemaType: "number",
4931
- $data: true,
4932
- error: error2,
4933
- code(cxt) {
4934
- const { keyword, data, schemaCode } = cxt;
4935
- const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT;
4936
- cxt.fail$data((0, codegen_1._)`${data}.length ${op} ${schemaCode}`);
4643
+ $dynamicAnchor: "meta",
4644
+ title: "Content vocabulary meta-schema",
4645
+ type: ["object", "boolean"],
4646
+ properties: {
4647
+ contentEncoding: { type: "string" },
4648
+ contentMediaType: { type: "string" },
4649
+ contentSchema: { $dynamicRef: "#meta" }
4937
4650
  }
4938
4651
  };
4939
- exports.default = def;
4940
- }
4941
- });
4942
-
4943
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js
4944
- var require_equal = __commonJS({
4945
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js"(exports) {
4946
- Object.defineProperty(exports, "__esModule", { value: true });
4947
- var equal = require_fast_deep_equal();
4948
- equal.code = 'require("ajv/dist/runtime/equal").default';
4949
- exports.default = equal;
4950
4652
  }
4951
4653
  });
4952
4654
 
4953
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js
4954
- var require_uniqueItems = __commonJS({
4955
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js"(exports) {
4956
- Object.defineProperty(exports, "__esModule", { value: true });
4957
- var dataType_1 = require_dataType();
4958
- var codegen_1 = require_codegen();
4959
- var util_1 = require_util();
4960
- var equal_1 = require_equal();
4961
- var error2 = {
4962
- message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,
4963
- params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}`
4964
- };
4965
- var def = {
4966
- keyword: "uniqueItems",
4967
- type: "array",
4968
- schemaType: "boolean",
4969
- $data: true,
4970
- error: error2,
4971
- code(cxt) {
4972
- const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt;
4973
- if (!$data && !schema)
4974
- return;
4975
- const valid = gen.let("valid");
4976
- const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : [];
4977
- cxt.block$data(valid, validateUniqueItems, (0, codegen_1._)`${schemaCode} === false`);
4978
- cxt.ok(valid);
4979
- function validateUniqueItems() {
4980
- const i = gen.let("i", (0, codegen_1._)`${data}.length`);
4981
- const j = gen.let("j");
4982
- cxt.setParams({ i, j });
4983
- gen.assign(valid, true);
4984
- gen.if((0, codegen_1._)`${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j));
4985
- }
4986
- function canOptimize() {
4987
- return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array");
4988
- }
4989
- function loopN(i, j) {
4990
- const item = gen.name("item");
4991
- const wrongType = (0, dataType_1.checkDataTypes)(itemTypes, item, it.opts.strictNumbers, dataType_1.DataType.Wrong);
4992
- const indices = gen.const("indices", (0, codegen_1._)`{}`);
4993
- gen.for((0, codegen_1._)`;${i}--;`, () => {
4994
- gen.let(item, (0, codegen_1._)`${data}[${i}]`);
4995
- gen.if(wrongType, (0, codegen_1._)`continue`);
4996
- if (itemTypes.length > 1)
4997
- gen.if((0, codegen_1._)`typeof ${item} == "string"`, (0, codegen_1._)`${item} += "_"`);
4998
- gen.if((0, codegen_1._)`typeof ${indices}[${item}] == "number"`, () => {
4999
- gen.assign(j, (0, codegen_1._)`${indices}[${item}]`);
5000
- cxt.error();
5001
- gen.assign(valid, false).break();
5002
- }).code((0, codegen_1._)`${indices}[${item}] = ${i}`);
5003
- });
5004
- }
5005
- function loopN2(i, j) {
5006
- const eql = (0, util_1.useFunc)(gen, equal_1.default);
5007
- const outer = gen.name("outer");
5008
- gen.label(outer).for((0, codegen_1._)`;${i}--;`, () => gen.for((0, codegen_1._)`${j} = ${i}; ${j}--;`, () => gen.if((0, codegen_1._)`${eql}(${data}[${i}], ${data}[${j}])`, () => {
5009
- cxt.error();
5010
- gen.assign(valid, false).break(outer);
5011
- })));
4655
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json
4656
+ var require_core2 = __commonJS({
4657
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json"(exports, module) {
4658
+ module.exports = {
4659
+ $schema: "https://json-schema.org/draft/2020-12/schema",
4660
+ $id: "https://json-schema.org/draft/2020-12/meta/core",
4661
+ $vocabulary: {
4662
+ "https://json-schema.org/draft/2020-12/vocab/core": true
4663
+ },
4664
+ $dynamicAnchor: "meta",
4665
+ title: "Core vocabulary meta-schema",
4666
+ type: ["object", "boolean"],
4667
+ properties: {
4668
+ $id: {
4669
+ $ref: "#/$defs/uriReferenceString",
4670
+ $comment: "Non-empty fragments not allowed.",
4671
+ pattern: "^[^#]*#?$"
4672
+ },
4673
+ $schema: { $ref: "#/$defs/uriString" },
4674
+ $ref: { $ref: "#/$defs/uriReferenceString" },
4675
+ $anchor: { $ref: "#/$defs/anchorString" },
4676
+ $dynamicRef: { $ref: "#/$defs/uriReferenceString" },
4677
+ $dynamicAnchor: { $ref: "#/$defs/anchorString" },
4678
+ $vocabulary: {
4679
+ type: "object",
4680
+ propertyNames: { $ref: "#/$defs/uriString" },
4681
+ additionalProperties: {
4682
+ type: "boolean"
4683
+ }
4684
+ },
4685
+ $comment: {
4686
+ type: "string"
4687
+ },
4688
+ $defs: {
4689
+ type: "object",
4690
+ additionalProperties: { $dynamicRef: "#meta" }
4691
+ }
4692
+ },
4693
+ $defs: {
4694
+ anchorString: {
4695
+ type: "string",
4696
+ pattern: "^[A-Za-z_][-A-Za-z0-9._]*$"
4697
+ },
4698
+ uriString: {
4699
+ type: "string",
4700
+ format: "uri"
4701
+ },
4702
+ uriReferenceString: {
4703
+ type: "string",
4704
+ format: "uri-reference"
5012
4705
  }
5013
4706
  }
5014
4707
  };
5015
- exports.default = def;
5016
4708
  }
5017
4709
  });
5018
4710
 
5019
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js
5020
- var require_const = __commonJS({
5021
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js"(exports) {
5022
- Object.defineProperty(exports, "__esModule", { value: true });
5023
- var codegen_1 = require_codegen();
5024
- var util_1 = require_util();
5025
- var equal_1 = require_equal();
5026
- var error2 = {
5027
- message: "must be equal to constant",
5028
- params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}`
5029
- };
5030
- var def = {
5031
- keyword: "const",
5032
- $data: true,
5033
- error: error2,
5034
- code(cxt) {
5035
- const { gen, data, $data, schemaCode, schema } = cxt;
5036
- if ($data || schema && typeof schema == "object") {
5037
- cxt.fail$data((0, codegen_1._)`!${(0, util_1.useFunc)(gen, equal_1.default)}(${data}, ${schemaCode})`);
5038
- } else {
5039
- cxt.fail((0, codegen_1._)`${schema} !== ${data}`);
5040
- }
4711
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json
4712
+ var require_format_annotation = __commonJS({
4713
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json"(exports, module) {
4714
+ module.exports = {
4715
+ $schema: "https://json-schema.org/draft/2020-12/schema",
4716
+ $id: "https://json-schema.org/draft/2020-12/meta/format-annotation",
4717
+ $vocabulary: {
4718
+ "https://json-schema.org/draft/2020-12/vocab/format-annotation": true
4719
+ },
4720
+ $dynamicAnchor: "meta",
4721
+ title: "Format vocabulary meta-schema for annotation results",
4722
+ type: ["object", "boolean"],
4723
+ properties: {
4724
+ format: { type: "string" }
5041
4725
  }
5042
4726
  };
5043
- exports.default = def;
5044
4727
  }
5045
4728
  });
5046
4729
 
5047
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js
5048
- var require_enum = __commonJS({
5049
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js"(exports) {
5050
- Object.defineProperty(exports, "__esModule", { value: true });
5051
- var codegen_1 = require_codegen();
5052
- var util_1 = require_util();
5053
- var equal_1 = require_equal();
5054
- var error2 = {
5055
- message: "must be equal to one of the allowed values",
5056
- params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}`
5057
- };
5058
- var def = {
5059
- keyword: "enum",
5060
- schemaType: "array",
5061
- $data: true,
5062
- error: error2,
5063
- code(cxt) {
5064
- const { gen, data, $data, schema, schemaCode, it } = cxt;
5065
- if (!$data && schema.length === 0)
5066
- throw new Error("enum must have non-empty array");
5067
- const useLoop = schema.length >= it.opts.loopEnum;
5068
- let eql;
5069
- const getEql = () => eql !== null && eql !== void 0 ? eql : eql = (0, util_1.useFunc)(gen, equal_1.default);
5070
- let valid;
5071
- if (useLoop || $data) {
5072
- valid = gen.let("valid");
5073
- cxt.block$data(valid, loopEnum);
5074
- } else {
5075
- if (!Array.isArray(schema))
5076
- throw new Error("ajv implementation error");
5077
- const vSchema = gen.const("vSchema", schemaCode);
5078
- valid = (0, codegen_1.or)(...schema.map((_x, i) => equalCode(vSchema, i)));
5079
- }
5080
- cxt.pass(valid);
5081
- function loopEnum() {
5082
- gen.assign(valid, false);
5083
- gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._)`${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break()));
5084
- }
5085
- function equalCode(vSchema, i) {
5086
- const sch = schema[i];
5087
- return typeof sch === "object" && sch !== null ? (0, codegen_1._)`${getEql()}(${data}, ${vSchema}[${i}])` : (0, codegen_1._)`${data} === ${sch}`;
4730
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json
4731
+ var require_meta_data = __commonJS({
4732
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json"(exports, module) {
4733
+ module.exports = {
4734
+ $schema: "https://json-schema.org/draft/2020-12/schema",
4735
+ $id: "https://json-schema.org/draft/2020-12/meta/meta-data",
4736
+ $vocabulary: {
4737
+ "https://json-schema.org/draft/2020-12/vocab/meta-data": true
4738
+ },
4739
+ $dynamicAnchor: "meta",
4740
+ title: "Meta-data vocabulary meta-schema",
4741
+ type: ["object", "boolean"],
4742
+ properties: {
4743
+ title: {
4744
+ type: "string"
4745
+ },
4746
+ description: {
4747
+ type: "string"
4748
+ },
4749
+ default: true,
4750
+ deprecated: {
4751
+ type: "boolean",
4752
+ default: false
4753
+ },
4754
+ readOnly: {
4755
+ type: "boolean",
4756
+ default: false
4757
+ },
4758
+ writeOnly: {
4759
+ type: "boolean",
4760
+ default: false
4761
+ },
4762
+ examples: {
4763
+ type: "array",
4764
+ items: true
5088
4765
  }
5089
4766
  }
5090
4767
  };
5091
- exports.default = def;
5092
4768
  }
5093
4769
  });
5094
4770
 
5095
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js
4771
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json
5096
4772
  var require_validation = __commonJS({
5097
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js"(exports) {
5098
- Object.defineProperty(exports, "__esModule", { value: true });
5099
- var limitNumber_1 = require_limitNumber();
5100
- var multipleOf_1 = require_multipleOf();
5101
- var limitLength_1 = require_limitLength();
5102
- var pattern_1 = require_pattern();
5103
- var limitProperties_1 = require_limitProperties();
5104
- var required_1 = require_required();
5105
- var limitItems_1 = require_limitItems();
5106
- var uniqueItems_1 = require_uniqueItems();
5107
- var const_1 = require_const();
5108
- var enum_1 = require_enum();
5109
- var validation = [
5110
- // number
5111
- limitNumber_1.default,
5112
- multipleOf_1.default,
5113
- // string
5114
- limitLength_1.default,
5115
- pattern_1.default,
5116
- // object
5117
- limitProperties_1.default,
5118
- required_1.default,
5119
- // array
5120
- limitItems_1.default,
5121
- uniqueItems_1.default,
5122
- // any
5123
- { keyword: "type", schemaType: ["string", "array"] },
5124
- { keyword: "nullable", schemaType: "boolean" },
5125
- const_1.default,
5126
- enum_1.default
5127
- ];
5128
- exports.default = validation;
4773
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json"(exports, module) {
4774
+ module.exports = {
4775
+ $schema: "https://json-schema.org/draft/2020-12/schema",
4776
+ $id: "https://json-schema.org/draft/2020-12/meta/validation",
4777
+ $vocabulary: {
4778
+ "https://json-schema.org/draft/2020-12/vocab/validation": true
4779
+ },
4780
+ $dynamicAnchor: "meta",
4781
+ title: "Validation vocabulary meta-schema",
4782
+ type: ["object", "boolean"],
4783
+ properties: {
4784
+ type: {
4785
+ anyOf: [
4786
+ { $ref: "#/$defs/simpleTypes" },
4787
+ {
4788
+ type: "array",
4789
+ items: { $ref: "#/$defs/simpleTypes" },
4790
+ minItems: 1,
4791
+ uniqueItems: true
4792
+ }
4793
+ ]
4794
+ },
4795
+ const: true,
4796
+ enum: {
4797
+ type: "array",
4798
+ items: true
4799
+ },
4800
+ multipleOf: {
4801
+ type: "number",
4802
+ exclusiveMinimum: 0
4803
+ },
4804
+ maximum: {
4805
+ type: "number"
4806
+ },
4807
+ exclusiveMaximum: {
4808
+ type: "number"
4809
+ },
4810
+ minimum: {
4811
+ type: "number"
4812
+ },
4813
+ exclusiveMinimum: {
4814
+ type: "number"
4815
+ },
4816
+ maxLength: { $ref: "#/$defs/nonNegativeInteger" },
4817
+ minLength: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
4818
+ pattern: {
4819
+ type: "string",
4820
+ format: "regex"
4821
+ },
4822
+ maxItems: { $ref: "#/$defs/nonNegativeInteger" },
4823
+ minItems: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
4824
+ uniqueItems: {
4825
+ type: "boolean",
4826
+ default: false
4827
+ },
4828
+ maxContains: { $ref: "#/$defs/nonNegativeInteger" },
4829
+ minContains: {
4830
+ $ref: "#/$defs/nonNegativeInteger",
4831
+ default: 1
4832
+ },
4833
+ maxProperties: { $ref: "#/$defs/nonNegativeInteger" },
4834
+ minProperties: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
4835
+ required: { $ref: "#/$defs/stringArray" },
4836
+ dependentRequired: {
4837
+ type: "object",
4838
+ additionalProperties: {
4839
+ $ref: "#/$defs/stringArray"
4840
+ }
4841
+ }
4842
+ },
4843
+ $defs: {
4844
+ nonNegativeInteger: {
4845
+ type: "integer",
4846
+ minimum: 0
4847
+ },
4848
+ nonNegativeIntegerDefault0: {
4849
+ $ref: "#/$defs/nonNegativeInteger",
4850
+ default: 0
4851
+ },
4852
+ simpleTypes: {
4853
+ enum: ["array", "boolean", "integer", "null", "number", "object", "string"]
4854
+ },
4855
+ stringArray: {
4856
+ type: "array",
4857
+ items: { type: "string" },
4858
+ uniqueItems: true,
4859
+ default: []
4860
+ }
4861
+ }
4862
+ };
5129
4863
  }
5130
4864
  });
5131
4865
 
5132
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js
5133
- var require_additionalItems = __commonJS({
5134
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js"(exports) {
4866
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js
4867
+ var require_json_schema_2020_12 = __commonJS({
4868
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js"(exports) {
4869
+ Object.defineProperty(exports, "__esModule", { value: true });
4870
+ var metaSchema = require_schema();
4871
+ var applicator = require_applicator();
4872
+ var unevaluated = require_unevaluated();
4873
+ var content = require_content();
4874
+ var core = require_core2();
4875
+ var format = require_format_annotation();
4876
+ var metadata = require_meta_data();
4877
+ var validation = require_validation();
4878
+ var META_SUPPORT_DATA = ["/properties"];
4879
+ function addMetaSchema20202($data) {
4880
+ [
4881
+ metaSchema,
4882
+ applicator,
4883
+ unevaluated,
4884
+ content,
4885
+ core,
4886
+ with$data(this, format),
4887
+ metadata,
4888
+ with$data(this, validation)
4889
+ ].forEach((sch) => this.addMetaSchema(sch, void 0, false));
4890
+ return this;
4891
+ function with$data(ajv2, sch) {
4892
+ return $data ? ajv2.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch;
4893
+ }
4894
+ }
4895
+ exports.default = addMetaSchema20202;
4896
+ }
4897
+ });
4898
+
4899
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js
4900
+ var require_id = __commonJS({
4901
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js"(exports) {
5135
4902
  Object.defineProperty(exports, "__esModule", { value: true });
5136
- exports.validateAdditionalItems = void 0;
5137
- var codegen_1 = require_codegen();
5138
- var util_1 = require_util();
5139
- var error2 = {
5140
- message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
5141
- params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
5142
- };
5143
4903
  var def = {
5144
- keyword: "additionalItems",
5145
- type: "array",
5146
- schemaType: ["boolean", "object"],
5147
- before: "uniqueItems",
5148
- error: error2,
5149
- code(cxt) {
5150
- const { parentSchema, it } = cxt;
5151
- const { items } = parentSchema;
5152
- if (!Array.isArray(items)) {
5153
- (0, util_1.checkStrictMode)(it, '"additionalItems" is ignored when "items" is not an array of schemas');
5154
- return;
5155
- }
5156
- validateAdditionalItems(cxt, items);
4904
+ keyword: "id",
4905
+ code() {
4906
+ throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID');
5157
4907
  }
5158
4908
  };
5159
- function validateAdditionalItems(cxt, items) {
5160
- const { gen, schema, data, keyword, it } = cxt;
5161
- it.items = true;
5162
- const len = gen.const("len", (0, codegen_1._)`${data}.length`);
5163
- if (schema === false) {
5164
- cxt.setParams({ len: items.length });
5165
- cxt.pass((0, codegen_1._)`${len} <= ${items.length}`);
5166
- } else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
5167
- const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items.length}`);
5168
- gen.if((0, codegen_1.not)(valid), () => validateItems(valid));
5169
- cxt.ok(valid);
5170
- }
5171
- function validateItems(valid) {
5172
- gen.forRange("i", items.length, len, (i) => {
5173
- cxt.subschema({ keyword, dataProp: i, dataPropType: util_1.Type.Num }, valid);
5174
- if (!it.allErrors)
5175
- gen.if((0, codegen_1.not)(valid), () => gen.break());
5176
- });
5177
- }
5178
- }
5179
- exports.validateAdditionalItems = validateAdditionalItems;
5180
4909
  exports.default = def;
5181
4910
  }
5182
4911
  });
5183
4912
 
5184
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js
5185
- var require_items = __commonJS({
5186
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js"(exports) {
4913
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js
4914
+ var require_ref = __commonJS({
4915
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js"(exports) {
5187
4916
  Object.defineProperty(exports, "__esModule", { value: true });
5188
- exports.validateTuple = void 0;
4917
+ exports.callRef = exports.getValidate = void 0;
4918
+ var ref_error_1 = require_ref_error();
4919
+ var code_1 = require_code2();
5189
4920
  var codegen_1 = require_codegen();
4921
+ var names_1 = require_names();
4922
+ var compile_1 = require_compile();
5190
4923
  var util_1 = require_util();
5191
- var code_1 = require_code2();
5192
4924
  var def = {
5193
- keyword: "items",
5194
- type: "array",
5195
- schemaType: ["object", "array", "boolean"],
5196
- before: "uniqueItems",
4925
+ keyword: "$ref",
4926
+ schemaType: "string",
5197
4927
  code(cxt) {
5198
- const { schema, it } = cxt;
5199
- if (Array.isArray(schema))
5200
- return validateTuple(cxt, "additionalItems", schema);
5201
- it.items = true;
5202
- if ((0, util_1.alwaysValidSchema)(it, schema))
5203
- return;
5204
- cxt.ok((0, code_1.validateArray)(cxt));
4928
+ const { gen, schema: $ref, it } = cxt;
4929
+ const { baseId, schemaEnv: env, validateName, opts, self } = it;
4930
+ const { root } = env;
4931
+ if (($ref === "#" || $ref === "#/") && baseId === root.baseId)
4932
+ return callRootRef();
4933
+ const schOrEnv = compile_1.resolveRef.call(self, root, baseId, $ref);
4934
+ if (schOrEnv === void 0)
4935
+ throw new ref_error_1.default(it.opts.uriResolver, baseId, $ref);
4936
+ if (schOrEnv instanceof compile_1.SchemaEnv)
4937
+ return callValidate(schOrEnv);
4938
+ return inlineRefSchema(schOrEnv);
4939
+ function callRootRef() {
4940
+ if (env === root)
4941
+ return callRef(cxt, validateName, env, env.$async);
4942
+ const rootName = gen.scopeValue("root", { ref: root });
4943
+ return callRef(cxt, (0, codegen_1._)`${rootName}.validate`, root, root.$async);
4944
+ }
4945
+ function callValidate(sch) {
4946
+ const v = getValidate(cxt, sch);
4947
+ callRef(cxt, v, sch, sch.$async);
4948
+ }
4949
+ function inlineRefSchema(sch) {
4950
+ const schName = gen.scopeValue("schema", opts.code.source === true ? { ref: sch, code: (0, codegen_1.stringify)(sch) } : { ref: sch });
4951
+ const valid = gen.name("valid");
4952
+ const schCxt = cxt.subschema({
4953
+ schema: sch,
4954
+ dataTypes: [],
4955
+ schemaPath: codegen_1.nil,
4956
+ topSchemaRef: schName,
4957
+ errSchemaPath: $ref
4958
+ }, valid);
4959
+ cxt.mergeEvaluated(schCxt);
4960
+ cxt.ok(valid);
4961
+ }
5205
4962
  }
5206
4963
  };
5207
- function validateTuple(cxt, extraItems, schArr = cxt.schema) {
5208
- const { gen, parentSchema, data, keyword, it } = cxt;
5209
- checkStrictTuple(parentSchema);
5210
- if (it.opts.unevaluated && schArr.length && it.items !== true) {
5211
- it.items = util_1.mergeEvaluated.items(gen, schArr.length, it.items);
4964
+ function getValidate(cxt, sch) {
4965
+ const { gen } = cxt;
4966
+ return sch.validate ? gen.scopeValue("validate", { ref: sch.validate }) : (0, codegen_1._)`${gen.scopeValue("wrapper", { ref: sch })}.validate`;
4967
+ }
4968
+ exports.getValidate = getValidate;
4969
+ function callRef(cxt, v, sch, $async) {
4970
+ const { gen, it } = cxt;
4971
+ const { allErrors, schemaEnv: env, opts } = it;
4972
+ const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil;
4973
+ if ($async)
4974
+ callAsyncRef();
4975
+ else
4976
+ callSyncRef();
4977
+ function callAsyncRef() {
4978
+ if (!env.$async)
4979
+ throw new Error("async schema referenced by sync schema");
4980
+ const valid = gen.let("valid");
4981
+ gen.try(() => {
4982
+ gen.code((0, codegen_1._)`await ${(0, code_1.callValidateCode)(cxt, v, passCxt)}`);
4983
+ addEvaluatedFrom(v);
4984
+ if (!allErrors)
4985
+ gen.assign(valid, true);
4986
+ }, (e) => {
4987
+ gen.if((0, codegen_1._)`!(${e} instanceof ${it.ValidationError})`, () => gen.throw(e));
4988
+ addErrorsFrom(e);
4989
+ if (!allErrors)
4990
+ gen.assign(valid, false);
4991
+ });
4992
+ cxt.ok(valid);
5212
4993
  }
5213
- const valid = gen.name("valid");
5214
- const len = gen.const("len", (0, codegen_1._)`${data}.length`);
5215
- schArr.forEach((sch, i) => {
5216
- if ((0, util_1.alwaysValidSchema)(it, sch))
4994
+ function callSyncRef() {
4995
+ cxt.result((0, code_1.callValidateCode)(cxt, v, passCxt), () => addEvaluatedFrom(v), () => addErrorsFrom(v));
4996
+ }
4997
+ function addErrorsFrom(source) {
4998
+ const errs = (0, codegen_1._)`${source}.errors`;
4999
+ gen.assign(names_1.default.vErrors, (0, codegen_1._)`${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`);
5000
+ gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
5001
+ }
5002
+ function addEvaluatedFrom(source) {
5003
+ var _a;
5004
+ if (!it.opts.unevaluated)
5217
5005
  return;
5218
- gen.if((0, codegen_1._)`${len} > ${i}`, () => cxt.subschema({
5219
- keyword,
5220
- schemaProp: i,
5221
- dataProp: i
5222
- }, valid));
5223
- cxt.ok(valid);
5224
- });
5225
- function checkStrictTuple(sch) {
5226
- const { opts, errSchemaPath } = it;
5227
- const l = schArr.length;
5228
- const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false);
5229
- if (opts.strictTuples && !fullTuple) {
5230
- const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"`;
5231
- (0, util_1.checkStrictMode)(it, msg, opts.strictTuples);
5006
+ const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated;
5007
+ if (it.props !== true) {
5008
+ if (schEvaluated && !schEvaluated.dynamicProps) {
5009
+ if (schEvaluated.props !== void 0) {
5010
+ it.props = util_1.mergeEvaluated.props(gen, schEvaluated.props, it.props);
5011
+ }
5012
+ } else {
5013
+ const props = gen.var("props", (0, codegen_1._)`${source}.evaluated.props`);
5014
+ it.props = util_1.mergeEvaluated.props(gen, props, it.props, codegen_1.Name);
5015
+ }
5016
+ }
5017
+ if (it.items !== true) {
5018
+ if (schEvaluated && !schEvaluated.dynamicItems) {
5019
+ if (schEvaluated.items !== void 0) {
5020
+ it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items);
5021
+ }
5022
+ } else {
5023
+ const items = gen.var("items", (0, codegen_1._)`${source}.evaluated.items`);
5024
+ it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name);
5025
+ }
5232
5026
  }
5233
5027
  }
5234
5028
  }
5235
- exports.validateTuple = validateTuple;
5029
+ exports.callRef = callRef;
5236
5030
  exports.default = def;
5237
5031
  }
5238
5032
  });
5239
5033
 
5240
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js
5241
- var require_prefixItems = __commonJS({
5242
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js"(exports) {
5034
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js
5035
+ var require_core3 = __commonJS({
5036
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js"(exports) {
5243
5037
  Object.defineProperty(exports, "__esModule", { value: true });
5244
- var items_1 = require_items();
5038
+ var id_1 = require_id();
5039
+ var ref_1 = require_ref();
5040
+ var core = [
5041
+ "$schema",
5042
+ "$id",
5043
+ "$defs",
5044
+ "$vocabulary",
5045
+ { keyword: "$comment" },
5046
+ "definitions",
5047
+ id_1.default,
5048
+ ref_1.default
5049
+ ];
5050
+ exports.default = core;
5051
+ }
5052
+ });
5053
+
5054
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js
5055
+ var require_limitNumber = __commonJS({
5056
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js"(exports) {
5057
+ Object.defineProperty(exports, "__esModule", { value: true });
5058
+ var codegen_1 = require_codegen();
5059
+ var ops = codegen_1.operators;
5060
+ var KWDs = {
5061
+ maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
5062
+ minimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT },
5063
+ exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
5064
+ exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }
5065
+ };
5066
+ var error2 = {
5067
+ message: ({ keyword, schemaCode }) => (0, codegen_1.str)`must be ${KWDs[keyword].okStr} ${schemaCode}`,
5068
+ params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
5069
+ };
5245
5070
  var def = {
5246
- keyword: "prefixItems",
5247
- type: "array",
5248
- schemaType: ["array"],
5249
- before: "uniqueItems",
5250
- code: (cxt) => (0, items_1.validateTuple)(cxt, "items")
5071
+ keyword: Object.keys(KWDs),
5072
+ type: "number",
5073
+ schemaType: "number",
5074
+ $data: true,
5075
+ error: error2,
5076
+ code(cxt) {
5077
+ const { keyword, data, schemaCode } = cxt;
5078
+ cxt.fail$data((0, codegen_1._)`${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`);
5079
+ }
5251
5080
  };
5252
5081
  exports.default = def;
5253
5082
  }
5254
5083
  });
5255
5084
 
5256
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js
5257
- var require_items2020 = __commonJS({
5258
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js"(exports) {
5085
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js
5086
+ var require_multipleOf = __commonJS({
5087
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js"(exports) {
5259
5088
  Object.defineProperty(exports, "__esModule", { value: true });
5260
5089
  var codegen_1 = require_codegen();
5261
- var util_1 = require_util();
5262
- var code_1 = require_code2();
5263
- var additionalItems_1 = require_additionalItems();
5264
5090
  var error2 = {
5265
- message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
5266
- params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
5091
+ message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`,
5092
+ params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}`
5267
5093
  };
5268
5094
  var def = {
5269
- keyword: "items",
5270
- type: "array",
5271
- schemaType: ["object", "boolean"],
5272
- before: "uniqueItems",
5095
+ keyword: "multipleOf",
5096
+ type: "number",
5097
+ schemaType: "number",
5098
+ $data: true,
5273
5099
  error: error2,
5274
5100
  code(cxt) {
5275
- const { schema, parentSchema, it } = cxt;
5276
- const { prefixItems } = parentSchema;
5277
- it.items = true;
5278
- if ((0, util_1.alwaysValidSchema)(it, schema))
5279
- return;
5280
- if (prefixItems)
5281
- (0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems);
5282
- else
5283
- cxt.ok((0, code_1.validateArray)(cxt));
5101
+ const { gen, data, schemaCode, it } = cxt;
5102
+ const prec = it.opts.multipleOfPrecision;
5103
+ const res = gen.let("res");
5104
+ const invalid = prec ? (0, codegen_1._)`Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` : (0, codegen_1._)`${res} !== parseInt(${res})`;
5105
+ cxt.fail$data((0, codegen_1._)`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`);
5284
5106
  }
5285
5107
  };
5286
5108
  exports.default = def;
5287
5109
  }
5288
5110
  });
5289
5111
 
5290
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js
5291
- var require_contains = __commonJS({
5292
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js"(exports) {
5112
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js
5113
+ var require_ucs2length = __commonJS({
5114
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js"(exports) {
5115
+ Object.defineProperty(exports, "__esModule", { value: true });
5116
+ function ucs2length(str) {
5117
+ const len = str.length;
5118
+ let length = 0;
5119
+ let pos = 0;
5120
+ let value;
5121
+ while (pos < len) {
5122
+ length++;
5123
+ value = str.charCodeAt(pos++);
5124
+ if (value >= 55296 && value <= 56319 && pos < len) {
5125
+ value = str.charCodeAt(pos);
5126
+ if ((value & 64512) === 56320)
5127
+ pos++;
5128
+ }
5129
+ }
5130
+ return length;
5131
+ }
5132
+ exports.default = ucs2length;
5133
+ ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default';
5134
+ }
5135
+ });
5136
+
5137
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js
5138
+ var require_limitLength = __commonJS({
5139
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js"(exports) {
5293
5140
  Object.defineProperty(exports, "__esModule", { value: true });
5294
5141
  var codegen_1 = require_codegen();
5295
5142
  var util_1 = require_util();
5143
+ var ucs2length_1 = require_ucs2length();
5296
5144
  var error2 = {
5297
- message: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`,
5298
- params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`
5145
+ message({ keyword, schemaCode }) {
5146
+ const comp = keyword === "maxLength" ? "more" : "fewer";
5147
+ return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} characters`;
5148
+ },
5149
+ params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}`
5299
5150
  };
5300
5151
  var def = {
5301
- keyword: "contains",
5302
- type: "array",
5303
- schemaType: ["object", "boolean"],
5304
- before: "uniqueItems",
5305
- trackErrors: true,
5152
+ keyword: ["maxLength", "minLength"],
5153
+ type: "string",
5154
+ schemaType: "number",
5155
+ $data: true,
5306
5156
  error: error2,
5307
5157
  code(cxt) {
5308
- const { gen, schema, parentSchema, data, it } = cxt;
5309
- let min;
5310
- let max;
5311
- const { minContains, maxContains } = parentSchema;
5312
- if (it.opts.next) {
5313
- min = minContains === void 0 ? 1 : minContains;
5314
- max = maxContains;
5315
- } else {
5316
- min = 1;
5317
- }
5318
- const len = gen.const("len", (0, codegen_1._)`${data}.length`);
5319
- cxt.setParams({ min, max });
5320
- if (max === void 0 && min === 0) {
5321
- (0, util_1.checkStrictMode)(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`);
5322
- return;
5323
- }
5324
- if (max !== void 0 && min > max) {
5325
- (0, util_1.checkStrictMode)(it, `"minContains" > "maxContains" is always invalid`);
5326
- cxt.fail();
5327
- return;
5328
- }
5329
- if ((0, util_1.alwaysValidSchema)(it, schema)) {
5330
- let cond = (0, codegen_1._)`${len} >= ${min}`;
5331
- if (max !== void 0)
5332
- cond = (0, codegen_1._)`${cond} && ${len} <= ${max}`;
5333
- cxt.pass(cond);
5334
- return;
5335
- }
5336
- it.items = true;
5337
- const valid = gen.name("valid");
5338
- if (max === void 0 && min === 1) {
5339
- validateItems(valid, () => gen.if(valid, () => gen.break()));
5340
- } else if (min === 0) {
5341
- gen.let(valid, true);
5342
- if (max !== void 0)
5343
- gen.if((0, codegen_1._)`${data}.length > 0`, validateItemsWithCount);
5344
- } else {
5345
- gen.let(valid, false);
5346
- validateItemsWithCount();
5347
- }
5348
- cxt.result(valid, () => cxt.reset());
5349
- function validateItemsWithCount() {
5350
- const schValid = gen.name("_valid");
5351
- const count = gen.let("count", 0);
5352
- validateItems(schValid, () => gen.if(schValid, () => checkLimits(count)));
5353
- }
5354
- function validateItems(_valid, block) {
5355
- gen.forRange("i", 0, len, (i) => {
5356
- cxt.subschema({
5357
- keyword: "contains",
5358
- dataProp: i,
5359
- dataPropType: util_1.Type.Num,
5360
- compositeRule: true
5361
- }, _valid);
5362
- block();
5363
- });
5364
- }
5365
- function checkLimits(count) {
5366
- gen.code((0, codegen_1._)`${count}++`);
5367
- if (max === void 0) {
5368
- gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true).break());
5369
- } else {
5370
- gen.if((0, codegen_1._)`${count} > ${max}`, () => gen.assign(valid, false).break());
5371
- if (min === 1)
5372
- gen.assign(valid, true);
5373
- else
5374
- gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true));
5375
- }
5376
- }
5158
+ const { keyword, data, schemaCode, it } = cxt;
5159
+ const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT;
5160
+ const len = it.opts.unicode === false ? (0, codegen_1._)`${data}.length` : (0, codegen_1._)`${(0, util_1.useFunc)(cxt.gen, ucs2length_1.default)}(${data})`;
5161
+ cxt.fail$data((0, codegen_1._)`${len} ${op} ${schemaCode}`);
5377
5162
  }
5378
5163
  };
5379
5164
  exports.default = def;
5380
5165
  }
5381
5166
  });
5382
5167
 
5383
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js
5384
- var require_dependencies = __commonJS({
5385
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js"(exports) {
5168
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js
5169
+ var require_pattern = __commonJS({
5170
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js"(exports) {
5386
5171
  Object.defineProperty(exports, "__esModule", { value: true });
5387
- exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0;
5388
- var codegen_1 = require_codegen();
5389
- var util_1 = require_util();
5390
5172
  var code_1 = require_code2();
5391
- exports.error = {
5392
- message: ({ params: { property, depsCount, deps } }) => {
5393
- const property_ies = depsCount === 1 ? "property" : "properties";
5394
- return (0, codegen_1.str)`must have ${property_ies} ${deps} when property ${property} is present`;
5395
- },
5396
- params: ({ params: { property, depsCount, deps, missingProperty } }) => (0, codegen_1._)`{property: ${property},
5397
- missingProperty: ${missingProperty},
5398
- depsCount: ${depsCount},
5399
- deps: ${deps}}`
5400
- // TODO change to reference
5173
+ var util_1 = require_util();
5174
+ var codegen_1 = require_codegen();
5175
+ var error2 = {
5176
+ message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
5177
+ params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}`
5401
5178
  };
5402
5179
  var def = {
5403
- keyword: "dependencies",
5404
- type: "object",
5405
- schemaType: "object",
5406
- error: exports.error,
5180
+ keyword: "pattern",
5181
+ type: "string",
5182
+ schemaType: "string",
5183
+ $data: true,
5184
+ error: error2,
5407
5185
  code(cxt) {
5408
- const [propDeps, schDeps] = splitDependencies(cxt);
5409
- validatePropertyDeps(cxt, propDeps);
5410
- validateSchemaDeps(cxt, schDeps);
5411
- }
5412
- };
5413
- function splitDependencies({ schema }) {
5414
- const propertyDeps = {};
5415
- const schemaDeps = {};
5416
- for (const key in schema) {
5417
- if (key === "__proto__")
5418
- continue;
5419
- const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps;
5420
- deps[key] = schema[key];
5421
- }
5422
- return [propertyDeps, schemaDeps];
5423
- }
5424
- function validatePropertyDeps(cxt, propertyDeps = cxt.schema) {
5425
- const { gen, data, it } = cxt;
5426
- if (Object.keys(propertyDeps).length === 0)
5427
- return;
5428
- const missing = gen.let("missing");
5429
- for (const prop in propertyDeps) {
5430
- const deps = propertyDeps[prop];
5431
- if (deps.length === 0)
5432
- continue;
5433
- const hasProperty = (0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties);
5434
- cxt.setParams({
5435
- property: prop,
5436
- depsCount: deps.length,
5437
- deps: deps.join(", ")
5438
- });
5439
- if (it.allErrors) {
5440
- gen.if(hasProperty, () => {
5441
- for (const depProp of deps) {
5442
- (0, code_1.checkReportMissingProp)(cxt, depProp);
5443
- }
5444
- });
5186
+ const { gen, data, $data, schema, schemaCode, it } = cxt;
5187
+ const u = it.opts.unicodeRegExp ? "u" : "";
5188
+ if ($data) {
5189
+ const { regExp } = it.opts.code;
5190
+ const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
5191
+ const valid = gen.let("valid");
5192
+ gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
5193
+ cxt.fail$data((0, codegen_1._)`!${valid}`);
5445
5194
  } else {
5446
- gen.if((0, codegen_1._)`${hasProperty} && (${(0, code_1.checkMissingProp)(cxt, deps, missing)})`);
5447
- (0, code_1.reportMissingProp)(cxt, missing);
5448
- gen.else();
5195
+ const regExp = (0, code_1.usePattern)(cxt, schema);
5196
+ cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
5449
5197
  }
5450
5198
  }
5451
- }
5452
- exports.validatePropertyDeps = validatePropertyDeps;
5453
- function validateSchemaDeps(cxt, schemaDeps = cxt.schema) {
5454
- const { gen, data, keyword, it } = cxt;
5455
- const valid = gen.name("valid");
5456
- for (const prop in schemaDeps) {
5457
- if ((0, util_1.alwaysValidSchema)(it, schemaDeps[prop]))
5458
- continue;
5459
- gen.if(
5460
- (0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties),
5461
- () => {
5462
- const schCxt = cxt.subschema({ keyword, schemaProp: prop }, valid);
5463
- cxt.mergeValidEvaluated(schCxt, valid);
5464
- },
5465
- () => gen.var(valid, true)
5466
- // TODO var
5467
- );
5468
- cxt.ok(valid);
5469
- }
5470
- }
5471
- exports.validateSchemaDeps = validateSchemaDeps;
5199
+ };
5472
5200
  exports.default = def;
5473
5201
  }
5474
5202
  });
5475
5203
 
5476
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js
5477
- var require_propertyNames = __commonJS({
5478
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js"(exports) {
5204
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js
5205
+ var require_limitProperties = __commonJS({
5206
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js"(exports) {
5479
5207
  Object.defineProperty(exports, "__esModule", { value: true });
5480
5208
  var codegen_1 = require_codegen();
5481
- var util_1 = require_util();
5482
5209
  var error2 = {
5483
- message: "property name must be valid",
5484
- params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}`
5210
+ message({ keyword, schemaCode }) {
5211
+ const comp = keyword === "maxProperties" ? "more" : "fewer";
5212
+ return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} properties`;
5213
+ },
5214
+ params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}`
5485
5215
  };
5486
5216
  var def = {
5487
- keyword: "propertyNames",
5217
+ keyword: ["maxProperties", "minProperties"],
5488
5218
  type: "object",
5489
- schemaType: ["object", "boolean"],
5219
+ schemaType: "number",
5220
+ $data: true,
5490
5221
  error: error2,
5491
5222
  code(cxt) {
5492
- const { gen, schema, data, it } = cxt;
5493
- if ((0, util_1.alwaysValidSchema)(it, schema))
5494
- return;
5495
- const valid = gen.name("valid");
5496
- gen.forIn("key", data, (key) => {
5497
- cxt.setParams({ propertyName: key });
5498
- cxt.subschema({
5499
- keyword: "propertyNames",
5500
- data: key,
5501
- dataTypes: ["string"],
5502
- propertyName: key,
5503
- compositeRule: true
5504
- }, valid);
5505
- gen.if((0, codegen_1.not)(valid), () => {
5506
- cxt.error(true);
5507
- if (!it.allErrors)
5508
- gen.break();
5509
- });
5510
- });
5511
- cxt.ok(valid);
5223
+ const { keyword, data, schemaCode } = cxt;
5224
+ const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT;
5225
+ cxt.fail$data((0, codegen_1._)`Object.keys(${data}).length ${op} ${schemaCode}`);
5512
5226
  }
5513
5227
  };
5514
5228
  exports.default = def;
5515
5229
  }
5516
5230
  });
5517
5231
 
5518
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js
5519
- var require_additionalProperties = __commonJS({
5520
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js"(exports) {
5232
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js
5233
+ var require_required = __commonJS({
5234
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js"(exports) {
5521
5235
  Object.defineProperty(exports, "__esModule", { value: true });
5522
5236
  var code_1 = require_code2();
5523
5237
  var codegen_1 = require_codegen();
5524
- var names_1 = require_names();
5525
5238
  var util_1 = require_util();
5526
5239
  var error2 = {
5527
- message: "must NOT have additional properties",
5528
- params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}`
5240
+ message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
5241
+ params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
5529
5242
  };
5530
5243
  var def = {
5531
- keyword: "additionalProperties",
5532
- type: ["object"],
5533
- schemaType: ["boolean", "object"],
5534
- allowUndefined: true,
5535
- trackErrors: true,
5244
+ keyword: "required",
5245
+ type: "object",
5246
+ schemaType: "array",
5247
+ $data: true,
5536
5248
  error: error2,
5537
5249
  code(cxt) {
5538
- const { gen, schema, parentSchema, data, errsCount, it } = cxt;
5539
- if (!errsCount)
5540
- throw new Error("ajv implementation error");
5541
- const { allErrors, opts } = it;
5542
- it.props = true;
5543
- if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema))
5250
+ const { gen, schema, schemaCode, data, $data, it } = cxt;
5251
+ const { opts } = it;
5252
+ if (!$data && schema.length === 0)
5544
5253
  return;
5545
- const props = (0, code_1.allSchemaProperties)(parentSchema.properties);
5546
- const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties);
5547
- checkAdditionalProperties();
5548
- cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
5549
- function checkAdditionalProperties() {
5550
- gen.forIn("key", data, (key) => {
5551
- if (!props.length && !patProps.length)
5552
- additionalPropertyCode(key);
5553
- else
5554
- gen.if(isAdditional(key), () => additionalPropertyCode(key));
5555
- });
5254
+ const useLoop = schema.length >= opts.loopRequired;
5255
+ if (it.allErrors)
5256
+ allErrorsMode();
5257
+ else
5258
+ exitOnErrorMode();
5259
+ if (opts.strictRequired) {
5260
+ const props = cxt.parentSchema.properties;
5261
+ const { definedProperties } = cxt.it;
5262
+ for (const requiredKey of schema) {
5263
+ if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === void 0 && !definedProperties.has(requiredKey)) {
5264
+ const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
5265
+ const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)`;
5266
+ (0, util_1.checkStrictMode)(it, msg, it.opts.strictRequired);
5267
+ }
5268
+ }
5556
5269
  }
5557
- function isAdditional(key) {
5558
- let definedProp;
5559
- if (props.length > 8) {
5560
- const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties");
5561
- definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key);
5562
- } else if (props.length) {
5563
- definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._)`${key} === ${p}`));
5270
+ function allErrorsMode() {
5271
+ if (useLoop || $data) {
5272
+ cxt.block$data(codegen_1.nil, loopAllRequired);
5564
5273
  } else {
5565
- definedProp = codegen_1.nil;
5274
+ for (const prop of schema) {
5275
+ (0, code_1.checkReportMissingProp)(cxt, prop);
5276
+ }
5566
5277
  }
5567
- if (patProps.length) {
5568
- definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p)}.test(${key})`));
5278
+ }
5279
+ function exitOnErrorMode() {
5280
+ const missing = gen.let("missing");
5281
+ if (useLoop || $data) {
5282
+ const valid = gen.let("valid", true);
5283
+ cxt.block$data(valid, () => loopUntilMissing(missing, valid));
5284
+ cxt.ok(valid);
5285
+ } else {
5286
+ gen.if((0, code_1.checkMissingProp)(cxt, schema, missing));
5287
+ (0, code_1.reportMissingProp)(cxt, missing);
5288
+ gen.else();
5569
5289
  }
5570
- return (0, codegen_1.not)(definedProp);
5571
5290
  }
5572
- function deleteAdditional(key) {
5573
- gen.code((0, codegen_1._)`delete ${data}[${key}]`);
5291
+ function loopAllRequired() {
5292
+ gen.forOf("prop", schemaCode, (prop) => {
5293
+ cxt.setParams({ missingProperty: prop });
5294
+ gen.if((0, code_1.noPropertyInData)(gen, data, prop, opts.ownProperties), () => cxt.error());
5295
+ });
5574
5296
  }
5575
- function additionalPropertyCode(key) {
5576
- if (opts.removeAdditional === "all" || opts.removeAdditional && schema === false) {
5577
- deleteAdditional(key);
5578
- return;
5579
- }
5580
- if (schema === false) {
5581
- cxt.setParams({ additionalProperty: key });
5582
- cxt.error();
5583
- if (!allErrors)
5297
+ function loopUntilMissing(missing, valid) {
5298
+ cxt.setParams({ missingProperty: missing });
5299
+ gen.forOf(missing, schemaCode, () => {
5300
+ gen.assign(valid, (0, code_1.propertyInData)(gen, data, missing, opts.ownProperties));
5301
+ gen.if((0, codegen_1.not)(valid), () => {
5302
+ cxt.error();
5584
5303
  gen.break();
5585
- return;
5586
- }
5587
- if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
5588
- const valid = gen.name("valid");
5589
- if (opts.removeAdditional === "failing") {
5590
- applyAdditionalSchema(key, valid, false);
5591
- gen.if((0, codegen_1.not)(valid), () => {
5592
- cxt.reset();
5593
- deleteAdditional(key);
5594
- });
5595
- } else {
5596
- applyAdditionalSchema(key, valid);
5597
- if (!allErrors)
5598
- gen.if((0, codegen_1.not)(valid), () => gen.break());
5599
- }
5600
- }
5601
- }
5602
- function applyAdditionalSchema(key, valid, errors) {
5603
- const subschema = {
5604
- keyword: "additionalProperties",
5605
- dataProp: key,
5606
- dataPropType: util_1.Type.Str
5607
- };
5608
- if (errors === false) {
5609
- Object.assign(subschema, {
5610
- compositeRule: true,
5611
- createErrors: false,
5612
- allErrors: false
5613
5304
  });
5614
- }
5615
- cxt.subschema(subschema, valid);
5305
+ }, codegen_1.nil);
5616
5306
  }
5617
5307
  }
5618
5308
  };
@@ -5620,232 +5310,179 @@ var require_additionalProperties = __commonJS({
5620
5310
  }
5621
5311
  });
5622
5312
 
5623
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js
5624
- var require_properties = __commonJS({
5625
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js"(exports) {
5313
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js
5314
+ var require_limitItems = __commonJS({
5315
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js"(exports) {
5626
5316
  Object.defineProperty(exports, "__esModule", { value: true });
5627
- var validate_1 = require_validate();
5628
- var code_1 = require_code2();
5629
- var util_1 = require_util();
5630
- var additionalProperties_1 = require_additionalProperties();
5631
- var def = {
5632
- keyword: "properties",
5633
- type: "object",
5634
- schemaType: "object",
5635
- code(cxt) {
5636
- const { gen, schema, parentSchema, data, it } = cxt;
5637
- if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === void 0) {
5638
- additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties"));
5639
- }
5640
- const allProps = (0, code_1.allSchemaProperties)(schema);
5641
- for (const prop of allProps) {
5642
- it.definedProperties.add(prop);
5643
- }
5644
- if (it.opts.unevaluated && allProps.length && it.props !== true) {
5645
- it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props);
5646
- }
5647
- const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p]));
5648
- if (properties.length === 0)
5649
- return;
5650
- const valid = gen.name("valid");
5651
- for (const prop of properties) {
5652
- if (hasDefault(prop)) {
5653
- applyPropertySchema(prop);
5654
- } else {
5655
- gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties));
5656
- applyPropertySchema(prop);
5657
- if (!it.allErrors)
5658
- gen.else().var(valid, true);
5659
- gen.endIf();
5660
- }
5661
- cxt.it.definedProperties.add(prop);
5662
- cxt.ok(valid);
5663
- }
5664
- function hasDefault(prop) {
5665
- return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== void 0;
5666
- }
5667
- function applyPropertySchema(prop) {
5668
- cxt.subschema({
5669
- keyword: "properties",
5670
- schemaProp: prop,
5671
- dataProp: prop
5672
- }, valid);
5673
- }
5317
+ var codegen_1 = require_codegen();
5318
+ var error2 = {
5319
+ message({ keyword, schemaCode }) {
5320
+ const comp = keyword === "maxItems" ? "more" : "fewer";
5321
+ return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} items`;
5322
+ },
5323
+ params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}`
5324
+ };
5325
+ var def = {
5326
+ keyword: ["maxItems", "minItems"],
5327
+ type: "array",
5328
+ schemaType: "number",
5329
+ $data: true,
5330
+ error: error2,
5331
+ code(cxt) {
5332
+ const { keyword, data, schemaCode } = cxt;
5333
+ const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT;
5334
+ cxt.fail$data((0, codegen_1._)`${data}.length ${op} ${schemaCode}`);
5674
5335
  }
5675
5336
  };
5676
5337
  exports.default = def;
5677
5338
  }
5678
5339
  });
5679
5340
 
5680
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js
5681
- var require_patternProperties = __commonJS({
5682
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js"(exports) {
5341
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js
5342
+ var require_equal = __commonJS({
5343
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js"(exports) {
5683
5344
  Object.defineProperty(exports, "__esModule", { value: true });
5684
- var code_1 = require_code2();
5345
+ var equal = require_fast_deep_equal();
5346
+ equal.code = 'require("ajv/dist/runtime/equal").default';
5347
+ exports.default = equal;
5348
+ }
5349
+ });
5350
+
5351
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js
5352
+ var require_uniqueItems = __commonJS({
5353
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js"(exports) {
5354
+ Object.defineProperty(exports, "__esModule", { value: true });
5355
+ var dataType_1 = require_dataType();
5685
5356
  var codegen_1 = require_codegen();
5686
5357
  var util_1 = require_util();
5687
- var util_2 = require_util();
5358
+ var equal_1 = require_equal();
5359
+ var error2 = {
5360
+ message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,
5361
+ params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}`
5362
+ };
5688
5363
  var def = {
5689
- keyword: "patternProperties",
5690
- type: "object",
5691
- schemaType: "object",
5364
+ keyword: "uniqueItems",
5365
+ type: "array",
5366
+ schemaType: "boolean",
5367
+ $data: true,
5368
+ error: error2,
5692
5369
  code(cxt) {
5693
- const { gen, schema, data, parentSchema, it } = cxt;
5694
- const { opts } = it;
5695
- const patterns = (0, code_1.allSchemaProperties)(schema);
5696
- const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema[p]));
5697
- if (patterns.length === 0 || alwaysValidPatterns.length === patterns.length && (!it.opts.unevaluated || it.props === true)) {
5370
+ const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt;
5371
+ if (!$data && !schema)
5698
5372
  return;
5373
+ const valid = gen.let("valid");
5374
+ const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : [];
5375
+ cxt.block$data(valid, validateUniqueItems, (0, codegen_1._)`${schemaCode} === false`);
5376
+ cxt.ok(valid);
5377
+ function validateUniqueItems() {
5378
+ const i = gen.let("i", (0, codegen_1._)`${data}.length`);
5379
+ const j = gen.let("j");
5380
+ cxt.setParams({ i, j });
5381
+ gen.assign(valid, true);
5382
+ gen.if((0, codegen_1._)`${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j));
5699
5383
  }
5700
- const checkProperties = opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties;
5701
- const valid = gen.name("valid");
5702
- if (it.props !== true && !(it.props instanceof codegen_1.Name)) {
5703
- it.props = (0, util_2.evaluatedPropsToName)(gen, it.props);
5704
- }
5705
- const { props } = it;
5706
- validatePatternProperties();
5707
- function validatePatternProperties() {
5708
- for (const pat of patterns) {
5709
- if (checkProperties)
5710
- checkMatchingProperties(pat);
5711
- if (it.allErrors) {
5712
- validateProperties(pat);
5713
- } else {
5714
- gen.var(valid, true);
5715
- validateProperties(pat);
5716
- gen.if(valid);
5717
- }
5718
- }
5719
- }
5720
- function checkMatchingProperties(pat) {
5721
- for (const prop in checkProperties) {
5722
- if (new RegExp(pat).test(prop)) {
5723
- (0, util_1.checkStrictMode)(it, `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`);
5724
- }
5725
- }
5384
+ function canOptimize() {
5385
+ return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array");
5726
5386
  }
5727
- function validateProperties(pat) {
5728
- gen.forIn("key", data, (key) => {
5729
- gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${key})`, () => {
5730
- const alwaysValid = alwaysValidPatterns.includes(pat);
5731
- if (!alwaysValid) {
5732
- cxt.subschema({
5733
- keyword: "patternProperties",
5734
- schemaProp: pat,
5735
- dataProp: key,
5736
- dataPropType: util_2.Type.Str
5737
- }, valid);
5738
- }
5739
- if (it.opts.unevaluated && props !== true) {
5740
- gen.assign((0, codegen_1._)`${props}[${key}]`, true);
5741
- } else if (!alwaysValid && !it.allErrors) {
5742
- gen.if((0, codegen_1.not)(valid), () => gen.break());
5743
- }
5744
- });
5387
+ function loopN(i, j) {
5388
+ const item = gen.name("item");
5389
+ const wrongType = (0, dataType_1.checkDataTypes)(itemTypes, item, it.opts.strictNumbers, dataType_1.DataType.Wrong);
5390
+ const indices = gen.const("indices", (0, codegen_1._)`{}`);
5391
+ gen.for((0, codegen_1._)`;${i}--;`, () => {
5392
+ gen.let(item, (0, codegen_1._)`${data}[${i}]`);
5393
+ gen.if(wrongType, (0, codegen_1._)`continue`);
5394
+ if (itemTypes.length > 1)
5395
+ gen.if((0, codegen_1._)`typeof ${item} == "string"`, (0, codegen_1._)`${item} += "_"`);
5396
+ gen.if((0, codegen_1._)`typeof ${indices}[${item}] == "number"`, () => {
5397
+ gen.assign(j, (0, codegen_1._)`${indices}[${item}]`);
5398
+ cxt.error();
5399
+ gen.assign(valid, false).break();
5400
+ }).code((0, codegen_1._)`${indices}[${item}] = ${i}`);
5745
5401
  });
5746
5402
  }
5403
+ function loopN2(i, j) {
5404
+ const eql = (0, util_1.useFunc)(gen, equal_1.default);
5405
+ const outer = gen.name("outer");
5406
+ gen.label(outer).for((0, codegen_1._)`;${i}--;`, () => gen.for((0, codegen_1._)`${j} = ${i}; ${j}--;`, () => gen.if((0, codegen_1._)`${eql}(${data}[${i}], ${data}[${j}])`, () => {
5407
+ cxt.error();
5408
+ gen.assign(valid, false).break(outer);
5409
+ })));
5410
+ }
5747
5411
  }
5748
5412
  };
5749
5413
  exports.default = def;
5750
5414
  }
5751
5415
  });
5752
5416
 
5753
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js
5754
- var require_not = __commonJS({
5755
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js"(exports) {
5417
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js
5418
+ var require_const = __commonJS({
5419
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js"(exports) {
5756
5420
  Object.defineProperty(exports, "__esModule", { value: true });
5421
+ var codegen_1 = require_codegen();
5757
5422
  var util_1 = require_util();
5423
+ var equal_1 = require_equal();
5424
+ var error2 = {
5425
+ message: "must be equal to constant",
5426
+ params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}`
5427
+ };
5758
5428
  var def = {
5759
- keyword: "not",
5760
- schemaType: ["object", "boolean"],
5761
- trackErrors: true,
5429
+ keyword: "const",
5430
+ $data: true,
5431
+ error: error2,
5762
5432
  code(cxt) {
5763
- const { gen, schema, it } = cxt;
5764
- if ((0, util_1.alwaysValidSchema)(it, schema)) {
5765
- cxt.fail();
5766
- return;
5433
+ const { gen, data, $data, schemaCode, schema } = cxt;
5434
+ if ($data || schema && typeof schema == "object") {
5435
+ cxt.fail$data((0, codegen_1._)`!${(0, util_1.useFunc)(gen, equal_1.default)}(${data}, ${schemaCode})`);
5436
+ } else {
5437
+ cxt.fail((0, codegen_1._)`${schema} !== ${data}`);
5767
5438
  }
5768
- const valid = gen.name("valid");
5769
- cxt.subschema({
5770
- keyword: "not",
5771
- compositeRule: true,
5772
- createErrors: false,
5773
- allErrors: false
5774
- }, valid);
5775
- cxt.failResult(valid, () => cxt.reset(), () => cxt.error());
5776
- },
5777
- error: { message: "must NOT be valid" }
5778
- };
5779
- exports.default = def;
5780
- }
5781
- });
5782
-
5783
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js
5784
- var require_anyOf = __commonJS({
5785
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js"(exports) {
5786
- Object.defineProperty(exports, "__esModule", { value: true });
5787
- var code_1 = require_code2();
5788
- var def = {
5789
- keyword: "anyOf",
5790
- schemaType: "array",
5791
- trackErrors: true,
5792
- code: code_1.validateUnion,
5793
- error: { message: "must match a schema in anyOf" }
5439
+ }
5794
5440
  };
5795
5441
  exports.default = def;
5796
5442
  }
5797
5443
  });
5798
5444
 
5799
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js
5800
- var require_oneOf = __commonJS({
5801
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js"(exports) {
5445
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js
5446
+ var require_enum = __commonJS({
5447
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js"(exports) {
5802
5448
  Object.defineProperty(exports, "__esModule", { value: true });
5803
5449
  var codegen_1 = require_codegen();
5804
5450
  var util_1 = require_util();
5451
+ var equal_1 = require_equal();
5805
5452
  var error2 = {
5806
- message: "must match exactly one schema in oneOf",
5807
- params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}`
5453
+ message: "must be equal to one of the allowed values",
5454
+ params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}`
5808
5455
  };
5809
5456
  var def = {
5810
- keyword: "oneOf",
5457
+ keyword: "enum",
5811
5458
  schemaType: "array",
5812
- trackErrors: true,
5459
+ $data: true,
5813
5460
  error: error2,
5814
5461
  code(cxt) {
5815
- const { gen, schema, parentSchema, it } = cxt;
5816
- if (!Array.isArray(schema))
5817
- throw new Error("ajv implementation error");
5818
- if (it.opts.discriminator && parentSchema.discriminator)
5819
- return;
5820
- const schArr = schema;
5821
- const valid = gen.let("valid", false);
5822
- const passing = gen.let("passing", null);
5823
- const schValid = gen.name("_valid");
5824
- cxt.setParams({ passing });
5825
- gen.block(validateOneOf);
5826
- cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
5827
- function validateOneOf() {
5828
- schArr.forEach((sch, i) => {
5829
- let schCxt;
5830
- if ((0, util_1.alwaysValidSchema)(it, sch)) {
5831
- gen.var(schValid, true);
5832
- } else {
5833
- schCxt = cxt.subschema({
5834
- keyword: "oneOf",
5835
- schemaProp: i,
5836
- compositeRule: true
5837
- }, schValid);
5838
- }
5839
- if (i > 0) {
5840
- gen.if((0, codegen_1._)`${schValid} && ${valid}`).assign(valid, false).assign(passing, (0, codegen_1._)`[${passing}, ${i}]`).else();
5841
- }
5842
- gen.if(schValid, () => {
5843
- gen.assign(valid, true);
5844
- gen.assign(passing, i);
5845
- if (schCxt)
5846
- cxt.mergeEvaluated(schCxt, codegen_1.Name);
5847
- });
5848
- });
5462
+ const { gen, data, $data, schema, schemaCode, it } = cxt;
5463
+ if (!$data && schema.length === 0)
5464
+ throw new Error("enum must have non-empty array");
5465
+ const useLoop = schema.length >= it.opts.loopEnum;
5466
+ let eql;
5467
+ const getEql = () => eql !== null && eql !== void 0 ? eql : eql = (0, util_1.useFunc)(gen, equal_1.default);
5468
+ let valid;
5469
+ if (useLoop || $data) {
5470
+ valid = gen.let("valid");
5471
+ cxt.block$data(valid, loopEnum);
5472
+ } else {
5473
+ if (!Array.isArray(schema))
5474
+ throw new Error("ajv implementation error");
5475
+ const vSchema = gen.const("vSchema", schemaCode);
5476
+ valid = (0, codegen_1.or)(...schema.map((_x, i) => equalCode(vSchema, i)));
5477
+ }
5478
+ cxt.pass(valid);
5479
+ function loopEnum() {
5480
+ gen.assign(valid, false);
5481
+ gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._)`${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break()));
5482
+ }
5483
+ function equalCode(vSchema, i) {
5484
+ const sch = schema[i];
5485
+ return typeof sch === "object" && sch !== null ? (0, codegen_1._)`${getEql()}(${data}, ${vSchema}[${i}])` : (0, codegen_1._)`${data} === ${sch}`;
5849
5486
  }
5850
5487
  }
5851
5488
  };
@@ -5853,410 +5490,584 @@ var require_oneOf = __commonJS({
5853
5490
  }
5854
5491
  });
5855
5492
 
5856
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js
5857
- var require_allOf = __commonJS({
5858
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js"(exports) {
5493
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js
5494
+ var require_validation2 = __commonJS({
5495
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js"(exports) {
5859
5496
  Object.defineProperty(exports, "__esModule", { value: true });
5860
- var util_1 = require_util();
5861
- var def = {
5862
- keyword: "allOf",
5863
- schemaType: "array",
5864
- code(cxt) {
5865
- const { gen, schema, it } = cxt;
5866
- if (!Array.isArray(schema))
5867
- throw new Error("ajv implementation error");
5868
- const valid = gen.name("valid");
5869
- schema.forEach((sch, i) => {
5870
- if ((0, util_1.alwaysValidSchema)(it, sch))
5871
- return;
5872
- const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i }, valid);
5873
- cxt.ok(valid);
5874
- cxt.mergeEvaluated(schCxt);
5875
- });
5876
- }
5877
- };
5878
- exports.default = def;
5497
+ var limitNumber_1 = require_limitNumber();
5498
+ var multipleOf_1 = require_multipleOf();
5499
+ var limitLength_1 = require_limitLength();
5500
+ var pattern_1 = require_pattern();
5501
+ var limitProperties_1 = require_limitProperties();
5502
+ var required_1 = require_required();
5503
+ var limitItems_1 = require_limitItems();
5504
+ var uniqueItems_1 = require_uniqueItems();
5505
+ var const_1 = require_const();
5506
+ var enum_1 = require_enum();
5507
+ var validation = [
5508
+ // number
5509
+ limitNumber_1.default,
5510
+ multipleOf_1.default,
5511
+ // string
5512
+ limitLength_1.default,
5513
+ pattern_1.default,
5514
+ // object
5515
+ limitProperties_1.default,
5516
+ required_1.default,
5517
+ // array
5518
+ limitItems_1.default,
5519
+ uniqueItems_1.default,
5520
+ // any
5521
+ { keyword: "type", schemaType: ["string", "array"] },
5522
+ { keyword: "nullable", schemaType: "boolean" },
5523
+ const_1.default,
5524
+ enum_1.default
5525
+ ];
5526
+ exports.default = validation;
5879
5527
  }
5880
5528
  });
5881
5529
 
5882
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js
5883
- var require_if = __commonJS({
5884
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js"(exports) {
5530
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js
5531
+ var require_additionalItems = __commonJS({
5532
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js"(exports) {
5885
5533
  Object.defineProperty(exports, "__esModule", { value: true });
5534
+ exports.validateAdditionalItems = void 0;
5886
5535
  var codegen_1 = require_codegen();
5887
5536
  var util_1 = require_util();
5888
5537
  var error2 = {
5889
- message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`,
5890
- params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`
5538
+ message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
5539
+ params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
5891
5540
  };
5892
5541
  var def = {
5893
- keyword: "if",
5894
- schemaType: ["object", "boolean"],
5895
- trackErrors: true,
5542
+ keyword: "additionalItems",
5543
+ type: "array",
5544
+ schemaType: ["boolean", "object"],
5545
+ before: "uniqueItems",
5896
5546
  error: error2,
5897
5547
  code(cxt) {
5898
- const { gen, parentSchema, it } = cxt;
5899
- if (parentSchema.then === void 0 && parentSchema.else === void 0) {
5900
- (0, util_1.checkStrictMode)(it, '"if" without "then" and "else" is ignored');
5901
- }
5902
- const hasThen = hasSchema(it, "then");
5903
- const hasElse = hasSchema(it, "else");
5904
- if (!hasThen && !hasElse)
5548
+ const { parentSchema, it } = cxt;
5549
+ const { items } = parentSchema;
5550
+ if (!Array.isArray(items)) {
5551
+ (0, util_1.checkStrictMode)(it, '"additionalItems" is ignored when "items" is not an array of schemas');
5905
5552
  return;
5906
- const valid = gen.let("valid", true);
5907
- const schValid = gen.name("_valid");
5908
- validateIf();
5909
- cxt.reset();
5910
- if (hasThen && hasElse) {
5911
- const ifClause = gen.let("ifClause");
5912
- cxt.setParams({ ifClause });
5913
- gen.if(schValid, validateClause("then", ifClause), validateClause("else", ifClause));
5914
- } else if (hasThen) {
5915
- gen.if(schValid, validateClause("then"));
5916
- } else {
5917
- gen.if((0, codegen_1.not)(schValid), validateClause("else"));
5918
- }
5919
- cxt.pass(valid, () => cxt.error(true));
5920
- function validateIf() {
5921
- const schCxt = cxt.subschema({
5922
- keyword: "if",
5923
- compositeRule: true,
5924
- createErrors: false,
5925
- allErrors: false
5926
- }, schValid);
5927
- cxt.mergeEvaluated(schCxt);
5928
- }
5929
- function validateClause(keyword, ifClause) {
5930
- return () => {
5931
- const schCxt = cxt.subschema({ keyword }, schValid);
5932
- gen.assign(valid, schValid);
5933
- cxt.mergeValidEvaluated(schCxt, valid);
5934
- if (ifClause)
5935
- gen.assign(ifClause, (0, codegen_1._)`${keyword}`);
5936
- else
5937
- cxt.setParams({ ifClause: keyword });
5938
- };
5939
5553
  }
5554
+ validateAdditionalItems(cxt, items);
5940
5555
  }
5941
5556
  };
5942
- function hasSchema(it, keyword) {
5943
- const schema = it.schema[keyword];
5944
- return schema !== void 0 && !(0, util_1.alwaysValidSchema)(it, schema);
5557
+ function validateAdditionalItems(cxt, items) {
5558
+ const { gen, schema, data, keyword, it } = cxt;
5559
+ it.items = true;
5560
+ const len = gen.const("len", (0, codegen_1._)`${data}.length`);
5561
+ if (schema === false) {
5562
+ cxt.setParams({ len: items.length });
5563
+ cxt.pass((0, codegen_1._)`${len} <= ${items.length}`);
5564
+ } else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
5565
+ const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items.length}`);
5566
+ gen.if((0, codegen_1.not)(valid), () => validateItems(valid));
5567
+ cxt.ok(valid);
5568
+ }
5569
+ function validateItems(valid) {
5570
+ gen.forRange("i", items.length, len, (i) => {
5571
+ cxt.subschema({ keyword, dataProp: i, dataPropType: util_1.Type.Num }, valid);
5572
+ if (!it.allErrors)
5573
+ gen.if((0, codegen_1.not)(valid), () => gen.break());
5574
+ });
5575
+ }
5945
5576
  }
5577
+ exports.validateAdditionalItems = validateAdditionalItems;
5946
5578
  exports.default = def;
5947
5579
  }
5948
5580
  });
5949
5581
 
5950
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js
5951
- var require_thenElse = __commonJS({
5952
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js"(exports) {
5582
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js
5583
+ var require_items = __commonJS({
5584
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js"(exports) {
5953
5585
  Object.defineProperty(exports, "__esModule", { value: true });
5586
+ exports.validateTuple = void 0;
5587
+ var codegen_1 = require_codegen();
5954
5588
  var util_1 = require_util();
5589
+ var code_1 = require_code2();
5955
5590
  var def = {
5956
- keyword: ["then", "else"],
5957
- schemaType: ["object", "boolean"],
5958
- code({ keyword, parentSchema, it }) {
5959
- if (parentSchema.if === void 0)
5960
- (0, util_1.checkStrictMode)(it, `"${keyword}" without "if" is ignored`);
5591
+ keyword: "items",
5592
+ type: "array",
5593
+ schemaType: ["object", "array", "boolean"],
5594
+ before: "uniqueItems",
5595
+ code(cxt) {
5596
+ const { schema, it } = cxt;
5597
+ if (Array.isArray(schema))
5598
+ return validateTuple(cxt, "additionalItems", schema);
5599
+ it.items = true;
5600
+ if ((0, util_1.alwaysValidSchema)(it, schema))
5601
+ return;
5602
+ cxt.ok((0, code_1.validateArray)(cxt));
5961
5603
  }
5962
5604
  };
5605
+ function validateTuple(cxt, extraItems, schArr = cxt.schema) {
5606
+ const { gen, parentSchema, data, keyword, it } = cxt;
5607
+ checkStrictTuple(parentSchema);
5608
+ if (it.opts.unevaluated && schArr.length && it.items !== true) {
5609
+ it.items = util_1.mergeEvaluated.items(gen, schArr.length, it.items);
5610
+ }
5611
+ const valid = gen.name("valid");
5612
+ const len = gen.const("len", (0, codegen_1._)`${data}.length`);
5613
+ schArr.forEach((sch, i) => {
5614
+ if ((0, util_1.alwaysValidSchema)(it, sch))
5615
+ return;
5616
+ gen.if((0, codegen_1._)`${len} > ${i}`, () => cxt.subschema({
5617
+ keyword,
5618
+ schemaProp: i,
5619
+ dataProp: i
5620
+ }, valid));
5621
+ cxt.ok(valid);
5622
+ });
5623
+ function checkStrictTuple(sch) {
5624
+ const { opts, errSchemaPath } = it;
5625
+ const l = schArr.length;
5626
+ const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false);
5627
+ if (opts.strictTuples && !fullTuple) {
5628
+ const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"`;
5629
+ (0, util_1.checkStrictMode)(it, msg, opts.strictTuples);
5630
+ }
5631
+ }
5632
+ }
5633
+ exports.validateTuple = validateTuple;
5963
5634
  exports.default = def;
5964
5635
  }
5965
5636
  });
5966
5637
 
5967
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js
5968
- var require_applicator = __commonJS({
5969
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js"(exports) {
5638
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js
5639
+ var require_prefixItems = __commonJS({
5640
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js"(exports) {
5970
5641
  Object.defineProperty(exports, "__esModule", { value: true });
5971
- var additionalItems_1 = require_additionalItems();
5972
- var prefixItems_1 = require_prefixItems();
5973
5642
  var items_1 = require_items();
5974
- var items2020_1 = require_items2020();
5975
- var contains_1 = require_contains();
5976
- var dependencies_1 = require_dependencies();
5977
- var propertyNames_1 = require_propertyNames();
5978
- var additionalProperties_1 = require_additionalProperties();
5979
- var properties_1 = require_properties();
5980
- var patternProperties_1 = require_patternProperties();
5981
- var not_1 = require_not();
5982
- var anyOf_1 = require_anyOf();
5983
- var oneOf_1 = require_oneOf();
5984
- var allOf_1 = require_allOf();
5985
- var if_1 = require_if();
5986
- var thenElse_1 = require_thenElse();
5987
- function getApplicator(draft2020 = false) {
5988
- const applicator = [
5989
- // any
5990
- not_1.default,
5991
- anyOf_1.default,
5992
- oneOf_1.default,
5993
- allOf_1.default,
5994
- if_1.default,
5995
- thenElse_1.default,
5996
- // object
5997
- propertyNames_1.default,
5998
- additionalProperties_1.default,
5999
- dependencies_1.default,
6000
- properties_1.default,
6001
- patternProperties_1.default
6002
- ];
6003
- if (draft2020)
6004
- applicator.push(prefixItems_1.default, items2020_1.default);
6005
- else
6006
- applicator.push(additionalItems_1.default, items_1.default);
6007
- applicator.push(contains_1.default);
6008
- return applicator;
6009
- }
6010
- exports.default = getApplicator;
5643
+ var def = {
5644
+ keyword: "prefixItems",
5645
+ type: "array",
5646
+ schemaType: ["array"],
5647
+ before: "uniqueItems",
5648
+ code: (cxt) => (0, items_1.validateTuple)(cxt, "items")
5649
+ };
5650
+ exports.default = def;
6011
5651
  }
6012
5652
  });
6013
-
6014
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js
6015
- var require_dynamicAnchor = __commonJS({
6016
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js"(exports) {
5653
+
5654
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js
5655
+ var require_items2020 = __commonJS({
5656
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js"(exports) {
6017
5657
  Object.defineProperty(exports, "__esModule", { value: true });
6018
- exports.dynamicAnchor = void 0;
6019
5658
  var codegen_1 = require_codegen();
6020
- var names_1 = require_names();
6021
- var compile_1 = require_compile();
6022
- var ref_1 = require_ref();
5659
+ var util_1 = require_util();
5660
+ var code_1 = require_code2();
5661
+ var additionalItems_1 = require_additionalItems();
5662
+ var error2 = {
5663
+ message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
5664
+ params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
5665
+ };
6023
5666
  var def = {
6024
- keyword: "$dynamicAnchor",
6025
- schemaType: "string",
6026
- code: (cxt) => dynamicAnchor(cxt, cxt.schema)
5667
+ keyword: "items",
5668
+ type: "array",
5669
+ schemaType: ["object", "boolean"],
5670
+ before: "uniqueItems",
5671
+ error: error2,
5672
+ code(cxt) {
5673
+ const { schema, parentSchema, it } = cxt;
5674
+ const { prefixItems } = parentSchema;
5675
+ it.items = true;
5676
+ if ((0, util_1.alwaysValidSchema)(it, schema))
5677
+ return;
5678
+ if (prefixItems)
5679
+ (0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems);
5680
+ else
5681
+ cxt.ok((0, code_1.validateArray)(cxt));
5682
+ }
6027
5683
  };
6028
- function dynamicAnchor(cxt, anchor) {
6029
- const { gen, it } = cxt;
6030
- it.schemaEnv.root.dynamicAnchors[anchor] = true;
6031
- const v = (0, codegen_1._)`${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`;
6032
- const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt);
6033
- gen.if((0, codegen_1._)`!${v}`, () => gen.assign(v, validate));
6034
- }
6035
- exports.dynamicAnchor = dynamicAnchor;
6036
- function _getValidate(cxt) {
6037
- const { schemaEnv, schema, self } = cxt.it;
6038
- const { root, baseId, localRefs, meta } = schemaEnv.root;
6039
- const { schemaId } = self.opts;
6040
- const sch = new compile_1.SchemaEnv({ schema, schemaId, root, baseId, localRefs, meta });
6041
- compile_1.compileSchema.call(self, sch);
6042
- return (0, ref_1.getValidate)(cxt, sch);
6043
- }
6044
5684
  exports.default = def;
6045
5685
  }
6046
5686
  });
6047
5687
 
6048
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js
6049
- var require_dynamicRef = __commonJS({
6050
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js"(exports) {
5688
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js
5689
+ var require_contains = __commonJS({
5690
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js"(exports) {
6051
5691
  Object.defineProperty(exports, "__esModule", { value: true });
6052
- exports.dynamicRef = void 0;
6053
5692
  var codegen_1 = require_codegen();
6054
- var names_1 = require_names();
6055
- var ref_1 = require_ref();
6056
- var def = {
6057
- keyword: "$dynamicRef",
6058
- schemaType: "string",
6059
- code: (cxt) => dynamicRef(cxt, cxt.schema)
5693
+ var util_1 = require_util();
5694
+ var error2 = {
5695
+ message: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`,
5696
+ params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`
6060
5697
  };
6061
- function dynamicRef(cxt, ref) {
6062
- const { gen, keyword, it } = cxt;
6063
- if (ref[0] !== "#")
6064
- throw new Error(`"${keyword}" only supports hash fragment reference`);
6065
- const anchor = ref.slice(1);
6066
- if (it.allErrors) {
6067
- _dynamicRef();
6068
- } else {
6069
- const valid = gen.let("valid", false);
6070
- _dynamicRef(valid);
6071
- cxt.ok(valid);
6072
- }
6073
- function _dynamicRef(valid) {
6074
- if (it.schemaEnv.root.dynamicAnchors[anchor]) {
6075
- const v = gen.let("_v", (0, codegen_1._)`${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`);
6076
- gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid));
5698
+ var def = {
5699
+ keyword: "contains",
5700
+ type: "array",
5701
+ schemaType: ["object", "boolean"],
5702
+ before: "uniqueItems",
5703
+ trackErrors: true,
5704
+ error: error2,
5705
+ code(cxt) {
5706
+ const { gen, schema, parentSchema, data, it } = cxt;
5707
+ let min;
5708
+ let max;
5709
+ const { minContains, maxContains } = parentSchema;
5710
+ if (it.opts.next) {
5711
+ min = minContains === void 0 ? 1 : minContains;
5712
+ max = maxContains;
6077
5713
  } else {
6078
- _callRef(it.validateName, valid)();
5714
+ min = 1;
6079
5715
  }
6080
- }
6081
- function _callRef(validate, valid) {
6082
- return valid ? () => gen.block(() => {
6083
- (0, ref_1.callRef)(cxt, validate);
5716
+ const len = gen.const("len", (0, codegen_1._)`${data}.length`);
5717
+ cxt.setParams({ min, max });
5718
+ if (max === void 0 && min === 0) {
5719
+ (0, util_1.checkStrictMode)(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`);
5720
+ return;
5721
+ }
5722
+ if (max !== void 0 && min > max) {
5723
+ (0, util_1.checkStrictMode)(it, `"minContains" > "maxContains" is always invalid`);
5724
+ cxt.fail();
5725
+ return;
5726
+ }
5727
+ if ((0, util_1.alwaysValidSchema)(it, schema)) {
5728
+ let cond = (0, codegen_1._)`${len} >= ${min}`;
5729
+ if (max !== void 0)
5730
+ cond = (0, codegen_1._)`${cond} && ${len} <= ${max}`;
5731
+ cxt.pass(cond);
5732
+ return;
5733
+ }
5734
+ it.items = true;
5735
+ const valid = gen.name("valid");
5736
+ if (max === void 0 && min === 1) {
5737
+ validateItems(valid, () => gen.if(valid, () => gen.break()));
5738
+ } else if (min === 0) {
6084
5739
  gen.let(valid, true);
6085
- }) : () => (0, ref_1.callRef)(cxt, validate);
5740
+ if (max !== void 0)
5741
+ gen.if((0, codegen_1._)`${data}.length > 0`, validateItemsWithCount);
5742
+ } else {
5743
+ gen.let(valid, false);
5744
+ validateItemsWithCount();
5745
+ }
5746
+ cxt.result(valid, () => cxt.reset());
5747
+ function validateItemsWithCount() {
5748
+ const schValid = gen.name("_valid");
5749
+ const count = gen.let("count", 0);
5750
+ validateItems(schValid, () => gen.if(schValid, () => checkLimits(count)));
5751
+ }
5752
+ function validateItems(_valid, block) {
5753
+ gen.forRange("i", 0, len, (i) => {
5754
+ cxt.subschema({
5755
+ keyword: "contains",
5756
+ dataProp: i,
5757
+ dataPropType: util_1.Type.Num,
5758
+ compositeRule: true
5759
+ }, _valid);
5760
+ block();
5761
+ });
5762
+ }
5763
+ function checkLimits(count) {
5764
+ gen.code((0, codegen_1._)`${count}++`);
5765
+ if (max === void 0) {
5766
+ gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true).break());
5767
+ } else {
5768
+ gen.if((0, codegen_1._)`${count} > ${max}`, () => gen.assign(valid, false).break());
5769
+ if (min === 1)
5770
+ gen.assign(valid, true);
5771
+ else
5772
+ gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true));
5773
+ }
5774
+ }
6086
5775
  }
6087
- }
6088
- exports.dynamicRef = dynamicRef;
5776
+ };
6089
5777
  exports.default = def;
6090
5778
  }
6091
5779
  });
6092
5780
 
6093
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js
6094
- var require_recursiveAnchor = __commonJS({
6095
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js"(exports) {
5781
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js
5782
+ var require_dependencies = __commonJS({
5783
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js"(exports) {
6096
5784
  Object.defineProperty(exports, "__esModule", { value: true });
6097
- var dynamicAnchor_1 = require_dynamicAnchor();
5785
+ exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0;
5786
+ var codegen_1 = require_codegen();
6098
5787
  var util_1 = require_util();
5788
+ var code_1 = require_code2();
5789
+ exports.error = {
5790
+ message: ({ params: { property, depsCount, deps } }) => {
5791
+ const property_ies = depsCount === 1 ? "property" : "properties";
5792
+ return (0, codegen_1.str)`must have ${property_ies} ${deps} when property ${property} is present`;
5793
+ },
5794
+ params: ({ params: { property, depsCount, deps, missingProperty } }) => (0, codegen_1._)`{property: ${property},
5795
+ missingProperty: ${missingProperty},
5796
+ depsCount: ${depsCount},
5797
+ deps: ${deps}}`
5798
+ // TODO change to reference
5799
+ };
6099
5800
  var def = {
6100
- keyword: "$recursiveAnchor",
6101
- schemaType: "boolean",
5801
+ keyword: "dependencies",
5802
+ type: "object",
5803
+ schemaType: "object",
5804
+ error: exports.error,
6102
5805
  code(cxt) {
6103
- if (cxt.schema)
6104
- (0, dynamicAnchor_1.dynamicAnchor)(cxt, "");
6105
- else
6106
- (0, util_1.checkStrictMode)(cxt.it, "$recursiveAnchor: false is ignored");
5806
+ const [propDeps, schDeps] = splitDependencies(cxt);
5807
+ validatePropertyDeps(cxt, propDeps);
5808
+ validateSchemaDeps(cxt, schDeps);
5809
+ }
5810
+ };
5811
+ function splitDependencies({ schema }) {
5812
+ const propertyDeps = {};
5813
+ const schemaDeps = {};
5814
+ for (const key in schema) {
5815
+ if (key === "__proto__")
5816
+ continue;
5817
+ const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps;
5818
+ deps[key] = schema[key];
5819
+ }
5820
+ return [propertyDeps, schemaDeps];
5821
+ }
5822
+ function validatePropertyDeps(cxt, propertyDeps = cxt.schema) {
5823
+ const { gen, data, it } = cxt;
5824
+ if (Object.keys(propertyDeps).length === 0)
5825
+ return;
5826
+ const missing = gen.let("missing");
5827
+ for (const prop in propertyDeps) {
5828
+ const deps = propertyDeps[prop];
5829
+ if (deps.length === 0)
5830
+ continue;
5831
+ const hasProperty = (0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties);
5832
+ cxt.setParams({
5833
+ property: prop,
5834
+ depsCount: deps.length,
5835
+ deps: deps.join(", ")
5836
+ });
5837
+ if (it.allErrors) {
5838
+ gen.if(hasProperty, () => {
5839
+ for (const depProp of deps) {
5840
+ (0, code_1.checkReportMissingProp)(cxt, depProp);
5841
+ }
5842
+ });
5843
+ } else {
5844
+ gen.if((0, codegen_1._)`${hasProperty} && (${(0, code_1.checkMissingProp)(cxt, deps, missing)})`);
5845
+ (0, code_1.reportMissingProp)(cxt, missing);
5846
+ gen.else();
5847
+ }
5848
+ }
5849
+ }
5850
+ exports.validatePropertyDeps = validatePropertyDeps;
5851
+ function validateSchemaDeps(cxt, schemaDeps = cxt.schema) {
5852
+ const { gen, data, keyword, it } = cxt;
5853
+ const valid = gen.name("valid");
5854
+ for (const prop in schemaDeps) {
5855
+ if ((0, util_1.alwaysValidSchema)(it, schemaDeps[prop]))
5856
+ continue;
5857
+ gen.if(
5858
+ (0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties),
5859
+ () => {
5860
+ const schCxt = cxt.subschema({ keyword, schemaProp: prop }, valid);
5861
+ cxt.mergeValidEvaluated(schCxt, valid);
5862
+ },
5863
+ () => gen.var(valid, true)
5864
+ // TODO var
5865
+ );
5866
+ cxt.ok(valid);
6107
5867
  }
6108
- };
6109
- exports.default = def;
6110
- }
6111
- });
6112
-
6113
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js
6114
- var require_recursiveRef = __commonJS({
6115
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js"(exports) {
6116
- Object.defineProperty(exports, "__esModule", { value: true });
6117
- var dynamicRef_1 = require_dynamicRef();
6118
- var def = {
6119
- keyword: "$recursiveRef",
6120
- schemaType: "string",
6121
- code: (cxt) => (0, dynamicRef_1.dynamicRef)(cxt, cxt.schema)
6122
- };
5868
+ }
5869
+ exports.validateSchemaDeps = validateSchemaDeps;
6123
5870
  exports.default = def;
6124
5871
  }
6125
5872
  });
6126
5873
 
6127
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js
6128
- var require_dynamic = __commonJS({
6129
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js"(exports) {
6130
- Object.defineProperty(exports, "__esModule", { value: true });
6131
- var dynamicAnchor_1 = require_dynamicAnchor();
6132
- var dynamicRef_1 = require_dynamicRef();
6133
- var recursiveAnchor_1 = require_recursiveAnchor();
6134
- var recursiveRef_1 = require_recursiveRef();
6135
- var dynamic = [dynamicAnchor_1.default, dynamicRef_1.default, recursiveAnchor_1.default, recursiveRef_1.default];
6136
- exports.default = dynamic;
6137
- }
6138
- });
6139
-
6140
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js
6141
- var require_dependentRequired = __commonJS({
6142
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js"(exports) {
5874
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js
5875
+ var require_propertyNames = __commonJS({
5876
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js"(exports) {
6143
5877
  Object.defineProperty(exports, "__esModule", { value: true });
6144
- var dependencies_1 = require_dependencies();
6145
- var def = {
6146
- keyword: "dependentRequired",
6147
- type: "object",
6148
- schemaType: "object",
6149
- error: dependencies_1.error,
6150
- code: (cxt) => (0, dependencies_1.validatePropertyDeps)(cxt)
5878
+ var codegen_1 = require_codegen();
5879
+ var util_1 = require_util();
5880
+ var error2 = {
5881
+ message: "property name must be valid",
5882
+ params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}`
6151
5883
  };
6152
- exports.default = def;
6153
- }
6154
- });
6155
-
6156
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js
6157
- var require_dependentSchemas = __commonJS({
6158
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js"(exports) {
6159
- Object.defineProperty(exports, "__esModule", { value: true });
6160
- var dependencies_1 = require_dependencies();
6161
5884
  var def = {
6162
- keyword: "dependentSchemas",
5885
+ keyword: "propertyNames",
6163
5886
  type: "object",
6164
- schemaType: "object",
6165
- code: (cxt) => (0, dependencies_1.validateSchemaDeps)(cxt)
6166
- };
6167
- exports.default = def;
6168
- }
6169
- });
6170
-
6171
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js
6172
- var require_limitContains = __commonJS({
6173
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js"(exports) {
6174
- Object.defineProperty(exports, "__esModule", { value: true });
6175
- var util_1 = require_util();
6176
- var def = {
6177
- keyword: ["maxContains", "minContains"],
6178
- type: "array",
6179
- schemaType: "number",
6180
- code({ keyword, parentSchema, it }) {
6181
- if (parentSchema.contains === void 0) {
6182
- (0, util_1.checkStrictMode)(it, `"${keyword}" without "contains" is ignored`);
6183
- }
5887
+ schemaType: ["object", "boolean"],
5888
+ error: error2,
5889
+ code(cxt) {
5890
+ const { gen, schema, data, it } = cxt;
5891
+ if ((0, util_1.alwaysValidSchema)(it, schema))
5892
+ return;
5893
+ const valid = gen.name("valid");
5894
+ gen.forIn("key", data, (key) => {
5895
+ cxt.setParams({ propertyName: key });
5896
+ cxt.subschema({
5897
+ keyword: "propertyNames",
5898
+ data: key,
5899
+ dataTypes: ["string"],
5900
+ propertyName: key,
5901
+ compositeRule: true
5902
+ }, valid);
5903
+ gen.if((0, codegen_1.not)(valid), () => {
5904
+ cxt.error(true);
5905
+ if (!it.allErrors)
5906
+ gen.break();
5907
+ });
5908
+ });
5909
+ cxt.ok(valid);
6184
5910
  }
6185
5911
  };
6186
5912
  exports.default = def;
6187
5913
  }
6188
5914
  });
6189
5915
 
6190
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js
6191
- var require_next = __commonJS({
6192
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js"(exports) {
6193
- Object.defineProperty(exports, "__esModule", { value: true });
6194
- var dependentRequired_1 = require_dependentRequired();
6195
- var dependentSchemas_1 = require_dependentSchemas();
6196
- var limitContains_1 = require_limitContains();
6197
- var next = [dependentRequired_1.default, dependentSchemas_1.default, limitContains_1.default];
6198
- exports.default = next;
6199
- }
6200
- });
6201
-
6202
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js
6203
- var require_unevaluatedProperties = __commonJS({
6204
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js"(exports) {
5916
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js
5917
+ var require_additionalProperties = __commonJS({
5918
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js"(exports) {
6205
5919
  Object.defineProperty(exports, "__esModule", { value: true });
5920
+ var code_1 = require_code2();
6206
5921
  var codegen_1 = require_codegen();
6207
- var util_1 = require_util();
6208
5922
  var names_1 = require_names();
5923
+ var util_1 = require_util();
6209
5924
  var error2 = {
6210
- message: "must NOT have unevaluated properties",
6211
- params: ({ params }) => (0, codegen_1._)`{unevaluatedProperty: ${params.unevaluatedProperty}}`
5925
+ message: "must NOT have additional properties",
5926
+ params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}`
6212
5927
  };
6213
5928
  var def = {
6214
- keyword: "unevaluatedProperties",
6215
- type: "object",
5929
+ keyword: "additionalProperties",
5930
+ type: ["object"],
6216
5931
  schemaType: ["boolean", "object"],
5932
+ allowUndefined: true,
6217
5933
  trackErrors: true,
6218
5934
  error: error2,
6219
5935
  code(cxt) {
6220
- const { gen, schema, data, errsCount, it } = cxt;
5936
+ const { gen, schema, parentSchema, data, errsCount, it } = cxt;
6221
5937
  if (!errsCount)
6222
5938
  throw new Error("ajv implementation error");
6223
- const { allErrors, props } = it;
6224
- if (props instanceof codegen_1.Name) {
6225
- gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key))));
6226
- } else if (props !== true) {
6227
- gen.forIn("key", data, (key) => props === void 0 ? unevaluatedPropCode(key) : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key)));
6228
- }
5939
+ const { allErrors, opts } = it;
6229
5940
  it.props = true;
5941
+ if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema))
5942
+ return;
5943
+ const props = (0, code_1.allSchemaProperties)(parentSchema.properties);
5944
+ const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties);
5945
+ checkAdditionalProperties();
6230
5946
  cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
6231
- function unevaluatedPropCode(key) {
5947
+ function checkAdditionalProperties() {
5948
+ gen.forIn("key", data, (key) => {
5949
+ if (!props.length && !patProps.length)
5950
+ additionalPropertyCode(key);
5951
+ else
5952
+ gen.if(isAdditional(key), () => additionalPropertyCode(key));
5953
+ });
5954
+ }
5955
+ function isAdditional(key) {
5956
+ let definedProp;
5957
+ if (props.length > 8) {
5958
+ const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties");
5959
+ definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key);
5960
+ } else if (props.length) {
5961
+ definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._)`${key} === ${p}`));
5962
+ } else {
5963
+ definedProp = codegen_1.nil;
5964
+ }
5965
+ if (patProps.length) {
5966
+ definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p)}.test(${key})`));
5967
+ }
5968
+ return (0, codegen_1.not)(definedProp);
5969
+ }
5970
+ function deleteAdditional(key) {
5971
+ gen.code((0, codegen_1._)`delete ${data}[${key}]`);
5972
+ }
5973
+ function additionalPropertyCode(key) {
5974
+ if (opts.removeAdditional === "all" || opts.removeAdditional && schema === false) {
5975
+ deleteAdditional(key);
5976
+ return;
5977
+ }
6232
5978
  if (schema === false) {
6233
- cxt.setParams({ unevaluatedProperty: key });
5979
+ cxt.setParams({ additionalProperty: key });
6234
5980
  cxt.error();
6235
5981
  if (!allErrors)
6236
5982
  gen.break();
6237
5983
  return;
6238
5984
  }
6239
- if (!(0, util_1.alwaysValidSchema)(it, schema)) {
5985
+ if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
6240
5986
  const valid = gen.name("valid");
6241
- cxt.subschema({
6242
- keyword: "unevaluatedProperties",
6243
- dataProp: key,
6244
- dataPropType: util_1.Type.Str
6245
- }, valid);
6246
- if (!allErrors)
6247
- gen.if((0, codegen_1.not)(valid), () => gen.break());
5987
+ if (opts.removeAdditional === "failing") {
5988
+ applyAdditionalSchema(key, valid, false);
5989
+ gen.if((0, codegen_1.not)(valid), () => {
5990
+ cxt.reset();
5991
+ deleteAdditional(key);
5992
+ });
5993
+ } else {
5994
+ applyAdditionalSchema(key, valid);
5995
+ if (!allErrors)
5996
+ gen.if((0, codegen_1.not)(valid), () => gen.break());
5997
+ }
5998
+ }
5999
+ }
6000
+ function applyAdditionalSchema(key, valid, errors) {
6001
+ const subschema = {
6002
+ keyword: "additionalProperties",
6003
+ dataProp: key,
6004
+ dataPropType: util_1.Type.Str
6005
+ };
6006
+ if (errors === false) {
6007
+ Object.assign(subschema, {
6008
+ compositeRule: true,
6009
+ createErrors: false,
6010
+ allErrors: false
6011
+ });
6012
+ }
6013
+ cxt.subschema(subschema, valid);
6014
+ }
6015
+ }
6016
+ };
6017
+ exports.default = def;
6018
+ }
6019
+ });
6020
+
6021
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js
6022
+ var require_properties = __commonJS({
6023
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js"(exports) {
6024
+ Object.defineProperty(exports, "__esModule", { value: true });
6025
+ var validate_1 = require_validate();
6026
+ var code_1 = require_code2();
6027
+ var util_1 = require_util();
6028
+ var additionalProperties_1 = require_additionalProperties();
6029
+ var def = {
6030
+ keyword: "properties",
6031
+ type: "object",
6032
+ schemaType: "object",
6033
+ code(cxt) {
6034
+ const { gen, schema, parentSchema, data, it } = cxt;
6035
+ if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === void 0) {
6036
+ additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties"));
6037
+ }
6038
+ const allProps = (0, code_1.allSchemaProperties)(schema);
6039
+ for (const prop of allProps) {
6040
+ it.definedProperties.add(prop);
6041
+ }
6042
+ if (it.opts.unevaluated && allProps.length && it.props !== true) {
6043
+ it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props);
6044
+ }
6045
+ const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p]));
6046
+ if (properties.length === 0)
6047
+ return;
6048
+ const valid = gen.name("valid");
6049
+ for (const prop of properties) {
6050
+ if (hasDefault(prop)) {
6051
+ applyPropertySchema(prop);
6052
+ } else {
6053
+ gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties));
6054
+ applyPropertySchema(prop);
6055
+ if (!it.allErrors)
6056
+ gen.else().var(valid, true);
6057
+ gen.endIf();
6248
6058
  }
6059
+ cxt.it.definedProperties.add(prop);
6060
+ cxt.ok(valid);
6249
6061
  }
6250
- function unevaluatedDynamic(evaluatedProps, key) {
6251
- return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${key}]`;
6062
+ function hasDefault(prop) {
6063
+ return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== void 0;
6252
6064
  }
6253
- function unevaluatedStatic(evaluatedProps, key) {
6254
- const ps = [];
6255
- for (const p in evaluatedProps) {
6256
- if (evaluatedProps[p] === true)
6257
- ps.push((0, codegen_1._)`${key} !== ${p}`);
6258
- }
6259
- return (0, codegen_1.and)(...ps);
6065
+ function applyPropertySchema(prop) {
6066
+ cxt.subschema({
6067
+ keyword: "properties",
6068
+ schemaProp: prop,
6069
+ dataProp: prop
6070
+ }, valid);
6260
6071
  }
6261
6072
  }
6262
6073
  };
@@ -6264,318 +6075,175 @@ var require_unevaluatedProperties = __commonJS({
6264
6075
  }
6265
6076
  });
6266
6077
 
6267
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js
6268
- var require_unevaluatedItems = __commonJS({
6269
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js"(exports) {
6078
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js
6079
+ var require_patternProperties = __commonJS({
6080
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js"(exports) {
6270
6081
  Object.defineProperty(exports, "__esModule", { value: true });
6082
+ var code_1 = require_code2();
6271
6083
  var codegen_1 = require_codegen();
6272
6084
  var util_1 = require_util();
6273
- var error2 = {
6274
- message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
6275
- params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
6276
- };
6085
+ var util_2 = require_util();
6277
6086
  var def = {
6278
- keyword: "unevaluatedItems",
6279
- type: "array",
6280
- schemaType: ["boolean", "object"],
6281
- error: error2,
6087
+ keyword: "patternProperties",
6088
+ type: "object",
6089
+ schemaType: "object",
6282
6090
  code(cxt) {
6283
- const { gen, schema, data, it } = cxt;
6284
- const items = it.items || 0;
6285
- if (items === true)
6091
+ const { gen, schema, data, parentSchema, it } = cxt;
6092
+ const { opts } = it;
6093
+ const patterns = (0, code_1.allSchemaProperties)(schema);
6094
+ const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema[p]));
6095
+ if (patterns.length === 0 || alwaysValidPatterns.length === patterns.length && (!it.opts.unevaluated || it.props === true)) {
6286
6096
  return;
6287
- const len = gen.const("len", (0, codegen_1._)`${data}.length`);
6288
- if (schema === false) {
6289
- cxt.setParams({ len: items });
6290
- cxt.fail((0, codegen_1._)`${len} > ${items}`);
6291
- } else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
6292
- const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items}`);
6293
- gen.if((0, codegen_1.not)(valid), () => validateItems(valid, items));
6294
- cxt.ok(valid);
6295
- }
6296
- it.items = true;
6297
- function validateItems(valid, from) {
6298
- gen.forRange("i", from, len, (i) => {
6299
- cxt.subschema({ keyword: "unevaluatedItems", dataProp: i, dataPropType: util_1.Type.Num }, valid);
6300
- if (!it.allErrors)
6301
- gen.if((0, codegen_1.not)(valid), () => gen.break());
6302
- });
6303
6097
  }
6304
- }
6305
- };
6306
- exports.default = def;
6307
- }
6308
- });
6309
-
6310
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js
6311
- var require_unevaluated = __commonJS({
6312
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js"(exports) {
6313
- Object.defineProperty(exports, "__esModule", { value: true });
6314
- var unevaluatedProperties_1 = require_unevaluatedProperties();
6315
- var unevaluatedItems_1 = require_unevaluatedItems();
6316
- var unevaluated = [unevaluatedProperties_1.default, unevaluatedItems_1.default];
6317
- exports.default = unevaluated;
6318
- }
6319
- });
6320
-
6321
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js
6322
- var require_format = __commonJS({
6323
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js"(exports) {
6324
- Object.defineProperty(exports, "__esModule", { value: true });
6325
- var codegen_1 = require_codegen();
6326
- var error2 = {
6327
- message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`,
6328
- params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}`
6329
- };
6330
- var def = {
6331
- keyword: "format",
6332
- type: ["number", "string"],
6333
- schemaType: "string",
6334
- $data: true,
6335
- error: error2,
6336
- code(cxt, ruleType) {
6337
- const { gen, data, $data, schema, schemaCode, it } = cxt;
6338
- const { opts, errSchemaPath, schemaEnv, self } = it;
6339
- if (!opts.validateFormats)
6340
- return;
6341
- if ($data)
6342
- validate$DataFormat();
6343
- else
6344
- validateFormat();
6345
- function validate$DataFormat() {
6346
- const fmts = gen.scopeValue("formats", {
6347
- ref: self.formats,
6348
- code: opts.code.formats
6349
- });
6350
- const fDef = gen.const("fDef", (0, codegen_1._)`${fmts}[${schemaCode}]`);
6351
- const fType = gen.let("fType");
6352
- const format = gen.let("format");
6353
- gen.if((0, codegen_1._)`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._)`${fDef}.type || "string"`).assign(format, (0, codegen_1._)`${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._)`"string"`).assign(format, fDef));
6354
- cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt()));
6355
- function unknownFmt() {
6356
- if (opts.strictSchema === false)
6357
- return codegen_1.nil;
6358
- return (0, codegen_1._)`${schemaCode} && !${format}`;
6359
- }
6360
- function invalidFmt() {
6361
- const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` : (0, codegen_1._)`${format}(${data})`;
6362
- const validData = (0, codegen_1._)`(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))`;
6363
- return (0, codegen_1._)`${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`;
6364
- }
6098
+ const checkProperties = opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties;
6099
+ const valid = gen.name("valid");
6100
+ if (it.props !== true && !(it.props instanceof codegen_1.Name)) {
6101
+ it.props = (0, util_2.evaluatedPropsToName)(gen, it.props);
6365
6102
  }
6366
- function validateFormat() {
6367
- const formatDef = self.formats[schema];
6368
- if (!formatDef) {
6369
- unknownFormat();
6370
- return;
6371
- }
6372
- if (formatDef === true)
6373
- return;
6374
- const [fmtType, format, fmtRef] = getFormat(formatDef);
6375
- if (fmtType === ruleType)
6376
- cxt.pass(validCondition());
6377
- function unknownFormat() {
6378
- if (opts.strictSchema === false) {
6379
- self.logger.warn(unknownMsg());
6380
- return;
6381
- }
6382
- throw new Error(unknownMsg());
6383
- function unknownMsg() {
6384
- return `unknown format "${schema}" ignored in schema at path "${errSchemaPath}"`;
6385
- }
6386
- }
6387
- function getFormat(fmtDef) {
6388
- const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(schema)}` : void 0;
6389
- const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code });
6390
- if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) {
6391
- return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._)`${fmt}.validate`];
6103
+ const { props } = it;
6104
+ validatePatternProperties();
6105
+ function validatePatternProperties() {
6106
+ for (const pat of patterns) {
6107
+ if (checkProperties)
6108
+ checkMatchingProperties(pat);
6109
+ if (it.allErrors) {
6110
+ validateProperties(pat);
6111
+ } else {
6112
+ gen.var(valid, true);
6113
+ validateProperties(pat);
6114
+ gen.if(valid);
6392
6115
  }
6393
- return ["string", fmtDef, fmt];
6394
6116
  }
6395
- function validCondition() {
6396
- if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) {
6397
- if (!schemaEnv.$async)
6398
- throw new Error("async format in sync schema");
6399
- return (0, codegen_1._)`await ${fmtRef}(${data})`;
6117
+ }
6118
+ function checkMatchingProperties(pat) {
6119
+ for (const prop in checkProperties) {
6120
+ if (new RegExp(pat).test(prop)) {
6121
+ (0, util_1.checkStrictMode)(it, `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`);
6400
6122
  }
6401
- return typeof format == "function" ? (0, codegen_1._)`${fmtRef}(${data})` : (0, codegen_1._)`${fmtRef}.test(${data})`;
6402
6123
  }
6403
6124
  }
6125
+ function validateProperties(pat) {
6126
+ gen.forIn("key", data, (key) => {
6127
+ gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${key})`, () => {
6128
+ const alwaysValid = alwaysValidPatterns.includes(pat);
6129
+ if (!alwaysValid) {
6130
+ cxt.subschema({
6131
+ keyword: "patternProperties",
6132
+ schemaProp: pat,
6133
+ dataProp: key,
6134
+ dataPropType: util_2.Type.Str
6135
+ }, valid);
6136
+ }
6137
+ if (it.opts.unevaluated && props !== true) {
6138
+ gen.assign((0, codegen_1._)`${props}[${key}]`, true);
6139
+ } else if (!alwaysValid && !it.allErrors) {
6140
+ gen.if((0, codegen_1.not)(valid), () => gen.break());
6141
+ }
6142
+ });
6143
+ });
6144
+ }
6404
6145
  }
6405
6146
  };
6406
6147
  exports.default = def;
6407
6148
  }
6408
6149
  });
6409
-
6410
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js
6411
- var require_format2 = __commonJS({
6412
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js"(exports) {
6413
- Object.defineProperty(exports, "__esModule", { value: true });
6414
- var format_1 = require_format();
6415
- var format = [format_1.default];
6416
- exports.default = format;
6417
- }
6418
- });
6419
-
6420
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js
6421
- var require_metadata = __commonJS({
6422
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js"(exports) {
6423
- Object.defineProperty(exports, "__esModule", { value: true });
6424
- exports.contentVocabulary = exports.metadataVocabulary = void 0;
6425
- exports.metadataVocabulary = [
6426
- "title",
6427
- "description",
6428
- "default",
6429
- "deprecated",
6430
- "readOnly",
6431
- "writeOnly",
6432
- "examples"
6433
- ];
6434
- exports.contentVocabulary = [
6435
- "contentMediaType",
6436
- "contentEncoding",
6437
- "contentSchema"
6438
- ];
6439
- }
6440
- });
6441
-
6442
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js
6443
- var require_draft2020 = __commonJS({
6444
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js"(exports) {
6445
- Object.defineProperty(exports, "__esModule", { value: true });
6446
- var core_1 = require_core2();
6447
- var validation_1 = require_validation();
6448
- var applicator_1 = require_applicator();
6449
- var dynamic_1 = require_dynamic();
6450
- var next_1 = require_next();
6451
- var unevaluated_1 = require_unevaluated();
6452
- var format_1 = require_format2();
6453
- var metadata_1 = require_metadata();
6454
- var draft2020Vocabularies = [
6455
- dynamic_1.default,
6456
- core_1.default,
6457
- validation_1.default,
6458
- (0, applicator_1.default)(true),
6459
- format_1.default,
6460
- metadata_1.metadataVocabulary,
6461
- metadata_1.contentVocabulary,
6462
- next_1.default,
6463
- unevaluated_1.default
6464
- ];
6465
- exports.default = draft2020Vocabularies;
6150
+
6151
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js
6152
+ var require_not = __commonJS({
6153
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js"(exports) {
6154
+ Object.defineProperty(exports, "__esModule", { value: true });
6155
+ var util_1 = require_util();
6156
+ var def = {
6157
+ keyword: "not",
6158
+ schemaType: ["object", "boolean"],
6159
+ trackErrors: true,
6160
+ code(cxt) {
6161
+ const { gen, schema, it } = cxt;
6162
+ if ((0, util_1.alwaysValidSchema)(it, schema)) {
6163
+ cxt.fail();
6164
+ return;
6165
+ }
6166
+ const valid = gen.name("valid");
6167
+ cxt.subschema({
6168
+ keyword: "not",
6169
+ compositeRule: true,
6170
+ createErrors: false,
6171
+ allErrors: false
6172
+ }, valid);
6173
+ cxt.failResult(valid, () => cxt.reset(), () => cxt.error());
6174
+ },
6175
+ error: { message: "must NOT be valid" }
6176
+ };
6177
+ exports.default = def;
6466
6178
  }
6467
6179
  });
6468
6180
 
6469
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js
6470
- var require_types = __commonJS({
6471
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js"(exports) {
6181
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js
6182
+ var require_anyOf = __commonJS({
6183
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js"(exports) {
6472
6184
  Object.defineProperty(exports, "__esModule", { value: true });
6473
- exports.DiscrError = void 0;
6474
- var DiscrError;
6475
- (function(DiscrError2) {
6476
- DiscrError2["Tag"] = "tag";
6477
- DiscrError2["Mapping"] = "mapping";
6478
- })(DiscrError || (exports.DiscrError = DiscrError = {}));
6185
+ var code_1 = require_code2();
6186
+ var def = {
6187
+ keyword: "anyOf",
6188
+ schemaType: "array",
6189
+ trackErrors: true,
6190
+ code: code_1.validateUnion,
6191
+ error: { message: "must match a schema in anyOf" }
6192
+ };
6193
+ exports.default = def;
6479
6194
  }
6480
6195
  });
6481
6196
 
6482
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js
6483
- var require_discriminator = __commonJS({
6484
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js"(exports) {
6197
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js
6198
+ var require_oneOf = __commonJS({
6199
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js"(exports) {
6485
6200
  Object.defineProperty(exports, "__esModule", { value: true });
6486
6201
  var codegen_1 = require_codegen();
6487
- var types_1 = require_types();
6488
- var compile_1 = require_compile();
6489
- var ref_error_1 = require_ref_error();
6490
6202
  var util_1 = require_util();
6491
6203
  var error2 = {
6492
- message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`,
6493
- params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`
6204
+ message: "must match exactly one schema in oneOf",
6205
+ params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}`
6494
6206
  };
6495
6207
  var def = {
6496
- keyword: "discriminator",
6497
- type: "object",
6498
- schemaType: "object",
6208
+ keyword: "oneOf",
6209
+ schemaType: "array",
6210
+ trackErrors: true,
6499
6211
  error: error2,
6500
6212
  code(cxt) {
6501
- const { gen, data, schema, parentSchema, it } = cxt;
6502
- const { oneOf } = parentSchema;
6503
- if (!it.opts.discriminator) {
6504
- throw new Error("discriminator: requires discriminator option");
6505
- }
6506
- const tagName = schema.propertyName;
6507
- if (typeof tagName != "string")
6508
- throw new Error("discriminator: requires propertyName");
6509
- if (schema.mapping)
6510
- throw new Error("discriminator: mapping is not supported");
6511
- if (!oneOf)
6512
- throw new Error("discriminator: requires oneOf keyword");
6213
+ const { gen, schema, parentSchema, it } = cxt;
6214
+ if (!Array.isArray(schema))
6215
+ throw new Error("ajv implementation error");
6216
+ if (it.opts.discriminator && parentSchema.discriminator)
6217
+ return;
6218
+ const schArr = schema;
6513
6219
  const valid = gen.let("valid", false);
6514
- const tag = gen.const("tag", (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(tagName)}`);
6515
- gen.if((0, codegen_1._)`typeof ${tag} == "string"`, () => validateMapping(), () => cxt.error(false, { discrError: types_1.DiscrError.Tag, tag, tagName }));
6516
- cxt.ok(valid);
6517
- function validateMapping() {
6518
- const mapping = getMapping();
6519
- gen.if(false);
6520
- for (const tagValue in mapping) {
6521
- gen.elseIf((0, codegen_1._)`${tag} === ${tagValue}`);
6522
- gen.assign(valid, applyTagSchema(mapping[tagValue]));
6523
- }
6524
- gen.else();
6525
- cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag, tagName });
6526
- gen.endIf();
6527
- }
6528
- function applyTagSchema(schemaProp) {
6529
- const _valid = gen.name("valid");
6530
- const schCxt = cxt.subschema({ keyword: "oneOf", schemaProp }, _valid);
6531
- cxt.mergeEvaluated(schCxt, codegen_1.Name);
6532
- return _valid;
6533
- }
6534
- function getMapping() {
6535
- var _a;
6536
- const oneOfMapping = {};
6537
- const topRequired = hasRequired(parentSchema);
6538
- let tagRequired = true;
6539
- for (let i = 0; i < oneOf.length; i++) {
6540
- let sch = oneOf[i];
6541
- if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) {
6542
- const ref = sch.$ref;
6543
- sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, ref);
6544
- if (sch instanceof compile_1.SchemaEnv)
6545
- sch = sch.schema;
6546
- if (sch === void 0)
6547
- throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref);
6548
- }
6549
- const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName];
6550
- if (typeof propSch != "object") {
6551
- throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
6552
- }
6553
- tagRequired = tagRequired && (topRequired || hasRequired(sch));
6554
- addMappings(propSch, i);
6555
- }
6556
- if (!tagRequired)
6557
- throw new Error(`discriminator: "${tagName}" must be required`);
6558
- return oneOfMapping;
6559
- function hasRequired({ required }) {
6560
- return Array.isArray(required) && required.includes(tagName);
6561
- }
6562
- function addMappings(sch, i) {
6563
- if (sch.const) {
6564
- addMapping(sch.const, i);
6565
- } else if (sch.enum) {
6566
- for (const tagValue of sch.enum) {
6567
- addMapping(tagValue, i);
6568
- }
6220
+ const passing = gen.let("passing", null);
6221
+ const schValid = gen.name("_valid");
6222
+ cxt.setParams({ passing });
6223
+ gen.block(validateOneOf);
6224
+ cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
6225
+ function validateOneOf() {
6226
+ schArr.forEach((sch, i) => {
6227
+ let schCxt;
6228
+ if ((0, util_1.alwaysValidSchema)(it, sch)) {
6229
+ gen.var(schValid, true);
6569
6230
  } else {
6570
- throw new Error(`discriminator: "properties/${tagName}" must have "const" or "enum"`);
6231
+ schCxt = cxt.subschema({
6232
+ keyword: "oneOf",
6233
+ schemaProp: i,
6234
+ compositeRule: true
6235
+ }, schValid);
6571
6236
  }
6572
- }
6573
- function addMapping(tagValue, i) {
6574
- if (typeof tagValue != "string" || tagValue in oneOfMapping) {
6575
- throw new Error(`discriminator: "${tagName}" values must be unique strings`);
6237
+ if (i > 0) {
6238
+ gen.if((0, codegen_1._)`${schValid} && ${valid}`).assign(valid, false).assign(passing, (0, codegen_1._)`[${passing}, ${i}]`).else();
6576
6239
  }
6577
- oneOfMapping[tagValue] = i;
6578
- }
6240
+ gen.if(schValid, () => {
6241
+ gen.assign(valid, true);
6242
+ gen.assign(passing, i);
6243
+ if (schCxt)
6244
+ cxt.mergeEvaluated(schCxt, codegen_1.Name);
6245
+ });
6246
+ });
6579
6247
  }
6580
6248
  }
6581
6249
  };
@@ -6583,477 +6251,616 @@ var require_discriminator = __commonJS({
6583
6251
  }
6584
6252
  });
6585
6253
 
6586
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json
6587
- var require_schema = __commonJS({
6588
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json"(exports, module) {
6589
- module.exports = {
6590
- $schema: "https://json-schema.org/draft/2020-12/schema",
6591
- $id: "https://json-schema.org/draft/2020-12/schema",
6592
- $vocabulary: {
6593
- "https://json-schema.org/draft/2020-12/vocab/core": true,
6594
- "https://json-schema.org/draft/2020-12/vocab/applicator": true,
6595
- "https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
6596
- "https://json-schema.org/draft/2020-12/vocab/validation": true,
6597
- "https://json-schema.org/draft/2020-12/vocab/meta-data": true,
6598
- "https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
6599
- "https://json-schema.org/draft/2020-12/vocab/content": true
6600
- },
6601
- $dynamicAnchor: "meta",
6602
- title: "Core and Validation specifications meta-schema",
6603
- allOf: [
6604
- { $ref: "meta/core" },
6605
- { $ref: "meta/applicator" },
6606
- { $ref: "meta/unevaluated" },
6607
- { $ref: "meta/validation" },
6608
- { $ref: "meta/meta-data" },
6609
- { $ref: "meta/format-annotation" },
6610
- { $ref: "meta/content" }
6611
- ],
6612
- type: ["object", "boolean"],
6613
- $comment: "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",
6614
- properties: {
6615
- definitions: {
6616
- $comment: '"definitions" has been replaced by "$defs".',
6617
- type: "object",
6618
- additionalProperties: { $dynamicRef: "#meta" },
6619
- deprecated: true,
6620
- default: {}
6621
- },
6622
- dependencies: {
6623
- $comment: '"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',
6624
- type: "object",
6625
- additionalProperties: {
6626
- anyOf: [{ $dynamicRef: "#meta" }, { $ref: "meta/validation#/$defs/stringArray" }]
6627
- },
6628
- deprecated: true,
6629
- default: {}
6630
- },
6631
- $recursiveAnchor: {
6632
- $comment: '"$recursiveAnchor" has been replaced by "$dynamicAnchor".',
6633
- $ref: "meta/core#/$defs/anchorString",
6634
- deprecated: true
6635
- },
6636
- $recursiveRef: {
6637
- $comment: '"$recursiveRef" has been replaced by "$dynamicRef".',
6638
- $ref: "meta/core#/$defs/uriReferenceString",
6639
- deprecated: true
6640
- }
6254
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js
6255
+ var require_allOf = __commonJS({
6256
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js"(exports) {
6257
+ Object.defineProperty(exports, "__esModule", { value: true });
6258
+ var util_1 = require_util();
6259
+ var def = {
6260
+ keyword: "allOf",
6261
+ schemaType: "array",
6262
+ code(cxt) {
6263
+ const { gen, schema, it } = cxt;
6264
+ if (!Array.isArray(schema))
6265
+ throw new Error("ajv implementation error");
6266
+ const valid = gen.name("valid");
6267
+ schema.forEach((sch, i) => {
6268
+ if ((0, util_1.alwaysValidSchema)(it, sch))
6269
+ return;
6270
+ const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i }, valid);
6271
+ cxt.ok(valid);
6272
+ cxt.mergeEvaluated(schCxt);
6273
+ });
6641
6274
  }
6642
6275
  };
6276
+ exports.default = def;
6643
6277
  }
6644
6278
  });
6645
6279
 
6646
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json
6647
- var require_applicator2 = __commonJS({
6648
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json"(exports, module) {
6649
- module.exports = {
6650
- $schema: "https://json-schema.org/draft/2020-12/schema",
6651
- $id: "https://json-schema.org/draft/2020-12/meta/applicator",
6652
- $vocabulary: {
6653
- "https://json-schema.org/draft/2020-12/vocab/applicator": true
6654
- },
6655
- $dynamicAnchor: "meta",
6656
- title: "Applicator vocabulary meta-schema",
6657
- type: ["object", "boolean"],
6658
- properties: {
6659
- prefixItems: { $ref: "#/$defs/schemaArray" },
6660
- items: { $dynamicRef: "#meta" },
6661
- contains: { $dynamicRef: "#meta" },
6662
- additionalProperties: { $dynamicRef: "#meta" },
6663
- properties: {
6664
- type: "object",
6665
- additionalProperties: { $dynamicRef: "#meta" },
6666
- default: {}
6667
- },
6668
- patternProperties: {
6669
- type: "object",
6670
- additionalProperties: { $dynamicRef: "#meta" },
6671
- propertyNames: { format: "regex" },
6672
- default: {}
6673
- },
6674
- dependentSchemas: {
6675
- type: "object",
6676
- additionalProperties: { $dynamicRef: "#meta" },
6677
- default: {}
6678
- },
6679
- propertyNames: { $dynamicRef: "#meta" },
6680
- if: { $dynamicRef: "#meta" },
6681
- then: { $dynamicRef: "#meta" },
6682
- else: { $dynamicRef: "#meta" },
6683
- allOf: { $ref: "#/$defs/schemaArray" },
6684
- anyOf: { $ref: "#/$defs/schemaArray" },
6685
- oneOf: { $ref: "#/$defs/schemaArray" },
6686
- not: { $dynamicRef: "#meta" }
6687
- },
6688
- $defs: {
6689
- schemaArray: {
6690
- type: "array",
6691
- minItems: 1,
6692
- items: { $dynamicRef: "#meta" }
6280
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js
6281
+ var require_if = __commonJS({
6282
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js"(exports) {
6283
+ Object.defineProperty(exports, "__esModule", { value: true });
6284
+ var codegen_1 = require_codegen();
6285
+ var util_1 = require_util();
6286
+ var error2 = {
6287
+ message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`,
6288
+ params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`
6289
+ };
6290
+ var def = {
6291
+ keyword: "if",
6292
+ schemaType: ["object", "boolean"],
6293
+ trackErrors: true,
6294
+ error: error2,
6295
+ code(cxt) {
6296
+ const { gen, parentSchema, it } = cxt;
6297
+ if (parentSchema.then === void 0 && parentSchema.else === void 0) {
6298
+ (0, util_1.checkStrictMode)(it, '"if" without "then" and "else" is ignored');
6299
+ }
6300
+ const hasThen = hasSchema(it, "then");
6301
+ const hasElse = hasSchema(it, "else");
6302
+ if (!hasThen && !hasElse)
6303
+ return;
6304
+ const valid = gen.let("valid", true);
6305
+ const schValid = gen.name("_valid");
6306
+ validateIf();
6307
+ cxt.reset();
6308
+ if (hasThen && hasElse) {
6309
+ const ifClause = gen.let("ifClause");
6310
+ cxt.setParams({ ifClause });
6311
+ gen.if(schValid, validateClause("then", ifClause), validateClause("else", ifClause));
6312
+ } else if (hasThen) {
6313
+ gen.if(schValid, validateClause("then"));
6314
+ } else {
6315
+ gen.if((0, codegen_1.not)(schValid), validateClause("else"));
6316
+ }
6317
+ cxt.pass(valid, () => cxt.error(true));
6318
+ function validateIf() {
6319
+ const schCxt = cxt.subschema({
6320
+ keyword: "if",
6321
+ compositeRule: true,
6322
+ createErrors: false,
6323
+ allErrors: false
6324
+ }, schValid);
6325
+ cxt.mergeEvaluated(schCxt);
6326
+ }
6327
+ function validateClause(keyword, ifClause) {
6328
+ return () => {
6329
+ const schCxt = cxt.subschema({ keyword }, schValid);
6330
+ gen.assign(valid, schValid);
6331
+ cxt.mergeValidEvaluated(schCxt, valid);
6332
+ if (ifClause)
6333
+ gen.assign(ifClause, (0, codegen_1._)`${keyword}`);
6334
+ else
6335
+ cxt.setParams({ ifClause: keyword });
6336
+ };
6693
6337
  }
6694
6338
  }
6695
6339
  };
6340
+ function hasSchema(it, keyword) {
6341
+ const schema = it.schema[keyword];
6342
+ return schema !== void 0 && !(0, util_1.alwaysValidSchema)(it, schema);
6343
+ }
6344
+ exports.default = def;
6696
6345
  }
6697
6346
  });
6698
6347
 
6699
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json
6700
- var require_unevaluated2 = __commonJS({
6701
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json"(exports, module) {
6702
- module.exports = {
6703
- $schema: "https://json-schema.org/draft/2020-12/schema",
6704
- $id: "https://json-schema.org/draft/2020-12/meta/unevaluated",
6705
- $vocabulary: {
6706
- "https://json-schema.org/draft/2020-12/vocab/unevaluated": true
6707
- },
6708
- $dynamicAnchor: "meta",
6709
- title: "Unevaluated applicator vocabulary meta-schema",
6710
- type: ["object", "boolean"],
6711
- properties: {
6712
- unevaluatedItems: { $dynamicRef: "#meta" },
6713
- unevaluatedProperties: { $dynamicRef: "#meta" }
6348
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js
6349
+ var require_thenElse = __commonJS({
6350
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js"(exports) {
6351
+ Object.defineProperty(exports, "__esModule", { value: true });
6352
+ var util_1 = require_util();
6353
+ var def = {
6354
+ keyword: ["then", "else"],
6355
+ schemaType: ["object", "boolean"],
6356
+ code({ keyword, parentSchema, it }) {
6357
+ if (parentSchema.if === void 0)
6358
+ (0, util_1.checkStrictMode)(it, `"${keyword}" without "if" is ignored`);
6714
6359
  }
6715
6360
  };
6361
+ exports.default = def;
6716
6362
  }
6717
6363
  });
6718
6364
 
6719
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json
6720
- var require_content = __commonJS({
6721
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json"(exports, module) {
6722
- module.exports = {
6723
- $schema: "https://json-schema.org/draft/2020-12/schema",
6724
- $id: "https://json-schema.org/draft/2020-12/meta/content",
6725
- $vocabulary: {
6726
- "https://json-schema.org/draft/2020-12/vocab/content": true
6727
- },
6728
- $dynamicAnchor: "meta",
6729
- title: "Content vocabulary meta-schema",
6730
- type: ["object", "boolean"],
6731
- properties: {
6732
- contentEncoding: { type: "string" },
6733
- contentMediaType: { type: "string" },
6734
- contentSchema: { $dynamicRef: "#meta" }
6735
- }
6365
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js
6366
+ var require_applicator2 = __commonJS({
6367
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js"(exports) {
6368
+ Object.defineProperty(exports, "__esModule", { value: true });
6369
+ var additionalItems_1 = require_additionalItems();
6370
+ var prefixItems_1 = require_prefixItems();
6371
+ var items_1 = require_items();
6372
+ var items2020_1 = require_items2020();
6373
+ var contains_1 = require_contains();
6374
+ var dependencies_1 = require_dependencies();
6375
+ var propertyNames_1 = require_propertyNames();
6376
+ var additionalProperties_1 = require_additionalProperties();
6377
+ var properties_1 = require_properties();
6378
+ var patternProperties_1 = require_patternProperties();
6379
+ var not_1 = require_not();
6380
+ var anyOf_1 = require_anyOf();
6381
+ var oneOf_1 = require_oneOf();
6382
+ var allOf_1 = require_allOf();
6383
+ var if_1 = require_if();
6384
+ var thenElse_1 = require_thenElse();
6385
+ function getApplicator(draft20202 = false) {
6386
+ const applicator = [
6387
+ // any
6388
+ not_1.default,
6389
+ anyOf_1.default,
6390
+ oneOf_1.default,
6391
+ allOf_1.default,
6392
+ if_1.default,
6393
+ thenElse_1.default,
6394
+ // object
6395
+ propertyNames_1.default,
6396
+ additionalProperties_1.default,
6397
+ dependencies_1.default,
6398
+ properties_1.default,
6399
+ patternProperties_1.default
6400
+ ];
6401
+ if (draft20202)
6402
+ applicator.push(prefixItems_1.default, items2020_1.default);
6403
+ else
6404
+ applicator.push(additionalItems_1.default, items_1.default);
6405
+ applicator.push(contains_1.default);
6406
+ return applicator;
6407
+ }
6408
+ exports.default = getApplicator;
6409
+ }
6410
+ });
6411
+
6412
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js
6413
+ var require_dynamicAnchor = __commonJS({
6414
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js"(exports) {
6415
+ Object.defineProperty(exports, "__esModule", { value: true });
6416
+ exports.dynamicAnchor = void 0;
6417
+ var codegen_1 = require_codegen();
6418
+ var names_1 = require_names();
6419
+ var compile_1 = require_compile();
6420
+ var ref_1 = require_ref();
6421
+ var def = {
6422
+ keyword: "$dynamicAnchor",
6423
+ schemaType: "string",
6424
+ code: (cxt) => dynamicAnchor(cxt, cxt.schema)
6736
6425
  };
6426
+ function dynamicAnchor(cxt, anchor) {
6427
+ const { gen, it } = cxt;
6428
+ it.schemaEnv.root.dynamicAnchors[anchor] = true;
6429
+ const v = (0, codegen_1._)`${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`;
6430
+ const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt);
6431
+ gen.if((0, codegen_1._)`!${v}`, () => gen.assign(v, validate));
6432
+ }
6433
+ exports.dynamicAnchor = dynamicAnchor;
6434
+ function _getValidate(cxt) {
6435
+ const { schemaEnv, schema, self } = cxt.it;
6436
+ const { root, baseId, localRefs, meta } = schemaEnv.root;
6437
+ const { schemaId } = self.opts;
6438
+ const sch = new compile_1.SchemaEnv({ schema, schemaId, root, baseId, localRefs, meta });
6439
+ compile_1.compileSchema.call(self, sch);
6440
+ return (0, ref_1.getValidate)(cxt, sch);
6441
+ }
6442
+ exports.default = def;
6737
6443
  }
6738
6444
  });
6739
6445
 
6740
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json
6741
- var require_core3 = __commonJS({
6742
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json"(exports, module) {
6743
- module.exports = {
6744
- $schema: "https://json-schema.org/draft/2020-12/schema",
6745
- $id: "https://json-schema.org/draft/2020-12/meta/core",
6746
- $vocabulary: {
6747
- "https://json-schema.org/draft/2020-12/vocab/core": true
6748
- },
6749
- $dynamicAnchor: "meta",
6750
- title: "Core vocabulary meta-schema",
6751
- type: ["object", "boolean"],
6752
- properties: {
6753
- $id: {
6754
- $ref: "#/$defs/uriReferenceString",
6755
- $comment: "Non-empty fragments not allowed.",
6756
- pattern: "^[^#]*#?$"
6757
- },
6758
- $schema: { $ref: "#/$defs/uriString" },
6759
- $ref: { $ref: "#/$defs/uriReferenceString" },
6760
- $anchor: { $ref: "#/$defs/anchorString" },
6761
- $dynamicRef: { $ref: "#/$defs/uriReferenceString" },
6762
- $dynamicAnchor: { $ref: "#/$defs/anchorString" },
6763
- $vocabulary: {
6764
- type: "object",
6765
- propertyNames: { $ref: "#/$defs/uriString" },
6766
- additionalProperties: {
6767
- type: "boolean"
6768
- }
6769
- },
6770
- $comment: {
6771
- type: "string"
6772
- },
6773
- $defs: {
6774
- type: "object",
6775
- additionalProperties: { $dynamicRef: "#meta" }
6776
- }
6777
- },
6778
- $defs: {
6779
- anchorString: {
6780
- type: "string",
6781
- pattern: "^[A-Za-z_][-A-Za-z0-9._]*$"
6782
- },
6783
- uriString: {
6784
- type: "string",
6785
- format: "uri"
6786
- },
6787
- uriReferenceString: {
6788
- type: "string",
6789
- format: "uri-reference"
6446
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js
6447
+ var require_dynamicRef = __commonJS({
6448
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js"(exports) {
6449
+ Object.defineProperty(exports, "__esModule", { value: true });
6450
+ exports.dynamicRef = void 0;
6451
+ var codegen_1 = require_codegen();
6452
+ var names_1 = require_names();
6453
+ var ref_1 = require_ref();
6454
+ var def = {
6455
+ keyword: "$dynamicRef",
6456
+ schemaType: "string",
6457
+ code: (cxt) => dynamicRef(cxt, cxt.schema)
6458
+ };
6459
+ function dynamicRef(cxt, ref) {
6460
+ const { gen, keyword, it } = cxt;
6461
+ if (ref[0] !== "#")
6462
+ throw new Error(`"${keyword}" only supports hash fragment reference`);
6463
+ const anchor = ref.slice(1);
6464
+ if (it.allErrors) {
6465
+ _dynamicRef();
6466
+ } else {
6467
+ const valid = gen.let("valid", false);
6468
+ _dynamicRef(valid);
6469
+ cxt.ok(valid);
6470
+ }
6471
+ function _dynamicRef(valid) {
6472
+ if (it.schemaEnv.root.dynamicAnchors[anchor]) {
6473
+ const v = gen.let("_v", (0, codegen_1._)`${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`);
6474
+ gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid));
6475
+ } else {
6476
+ _callRef(it.validateName, valid)();
6790
6477
  }
6791
6478
  }
6479
+ function _callRef(validate, valid) {
6480
+ return valid ? () => gen.block(() => {
6481
+ (0, ref_1.callRef)(cxt, validate);
6482
+ gen.let(valid, true);
6483
+ }) : () => (0, ref_1.callRef)(cxt, validate);
6484
+ }
6485
+ }
6486
+ exports.dynamicRef = dynamicRef;
6487
+ exports.default = def;
6488
+ }
6489
+ });
6490
+
6491
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js
6492
+ var require_recursiveAnchor = __commonJS({
6493
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js"(exports) {
6494
+ Object.defineProperty(exports, "__esModule", { value: true });
6495
+ var dynamicAnchor_1 = require_dynamicAnchor();
6496
+ var util_1 = require_util();
6497
+ var def = {
6498
+ keyword: "$recursiveAnchor",
6499
+ schemaType: "boolean",
6500
+ code(cxt) {
6501
+ if (cxt.schema)
6502
+ (0, dynamicAnchor_1.dynamicAnchor)(cxt, "");
6503
+ else
6504
+ (0, util_1.checkStrictMode)(cxt.it, "$recursiveAnchor: false is ignored");
6505
+ }
6506
+ };
6507
+ exports.default = def;
6508
+ }
6509
+ });
6510
+
6511
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js
6512
+ var require_recursiveRef = __commonJS({
6513
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js"(exports) {
6514
+ Object.defineProperty(exports, "__esModule", { value: true });
6515
+ var dynamicRef_1 = require_dynamicRef();
6516
+ var def = {
6517
+ keyword: "$recursiveRef",
6518
+ schemaType: "string",
6519
+ code: (cxt) => (0, dynamicRef_1.dynamicRef)(cxt, cxt.schema)
6792
6520
  };
6521
+ exports.default = def;
6793
6522
  }
6794
6523
  });
6795
6524
 
6796
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json
6797
- var require_format_annotation = __commonJS({
6798
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json"(exports, module) {
6799
- module.exports = {
6800
- $schema: "https://json-schema.org/draft/2020-12/schema",
6801
- $id: "https://json-schema.org/draft/2020-12/meta/format-annotation",
6802
- $vocabulary: {
6803
- "https://json-schema.org/draft/2020-12/vocab/format-annotation": true
6804
- },
6805
- $dynamicAnchor: "meta",
6806
- title: "Format vocabulary meta-schema for annotation results",
6807
- type: ["object", "boolean"],
6808
- properties: {
6809
- format: { type: "string" }
6810
- }
6525
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js
6526
+ var require_dynamic = __commonJS({
6527
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js"(exports) {
6528
+ Object.defineProperty(exports, "__esModule", { value: true });
6529
+ var dynamicAnchor_1 = require_dynamicAnchor();
6530
+ var dynamicRef_1 = require_dynamicRef();
6531
+ var recursiveAnchor_1 = require_recursiveAnchor();
6532
+ var recursiveRef_1 = require_recursiveRef();
6533
+ var dynamic = [dynamicAnchor_1.default, dynamicRef_1.default, recursiveAnchor_1.default, recursiveRef_1.default];
6534
+ exports.default = dynamic;
6535
+ }
6536
+ });
6537
+
6538
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js
6539
+ var require_dependentRequired = __commonJS({
6540
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js"(exports) {
6541
+ Object.defineProperty(exports, "__esModule", { value: true });
6542
+ var dependencies_1 = require_dependencies();
6543
+ var def = {
6544
+ keyword: "dependentRequired",
6545
+ type: "object",
6546
+ schemaType: "object",
6547
+ error: dependencies_1.error,
6548
+ code: (cxt) => (0, dependencies_1.validatePropertyDeps)(cxt)
6811
6549
  };
6550
+ exports.default = def;
6812
6551
  }
6813
6552
  });
6814
6553
 
6815
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json
6816
- var require_meta_data = __commonJS({
6817
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json"(exports, module) {
6818
- module.exports = {
6819
- $schema: "https://json-schema.org/draft/2020-12/schema",
6820
- $id: "https://json-schema.org/draft/2020-12/meta/meta-data",
6821
- $vocabulary: {
6822
- "https://json-schema.org/draft/2020-12/vocab/meta-data": true
6823
- },
6824
- $dynamicAnchor: "meta",
6825
- title: "Meta-data vocabulary meta-schema",
6826
- type: ["object", "boolean"],
6827
- properties: {
6828
- title: {
6829
- type: "string"
6830
- },
6831
- description: {
6832
- type: "string"
6833
- },
6834
- default: true,
6835
- deprecated: {
6836
- type: "boolean",
6837
- default: false
6838
- },
6839
- readOnly: {
6840
- type: "boolean",
6841
- default: false
6842
- },
6843
- writeOnly: {
6844
- type: "boolean",
6845
- default: false
6846
- },
6847
- examples: {
6848
- type: "array",
6849
- items: true
6554
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js
6555
+ var require_dependentSchemas = __commonJS({
6556
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js"(exports) {
6557
+ Object.defineProperty(exports, "__esModule", { value: true });
6558
+ var dependencies_1 = require_dependencies();
6559
+ var def = {
6560
+ keyword: "dependentSchemas",
6561
+ type: "object",
6562
+ schemaType: "object",
6563
+ code: (cxt) => (0, dependencies_1.validateSchemaDeps)(cxt)
6564
+ };
6565
+ exports.default = def;
6566
+ }
6567
+ });
6568
+
6569
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js
6570
+ var require_limitContains = __commonJS({
6571
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js"(exports) {
6572
+ Object.defineProperty(exports, "__esModule", { value: true });
6573
+ var util_1 = require_util();
6574
+ var def = {
6575
+ keyword: ["maxContains", "minContains"],
6576
+ type: "array",
6577
+ schemaType: "number",
6578
+ code({ keyword, parentSchema, it }) {
6579
+ if (parentSchema.contains === void 0) {
6580
+ (0, util_1.checkStrictMode)(it, `"${keyword}" without "contains" is ignored`);
6850
6581
  }
6851
6582
  }
6852
6583
  };
6584
+ exports.default = def;
6853
6585
  }
6854
6586
  });
6855
6587
 
6856
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json
6857
- var require_validation2 = __commonJS({
6858
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json"(exports, module) {
6859
- module.exports = {
6860
- $schema: "https://json-schema.org/draft/2020-12/schema",
6861
- $id: "https://json-schema.org/draft/2020-12/meta/validation",
6862
- $vocabulary: {
6863
- "https://json-schema.org/draft/2020-12/vocab/validation": true
6864
- },
6865
- $dynamicAnchor: "meta",
6866
- title: "Validation vocabulary meta-schema",
6867
- type: ["object", "boolean"],
6868
- properties: {
6869
- type: {
6870
- anyOf: [
6871
- { $ref: "#/$defs/simpleTypes" },
6872
- {
6873
- type: "array",
6874
- items: { $ref: "#/$defs/simpleTypes" },
6875
- minItems: 1,
6876
- uniqueItems: true
6877
- }
6878
- ]
6879
- },
6880
- const: true,
6881
- enum: {
6882
- type: "array",
6883
- items: true
6884
- },
6885
- multipleOf: {
6886
- type: "number",
6887
- exclusiveMinimum: 0
6888
- },
6889
- maximum: {
6890
- type: "number"
6891
- },
6892
- exclusiveMaximum: {
6893
- type: "number"
6894
- },
6895
- minimum: {
6896
- type: "number"
6897
- },
6898
- exclusiveMinimum: {
6899
- type: "number"
6900
- },
6901
- maxLength: { $ref: "#/$defs/nonNegativeInteger" },
6902
- minLength: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
6903
- pattern: {
6904
- type: "string",
6905
- format: "regex"
6906
- },
6907
- maxItems: { $ref: "#/$defs/nonNegativeInteger" },
6908
- minItems: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
6909
- uniqueItems: {
6910
- type: "boolean",
6911
- default: false
6912
- },
6913
- maxContains: { $ref: "#/$defs/nonNegativeInteger" },
6914
- minContains: {
6915
- $ref: "#/$defs/nonNegativeInteger",
6916
- default: 1
6917
- },
6918
- maxProperties: { $ref: "#/$defs/nonNegativeInteger" },
6919
- minProperties: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
6920
- required: { $ref: "#/$defs/stringArray" },
6921
- dependentRequired: {
6922
- type: "object",
6923
- additionalProperties: {
6924
- $ref: "#/$defs/stringArray"
6925
- }
6588
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js
6589
+ var require_next = __commonJS({
6590
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js"(exports) {
6591
+ Object.defineProperty(exports, "__esModule", { value: true });
6592
+ var dependentRequired_1 = require_dependentRequired();
6593
+ var dependentSchemas_1 = require_dependentSchemas();
6594
+ var limitContains_1 = require_limitContains();
6595
+ var next = [dependentRequired_1.default, dependentSchemas_1.default, limitContains_1.default];
6596
+ exports.default = next;
6597
+ }
6598
+ });
6599
+
6600
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js
6601
+ var require_unevaluatedProperties = __commonJS({
6602
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js"(exports) {
6603
+ Object.defineProperty(exports, "__esModule", { value: true });
6604
+ var codegen_1 = require_codegen();
6605
+ var util_1 = require_util();
6606
+ var names_1 = require_names();
6607
+ var error2 = {
6608
+ message: "must NOT have unevaluated properties",
6609
+ params: ({ params }) => (0, codegen_1._)`{unevaluatedProperty: ${params.unevaluatedProperty}}`
6610
+ };
6611
+ var def = {
6612
+ keyword: "unevaluatedProperties",
6613
+ type: "object",
6614
+ schemaType: ["boolean", "object"],
6615
+ trackErrors: true,
6616
+ error: error2,
6617
+ code(cxt) {
6618
+ const { gen, schema, data, errsCount, it } = cxt;
6619
+ if (!errsCount)
6620
+ throw new Error("ajv implementation error");
6621
+ const { allErrors, props } = it;
6622
+ if (props instanceof codegen_1.Name) {
6623
+ gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key))));
6624
+ } else if (props !== true) {
6625
+ gen.forIn("key", data, (key) => props === void 0 ? unevaluatedPropCode(key) : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key)));
6926
6626
  }
6927
- },
6928
- $defs: {
6929
- nonNegativeInteger: {
6930
- type: "integer",
6931
- minimum: 0
6932
- },
6933
- nonNegativeIntegerDefault0: {
6934
- $ref: "#/$defs/nonNegativeInteger",
6935
- default: 0
6936
- },
6937
- simpleTypes: {
6938
- enum: ["array", "boolean", "integer", "null", "number", "object", "string"]
6939
- },
6940
- stringArray: {
6941
- type: "array",
6942
- items: { type: "string" },
6943
- uniqueItems: true,
6944
- default: []
6627
+ it.props = true;
6628
+ cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
6629
+ function unevaluatedPropCode(key) {
6630
+ if (schema === false) {
6631
+ cxt.setParams({ unevaluatedProperty: key });
6632
+ cxt.error();
6633
+ if (!allErrors)
6634
+ gen.break();
6635
+ return;
6636
+ }
6637
+ if (!(0, util_1.alwaysValidSchema)(it, schema)) {
6638
+ const valid = gen.name("valid");
6639
+ cxt.subschema({
6640
+ keyword: "unevaluatedProperties",
6641
+ dataProp: key,
6642
+ dataPropType: util_1.Type.Str
6643
+ }, valid);
6644
+ if (!allErrors)
6645
+ gen.if((0, codegen_1.not)(valid), () => gen.break());
6646
+ }
6647
+ }
6648
+ function unevaluatedDynamic(evaluatedProps, key) {
6649
+ return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${key}]`;
6650
+ }
6651
+ function unevaluatedStatic(evaluatedProps, key) {
6652
+ const ps = [];
6653
+ for (const p in evaluatedProps) {
6654
+ if (evaluatedProps[p] === true)
6655
+ ps.push((0, codegen_1._)`${key} !== ${p}`);
6656
+ }
6657
+ return (0, codegen_1.and)(...ps);
6945
6658
  }
6946
6659
  }
6947
6660
  };
6661
+ exports.default = def;
6948
6662
  }
6949
6663
  });
6950
6664
 
6951
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js
6952
- var require_json_schema_2020_12 = __commonJS({
6953
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js"(exports) {
6665
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js
6666
+ var require_unevaluatedItems = __commonJS({
6667
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js"(exports) {
6954
6668
  Object.defineProperty(exports, "__esModule", { value: true });
6955
- var metaSchema = require_schema();
6956
- var applicator = require_applicator2();
6957
- var unevaluated = require_unevaluated2();
6958
- var content = require_content();
6959
- var core = require_core3();
6960
- var format = require_format_annotation();
6961
- var metadata = require_meta_data();
6962
- var validation = require_validation2();
6963
- var META_SUPPORT_DATA = ["/properties"];
6964
- function addMetaSchema2020($data) {
6965
- [
6966
- metaSchema,
6967
- applicator,
6968
- unevaluated,
6969
- content,
6970
- core,
6971
- with$data(this, format),
6972
- metadata,
6973
- with$data(this, validation)
6974
- ].forEach((sch) => this.addMetaSchema(sch, void 0, false));
6975
- return this;
6976
- function with$data(ajv, sch) {
6977
- return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch;
6669
+ var codegen_1 = require_codegen();
6670
+ var util_1 = require_util();
6671
+ var error2 = {
6672
+ message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
6673
+ params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
6674
+ };
6675
+ var def = {
6676
+ keyword: "unevaluatedItems",
6677
+ type: "array",
6678
+ schemaType: ["boolean", "object"],
6679
+ error: error2,
6680
+ code(cxt) {
6681
+ const { gen, schema, data, it } = cxt;
6682
+ const items = it.items || 0;
6683
+ if (items === true)
6684
+ return;
6685
+ const len = gen.const("len", (0, codegen_1._)`${data}.length`);
6686
+ if (schema === false) {
6687
+ cxt.setParams({ len: items });
6688
+ cxt.fail((0, codegen_1._)`${len} > ${items}`);
6689
+ } else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
6690
+ const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items}`);
6691
+ gen.if((0, codegen_1.not)(valid), () => validateItems(valid, items));
6692
+ cxt.ok(valid);
6693
+ }
6694
+ it.items = true;
6695
+ function validateItems(valid, from) {
6696
+ gen.forRange("i", from, len, (i) => {
6697
+ cxt.subschema({ keyword: "unevaluatedItems", dataProp: i, dataPropType: util_1.Type.Num }, valid);
6698
+ if (!it.allErrors)
6699
+ gen.if((0, codegen_1.not)(valid), () => gen.break());
6700
+ });
6701
+ }
6978
6702
  }
6979
- }
6980
- exports.default = addMetaSchema2020;
6703
+ };
6704
+ exports.default = def;
6981
6705
  }
6982
6706
  });
6983
6707
 
6984
- // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js
6985
- var require__ = __commonJS({
6986
- "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js"(exports, module) {
6708
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js
6709
+ var require_unevaluated2 = __commonJS({
6710
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js"(exports) {
6987
6711
  Object.defineProperty(exports, "__esModule", { value: true });
6988
- exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv2020 = void 0;
6989
- var core_1 = require_core();
6990
- var draft2020_1 = require_draft2020();
6991
- var discriminator_1 = require_discriminator();
6992
- var json_schema_2020_12_1 = require_json_schema_2020_12();
6993
- var META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema";
6994
- var Ajv20202 = class extends core_1.default {
6995
- constructor(opts = {}) {
6996
- super({
6997
- ...opts,
6998
- dynamicRef: true,
6999
- next: true,
7000
- unevaluated: true
7001
- });
7002
- }
7003
- _addVocabularies() {
7004
- super._addVocabularies();
7005
- draft2020_1.default.forEach((v) => this.addVocabulary(v));
7006
- if (this.opts.discriminator)
7007
- this.addKeyword(discriminator_1.default);
7008
- }
7009
- _addDefaultMetaSchema() {
7010
- super._addDefaultMetaSchema();
7011
- const { $data, meta } = this.opts;
7012
- if (!meta)
6712
+ var unevaluatedProperties_1 = require_unevaluatedProperties();
6713
+ var unevaluatedItems_1 = require_unevaluatedItems();
6714
+ var unevaluated = [unevaluatedProperties_1.default, unevaluatedItems_1.default];
6715
+ exports.default = unevaluated;
6716
+ }
6717
+ });
6718
+
6719
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js
6720
+ var require_format = __commonJS({
6721
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js"(exports) {
6722
+ Object.defineProperty(exports, "__esModule", { value: true });
6723
+ var codegen_1 = require_codegen();
6724
+ var error2 = {
6725
+ message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`,
6726
+ params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}`
6727
+ };
6728
+ var def = {
6729
+ keyword: "format",
6730
+ type: ["number", "string"],
6731
+ schemaType: "string",
6732
+ $data: true,
6733
+ error: error2,
6734
+ code(cxt, ruleType) {
6735
+ const { gen, data, $data, schema, schemaCode, it } = cxt;
6736
+ const { opts, errSchemaPath, schemaEnv, self } = it;
6737
+ if (!opts.validateFormats)
7013
6738
  return;
7014
- json_schema_2020_12_1.default.call(this, $data);
7015
- this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
7016
- }
7017
- defaultMeta() {
7018
- return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : void 0);
6739
+ if ($data)
6740
+ validate$DataFormat();
6741
+ else
6742
+ validateFormat();
6743
+ function validate$DataFormat() {
6744
+ const fmts = gen.scopeValue("formats", {
6745
+ ref: self.formats,
6746
+ code: opts.code.formats
6747
+ });
6748
+ const fDef = gen.const("fDef", (0, codegen_1._)`${fmts}[${schemaCode}]`);
6749
+ const fType = gen.let("fType");
6750
+ const format = gen.let("format");
6751
+ gen.if((0, codegen_1._)`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._)`${fDef}.type || "string"`).assign(format, (0, codegen_1._)`${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._)`"string"`).assign(format, fDef));
6752
+ cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt()));
6753
+ function unknownFmt() {
6754
+ if (opts.strictSchema === false)
6755
+ return codegen_1.nil;
6756
+ return (0, codegen_1._)`${schemaCode} && !${format}`;
6757
+ }
6758
+ function invalidFmt() {
6759
+ const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` : (0, codegen_1._)`${format}(${data})`;
6760
+ const validData = (0, codegen_1._)`(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))`;
6761
+ return (0, codegen_1._)`${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`;
6762
+ }
6763
+ }
6764
+ function validateFormat() {
6765
+ const formatDef = self.formats[schema];
6766
+ if (!formatDef) {
6767
+ unknownFormat();
6768
+ return;
6769
+ }
6770
+ if (formatDef === true)
6771
+ return;
6772
+ const [fmtType, format, fmtRef] = getFormat(formatDef);
6773
+ if (fmtType === ruleType)
6774
+ cxt.pass(validCondition());
6775
+ function unknownFormat() {
6776
+ if (opts.strictSchema === false) {
6777
+ self.logger.warn(unknownMsg());
6778
+ return;
6779
+ }
6780
+ throw new Error(unknownMsg());
6781
+ function unknownMsg() {
6782
+ return `unknown format "${schema}" ignored in schema at path "${errSchemaPath}"`;
6783
+ }
6784
+ }
6785
+ function getFormat(fmtDef) {
6786
+ const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(schema)}` : void 0;
6787
+ const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code });
6788
+ if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) {
6789
+ return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._)`${fmt}.validate`];
6790
+ }
6791
+ return ["string", fmtDef, fmt];
6792
+ }
6793
+ function validCondition() {
6794
+ if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) {
6795
+ if (!schemaEnv.$async)
6796
+ throw new Error("async format in sync schema");
6797
+ return (0, codegen_1._)`await ${fmtRef}(${data})`;
6798
+ }
6799
+ return typeof format == "function" ? (0, codegen_1._)`${fmtRef}(${data})` : (0, codegen_1._)`${fmtRef}.test(${data})`;
6800
+ }
6801
+ }
7019
6802
  }
7020
6803
  };
7021
- exports.Ajv2020 = Ajv20202;
7022
- module.exports = exports = Ajv20202;
7023
- module.exports.Ajv2020 = Ajv20202;
6804
+ exports.default = def;
6805
+ }
6806
+ });
6807
+
6808
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js
6809
+ var require_format2 = __commonJS({
6810
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js"(exports) {
7024
6811
  Object.defineProperty(exports, "__esModule", { value: true });
7025
- exports.default = Ajv20202;
7026
- var validate_1 = require_validate();
7027
- Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
7028
- return validate_1.KeywordCxt;
7029
- } });
7030
- var codegen_1 = require_codegen();
7031
- Object.defineProperty(exports, "_", { enumerable: true, get: function() {
7032
- return codegen_1._;
7033
- } });
7034
- Object.defineProperty(exports, "str", { enumerable: true, get: function() {
7035
- return codegen_1.str;
7036
- } });
7037
- Object.defineProperty(exports, "stringify", { enumerable: true, get: function() {
7038
- return codegen_1.stringify;
7039
- } });
7040
- Object.defineProperty(exports, "nil", { enumerable: true, get: function() {
7041
- return codegen_1.nil;
7042
- } });
7043
- Object.defineProperty(exports, "Name", { enumerable: true, get: function() {
7044
- return codegen_1.Name;
7045
- } });
7046
- Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() {
7047
- return codegen_1.CodeGen;
7048
- } });
7049
- var validation_error_1 = require_validation_error();
7050
- Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function() {
7051
- return validation_error_1.default;
7052
- } });
7053
- var ref_error_1 = require_ref_error();
7054
- Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function() {
7055
- return ref_error_1.default;
7056
- } });
6812
+ var format_1 = require_format();
6813
+ var format = [format_1.default];
6814
+ exports.default = format;
6815
+ }
6816
+ });
6817
+
6818
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js
6819
+ var require_metadata = __commonJS({
6820
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js"(exports) {
6821
+ Object.defineProperty(exports, "__esModule", { value: true });
6822
+ exports.contentVocabulary = exports.metadataVocabulary = void 0;
6823
+ exports.metadataVocabulary = [
6824
+ "title",
6825
+ "description",
6826
+ "default",
6827
+ "deprecated",
6828
+ "readOnly",
6829
+ "writeOnly",
6830
+ "examples"
6831
+ ];
6832
+ exports.contentVocabulary = [
6833
+ "contentMediaType",
6834
+ "contentEncoding",
6835
+ "contentSchema"
6836
+ ];
6837
+ }
6838
+ });
6839
+
6840
+ // ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js
6841
+ var require_draft2020 = __commonJS({
6842
+ "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js"(exports) {
6843
+ Object.defineProperty(exports, "__esModule", { value: true });
6844
+ var core_1 = require_core3();
6845
+ var validation_1 = require_validation2();
6846
+ var applicator_1 = require_applicator2();
6847
+ var dynamic_1 = require_dynamic();
6848
+ var next_1 = require_next();
6849
+ var unevaluated_1 = require_unevaluated2();
6850
+ var format_1 = require_format2();
6851
+ var metadata_1 = require_metadata();
6852
+ var draft2020Vocabularies = [
6853
+ dynamic_1.default,
6854
+ core_1.default,
6855
+ validation_1.default,
6856
+ (0, applicator_1.default)(true),
6857
+ format_1.default,
6858
+ metadata_1.metadataVocabulary,
6859
+ metadata_1.contentVocabulary,
6860
+ next_1.default,
6861
+ unevaluated_1.default
6862
+ ];
6863
+ exports.default = draft2020Vocabularies;
7057
6864
  }
7058
6865
  });
7059
6866
 
@@ -7205,7 +7012,9 @@ function defaultReadMicros() {
7205
7012
  }
7206
7013
 
7207
7014
  // src/schema.ts
7208
- var import__ = __toESM(require__());
7015
+ var AjvCoreModule = __toESM(require_core());
7016
+ var AddMetaSchema2020Module = __toESM(require_json_schema_2020_12());
7017
+ var Draft2020Module = __toESM(require_draft2020());
7209
7018
 
7210
7019
  // schema/profile-capture.schema.json
7211
7020
  var profile_capture_schema_default = {
@@ -7281,7 +7090,35 @@ var profile_capture_schema_default = {
7281
7090
  };
7282
7091
 
7283
7092
  // src/schema.ts
7284
- var validator = new import__.Ajv2020({ allErrors: true, strict: true }).compile(profile_capture_schema_default);
7093
+ function resolveCommonJsDefault(moduleDefault, isExpected) {
7094
+ if (isExpected(moduleDefault)) return moduleDefault;
7095
+ const nestedDefault = moduleDefault?.default;
7096
+ if (isExpected(nestedDefault)) return nestedDefault;
7097
+ throw new TypeError("Ajv CommonJS export shape is unsupported");
7098
+ }
7099
+ var AjvCore = resolveCommonJsDefault(
7100
+ AjvCoreModule.default,
7101
+ (value) => typeof value === "function"
7102
+ );
7103
+ var addMetaSchema2020 = resolveCommonJsDefault(
7104
+ AddMetaSchema2020Module.default,
7105
+ (value) => typeof value === "function"
7106
+ );
7107
+ var draft2020 = resolveCommonJsDefault(
7108
+ Draft2020Module.default,
7109
+ (value) => Array.isArray(value)
7110
+ );
7111
+ var ajv = new AjvCore({
7112
+ allErrors: true,
7113
+ dynamicRef: true,
7114
+ meta: false,
7115
+ next: true,
7116
+ strict: true,
7117
+ unevaluated: true
7118
+ });
7119
+ for (const vocabulary of draft2020) ajv.addVocabulary(vocabulary);
7120
+ addMetaSchema2020.call(ajv, false);
7121
+ var validator = ajv.compile(profile_capture_schema_default);
7285
7122
  function error(code, path, message) {
7286
7123
  return {
7287
7124
  ok: false,