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