fumadocs-openapi 10.10.3 → 11.0.1
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/css/generated/shared.css +1 -1159
- package/css/preset.css +1 -0
- package/dist/.translations/index.d.ts +80 -0
- package/dist/.translations/keys.js +80 -0
- package/dist/_virtual/_rolldown/runtime.js +1 -10
- package/dist/generate-file.d.ts +0 -4
- package/dist/generate-file.js +4 -5
- package/dist/i18n.d.ts +5 -100
- package/dist/i18n.js +8 -108
- package/dist/index.d.ts +4 -4
- package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/2.0-to-3.0/upgrade-from-two-to-three.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/3.0-to-3.1/upgrade-from-three-to-three-one.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/3.1-to-3.2/upgrade-from-three-one-to-three-two.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/helpers/traverse.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/upgrade.js +1 -1
- package/dist/playground/auth.js +4 -4
- package/dist/playground/client.d.ts +12 -21
- package/dist/playground/client.js +80 -59
- package/dist/playground/components/oauth-dialog.js +33 -33
- package/dist/playground/components/result-display.d.ts +1 -2
- package/dist/playground/components/result-display.js +7 -8
- package/dist/playground/components/server-select.js +11 -11
- package/dist/playground/status-info.js +29 -37
- package/dist/requests/generators/csharp.js +3 -3
- package/dist/requests/generators/curl.js +2 -2
- package/dist/requests/generators/go.js +2 -2
- package/dist/requests/generators/index.d.ts +28 -41
- package/dist/requests/generators/index.js +18 -35
- package/dist/requests/generators/java.js +2 -2
- package/dist/requests/generators/javascript.js +2 -2
- package/dist/requests/generators/python.js +2 -2
- package/dist/scalar/client.js +3 -2
- package/dist/scalar/index.d.ts +2 -2
- package/dist/scalar/index.js +10 -9
- package/dist/server/index.d.ts +23 -27
- package/dist/server/index.js +42 -38
- package/dist/server/proxy.d.ts +0 -6
- package/dist/server/proxy.js +2 -4
- package/dist/{_openapi/types.d.ts → types/openapi.d.ts} +127 -136
- package/dist/types.d.ts +14 -18
- package/dist/ui/base.d.ts +15 -162
- package/dist/ui/base.js +148 -107
- package/dist/ui/components/codeblock.js +6 -14
- package/dist/ui/components/heading.js +8 -4
- package/dist/ui/components/markdown.js +12 -0
- package/dist/ui/contexts/api.js +8 -26
- package/dist/ui/index.d.ts +204 -7
- package/dist/ui/index.js +10 -15
- package/dist/ui/operation/context.js +48 -0
- package/dist/ui/operation/index.js +168 -126
- package/dist/ui/operation/request-tabs.d.ts +10 -5
- package/dist/ui/operation/request-tabs.js +35 -22
- package/dist/ui/operation/response-tabs.d.ts +5 -2
- package/dist/ui/operation/response-tabs.js +22 -15
- package/dist/ui/operation/usage-tabs.js +144 -0
- package/dist/utils/document/dereference.d.ts +1 -1
- package/dist/utils/document/dereference.js +5 -8
- package/dist/utils/document/load.js +17 -0
- package/dist/utils/get-example-requests.d.ts +13 -0
- package/dist/{ui/operation → utils}/get-example-requests.js +31 -20
- package/dist/utils/pages/builder.d.ts +38 -10
- package/dist/utils/pages/builder.js +12 -10
- package/dist/utils/pages/preset-auto.d.ts +1 -2
- package/dist/utils/pages/preset-auto.js +15 -15
- package/dist/utils/pages/to-static-data.js +5 -4
- package/dist/utils/pages/to-text.d.ts +1 -0
- package/dist/utils/pages/to-text.js +21 -11
- package/dist/utils/remove-undefined.js +14 -9
- package/dist/utils/schema.d.ts +2 -0
- package/dist/utils/{schema/index.js → schema.js} +3 -30
- package/dist/{ui/client → utils}/storage-key.js +3 -3
- package/package.json +16 -29
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js +0 -239
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js +0 -187
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js +0 -136
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/normalize-args.js +0 -41
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.js +0 -124
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parse.js +0 -109
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/binary.js +0 -30
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/json.js +0 -46
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/text.js +0 -36
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/yaml.js +0 -49
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.js +0 -242
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.js +0 -247
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.js +0 -210
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolve-external.js +0 -100
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/file.js +0 -41
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js +0 -112
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/convert-path-to-posix.js +0 -8
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.js +0 -146
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/is-windows.js +0 -5
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/maybe.js +0 -18
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/next.js +0 -11
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/plugins.js +0 -99
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/schema-resources.js +0 -30
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/url.js +0 -315
- package/dist/node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js +0 -108
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js +0 -110
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js +0 -138
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +0 -674
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js +0 -141
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js +0 -102
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +0 -223
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js +0 -28
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js +0 -18
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +0 -133
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +0 -61
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +0 -146
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js +0 -23
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +0 -48
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +0 -172
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js +0 -31
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +0 -433
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +0 -113
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js +0 -72
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +0 -583
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/data.js +0 -18
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +0 -42
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.js +0 -50
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.js +0 -20
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.js +0 -51
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.js +0 -16
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.js +0 -36
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.js +0 -19
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.js +0 -85
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.js +0 -59
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js +0 -12
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js +0 -25
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js +0 -12
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js +0 -16
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +0 -57
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +0 -96
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +0 -29
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +0 -16
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +0 -89
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +0 -87
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +0 -16
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js +0 -62
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +0 -60
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +0 -59
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +0 -34
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js +0 -31
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +0 -51
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +0 -61
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +0 -17
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +0 -52
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +0 -41
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +0 -17
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js +0 -130
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js +0 -14
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js +0 -22
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +0 -112
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +0 -101
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +0 -14
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js +0 -35
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +0 -46
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +0 -45
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js +0 -22
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +0 -20
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +0 -15
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js +0 -92
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js +0 -10
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js +0 -23
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js +0 -19
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js +0 -13
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +0 -46
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +0 -59
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js +0 -27
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +0 -17
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js +0 -49
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js +0 -48
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js +0 -18
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +0 -28
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +0 -33
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +0 -47
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +0 -28
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +0 -27
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +0 -38
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +0 -72
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +0 -70
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +0 -33
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +0 -236
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +0 -187
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +0 -282
- package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +0 -78
- package/dist/playground/components/inputs.js +0 -419
- package/dist/playground/components/spinner.js +0 -15
- package/dist/playground/schema.d.ts +0 -15
- package/dist/playground/schema.js +0 -144
- package/dist/ui/api-page.d.ts +0 -31
- package/dist/ui/api-page.js +0 -59
- package/dist/ui/client/boundary.d.ts +0 -11
- package/dist/ui/client/boundary.js +0 -17
- package/dist/ui/client/boundary.lazy.js +0 -19
- package/dist/ui/client/full.js +0 -13
- package/dist/ui/client/i18n.js +0 -16
- package/dist/ui/client/index.d.ts +0 -42
- package/dist/ui/client/index.js +0 -7
- package/dist/ui/components/accordion.js +0 -67
- package/dist/ui/components/codeblock.d.ts +0 -14
- package/dist/ui/components/dialog.js +0 -56
- package/dist/ui/components/input.js +0 -17
- package/dist/ui/components/select-tab.js +0 -56
- package/dist/ui/components/select.js +0 -71
- package/dist/ui/contexts/api.d.ts +0 -29
- package/dist/ui/create-client.d.ts +0 -26
- package/dist/ui/create-client.js +0 -125
- package/dist/ui/operation/client.js +0 -78
- package/dist/ui/operation/get-example-requests.d.ts +0 -11
- package/dist/ui/operation/usage-tabs/client.d.ts +0 -14
- package/dist/ui/operation/usage-tabs/client.js +0 -91
- package/dist/ui/operation/usage-tabs/index.js +0 -54
- package/dist/ui/schema/client.d.ts +0 -18
- package/dist/ui/schema/client.js +0 -410
- package/dist/ui/schema/index.d.ts +0 -61
- package/dist/ui/schema/index.js +0 -256
- package/dist/utils/auto-anchor.client.js +0 -20
- package/dist/utils/auto-anchor.js +0 -17
- package/dist/utils/deep-equal.js +0 -21
- package/dist/utils/document/process.d.ts +0 -6
- package/dist/utils/document/process.js +0 -18
- package/dist/utils/id-to-title.js +0 -12
- package/dist/utils/is-plain-object.js +0 -8
- package/dist/utils/merge-refs.js +0 -11
- package/dist/utils/schema/dereference.js +0 -45
- package/dist/utils/schema/index.d.ts +0 -18
- package/dist/utils/schema/merge.js +0 -156
- package/dist/utils/schema/pick.js +0 -44
- package/dist/utils/schema/ref.js +0 -35
- package/dist/utils/schema/resolve-ref.js +0 -11
- package/dist/utils/schema/sample.js +0 -442
- package/dist/utils/schema/to-string.d.ts +0 -1
- package/dist/utils/schema/to-string.js +0 -53
- package/dist/utils/url.js +0 -39
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { __commonJSMin } from "../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js
|
|
3
|
-
var require_rules = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.getRules = exports.isJSONType = void 0;
|
|
6
|
-
const jsonTypes = new Set([
|
|
7
|
-
"string",
|
|
8
|
-
"number",
|
|
9
|
-
"integer",
|
|
10
|
-
"boolean",
|
|
11
|
-
"null",
|
|
12
|
-
"object",
|
|
13
|
-
"array"
|
|
14
|
-
]);
|
|
15
|
-
function isJSONType(x) {
|
|
16
|
-
return typeof x == "string" && jsonTypes.has(x);
|
|
17
|
-
}
|
|
18
|
-
exports.isJSONType = isJSONType;
|
|
19
|
-
function getRules() {
|
|
20
|
-
const groups = {
|
|
21
|
-
number: {
|
|
22
|
-
type: "number",
|
|
23
|
-
rules: []
|
|
24
|
-
},
|
|
25
|
-
string: {
|
|
26
|
-
type: "string",
|
|
27
|
-
rules: []
|
|
28
|
-
},
|
|
29
|
-
array: {
|
|
30
|
-
type: "array",
|
|
31
|
-
rules: []
|
|
32
|
-
},
|
|
33
|
-
object: {
|
|
34
|
-
type: "object",
|
|
35
|
-
rules: []
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
return {
|
|
39
|
-
types: {
|
|
40
|
-
...groups,
|
|
41
|
-
integer: true,
|
|
42
|
-
boolean: true,
|
|
43
|
-
null: true
|
|
44
|
-
},
|
|
45
|
-
rules: [
|
|
46
|
-
{ rules: [] },
|
|
47
|
-
groups.number,
|
|
48
|
-
groups.string,
|
|
49
|
-
groups.array,
|
|
50
|
-
groups.object
|
|
51
|
-
],
|
|
52
|
-
post: { rules: [] },
|
|
53
|
-
all: {},
|
|
54
|
-
keywords: {}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
exports.getRules = getRules;
|
|
58
|
-
}));
|
|
59
|
-
//#endregion
|
|
60
|
-
export default require_rules();
|
|
61
|
-
export { require_rules };
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { __commonJSMin } from "../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { require_code } from "./codegen/code.js";
|
|
3
|
-
import { require_codegen } from "./codegen/index.js";
|
|
4
|
-
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js
|
|
5
|
-
var require_util = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = void 0;
|
|
8
|
-
const codegen_1 = require_codegen();
|
|
9
|
-
const code_1 = require_code();
|
|
10
|
-
function toHash(arr) {
|
|
11
|
-
const hash = {};
|
|
12
|
-
for (const item of arr) hash[item] = true;
|
|
13
|
-
return hash;
|
|
14
|
-
}
|
|
15
|
-
exports.toHash = toHash;
|
|
16
|
-
function alwaysValidSchema(it, schema) {
|
|
17
|
-
if (typeof schema == "boolean") return schema;
|
|
18
|
-
if (Object.keys(schema).length === 0) return true;
|
|
19
|
-
checkUnknownRules(it, schema);
|
|
20
|
-
return !schemaHasRules(schema, it.self.RULES.all);
|
|
21
|
-
}
|
|
22
|
-
exports.alwaysValidSchema = alwaysValidSchema;
|
|
23
|
-
function checkUnknownRules(it, schema = it.schema) {
|
|
24
|
-
const { opts, self } = it;
|
|
25
|
-
if (!opts.strictSchema) return;
|
|
26
|
-
if (typeof schema === "boolean") return;
|
|
27
|
-
const rules = self.RULES.keywords;
|
|
28
|
-
for (const key in schema) if (!rules[key]) checkStrictMode(it, `unknown keyword: "${key}"`);
|
|
29
|
-
}
|
|
30
|
-
exports.checkUnknownRules = checkUnknownRules;
|
|
31
|
-
function schemaHasRules(schema, rules) {
|
|
32
|
-
if (typeof schema == "boolean") return !schema;
|
|
33
|
-
for (const key in schema) if (rules[key]) return true;
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
exports.schemaHasRules = schemaHasRules;
|
|
37
|
-
function schemaHasRulesButRef(schema, RULES) {
|
|
38
|
-
if (typeof schema == "boolean") return !schema;
|
|
39
|
-
for (const key in schema) if (key !== "$ref" && RULES.all[key]) return true;
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
exports.schemaHasRulesButRef = schemaHasRulesButRef;
|
|
43
|
-
function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword, $data) {
|
|
44
|
-
if (!$data) {
|
|
45
|
-
if (typeof schema == "number" || typeof schema == "boolean") return schema;
|
|
46
|
-
if (typeof schema == "string") return (0, codegen_1._)`${schema}`;
|
|
47
|
-
}
|
|
48
|
-
return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
|
|
49
|
-
}
|
|
50
|
-
exports.schemaRefOrVal = schemaRefOrVal;
|
|
51
|
-
function unescapeFragment(str) {
|
|
52
|
-
return unescapeJsonPointer(decodeURIComponent(str));
|
|
53
|
-
}
|
|
54
|
-
exports.unescapeFragment = unescapeFragment;
|
|
55
|
-
function escapeFragment(str) {
|
|
56
|
-
return encodeURIComponent(escapeJsonPointer(str));
|
|
57
|
-
}
|
|
58
|
-
exports.escapeFragment = escapeFragment;
|
|
59
|
-
function escapeJsonPointer(str) {
|
|
60
|
-
if (typeof str == "number") return `${str}`;
|
|
61
|
-
return str.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
62
|
-
}
|
|
63
|
-
exports.escapeJsonPointer = escapeJsonPointer;
|
|
64
|
-
function unescapeJsonPointer(str) {
|
|
65
|
-
return str.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
66
|
-
}
|
|
67
|
-
exports.unescapeJsonPointer = unescapeJsonPointer;
|
|
68
|
-
function eachItem(xs, f) {
|
|
69
|
-
if (Array.isArray(xs)) for (const x of xs) f(x);
|
|
70
|
-
else f(xs);
|
|
71
|
-
}
|
|
72
|
-
exports.eachItem = eachItem;
|
|
73
|
-
function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName }) {
|
|
74
|
-
return (gen, from, to, toName) => {
|
|
75
|
-
const res = to === void 0 ? from : to instanceof codegen_1.Name ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1.Name ? (mergeToName(gen, to, from), from) : mergeValues(from, to);
|
|
76
|
-
return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
exports.mergeEvaluated = {
|
|
80
|
-
props: makeMergeEvaluated({
|
|
81
|
-
mergeNames: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true && ${from} !== undefined`, () => {
|
|
82
|
-
gen.if((0, codegen_1._)`${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1._)`${to} || {}`).code((0, codegen_1._)`Object.assign(${to}, ${from})`));
|
|
83
|
-
}),
|
|
84
|
-
mergeToName: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true`, () => {
|
|
85
|
-
if (from === true) gen.assign(to, true);
|
|
86
|
-
else {
|
|
87
|
-
gen.assign(to, (0, codegen_1._)`${to} || {}`);
|
|
88
|
-
setEvaluated(gen, to, from);
|
|
89
|
-
}
|
|
90
|
-
}),
|
|
91
|
-
mergeValues: (from, to) => from === true ? true : {
|
|
92
|
-
...from,
|
|
93
|
-
...to
|
|
94
|
-
},
|
|
95
|
-
resultToName: evaluatedPropsToName
|
|
96
|
-
}),
|
|
97
|
-
items: makeMergeEvaluated({
|
|
98
|
-
mergeNames: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
|
|
99
|
-
mergeToName: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1._)`${to} > ${from} ? ${to} : ${from}`)),
|
|
100
|
-
mergeValues: (from, to) => from === true ? true : Math.max(from, to),
|
|
101
|
-
resultToName: (gen, items) => gen.var("items", items)
|
|
102
|
-
})
|
|
103
|
-
};
|
|
104
|
-
function evaluatedPropsToName(gen, ps) {
|
|
105
|
-
if (ps === true) return gen.var("props", true);
|
|
106
|
-
const props = gen.var("props", (0, codegen_1._)`{}`);
|
|
107
|
-
if (ps !== void 0) setEvaluated(gen, props, ps);
|
|
108
|
-
return props;
|
|
109
|
-
}
|
|
110
|
-
exports.evaluatedPropsToName = evaluatedPropsToName;
|
|
111
|
-
function setEvaluated(gen, props, ps) {
|
|
112
|
-
Object.keys(ps).forEach((p) => gen.assign((0, codegen_1._)`${props}${(0, codegen_1.getProperty)(p)}`, true));
|
|
113
|
-
}
|
|
114
|
-
exports.setEvaluated = setEvaluated;
|
|
115
|
-
const snippets = {};
|
|
116
|
-
function useFunc(gen, f) {
|
|
117
|
-
return gen.scopeValue("func", {
|
|
118
|
-
ref: f,
|
|
119
|
-
code: snippets[f.code] || (snippets[f.code] = new code_1._Code(f.code))
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
exports.useFunc = useFunc;
|
|
123
|
-
var Type;
|
|
124
|
-
(function(Type) {
|
|
125
|
-
Type[Type["Num"] = 0] = "Num";
|
|
126
|
-
Type[Type["Str"] = 1] = "Str";
|
|
127
|
-
})(Type || (exports.Type = Type = {}));
|
|
128
|
-
function getErrorPath(dataProp, dataPropType, jsPropertySyntax) {
|
|
129
|
-
if (dataProp instanceof codegen_1.Name) {
|
|
130
|
-
const isNumber = dataPropType === Type.Num;
|
|
131
|
-
return jsPropertySyntax ? isNumber ? (0, codegen_1._)`"[" + ${dataProp} + "]"` : (0, codegen_1._)`"['" + ${dataProp} + "']"` : isNumber ? (0, codegen_1._)`"/" + ${dataProp}` : (0, codegen_1._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
132
|
-
}
|
|
133
|
-
return jsPropertySyntax ? (0, codegen_1.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
|
|
134
|
-
}
|
|
135
|
-
exports.getErrorPath = getErrorPath;
|
|
136
|
-
function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
|
|
137
|
-
if (!mode) return;
|
|
138
|
-
msg = `strict mode: ${msg}`;
|
|
139
|
-
if (mode === true) throw new Error(msg);
|
|
140
|
-
it.self.logger.warn(msg);
|
|
141
|
-
}
|
|
142
|
-
exports.checkStrictMode = checkStrictMode;
|
|
143
|
-
}));
|
|
144
|
-
//#endregion
|
|
145
|
-
export default require_util();
|
|
146
|
-
export { require_util };
|
package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js
|
|
3
|
-
var require_applicability = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0;
|
|
6
|
-
function schemaHasRulesForType({ schema, self }, type) {
|
|
7
|
-
const group = self.RULES.types[type];
|
|
8
|
-
return group && group !== true && shouldUseGroup(schema, group);
|
|
9
|
-
}
|
|
10
|
-
exports.schemaHasRulesForType = schemaHasRulesForType;
|
|
11
|
-
function shouldUseGroup(schema, group) {
|
|
12
|
-
return group.rules.some((rule) => shouldUseRule(schema, rule));
|
|
13
|
-
}
|
|
14
|
-
exports.shouldUseGroup = shouldUseGroup;
|
|
15
|
-
function shouldUseRule(schema, rule) {
|
|
16
|
-
var _a;
|
|
17
|
-
return schema[rule.keyword] !== void 0 || ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== void 0));
|
|
18
|
-
}
|
|
19
|
-
exports.shouldUseRule = shouldUseRule;
|
|
20
|
-
}));
|
|
21
|
-
//#endregion
|
|
22
|
-
export default require_applicability();
|
|
23
|
-
export { require_applicability };
|
package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { require_codegen } from "../codegen/index.js";
|
|
3
|
-
import { require_names } from "../names.js";
|
|
4
|
-
import { require_errors } from "../errors.js";
|
|
5
|
-
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js
|
|
6
|
-
var require_boolSchema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0;
|
|
9
|
-
const errors_1 = require_errors();
|
|
10
|
-
const codegen_1 = require_codegen();
|
|
11
|
-
const names_1 = require_names();
|
|
12
|
-
const boolError = { message: "boolean schema is false" };
|
|
13
|
-
function topBoolOrEmptySchema(it) {
|
|
14
|
-
const { gen, schema, validateName } = it;
|
|
15
|
-
if (schema === false) falseSchemaError(it, false);
|
|
16
|
-
else if (typeof schema == "object" && schema.$async === true) gen.return(names_1.default.data);
|
|
17
|
-
else {
|
|
18
|
-
gen.assign((0, codegen_1._)`${validateName}.errors`, null);
|
|
19
|
-
gen.return(true);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.topBoolOrEmptySchema = topBoolOrEmptySchema;
|
|
23
|
-
function boolOrEmptySchema(it, valid) {
|
|
24
|
-
const { gen, schema } = it;
|
|
25
|
-
if (schema === false) {
|
|
26
|
-
gen.var(valid, false);
|
|
27
|
-
falseSchemaError(it);
|
|
28
|
-
} else gen.var(valid, true);
|
|
29
|
-
}
|
|
30
|
-
exports.boolOrEmptySchema = boolOrEmptySchema;
|
|
31
|
-
function falseSchemaError(it, overrideAllErrors) {
|
|
32
|
-
const { gen, data } = it;
|
|
33
|
-
const cxt = {
|
|
34
|
-
gen,
|
|
35
|
-
keyword: "false schema",
|
|
36
|
-
data,
|
|
37
|
-
schema: false,
|
|
38
|
-
schemaCode: false,
|
|
39
|
-
schemaValue: false,
|
|
40
|
-
params: {},
|
|
41
|
-
it
|
|
42
|
-
};
|
|
43
|
-
(0, errors_1.reportError)(cxt, boolError, void 0, overrideAllErrors);
|
|
44
|
-
}
|
|
45
|
-
}));
|
|
46
|
-
//#endregion
|
|
47
|
-
export default require_boolSchema();
|
|
48
|
-
export { require_boolSchema };
|
package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { require_codegen } from "../codegen/index.js";
|
|
3
|
-
import { require_util } from "../util.js";
|
|
4
|
-
import { require_errors } from "../errors.js";
|
|
5
|
-
import { require_rules } from "../rules.js";
|
|
6
|
-
import { require_applicability } from "./applicability.js";
|
|
7
|
-
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js
|
|
8
|
-
var require_dataType = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0;
|
|
11
|
-
const rules_1 = require_rules();
|
|
12
|
-
const applicability_1 = require_applicability();
|
|
13
|
-
const errors_1 = require_errors();
|
|
14
|
-
const codegen_1 = require_codegen();
|
|
15
|
-
const util_1 = require_util();
|
|
16
|
-
var DataType;
|
|
17
|
-
(function(DataType) {
|
|
18
|
-
DataType[DataType["Correct"] = 0] = "Correct";
|
|
19
|
-
DataType[DataType["Wrong"] = 1] = "Wrong";
|
|
20
|
-
})(DataType || (exports.DataType = DataType = {}));
|
|
21
|
-
function getSchemaTypes(schema) {
|
|
22
|
-
const types = getJSONTypes(schema.type);
|
|
23
|
-
if (types.includes("null")) {
|
|
24
|
-
if (schema.nullable === false) throw new Error("type: null contradicts nullable: false");
|
|
25
|
-
} else {
|
|
26
|
-
if (!types.length && schema.nullable !== void 0) throw new Error("\"nullable\" cannot be used without \"type\"");
|
|
27
|
-
if (schema.nullable === true) types.push("null");
|
|
28
|
-
}
|
|
29
|
-
return types;
|
|
30
|
-
}
|
|
31
|
-
exports.getSchemaTypes = getSchemaTypes;
|
|
32
|
-
function getJSONTypes(ts) {
|
|
33
|
-
const types = Array.isArray(ts) ? ts : ts ? [ts] : [];
|
|
34
|
-
if (types.every(rules_1.isJSONType)) return types;
|
|
35
|
-
throw new Error("type must be JSONType or JSONType[]: " + types.join(","));
|
|
36
|
-
}
|
|
37
|
-
exports.getJSONTypes = getJSONTypes;
|
|
38
|
-
function coerceAndCheckDataType(it, types) {
|
|
39
|
-
const { gen, data, opts } = it;
|
|
40
|
-
const coerceTo = coerceToTypes(types, opts.coerceTypes);
|
|
41
|
-
const checkTypes = types.length > 0 && !(coerceTo.length === 0 && types.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types[0]));
|
|
42
|
-
if (checkTypes) {
|
|
43
|
-
const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong);
|
|
44
|
-
gen.if(wrongType, () => {
|
|
45
|
-
if (coerceTo.length) coerceData(it, types, coerceTo);
|
|
46
|
-
else reportTypeError(it);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return checkTypes;
|
|
50
|
-
}
|
|
51
|
-
exports.coerceAndCheckDataType = coerceAndCheckDataType;
|
|
52
|
-
const COERCIBLE = new Set([
|
|
53
|
-
"string",
|
|
54
|
-
"number",
|
|
55
|
-
"integer",
|
|
56
|
-
"boolean",
|
|
57
|
-
"null"
|
|
58
|
-
]);
|
|
59
|
-
function coerceToTypes(types, coerceTypes) {
|
|
60
|
-
return coerceTypes ? types.filter((t) => COERCIBLE.has(t) || coerceTypes === "array" && t === "array") : [];
|
|
61
|
-
}
|
|
62
|
-
function coerceData(it, types, coerceTo) {
|
|
63
|
-
const { gen, data, opts } = it;
|
|
64
|
-
const dataType = gen.let("dataType", (0, codegen_1._)`typeof ${data}`);
|
|
65
|
-
const coerced = gen.let("coerced", (0, codegen_1._)`undefined`);
|
|
66
|
-
if (opts.coerceTypes === "array") gen.if((0, codegen_1._)`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1._)`${data}[0]`).assign(dataType, (0, codegen_1._)`typeof ${data}`).if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data)));
|
|
67
|
-
gen.if((0, codegen_1._)`${coerced} !== undefined`);
|
|
68
|
-
for (const t of coerceTo) if (COERCIBLE.has(t) || t === "array" && opts.coerceTypes === "array") coerceSpecificType(t);
|
|
69
|
-
gen.else();
|
|
70
|
-
reportTypeError(it);
|
|
71
|
-
gen.endIf();
|
|
72
|
-
gen.if((0, codegen_1._)`${coerced} !== undefined`, () => {
|
|
73
|
-
gen.assign(data, coerced);
|
|
74
|
-
assignParentData(it, coerced);
|
|
75
|
-
});
|
|
76
|
-
function coerceSpecificType(t) {
|
|
77
|
-
switch (t) {
|
|
78
|
-
case "string":
|
|
79
|
-
gen.elseIf((0, codegen_1._)`${dataType} == "number" || ${dataType} == "boolean"`).assign(coerced, (0, codegen_1._)`"" + ${data}`).elseIf((0, codegen_1._)`${data} === null`).assign(coerced, (0, codegen_1._)`""`);
|
|
80
|
-
return;
|
|
81
|
-
case "number":
|
|
82
|
-
gen.elseIf((0, codegen_1._)`${dataType} == "boolean" || ${data} === null
|
|
83
|
-
|| (${dataType} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1._)`+${data}`);
|
|
84
|
-
return;
|
|
85
|
-
case "integer":
|
|
86
|
-
gen.elseIf((0, codegen_1._)`${dataType} === "boolean" || ${data} === null
|
|
87
|
-
|| (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`).assign(coerced, (0, codegen_1._)`+${data}`);
|
|
88
|
-
return;
|
|
89
|
-
case "boolean":
|
|
90
|
-
gen.elseIf((0, codegen_1._)`${data} === "false" || ${data} === 0 || ${data} === null`).assign(coerced, false).elseIf((0, codegen_1._)`${data} === "true" || ${data} === 1`).assign(coerced, true);
|
|
91
|
-
return;
|
|
92
|
-
case "null":
|
|
93
|
-
gen.elseIf((0, codegen_1._)`${data} === "" || ${data} === 0 || ${data} === false`);
|
|
94
|
-
gen.assign(coerced, null);
|
|
95
|
-
return;
|
|
96
|
-
case "array": gen.elseIf((0, codegen_1._)`${dataType} === "string" || ${dataType} === "number"
|
|
97
|
-
|| ${dataType} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1._)`[${data}]`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
function assignParentData({ gen, parentData, parentDataProperty }, expr) {
|
|
102
|
-
gen.if((0, codegen_1._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1._)`${parentData}[${parentDataProperty}]`, expr));
|
|
103
|
-
}
|
|
104
|
-
function checkDataType(dataType, data, strictNums, correct = DataType.Correct) {
|
|
105
|
-
const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ;
|
|
106
|
-
let cond;
|
|
107
|
-
switch (dataType) {
|
|
108
|
-
case "null": return (0, codegen_1._)`${data} ${EQ} null`;
|
|
109
|
-
case "array":
|
|
110
|
-
cond = (0, codegen_1._)`Array.isArray(${data})`;
|
|
111
|
-
break;
|
|
112
|
-
case "object":
|
|
113
|
-
cond = (0, codegen_1._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
|
|
114
|
-
break;
|
|
115
|
-
case "integer":
|
|
116
|
-
cond = numCond((0, codegen_1._)`!(${data} % 1) && !isNaN(${data})`);
|
|
117
|
-
break;
|
|
118
|
-
case "number":
|
|
119
|
-
cond = numCond();
|
|
120
|
-
break;
|
|
121
|
-
default: return (0, codegen_1._)`typeof ${data} ${EQ} ${dataType}`;
|
|
122
|
-
}
|
|
123
|
-
return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond);
|
|
124
|
-
function numCond(_cond = codegen_1.nil) {
|
|
125
|
-
return (0, codegen_1.and)((0, codegen_1._)`typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1._)`isFinite(${data})` : codegen_1.nil);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
exports.checkDataType = checkDataType;
|
|
129
|
-
function checkDataTypes(dataTypes, data, strictNums, correct) {
|
|
130
|
-
if (dataTypes.length === 1) return checkDataType(dataTypes[0], data, strictNums, correct);
|
|
131
|
-
let cond;
|
|
132
|
-
const types = (0, util_1.toHash)(dataTypes);
|
|
133
|
-
if (types.array && types.object) {
|
|
134
|
-
const notObj = (0, codegen_1._)`typeof ${data} != "object"`;
|
|
135
|
-
cond = types.null ? notObj : (0, codegen_1._)`!${data} || ${notObj}`;
|
|
136
|
-
delete types.null;
|
|
137
|
-
delete types.array;
|
|
138
|
-
delete types.object;
|
|
139
|
-
} else cond = codegen_1.nil;
|
|
140
|
-
if (types.number) delete types.integer;
|
|
141
|
-
for (const t in types) cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct));
|
|
142
|
-
return cond;
|
|
143
|
-
}
|
|
144
|
-
exports.checkDataTypes = checkDataTypes;
|
|
145
|
-
const typeError = {
|
|
146
|
-
message: ({ schema }) => `must be ${schema}`,
|
|
147
|
-
params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1._)`{type: ${schema}}` : (0, codegen_1._)`{type: ${schemaValue}}`
|
|
148
|
-
};
|
|
149
|
-
function reportTypeError(it) {
|
|
150
|
-
const cxt = getTypeErrorContext(it);
|
|
151
|
-
(0, errors_1.reportError)(cxt, typeError);
|
|
152
|
-
}
|
|
153
|
-
exports.reportTypeError = reportTypeError;
|
|
154
|
-
function getTypeErrorContext(it) {
|
|
155
|
-
const { gen, data, schema } = it;
|
|
156
|
-
const schemaCode = (0, util_1.schemaRefOrVal)(it, schema, "type");
|
|
157
|
-
return {
|
|
158
|
-
gen,
|
|
159
|
-
keyword: "type",
|
|
160
|
-
data,
|
|
161
|
-
schema: schema.type,
|
|
162
|
-
schemaCode,
|
|
163
|
-
schemaValue: schemaCode,
|
|
164
|
-
parentSchema: schema,
|
|
165
|
-
params: {},
|
|
166
|
-
it
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
}));
|
|
170
|
-
//#endregion
|
|
171
|
-
export default require_dataType();
|
|
172
|
-
export { require_dataType };
|
package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { require_codegen } from "../codegen/index.js";
|
|
3
|
-
import { require_util } from "../util.js";
|
|
4
|
-
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js
|
|
5
|
-
var require_defaults = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.assignDefaults = void 0;
|
|
8
|
-
const codegen_1 = require_codegen();
|
|
9
|
-
const util_1 = require_util();
|
|
10
|
-
function assignDefaults(it, ty) {
|
|
11
|
-
const { properties, items } = it.schema;
|
|
12
|
-
if (ty === "object" && properties) for (const key in properties) assignDefault(it, key, properties[key].default);
|
|
13
|
-
else if (ty === "array" && Array.isArray(items)) items.forEach((sch, i) => assignDefault(it, i, sch.default));
|
|
14
|
-
}
|
|
15
|
-
exports.assignDefaults = assignDefaults;
|
|
16
|
-
function assignDefault(it, prop, defaultValue) {
|
|
17
|
-
const { gen, compositeRule, data, opts } = it;
|
|
18
|
-
if (defaultValue === void 0) return;
|
|
19
|
-
const childData = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(prop)}`;
|
|
20
|
-
if (compositeRule) {
|
|
21
|
-
(0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
let condition = (0, codegen_1._)`${childData} === undefined`;
|
|
25
|
-
if (opts.useDefaults === "empty") condition = (0, codegen_1._)`${condition} || ${childData} === null || ${childData} === ""`;
|
|
26
|
-
gen.if(condition, (0, codegen_1._)`${childData} = ${(0, codegen_1.stringify)(defaultValue)}`);
|
|
27
|
-
}
|
|
28
|
-
}));
|
|
29
|
-
//#endregion
|
|
30
|
-
export default require_defaults();
|
|
31
|
-
export { require_defaults };
|