@shuttl-io/core 0.2.0
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/CHANGELOG.md +96 -0
- package/README.md +3 -0
- package/dist/Server.d.ts +5 -0
- package/dist/Server.js +3 -0
- package/dist/Triggers.d.ts +0 -0
- package/dist/Triggers.js +2 -0
- package/dist/agent.d.ts +49 -0
- package/dist/agent.js +251 -0
- package/dist/app.d.ts +17 -0
- package/dist/app.js +46 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +29 -0
- package/dist/model.d.ts +6 -0
- package/dist/model.js +16 -0
- package/dist/models/openAi.d.ts +40 -0
- package/dist/models/openAi.js +346 -0
- package/dist/models/types.d.ts +102 -0
- package/dist/models/types.js +27 -0
- package/dist/outcomes/CombinationOutcome.d.ts +9 -0
- package/dist/outcomes/CombinationOutcome.js +41 -0
- package/dist/outcomes/IOutcomes.d.ts +9 -0
- package/dist/outcomes/IOutcomes.js +19 -0
- package/dist/outcomes/StreamingOutcome.d.ts +6 -0
- package/dist/outcomes/StreamingOutcome.js +30 -0
- package/dist/outcomes/index.d.ts +3 -0
- package/dist/outcomes/index.js +20 -0
- package/dist/secrets.d.ts +19 -0
- package/dist/secrets.js +34 -0
- package/dist/server/http.d.ts +68 -0
- package/dist/server/http.js +654 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +18 -0
- package/dist/src/Server.d.ts +5 -0
- package/dist/src/Server.js +3 -0
- package/dist/src/Triggers.d.ts +0 -0
- package/dist/src/Triggers.js +2 -0
- package/dist/src/agent.d.ts +49 -0
- package/dist/src/agent.js +251 -0
- package/dist/src/app.d.ts +17 -0
- package/dist/src/app.js +46 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.js +29 -0
- package/dist/src/model.d.ts +6 -0
- package/dist/src/model.js +16 -0
- package/dist/src/models/openAi.d.ts +38 -0
- package/dist/src/models/openAi.js +344 -0
- package/dist/src/models/types.d.ts +101 -0
- package/dist/src/models/types.js +27 -0
- package/dist/src/outcomes/CombinationOutcome.d.ts +9 -0
- package/dist/src/outcomes/CombinationOutcome.js +41 -0
- package/dist/src/outcomes/IOutcomes.d.ts +9 -0
- package/dist/src/outcomes/IOutcomes.js +19 -0
- package/dist/src/outcomes/StreamingOutcome.d.ts +6 -0
- package/dist/src/outcomes/StreamingOutcome.js +30 -0
- package/dist/src/outcomes/index.d.ts +3 -0
- package/dist/src/outcomes/index.js +20 -0
- package/dist/src/secrets.d.ts +19 -0
- package/dist/src/secrets.js +34 -0
- package/dist/src/server/http.d.ts +68 -0
- package/dist/src/server/http.js +654 -0
- package/dist/src/server/index.d.ts +1 -0
- package/dist/src/server/index.js +18 -0
- package/dist/src/tools/tool.d.ts +33 -0
- package/dist/src/tools/tool.js +49 -0
- package/dist/src/tools/toolkit.d.ts +13 -0
- package/dist/src/tools/toolkit.js +19 -0
- package/dist/src/trigger/ApiTrigger.d.ts +37 -0
- package/dist/src/trigger/ApiTrigger.js +106 -0
- package/dist/src/trigger/EmailTrigger.d.ts +15 -0
- package/dist/src/trigger/EmailTrigger.js +22 -0
- package/dist/src/trigger/FileTrigger.d.ts +14 -0
- package/dist/src/trigger/FileTrigger.js +37 -0
- package/dist/src/trigger/ITrigger.d.ts +89 -0
- package/dist/src/trigger/ITrigger.js +35 -0
- package/dist/src/trigger/RateTrigger.d.ts +23 -0
- package/dist/src/trigger/RateTrigger.js +58 -0
- package/dist/src/trigger/index.d.ts +5 -0
- package/dist/src/trigger/index.js +22 -0
- package/dist/tests/agent.test.d.ts +1 -0
- package/dist/tests/agent.test.js +388 -0
- package/dist/tests/agentStreamer.test.d.ts +1 -0
- package/dist/tests/agentStreamer.test.js +530 -0
- package/dist/tests/app.test.d.ts +1 -0
- package/dist/tests/app.test.js +423 -0
- package/dist/tests/model.test.d.ts +1 -0
- package/dist/tests/model.test.js +310 -0
- package/dist/tests/openAi.test.d.ts +1 -0
- package/dist/tests/openAi.test.js +701 -0
- package/dist/tests/outcomes.test.d.ts +1 -0
- package/dist/tests/outcomes.test.js +257 -0
- package/dist/tests/secrets.test.d.ts +1 -0
- package/dist/tests/secrets.test.js +263 -0
- package/dist/tests/server/http.test.d.ts +1 -0
- package/dist/tests/server/http.test.js +553 -0
- package/dist/tests/tool.test.d.ts +1 -0
- package/dist/tests/tool.test.js +315 -0
- package/dist/tests/toolkit.test.d.ts +1 -0
- package/dist/tests/toolkit.test.js +189 -0
- package/dist/tests/triggers.test.d.ts +1 -0
- package/dist/tests/triggers.test.js +203 -0
- package/dist/tests/types.test.d.ts +1 -0
- package/dist/tests/types.test.js +429 -0
- package/dist/tools/tool.d.ts +33 -0
- package/dist/tools/tool.js +49 -0
- package/dist/tools/toolkit.d.ts +13 -0
- package/dist/tools/toolkit.js +19 -0
- package/dist/trigger/ApiTrigger.d.ts +37 -0
- package/dist/trigger/ApiTrigger.js +106 -0
- package/dist/trigger/EmailTrigger.d.ts +15 -0
- package/dist/trigger/EmailTrigger.js +22 -0
- package/dist/trigger/FileTrigger.d.ts +14 -0
- package/dist/trigger/FileTrigger.js +37 -0
- package/dist/trigger/ITrigger.d.ts +90 -0
- package/dist/trigger/ITrigger.js +38 -0
- package/dist/trigger/RateTrigger.d.ts +23 -0
- package/dist/trigger/RateTrigger.js +58 -0
- package/dist/trigger/index.d.ts +5 -0
- package/dist/trigger/index.js +22 -0
- package/jest.config.js +20 -0
- package/node_modules/zod/LICENSE +21 -0
- package/node_modules/zod/README.md +208 -0
- package/node_modules/zod/index.cjs +33 -0
- package/node_modules/zod/index.d.cts +4 -0
- package/node_modules/zod/index.d.ts +4 -0
- package/node_modules/zod/index.js +4 -0
- package/node_modules/zod/locales/index.cjs +17 -0
- package/node_modules/zod/locales/index.d.cts +1 -0
- package/node_modules/zod/locales/index.d.ts +1 -0
- package/node_modules/zod/locales/index.js +1 -0
- package/node_modules/zod/locales/package.json +6 -0
- package/node_modules/zod/mini/index.cjs +17 -0
- package/node_modules/zod/mini/index.d.cts +1 -0
- package/node_modules/zod/mini/index.d.ts +1 -0
- package/node_modules/zod/mini/index.js +1 -0
- package/node_modules/zod/mini/package.json +6 -0
- package/node_modules/zod/package.json +135 -0
- package/node_modules/zod/src/index.ts +4 -0
- package/node_modules/zod/src/locales/index.ts +1 -0
- package/node_modules/zod/src/mini/index.ts +1 -0
- package/node_modules/zod/src/v3/ZodError.ts +330 -0
- package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
- package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
- package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
- package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
- package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
- package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
- package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
- package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
- package/node_modules/zod/src/v3/errors.ts +13 -0
- package/node_modules/zod/src/v3/external.ts +6 -0
- package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
- package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
- package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
- package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
- package/node_modules/zod/src/v3/helpers/util.ts +224 -0
- package/node_modules/zod/src/v3/index.ts +4 -0
- package/node_modules/zod/src/v3/locales/en.ts +124 -0
- package/node_modules/zod/src/v3/standard-schema.ts +113 -0
- package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
- package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
- package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
- package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
- package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
- package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
- package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
- package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
- package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
- package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
- package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
- package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
- package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
- package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
- package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
- package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
- package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
- package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
- package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
- package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
- package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
- package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
- package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
- package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
- package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
- package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
- package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
- package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
- package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
- package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
- package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
- package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
- package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
- package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
- package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
- package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
- package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
- package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
- package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
- package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
- package/node_modules/zod/src/v3/types.ts +5138 -0
- package/node_modules/zod/src/v4/classic/checks.ts +32 -0
- package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
- package/node_modules/zod/src/v4/classic/compat.ts +70 -0
- package/node_modules/zod/src/v4/classic/errors.ts +82 -0
- package/node_modules/zod/src/v4/classic/external.ts +51 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +536 -0
- package/node_modules/zod/src/v4/classic/index.ts +5 -0
- package/node_modules/zod/src/v4/classic/iso.ts +90 -0
- package/node_modules/zod/src/v4/classic/parse.ts +82 -0
- package/node_modules/zod/src/v4/classic/schemas.ts +2352 -0
- package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +210 -0
- package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +63 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +276 -0
- package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +573 -0
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +562 -0
- package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
- package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +302 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +365 -0
- package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +661 -0
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +595 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
- package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +537 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +308 -0
- package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +898 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +34 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +171 -0
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +117 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +196 -0
- package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +270 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +609 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +136 -0
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +340 -0
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +127 -0
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +74 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +282 -0
- package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +525 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +582 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +605 -0
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +208 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +181 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +134 -0
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +1152 -0
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +106 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +771 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +2755 -0
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +361 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +181 -0
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +219 -0
- package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
- package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
- package/node_modules/zod/src/v4/core/api.ts +1681 -0
- package/node_modules/zod/src/v4/core/checks.ts +1287 -0
- package/node_modules/zod/src/v4/core/config.ts +15 -0
- package/node_modules/zod/src/v4/core/core.ts +128 -0
- package/node_modules/zod/src/v4/core/doc.ts +44 -0
- package/node_modules/zod/src/v4/core/errors.ts +424 -0
- package/node_modules/zod/src/v4/core/index.ts +16 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +124 -0
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +630 -0
- package/node_modules/zod/src/v4/core/json-schema.ts +147 -0
- package/node_modules/zod/src/v4/core/parse.ts +195 -0
- package/node_modules/zod/src/v4/core/regexes.ts +182 -0
- package/node_modules/zod/src/v4/core/registries.ts +108 -0
- package/node_modules/zod/src/v4/core/schemas.ts +4418 -0
- package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
- package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
- package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +181 -0
- package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
- package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +67 -0
- package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +554 -0
- package/node_modules/zod/src/v4/core/util.ts +921 -0
- package/node_modules/zod/src/v4/core/versions.ts +5 -0
- package/node_modules/zod/src/v4/core/zsf.ts +323 -0
- package/node_modules/zod/src/v4/index.ts +4 -0
- package/node_modules/zod/src/v4/locales/ar.ts +125 -0
- package/node_modules/zod/src/v4/locales/az.ts +121 -0
- package/node_modules/zod/src/v4/locales/be.ts +184 -0
- package/node_modules/zod/src/v4/locales/bg.ts +136 -0
- package/node_modules/zod/src/v4/locales/ca.ts +127 -0
- package/node_modules/zod/src/v4/locales/cs.ts +142 -0
- package/node_modules/zod/src/v4/locales/da.ts +141 -0
- package/node_modules/zod/src/v4/locales/de.ts +124 -0
- package/node_modules/zod/src/v4/locales/en.ts +128 -0
- package/node_modules/zod/src/v4/locales/eo.ts +125 -0
- package/node_modules/zod/src/v4/locales/es.ts +159 -0
- package/node_modules/zod/src/v4/locales/fa.ts +134 -0
- package/node_modules/zod/src/v4/locales/fi.ts +131 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +126 -0
- package/node_modules/zod/src/v4/locales/fr.ts +124 -0
- package/node_modules/zod/src/v4/locales/he.ts +256 -0
- package/node_modules/zod/src/v4/locales/hu.ts +126 -0
- package/node_modules/zod/src/v4/locales/id.ts +125 -0
- package/node_modules/zod/src/v4/locales/index.ts +47 -0
- package/node_modules/zod/src/v4/locales/is.ts +127 -0
- package/node_modules/zod/src/v4/locales/it.ts +125 -0
- package/node_modules/zod/src/v4/locales/ja.ts +122 -0
- package/node_modules/zod/src/v4/locales/ka.ts +138 -0
- package/node_modules/zod/src/v4/locales/kh.ts +7 -0
- package/node_modules/zod/src/v4/locales/km.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +131 -0
- package/node_modules/zod/src/v4/locales/lt.ts +265 -0
- package/node_modules/zod/src/v4/locales/mk.ts +127 -0
- package/node_modules/zod/src/v4/locales/ms.ts +124 -0
- package/node_modules/zod/src/v4/locales/nl.ts +126 -0
- package/node_modules/zod/src/v4/locales/no.ts +124 -0
- package/node_modules/zod/src/v4/locales/ota.ts +125 -0
- package/node_modules/zod/src/v4/locales/pl.ts +126 -0
- package/node_modules/zod/src/v4/locales/ps.ts +133 -0
- package/node_modules/zod/src/v4/locales/pt.ts +123 -0
- package/node_modules/zod/src/v4/locales/ru.ts +184 -0
- package/node_modules/zod/src/v4/locales/sl.ts +126 -0
- package/node_modules/zod/src/v4/locales/sv.ts +127 -0
- package/node_modules/zod/src/v4/locales/ta.ts +125 -0
- package/node_modules/zod/src/v4/locales/th.ts +126 -0
- package/node_modules/zod/src/v4/locales/tr.ts +121 -0
- package/node_modules/zod/src/v4/locales/ua.ts +7 -0
- package/node_modules/zod/src/v4/locales/uk.ts +126 -0
- package/node_modules/zod/src/v4/locales/ur.ts +126 -0
- package/node_modules/zod/src/v4/locales/vi.ts +125 -0
- package/node_modules/zod/src/v4/locales/yo.ts +131 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +123 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +125 -0
- package/node_modules/zod/src/v4/mini/checks.ts +32 -0
- package/node_modules/zod/src/v4/mini/coerce.ts +22 -0
- package/node_modules/zod/src/v4/mini/external.ts +40 -0
- package/node_modules/zod/src/v4/mini/index.ts +3 -0
- package/node_modules/zod/src/v4/mini/iso.ts +62 -0
- package/node_modules/zod/src/v4/mini/parse.ts +14 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +1781 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +51 -0
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +529 -0
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +5 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +922 -0
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +200 -0
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +275 -0
- package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +17 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +347 -0
- package/node_modules/zod/src/v4-mini/index.ts +1 -0
- package/node_modules/zod/v3/ZodError.cjs +138 -0
- package/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/node_modules/zod/v3/ZodError.d.ts +164 -0
- package/node_modules/zod/v3/ZodError.js +133 -0
- package/node_modules/zod/v3/errors.cjs +17 -0
- package/node_modules/zod/v3/errors.d.cts +5 -0
- package/node_modules/zod/v3/errors.d.ts +5 -0
- package/node_modules/zod/v3/errors.js +9 -0
- package/node_modules/zod/v3/external.cjs +22 -0
- package/node_modules/zod/v3/external.d.cts +6 -0
- package/node_modules/zod/v3/external.d.ts +6 -0
- package/node_modules/zod/v3/external.js +6 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/node_modules/zod/v3/helpers/util.cjs +137 -0
- package/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/node_modules/zod/v3/helpers/util.d.ts +85 -0
- package/node_modules/zod/v3/helpers/util.js +133 -0
- package/node_modules/zod/v3/index.cjs +33 -0
- package/node_modules/zod/v3/index.d.cts +4 -0
- package/node_modules/zod/v3/index.d.ts +4 -0
- package/node_modules/zod/v3/index.js +4 -0
- package/node_modules/zod/v3/locales/en.cjs +112 -0
- package/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/node_modules/zod/v3/locales/en.d.ts +3 -0
- package/node_modules/zod/v3/locales/en.js +109 -0
- package/node_modules/zod/v3/package.json +6 -0
- package/node_modules/zod/v3/standard-schema.cjs +2 -0
- package/node_modules/zod/v3/standard-schema.d.cts +102 -0
- package/node_modules/zod/v3/standard-schema.d.ts +102 -0
- package/node_modules/zod/v3/standard-schema.js +1 -0
- package/node_modules/zod/v3/types.cjs +3777 -0
- package/node_modules/zod/v3/types.d.cts +1034 -0
- package/node_modules/zod/v3/types.d.ts +1034 -0
- package/node_modules/zod/v3/types.js +3695 -0
- package/node_modules/zod/v4/classic/checks.cjs +33 -0
- package/node_modules/zod/v4/classic/checks.d.cts +1 -0
- package/node_modules/zod/v4/classic/checks.d.ts +1 -0
- package/node_modules/zod/v4/classic/checks.js +1 -0
- package/node_modules/zod/v4/classic/coerce.cjs +47 -0
- package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
- package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
- package/node_modules/zod/v4/classic/coerce.js +17 -0
- package/node_modules/zod/v4/classic/compat.cjs +61 -0
- package/node_modules/zod/v4/classic/compat.d.cts +50 -0
- package/node_modules/zod/v4/classic/compat.d.ts +50 -0
- package/node_modules/zod/v4/classic/compat.js +31 -0
- package/node_modules/zod/v4/classic/errors.cjs +74 -0
- package/node_modules/zod/v4/classic/errors.d.cts +30 -0
- package/node_modules/zod/v4/classic/errors.d.ts +30 -0
- package/node_modules/zod/v4/classic/errors.js +48 -0
- package/node_modules/zod/v4/classic/external.cjs +73 -0
- package/node_modules/zod/v4/classic/external.d.cts +15 -0
- package/node_modules/zod/v4/classic/external.d.ts +15 -0
- package/node_modules/zod/v4/classic/external.js +20 -0
- package/node_modules/zod/v4/classic/from-json-schema.cjs +511 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.cts +10 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.ts +10 -0
- package/node_modules/zod/v4/classic/from-json-schema.js +485 -0
- package/node_modules/zod/v4/classic/index.cjs +33 -0
- package/node_modules/zod/v4/classic/index.d.cts +4 -0
- package/node_modules/zod/v4/classic/index.d.ts +4 -0
- package/node_modules/zod/v4/classic/index.js +4 -0
- package/node_modules/zod/v4/classic/iso.cjs +60 -0
- package/node_modules/zod/v4/classic/iso.d.cts +22 -0
- package/node_modules/zod/v4/classic/iso.d.ts +22 -0
- package/node_modules/zod/v4/classic/iso.js +30 -0
- package/node_modules/zod/v4/classic/package.json +6 -0
- package/node_modules/zod/v4/classic/parse.cjs +41 -0
- package/node_modules/zod/v4/classic/parse.d.cts +31 -0
- package/node_modules/zod/v4/classic/parse.d.ts +31 -0
- package/node_modules/zod/v4/classic/parse.js +15 -0
- package/node_modules/zod/v4/classic/schemas.cjs +1240 -0
- package/node_modules/zod/v4/classic/schemas.d.cts +726 -0
- package/node_modules/zod/v4/classic/schemas.d.ts +726 -0
- package/node_modules/zod/v4/classic/schemas.js +1126 -0
- package/node_modules/zod/v4/core/api.cjs +1109 -0
- package/node_modules/zod/v4/core/api.d.cts +304 -0
- package/node_modules/zod/v4/core/api.d.ts +304 -0
- package/node_modules/zod/v4/core/api.js +969 -0
- package/node_modules/zod/v4/core/checks.cjs +595 -0
- package/node_modules/zod/v4/core/checks.d.cts +278 -0
- package/node_modules/zod/v4/core/checks.d.ts +278 -0
- package/node_modules/zod/v4/core/checks.js +569 -0
- package/node_modules/zod/v4/core/core.cjs +83 -0
- package/node_modules/zod/v4/core/core.d.cts +52 -0
- package/node_modules/zod/v4/core/core.d.ts +52 -0
- package/node_modules/zod/v4/core/core.js +76 -0
- package/node_modules/zod/v4/core/doc.cjs +39 -0
- package/node_modules/zod/v4/core/doc.d.cts +14 -0
- package/node_modules/zod/v4/core/doc.d.ts +14 -0
- package/node_modules/zod/v4/core/doc.js +35 -0
- package/node_modules/zod/v4/core/errors.cjs +213 -0
- package/node_modules/zod/v4/core/errors.d.cts +219 -0
- package/node_modules/zod/v4/core/errors.d.ts +219 -0
- package/node_modules/zod/v4/core/errors.js +182 -0
- package/node_modules/zod/v4/core/index.cjs +47 -0
- package/node_modules/zod/v4/core/index.d.cts +16 -0
- package/node_modules/zod/v4/core/index.d.ts +16 -0
- package/node_modules/zod/v4/core/index.js +16 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +99 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +64 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +64 -0
- package/node_modules/zod/v4/core/json-schema-generator.js +95 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +617 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +49 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +49 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +574 -0
- package/node_modules/zod/v4/core/json-schema.cjs +2 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +88 -0
- package/node_modules/zod/v4/core/json-schema.d.ts +88 -0
- package/node_modules/zod/v4/core/json-schema.js +1 -0
- package/node_modules/zod/v4/core/package.json +6 -0
- package/node_modules/zod/v4/core/parse.cjs +131 -0
- package/node_modules/zod/v4/core/parse.d.cts +49 -0
- package/node_modules/zod/v4/core/parse.d.ts +49 -0
- package/node_modules/zod/v4/core/parse.js +93 -0
- package/node_modules/zod/v4/core/regexes.cjs +165 -0
- package/node_modules/zod/v4/core/regexes.d.cts +79 -0
- package/node_modules/zod/v4/core/regexes.d.ts +79 -0
- package/node_modules/zod/v4/core/regexes.js +132 -0
- package/node_modules/zod/v4/core/registries.cjs +59 -0
- package/node_modules/zod/v4/core/registries.d.cts +35 -0
- package/node_modules/zod/v4/core/registries.d.ts +35 -0
- package/node_modules/zod/v4/core/registries.js +54 -0
- package/node_modules/zod/v4/core/schemas.cjs +2040 -0
- package/node_modules/zod/v4/core/schemas.d.cts +1135 -0
- package/node_modules/zod/v4/core/schemas.d.ts +1135 -0
- package/node_modules/zod/v4/core/schemas.js +2009 -0
- package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
- package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
- package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
- package/node_modules/zod/v4/core/standard-schema.js +1 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +392 -0
- package/node_modules/zod/v4/core/to-json-schema.d.cts +113 -0
- package/node_modules/zod/v4/core/to-json-schema.d.ts +113 -0
- package/node_modules/zod/v4/core/to-json-schema.js +383 -0
- package/node_modules/zod/v4/core/util.cjs +669 -0
- package/node_modules/zod/v4/core/util.d.cts +198 -0
- package/node_modules/zod/v4/core/util.d.ts +198 -0
- package/node_modules/zod/v4/core/util.js +611 -0
- package/node_modules/zod/v4/core/versions.cjs +8 -0
- package/node_modules/zod/v4/core/versions.d.cts +5 -0
- package/node_modules/zod/v4/core/versions.d.ts +5 -0
- package/node_modules/zod/v4/core/versions.js +5 -0
- package/node_modules/zod/v4/index.cjs +22 -0
- package/node_modules/zod/v4/index.d.cts +3 -0
- package/node_modules/zod/v4/index.d.ts +3 -0
- package/node_modules/zod/v4/index.js +3 -0
- package/node_modules/zod/v4/locales/ar.cjs +143 -0
- package/node_modules/zod/v4/locales/ar.d.cts +5 -0
- package/node_modules/zod/v4/locales/ar.d.ts +4 -0
- package/node_modules/zod/v4/locales/ar.js +116 -0
- package/node_modules/zod/v4/locales/az.cjs +142 -0
- package/node_modules/zod/v4/locales/az.d.cts +5 -0
- package/node_modules/zod/v4/locales/az.d.ts +4 -0
- package/node_modules/zod/v4/locales/az.js +115 -0
- package/node_modules/zod/v4/locales/be.cjs +191 -0
- package/node_modules/zod/v4/locales/be.d.cts +5 -0
- package/node_modules/zod/v4/locales/be.d.ts +4 -0
- package/node_modules/zod/v4/locales/be.js +164 -0
- package/node_modules/zod/v4/locales/bg.cjs +156 -0
- package/node_modules/zod/v4/locales/bg.d.cts +5 -0
- package/node_modules/zod/v4/locales/bg.d.ts +5 -0
- package/node_modules/zod/v4/locales/bg.js +128 -0
- package/node_modules/zod/v4/locales/ca.cjs +145 -0
- package/node_modules/zod/v4/locales/ca.d.cts +5 -0
- package/node_modules/zod/v4/locales/ca.d.ts +4 -0
- package/node_modules/zod/v4/locales/ca.js +118 -0
- package/node_modules/zod/v4/locales/cs.cjs +162 -0
- package/node_modules/zod/v4/locales/cs.d.cts +5 -0
- package/node_modules/zod/v4/locales/cs.d.ts +4 -0
- package/node_modules/zod/v4/locales/cs.js +135 -0
- package/node_modules/zod/v4/locales/da.cjs +158 -0
- package/node_modules/zod/v4/locales/da.d.cts +5 -0
- package/node_modules/zod/v4/locales/da.d.ts +4 -0
- package/node_modules/zod/v4/locales/da.js +131 -0
- package/node_modules/zod/v4/locales/de.cjs +143 -0
- package/node_modules/zod/v4/locales/de.d.cts +5 -0
- package/node_modules/zod/v4/locales/de.d.ts +4 -0
- package/node_modules/zod/v4/locales/de.js +116 -0
- package/node_modules/zod/v4/locales/en.cjs +146 -0
- package/node_modules/zod/v4/locales/en.d.cts +5 -0
- package/node_modules/zod/v4/locales/en.d.ts +5 -0
- package/node_modules/zod/v4/locales/en.js +118 -0
- package/node_modules/zod/v4/locales/eo.cjs +144 -0
- package/node_modules/zod/v4/locales/eo.d.cts +5 -0
- package/node_modules/zod/v4/locales/eo.d.ts +5 -0
- package/node_modules/zod/v4/locales/eo.js +116 -0
- package/node_modules/zod/v4/locales/es.cjs +176 -0
- package/node_modules/zod/v4/locales/es.d.cts +5 -0
- package/node_modules/zod/v4/locales/es.d.ts +4 -0
- package/node_modules/zod/v4/locales/es.js +149 -0
- package/node_modules/zod/v4/locales/fa.cjs +149 -0
- package/node_modules/zod/v4/locales/fa.d.cts +5 -0
- package/node_modules/zod/v4/locales/fa.d.ts +4 -0
- package/node_modules/zod/v4/locales/fa.js +122 -0
- package/node_modules/zod/v4/locales/fi.cjs +149 -0
- package/node_modules/zod/v4/locales/fi.d.cts +5 -0
- package/node_modules/zod/v4/locales/fi.d.ts +4 -0
- package/node_modules/zod/v4/locales/fi.js +122 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +144 -0
- package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.js +117 -0
- package/node_modules/zod/v4/locales/fr.cjs +143 -0
- package/node_modules/zod/v4/locales/fr.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr.js +116 -0
- package/node_modules/zod/v4/locales/he.cjs +255 -0
- package/node_modules/zod/v4/locales/he.d.cts +5 -0
- package/node_modules/zod/v4/locales/he.d.ts +4 -0
- package/node_modules/zod/v4/locales/he.js +228 -0
- package/node_modules/zod/v4/locales/hu.cjs +144 -0
- package/node_modules/zod/v4/locales/hu.d.cts +5 -0
- package/node_modules/zod/v4/locales/hu.d.ts +4 -0
- package/node_modules/zod/v4/locales/hu.js +117 -0
- package/node_modules/zod/v4/locales/id.cjs +143 -0
- package/node_modules/zod/v4/locales/id.d.cts +5 -0
- package/node_modules/zod/v4/locales/id.d.ts +4 -0
- package/node_modules/zod/v4/locales/id.js +116 -0
- package/node_modules/zod/v4/locales/index.cjs +100 -0
- package/node_modules/zod/v4/locales/index.d.cts +47 -0
- package/node_modules/zod/v4/locales/index.d.ts +47 -0
- package/node_modules/zod/v4/locales/index.js +47 -0
- package/node_modules/zod/v4/locales/is.cjs +145 -0
- package/node_modules/zod/v4/locales/is.d.cts +5 -0
- package/node_modules/zod/v4/locales/is.d.ts +5 -0
- package/node_modules/zod/v4/locales/is.js +117 -0
- package/node_modules/zod/v4/locales/it.cjs +144 -0
- package/node_modules/zod/v4/locales/it.d.cts +5 -0
- package/node_modules/zod/v4/locales/it.d.ts +4 -0
- package/node_modules/zod/v4/locales/it.js +117 -0
- package/node_modules/zod/v4/locales/ja.cjs +142 -0
- package/node_modules/zod/v4/locales/ja.d.cts +5 -0
- package/node_modules/zod/v4/locales/ja.d.ts +4 -0
- package/node_modules/zod/v4/locales/ja.js +115 -0
- package/node_modules/zod/v4/locales/ka.cjs +153 -0
- package/node_modules/zod/v4/locales/ka.d.cts +5 -0
- package/node_modules/zod/v4/locales/ka.d.ts +5 -0
- package/node_modules/zod/v4/locales/ka.js +125 -0
- package/node_modules/zod/v4/locales/kh.cjs +12 -0
- package/node_modules/zod/v4/locales/kh.d.cts +5 -0
- package/node_modules/zod/v4/locales/kh.d.ts +5 -0
- package/node_modules/zod/v4/locales/kh.js +5 -0
- package/node_modules/zod/v4/locales/km.cjs +144 -0
- package/node_modules/zod/v4/locales/km.d.cts +5 -0
- package/node_modules/zod/v4/locales/km.d.ts +4 -0
- package/node_modules/zod/v4/locales/km.js +117 -0
- package/node_modules/zod/v4/locales/ko.cjs +148 -0
- package/node_modules/zod/v4/locales/ko.d.cts +5 -0
- package/node_modules/zod/v4/locales/ko.d.ts +4 -0
- package/node_modules/zod/v4/locales/ko.js +121 -0
- package/node_modules/zod/v4/locales/lt.cjs +258 -0
- package/node_modules/zod/v4/locales/lt.d.cts +5 -0
- package/node_modules/zod/v4/locales/lt.d.ts +5 -0
- package/node_modules/zod/v4/locales/lt.js +230 -0
- package/node_modules/zod/v4/locales/mk.cjs +145 -0
- package/node_modules/zod/v4/locales/mk.d.cts +5 -0
- package/node_modules/zod/v4/locales/mk.d.ts +4 -0
- package/node_modules/zod/v4/locales/mk.js +118 -0
- package/node_modules/zod/v4/locales/ms.cjs +143 -0
- package/node_modules/zod/v4/locales/ms.d.cts +5 -0
- package/node_modules/zod/v4/locales/ms.d.ts +4 -0
- package/node_modules/zod/v4/locales/ms.js +116 -0
- package/node_modules/zod/v4/locales/nl.cjs +144 -0
- package/node_modules/zod/v4/locales/nl.d.cts +5 -0
- package/node_modules/zod/v4/locales/nl.d.ts +4 -0
- package/node_modules/zod/v4/locales/nl.js +117 -0
- package/node_modules/zod/v4/locales/no.cjs +143 -0
- package/node_modules/zod/v4/locales/no.d.cts +5 -0
- package/node_modules/zod/v4/locales/no.d.ts +4 -0
- package/node_modules/zod/v4/locales/no.js +116 -0
- package/node_modules/zod/v4/locales/ota.cjs +144 -0
- package/node_modules/zod/v4/locales/ota.d.cts +5 -0
- package/node_modules/zod/v4/locales/ota.d.ts +4 -0
- package/node_modules/zod/v4/locales/ota.js +117 -0
- package/node_modules/zod/v4/locales/package.json +6 -0
- package/node_modules/zod/v4/locales/pl.cjs +144 -0
- package/node_modules/zod/v4/locales/pl.d.cts +5 -0
- package/node_modules/zod/v4/locales/pl.d.ts +4 -0
- package/node_modules/zod/v4/locales/pl.js +117 -0
- package/node_modules/zod/v4/locales/ps.cjs +149 -0
- package/node_modules/zod/v4/locales/ps.d.cts +5 -0
- package/node_modules/zod/v4/locales/ps.d.ts +4 -0
- package/node_modules/zod/v4/locales/ps.js +122 -0
- package/node_modules/zod/v4/locales/pt.cjs +143 -0
- package/node_modules/zod/v4/locales/pt.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt.js +116 -0
- package/node_modules/zod/v4/locales/ru.cjs +191 -0
- package/node_modules/zod/v4/locales/ru.d.cts +5 -0
- package/node_modules/zod/v4/locales/ru.d.ts +4 -0
- package/node_modules/zod/v4/locales/ru.js +164 -0
- package/node_modules/zod/v4/locales/sl.cjs +144 -0
- package/node_modules/zod/v4/locales/sl.d.cts +5 -0
- package/node_modules/zod/v4/locales/sl.d.ts +4 -0
- package/node_modules/zod/v4/locales/sl.js +117 -0
- package/node_modules/zod/v4/locales/sv.cjs +145 -0
- package/node_modules/zod/v4/locales/sv.d.cts +5 -0
- package/node_modules/zod/v4/locales/sv.d.ts +4 -0
- package/node_modules/zod/v4/locales/sv.js +118 -0
- package/node_modules/zod/v4/locales/ta.cjs +144 -0
- package/node_modules/zod/v4/locales/ta.d.cts +5 -0
- package/node_modules/zod/v4/locales/ta.d.ts +4 -0
- package/node_modules/zod/v4/locales/ta.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +144 -0
- package/node_modules/zod/v4/locales/th.d.cts +5 -0
- package/node_modules/zod/v4/locales/th.d.ts +4 -0
- package/node_modules/zod/v4/locales/th.js +117 -0
- package/node_modules/zod/v4/locales/tr.cjs +143 -0
- package/node_modules/zod/v4/locales/tr.d.cts +5 -0
- package/node_modules/zod/v4/locales/tr.d.ts +5 -0
- package/node_modules/zod/v4/locales/tr.js +115 -0
- package/node_modules/zod/v4/locales/ua.cjs +12 -0
- package/node_modules/zod/v4/locales/ua.d.cts +5 -0
- package/node_modules/zod/v4/locales/ua.d.ts +5 -0
- package/node_modules/zod/v4/locales/ua.js +5 -0
- package/node_modules/zod/v4/locales/uk.cjs +144 -0
- package/node_modules/zod/v4/locales/uk.d.cts +5 -0
- package/node_modules/zod/v4/locales/uk.d.ts +4 -0
- package/node_modules/zod/v4/locales/uk.js +117 -0
- package/node_modules/zod/v4/locales/ur.cjs +144 -0
- package/node_modules/zod/v4/locales/ur.d.cts +5 -0
- package/node_modules/zod/v4/locales/ur.d.ts +4 -0
- package/node_modules/zod/v4/locales/ur.js +117 -0
- package/node_modules/zod/v4/locales/vi.cjs +143 -0
- package/node_modules/zod/v4/locales/vi.d.cts +5 -0
- package/node_modules/zod/v4/locales/vi.d.ts +4 -0
- package/node_modules/zod/v4/locales/vi.js +116 -0
- package/node_modules/zod/v4/locales/yo.cjs +142 -0
- package/node_modules/zod/v4/locales/yo.d.cts +5 -0
- package/node_modules/zod/v4/locales/yo.d.ts +4 -0
- package/node_modules/zod/v4/locales/yo.js +115 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +143 -0
- package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.js +116 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +144 -0
- package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.js +117 -0
- package/node_modules/zod/v4/mini/checks.cjs +34 -0
- package/node_modules/zod/v4/mini/checks.d.cts +1 -0
- package/node_modules/zod/v4/mini/checks.d.ts +1 -0
- package/node_modules/zod/v4/mini/checks.js +1 -0
- package/node_modules/zod/v4/mini/coerce.cjs +47 -0
- package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
- package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
- package/node_modules/zod/v4/mini/coerce.js +17 -0
- package/node_modules/zod/v4/mini/external.cjs +63 -0
- package/node_modules/zod/v4/mini/external.d.cts +12 -0
- package/node_modules/zod/v4/mini/external.d.ts +12 -0
- package/node_modules/zod/v4/mini/external.js +14 -0
- package/node_modules/zod/v4/mini/index.cjs +32 -0
- package/node_modules/zod/v4/mini/index.d.cts +3 -0
- package/node_modules/zod/v4/mini/index.d.ts +3 -0
- package/node_modules/zod/v4/mini/index.js +3 -0
- package/node_modules/zod/v4/mini/iso.cjs +60 -0
- package/node_modules/zod/v4/mini/iso.d.cts +22 -0
- package/node_modules/zod/v4/mini/iso.d.ts +22 -0
- package/node_modules/zod/v4/mini/iso.js +30 -0
- package/node_modules/zod/v4/mini/package.json +6 -0
- package/node_modules/zod/v4/mini/parse.cjs +16 -0
- package/node_modules/zod/v4/mini/parse.d.cts +1 -0
- package/node_modules/zod/v4/mini/parse.d.ts +1 -0
- package/node_modules/zod/v4/mini/parse.js +1 -0
- package/node_modules/zod/v4/mini/schemas.cjs +929 -0
- package/node_modules/zod/v4/mini/schemas.d.cts +421 -0
- package/node_modules/zod/v4/mini/schemas.d.ts +421 -0
- package/node_modules/zod/v4/mini/schemas.js +809 -0
- package/node_modules/zod/v4/package.json +6 -0
- package/node_modules/zod/v4-mini/index.cjs +17 -0
- package/node_modules/zod/v4-mini/index.d.cts +1 -0
- package/node_modules/zod/v4-mini/index.d.ts +1 -0
- package/node_modules/zod/v4-mini/index.js +1 -0
- package/node_modules/zod/v4-mini/package.json +6 -0
- package/package.json +93 -0
- package/publish.sh +449 -0
|
@@ -0,0 +1,630 @@
|
|
|
1
|
+
import type * as checks from "./checks.js";
|
|
2
|
+
import type * as JSONSchema from "./json-schema.js";
|
|
3
|
+
import type { $ZodRegistry } from "./registries.js";
|
|
4
|
+
import type * as schemas from "./schemas.js";
|
|
5
|
+
import {
|
|
6
|
+
type Processor,
|
|
7
|
+
type RegistryToJSONSchemaParams,
|
|
8
|
+
type ToJSONSchemaParams,
|
|
9
|
+
type ZodStandardJSONSchemaPayload,
|
|
10
|
+
extractDefs,
|
|
11
|
+
finalize,
|
|
12
|
+
initializeContext,
|
|
13
|
+
process,
|
|
14
|
+
} from "./to-json-schema.js";
|
|
15
|
+
import { getEnumValues } from "./util.js";
|
|
16
|
+
|
|
17
|
+
const formatMap: Partial<Record<checks.$ZodStringFormats, string | undefined>> = {
|
|
18
|
+
guid: "uuid",
|
|
19
|
+
url: "uri",
|
|
20
|
+
datetime: "date-time",
|
|
21
|
+
json_string: "json-string",
|
|
22
|
+
regex: "", // do not set
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// ==================== SIMPLE TYPE PROCESSORS ====================
|
|
26
|
+
|
|
27
|
+
export const stringProcessor: Processor<schemas.$ZodString> = (schema, ctx, _json, _params) => {
|
|
28
|
+
const json = _json as JSONSchema.StringSchema;
|
|
29
|
+
json.type = "string";
|
|
30
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod
|
|
31
|
+
.bag as schemas.$ZodStringInternals<unknown>["bag"];
|
|
32
|
+
if (typeof minimum === "number") json.minLength = minimum;
|
|
33
|
+
if (typeof maximum === "number") json.maxLength = maximum;
|
|
34
|
+
// custom pattern overrides format
|
|
35
|
+
if (format) {
|
|
36
|
+
json.format = formatMap[format as checks.$ZodStringFormats] ?? format;
|
|
37
|
+
if (json.format === "") delete json.format; // empty format is not valid
|
|
38
|
+
}
|
|
39
|
+
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
40
|
+
if (patterns && patterns.size > 0) {
|
|
41
|
+
const regexes = [...patterns];
|
|
42
|
+
if (regexes.length === 1) json.pattern = regexes[0]!.source;
|
|
43
|
+
else if (regexes.length > 1) {
|
|
44
|
+
json.allOf = [
|
|
45
|
+
...regexes.map((regex) => ({
|
|
46
|
+
...(ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0"
|
|
47
|
+
? ({ type: "string" } as const)
|
|
48
|
+
: {}),
|
|
49
|
+
pattern: regex.source,
|
|
50
|
+
})),
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const numberProcessor: Processor<schemas.$ZodNumber> = (schema, ctx, _json, _params) => {
|
|
57
|
+
const json = _json as JSONSchema.NumberSchema | JSONSchema.IntegerSchema;
|
|
58
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
59
|
+
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
|
60
|
+
else json.type = "number";
|
|
61
|
+
|
|
62
|
+
if (typeof exclusiveMinimum === "number") {
|
|
63
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
64
|
+
json.minimum = exclusiveMinimum;
|
|
65
|
+
json.exclusiveMinimum = true;
|
|
66
|
+
} else {
|
|
67
|
+
json.exclusiveMinimum = exclusiveMinimum;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (typeof minimum === "number") {
|
|
71
|
+
json.minimum = minimum;
|
|
72
|
+
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
|
|
73
|
+
if (exclusiveMinimum >= minimum) delete json.minimum;
|
|
74
|
+
else delete json.exclusiveMinimum;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (typeof exclusiveMaximum === "number") {
|
|
79
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
80
|
+
json.maximum = exclusiveMaximum;
|
|
81
|
+
json.exclusiveMaximum = true;
|
|
82
|
+
} else {
|
|
83
|
+
json.exclusiveMaximum = exclusiveMaximum;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (typeof maximum === "number") {
|
|
87
|
+
json.maximum = maximum;
|
|
88
|
+
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
|
|
89
|
+
if (exclusiveMaximum <= maximum) delete json.maximum;
|
|
90
|
+
else delete json.exclusiveMaximum;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const booleanProcessor: Processor<schemas.$ZodBoolean> = (_schema, _ctx, json, _params) => {
|
|
98
|
+
(json as JSONSchema.BooleanSchema).type = "boolean";
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const bigintProcessor: Processor<schemas.$ZodBigInt> = (_schema, ctx, _json, _params) => {
|
|
102
|
+
if (ctx.unrepresentable === "throw") {
|
|
103
|
+
throw new Error("BigInt cannot be represented in JSON Schema");
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const symbolProcessor: Processor<schemas.$ZodSymbol> = (_schema, ctx, _json, _params) => {
|
|
108
|
+
if (ctx.unrepresentable === "throw") {
|
|
109
|
+
throw new Error("Symbols cannot be represented in JSON Schema");
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const nullProcessor: Processor<schemas.$ZodNull> = (_schema, ctx, json, _params) => {
|
|
114
|
+
if (ctx.target === "openapi-3.0") {
|
|
115
|
+
json.type = "string";
|
|
116
|
+
json.nullable = true;
|
|
117
|
+
json.enum = [null];
|
|
118
|
+
} else {
|
|
119
|
+
json.type = "null";
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const undefinedProcessor: Processor<schemas.$ZodUndefined> = (_schema, ctx, _json, _params) => {
|
|
124
|
+
if (ctx.unrepresentable === "throw") {
|
|
125
|
+
throw new Error("Undefined cannot be represented in JSON Schema");
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const voidProcessor: Processor<schemas.$ZodVoid> = (_schema, ctx, _json, _params) => {
|
|
130
|
+
if (ctx.unrepresentable === "throw") {
|
|
131
|
+
throw new Error("Void cannot be represented in JSON Schema");
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const neverProcessor: Processor<schemas.$ZodNever> = (_schema, _ctx, json, _params) => {
|
|
136
|
+
json.not = {};
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const anyProcessor: Processor<schemas.$ZodAny> = (_schema, _ctx, _json, _params) => {
|
|
140
|
+
// empty schema accepts anything
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const unknownProcessor: Processor<schemas.$ZodUnknown> = (_schema, _ctx, _json, _params) => {
|
|
144
|
+
// empty schema accepts anything
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const dateProcessor: Processor<schemas.$ZodDate> = (_schema, ctx, _json, _params) => {
|
|
148
|
+
if (ctx.unrepresentable === "throw") {
|
|
149
|
+
throw new Error("Date cannot be represented in JSON Schema");
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export const enumProcessor: Processor<schemas.$ZodEnum> = (schema, _ctx, json, _params) => {
|
|
154
|
+
const def = schema._zod.def as schemas.$ZodEnumDef;
|
|
155
|
+
const values = getEnumValues(def.entries);
|
|
156
|
+
// Number enums can have both string and number values
|
|
157
|
+
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
158
|
+
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
159
|
+
json.enum = values;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export const literalProcessor: Processor<schemas.$ZodLiteral> = (schema, ctx, json, _params) => {
|
|
163
|
+
const def = schema._zod.def as schemas.$ZodLiteralDef<any>;
|
|
164
|
+
const vals: (string | number | boolean | null)[] = [];
|
|
165
|
+
for (const val of def.values) {
|
|
166
|
+
if (val === undefined) {
|
|
167
|
+
if (ctx.unrepresentable === "throw") {
|
|
168
|
+
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
169
|
+
} else {
|
|
170
|
+
// do not add to vals
|
|
171
|
+
}
|
|
172
|
+
} else if (typeof val === "bigint") {
|
|
173
|
+
if (ctx.unrepresentable === "throw") {
|
|
174
|
+
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
175
|
+
} else {
|
|
176
|
+
vals.push(Number(val));
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
vals.push(val);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (vals.length === 0) {
|
|
183
|
+
// do nothing (an undefined literal was stripped)
|
|
184
|
+
} else if (vals.length === 1) {
|
|
185
|
+
const val = vals[0]!;
|
|
186
|
+
json.type = val === null ? ("null" as const) : (typeof val as any);
|
|
187
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
188
|
+
json.enum = [val];
|
|
189
|
+
} else {
|
|
190
|
+
json.const = val;
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
if (vals.every((v) => typeof v === "number")) json.type = "number";
|
|
194
|
+
if (vals.every((v) => typeof v === "string")) json.type = "string";
|
|
195
|
+
if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
|
|
196
|
+
if (vals.every((v) => v === null)) json.type = "null";
|
|
197
|
+
json.enum = vals;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export const nanProcessor: Processor<schemas.$ZodNaN> = (_schema, ctx, _json, _params) => {
|
|
202
|
+
if (ctx.unrepresentable === "throw") {
|
|
203
|
+
throw new Error("NaN cannot be represented in JSON Schema");
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export const templateLiteralProcessor: Processor<schemas.$ZodTemplateLiteral> = (schema, _ctx, json, _params) => {
|
|
208
|
+
const _json = json as JSONSchema.StringSchema;
|
|
209
|
+
const pattern = schema._zod.pattern;
|
|
210
|
+
if (!pattern) throw new Error("Pattern not found in template literal");
|
|
211
|
+
_json.type = "string";
|
|
212
|
+
_json.pattern = pattern.source;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export const fileProcessor: Processor<schemas.$ZodFile> = (schema, _ctx, json, _params) => {
|
|
216
|
+
const _json = json as JSONSchema.StringSchema;
|
|
217
|
+
const file: JSONSchema.StringSchema = {
|
|
218
|
+
type: "string",
|
|
219
|
+
format: "binary",
|
|
220
|
+
contentEncoding: "binary",
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const { minimum, maximum, mime } = schema._zod.bag as schemas.$ZodFileInternals["bag"];
|
|
224
|
+
if (minimum !== undefined) file.minLength = minimum;
|
|
225
|
+
if (maximum !== undefined) file.maxLength = maximum;
|
|
226
|
+
if (mime) {
|
|
227
|
+
if (mime.length === 1) {
|
|
228
|
+
file.contentMediaType = mime[0]!;
|
|
229
|
+
Object.assign(_json, file);
|
|
230
|
+
} else {
|
|
231
|
+
_json.anyOf = mime.map((m) => {
|
|
232
|
+
const mFile: JSONSchema.StringSchema = { ...file, contentMediaType: m };
|
|
233
|
+
return mFile;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
} else {
|
|
237
|
+
Object.assign(_json, file);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
export const successProcessor: Processor<schemas.$ZodSuccess> = (_schema, _ctx, json, _params) => {
|
|
242
|
+
(json as JSONSchema.BooleanSchema).type = "boolean";
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export const customProcessor: Processor<schemas.$ZodCustom> = (_schema, ctx, _json, _params) => {
|
|
246
|
+
if (ctx.unrepresentable === "throw") {
|
|
247
|
+
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export const functionProcessor: Processor<schemas.$ZodFunction> = (_schema, ctx, _json, _params) => {
|
|
252
|
+
if (ctx.unrepresentable === "throw") {
|
|
253
|
+
throw new Error("Function types cannot be represented in JSON Schema");
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export const transformProcessor: Processor<schemas.$ZodTransform> = (_schema, ctx, _json, _params) => {
|
|
258
|
+
if (ctx.unrepresentable === "throw") {
|
|
259
|
+
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export const mapProcessor: Processor<schemas.$ZodMap> = (_schema, ctx, _json, _params) => {
|
|
264
|
+
if (ctx.unrepresentable === "throw") {
|
|
265
|
+
throw new Error("Map cannot be represented in JSON Schema");
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
export const setProcessor: Processor<schemas.$ZodSet> = (_schema, ctx, _json, _params) => {
|
|
270
|
+
if (ctx.unrepresentable === "throw") {
|
|
271
|
+
throw new Error("Set cannot be represented in JSON Schema");
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
// ==================== COMPOSITE TYPE PROCESSORS ====================
|
|
276
|
+
|
|
277
|
+
export const arrayProcessor: Processor<schemas.$ZodArray> = (schema, ctx, _json, params) => {
|
|
278
|
+
const json = _json as JSONSchema.ArraySchema;
|
|
279
|
+
const def = schema._zod.def as schemas.$ZodArrayDef;
|
|
280
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
281
|
+
if (typeof minimum === "number") json.minItems = minimum;
|
|
282
|
+
if (typeof maximum === "number") json.maxItems = maximum;
|
|
283
|
+
|
|
284
|
+
json.type = "array";
|
|
285
|
+
json.items = process(def.element, ctx as any, { ...params, path: [...params.path, "items"] });
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
export const objectProcessor: Processor<schemas.$ZodObject> = (schema, ctx, _json, params) => {
|
|
289
|
+
const json = _json as JSONSchema.ObjectSchema;
|
|
290
|
+
const def = schema._zod.def as schemas.$ZodObjectDef;
|
|
291
|
+
json.type = "object";
|
|
292
|
+
json.properties = {};
|
|
293
|
+
const shape = def.shape;
|
|
294
|
+
|
|
295
|
+
for (const key in shape) {
|
|
296
|
+
json.properties[key] = process(shape[key]!, ctx as any, {
|
|
297
|
+
...params,
|
|
298
|
+
path: [...params.path, "properties", key],
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// required keys
|
|
303
|
+
const allKeys = new Set(Object.keys(shape));
|
|
304
|
+
const requiredKeys = new Set(
|
|
305
|
+
[...allKeys].filter((key) => {
|
|
306
|
+
const v = def.shape[key]!._zod;
|
|
307
|
+
if (ctx.io === "input") {
|
|
308
|
+
return v.optin === undefined;
|
|
309
|
+
} else {
|
|
310
|
+
return v.optout === undefined;
|
|
311
|
+
}
|
|
312
|
+
})
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
if (requiredKeys.size > 0) {
|
|
316
|
+
json.required = Array.from(requiredKeys);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// catchall
|
|
320
|
+
if (def.catchall?._zod.def.type === "never") {
|
|
321
|
+
// strict
|
|
322
|
+
json.additionalProperties = false;
|
|
323
|
+
} else if (!def.catchall) {
|
|
324
|
+
// regular
|
|
325
|
+
if (ctx.io === "output") json.additionalProperties = false;
|
|
326
|
+
} else if (def.catchall) {
|
|
327
|
+
json.additionalProperties = process(def.catchall, ctx as any, {
|
|
328
|
+
...params,
|
|
329
|
+
path: [...params.path, "additionalProperties"],
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
export const unionProcessor: Processor<schemas.$ZodUnion> = (schema, ctx, json, params) => {
|
|
335
|
+
const def = schema._zod.def as schemas.$ZodUnionDef;
|
|
336
|
+
// Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches)
|
|
337
|
+
// This includes both z.xor() and discriminated unions
|
|
338
|
+
const isExclusive = def.inclusive === false;
|
|
339
|
+
const options = def.options.map((x, i) =>
|
|
340
|
+
process(x, ctx as any, {
|
|
341
|
+
...params,
|
|
342
|
+
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i],
|
|
343
|
+
})
|
|
344
|
+
);
|
|
345
|
+
if (isExclusive) {
|
|
346
|
+
json.oneOf = options;
|
|
347
|
+
} else {
|
|
348
|
+
json.anyOf = options;
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
export const intersectionProcessor: Processor<schemas.$ZodIntersection> = (schema, ctx, json, params) => {
|
|
353
|
+
const def = schema._zod.def as schemas.$ZodIntersectionDef;
|
|
354
|
+
const a = process(def.left, ctx as any, {
|
|
355
|
+
...params,
|
|
356
|
+
path: [...params.path, "allOf", 0],
|
|
357
|
+
});
|
|
358
|
+
const b = process(def.right, ctx as any, {
|
|
359
|
+
...params,
|
|
360
|
+
path: [...params.path, "allOf", 1],
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
const isSimpleIntersection = (val: any) => "allOf" in val && Object.keys(val).length === 1;
|
|
364
|
+
const allOf = [
|
|
365
|
+
...(isSimpleIntersection(a) ? (a.allOf as any[]) : [a]),
|
|
366
|
+
...(isSimpleIntersection(b) ? (b.allOf as any[]) : [b]),
|
|
367
|
+
];
|
|
368
|
+
json.allOf = allOf;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
export const tupleProcessor: Processor<schemas.$ZodTuple> = (schema, ctx, _json, params) => {
|
|
372
|
+
const json = _json as JSONSchema.ArraySchema;
|
|
373
|
+
const def = schema._zod.def as schemas.$ZodTupleDef;
|
|
374
|
+
json.type = "array";
|
|
375
|
+
|
|
376
|
+
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
377
|
+
const restPath =
|
|
378
|
+
ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
379
|
+
|
|
380
|
+
const prefixItems = def.items.map((x, i) =>
|
|
381
|
+
process(x, ctx as any, {
|
|
382
|
+
...params,
|
|
383
|
+
path: [...params.path, prefixPath, i],
|
|
384
|
+
})
|
|
385
|
+
);
|
|
386
|
+
const rest = def.rest
|
|
387
|
+
? process(def.rest, ctx as any, {
|
|
388
|
+
...params,
|
|
389
|
+
path: [...params.path, restPath, ...(ctx.target === "openapi-3.0" ? [def.items.length] : [])],
|
|
390
|
+
})
|
|
391
|
+
: null;
|
|
392
|
+
|
|
393
|
+
if (ctx.target === "draft-2020-12") {
|
|
394
|
+
json.prefixItems = prefixItems;
|
|
395
|
+
if (rest) {
|
|
396
|
+
json.items = rest;
|
|
397
|
+
}
|
|
398
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
399
|
+
json.items = {
|
|
400
|
+
anyOf: prefixItems,
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
if (rest) {
|
|
404
|
+
json.items.anyOf!.push(rest);
|
|
405
|
+
}
|
|
406
|
+
json.minItems = prefixItems.length;
|
|
407
|
+
if (!rest) {
|
|
408
|
+
json.maxItems = prefixItems.length;
|
|
409
|
+
}
|
|
410
|
+
} else {
|
|
411
|
+
json.items = prefixItems;
|
|
412
|
+
if (rest) {
|
|
413
|
+
json.additionalItems = rest;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// length
|
|
418
|
+
const { minimum, maximum } = schema._zod.bag as {
|
|
419
|
+
minimum?: number;
|
|
420
|
+
maximum?: number;
|
|
421
|
+
};
|
|
422
|
+
if (typeof minimum === "number") json.minItems = minimum;
|
|
423
|
+
if (typeof maximum === "number") json.maxItems = maximum;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
export const recordProcessor: Processor<schemas.$ZodRecord> = (schema, ctx, _json, params) => {
|
|
427
|
+
const json = _json as JSONSchema.ObjectSchema;
|
|
428
|
+
const def = schema._zod.def as schemas.$ZodRecordDef;
|
|
429
|
+
json.type = "object";
|
|
430
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
431
|
+
json.propertyNames = process(def.keyType, ctx as any, {
|
|
432
|
+
...params,
|
|
433
|
+
path: [...params.path, "propertyNames"],
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
json.additionalProperties = process(def.valueType, ctx as any, {
|
|
437
|
+
...params,
|
|
438
|
+
path: [...params.path, "additionalProperties"],
|
|
439
|
+
});
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
export const nullableProcessor: Processor<schemas.$ZodNullable> = (schema, ctx, json, params) => {
|
|
443
|
+
const def = schema._zod.def as schemas.$ZodNullableDef;
|
|
444
|
+
const inner = process(def.innerType, ctx as any, params);
|
|
445
|
+
const seen = ctx.seen.get(schema)!;
|
|
446
|
+
if (ctx.target === "openapi-3.0") {
|
|
447
|
+
seen.ref = def.innerType;
|
|
448
|
+
json.nullable = true;
|
|
449
|
+
} else {
|
|
450
|
+
json.anyOf = [inner, { type: "null" }];
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
export const nonoptionalProcessor: Processor<schemas.$ZodNonOptional> = (schema, ctx, _json, params) => {
|
|
455
|
+
const def = schema._zod.def as schemas.$ZodNonOptionalDef;
|
|
456
|
+
process(def.innerType, ctx as any, params);
|
|
457
|
+
const seen = ctx.seen.get(schema)!;
|
|
458
|
+
seen.ref = def.innerType;
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
export const defaultProcessor: Processor<schemas.$ZodDefault> = (schema, ctx, json, params) => {
|
|
462
|
+
const def = schema._zod.def as schemas.$ZodDefaultDef;
|
|
463
|
+
process(def.innerType, ctx as any, params);
|
|
464
|
+
const seen = ctx.seen.get(schema)!;
|
|
465
|
+
seen.ref = def.innerType;
|
|
466
|
+
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
export const prefaultProcessor: Processor<schemas.$ZodPrefault> = (schema, ctx, json, params) => {
|
|
470
|
+
const def = schema._zod.def as schemas.$ZodPrefaultDef;
|
|
471
|
+
process(def.innerType, ctx as any, params);
|
|
472
|
+
const seen = ctx.seen.get(schema)!;
|
|
473
|
+
seen.ref = def.innerType;
|
|
474
|
+
if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
export const catchProcessor: Processor<schemas.$ZodCatch> = (schema, ctx, json, params) => {
|
|
478
|
+
const def = schema._zod.def as schemas.$ZodCatchDef;
|
|
479
|
+
process(def.innerType, ctx as any, params);
|
|
480
|
+
const seen = ctx.seen.get(schema)!;
|
|
481
|
+
seen.ref = def.innerType;
|
|
482
|
+
let catchValue: any;
|
|
483
|
+
try {
|
|
484
|
+
catchValue = def.catchValue(undefined as any);
|
|
485
|
+
} catch {
|
|
486
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
487
|
+
}
|
|
488
|
+
json.default = catchValue;
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
export const pipeProcessor: Processor<schemas.$ZodPipe> = (schema, ctx, _json, params) => {
|
|
492
|
+
const def = schema._zod.def as schemas.$ZodPipeDef;
|
|
493
|
+
const innerType = ctx.io === "input" ? (def.in._zod.def.type === "transform" ? def.out : def.in) : def.out;
|
|
494
|
+
process(innerType, ctx as any, params);
|
|
495
|
+
const seen = ctx.seen.get(schema)!;
|
|
496
|
+
seen.ref = innerType;
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
export const readonlyProcessor: Processor<schemas.$ZodReadonly> = (schema, ctx, json, params) => {
|
|
500
|
+
const def = schema._zod.def as schemas.$ZodReadonlyDef;
|
|
501
|
+
process(def.innerType, ctx as any, params);
|
|
502
|
+
const seen = ctx.seen.get(schema)!;
|
|
503
|
+
seen.ref = def.innerType;
|
|
504
|
+
json.readOnly = true;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
export const promiseProcessor: Processor<schemas.$ZodPromise> = (schema, ctx, _json, params) => {
|
|
508
|
+
const def = schema._zod.def as schemas.$ZodPromiseDef;
|
|
509
|
+
process(def.innerType, ctx as any, params);
|
|
510
|
+
const seen = ctx.seen.get(schema)!;
|
|
511
|
+
seen.ref = def.innerType;
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
export const optionalProcessor: Processor<schemas.$ZodOptional> = (schema, ctx, _json, params) => {
|
|
515
|
+
const def = schema._zod.def as schemas.$ZodOptionalDef;
|
|
516
|
+
process(def.innerType, ctx as any, params);
|
|
517
|
+
const seen = ctx.seen.get(schema)!;
|
|
518
|
+
seen.ref = def.innerType;
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
export const lazyProcessor: Processor<schemas.$ZodLazy> = (schema, ctx, _json, params) => {
|
|
522
|
+
const innerType = (schema as schemas.$ZodLazy)._zod.innerType;
|
|
523
|
+
process(innerType, ctx as any, params);
|
|
524
|
+
const seen = ctx.seen.get(schema)!;
|
|
525
|
+
seen.ref = innerType;
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
// ==================== ALL PROCESSORS ====================
|
|
529
|
+
|
|
530
|
+
export const allProcessors: Record<string, Processor<any>> = {
|
|
531
|
+
string: stringProcessor,
|
|
532
|
+
number: numberProcessor,
|
|
533
|
+
boolean: booleanProcessor,
|
|
534
|
+
bigint: bigintProcessor,
|
|
535
|
+
symbol: symbolProcessor,
|
|
536
|
+
null: nullProcessor,
|
|
537
|
+
undefined: undefinedProcessor,
|
|
538
|
+
void: voidProcessor,
|
|
539
|
+
never: neverProcessor,
|
|
540
|
+
any: anyProcessor,
|
|
541
|
+
unknown: unknownProcessor,
|
|
542
|
+
date: dateProcessor,
|
|
543
|
+
enum: enumProcessor,
|
|
544
|
+
literal: literalProcessor,
|
|
545
|
+
nan: nanProcessor,
|
|
546
|
+
template_literal: templateLiteralProcessor,
|
|
547
|
+
file: fileProcessor,
|
|
548
|
+
success: successProcessor,
|
|
549
|
+
custom: customProcessor,
|
|
550
|
+
function: functionProcessor,
|
|
551
|
+
transform: transformProcessor,
|
|
552
|
+
map: mapProcessor,
|
|
553
|
+
set: setProcessor,
|
|
554
|
+
array: arrayProcessor,
|
|
555
|
+
object: objectProcessor,
|
|
556
|
+
union: unionProcessor,
|
|
557
|
+
intersection: intersectionProcessor,
|
|
558
|
+
tuple: tupleProcessor,
|
|
559
|
+
record: recordProcessor,
|
|
560
|
+
nullable: nullableProcessor,
|
|
561
|
+
nonoptional: nonoptionalProcessor,
|
|
562
|
+
default: defaultProcessor,
|
|
563
|
+
prefault: prefaultProcessor,
|
|
564
|
+
catch: catchProcessor,
|
|
565
|
+
pipe: pipeProcessor,
|
|
566
|
+
readonly: readonlyProcessor,
|
|
567
|
+
promise: promiseProcessor,
|
|
568
|
+
optional: optionalProcessor,
|
|
569
|
+
lazy: lazyProcessor,
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
// ==================== TOP-LEVEL toJSONSchema ====================
|
|
573
|
+
|
|
574
|
+
export function toJSONSchema<T extends schemas.$ZodType>(
|
|
575
|
+
schema: T,
|
|
576
|
+
params?: ToJSONSchemaParams
|
|
577
|
+
): ZodStandardJSONSchemaPayload<T>;
|
|
578
|
+
export function toJSONSchema(
|
|
579
|
+
registry: $ZodRegistry<{ id?: string | undefined }>,
|
|
580
|
+
params?: RegistryToJSONSchemaParams
|
|
581
|
+
): { schemas: Record<string, ZodStandardJSONSchemaPayload<schemas.$ZodType>> };
|
|
582
|
+
export function toJSONSchema(
|
|
583
|
+
input: schemas.$ZodType | $ZodRegistry<{ id?: string | undefined }>,
|
|
584
|
+
params?: ToJSONSchemaParams | RegistryToJSONSchemaParams
|
|
585
|
+
): any {
|
|
586
|
+
if ("_idmap" in input) {
|
|
587
|
+
// Registry case
|
|
588
|
+
const registry = input as $ZodRegistry<{ id?: string | undefined }>;
|
|
589
|
+
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
590
|
+
const defs: any = {};
|
|
591
|
+
|
|
592
|
+
// First pass: process all schemas to build the seen map
|
|
593
|
+
for (const entry of registry._idmap.entries()) {
|
|
594
|
+
const [_, schema] = entry;
|
|
595
|
+
process(schema, ctx as any);
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
const schemas: Record<string, JSONSchema.BaseSchema> = {};
|
|
599
|
+
const external = {
|
|
600
|
+
registry,
|
|
601
|
+
uri: (params as RegistryToJSONSchemaParams)?.uri,
|
|
602
|
+
defs,
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
// Update the context with external configuration
|
|
606
|
+
ctx.external = external;
|
|
607
|
+
|
|
608
|
+
// Second pass: emit each schema
|
|
609
|
+
for (const entry of registry._idmap.entries()) {
|
|
610
|
+
const [key, schema] = entry;
|
|
611
|
+
extractDefs(ctx as any, schema);
|
|
612
|
+
schemas[key] = finalize(ctx as any, schema);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
if (Object.keys(defs).length > 0) {
|
|
616
|
+
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
617
|
+
schemas.__shared = {
|
|
618
|
+
[defsSegment]: defs,
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
return { schemas };
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// Single schema case
|
|
626
|
+
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
627
|
+
process(input, ctx as any);
|
|
628
|
+
extractDefs(ctx as any, input);
|
|
629
|
+
return finalize(ctx as any, input);
|
|
630
|
+
}
|