@psnext/slingcli 3.0.20260827-1 → 3.3.20260911-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/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js +5 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/util/hasOwn.js +3 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/util/index.js +1 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/util/hasOwn.d.ts +4 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/util/index.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/hasOwn.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/index.d.ts +1 -0
- package/node_modules/@aws-sdk/core/package.json +1 -1
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -4
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +1 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +2 -3
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +8 -1
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +2 -0
- package/node_modules/@aws-sdk/credential-provider-node/dist-es/runtime/memoize-chain.js +2 -0
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-websocket/package.json +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -4
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +1 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +2 -3
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +8 -1
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/package.json +2 -2
- package/node_modules/@aws-sdk/nested-clients/package.json +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-PBNSMEG7.js → chunk-VDBOM5UG.js} +9 -9
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/index.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/rpc-entry.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Client.md +25 -8
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +3 -2
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/EventSource.md +4 -0
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Interceptors.md +7 -3
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +7 -1
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/readable.js +33 -43
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/cache/memory-cache-store.js +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/connect.js +16 -2
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/symbols.js +3 -0
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/agent.js +7 -2
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/balanced-pool.js +7 -4
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client-h1.js +9 -1
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client-h2.js +221 -12
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client.js +76 -30
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/dispatcher-base.js +13 -1
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/dispatcher.js +15 -1
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +3 -0
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +37 -8
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -1
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/retry-agent.js +3 -0
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/round-robin-pool.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +106 -22
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/cache-handler.js +29 -5
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/decorator-handler.js +7 -1
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/deduplication-handler.js +12 -6
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/redirect-handler.js +21 -4
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/retry-handler.js +155 -32
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/cache.js +65 -9
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/decompress.js +115 -13
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/deduplicate.js +5 -4
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/dns.js +7 -0
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/dump.js +10 -23
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-agent.js +13 -1
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-utils.js +217 -27
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/util/cache.js +43 -3
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cookies/parse.js +150 -147
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/eventsource/eventsource-stream.js +28 -1
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/eventsource/eventsource.js +13 -3
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/index.js +6 -0
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/request.js +2 -3
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/util.js +6 -1
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/webidl/index.js +3 -3
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/connection.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/websocket.js +22 -0
- package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/package.json +3 -3
- package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +4 -4
- package/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/errors/index.js +20 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +11 -10
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +11 -10
- package/node_modules/@smithy/core/dist-es/submodules/errors/errors.js +18 -0
- package/node_modules/@smithy/core/dist-es/submodules/errors/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/retry/service-error-classification/service-error-classification.js +11 -10
- package/node_modules/@smithy/core/dist-types/submodules/errors/errors.d.ts +44 -0
- package/node_modules/@smithy/core/dist-types/submodules/errors/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/retry/service-error-classification/service-error-classification.d.ts +4 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/errors/errors.d.ts +44 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/errors/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/retry/service-error-classification/service-error-classification.d.ts +4 -0
- package/node_modules/@smithy/core/errors.d.ts +5 -0
- package/node_modules/@smithy/core/errors.js +5 -0
- package/node_modules/@smithy/core/package.json +11 -2
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +2 -1
- package/node_modules/@smithy/fetch-http-handler/dist-es/fetch-http-handler.js +2 -1
- package/node_modules/@smithy/fetch-http-handler/package.json +3 -3
- package/node_modules/@smithy/types/dist-types/http/httpHandlerInitialization.d.ts +14 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/http/httpHandlerInitialization.d.ts +14 -0
- package/node_modules/@smithy/types/package.json +1 -1
- package/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/node/assert/strict.d.ts +56 -13
- package/node_modules/@types/node/assert.d.ts +190 -189
- package/node_modules/@types/node/async_hooks.d.ts +43 -151
- package/node_modules/@types/node/buffer.buffer.d.ts +13 -12
- package/node_modules/@types/node/buffer.d.ts +237 -102
- package/node_modules/@types/node/child_process.d.ts +154 -39
- package/node_modules/@types/node/cluster.d.ts +384 -238
- package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
- package/node_modules/@types/node/console.d.ts +404 -45
- package/node_modules/@types/node/constants.d.ts +10 -3
- package/node_modules/@types/node/crypto.d.ts +1600 -1007
- package/node_modules/@types/node/dgram.d.ts +81 -133
- package/node_modules/@types/node/diagnostics_channel.d.ts +59 -277
- package/node_modules/@types/node/dns/promises.d.ts +15 -9
- package/node_modules/@types/node/dns.d.ts +183 -136
- package/node_modules/@types/node/domain.d.ts +32 -12
- package/node_modules/@types/node/events.d.ts +696 -728
- package/node_modules/@types/node/fs/promises.d.ts +85 -256
- package/node_modules/@types/node/fs.d.ts +525 -865
- package/node_modules/@types/node/globals.d.ts +34 -12
- package/node_modules/@types/node/globals.typedarray.d.ts +0 -63
- package/node_modules/@types/node/http.d.ts +311 -432
- package/node_modules/@types/node/http2.d.ts +891 -545
- package/node_modules/@types/node/https.d.ts +243 -64
- package/node_modules/@types/node/index.d.ts +7 -25
- package/node_modules/@types/node/inspector.d.ts +58 -70
- package/node_modules/@types/node/inspector.generated.d.ts +411 -765
- package/node_modules/@types/node/module.d.ts +219 -54
- package/node_modules/@types/node/net.d.ts +222 -208
- package/node_modules/@types/node/os.d.ts +49 -41
- package/node_modules/@types/node/package.json +3 -13
- package/node_modules/@types/node/path.d.ts +141 -119
- package/node_modules/@types/node/perf_hooks.d.ts +673 -310
- package/node_modules/@types/node/process.d.ts +205 -389
- package/node_modules/@types/node/punycode.d.ts +31 -3
- package/node_modules/@types/node/querystring.d.ts +16 -3
- package/node_modules/@types/node/readline/promises.d.ts +6 -3
- package/node_modules/@types/node/readline.d.ts +152 -66
- package/node_modules/@types/node/repl.d.ts +109 -101
- package/node_modules/@types/node/sea.d.ts +116 -1
- package/node_modules/@types/node/sqlite.d.ts +68 -486
- package/node_modules/@types/node/stream/consumers.d.ts +15 -91
- package/node_modules/@types/node/stream/promises.d.ts +15 -136
- package/node_modules/@types/node/stream/web.d.ts +456 -179
- package/node_modules/@types/node/stream.d.ts +491 -603
- package/node_modules/@types/node/string_decoder.d.ts +43 -3
- package/node_modules/@types/node/test.d.ts +292 -513
- package/node_modules/@types/node/timers/promises.d.ts +18 -3
- package/node_modules/@types/node/timers.d.ts +141 -3
- package/node_modules/@types/node/tls.d.ts +242 -140
- package/node_modules/@types/node/trace_events.d.ts +97 -3
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +8 -7
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -2
- package/node_modules/@types/node/ts5.6/index.d.ts +6 -26
- package/node_modules/@types/node/tty.d.ts +43 -61
- package/node_modules/@types/node/url.d.ts +584 -156
- package/node_modules/@types/node/util.d.ts +1110 -181
- package/node_modules/@types/node/v8.d.ts +36 -175
- package/node_modules/@types/node/vm.d.ts +209 -292
- package/node_modules/@types/node/wasi.d.ts +74 -24
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +2 -27
- package/node_modules/@types/node/web-globals/domexception.d.ts +0 -15
- package/node_modules/@types/node/web-globals/events.d.ts +0 -9
- package/node_modules/@types/node/web-globals/fetch.d.ts +0 -14
- package/node_modules/@types/node/web-globals/navigator.d.ts +0 -3
- package/node_modules/@types/node/web-globals/streams.d.ts +0 -93
- package/node_modules/@types/node/worker_threads.d.ts +407 -257
- package/node_modules/@types/node/zlib.d.ts +165 -7
- package/node_modules/express-rate-limit/dist/index.cjs +6 -3
- package/node_modules/express-rate-limit/dist/index.d.cts +11 -0
- package/node_modules/express-rate-limit/dist/index.d.mts +11 -0
- package/node_modules/express-rate-limit/dist/index.d.ts +11 -0
- package/node_modules/express-rate-limit/dist/index.mjs +6 -3
- package/node_modules/express-rate-limit/{license.md → license} +7 -6
- package/node_modules/express-rate-limit/package.json +5 -5
- package/node_modules/express-rate-limit/readme.md +1 -0
- package/node_modules/fast-uri/index.js +20 -5
- package/node_modules/fast-uri/lib/utils.js +8 -1
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/component-safe-serialization.test.js +58 -0
- package/node_modules/fast-uri/test/ipv6-validation.test.js +34 -0
- package/node_modules/hono/dist/cjs/client/client.js +4 -4
- package/node_modules/hono/dist/cjs/hono-base.js +7 -6
- package/node_modules/hono/dist/cjs/jsx/base.js +18 -1
- package/node_modules/hono/dist/cjs/jsx/components.js +25 -26
- package/node_modules/hono/dist/cjs/jsx/context.js +5 -5
- package/node_modules/hono/dist/cjs/jsx/dom/server.js +5 -1
- package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +2 -2
- package/node_modules/hono/dist/cjs/jsx/streaming.js +4 -5
- package/node_modules/hono/dist/client/client.js +4 -4
- package/node_modules/hono/dist/hono-base.js +7 -6
- package/node_modules/hono/dist/jsx/base.js +15 -1
- package/node_modules/hono/dist/jsx/components.js +26 -27
- package/node_modules/hono/dist/jsx/context.js +6 -6
- package/node_modules/hono/dist/jsx/dom/server.js +5 -1
- package/node_modules/hono/dist/jsx/intrinsic-element/components.js +3 -3
- package/node_modules/hono/dist/jsx/streaming.js +5 -6
- package/node_modules/hono/dist/types/context.d.ts +2 -2
- package/node_modules/hono/dist/types/jsx/base.d.ts +3 -0
- package/node_modules/hono/package.json +2 -2
- package/node_modules/ip-address/README.md +92 -82
- package/node_modules/ip-address/dist/common.d.ts +20 -0
- package/node_modules/ip-address/dist/common.js +36 -0
- package/node_modules/ip-address/dist/common.js.map +1 -1
- package/node_modules/ip-address/dist/ipv4.d.ts +50 -0
- package/node_modules/ip-address/dist/ipv4.js +75 -0
- package/node_modules/ip-address/dist/ipv4.js.map +1 -1
- package/node_modules/ip-address/dist/ipv6.d.ts +79 -10
- package/node_modules/ip-address/dist/ipv6.js +120 -30
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/dist/v4/constants.d.ts +12 -0
- package/node_modules/ip-address/dist/v4/constants.js +40 -1
- package/node_modules/ip-address/dist/v4/constants.js.map +1 -1
- package/node_modules/ip-address/dist/v6/constants.d.ts +14 -0
- package/node_modules/ip-address/dist/v6/constants.js +47 -1
- package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
- package/node_modules/ip-address/package.json +1 -1
- package/node_modules/jose/dist/types/index.d.ts +1 -2
- package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +12 -25
- package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +18 -32
- package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +12 -25
- package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +24 -50
- package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +15 -30
- package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +29 -52
- package/node_modules/jose/dist/types/jwk/embedded.d.ts +5 -8
- package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +7 -9
- package/node_modules/jose/dist/types/jwks/local.d.ts +10 -13
- package/node_modules/jose/dist/types/jwks/remote.d.ts +29 -41
- package/node_modules/jose/dist/types/jws/compact/sign.d.ts +8 -13
- package/node_modules/jose/dist/types/jws/compact/verify.d.ts +14 -26
- package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +10 -19
- package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +14 -26
- package/node_modules/jose/dist/types/jws/general/sign.d.ts +19 -33
- package/node_modules/jose/dist/types/jws/general/verify.d.ts +17 -32
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +20 -27
- package/node_modules/jose/dist/types/jwt/encrypt.d.ts +30 -35
- package/node_modules/jose/dist/types/jwt/sign.d.ts +8 -13
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +10 -19
- package/node_modules/jose/dist/types/jwt/verify.d.ts +19 -22
- package/node_modules/jose/dist/types/key/export.d.ts +10 -10
- package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +15 -22
- package/node_modules/jose/dist/types/key/generate_secret.d.ts +12 -19
- package/node_modules/jose/dist/types/key/import.d.ts +25 -31
- package/node_modules/jose/dist/types/types.d.ts +184 -319
- package/node_modules/jose/dist/types/util/base64url.d.ts +7 -7
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +5 -7
- package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +6 -5
- package/node_modules/jose/dist/types/util/errors.d.ts +50 -88
- package/node_modules/jose/dist/webapi/index.js +70 -32
- package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +6 -8
- package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +25 -48
- package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +14 -14
- package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +34 -64
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +38 -49
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +100 -172
- package/node_modules/jose/dist/webapi/jwk/embedded.js +29 -32
- package/node_modules/jose/dist/webapi/jwk/thumbprint.js +51 -70
- package/node_modules/jose/dist/webapi/jwks/local.js +53 -64
- package/node_modules/jose/dist/webapi/jwks/remote.js +88 -136
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +19 -21
- package/node_modules/jose/dist/webapi/jws/compact/verify.js +7 -8
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +22 -31
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +11 -24
- package/node_modules/jose/dist/webapi/jws/general/sign.js +55 -73
- package/node_modules/jose/dist/webapi/jws/general/verify.js +43 -69
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +12 -20
- package/node_modules/jose/dist/webapi/jwt/encrypt.js +43 -70
- package/node_modules/jose/dist/webapi/jwt/sign.js +17 -16
- package/node_modules/jose/dist/webapi/jwt/unsecured.js +31 -40
- package/node_modules/jose/dist/webapi/jwt/verify.js +12 -14
- package/node_modules/jose/dist/webapi/key/export.js +32 -41
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +32 -49
- package/node_modules/jose/dist/webapi/key/generate_secret.js +35 -40
- package/node_modules/jose/dist/webapi/key/import.js +48 -56
- package/node_modules/jose/dist/webapi/lib/asn1.js +128 -169
- package/node_modules/jose/dist/webapi/lib/buffer_utils.js +72 -41
- package/node_modules/jose/dist/webapi/lib/content_encryption.js +75 -119
- package/node_modules/jose/dist/webapi/lib/deflate.js +35 -47
- package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +102 -93
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +178 -234
- package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +71 -138
- package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +62 -61
- package/node_modules/jose/dist/webapi/lib/jws_sign.js +43 -82
- package/node_modules/jose/dist/webapi/lib/jws_verify.js +78 -131
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +123 -209
- package/node_modules/jose/dist/webapi/lib/key.js +147 -139
- package/node_modules/jose/dist/webapi/lib/key_algorithm.js +13 -8
- package/node_modules/jose/dist/webapi/lib/key_descriptor.js +8 -6
- package/node_modules/jose/dist/webapi/lib/key_management.js +169 -235
- package/node_modules/jose/dist/webapi/lib/validate.js +122 -0
- package/node_modules/jose/dist/webapi/util/base64url.js +14 -37
- package/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -31
- package/node_modules/jose/dist/webapi/util/decode_protected_header.js +18 -23
- package/node_modules/jose/dist/webapi/util/errors.js +94 -84
- package/node_modules/jose/package.json +17 -81
- package/node_modules/protobufjs/dist/light/protobuf.js +59 -6
- package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.js +22 -2
- package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.js +59 -6
- package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/package.json +1 -1
- package/node_modules/protobufjs/src/decoder.js +32 -3
- package/node_modules/protobufjs/src/reader.js +20 -0
- package/node_modules/protobufjs/src/wrappers.js +5 -1
- package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
- package/node_modules/qs/CHANGELOG.md +15 -0
- package/node_modules/qs/README.md +19 -1
- package/node_modules/qs/dist/qs.js +21 -21
- package/node_modules/qs/eslint.config.mjs +1 -1
- package/node_modules/qs/lib/parse.js +3 -4
- package/node_modules/qs/lib/stringify.js +23 -8
- package/node_modules/qs/lib/utils.js +10 -3
- package/node_modules/qs/package.json +4 -4
- package/node_modules/qs/test/parse.js +192 -3
- package/node_modules/qs/test/stringify.js +317 -0
- package/node_modules/qs/test/utils.js +12 -0
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +4 -2
- package/node_modules/undici/lib/dispatcher/client-h1.js +12 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +70 -14
- package/node_modules/undici/lib/dispatcher/client.js +6 -2
- package/node_modules/undici/lib/handler/cache-handler.js +21 -5
- package/node_modules/undici/lib/handler/retry-handler.js +42 -7
- package/node_modules/undici/lib/interceptor/cache.js +20 -1
- package/node_modules/undici/lib/interceptor/decompress.js +146 -14
- package/node_modules/undici/lib/interceptor/dump.js +10 -23
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +245 -150
- package/node_modules/undici/lib/web/websocket/connection.js +1 -1
- package/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/interceptors.d.ts +2 -0
- package/node_modules/undici-types/agent.d.ts +13 -12
- package/node_modules/undici-types/api.d.ts +26 -26
- package/node_modules/undici-types/balanced-pool.d.ts +12 -13
- package/node_modules/undici-types/client.d.ts +34 -55
- package/node_modules/undici-types/connector.d.ts +2 -4
- package/node_modules/undici-types/cookies.d.ts +0 -2
- package/node_modules/undici-types/diagnostics-channel.d.ts +10 -18
- package/node_modules/undici-types/dispatcher.d.ts +137 -134
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +3 -4
- package/node_modules/undici-types/errors.d.ts +54 -82
- package/node_modules/undici-types/eventsource.d.ts +4 -9
- package/node_modules/undici-types/fetch.d.ts +24 -46
- package/node_modules/undici-types/file.d.ts +39 -0
- package/node_modules/undici-types/filereader.d.ts +54 -0
- package/node_modules/undici-types/formdata.d.ts +7 -7
- package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
- package/node_modules/undici-types/global-origin.d.ts +5 -5
- package/node_modules/undici-types/handlers.d.ts +9 -8
- package/node_modules/undici-types/header.d.ts +1 -162
- package/node_modules/undici-types/index.d.ts +47 -69
- package/node_modules/undici-types/interceptors.d.ts +9 -72
- package/node_modules/undici-types/mock-agent.d.ts +18 -36
- package/node_modules/undici-types/mock-client.d.ts +4 -6
- package/node_modules/undici-types/mock-errors.d.ts +3 -3
- package/node_modules/undici-types/mock-interceptor.d.ts +20 -21
- package/node_modules/undici-types/mock-pool.d.ts +4 -6
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/patch.d.ts +4 -0
- package/node_modules/undici-types/pool-stats.d.ts +8 -8
- package/node_modules/undici-types/pool.d.ts +14 -14
- package/node_modules/undici-types/proxy-agent.d.ts +6 -7
- package/node_modules/undici-types/readable.d.ts +16 -19
- package/node_modules/undici-types/retry-agent.d.ts +1 -1
- package/node_modules/undici-types/retry-handler.d.ts +10 -19
- package/node_modules/undici-types/util.d.ts +3 -3
- package/node_modules/undici-types/webidl.d.ts +30 -148
- package/node_modules/undici-types/websocket.d.ts +10 -48
- package/node_modules/zod/README.md +27 -0
- 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 +21 -2
- package/node_modules/zod/index.d.cts +1 -2
- package/node_modules/zod/index.d.ts +1 -2
- package/node_modules/zod/index.js +5 -2
- package/node_modules/zod/locales/index.cjs +19 -0
- package/node_modules/zod/mini/index.cjs +19 -0
- package/node_modules/zod/package.json +20 -8
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +5 -2
- package/node_modules/zod/src/v3/ZodError.ts +22 -12
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
- package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
- 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/object.test.ts +3 -6
- package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
- package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
- package/node_modules/zod/src/v3/types.ts +5 -5
- package/node_modules/zod/src/v4/classic/compat.ts +26 -18
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +59 -44
- package/node_modules/zod/src/v4/classic/external.ts +14 -9
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +363 -78
- 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 +10 -4
- package/node_modules/zod/src/v4/classic/schemas.ts +652 -371
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +185 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +3 -3
- 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 +994 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
- 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 +46 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +261 -13
- 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 +112 -2
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +403 -6
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +4 -0
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +582 -10
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
- 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 +21 -2
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +297 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +67 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
- 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 +3 -10
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +12 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +46 -9
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +301 -12
- 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 +49 -16
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +225 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +79 -3
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +9 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +152 -5
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +44 -3
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1758 -202
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
- 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 +73 -13
- package/node_modules/zod/src/v4/core/checks.ts +58 -145
- package/node_modules/zod/src/v4/core/compile.ts +2302 -0
- package/node_modules/zod/src/v4/core/core.ts +98 -19
- package/node_modules/zod/src/v4/core/doc.ts +17 -9
- package/node_modules/zod/src/v4/core/errors.ts +113 -25
- package/node_modules/zod/src/v4/core/index.ts +3 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +8 -3
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +468 -146
- package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
- package/node_modules/zod/src/v4/core/memoizer.ts +334 -0
- package/node_modules/zod/src/v4/core/parse.ts +164 -50
- package/node_modules/zod/src/v4/core/regexes.ts +38 -15
- package/node_modules/zod/src/v4/core/registries.ts +2 -2
- package/node_modules/zod/src/v4/core/schemas.ts +1073 -538
- 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 +969 -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 +1859 -0
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
- 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/polyfill-collision.test.ts +46 -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 +31 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +284 -49
- package/node_modules/zod/src/v4/core/util.ts +458 -157
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/core/visit.ts +204 -0
- package/node_modules/zod/src/v4/index.ts +3 -3
- package/node_modules/zod/src/v4/locales/ar.ts +4 -0
- package/node_modules/zod/src/v4/locales/az.ts +4 -0
- package/node_modules/zod/src/v4/locales/be.ts +11 -0
- package/node_modules/zod/src/v4/locales/bg.ts +4 -0
- package/node_modules/zod/src/v4/locales/bn.ts +122 -0
- package/node_modules/zod/src/v4/locales/ca.ts +4 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +139 -0
- package/node_modules/zod/src/v4/locales/cs.ts +4 -0
- package/node_modules/zod/src/v4/locales/da.ts +6 -2
- package/node_modules/zod/src/v4/locales/de.ts +4 -0
- package/node_modules/zod/src/v4/locales/el.ts +2 -0
- package/node_modules/zod/src/v4/locales/en.ts +16 -4
- package/node_modules/zod/src/v4/locales/eo.ts +4 -0
- package/node_modules/zod/src/v4/locales/es.ts +3 -0
- package/node_modules/zod/src/v4/locales/fa.ts +4 -0
- package/node_modules/zod/src/v4/locales/fi.ts +4 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +4 -0
- package/node_modules/zod/src/v4/locales/fr.ts +20 -14
- package/node_modules/zod/src/v4/locales/gu.ts +122 -0
- package/node_modules/zod/src/v4/locales/he.ts +7 -1
- package/node_modules/zod/src/v4/locales/hi.ts +125 -0
- package/node_modules/zod/src/v4/locales/hr.ts +3 -0
- package/node_modules/zod/src/v4/locales/hu.ts +4 -0
- package/node_modules/zod/src/v4/locales/hy.ts +10 -0
- package/node_modules/zod/src/v4/locales/id.ts +4 -0
- package/node_modules/zod/src/v4/locales/index.ts +11 -0
- package/node_modules/zod/src/v4/locales/is.ts +4 -0
- package/node_modules/zod/src/v4/locales/it.ts +4 -0
- package/node_modules/zod/src/v4/locales/ja.ts +4 -0
- package/node_modules/zod/src/v4/locales/ka.ts +4 -0
- package/node_modules/zod/src/v4/locales/km.ts +4 -0
- package/node_modules/zod/src/v4/locales/kn.ts +125 -0
- package/node_modules/zod/src/v4/locales/ko.ts +4 -0
- package/node_modules/zod/src/v4/locales/lt.ts +3 -0
- package/node_modules/zod/src/v4/locales/mk.ts +4 -0
- package/node_modules/zod/src/v4/locales/ms.ts +4 -0
- package/node_modules/zod/src/v4/locales/ne.ts +127 -0
- package/node_modules/zod/src/v4/locales/nl.ts +4 -0
- package/node_modules/zod/src/v4/locales/nn.ts +120 -0
- package/node_modules/zod/src/v4/locales/no.ts +6 -2
- package/node_modules/zod/src/v4/locales/ota.ts +4 -0
- package/node_modules/zod/src/v4/locales/pl.ts +4 -0
- package/node_modules/zod/src/v4/locales/ps.ts +4 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +160 -0
- package/node_modules/zod/src/v4/locales/pt.ts +100 -58
- package/node_modules/zod/src/v4/locales/ro.ts +2 -0
- package/node_modules/zod/src/v4/locales/ru.ts +11 -0
- package/node_modules/zod/src/v4/locales/sk.ts +122 -0
- package/node_modules/zod/src/v4/locales/sl.ts +4 -0
- package/node_modules/zod/src/v4/locales/sv.ts +6 -2
- package/node_modules/zod/src/v4/locales/ta.ts +4 -0
- package/node_modules/zod/src/v4/locales/tg.ts +134 -0
- package/node_modules/zod/src/v4/locales/th.ts +4 -0
- package/node_modules/zod/src/v4/locales/tk.ts +112 -0
- package/node_modules/zod/src/v4/locales/tr.ts +4 -0
- package/node_modules/zod/src/v4/locales/uk.ts +4 -0
- package/node_modules/zod/src/v4/locales/ur.ts +4 -0
- package/node_modules/zod/src/v4/locales/uz.ts +2 -0
- package/node_modules/zod/src/v4/locales/vi.ts +4 -0
- package/node_modules/zod/src/v4/locales/yo.ts +4 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +4 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +4 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +12 -1
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/parse.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +174 -59
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
- 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 +23 -4
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +102 -5
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +37 -0
- package/node_modules/zod/v3/ZodError.cjs +41 -12
- package/node_modules/zod/v3/ZodError.d.cts +1 -1
- package/node_modules/zod/v3/ZodError.d.ts +1 -1
- package/node_modules/zod/v3/ZodError.js +22 -12
- 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/standard-schema.cjs +19 -0
- package/node_modules/zod/v3/types.cjs +26 -5
- package/node_modules/zod/v3/types.js +7 -5
- package/node_modules/zod/v4/classic/checks.cjs +19 -0
- package/node_modules/zod/v4/classic/coerce.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.d.cts +9 -11
- package/node_modules/zod/v4/classic/compat.d.ts +9 -11
- 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 +62 -34
- 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 +43 -34
- package/node_modules/zod/v4/classic/external.cjs +51 -27
- package/node_modules/zod/v4/classic/external.d.cts +5 -2
- package/node_modules/zod/v4/classic/external.d.ts +5 -2
- package/node_modules/zod/v4/classic/external.js +5 -8
- package/node_modules/zod/v4/classic/from-json-schema.cjs +376 -75
- package/node_modules/zod/v4/classic/from-json-schema.js +357 -75
- 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/parse.cjs +23 -1
- package/node_modules/zod/v4/classic/parse.d.cts +17 -4
- package/node_modules/zod/v4/classic/parse.d.ts +17 -4
- package/node_modules/zod/v4/classic/parse.js +1 -0
- package/node_modules/zod/v4/classic/schemas.cjs +591 -422
- package/node_modules/zod/v4/classic/schemas.d.cts +70 -19
- package/node_modules/zod/v4/classic/schemas.d.ts +70 -19
- package/node_modules/zod/v4/classic/schemas.js +564 -420
- package/node_modules/zod/v4/core/api.cjs +58 -4
- package/node_modules/zod/v4/core/api.d.cts +16 -10
- package/node_modules/zod/v4/core/api.d.ts +16 -10
- package/node_modules/zod/v4/core/api.js +36 -4
- package/node_modules/zod/v4/core/checks.cjs +56 -127
- package/node_modules/zod/v4/core/checks.d.cts +13 -13
- package/node_modules/zod/v4/core/checks.d.ts +13 -13
- package/node_modules/zod/v4/core/checks.js +37 -127
- package/node_modules/zod/v4/core/compile.cjs +1913 -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 +1863 -0
- package/node_modules/zod/v4/core/core.cjs +100 -18
- package/node_modules/zod/v4/core/core.d.cts +16 -4
- package/node_modules/zod/v4/core/core.d.ts +16 -4
- package/node_modules/zod/v4/core/core.js +82 -19
- package/node_modules/zod/v4/core/doc.cjs +31 -9
- package/node_modules/zod/v4/core/doc.d.cts +3 -1
- package/node_modules/zod/v4/core/doc.d.ts +3 -1
- package/node_modules/zod/v4/core/doc.js +12 -9
- package/node_modules/zod/v4/core/errors.cjs +126 -25
- package/node_modules/zod/v4/core/errors.d.cts +4 -0
- package/node_modules/zod/v4/core/errors.d.ts +4 -0
- package/node_modules/zod/v4/core/errors.js +107 -25
- package/node_modules/zod/v4/core/index.cjs +24 -1
- package/node_modules/zod/v4/core/index.d.cts +3 -0
- package/node_modules/zod/v4/core/index.d.ts +3 -0
- package/node_modules/zod/v4/core/index.js +3 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +24 -1
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.js +6 -2
- package/node_modules/zod/v4/core/json-schema-processors.cjs +470 -149
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +17 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +17 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +427 -150
- package/node_modules/zod/v4/core/json-schema.cjs +19 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
- package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
- package/node_modules/zod/v4/core/memoizer.cjs +363 -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 +314 -0
- package/node_modules/zod/v4/core/parse.cjs +148 -46
- package/node_modules/zod/v4/core/parse.d.cts +14 -11
- package/node_modules/zod/v4/core/parse.d.ts +14 -11
- package/node_modules/zod/v4/core/parse.js +127 -45
- package/node_modules/zod/v4/core/regexes.cjs +52 -17
- package/node_modules/zod/v4/core/regexes.d.cts +4 -0
- package/node_modules/zod/v4/core/regexes.d.ts +4 -0
- package/node_modules/zod/v4/core/regexes.js +30 -15
- package/node_modules/zod/v4/core/registries.cjs +19 -0
- package/node_modules/zod/v4/core/registries.js +2 -2
- package/node_modules/zod/v4/core/schemas.cjs +826 -387
- package/node_modules/zod/v4/core/schemas.d.cts +140 -36
- package/node_modules/zod/v4/core/schemas.d.ts +140 -36
- package/node_modules/zod/v4/core/schemas.js +796 -387
- package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +270 -45
- package/node_modules/zod/v4/core/to-json-schema.d.cts +48 -5
- package/node_modules/zod/v4/core/to-json-schema.d.ts +48 -5
- package/node_modules/zod/v4/core/to-json-schema.js +248 -45
- package/node_modules/zod/v4/core/util.cjs +376 -157
- package/node_modules/zod/v4/core/util.d.cts +79 -1
- package/node_modules/zod/v4/core/util.d.ts +79 -1
- package/node_modules/zod/v4/core/util.js +345 -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 +226 -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 +181 -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 +4 -0
- package/node_modules/zod/v4/locales/ar.js +4 -0
- package/node_modules/zod/v4/locales/az.cjs +4 -0
- package/node_modules/zod/v4/locales/az.js +4 -0
- package/node_modules/zod/v4/locales/be.cjs +11 -0
- package/node_modules/zod/v4/locales/be.js +11 -0
- package/node_modules/zod/v4/locales/bg.cjs +4 -0
- package/node_modules/zod/v4/locales/bg.js +4 -0
- package/node_modules/zod/v4/locales/bn.cjs +139 -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 +112 -0
- package/node_modules/zod/v4/locales/ca.cjs +4 -0
- package/node_modules/zod/v4/locales/ca.js +4 -0
- package/node_modules/zod/v4/locales/ckb.cjs +159 -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 +132 -0
- package/node_modules/zod/v4/locales/cs.cjs +4 -0
- package/node_modules/zod/v4/locales/cs.js +4 -0
- package/node_modules/zod/v4/locales/da.cjs +6 -2
- package/node_modules/zod/v4/locales/da.js +6 -2
- package/node_modules/zod/v4/locales/de.cjs +4 -0
- package/node_modules/zod/v4/locales/de.js +4 -0
- package/node_modules/zod/v4/locales/el.cjs +2 -0
- package/node_modules/zod/v4/locales/el.js +2 -0
- package/node_modules/zod/v4/locales/en.cjs +15 -4
- package/node_modules/zod/v4/locales/en.js +15 -4
- package/node_modules/zod/v4/locales/eo.cjs +4 -0
- package/node_modules/zod/v4/locales/eo.js +4 -0
- package/node_modules/zod/v4/locales/es.cjs +3 -0
- package/node_modules/zod/v4/locales/es.js +3 -0
- package/node_modules/zod/v4/locales/fa.cjs +4 -0
- package/node_modules/zod/v4/locales/fa.js +4 -0
- package/node_modules/zod/v4/locales/fi.cjs +4 -0
- package/node_modules/zod/v4/locales/fi.js +4 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +4 -0
- package/node_modules/zod/v4/locales/fr-CA.js +4 -0
- package/node_modules/zod/v4/locales/fr.cjs +17 -14
- package/node_modules/zod/v4/locales/fr.js +17 -14
- package/node_modules/zod/v4/locales/gu.cjs +139 -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 +112 -0
- package/node_modules/zod/v4/locales/he.cjs +6 -0
- package/node_modules/zod/v4/locales/he.js +6 -0
- package/node_modules/zod/v4/locales/hi.cjs +137 -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 +110 -0
- package/node_modules/zod/v4/locales/hr.cjs +3 -0
- package/node_modules/zod/v4/locales/hr.js +3 -0
- package/node_modules/zod/v4/locales/hu.cjs +4 -0
- package/node_modules/zod/v4/locales/hu.js +4 -0
- package/node_modules/zod/v4/locales/hy.cjs +10 -0
- package/node_modules/zod/v4/locales/hy.js +10 -0
- package/node_modules/zod/v4/locales/id.cjs +4 -0
- package/node_modules/zod/v4/locales/id.js +4 -0
- package/node_modules/zod/v4/locales/index.cjs +43 -2
- package/node_modules/zod/v4/locales/index.d.cts +11 -0
- package/node_modules/zod/v4/locales/index.d.ts +11 -0
- package/node_modules/zod/v4/locales/index.js +11 -0
- package/node_modules/zod/v4/locales/is.cjs +4 -0
- package/node_modules/zod/v4/locales/is.js +4 -0
- package/node_modules/zod/v4/locales/it.cjs +4 -0
- package/node_modules/zod/v4/locales/it.js +4 -0
- package/node_modules/zod/v4/locales/ja.cjs +4 -0
- package/node_modules/zod/v4/locales/ja.js +4 -0
- package/node_modules/zod/v4/locales/ka.cjs +4 -0
- package/node_modules/zod/v4/locales/ka.js +4 -0
- package/node_modules/zod/v4/locales/km.cjs +4 -0
- package/node_modules/zod/v4/locales/km.js +4 -0
- package/node_modules/zod/v4/locales/kn.cjs +142 -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 +115 -0
- package/node_modules/zod/v4/locales/ko.cjs +4 -0
- package/node_modules/zod/v4/locales/ko.js +4 -0
- package/node_modules/zod/v4/locales/lt.cjs +3 -0
- package/node_modules/zod/v4/locales/lt.js +3 -0
- package/node_modules/zod/v4/locales/mk.cjs +4 -0
- package/node_modules/zod/v4/locales/mk.js +4 -0
- package/node_modules/zod/v4/locales/ms.cjs +4 -0
- package/node_modules/zod/v4/locales/ms.js +4 -0
- package/node_modules/zod/v4/locales/ne.cjs +137 -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 +110 -0
- package/node_modules/zod/v4/locales/nl.cjs +4 -0
- package/node_modules/zod/v4/locales/nl.js +4 -0
- package/node_modules/zod/v4/locales/nn.cjs +139 -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 +112 -0
- package/node_modules/zod/v4/locales/no.cjs +6 -2
- package/node_modules/zod/v4/locales/no.js +6 -2
- package/node_modules/zod/v4/locales/ota.cjs +4 -0
- package/node_modules/zod/v4/locales/ota.js +4 -0
- package/node_modules/zod/v4/locales/pl.cjs +4 -0
- package/node_modules/zod/v4/locales/pl.js +4 -0
- package/node_modules/zod/v4/locales/ps.cjs +4 -0
- package/node_modules/zod/v4/locales/ps.js +4 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +169 -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 +142 -0
- package/node_modules/zod/v4/locales/pt.cjs +88 -55
- package/node_modules/zod/v4/locales/pt.js +88 -55
- package/node_modules/zod/v4/locales/ro.cjs +2 -0
- package/node_modules/zod/v4/locales/ro.js +2 -0
- package/node_modules/zod/v4/locales/ru.cjs +11 -0
- package/node_modules/zod/v4/locales/ru.js +11 -0
- package/node_modules/zod/v4/locales/sk.cjs +142 -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 +115 -0
- package/node_modules/zod/v4/locales/sl.cjs +4 -0
- package/node_modules/zod/v4/locales/sl.js +4 -0
- package/node_modules/zod/v4/locales/sv.cjs +6 -2
- package/node_modules/zod/v4/locales/sv.js +6 -2
- package/node_modules/zod/v4/locales/ta.cjs +4 -0
- package/node_modules/zod/v4/locales/ta.js +4 -0
- package/node_modules/zod/v4/locales/tg.cjs +143 -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 +116 -0
- package/node_modules/zod/v4/locales/th.cjs +4 -0
- package/node_modules/zod/v4/locales/th.js +4 -0
- package/node_modules/zod/v4/locales/tk.cjs +133 -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 +106 -0
- package/node_modules/zod/v4/locales/tr.cjs +4 -0
- package/node_modules/zod/v4/locales/tr.js +4 -0
- package/node_modules/zod/v4/locales/uk.cjs +4 -0
- package/node_modules/zod/v4/locales/uk.js +4 -0
- package/node_modules/zod/v4/locales/ur.cjs +4 -0
- package/node_modules/zod/v4/locales/ur.js +4 -0
- package/node_modules/zod/v4/locales/uz.cjs +2 -0
- package/node_modules/zod/v4/locales/uz.js +2 -0
- package/node_modules/zod/v4/locales/vi.cjs +4 -0
- package/node_modules/zod/v4/locales/vi.js +4 -0
- package/node_modules/zod/v4/locales/yo.cjs +4 -0
- package/node_modules/zod/v4/locales/yo.js +4 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +4 -0
- package/node_modules/zod/v4/locales/zh-CN.js +4 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +4 -0
- package/node_modules/zod/v4/locales/zh-TW.js +4 -0
- package/node_modules/zod/v4/mini/checks.cjs +19 -0
- package/node_modules/zod/v4/mini/coerce.cjs +19 -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 +33 -1
- package/node_modules/zod/v4/mini/external.d.cts +5 -2
- package/node_modules/zod/v4/mini/external.d.ts +5 -2
- package/node_modules/zod/v4/mini/external.js +3 -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 +19 -0
- package/node_modules/zod/v4/mini/parse.cjs +22 -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 +115 -49
- package/node_modules/zod/v4/mini/schemas.d.cts +52 -14
- package/node_modules/zod/v4/mini/schemas.d.ts +52 -14
- package/node_modules/zod/v4/mini/schemas.js +90 -47
- package/node_modules/zod/v4-mini/index.cjs +19 -0
- package/package.json +3 -2
- package/skills/context-management/SKILL.md +258 -0
- package/skills/figma-implement-design/SKILL.md +258 -0
- package/skills/orchestrator/SKILL.md +82 -0
- package/skills/s-help/SKILL.md +42 -0
- package/skills/s-help/resources/README.md +23 -0
- package/skills/s-help/resources/commands.json +78 -0
- package/skills/s-help/resources/s-acm.md +26 -0
- package/skills/s-help/resources/s-bash-mode.md +23 -0
- package/skills/s-help/resources/s-bash-reset.md +23 -0
- package/skills/s-help/resources/s-context.md +25 -0
- package/skills/s-help/resources/s-filechanges-accept.md +25 -0
- package/skills/s-help/resources/s-filechanges-decline.md +30 -0
- package/skills/s-help/resources/s-filechanges.md +38 -0
- package/skills/s-help/resources/s-footer.md +38 -0
- package/skills/s-help/resources/s-promptlib.md +28 -0
- package/skills/s-help/resources/s-skills-manager.md +31 -0
- package/skills/s-help/resources/s-stash-history.md +26 -0
- package/skills/screenshot/SKILL.md +267 -0
- package/skills/screenshot/scripts/ensure_macos_permissions.sh +54 -0
- package/skills/screenshot/scripts/macos_display_info.swift +22 -0
- package/skills/screenshot/scripts/macos_permissions.swift +40 -0
- package/skills/screenshot/scripts/macos_window_info.swift +126 -0
- package/skills/screenshot/scripts/take_screenshot.ps1 +163 -0
- package/skills/screenshot/scripts/take_screenshot.py +585 -0
- package/slingshot/index.js +232 -230
- package/node_modules/@types/node/ffi.d.ts +0 -486
- package/node_modules/@types/node/inspector/promises.d.ts +0 -35
- package/node_modules/@types/node/path/posix.d.ts +0 -8
- package/node_modules/@types/node/path/win32.d.ts +0 -8
- package/node_modules/@types/node/quic.d.ts +0 -2151
- package/node_modules/@types/node/stream/iter.d.ts +0 -452
- package/node_modules/@types/node/test/reporters.d.ts +0 -59
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
- package/node_modules/@types/node/ts5.7/index.d.ts +0 -118
- package/node_modules/@types/node/util/types.d.ts +0 -558
- package/node_modules/@types/node/vfs.d.ts +0 -210
- package/node_modules/@types/node/web-globals/blob.d.ts +0 -23
- package/node_modules/@types/node/web-globals/console.d.ts +0 -9
- package/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
- package/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
- package/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
- package/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
- package/node_modules/@types/node/web-globals/performance.d.ts +0 -45
- package/node_modules/@types/node/web-globals/timers.d.ts +0 -44
- package/node_modules/@types/node/web-globals/url.d.ts +0 -24
- package/node_modules/@types/node/zlib/iter.d.ts +0 -131
- package/node_modules/jose/dist/webapi/lib/base64.js +0 -22
- package/node_modules/jose/dist/webapi/lib/crypto_key.js +0 -28
- package/node_modules/jose/dist/webapi/lib/helpers.js +0 -42
- package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +0 -26
- package/node_modules/jose/dist/webapi/lib/is_key_like.js +0 -17
- package/node_modules/jose/dist/webapi/lib/jwk_metadata.js +0 -20
- package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +0 -17
- package/node_modules/jose/dist/webapi/lib/key_options.js +0 -6
- package/node_modules/jose/dist/webapi/lib/options.js +0 -74
- package/node_modules/jose/dist/webapi/lib/signing.js +0 -26
- package/node_modules/jose/dist/webapi/lib/type_checks.js +0 -33
- package/node_modules/undici-types/cache-interceptor.d.ts +0 -179
- package/node_modules/undici-types/client-stats.d.ts +0 -15
- package/node_modules/undici-types/dispatcher1-wrapper.d.ts +0 -7
- package/node_modules/undici-types/h2c-client.d.ts +0 -73
- package/node_modules/undici-types/mock-call-history.d.ts +0 -111
- package/node_modules/undici-types/round-robin-pool.d.ts +0 -39
- package/node_modules/undici-types/snapshot-agent.d.ts +0 -113
- package/node_modules/undici-types/socks5-proxy-agent.d.ts +0 -25
- package/node_modules/undici-types/utility.d.ts +0 -7
- package/node_modules/zod/src/v4/core/config.ts +0 -15
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as checks from "./checks.js";
|
|
2
2
|
import * as core from "./core.js";
|
|
3
3
|
import { Doc } from "./doc.js";
|
|
4
|
-
import { parse, parseAsync
|
|
4
|
+
import { parse, parseAsync } from "./parse.js";
|
|
5
5
|
import * as regexes from "./regexes.js";
|
|
6
6
|
import * as util from "./util.js";
|
|
7
7
|
import { version } from "./versions.js";
|
|
@@ -11,19 +11,20 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
11
11
|
inst._zod.def = def; // set _def property
|
|
12
12
|
inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
|
|
13
13
|
inst._zod.version = version;
|
|
14
|
-
const
|
|
14
|
+
const defChecks = inst._zod.def.checks;
|
|
15
15
|
// if inst is itself a checks.$ZodCheck, run it as a check
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const checks = inst._zod.traits.has("$ZodCheck")
|
|
17
|
+
? [inst, ...(defChecks ?? [])]
|
|
18
|
+
: defChecks?.length
|
|
19
|
+
? [...defChecks]
|
|
20
|
+
: [];
|
|
19
21
|
for (const ch of checks) {
|
|
20
22
|
for (const fn of ch._zod.onattach) {
|
|
21
23
|
fn(inst);
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
if (checks.length === 0) {
|
|
25
|
-
// deferred initializer
|
|
26
|
-
// inst._zod.parse is not yet defined
|
|
27
|
+
// deferred initializer inst._zod.parse is not yet defined
|
|
27
28
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
28
29
|
inst._zod.deferred?.push(() => {
|
|
29
30
|
inst._zod.run = inst._zod.parse;
|
|
@@ -31,6 +32,8 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
31
32
|
}
|
|
32
33
|
else {
|
|
33
34
|
const runChecks = (payload, checks, ctx) => {
|
|
35
|
+
if (payload.memo)
|
|
36
|
+
return payload;
|
|
34
37
|
let isAborted = util.aborted(payload);
|
|
35
38
|
let asyncResult;
|
|
36
39
|
for (const ch of checks) {
|
|
@@ -55,6 +58,7 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
55
58
|
const nextLen = payload.issues.length;
|
|
56
59
|
if (nextLen === currLen)
|
|
57
60
|
return;
|
|
61
|
+
util.attachSchema(payload.issues, currLen, inst);
|
|
58
62
|
if (!isAborted)
|
|
59
63
|
isAborted = util.aborted(payload, currLen);
|
|
60
64
|
});
|
|
@@ -63,6 +67,7 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
63
67
|
const nextLen = payload.issues.length;
|
|
64
68
|
if (nextLen === currLen)
|
|
65
69
|
continue;
|
|
70
|
+
util.attachSchema(payload.issues, currLen, inst);
|
|
66
71
|
if (!isAborted)
|
|
67
72
|
isAborted = util.aborted(payload, currLen);
|
|
68
73
|
}
|
|
@@ -94,8 +99,7 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
94
99
|
return inst._zod.parse(payload, ctx);
|
|
95
100
|
}
|
|
96
101
|
if (ctx.direction === "backward") {
|
|
97
|
-
// run canary
|
|
98
|
-
// initial pass (no checks)
|
|
102
|
+
// run canary initial pass (no checks)
|
|
99
103
|
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
100
104
|
if (canary instanceof Promise) {
|
|
101
105
|
return canary.then((canary) => {
|
|
@@ -114,25 +118,44 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
114
118
|
return runChecks(result, checks, ctx);
|
|
115
119
|
};
|
|
116
120
|
}
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
}, {
|
|
122
|
+
// Wrappers extend this by installing a richer factory over it; reading it eagerly would defeat the laziness.
|
|
123
|
+
get "~standard"() {
|
|
124
|
+
return util.hide(this, "~standard", standardProps(this));
|
|
125
|
+
},
|
|
126
|
+
set "~standard"(value) {
|
|
127
|
+
util.own(this, "~standard", value);
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
131
|
+
// a Standard Schema result only reports issues, so a failure finalizes them straight off the raw payload: no ZodError, and no lazy result to read through
|
|
132
|
+
const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())) } : { value: r.value };
|
|
133
|
+
async function validateAsync(inst, value) {
|
|
134
|
+
const ctx = { async: true };
|
|
135
|
+
return toStandardResult((await inst._zod.run({ value, issues: [] }, ctx)), ctx);
|
|
136
|
+
}
|
|
137
|
+
export function standardProps(inst) {
|
|
138
|
+
return {
|
|
119
139
|
validate: (value) => {
|
|
140
|
+
const ctx = { async: false };
|
|
120
141
|
try {
|
|
121
|
-
const r =
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
catch (_) {
|
|
125
|
-
return safeParseAsync(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
|
|
142
|
+
const r = inst._zod.run({ value, issues: [] }, ctx);
|
|
143
|
+
if (!(r instanceof Promise))
|
|
144
|
+
return toStandardResult(r, ctx);
|
|
126
145
|
}
|
|
146
|
+
catch (_) { }
|
|
147
|
+
// async function so a synchronously throwing check rejects instead of escaping validate
|
|
148
|
+
return validateAsync(inst, value);
|
|
127
149
|
},
|
|
128
150
|
vendor: "zod",
|
|
129
151
|
version: 1,
|
|
130
|
-
}
|
|
131
|
-
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
132
154
|
export { clone } from "./util.js";
|
|
133
155
|
export const $ZodString = /*@__PURE__*/ core.$constructor("$ZodString", (inst, def) => {
|
|
134
156
|
$ZodType.init(inst, def);
|
|
135
|
-
|
|
157
|
+
// a format's own pattern, else unbounded; a template literal derives the check-aware form itself
|
|
158
|
+
inst._zod.pattern = def.pattern ?? regexes.anyString;
|
|
136
159
|
inst._zod.parse = (payload, _) => {
|
|
137
160
|
if (def.coerce)
|
|
138
161
|
try {
|
|
@@ -184,66 +207,89 @@ export const $ZodEmail = /*@__PURE__*/ core.$constructor("$ZodEmail", (inst, def
|
|
|
184
207
|
def.pattern ?? (def.pattern = regexes.email);
|
|
185
208
|
$ZodStringFormat.init(inst, def);
|
|
186
209
|
});
|
|
210
|
+
/** The `://` guard rejected the input before the URL constructor saw it. */
|
|
211
|
+
export const URL_BAD_FORMAT = 1;
|
|
212
|
+
/** The URL constructor rejected the input. */
|
|
213
|
+
export const URL_UNPARSEABLE = 2;
|
|
214
|
+
/** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
|
|
215
|
+
export function parseURLObject(trimmed, def) {
|
|
216
|
+
// When normalize is off, require :// for http/https URLs. This prevents strings like "http:example.com" or "https:/path" from being silently accepted
|
|
217
|
+
if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
|
|
218
|
+
return URL_BAD_FORMAT;
|
|
219
|
+
}
|
|
220
|
+
try {
|
|
221
|
+
// @ts-ignore
|
|
222
|
+
return new URL(trimmed);
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
return URL_UNPARSEABLE;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const asciiTabOrNewline = /[\t\n\r]/g;
|
|
229
|
+
/** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */
|
|
230
|
+
export function stripTabAndNewline(value) {
|
|
231
|
+
return value.replace(asciiTabOrNewline, "");
|
|
232
|
+
}
|
|
233
|
+
export function urlHostnameOk(url, hostname) {
|
|
234
|
+
hostname.lastIndex = 0;
|
|
235
|
+
return hostname.test(url.hostname);
|
|
236
|
+
}
|
|
237
|
+
export function urlProtocolOk(url, protocol) {
|
|
238
|
+
protocol.lastIndex = 0;
|
|
239
|
+
return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
|
|
240
|
+
}
|
|
187
241
|
export const $ZodURL = /*@__PURE__*/ core.$constructor("$ZodURL", (inst, def) => {
|
|
188
242
|
$ZodStringFormat.init(inst, def);
|
|
189
243
|
inst._zod.check = (payload) => {
|
|
190
244
|
try {
|
|
191
245
|
// Trim whitespace from input
|
|
192
246
|
const trimmed = payload.value.trim();
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
});
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
// @ts-ignore
|
|
209
|
-
const url = new URL(trimmed);
|
|
210
|
-
if (def.hostname) {
|
|
211
|
-
def.hostname.lastIndex = 0;
|
|
212
|
-
if (!def.hostname.test(url.hostname)) {
|
|
213
|
-
payload.issues.push({
|
|
214
|
-
code: "invalid_format",
|
|
215
|
-
format: "url",
|
|
216
|
-
note: "Invalid hostname",
|
|
217
|
-
pattern: def.hostname.source,
|
|
218
|
-
input: payload.value,
|
|
219
|
-
inst,
|
|
220
|
-
continue: !def.abort,
|
|
221
|
-
});
|
|
222
|
-
}
|
|
247
|
+
const url = parseURLObject(trimmed, def);
|
|
248
|
+
if (url === URL_BAD_FORMAT) {
|
|
249
|
+
payload.issues.push({
|
|
250
|
+
code: "invalid_format",
|
|
251
|
+
format: "url",
|
|
252
|
+
note: "Invalid URL format",
|
|
253
|
+
input: payload.value,
|
|
254
|
+
inst,
|
|
255
|
+
continue: !def.abort,
|
|
256
|
+
});
|
|
257
|
+
return;
|
|
223
258
|
}
|
|
224
|
-
if (
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
inst,
|
|
234
|
-
continue: !def.abort,
|
|
235
|
-
});
|
|
236
|
-
}
|
|
259
|
+
if (url === URL_UNPARSEABLE) {
|
|
260
|
+
payload.issues.push({
|
|
261
|
+
code: "invalid_format",
|
|
262
|
+
format: "url",
|
|
263
|
+
input: payload.value,
|
|
264
|
+
inst,
|
|
265
|
+
continue: !def.abort,
|
|
266
|
+
});
|
|
267
|
+
return;
|
|
237
268
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
269
|
+
if (def.hostname && !urlHostnameOk(url, def.hostname)) {
|
|
270
|
+
payload.issues.push({
|
|
271
|
+
code: "invalid_format",
|
|
272
|
+
format: "url",
|
|
273
|
+
note: "Invalid hostname",
|
|
274
|
+
pattern: def.hostname.source,
|
|
275
|
+
input: payload.value,
|
|
276
|
+
inst,
|
|
277
|
+
continue: !def.abort,
|
|
278
|
+
});
|
|
242
279
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
280
|
+
if (def.protocol && !urlProtocolOk(url, def.protocol)) {
|
|
281
|
+
payload.issues.push({
|
|
282
|
+
code: "invalid_format",
|
|
283
|
+
format: "url",
|
|
284
|
+
note: "Invalid protocol",
|
|
285
|
+
pattern: def.protocol.source,
|
|
286
|
+
input: payload.value,
|
|
287
|
+
inst,
|
|
288
|
+
continue: !def.abort,
|
|
289
|
+
});
|
|
246
290
|
}
|
|
291
|
+
// Set the output value based on normalize flag
|
|
292
|
+
payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
|
|
247
293
|
return;
|
|
248
294
|
}
|
|
249
295
|
catch (_) {
|
|
@@ -262,7 +308,9 @@ export const $ZodEmoji = /*@__PURE__*/ core.$constructor("$ZodEmoji", (inst, def
|
|
|
262
308
|
$ZodStringFormat.init(inst, def);
|
|
263
309
|
});
|
|
264
310
|
export const $ZodNanoID = /*@__PURE__*/ core.$constructor("$ZodNanoID", (inst, def) => {
|
|
265
|
-
def.
|
|
311
|
+
if (def.length !== undefined && (!Number.isInteger(def.length) || def.length < 1))
|
|
312
|
+
throw new Error(`Invalid nanoid length: ${def.length}`);
|
|
313
|
+
def.pattern ?? (def.pattern = def.length === undefined ? regexes.nanoid : regexes.nanoidOfLength(def.length));
|
|
266
314
|
$ZodStringFormat.init(inst, def);
|
|
267
315
|
});
|
|
268
316
|
/**
|
|
@@ -309,19 +357,26 @@ export const $ZodISODuration = /*@__PURE__*/ core.$constructor("$ZodISODuration"
|
|
|
309
357
|
export const $ZodIPv4 = /*@__PURE__*/ core.$constructor("$ZodIPv4", (inst, def) => {
|
|
310
358
|
def.pattern ?? (def.pattern = regexes.ipv4);
|
|
311
359
|
$ZodStringFormat.init(inst, def);
|
|
312
|
-
inst._zod.bag.format = `ipv4`;
|
|
313
360
|
});
|
|
361
|
+
/** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
|
|
362
|
+
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
363
|
+
export function isValidIPv6(value) {
|
|
364
|
+
if (!ipv6Alphabet.test(value))
|
|
365
|
+
return false;
|
|
366
|
+
try {
|
|
367
|
+
// @ts-ignore
|
|
368
|
+
new URL(`http://[${value}]`);
|
|
369
|
+
return true;
|
|
370
|
+
}
|
|
371
|
+
catch {
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
314
375
|
export const $ZodIPv6 = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def) => {
|
|
315
376
|
def.pattern ?? (def.pattern = regexes.ipv6);
|
|
316
377
|
$ZodStringFormat.init(inst, def);
|
|
317
|
-
inst._zod.bag.format = `ipv6`;
|
|
318
378
|
inst._zod.check = (payload) => {
|
|
319
|
-
|
|
320
|
-
// @ts-ignore
|
|
321
|
-
new URL(`http://[${payload.value}]`);
|
|
322
|
-
// return;
|
|
323
|
-
}
|
|
324
|
-
catch {
|
|
379
|
+
if (!isValidIPv6(payload.value)) {
|
|
325
380
|
payload.issues.push({
|
|
326
381
|
code: "invalid_format",
|
|
327
382
|
format: "ipv6",
|
|
@@ -335,32 +390,30 @@ export const $ZodIPv6 = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def)
|
|
|
335
390
|
export const $ZodMAC = /*@__PURE__*/ core.$constructor("$ZodMAC", (inst, def) => {
|
|
336
391
|
def.pattern ?? (def.pattern = regexes.mac(def.delimiter));
|
|
337
392
|
$ZodStringFormat.init(inst, def);
|
|
338
|
-
inst._zod.bag.format = `mac`;
|
|
339
393
|
});
|
|
340
394
|
export const $ZodCIDRv4 = /*@__PURE__*/ core.$constructor("$ZodCIDRv4", (inst, def) => {
|
|
341
395
|
def.pattern ?? (def.pattern = regexes.cidrv4);
|
|
342
396
|
$ZodStringFormat.init(inst, def);
|
|
343
397
|
});
|
|
398
|
+
export function isValidCIDRv6(value) {
|
|
399
|
+
const parts = value.split("/");
|
|
400
|
+
if (parts.length !== 2)
|
|
401
|
+
return false;
|
|
402
|
+
const [address, prefix] = parts;
|
|
403
|
+
if (!prefix)
|
|
404
|
+
return false;
|
|
405
|
+
const prefixNum = Number(prefix);
|
|
406
|
+
if (`${prefixNum}` !== prefix)
|
|
407
|
+
return false;
|
|
408
|
+
if (prefixNum < 0 || prefixNum > 128)
|
|
409
|
+
return false;
|
|
410
|
+
return isValidIPv6(address);
|
|
411
|
+
}
|
|
344
412
|
export const $ZodCIDRv6 = /*@__PURE__*/ core.$constructor("$ZodCIDRv6", (inst, def) => {
|
|
345
413
|
def.pattern ?? (def.pattern = regexes.cidrv6); // not used for validation
|
|
346
414
|
$ZodStringFormat.init(inst, def);
|
|
347
415
|
inst._zod.check = (payload) => {
|
|
348
|
-
|
|
349
|
-
try {
|
|
350
|
-
if (parts.length !== 2)
|
|
351
|
-
throw new Error();
|
|
352
|
-
const [address, prefix] = parts;
|
|
353
|
-
if (!prefix)
|
|
354
|
-
throw new Error();
|
|
355
|
-
const prefixNum = Number(prefix);
|
|
356
|
-
if (`${prefixNum}` !== prefix)
|
|
357
|
-
throw new Error();
|
|
358
|
-
if (prefixNum < 0 || prefixNum > 128)
|
|
359
|
-
throw new Error();
|
|
360
|
-
// @ts-ignore
|
|
361
|
-
new URL(`http://[${address}]`);
|
|
362
|
-
}
|
|
363
|
-
catch {
|
|
416
|
+
if (!isValidCIDRv6(payload.value)) {
|
|
364
417
|
payload.issues.push({
|
|
365
418
|
code: "invalid_format",
|
|
366
419
|
format: "cidrv6",
|
|
@@ -389,10 +442,11 @@ export function isValidBase64(data) {
|
|
|
389
442
|
return false;
|
|
390
443
|
}
|
|
391
444
|
}
|
|
445
|
+
// lax on purpose: the quantified regexes.base64 overflows the regex stack on multi-MB input and its leading ^$| alternation leaks through template-literal composition; isValidBase64 enforces length and padding
|
|
446
|
+
export const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
|
|
392
447
|
export const $ZodBase64 = /*@__PURE__*/ core.$constructor("$ZodBase64", (inst, def) => {
|
|
393
|
-
def.pattern ?? (def.pattern =
|
|
448
|
+
def.pattern ?? (def.pattern = base64Charset);
|
|
394
449
|
$ZodStringFormat.init(inst, def);
|
|
395
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
396
450
|
inst._zod.check = (payload) => {
|
|
397
451
|
if (isValidBase64(payload.value))
|
|
398
452
|
return;
|
|
@@ -405,18 +459,19 @@ export const $ZodBase64 = /*@__PURE__*/ core.$constructor("$ZodBase64", (inst, d
|
|
|
405
459
|
});
|
|
406
460
|
};
|
|
407
461
|
});
|
|
408
|
-
//////////////////////////////
|
|
462
|
+
////////////////////////////// ZodBase64URL //////////////////////////////
|
|
463
|
+
// lax on purpose: the quantified regexes.base64url overflows the regex stack on multi-MB input; isValidBase64 enforces length on the padded string
|
|
464
|
+
export const base64urlCharset = /^[A-Za-z0-9_-]*$/;
|
|
409
465
|
export function isValidBase64URL(data) {
|
|
410
|
-
if (!
|
|
466
|
+
if (!base64urlCharset.test(data))
|
|
411
467
|
return false;
|
|
412
468
|
const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
|
|
413
469
|
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
|
|
414
470
|
return isValidBase64(padded);
|
|
415
471
|
}
|
|
416
472
|
export const $ZodBase64URL = /*@__PURE__*/ core.$constructor("$ZodBase64URL", (inst, def) => {
|
|
417
|
-
def.pattern ?? (def.pattern =
|
|
473
|
+
def.pattern ?? (def.pattern = base64urlCharset);
|
|
418
474
|
$ZodStringFormat.init(inst, def);
|
|
419
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
420
475
|
inst._zod.check = (payload) => {
|
|
421
476
|
if (isValidBase64URL(payload.value))
|
|
422
477
|
return;
|
|
@@ -433,6 +488,77 @@ export const $ZodE164 = /*@__PURE__*/ core.$constructor("$ZodE164", (inst, def)
|
|
|
433
488
|
def.pattern ?? (def.pattern = regexes.e164);
|
|
434
489
|
$ZodStringFormat.init(inst, def);
|
|
435
490
|
});
|
|
491
|
+
////////////////////////////// ZodCreditCard //////////////////////////////
|
|
492
|
+
const CC_SANITIZE = /[- ]/g;
|
|
493
|
+
/** Luhn checksum on a digit-only string. Adapted from valibot (MIT). */
|
|
494
|
+
function isLuhnAlgo(digits) {
|
|
495
|
+
let length = digits.length;
|
|
496
|
+
let bit = 1;
|
|
497
|
+
let sum = 0;
|
|
498
|
+
while (length) {
|
|
499
|
+
const value = digits.charCodeAt(--length) - 48;
|
|
500
|
+
bit ^= 1;
|
|
501
|
+
sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value;
|
|
502
|
+
}
|
|
503
|
+
return sum % 10 === 0;
|
|
504
|
+
}
|
|
505
|
+
export function isValidCreditCard(input) {
|
|
506
|
+
if (!regexes.creditCard.test(input))
|
|
507
|
+
return false;
|
|
508
|
+
return isLuhnAlgo(input.replace(CC_SANITIZE, ""));
|
|
509
|
+
}
|
|
510
|
+
export const $ZodCreditCard = /*@__PURE__*/ core.$constructor("$ZodCreditCard", (inst, def) => {
|
|
511
|
+
// Shape only — the Luhn check below is not expressible as a pattern, so consumers of `pattern` (JSON Schema, template literals) get the length and separator rules alone.
|
|
512
|
+
def.pattern ?? (def.pattern = regexes.creditCard);
|
|
513
|
+
$ZodStringFormat.init(inst, def);
|
|
514
|
+
inst._zod.check = (payload) => {
|
|
515
|
+
if (isValidCreditCard(payload.value))
|
|
516
|
+
return;
|
|
517
|
+
payload.issues.push({
|
|
518
|
+
code: "invalid_format",
|
|
519
|
+
format: "credit_card",
|
|
520
|
+
input: payload.value,
|
|
521
|
+
inst,
|
|
522
|
+
continue: !def.abort,
|
|
523
|
+
});
|
|
524
|
+
};
|
|
525
|
+
});
|
|
526
|
+
////////////////////////////// ZodIBAN //////////////////////////////
|
|
527
|
+
// iso 7064 mod 97-10 checksum without BigInt
|
|
528
|
+
function isIso7064Mod97(iban) {
|
|
529
|
+
let remainder = 0;
|
|
530
|
+
const len = iban.length;
|
|
531
|
+
for (let i = 4; i < len; i++) {
|
|
532
|
+
const code = iban.charCodeAt(i);
|
|
533
|
+
remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
|
|
534
|
+
}
|
|
535
|
+
for (let i = 0; i < 4; i++) {
|
|
536
|
+
const code = iban.charCodeAt(i);
|
|
537
|
+
remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
|
|
538
|
+
}
|
|
539
|
+
return remainder === 1;
|
|
540
|
+
}
|
|
541
|
+
export function isValidIBAN(input) {
|
|
542
|
+
if (!regexes.iban.test(input))
|
|
543
|
+
return false;
|
|
544
|
+
return isIso7064Mod97(input);
|
|
545
|
+
}
|
|
546
|
+
export const $ZodIBAN = /*@__PURE__*/ core.$constructor("$ZodIBAN", (inst, def) => {
|
|
547
|
+
// shape only — checksum is not expressible as a pattern
|
|
548
|
+
def.pattern ?? (def.pattern = regexes.iban);
|
|
549
|
+
$ZodStringFormat.init(inst, def);
|
|
550
|
+
inst._zod.check = (payload) => {
|
|
551
|
+
if (isValidIBAN(payload.value))
|
|
552
|
+
return;
|
|
553
|
+
payload.issues.push({
|
|
554
|
+
code: "invalid_format",
|
|
555
|
+
format: "iban",
|
|
556
|
+
input: payload.value,
|
|
557
|
+
inst,
|
|
558
|
+
continue: !def.abort,
|
|
559
|
+
});
|
|
560
|
+
};
|
|
561
|
+
});
|
|
436
562
|
////////////////////////////// ZodJWT //////////////////////////////
|
|
437
563
|
export function isValidJWT(token, algorithm = null) {
|
|
438
564
|
try {
|
|
@@ -486,7 +612,7 @@ export const $ZodCustomStringFormat = /*@__PURE__*/ core.$constructor("$ZodCusto
|
|
|
486
612
|
});
|
|
487
613
|
export const $ZodNumber = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, def) => {
|
|
488
614
|
$ZodType.init(inst, def);
|
|
489
|
-
inst._zod.pattern =
|
|
615
|
+
inst._zod.pattern = regexes.number;
|
|
490
616
|
inst._zod.parse = (payload, _ctx) => {
|
|
491
617
|
if (def.coerce)
|
|
492
618
|
try {
|
|
@@ -501,7 +627,7 @@ export const $ZodNumber = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, d
|
|
|
501
627
|
? Number.isNaN(input)
|
|
502
628
|
? "NaN"
|
|
503
629
|
: !Number.isFinite(input)
|
|
504
|
-
?
|
|
630
|
+
? String(input)
|
|
505
631
|
: undefined
|
|
506
632
|
: undefined;
|
|
507
633
|
payload.issues.push({
|
|
@@ -679,6 +805,8 @@ function handleArrayResult(result, final, index) {
|
|
|
679
805
|
}
|
|
680
806
|
export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def) => {
|
|
681
807
|
$ZodType.init(inst, def);
|
|
808
|
+
const memo = core.globalConfig.memoizer;
|
|
809
|
+
memo?.attach(inst);
|
|
682
810
|
inst._zod.parse = (payload, ctx) => {
|
|
683
811
|
const input = payload.value;
|
|
684
812
|
if (!Array.isArray(input)) {
|
|
@@ -690,8 +818,9 @@ export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def
|
|
|
690
818
|
});
|
|
691
819
|
return payload;
|
|
692
820
|
}
|
|
693
|
-
payload.value = Array(input.length);
|
|
821
|
+
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
694
822
|
const proms = [];
|
|
823
|
+
const abortEarly = ctx?.abortEarly;
|
|
695
824
|
for (let i = 0; i < input.length; i++) {
|
|
696
825
|
const item = input[i];
|
|
697
826
|
const result = def.element._zod.run({
|
|
@@ -703,6 +832,9 @@ export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def
|
|
|
703
832
|
}
|
|
704
833
|
else {
|
|
705
834
|
handleArrayResult(result, payload, i);
|
|
835
|
+
// the element's payload is authoritative here, since handleArrayResult forwards every issue; an object's is not, because it drops a failed absent optional
|
|
836
|
+
if (abortEarly && result.issues.length !== 0 && util.aborted(result))
|
|
837
|
+
break;
|
|
706
838
|
}
|
|
707
839
|
}
|
|
708
840
|
if (proms.length) {
|
|
@@ -711,16 +843,21 @@ export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def
|
|
|
711
843
|
return payload; //handleArrayResultsAsync(parseResults, final);
|
|
712
844
|
};
|
|
713
845
|
});
|
|
714
|
-
function handlePropertyResult(result, final, key, input,
|
|
846
|
+
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
715
847
|
const isPresent = key in input;
|
|
848
|
+
const isOptionalOut = optout === "optional";
|
|
849
|
+
// The middle rung means "absence permitted, nothing supplied in its place", so an absent key contributes nothing — whatever the schema made of `undefined` is invented, not substituted. Only `optional` reaches this with a value: `defaulted` substitutes, and a schema that isn't optional-out has to keep the key.
|
|
850
|
+
if (!isPresent && isOptionalOut && optin === "optional") {
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
716
853
|
if (result.issues.length) {
|
|
717
854
|
// For optional-in/out schemas, ignore errors on absent keys.
|
|
718
|
-
if (
|
|
855
|
+
if (optin !== undefined && isOptionalOut && !isPresent) {
|
|
719
856
|
return;
|
|
720
857
|
}
|
|
721
858
|
final.issues.push(...util.prefixIssues(key, result.issues));
|
|
722
859
|
}
|
|
723
|
-
if (!isPresent &&
|
|
860
|
+
if (!isPresent && optin === undefined) {
|
|
724
861
|
if (!result.issues.length) {
|
|
725
862
|
final.issues.push({
|
|
726
863
|
code: "invalid_type",
|
|
@@ -732,7 +869,7 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
732
869
|
return;
|
|
733
870
|
}
|
|
734
871
|
if (result.value === undefined) {
|
|
735
|
-
if (isPresent) {
|
|
872
|
+
if (isPresent || (optin === "defaulted" && !isOptionalOut)) {
|
|
736
873
|
final.value[key] = undefined;
|
|
737
874
|
}
|
|
738
875
|
}
|
|
@@ -740,46 +877,64 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
740
877
|
final.value[key] = result.value;
|
|
741
878
|
}
|
|
742
879
|
}
|
|
880
|
+
// one shared instance; a fresh [] per schema cost 56 bytes retained
|
|
881
|
+
const NO_SYMBOL_KEYS = [];
|
|
743
882
|
function normalizeDef(def) {
|
|
744
883
|
const keys = Object.keys(def.shape);
|
|
745
|
-
|
|
884
|
+
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
885
|
+
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
886
|
+
// aliases `keys` when there are no symbols, so a string-only shape keeps one array
|
|
887
|
+
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
888
|
+
for (const k of allKeys) {
|
|
746
889
|
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
747
|
-
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
890
|
+
throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
|
|
748
891
|
}
|
|
749
892
|
}
|
|
750
893
|
const okeys = util.optionalKeys(def.shape);
|
|
751
894
|
return {
|
|
752
895
|
...def,
|
|
753
|
-
|
|
896
|
+
allKeys,
|
|
897
|
+
symbolKeys,
|
|
898
|
+
// string-only: handleCatchall matches it against `for...in`, which never yields a symbol
|
|
754
899
|
keySet: new Set(keys),
|
|
755
900
|
numKeys: keys.length,
|
|
756
901
|
optionalKeys: new Set(okeys),
|
|
757
902
|
};
|
|
758
903
|
}
|
|
759
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
904
|
+
function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
760
905
|
const unrecognized = [];
|
|
761
906
|
const keySet = def.keySet;
|
|
762
907
|
const _catchall = def.catchall._zod;
|
|
763
908
|
const t = _catchall.def.type;
|
|
764
|
-
const
|
|
765
|
-
const
|
|
909
|
+
const optin = _catchall.optin;
|
|
910
|
+
const optout = _catchall.optout;
|
|
911
|
+
// starts at 0, not the current length: the shape phase already ran and may have aborted
|
|
912
|
+
let seen = 0;
|
|
766
913
|
for (const key in input) {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
914
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
915
|
+
if (util.aborted(payload, seen))
|
|
916
|
+
break;
|
|
917
|
+
seen = payload.issues.length;
|
|
918
|
+
}
|
|
919
|
+
// Must precede the __proto__ branch: a declared key is not unrecognized, even though the shape loop deliberately strips __proto__ from the parsed output.
|
|
771
920
|
if (keySet.has(key))
|
|
772
921
|
continue;
|
|
922
|
+
// Don't copy an undeclared __proto__ into the result; assignment to a plain {} would replace the result prototype. But in strict mode it is still an unknown key, so report it before skipping.
|
|
923
|
+
if (key === "__proto__") {
|
|
924
|
+
if (t === "never")
|
|
925
|
+
unrecognized.push(key);
|
|
926
|
+
continue;
|
|
927
|
+
}
|
|
773
928
|
if (t === "never") {
|
|
774
929
|
unrecognized.push(key);
|
|
775
930
|
continue;
|
|
776
931
|
}
|
|
777
932
|
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
778
933
|
if (r instanceof Promise) {
|
|
779
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
934
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
780
935
|
}
|
|
781
936
|
else {
|
|
782
|
-
handlePropertyResult(r, payload, key, input,
|
|
937
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
783
938
|
}
|
|
784
939
|
}
|
|
785
940
|
if (unrecognized.length) {
|
|
@@ -788,6 +943,8 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
788
943
|
keys: unrecognized,
|
|
789
944
|
input,
|
|
790
945
|
inst,
|
|
946
|
+
// Describes the shape of the input, not the validity of the parsed value, so it never aborts. The parse still fails; the schema's own checks just get to run first, and an enclosing intersection can reconcile the key against a sibling operand.
|
|
947
|
+
continue: true,
|
|
791
948
|
});
|
|
792
949
|
}
|
|
793
950
|
if (!proms.length)
|
|
@@ -799,30 +956,35 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
799
956
|
export const $ZodObject = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, def) => {
|
|
800
957
|
// requires cast because technically $ZodObject doesn't extend
|
|
801
958
|
$ZodType.init(inst, def);
|
|
802
|
-
// const sh = def.shape;
|
|
803
959
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
960
|
+
// a cloned def carries its source's accessor, which knows the shape it answers from; adopting that keeps the clone's keys readable without running it
|
|
961
|
+
const sh = desc?.get ? desc.get.raw : (def.shape ?? {});
|
|
962
|
+
if (sh) {
|
|
963
|
+
// Freezes the shape on first read, so its getters resolve once and every later read sees the same schemas.
|
|
964
|
+
const get = () => {
|
|
965
|
+
const newSh = { ...sh };
|
|
966
|
+
Object.defineProperty(def, "shape", { value: newSh });
|
|
967
|
+
get.raw = newSh;
|
|
968
|
+
return newSh;
|
|
969
|
+
};
|
|
970
|
+
get.raw = sh;
|
|
971
|
+
Object.defineProperty(def, "shape", { get });
|
|
815
972
|
}
|
|
816
973
|
const _normalized = util.cached(() => normalizeDef(def));
|
|
817
|
-
util.
|
|
818
|
-
const shape = def.shape;
|
|
974
|
+
util.defineLazyInternal(inst, "propValues", (zod) => {
|
|
975
|
+
const shape = zod.def.shape;
|
|
819
976
|
const propValues = {};
|
|
820
977
|
for (const key in shape) {
|
|
821
978
|
const field = shape[key]._zod;
|
|
822
979
|
if (field.values) {
|
|
823
|
-
|
|
980
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key)) {
|
|
981
|
+
util.assignProp(propValues, key, new Set());
|
|
982
|
+
}
|
|
824
983
|
for (const v of field.values)
|
|
825
984
|
propValues[key].add(v);
|
|
985
|
+
// An omittable slot reads back as undefined at a discriminator lookup, so it has to claim undefined: two options that can both omit the key are not discriminable on it.
|
|
986
|
+
if (field.optin !== undefined)
|
|
987
|
+
propValues[key].add(undefined);
|
|
826
988
|
}
|
|
827
989
|
}
|
|
828
990
|
return propValues;
|
|
@@ -830,6 +992,8 @@ export const $ZodObject = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, d
|
|
|
830
992
|
const isObject = util.isObject;
|
|
831
993
|
const catchall = def.catchall;
|
|
832
994
|
let value;
|
|
995
|
+
const memo = core.globalConfig.memoizer;
|
|
996
|
+
memo?.attach(inst);
|
|
833
997
|
inst._zod.parse = (payload, ctx) => {
|
|
834
998
|
value ?? (value = _normalized.value);
|
|
835
999
|
const input = payload.value;
|
|
@@ -842,25 +1006,34 @@ export const $ZodObject = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, d
|
|
|
842
1006
|
});
|
|
843
1007
|
return payload;
|
|
844
1008
|
}
|
|
845
|
-
payload.value = {};
|
|
1009
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
846
1010
|
const proms = [];
|
|
847
1011
|
const shape = value.shape;
|
|
848
|
-
|
|
1012
|
+
const abortEarly = ctx?.abortEarly;
|
|
1013
|
+
let seen = payload.issues.length;
|
|
1014
|
+
for (const key of value.allKeys) {
|
|
1015
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1016
|
+
if (util.aborted(payload, seen))
|
|
1017
|
+
break;
|
|
1018
|
+
seen = payload.issues.length;
|
|
1019
|
+
}
|
|
1020
|
+
if (key === "__proto__")
|
|
1021
|
+
continue;
|
|
849
1022
|
const el = shape[key];
|
|
850
|
-
const
|
|
851
|
-
const
|
|
1023
|
+
const optin = el._zod.optin;
|
|
1024
|
+
const optout = el._zod.optout;
|
|
852
1025
|
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
853
1026
|
if (r instanceof Promise) {
|
|
854
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1027
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
855
1028
|
}
|
|
856
1029
|
else {
|
|
857
|
-
handlePropertyResult(r, payload, key, input,
|
|
1030
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
858
1031
|
}
|
|
859
1032
|
}
|
|
860
1033
|
if (!catchall) {
|
|
861
1034
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
862
1035
|
}
|
|
863
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
1036
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
|
|
864
1037
|
};
|
|
865
1038
|
});
|
|
866
1039
|
export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -868,58 +1041,65 @@ export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (i
|
|
|
868
1041
|
$ZodObject.init(inst, def);
|
|
869
1042
|
const superParse = inst._zod.parse;
|
|
870
1043
|
const _normalized = util.cached(() => normalizeDef(def));
|
|
1044
|
+
const memo = core.globalConfig.memoizer;
|
|
871
1045
|
const generateFastpass = (shape) => {
|
|
872
|
-
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
873
1046
|
const normalized = _normalized.value;
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
}
|
|
1047
|
+
const syms = normalized.symbolKeys;
|
|
1048
|
+
// a symbol has no source literal, so it is read as `syms[i]` off the closed-over scope
|
|
1049
|
+
const doc = new Doc(["payload", "ctx"], { shape, inst, memo, syms });
|
|
1050
|
+
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1051
|
+
// prefixes in place, like util.prefixIssues. newResult must land before the early return: a catchall runs after this and would otherwise write onto the caller's input
|
|
1052
|
+
const prefixStr = (id, k) => `
|
|
1053
|
+
let ${id}_ab = false;
|
|
1054
|
+
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
1055
|
+
const iss = ${id}.issues[i];
|
|
1056
|
+
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
1057
|
+
payload.issues.push(iss);
|
|
1058
|
+
if (iss.continue !== true) ${id}_ab = true;
|
|
1059
|
+
}
|
|
1060
|
+
if (${id}_ab && ctx && ctx.abortEarly) {
|
|
1061
|
+
payload.value = newResult;
|
|
1062
|
+
return payload;
|
|
1063
|
+
}`;
|
|
878
1064
|
doc.write(`const input = payload.value;`);
|
|
879
1065
|
const ids = Object.create(null);
|
|
880
1066
|
let counter = 0;
|
|
881
|
-
for (const key of normalized.
|
|
1067
|
+
for (const key of normalized.allKeys) {
|
|
882
1068
|
ids[key] = `key_${counter++}`;
|
|
883
1069
|
}
|
|
884
1070
|
// A: preserve key order {
|
|
885
|
-
doc.write(`const newResult = {};`);
|
|
886
|
-
for (const key of normalized.
|
|
1071
|
+
doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
1072
|
+
for (const key of normalized.allKeys) {
|
|
1073
|
+
if (key === "__proto__")
|
|
1074
|
+
continue;
|
|
887
1075
|
const id = ids[key];
|
|
888
|
-
const k = util.esc(key);
|
|
1076
|
+
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : util.esc(key);
|
|
1077
|
+
const isPresent = `${k} in input`;
|
|
889
1078
|
const schema = shape[key];
|
|
890
|
-
const
|
|
1079
|
+
const optin = schema?._zod?.optin;
|
|
1080
|
+
const isOptionalIn = optin !== undefined;
|
|
891
1081
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
892
|
-
doc.write(`const ${id} = ${parseStr(
|
|
1082
|
+
doc.write(`const ${id} = ${parseStr(k)};`);
|
|
893
1083
|
if (isOptionalIn && isOptionalOut) {
|
|
894
|
-
// For optional-in/out schemas, ignore errors on absent keys
|
|
1084
|
+
// For optional-in/out schemas, ignore errors on absent keys — and, like the interpreted path, drop the value produced alongside them. The middle rung goes further: it permits absence without supplying anything in its place, so an absent key contributes nothing at all.
|
|
1085
|
+
const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
|
|
895
1086
|
doc.write(`
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
...iss,
|
|
900
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
901
|
-
})));
|
|
1087
|
+
const ${id}_present = ${isPresent};
|
|
1088
|
+
if (!${id}.issues.length || ${id}_present) {
|
|
1089
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
902
1090
|
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
if (${k} in input) {
|
|
907
|
-
newResult[${k}] = undefined;
|
|
1091
|
+
|
|
1092
|
+
if (${assign}) {
|
|
1093
|
+
newResult[${k}] = ${id}.value;
|
|
908
1094
|
}
|
|
909
|
-
} else {
|
|
910
|
-
newResult[${k}] = ${id}.value;
|
|
911
1095
|
}
|
|
912
|
-
|
|
1096
|
+
|
|
913
1097
|
`);
|
|
914
1098
|
}
|
|
915
1099
|
else if (!isOptionalIn) {
|
|
916
1100
|
doc.write(`
|
|
917
|
-
const ${id}_present = ${
|
|
918
|
-
if (${id}.issues.length) {
|
|
919
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
920
|
-
...iss,
|
|
921
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
922
|
-
})));
|
|
1101
|
+
const ${id}_present = ${isPresent};
|
|
1102
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
923
1103
|
}
|
|
924
1104
|
if (!${id}_present && !${id}.issues.length) {
|
|
925
1105
|
payload.issues.push({
|
|
@@ -928,42 +1108,39 @@ export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (i
|
|
|
928
1108
|
input: undefined,
|
|
929
1109
|
path: [${k}]
|
|
930
1110
|
});
|
|
1111
|
+
if (ctx && ctx.abortEarly) {
|
|
1112
|
+
payload.value = newResult;
|
|
1113
|
+
return payload;
|
|
1114
|
+
}
|
|
931
1115
|
}
|
|
932
1116
|
|
|
933
1117
|
if (${id}_present) {
|
|
934
|
-
|
|
935
|
-
newResult[${k}] = undefined;
|
|
936
|
-
} else {
|
|
937
|
-
newResult[${k}] = ${id}.value;
|
|
938
|
-
}
|
|
1118
|
+
newResult[${k}] = ${id}.value;
|
|
939
1119
|
}
|
|
940
1120
|
|
|
941
1121
|
`);
|
|
942
1122
|
}
|
|
943
1123
|
else {
|
|
944
1124
|
doc.write(`
|
|
945
|
-
if (${id}.issues.length) {
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
newResult[${k}] = undefined;
|
|
955
|
-
}
|
|
956
|
-
} else {
|
|
1125
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1126
|
+
}
|
|
1127
|
+
`);
|
|
1128
|
+
if (optin === "defaulted") {
|
|
1129
|
+
doc.write(`newResult[${k}] = ${id}.value;`);
|
|
1130
|
+
}
|
|
1131
|
+
else {
|
|
1132
|
+
doc.write(`
|
|
1133
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
957
1134
|
newResult[${k}] = ${id}.value;
|
|
958
1135
|
}
|
|
959
|
-
|
|
960
1136
|
`);
|
|
1137
|
+
}
|
|
961
1138
|
}
|
|
962
1139
|
}
|
|
963
1140
|
doc.write(`payload.value = newResult;`);
|
|
964
1141
|
doc.write(`return payload;`);
|
|
965
|
-
|
|
966
|
-
return (
|
|
1142
|
+
// closing `shape` in is what pays: turbofan specializes the parser against that one shape object, so every `shape[k]._zod.run` folds to a known callee. as a parameter it stays a generic load and measures 13% slower even with the forwarding frame gone
|
|
1143
|
+
return doc.compile();
|
|
967
1144
|
};
|
|
968
1145
|
let fastpass;
|
|
969
1146
|
const isObject = util.isObject;
|
|
@@ -991,7 +1168,7 @@ export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (i
|
|
|
991
1168
|
payload = fastpass(payload, ctx);
|
|
992
1169
|
if (!catchall)
|
|
993
1170
|
return payload;
|
|
994
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
1171
|
+
return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
|
|
995
1172
|
}
|
|
996
1173
|
return superParse(payload, ctx);
|
|
997
1174
|
};
|
|
@@ -1018,17 +1195,21 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
1018
1195
|
}
|
|
1019
1196
|
export const $ZodUnion = /*@__PURE__*/ core.$constructor("$ZodUnion", (inst, def) => {
|
|
1020
1197
|
$ZodType.init(inst, def);
|
|
1021
|
-
util.
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1198
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted")
|
|
1199
|
+
? "defaulted"
|
|
1200
|
+
: zod.def.options.some((o) => o._zod.optin !== undefined)
|
|
1201
|
+
? "optional"
|
|
1202
|
+
: undefined);
|
|
1203
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
|
|
1204
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
1205
|
+
if (zod.def.options.every((o) => o._zod.values)) {
|
|
1206
|
+
return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1026
1207
|
}
|
|
1027
1208
|
return undefined;
|
|
1028
1209
|
});
|
|
1029
|
-
util.
|
|
1030
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
1031
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
1210
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
1211
|
+
if (zod.def.options.every((o) => o._zod.pattern)) {
|
|
1212
|
+
const patterns = zod.def.options.map((o) => o._zod.pattern);
|
|
1032
1213
|
return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join("|")})$`);
|
|
1033
1214
|
}
|
|
1034
1215
|
return undefined;
|
|
@@ -1063,12 +1244,16 @@ export const $ZodUnion = /*@__PURE__*/ core.$constructor("$ZodUnion", (inst, def
|
|
|
1063
1244
|
};
|
|
1064
1245
|
});
|
|
1065
1246
|
function handleExclusiveUnionResults(results, final, inst, ctx) {
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1068
|
-
|
|
1247
|
+
const matches = [];
|
|
1248
|
+
for (let i = 0; i < results.length; i++) {
|
|
1249
|
+
if (results[i].issues.length === 0)
|
|
1250
|
+
matches.push(i);
|
|
1251
|
+
}
|
|
1252
|
+
if (matches.length === 1) {
|
|
1253
|
+
final.value = results[matches[0]].value;
|
|
1069
1254
|
return final;
|
|
1070
1255
|
}
|
|
1071
|
-
if (
|
|
1256
|
+
if (matches.length === 0) {
|
|
1072
1257
|
// No matches - same as regular union
|
|
1073
1258
|
final.issues.push({
|
|
1074
1259
|
code: "invalid_union",
|
|
@@ -1085,6 +1270,7 @@ function handleExclusiveUnionResults(results, final, inst, ctx) {
|
|
|
1085
1270
|
inst,
|
|
1086
1271
|
errors: [],
|
|
1087
1272
|
inclusive: false,
|
|
1273
|
+
matches,
|
|
1088
1274
|
});
|
|
1089
1275
|
}
|
|
1090
1276
|
return final;
|
|
@@ -1119,44 +1305,75 @@ export const $ZodXor = /*@__PURE__*/ core.$constructor("$ZodXor", (inst, def) =>
|
|
|
1119
1305
|
});
|
|
1120
1306
|
};
|
|
1121
1307
|
});
|
|
1308
|
+
/** Returns the option whose discriminator claims `value`, or throws if ambiguous. */
|
|
1309
|
+
export function getDiscriminatedOption(union, value) {
|
|
1310
|
+
const internals = union._zod;
|
|
1311
|
+
let map = internals.bag.optionsMap;
|
|
1312
|
+
if (!map) {
|
|
1313
|
+
map = discriminatorMap(internals.def);
|
|
1314
|
+
internals.bag.optionsMap = map;
|
|
1315
|
+
}
|
|
1316
|
+
const option = map.get(value);
|
|
1317
|
+
if (option === null)
|
|
1318
|
+
throw new Error(`Ambiguous discriminator value "${String(value)}"`);
|
|
1319
|
+
return option;
|
|
1320
|
+
}
|
|
1321
|
+
function discriminatorMap(def) {
|
|
1322
|
+
const map = new Map();
|
|
1323
|
+
for (const option of def.options) {
|
|
1324
|
+
const values = option._zod.propValues?.[def.discriminator];
|
|
1325
|
+
if (!values || values.size === 0)
|
|
1326
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
1327
|
+
for (const value of values) {
|
|
1328
|
+
if (map.has(value)) {
|
|
1329
|
+
if (value !== undefined)
|
|
1330
|
+
throw new Error(`Duplicate discriminator value "${String(value)}"`);
|
|
1331
|
+
// keep the collision marked so a later member cannot reclaim it
|
|
1332
|
+
map.set(value, null);
|
|
1333
|
+
}
|
|
1334
|
+
else {
|
|
1335
|
+
map.set(value, option);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
return map;
|
|
1340
|
+
}
|
|
1122
1341
|
export const $ZodDiscriminatedUnion =
|
|
1123
1342
|
/*@__PURE__*/
|
|
1124
1343
|
core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
1125
1344
|
def.inclusive = false;
|
|
1126
1345
|
$ZodUnion.init(inst, def);
|
|
1127
1346
|
const _super = inst._zod.parse;
|
|
1128
|
-
util.
|
|
1347
|
+
util.defineLazyInternal(inst, "propValues", (zod) => {
|
|
1129
1348
|
const propValues = {};
|
|
1130
|
-
|
|
1349
|
+
let undefinedCount = 0;
|
|
1350
|
+
for (const option of zod.def.options) {
|
|
1131
1351
|
const pv = option._zod.propValues;
|
|
1132
1352
|
if (!pv || Object.keys(pv).length === 0)
|
|
1133
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
1353
|
+
throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
|
|
1354
|
+
if (pv[zod.def.discriminator]?.has(undefined))
|
|
1355
|
+
undefinedCount++;
|
|
1134
1356
|
for (const [k, v] of Object.entries(pv)) {
|
|
1135
|
-
if (!propValues
|
|
1136
|
-
propValues
|
|
1357
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
|
|
1358
|
+
util.assignProp(propValues, k, new Set());
|
|
1359
|
+
}
|
|
1137
1360
|
for (const val of v) {
|
|
1138
1361
|
propValues[k].add(val);
|
|
1139
1362
|
}
|
|
1140
1363
|
}
|
|
1141
1364
|
}
|
|
1365
|
+
if (!zod.def.unionFallback && undefinedCount > 1)
|
|
1366
|
+
propValues[zod.def.discriminator]?.delete(undefined);
|
|
1142
1367
|
return propValues;
|
|
1143
1368
|
});
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
const
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
if (!values || values.size === 0)
|
|
1150
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
1151
|
-
for (const v of values) {
|
|
1152
|
-
if (map.has(v)) {
|
|
1153
|
-
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
1154
|
-
}
|
|
1155
|
-
map.set(v, o);
|
|
1156
|
-
}
|
|
1369
|
+
// Checked now rather than in the lookup map below, so an option that lacks the discriminator fails at the `discriminatedUnion` call instead of on the first object parsed. Options whose shape cannot be enumerated without resolving it — pipes and lazies — are left to the map.
|
|
1370
|
+
def.options.forEach((option, i) => {
|
|
1371
|
+
const propShape = util.rawShape(option._zod.def);
|
|
1372
|
+
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
|
|
1373
|
+
throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
1157
1374
|
}
|
|
1158
|
-
return map;
|
|
1159
1375
|
});
|
|
1376
|
+
const disc = util.cached(() => discriminatorMap(def));
|
|
1160
1377
|
inst._zod.parse = (payload, ctx) => {
|
|
1161
1378
|
const input = payload.value;
|
|
1162
1379
|
if (!util.isObject(input)) {
|
|
@@ -1168,14 +1385,15 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1168
1385
|
});
|
|
1169
1386
|
return payload;
|
|
1170
1387
|
}
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1388
|
+
const value = input?.[def.discriminator];
|
|
1389
|
+
const opt = disc.value.get(value);
|
|
1390
|
+
// forward metadata cannot choose an encoder for an absent tag
|
|
1391
|
+
if (opt && (value !== undefined || ctx.direction !== "backward")) {
|
|
1173
1392
|
return opt._zod.run(payload, ctx);
|
|
1174
1393
|
}
|
|
1175
1394
|
// Fall back to union matching when the fast discriminator path fails:
|
|
1176
1395
|
// - explicitly enabled via unionFallback, or
|
|
1177
|
-
// - during backward direction (encode), since codec-based discriminators
|
|
1178
|
-
// have different values in forward vs backward directions
|
|
1396
|
+
// - during backward direction (encode), since codec-based discriminators have different values in forward vs backward directions
|
|
1179
1397
|
if (def.unionFallback || ctx.direction === "backward") {
|
|
1180
1398
|
return _super(payload, ctx);
|
|
1181
1399
|
}
|
|
@@ -1185,7 +1403,7 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1185
1403
|
errors: [],
|
|
1186
1404
|
note: "No matching discriminator",
|
|
1187
1405
|
discriminator: def.discriminator,
|
|
1188
|
-
options: Array.from(disc.value.keys()),
|
|
1406
|
+
options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
|
|
1189
1407
|
input,
|
|
1190
1408
|
path: [def.discriminator],
|
|
1191
1409
|
inst,
|
|
@@ -1208,7 +1426,7 @@ export const $ZodIntersection = /*@__PURE__*/ core.$constructor("$ZodIntersectio
|
|
|
1208
1426
|
return handleIntersectionResults(payload, left, right);
|
|
1209
1427
|
};
|
|
1210
1428
|
});
|
|
1211
|
-
function mergeValues(a, b) {
|
|
1429
|
+
export function mergeValues(a, b) {
|
|
1212
1430
|
// const aType = parse.t(a);
|
|
1213
1431
|
// const bType = parse.t(b);
|
|
1214
1432
|
if (a === b) {
|
|
@@ -1221,7 +1439,11 @@ function mergeValues(a, b) {
|
|
|
1221
1439
|
const bKeys = Object.keys(b);
|
|
1222
1440
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
1223
1441
|
const newObj = { ...a, ...b };
|
|
1442
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
|
|
1443
|
+
delete newObj.__proto__;
|
|
1224
1444
|
for (const key of sharedKeys) {
|
|
1445
|
+
if (key === "__proto__")
|
|
1446
|
+
continue;
|
|
1225
1447
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
1226
1448
|
if (!sharedValue.valid) {
|
|
1227
1449
|
return {
|
|
@@ -1255,43 +1477,55 @@ function mergeValues(a, b) {
|
|
|
1255
1477
|
return { valid: false, mergeErrorPath: [] };
|
|
1256
1478
|
}
|
|
1257
1479
|
function handleIntersectionResults(result, left, right) {
|
|
1258
|
-
// Track which side(s)
|
|
1480
|
+
// Track which side(s) reject each key. A key rejection is reported only when BOTH sides reject it, so a key owned by one branch survives the other's key schema. strictObject reports these as unrecognized_keys; a record with an open key schema reports one invalid_key per key.
|
|
1259
1481
|
const unrecKeys = new Map();
|
|
1260
1482
|
let unrecIssue;
|
|
1261
|
-
|
|
1262
|
-
|
|
1483
|
+
const keyIssues = new Map();
|
|
1484
|
+
const collect = (iss, side) => {
|
|
1485
|
+
let keys;
|
|
1486
|
+
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
1263
1487
|
unrecIssue ?? (unrecIssue = iss);
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1488
|
+
keys = iss.keys;
|
|
1489
|
+
}
|
|
1490
|
+
else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
1491
|
+
const k = String(iss.path[0]);
|
|
1492
|
+
if (!keyIssues.has(k))
|
|
1493
|
+
keyIssues.set(k, iss);
|
|
1494
|
+
keys = [k];
|
|
1269
1495
|
}
|
|
1270
1496
|
else {
|
|
1271
|
-
|
|
1497
|
+
return false;
|
|
1272
1498
|
}
|
|
1499
|
+
for (const k of keys) {
|
|
1500
|
+
if (!unrecKeys.has(k))
|
|
1501
|
+
unrecKeys.set(k, {});
|
|
1502
|
+
unrecKeys.get(k)[side] = true;
|
|
1503
|
+
}
|
|
1504
|
+
return true;
|
|
1505
|
+
};
|
|
1506
|
+
for (const iss of left.issues) {
|
|
1507
|
+
if (!collect(iss, "l"))
|
|
1508
|
+
result.issues.push(iss);
|
|
1273
1509
|
}
|
|
1274
1510
|
for (const iss of right.issues) {
|
|
1275
|
-
if (iss
|
|
1276
|
-
for (const k of iss.keys) {
|
|
1277
|
-
if (!unrecKeys.has(k))
|
|
1278
|
-
unrecKeys.set(k, {});
|
|
1279
|
-
unrecKeys.get(k).r = true;
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
else {
|
|
1511
|
+
if (!collect(iss, "r"))
|
|
1283
1512
|
result.issues.push(iss);
|
|
1284
|
-
}
|
|
1285
1513
|
}
|
|
1286
|
-
// Report only keys
|
|
1514
|
+
// Report only keys rejected by BOTH sides
|
|
1287
1515
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1288
|
-
if (bothKeys.length
|
|
1289
|
-
|
|
1516
|
+
if (bothKeys.length) {
|
|
1517
|
+
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
1518
|
+
if (aggregated.length)
|
|
1519
|
+
result.issues.push({ ...unrecIssue, keys: aggregated });
|
|
1520
|
+
for (const k of bothKeys) {
|
|
1521
|
+
if (!aggregated.includes(k) && keyIssues.has(k))
|
|
1522
|
+
result.issues.push(keyIssues.get(k));
|
|
1523
|
+
}
|
|
1290
1524
|
}
|
|
1291
|
-
if (util.aborted(result))
|
|
1292
|
-
return result;
|
|
1293
1525
|
const merged = mergeValues(left.value, right.value);
|
|
1294
1526
|
if (!merged.valid) {
|
|
1527
|
+
if (util.aborted(result))
|
|
1528
|
+
return result;
|
|
1295
1529
|
throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
|
|
1296
1530
|
}
|
|
1297
1531
|
result.value = merged.data;
|
|
@@ -1300,6 +1534,8 @@ function handleIntersectionResults(result, left, right) {
|
|
|
1300
1534
|
export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def) => {
|
|
1301
1535
|
$ZodType.init(inst, def);
|
|
1302
1536
|
const items = def.items;
|
|
1537
|
+
const memo = core.globalConfig.memoizer;
|
|
1538
|
+
memo?.attach(inst);
|
|
1303
1539
|
inst._zod.parse = (payload, ctx) => {
|
|
1304
1540
|
const input = payload.value;
|
|
1305
1541
|
if (!Array.isArray(input)) {
|
|
@@ -1311,7 +1547,7 @@ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def
|
|
|
1311
1547
|
});
|
|
1312
1548
|
return payload;
|
|
1313
1549
|
}
|
|
1314
|
-
payload.value = [];
|
|
1550
|
+
payload.value = memo ? memo.alloc(inst, payload, [], ctx) : [];
|
|
1315
1551
|
const proms = [];
|
|
1316
1552
|
const optinStart = getTupleOptStart(items, "optin");
|
|
1317
1553
|
const optoutStart = getTupleOptStart(items, "optout");
|
|
@@ -1338,11 +1574,11 @@ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def
|
|
|
1338
1574
|
});
|
|
1339
1575
|
}
|
|
1340
1576
|
}
|
|
1341
|
-
// Run every item in parallel, collecting results into an indexed
|
|
1342
|
-
// array. The post-processing in `handleTupleResults` walks them in
|
|
1343
|
-
// order so it can decide whether an absent optional-output error can
|
|
1344
|
-
// truncate the tail or must be reported to preserve required output.
|
|
1577
|
+
// Run every item in parallel, collecting results into an indexed array. The post-processing in `handleTupleResults` walks them in order so it can decide whether an absent optional-output error can truncate the tail or must be reported to preserve required output.
|
|
1345
1578
|
const itemResults = new Array(items.length);
|
|
1579
|
+
// only tracked when there is a rest loop to skip
|
|
1580
|
+
const abortEarly = def.rest ? ctx?.abortEarly : undefined;
|
|
1581
|
+
let itemAborted = false;
|
|
1346
1582
|
for (let i = 0; i < items.length; i++) {
|
|
1347
1583
|
const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
|
|
1348
1584
|
if (r instanceof Promise) {
|
|
@@ -1352,12 +1588,21 @@ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def
|
|
|
1352
1588
|
}
|
|
1353
1589
|
else {
|
|
1354
1590
|
itemResults[i] = r;
|
|
1591
|
+
if (abortEarly && !itemAborted && r.issues.length)
|
|
1592
|
+
itemAborted = util.aborted(r);
|
|
1355
1593
|
}
|
|
1356
1594
|
}
|
|
1357
|
-
|
|
1595
|
+
// sound because rest is non-empty exactly when every fixed index is present, the one case handleTupleResults cannot discard an item's issues
|
|
1596
|
+
if (def.rest && !itemAborted) {
|
|
1358
1597
|
let i = items.length - 1;
|
|
1359
1598
|
const rest = input.slice(items.length);
|
|
1599
|
+
let seen = payload.issues.length;
|
|
1360
1600
|
for (const el of rest) {
|
|
1601
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1602
|
+
if (util.aborted(payload, seen))
|
|
1603
|
+
break;
|
|
1604
|
+
seen = payload.issues.length;
|
|
1605
|
+
}
|
|
1361
1606
|
i++;
|
|
1362
1607
|
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
1363
1608
|
if (result instanceof Promise) {
|
|
@@ -1376,7 +1621,9 @@ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def
|
|
|
1376
1621
|
});
|
|
1377
1622
|
function getTupleOptStart(items, key) {
|
|
1378
1623
|
for (let i = items.length - 1; i >= 0; i--) {
|
|
1379
|
-
|
|
1624
|
+
// optin is a three-rung ladder so any rung above `undefined` permits an absent slot; optout stays two-valued.
|
|
1625
|
+
const omittable = key === "optin" ? items[i]._zod.optin !== undefined : items[i]._zod.optout === "optional";
|
|
1626
|
+
if (!omittable)
|
|
1380
1627
|
return i + 1;
|
|
1381
1628
|
}
|
|
1382
1629
|
return 0;
|
|
@@ -1388,12 +1635,15 @@ function handleTupleResult(result, final, index) {
|
|
|
1388
1635
|
final.value[index] = result.value;
|
|
1389
1636
|
}
|
|
1390
1637
|
function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
1391
|
-
// Walk results in order. Mirror $ZodObject's swallow-on-absent-optional
|
|
1392
|
-
// rule, but only after `optoutStart`: the first index where the output
|
|
1393
|
-
// tuple tail can be absent.
|
|
1638
|
+
// Walk results in order. Mirror $ZodObject's swallow-on-absent-optional rule, but only after `optoutStart`: the first index where the output tuple tail can be absent.
|
|
1394
1639
|
for (let i = 0; i < items.length; i++) {
|
|
1395
1640
|
const r = itemResults[i];
|
|
1396
1641
|
const isPresent = i < input.length;
|
|
1642
|
+
// The array analog of `handlePropertyResult`'s absent-key early return: the middle rung permits absence without supplying anything in its place, so the tail truncates here instead of materializing whatever the item made of `undefined`.
|
|
1643
|
+
if (!isPresent && i >= optoutStart && items[i]._zod.optin === "optional") {
|
|
1644
|
+
final.value.length = i;
|
|
1645
|
+
break;
|
|
1646
|
+
}
|
|
1397
1647
|
if (r.issues.length) {
|
|
1398
1648
|
if (!isPresent && i >= optoutStart) {
|
|
1399
1649
|
final.value.length = i;
|
|
@@ -1421,6 +1671,8 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
1421
1671
|
}
|
|
1422
1672
|
export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, def) => {
|
|
1423
1673
|
$ZodType.init(inst, def);
|
|
1674
|
+
const memo = core.globalConfig.memoizer;
|
|
1675
|
+
memo?.attach(inst);
|
|
1424
1676
|
inst._zod.parse = (payload, ctx) => {
|
|
1425
1677
|
const input = payload.value;
|
|
1426
1678
|
if (!util.isPlainObject(input)) {
|
|
@@ -1432,14 +1684,18 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1432
1684
|
});
|
|
1433
1685
|
return payload;
|
|
1434
1686
|
}
|
|
1687
|
+
// no guard in either loop below: a record's invalid_key aborts but an enclosing intersection can reconcile it, so a stopped loop hides keys the sibling does not own and the intersection then rejects nothing
|
|
1435
1688
|
const proms = [];
|
|
1436
1689
|
const values = def.keyType._zod.values;
|
|
1437
|
-
if (values) {
|
|
1438
|
-
payload.value = {};
|
|
1690
|
+
if (values && !def.partial) {
|
|
1691
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1439
1692
|
const recordKeys = new Set();
|
|
1440
1693
|
for (const key of values) {
|
|
1441
1694
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
1442
1695
|
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
1696
|
+
// A declared __proto__ is stripped but is not an unrecognized key.
|
|
1697
|
+
if (key === "__proto__")
|
|
1698
|
+
continue;
|
|
1443
1699
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1444
1700
|
if (keyResult instanceof Promise) {
|
|
1445
1701
|
throw new Error("Async schemas not supported in object keys currently");
|
|
@@ -1456,6 +1712,8 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1456
1712
|
continue;
|
|
1457
1713
|
}
|
|
1458
1714
|
const outKey = keyResult.value;
|
|
1715
|
+
if (outKey === "__proto__")
|
|
1716
|
+
continue;
|
|
1459
1717
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1460
1718
|
if (result instanceof Promise) {
|
|
1461
1719
|
proms.push(result.then((result) => {
|
|
@@ -1476,8 +1734,16 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1476
1734
|
let unrecognized;
|
|
1477
1735
|
for (const key in input) {
|
|
1478
1736
|
if (!recordKeys.has(key)) {
|
|
1479
|
-
|
|
1480
|
-
|
|
1737
|
+
if (def.mode === "loose") {
|
|
1738
|
+
// skip __proto__ so it can't replace the result prototype via the assignment setter on the plain {} we build into
|
|
1739
|
+
if (key === "__proto__")
|
|
1740
|
+
continue;
|
|
1741
|
+
payload.value[key] = input[key];
|
|
1742
|
+
}
|
|
1743
|
+
else {
|
|
1744
|
+
unrecognized = unrecognized ?? [];
|
|
1745
|
+
unrecognized.push(key);
|
|
1746
|
+
}
|
|
1481
1747
|
}
|
|
1482
1748
|
}
|
|
1483
1749
|
if (unrecognized && unrecognized.length > 0) {
|
|
@@ -1486,11 +1752,14 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1486
1752
|
input,
|
|
1487
1753
|
inst,
|
|
1488
1754
|
keys: unrecognized,
|
|
1755
|
+
continue: true,
|
|
1489
1756
|
});
|
|
1490
1757
|
}
|
|
1491
1758
|
}
|
|
1492
1759
|
else {
|
|
1493
|
-
payload.value = {};
|
|
1760
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1761
|
+
// An enumerable key schema declares which keys the record owns, so a key outside the set is unrecognized. A non-enumerable one (regex, refine) is a constraint every key must satisfy, so a failing key is invalid. Only the former is reconcilable against the other side of an intersection.
|
|
1762
|
+
let unrecognized;
|
|
1494
1763
|
// Reflect.ownKeys for Symbol-key support; filter non-enumerable to match z.object()
|
|
1495
1764
|
for (const key of Reflect.ownKeys(input)) {
|
|
1496
1765
|
if (key === "__proto__")
|
|
@@ -1501,8 +1770,7 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1501
1770
|
if (keyResult instanceof Promise) {
|
|
1502
1771
|
throw new Error("Async schemas not supported in object keys currently");
|
|
1503
1772
|
}
|
|
1504
|
-
// Numeric string fallback: if key is a numeric string and failed, retry with Number(key)
|
|
1505
|
-
// This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
|
|
1773
|
+
// Numeric string fallback: if key is a numeric string and failed, retry with Number(key). This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
|
|
1506
1774
|
const checkNumericKey = typeof key === "string" && regexes.number.test(key) && keyResult.issues.length;
|
|
1507
1775
|
if (checkNumericKey) {
|
|
1508
1776
|
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
@@ -1518,6 +1786,10 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1518
1786
|
// Pass through unchanged
|
|
1519
1787
|
payload.value[key] = input[key];
|
|
1520
1788
|
}
|
|
1789
|
+
else if (values) {
|
|
1790
|
+
unrecognized = unrecognized ?? [];
|
|
1791
|
+
unrecognized.push(key);
|
|
1792
|
+
}
|
|
1521
1793
|
else {
|
|
1522
1794
|
// Default "strict" behavior: error on invalid key
|
|
1523
1795
|
payload.issues.push({
|
|
@@ -1531,22 +1803,35 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1531
1803
|
}
|
|
1532
1804
|
continue;
|
|
1533
1805
|
}
|
|
1806
|
+
// the guard above tests the raw input key, but the key schema can normalize an ordinary key into __proto__; re-check the key we actually write under
|
|
1807
|
+
const outKey = keyResult.value;
|
|
1808
|
+
if (outKey === "__proto__")
|
|
1809
|
+
continue;
|
|
1534
1810
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1535
1811
|
if (result instanceof Promise) {
|
|
1536
1812
|
proms.push(result.then((result) => {
|
|
1537
1813
|
if (result.issues.length) {
|
|
1538
1814
|
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
1539
1815
|
}
|
|
1540
|
-
payload.value[
|
|
1816
|
+
payload.value[outKey] = result.value;
|
|
1541
1817
|
}));
|
|
1542
1818
|
}
|
|
1543
1819
|
else {
|
|
1544
1820
|
if (result.issues.length) {
|
|
1545
1821
|
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
1546
1822
|
}
|
|
1547
|
-
payload.value[
|
|
1823
|
+
payload.value[outKey] = result.value;
|
|
1548
1824
|
}
|
|
1549
1825
|
}
|
|
1826
|
+
if (unrecognized && unrecognized.length > 0) {
|
|
1827
|
+
payload.issues.push({
|
|
1828
|
+
code: "unrecognized_keys",
|
|
1829
|
+
input,
|
|
1830
|
+
inst,
|
|
1831
|
+
keys: unrecognized,
|
|
1832
|
+
continue: true,
|
|
1833
|
+
});
|
|
1834
|
+
}
|
|
1550
1835
|
}
|
|
1551
1836
|
if (proms.length) {
|
|
1552
1837
|
return Promise.all(proms).then(() => payload);
|
|
@@ -1556,6 +1841,8 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1556
1841
|
});
|
|
1557
1842
|
export const $ZodMap = /*@__PURE__*/ core.$constructor("$ZodMap", (inst, def) => {
|
|
1558
1843
|
$ZodType.init(inst, def);
|
|
1844
|
+
const memo = core.globalConfig.memoizer;
|
|
1845
|
+
memo?.attach(inst);
|
|
1559
1846
|
inst._zod.parse = (payload, ctx) => {
|
|
1560
1847
|
const input = payload.value;
|
|
1561
1848
|
if (!(input instanceof Map)) {
|
|
@@ -1568,8 +1855,15 @@ export const $ZodMap = /*@__PURE__*/ core.$constructor("$ZodMap", (inst, def) =>
|
|
|
1568
1855
|
return payload;
|
|
1569
1856
|
}
|
|
1570
1857
|
const proms = [];
|
|
1571
|
-
payload.value = new Map();
|
|
1858
|
+
payload.value = memo ? memo.alloc(inst, payload, new Map(), ctx) : new Map();
|
|
1859
|
+
const abortEarly = ctx?.abortEarly;
|
|
1860
|
+
let seen = payload.issues.length;
|
|
1572
1861
|
for (const [key, value] of input) {
|
|
1862
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1863
|
+
if (util.aborted(payload, seen))
|
|
1864
|
+
break;
|
|
1865
|
+
seen = payload.issues.length;
|
|
1866
|
+
}
|
|
1573
1867
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1574
1868
|
const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
|
|
1575
1869
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
@@ -1620,6 +1914,8 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
1620
1914
|
}
|
|
1621
1915
|
export const $ZodSet = /*@__PURE__*/ core.$constructor("$ZodSet", (inst, def) => {
|
|
1622
1916
|
$ZodType.init(inst, def);
|
|
1917
|
+
const memo = core.globalConfig.memoizer;
|
|
1918
|
+
memo?.attach(inst);
|
|
1623
1919
|
inst._zod.parse = (payload, ctx) => {
|
|
1624
1920
|
const input = payload.value;
|
|
1625
1921
|
if (!(input instanceof Set)) {
|
|
@@ -1632,8 +1928,15 @@ export const $ZodSet = /*@__PURE__*/ core.$constructor("$ZodSet", (inst, def) =>
|
|
|
1632
1928
|
return payload;
|
|
1633
1929
|
}
|
|
1634
1930
|
const proms = [];
|
|
1635
|
-
payload.value = new Set();
|
|
1931
|
+
payload.value = memo ? memo.alloc(inst, payload, new Set(), ctx) : new Set();
|
|
1932
|
+
const abortEarly = ctx?.abortEarly;
|
|
1933
|
+
let seen = payload.issues.length;
|
|
1636
1934
|
for (const item of input) {
|
|
1935
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1936
|
+
if (util.aborted(payload, seen))
|
|
1937
|
+
break;
|
|
1938
|
+
seen = payload.issues.length;
|
|
1939
|
+
}
|
|
1637
1940
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
1638
1941
|
if (result instanceof Promise) {
|
|
1639
1942
|
proms.push(result.then((result) => handleSetResult(result, payload)));
|
|
@@ -1657,10 +1960,11 @@ export const $ZodEnum = /*@__PURE__*/ core.$constructor("$ZodEnum", (inst, def)
|
|
|
1657
1960
|
const values = util.getEnumValues(def.entries);
|
|
1658
1961
|
const valuesSet = new Set(values);
|
|
1659
1962
|
inst._zod.values = valuesSet;
|
|
1660
|
-
inst
|
|
1661
|
-
.filter((k) => util.propertyKeyTypes.has(typeof k))
|
|
1662
|
-
|
|
1663
|
-
.join("|")})$`);
|
|
1963
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
1964
|
+
const patternValues = util.getEnumValues(zod.def.entries).filter((k) => util.propertyKeyTypes.has(typeof k));
|
|
1965
|
+
// unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
|
|
1966
|
+
return new RegExp(patternValues.length ? `^(${patternValues.map((o) => util.escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
1967
|
+
});
|
|
1664
1968
|
inst._zod.parse = (payload, _ctx) => {
|
|
1665
1969
|
const input = payload.value;
|
|
1666
1970
|
if (valuesSet.has(input)) {
|
|
@@ -1677,14 +1981,17 @@ export const $ZodEnum = /*@__PURE__*/ core.$constructor("$ZodEnum", (inst, def)
|
|
|
1677
1981
|
});
|
|
1678
1982
|
export const $ZodLiteral = /*@__PURE__*/ core.$constructor("$ZodLiteral", (inst, def) => {
|
|
1679
1983
|
$ZodType.init(inst, def);
|
|
1680
|
-
if (def.values.length === 0) {
|
|
1681
|
-
throw new Error("Cannot create literal schema with no valid values");
|
|
1682
|
-
}
|
|
1683
1984
|
const values = new Set(def.values);
|
|
1684
1985
|
inst._zod.values = values;
|
|
1685
|
-
inst
|
|
1686
|
-
|
|
1687
|
-
|
|
1986
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
1987
|
+
const vals = zod.def.values;
|
|
1988
|
+
// unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
|
|
1989
|
+
return new RegExp(vals.length
|
|
1990
|
+
? `^(${vals
|
|
1991
|
+
.map((o) => typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o))
|
|
1992
|
+
.join("|")})$`
|
|
1993
|
+
: "^[^\\s\\S]$");
|
|
1994
|
+
});
|
|
1688
1995
|
inst._zod.parse = (payload, _ctx) => {
|
|
1689
1996
|
const input = payload.value;
|
|
1690
1997
|
if (values.has(input)) {
|
|
@@ -1718,6 +2025,7 @@ export const $ZodFile = /*@__PURE__*/ core.$constructor("$ZodFile", (inst, def)
|
|
|
1718
2025
|
export const $ZodTransform = /*@__PURE__*/ core.$constructor("$ZodTransform", (inst, def) => {
|
|
1719
2026
|
$ZodType.init(inst, def);
|
|
1720
2027
|
inst._zod.optin = "optional";
|
|
2028
|
+
core.globalConfig.memoizer?.guard(inst);
|
|
1721
2029
|
inst._zod.parse = (payload, ctx) => {
|
|
1722
2030
|
if (ctx.direction === "backward") {
|
|
1723
2031
|
throw new core.$ZodEncodeError(inst.constructor.name);
|
|
@@ -1727,7 +2035,6 @@ export const $ZodTransform = /*@__PURE__*/ core.$constructor("$ZodTransform", (i
|
|
|
1727
2035
|
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
1728
2036
|
return output.then((output) => {
|
|
1729
2037
|
payload.value = output;
|
|
1730
|
-
payload.fallback = true;
|
|
1731
2038
|
return payload;
|
|
1732
2039
|
});
|
|
1733
2040
|
}
|
|
@@ -1735,37 +2042,37 @@ export const $ZodTransform = /*@__PURE__*/ core.$constructor("$ZodTransform", (i
|
|
|
1735
2042
|
throw new core.$ZodAsyncError();
|
|
1736
2043
|
}
|
|
1737
2044
|
payload.value = _out;
|
|
1738
|
-
payload.fallback = true;
|
|
1739
2045
|
return payload;
|
|
1740
2046
|
};
|
|
1741
2047
|
});
|
|
1742
|
-
function handleOptionalResult(
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
return result;
|
|
2048
|
+
function handleOptionalResult(payload, result) {
|
|
2049
|
+
// A substituting schema that still failed has no usable answer; yield undefined. Its issues are simply dropped: it ran on a payload of its own, so there is no shared array to truncate and nothing of the caller's to lose with it.
|
|
2050
|
+
payload.value = result.issues.length ? undefined : result.value;
|
|
2051
|
+
return payload;
|
|
1747
2052
|
}
|
|
1748
2053
|
export const $ZodOptional = /*@__PURE__*/ core.$constructor("$ZodOptional", (inst, def) => {
|
|
1749
2054
|
$ZodType.init(inst, def);
|
|
1750
|
-
|
|
2055
|
+
// .optional() propagates absence rather than substituting for it, so a defaulted inner keeps its rung.
|
|
2056
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
1751
2057
|
inst._zod.optout = "optional";
|
|
1752
|
-
util.
|
|
1753
|
-
|
|
2058
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2059
|
+
const values = zod.def.innerType._zod.values;
|
|
2060
|
+
return values ? new Set([...values, undefined]) : undefined;
|
|
1754
2061
|
});
|
|
1755
|
-
util.
|
|
1756
|
-
const pattern = def.innerType._zod.pattern;
|
|
2062
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2063
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
1757
2064
|
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
|
|
1758
2065
|
});
|
|
1759
2066
|
inst._zod.parse = (payload, ctx) => {
|
|
1760
|
-
if (def.innerType._zod.optin === "optional") {
|
|
1761
|
-
const input = payload.value;
|
|
1762
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
1763
|
-
if (result instanceof Promise)
|
|
1764
|
-
return result.then((r) => handleOptionalResult(r, input));
|
|
1765
|
-
return handleOptionalResult(result, input);
|
|
1766
|
-
}
|
|
1767
2067
|
if (payload.value === undefined) {
|
|
1768
|
-
|
|
2068
|
+
// Only the top rung substitutes a value for absence; everything else leaves it intact, which is what .optional() means.
|
|
2069
|
+
if (def.innerType._zod.optin !== "defaulted")
|
|
2070
|
+
return payload;
|
|
2071
|
+
// Its own payload, for the same reason $ZodCatch gets one: a pipe forwards an unrecognized key through the caller's issues array, and this must not read that as the substituting schema failing and drop it.
|
|
2072
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
2073
|
+
if (result instanceof Promise)
|
|
2074
|
+
return result.then((result) => handleOptionalResult(payload, result));
|
|
2075
|
+
return handleOptionalResult(payload, result);
|
|
1769
2076
|
}
|
|
1770
2077
|
return def.innerType._zod.run(payload, ctx);
|
|
1771
2078
|
};
|
|
@@ -1774,8 +2081,8 @@ export const $ZodExactOptional = /*@__PURE__*/ core.$constructor("$ZodExactOptio
|
|
|
1774
2081
|
// Call parent init - inherits optin/optout = "optional"
|
|
1775
2082
|
$ZodOptional.init(inst, def);
|
|
1776
2083
|
// Override values/pattern to NOT add undefined
|
|
1777
|
-
util.
|
|
1778
|
-
util.
|
|
2084
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2085
|
+
util.defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
|
|
1779
2086
|
// Override parse to just delegate (no undefined handling)
|
|
1780
2087
|
inst._zod.parse = (payload, ctx) => {
|
|
1781
2088
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1783,14 +2090,14 @@ export const $ZodExactOptional = /*@__PURE__*/ core.$constructor("$ZodExactOptio
|
|
|
1783
2090
|
});
|
|
1784
2091
|
export const $ZodNullable = /*@__PURE__*/ core.$constructor("$ZodNullable", (inst, def) => {
|
|
1785
2092
|
$ZodType.init(inst, def);
|
|
1786
|
-
util.
|
|
1787
|
-
util.
|
|
1788
|
-
util.
|
|
1789
|
-
const pattern = def.innerType._zod.pattern;
|
|
2093
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
|
|
2094
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2095
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2096
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
1790
2097
|
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;
|
|
1791
2098
|
});
|
|
1792
|
-
util.
|
|
1793
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
|
|
2099
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2100
|
+
return zod.def.innerType._zod.values ? new Set([...zod.def.innerType._zod.values, null]) : undefined;
|
|
1794
2101
|
});
|
|
1795
2102
|
inst._zod.parse = (payload, ctx) => {
|
|
1796
2103
|
// Forward direction (decode): allow null to pass through
|
|
@@ -1802,8 +2109,8 @@ export const $ZodNullable = /*@__PURE__*/ core.$constructor("$ZodNullable", (ins
|
|
|
1802
2109
|
export const $ZodDefault = /*@__PURE__*/ core.$constructor("$ZodDefault", (inst, def) => {
|
|
1803
2110
|
$ZodType.init(inst, def);
|
|
1804
2111
|
// inst._zod.qin = "true";
|
|
1805
|
-
inst._zod.optin = "
|
|
1806
|
-
util.
|
|
2112
|
+
inst._zod.optin = "defaulted";
|
|
2113
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1807
2114
|
inst._zod.parse = (payload, ctx) => {
|
|
1808
2115
|
if (ctx.direction === "backward") {
|
|
1809
2116
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1832,8 +2139,8 @@ function handleDefaultResult(payload, def) {
|
|
|
1832
2139
|
}
|
|
1833
2140
|
export const $ZodPrefault = /*@__PURE__*/ core.$constructor("$ZodPrefault", (inst, def) => {
|
|
1834
2141
|
$ZodType.init(inst, def);
|
|
1835
|
-
inst._zod.optin = "
|
|
1836
|
-
util.
|
|
2142
|
+
inst._zod.optin = "defaulted";
|
|
2143
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1837
2144
|
inst._zod.parse = (payload, ctx) => {
|
|
1838
2145
|
if (ctx.direction === "backward") {
|
|
1839
2146
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1847,8 +2154,8 @@ export const $ZodPrefault = /*@__PURE__*/ core.$constructor("$ZodPrefault", (ins
|
|
|
1847
2154
|
});
|
|
1848
2155
|
export const $ZodNonOptional = /*@__PURE__*/ core.$constructor("$ZodNonOptional", (inst, def) => {
|
|
1849
2156
|
$ZodType.init(inst, def);
|
|
1850
|
-
util.
|
|
1851
|
-
const v = def.innerType._zod.values;
|
|
2157
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2158
|
+
const v = zod.def.innerType._zod.values;
|
|
1852
2159
|
return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
|
|
1853
2160
|
});
|
|
1854
2161
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -1887,47 +2194,40 @@ export const $ZodSuccess = /*@__PURE__*/ core.$constructor("$ZodSuccess", (inst,
|
|
|
1887
2194
|
return payload;
|
|
1888
2195
|
};
|
|
1889
2196
|
});
|
|
2197
|
+
function handleCatchResult(payload, result, def, ctx) {
|
|
2198
|
+
if (!result.issues.length) {
|
|
2199
|
+
payload.value = result.value;
|
|
2200
|
+
// The value carries up, so the flag describing it has to carry with it: a back-edge into a node still being parsed must not be frozen by an enclosing readonly, and its checks belong to the node itself. Guarded so the ordinary case adds no own property.
|
|
2201
|
+
if (result.memo)
|
|
2202
|
+
payload.memo = true;
|
|
2203
|
+
return payload;
|
|
2204
|
+
}
|
|
2205
|
+
// Spread the inner's own payload, not ours: `value` has to stay the input the catch was handed, and the inner ran on a payload of its own so its issues are already private to this call.
|
|
2206
|
+
payload.value = def.catchValue({
|
|
2207
|
+
...result,
|
|
2208
|
+
value: payload.value,
|
|
2209
|
+
error: {
|
|
2210
|
+
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
2211
|
+
},
|
|
2212
|
+
input: payload.value,
|
|
2213
|
+
});
|
|
2214
|
+
return payload;
|
|
2215
|
+
}
|
|
1890
2216
|
export const $ZodCatch = /*@__PURE__*/ core.$constructor("$ZodCatch", (inst, def) => {
|
|
1891
2217
|
$ZodType.init(inst, def);
|
|
1892
|
-
inst._zod.optin
|
|
1893
|
-
util.
|
|
1894
|
-
util.
|
|
2218
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2219
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2220
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1895
2221
|
inst._zod.parse = (payload, ctx) => {
|
|
1896
2222
|
if (ctx.direction === "backward") {
|
|
1897
2223
|
return def.innerType._zod.run(payload, ctx);
|
|
1898
2224
|
}
|
|
1899
2225
|
// Forward direction (decode): apply catch logic
|
|
1900
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2226
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
1901
2227
|
if (result instanceof Promise) {
|
|
1902
|
-
return result.then((result) =>
|
|
1903
|
-
payload.value = result.value;
|
|
1904
|
-
if (result.issues.length) {
|
|
1905
|
-
payload.value = def.catchValue({
|
|
1906
|
-
...payload,
|
|
1907
|
-
error: {
|
|
1908
|
-
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
1909
|
-
},
|
|
1910
|
-
input: payload.value,
|
|
1911
|
-
});
|
|
1912
|
-
payload.issues = [];
|
|
1913
|
-
payload.fallback = true;
|
|
1914
|
-
}
|
|
1915
|
-
return payload;
|
|
1916
|
-
});
|
|
2228
|
+
return result.then((result) => handleCatchResult(payload, result, def, ctx));
|
|
1917
2229
|
}
|
|
1918
|
-
payload
|
|
1919
|
-
if (result.issues.length) {
|
|
1920
|
-
payload.value = def.catchValue({
|
|
1921
|
-
...payload,
|
|
1922
|
-
error: {
|
|
1923
|
-
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
1924
|
-
},
|
|
1925
|
-
input: payload.value,
|
|
1926
|
-
});
|
|
1927
|
-
payload.issues = [];
|
|
1928
|
-
payload.fallback = true;
|
|
1929
|
-
}
|
|
1930
|
-
return payload;
|
|
2230
|
+
return handleCatchResult(payload, result, def, ctx);
|
|
1931
2231
|
};
|
|
1932
2232
|
});
|
|
1933
2233
|
export const $ZodNaN = /*@__PURE__*/ core.$constructor("$ZodNaN", (inst, def) => {
|
|
@@ -1947,10 +2247,10 @@ export const $ZodNaN = /*@__PURE__*/ core.$constructor("$ZodNaN", (inst, def) =>
|
|
|
1947
2247
|
});
|
|
1948
2248
|
export const $ZodPipe = /*@__PURE__*/ core.$constructor("$ZodPipe", (inst, def) => {
|
|
1949
2249
|
$ZodType.init(inst, def);
|
|
1950
|
-
util.
|
|
1951
|
-
util.
|
|
1952
|
-
util.
|
|
1953
|
-
util.
|
|
2250
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2251
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2252
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2253
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
1954
2254
|
inst._zod.parse = (payload, ctx) => {
|
|
1955
2255
|
if (ctx.direction === "backward") {
|
|
1956
2256
|
const right = def.out._zod.run(payload, ctx);
|
|
@@ -1967,19 +2267,20 @@ export const $ZodPipe = /*@__PURE__*/ core.$constructor("$ZodPipe", (inst, def)
|
|
|
1967
2267
|
};
|
|
1968
2268
|
});
|
|
1969
2269
|
function handlePipeResult(left, next, ctx) {
|
|
1970
|
-
|
|
2270
|
+
// Any issue stops the pipe, so a failing refinement never feeds its transform. An unrecognized key is the exception: it describes the input's extra properties, not the value being piped, and an enclosing intersection may yet reconcile it.
|
|
2271
|
+
if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
|
|
1971
2272
|
// prevent further checks
|
|
1972
2273
|
left.aborted = true;
|
|
1973
2274
|
return left;
|
|
1974
2275
|
}
|
|
1975
|
-
return next._zod.run({ value: left.value, issues: left.issues
|
|
2276
|
+
return next._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
1976
2277
|
}
|
|
1977
2278
|
export const $ZodCodec = /*@__PURE__*/ core.$constructor("$ZodCodec", (inst, def) => {
|
|
1978
2279
|
$ZodType.init(inst, def);
|
|
1979
|
-
util.
|
|
1980
|
-
util.
|
|
1981
|
-
util.
|
|
1982
|
-
util.
|
|
2280
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2281
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2282
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2283
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
1983
2284
|
inst._zod.parse = (payload, ctx) => {
|
|
1984
2285
|
const direction = ctx.direction || "forward";
|
|
1985
2286
|
if (direction === "forward") {
|
|
@@ -2033,10 +2334,10 @@ export const $ZodPreprocess = /*@__PURE__*/ core.$constructor("$ZodPreprocess",
|
|
|
2033
2334
|
});
|
|
2034
2335
|
export const $ZodReadonly = /*@__PURE__*/ core.$constructor("$ZodReadonly", (inst, def) => {
|
|
2035
2336
|
$ZodType.init(inst, def);
|
|
2036
|
-
util.
|
|
2037
|
-
util.
|
|
2038
|
-
util.
|
|
2039
|
-
util.
|
|
2337
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
2338
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2339
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
|
|
2340
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
|
|
2040
2341
|
inst._zod.parse = (payload, ctx) => {
|
|
2041
2342
|
if (ctx.direction === "backward") {
|
|
2042
2343
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -2049,25 +2350,72 @@ export const $ZodReadonly = /*@__PURE__*/ core.$constructor("$ZodReadonly", (ins
|
|
|
2049
2350
|
};
|
|
2050
2351
|
});
|
|
2051
2352
|
function handleReadonlyResult(payload) {
|
|
2052
|
-
|
|
2353
|
+
// A repeat visit hands back a node that is still being built; freezing it here would make the rest of its keys fail to assign.
|
|
2354
|
+
if (!payload.memo)
|
|
2355
|
+
payload.value = Object.freeze(payload.value);
|
|
2053
2356
|
return payload;
|
|
2054
2357
|
}
|
|
2358
|
+
// a leaf's pattern source with its own checks folded in: the last pattern-carrying check wins, else length bounds narrow the catch-all, else an integer format narrows the number form. the fold lives here instead of on `_zod.pattern` so a bundle without template literals never pays for it
|
|
2359
|
+
function leafPattern(schema) {
|
|
2360
|
+
const def = schema._zod.def;
|
|
2361
|
+
let pattern = def.pattern;
|
|
2362
|
+
let isInt = !!def.format?.includes("int");
|
|
2363
|
+
let minimum;
|
|
2364
|
+
let maximum;
|
|
2365
|
+
for (const ch of def.checks ?? []) {
|
|
2366
|
+
const d = ch._zod.def;
|
|
2367
|
+
if (d.pattern)
|
|
2368
|
+
pattern = d.pattern;
|
|
2369
|
+
isInt || (isInt = !!d.format?.includes("int"));
|
|
2370
|
+
const lo = d.minimum ?? d.length;
|
|
2371
|
+
const hi = d.maximum ?? d.length;
|
|
2372
|
+
if (lo !== undefined && (minimum === undefined || lo > minimum))
|
|
2373
|
+
minimum = lo;
|
|
2374
|
+
if (hi !== undefined && (maximum === undefined || hi < maximum))
|
|
2375
|
+
maximum = hi;
|
|
2376
|
+
}
|
|
2377
|
+
if (pattern)
|
|
2378
|
+
return pattern.source;
|
|
2379
|
+
// an empty range matches nothing at runtime, and `{8,5}` is not a legal quantifier
|
|
2380
|
+
if (minimum !== undefined && maximum !== undefined && minimum > maximum)
|
|
2381
|
+
return "(?!)";
|
|
2382
|
+
if (minimum !== undefined || maximum !== undefined)
|
|
2383
|
+
return regexes.string({ minimum, maximum }).source;
|
|
2384
|
+
const own = schema._zod.pattern;
|
|
2385
|
+
return (isInt && own === regexes.number ? regexes.integer : own)?.source;
|
|
2386
|
+
}
|
|
2387
|
+
// a part's pattern source. a wrapper's pattern embeds its inner pattern's source verbatim, so the folded form is substituted in place without knowing the wrapper's own composition; a union's options are joined the way the union builds its own pattern
|
|
2388
|
+
function partPattern(schema) {
|
|
2389
|
+
const def = schema._zod.def;
|
|
2390
|
+
const own = schema._zod.pattern?.source;
|
|
2391
|
+
// lazy resolves its inner on the internals, not the def
|
|
2392
|
+
const inner = def.innerType ?? schema._zod.innerType;
|
|
2393
|
+
if (inner) {
|
|
2394
|
+
const before = inner._zod.pattern?.source;
|
|
2395
|
+
const after = partPattern(inner);
|
|
2396
|
+
if (own && before && after && after !== before) {
|
|
2397
|
+
return own.replace(util.cleanRegex(before), () => util.cleanRegex(after));
|
|
2398
|
+
}
|
|
2399
|
+
return own;
|
|
2400
|
+
}
|
|
2401
|
+
if (def.options) {
|
|
2402
|
+
const sources = def.options.map(partPattern);
|
|
2403
|
+
if (sources.every(Boolean))
|
|
2404
|
+
return `^(${sources.map((s) => util.cleanRegex(s)).join("|")})$`;
|
|
2405
|
+
}
|
|
2406
|
+
return leafPattern(schema);
|
|
2407
|
+
}
|
|
2055
2408
|
export const $ZodTemplateLiteral = /*@__PURE__*/ core.$constructor("$ZodTemplateLiteral", (inst, def) => {
|
|
2056
2409
|
$ZodType.init(inst, def);
|
|
2057
2410
|
const regexParts = [];
|
|
2058
2411
|
for (const part of def.parts) {
|
|
2059
2412
|
if (typeof part === "object" && part !== null) {
|
|
2060
2413
|
// is Zod schema
|
|
2061
|
-
|
|
2062
|
-
|
|
2414
|
+
const source = partPattern(part);
|
|
2415
|
+
if (!source) {
|
|
2063
2416
|
throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
|
|
2064
2417
|
}
|
|
2065
|
-
|
|
2066
|
-
if (!source)
|
|
2067
|
-
throw new Error(`Invalid template literal part: ${part._zod.traits}`);
|
|
2068
|
-
const start = source.startsWith("^") ? 1 : 0;
|
|
2069
|
-
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
2070
|
-
regexParts.push(source.slice(start, end));
|
|
2418
|
+
regexParts.push(util.cleanRegex(source));
|
|
2071
2419
|
}
|
|
2072
2420
|
else if (part === null || util.primitiveTypes.has(typeof part)) {
|
|
2073
2421
|
regexParts.push(util.escapeRegex(`${part}`));
|
|
@@ -2103,33 +2451,35 @@ export const $ZodTemplateLiteral = /*@__PURE__*/ core.$constructor("$ZodTemplate
|
|
|
2103
2451
|
});
|
|
2104
2452
|
export const $ZodFunction = /*@__PURE__*/ core.$constructor("$ZodFunction", (inst, def) => {
|
|
2105
2453
|
$ZodType.init(inst, def);
|
|
2106
|
-
|
|
2454
|
+
// Defined, not assigned: the classic prototype exposes `_def` as a getter with no setter.
|
|
2455
|
+
Object.defineProperty(inst, "_def", { value: def });
|
|
2107
2456
|
inst._zod.def = def;
|
|
2108
2457
|
inst.implement = (func) => {
|
|
2109
2458
|
if (typeof func !== "function") {
|
|
2110
2459
|
throw new Error("implement() must be called with a function");
|
|
2111
2460
|
}
|
|
2112
|
-
|
|
2461
|
+
// Defined inline so the closure stays anonymous: binding it to a `const` first names it, which costs 256 bytes per implemented function.
|
|
2462
|
+
return Object.defineProperty(function (...args) {
|
|
2113
2463
|
const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
|
|
2114
2464
|
const result = Reflect.apply(func, this, parsedArgs);
|
|
2115
2465
|
if (inst._def.output) {
|
|
2116
2466
|
return parse(inst._def.output, result);
|
|
2117
2467
|
}
|
|
2118
2468
|
return result;
|
|
2119
|
-
};
|
|
2469
|
+
}, "_zod", { value: inst._zod, enumerable: false });
|
|
2120
2470
|
};
|
|
2121
2471
|
inst.implementAsync = (func) => {
|
|
2122
2472
|
if (typeof func !== "function") {
|
|
2123
2473
|
throw new Error("implementAsync() must be called with a function");
|
|
2124
2474
|
}
|
|
2125
|
-
return async function (...args) {
|
|
2475
|
+
return Object.defineProperty(async function (...args) {
|
|
2126
2476
|
const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
|
|
2127
2477
|
const result = await Reflect.apply(func, this, parsedArgs);
|
|
2128
2478
|
if (inst._def.output) {
|
|
2129
2479
|
return await parseAsync(inst._def.output, result);
|
|
2130
2480
|
}
|
|
2131
2481
|
return result;
|
|
2132
|
-
};
|
|
2482
|
+
}, "_zod", { value: inst._zod, enumerable: false });
|
|
2133
2483
|
};
|
|
2134
2484
|
inst._zod.parse = (payload, _ctx) => {
|
|
2135
2485
|
if (typeof payload.value !== "function") {
|
|
@@ -2188,19 +2538,17 @@ export const $ZodPromise = /*@__PURE__*/ core.$constructor("$ZodPromise", (inst,
|
|
|
2188
2538
|
});
|
|
2189
2539
|
export const $ZodLazy = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def) => {
|
|
2190
2540
|
$ZodType.init(inst, def);
|
|
2191
|
-
// Cache the resolved inner type on the shared `def` so all clones of this
|
|
2192
|
-
// lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance,
|
|
2193
|
-
// preserving identity for cycle detection on recursive schemas.
|
|
2541
|
+
// Cache the resolved inner type on the shared `def` so all clones of this lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance, preserving identity for cycle detection on recursive schemas.
|
|
2194
2542
|
util.defineLazy(inst._zod, "innerType", () => {
|
|
2195
2543
|
const d = def;
|
|
2196
2544
|
if (!d._cachedInner)
|
|
2197
2545
|
d._cachedInner = def.getter();
|
|
2198
2546
|
return d._cachedInner;
|
|
2199
2547
|
});
|
|
2200
|
-
util.
|
|
2201
|
-
util.
|
|
2202
|
-
util.
|
|
2203
|
-
util.
|
|
2548
|
+
util.defineLazyInternal(inst, "pattern", (zod) => zod.innerType?._zod?.pattern);
|
|
2549
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.innerType?._zod?.propValues);
|
|
2550
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.innerType?._zod?.optin ?? undefined);
|
|
2551
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.innerType?._zod?.optout ?? undefined);
|
|
2204
2552
|
inst._zod.parse = (payload, ctx) => {
|
|
2205
2553
|
const inner = inst._zod.innerType;
|
|
2206
2554
|
return inner._zod.run(payload, ctx);
|
|
@@ -2237,3 +2585,64 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2237
2585
|
payload.issues.push(util.issue(_iss));
|
|
2238
2586
|
}
|
|
2239
2587
|
}
|
|
2588
|
+
// asserts in place: the child result's value is discarded, matching z.property(), because a nested object or array schema rebuilds its output even when nothing transformed
|
|
2589
|
+
function handlePropertiesResult(result, payload, key) {
|
|
2590
|
+
if (result.issues.length) {
|
|
2591
|
+
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
export const $ZodProperties = /*@__PURE__*/ core.$constructor("$ZodProperties", (inst, def) => {
|
|
2595
|
+
// $ZodType.init prepends an instance that already carries the $ZodCheck trait to its own `checks`, which would run the shape a second time and cost the parse context. Initializing the check trait after it keeps the schema role in `parse`, where the context arrives.
|
|
2596
|
+
$ZodType.init(inst, def);
|
|
2597
|
+
checks.$ZodCheck.init(inst, def);
|
|
2598
|
+
const memo = core.globalConfig.memoizer;
|
|
2599
|
+
memo?.attach(inst);
|
|
2600
|
+
// key and schema snapshotted together: reading one live and the other cached lets a later mutation of the caller's shape object pair a stale key with a missing schema
|
|
2601
|
+
let entries;
|
|
2602
|
+
const runShape = (payload, ctx) => {
|
|
2603
|
+
entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
|
|
2604
|
+
const input = payload.value;
|
|
2605
|
+
let proms;
|
|
2606
|
+
for (const [key, schema] of entries) {
|
|
2607
|
+
const result = schema._zod.run({ value: input[key], issues: [] }, ctx);
|
|
2608
|
+
if (result instanceof Promise) {
|
|
2609
|
+
proms ?? (proms = []);
|
|
2610
|
+
proms.push(result.then((result) => handlePropertiesResult(result, payload, key)));
|
|
2611
|
+
}
|
|
2612
|
+
else {
|
|
2613
|
+
handlePropertiesResult(result, payload, key);
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
if (proms)
|
|
2617
|
+
return Promise.all(proms).then(() => undefined);
|
|
2618
|
+
return undefined;
|
|
2619
|
+
};
|
|
2620
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2621
|
+
const input = payload.value;
|
|
2622
|
+
// as a schema this is the type gate, and it infers an object shape, so a primitive is a type error. A function passes: its properties read like any other object's, and z.instanceof allows one.
|
|
2623
|
+
if (input === null || (typeof input !== "object" && typeof input !== "function")) {
|
|
2624
|
+
payload.issues.push({ expected: "object", code: "invalid_type", input, inst });
|
|
2625
|
+
return payload;
|
|
2626
|
+
}
|
|
2627
|
+
// both sides declare the shape's input type, so the assertion runs forward in either direction; encoding the children backward would reject the very type this schema claims to take
|
|
2628
|
+
if (ctx.direction === "backward")
|
|
2629
|
+
ctx = { ...ctx, direction: "forward" };
|
|
2630
|
+
// the input is its own output here, so it registers as its own memo entry: a cycle re-entering this node hits the bucket instead of recursing forever
|
|
2631
|
+
if (memo)
|
|
2632
|
+
memo.alloc(inst, payload, input, ctx);
|
|
2633
|
+
const result = runShape(payload, ctx);
|
|
2634
|
+
return result instanceof Promise ? result.then(() => payload) : payload;
|
|
2635
|
+
};
|
|
2636
|
+
// as a check the base schema already typed the value, so this only asserts the properties — which read on a primitive too, matching z.property() on a string's length. It gets no context of its own, so a cycle through a spread schema is not tracked.
|
|
2637
|
+
inst._zod.check = (payload) => {
|
|
2638
|
+
if (payload.value == null) {
|
|
2639
|
+
payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
|
|
2640
|
+
return undefined;
|
|
2641
|
+
}
|
|
2642
|
+
return runShape(payload, {});
|
|
2643
|
+
};
|
|
2644
|
+
}, {
|
|
2645
|
+
*[Symbol.iterator]() {
|
|
2646
|
+
yield this;
|
|
2647
|
+
},
|
|
2648
|
+
});
|