@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,147 @@
|
|
|
1
|
+
export type Schema =
|
|
2
|
+
| ObjectSchema
|
|
3
|
+
| ArraySchema
|
|
4
|
+
| StringSchema
|
|
5
|
+
| NumberSchema
|
|
6
|
+
| IntegerSchema
|
|
7
|
+
| BooleanSchema
|
|
8
|
+
| NullSchema;
|
|
9
|
+
|
|
10
|
+
// export type JsonType = "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
|
|
11
|
+
|
|
12
|
+
// export interface JSONSchema {
|
|
13
|
+
// type?: string ;
|
|
14
|
+
// $id?: string ;
|
|
15
|
+
// id?: string ;
|
|
16
|
+
// $schema?: string ;
|
|
17
|
+
// $ref?: string ;
|
|
18
|
+
// $anchor?: string ;
|
|
19
|
+
// $defs?: { [key: string]: JSONSchema } ;
|
|
20
|
+
// definitions?: { [key: string]: JSONSchema } ;
|
|
21
|
+
// $comment?: string ;
|
|
22
|
+
// title?: string ;
|
|
23
|
+
// description?: string ;
|
|
24
|
+
// default?: unknown ;
|
|
25
|
+
// examples?: unknown[] ;
|
|
26
|
+
// readOnly?: boolean ;
|
|
27
|
+
// writeOnly?: boolean ;
|
|
28
|
+
// deprecated?: boolean ;
|
|
29
|
+
// allOf?: JSONSchema[] ;
|
|
30
|
+
// anyOf?: JSONSchema[] ;
|
|
31
|
+
// oneOf?: JSONSchema[] ;
|
|
32
|
+
// not?: JSONSchema ;
|
|
33
|
+
// if?: JSONSchema ;
|
|
34
|
+
// then?: JSONSchema ;
|
|
35
|
+
// else?: JSONSchema ;
|
|
36
|
+
// enum?: Array<string | number | boolean | null> ;
|
|
37
|
+
// const?: string | number | boolean | null ;
|
|
38
|
+
// [k: string]: unknown;
|
|
39
|
+
|
|
40
|
+
// /** A special key used as an intermediate representation of extends-style relationships. Omitted as a $ref with additional properties. */
|
|
41
|
+
// // _ref?: JSONSchema;
|
|
42
|
+
// _prefault?: unknown ;
|
|
43
|
+
// }
|
|
44
|
+
|
|
45
|
+
export type _JSONSchema = boolean | JSONSchema;
|
|
46
|
+
export type JSONSchema = {
|
|
47
|
+
[k: string]: unknown;
|
|
48
|
+
$schema?:
|
|
49
|
+
| "https://json-schema.org/draft/2020-12/schema"
|
|
50
|
+
| "http://json-schema.org/draft-07/schema#"
|
|
51
|
+
| "http://json-schema.org/draft-04/schema#";
|
|
52
|
+
$id?: string;
|
|
53
|
+
$anchor?: string;
|
|
54
|
+
$ref?: string;
|
|
55
|
+
$dynamicRef?: string;
|
|
56
|
+
$dynamicAnchor?: string;
|
|
57
|
+
$vocabulary?: Record<string, boolean>;
|
|
58
|
+
$comment?: string;
|
|
59
|
+
$defs?: Record<string, JSONSchema>;
|
|
60
|
+
type?: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
|
|
61
|
+
additionalItems?: _JSONSchema;
|
|
62
|
+
unevaluatedItems?: _JSONSchema;
|
|
63
|
+
prefixItems?: _JSONSchema[];
|
|
64
|
+
items?: _JSONSchema | _JSONSchema[];
|
|
65
|
+
contains?: _JSONSchema;
|
|
66
|
+
additionalProperties?: _JSONSchema;
|
|
67
|
+
unevaluatedProperties?: _JSONSchema;
|
|
68
|
+
properties?: Record<string, _JSONSchema>;
|
|
69
|
+
patternProperties?: Record<string, _JSONSchema>;
|
|
70
|
+
dependentSchemas?: Record<string, _JSONSchema>;
|
|
71
|
+
propertyNames?: _JSONSchema;
|
|
72
|
+
if?: _JSONSchema;
|
|
73
|
+
then?: _JSONSchema;
|
|
74
|
+
else?: _JSONSchema;
|
|
75
|
+
allOf?: JSONSchema[];
|
|
76
|
+
anyOf?: JSONSchema[];
|
|
77
|
+
oneOf?: JSONSchema[];
|
|
78
|
+
not?: _JSONSchema;
|
|
79
|
+
multipleOf?: number;
|
|
80
|
+
maximum?: number;
|
|
81
|
+
exclusiveMaximum?: number | boolean;
|
|
82
|
+
minimum?: number;
|
|
83
|
+
exclusiveMinimum?: number | boolean;
|
|
84
|
+
maxLength?: number;
|
|
85
|
+
minLength?: number;
|
|
86
|
+
pattern?: string;
|
|
87
|
+
maxItems?: number;
|
|
88
|
+
minItems?: number;
|
|
89
|
+
uniqueItems?: boolean;
|
|
90
|
+
maxContains?: number;
|
|
91
|
+
minContains?: number;
|
|
92
|
+
maxProperties?: number;
|
|
93
|
+
minProperties?: number;
|
|
94
|
+
required?: string[];
|
|
95
|
+
dependentRequired?: Record<string, string[]>;
|
|
96
|
+
enum?: Array<string | number | boolean | null>;
|
|
97
|
+
const?: string | number | boolean | null;
|
|
98
|
+
|
|
99
|
+
// metadata
|
|
100
|
+
id?: string;
|
|
101
|
+
title?: string;
|
|
102
|
+
description?: string;
|
|
103
|
+
default?: unknown;
|
|
104
|
+
deprecated?: boolean;
|
|
105
|
+
readOnly?: boolean;
|
|
106
|
+
writeOnly?: boolean;
|
|
107
|
+
nullable?: boolean;
|
|
108
|
+
examples?: unknown[];
|
|
109
|
+
format?: string;
|
|
110
|
+
contentMediaType?: string;
|
|
111
|
+
contentEncoding?: string;
|
|
112
|
+
contentSchema?: JSONSchema;
|
|
113
|
+
|
|
114
|
+
// internal
|
|
115
|
+
_prefault?: unknown;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// for backwards compatibility
|
|
119
|
+
export type BaseSchema = JSONSchema;
|
|
120
|
+
|
|
121
|
+
export interface ObjectSchema extends JSONSchema {
|
|
122
|
+
type: "object";
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface ArraySchema extends JSONSchema {
|
|
126
|
+
type: "array";
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface StringSchema extends JSONSchema {
|
|
130
|
+
type: "string";
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface NumberSchema extends JSONSchema {
|
|
134
|
+
type: "number";
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface IntegerSchema extends JSONSchema {
|
|
138
|
+
type: "integer";
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface BooleanSchema extends JSONSchema {
|
|
142
|
+
type: "boolean";
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface NullSchema extends JSONSchema {
|
|
146
|
+
type: "null";
|
|
147
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import * as core from "./core.js";
|
|
2
|
+
import * as errors from "./errors.js";
|
|
3
|
+
import type * as schemas from "./schemas.js";
|
|
4
|
+
import * as util from "./util.js";
|
|
5
|
+
|
|
6
|
+
export type $ZodErrorClass = { new (issues: errors.$ZodIssue[]): errors.$ZodError };
|
|
7
|
+
|
|
8
|
+
/////////// METHODS ///////////
|
|
9
|
+
export type $Parse = <T extends schemas.$ZodType>(
|
|
10
|
+
schema: T,
|
|
11
|
+
value: unknown,
|
|
12
|
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>,
|
|
13
|
+
_params?: { callee?: util.AnyFunc; Err?: $ZodErrorClass }
|
|
14
|
+
) => core.output<T>;
|
|
15
|
+
|
|
16
|
+
export const _parse: (_Err: $ZodErrorClass) => $Parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
17
|
+
const ctx: schemas.ParseContextInternal = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
18
|
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
19
|
+
if (result instanceof Promise) {
|
|
20
|
+
throw new core.$ZodAsyncError();
|
|
21
|
+
}
|
|
22
|
+
if (result.issues.length) {
|
|
23
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));
|
|
24
|
+
util.captureStackTrace(e, _params?.callee);
|
|
25
|
+
throw e;
|
|
26
|
+
}
|
|
27
|
+
return result.value as core.output<typeof schema>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const parse: $Parse = /* @__PURE__*/ _parse(errors.$ZodRealError);
|
|
31
|
+
|
|
32
|
+
export type $ParseAsync = <T extends schemas.$ZodType>(
|
|
33
|
+
schema: T,
|
|
34
|
+
value: unknown,
|
|
35
|
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>,
|
|
36
|
+
_params?: { callee?: util.AnyFunc; Err?: $ZodErrorClass }
|
|
37
|
+
) => Promise<core.output<T>>;
|
|
38
|
+
|
|
39
|
+
export const _parseAsync: (_Err: $ZodErrorClass) => $ParseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
40
|
+
const ctx: schemas.ParseContextInternal = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
41
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
42
|
+
if (result instanceof Promise) result = await result;
|
|
43
|
+
if (result.issues.length) {
|
|
44
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));
|
|
45
|
+
util.captureStackTrace(e, params?.callee);
|
|
46
|
+
throw e;
|
|
47
|
+
}
|
|
48
|
+
return result.value as core.output<typeof schema>;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const parseAsync: $ParseAsync = /* @__PURE__*/ _parseAsync(errors.$ZodRealError);
|
|
52
|
+
|
|
53
|
+
export type $SafeParse = <T extends schemas.$ZodType>(
|
|
54
|
+
schema: T,
|
|
55
|
+
value: unknown,
|
|
56
|
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>
|
|
57
|
+
) => util.SafeParseResult<core.output<T>>;
|
|
58
|
+
|
|
59
|
+
export const _safeParse: (_Err: $ZodErrorClass) => $SafeParse = (_Err) => (schema, value, _ctx) => {
|
|
60
|
+
const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
61
|
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
62
|
+
if (result instanceof Promise) {
|
|
63
|
+
throw new core.$ZodAsyncError();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return result.issues.length
|
|
67
|
+
? {
|
|
68
|
+
success: false,
|
|
69
|
+
error: new (_Err ?? errors.$ZodError)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
|
|
70
|
+
}
|
|
71
|
+
: ({ success: true, data: result.value } as any);
|
|
72
|
+
};
|
|
73
|
+
export const safeParse: $SafeParse = /* @__PURE__*/ _safeParse(errors.$ZodRealError);
|
|
74
|
+
|
|
75
|
+
export type $SafeParseAsync = <T extends schemas.$ZodType>(
|
|
76
|
+
schema: T,
|
|
77
|
+
value: unknown,
|
|
78
|
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>
|
|
79
|
+
) => Promise<util.SafeParseResult<core.output<T>>>;
|
|
80
|
+
|
|
81
|
+
export const _safeParseAsync: (_Err: $ZodErrorClass) => $SafeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
82
|
+
const ctx: schemas.ParseContextInternal = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
83
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
84
|
+
if (result instanceof Promise) result = await result;
|
|
85
|
+
|
|
86
|
+
return result.issues.length
|
|
87
|
+
? {
|
|
88
|
+
success: false,
|
|
89
|
+
error: new _Err(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
|
|
90
|
+
}
|
|
91
|
+
: ({ success: true, data: result.value } as any);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const safeParseAsync: $SafeParseAsync = /* @__PURE__*/ _safeParseAsync(errors.$ZodRealError);
|
|
95
|
+
|
|
96
|
+
// Codec functions
|
|
97
|
+
export type $Encode = <T extends schemas.$ZodType>(
|
|
98
|
+
schema: T,
|
|
99
|
+
value: core.output<T>,
|
|
100
|
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>
|
|
101
|
+
) => core.input<T>;
|
|
102
|
+
|
|
103
|
+
export const _encode: (_Err: $ZodErrorClass) => $Encode = (_Err) => (schema, value, _ctx) => {
|
|
104
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" as const }) : { direction: "backward" as const };
|
|
105
|
+
return _parse(_Err)(schema, value, ctx as any) as any;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const encode: $Encode = /* @__PURE__*/ _encode(errors.$ZodRealError);
|
|
109
|
+
|
|
110
|
+
export type $Decode = <T extends schemas.$ZodType>(
|
|
111
|
+
schema: T,
|
|
112
|
+
value: core.input<T>,
|
|
113
|
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>
|
|
114
|
+
) => core.output<T>;
|
|
115
|
+
|
|
116
|
+
export const _decode: (_Err: $ZodErrorClass) => $Decode = (_Err) => (schema, value, _ctx) => {
|
|
117
|
+
return _parse(_Err)(schema, value, _ctx);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const decode: $Decode = /* @__PURE__*/ _decode(errors.$ZodRealError);
|
|
121
|
+
|
|
122
|
+
export type $EncodeAsync = <T extends schemas.$ZodType>(
|
|
123
|
+
schema: T,
|
|
124
|
+
value: core.output<T>,
|
|
125
|
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>
|
|
126
|
+
) => Promise<core.input<T>>;
|
|
127
|
+
|
|
128
|
+
export const _encodeAsync: (_Err: $ZodErrorClass) => $EncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
129
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" as const }) : { direction: "backward" as const };
|
|
130
|
+
return _parseAsync(_Err)(schema, value, ctx as any) as any;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const encodeAsync: $EncodeAsync = /* @__PURE__*/ _encodeAsync(errors.$ZodRealError);
|
|
134
|
+
|
|
135
|
+
export type $DecodeAsync = <T extends schemas.$ZodType>(
|
|
136
|
+
schema: T,
|
|
137
|
+
value: core.input<T>,
|
|
138
|
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>
|
|
139
|
+
) => Promise<core.output<T>>;
|
|
140
|
+
|
|
141
|
+
export const _decodeAsync: (_Err: $ZodErrorClass) => $DecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
142
|
+
return _parseAsync(_Err)(schema, value, _ctx);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const decodeAsync: $DecodeAsync = /* @__PURE__*/ _decodeAsync(errors.$ZodRealError);
|
|
146
|
+
|
|
147
|
+
export type $SafeEncode = <T extends schemas.$ZodType>(
|
|
148
|
+
schema: T,
|
|
149
|
+
value: core.output<T>,
|
|
150
|
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>
|
|
151
|
+
) => util.SafeParseResult<core.input<T>>;
|
|
152
|
+
|
|
153
|
+
export const _safeEncode: (_Err: $ZodErrorClass) => $SafeEncode = (_Err) => (schema, value, _ctx) => {
|
|
154
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" as const }) : { direction: "backward" as const };
|
|
155
|
+
return _safeParse(_Err)(schema, value, ctx as any) as any;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export const safeEncode: $SafeEncode = /* @__PURE__*/ _safeEncode(errors.$ZodRealError);
|
|
159
|
+
|
|
160
|
+
export type $SafeDecode = <T extends schemas.$ZodType>(
|
|
161
|
+
schema: T,
|
|
162
|
+
value: core.input<T>,
|
|
163
|
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>
|
|
164
|
+
) => util.SafeParseResult<core.output<T>>;
|
|
165
|
+
|
|
166
|
+
export const _safeDecode: (_Err: $ZodErrorClass) => $SafeDecode = (_Err) => (schema, value, _ctx) => {
|
|
167
|
+
return _safeParse(_Err)(schema, value, _ctx);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export const safeDecode: $SafeDecode = /* @__PURE__*/ _safeDecode(errors.$ZodRealError);
|
|
171
|
+
|
|
172
|
+
export type $SafeEncodeAsync = <T extends schemas.$ZodType>(
|
|
173
|
+
schema: T,
|
|
174
|
+
value: core.output<T>,
|
|
175
|
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>
|
|
176
|
+
) => Promise<util.SafeParseResult<core.input<T>>>;
|
|
177
|
+
|
|
178
|
+
export const _safeEncodeAsync: (_Err: $ZodErrorClass) => $SafeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
179
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" as const }) : { direction: "backward" as const };
|
|
180
|
+
return _safeParseAsync(_Err)(schema, value, ctx as any) as any;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export const safeEncodeAsync: $SafeEncodeAsync = /* @__PURE__*/ _safeEncodeAsync(errors.$ZodRealError);
|
|
184
|
+
|
|
185
|
+
export type $SafeDecodeAsync = <T extends schemas.$ZodType>(
|
|
186
|
+
schema: T,
|
|
187
|
+
value: core.input<T>,
|
|
188
|
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>
|
|
189
|
+
) => Promise<util.SafeParseResult<core.output<T>>>;
|
|
190
|
+
|
|
191
|
+
export const _safeDecodeAsync: (_Err: $ZodErrorClass) => $SafeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
192
|
+
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export const safeDecodeAsync: $SafeDecodeAsync = /* @__PURE__*/ _safeDecodeAsync(errors.$ZodRealError);
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import * as util from "./util.js";
|
|
2
|
+
|
|
3
|
+
export const cuid: RegExp = /^[cC][^\s-]{8,}$/;
|
|
4
|
+
export const cuid2: RegExp = /^[0-9a-z]+$/;
|
|
5
|
+
export const ulid: RegExp = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
6
|
+
export const xid: RegExp = /^[0-9a-vA-V]{20}$/;
|
|
7
|
+
export const ksuid: RegExp = /^[A-Za-z0-9]{27}$/;
|
|
8
|
+
export const nanoid: RegExp = /^[a-zA-Z0-9_-]{21}$/;
|
|
9
|
+
|
|
10
|
+
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
11
|
+
export const duration: RegExp =
|
|
12
|
+
/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
13
|
+
|
|
14
|
+
/** Implements ISO 8601-2 extensions like explicit +- prefixes, mixing weeks with other units, and fractional/negative components. */
|
|
15
|
+
export const extendedDuration: RegExp =
|
|
16
|
+
/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
|
17
|
+
|
|
18
|
+
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
19
|
+
export const guid: RegExp = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
20
|
+
|
|
21
|
+
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
22
|
+
*
|
|
23
|
+
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
24
|
+
export const uuid = (version?: number | undefined): RegExp => {
|
|
25
|
+
if (!version)
|
|
26
|
+
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
27
|
+
return new RegExp(
|
|
28
|
+
`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
export const uuid4: RegExp = /*@__PURE__*/ uuid(4);
|
|
32
|
+
export const uuid6: RegExp = /*@__PURE__*/ uuid(6);
|
|
33
|
+
export const uuid7: RegExp = /*@__PURE__*/ uuid(7);
|
|
34
|
+
|
|
35
|
+
/** Practical email validation */
|
|
36
|
+
export const email: RegExp =
|
|
37
|
+
/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
38
|
+
|
|
39
|
+
/** Equivalent to the HTML5 input[type=email] validation implemented by browsers. Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email */
|
|
40
|
+
export const html5Email: RegExp =
|
|
41
|
+
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
|
42
|
+
|
|
43
|
+
/** The classic emailregex.com regex for RFC 5322-compliant emails */
|
|
44
|
+
export const rfc5322Email =
|
|
45
|
+
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
46
|
+
|
|
47
|
+
/** A loose regex that allows Unicode characters, enforces length limits, and that's about it. */
|
|
48
|
+
export const unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u;
|
|
49
|
+
export const idnEmail = unicodeEmail;
|
|
50
|
+
|
|
51
|
+
export const browserEmail: RegExp =
|
|
52
|
+
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
|
53
|
+
// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
|
|
54
|
+
|
|
55
|
+
const _emoji: string = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
56
|
+
export function emoji(): RegExp {
|
|
57
|
+
return new RegExp(_emoji, "u");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const ipv4: RegExp =
|
|
61
|
+
/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
62
|
+
export const ipv6: RegExp =
|
|
63
|
+
/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
64
|
+
export const mac = (delimiter?: string): RegExp => {
|
|
65
|
+
const escapedDelim = util.escapeRegex(delimiter ?? ":");
|
|
66
|
+
return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
|
|
67
|
+
};
|
|
68
|
+
export const cidrv4: RegExp =
|
|
69
|
+
/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
70
|
+
export const cidrv6: RegExp =
|
|
71
|
+
/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
72
|
+
|
|
73
|
+
// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
|
|
74
|
+
export const base64: RegExp = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
75
|
+
export const base64url: RegExp = /^[A-Za-z0-9_-]*$/;
|
|
76
|
+
|
|
77
|
+
// based on https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address
|
|
78
|
+
// export const hostname: RegExp = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
|
79
|
+
export const hostname: RegExp =
|
|
80
|
+
/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
|
|
81
|
+
|
|
82
|
+
export const domain: RegExp = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
|
|
83
|
+
|
|
84
|
+
// https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces)
|
|
85
|
+
export const e164: RegExp = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
86
|
+
|
|
87
|
+
// const dateSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
|
88
|
+
const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
89
|
+
export const date: RegExp = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
|
|
90
|
+
|
|
91
|
+
function timeSource(args: { precision?: number | null | undefined }) {
|
|
92
|
+
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
93
|
+
const regex =
|
|
94
|
+
typeof args.precision === "number"
|
|
95
|
+
? args.precision === -1
|
|
96
|
+
? `${hhmm}`
|
|
97
|
+
: args.precision === 0
|
|
98
|
+
? `${hhmm}:[0-5]\\d`
|
|
99
|
+
: `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}`
|
|
100
|
+
: `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
101
|
+
return regex;
|
|
102
|
+
}
|
|
103
|
+
export function time(args: {
|
|
104
|
+
precision?: number | null;
|
|
105
|
+
// local?: boolean;
|
|
106
|
+
}): RegExp {
|
|
107
|
+
return new RegExp(`^${timeSource(args)}$`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Adapted from https://stackoverflow.com/a/3143231
|
|
111
|
+
export function datetime(args: {
|
|
112
|
+
precision?: number | null;
|
|
113
|
+
offset?: boolean;
|
|
114
|
+
local?: boolean;
|
|
115
|
+
}): RegExp {
|
|
116
|
+
const time = timeSource({ precision: args.precision });
|
|
117
|
+
const opts = ["Z"];
|
|
118
|
+
if (args.local) opts.push("");
|
|
119
|
+
// if (args.offset) opts.push(`([+-]\\d{2}:\\d{2})`);
|
|
120
|
+
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
121
|
+
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
122
|
+
|
|
123
|
+
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export const string = (params?: { minimum?: number | undefined; maximum?: number | undefined }): RegExp => {
|
|
127
|
+
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
128
|
+
return new RegExp(`^${regex}$`);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const bigint: RegExp = /^-?\d+n?$/;
|
|
132
|
+
export const integer: RegExp = /^-?\d+$/;
|
|
133
|
+
export const number: RegExp = /^-?\d+(?:\.\d+)?/;
|
|
134
|
+
export const boolean: RegExp = /^(?:true|false)$/i;
|
|
135
|
+
const _null: RegExp = /^null$/i;
|
|
136
|
+
export { _null as null };
|
|
137
|
+
const _undefined: RegExp = /^undefined$/i;
|
|
138
|
+
export { _undefined as undefined };
|
|
139
|
+
|
|
140
|
+
// regex for string with no uppercase letters
|
|
141
|
+
export const lowercase: RegExp = /^[^A-Z]*$/;
|
|
142
|
+
// regex for string with no lowercase letters
|
|
143
|
+
export const uppercase: RegExp = /^[^a-z]*$/;
|
|
144
|
+
|
|
145
|
+
// regex for hexadecimal strings (any length)
|
|
146
|
+
export const hex: RegExp = /^[0-9a-fA-F]*$/;
|
|
147
|
+
|
|
148
|
+
// Hash regexes for different algorithms and encodings
|
|
149
|
+
// Helper function to create base64 regex with exact length and padding
|
|
150
|
+
function fixedBase64(bodyLength: number, padding: "" | "=" | "=="): RegExp {
|
|
151
|
+
return new RegExp(`^[A-Za-z0-9+/]{${bodyLength}}${padding}$`);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Helper function to create base64url regex with exact length (no padding)
|
|
155
|
+
function fixedBase64url(length: number): RegExp {
|
|
156
|
+
return new RegExp(`^[A-Za-z0-9_-]{${length}}$`);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// MD5 (16 bytes): base64 = 24 chars total (22 + "==")
|
|
160
|
+
export const md5_hex: RegExp = /^[0-9a-fA-F]{32}$/;
|
|
161
|
+
export const md5_base64: RegExp = /*@__PURE__*/ fixedBase64(22, "==");
|
|
162
|
+
export const md5_base64url: RegExp = /*@__PURE__*/ fixedBase64url(22);
|
|
163
|
+
|
|
164
|
+
// SHA1 (20 bytes): base64 = 28 chars total (27 + "=")
|
|
165
|
+
export const sha1_hex: RegExp = /^[0-9a-fA-F]{40}$/;
|
|
166
|
+
export const sha1_base64: RegExp = /*@__PURE__*/ fixedBase64(27, "=");
|
|
167
|
+
export const sha1_base64url: RegExp = /*@__PURE__*/ fixedBase64url(27);
|
|
168
|
+
|
|
169
|
+
// SHA256 (32 bytes): base64 = 44 chars total (43 + "=")
|
|
170
|
+
export const sha256_hex: RegExp = /^[0-9a-fA-F]{64}$/;
|
|
171
|
+
export const sha256_base64: RegExp = /*@__PURE__*/ fixedBase64(43, "=");
|
|
172
|
+
export const sha256_base64url: RegExp = /*@__PURE__*/ fixedBase64url(43);
|
|
173
|
+
|
|
174
|
+
// SHA384 (48 bytes): base64 = 64 chars total (no padding)
|
|
175
|
+
export const sha384_hex: RegExp = /^[0-9a-fA-F]{96}$/;
|
|
176
|
+
export const sha384_base64: RegExp = /*@__PURE__*/ fixedBase64(64, "");
|
|
177
|
+
export const sha384_base64url: RegExp = /*@__PURE__*/ fixedBase64url(64);
|
|
178
|
+
|
|
179
|
+
// SHA512 (64 bytes): base64 = 88 chars total (86 + "==")
|
|
180
|
+
export const sha512_hex: RegExp = /^[0-9a-fA-F]{128}$/;
|
|
181
|
+
export const sha512_base64: RegExp = /*@__PURE__*/ fixedBase64(86, "==");
|
|
182
|
+
export const sha512_base64url: RegExp = /*@__PURE__*/ fixedBase64url(86);
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type * as core from "./core.js";
|
|
2
|
+
import type { $ZodType } from "./schemas.js";
|
|
3
|
+
|
|
4
|
+
export const $output: unique symbol = Symbol("ZodOutput");
|
|
5
|
+
export type $output = typeof $output;
|
|
6
|
+
export const $input: unique symbol = Symbol("ZodInput");
|
|
7
|
+
export type $input = typeof $input;
|
|
8
|
+
|
|
9
|
+
export type $replace<Meta, S extends $ZodType> = Meta extends $output
|
|
10
|
+
? core.output<S>
|
|
11
|
+
: Meta extends $input
|
|
12
|
+
? core.input<S>
|
|
13
|
+
: Meta extends (infer M)[]
|
|
14
|
+
? $replace<M, S>[]
|
|
15
|
+
: Meta extends (...args: infer P) => infer R
|
|
16
|
+
? (
|
|
17
|
+
...args: {
|
|
18
|
+
[K in keyof P]: $replace<P[K], S>; // tuple
|
|
19
|
+
}
|
|
20
|
+
) => $replace<R, S>
|
|
21
|
+
: // handle objects
|
|
22
|
+
Meta extends object
|
|
23
|
+
? { [K in keyof Meta]: $replace<Meta[K], S> }
|
|
24
|
+
: Meta;
|
|
25
|
+
|
|
26
|
+
type MetadataType = object | undefined;
|
|
27
|
+
export class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {
|
|
28
|
+
_meta!: Meta;
|
|
29
|
+
_schema!: Schema;
|
|
30
|
+
_map: WeakMap<Schema, $replace<Meta, Schema>> = new WeakMap();
|
|
31
|
+
_idmap: Map<string, Schema> = new Map();
|
|
32
|
+
|
|
33
|
+
add<S extends Schema>(
|
|
34
|
+
schema: S,
|
|
35
|
+
..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]
|
|
36
|
+
): this {
|
|
37
|
+
const meta: any = _meta[0];
|
|
38
|
+
this._map.set(schema, meta!);
|
|
39
|
+
if (meta && typeof meta === "object" && "id" in meta) {
|
|
40
|
+
if (this._idmap.has(meta.id!)) {
|
|
41
|
+
throw new Error(`ID ${meta.id} already exists in the registry`);
|
|
42
|
+
}
|
|
43
|
+
this._idmap.set(meta.id!, schema);
|
|
44
|
+
}
|
|
45
|
+
return this as any;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
clear(): this {
|
|
49
|
+
this._map = new WeakMap();
|
|
50
|
+
this._idmap = new Map();
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
remove(schema: Schema): this {
|
|
55
|
+
const meta: any = this._map.get(schema);
|
|
56
|
+
if (meta && typeof meta === "object" && "id" in meta) {
|
|
57
|
+
this._idmap.delete(meta.id!);
|
|
58
|
+
}
|
|
59
|
+
this._map.delete(schema);
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get<S extends Schema>(schema: S): $replace<Meta, S> | undefined {
|
|
64
|
+
// return this._map.get(schema) as any;
|
|
65
|
+
|
|
66
|
+
// inherit metadata
|
|
67
|
+
const p = schema._zod.parent as Schema;
|
|
68
|
+
if (p) {
|
|
69
|
+
const pm: any = { ...(this.get(p) ?? {}) };
|
|
70
|
+
delete pm.id; // do not inherit id
|
|
71
|
+
const f = { ...pm, ...this._map.get(schema) } as any;
|
|
72
|
+
return Object.keys(f).length ? f : undefined;
|
|
73
|
+
}
|
|
74
|
+
return this._map.get(schema) as any;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
has(schema: Schema): boolean {
|
|
78
|
+
return this._map.has(schema);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface JSONSchemaMeta {
|
|
83
|
+
id?: string | undefined;
|
|
84
|
+
title?: string | undefined;
|
|
85
|
+
description?: string | undefined;
|
|
86
|
+
deprecated?: boolean | undefined;
|
|
87
|
+
[k: string]: unknown;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface GlobalMeta extends JSONSchemaMeta {}
|
|
91
|
+
|
|
92
|
+
// registries
|
|
93
|
+
export function registry<T extends MetadataType = MetadataType, S extends $ZodType = $ZodType>(): $ZodRegistry<T, S> {
|
|
94
|
+
return new $ZodRegistry<T, S>();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
interface GlobalThisWithRegistry {
|
|
98
|
+
/**
|
|
99
|
+
* The globalRegistry instance shared across both CommonJS and ESM builds.
|
|
100
|
+
* By attaching the registry to `globalThis`, this property ensures a single, deduplicated instance
|
|
101
|
+
* is used regardless of whether the package is loaded via `require` (CJS) or `import` (ESM).
|
|
102
|
+
* This prevents dual package hazards and keeps registry state consistent.
|
|
103
|
+
*/
|
|
104
|
+
__zod_globalRegistry?: $ZodRegistry<GlobalMeta>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
(globalThis as GlobalThisWithRegistry).__zod_globalRegistry ??= registry<GlobalMeta>();
|
|
108
|
+
export const globalRegistry: $ZodRegistry<GlobalMeta> = (globalThis as GlobalThisWithRegistry).__zod_globalRegistry!;
|