@wopee-io/wopee.wdio 5.2.5 → 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/README.md +14 -0
- 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.d.ts.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/debug/README.md +1 -1
- package/node_modules/debug/package.json +8 -4
- package/node_modules/debug/src/browser.js +2 -1
- package/node_modules/debug/src/common.js +57 -39
- 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/ms/index.js +1 -1
- package/node_modules/ms/license.md +1 -1
- package/node_modules/ms/package.json +5 -4
- package/node_modules/ms/readme.md +1 -2
- 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 +23 -16
- 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
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/CHANGELOG.md +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/LICENSE +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/MIGRATION_GUIDE.md +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/README.md +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/dist/axios.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/dist/axios.min.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/dist/axios.min.js.map +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/dist/browser/axios.cjs +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/dist/esm/axios.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/dist/esm/axios.min.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/dist/esm/axios.min.js.map +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/dist/node/axios.cjs +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/index.d.cts +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/index.d.ts +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/index.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/adapters/README.md +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/adapters/adapters.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/adapters/fetch.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/adapters/http.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/adapters/xhr.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/axios.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/cancel/CancelToken.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/cancel/CanceledError.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/cancel/isCancel.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/core/Axios.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/core/AxiosError.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/core/AxiosHeaders.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/core/InterceptorManager.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/core/README.md +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/core/buildFullPath.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/core/dispatchRequest.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/core/mergeConfig.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/core/methodList.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/core/setFormDataHeaders.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/core/settle.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/core/transformData.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/defaults/index.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/defaults/transitional.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/env/README.md +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/env/classes/FormData.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/env/data.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/AxiosTransformStream.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/AxiosURLSearchParams.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/Http2Sessions.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/HttpStatusCode.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/README.md +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/ZlibHeaderTransformStream.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/bind.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/buildURL.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/callbackify.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/combineURLs.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/composeSignals.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/cookies.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/deprecatedMethod.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/estimateDataURLDecodedBytes.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/formDataToJSON.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/formDataToStream.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/fromDataURI.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/isAbsoluteURL.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/isAxiosError.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/isURLSameOrigin.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/normalizeURLForProtocolCheck.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/null.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/parseHeaders.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/parseProtocol.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/progressEventReducer.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/readBlob.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/resolveConfig.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/sanitizeHeaderValue.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/shouldBypassProxy.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/speedometer.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/spread.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/throttle.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/toFormData.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/toURLEncodedForm.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/trackStream.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/helpers/validator.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/platform/browser/classes/Blob.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/platform/browser/classes/FormData.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/platform/browser/classes/URLSearchParams.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/platform/browser/index.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/platform/common/utils.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/platform/index.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/platform/node/classes/Buffer.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/platform/node/classes/FormData.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/platform/node/classes/URLSearchParams.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/platform/node/index.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/lib/utils.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk → axios}/node_modules/agent-base/README.md +0 -0
- /package/node_modules/{@autonomous-testing/sdk → axios}/node_modules/agent-base/dist/src/index.d.ts +0 -0
- /package/node_modules/{@autonomous-testing/sdk → axios}/node_modules/agent-base/dist/src/index.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk → axios}/node_modules/agent-base/dist/src/index.js.map +0 -0
- /package/node_modules/{@autonomous-testing/sdk → axios}/node_modules/agent-base/dist/src/promisify.d.ts +0 -0
- /package/node_modules/{@autonomous-testing/sdk → axios}/node_modules/agent-base/dist/src/promisify.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk → axios}/node_modules/agent-base/dist/src/promisify.js.map +0 -0
- /package/node_modules/{@autonomous-testing/sdk → axios}/node_modules/agent-base/package.json +0 -0
- /package/node_modules/{@autonomous-testing/sdk → axios}/node_modules/agent-base/src/index.ts +0 -0
- /package/node_modules/{@autonomous-testing/sdk → axios}/node_modules/agent-base/src/promisify.ts +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/node_modules/https-proxy-agent/README.md +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/node_modules/https-proxy-agent/dist/agent.d.ts +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/node_modules/https-proxy-agent/dist/agent.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/node_modules/https-proxy-agent/dist/agent.js.map +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/node_modules/https-proxy-agent/dist/index.d.ts +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/node_modules/https-proxy-agent/dist/index.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/node_modules/https-proxy-agent/dist/index.js.map +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/node_modules/https-proxy-agent/dist/parse-proxy-response.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/node_modules/https-proxy-agent/package.json +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/axios → axios}/package.json +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/form-data → form-data}/CHANGELOG.md +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/form-data → form-data}/License +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/form-data → form-data}/README.md +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/form-data → form-data}/index.d.ts +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/form-data → form-data}/lib/browser.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/form-data → form-data}/lib/form_data.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/form-data → form-data}/lib/populate.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/form-data → form-data}/package.json +0 -0
- /package/node_modules/{mime-types/node_modules/mime-db → mime-db}/HISTORY.md +0 -0
- /package/node_modules/{mime-types/node_modules/mime-db → mime-db}/LICENSE +0 -0
- /package/node_modules/{mime-types/node_modules/mime-db → mime-db}/README.md +0 -0
- /package/node_modules/{mime-types/node_modules/mime-db → mime-db}/db.json +0 -0
- /package/node_modules/{mime-types/node_modules/mime-db → mime-db}/index.js +0 -0
- /package/node_modules/{mime-types/node_modules/mime-db → mime-db}/package.json +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/proxy-from-env → proxy-from-env}/LICENSE +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/proxy-from-env → proxy-from-env}/README.md +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/proxy-from-env → proxy-from-env}/index.cjs +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/proxy-from-env → proxy-from-env}/index.js +0 -0
- /package/node_modules/{@autonomous-testing/sdk/node_modules/proxy-from-env → proxy-from-env}/package.json +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type * as checks from "./checks.js";
|
|
2
|
+
import { globalConfig } from "./core.js";
|
|
2
3
|
import type { $ZodConfig } from "./core.js";
|
|
3
4
|
import type * as errors from "./errors.js";
|
|
4
5
|
import type * as schemas from "./schemas.js";
|
|
@@ -20,6 +21,10 @@ export type JWTAlgorithm =
|
|
|
20
21
|
| "PS512"
|
|
21
22
|
| "EdDSA"
|
|
22
23
|
| (string & {});
|
|
24
|
+
|
|
25
|
+
export type HashAlgorithm = "md5" | "sha1" | "sha256" | "sha384" | "sha512";
|
|
26
|
+
export type HashEncoding = "hex" | "base64" | "base64url";
|
|
27
|
+
export type HashFormat = `${HashAlgorithm}_${HashEncoding}`;
|
|
23
28
|
export type IPVersion = "v4" | "v6";
|
|
24
29
|
export type MimeTypes =
|
|
25
30
|
| "application/json"
|
|
@@ -81,6 +86,58 @@ export type ParsedTypes =
|
|
|
81
86
|
export type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
|
|
82
87
|
export type AssertNotEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? false : true;
|
|
83
88
|
export type AssertExtends<T, U> = T extends U ? T : never;
|
|
89
|
+
type ToZodMismatch<T, S extends schemas.$ZodType> = {
|
|
90
|
+
"types do not match": {
|
|
91
|
+
expected: T;
|
|
92
|
+
received: S["_zod"]["output"];
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// Stays a `$ZodType` so it still satisfies the shape constraint, and carries a brand no real schema has so the offending property is the one TypeScript reports as unassignable.
|
|
97
|
+
type ToZodKeyMismatch<Expected, Received> = schemas.$ZodType & {
|
|
98
|
+
"types do not match": { expected: Expected; received: Received };
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// An enum reference and the union of exactly its members are mutually assignable but not identical, so `AssertEqual` alone rejects `z.enum(SomeEnum)` against a `SomeEnum` target. Unioning each side with a private dummy forces the union to be rebuilt, which collapses that one difference and nothing else — plain literals against an enum, member subsets, brands and `any` all still fail. The symbol is not exported, so no user type can smuggle it in and cancel a real difference.
|
|
102
|
+
declare const toZodDummy: unique symbol;
|
|
103
|
+
|
|
104
|
+
// Homomorphic, so `readonly` and optional modifiers survive the rebuild and only leaves are normalized. An intersection flattens here, which is why an intersection target and the flat object with the same keys match each other. A callable stops the walk because `keyof` a function is `never`, so mapping one would erase its signature and make every function compare equal.
|
|
105
|
+
type ToZodNormalize<T> = [T] extends [(...args: any[]) => any]
|
|
106
|
+
? T
|
|
107
|
+
: [T] extends [object]
|
|
108
|
+
? { [K in keyof T]: ToZodNormalize<T[K]> }
|
|
109
|
+
: T | typeof toZodDummy;
|
|
110
|
+
|
|
111
|
+
type ToZodEqual<Output, T> = AssertEqual<Output, T> extends true
|
|
112
|
+
? true
|
|
113
|
+
: IsAny<Output> extends true
|
|
114
|
+
? false
|
|
115
|
+
: IsAny<T> extends true
|
|
116
|
+
? false
|
|
117
|
+
: AssertEqual<ToZodNormalize<Output>, ToZodNormalize<T>>;
|
|
118
|
+
|
|
119
|
+
// Rebuilds the shape with a marker on each key that disagrees, so the diagnostic names the key instead of failing the whole schema at the top level. A key the target lacks reports `expected: never`; a key the schema lacks reports `received: never`.
|
|
120
|
+
type ToZodShape<Shape, T> = {
|
|
121
|
+
[K in keyof Shape]: Shape[K] extends schemas.$ZodType
|
|
122
|
+
? K extends keyof T
|
|
123
|
+
? ToZodEqual<Shape[K]["_zod"]["output"], T[K]> extends true
|
|
124
|
+
? Shape[K]
|
|
125
|
+
: ToZodKeyMismatch<T[K], Shape[K]["_zod"]["output"]>
|
|
126
|
+
: ToZodKeyMismatch<never, Shape[K]["_zod"]["output"]>
|
|
127
|
+
: Shape[K];
|
|
128
|
+
} & { [K in Exclude<keyof T, keyof Shape>]: ToZodKeyMismatch<T[K], never> };
|
|
129
|
+
|
|
130
|
+
// Forces the mapped type to display expanded, so the error prints the keys rather than the alias name.
|
|
131
|
+
type ToZodExpand<X> = { [K in keyof X]: X[K] } & {};
|
|
132
|
+
|
|
133
|
+
// Only localizes when a key is genuinely at fault. A whole-type difference the per-key walk cannot see — a `readonly` modifier, an intersection versus the flat object with the same keys — leaves every key agreeing, and reporting nothing there would silently accept what the top-level check rejected.
|
|
134
|
+
type ToZodTarget<S extends schemas.$ZodType, T> = S extends schemas.$ZodObject<infer Shape, infer Config>
|
|
135
|
+
? T extends object
|
|
136
|
+
? AssertEqual<ToZodExpand<ToZodShape<Shape, T>>, ToZodExpand<Shape>> extends true
|
|
137
|
+
? S & ToZodMismatch<T, S>
|
|
138
|
+
: schemas.$ZodObject<ToZodExpand<ToZodShape<Shape, T>>, Config>
|
|
139
|
+
: S & ToZodMismatch<T, S>
|
|
140
|
+
: S & ToZodMismatch<T, S>;
|
|
84
141
|
export type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
85
142
|
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
86
143
|
export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
|
|
@@ -90,6 +147,17 @@ export type MakeRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K
|
|
|
90
147
|
export type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
|
|
91
148
|
export type NoUndefined<T> = T extends undefined ? never : T;
|
|
92
149
|
export type Whatever = {} | undefined | null;
|
|
150
|
+
// literal inputs widen to their primitive so a property check over `"https:"` accepts a `string` property
|
|
151
|
+
export type Widen<T> = T extends string
|
|
152
|
+
? string
|
|
153
|
+
: T extends number
|
|
154
|
+
? number
|
|
155
|
+
: T extends boolean
|
|
156
|
+
? boolean
|
|
157
|
+
: T extends bigint
|
|
158
|
+
? bigint
|
|
159
|
+
: T;
|
|
160
|
+
|
|
93
161
|
export type LoosePartial<T extends object> = InexactPartial<T> & {
|
|
94
162
|
[k: string]: unknown;
|
|
95
163
|
};
|
|
@@ -123,6 +191,7 @@ export type Identity<T> = T;
|
|
|
123
191
|
export type Flatten<T> = Identity<{ [k in keyof T]: T[k] }>;
|
|
124
192
|
export type Mapped<T> = { [k in keyof T]: T[k] };
|
|
125
193
|
export type Prettify<T> = {
|
|
194
|
+
// @ts-ignore
|
|
126
195
|
[K in keyof T]: T[K];
|
|
127
196
|
} & {};
|
|
128
197
|
|
|
@@ -191,10 +260,16 @@ export function assertNotEqual<A, B>(val: AssertNotEqual<A, B>): AssertNotEqual<
|
|
|
191
260
|
return val;
|
|
192
261
|
}
|
|
193
262
|
|
|
263
|
+
export function toZod<T>(): <S extends schemas.$ZodType>(
|
|
264
|
+
schema: ToZodEqual<S["_zod"]["output"], T> extends true ? S : ToZodTarget<S, T>
|
|
265
|
+
) => S {
|
|
266
|
+
return (schema) => schema as any;
|
|
267
|
+
}
|
|
268
|
+
|
|
194
269
|
export function assertIs<T>(_arg: T): void {}
|
|
195
270
|
|
|
196
271
|
export function assertNever(_x: never): never {
|
|
197
|
-
throw new Error();
|
|
272
|
+
throw new Error("Unexpected value in exhaustive check");
|
|
198
273
|
}
|
|
199
274
|
export function assert<T>(_: any): asserts _ is T {}
|
|
200
275
|
|
|
@@ -215,18 +290,28 @@ export function jsonStringifyReplacer(_: string, value: any): any {
|
|
|
215
290
|
return value;
|
|
216
291
|
}
|
|
217
292
|
|
|
293
|
+
// the accessor lives on a shared prototype: an own accessor makes every box a dictionary-mode object (~360 B and a slow load per read against ~100 B and an inlined getter here)
|
|
294
|
+
class Cached<T> {
|
|
295
|
+
_getter: (() => T) | undefined;
|
|
296
|
+
_value: T | undefined;
|
|
297
|
+
|
|
298
|
+
constructor(getter: () => T) {
|
|
299
|
+
this._getter = getter;
|
|
300
|
+
this._value = undefined;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
get value(): T {
|
|
304
|
+
const getter = this._getter;
|
|
305
|
+
if (getter !== undefined) {
|
|
306
|
+
this._value = getter();
|
|
307
|
+
this._getter = undefined;
|
|
308
|
+
}
|
|
309
|
+
return this._value as T;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
218
313
|
export function cached<T>(getter: () => T): { value: T } {
|
|
219
|
-
|
|
220
|
-
return {
|
|
221
|
-
get value() {
|
|
222
|
-
if (!set) {
|
|
223
|
-
const value = getter();
|
|
224
|
-
Object.defineProperty(this, "value", { value });
|
|
225
|
-
return value;
|
|
226
|
-
}
|
|
227
|
-
throw new Error("cached value already set");
|
|
228
|
-
},
|
|
229
|
-
};
|
|
314
|
+
return new Cached(getter);
|
|
230
315
|
}
|
|
231
316
|
|
|
232
317
|
export function nullish(input: any): boolean {
|
|
@@ -240,24 +325,29 @@ export function cleanRegex(source: string): string {
|
|
|
240
325
|
}
|
|
241
326
|
|
|
242
327
|
export function floatSafeRemainder(val: number, step: number): number {
|
|
243
|
-
const
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
return
|
|
328
|
+
const ratio = val / step;
|
|
329
|
+
const roundedRatio = Math.round(ratio);
|
|
330
|
+
// `val` and `step` each round to a double before the division rounds again, so a true decimal multiple's quotient can sit up to 1.5 of these scaled epsilons from the integer. A 1x tolerance therefore rejected 2.03 as a multiple of 0.07; 4x covers the worst case with margin.
|
|
331
|
+
const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
332
|
+
if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
|
|
333
|
+
return ratio - roundedRatio;
|
|
249
334
|
}
|
|
250
335
|
|
|
336
|
+
const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
|
|
337
|
+
|
|
251
338
|
export function defineLazy<T, K extends keyof T>(object: T, key: K, getter: () => T[K]): void {
|
|
252
|
-
|
|
339
|
+
let value: T[K] | typeof EVALUATING | undefined = undefined;
|
|
253
340
|
Object.defineProperty(object, key, {
|
|
254
341
|
get() {
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
342
|
+
if (value === EVALUATING) {
|
|
343
|
+
// Circular reference detected, return undefined to break the cycle
|
|
344
|
+
return undefined as T[K];
|
|
345
|
+
}
|
|
346
|
+
if (value === undefined) {
|
|
347
|
+
value = EVALUATING;
|
|
348
|
+
value = getter();
|
|
259
349
|
}
|
|
260
|
-
|
|
350
|
+
return value;
|
|
261
351
|
},
|
|
262
352
|
set(v) {
|
|
263
353
|
Object.defineProperty(object, key, {
|
|
@@ -270,6 +360,10 @@ export function defineLazy<T, K extends keyof T>(object: T, key: K, getter: () =
|
|
|
270
360
|
});
|
|
271
361
|
}
|
|
272
362
|
|
|
363
|
+
export function objectClone(obj: object) {
|
|
364
|
+
return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
|
|
365
|
+
}
|
|
366
|
+
|
|
273
367
|
export function assignProp<T extends object, K extends PropertyKey>(
|
|
274
368
|
target: T,
|
|
275
369
|
prop: K,
|
|
@@ -283,6 +377,95 @@ export function assignProp<T extends object, K extends PropertyKey>(
|
|
|
283
377
|
});
|
|
284
378
|
}
|
|
285
379
|
|
|
380
|
+
/** A def's `shape` accessor, carrying whichever object it currently answers from. */
|
|
381
|
+
export interface ShapeGetter {
|
|
382
|
+
(): Record<PropertyKey, any>;
|
|
383
|
+
raw: Record<PropertyKey, any>;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
|
|
388
|
+
*
|
|
389
|
+
* Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.
|
|
390
|
+
*/
|
|
391
|
+
export function rawShape(def: any): Record<PropertyKey, any> | undefined {
|
|
392
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
393
|
+
return desc?.get ? (desc.get as ShapeGetter).raw : desc?.value;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// where a builder reads its source's keys and descriptors, resolving only a shape a def answers for itself. A shape resolves by object spread, so only its enumerable keys are ever part of it.
|
|
397
|
+
function sourceShape(schema: schemas.$ZodObject): Record<PropertyKey, any> {
|
|
398
|
+
return rawShape(schema._zod.def) ?? (schema._zod.def.shape as any);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// a key whose value is not settled yet, self-caching so every read after the first gets the same one
|
|
402
|
+
function deferProp(target: object, key: PropertyKey, getter: () => any): void {
|
|
403
|
+
Object.defineProperty(target, key, {
|
|
404
|
+
get(this: any) {
|
|
405
|
+
const value = getter();
|
|
406
|
+
assignProp(this, key as any, value);
|
|
407
|
+
return value;
|
|
408
|
+
},
|
|
409
|
+
enumerable: true,
|
|
410
|
+
configurable: true,
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Writes a settled key. A plain assignment is much cheaper than `defineProperty` and produces the same descriptor, but it runs whatever setter already answers to the key — an accessor this shape deferred, or an inherited one, which `__proto__` has on every object and prototype pollution can add for any name.
|
|
415
|
+
function putProp(target: any, key: PropertyKey, value: any): void {
|
|
416
|
+
if (key in target) assignProp(target, key as any, value);
|
|
417
|
+
else target[key] = value;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.
|
|
422
|
+
*
|
|
423
|
+
* A key the source has resolved is copied through now, so the derived shape states it outright and nothing has to resolve it to learn what it holds. A key the source still defers stays deferred, and reads back through the source's own `shape`, so it resolves once and both shapes get that one schema.
|
|
424
|
+
*/
|
|
425
|
+
function mirrorShape(
|
|
426
|
+
target: object,
|
|
427
|
+
source: schemas.$ZodObject,
|
|
428
|
+
keys: PropertyKey[],
|
|
429
|
+
wrap?: ((value: any, key: PropertyKey) => any) | null
|
|
430
|
+
): void {
|
|
431
|
+
const raw = sourceShape(source);
|
|
432
|
+
for (const key of keys) {
|
|
433
|
+
const desc = Object.getOwnPropertyDescriptor(raw, key)!;
|
|
434
|
+
if (!desc.enumerable) continue;
|
|
435
|
+
if (desc.get) {
|
|
436
|
+
deferProp(target, key, () => {
|
|
437
|
+
const value = (source._zod.def.shape as any)[key];
|
|
438
|
+
return wrap ? wrap(value, key) : value;
|
|
439
|
+
});
|
|
440
|
+
} else putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// same, for a plain shape a caller passed rather than a schema's
|
|
445
|
+
function mirrorProps(target: object, source: Record<PropertyKey, any>): void {
|
|
446
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
447
|
+
const desc = Object.getOwnPropertyDescriptor(source, key)!;
|
|
448
|
+
if (!desc.enumerable) continue;
|
|
449
|
+
if (desc.get) deferProp(target, key, () => source[key as any]);
|
|
450
|
+
else putProp(target, key, desc.value);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export function mergeDefs(...defs: Record<string, any>[]): any {
|
|
455
|
+
const mergedDescriptors: Record<string, PropertyDescriptor> = {};
|
|
456
|
+
|
|
457
|
+
for (const def of defs) {
|
|
458
|
+
const descriptors = Object.getOwnPropertyDescriptors(def);
|
|
459
|
+
Object.assign(mergedDescriptors, descriptors);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
return Object.defineProperties({}, mergedDescriptors);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export function cloneDef(schema: schemas.$ZodType): any {
|
|
466
|
+
return mergeDefs(schema._zod.def);
|
|
467
|
+
}
|
|
468
|
+
|
|
286
469
|
export function getElementAtPath(obj: any, path: (string | number)[] | null | undefined): any {
|
|
287
470
|
if (!path) return obj;
|
|
288
471
|
return path.reduce((acc, key) => acc?.[key], obj);
|
|
@@ -314,15 +497,30 @@ export function esc(str: string): string {
|
|
|
314
497
|
return JSON.stringify(str);
|
|
315
498
|
}
|
|
316
499
|
|
|
317
|
-
export
|
|
318
|
-
|
|
319
|
-
|
|
500
|
+
export function slugify(input: string): string {
|
|
501
|
+
return input
|
|
502
|
+
.toLowerCase()
|
|
503
|
+
.trim()
|
|
504
|
+
.replace(/[^\w\s-]/g, "")
|
|
505
|
+
.replace(/[\s_-]+/g, "-")
|
|
506
|
+
.replace(/^-+|-+$/g, "");
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
export const captureStackTrace: (targetObject: object, constructorOpt?: Function) => void = (
|
|
510
|
+
"captureStackTrace" in Error ? Error.captureStackTrace : (..._args: any[]) => {}
|
|
511
|
+
) as any;
|
|
320
512
|
|
|
321
513
|
export function isObject(data: any): data is Record<PropertyKey, unknown> {
|
|
322
514
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
323
515
|
}
|
|
324
516
|
|
|
325
|
-
export const allowsEval: { value: boolean } = cached(() => {
|
|
517
|
+
export const allowsEval: { value: boolean } = /* @__PURE__*/ cached(() => {
|
|
518
|
+
// Skip the probe under `jitless`: strict CSPs report the caught `new Function` as a `securitypolicyviolation` even though the throw is swallowed.
|
|
519
|
+
if (globalConfig.jitless) {
|
|
520
|
+
return false;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// @ts-ignore
|
|
326
524
|
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
|
327
525
|
return false;
|
|
328
526
|
}
|
|
@@ -343,6 +541,8 @@ export function isPlainObject(o: any): o is Record<PropertyKey, unknown> {
|
|
|
343
541
|
const ctor = o.constructor;
|
|
344
542
|
if (ctor === undefined) return true;
|
|
345
543
|
|
|
544
|
+
if (typeof ctor !== "function") return true;
|
|
545
|
+
|
|
346
546
|
// modified prototype
|
|
347
547
|
const prot = ctor.prototype;
|
|
348
548
|
if (isObject(prot) === false) return false;
|
|
@@ -355,6 +555,14 @@ export function isPlainObject(o: any): o is Record<PropertyKey, unknown> {
|
|
|
355
555
|
return true;
|
|
356
556
|
}
|
|
357
557
|
|
|
558
|
+
export function shallowClone(o: any): any {
|
|
559
|
+
if (isPlainObject(o)) return { ...o };
|
|
560
|
+
if (Array.isArray(o)) return [...o];
|
|
561
|
+
if (o instanceof Map) return new Map(o);
|
|
562
|
+
if (o instanceof Set) return new Set(o);
|
|
563
|
+
return o;
|
|
564
|
+
}
|
|
565
|
+
|
|
358
566
|
export function numKeys(data: any): number {
|
|
359
567
|
let keyCount = 0;
|
|
360
568
|
for (const key in data) {
|
|
@@ -409,6 +617,7 @@ export const getParsedType = (data: any): ParsedTypes => {
|
|
|
409
617
|
if (typeof Date !== "undefined" && data instanceof Date) {
|
|
410
618
|
return "date";
|
|
411
619
|
}
|
|
620
|
+
// @ts-ignore
|
|
412
621
|
if (typeof File !== "undefined" && data instanceof File) {
|
|
413
622
|
return "file";
|
|
414
623
|
}
|
|
@@ -419,8 +628,15 @@ export const getParsedType = (data: any): ParsedTypes => {
|
|
|
419
628
|
}
|
|
420
629
|
};
|
|
421
630
|
|
|
422
|
-
export const propertyKeyTypes: Set<string> = new Set(["string", "number", "symbol"]);
|
|
423
|
-
export const primitiveTypes: Set<string> = new Set([
|
|
631
|
+
export const propertyKeyTypes: Set<string> = /* @__PURE__*/ new Set(["string", "number", "symbol"]);
|
|
632
|
+
export const primitiveTypes: Set<string> = /* @__PURE__*/ new Set([
|
|
633
|
+
"string",
|
|
634
|
+
"number",
|
|
635
|
+
"bigint",
|
|
636
|
+
"boolean",
|
|
637
|
+
"symbol",
|
|
638
|
+
"undefined",
|
|
639
|
+
]);
|
|
424
640
|
export function escapeRegex(str: string): string {
|
|
425
641
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
426
642
|
}
|
|
@@ -509,7 +725,7 @@ export function stringifyPrimitive(value: any): string {
|
|
|
509
725
|
|
|
510
726
|
export function optionalKeys(shape: schemas.$ZodShape): string[] {
|
|
511
727
|
return Object.keys(shape).filter((k) => {
|
|
512
|
-
return shape[k]!._zod.optin
|
|
728
|
+
return shape[k]!._zod.optin !== undefined && shape[k]!._zod.optout === "optional";
|
|
513
729
|
});
|
|
514
730
|
}
|
|
515
731
|
|
|
@@ -521,13 +737,14 @@ export type FromCleanMap<T extends schemas.$ZodLooseShape> = {
|
|
|
521
737
|
[k in keyof T as k extends `?${infer K}` ? K : k extends `${infer K}?` ? K : k]: k;
|
|
522
738
|
};
|
|
523
739
|
|
|
524
|
-
|
|
740
|
+
// Wrapped in a `@__PURE__` IIFE: esbuild never tree-shakes a top-level initializer that contains a member access on `Number`, so the bare object literal survived into every bundle.
|
|
741
|
+
export const NUMBER_FORMAT_RANGES: Record<checks.$ZodNumberFormats, [number, number]> = /*@__PURE__*/ (() => ({
|
|
525
742
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
526
743
|
int32: [-2147483648, 2147483647],
|
|
527
744
|
uint32: [0, 4294967295],
|
|
528
745
|
float32: [-3.4028234663852886e38, 3.4028234663852886e38],
|
|
529
746
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE],
|
|
530
|
-
};
|
|
747
|
+
}))();
|
|
531
748
|
|
|
532
749
|
export const BIGINT_FORMAT_RANGES: Record<checks.$ZodBigIntFormats, [bigint, bigint]> = {
|
|
533
750
|
int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
|
|
@@ -535,112 +752,135 @@ export const BIGINT_FORMAT_RANGES: Record<checks.$ZodBigIntFormats, [bigint, big
|
|
|
535
752
|
};
|
|
536
753
|
|
|
537
754
|
export function pick(schema: schemas.$ZodObject, mask: Record<string, unknown>): any {
|
|
755
|
+
const currDef = schema._zod.def;
|
|
756
|
+
|
|
757
|
+
const checks = currDef.checks;
|
|
758
|
+
const hasChecks = checks && checks.length > 0;
|
|
759
|
+
if (hasChecks) {
|
|
760
|
+
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
761
|
+
}
|
|
762
|
+
|
|
538
763
|
const newShape: Writeable<schemas.$ZodShape> = {};
|
|
539
|
-
|
|
764
|
+
mirrorShape(newShape, schema, maskedKeys(schema, mask));
|
|
540
765
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
544
|
-
}
|
|
545
|
-
if (!mask[key]) continue;
|
|
766
|
+
return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] })) as any;
|
|
767
|
+
}
|
|
546
768
|
|
|
547
|
-
|
|
548
|
-
|
|
769
|
+
// the mask keys that select something, checked against the source's shape without resolving it
|
|
770
|
+
function maskedKeys(schema: schemas.$ZodObject, mask: object): PropertyKey[] {
|
|
771
|
+
const raw = sourceShape(schema);
|
|
772
|
+
const keys: PropertyKey[] = [];
|
|
773
|
+
// `for...in` skips symbols, so a symbol in the mask would select nothing
|
|
774
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
775
|
+
if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {
|
|
776
|
+
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
777
|
+
}
|
|
778
|
+
if ((mask as any)[key]) keys.push(key);
|
|
549
779
|
}
|
|
550
|
-
|
|
551
|
-
return clone(schema, {
|
|
552
|
-
...schema._zod.def,
|
|
553
|
-
shape: newShape,
|
|
554
|
-
checks: [],
|
|
555
|
-
}) as any;
|
|
780
|
+
return keys;
|
|
556
781
|
}
|
|
557
782
|
|
|
558
783
|
export function omit(schema: schemas.$ZodObject, mask: object): any {
|
|
559
|
-
const
|
|
560
|
-
const currDef = schema._zod.def; //.shape;
|
|
561
|
-
for (const key in mask) {
|
|
562
|
-
if (!(key in currDef.shape)) {
|
|
563
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
564
|
-
}
|
|
565
|
-
if (!(mask as any)[key]) continue;
|
|
784
|
+
const currDef = schema._zod.def;
|
|
566
785
|
|
|
567
|
-
|
|
786
|
+
const checks = currDef.checks;
|
|
787
|
+
const hasChecks = checks && checks.length > 0;
|
|
788
|
+
if (hasChecks) {
|
|
789
|
+
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
568
790
|
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
791
|
+
|
|
792
|
+
const omitted = new Set(maskedKeys(schema, mask));
|
|
793
|
+
const newShape: Writeable<schemas.$ZodShape> = {};
|
|
794
|
+
mirrorShape(
|
|
795
|
+
newShape,
|
|
796
|
+
schema,
|
|
797
|
+
Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key))
|
|
798
|
+
);
|
|
799
|
+
|
|
800
|
+
return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
|
|
574
801
|
}
|
|
575
802
|
|
|
576
803
|
export function extend(schema: schemas.$ZodObject, shape: schemas.$ZodShape): any {
|
|
577
804
|
if (!isPlainObject(shape)) {
|
|
578
805
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
579
806
|
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
807
|
+
|
|
808
|
+
const checks = schema._zod.def.checks;
|
|
809
|
+
const hasChecks = checks && checks.length > 0;
|
|
810
|
+
if (hasChecks) {
|
|
811
|
+
// Only throw if new shape overlaps with existing shape. Use getOwnPropertyDescriptor to check key existence without accessing values
|
|
812
|
+
const existingShape = sourceShape(schema);
|
|
813
|
+
for (const key of Reflect.ownKeys(shape)) {
|
|
814
|
+
if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
|
|
815
|
+
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) })) as any;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
// the source's keys, then the caller's overlaid on top
|
|
824
|
+
function extended(schema: schemas.$ZodObject, shape: schemas.$ZodShape): schemas.$ZodShape {
|
|
825
|
+
const newShape: Writeable<schemas.$ZodShape> = {};
|
|
826
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
|
|
827
|
+
mirrorProps(newShape, shape);
|
|
828
|
+
return newShape;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
export function safeExtend(schema: schemas.$ZodObject, shape: schemas.$ZodShape): any {
|
|
832
|
+
if (!isPlainObject(shape)) {
|
|
833
|
+
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
834
|
+
}
|
|
835
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) })) as any;
|
|
590
836
|
}
|
|
591
837
|
|
|
592
838
|
export function merge(a: schemas.$ZodObject, b: schemas.$ZodObject): any {
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
839
|
+
if (!b?._zod?.def) {
|
|
840
|
+
throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
841
|
+
}
|
|
842
|
+
if (a._zod.def.checks?.length) {
|
|
843
|
+
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
844
|
+
}
|
|
845
|
+
const newShape: Writeable<schemas.$ZodShape> = {};
|
|
846
|
+
mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
|
|
847
|
+
mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
|
|
848
|
+
|
|
849
|
+
const def = mergeDefs(a._zod.def, {
|
|
850
|
+
shape: newShape,
|
|
851
|
+
get catchall() {
|
|
852
|
+
return b._zod.def.catchall;
|
|
599
853
|
},
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
854
|
+
checks: b._zod.def.checks ?? [],
|
|
855
|
+
});
|
|
856
|
+
|
|
857
|
+
return clone(a, def) as any;
|
|
603
858
|
}
|
|
604
859
|
|
|
605
860
|
export function partial(
|
|
606
861
|
Class: SchemaClass<schemas.$ZodOptional> | null,
|
|
607
862
|
schema: schemas.$ZodObject,
|
|
608
|
-
mask: object | undefined
|
|
863
|
+
mask: object | undefined,
|
|
864
|
+
name = "partial"
|
|
609
865
|
): any {
|
|
610
|
-
const
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
if (
|
|
614
|
-
|
|
615
|
-
if (!(key in oldShape)) {
|
|
616
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
617
|
-
}
|
|
618
|
-
if (!(mask as any)[key]) continue;
|
|
619
|
-
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
620
|
-
shape[key] = Class
|
|
621
|
-
? new Class({
|
|
622
|
-
type: "optional",
|
|
623
|
-
innerType: oldShape[key]!,
|
|
624
|
-
})
|
|
625
|
-
: oldShape[key]!;
|
|
626
|
-
}
|
|
627
|
-
} else {
|
|
628
|
-
for (const key in oldShape) {
|
|
629
|
-
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
630
|
-
shape[key] = Class
|
|
631
|
-
? new Class({
|
|
632
|
-
type: "optional",
|
|
633
|
-
innerType: oldShape[key]!,
|
|
634
|
-
})
|
|
635
|
-
: oldShape[key]!;
|
|
636
|
-
}
|
|
866
|
+
const currDef = schema._zod.def;
|
|
867
|
+
const checks = currDef.checks;
|
|
868
|
+
const hasChecks = checks && checks.length > 0;
|
|
869
|
+
if (hasChecks) {
|
|
870
|
+
throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
637
871
|
}
|
|
638
872
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
873
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;
|
|
874
|
+
const newShape: Writeable<schemas.$ZodShape> = {};
|
|
875
|
+
mirrorShape(
|
|
876
|
+
newShape,
|
|
877
|
+
schema,
|
|
878
|
+
Reflect.ownKeys(sourceShape(schema)),
|
|
879
|
+
Class &&
|
|
880
|
+
((value, key) => (selected && !selected.has(key) ? value : new Class({ type: "optional", innerType: value })))
|
|
881
|
+
);
|
|
882
|
+
|
|
883
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape, checks: [] })) as any;
|
|
644
884
|
}
|
|
645
885
|
|
|
646
886
|
export function required(
|
|
@@ -648,44 +888,36 @@ export function required(
|
|
|
648
888
|
schema: schemas.$ZodObject,
|
|
649
889
|
mask: object | undefined
|
|
650
890
|
): any {
|
|
651
|
-
const
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
658
|
-
}
|
|
659
|
-
if (!(mask as any)[key]) continue;
|
|
660
|
-
// overwrite with non-optional
|
|
661
|
-
shape[key] = new Class({
|
|
662
|
-
type: "nonoptional",
|
|
663
|
-
innerType: oldShape[key]!,
|
|
664
|
-
});
|
|
665
|
-
}
|
|
666
|
-
} else {
|
|
667
|
-
for (const key in oldShape) {
|
|
668
|
-
// overwrite with non-optional
|
|
669
|
-
shape[key] = new Class({
|
|
670
|
-
type: "nonoptional",
|
|
671
|
-
innerType: oldShape[key]!,
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
}
|
|
891
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;
|
|
892
|
+
const newShape: Writeable<schemas.$ZodShape> = {};
|
|
893
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) =>
|
|
894
|
+
// overwrite with non-optional
|
|
895
|
+
selected && !selected.has(key) ? value : new Class({ type: "nonoptional", innerType: value })
|
|
896
|
+
);
|
|
675
897
|
|
|
676
|
-
return clone(schema, {
|
|
677
|
-
...schema._zod.def,
|
|
678
|
-
shape,
|
|
679
|
-
// optional: [],
|
|
680
|
-
checks: [],
|
|
681
|
-
}) as any;
|
|
898
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape })) as any;
|
|
682
899
|
}
|
|
683
900
|
|
|
684
901
|
export type Constructor<T, Def extends any[] = any[]> = new (...args: Def) => T;
|
|
685
902
|
|
|
903
|
+
// invalid_type | too_big | too_small | invalid_format | not_multiple_of | unrecognized_keys | invalid_union | invalid_key | invalid_element | invalid_value | custom
|
|
686
904
|
export function aborted(x: schemas.ParsePayload, startIndex = 0): boolean {
|
|
905
|
+
if (x.aborted === true) return true;
|
|
906
|
+
for (let i = startIndex; i < x.issues.length; i++) {
|
|
907
|
+
if (x.issues[i]?.continue !== true) {
|
|
908
|
+
return true;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
return false;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
// Checks for explicit abort (continue === false), as opposed to implicit abort (continue === undefined). Used to respect `abort: true` in .refine() even for checks that have a `when` function.
|
|
915
|
+
export function explicitlyAborted(x: schemas.ParsePayload, startIndex = 0): boolean {
|
|
916
|
+
if (x.aborted === true) return true;
|
|
687
917
|
for (let i = startIndex; i < x.issues.length; i++) {
|
|
688
|
-
if (x.issues[i]?.continue
|
|
918
|
+
if (x.issues[i]?.continue === false) {
|
|
919
|
+
return true;
|
|
920
|
+
}
|
|
689
921
|
}
|
|
690
922
|
return false;
|
|
691
923
|
}
|
|
@@ -702,47 +934,116 @@ export function unwrapMessage(message: string | { message: string } | undefined
|
|
|
702
934
|
return typeof message === "string" ? message : message?.message;
|
|
703
935
|
}
|
|
704
936
|
|
|
937
|
+
/* A check holds no link back to the schema it is attached to — the same check instance is shared by every clone of that schema — so the owner is stamped onto the issues a check just raised, at the only point where both are in scope. Runs on the failure path only; `start` is the issue count from before the check ran. */
|
|
938
|
+
/** The leading size checks of `defChecks` that set an upper bound, each paired with it. */
|
|
939
|
+
export function sizeCaps(defChecks: checks.$ZodCheck<never>[] | undefined): [number, checks.$ZodCheck<never>][] {
|
|
940
|
+
const caps: [number, checks.$ZodCheck<never>][] = [];
|
|
941
|
+
for (const ch of defChecks ?? []) {
|
|
942
|
+
const d = ch._zod.def as any;
|
|
943
|
+
// a later check may rewrite the value
|
|
944
|
+
if (!/_(length|size)$|_equals$/.test(d.check)) break;
|
|
945
|
+
const max = d.maximum ?? d.length ?? d.size;
|
|
946
|
+
if (max >= 0) caps.push([max, ch]);
|
|
947
|
+
}
|
|
948
|
+
return caps;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
export function attachSchema(issues: errors.$ZodRawIssue[], start: number, inst: schemas.$ZodType): void {
|
|
952
|
+
for (let i = start; i < issues.length; i++) {
|
|
953
|
+
(issues[i] as any).schema ??= inst;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
|
|
705
957
|
export function finalizeIssue(
|
|
706
958
|
iss: errors.$ZodRawIssue,
|
|
707
959
|
ctx: schemas.ParseContextInternal | undefined,
|
|
708
960
|
config: $ZodConfig
|
|
709
961
|
): errors.$ZodIssue {
|
|
710
|
-
|
|
962
|
+
// A schema that raised an issue itself owns it outright, and outranks any stamp an enclosing check left in `attachSchema`. String formats and z.custom() are schema and check at once, so when they act as a check they defer to that stamp instead.
|
|
963
|
+
const traits: Set<string> | undefined = (iss.inst as any)?._zod?.traits;
|
|
964
|
+
if (traits?.has("$ZodType")) {
|
|
965
|
+
if (traits.has("$ZodCheck")) (iss as any).schema ??= iss.inst;
|
|
966
|
+
else (iss as any).schema = iss.inst;
|
|
967
|
+
}
|
|
711
968
|
|
|
712
|
-
//
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
969
|
+
// Decreasing specificity, first map to return a message wins. `inst` is whatever raised the issue, so a check's own map outranks the owning schema's.
|
|
970
|
+
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : undefined;
|
|
971
|
+
const message = iss.message
|
|
972
|
+
? iss.message
|
|
973
|
+
: (unwrapMessage(iss.inst?._zod.def?.error?.(iss as never)) ??
|
|
974
|
+
unwrapMessage(schemaError?.(iss as never)) ??
|
|
716
975
|
unwrapMessage(ctx?.error?.(iss as never)) ??
|
|
717
976
|
unwrapMessage(config.customError?.(iss)) ??
|
|
718
977
|
unwrapMessage(config.localeError?.(iss)) ??
|
|
719
|
-
"Invalid input";
|
|
720
|
-
(full as any).message = message;
|
|
721
|
-
}
|
|
978
|
+
"Invalid input");
|
|
722
979
|
|
|
723
|
-
//
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
980
|
+
// an explicit own-key copy beats object rest with excluded keys, which v8 routes through a generic runtime call; Object.keys rather than for-in so an issue pushed with a prototype does not leak inherited keys, and an own __proto__ key is dropped rather than assigned through the setter
|
|
981
|
+
const full: any = {};
|
|
982
|
+
for (const k of Object.keys(iss)) {
|
|
983
|
+
if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__") continue;
|
|
984
|
+
full[k] = (iss as any)[k];
|
|
985
|
+
}
|
|
986
|
+
full.path ??= [];
|
|
987
|
+
full.message = message;
|
|
988
|
+
if (ctx?.reportInput) {
|
|
989
|
+
full.input = iss.input;
|
|
728
990
|
}
|
|
729
|
-
|
|
730
991
|
return full;
|
|
731
992
|
}
|
|
732
993
|
|
|
733
994
|
export function getSizableOrigin(input: any): "set" | "map" | "file" | "unknown" {
|
|
734
995
|
if (input instanceof Set) return "set";
|
|
735
996
|
if (input instanceof Map) return "map";
|
|
997
|
+
// @ts-ignore
|
|
736
998
|
if (input instanceof File) return "file";
|
|
737
999
|
return "unknown";
|
|
738
1000
|
}
|
|
739
1001
|
|
|
1002
|
+
const highSurrogate = /[\uD800-\uDBFF]/;
|
|
1003
|
+
|
|
1004
|
+
// Code points in `str`: a surrogate pair counts once, a lone surrogate as itself. Hand-rolled because the string iterator allocates and runs ~250x slower on this path; the regex probe exits ~50x quicker for a string with no astral characters.
|
|
1005
|
+
export function codePointLength(str: string): number {
|
|
1006
|
+
const units = str.length;
|
|
1007
|
+
if (!highSurrogate.test(str)) return units;
|
|
1008
|
+
let count = units;
|
|
1009
|
+
for (let i = 0; i < units - 1; i++) {
|
|
1010
|
+
if ((str.charCodeAt(i) & 0xfc00) === 0xd800 && (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {
|
|
1011
|
+
count--;
|
|
1012
|
+
i++;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
return count;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
740
1018
|
export function getLengthableOrigin(input: any): "array" | "string" | "unknown" {
|
|
741
1019
|
if (Array.isArray(input)) return "array";
|
|
742
1020
|
if (typeof input === "string") return "string";
|
|
743
1021
|
return "unknown";
|
|
744
1022
|
}
|
|
745
1023
|
|
|
1024
|
+
export function parsedType(data: unknown): errors.$ZodInvalidTypeExpected {
|
|
1025
|
+
const t = typeof data;
|
|
1026
|
+
switch (t) {
|
|
1027
|
+
case "number": {
|
|
1028
|
+
return Number.isNaN(data) ? "nan" : "number";
|
|
1029
|
+
}
|
|
1030
|
+
case "object": {
|
|
1031
|
+
if (data === null) {
|
|
1032
|
+
return "null";
|
|
1033
|
+
}
|
|
1034
|
+
if (Array.isArray(data)) {
|
|
1035
|
+
return "array";
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
const obj = data as object;
|
|
1039
|
+
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) {
|
|
1040
|
+
return (obj.constructor as { name: string }).name;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
return t;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
746
1047
|
////////// REFINES //////////
|
|
747
1048
|
export function issue(_iss: string, input: any, inst: any): errors.$ZodRawIssue;
|
|
748
1049
|
export function issue(_iss: errors.$ZodRawIssue): errors.$ZodRawIssue;
|
|
@@ -769,7 +1070,224 @@ export function cleanEnum(obj: Record<string, EnumValue>): EnumValue[] {
|
|
|
769
1070
|
.map((el) => el[1]);
|
|
770
1071
|
}
|
|
771
1072
|
|
|
1073
|
+
// Codec utility functions
|
|
1074
|
+
export function base64ToUint8Array(base64: string): InstanceType<typeof Uint8Array> {
|
|
1075
|
+
const binaryString = atob(base64);
|
|
1076
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
1077
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
1078
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
1079
|
+
}
|
|
1080
|
+
return bytes;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
export function uint8ArrayToBase64(bytes: Uint8Array): string {
|
|
1084
|
+
let binaryString = "";
|
|
1085
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
1086
|
+
binaryString += String.fromCharCode(bytes[i]);
|
|
1087
|
+
}
|
|
1088
|
+
return btoa(binaryString);
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
export function base64urlToUint8Array(base64url: string): InstanceType<typeof Uint8Array> {
|
|
1092
|
+
const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/");
|
|
1093
|
+
const padding = "=".repeat((4 - (base64.length % 4)) % 4);
|
|
1094
|
+
return base64ToUint8Array(base64 + padding);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
export function uint8ArrayToBase64url(bytes: Uint8Array): string {
|
|
1098
|
+
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
export function hexToUint8Array(hex: string): InstanceType<typeof Uint8Array> {
|
|
1102
|
+
const cleanHex = hex.replace(/^0x/, "");
|
|
1103
|
+
if (cleanHex.length % 2 !== 0) {
|
|
1104
|
+
throw new Error("Invalid hex string length");
|
|
1105
|
+
}
|
|
1106
|
+
const bytes = new Uint8Array(cleanHex.length / 2);
|
|
1107
|
+
for (let i = 0; i < cleanHex.length; i += 2) {
|
|
1108
|
+
bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
|
|
1109
|
+
}
|
|
1110
|
+
return bytes;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
export function uint8ArrayToHex(bytes: Uint8Array): string {
|
|
1114
|
+
return Array.from(bytes)
|
|
1115
|
+
.map((b) => b.toString(16).padStart(2, "0"))
|
|
1116
|
+
.join("");
|
|
1117
|
+
}
|
|
1118
|
+
|
|
772
1119
|
// instanceof
|
|
773
1120
|
export abstract class Class {
|
|
774
1121
|
constructor(..._args: any[]) {}
|
|
775
1122
|
}
|
|
1123
|
+
|
|
1124
|
+
////////// PROTOTYPE INSTALLERS //////////
|
|
1125
|
+
//
|
|
1126
|
+
// Members live on the prototype and materialize per instance on first read, which keeps own-property count under the step where V8 stops using inline slots. Changing anything here means re-measuring runtime, memory and bundle size together — see "The three axes" in AGENTS.md.
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* Installs a trait's members on its prototype. Each value builds that member for the instance on first read; the built value shadows the accessor as an own property, so a detached `const { parse } = schema` keeps working.
|
|
1130
|
+
*
|
|
1131
|
+
* Call this from a `proto` initializer, which runs once per prototype — never per instance.
|
|
1132
|
+
*/
|
|
1133
|
+
export function members(proto: object, table: object): void {
|
|
1134
|
+
for (const key in table) {
|
|
1135
|
+
const desc = Object.getOwnPropertyDescriptor(table, key)!;
|
|
1136
|
+
// a getter installs as written, so it stays live: `description` reads through to the registry on every access. not enumerable: an object literal's is, and a prototype member never was
|
|
1137
|
+
if (desc.get) Object.defineProperty(proto, key, { ...desc, enumerable: false });
|
|
1138
|
+
// a method materializes bound on first read, which is what keeps a detached member working: `const opt = schema.optional; opt()`
|
|
1139
|
+
else defineBound(proto, key, desc.value);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
/** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
|
|
1144
|
+
export function own<T>(inst: object, key: PropertyKey, value: T, enumerable = true): T {
|
|
1145
|
+
Object.defineProperty(inst, key, { configurable: true, writable: true, enumerable, value });
|
|
1146
|
+
return value;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
/** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
|
|
1150
|
+
export function hide<T>(inst: object, key: PropertyKey, value: T): T {
|
|
1151
|
+
return own(inst, key, value, false);
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
/** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */
|
|
1155
|
+
export /*@__NO_SIDE_EFFECTS__*/ function derived<T>(
|
|
1156
|
+
computes: { [K in keyof T]?: (inst: T) => T[K] },
|
|
1157
|
+
table: ProtoOf<T>
|
|
1158
|
+
): ProtoOf<T> {
|
|
1159
|
+
for (const key in computes) {
|
|
1160
|
+
const compute = computes[key]!;
|
|
1161
|
+
// an object literal's accessor is configurable and enumerable, and `members` copies the descriptor as written
|
|
1162
|
+
Object.defineProperty(table, key, {
|
|
1163
|
+
configurable: true,
|
|
1164
|
+
enumerable: true,
|
|
1165
|
+
get(this: T) {
|
|
1166
|
+
return own(this as object, key, compute(this));
|
|
1167
|
+
},
|
|
1168
|
+
set(this: T, value: T[typeof key]) {
|
|
1169
|
+
own(this as object, key, value);
|
|
1170
|
+
},
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
return table;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
function defineBound(proto: object, key: PropertyKey, fn: AnyFunc): void {
|
|
1177
|
+
Object.defineProperty(proto, key, {
|
|
1178
|
+
configurable: true,
|
|
1179
|
+
get(this: any) {
|
|
1180
|
+
// vitest's spyOn calls a prototype getter bare to find the function it wraps, so a nullish receiver answers the raw method
|
|
1181
|
+
return this == null ? fn : own(this, key, fn.bind(this));
|
|
1182
|
+
},
|
|
1183
|
+
set(this: any, value: unknown) {
|
|
1184
|
+
own(this, key, value);
|
|
1185
|
+
},
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
|
|
1190
|
+
function claim(inst: object, sentinel: string): object | undefined {
|
|
1191
|
+
const proto = Object.getPrototypeOf(inst);
|
|
1192
|
+
// Runs on every construction, so `in` rather than the costlier `hasOwnProperty.call`. Sentinels are keys the group itself defines.
|
|
1193
|
+
return sentinel in proto ? undefined : proto;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
/** A trait's prototype members: a partial view of its own interface, with `this` typed as the instance. */
|
|
1197
|
+
export type ProtoOf<T> = {
|
|
1198
|
+
// `infer R` resolves a polymorphic `this` return type to `T`, which a method written here can actually produce
|
|
1199
|
+
[K in keyof T]?: (T[K] extends (...args: infer A) => infer R ? (...args: A) => R : T[K]) | undefined;
|
|
1200
|
+
} & ThisType<T>;
|
|
1201
|
+
|
|
1202
|
+
// The internals whose init chain is installing. A second call for the same one is a derived constructor overriding its base, so it must not construct another schema in between or the override is dropped.
|
|
1203
|
+
let installing: object | undefined;
|
|
1204
|
+
|
|
1205
|
+
// Set while a getter is running, so a value that resolved through a recursion break is not memoized. One shared descriptor shadows the key for the duration, which costs no per-key allocation.
|
|
1206
|
+
let broke = false;
|
|
1207
|
+
const breaker: PropertyDescriptor = {
|
|
1208
|
+
configurable: true,
|
|
1209
|
+
get() {
|
|
1210
|
+
broke = true;
|
|
1211
|
+
return undefined;
|
|
1212
|
+
},
|
|
1213
|
+
};
|
|
1214
|
+
|
|
1215
|
+
/**
|
|
1216
|
+
* Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
|
|
1217
|
+
* constructor, computed from the internals object itself and cached there on
|
|
1218
|
+
* first read. One accessor per constructor rather than one per instance.
|
|
1219
|
+
*/
|
|
1220
|
+
export function defineLazyInternal<T extends { _zod: any }>(
|
|
1221
|
+
inst: T,
|
|
1222
|
+
key: string,
|
|
1223
|
+
compute: (zod: T["_zod"]) => unknown
|
|
1224
|
+
): void {
|
|
1225
|
+
const proto = Object.getPrototypeOf(inst._zod);
|
|
1226
|
+
if (key in proto && installing !== inst._zod) {
|
|
1227
|
+
// A repeat construction: everything is installed already. Cleared here so the reference is not held past the first construction of every type.
|
|
1228
|
+
installing = undefined;
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
installing = inst._zod;
|
|
1232
|
+
|
|
1233
|
+
Object.defineProperty(proto, key, {
|
|
1234
|
+
configurable: true,
|
|
1235
|
+
get(this: any) {
|
|
1236
|
+
// Shadowed before computing so a re-entrant read from a recursive schema resolves to undefined instead of running the getter again.
|
|
1237
|
+
Object.defineProperty(this, key, breaker);
|
|
1238
|
+
const outer = broke;
|
|
1239
|
+
broke = false;
|
|
1240
|
+
try {
|
|
1241
|
+
const value = compute(this);
|
|
1242
|
+
// A result that resolved through a recursion break is recomputed once the graph is complete; everything else memoizes, undefined included.
|
|
1243
|
+
if (broke) delete this[key];
|
|
1244
|
+
else Object.defineProperty(this, key, { configurable: true, writable: true, value });
|
|
1245
|
+
broke = broke || outer;
|
|
1246
|
+
return value;
|
|
1247
|
+
} catch (err) {
|
|
1248
|
+
// A compute that threw memoizes nothing, so a later read runs it again and fails the same way. The shadow goes with it, since leaving it installed would answer undefined for every later read.
|
|
1249
|
+
delete this[key];
|
|
1250
|
+
broke = broke || outer;
|
|
1251
|
+
throw err;
|
|
1252
|
+
}
|
|
1253
|
+
},
|
|
1254
|
+
set(this: any, value: unknown) {
|
|
1255
|
+
Object.defineProperty(this, key, { configurable: true, writable: true, value });
|
|
1256
|
+
},
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
|
|
1262
|
+
* data property. One accessor per constructor rather than one per instance, because an own accessor
|
|
1263
|
+
* puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
|
|
1264
|
+
*/
|
|
1265
|
+
export function installLazyProp(inst: object, key: string, make: (self: any) => unknown, enumerable: boolean): void {
|
|
1266
|
+
const proto = claim(inst, key);
|
|
1267
|
+
if (!proto) return;
|
|
1268
|
+
Object.defineProperty(proto, key, {
|
|
1269
|
+
configurable: true,
|
|
1270
|
+
get(this: any) {
|
|
1271
|
+
// Shadowed before computing, so a re-entrant read from a self-referential shape resolves to undefined instead of running the getter again. A data property rather than an accessor: an own accessor is the dictionary-mode transition this exists to avoid.
|
|
1272
|
+
const desc = { configurable: true, writable: true, enumerable, value: undefined as unknown };
|
|
1273
|
+
Object.defineProperty(this, key, desc);
|
|
1274
|
+
// a compute that throws leaves the shadow behind, so later reads answer undefined instead of re-throwing; `defineLazy` did the same, and `defineLazyInternal`'s delete-on-catch would cost bytes in every bundle for a case only a throwing user getter reaches
|
|
1275
|
+
desc.value = make(this);
|
|
1276
|
+
Object.defineProperty(this, key, desc);
|
|
1277
|
+
return desc.value;
|
|
1278
|
+
},
|
|
1279
|
+
set(this: any, value: unknown) {
|
|
1280
|
+
Object.defineProperty(this, key, { configurable: true, writable: true, enumerable, value });
|
|
1281
|
+
},
|
|
1282
|
+
});
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
/** Marks the thunk `_catch` synthesises for a constant catch value. `Function.length` cannot tell that thunk from a user callback — rest and defaulted parameters both report arity 0 — and a user callback reads `ctx.error`, whose issues only finalize correctly against the caller's per-parse error map. Provenance can say what arity cannot. A plain string key rather than `Symbol.for`, whose call at module scope no bundler can prove pure — the same shape that anchored `urlCanParse` into every build. */
|
|
1286
|
+
export const CONSTANT_CATCH = "~constantCatch";
|
|
1287
|
+
|
|
1288
|
+
/** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
|
|
1289
|
+
export function constantCatch<T>(value: T): () => T {
|
|
1290
|
+
const fn = () => value;
|
|
1291
|
+
(fn as { [CONSTANT_CATCH]?: boolean })[CONSTANT_CATCH] = true;
|
|
1292
|
+
return fn;
|
|
1293
|
+
}
|