@wopee-io/wopee.wdio 6.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/domain/model/config.interface.d.ts +15 -60
- package/build/domain/model/config.interface.d.ts.map +1 -1
- package/build/domain/service/wopeeService.d.ts.map +1 -1
- package/build/domain/service/wopeeService.js +2 -0
- package/build/domain/service/wopeeService.js.map +1 -1
- package/build/utils/versionMetadata.js +2 -2
- package/node_modules/@autonomous-testing/sdk/build/core/domain/entities/createIntegrationScenarioPayload.interface.d.ts +1 -7
- package/node_modules/@autonomous-testing/sdk/build/core/domain/entities/createIntegrationStepPayload.interface.d.ts +1 -23
- package/node_modules/@autonomous-testing/sdk/build/core/domain/entities/createIntegrationSuitePayload.interface.d.ts +1 -5
- package/node_modules/@autonomous-testing/sdk/build/core/domain/entities/integrationScenario.interface.d.ts +1 -7
- package/node_modules/@autonomous-testing/sdk/build/core/domain/entities/integrationStep.interface.d.ts +3 -11
- package/node_modules/@autonomous-testing/sdk/build/core/domain/entities/integrationStep.interface.js +1 -1
- package/node_modules/@autonomous-testing/sdk/build/core/domain/entities/integrationSuite.interface.d.ts +1 -7
- package/node_modules/@autonomous-testing/sdk/build/core/domain/entities/visualAssert.interface.d.ts +3 -11
- package/node_modules/@autonomous-testing/sdk/build/core/domain/entities/visualAssert.interface.js +1 -1
- package/node_modules/@autonomous-testing/sdk/build/core/domain/entities/visualAssertPayload.interface.d.ts +1 -9
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/adapter.d.ts +9 -2
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/adapter.js +30 -3
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/axios-config.d.ts +15 -1
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/axios-config.js +17 -1
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/deadline.d.ts +36 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/deadline.js +63 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/errors.js +10 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/factories.js +1 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/index.d.ts +2 -2
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/interface.d.ts +41 -224
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/interface.js +16 -8
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/retry.d.ts +52 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/retry.js +122 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/apolloAdapterService/apolloAdapterService.js +3 -7
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/apolloAdapterService/apolloService.interface.d.ts +2 -2
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/loggerService/loggerOptions.interface.d.ts +5 -10
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/loggerService/loggerOptions.interface.js +2 -1
- package/node_modules/@autonomous-testing/sdk/build/shared/metadata/versionMetadata.js +2 -2
- package/node_modules/@autonomous-testing/sdk/build/shared/utils/zodHelper/zodHelper.d.ts +10 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/utils/zodHelper/zodHelper.js +8 -0
- package/node_modules/@autonomous-testing/sdk/package.json +2 -2
- package/node_modules/follow-redirects/README.md +27 -1
- package/node_modules/follow-redirects/index.js +11 -6
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/zod/README.md +34 -24
- package/node_modules/zod/compile.cjs +96 -0
- package/node_modules/zod/compile.d.cts +1 -0
- package/node_modules/zod/compile.d.ts +1 -0
- package/node_modules/zod/compile.js +52 -0
- package/node_modules/zod/index.cjs +22 -3
- package/node_modules/zod/index.d.cts +3 -4
- package/node_modules/zod/index.d.ts +3 -4
- package/node_modules/zod/index.js +7 -4
- package/node_modules/zod/locales/index.cjs +36 -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 +7 -0
- package/node_modules/zod/mini/index.cjs +51 -0
- package/node_modules/zod/mini/index.d.cts +3 -0
- package/node_modules/zod/mini/index.d.ts +3 -0
- package/node_modules/zod/mini/index.js +3 -0
- package/node_modules/zod/mini/package.json +7 -0
- package/node_modules/zod/package.json +44 -15
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +7 -4
- package/node_modules/zod/src/locales/index.ts +1 -0
- package/node_modules/zod/src/mini/index.ts +3 -0
- package/node_modules/zod/src/v3/ZodError.ts +23 -13
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +3 -3
- package/node_modules/zod/src/v3/tests/complex.test.ts +17 -3
- package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
- package/node_modules/zod/src/v3/tests/function.test.ts +7 -3
- package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
- package/node_modules/zod/src/v3/tests/nan.test.ts +5 -2
- package/node_modules/zod/src/v3/tests/object.test.ts +10 -13
- package/node_modules/zod/src/v3/tests/partials.test.ts +3 -3
- package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
- package/node_modules/zod/src/v3/tests/string.test.ts +8 -2
- package/node_modules/zod/src/v3/types.ts +8 -6
- package/node_modules/zod/src/v4/classic/checks.ts +3 -0
- package/node_modules/zod/src/v4/classic/compat.ts +30 -18
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +61 -39
- package/node_modules/zod/src/v4/classic/external.ts +18 -11
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +944 -0
- package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
- package/node_modules/zod/src/v4/classic/index.ts +2 -2
- package/node_modules/zod/src/v4/classic/iso.ts +2 -72
- package/node_modules/zod/src/v4/classic/parse.ts +57 -2
- package/node_modules/zod/src/v4/classic/schemas.ts +1258 -375
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +86 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +35 -8
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +192 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +43 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +357 -5
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +572 -0
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +704 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +27 -5
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +67 -6
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +37 -17
- package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +142 -0
- package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +221 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +333 -10
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +394 -4
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +403 -6
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +9 -4
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +4 -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 +1467 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +160 -37
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +67 -0
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +134 -5
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +93 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +168 -5
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +4 -3
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +37 -1
- package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +153 -0
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +15 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +161 -7
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +457 -14
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +255 -12
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +350 -0
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +89 -5
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +25 -5
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +107 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +44 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +74 -21
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +1 -69
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +553 -10
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +352 -1
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +229 -68
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +40 -1
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +20 -3
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +96 -0
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +16 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +568 -9
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +58 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +70 -16
- 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 +3409 -990
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +128 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +353 -5
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +219 -3
- package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
- package/node_modules/zod/src/v4/core/api.ts +442 -161
- package/node_modules/zod/src/v4/core/checks.ts +134 -151
- package/node_modules/zod/src/v4/core/compile.ts +2322 -0
- package/node_modules/zod/src/v4/core/core.ts +146 -50
- package/node_modules/zod/src/v4/core/doc.ts +18 -10
- package/node_modules/zod/src/v4/core/errors.ts +221 -102
- package/node_modules/zod/src/v4/core/index.ts +5 -1
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +131 -0
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +934 -0
- package/node_modules/zod/src/v4/core/json-schema.ts +9 -4
- package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
- package/node_modules/zod/src/v4/core/parse.ts +252 -37
- package/node_modules/zod/src/v4/core/regexes.ts +112 -30
- package/node_modules/zod/src/v4/core/registries.ts +19 -10
- package/node_modules/zod/src/v4/core/schemas.ts +1972 -588
- package/node_modules/zod/src/v4/core/standard-schema.ts +114 -19
- package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
- package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +214 -0
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +1 -1
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +180 -0
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
- package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +2 -2
- package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
- package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
- package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +706 -826
- package/node_modules/zod/src/v4/core/util.ts +675 -157
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/index.ts +3 -3
- package/node_modules/zod/src/v4/locales/ar.ts +22 -27
- package/node_modules/zod/src/v4/locales/az.ts +22 -27
- package/node_modules/zod/src/v4/locales/be.ts +31 -27
- package/node_modules/zod/src/v4/locales/bg.ts +133 -0
- package/node_modules/zod/src/v4/locales/bn.ts +123 -0
- package/node_modules/zod/src/v4/locales/ca.ts +22 -28
- package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
- package/node_modules/zod/src/v4/locales/cs.ts +26 -45
- package/node_modules/zod/src/v4/locales/da.ts +128 -0
- package/node_modules/zod/src/v4/locales/de.ts +24 -27
- package/node_modules/zod/src/v4/locales/el.ts +124 -0
- package/node_modules/zod/src/v4/locales/en.ts +38 -29
- package/node_modules/zod/src/v4/locales/eo.ts +25 -27
- package/node_modules/zod/src/v4/locales/es.ts +53 -33
- package/node_modules/zod/src/v4/locales/fa.ts +24 -27
- package/node_modules/zod/src/v4/locales/fi.ts +22 -27
- package/node_modules/zod/src/v4/locales/fr-CA.ts +22 -27
- package/node_modules/zod/src/v4/locales/fr.ts +58 -43
- package/node_modules/zod/src/v4/locales/gu.ts +123 -0
- package/node_modules/zod/src/v4/locales/he.ts +208 -80
- package/node_modules/zod/src/v4/locales/hi.ts +126 -0
- package/node_modules/zod/src/v4/locales/hr.ts +135 -0
- package/node_modules/zod/src/v4/locales/hu.ts +24 -28
- package/node_modules/zod/src/v4/locales/hy.ts +175 -0
- package/node_modules/zod/src/v4/locales/id.ts +22 -27
- package/node_modules/zod/src/v4/locales/index.ts +24 -0
- package/node_modules/zod/src/v4/locales/is.ts +124 -0
- package/node_modules/zod/src/v4/locales/it.ts +24 -28
- package/node_modules/zod/src/v4/locales/ja.ts +24 -27
- package/node_modules/zod/src/v4/locales/ka.ts +128 -0
- package/node_modules/zod/src/v4/locales/kh.ts +3 -122
- package/node_modules/zod/src/v4/locales/km.ts +124 -0
- package/node_modules/zod/src/v4/locales/kn.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +22 -27
- package/node_modules/zod/src/v4/locales/lt.ts +243 -0
- package/node_modules/zod/src/v4/locales/mk.ts +24 -28
- package/node_modules/zod/src/v4/locales/ms.ts +23 -27
- package/node_modules/zod/src/v4/locales/ne.ts +128 -0
- package/node_modules/zod/src/v4/locales/nl.ts +37 -37
- package/node_modules/zod/src/v4/locales/nn.ts +121 -0
- package/node_modules/zod/src/v4/locales/no.ts +26 -29
- package/node_modules/zod/src/v4/locales/ota.ts +25 -28
- package/node_modules/zod/src/v4/locales/pl.ts +24 -27
- package/node_modules/zod/src/v4/locales/ps.ts +24 -26
- package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
- package/node_modules/zod/src/v4/locales/pt.ts +107 -71
- package/node_modules/zod/src/v4/locales/ro.ts +132 -0
- package/node_modules/zod/src/v4/locales/ru.ts +31 -27
- package/node_modules/zod/src/v4/locales/sk.ts +123 -0
- package/node_modules/zod/src/v4/locales/sl.ts +24 -27
- package/node_modules/zod/src/v4/locales/sv.ts +26 -29
- package/node_modules/zod/src/v4/locales/ta.ts +25 -27
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +25 -27
- package/node_modules/zod/src/v4/locales/tk.ts +113 -0
- package/node_modules/zod/src/v4/locales/tr.ts +22 -27
- package/node_modules/zod/src/v4/locales/ua.ts +3 -122
- package/node_modules/zod/src/v4/locales/uk.ts +122 -0
- package/node_modules/zod/src/v4/locales/ur.ts +25 -27
- package/node_modules/zod/src/v4/locales/uz.ts +120 -0
- package/node_modules/zod/src/v4/locales/vi.ts +24 -27
- package/node_modules/zod/src/v4/locales/yo.ts +129 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +25 -27
- package/node_modules/zod/src/v4/locales/zh-TW.ts +22 -27
- package/node_modules/zod/src/v4/mini/checks.ts +1 -0
- package/node_modules/zod/src/v4/mini/coerce.ts +5 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +15 -3
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/iso.ts +8 -4
- package/node_modules/zod/src/v4/mini/parse.ts +16 -1
- package/node_modules/zod/src/v4/mini/schemas.ts +586 -114
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +57 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +63 -2
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +582 -0
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +12 -18
- package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +24 -5
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +7 -36
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +281 -6
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +15 -1
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +116 -9
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +1 -1
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +68 -2
- package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +98 -1
- package/node_modules/zod/src/v4-mini/index.ts +3 -1
- package/node_modules/zod/v3/ZodError.cjs +42 -13
- package/node_modules/zod/v3/ZodError.d.cts +6 -6
- package/node_modules/zod/v3/ZodError.d.ts +6 -6
- package/node_modules/zod/v3/ZodError.js +23 -13
- package/node_modules/zod/v3/errors.cjs +19 -0
- package/node_modules/zod/v3/external.cjs +19 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
- package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
- package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
- package/node_modules/zod/v3/helpers/util.cjs +19 -0
- package/node_modules/zod/v3/index.cjs +19 -0
- package/node_modules/zod/v3/locales/en.cjs +1 -0
- package/node_modules/zod/v3/locales/en.d.cts +1 -1
- package/node_modules/zod/v3/package.json +7 -0
- package/node_modules/zod/v3/standard-schema.cjs +19 -0
- package/node_modules/zod/v3/types.cjs +28 -5
- package/node_modules/zod/v3/types.d.cts +4 -1
- package/node_modules/zod/v3/types.d.ts +4 -1
- package/node_modules/zod/v3/types.js +9 -5
- package/node_modules/zod/v4/classic/checks.cjs +22 -1
- package/node_modules/zod/v4/classic/checks.d.cts +1 -1
- package/node_modules/zod/v4/classic/checks.d.ts +1 -1
- package/node_modules/zod/v4/classic/checks.js +1 -1
- package/node_modules/zod/v4/classic/coerce.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.cjs +24 -1
- package/node_modules/zod/v4/classic/compat.d.cts +13 -11
- package/node_modules/zod/v4/classic/compat.d.ts +13 -11
- package/node_modules/zod/v4/classic/compat.js +4 -0
- package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/node_modules/zod/v4/classic/errors.cjs +63 -28
- package/node_modules/zod/v4/classic/errors.d.cts +3 -4
- package/node_modules/zod/v4/classic/errors.d.ts +3 -4
- package/node_modules/zod/v4/classic/errors.js +45 -29
- package/node_modules/zod/v4/classic/external.cjs +55 -28
- package/node_modules/zod/v4/classic/external.d.cts +8 -2
- package/node_modules/zod/v4/classic/external.d.ts +8 -2
- package/node_modules/zod/v4/classic/external.js +7 -8
- package/node_modules/zod/v4/classic/from-json-schema.cjs +926 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.js +881 -0
- package/node_modules/zod/v4/classic/in-out.cjs +82 -0
- package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
- package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
- package/node_modules/zod/v4/classic/in-out.js +36 -0
- package/node_modules/zod/v4/classic/index.cjs +21 -2
- package/node_modules/zod/v4/classic/index.d.cts +1 -2
- package/node_modules/zod/v4/classic/index.d.ts +1 -2
- package/node_modules/zod/v4/classic/index.js +2 -2
- package/node_modules/zod/v4/classic/iso.cjs +30 -22
- package/node_modules/zod/v4/classic/iso.d.cts +2 -17
- package/node_modules/zod/v4/classic/iso.d.ts +2 -17
- package/node_modules/zod/v4/classic/iso.js +2 -17
- package/node_modules/zod/v4/classic/package.json +7 -0
- package/node_modules/zod/v4/classic/parse.cjs +32 -1
- package/node_modules/zod/v4/classic/parse.d.cts +21 -0
- package/node_modules/zod/v4/classic/parse.d.ts +21 -0
- package/node_modules/zod/v4/classic/parse.js +10 -0
- package/node_modules/zod/v4/classic/schemas.cjs +805 -238
- package/node_modules/zod/v4/classic/schemas.d.cts +241 -55
- package/node_modules/zod/v4/classic/schemas.d.ts +241 -55
- package/node_modules/zod/v4/classic/schemas.js +766 -237
- package/node_modules/zod/v4/core/api.cjs +284 -54
- package/node_modules/zod/v4/core/api.d.cts +133 -82
- package/node_modules/zod/v4/core/api.d.ts +133 -82
- package/node_modules/zod/v4/core/api.js +255 -54
- package/node_modules/zod/v4/core/checks.cjs +100 -130
- package/node_modules/zod/v4/core/checks.d.cts +32 -16
- package/node_modules/zod/v4/core/checks.d.ts +32 -16
- package/node_modules/zod/v4/core/checks.js +80 -129
- package/node_modules/zod/v4/core/compile.cjs +1916 -0
- package/node_modules/zod/v4/core/compile.d.cts +65 -0
- package/node_modules/zod/v4/core/compile.d.ts +65 -0
- package/node_modules/zod/v4/core/compile.js +1866 -0
- package/node_modules/zod/v4/core/core.cjs +120 -20
- package/node_modules/zod/v4/core/core.d.cts +40 -7
- package/node_modules/zod/v4/core/core.d.ts +40 -7
- package/node_modules/zod/v4/core/core.js +101 -21
- package/node_modules/zod/v4/core/doc.cjs +31 -9
- package/node_modules/zod/v4/core/doc.d.cts +4 -2
- package/node_modules/zod/v4/core/doc.d.ts +4 -2
- package/node_modules/zod/v4/core/doc.js +12 -9
- package/node_modules/zod/v4/core/errors.cjs +151 -60
- package/node_modules/zod/v4/core/errors.d.cts +41 -24
- package/node_modules/zod/v4/core/errors.d.ts +41 -24
- package/node_modules/zod/v4/core/errors.js +132 -60
- package/node_modules/zod/v4/core/index.cjs +28 -2
- package/node_modules/zod/v4/core/index.d.cts +5 -1
- package/node_modules/zod/v4/core/index.d.ts +5 -1
- package/node_modules/zod/v4/core/index.js +5 -1
- package/node_modules/zod/v4/core/json-schema-generator.cjs +122 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.js +99 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +929 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +65 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +65 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +843 -0
- package/node_modules/zod/v4/core/json-schema.cjs +19 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +6 -4
- package/node_modules/zod/v4/core/json-schema.d.ts +6 -4
- package/node_modules/zod/v4/core/memoizer.cjs +360 -0
- package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
- package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
- package/node_modules/zod/v4/core/memoizer.js +311 -0
- package/node_modules/zod/v4/core/package.json +7 -0
- package/node_modules/zod/v4/core/parse.cjs +183 -37
- package/node_modules/zod/v4/core/parse.d.cts +34 -7
- package/node_modules/zod/v4/core/parse.d.ts +34 -7
- package/node_modules/zod/v4/core/parse.js +154 -36
- package/node_modules/zod/v4/core/regexes.cjs +137 -31
- package/node_modules/zod/v4/core/regexes.d.cts +30 -2
- package/node_modules/zod/v4/core/regexes.d.ts +30 -2
- package/node_modules/zod/v4/core/regexes.js +90 -29
- package/node_modules/zod/v4/core/registries.cjs +26 -7
- package/node_modules/zod/v4/core/registries.d.cts +2 -2
- package/node_modules/zod/v4/core/registries.d.ts +2 -2
- package/node_modules/zod/v4/core/registries.js +9 -9
- package/node_modules/zod/v4/core/schemas.cjs +1373 -422
- package/node_modules/zod/v4/core/schemas.d.cts +276 -42
- package/node_modules/zod/v4/core/schemas.d.ts +276 -42
- package/node_modules/zod/v4/core/schemas.js +1341 -422
- package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
- package/node_modules/zod/v4/core/standard-schema.d.cts +90 -19
- package/node_modules/zod/v4/core/standard-schema.d.ts +90 -19
- package/node_modules/zod/v4/core/to-json-schema.cjs +628 -801
- package/node_modules/zod/v4/core/to-json-schema.d.cts +103 -37
- package/node_modules/zod/v4/core/to-json-schema.d.ts +103 -37
- package/node_modules/zod/v4/core/to-json-schema.js +602 -800
- package/node_modules/zod/v4/core/util.cjs +580 -155
- package/node_modules/zod/v4/core/util.d.cts +98 -1
- package/node_modules/zod/v4/core/util.d.ts +98 -1
- package/node_modules/zod/v4/core/util.js +536 -156
- package/node_modules/zod/v4/core/versions.cjs +21 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/core/visit.cjs +214 -0
- package/node_modules/zod/v4/core/visit.d.cts +30 -0
- package/node_modules/zod/v4/core/visit.d.ts +30 -0
- package/node_modules/zod/v4/core/visit.js +169 -0
- package/node_modules/zod/v4/index.cjs +34 -5
- package/node_modules/zod/v4/index.d.cts +2 -2
- package/node_modules/zod/v4/index.d.ts +2 -2
- package/node_modules/zod/v4/index.js +3 -2
- package/node_modules/zod/v4/locales/ar.cjs +20 -24
- package/node_modules/zod/v4/locales/ar.d.cts +2 -1
- package/node_modules/zod/v4/locales/ar.js +19 -24
- package/node_modules/zod/v4/locales/az.cjs +20 -24
- package/node_modules/zod/v4/locales/az.d.cts +2 -1
- package/node_modules/zod/v4/locales/az.js +19 -24
- package/node_modules/zod/v4/locales/be.cjs +29 -24
- package/node_modules/zod/v4/locales/be.d.cts +2 -1
- package/node_modules/zod/v4/locales/be.js +28 -24
- package/node_modules/zod/v4/locales/bg.cjs +152 -0
- package/node_modules/zod/v4/locales/bg.d.cts +5 -0
- package/node_modules/zod/v4/locales/bg.d.ts +4 -0
- package/node_modules/zod/v4/locales/bg.js +125 -0
- package/node_modules/zod/v4/locales/bn.cjs +140 -0
- package/node_modules/zod/v4/locales/bn.d.cts +5 -0
- package/node_modules/zod/v4/locales/bn.d.ts +4 -0
- package/node_modules/zod/v4/locales/bn.js +113 -0
- package/node_modules/zod/v4/locales/ca.cjs +20 -25
- package/node_modules/zod/v4/locales/ca.d.cts +2 -1
- package/node_modules/zod/v4/locales/ca.js +19 -25
- package/node_modules/zod/v4/locales/ckb.cjs +160 -0
- package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
- package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
- package/node_modules/zod/v4/locales/ckb.js +133 -0
- package/node_modules/zod/v4/locales/cs.cjs +24 -42
- package/node_modules/zod/v4/locales/cs.d.cts +2 -1
- package/node_modules/zod/v4/locales/cs.js +23 -42
- package/node_modules/zod/v4/locales/da.cjs +147 -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 +120 -0
- package/node_modules/zod/v4/locales/de.cjs +22 -24
- package/node_modules/zod/v4/locales/de.d.cts +2 -1
- package/node_modules/zod/v4/locales/de.js +21 -24
- package/node_modules/zod/v4/locales/el.cjs +139 -0
- package/node_modules/zod/v4/locales/el.d.cts +5 -0
- package/node_modules/zod/v4/locales/el.d.ts +4 -0
- package/node_modules/zod/v4/locales/el.js +112 -0
- package/node_modules/zod/v4/locales/en.cjs +35 -28
- package/node_modules/zod/v4/locales/en.d.cts +2 -2
- package/node_modules/zod/v4/locales/en.d.ts +0 -1
- package/node_modules/zod/v4/locales/en.js +34 -26
- package/node_modules/zod/v4/locales/eo.cjs +23 -26
- package/node_modules/zod/v4/locales/eo.d.cts +2 -2
- package/node_modules/zod/v4/locales/eo.d.ts +0 -1
- package/node_modules/zod/v4/locales/eo.js +22 -24
- package/node_modules/zod/v4/locales/es.cjs +51 -31
- package/node_modules/zod/v4/locales/es.d.cts +2 -1
- package/node_modules/zod/v4/locales/es.js +50 -31
- package/node_modules/zod/v4/locales/fa.cjs +22 -24
- package/node_modules/zod/v4/locales/fa.d.cts +2 -1
- package/node_modules/zod/v4/locales/fa.js +21 -24
- package/node_modules/zod/v4/locales/fi.cjs +20 -24
- package/node_modules/zod/v4/locales/fi.d.cts +2 -1
- package/node_modules/zod/v4/locales/fi.js +19 -24
- package/node_modules/zod/v4/locales/fr-CA.cjs +20 -24
- package/node_modules/zod/v4/locales/fr-CA.d.cts +2 -1
- package/node_modules/zod/v4/locales/fr-CA.js +19 -24
- package/node_modules/zod/v4/locales/fr.cjs +53 -39
- package/node_modules/zod/v4/locales/fr.d.cts +2 -1
- package/node_modules/zod/v4/locales/fr.js +52 -39
- package/node_modules/zod/v4/locales/gu.cjs +140 -0
- package/node_modules/zod/v4/locales/gu.d.cts +5 -0
- package/node_modules/zod/v4/locales/gu.d.ts +4 -0
- package/node_modules/zod/v4/locales/gu.js +113 -0
- package/node_modules/zod/v4/locales/he.cjs +183 -78
- package/node_modules/zod/v4/locales/he.d.cts +2 -1
- package/node_modules/zod/v4/locales/he.js +182 -78
- package/node_modules/zod/v4/locales/hi.cjs +138 -0
- package/node_modules/zod/v4/locales/hi.d.cts +5 -0
- package/node_modules/zod/v4/locales/hi.d.ts +4 -0
- package/node_modules/zod/v4/locales/hi.js +111 -0
- package/node_modules/zod/v4/locales/hr.cjs +153 -0
- package/node_modules/zod/v4/locales/hr.d.cts +5 -0
- package/node_modules/zod/v4/locales/hr.d.ts +4 -0
- package/node_modules/zod/v4/locales/hr.js +126 -0
- package/node_modules/zod/v4/locales/hu.cjs +22 -25
- package/node_modules/zod/v4/locales/hu.d.cts +2 -1
- package/node_modules/zod/v4/locales/hu.js +21 -25
- package/node_modules/zod/v4/locales/hy.cjs +185 -0
- package/node_modules/zod/v4/locales/hy.d.cts +5 -0
- package/node_modules/zod/v4/locales/hy.d.ts +4 -0
- package/node_modules/zod/v4/locales/hy.js +158 -0
- package/node_modules/zod/v4/locales/id.cjs +20 -24
- package/node_modules/zod/v4/locales/id.d.cts +2 -1
- package/node_modules/zod/v4/locales/id.js +19 -24
- package/node_modules/zod/v4/locales/index.cjs +69 -1
- package/node_modules/zod/v4/locales/index.d.cts +24 -0
- package/node_modules/zod/v4/locales/index.d.ts +24 -0
- package/node_modules/zod/v4/locales/index.js +24 -0
- package/node_modules/zod/v4/locales/is.cjs +141 -0
- package/node_modules/zod/v4/locales/is.d.cts +5 -0
- package/node_modules/zod/v4/locales/is.d.ts +4 -0
- package/node_modules/zod/v4/locales/is.js +114 -0
- package/node_modules/zod/v4/locales/it.cjs +22 -25
- package/node_modules/zod/v4/locales/it.d.cts +2 -1
- package/node_modules/zod/v4/locales/it.js +21 -25
- package/node_modules/zod/v4/locales/ja.cjs +22 -24
- package/node_modules/zod/v4/locales/ja.d.cts +2 -1
- package/node_modules/zod/v4/locales/ja.js +21 -24
- package/node_modules/zod/v4/locales/ka.cjs +144 -0
- package/node_modules/zod/v4/locales/ka.d.cts +5 -0
- package/node_modules/zod/v4/locales/ka.d.ts +4 -0
- package/node_modules/zod/v4/locales/ka.js +117 -0
- package/node_modules/zod/v4/locales/kh.cjs +6 -137
- package/node_modules/zod/v4/locales/kh.d.cts +2 -1
- package/node_modules/zod/v4/locales/kh.d.ts +1 -0
- package/node_modules/zod/v4/locales/kh.js +3 -115
- package/node_modules/zod/v4/locales/km.cjs +142 -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 +115 -0
- package/node_modules/zod/v4/locales/kn.cjs +143 -0
- package/node_modules/zod/v4/locales/kn.d.cts +5 -0
- package/node_modules/zod/v4/locales/kn.d.ts +4 -0
- package/node_modules/zod/v4/locales/kn.js +116 -0
- package/node_modules/zod/v4/locales/ko.cjs +20 -24
- package/node_modules/zod/v4/locales/ko.d.cts +2 -1
- package/node_modules/zod/v4/locales/ko.js +19 -24
- package/node_modules/zod/v4/locales/lt.cjs +234 -0
- package/node_modules/zod/v4/locales/lt.d.cts +5 -0
- package/node_modules/zod/v4/locales/lt.d.ts +4 -0
- package/node_modules/zod/v4/locales/lt.js +207 -0
- package/node_modules/zod/v4/locales/mk.cjs +22 -25
- package/node_modules/zod/v4/locales/mk.d.cts +2 -1
- package/node_modules/zod/v4/locales/mk.js +21 -25
- package/node_modules/zod/v4/locales/ms.cjs +21 -24
- package/node_modules/zod/v4/locales/ms.d.cts +2 -1
- package/node_modules/zod/v4/locales/ms.js +20 -24
- package/node_modules/zod/v4/locales/ne.cjs +138 -0
- package/node_modules/zod/v4/locales/ne.d.cts +5 -0
- package/node_modules/zod/v4/locales/ne.d.ts +4 -0
- package/node_modules/zod/v4/locales/ne.js +111 -0
- package/node_modules/zod/v4/locales/nl.cjs +31 -32
- package/node_modules/zod/v4/locales/nl.d.cts +2 -1
- package/node_modules/zod/v4/locales/nl.js +30 -32
- package/node_modules/zod/v4/locales/nn.cjs +140 -0
- package/node_modules/zod/v4/locales/nn.d.cts +5 -0
- package/node_modules/zod/v4/locales/nn.d.ts +4 -0
- package/node_modules/zod/v4/locales/nn.js +113 -0
- package/node_modules/zod/v4/locales/no.cjs +24 -26
- package/node_modules/zod/v4/locales/no.d.cts +2 -1
- package/node_modules/zod/v4/locales/no.js +23 -26
- package/node_modules/zod/v4/locales/ota.cjs +23 -25
- package/node_modules/zod/v4/locales/ota.d.cts +2 -1
- package/node_modules/zod/v4/locales/ota.js +22 -25
- package/node_modules/zod/v4/locales/package.json +7 -0
- package/node_modules/zod/v4/locales/pl.cjs +22 -24
- package/node_modules/zod/v4/locales/pl.d.cts +2 -1
- package/node_modules/zod/v4/locales/pl.js +21 -24
- package/node_modules/zod/v4/locales/ps.cjs +22 -24
- package/node_modules/zod/v4/locales/ps.d.cts +2 -1
- package/node_modules/zod/v4/locales/ps.js +21 -24
- package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
- package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt-BR.js +143 -0
- package/node_modules/zod/v4/locales/pt.cjs +95 -68
- package/node_modules/zod/v4/locales/pt.d.cts +2 -1
- package/node_modules/zod/v4/locales/pt.js +94 -68
- package/node_modules/zod/v4/locales/ro.cjs +149 -0
- package/node_modules/zod/v4/locales/ro.d.cts +5 -0
- package/node_modules/zod/v4/locales/ro.d.ts +4 -0
- package/node_modules/zod/v4/locales/ro.js +122 -0
- package/node_modules/zod/v4/locales/ru.cjs +29 -24
- package/node_modules/zod/v4/locales/ru.d.cts +2 -1
- package/node_modules/zod/v4/locales/ru.js +28 -24
- package/node_modules/zod/v4/locales/sk.cjs +143 -0
- package/node_modules/zod/v4/locales/sk.d.cts +5 -0
- package/node_modules/zod/v4/locales/sk.d.ts +4 -0
- package/node_modules/zod/v4/locales/sk.js +116 -0
- package/node_modules/zod/v4/locales/sl.cjs +22 -24
- package/node_modules/zod/v4/locales/sl.d.cts +2 -1
- package/node_modules/zod/v4/locales/sl.js +21 -24
- package/node_modules/zod/v4/locales/sv.cjs +24 -26
- package/node_modules/zod/v4/locales/sv.d.cts +2 -1
- package/node_modules/zod/v4/locales/sv.js +23 -26
- package/node_modules/zod/v4/locales/ta.cjs +23 -24
- package/node_modules/zod/v4/locales/ta.d.cts +2 -1
- package/node_modules/zod/v4/locales/ta.js +22 -24
- package/node_modules/zod/v4/locales/tg.cjs +144 -0
- package/node_modules/zod/v4/locales/tg.d.cts +5 -0
- package/node_modules/zod/v4/locales/tg.d.ts +4 -0
- package/node_modules/zod/v4/locales/tg.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +23 -24
- package/node_modules/zod/v4/locales/th.d.cts +2 -1
- package/node_modules/zod/v4/locales/th.js +22 -24
- package/node_modules/zod/v4/locales/tk.cjs +134 -0
- package/node_modules/zod/v4/locales/tk.d.cts +5 -0
- package/node_modules/zod/v4/locales/tk.d.ts +4 -0
- package/node_modules/zod/v4/locales/tk.js +107 -0
- package/node_modules/zod/v4/locales/tr.cjs +20 -26
- package/node_modules/zod/v4/locales/tr.d.cts +2 -2
- package/node_modules/zod/v4/locales/tr.d.ts +0 -1
- package/node_modules/zod/v4/locales/tr.js +19 -24
- package/node_modules/zod/v4/locales/ua.cjs +6 -137
- package/node_modules/zod/v4/locales/ua.d.cts +2 -1
- package/node_modules/zod/v4/locales/ua.d.ts +1 -0
- package/node_modules/zod/v4/locales/ua.js +3 -115
- package/node_modules/zod/v4/locales/uk.cjs +140 -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 +113 -0
- package/node_modules/zod/v4/locales/ur.cjs +23 -24
- package/node_modules/zod/v4/locales/ur.d.cts +2 -1
- package/node_modules/zod/v4/locales/ur.js +22 -24
- package/node_modules/zod/v4/locales/uz.cjs +140 -0
- package/node_modules/zod/v4/locales/uz.d.cts +5 -0
- package/node_modules/zod/v4/locales/uz.d.ts +4 -0
- package/node_modules/zod/v4/locales/uz.js +113 -0
- package/node_modules/zod/v4/locales/vi.cjs +22 -24
- package/node_modules/zod/v4/locales/vi.d.cts +2 -1
- package/node_modules/zod/v4/locales/vi.js +21 -24
- package/node_modules/zod/v4/locales/yo.cjs +139 -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 +112 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +23 -24
- package/node_modules/zod/v4/locales/zh-CN.d.cts +2 -1
- package/node_modules/zod/v4/locales/zh-CN.js +22 -24
- package/node_modules/zod/v4/locales/zh-TW.cjs +20 -24
- package/node_modules/zod/v4/locales/zh-TW.d.cts +2 -1
- package/node_modules/zod/v4/locales/zh-TW.js +19 -24
- package/node_modules/zod/v4/mini/checks.cjs +21 -1
- package/node_modules/zod/v4/mini/checks.d.cts +1 -1
- package/node_modules/zod/v4/mini/checks.d.ts +1 -1
- package/node_modules/zod/v4/mini/checks.js +1 -1
- package/node_modules/zod/v4/mini/coerce.cjs +24 -0
- package/node_modules/zod/v4/mini/coerce.js +5 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.js +13 -0
- package/node_modules/zod/v4/mini/external.cjs +36 -3
- package/node_modules/zod/v4/mini/external.d.cts +7 -2
- package/node_modules/zod/v4/mini/external.d.ts +7 -2
- package/node_modules/zod/v4/mini/external.js +4 -1
- package/node_modules/zod/v4/mini/in-out.cjs +82 -0
- package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
- package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
- package/node_modules/zod/v4/mini/in-out.js +36 -0
- package/node_modules/zod/v4/mini/index.cjs +19 -0
- package/node_modules/zod/v4/mini/iso.cjs +27 -4
- package/node_modules/zod/v4/mini/iso.js +8 -4
- package/node_modules/zod/v4/mini/package.json +7 -0
- package/node_modules/zod/v4/mini/parse.cjs +30 -1
- package/node_modules/zod/v4/mini/parse.d.cts +1 -1
- package/node_modules/zod/v4/mini/parse.d.ts +1 -1
- package/node_modules/zod/v4/mini/parse.js +1 -1
- package/node_modules/zod/v4/mini/schemas.cjs +390 -82
- package/node_modules/zod/v4/mini/schemas.d.cts +156 -32
- package/node_modules/zod/v4/mini/schemas.d.ts +156 -32
- package/node_modules/zod/v4/mini/schemas.js +329 -59
- package/node_modules/zod/v4/package.json +7 -0
- package/node_modules/zod/v4-mini/index.cjs +35 -1
- package/node_modules/zod/v4-mini/index.d.cts +3 -1
- package/node_modules/zod/v4-mini/index.d.ts +3 -1
- package/node_modules/zod/v4-mini/index.js +3 -1
- package/node_modules/zod/v4-mini/package.json +7 -0
- package/package.json +6 -3
- package/node_modules/zod/src/v4/core/config.ts +0 -15
- package/node_modules/zod/src/v4/core/function.ts +0 -176
- package/node_modules/zod/v4/core/function.cjs +0 -102
- package/node_modules/zod/v4/core/function.d.cts +0 -52
- package/node_modules/zod/v4/core/function.d.ts +0 -52
- package/node_modules/zod/v4/core/function.js +0 -75
|
@@ -1,10 +1,27 @@
|
|
|
1
|
+
import type { $ZodBigIntFormats } from "../core/checks.js";
|
|
1
2
|
import * as core from "../core/index.js";
|
|
2
|
-
import { util } from "../core/index.js";
|
|
3
|
+
import { util, type $ZodNumberFormats } from "../core/index.js";
|
|
4
|
+
import * as processors from "../core/json-schema-processors.js";
|
|
5
|
+
import * as regexes from "../core/regexes.js";
|
|
6
|
+
import type { StandardSchemaWithJSONProps } from "../core/standard-schema.js";
|
|
7
|
+
import { createStandardJSONSchemaMethod, createToJSONSchemaMethod } from "../core/to-json-schema.js";
|
|
8
|
+
import en from "../locales/en.js";
|
|
3
9
|
|
|
4
10
|
import * as checks from "./checks.js";
|
|
5
|
-
import * as iso from "./iso.js";
|
|
6
11
|
import * as parse from "./parse.js";
|
|
7
12
|
|
|
13
|
+
// Register English as the default locale on first ZodType construction. Hooked into the `ZodType` `$constructor` (rather than a top-level `config(en())` in `external.ts`) so bundlers honoring `sideEffects: false` can't tree-shake it out — see #5953, #5725. An explicit `z.config(z.locales.xx())` call wins regardless of order, since this only sets the default when none is present.
|
|
14
|
+
function _ensureDefaultLocale(): void {
|
|
15
|
+
if (!core.globalConfig.localeError) core.config(en());
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// the default memoizer is read by the core container init, which runs before `ZodType.init`, so each container calls this first
|
|
19
|
+
function _ensureDefaultMemoizer(): void {
|
|
20
|
+
if (!core.globalConfig.memoizer) core.config({ memoizer: core.memoizer() });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Methods live on each concrete constructor's prototype and materialize per instance on first access, so a schema only pays for what it is asked for.
|
|
24
|
+
|
|
8
25
|
///////////////////////////////////////////
|
|
9
26
|
///////////////////////////////////////////
|
|
10
27
|
//////////// ////////////
|
|
@@ -13,10 +30,7 @@ import * as parse from "./parse.js";
|
|
|
13
30
|
///////////////////////////////////////////
|
|
14
31
|
///////////////////////////////////////////
|
|
15
32
|
|
|
16
|
-
export
|
|
17
|
-
addIssue(arg: string | core.$ZodRawIssue | Partial<core.$ZodIssueCustom>): void;
|
|
18
|
-
}
|
|
19
|
-
|
|
33
|
+
export type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<core.input<T>, core.output<T>>;
|
|
20
34
|
export interface ZodType<
|
|
21
35
|
out Output = unknown,
|
|
22
36
|
out Input = unknown,
|
|
@@ -32,8 +46,13 @@ export interface ZodType<
|
|
|
32
46
|
/** @deprecated Use `z.input<typeof schema>` instead. */
|
|
33
47
|
_input: Internals["input"];
|
|
34
48
|
|
|
49
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
50
|
+
/** Converts this schema to a JSON Schema representation. */
|
|
51
|
+
toJSONSchema(params?: core.ToJSONSchemaParams): core.ZodStandardJSONSchemaPayload<this>;
|
|
52
|
+
|
|
35
53
|
// base methods
|
|
36
54
|
check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
|
|
55
|
+
with(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
|
|
37
56
|
clone(def?: Internals["def"], params?: { parent: boolean }): this;
|
|
38
57
|
register<R extends core.$ZodRegistry>(
|
|
39
58
|
registry: R,
|
|
@@ -44,7 +63,9 @@ export interface ZodType<
|
|
|
44
63
|
: ["Incompatible schema"]
|
|
45
64
|
): this;
|
|
46
65
|
|
|
47
|
-
brand<T extends PropertyKey = PropertyKey
|
|
66
|
+
brand<T extends PropertyKey = PropertyKey, Dir extends "in" | "out" | "inout" = "out">(
|
|
67
|
+
value?: T
|
|
68
|
+
): PropertyKey extends T ? this : core.$ZodBranded<this, T, Dir>;
|
|
48
69
|
|
|
49
70
|
// parsing
|
|
50
71
|
parse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
|
|
@@ -58,21 +79,49 @@ export interface ZodType<
|
|
|
58
79
|
data: unknown,
|
|
59
80
|
params?: core.ParseContext<core.$ZodIssue>
|
|
60
81
|
) => Promise<parse.ZodSafeParseResult<core.output<this>>>;
|
|
82
|
+
validate(data: unknown, params?: core.ParseContext<core.$ZodIssue>): data is core.input<this>;
|
|
83
|
+
validateAsync(data: unknown, params?: core.ParseContext<core.$ZodIssue>): Promise<boolean>;
|
|
84
|
+
|
|
85
|
+
// encoding/decoding
|
|
86
|
+
encode(data: core.output<this>, params?: core.ParseContext<core.$ZodIssue>): core.input<this>;
|
|
87
|
+
decode(data: core.input<this>, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
|
|
88
|
+
encodeAsync(data: core.output<this>, params?: core.ParseContext<core.$ZodIssue>): Promise<core.input<this>>;
|
|
89
|
+
decodeAsync(data: core.input<this>, params?: core.ParseContext<core.$ZodIssue>): Promise<core.output<this>>;
|
|
90
|
+
safeEncode(
|
|
91
|
+
data: core.output<this>,
|
|
92
|
+
params?: core.ParseContext<core.$ZodIssue>
|
|
93
|
+
): parse.ZodSafeParseResult<core.input<this>>;
|
|
94
|
+
safeDecode(
|
|
95
|
+
data: core.input<this>,
|
|
96
|
+
params?: core.ParseContext<core.$ZodIssue>
|
|
97
|
+
): parse.ZodSafeParseResult<core.output<this>>;
|
|
98
|
+
safeEncodeAsync(
|
|
99
|
+
data: core.output<this>,
|
|
100
|
+
params?: core.ParseContext<core.$ZodIssue>
|
|
101
|
+
): Promise<parse.ZodSafeParseResult<core.input<this>>>;
|
|
102
|
+
safeDecodeAsync(
|
|
103
|
+
data: core.input<this>,
|
|
104
|
+
params?: core.ParseContext<core.$ZodIssue>
|
|
105
|
+
): Promise<parse.ZodSafeParseResult<core.output<this>>>;
|
|
61
106
|
|
|
62
107
|
// refinements
|
|
63
|
-
refine
|
|
64
|
-
|
|
108
|
+
refine<Ch extends (arg: core.output<this>) => unknown | Promise<unknown>>(
|
|
109
|
+
check: Ch,
|
|
110
|
+
params?: string | core.$ZodCustomParams
|
|
111
|
+
): Ch extends (arg: any) => arg is infer R ? this & ZodType<R, core.input<this>> : this;
|
|
65
112
|
superRefine(
|
|
66
|
-
refinement: (arg: core.output<this>, ctx: RefinementCtx<core.output<this>>) => void | Promise<void
|
|
113
|
+
refinement: (arg: core.output<this>, ctx: core.$RefinementCtx<core.output<this>>) => void | Promise<void>,
|
|
114
|
+
params?: core.$ZodSuperRefineParams
|
|
67
115
|
): this;
|
|
68
116
|
overwrite(fn: (x: core.output<this>) => core.output<this>): this;
|
|
69
117
|
|
|
70
118
|
// wrappers
|
|
71
119
|
optional(): ZodOptional<this>;
|
|
120
|
+
exactOptional(): ZodExactOptional<this>;
|
|
72
121
|
nonoptional(params?: string | core.$ZodNonOptionalParams): ZodNonOptional<this>;
|
|
73
122
|
nullable(): ZodNullable<this>;
|
|
74
123
|
nullish(): ZodOptional<ZodNullable<this>>;
|
|
75
|
-
default(def: core.output<this
|
|
124
|
+
default(def: util.NoUndefined<core.output<this>>): ZodDefault<this>;
|
|
76
125
|
default(def: () => util.NoUndefined<core.output<this>>): ZodDefault<this>;
|
|
77
126
|
prefault(def: () => core.input<this>): ZodPrefault<this>;
|
|
78
127
|
prefault(def: core.input<this>): ZodPrefault<this>;
|
|
@@ -80,7 +129,7 @@ export interface ZodType<
|
|
|
80
129
|
or<T extends core.SomeType>(option: T): ZodUnion<[this, T]>;
|
|
81
130
|
and<T extends core.SomeType>(incoming: T): ZodIntersection<this, T>;
|
|
82
131
|
transform<NewOut>(
|
|
83
|
-
transform: (arg: core.output<this>, ctx: RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>
|
|
132
|
+
transform: (arg: core.output<this>, ctx: core.$RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>
|
|
84
133
|
): ZodPipe<this, ZodTransform<Awaited<NewOut>, core.output<this>>>;
|
|
85
134
|
catch(def: core.output<this>): ZodCatch<this>;
|
|
86
135
|
catch(def: (ctx: core.$ZodCatchCtx) => core.output<this>): ZodCatch<this>;
|
|
@@ -115,92 +164,198 @@ export interface ZodType<
|
|
|
115
164
|
* ```
|
|
116
165
|
*/
|
|
117
166
|
isNullable(): boolean;
|
|
167
|
+
apply<T, TArgs extends unknown[] = []>(fn: (schema: this, ...args: TArgs) => T, ...args: TArgs): T;
|
|
118
168
|
}
|
|
119
169
|
|
|
120
170
|
export interface _ZodType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals>
|
|
121
171
|
extends ZodType<any, any, Internals> {}
|
|
122
172
|
|
|
123
|
-
export const ZodType: core.$constructor<ZodType> = /*@__PURE__*/ core.$constructor
|
|
124
|
-
|
|
125
|
-
inst
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
// base methods
|
|
129
|
-
inst.check = (...checks) => {
|
|
130
|
-
return inst.clone(
|
|
131
|
-
{
|
|
132
|
-
...def,
|
|
133
|
-
checks: [
|
|
134
|
-
...(def.checks ?? []),
|
|
135
|
-
...checks.map((ch) =>
|
|
136
|
-
typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch
|
|
137
|
-
),
|
|
138
|
-
],
|
|
139
|
-
}
|
|
140
|
-
// { parent: true }
|
|
141
|
-
);
|
|
142
|
-
};
|
|
143
|
-
inst.clone = (def, params) => core.clone(inst, def, params);
|
|
144
|
-
inst.brand = () => inst as any;
|
|
145
|
-
inst.register = ((reg: any, meta: any) => {
|
|
146
|
-
reg.add(inst, meta);
|
|
147
|
-
return inst;
|
|
148
|
-
}) as any;
|
|
149
|
-
|
|
150
|
-
// parsing
|
|
151
|
-
inst.parse = (data, params) => parse.parse(inst, data, params, { callee: inst.parse });
|
|
152
|
-
inst.safeParse = (data, params) => parse.safeParse(inst, data, params);
|
|
153
|
-
inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
154
|
-
inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params);
|
|
155
|
-
inst.spa = inst.safeParseAsync;
|
|
173
|
+
export const ZodType: core.$constructor<ZodType> = /*@__PURE__*/ core.$constructor<ZodType>(
|
|
174
|
+
"ZodType",
|
|
175
|
+
(inst, def) => {
|
|
176
|
+
_ensureDefaultLocale();
|
|
177
|
+
core.$ZodType.init(inst, def);
|
|
156
178
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
160
|
-
inst.overwrite = (fn) => inst.check(checks.overwrite(fn));
|
|
179
|
+
inst.def = def;
|
|
180
|
+
inst.type = def.type;
|
|
161
181
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
// meta
|
|
179
|
-
inst.describe = (description) => {
|
|
180
|
-
const cl = inst.clone();
|
|
181
|
-
core.globalRegistry.add(cl, { description });
|
|
182
|
-
return cl;
|
|
183
|
-
};
|
|
184
|
-
Object.defineProperty(inst, "description", {
|
|
185
|
-
get() {
|
|
186
|
-
return core.globalRegistry.get(inst)?.description;
|
|
182
|
+
return inst;
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
check(...chks) {
|
|
186
|
+
const def = this.def;
|
|
187
|
+
return this.clone(
|
|
188
|
+
util.mergeDefs(def, {
|
|
189
|
+
checks: [
|
|
190
|
+
...(def.checks ?? []),
|
|
191
|
+
...chks.map((ch) =>
|
|
192
|
+
typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch
|
|
193
|
+
),
|
|
194
|
+
],
|
|
195
|
+
}),
|
|
196
|
+
{ parent: true }
|
|
197
|
+
);
|
|
187
198
|
},
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return core.
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
199
|
+
with(...chks) {
|
|
200
|
+
return this.check(...chks);
|
|
201
|
+
},
|
|
202
|
+
clone(def, params) {
|
|
203
|
+
return core.clone(this, def, params);
|
|
204
|
+
},
|
|
205
|
+
brand() {
|
|
206
|
+
return this;
|
|
207
|
+
},
|
|
208
|
+
register(reg, meta) {
|
|
209
|
+
reg.add(this, meta);
|
|
210
|
+
return this;
|
|
211
|
+
},
|
|
212
|
+
refine(check, params) {
|
|
213
|
+
return this.check(refine(check, params));
|
|
214
|
+
},
|
|
215
|
+
superRefine(refinement, params) {
|
|
216
|
+
return this.check(superRefine(refinement, params));
|
|
217
|
+
},
|
|
218
|
+
overwrite(fn) {
|
|
219
|
+
return this.check(checks.overwrite(fn));
|
|
220
|
+
},
|
|
221
|
+
optional() {
|
|
222
|
+
return optional(this);
|
|
223
|
+
},
|
|
224
|
+
exactOptional() {
|
|
225
|
+
return exactOptional(this);
|
|
226
|
+
},
|
|
227
|
+
nullable() {
|
|
228
|
+
return nullable(this);
|
|
229
|
+
},
|
|
230
|
+
nullish() {
|
|
231
|
+
return optional(nullable(this));
|
|
232
|
+
},
|
|
233
|
+
nonoptional(params) {
|
|
234
|
+
return nonoptional(this, params);
|
|
235
|
+
},
|
|
236
|
+
array() {
|
|
237
|
+
return array(this);
|
|
238
|
+
},
|
|
239
|
+
or(arg) {
|
|
240
|
+
return union([this, arg]);
|
|
241
|
+
},
|
|
242
|
+
and(arg) {
|
|
243
|
+
return intersection(this, arg);
|
|
244
|
+
},
|
|
245
|
+
transform(tx) {
|
|
246
|
+
return pipe(this, transform(tx));
|
|
247
|
+
},
|
|
248
|
+
default(d) {
|
|
249
|
+
return _default(this, d);
|
|
250
|
+
},
|
|
251
|
+
prefault(d) {
|
|
252
|
+
return prefault(this, d);
|
|
253
|
+
},
|
|
254
|
+
catch(params) {
|
|
255
|
+
return _catch(this, params);
|
|
256
|
+
},
|
|
257
|
+
pipe(target) {
|
|
258
|
+
return pipe(this, target);
|
|
259
|
+
},
|
|
260
|
+
readonly() {
|
|
261
|
+
return readonly(this);
|
|
262
|
+
},
|
|
263
|
+
describe(description) {
|
|
264
|
+
const cl = this.clone();
|
|
265
|
+
core.globalRegistry.add(cl, { description });
|
|
266
|
+
return cl;
|
|
267
|
+
},
|
|
268
|
+
meta(...args: any[]): any {
|
|
269
|
+
// overloaded: meta() returns the registered metadata, meta(data) returns a clone with `data` registered. The mapped type picks up the second overload, so we accept variadic any-args and return `any` to satisfy both at runtime.
|
|
270
|
+
if (args.length === 0) return core.globalRegistry.get(this);
|
|
271
|
+
const cl = this.clone();
|
|
272
|
+
core.globalRegistry.add(cl, args[0]);
|
|
273
|
+
return cl;
|
|
274
|
+
},
|
|
275
|
+
isOptional() {
|
|
276
|
+
return this.safeParse(undefined).success;
|
|
277
|
+
},
|
|
278
|
+
isNullable() {
|
|
279
|
+
return this.safeParse(null).success;
|
|
280
|
+
},
|
|
281
|
+
apply(fn, ...args) {
|
|
282
|
+
return args.length === 0 ? fn(this) : fn(this, ...args);
|
|
283
|
+
},
|
|
284
|
+
// Overrides core's `~standard` to add `jsonSchema`. Must stay a prototype entry: redefining it per instance demotes instances to dictionary mode.
|
|
285
|
+
get "~standard"(): ZodType["~standard"] {
|
|
286
|
+
return util.hide(this, "~standard", {
|
|
287
|
+
...core.standardProps(this),
|
|
288
|
+
jsonSchema: {
|
|
289
|
+
input: createStandardJSONSchemaMethod(this, "input"),
|
|
290
|
+
output: createStandardJSONSchemaMethod(this, "output"),
|
|
291
|
+
},
|
|
292
|
+
} as ZodType["~standard"]);
|
|
293
|
+
},
|
|
294
|
+
set "~standard"(value: ZodType["~standard"]) {
|
|
295
|
+
util.own(this, "~standard", value);
|
|
296
|
+
},
|
|
297
|
+
parse: function _parse(data, params) {
|
|
298
|
+
return parse.parse(this, data, params, { callee: _parse });
|
|
299
|
+
},
|
|
300
|
+
parseAsync: async function _parseAsync(data, params) {
|
|
301
|
+
return await parse.parseAsync(this, data, params, { callee: _parseAsync });
|
|
302
|
+
},
|
|
303
|
+
safeParse(data, params) {
|
|
304
|
+
return parse.safeParse(this, data, params);
|
|
305
|
+
},
|
|
306
|
+
async safeParseAsync(data, params) {
|
|
307
|
+
return parse.safeParseAsync(this, data, params);
|
|
308
|
+
},
|
|
309
|
+
// `spa` is an alias: same function object as `safeParseAsync`, as before.
|
|
310
|
+
get spa(): ZodType["safeParseAsync"] {
|
|
311
|
+
return this?.safeParseAsync;
|
|
312
|
+
},
|
|
313
|
+
set spa(value: ZodType["safeParseAsync"]) {
|
|
314
|
+
util.own(this, "spa", value);
|
|
315
|
+
},
|
|
316
|
+
validate(data, params) {
|
|
317
|
+
return parse.validate(this, data, params);
|
|
318
|
+
},
|
|
319
|
+
validateAsync(data, params) {
|
|
320
|
+
return parse.validateAsync(this, data, params);
|
|
321
|
+
},
|
|
322
|
+
encode: function _encode(data, params) {
|
|
323
|
+
return parse.encode(this, data, params, { callee: _encode });
|
|
324
|
+
},
|
|
325
|
+
decode: function _decode(data, params) {
|
|
326
|
+
return parse.decode(this, data, params, { callee: _decode });
|
|
327
|
+
},
|
|
328
|
+
encodeAsync: async function _encodeAsync(data, params) {
|
|
329
|
+
return await parse.encodeAsync(this, data, params, { callee: _encodeAsync });
|
|
330
|
+
},
|
|
331
|
+
decodeAsync: async function _decodeAsync(data, params) {
|
|
332
|
+
return await parse.decodeAsync(this, data, params, { callee: _decodeAsync });
|
|
333
|
+
},
|
|
334
|
+
safeEncode(data, params) {
|
|
335
|
+
return parse.safeEncode(this, data, params);
|
|
336
|
+
},
|
|
337
|
+
safeDecode(data, params) {
|
|
338
|
+
return parse.safeDecode(this, data, params);
|
|
339
|
+
},
|
|
340
|
+
async safeEncodeAsync(data, params) {
|
|
341
|
+
return parse.safeEncodeAsync(this, data, params);
|
|
342
|
+
},
|
|
343
|
+
async safeDecodeAsync(data, params) {
|
|
344
|
+
return parse.safeDecodeAsync(this, data, params);
|
|
345
|
+
},
|
|
346
|
+
toJSONSchema(params) {
|
|
347
|
+
return createToJSONSchemaMethod(this, {})(params);
|
|
348
|
+
},
|
|
349
|
+
// Reads through to the registry on every access, so it must not cache.
|
|
350
|
+
get description(): string | undefined {
|
|
351
|
+
return core.globalRegistry.get(this as unknown as ZodType)?.description;
|
|
352
|
+
},
|
|
353
|
+
// No setter: `schema._def = x` throws, as it did when `_def` was a non-writable own property.
|
|
354
|
+
get _def(): core.$ZodTypeDef {
|
|
355
|
+
return (this as unknown as ZodType)._zod.def;
|
|
356
|
+
},
|
|
357
|
+
}
|
|
358
|
+
);
|
|
204
359
|
|
|
205
360
|
// ZodString
|
|
206
361
|
export interface _ZodString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>>
|
|
@@ -211,7 +366,7 @@ export interface _ZodString<T extends core.$ZodStringInternals<unknown> = core.$
|
|
|
211
366
|
|
|
212
367
|
// miscellaneous checks
|
|
213
368
|
regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
|
|
214
|
-
includes(value: string, params?: core.$ZodCheckIncludesParams): this;
|
|
369
|
+
includes(value: string, params?: string | core.$ZodCheckIncludesParams): this;
|
|
215
370
|
startsWith(value: string, params?: string | core.$ZodCheckStartsWithParams): this;
|
|
216
371
|
endsWith(value: string, params?: string | core.$ZodCheckEndsWithParams): this;
|
|
217
372
|
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
@@ -226,36 +381,73 @@ export interface _ZodString<T extends core.$ZodStringInternals<unknown> = core.$
|
|
|
226
381
|
normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})): this;
|
|
227
382
|
toLowerCase(): this;
|
|
228
383
|
toUpperCase(): this;
|
|
384
|
+
slugify(): this;
|
|
229
385
|
}
|
|
230
386
|
|
|
231
387
|
/** @internal */
|
|
232
|
-
export const _ZodString: core.$constructor<_ZodString> = /*@__PURE__*/ core.$constructor
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
inst.format = bag.format ?? null;
|
|
238
|
-
inst.minLength = bag.minimum ?? null;
|
|
239
|
-
inst.maxLength = bag.maximum ?? null;
|
|
240
|
-
|
|
241
|
-
// validations
|
|
242
|
-
inst.regex = (...args) => inst.check(checks.regex(...args));
|
|
243
|
-
inst.includes = (...args) => inst.check(checks.includes(...args));
|
|
244
|
-
inst.startsWith = (...args) => inst.check(checks.startsWith(...args));
|
|
245
|
-
inst.endsWith = (...args) => inst.check(checks.endsWith(...args));
|
|
246
|
-
inst.min = (...args) => inst.check(checks.minLength(...args));
|
|
247
|
-
inst.max = (...args) => inst.check(checks.maxLength(...args));
|
|
248
|
-
inst.length = (...args) => inst.check(checks.length(...args));
|
|
249
|
-
inst.nonempty = (...args) => inst.check(checks.minLength(1, ...args));
|
|
250
|
-
inst.lowercase = (params) => inst.check(checks.lowercase(params));
|
|
251
|
-
inst.uppercase = (params) => inst.check(checks.uppercase(params));
|
|
388
|
+
export const _ZodString: core.$constructor<_ZodString> = /*@__PURE__*/ core.$constructor<_ZodString>(
|
|
389
|
+
"_ZodString",
|
|
390
|
+
(inst, def) => {
|
|
391
|
+
core.$ZodString.init(inst, def);
|
|
392
|
+
ZodType.init(inst, def);
|
|
252
393
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
394
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.stringProcessor(inst, ctx, json, params);
|
|
395
|
+
},
|
|
396
|
+
/*@__PURE__*/ util.derived<_ZodString>(
|
|
397
|
+
{
|
|
398
|
+
format: (inst) => processors.aggregateChecks(inst).format ?? null,
|
|
399
|
+
minLength: (inst) => processors.aggregateChecks<number>(inst).minimum ?? null,
|
|
400
|
+
maxLength: (inst) => processors.aggregateChecks<number>(inst).maximum ?? null,
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
regex(...args) {
|
|
404
|
+
return this.check((checks.regex as any)(...args));
|
|
405
|
+
},
|
|
406
|
+
includes(...args) {
|
|
407
|
+
return this.check((checks.includes as any)(...args));
|
|
408
|
+
},
|
|
409
|
+
startsWith(...args) {
|
|
410
|
+
return this.check((checks.startsWith as any)(...args));
|
|
411
|
+
},
|
|
412
|
+
endsWith(...args) {
|
|
413
|
+
return this.check((checks.endsWith as any)(...args));
|
|
414
|
+
},
|
|
415
|
+
min(...args) {
|
|
416
|
+
return this.check((checks.minLength as any)(...args));
|
|
417
|
+
},
|
|
418
|
+
max(...args) {
|
|
419
|
+
return this.check((checks.maxLength as any)(...args));
|
|
420
|
+
},
|
|
421
|
+
length(...args) {
|
|
422
|
+
return this.check((checks.length as any)(...args));
|
|
423
|
+
},
|
|
424
|
+
nonempty(...args) {
|
|
425
|
+
return this.check((checks.minLength as any)(1, ...args));
|
|
426
|
+
},
|
|
427
|
+
lowercase(params) {
|
|
428
|
+
return this.check(checks.lowercase(params));
|
|
429
|
+
},
|
|
430
|
+
uppercase(params) {
|
|
431
|
+
return this.check(checks.uppercase(params));
|
|
432
|
+
},
|
|
433
|
+
trim() {
|
|
434
|
+
return this.check(checks.trim());
|
|
435
|
+
},
|
|
436
|
+
normalize(...args) {
|
|
437
|
+
return this.check(checks.normalize(...args));
|
|
438
|
+
},
|
|
439
|
+
toLowerCase() {
|
|
440
|
+
return this.check(checks.toLowerCase());
|
|
441
|
+
},
|
|
442
|
+
toUpperCase() {
|
|
443
|
+
return this.check(checks.toUpperCase());
|
|
444
|
+
},
|
|
445
|
+
slugify() {
|
|
446
|
+
return this.check(checks.slugify());
|
|
447
|
+
},
|
|
448
|
+
}
|
|
449
|
+
)
|
|
450
|
+
);
|
|
259
451
|
|
|
260
452
|
export interface ZodString extends _ZodString<core.$ZodStringInternals<string>> {
|
|
261
453
|
// string format checks
|
|
@@ -282,7 +474,11 @@ export interface ZodString extends _ZodString<core.$ZodStringInternals<string>>
|
|
|
282
474
|
nanoid(params?: string | core.$ZodCheckNanoIDParams): this;
|
|
283
475
|
/** @deprecated Use `z.guid()` instead. */
|
|
284
476
|
guid(params?: string | core.$ZodCheckGUIDParams): this;
|
|
285
|
-
/**
|
|
477
|
+
/**
|
|
478
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
479
|
+
* (timestamps embedded in the id). Use `z.cuid2()` instead.
|
|
480
|
+
* See https://github.com/paralleldrive/cuid.
|
|
481
|
+
*/
|
|
286
482
|
cuid(params?: string | core.$ZodCheckCUIDParams): this;
|
|
287
483
|
/** @deprecated Use `z.cuid2()` instead. */
|
|
288
484
|
cuid2(params?: string | core.$ZodCheckCUID2Params): this;
|
|
@@ -330,45 +526,98 @@ export interface ZodString extends _ZodString<core.$ZodStringInternals<string>>
|
|
|
330
526
|
duration(params?: string | core.$ZodCheckISODurationParams): this;
|
|
331
527
|
}
|
|
332
528
|
|
|
333
|
-
export const ZodString: core.$constructor<ZodString> = /*@__PURE__*/ core.$constructor
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
529
|
+
export const ZodString: core.$constructor<ZodString> = /*@__PURE__*/ core.$constructor<ZodString>(
|
|
530
|
+
"ZodString",
|
|
531
|
+
(inst, def) => {
|
|
532
|
+
core.$ZodString.init(inst, def);
|
|
533
|
+
_ZodString.init(inst, def);
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
email(params) {
|
|
537
|
+
return this.check(core._email(ZodEmail, params));
|
|
538
|
+
},
|
|
539
|
+
url(params) {
|
|
540
|
+
return this.check(core._url(ZodURL, params));
|
|
541
|
+
},
|
|
542
|
+
jwt(params) {
|
|
543
|
+
return this.check(core._jwt(ZodJWT, params));
|
|
544
|
+
},
|
|
545
|
+
emoji(params) {
|
|
546
|
+
return this.check(core._emoji(ZodEmoji, params));
|
|
547
|
+
},
|
|
548
|
+
guid(params) {
|
|
549
|
+
return this.check(core._guid(ZodGUID, params));
|
|
550
|
+
},
|
|
551
|
+
uuid(params) {
|
|
552
|
+
return this.check(core._uuid(ZodUUID, params));
|
|
553
|
+
},
|
|
554
|
+
uuidv4(params) {
|
|
555
|
+
return this.check(core._uuidv4(ZodUUID, params));
|
|
556
|
+
},
|
|
557
|
+
uuidv6(params) {
|
|
558
|
+
return this.check(core._uuidv6(ZodUUID, params));
|
|
559
|
+
},
|
|
560
|
+
uuidv7(params) {
|
|
561
|
+
return this.check(core._uuidv7(ZodUUID, params));
|
|
562
|
+
},
|
|
563
|
+
nanoid(params) {
|
|
564
|
+
return this.check(core._nanoid(ZodNanoID, params));
|
|
565
|
+
},
|
|
566
|
+
cuid(params) {
|
|
567
|
+
return this.check(core._cuid(ZodCUID, params));
|
|
568
|
+
},
|
|
569
|
+
cuid2(params) {
|
|
570
|
+
return this.check(core._cuid2(ZodCUID2, params));
|
|
571
|
+
},
|
|
572
|
+
ulid(params) {
|
|
573
|
+
return this.check(core._ulid(ZodULID, params));
|
|
574
|
+
},
|
|
575
|
+
base64(params) {
|
|
576
|
+
return this.check(core._base64(ZodBase64, params));
|
|
577
|
+
},
|
|
578
|
+
base64url(params) {
|
|
579
|
+
return this.check(core._base64url(ZodBase64URL, params));
|
|
580
|
+
},
|
|
581
|
+
xid(params) {
|
|
582
|
+
return this.check(core._xid(ZodXID, params));
|
|
583
|
+
},
|
|
584
|
+
ksuid(params) {
|
|
585
|
+
return this.check(core._ksuid(ZodKSUID, params));
|
|
586
|
+
},
|
|
587
|
+
ipv4(params) {
|
|
588
|
+
return this.check(core._ipv4(ZodIPv4, params));
|
|
589
|
+
},
|
|
590
|
+
ipv6(params) {
|
|
591
|
+
return this.check(core._ipv6(ZodIPv6, params));
|
|
592
|
+
},
|
|
593
|
+
cidrv4(params) {
|
|
594
|
+
return this.check(core._cidrv4(ZodCIDRv4, params));
|
|
595
|
+
},
|
|
596
|
+
cidrv6(params) {
|
|
597
|
+
return this.check(core._cidrv6(ZodCIDRv6, params));
|
|
598
|
+
},
|
|
599
|
+
e164(params) {
|
|
600
|
+
return this.check(core._e164(ZodE164, params));
|
|
601
|
+
},
|
|
602
|
+
datetime(params) {
|
|
603
|
+
return this.check(core._isoDateTime(ZodISODateTime, params as any));
|
|
604
|
+
},
|
|
605
|
+
date(params) {
|
|
606
|
+
return this.check(core._isoDate(ZodISODate, params as any));
|
|
607
|
+
},
|
|
608
|
+
time(params) {
|
|
609
|
+
return this.check(core._isoTime(ZodISOTime, params as any));
|
|
610
|
+
},
|
|
611
|
+
duration(params) {
|
|
612
|
+
return this.check(core._isoDuration(ZodISODuration, params as any));
|
|
613
|
+
},
|
|
614
|
+
}
|
|
615
|
+
);
|
|
367
616
|
|
|
368
617
|
export function string(params?: string | core.$ZodStringParams): ZodString;
|
|
369
618
|
export function string<T extends string>(params?: string | core.$ZodStringParams): core.$ZodType<T, T>;
|
|
370
619
|
export function string(params?: string | core.$ZodStringParams): ZodString {
|
|
371
|
-
return core._string(ZodString, params)
|
|
620
|
+
return core._string(ZodString, params);
|
|
372
621
|
}
|
|
373
622
|
|
|
374
623
|
// ZodStringFormat
|
|
@@ -382,6 +631,72 @@ export const ZodStringFormat: core.$constructor<ZodStringFormat> = /*@__PURE__*/
|
|
|
382
631
|
}
|
|
383
632
|
);
|
|
384
633
|
|
|
634
|
+
//////////////////////////////////////////////
|
|
635
|
+
//////////////////////////////////////////////
|
|
636
|
+
////////// //////////
|
|
637
|
+
////////// ZodISODateTime //////////
|
|
638
|
+
////////// //////////
|
|
639
|
+
//////////////////////////////////////////////
|
|
640
|
+
//////////////////////////////////////////////
|
|
641
|
+
export interface ZodISODateTime extends ZodStringFormat {
|
|
642
|
+
_zod: core.$ZodISODateTimeInternals;
|
|
643
|
+
}
|
|
644
|
+
export const ZodISODateTime: core.$constructor<ZodISODateTime> = /*@__PURE__*/ core.$constructor(
|
|
645
|
+
"ZodISODateTime",
|
|
646
|
+
(inst, def) => {
|
|
647
|
+
core.$ZodISODateTime.init(inst, def);
|
|
648
|
+
ZodStringFormat.init(inst, def);
|
|
649
|
+
}
|
|
650
|
+
);
|
|
651
|
+
|
|
652
|
+
//////////////////////////////////////////
|
|
653
|
+
//////////////////////////////////////////
|
|
654
|
+
////////// //////////
|
|
655
|
+
////////// ZodISODate //////////
|
|
656
|
+
////////// //////////
|
|
657
|
+
//////////////////////////////////////////
|
|
658
|
+
//////////////////////////////////////////
|
|
659
|
+
export interface ZodISODate extends ZodStringFormat {
|
|
660
|
+
_zod: core.$ZodISODateInternals;
|
|
661
|
+
}
|
|
662
|
+
export const ZodISODate: core.$constructor<ZodISODate> = /*@__PURE__*/ core.$constructor("ZodISODate", (inst, def) => {
|
|
663
|
+
core.$ZodISODate.init(inst, def);
|
|
664
|
+
ZodStringFormat.init(inst, def);
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
//////////////////////////////////////////
|
|
668
|
+
//////////////////////////////////////////
|
|
669
|
+
////////// //////////
|
|
670
|
+
////////// ZodISOTime //////////
|
|
671
|
+
////////// //////////
|
|
672
|
+
//////////////////////////////////////////
|
|
673
|
+
//////////////////////////////////////////
|
|
674
|
+
export interface ZodISOTime extends ZodStringFormat {
|
|
675
|
+
_zod: core.$ZodISOTimeInternals;
|
|
676
|
+
}
|
|
677
|
+
export const ZodISOTime: core.$constructor<ZodISOTime> = /*@__PURE__*/ core.$constructor("ZodISOTime", (inst, def) => {
|
|
678
|
+
core.$ZodISOTime.init(inst, def);
|
|
679
|
+
ZodStringFormat.init(inst, def);
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
//////////////////////////////////////////////
|
|
683
|
+
//////////////////////////////////////////////
|
|
684
|
+
////////// //////////
|
|
685
|
+
////////// ZodISODuration //////////
|
|
686
|
+
////////// //////////
|
|
687
|
+
//////////////////////////////////////////////
|
|
688
|
+
//////////////////////////////////////////////
|
|
689
|
+
export interface ZodISODuration extends ZodStringFormat {
|
|
690
|
+
_zod: core.$ZodISODurationInternals;
|
|
691
|
+
}
|
|
692
|
+
export const ZodISODuration: core.$constructor<ZodISODuration> = /*@__PURE__*/ core.$constructor(
|
|
693
|
+
"ZodISODuration",
|
|
694
|
+
(inst, def) => {
|
|
695
|
+
core.$ZodISODuration.init(inst, def);
|
|
696
|
+
ZodStringFormat.init(inst, def);
|
|
697
|
+
}
|
|
698
|
+
);
|
|
699
|
+
|
|
385
700
|
// ZodEmail
|
|
386
701
|
export interface ZodEmail extends ZodStringFormat<"email"> {
|
|
387
702
|
_zod: core.$ZodEmailInternals;
|
|
@@ -454,6 +769,14 @@ export function url(params?: string | core.$ZodURLParams): ZodURL {
|
|
|
454
769
|
return core._url(ZodURL, params);
|
|
455
770
|
}
|
|
456
771
|
|
|
772
|
+
export function httpUrl(params?: string | Omit<core.$ZodURLParams, "protocol" | "hostname">): ZodURL {
|
|
773
|
+
return core._url(ZodURL, {
|
|
774
|
+
protocol: regexes.httpProtocol,
|
|
775
|
+
hostname: regexes.domain,
|
|
776
|
+
...util.normalizeParams(params),
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
|
|
457
780
|
// ZodEmoji
|
|
458
781
|
export interface ZodEmoji extends ZodStringFormat<"emoji"> {
|
|
459
782
|
_zod: core.$ZodEmojiInternals;
|
|
@@ -483,15 +806,32 @@ export function nanoid(params?: string | core.$ZodNanoIDParams): ZodNanoID {
|
|
|
483
806
|
}
|
|
484
807
|
|
|
485
808
|
// ZodCUID
|
|
809
|
+
/**
|
|
810
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
811
|
+
* (timestamps embedded in the id). Use {@link ZodCUID2} instead.
|
|
812
|
+
* See https://github.com/paralleldrive/cuid.
|
|
813
|
+
*/
|
|
486
814
|
export interface ZodCUID extends ZodStringFormat<"cuid"> {
|
|
487
815
|
_zod: core.$ZodCUIDInternals;
|
|
488
816
|
}
|
|
817
|
+
/**
|
|
818
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
819
|
+
* (timestamps embedded in the id). Use {@link ZodCUID2} instead.
|
|
820
|
+
* See https://github.com/paralleldrive/cuid.
|
|
821
|
+
*/
|
|
489
822
|
export const ZodCUID: core.$constructor<ZodCUID> = /*@__PURE__*/ core.$constructor("ZodCUID", (inst, def) => {
|
|
490
823
|
// ZodStringFormat.init(inst, def);
|
|
491
824
|
core.$ZodCUID.init(inst, def);
|
|
492
825
|
ZodStringFormat.init(inst, def);
|
|
493
826
|
});
|
|
494
827
|
|
|
828
|
+
/**
|
|
829
|
+
* Validates a CUID v1 string.
|
|
830
|
+
*
|
|
831
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
832
|
+
* (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.
|
|
833
|
+
* See https://github.com/paralleldrive/cuid.
|
|
834
|
+
*/
|
|
495
835
|
export function cuid(params?: string | core.$ZodCUIDParams): ZodCUID {
|
|
496
836
|
return core._cuid(ZodCUID, params);
|
|
497
837
|
}
|
|
@@ -580,6 +920,19 @@ export function ipv4(params?: string | core.$ZodIPv4Params): ZodIPv4 {
|
|
|
580
920
|
return core._ipv4(ZodIPv4, params);
|
|
581
921
|
}
|
|
582
922
|
|
|
923
|
+
// ZodMAC
|
|
924
|
+
export interface ZodMAC extends ZodStringFormat<"mac"> {
|
|
925
|
+
_zod: core.$ZodMACInternals;
|
|
926
|
+
}
|
|
927
|
+
export const ZodMAC: core.$constructor<ZodMAC> = /*@__PURE__*/ core.$constructor("ZodMAC", (inst, def) => {
|
|
928
|
+
// ZodStringFormat.init(inst, def);
|
|
929
|
+
core.$ZodMAC.init(inst, def);
|
|
930
|
+
ZodStringFormat.init(inst, def);
|
|
931
|
+
});
|
|
932
|
+
export function mac(params?: string | core.$ZodMACParams): ZodMAC {
|
|
933
|
+
return core._mac(ZodMAC, params);
|
|
934
|
+
}
|
|
935
|
+
|
|
583
936
|
// ZodIPv6
|
|
584
937
|
export interface ZodIPv6 extends ZodStringFormat<"ipv6"> {
|
|
585
938
|
_zod: core.$ZodIPv6Internals;
|
|
@@ -662,6 +1015,35 @@ export function e164(params?: string | core.$ZodE164Params): ZodE164 {
|
|
|
662
1015
|
return core._e164(ZodE164, params);
|
|
663
1016
|
}
|
|
664
1017
|
|
|
1018
|
+
// ZodCreditCard
|
|
1019
|
+
export interface ZodCreditCard extends ZodStringFormat<"credit_card"> {
|
|
1020
|
+
_zod: core.$ZodCreditCardInternals;
|
|
1021
|
+
}
|
|
1022
|
+
export const ZodCreditCard: core.$constructor<ZodCreditCard> = /*@__PURE__*/ core.$constructor(
|
|
1023
|
+
"ZodCreditCard",
|
|
1024
|
+
(inst, def) => {
|
|
1025
|
+
core.$ZodCreditCard.init(inst, def);
|
|
1026
|
+
ZodStringFormat.init(inst, def);
|
|
1027
|
+
}
|
|
1028
|
+
);
|
|
1029
|
+
|
|
1030
|
+
export function creditCard(params?: string | core.$ZodCreditCardParams): ZodCreditCard {
|
|
1031
|
+
return core._creditCard(ZodCreditCard, params);
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
// ZodIBAN
|
|
1035
|
+
export interface ZodIBAN extends ZodStringFormat<"iban"> {
|
|
1036
|
+
_zod: core.$ZodIBANInternals;
|
|
1037
|
+
}
|
|
1038
|
+
export const ZodIBAN: core.$constructor<ZodIBAN> = /*@__PURE__*/ core.$constructor("ZodIBAN", (inst, def) => {
|
|
1039
|
+
core.$ZodIBAN.init(inst, def);
|
|
1040
|
+
ZodStringFormat.init(inst, def);
|
|
1041
|
+
});
|
|
1042
|
+
|
|
1043
|
+
export function iban(params?: string | core.$ZodIBANParams): ZodIBAN {
|
|
1044
|
+
return core._iban(ZodIBAN, params);
|
|
1045
|
+
}
|
|
1046
|
+
|
|
665
1047
|
// ZodJWT
|
|
666
1048
|
export interface ZodJWT extends ZodStringFormat<"jwt"> {
|
|
667
1049
|
_zod: core.$ZodJWTInternals;
|
|
@@ -681,6 +1063,7 @@ export interface ZodCustomStringFormat<Format extends string = string>
|
|
|
681
1063
|
extends ZodStringFormat<Format>,
|
|
682
1064
|
core.$ZodCustomStringFormat<Format> {
|
|
683
1065
|
_zod: core.$ZodCustomStringFormatInternals<Format>;
|
|
1066
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
684
1067
|
}
|
|
685
1068
|
export const ZodCustomStringFormat: core.$constructor<ZodCustomStringFormat> = /*@__PURE__*/ core.$constructor(
|
|
686
1069
|
"ZodCustomStringFormat",
|
|
@@ -698,6 +1081,31 @@ export function stringFormat<Format extends string>(
|
|
|
698
1081
|
return core._stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params) as any;
|
|
699
1082
|
}
|
|
700
1083
|
|
|
1084
|
+
export function hostname(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<"hostname"> {
|
|
1085
|
+
return core._stringFormat(ZodCustomStringFormat, "hostname", regexes.hostname, _params) as any;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
export function hex(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<"hex"> {
|
|
1089
|
+
return core._stringFormat(ZodCustomStringFormat, "hex", regexes.hex, _params) as any;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
export function currencyCode(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<"currency_code"> {
|
|
1093
|
+
return core._stringFormat(ZodCustomStringFormat, "currency_code", regexes.currencyCode, _params) as any;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
export function hash<Alg extends util.HashAlgorithm, Enc extends util.HashEncoding = "hex">(
|
|
1097
|
+
alg: Alg,
|
|
1098
|
+
params?: {
|
|
1099
|
+
enc?: Enc;
|
|
1100
|
+
} & core.$ZodStringFormatParams
|
|
1101
|
+
): ZodCustomStringFormat<`${Alg}_${Enc}`> {
|
|
1102
|
+
const enc = params?.enc ?? "hex";
|
|
1103
|
+
const format = `${alg}_${enc}` as const;
|
|
1104
|
+
const regex = core.regexes[format as keyof typeof core.regexes] as RegExp;
|
|
1105
|
+
if (!regex) throw new Error(`Unrecognized hash format: ${format}`);
|
|
1106
|
+
return core._stringFormat(ZodCustomStringFormat, format, regex, params) as any;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
701
1109
|
// ZodNumber
|
|
702
1110
|
export interface _ZodNumber<Internals extends core.$ZodNumberInternals = core.$ZodNumberInternals>
|
|
703
1111
|
extends _ZodType<Internals> {
|
|
@@ -735,45 +1143,89 @@ export interface _ZodNumber<Internals extends core.$ZodNumberInternals = core.$Z
|
|
|
735
1143
|
|
|
736
1144
|
export interface ZodNumber extends _ZodNumber<core.$ZodNumberInternals<number>> {}
|
|
737
1145
|
|
|
738
|
-
export const ZodNumber: core.$constructor<ZodNumber> = /*@__PURE__*/ core.$constructor
|
|
739
|
-
|
|
740
|
-
|
|
1146
|
+
export const ZodNumber: core.$constructor<ZodNumber> = /*@__PURE__*/ core.$constructor<ZodNumber>(
|
|
1147
|
+
"ZodNumber",
|
|
1148
|
+
(inst, def) => {
|
|
1149
|
+
core.$ZodNumber.init(inst, def);
|
|
741
1150
|
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
1151
|
+
ZodType.init(inst, def);
|
|
1152
|
+
|
|
1153
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.numberProcessor(inst, ctx, json, params);
|
|
1154
|
+
inst.isFinite = true;
|
|
1155
|
+
},
|
|
1156
|
+
/*@__PURE__*/ util.derived<ZodNumber>(
|
|
1157
|
+
{
|
|
1158
|
+
minValue: (inst) => {
|
|
1159
|
+
const { minimum, exclusiveMinimum } = processors.aggregateChecks<number>(inst);
|
|
1160
|
+
return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
|
|
1161
|
+
},
|
|
1162
|
+
maxValue: (inst) => {
|
|
1163
|
+
const { maximum, exclusiveMaximum } = processors.aggregateChecks<number>(inst);
|
|
1164
|
+
return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
|
|
1165
|
+
},
|
|
1166
|
+
isInt: (inst) => {
|
|
1167
|
+
const { isInt, multipleOf } = processors.aggregateChecks(inst);
|
|
1168
|
+
return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
|
|
1169
|
+
},
|
|
1170
|
+
format: (inst) => processors.aggregateChecks(inst).format ?? null,
|
|
1171
|
+
},
|
|
1172
|
+
{
|
|
1173
|
+
gt(value, params) {
|
|
1174
|
+
return this.check(checks.gt(value, params));
|
|
1175
|
+
},
|
|
1176
|
+
gte(value, params) {
|
|
1177
|
+
return this.check(checks.gte(value, params));
|
|
1178
|
+
},
|
|
1179
|
+
min(value, params) {
|
|
1180
|
+
return this.check(checks.gte(value, params));
|
|
1181
|
+
},
|
|
1182
|
+
lt(value, params) {
|
|
1183
|
+
return this.check(checks.lt(value, params));
|
|
1184
|
+
},
|
|
1185
|
+
lte(value, params) {
|
|
1186
|
+
return this.check(checks.lte(value, params));
|
|
1187
|
+
},
|
|
1188
|
+
max(value, params) {
|
|
1189
|
+
return this.check(checks.lte(value, params));
|
|
1190
|
+
},
|
|
1191
|
+
int(params) {
|
|
1192
|
+
return this.check(int(params));
|
|
1193
|
+
},
|
|
1194
|
+
safe(params) {
|
|
1195
|
+
return this.check(int(params));
|
|
1196
|
+
},
|
|
1197
|
+
positive(params) {
|
|
1198
|
+
return this.check(checks.gt(0, params));
|
|
1199
|
+
},
|
|
1200
|
+
nonnegative(params) {
|
|
1201
|
+
return this.check(checks.gte(0, params));
|
|
1202
|
+
},
|
|
1203
|
+
negative(params) {
|
|
1204
|
+
return this.check(checks.lt(0, params));
|
|
1205
|
+
},
|
|
1206
|
+
nonpositive(params) {
|
|
1207
|
+
return this.check(checks.lte(0, params));
|
|
1208
|
+
},
|
|
1209
|
+
multipleOf(value, params) {
|
|
1210
|
+
return this.check(checks.multipleOf(value, params));
|
|
1211
|
+
},
|
|
1212
|
+
step(value, params) {
|
|
1213
|
+
return this.check(checks.multipleOf(value, params));
|
|
1214
|
+
},
|
|
1215
|
+
finite() {
|
|
1216
|
+
return this;
|
|
1217
|
+
},
|
|
1218
|
+
}
|
|
1219
|
+
)
|
|
1220
|
+
);
|
|
769
1221
|
|
|
770
1222
|
export function number(params?: string | core.$ZodNumberParams): ZodNumber {
|
|
771
|
-
return core._number(ZodNumber, params)
|
|
1223
|
+
return core._number(ZodNumber, params);
|
|
772
1224
|
}
|
|
773
1225
|
|
|
774
1226
|
// ZodNumberFormat
|
|
775
|
-
export interface ZodNumberFormat extends ZodNumber {
|
|
776
|
-
_zod: core.$ZodNumberFormatInternals
|
|
1227
|
+
export interface ZodNumberFormat<Format extends $ZodNumberFormats = $ZodNumberFormats> extends ZodNumber {
|
|
1228
|
+
_zod: core.$ZodNumberFormatInternals<Format>;
|
|
777
1229
|
}
|
|
778
1230
|
export const ZodNumberFormat: core.$constructor<ZodNumberFormat> = /*@__PURE__*/ core.$constructor(
|
|
779
1231
|
"ZodNumberFormat",
|
|
@@ -784,33 +1236,33 @@ export const ZodNumberFormat: core.$constructor<ZodNumberFormat> = /*@__PURE__*/
|
|
|
784
1236
|
);
|
|
785
1237
|
|
|
786
1238
|
// int
|
|
787
|
-
export interface ZodInt extends ZodNumberFormat {}
|
|
1239
|
+
export interface ZodInt extends ZodNumberFormat<"safeint"> {}
|
|
788
1240
|
export function int(params?: string | core.$ZodCheckNumberFormatParams): ZodInt {
|
|
789
|
-
return core._int(ZodNumberFormat, params);
|
|
1241
|
+
return core._int(ZodNumberFormat, params) as ZodInt;
|
|
790
1242
|
}
|
|
791
1243
|
|
|
792
1244
|
// float32
|
|
793
|
-
export interface ZodFloat32 extends ZodNumberFormat {}
|
|
1245
|
+
export interface ZodFloat32 extends ZodNumberFormat<"float32"> {}
|
|
794
1246
|
export function float32(params?: string | core.$ZodCheckNumberFormatParams): ZodFloat32 {
|
|
795
|
-
return core._float32(ZodNumberFormat, params);
|
|
1247
|
+
return core._float32(ZodNumberFormat, params) as ZodFloat32;
|
|
796
1248
|
}
|
|
797
1249
|
|
|
798
1250
|
// float64
|
|
799
|
-
export interface ZodFloat64 extends ZodNumberFormat {}
|
|
1251
|
+
export interface ZodFloat64 extends ZodNumberFormat<"float64"> {}
|
|
800
1252
|
export function float64(params?: string | core.$ZodCheckNumberFormatParams): ZodFloat64 {
|
|
801
|
-
return core._float64(ZodNumberFormat, params);
|
|
1253
|
+
return core._float64(ZodNumberFormat, params) as ZodFloat64;
|
|
802
1254
|
}
|
|
803
1255
|
|
|
804
1256
|
// int32
|
|
805
|
-
export interface ZodInt32 extends ZodNumberFormat {}
|
|
1257
|
+
export interface ZodInt32 extends ZodNumberFormat<"int32"> {}
|
|
806
1258
|
export function int32(params?: string | core.$ZodCheckNumberFormatParams): ZodInt32 {
|
|
807
|
-
return core._int32(ZodNumberFormat, params);
|
|
1259
|
+
return core._int32(ZodNumberFormat, params) as ZodInt32;
|
|
808
1260
|
}
|
|
809
1261
|
|
|
810
1262
|
// uint32
|
|
811
|
-
export interface ZodUInt32 extends ZodNumberFormat {}
|
|
1263
|
+
export interface ZodUInt32 extends ZodNumberFormat<"uint32"> {}
|
|
812
1264
|
export function uint32(params?: string | core.$ZodCheckNumberFormatParams): ZodUInt32 {
|
|
813
|
-
return core._uint32(ZodNumberFormat, params);
|
|
1265
|
+
return core._uint32(ZodNumberFormat, params) as ZodUInt32;
|
|
814
1266
|
}
|
|
815
1267
|
|
|
816
1268
|
// boolean
|
|
@@ -819,10 +1271,11 @@ export interface ZodBoolean extends _ZodBoolean<core.$ZodBooleanInternals<boolea
|
|
|
819
1271
|
export const ZodBoolean: core.$constructor<ZodBoolean> = /*@__PURE__*/ core.$constructor("ZodBoolean", (inst, def) => {
|
|
820
1272
|
core.$ZodBoolean.init(inst, def);
|
|
821
1273
|
ZodType.init(inst, def);
|
|
1274
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.booleanProcessor(inst, ctx, json, params);
|
|
822
1275
|
});
|
|
823
1276
|
|
|
824
1277
|
export function boolean(params?: string | core.$ZodBooleanParams): ZodBoolean {
|
|
825
|
-
return core._boolean(ZodBoolean, params)
|
|
1278
|
+
return core._boolean(ZodBoolean, params);
|
|
826
1279
|
}
|
|
827
1280
|
|
|
828
1281
|
// bigint
|
|
@@ -847,38 +1300,65 @@ export interface _ZodBigInt<T extends core.$ZodBigIntInternals = core.$ZodBigInt
|
|
|
847
1300
|
}
|
|
848
1301
|
|
|
849
1302
|
export interface ZodBigInt extends _ZodBigInt<core.$ZodBigIntInternals<bigint>> {}
|
|
850
|
-
export const ZodBigInt: core.$constructor<ZodBigInt> = /*@__PURE__*/ core.$constructor
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
}
|
|
1303
|
+
export const ZodBigInt: core.$constructor<ZodBigInt> = /*@__PURE__*/ core.$constructor<ZodBigInt>(
|
|
1304
|
+
"ZodBigInt",
|
|
1305
|
+
(inst, def) => {
|
|
1306
|
+
core.$ZodBigInt.init(inst, def);
|
|
1307
|
+
ZodType.init(inst, def);
|
|
1308
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.bigintProcessor(inst, ctx, json, params);
|
|
1309
|
+
},
|
|
1310
|
+
/*@__PURE__*/ util.derived<ZodBigInt>(
|
|
1311
|
+
{
|
|
1312
|
+
minValue: (inst) => processors.aggregateChecks<bigint>(inst).minimum ?? null,
|
|
1313
|
+
maxValue: (inst) => processors.aggregateChecks<bigint>(inst).maximum ?? null,
|
|
1314
|
+
format: (inst) => processors.aggregateChecks(inst).format ?? null,
|
|
1315
|
+
},
|
|
1316
|
+
{
|
|
1317
|
+
gte(value, params) {
|
|
1318
|
+
return this.check(checks.gte(value, params));
|
|
1319
|
+
},
|
|
1320
|
+
min(value, params) {
|
|
1321
|
+
return this.check(checks.gte(value, params));
|
|
1322
|
+
},
|
|
1323
|
+
gt(value, params) {
|
|
1324
|
+
return this.check(checks.gt(value, params));
|
|
1325
|
+
},
|
|
1326
|
+
lt(value, params) {
|
|
1327
|
+
return this.check(checks.lt(value, params));
|
|
1328
|
+
},
|
|
1329
|
+
lte(value, params) {
|
|
1330
|
+
return this.check(checks.lte(value, params));
|
|
1331
|
+
},
|
|
1332
|
+
max(value, params) {
|
|
1333
|
+
return this.check(checks.lte(value, params));
|
|
1334
|
+
},
|
|
1335
|
+
positive(params) {
|
|
1336
|
+
return this.check(checks.gt(BigInt(0), params));
|
|
1337
|
+
},
|
|
1338
|
+
negative(params) {
|
|
1339
|
+
return this.check(checks.lt(BigInt(0), params));
|
|
1340
|
+
},
|
|
1341
|
+
nonpositive(params) {
|
|
1342
|
+
return this.check(checks.lte(BigInt(0), params));
|
|
1343
|
+
},
|
|
1344
|
+
nonnegative(params) {
|
|
1345
|
+
return this.check(checks.gte(BigInt(0), params));
|
|
1346
|
+
},
|
|
1347
|
+
multipleOf(value, params) {
|
|
1348
|
+
return this.check(checks.multipleOf(value, params));
|
|
1349
|
+
},
|
|
1350
|
+
}
|
|
1351
|
+
)
|
|
1352
|
+
);
|
|
873
1353
|
|
|
874
1354
|
export function bigint(params?: string | core.$ZodBigIntParams): ZodBigInt {
|
|
875
|
-
return core._bigint(ZodBigInt, params)
|
|
1355
|
+
return core._bigint(ZodBigInt, params);
|
|
876
1356
|
}
|
|
877
1357
|
// bigint formats
|
|
878
1358
|
|
|
879
1359
|
// ZodBigIntFormat
|
|
880
|
-
export interface ZodBigIntFormat extends ZodBigInt {
|
|
881
|
-
_zod: core.$ZodBigIntFormatInternals
|
|
1360
|
+
export interface ZodBigIntFormat<Format extends $ZodBigIntFormats = $ZodBigIntFormats> extends ZodBigInt {
|
|
1361
|
+
_zod: core.$ZodBigIntFormatInternals<Format>;
|
|
882
1362
|
}
|
|
883
1363
|
export const ZodBigIntFormat: core.$constructor<ZodBigIntFormat> = /*@__PURE__*/ core.$constructor(
|
|
884
1364
|
"ZodBigIntFormat",
|
|
@@ -889,13 +1369,15 @@ export const ZodBigIntFormat: core.$constructor<ZodBigIntFormat> = /*@__PURE__*/
|
|
|
889
1369
|
);
|
|
890
1370
|
|
|
891
1371
|
// int64
|
|
892
|
-
export
|
|
893
|
-
|
|
1372
|
+
export interface ZodInt64 extends ZodBigIntFormat<"int64"> {}
|
|
1373
|
+
export function int64(params?: string | core.$ZodBigIntFormatParams): ZodInt64 {
|
|
1374
|
+
return core._int64(ZodBigIntFormat, params) as ZodInt64;
|
|
894
1375
|
}
|
|
895
1376
|
|
|
896
1377
|
// uint64
|
|
897
|
-
export
|
|
898
|
-
|
|
1378
|
+
export interface ZodUInt64 extends ZodBigIntFormat<"uint64"> {}
|
|
1379
|
+
export function uint64(params?: string | core.$ZodBigIntFormatParams): ZodUInt64 {
|
|
1380
|
+
return core._uint64(ZodBigIntFormat, params) as ZodUInt64;
|
|
899
1381
|
}
|
|
900
1382
|
|
|
901
1383
|
// symbol
|
|
@@ -903,6 +1385,7 @@ export interface ZodSymbol extends _ZodType<core.$ZodSymbolInternals> {}
|
|
|
903
1385
|
export const ZodSymbol: core.$constructor<ZodSymbol> = /*@__PURE__*/ core.$constructor("ZodSymbol", (inst, def) => {
|
|
904
1386
|
core.$ZodSymbol.init(inst, def);
|
|
905
1387
|
ZodType.init(inst, def);
|
|
1388
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.symbolProcessor(inst, ctx, json, params);
|
|
906
1389
|
});
|
|
907
1390
|
|
|
908
1391
|
export function symbol(params?: string | core.$ZodSymbolParams): ZodSymbol {
|
|
@@ -916,6 +1399,7 @@ export const ZodUndefined: core.$constructor<ZodUndefined> = /*@__PURE__*/ core.
|
|
|
916
1399
|
(inst, def) => {
|
|
917
1400
|
core.$ZodUndefined.init(inst, def);
|
|
918
1401
|
ZodType.init(inst, def);
|
|
1402
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.undefinedProcessor(inst, ctx, json, params);
|
|
919
1403
|
}
|
|
920
1404
|
);
|
|
921
1405
|
|
|
@@ -929,6 +1413,7 @@ export interface ZodNull extends _ZodType<core.$ZodNullInternals> {}
|
|
|
929
1413
|
export const ZodNull: core.$constructor<ZodNull> = /*@__PURE__*/ core.$constructor("ZodNull", (inst, def) => {
|
|
930
1414
|
core.$ZodNull.init(inst, def);
|
|
931
1415
|
ZodType.init(inst, def);
|
|
1416
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.nullProcessor(inst, ctx, json, params);
|
|
932
1417
|
});
|
|
933
1418
|
|
|
934
1419
|
function _null(params?: string | core.$ZodNullParams): ZodNull {
|
|
@@ -941,6 +1426,7 @@ export interface ZodAny extends _ZodType<core.$ZodAnyInternals> {}
|
|
|
941
1426
|
export const ZodAny: core.$constructor<ZodAny> = /*@__PURE__*/ core.$constructor("ZodAny", (inst, def) => {
|
|
942
1427
|
core.$ZodAny.init(inst, def);
|
|
943
1428
|
ZodType.init(inst, def);
|
|
1429
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.anyProcessor(inst, ctx, json, params);
|
|
944
1430
|
});
|
|
945
1431
|
|
|
946
1432
|
export function any(): ZodAny {
|
|
@@ -952,6 +1438,7 @@ export interface ZodUnknown extends _ZodType<core.$ZodUnknownInternals> {}
|
|
|
952
1438
|
export const ZodUnknown: core.$constructor<ZodUnknown> = /*@__PURE__*/ core.$constructor("ZodUnknown", (inst, def) => {
|
|
953
1439
|
core.$ZodUnknown.init(inst, def);
|
|
954
1440
|
ZodType.init(inst, def);
|
|
1441
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.unknownProcessor(inst, ctx, json, params);
|
|
955
1442
|
});
|
|
956
1443
|
|
|
957
1444
|
export function unknown(): ZodUnknown {
|
|
@@ -963,6 +1450,7 @@ export interface ZodNever extends _ZodType<core.$ZodNeverInternals> {}
|
|
|
963
1450
|
export const ZodNever: core.$constructor<ZodNever> = /*@__PURE__*/ core.$constructor("ZodNever", (inst, def) => {
|
|
964
1451
|
core.$ZodNever.init(inst, def);
|
|
965
1452
|
ZodType.init(inst, def);
|
|
1453
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.neverProcessor(inst, ctx, json, params);
|
|
966
1454
|
});
|
|
967
1455
|
|
|
968
1456
|
export function never(params?: string | core.$ZodNeverParams): ZodNever {
|
|
@@ -974,6 +1462,7 @@ export interface ZodVoid extends _ZodType<core.$ZodVoidInternals> {}
|
|
|
974
1462
|
export const ZodVoid: core.$constructor<ZodVoid> = /*@__PURE__*/ core.$constructor("ZodVoid", (inst, def) => {
|
|
975
1463
|
core.$ZodVoid.init(inst, def);
|
|
976
1464
|
ZodType.init(inst, def);
|
|
1465
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.voidProcessor(inst, ctx, json, params);
|
|
977
1466
|
});
|
|
978
1467
|
|
|
979
1468
|
function _void(params?: string | core.$ZodVoidParams): ZodVoid {
|
|
@@ -993,17 +1482,30 @@ export interface _ZodDate<T extends core.$ZodDateInternals = core.$ZodDateIntern
|
|
|
993
1482
|
}
|
|
994
1483
|
|
|
995
1484
|
export interface ZodDate extends _ZodDate<core.$ZodDateInternals<Date>> {}
|
|
996
|
-
export const ZodDate: core.$constructor<ZodDate> = /*@__PURE__*/ core.$constructor
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1485
|
+
export const ZodDate: core.$constructor<ZodDate> = /*@__PURE__*/ core.$constructor<ZodDate>(
|
|
1486
|
+
"ZodDate",
|
|
1487
|
+
(inst, def) => {
|
|
1488
|
+
core.$ZodDate.init(inst, def);
|
|
1489
|
+
ZodType.init(inst, def);
|
|
1490
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.dateProcessor(inst, ctx, json, params);
|
|
1002
1491
|
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1492
|
+
inst.min = (value, params) => inst.check(checks.gte(value, params));
|
|
1493
|
+
inst.max = (value, params) => inst.check(checks.lte(value, params));
|
|
1494
|
+
},
|
|
1495
|
+
/*@__PURE__*/ util.derived<ZodDate>(
|
|
1496
|
+
{
|
|
1497
|
+
minDate: (inst) => {
|
|
1498
|
+
const { minimum } = processors.aggregateChecks<Date>(inst);
|
|
1499
|
+
return minimum ? new Date(minimum) : null;
|
|
1500
|
+
},
|
|
1501
|
+
maxDate: (inst) => {
|
|
1502
|
+
const { maximum } = processors.aggregateChecks<Date>(inst);
|
|
1503
|
+
return maximum ? new Date(maximum) : null;
|
|
1504
|
+
},
|
|
1505
|
+
},
|
|
1506
|
+
{}
|
|
1507
|
+
)
|
|
1508
|
+
);
|
|
1007
1509
|
|
|
1008
1510
|
export function date(params?: string | core.$ZodDateParams): ZodDate {
|
|
1009
1511
|
return core._date(ZodDate, params);
|
|
@@ -1020,38 +1522,66 @@ export interface ZodArray<T extends core.SomeType = core.$ZodType>
|
|
|
1020
1522
|
length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
|
|
1021
1523
|
|
|
1022
1524
|
unwrap(): T;
|
|
1525
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1023
1526
|
}
|
|
1024
|
-
export const ZodArray: core.$constructor<ZodArray> = /*@__PURE__*/ core.$constructor
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
inst.max = (maxLength, params) => inst.check(checks.maxLength(maxLength, params));
|
|
1032
|
-
inst.length = (len, params) => inst.check(checks.length(len, params));
|
|
1527
|
+
export const ZodArray: core.$constructor<ZodArray> = /*@__PURE__*/ core.$constructor<ZodArray>(
|
|
1528
|
+
"ZodArray",
|
|
1529
|
+
(inst, def) => {
|
|
1530
|
+
_ensureDefaultMemoizer();
|
|
1531
|
+
core.$ZodArray.init(inst, def);
|
|
1532
|
+
ZodType.init(inst, def);
|
|
1533
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.arrayProcessor(inst, ctx, json, params);
|
|
1033
1534
|
|
|
1034
|
-
|
|
1035
|
-
}
|
|
1535
|
+
inst.element = def.element;
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
min(n, params) {
|
|
1539
|
+
return this.check(checks.minLength(n, params));
|
|
1540
|
+
},
|
|
1541
|
+
nonempty(params) {
|
|
1542
|
+
return this.check(checks.minLength(1, params));
|
|
1543
|
+
},
|
|
1544
|
+
max(n, params) {
|
|
1545
|
+
return this.check(checks.maxLength(n, params));
|
|
1546
|
+
},
|
|
1547
|
+
length(n, params) {
|
|
1548
|
+
return this.check(checks.length(n, params));
|
|
1549
|
+
},
|
|
1550
|
+
unwrap() {
|
|
1551
|
+
return this.element;
|
|
1552
|
+
},
|
|
1553
|
+
}
|
|
1554
|
+
);
|
|
1036
1555
|
|
|
1037
1556
|
export function array<T extends core.SomeType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T> {
|
|
1038
1557
|
return core._array(ZodArray, element as any, params) as any;
|
|
1039
1558
|
}
|
|
1040
1559
|
|
|
1041
1560
|
// .keyof
|
|
1042
|
-
export function keyof<T extends ZodObject>(schema: T):
|
|
1561
|
+
export function keyof<T extends ZodObject>(schema: T): ZodEnum<util.KeysEnum<T["_zod"]["output"]>> {
|
|
1043
1562
|
const shape = schema._zod.def.shape;
|
|
1044
|
-
return
|
|
1563
|
+
return _enum(Object.keys(shape)) as any;
|
|
1045
1564
|
}
|
|
1046
1565
|
|
|
1047
1566
|
// ZodObject
|
|
1048
1567
|
|
|
1568
|
+
export type SafeExtendShape<Base extends core.$ZodShape, Ext extends core.$ZodLooseShape> = {
|
|
1569
|
+
[K in keyof Ext]: K extends keyof Base
|
|
1570
|
+
? core.output<Ext[K]> extends core.output<Base[K]>
|
|
1571
|
+
? core.input<Ext[K]> extends core.input<Base[K]>
|
|
1572
|
+
? Ext[K]
|
|
1573
|
+
: never
|
|
1574
|
+
: never
|
|
1575
|
+
: Ext[K];
|
|
1576
|
+
};
|
|
1577
|
+
|
|
1049
1578
|
export interface ZodObject<
|
|
1050
1579
|
/** @ts-ignore Cast variance */
|
|
1051
1580
|
out Shape extends core.$ZodShape = core.$ZodLooseShape,
|
|
1052
1581
|
out Config extends core.$ZodObjectConfig = core.$strip,
|
|
1053
1582
|
> extends _ZodType<core.$ZodObjectInternals<Shape, Config>>,
|
|
1054
1583
|
core.$ZodObject<Shape, Config> {
|
|
1584
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1055
1585
|
shape: Shape;
|
|
1056
1586
|
|
|
1057
1587
|
keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
|
|
@@ -1069,44 +1599,36 @@ export interface ZodObject<
|
|
|
1069
1599
|
/** This is the default behavior. This method call is likely unnecessary. */
|
|
1070
1600
|
strip(): ZodObject<Shape, core.$strip>;
|
|
1071
1601
|
|
|
1072
|
-
extend<U extends core.$ZodLooseShape
|
|
1073
|
-
|
|
1074
|
-
|
|
1602
|
+
extend<U extends core.$ZodLooseShape>(shape: U): ZodObject<util.Extend<Shape, util.Writeable<U>>, Config>;
|
|
1603
|
+
|
|
1604
|
+
safeExtend<U extends core.$ZodLooseShape>(
|
|
1605
|
+
shape: SafeExtendShape<Shape, U> & Partial<Record<keyof Shape, core.SomeType>>
|
|
1606
|
+
): ZodObject<util.Extend<Shape, util.Writeable<U>>, Config>;
|
|
1075
1607
|
|
|
1076
1608
|
/**
|
|
1077
|
-
* @deprecated Use
|
|
1078
|
-
*
|
|
1079
|
-
* ```ts
|
|
1080
|
-
* const A = z.object({ a: z.string() });
|
|
1081
|
-
* const B = z.object({ b: z.number() });
|
|
1082
|
-
*
|
|
1083
|
-
* const C = z.object({
|
|
1084
|
-
* ...A.shape,
|
|
1085
|
-
* ...B.shape
|
|
1086
|
-
* });
|
|
1087
|
-
* ```
|
|
1609
|
+
* @deprecated Use [`A.extend(B.shape)`](https://zod.dev/api?id=extend) instead.
|
|
1088
1610
|
*/
|
|
1089
1611
|
merge<U extends ZodObject>(other: U): ZodObject<util.Extend<Shape, U["shape"]>, U["_zod"]["config"]>;
|
|
1090
1612
|
|
|
1091
1613
|
pick<M extends util.Mask<keyof Shape>>(
|
|
1092
|
-
mask: M
|
|
1614
|
+
mask: M & Record<Exclude<keyof M, keyof Shape>, never>
|
|
1093
1615
|
): ZodObject<util.Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
1094
1616
|
|
|
1095
1617
|
omit<M extends util.Mask<keyof Shape>>(
|
|
1096
|
-
mask: M
|
|
1618
|
+
mask: M & Record<Exclude<keyof M, keyof Shape>, never>
|
|
1097
1619
|
): ZodObject<util.Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
1098
1620
|
|
|
1099
1621
|
partial(): ZodObject<
|
|
1100
1622
|
{
|
|
1101
|
-
[k in keyof Shape]: ZodOptional<Shape[k]>;
|
|
1623
|
+
-readonly [k in keyof Shape]: ZodOptional<Shape[k]>;
|
|
1102
1624
|
},
|
|
1103
1625
|
Config
|
|
1104
1626
|
>;
|
|
1105
1627
|
partial<M extends util.Mask<keyof Shape>>(
|
|
1106
|
-
mask: M
|
|
1628
|
+
mask: M & Record<Exclude<keyof M, keyof Shape>, never>
|
|
1107
1629
|
): ZodObject<
|
|
1108
1630
|
{
|
|
1109
|
-
[k in keyof Shape]: k extends keyof M
|
|
1631
|
+
-readonly [k in keyof Shape]: k extends keyof M
|
|
1110
1632
|
? // Shape[k] extends OptionalInSchema
|
|
1111
1633
|
// ? Shape[k]
|
|
1112
1634
|
// :
|
|
@@ -1116,45 +1638,95 @@ export interface ZodObject<
|
|
|
1116
1638
|
Config
|
|
1117
1639
|
>;
|
|
1118
1640
|
|
|
1641
|
+
// exactPartial
|
|
1642
|
+
exactPartial(): ZodObject<
|
|
1643
|
+
{
|
|
1644
|
+
-readonly [k in keyof Shape]: ZodExactOptional<Shape[k]>;
|
|
1645
|
+
},
|
|
1646
|
+
Config
|
|
1647
|
+
>;
|
|
1648
|
+
exactPartial<M extends util.Mask<keyof Shape>>(
|
|
1649
|
+
mask: M & Record<Exclude<keyof M, keyof Shape>, never>
|
|
1650
|
+
): ZodObject<
|
|
1651
|
+
{
|
|
1652
|
+
-readonly [k in keyof Shape]: k extends keyof M ? ZodExactOptional<Shape[k]> : Shape[k];
|
|
1653
|
+
},
|
|
1654
|
+
Config
|
|
1655
|
+
>;
|
|
1656
|
+
|
|
1119
1657
|
// required
|
|
1120
1658
|
required(): ZodObject<
|
|
1121
1659
|
{
|
|
1122
|
-
[k in keyof Shape]: ZodNonOptional<Shape[k]>;
|
|
1660
|
+
-readonly [k in keyof Shape]: ZodNonOptional<Shape[k]>;
|
|
1123
1661
|
},
|
|
1124
1662
|
Config
|
|
1125
1663
|
>;
|
|
1126
1664
|
required<M extends util.Mask<keyof Shape>>(
|
|
1127
|
-
mask: M
|
|
1665
|
+
mask: M & Record<Exclude<keyof M, keyof Shape>, never>
|
|
1128
1666
|
): ZodObject<
|
|
1129
1667
|
{
|
|
1130
|
-
[k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k];
|
|
1668
|
+
-readonly [k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k];
|
|
1131
1669
|
},
|
|
1132
1670
|
Config
|
|
1133
1671
|
>;
|
|
1134
1672
|
}
|
|
1135
1673
|
|
|
1136
|
-
export const ZodObject: core.$constructor<ZodObject> = /*@__PURE__*/ core.$constructor
|
|
1137
|
-
|
|
1138
|
-
|
|
1674
|
+
export const ZodObject: core.$constructor<ZodObject> = /*@__PURE__*/ core.$constructor<ZodObject>(
|
|
1675
|
+
"ZodObject",
|
|
1676
|
+
(inst, def) => {
|
|
1677
|
+
_ensureDefaultMemoizer();
|
|
1678
|
+
core.$ZodObjectJIT.init(inst, def);
|
|
1679
|
+
ZodType.init(inst, def);
|
|
1680
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.objectProcessor(inst, ctx, json, params);
|
|
1139
1681
|
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
});
|
|
1682
|
+
util.installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
|
|
1683
|
+
},
|
|
1684
|
+
{
|
|
1685
|
+
keyof() {
|
|
1686
|
+
return _enum(Object.keys(this._zod.def.shape));
|
|
1687
|
+
},
|
|
1688
|
+
catchall(catchall) {
|
|
1689
|
+
// `mergeDefs` rather than a spread: spreading reads `shape`, and resolving it can mint a whole fresh subtree
|
|
1690
|
+
return this.clone(util.mergeDefs(this._zod.def, { catchall: catchall as any }));
|
|
1691
|
+
},
|
|
1692
|
+
passthrough() {
|
|
1693
|
+
return this.clone(util.mergeDefs(this._zod.def, { catchall: unknown() }));
|
|
1694
|
+
},
|
|
1695
|
+
loose() {
|
|
1696
|
+
return this.clone(util.mergeDefs(this._zod.def, { catchall: unknown() }));
|
|
1697
|
+
},
|
|
1698
|
+
strict() {
|
|
1699
|
+
return this.clone(util.mergeDefs(this._zod.def, { catchall: never() }));
|
|
1700
|
+
},
|
|
1701
|
+
strip() {
|
|
1702
|
+
return this.clone(util.mergeDefs(this._zod.def, { catchall: undefined }));
|
|
1703
|
+
},
|
|
1704
|
+
extend(incoming) {
|
|
1705
|
+
return util.extend(this, incoming);
|
|
1706
|
+
},
|
|
1707
|
+
safeExtend(incoming) {
|
|
1708
|
+
return util.safeExtend(this, incoming);
|
|
1709
|
+
},
|
|
1710
|
+
merge(other) {
|
|
1711
|
+
return util.merge(this, other);
|
|
1712
|
+
},
|
|
1713
|
+
pick(mask) {
|
|
1714
|
+
return util.pick(this, mask);
|
|
1715
|
+
},
|
|
1716
|
+
omit(mask) {
|
|
1717
|
+
return util.omit(this, mask);
|
|
1718
|
+
},
|
|
1719
|
+
partial(...args) {
|
|
1720
|
+
return util.partial(ZodOptional, this, args[0]);
|
|
1721
|
+
},
|
|
1722
|
+
exactPartial(...args) {
|
|
1723
|
+
return util.partial(ZodExactOptional, this, args[0], "exactPartial");
|
|
1724
|
+
},
|
|
1725
|
+
required(...args) {
|
|
1726
|
+
return util.required(ZodNonOptional, this, args[0]);
|
|
1727
|
+
},
|
|
1728
|
+
}
|
|
1729
|
+
);
|
|
1158
1730
|
|
|
1159
1731
|
export function object<T extends core.$ZodLooseShape = Partial<Record<never, core.SomeType>>>(
|
|
1160
1732
|
shape?: T,
|
|
@@ -1162,10 +1734,7 @@ export function object<T extends core.$ZodLooseShape = Partial<Record<never, cor
|
|
|
1162
1734
|
): ZodObject<util.Writeable<T>, core.$strip> {
|
|
1163
1735
|
const def: core.$ZodObjectDef = {
|
|
1164
1736
|
type: "object",
|
|
1165
|
-
|
|
1166
|
-
util.assignProp(this, "shape", { ...shape });
|
|
1167
|
-
return this.shape;
|
|
1168
|
-
},
|
|
1737
|
+
shape: shape ?? {},
|
|
1169
1738
|
...util.normalizeParams(params),
|
|
1170
1739
|
};
|
|
1171
1740
|
return new ZodObject(def) as any;
|
|
@@ -1176,13 +1745,10 @@ export function object<T extends core.$ZodLooseShape = Partial<Record<never, cor
|
|
|
1176
1745
|
export function strictObject<T extends core.$ZodLooseShape>(
|
|
1177
1746
|
shape: T,
|
|
1178
1747
|
params?: string | core.$ZodObjectParams
|
|
1179
|
-
): ZodObject<T
|
|
1748
|
+
): ZodObject<util.Writeable<T>, core.$strict> {
|
|
1180
1749
|
return new ZodObject({
|
|
1181
1750
|
type: "object",
|
|
1182
|
-
|
|
1183
|
-
util.assignProp(this, "shape", { ...shape });
|
|
1184
|
-
return this.shape;
|
|
1185
|
-
},
|
|
1751
|
+
shape,
|
|
1186
1752
|
catchall: never(),
|
|
1187
1753
|
...util.normalizeParams(params),
|
|
1188
1754
|
}) as any;
|
|
@@ -1193,13 +1759,10 @@ export function strictObject<T extends core.$ZodLooseShape>(
|
|
|
1193
1759
|
export function looseObject<T extends core.$ZodLooseShape>(
|
|
1194
1760
|
shape: T,
|
|
1195
1761
|
params?: string | core.$ZodObjectParams
|
|
1196
|
-
): ZodObject<T
|
|
1762
|
+
): ZodObject<util.Writeable<T>, core.$loose> {
|
|
1197
1763
|
return new ZodObject({
|
|
1198
1764
|
type: "object",
|
|
1199
|
-
|
|
1200
|
-
util.assignProp(this, "shape", { ...shape });
|
|
1201
|
-
return this.shape;
|
|
1202
|
-
},
|
|
1765
|
+
shape,
|
|
1203
1766
|
catchall: unknown(),
|
|
1204
1767
|
...util.normalizeParams(params),
|
|
1205
1768
|
}) as any;
|
|
@@ -1209,11 +1772,13 @@ export function looseObject<T extends core.$ZodLooseShape>(
|
|
|
1209
1772
|
export interface ZodUnion<T extends readonly core.SomeType[] = readonly core.$ZodType[]>
|
|
1210
1773
|
extends _ZodType<core.$ZodUnionInternals<T>>,
|
|
1211
1774
|
core.$ZodUnion<T> {
|
|
1775
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1212
1776
|
options: T;
|
|
1213
1777
|
}
|
|
1214
1778
|
export const ZodUnion: core.$constructor<ZodUnion> = /*@__PURE__*/ core.$constructor("ZodUnion", (inst, def) => {
|
|
1215
1779
|
core.$ZodUnion.init(inst, def);
|
|
1216
1780
|
ZodType.init(inst, def);
|
|
1781
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.unionProcessor(inst, ctx, json, params);
|
|
1217
1782
|
inst.options = def.options;
|
|
1218
1783
|
});
|
|
1219
1784
|
|
|
@@ -1228,11 +1793,44 @@ export function union<const T extends readonly core.SomeType[]>(
|
|
|
1228
1793
|
}) as any;
|
|
1229
1794
|
}
|
|
1230
1795
|
|
|
1796
|
+
// ZodXor
|
|
1797
|
+
export interface ZodXor<T extends readonly core.SomeType[] = readonly core.$ZodType[]>
|
|
1798
|
+
extends _ZodType<core.$ZodXorInternals<T>>,
|
|
1799
|
+
core.$ZodXor<T> {
|
|
1800
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1801
|
+
options: T;
|
|
1802
|
+
}
|
|
1803
|
+
export const ZodXor: core.$constructor<ZodXor> = /*@__PURE__*/ core.$constructor("ZodXor", (inst, def) => {
|
|
1804
|
+
ZodUnion.init(inst, def);
|
|
1805
|
+
core.$ZodXor.init(inst, def);
|
|
1806
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.unionProcessor(inst, ctx, json, params);
|
|
1807
|
+
inst.options = def.options;
|
|
1808
|
+
});
|
|
1809
|
+
|
|
1810
|
+
/** Creates an exclusive union (XOR) where exactly one option must match.
|
|
1811
|
+
* Unlike regular unions that succeed when any option matches, xor fails if
|
|
1812
|
+
* zero or more than one option matches the input. */
|
|
1813
|
+
export function xor<const T extends readonly core.SomeType[]>(
|
|
1814
|
+
options: T,
|
|
1815
|
+
params?: string | core.$ZodXorParams
|
|
1816
|
+
): ZodXor<T> {
|
|
1817
|
+
return new ZodXor({
|
|
1818
|
+
type: "union",
|
|
1819
|
+
options: options as any as core.$ZodType[],
|
|
1820
|
+
inclusive: false,
|
|
1821
|
+
...util.normalizeParams(params),
|
|
1822
|
+
}) as any;
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1231
1825
|
// ZodDiscriminatedUnion
|
|
1232
|
-
export interface ZodDiscriminatedUnion<
|
|
1233
|
-
extends
|
|
1234
|
-
|
|
1235
|
-
|
|
1826
|
+
export interface ZodDiscriminatedUnion<
|
|
1827
|
+
Options extends readonly core.SomeType[] = readonly core.$ZodType[],
|
|
1828
|
+
Disc extends string = string,
|
|
1829
|
+
> extends ZodUnion<Options>,
|
|
1830
|
+
core.$ZodDiscriminatedUnion<Options, Disc> {
|
|
1831
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1832
|
+
_zod: core.$ZodDiscriminatedUnionInternals<Options, Disc>;
|
|
1833
|
+
def: core.$ZodDiscriminatedUnionDef<Options, Disc>;
|
|
1236
1834
|
}
|
|
1237
1835
|
export const ZodDiscriminatedUnion: core.$constructor<ZodDiscriminatedUnion> = /*@__PURE__*/ core.$constructor(
|
|
1238
1836
|
"ZodDiscriminatedUnion",
|
|
@@ -1244,15 +1842,16 @@ export const ZodDiscriminatedUnion: core.$constructor<ZodDiscriminatedUnion> = /
|
|
|
1244
1842
|
|
|
1245
1843
|
export function discriminatedUnion<
|
|
1246
1844
|
Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]],
|
|
1845
|
+
Disc extends string,
|
|
1247
1846
|
>(
|
|
1248
|
-
discriminator:
|
|
1847
|
+
discriminator: Disc,
|
|
1249
1848
|
options: Types,
|
|
1250
1849
|
params?: string | core.$ZodDiscriminatedUnionParams
|
|
1251
|
-
): ZodDiscriminatedUnion<Types> {
|
|
1850
|
+
): ZodDiscriminatedUnion<Types, Disc> {
|
|
1252
1851
|
// const [options, params] = args;
|
|
1253
1852
|
return new ZodDiscriminatedUnion({
|
|
1254
1853
|
type: "union",
|
|
1255
|
-
options,
|
|
1854
|
+
options: options as any as core.$ZodType[],
|
|
1256
1855
|
discriminator,
|
|
1257
1856
|
...util.normalizeParams(params),
|
|
1258
1857
|
}) as any;
|
|
@@ -1261,12 +1860,15 @@ export function discriminatedUnion<
|
|
|
1261
1860
|
// ZodIntersection
|
|
1262
1861
|
export interface ZodIntersection<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType>
|
|
1263
1862
|
extends _ZodType<core.$ZodIntersectionInternals<A, B>>,
|
|
1264
|
-
core.$ZodIntersection<A, B> {
|
|
1863
|
+
core.$ZodIntersection<A, B> {
|
|
1864
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1865
|
+
}
|
|
1265
1866
|
export const ZodIntersection: core.$constructor<ZodIntersection> = /*@__PURE__*/ core.$constructor(
|
|
1266
1867
|
"ZodIntersection",
|
|
1267
1868
|
(inst, def) => {
|
|
1268
1869
|
core.$ZodIntersection.init(inst, def);
|
|
1269
1870
|
ZodType.init(inst, def);
|
|
1871
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.intersectionProcessor(inst, ctx, json, params);
|
|
1270
1872
|
}
|
|
1271
1873
|
);
|
|
1272
1874
|
|
|
@@ -1287,17 +1889,36 @@ export interface ZodTuple<
|
|
|
1287
1889
|
Rest extends core.SomeType | null = core.$ZodType | null,
|
|
1288
1890
|
> extends _ZodType<core.$ZodTupleInternals<T, Rest>>,
|
|
1289
1891
|
core.$ZodTuple<T, Rest> {
|
|
1892
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1290
1893
|
rest<Rest extends core.SomeType = core.$ZodType>(rest: Rest): ZodTuple<T, Rest>;
|
|
1894
|
+
partial(): ZodTuple<{ -readonly [k in keyof T]: ZodOptional<T[k]> }, Rest>;
|
|
1291
1895
|
}
|
|
1292
|
-
export const ZodTuple: core.$constructor<ZodTuple> = /*@__PURE__*/ core.$constructor
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1896
|
+
export const ZodTuple: core.$constructor<ZodTuple> = /*@__PURE__*/ core.$constructor<ZodTuple>(
|
|
1897
|
+
"ZodTuple",
|
|
1898
|
+
(inst, def) => {
|
|
1899
|
+
_ensureDefaultMemoizer();
|
|
1900
|
+
core.$ZodTuple.init(inst, def);
|
|
1901
|
+
ZodType.init(inst, def);
|
|
1902
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.tupleProcessor(inst, ctx, json, params);
|
|
1903
|
+
},
|
|
1904
|
+
{
|
|
1905
|
+
rest(rest) {
|
|
1906
|
+
return this.clone({
|
|
1907
|
+
...this._zod.def,
|
|
1908
|
+
rest: rest as any as core.$ZodType,
|
|
1909
|
+
}) as any;
|
|
1910
|
+
},
|
|
1911
|
+
partial() {
|
|
1912
|
+
const def = this._zod.def;
|
|
1913
|
+
// a refinement was authored against the full arity; partialing would run it on a shorter array
|
|
1914
|
+
if (def.checks?.length) throw new Error(".partial() cannot be used on tuple schemas containing refinements");
|
|
1915
|
+
return this.clone({
|
|
1916
|
+
...def,
|
|
1917
|
+
items: def.items.map((item) => new ZodOptional({ type: "optional", innerType: item })),
|
|
1918
|
+
}) as any;
|
|
1919
|
+
},
|
|
1920
|
+
}
|
|
1921
|
+
);
|
|
1301
1922
|
|
|
1302
1923
|
export function tuple<T extends readonly [core.SomeType, ...core.SomeType[]]>(
|
|
1303
1924
|
items: T,
|
|
@@ -1331,12 +1952,15 @@ export interface ZodRecord<
|
|
|
1331
1952
|
Value extends core.SomeType = core.$ZodType,
|
|
1332
1953
|
> extends _ZodType<core.$ZodRecordInternals<Key, Value>>,
|
|
1333
1954
|
core.$ZodRecord<Key, Value> {
|
|
1955
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1334
1956
|
keyType: Key;
|
|
1335
1957
|
valueType: Value;
|
|
1336
1958
|
}
|
|
1337
1959
|
export const ZodRecord: core.$constructor<ZodRecord> = /*@__PURE__*/ core.$constructor("ZodRecord", (inst, def) => {
|
|
1960
|
+
_ensureDefaultMemoizer();
|
|
1338
1961
|
core.$ZodRecord.init(inst, def);
|
|
1339
1962
|
ZodType.init(inst, def);
|
|
1963
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.recordProcessor(inst, ctx, json, params);
|
|
1340
1964
|
|
|
1341
1965
|
inst.keyType = def.keyType;
|
|
1342
1966
|
inst.valueType = def.valueType;
|
|
@@ -1347,6 +1971,15 @@ export function record<Key extends core.$ZodRecordKey, Value extends core.SomeTy
|
|
|
1347
1971
|
valueType: Value,
|
|
1348
1972
|
params?: string | core.$ZodRecordParams
|
|
1349
1973
|
): ZodRecord<Key, Value> {
|
|
1974
|
+
// v3-compat: z.record(valueType, params?) — defaults keyType to z.string()
|
|
1975
|
+
if (!valueType || !(valueType as any)._zod) {
|
|
1976
|
+
return new ZodRecord({
|
|
1977
|
+
type: "record",
|
|
1978
|
+
keyType: string() as any,
|
|
1979
|
+
valueType: keyType as any as core.$ZodType,
|
|
1980
|
+
...util.normalizeParams(valueType as string | core.$ZodRecordParams | undefined),
|
|
1981
|
+
}) as any;
|
|
1982
|
+
}
|
|
1350
1983
|
return new ZodRecord({
|
|
1351
1984
|
type: "record",
|
|
1352
1985
|
keyType,
|
|
@@ -1362,9 +1995,24 @@ export function partialRecord<Key extends core.$ZodRecordKey, Value extends core
|
|
|
1362
1995
|
): ZodRecord<Key & core.$partial, Value> {
|
|
1363
1996
|
return new ZodRecord({
|
|
1364
1997
|
type: "record",
|
|
1365
|
-
keyType
|
|
1998
|
+
keyType,
|
|
1366
1999
|
valueType: valueType as any,
|
|
1367
2000
|
...util.normalizeParams(params),
|
|
2001
|
+
partial: true,
|
|
2002
|
+
}) as any;
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
export function looseRecord<Key extends core.$ZodRecordKey, Value extends core.SomeType>(
|
|
2006
|
+
keyType: Key,
|
|
2007
|
+
valueType: Value,
|
|
2008
|
+
params?: string | core.$ZodRecordParams
|
|
2009
|
+
): ZodRecord<Key, Value> {
|
|
2010
|
+
return new ZodRecord({
|
|
2011
|
+
type: "record",
|
|
2012
|
+
keyType,
|
|
2013
|
+
valueType: valueType as any as core.$ZodType,
|
|
2014
|
+
mode: "loose",
|
|
2015
|
+
...util.normalizeParams(params),
|
|
1368
2016
|
}) as any;
|
|
1369
2017
|
}
|
|
1370
2018
|
|
|
@@ -1372,14 +2020,25 @@ export function partialRecord<Key extends core.$ZodRecordKey, Value extends core
|
|
|
1372
2020
|
export interface ZodMap<Key extends core.SomeType = core.$ZodType, Value extends core.SomeType = core.$ZodType>
|
|
1373
2021
|
extends _ZodType<core.$ZodMapInternals<Key, Value>>,
|
|
1374
2022
|
core.$ZodMap<Key, Value> {
|
|
2023
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1375
2024
|
keyType: Key;
|
|
1376
2025
|
valueType: Value;
|
|
2026
|
+
min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
|
2027
|
+
nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
|
|
2028
|
+
max(maxSize: number, params?: string | core.$ZodCheckMaxSizeParams): this;
|
|
2029
|
+
size(size: number, params?: string | core.$ZodCheckSizeEqualsParams): this;
|
|
1377
2030
|
}
|
|
1378
2031
|
export const ZodMap: core.$constructor<ZodMap> = /*@__PURE__*/ core.$constructor("ZodMap", (inst, def) => {
|
|
2032
|
+
_ensureDefaultMemoizer();
|
|
1379
2033
|
core.$ZodMap.init(inst, def);
|
|
1380
2034
|
ZodType.init(inst, def);
|
|
2035
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.mapProcessor(inst, ctx, json, params);
|
|
1381
2036
|
inst.keyType = def.keyType;
|
|
1382
2037
|
inst.valueType = def.valueType;
|
|
2038
|
+
inst.min = (...args) => inst.check(core._minSize(...args));
|
|
2039
|
+
inst.nonempty = (params) => inst.check(core._minSize(1, params));
|
|
2040
|
+
inst.max = (...args) => inst.check(core._maxSize(...args));
|
|
2041
|
+
inst.size = (...args) => inst.check(core._size(...args));
|
|
1383
2042
|
});
|
|
1384
2043
|
|
|
1385
2044
|
export function map<Key extends core.SomeType, Value extends core.SomeType>(
|
|
@@ -1399,15 +2058,17 @@ export function map<Key extends core.SomeType, Value extends core.SomeType>(
|
|
|
1399
2058
|
export interface ZodSet<T extends core.SomeType = core.$ZodType>
|
|
1400
2059
|
extends _ZodType<core.$ZodSetInternals<T>>,
|
|
1401
2060
|
core.$ZodSet<T> {
|
|
2061
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1402
2062
|
min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
|
1403
|
-
/** */
|
|
1404
2063
|
nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
|
|
1405
2064
|
max(maxSize: number, params?: string | core.$ZodCheckMaxSizeParams): this;
|
|
1406
2065
|
size(size: number, params?: string | core.$ZodCheckSizeEqualsParams): this;
|
|
1407
2066
|
}
|
|
1408
2067
|
export const ZodSet: core.$constructor<ZodSet> = /*@__PURE__*/ core.$constructor("ZodSet", (inst, def) => {
|
|
2068
|
+
_ensureDefaultMemoizer();
|
|
1409
2069
|
core.$ZodSet.init(inst, def);
|
|
1410
2070
|
ZodType.init(inst, def);
|
|
2071
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.setProcessor(inst, ctx, json, params);
|
|
1411
2072
|
|
|
1412
2073
|
inst.min = (...args) => inst.check(core._minSize(...args));
|
|
1413
2074
|
inst.nonempty = (params) => inst.check(core._minSize(1, params));
|
|
@@ -1432,6 +2093,7 @@ export interface ZodEnum<
|
|
|
1432
2093
|
out T extends util.EnumLike = util.EnumLike,
|
|
1433
2094
|
> extends _ZodType<core.$ZodEnumInternals<T>>,
|
|
1434
2095
|
core.$ZodEnum<T> {
|
|
2096
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1435
2097
|
enum: T;
|
|
1436
2098
|
options: Array<T[keyof T]>;
|
|
1437
2099
|
|
|
@@ -1447,9 +2109,11 @@ export interface ZodEnum<
|
|
|
1447
2109
|
export const ZodEnum: core.$constructor<ZodEnum> = /*@__PURE__*/ core.$constructor("ZodEnum", (inst, def) => {
|
|
1448
2110
|
core.$ZodEnum.init(inst, def);
|
|
1449
2111
|
ZodType.init(inst, def);
|
|
2112
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.enumProcessor(inst, ctx, json, params);
|
|
1450
2113
|
|
|
1451
2114
|
inst.enum = def.entries;
|
|
1452
|
-
|
|
2115
|
+
// reuse the parsed value set so a numeric TS enum's reverse-mapping keys stay out
|
|
2116
|
+
inst.options = [...inst._zod.values] as util.EnumValue[];
|
|
1453
2117
|
|
|
1454
2118
|
const keys = new Set(Object.keys(def.entries));
|
|
1455
2119
|
|
|
@@ -1512,13 +2176,14 @@ export function nativeEnum<T extends util.EnumLike>(entries: T, params?: string
|
|
|
1512
2176
|
type: "enum",
|
|
1513
2177
|
entries,
|
|
1514
2178
|
...util.normalizeParams(params),
|
|
1515
|
-
}) as
|
|
2179
|
+
}) as ZodEnum<T>;
|
|
1516
2180
|
}
|
|
1517
2181
|
|
|
1518
2182
|
// ZodLiteral
|
|
1519
2183
|
export interface ZodLiteral<T extends util.Literal = util.Literal>
|
|
1520
2184
|
extends _ZodType<core.$ZodLiteralInternals<T>>,
|
|
1521
2185
|
core.$ZodLiteral<T> {
|
|
2186
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1522
2187
|
values: Set<T>;
|
|
1523
2188
|
/** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
|
|
1524
2189
|
value: T;
|
|
@@ -1526,6 +2191,7 @@ export interface ZodLiteral<T extends util.Literal = util.Literal>
|
|
|
1526
2191
|
export const ZodLiteral: core.$constructor<ZodLiteral> = /*@__PURE__*/ core.$constructor("ZodLiteral", (inst, def) => {
|
|
1527
2192
|
core.$ZodLiteral.init(inst, def);
|
|
1528
2193
|
ZodType.init(inst, def);
|
|
2194
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.literalProcessor(inst, ctx, json, params);
|
|
1529
2195
|
inst.values = new Set(def.values);
|
|
1530
2196
|
Object.defineProperty(inst, "value", {
|
|
1531
2197
|
get() {
|
|
@@ -1555,6 +2221,7 @@ export function literal(value: any, params: any) {
|
|
|
1555
2221
|
|
|
1556
2222
|
// ZodFile
|
|
1557
2223
|
export interface ZodFile extends _ZodType<core.$ZodFileInternals>, core.$ZodFile {
|
|
2224
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1558
2225
|
min(size: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
|
1559
2226
|
max(size: number, params?: string | core.$ZodCheckMaxSizeParams): this;
|
|
1560
2227
|
mime(types: util.MimeTypes | Array<util.MimeTypes>, params?: string | core.$ZodCheckMimeTypeParams): this;
|
|
@@ -1562,6 +2229,7 @@ export interface ZodFile extends _ZodType<core.$ZodFileInternals>, core.$ZodFile
|
|
|
1562
2229
|
export const ZodFile: core.$constructor<ZodFile> = /*@__PURE__*/ core.$constructor("ZodFile", (inst, def) => {
|
|
1563
2230
|
core.$ZodFile.init(inst, def);
|
|
1564
2231
|
ZodType.init(inst, def);
|
|
2232
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.fileProcessor(inst, ctx, json, params);
|
|
1565
2233
|
|
|
1566
2234
|
inst.min = (size, params) => inst.check(core._minSize(size, params));
|
|
1567
2235
|
inst.max = (size, params) => inst.check(core._maxSize(size, params));
|
|
@@ -1575,15 +2243,23 @@ export function file(params?: string | core.$ZodFileParams): ZodFile {
|
|
|
1575
2243
|
// ZodTransform
|
|
1576
2244
|
export interface ZodTransform<O = unknown, I = unknown>
|
|
1577
2245
|
extends _ZodType<core.$ZodTransformInternals<O, I>>,
|
|
1578
|
-
core.$ZodTransform<O, I> {
|
|
2246
|
+
core.$ZodTransform<O, I> {
|
|
2247
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2248
|
+
}
|
|
1579
2249
|
export const ZodTransform: core.$constructor<ZodTransform> = /*@__PURE__*/ core.$constructor(
|
|
1580
2250
|
"ZodTransform",
|
|
1581
2251
|
(inst, def) => {
|
|
2252
|
+
_ensureDefaultMemoizer();
|
|
1582
2253
|
core.$ZodTransform.init(inst, def);
|
|
1583
2254
|
ZodType.init(inst, def);
|
|
2255
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.transformProcessor(inst, ctx, json, params);
|
|
1584
2256
|
|
|
1585
2257
|
inst._zod.parse = (payload, _ctx) => {
|
|
1586
|
-
(
|
|
2258
|
+
if (_ctx.direction === "backward") {
|
|
2259
|
+
throw new core.$ZodEncodeError(inst.constructor.name);
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
(payload as core.$RefinementCtx).addIssue = (issue) => {
|
|
1587
2263
|
if (typeof issue === "string") {
|
|
1588
2264
|
payload.issues.push(util.issue(issue, payload.value, def));
|
|
1589
2265
|
} else {
|
|
@@ -1592,9 +2268,9 @@ export const ZodTransform: core.$constructor<ZodTransform> = /*@__PURE__*/ core.
|
|
|
1592
2268
|
|
|
1593
2269
|
if (_issue.fatal) _issue.continue = false;
|
|
1594
2270
|
_issue.code ??= "custom";
|
|
1595
|
-
_issue.input
|
|
2271
|
+
if (!("input" in _issue)) _issue.input = payload.value;
|
|
1596
2272
|
_issue.inst ??= inst;
|
|
1597
|
-
_issue.continue ??= true;
|
|
2273
|
+
// _issue.continue ??= true;
|
|
1598
2274
|
payload.issues.push(util.issue(_issue));
|
|
1599
2275
|
}
|
|
1600
2276
|
};
|
|
@@ -1613,7 +2289,7 @@ export const ZodTransform: core.$constructor<ZodTransform> = /*@__PURE__*/ core.
|
|
|
1613
2289
|
);
|
|
1614
2290
|
|
|
1615
2291
|
export function transform<I = unknown, O = I>(
|
|
1616
|
-
fn: (input: I, ctx: core
|
|
2292
|
+
fn: (input: I, ctx: core.$RefinementCtx) => O
|
|
1617
2293
|
): ZodTransform<Awaited<O>, I> {
|
|
1618
2294
|
return new ZodTransform({
|
|
1619
2295
|
type: "transform",
|
|
@@ -1625,6 +2301,7 @@ export function transform<I = unknown, O = I>(
|
|
|
1625
2301
|
export interface ZodOptional<T extends core.SomeType = core.$ZodType>
|
|
1626
2302
|
extends _ZodType<core.$ZodOptionalInternals<T>>,
|
|
1627
2303
|
core.$ZodOptional<T> {
|
|
2304
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1628
2305
|
unwrap(): T;
|
|
1629
2306
|
}
|
|
1630
2307
|
export const ZodOptional: core.$constructor<ZodOptional> = /*@__PURE__*/ core.$constructor(
|
|
@@ -1632,6 +2309,7 @@ export const ZodOptional: core.$constructor<ZodOptional> = /*@__PURE__*/ core.$c
|
|
|
1632
2309
|
(inst, def) => {
|
|
1633
2310
|
core.$ZodOptional.init(inst, def);
|
|
1634
2311
|
ZodType.init(inst, def);
|
|
2312
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.optionalProcessor(inst, ctx, json, params);
|
|
1635
2313
|
|
|
1636
2314
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
1637
2315
|
}
|
|
@@ -1644,10 +2322,36 @@ export function optional<T extends core.SomeType>(innerType: T): ZodOptional<T>
|
|
|
1644
2322
|
}) as any;
|
|
1645
2323
|
}
|
|
1646
2324
|
|
|
2325
|
+
// ZodExactOptional
|
|
2326
|
+
export interface ZodExactOptional<T extends core.SomeType = core.$ZodType>
|
|
2327
|
+
extends _ZodType<core.$ZodExactOptionalInternals<T>>,
|
|
2328
|
+
core.$ZodExactOptional<T> {
|
|
2329
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2330
|
+
unwrap(): T;
|
|
2331
|
+
}
|
|
2332
|
+
export const ZodExactOptional: core.$constructor<ZodExactOptional> = /*@__PURE__*/ core.$constructor(
|
|
2333
|
+
"ZodExactOptional",
|
|
2334
|
+
(inst, def) => {
|
|
2335
|
+
core.$ZodExactOptional.init(inst, def);
|
|
2336
|
+
ZodType.init(inst, def);
|
|
2337
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.optionalProcessor(inst, ctx, json, params);
|
|
2338
|
+
|
|
2339
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2340
|
+
}
|
|
2341
|
+
);
|
|
2342
|
+
|
|
2343
|
+
export function exactOptional<T extends core.SomeType>(innerType: T): ZodExactOptional<T> {
|
|
2344
|
+
return new ZodExactOptional({
|
|
2345
|
+
type: "optional",
|
|
2346
|
+
innerType: innerType as any as core.$ZodType,
|
|
2347
|
+
}) as any;
|
|
2348
|
+
}
|
|
2349
|
+
|
|
1647
2350
|
// ZodNullable
|
|
1648
2351
|
export interface ZodNullable<T extends core.SomeType = core.$ZodType>
|
|
1649
2352
|
extends _ZodType<core.$ZodNullableInternals<T>>,
|
|
1650
2353
|
core.$ZodNullable<T> {
|
|
2354
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1651
2355
|
unwrap(): T;
|
|
1652
2356
|
}
|
|
1653
2357
|
export const ZodNullable: core.$constructor<ZodNullable> = /*@__PURE__*/ core.$constructor(
|
|
@@ -1655,6 +2359,7 @@ export const ZodNullable: core.$constructor<ZodNullable> = /*@__PURE__*/ core.$c
|
|
|
1655
2359
|
(inst, def) => {
|
|
1656
2360
|
core.$ZodNullable.init(inst, def);
|
|
1657
2361
|
ZodType.init(inst, def);
|
|
2362
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.nullableProcessor(inst, ctx, json, params);
|
|
1658
2363
|
|
|
1659
2364
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
1660
2365
|
}
|
|
@@ -1676,6 +2381,7 @@ export function nullish<T extends core.SomeType>(innerType: T): ZodOptional<ZodN
|
|
|
1676
2381
|
export interface ZodDefault<T extends core.SomeType = core.$ZodType>
|
|
1677
2382
|
extends _ZodType<core.$ZodDefaultInternals<T>>,
|
|
1678
2383
|
core.$ZodDefault<T> {
|
|
2384
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1679
2385
|
unwrap(): T;
|
|
1680
2386
|
/** @deprecated Use `.unwrap()` instead. */
|
|
1681
2387
|
removeDefault(): T;
|
|
@@ -1683,6 +2389,7 @@ export interface ZodDefault<T extends core.SomeType = core.$ZodType>
|
|
|
1683
2389
|
export const ZodDefault: core.$constructor<ZodDefault> = /*@__PURE__*/ core.$constructor("ZodDefault", (inst, def) => {
|
|
1684
2390
|
core.$ZodDefault.init(inst, def);
|
|
1685
2391
|
ZodType.init(inst, def);
|
|
2392
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.defaultProcessor(inst, ctx, json, params);
|
|
1686
2393
|
|
|
1687
2394
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
1688
2395
|
inst.removeDefault = inst.unwrap;
|
|
@@ -1696,7 +2403,7 @@ export function _default<T extends core.SomeType>(
|
|
|
1696
2403
|
type: "default",
|
|
1697
2404
|
innerType: innerType as any as core.$ZodType,
|
|
1698
2405
|
get defaultValue() {
|
|
1699
|
-
return typeof defaultValue === "function" ? (defaultValue as Function)() : defaultValue;
|
|
2406
|
+
return typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue);
|
|
1700
2407
|
},
|
|
1701
2408
|
}) as any;
|
|
1702
2409
|
}
|
|
@@ -1705,6 +2412,7 @@ export function _default<T extends core.SomeType>(
|
|
|
1705
2412
|
export interface ZodPrefault<T extends core.SomeType = core.$ZodType>
|
|
1706
2413
|
extends _ZodType<core.$ZodPrefaultInternals<T>>,
|
|
1707
2414
|
core.$ZodPrefault<T> {
|
|
2415
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1708
2416
|
unwrap(): T;
|
|
1709
2417
|
}
|
|
1710
2418
|
export const ZodPrefault: core.$constructor<ZodPrefault> = /*@__PURE__*/ core.$constructor(
|
|
@@ -1712,6 +2420,7 @@ export const ZodPrefault: core.$constructor<ZodPrefault> = /*@__PURE__*/ core.$c
|
|
|
1712
2420
|
(inst, def) => {
|
|
1713
2421
|
core.$ZodPrefault.init(inst, def);
|
|
1714
2422
|
ZodType.init(inst, def);
|
|
2423
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.prefaultProcessor(inst, ctx, json, params);
|
|
1715
2424
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
1716
2425
|
}
|
|
1717
2426
|
);
|
|
@@ -1724,7 +2433,7 @@ export function prefault<T extends core.SomeType>(
|
|
|
1724
2433
|
type: "prefault",
|
|
1725
2434
|
innerType: innerType as any as core.$ZodType,
|
|
1726
2435
|
get defaultValue() {
|
|
1727
|
-
return typeof defaultValue === "function" ? (defaultValue as Function)() : defaultValue;
|
|
2436
|
+
return typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue);
|
|
1728
2437
|
},
|
|
1729
2438
|
}) as any;
|
|
1730
2439
|
}
|
|
@@ -1733,6 +2442,7 @@ export function prefault<T extends core.SomeType>(
|
|
|
1733
2442
|
export interface ZodNonOptional<T extends core.SomeType = core.$ZodType>
|
|
1734
2443
|
extends _ZodType<core.$ZodNonOptionalInternals<T>>,
|
|
1735
2444
|
core.$ZodNonOptional<T> {
|
|
2445
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1736
2446
|
unwrap(): T;
|
|
1737
2447
|
}
|
|
1738
2448
|
export const ZodNonOptional: core.$constructor<ZodNonOptional> = /*@__PURE__*/ core.$constructor(
|
|
@@ -1740,6 +2450,7 @@ export const ZodNonOptional: core.$constructor<ZodNonOptional> = /*@__PURE__*/ c
|
|
|
1740
2450
|
(inst, def) => {
|
|
1741
2451
|
core.$ZodNonOptional.init(inst, def);
|
|
1742
2452
|
ZodType.init(inst, def);
|
|
2453
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.nonoptionalProcessor(inst, ctx, json, params);
|
|
1743
2454
|
|
|
1744
2455
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
1745
2456
|
}
|
|
@@ -1760,11 +2471,13 @@ export function nonoptional<T extends core.SomeType>(
|
|
|
1760
2471
|
export interface ZodSuccess<T extends core.SomeType = core.$ZodType>
|
|
1761
2472
|
extends _ZodType<core.$ZodSuccessInternals<T>>,
|
|
1762
2473
|
core.$ZodSuccess<T> {
|
|
2474
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1763
2475
|
unwrap(): T;
|
|
1764
2476
|
}
|
|
1765
2477
|
export const ZodSuccess: core.$constructor<ZodSuccess> = /*@__PURE__*/ core.$constructor("ZodSuccess", (inst, def) => {
|
|
1766
2478
|
core.$ZodSuccess.init(inst, def);
|
|
1767
2479
|
ZodType.init(inst, def);
|
|
2480
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.successProcessor(inst, ctx, json, params);
|
|
1768
2481
|
|
|
1769
2482
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
1770
2483
|
});
|
|
@@ -1780,6 +2493,7 @@ export function success<T extends core.SomeType>(innerType: T): ZodSuccess<T> {
|
|
|
1780
2493
|
export interface ZodCatch<T extends core.SomeType = core.$ZodType>
|
|
1781
2494
|
extends _ZodType<core.$ZodCatchInternals<T>>,
|
|
1782
2495
|
core.$ZodCatch<T> {
|
|
2496
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1783
2497
|
unwrap(): T;
|
|
1784
2498
|
/** @deprecated Use `.unwrap()` instead. */
|
|
1785
2499
|
removeCatch(): T;
|
|
@@ -1787,6 +2501,7 @@ export interface ZodCatch<T extends core.SomeType = core.$ZodType>
|
|
|
1787
2501
|
export const ZodCatch: core.$constructor<ZodCatch> = /*@__PURE__*/ core.$constructor("ZodCatch", (inst, def) => {
|
|
1788
2502
|
core.$ZodCatch.init(inst, def);
|
|
1789
2503
|
ZodType.init(inst, def);
|
|
2504
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.catchProcessor(inst, ctx, json, params);
|
|
1790
2505
|
|
|
1791
2506
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
1792
2507
|
inst.removeCatch = inst.unwrap;
|
|
@@ -1799,7 +2514,7 @@ function _catch<T extends core.SomeType>(
|
|
|
1799
2514
|
return new ZodCatch({
|
|
1800
2515
|
type: "catch",
|
|
1801
2516
|
innerType: innerType as any as core.$ZodType,
|
|
1802
|
-
catchValue: (typeof catchValue === "function" ? catchValue : (
|
|
2517
|
+
catchValue: (typeof catchValue === "function" ? catchValue : core.util.constantCatch(catchValue)) as (
|
|
1803
2518
|
ctx: core.$ZodCatchCtx
|
|
1804
2519
|
) => core.output<T>,
|
|
1805
2520
|
}) as any;
|
|
@@ -1807,10 +2522,13 @@ function _catch<T extends core.SomeType>(
|
|
|
1807
2522
|
export { _catch as catch };
|
|
1808
2523
|
|
|
1809
2524
|
// ZodNaN
|
|
1810
|
-
export interface ZodNaN extends _ZodType<core.$ZodNaNInternals>, core.$ZodNaN {
|
|
2525
|
+
export interface ZodNaN extends _ZodType<core.$ZodNaNInternals>, core.$ZodNaN {
|
|
2526
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2527
|
+
}
|
|
1811
2528
|
export const ZodNaN: core.$constructor<ZodNaN> = /*@__PURE__*/ core.$constructor("ZodNaN", (inst, def) => {
|
|
1812
2529
|
core.$ZodNaN.init(inst, def);
|
|
1813
2530
|
ZodType.init(inst, def);
|
|
2531
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.nanProcessor(inst, ctx, json, params);
|
|
1814
2532
|
});
|
|
1815
2533
|
|
|
1816
2534
|
export function nan(params?: string | core.$ZodNaNParams): ZodNaN {
|
|
@@ -1821,12 +2539,14 @@ export function nan(params?: string | core.$ZodNaNParams): ZodNaN {
|
|
|
1821
2539
|
export interface ZodPipe<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType>
|
|
1822
2540
|
extends _ZodType<core.$ZodPipeInternals<A, B>>,
|
|
1823
2541
|
core.$ZodPipe<A, B> {
|
|
2542
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1824
2543
|
in: A;
|
|
1825
2544
|
out: B;
|
|
1826
2545
|
}
|
|
1827
2546
|
export const ZodPipe: core.$constructor<ZodPipe> = /*@__PURE__*/ core.$constructor("ZodPipe", (inst, def) => {
|
|
1828
2547
|
core.$ZodPipe.init(inst, def);
|
|
1829
2548
|
ZodType.init(inst, def);
|
|
2549
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.pipeProcessor(inst, ctx, json, params);
|
|
1830
2550
|
|
|
1831
2551
|
inst.in = def.in;
|
|
1832
2552
|
inst.out = def.out;
|
|
@@ -1845,15 +2565,78 @@ export function pipe(in_: core.SomeType, out: core.SomeType) {
|
|
|
1845
2565
|
});
|
|
1846
2566
|
}
|
|
1847
2567
|
|
|
2568
|
+
// ZodCodec
|
|
2569
|
+
export interface ZodCodec<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType>
|
|
2570
|
+
extends ZodPipe<A, B>,
|
|
2571
|
+
core.$ZodCodec<A, B> {
|
|
2572
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2573
|
+
_zod: core.$ZodCodecInternals<A, B>;
|
|
2574
|
+
def: core.$ZodCodecDef<A, B>;
|
|
2575
|
+
}
|
|
2576
|
+
export const ZodCodec: core.$constructor<ZodCodec> = /*@__PURE__*/ core.$constructor("ZodCodec", (inst, def) => {
|
|
2577
|
+
ZodPipe.init(inst, def);
|
|
2578
|
+
core.$ZodCodec.init(inst, def);
|
|
2579
|
+
});
|
|
2580
|
+
|
|
2581
|
+
export function codec<const A extends core.SomeType, B extends core.SomeType = core.$ZodType>(
|
|
2582
|
+
in_: A,
|
|
2583
|
+
out: B,
|
|
2584
|
+
params: {
|
|
2585
|
+
decode: (value: core.output<A>, payload: core.ParsePayload<core.output<A>>) => core.util.MaybeAsync<core.input<B>>;
|
|
2586
|
+
encode: (value: core.input<B>, payload: core.ParsePayload<core.input<B>>) => core.util.MaybeAsync<core.output<A>>;
|
|
2587
|
+
}
|
|
2588
|
+
): ZodCodec<A, B> {
|
|
2589
|
+
return new ZodCodec({
|
|
2590
|
+
type: "pipe",
|
|
2591
|
+
in: in_ as any as core.$ZodType,
|
|
2592
|
+
out: out as any as core.$ZodType,
|
|
2593
|
+
transform: params.decode as any,
|
|
2594
|
+
reverseTransform: params.encode as any,
|
|
2595
|
+
}) as any;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
export function invertCodec<A extends core.SomeType, B extends core.SomeType>(codec: ZodCodec<A, B>): ZodCodec<B, A> {
|
|
2599
|
+
const def = codec._zod.def;
|
|
2600
|
+
return new ZodCodec({
|
|
2601
|
+
type: "pipe",
|
|
2602
|
+
in: def.out as any,
|
|
2603
|
+
out: def.in as any,
|
|
2604
|
+
transform: def.reverseTransform as any,
|
|
2605
|
+
reverseTransform: def.transform as any,
|
|
2606
|
+
}) as any;
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
// ZodPreprocess
|
|
2610
|
+
export interface ZodPreprocess<B extends core.SomeType = core.$ZodType, I = unknown>
|
|
2611
|
+
extends ZodPipe<core.$ZodTransform<unknown, I>, B>,
|
|
2612
|
+
core.$ZodPreprocess<B, I> {
|
|
2613
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2614
|
+
_zod: core.$ZodPreprocessInternals<B, I>;
|
|
2615
|
+
def: core.$ZodPreprocessDef<B, I>;
|
|
2616
|
+
}
|
|
2617
|
+
export const ZodPreprocess: core.$constructor<ZodPreprocess> = /*@__PURE__*/ core.$constructor(
|
|
2618
|
+
"ZodPreprocess",
|
|
2619
|
+
(inst, def) => {
|
|
2620
|
+
ZodPipe.init(inst, def);
|
|
2621
|
+
core.$ZodPreprocess.init(inst, def);
|
|
2622
|
+
}
|
|
2623
|
+
);
|
|
2624
|
+
|
|
1848
2625
|
// ZodReadonly
|
|
1849
2626
|
export interface ZodReadonly<T extends core.SomeType = core.$ZodType>
|
|
1850
2627
|
extends _ZodType<core.$ZodReadonlyInternals<T>>,
|
|
1851
|
-
core.$ZodReadonly<T> {
|
|
2628
|
+
core.$ZodReadonly<T> {
|
|
2629
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2630
|
+
unwrap(): T;
|
|
2631
|
+
}
|
|
1852
2632
|
export const ZodReadonly: core.$constructor<ZodReadonly> = /*@__PURE__*/ core.$constructor(
|
|
1853
2633
|
"ZodReadonly",
|
|
1854
2634
|
(inst, def) => {
|
|
1855
2635
|
core.$ZodReadonly.init(inst, def);
|
|
1856
2636
|
ZodType.init(inst, def);
|
|
2637
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.readonlyProcessor(inst, ctx, json, params);
|
|
2638
|
+
|
|
2639
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
1857
2640
|
}
|
|
1858
2641
|
);
|
|
1859
2642
|
|
|
@@ -1867,12 +2650,15 @@ export function readonly<T extends core.SomeType>(innerType: T): ZodReadonly<T>
|
|
|
1867
2650
|
// ZodTemplateLiteral
|
|
1868
2651
|
export interface ZodTemplateLiteral<Template extends string = string>
|
|
1869
2652
|
extends _ZodType<core.$ZodTemplateLiteralInternals<Template>>,
|
|
1870
|
-
core.$ZodTemplateLiteral<Template> {
|
|
2653
|
+
core.$ZodTemplateLiteral<Template> {
|
|
2654
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2655
|
+
}
|
|
1871
2656
|
export const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral> = /*@__PURE__*/ core.$constructor(
|
|
1872
2657
|
"ZodTemplateLiteral",
|
|
1873
2658
|
(inst, def) => {
|
|
1874
2659
|
core.$ZodTemplateLiteral.init(inst, def);
|
|
1875
2660
|
ZodType.init(inst, def);
|
|
2661
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.templateLiteralProcessor(inst, ctx, json, params);
|
|
1876
2662
|
}
|
|
1877
2663
|
);
|
|
1878
2664
|
|
|
@@ -1891,11 +2677,13 @@ export function templateLiteral<const Parts extends core.$ZodTemplateLiteralPart
|
|
|
1891
2677
|
export interface ZodLazy<T extends core.SomeType = core.$ZodType>
|
|
1892
2678
|
extends _ZodType<core.$ZodLazyInternals<T>>,
|
|
1893
2679
|
core.$ZodLazy<T> {
|
|
2680
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1894
2681
|
unwrap(): T;
|
|
1895
2682
|
}
|
|
1896
2683
|
export const ZodLazy: core.$constructor<ZodLazy> = /*@__PURE__*/ core.$constructor("ZodLazy", (inst, def) => {
|
|
1897
2684
|
core.$ZodLazy.init(inst, def);
|
|
1898
2685
|
ZodType.init(inst, def);
|
|
2686
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.lazyProcessor(inst, ctx, json, params);
|
|
1899
2687
|
|
|
1900
2688
|
inst.unwrap = () => inst._zod.def.getter();
|
|
1901
2689
|
});
|
|
@@ -1911,11 +2699,13 @@ export function lazy<T extends core.SomeType>(getter: () => T): ZodLazy<T> {
|
|
|
1911
2699
|
export interface ZodPromise<T extends core.SomeType = core.$ZodType>
|
|
1912
2700
|
extends _ZodType<core.$ZodPromiseInternals<T>>,
|
|
1913
2701
|
core.$ZodPromise<T> {
|
|
2702
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1914
2703
|
unwrap(): T;
|
|
1915
2704
|
}
|
|
1916
2705
|
export const ZodPromise: core.$constructor<ZodPromise> = /*@__PURE__*/ core.$constructor("ZodPromise", (inst, def) => {
|
|
1917
2706
|
core.$ZodPromise.init(inst, def);
|
|
1918
2707
|
ZodType.init(inst, def);
|
|
2708
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.promiseProcessor(inst, ctx, json, params);
|
|
1919
2709
|
|
|
1920
2710
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
1921
2711
|
});
|
|
@@ -1927,13 +2717,83 @@ export function promise<T extends core.SomeType>(innerType: T): ZodPromise<T> {
|
|
|
1927
2717
|
}) as any;
|
|
1928
2718
|
}
|
|
1929
2719
|
|
|
2720
|
+
// ZodFunction
|
|
2721
|
+
export interface ZodFunction<
|
|
2722
|
+
Args extends core.$ZodFunctionIn = core.$ZodFunctionIn,
|
|
2723
|
+
Returns extends core.$ZodFunctionOut = core.$ZodFunctionOut,
|
|
2724
|
+
> extends _ZodType<core.$ZodFunctionInternals<Args, Returns>>,
|
|
2725
|
+
core.$ZodFunction<Args, Returns> {
|
|
2726
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2727
|
+
_def: core.$ZodFunctionDef<Args, Returns>;
|
|
2728
|
+
_input: core.$InferInnerFunctionType<Args, Returns>;
|
|
2729
|
+
_output: core.$InferOuterFunctionType<Args, Returns>;
|
|
2730
|
+
|
|
2731
|
+
input<const Items extends util.TupleItems, const Rest extends core.$ZodFunctionOut = core.$ZodFunctionOut>(
|
|
2732
|
+
args: Items,
|
|
2733
|
+
rest?: Rest
|
|
2734
|
+
): ZodFunction<core.$ZodTuple<Items, Rest>, Returns>;
|
|
2735
|
+
input<NewArgs extends core.$ZodFunctionIn>(args: NewArgs): ZodFunction<NewArgs, Returns>;
|
|
2736
|
+
input(...args: any[]): ZodFunction<any, Returns>;
|
|
2737
|
+
|
|
2738
|
+
output<NewReturns extends core.$ZodType>(output: NewReturns): ZodFunction<Args, NewReturns>;
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
export const ZodFunction: core.$constructor<ZodFunction> = /*@__PURE__*/ core.$constructor(
|
|
2742
|
+
"ZodFunction",
|
|
2743
|
+
(inst, def) => {
|
|
2744
|
+
core.$ZodFunction.init(inst, def);
|
|
2745
|
+
ZodType.init(inst, def);
|
|
2746
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.functionProcessor(inst, ctx, json, params);
|
|
2747
|
+
}
|
|
2748
|
+
);
|
|
2749
|
+
|
|
2750
|
+
export function _function(): ZodFunction;
|
|
2751
|
+
export function _function<const In extends ReadonlyArray<core.$ZodType>>(params: {
|
|
2752
|
+
input: In;
|
|
2753
|
+
}): ZodFunction<ZodTuple<In, null>, core.$ZodFunctionOut>;
|
|
2754
|
+
export function _function<
|
|
2755
|
+
const In extends ReadonlyArray<core.$ZodType>,
|
|
2756
|
+
const Out extends core.$ZodFunctionOut = core.$ZodFunctionOut,
|
|
2757
|
+
>(params: {
|
|
2758
|
+
input: In;
|
|
2759
|
+
output: Out;
|
|
2760
|
+
}): ZodFunction<ZodTuple<In, null>, Out>;
|
|
2761
|
+
export function _function<const In extends core.$ZodFunctionIn = core.$ZodFunctionIn>(params: {
|
|
2762
|
+
input: In;
|
|
2763
|
+
}): ZodFunction<In, core.$ZodFunctionOut>;
|
|
2764
|
+
export function _function<const Out extends core.$ZodFunctionOut = core.$ZodFunctionOut>(params: {
|
|
2765
|
+
output: Out;
|
|
2766
|
+
}): ZodFunction<core.$ZodFunctionIn, Out>;
|
|
2767
|
+
export function _function<
|
|
2768
|
+
In extends core.$ZodFunctionIn = core.$ZodFunctionIn,
|
|
2769
|
+
Out extends core.$ZodType = core.$ZodType,
|
|
2770
|
+
>(params?: {
|
|
2771
|
+
input: In;
|
|
2772
|
+
output: Out;
|
|
2773
|
+
}): ZodFunction<In, Out>;
|
|
2774
|
+
export function _function(params?: {
|
|
2775
|
+
output?: core.$ZodType;
|
|
2776
|
+
input?: core.$ZodFunctionArgs | Array<core.$ZodType>;
|
|
2777
|
+
}): ZodFunction {
|
|
2778
|
+
return new ZodFunction({
|
|
2779
|
+
type: "function",
|
|
2780
|
+
input: Array.isArray(params?.input) ? tuple(params?.input as any) : (params?.input ?? array(unknown())),
|
|
2781
|
+
output: params?.output ?? unknown(),
|
|
2782
|
+
});
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
export { _function as function };
|
|
2786
|
+
|
|
1930
2787
|
// ZodCustom
|
|
1931
2788
|
export interface ZodCustom<O = unknown, I = unknown>
|
|
1932
2789
|
extends _ZodType<core.$ZodCustomInternals<O, I>>,
|
|
1933
|
-
core.$ZodCustom<O, I> {
|
|
2790
|
+
core.$ZodCustom<O, I> {
|
|
2791
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2792
|
+
}
|
|
1934
2793
|
export const ZodCustom: core.$constructor<ZodCustom> = /*@__PURE__*/ core.$constructor("ZodCustom", (inst, def) => {
|
|
1935
2794
|
core.$ZodCustom.init(inst, def);
|
|
1936
2795
|
ZodType.init(inst, def);
|
|
2796
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.customProcessor(inst, ctx, json, params);
|
|
1937
2797
|
});
|
|
1938
2798
|
|
|
1939
2799
|
// custom checks
|
|
@@ -1962,61 +2822,81 @@ export function refine<T>(
|
|
|
1962
2822
|
}
|
|
1963
2823
|
|
|
1964
2824
|
// superRefine
|
|
1965
|
-
export function superRefine<T>(
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
} else {
|
|
1971
|
-
// for Zod 3 backwards compatibility
|
|
1972
|
-
const _issue: any = issue;
|
|
1973
|
-
if (_issue.fatal) _issue.continue = false;
|
|
1974
|
-
_issue.code ??= "custom";
|
|
1975
|
-
_issue.input ??= payload.value;
|
|
1976
|
-
_issue.inst ??= ch;
|
|
1977
|
-
_issue.continue ??= !ch._zod.def.abort;
|
|
1978
|
-
payload.issues.push(util.issue(_issue));
|
|
1979
|
-
}
|
|
1980
|
-
};
|
|
1981
|
-
|
|
1982
|
-
return fn(payload.value, payload as RefinementCtx<T>);
|
|
1983
|
-
});
|
|
1984
|
-
return ch;
|
|
2825
|
+
export function superRefine<T>(
|
|
2826
|
+
fn: (arg: T, payload: core.$RefinementCtx<T>) => void | Promise<void>,
|
|
2827
|
+
params?: core.$ZodSuperRefineParams
|
|
2828
|
+
): core.$ZodCheck<T> {
|
|
2829
|
+
return core._superRefine(fn, params);
|
|
1985
2830
|
}
|
|
1986
2831
|
|
|
2832
|
+
// Re-export describe and meta from core
|
|
2833
|
+
export const describe = core.describe;
|
|
2834
|
+
export const meta = core.meta;
|
|
2835
|
+
|
|
1987
2836
|
type ZodInstanceOfParams = core.Params<
|
|
1988
2837
|
ZodCustom,
|
|
1989
2838
|
core.$ZodIssueCustom,
|
|
1990
2839
|
"type" | "check" | "checks" | "fn" | "abort" | "error" | "params" | "path"
|
|
1991
2840
|
>;
|
|
2841
|
+
|
|
2842
|
+
// ZodInstanceOf
|
|
2843
|
+
export interface ZodInstanceOf<T = unknown> extends ZodCustom<T, T> {
|
|
2844
|
+
// the shape is keyed off the instance type, so keys autocomplete and a schema that can't accept the property's type is an error. Methods are excluded: every object literal inherits Object.prototype.toString, which would otherwise collide with the constraint's own toString entry and reject every shape.
|
|
2845
|
+
properties<Shape extends { [k in keyof T as T[k] extends Function ? never : k]?: core.$ZodType<unknown, T[k]> }>(
|
|
2846
|
+
shape: Shape,
|
|
2847
|
+
params?: string | core.$ZodCheckPropertiesParams
|
|
2848
|
+
): ZodInstanceOf<T & core.$InferObjectInput<Shape, {}>>;
|
|
2849
|
+
}
|
|
2850
|
+
export const ZodInstanceOf: core.$constructor<ZodInstanceOf> = /*@__PURE__*/ core.$constructor(
|
|
2851
|
+
"ZodInstanceOf",
|
|
2852
|
+
(inst, def) => {
|
|
2853
|
+
ZodCustom.init(inst, def);
|
|
2854
|
+
},
|
|
2855
|
+
{
|
|
2856
|
+
properties(shape: core.$ZodShape, params?: string | core.$ZodCheckPropertiesParams) {
|
|
2857
|
+
// asserts in place, so the narrowed output type is truthful without a wrapper
|
|
2858
|
+
return this.check(core._properties(shape, params)) as any;
|
|
2859
|
+
},
|
|
2860
|
+
}
|
|
2861
|
+
);
|
|
2862
|
+
|
|
1992
2863
|
function _instanceof<T extends typeof util.Class>(
|
|
1993
2864
|
cls: T,
|
|
1994
|
-
params: ZodInstanceOfParams = {
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
): ZodCustom<InstanceType<T>, InstanceType<T>> {
|
|
1998
|
-
const inst = new ZodCustom({
|
|
2865
|
+
params: ZodInstanceOfParams = {}
|
|
2866
|
+
): ZodInstanceOf<InstanceType<T>> {
|
|
2867
|
+
const inst = new ZodInstanceOf({
|
|
1999
2868
|
type: "custom",
|
|
2000
2869
|
check: "custom",
|
|
2001
|
-
fn: (data) => data instanceof cls,
|
|
2870
|
+
fn: (data: unknown) => data instanceof cls,
|
|
2002
2871
|
abort: true,
|
|
2003
2872
|
...(util.normalizeParams(params) as any),
|
|
2004
2873
|
});
|
|
2005
2874
|
inst._zod.bag.Class = cls;
|
|
2875
|
+
// Override check to emit invalid_type instead of custom
|
|
2876
|
+
inst._zod.check = (payload) => {
|
|
2877
|
+
if (!(payload.value instanceof cls)) {
|
|
2878
|
+
payload.issues.push({
|
|
2879
|
+
code: "invalid_type",
|
|
2880
|
+
expected: cls.name,
|
|
2881
|
+
input: payload.value,
|
|
2882
|
+
inst,
|
|
2883
|
+
path: [...(inst._zod.def.path ?? [])],
|
|
2884
|
+
});
|
|
2885
|
+
}
|
|
2886
|
+
};
|
|
2006
2887
|
return inst as any;
|
|
2007
2888
|
}
|
|
2008
2889
|
export { _instanceof as instanceof };
|
|
2009
2890
|
|
|
2010
2891
|
// stringbool
|
|
2011
|
-
export const stringbool: (
|
|
2012
|
-
|
|
2013
|
-
) =>
|
|
2892
|
+
export const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodCodec<ZodString, ZodBoolean> = (
|
|
2893
|
+
...args
|
|
2894
|
+
) =>
|
|
2014
2895
|
core._stringbool(
|
|
2015
2896
|
{
|
|
2016
|
-
|
|
2897
|
+
Codec: ZodCodec,
|
|
2017
2898
|
Boolean: ZodBoolean,
|
|
2018
2899
|
String: ZodString,
|
|
2019
|
-
Transform: ZodTransform,
|
|
2020
2900
|
},
|
|
2021
2901
|
...args
|
|
2022
2902
|
) as any;
|
|
@@ -2045,10 +2925,13 @@ export function json(params?: string | core.$ZodCustomParams): ZodJSONSchema {
|
|
|
2045
2925
|
|
|
2046
2926
|
// preprocess
|
|
2047
2927
|
|
|
2048
|
-
// /** @deprecated Use `z.pipe()` and `z.transform()` instead. */
|
|
2049
2928
|
export function preprocess<A, U extends core.SomeType, B = unknown>(
|
|
2050
|
-
fn: (arg: B, ctx: RefinementCtx) => A,
|
|
2929
|
+
fn: (arg: B, ctx: core.$RefinementCtx) => A,
|
|
2051
2930
|
schema: U
|
|
2052
|
-
):
|
|
2053
|
-
return
|
|
2931
|
+
): ZodPreprocess<U, B> {
|
|
2932
|
+
return new ZodPreprocess({
|
|
2933
|
+
type: "pipe",
|
|
2934
|
+
in: transform(fn as any) as any as core.$ZodTransform,
|
|
2935
|
+
out: schema as any as core.$ZodType,
|
|
2936
|
+
}) as any;
|
|
2054
2937
|
}
|