@spotlightjs/spotlight 4.11.3 → 4.11.5
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/_virtual/ajv.js +6 -3
- package/dist/_virtual/ajv2.js +13 -0
- package/dist/_virtual/index.js +6 -3
- package/dist/_virtual/index10.js +3 -3
- package/dist/_virtual/index11.js +3 -3
- package/dist/_virtual/index12.js +13 -0
- package/dist/_virtual/index2.js +3 -3
- package/dist/_virtual/index4.js +3 -3
- package/dist/_virtual/index5.js +3 -3
- package/dist/_virtual/index6.js +3 -3
- package/dist/_virtual/index7.js +3 -3
- package/dist/_virtual/index8.js +3 -3
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js +1 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js.map +1 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +3 -3
- package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/formats.js +203 -194
- package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/formats.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/index.js +47 -47
- package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/limit.js +77 -69
- package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/limit.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/ajv.js +80 -85
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/ajv.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js +145 -136
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/index.js +692 -685
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/index.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/scope.js +143 -135
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/errors.js +122 -116
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/errors.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/index.js +218 -218
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/index.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/names.js +43 -35
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/names.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/ref_error.js +19 -11
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/ref_error.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/resolve.js +149 -144
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/resolve.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/rules.js +31 -25
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/rules.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/util.js +164 -160
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/util.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/applicability.js +23 -17
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/boolSchema.js +52 -49
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/dataType.js +174 -173
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/defaults.js +36 -32
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/index.js +473 -478
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/index.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/keyword.js +113 -111
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/subschema.js +81 -77
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/core.js +573 -574
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/core.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/data.json.js +3 -17
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/data.json.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +4 -236
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/equal.js +16 -7
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/equal.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/ucs2length.js +27 -18
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/uri.js +16 -7
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/uri.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/validation_error.js +17 -8
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/validation_error.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +55 -48
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +104 -99
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +30 -22
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +20 -12
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +95 -88
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +94 -88
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/if.js +71 -64
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/index.js +66 -73
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items.js +60 -54
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +41 -36
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/not.js +34 -26
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +60 -53
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +73 -67
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +20 -12
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +62 -57
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +46 -39
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +21 -13
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/code.js +132 -129
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/code.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/id.js +17 -8
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/index.js +27 -20
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/ref.js +121 -118
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +103 -99
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +15 -9
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/draft7.js +30 -26
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/format.js +84 -76
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/index.js +16 -8
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/metadata.js +24 -18
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/const.js +33 -27
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/enum.js +53 -47
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/index.js +52 -53
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +32 -24
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +37 -31
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +35 -27
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +32 -24
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +31 -23
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +41 -35
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/required.js +80 -74
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -1
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +71 -66
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -1
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +34 -27
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js.map +1 -1
- package/dist/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/index.js +300 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/index.js.map +1 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/schemes.js +223 -0
- package/dist/node_modules/.pnpm/{fast-uri@3.1.0 → fast-uri@3.1.2}/node_modules/fast-uri/lib/schemes.js.map +1 -1
- package/dist/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/utils.js +325 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/utils.js.map +1 -0
- package/dist/node_modules/.pnpm/hono@4.12.18/node_modules/hono/dist/helper/streaming/sse.js.map +1 -0
- package/dist/node_modules/.pnpm/{hono@4.12.8 → hono@4.12.18}/node_modules/hono/dist/middleware/cors/index.js +8 -8
- package/dist/node_modules/.pnpm/hono@4.12.18/node_modules/hono/dist/middleware/cors/index.js.map +1 -0
- package/dist/node_modules/.pnpm/hono@4.12.18/node_modules/hono/dist/utils/html.js.map +1 -0
- package/dist/node_modules/.pnpm/hono@4.12.18/node_modules/hono/dist/utils/stream.js.map +1 -0
- package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +83 -78
- package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js.map +1 -1
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.1.13/node_modules/zod-to-json-schema/dist/esm/Options.js +1 -1
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.1.13/node_modules/zod-to-json-schema/dist/esm/Options.js.map +1 -1
- package/dist/node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/util.js +1 -1
- package/dist/node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/util.js.map +1 -1
- package/dist/sentry-config.js +2 -2
- package/dist/server/cli/run.js +2 -2
- package/dist/server/cli.js +2 -2
- package/dist/server/main.js +2 -2
- package/dist/server/mcp/mcp.js +2 -2
- package/dist/server/routes/stream/streaming.js +2 -2
- package/dist/ui/assets/index.js +61 -70
- package/dist/ui/assets/index2.js +1 -1
- package/dist/ui/assets/instrumentation.js +18 -18
- package/dist/ui/assets/main.css +1 -1
- package/dist/ui/assets/main.js +1 -1
- package/dist/ui/assets/serverTimingMeta.js +23 -30
- package/package.json +9 -9
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +0 -264
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js.map +0 -1
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +0 -197
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +0 -261
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js.map +0 -1
- package/dist/node_modules/.pnpm/hono@4.12.8/node_modules/hono/dist/helper/streaming/sse.js.map +0 -1
- package/dist/node_modules/.pnpm/hono@4.12.8/node_modules/hono/dist/middleware/cors/index.js.map +0 -1
- package/dist/node_modules/.pnpm/hono@4.12.8/node_modules/hono/dist/utils/html.js.map +0 -1
- package/dist/node_modules/.pnpm/hono@4.12.8/node_modules/hono/dist/utils/stream.js.map +0 -1
- /package/dist/node_modules/.pnpm/{hono@4.12.8 → hono@4.12.18}/node_modules/hono/dist/helper/streaming/sse.js +0 -0
- /package/dist/node_modules/.pnpm/{hono@4.12.8 → hono@4.12.18}/node_modules/hono/dist/utils/html.js +0 -0
- /package/dist/node_modules/.pnpm/{hono@4.12.8 → hono@4.12.18}/node_modules/hono/dist/utils/stream.js +0 -0
|
@@ -2,636 +2,635 @@
|
|
|
2
2
|
!(function() {
|
|
3
3
|
try {
|
|
4
4
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
5
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
5
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "c8f163c9-517a-47f2-904c-28e555b29a77", e._sentryDebugIdIdentifier = "sentry-dbid-c8f163c9-517a-47f2-904c-28e555b29a77");
|
|
6
6
|
} catch (e2) {
|
|
7
7
|
}
|
|
8
8
|
})();
|
|
9
9
|
import { __exports as core } from "../../../../../../_virtual/core.js";
|
|
10
|
-
import "./compile/validate/index.js";
|
|
11
|
-
import "./compile/codegen/index.js";
|
|
12
|
-
import "./runtime/validation_error.js";
|
|
13
|
-
import "./compile/ref_error.js";
|
|
14
|
-
import "./compile/rules.js";
|
|
15
|
-
import "./compile/index.js";
|
|
16
|
-
import "./compile/resolve.js";
|
|
17
|
-
import "./compile/validate/dataType.js";
|
|
18
|
-
import "./compile/util.js";
|
|
10
|
+
import { __require as requireValidate } from "./compile/validate/index.js";
|
|
11
|
+
import { __require as requireCodegen } from "./compile/codegen/index.js";
|
|
12
|
+
import { __require as requireValidation_error } from "./runtime/validation_error.js";
|
|
13
|
+
import { __require as requireRef_error } from "./compile/ref_error.js";
|
|
14
|
+
import { __require as requireRules } from "./compile/rules.js";
|
|
15
|
+
import { __require as requireCompile } from "./compile/index.js";
|
|
16
|
+
import { __require as requireResolve } from "./compile/resolve.js";
|
|
17
|
+
import { __require as requireDataType } from "./compile/validate/dataType.js";
|
|
18
|
+
import { __require as requireUtil } from "./compile/util.js";
|
|
19
19
|
import require$$9 from "./refs/data.json.js";
|
|
20
|
-
import "./runtime/uri.js";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
strictKeywords: "It is default now, see option `strict`.",
|
|
96
|
-
uniqueItems: '"uniqueItems" keyword is always validated.',
|
|
97
|
-
unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",
|
|
98
|
-
cache: "Map is used as cache, schema object as key.",
|
|
99
|
-
serialize: "Map is used as cache, schema object as key.",
|
|
100
|
-
ajvErrors: "It is default now."
|
|
101
|
-
};
|
|
102
|
-
const deprecatedOptions = {
|
|
103
|
-
ignoreKeywordsWithRef: "",
|
|
104
|
-
jsPropertySyntax: "",
|
|
105
|
-
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
106
|
-
};
|
|
107
|
-
const MAX_EXPRESSION = 200;
|
|
108
|
-
function requiredOptions(o) {
|
|
109
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
110
|
-
const s = o.strict;
|
|
111
|
-
const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;
|
|
112
|
-
const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
|
|
113
|
-
const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
|
|
114
|
-
const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
|
|
115
|
-
return {
|
|
116
|
-
strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true,
|
|
117
|
-
strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true,
|
|
118
|
-
strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log",
|
|
119
|
-
strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log",
|
|
120
|
-
strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false,
|
|
121
|
-
code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp },
|
|
122
|
-
loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION,
|
|
123
|
-
loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION,
|
|
124
|
-
meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true,
|
|
125
|
-
messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true,
|
|
126
|
-
inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true,
|
|
127
|
-
schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : "$id",
|
|
128
|
-
addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true,
|
|
129
|
-
validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true,
|
|
130
|
-
validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true,
|
|
131
|
-
unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true,
|
|
132
|
-
int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true,
|
|
133
|
-
uriResolver
|
|
20
|
+
import { __require as requireUri } from "./runtime/uri.js";
|
|
21
|
+
var hasRequiredCore;
|
|
22
|
+
function requireCore() {
|
|
23
|
+
if (hasRequiredCore) return core;
|
|
24
|
+
hasRequiredCore = 1;
|
|
25
|
+
(function(exports$1) {
|
|
26
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
27
|
+
exports$1.CodeGen = exports$1.Name = exports$1.nil = exports$1.stringify = exports$1.str = exports$1._ = exports$1.KeywordCxt = void 0;
|
|
28
|
+
var validate_1 = /* @__PURE__ */ requireValidate();
|
|
29
|
+
Object.defineProperty(exports$1, "KeywordCxt", { enumerable: true, get: function() {
|
|
30
|
+
return validate_1.KeywordCxt;
|
|
31
|
+
} });
|
|
32
|
+
var codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
33
|
+
Object.defineProperty(exports$1, "_", { enumerable: true, get: function() {
|
|
34
|
+
return codegen_1._;
|
|
35
|
+
} });
|
|
36
|
+
Object.defineProperty(exports$1, "str", { enumerable: true, get: function() {
|
|
37
|
+
return codegen_1.str;
|
|
38
|
+
} });
|
|
39
|
+
Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function() {
|
|
40
|
+
return codegen_1.stringify;
|
|
41
|
+
} });
|
|
42
|
+
Object.defineProperty(exports$1, "nil", { enumerable: true, get: function() {
|
|
43
|
+
return codegen_1.nil;
|
|
44
|
+
} });
|
|
45
|
+
Object.defineProperty(exports$1, "Name", { enumerable: true, get: function() {
|
|
46
|
+
return codegen_1.Name;
|
|
47
|
+
} });
|
|
48
|
+
Object.defineProperty(exports$1, "CodeGen", { enumerable: true, get: function() {
|
|
49
|
+
return codegen_1.CodeGen;
|
|
50
|
+
} });
|
|
51
|
+
const validation_error_1 = /* @__PURE__ */ requireValidation_error();
|
|
52
|
+
const ref_error_1 = /* @__PURE__ */ requireRef_error();
|
|
53
|
+
const rules_1 = /* @__PURE__ */ requireRules();
|
|
54
|
+
const compile_1 = /* @__PURE__ */ requireCompile();
|
|
55
|
+
const codegen_2 = /* @__PURE__ */ requireCodegen();
|
|
56
|
+
const resolve_1 = /* @__PURE__ */ requireResolve();
|
|
57
|
+
const dataType_1 = /* @__PURE__ */ requireDataType();
|
|
58
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
59
|
+
const $dataRefSchema = require$$9;
|
|
60
|
+
const uri_1 = /* @__PURE__ */ requireUri();
|
|
61
|
+
const defaultRegExp = (str, flags) => new RegExp(str, flags);
|
|
62
|
+
defaultRegExp.code = "new RegExp";
|
|
63
|
+
const META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
|
|
64
|
+
const EXT_SCOPE_NAMES = /* @__PURE__ */ new Set([
|
|
65
|
+
"validate",
|
|
66
|
+
"serialize",
|
|
67
|
+
"parse",
|
|
68
|
+
"wrapper",
|
|
69
|
+
"root",
|
|
70
|
+
"schema",
|
|
71
|
+
"keyword",
|
|
72
|
+
"pattern",
|
|
73
|
+
"formats",
|
|
74
|
+
"validate$data",
|
|
75
|
+
"func",
|
|
76
|
+
"obj",
|
|
77
|
+
"Error"
|
|
78
|
+
]);
|
|
79
|
+
const removedOptions = {
|
|
80
|
+
errorDataPath: "",
|
|
81
|
+
format: "`validateFormats: false` can be used instead.",
|
|
82
|
+
nullable: '"nullable" keyword is supported by default.',
|
|
83
|
+
jsonPointers: "Deprecated jsPropertySyntax can be used instead.",
|
|
84
|
+
extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.",
|
|
85
|
+
missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.",
|
|
86
|
+
processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`",
|
|
87
|
+
sourceCode: "Use option `code: {source: true}`",
|
|
88
|
+
strictDefaults: "It is default now, see option `strict`.",
|
|
89
|
+
strictKeywords: "It is default now, see option `strict`.",
|
|
90
|
+
uniqueItems: '"uniqueItems" keyword is always validated.',
|
|
91
|
+
unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",
|
|
92
|
+
cache: "Map is used as cache, schema object as key.",
|
|
93
|
+
serialize: "Map is used as cache, schema object as key.",
|
|
94
|
+
ajvErrors: "It is default now."
|
|
134
95
|
};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
96
|
+
const deprecatedOptions = {
|
|
97
|
+
ignoreKeywordsWithRef: "",
|
|
98
|
+
jsPropertySyntax: "",
|
|
99
|
+
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
100
|
+
};
|
|
101
|
+
const MAX_EXPRESSION = 200;
|
|
102
|
+
function requiredOptions(o) {
|
|
103
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
104
|
+
const s = o.strict;
|
|
105
|
+
const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;
|
|
106
|
+
const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
|
|
107
|
+
const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
|
|
108
|
+
const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
|
|
109
|
+
return {
|
|
110
|
+
strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true,
|
|
111
|
+
strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true,
|
|
112
|
+
strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log",
|
|
113
|
+
strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log",
|
|
114
|
+
strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false,
|
|
115
|
+
code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp },
|
|
116
|
+
loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION,
|
|
117
|
+
loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION,
|
|
118
|
+
meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true,
|
|
119
|
+
messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true,
|
|
120
|
+
inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true,
|
|
121
|
+
schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : "$id",
|
|
122
|
+
addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true,
|
|
123
|
+
validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true,
|
|
124
|
+
validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true,
|
|
125
|
+
unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true,
|
|
126
|
+
int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true,
|
|
127
|
+
uriResolver
|
|
128
|
+
};
|
|
167
129
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
130
|
+
class Ajv {
|
|
131
|
+
constructor(opts = {}) {
|
|
132
|
+
this.schemas = {};
|
|
133
|
+
this.refs = {};
|
|
134
|
+
this.formats = {};
|
|
135
|
+
this._compilations = /* @__PURE__ */ new Set();
|
|
136
|
+
this._loading = {};
|
|
137
|
+
this._cache = /* @__PURE__ */ new Map();
|
|
138
|
+
opts = this.opts = { ...opts, ...requiredOptions(opts) };
|
|
139
|
+
const { es5, lines } = this.opts.code;
|
|
140
|
+
this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines });
|
|
141
|
+
this.logger = getLogger(opts.logger);
|
|
142
|
+
const formatOpt = opts.validateFormats;
|
|
143
|
+
opts.validateFormats = false;
|
|
144
|
+
this.RULES = (0, rules_1.getRules)();
|
|
145
|
+
checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED");
|
|
146
|
+
checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn");
|
|
147
|
+
this._metaOpts = getMetaSchemaOptions.call(this);
|
|
148
|
+
if (opts.formats)
|
|
149
|
+
addInitialFormats.call(this);
|
|
150
|
+
this._addVocabularies();
|
|
151
|
+
this._addDefaultMetaSchema();
|
|
152
|
+
if (opts.keywords)
|
|
153
|
+
addInitialKeywords.call(this, opts.keywords);
|
|
154
|
+
if (typeof opts.meta == "object")
|
|
155
|
+
this.addMetaSchema(opts.meta);
|
|
156
|
+
addInitialSchemas.call(this);
|
|
157
|
+
opts.validateFormats = formatOpt;
|
|
175
158
|
}
|
|
176
|
-
|
|
177
|
-
this.
|
|
178
|
-
}
|
|
179
|
-
defaultMeta() {
|
|
180
|
-
const { meta, schemaId } = this.opts;
|
|
181
|
-
return this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : void 0;
|
|
182
|
-
}
|
|
183
|
-
validate(schemaKeyRef, data) {
|
|
184
|
-
let v;
|
|
185
|
-
if (typeof schemaKeyRef == "string") {
|
|
186
|
-
v = this.getSchema(schemaKeyRef);
|
|
187
|
-
if (!v)
|
|
188
|
-
throw new Error(`no schema with key or ref "${schemaKeyRef}"`);
|
|
189
|
-
} else {
|
|
190
|
-
v = this.compile(schemaKeyRef);
|
|
159
|
+
_addVocabularies() {
|
|
160
|
+
this.addKeyword("$async");
|
|
191
161
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
if (typeof this.opts.loadSchema != "function") {
|
|
203
|
-
throw new Error("options.loadSchema should be a function");
|
|
162
|
+
_addDefaultMetaSchema() {
|
|
163
|
+
const { $data, meta, schemaId } = this.opts;
|
|
164
|
+
let _dataRefSchema = $dataRefSchema;
|
|
165
|
+
if (schemaId === "id") {
|
|
166
|
+
_dataRefSchema = { ...$dataRefSchema };
|
|
167
|
+
_dataRefSchema.id = _dataRefSchema.$id;
|
|
168
|
+
delete _dataRefSchema.$id;
|
|
169
|
+
}
|
|
170
|
+
if (meta && $data)
|
|
171
|
+
this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false);
|
|
204
172
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
await loadMetaSchema.call(this, _schema.$schema);
|
|
209
|
-
const sch = this._addSchema(_schema, _meta);
|
|
210
|
-
return sch.validate || _compileAsync.call(this, sch);
|
|
173
|
+
defaultMeta() {
|
|
174
|
+
const { meta, schemaId } = this.opts;
|
|
175
|
+
return this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : void 0;
|
|
211
176
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
177
|
+
validate(schemaKeyRef, data) {
|
|
178
|
+
let v;
|
|
179
|
+
if (typeof schemaKeyRef == "string") {
|
|
180
|
+
v = this.getSchema(schemaKeyRef);
|
|
181
|
+
if (!v)
|
|
182
|
+
throw new Error(`no schema with key or ref "${schemaKeyRef}"`);
|
|
183
|
+
} else {
|
|
184
|
+
v = this.compile(schemaKeyRef);
|
|
215
185
|
}
|
|
186
|
+
const valid = v(data);
|
|
187
|
+
if (!("$async" in v))
|
|
188
|
+
this.errors = v.errors;
|
|
189
|
+
return valid;
|
|
216
190
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
} catch (e) {
|
|
221
|
-
if (!(e instanceof ref_error_1.default))
|
|
222
|
-
throw e;
|
|
223
|
-
checkLoaded.call(this, e);
|
|
224
|
-
await loadMissingSchema.call(this, e.missingSchema);
|
|
225
|
-
return _compileAsync.call(this, sch);
|
|
226
|
-
}
|
|
191
|
+
compile(schema, _meta) {
|
|
192
|
+
const sch = this._addSchema(schema, _meta);
|
|
193
|
+
return sch.validate || this._compileSchemaEnv(sch);
|
|
227
194
|
}
|
|
228
|
-
|
|
229
|
-
if (this.
|
|
230
|
-
throw new Error(
|
|
195
|
+
compileAsync(schema, meta) {
|
|
196
|
+
if (typeof this.opts.loadSchema != "function") {
|
|
197
|
+
throw new Error("options.loadSchema should be a function");
|
|
231
198
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
if (!this.refs[ref])
|
|
199
|
+
const { loadSchema } = this.opts;
|
|
200
|
+
return runCompileAsync.call(this, schema, meta);
|
|
201
|
+
async function runCompileAsync(_schema, _meta) {
|
|
236
202
|
await loadMetaSchema.call(this, _schema.$schema);
|
|
237
|
-
|
|
238
|
-
|
|
203
|
+
const sch = this._addSchema(_schema, _meta);
|
|
204
|
+
return sch.validate || _compileAsync.call(this, sch);
|
|
205
|
+
}
|
|
206
|
+
async function loadMetaSchema($ref) {
|
|
207
|
+
if ($ref && !this.getSchema($ref)) {
|
|
208
|
+
await runCompileAsync.call(this, { $ref }, true);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
async function _compileAsync(sch) {
|
|
212
|
+
try {
|
|
213
|
+
return this._compileSchemaEnv(sch);
|
|
214
|
+
} catch (e) {
|
|
215
|
+
if (!(e instanceof ref_error_1.default))
|
|
216
|
+
throw e;
|
|
217
|
+
checkLoaded.call(this, e);
|
|
218
|
+
await loadMissingSchema.call(this, e.missingSchema);
|
|
219
|
+
return _compileAsync.call(this, sch);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function checkLoaded({ missingSchema: ref, missingRef }) {
|
|
223
|
+
if (this.refs[ref]) {
|
|
224
|
+
throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
async function loadMissingSchema(ref) {
|
|
228
|
+
const _schema = await _loadSchema.call(this, ref);
|
|
229
|
+
if (!this.refs[ref])
|
|
230
|
+
await loadMetaSchema.call(this, _schema.$schema);
|
|
231
|
+
if (!this.refs[ref])
|
|
232
|
+
this.addSchema(_schema, ref, meta);
|
|
233
|
+
}
|
|
234
|
+
async function _loadSchema(ref) {
|
|
235
|
+
const p = this._loading[ref];
|
|
236
|
+
if (p)
|
|
237
|
+
return p;
|
|
238
|
+
try {
|
|
239
|
+
return await (this._loading[ref] = loadSchema(ref));
|
|
240
|
+
} finally {
|
|
241
|
+
delete this._loading[ref];
|
|
242
|
+
}
|
|
243
|
+
}
|
|
239
244
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return
|
|
246
|
-
} finally {
|
|
247
|
-
delete this._loading[ref];
|
|
245
|
+
// Adds schema to the instance
|
|
246
|
+
addSchema(schema, key, _meta, _validateSchema = this.opts.validateSchema) {
|
|
247
|
+
if (Array.isArray(schema)) {
|
|
248
|
+
for (const sch of schema)
|
|
249
|
+
this.addSchema(sch, void 0, _meta, _validateSchema);
|
|
250
|
+
return this;
|
|
248
251
|
}
|
|
252
|
+
let id;
|
|
253
|
+
if (typeof schema === "object") {
|
|
254
|
+
const { schemaId } = this.opts;
|
|
255
|
+
id = schema[schemaId];
|
|
256
|
+
if (id !== void 0 && typeof id != "string") {
|
|
257
|
+
throw new Error(`schema ${schemaId} must be string`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
key = (0, resolve_1.normalizeId)(key || id);
|
|
261
|
+
this._checkUnique(key);
|
|
262
|
+
this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true);
|
|
263
|
+
return this;
|
|
249
264
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
for (const sch of schema)
|
|
255
|
-
this.addSchema(sch, void 0, _meta, _validateSchema);
|
|
265
|
+
// Add schema that will be used to validate other schemas
|
|
266
|
+
// options in META_IGNORE_OPTIONS are alway set to false
|
|
267
|
+
addMetaSchema(schema, key, _validateSchema = this.opts.validateSchema) {
|
|
268
|
+
this.addSchema(schema, key, true, _validateSchema);
|
|
256
269
|
return this;
|
|
257
270
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
271
|
+
// Validate schema against its meta-schema
|
|
272
|
+
validateSchema(schema, throwOrLogError) {
|
|
273
|
+
if (typeof schema == "boolean")
|
|
274
|
+
return true;
|
|
275
|
+
let $schema;
|
|
276
|
+
$schema = schema.$schema;
|
|
277
|
+
if ($schema !== void 0 && typeof $schema != "string") {
|
|
278
|
+
throw new Error("$schema must be a string");
|
|
264
279
|
}
|
|
280
|
+
$schema = $schema || this.opts.defaultMeta || this.defaultMeta();
|
|
281
|
+
if (!$schema) {
|
|
282
|
+
this.logger.warn("meta-schema not available");
|
|
283
|
+
this.errors = null;
|
|
284
|
+
return true;
|
|
285
|
+
}
|
|
286
|
+
const valid = this.validate($schema, schema);
|
|
287
|
+
if (!valid && throwOrLogError) {
|
|
288
|
+
const message = "schema is invalid: " + this.errorsText();
|
|
289
|
+
if (this.opts.validateSchema === "log")
|
|
290
|
+
this.logger.error(message);
|
|
291
|
+
else
|
|
292
|
+
throw new Error(message);
|
|
293
|
+
}
|
|
294
|
+
return valid;
|
|
265
295
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
return
|
|
281
|
-
let $schema;
|
|
282
|
-
$schema = schema.$schema;
|
|
283
|
-
if ($schema !== void 0 && typeof $schema != "string") {
|
|
284
|
-
throw new Error("$schema must be a string");
|
|
285
|
-
}
|
|
286
|
-
$schema = $schema || this.opts.defaultMeta || this.defaultMeta();
|
|
287
|
-
if (!$schema) {
|
|
288
|
-
this.logger.warn("meta-schema not available");
|
|
289
|
-
this.errors = null;
|
|
290
|
-
return true;
|
|
291
|
-
}
|
|
292
|
-
const valid = this.validate($schema, schema);
|
|
293
|
-
if (!valid && throwOrLogError) {
|
|
294
|
-
const message = "schema is invalid: " + this.errorsText();
|
|
295
|
-
if (this.opts.validateSchema === "log")
|
|
296
|
-
this.logger.error(message);
|
|
297
|
-
else
|
|
298
|
-
throw new Error(message);
|
|
296
|
+
// Get compiled schema by `key` or `ref`.
|
|
297
|
+
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
298
|
+
getSchema(keyRef) {
|
|
299
|
+
let sch;
|
|
300
|
+
while (typeof (sch = getSchEnv.call(this, keyRef)) == "string")
|
|
301
|
+
keyRef = sch;
|
|
302
|
+
if (sch === void 0) {
|
|
303
|
+
const { schemaId } = this.opts;
|
|
304
|
+
const root = new compile_1.SchemaEnv({ schema: {}, schemaId });
|
|
305
|
+
sch = compile_1.resolveSchema.call(this, root, keyRef);
|
|
306
|
+
if (!sch)
|
|
307
|
+
return;
|
|
308
|
+
this.refs[keyRef] = sch;
|
|
309
|
+
}
|
|
310
|
+
return sch.validate || this._compileSchemaEnv(sch);
|
|
299
311
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
// Remove cached schema(s).
|
|
313
|
+
// If no parameter is passed all schemas but meta-schemas are removed.
|
|
314
|
+
// If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
|
315
|
+
// Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
|
316
|
+
removeSchema(schemaKeyRef) {
|
|
317
|
+
if (schemaKeyRef instanceof RegExp) {
|
|
318
|
+
this._removeAllSchemas(this.schemas, schemaKeyRef);
|
|
319
|
+
this._removeAllSchemas(this.refs, schemaKeyRef);
|
|
320
|
+
return this;
|
|
321
|
+
}
|
|
322
|
+
switch (typeof schemaKeyRef) {
|
|
323
|
+
case "undefined":
|
|
324
|
+
this._removeAllSchemas(this.schemas);
|
|
325
|
+
this._removeAllSchemas(this.refs);
|
|
326
|
+
this._cache.clear();
|
|
327
|
+
return this;
|
|
328
|
+
case "string": {
|
|
329
|
+
const sch = getSchEnv.call(this, schemaKeyRef);
|
|
330
|
+
if (typeof sch == "object")
|
|
331
|
+
this._cache.delete(sch.schema);
|
|
332
|
+
delete this.schemas[schemaKeyRef];
|
|
333
|
+
delete this.refs[schemaKeyRef];
|
|
334
|
+
return this;
|
|
335
|
+
}
|
|
336
|
+
case "object": {
|
|
337
|
+
const cacheKey = schemaKeyRef;
|
|
338
|
+
this._cache.delete(cacheKey);
|
|
339
|
+
let id = schemaKeyRef[this.opts.schemaId];
|
|
340
|
+
if (id) {
|
|
341
|
+
id = (0, resolve_1.normalizeId)(id);
|
|
342
|
+
delete this.schemas[id];
|
|
343
|
+
delete this.refs[id];
|
|
344
|
+
}
|
|
345
|
+
return this;
|
|
346
|
+
}
|
|
347
|
+
default:
|
|
348
|
+
throw new Error("ajv.removeSchema: invalid parameter");
|
|
349
|
+
}
|
|
315
350
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
// If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
|
321
|
-
// Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
|
322
|
-
removeSchema(schemaKeyRef) {
|
|
323
|
-
if (schemaKeyRef instanceof RegExp) {
|
|
324
|
-
this._removeAllSchemas(this.schemas, schemaKeyRef);
|
|
325
|
-
this._removeAllSchemas(this.refs, schemaKeyRef);
|
|
351
|
+
// add "vocabulary" - a collection of keywords
|
|
352
|
+
addVocabulary(definitions) {
|
|
353
|
+
for (const def of definitions)
|
|
354
|
+
this.addKeyword(def);
|
|
326
355
|
return this;
|
|
327
356
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
const sch = getSchEnv.call(this, schemaKeyRef);
|
|
336
|
-
if (typeof sch == "object")
|
|
337
|
-
this._cache.delete(sch.schema);
|
|
338
|
-
delete this.schemas[schemaKeyRef];
|
|
339
|
-
delete this.refs[schemaKeyRef];
|
|
340
|
-
return this;
|
|
341
|
-
}
|
|
342
|
-
case "object": {
|
|
343
|
-
const cacheKey = schemaKeyRef;
|
|
344
|
-
this._cache.delete(cacheKey);
|
|
345
|
-
let id = schemaKeyRef[this.opts.schemaId];
|
|
346
|
-
if (id) {
|
|
347
|
-
id = (0, resolve_1.normalizeId)(id);
|
|
348
|
-
delete this.schemas[id];
|
|
349
|
-
delete this.refs[id];
|
|
357
|
+
addKeyword(kwdOrDef, def) {
|
|
358
|
+
let keyword;
|
|
359
|
+
if (typeof kwdOrDef == "string") {
|
|
360
|
+
keyword = kwdOrDef;
|
|
361
|
+
if (typeof def == "object") {
|
|
362
|
+
this.logger.warn("these parameters are deprecated, see docs for addKeyword");
|
|
363
|
+
def.keyword = keyword;
|
|
350
364
|
}
|
|
365
|
+
} else if (typeof kwdOrDef == "object" && def === void 0) {
|
|
366
|
+
def = kwdOrDef;
|
|
367
|
+
keyword = def.keyword;
|
|
368
|
+
if (Array.isArray(keyword) && !keyword.length) {
|
|
369
|
+
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
370
|
+
}
|
|
371
|
+
} else {
|
|
372
|
+
throw new Error("invalid addKeywords parameters");
|
|
373
|
+
}
|
|
374
|
+
checkKeyword.call(this, keyword, def);
|
|
375
|
+
if (!def) {
|
|
376
|
+
(0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd));
|
|
351
377
|
return this;
|
|
352
378
|
}
|
|
353
|
-
|
|
354
|
-
|
|
379
|
+
keywordMetaschema.call(this, def);
|
|
380
|
+
const definition = {
|
|
381
|
+
...def,
|
|
382
|
+
type: (0, dataType_1.getJSONTypes)(def.type),
|
|
383
|
+
schemaType: (0, dataType_1.getJSONTypes)(def.schemaType)
|
|
384
|
+
};
|
|
385
|
+
(0, util_1.eachItem)(keyword, definition.type.length === 0 ? (k) => addRule.call(this, k, definition) : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t)));
|
|
386
|
+
return this;
|
|
355
387
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
def.keyword = keyword;
|
|
370
|
-
}
|
|
371
|
-
} else if (typeof kwdOrDef == "object" && def === void 0) {
|
|
372
|
-
def = kwdOrDef;
|
|
373
|
-
keyword = def.keyword;
|
|
374
|
-
if (Array.isArray(keyword) && !keyword.length) {
|
|
375
|
-
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
388
|
+
getKeyword(keyword) {
|
|
389
|
+
const rule = this.RULES.all[keyword];
|
|
390
|
+
return typeof rule == "object" ? rule.definition : !!rule;
|
|
391
|
+
}
|
|
392
|
+
// Remove keyword
|
|
393
|
+
removeKeyword(keyword) {
|
|
394
|
+
const { RULES } = this;
|
|
395
|
+
delete RULES.keywords[keyword];
|
|
396
|
+
delete RULES.all[keyword];
|
|
397
|
+
for (const group of RULES.rules) {
|
|
398
|
+
const i = group.rules.findIndex((rule) => rule.keyword === keyword);
|
|
399
|
+
if (i >= 0)
|
|
400
|
+
group.rules.splice(i, 1);
|
|
376
401
|
}
|
|
377
|
-
|
|
378
|
-
throw new Error("invalid addKeywords parameters");
|
|
402
|
+
return this;
|
|
379
403
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
404
|
+
// Add format
|
|
405
|
+
addFormat(name, format) {
|
|
406
|
+
if (typeof format == "string")
|
|
407
|
+
format = new RegExp(format);
|
|
408
|
+
this.formats[name] = format;
|
|
383
409
|
return this;
|
|
384
410
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
schemaType: (0, dataType_1.getJSONTypes)(def.schemaType)
|
|
390
|
-
};
|
|
391
|
-
(0, util_1.eachItem)(keyword, definition.type.length === 0 ? (k) => addRule.call(this, k, definition) : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t)));
|
|
392
|
-
return this;
|
|
393
|
-
}
|
|
394
|
-
getKeyword(keyword) {
|
|
395
|
-
const rule = this.RULES.all[keyword];
|
|
396
|
-
return typeof rule == "object" ? rule.definition : !!rule;
|
|
397
|
-
}
|
|
398
|
-
// Remove keyword
|
|
399
|
-
removeKeyword(keyword) {
|
|
400
|
-
const { RULES } = this;
|
|
401
|
-
delete RULES.keywords[keyword];
|
|
402
|
-
delete RULES.all[keyword];
|
|
403
|
-
for (const group of RULES.rules) {
|
|
404
|
-
const i = group.rules.findIndex((rule) => rule.keyword === keyword);
|
|
405
|
-
if (i >= 0)
|
|
406
|
-
group.rules.splice(i, 1);
|
|
411
|
+
errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
412
|
+
if (!errors || errors.length === 0)
|
|
413
|
+
return "No errors";
|
|
414
|
+
return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text, msg) => text + separator + msg);
|
|
407
415
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
for (const jsonPointer of keywordsJsonPointers) {
|
|
426
|
-
const segments = jsonPointer.split("/").slice(1);
|
|
427
|
-
let keywords = metaSchema;
|
|
428
|
-
for (const seg of segments)
|
|
429
|
-
keywords = keywords[seg];
|
|
430
|
-
for (const key in rules2) {
|
|
431
|
-
const rule = rules2[key];
|
|
432
|
-
if (typeof rule != "object")
|
|
433
|
-
continue;
|
|
434
|
-
const { $data } = rule.definition;
|
|
435
|
-
const schema = keywords[key];
|
|
436
|
-
if ($data && schema)
|
|
437
|
-
keywords[key] = schemaOrData(schema);
|
|
416
|
+
$dataMetaSchema(metaSchema, keywordsJsonPointers) {
|
|
417
|
+
const rules = this.RULES.all;
|
|
418
|
+
metaSchema = JSON.parse(JSON.stringify(metaSchema));
|
|
419
|
+
for (const jsonPointer of keywordsJsonPointers) {
|
|
420
|
+
const segments = jsonPointer.split("/").slice(1);
|
|
421
|
+
let keywords = metaSchema;
|
|
422
|
+
for (const seg of segments)
|
|
423
|
+
keywords = keywords[seg];
|
|
424
|
+
for (const key in rules) {
|
|
425
|
+
const rule = rules[key];
|
|
426
|
+
if (typeof rule != "object")
|
|
427
|
+
continue;
|
|
428
|
+
const { $data } = rule.definition;
|
|
429
|
+
const schema = keywords[key];
|
|
430
|
+
if ($data && schema)
|
|
431
|
+
keywords[key] = schemaOrData(schema);
|
|
432
|
+
}
|
|
438
433
|
}
|
|
434
|
+
return metaSchema;
|
|
439
435
|
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
delete schemas[keyRef];
|
|
436
|
+
_removeAllSchemas(schemas, regex) {
|
|
437
|
+
for (const keyRef in schemas) {
|
|
438
|
+
const sch = schemas[keyRef];
|
|
439
|
+
if (!regex || regex.test(keyRef)) {
|
|
440
|
+
if (typeof sch == "string") {
|
|
441
|
+
delete schemas[keyRef];
|
|
442
|
+
} else if (sch && !sch.meta) {
|
|
443
|
+
this._cache.delete(sch.schema);
|
|
444
|
+
delete schemas[keyRef];
|
|
445
|
+
}
|
|
451
446
|
}
|
|
452
447
|
}
|
|
453
448
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
449
|
+
_addSchema(schema, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
450
|
+
let id;
|
|
451
|
+
const { schemaId } = this.opts;
|
|
452
|
+
if (typeof schema == "object") {
|
|
453
|
+
id = schema[schemaId];
|
|
454
|
+
} else {
|
|
455
|
+
if (this.opts.jtd)
|
|
456
|
+
throw new Error("schema must be object");
|
|
457
|
+
else if (typeof schema != "boolean")
|
|
458
|
+
throw new Error("schema must be object or boolean");
|
|
459
|
+
}
|
|
460
|
+
let sch = this._cache.get(schema);
|
|
461
|
+
if (sch !== void 0)
|
|
462
|
+
return sch;
|
|
463
|
+
baseId = (0, resolve_1.normalizeId)(id || baseId);
|
|
464
|
+
const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);
|
|
465
|
+
sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs });
|
|
466
|
+
this._cache.set(sch.schema, sch);
|
|
467
|
+
if (addSchema && !baseId.startsWith("#")) {
|
|
468
|
+
if (baseId)
|
|
469
|
+
this._checkUnique(baseId);
|
|
470
|
+
this.refs[baseId] = sch;
|
|
471
|
+
}
|
|
472
|
+
if (validateSchema)
|
|
473
|
+
this.validateSchema(schema, true);
|
|
468
474
|
return sch;
|
|
469
|
-
baseId = (0, resolve_1.normalizeId)(id || baseId);
|
|
470
|
-
const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);
|
|
471
|
-
sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs });
|
|
472
|
-
this._cache.set(sch.schema, sch);
|
|
473
|
-
if (addSchema && !baseId.startsWith("#")) {
|
|
474
|
-
if (baseId)
|
|
475
|
-
this._checkUnique(baseId);
|
|
476
|
-
this.refs[baseId] = sch;
|
|
477
475
|
}
|
|
478
|
-
|
|
479
|
-
this.
|
|
480
|
-
|
|
476
|
+
_checkUnique(id) {
|
|
477
|
+
if (this.schemas[id] || this.refs[id]) {
|
|
478
|
+
throw new Error(`schema with key or id "${id}" already exists`);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
_compileSchemaEnv(sch) {
|
|
482
|
+
if (sch.meta)
|
|
483
|
+
this._compileMetaSchema(sch);
|
|
484
|
+
else
|
|
485
|
+
compile_1.compileSchema.call(this, sch);
|
|
486
|
+
if (!sch.validate)
|
|
487
|
+
throw new Error("ajv implementation error");
|
|
488
|
+
return sch.validate;
|
|
489
|
+
}
|
|
490
|
+
_compileMetaSchema(sch) {
|
|
491
|
+
const currentOpts = this.opts;
|
|
492
|
+
this.opts = this._metaOpts;
|
|
493
|
+
try {
|
|
494
|
+
compile_1.compileSchema.call(this, sch);
|
|
495
|
+
} finally {
|
|
496
|
+
this.opts = currentOpts;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
481
499
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
500
|
+
Ajv.ValidationError = validation_error_1.default;
|
|
501
|
+
Ajv.MissingRefError = ref_error_1.default;
|
|
502
|
+
exports$1.default = Ajv;
|
|
503
|
+
function checkOptions(checkOpts, options, msg, log = "error") {
|
|
504
|
+
for (const key in checkOpts) {
|
|
505
|
+
const opt = key;
|
|
506
|
+
if (opt in options)
|
|
507
|
+
this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
485
508
|
}
|
|
486
509
|
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
510
|
+
function getSchEnv(keyRef) {
|
|
511
|
+
keyRef = (0, resolve_1.normalizeId)(keyRef);
|
|
512
|
+
return this.schemas[keyRef] || this.refs[keyRef];
|
|
513
|
+
}
|
|
514
|
+
function addInitialSchemas() {
|
|
515
|
+
const optsSchemas = this.opts.schemas;
|
|
516
|
+
if (!optsSchemas)
|
|
517
|
+
return;
|
|
518
|
+
if (Array.isArray(optsSchemas))
|
|
519
|
+
this.addSchema(optsSchemas);
|
|
490
520
|
else
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
throw new Error("ajv implementation error");
|
|
494
|
-
return sch.validate;
|
|
521
|
+
for (const key in optsSchemas)
|
|
522
|
+
this.addSchema(optsSchemas[key], key);
|
|
495
523
|
}
|
|
496
|
-
|
|
497
|
-
const
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
} finally {
|
|
502
|
-
this.opts = currentOpts;
|
|
524
|
+
function addInitialFormats() {
|
|
525
|
+
for (const name in this.opts.formats) {
|
|
526
|
+
const format = this.opts.formats[name];
|
|
527
|
+
if (format)
|
|
528
|
+
this.addFormat(name, format);
|
|
503
529
|
}
|
|
504
530
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
const
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
keyRef = (0, resolve_1.normalizeId)(keyRef);
|
|
518
|
-
return this.schemas[keyRef] || this.refs[keyRef];
|
|
519
|
-
}
|
|
520
|
-
function addInitialSchemas() {
|
|
521
|
-
const optsSchemas = this.opts.schemas;
|
|
522
|
-
if (!optsSchemas)
|
|
523
|
-
return;
|
|
524
|
-
if (Array.isArray(optsSchemas))
|
|
525
|
-
this.addSchema(optsSchemas);
|
|
526
|
-
else
|
|
527
|
-
for (const key in optsSchemas)
|
|
528
|
-
this.addSchema(optsSchemas[key], key);
|
|
529
|
-
}
|
|
530
|
-
function addInitialFormats() {
|
|
531
|
-
for (const name in this.opts.formats) {
|
|
532
|
-
const format = this.opts.formats[name];
|
|
533
|
-
if (format)
|
|
534
|
-
this.addFormat(name, format);
|
|
531
|
+
function addInitialKeywords(defs) {
|
|
532
|
+
if (Array.isArray(defs)) {
|
|
533
|
+
this.addVocabulary(defs);
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
this.logger.warn("keywords option as map is deprecated, pass array");
|
|
537
|
+
for (const keyword in defs) {
|
|
538
|
+
const def = defs[keyword];
|
|
539
|
+
if (!def.keyword)
|
|
540
|
+
def.keyword = keyword;
|
|
541
|
+
this.addKeyword(def);
|
|
542
|
+
}
|
|
535
543
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
return;
|
|
544
|
+
function getMetaSchemaOptions() {
|
|
545
|
+
const metaOpts = { ...this.opts };
|
|
546
|
+
for (const opt of META_IGNORE_OPTIONS)
|
|
547
|
+
delete metaOpts[opt];
|
|
548
|
+
return metaOpts;
|
|
541
549
|
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
550
|
+
const noLogs = { log() {
|
|
551
|
+
}, warn() {
|
|
552
|
+
}, error() {
|
|
553
|
+
} };
|
|
554
|
+
function getLogger(logger) {
|
|
555
|
+
if (logger === false)
|
|
556
|
+
return noLogs;
|
|
557
|
+
if (logger === void 0)
|
|
558
|
+
return console;
|
|
559
|
+
if (logger.log && logger.warn && logger.error)
|
|
560
|
+
return logger;
|
|
561
|
+
throw new Error("logger must implement log, warn and error methods");
|
|
548
562
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
if (logger === void 0)
|
|
564
|
-
return console;
|
|
565
|
-
if (logger.log && logger.warn && logger.error)
|
|
566
|
-
return logger;
|
|
567
|
-
throw new Error("logger must implement log, warn and error methods");
|
|
568
|
-
}
|
|
569
|
-
const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
570
|
-
function checkKeyword(keyword, def) {
|
|
571
|
-
const { RULES } = this;
|
|
572
|
-
(0, util_1.eachItem)(keyword, (kwd) => {
|
|
573
|
-
if (RULES.keywords[kwd])
|
|
574
|
-
throw new Error(`Keyword ${kwd} is already defined`);
|
|
575
|
-
if (!KEYWORD_NAME.test(kwd))
|
|
576
|
-
throw new Error(`Keyword ${kwd} has invalid name`);
|
|
577
|
-
});
|
|
578
|
-
if (!def)
|
|
579
|
-
return;
|
|
580
|
-
if (def.$data && !("code" in def || "validate" in def)) {
|
|
581
|
-
throw new Error('$data keyword must have "code" or "validate" function');
|
|
563
|
+
const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
564
|
+
function checkKeyword(keyword, def) {
|
|
565
|
+
const { RULES } = this;
|
|
566
|
+
(0, util_1.eachItem)(keyword, (kwd) => {
|
|
567
|
+
if (RULES.keywords[kwd])
|
|
568
|
+
throw new Error(`Keyword ${kwd} is already defined`);
|
|
569
|
+
if (!KEYWORD_NAME.test(kwd))
|
|
570
|
+
throw new Error(`Keyword ${kwd} has invalid name`);
|
|
571
|
+
});
|
|
572
|
+
if (!def)
|
|
573
|
+
return;
|
|
574
|
+
if (def.$data && !("code" in def || "validate" in def)) {
|
|
575
|
+
throw new Error('$data keyword must have "code" or "validate" function');
|
|
576
|
+
}
|
|
582
577
|
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
578
|
+
function addRule(keyword, definition, dataType) {
|
|
579
|
+
var _a;
|
|
580
|
+
const post = definition === null || definition === void 0 ? void 0 : definition.post;
|
|
581
|
+
if (dataType && post)
|
|
582
|
+
throw new Error('keyword with "post" flag cannot have "type"');
|
|
583
|
+
const { RULES } = this;
|
|
584
|
+
let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType);
|
|
585
|
+
if (!ruleGroup) {
|
|
586
|
+
ruleGroup = { type: dataType, rules: [] };
|
|
587
|
+
RULES.rules.push(ruleGroup);
|
|
588
|
+
}
|
|
589
|
+
RULES.keywords[keyword] = true;
|
|
590
|
+
if (!definition)
|
|
591
|
+
return;
|
|
592
|
+
const rule = {
|
|
593
|
+
keyword,
|
|
594
|
+
definition: {
|
|
595
|
+
...definition,
|
|
596
|
+
type: (0, dataType_1.getJSONTypes)(definition.type),
|
|
597
|
+
schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType)
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
if (definition.before)
|
|
601
|
+
addBeforeRule.call(this, ruleGroup, rule, definition.before);
|
|
602
|
+
else
|
|
603
|
+
ruleGroup.rules.push(rule);
|
|
604
|
+
RULES.all[keyword] = rule;
|
|
605
|
+
(_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd));
|
|
594
606
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
type: (0, dataType_1.getJSONTypes)(definition.type),
|
|
603
|
-
schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType)
|
|
607
|
+
function addBeforeRule(ruleGroup, rule, before) {
|
|
608
|
+
const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
|
|
609
|
+
if (i >= 0) {
|
|
610
|
+
ruleGroup.rules.splice(i, 0, rule);
|
|
611
|
+
} else {
|
|
612
|
+
ruleGroup.rules.push(rule);
|
|
613
|
+
this.logger.warn(`rule ${before} is not defined`);
|
|
604
614
|
}
|
|
615
|
+
}
|
|
616
|
+
function keywordMetaschema(def) {
|
|
617
|
+
let { metaSchema } = def;
|
|
618
|
+
if (metaSchema === void 0)
|
|
619
|
+
return;
|
|
620
|
+
if (def.$data && this.opts.$data)
|
|
621
|
+
metaSchema = schemaOrData(metaSchema);
|
|
622
|
+
def.validateSchema = this.compile(metaSchema, true);
|
|
623
|
+
}
|
|
624
|
+
const $dataRef = {
|
|
625
|
+
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
605
626
|
};
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
else
|
|
609
|
-
ruleGroup.rules.push(rule);
|
|
610
|
-
RULES.all[keyword] = rule;
|
|
611
|
-
(_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd));
|
|
612
|
-
}
|
|
613
|
-
function addBeforeRule(ruleGroup, rule, before) {
|
|
614
|
-
const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
|
|
615
|
-
if (i >= 0) {
|
|
616
|
-
ruleGroup.rules.splice(i, 0, rule);
|
|
617
|
-
} else {
|
|
618
|
-
ruleGroup.rules.push(rule);
|
|
619
|
-
this.logger.warn(`rule ${before} is not defined`);
|
|
627
|
+
function schemaOrData(schema) {
|
|
628
|
+
return { anyOf: [schema, $dataRef] };
|
|
620
629
|
}
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
metaSchema = schemaOrData(metaSchema);
|
|
628
|
-
def.validateSchema = this.compile(metaSchema, true);
|
|
629
|
-
}
|
|
630
|
-
const $dataRef = {
|
|
631
|
-
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
632
|
-
};
|
|
633
|
-
function schemaOrData(schema) {
|
|
634
|
-
return { anyOf: [schema, $dataRef] };
|
|
635
|
-
}
|
|
636
|
-
})(core);
|
|
630
|
+
})(core);
|
|
631
|
+
return core;
|
|
632
|
+
}
|
|
633
|
+
export {
|
|
634
|
+
requireCore as __require
|
|
635
|
+
};
|
|
637
636
|
//# sourceMappingURL=core.js.map
|