@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
|
@@ -23,11 +23,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.$
|
|
27
|
-
exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodFunction = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodPreprocess = exports.$ZodCodec = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodExactOptional = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = exports.$ZodSet = exports.$ZodMap = exports.$ZodRecord = void 0;
|
|
26
|
+
exports.$ZodObject = exports.$ZodArray = exports.$ZodDate = exports.$ZodVoid = exports.$ZodNever = exports.$ZodUnknown = exports.$ZodAny = exports.$ZodNull = exports.$ZodUndefined = exports.$ZodSymbol = exports.$ZodBigIntFormat = exports.$ZodBigInt = exports.$ZodBoolean = exports.$ZodNumberFormat = exports.$ZodNumber = exports.$ZodCustomStringFormat = exports.$ZodJWT = exports.$ZodIBAN = exports.$ZodCreditCard = exports.$ZodE164 = exports.$ZodBase64URL = exports.base64urlCharset = exports.$ZodBase64 = exports.base64Charset = exports.$ZodCIDRv6 = exports.$ZodCIDRv4 = exports.$ZodMAC = exports.$ZodIPv6 = exports.$ZodIPv4 = exports.$ZodISODuration = exports.$ZodISOTime = exports.$ZodISODate = exports.$ZodISODateTime = exports.$ZodKSUID = exports.$ZodXID = exports.$ZodULID = exports.$ZodCUID2 = exports.$ZodCUID = exports.$ZodNanoID = exports.$ZodEmoji = exports.$ZodURL = exports.URL_UNPARSEABLE = exports.URL_BAD_FORMAT = exports.$ZodEmail = exports.$ZodUUID = exports.$ZodGUID = exports.$ZodStringFormat = exports.$ZodString = exports.clone = exports.$ZodType = void 0;
|
|
27
|
+
exports.$ZodProperties = exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodFunction = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodPreprocess = exports.$ZodCodec = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodExactOptional = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = exports.$ZodSet = exports.$ZodMap = exports.$ZodRecord = exports.$ZodTuple = exports.$ZodIntersection = exports.$ZodDiscriminatedUnion = exports.$ZodXor = exports.$ZodUnion = exports.$ZodObjectJIT = void 0;
|
|
28
|
+
exports.standardProps = standardProps;
|
|
29
|
+
exports.parseURLObject = parseURLObject;
|
|
30
|
+
exports.stripTabAndNewline = stripTabAndNewline;
|
|
31
|
+
exports.urlHostnameOk = urlHostnameOk;
|
|
32
|
+
exports.urlProtocolOk = urlProtocolOk;
|
|
33
|
+
exports.isValidIPv6 = isValidIPv6;
|
|
34
|
+
exports.isValidCIDRv6 = isValidCIDRv6;
|
|
28
35
|
exports.isValidBase64 = isValidBase64;
|
|
29
36
|
exports.isValidBase64URL = isValidBase64URL;
|
|
37
|
+
exports.isValidCreditCard = isValidCreditCard;
|
|
38
|
+
exports.isValidIBAN = isValidIBAN;
|
|
30
39
|
exports.isValidJWT = isValidJWT;
|
|
40
|
+
exports.getDiscriminatedOption = getDiscriminatedOption;
|
|
41
|
+
exports.mergeValues = mergeValues;
|
|
31
42
|
const checks = __importStar(require("./checks.cjs"));
|
|
32
43
|
const core = __importStar(require("./core.cjs"));
|
|
33
44
|
const doc_js_1 = require("./doc.cjs");
|
|
@@ -41,19 +52,20 @@ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
|
|
|
41
52
|
inst._zod.def = def; // set _def property
|
|
42
53
|
inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
|
|
43
54
|
inst._zod.version = versions_js_1.version;
|
|
44
|
-
const
|
|
55
|
+
const defChecks = inst._zod.def.checks;
|
|
45
56
|
// if inst is itself a checks.$ZodCheck, run it as a check
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
const checks = inst._zod.traits.has("$ZodCheck")
|
|
58
|
+
? [inst, ...(defChecks ?? [])]
|
|
59
|
+
: defChecks?.length
|
|
60
|
+
? [...defChecks]
|
|
61
|
+
: [];
|
|
49
62
|
for (const ch of checks) {
|
|
50
63
|
for (const fn of ch._zod.onattach) {
|
|
51
64
|
fn(inst);
|
|
52
65
|
}
|
|
53
66
|
}
|
|
54
67
|
if (checks.length === 0) {
|
|
55
|
-
// deferred initializer
|
|
56
|
-
// inst._zod.parse is not yet defined
|
|
68
|
+
// deferred initializer inst._zod.parse is not yet defined
|
|
57
69
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
58
70
|
inst._zod.deferred?.push(() => {
|
|
59
71
|
inst._zod.run = inst._zod.parse;
|
|
@@ -61,6 +73,8 @@ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
|
|
|
61
73
|
}
|
|
62
74
|
else {
|
|
63
75
|
const runChecks = (payload, checks, ctx) => {
|
|
76
|
+
if (payload.memo)
|
|
77
|
+
return payload;
|
|
64
78
|
let isAborted = util.aborted(payload);
|
|
65
79
|
let asyncResult;
|
|
66
80
|
for (const ch of checks) {
|
|
@@ -85,6 +99,7 @@ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
|
|
|
85
99
|
const nextLen = payload.issues.length;
|
|
86
100
|
if (nextLen === currLen)
|
|
87
101
|
return;
|
|
102
|
+
util.attachSchema(payload.issues, currLen, inst);
|
|
88
103
|
if (!isAborted)
|
|
89
104
|
isAborted = util.aborted(payload, currLen);
|
|
90
105
|
});
|
|
@@ -93,6 +108,7 @@ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
|
|
|
93
108
|
const nextLen = payload.issues.length;
|
|
94
109
|
if (nextLen === currLen)
|
|
95
110
|
continue;
|
|
111
|
+
util.attachSchema(payload.issues, currLen, inst);
|
|
96
112
|
if (!isAborted)
|
|
97
113
|
isAborted = util.aborted(payload, currLen);
|
|
98
114
|
}
|
|
@@ -124,8 +140,7 @@ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
|
|
|
124
140
|
return inst._zod.parse(payload, ctx);
|
|
125
141
|
}
|
|
126
142
|
if (ctx.direction === "backward") {
|
|
127
|
-
// run canary
|
|
128
|
-
// initial pass (no checks)
|
|
143
|
+
// run canary initial pass (no checks)
|
|
129
144
|
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
130
145
|
if (canary instanceof Promise) {
|
|
131
146
|
return canary.then((canary) => {
|
|
@@ -144,26 +159,45 @@ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
|
|
|
144
159
|
return runChecks(result, checks, ctx);
|
|
145
160
|
};
|
|
146
161
|
}
|
|
147
|
-
|
|
148
|
-
|
|
162
|
+
}, {
|
|
163
|
+
// Wrappers extend this by installing a richer factory over it; reading it eagerly would defeat the laziness.
|
|
164
|
+
get "~standard"() {
|
|
165
|
+
return util.hide(this, "~standard", standardProps(this));
|
|
166
|
+
},
|
|
167
|
+
set "~standard"(value) {
|
|
168
|
+
util.own(this, "~standard", value);
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
172
|
+
// 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
|
|
173
|
+
const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())) } : { value: r.value };
|
|
174
|
+
async function validateAsync(inst, value) {
|
|
175
|
+
const ctx = { async: true };
|
|
176
|
+
return toStandardResult((await inst._zod.run({ value, issues: [] }, ctx)), ctx);
|
|
177
|
+
}
|
|
178
|
+
function standardProps(inst) {
|
|
179
|
+
return {
|
|
149
180
|
validate: (value) => {
|
|
181
|
+
const ctx = { async: false };
|
|
150
182
|
try {
|
|
151
|
-
const r = (
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
catch (_) {
|
|
155
|
-
return (0, parse_js_1.safeParseAsync)(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
|
|
183
|
+
const r = inst._zod.run({ value, issues: [] }, ctx);
|
|
184
|
+
if (!(r instanceof Promise))
|
|
185
|
+
return toStandardResult(r, ctx);
|
|
156
186
|
}
|
|
187
|
+
catch (_) { }
|
|
188
|
+
// async function so a synchronously throwing check rejects instead of escaping validate
|
|
189
|
+
return validateAsync(inst, value);
|
|
157
190
|
},
|
|
158
191
|
vendor: "zod",
|
|
159
192
|
version: 1,
|
|
160
|
-
}
|
|
161
|
-
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
162
195
|
var util_js_1 = require("./util.cjs");
|
|
163
196
|
Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return util_js_1.clone; } });
|
|
164
197
|
exports.$ZodString = core.$constructor("$ZodString", (inst, def) => {
|
|
165
198
|
exports.$ZodType.init(inst, def);
|
|
166
|
-
|
|
199
|
+
// a format's own pattern, else unbounded; a template literal derives the check-aware form itself
|
|
200
|
+
inst._zod.pattern = def.pattern ?? regexes.anyString;
|
|
167
201
|
inst._zod.parse = (payload, _) => {
|
|
168
202
|
if (def.coerce)
|
|
169
203
|
try {
|
|
@@ -215,66 +249,89 @@ exports.$ZodEmail = core.$constructor("$ZodEmail", (inst, def) => {
|
|
|
215
249
|
def.pattern ?? (def.pattern = regexes.email);
|
|
216
250
|
exports.$ZodStringFormat.init(inst, def);
|
|
217
251
|
});
|
|
252
|
+
/** The `://` guard rejected the input before the URL constructor saw it. */
|
|
253
|
+
exports.URL_BAD_FORMAT = 1;
|
|
254
|
+
/** The URL constructor rejected the input. */
|
|
255
|
+
exports.URL_UNPARSEABLE = 2;
|
|
256
|
+
/** 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. */
|
|
257
|
+
function parseURLObject(trimmed, def) {
|
|
258
|
+
// When normalize is off, require :// for http/https URLs. This prevents strings like "http:example.com" or "https:/path" from being silently accepted
|
|
259
|
+
if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
|
|
260
|
+
return exports.URL_BAD_FORMAT;
|
|
261
|
+
}
|
|
262
|
+
try {
|
|
263
|
+
// @ts-ignore
|
|
264
|
+
return new URL(trimmed);
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
return exports.URL_UNPARSEABLE;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
const asciiTabOrNewline = /[\t\n\r]/g;
|
|
271
|
+
/** 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. */
|
|
272
|
+
function stripTabAndNewline(value) {
|
|
273
|
+
return value.replace(asciiTabOrNewline, "");
|
|
274
|
+
}
|
|
275
|
+
function urlHostnameOk(url, hostname) {
|
|
276
|
+
hostname.lastIndex = 0;
|
|
277
|
+
return hostname.test(url.hostname);
|
|
278
|
+
}
|
|
279
|
+
function urlProtocolOk(url, protocol) {
|
|
280
|
+
protocol.lastIndex = 0;
|
|
281
|
+
return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
|
|
282
|
+
}
|
|
218
283
|
exports.$ZodURL = core.$constructor("$ZodURL", (inst, def) => {
|
|
219
284
|
exports.$ZodStringFormat.init(inst, def);
|
|
220
285
|
inst._zod.check = (payload) => {
|
|
221
286
|
try {
|
|
222
287
|
// Trim whitespace from input
|
|
223
288
|
const trimmed = payload.value.trim();
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
});
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
// @ts-ignore
|
|
240
|
-
const url = new URL(trimmed);
|
|
241
|
-
if (def.hostname) {
|
|
242
|
-
def.hostname.lastIndex = 0;
|
|
243
|
-
if (!def.hostname.test(url.hostname)) {
|
|
244
|
-
payload.issues.push({
|
|
245
|
-
code: "invalid_format",
|
|
246
|
-
format: "url",
|
|
247
|
-
note: "Invalid hostname",
|
|
248
|
-
pattern: def.hostname.source,
|
|
249
|
-
input: payload.value,
|
|
250
|
-
inst,
|
|
251
|
-
continue: !def.abort,
|
|
252
|
-
});
|
|
253
|
-
}
|
|
289
|
+
const url = parseURLObject(trimmed, def);
|
|
290
|
+
if (url === exports.URL_BAD_FORMAT) {
|
|
291
|
+
payload.issues.push({
|
|
292
|
+
code: "invalid_format",
|
|
293
|
+
format: "url",
|
|
294
|
+
note: "Invalid URL format",
|
|
295
|
+
input: payload.value,
|
|
296
|
+
inst,
|
|
297
|
+
continue: !def.abort,
|
|
298
|
+
});
|
|
299
|
+
return;
|
|
254
300
|
}
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
inst,
|
|
265
|
-
continue: !def.abort,
|
|
266
|
-
});
|
|
267
|
-
}
|
|
301
|
+
if (url === exports.URL_UNPARSEABLE) {
|
|
302
|
+
payload.issues.push({
|
|
303
|
+
code: "invalid_format",
|
|
304
|
+
format: "url",
|
|
305
|
+
input: payload.value,
|
|
306
|
+
inst,
|
|
307
|
+
continue: !def.abort,
|
|
308
|
+
});
|
|
309
|
+
return;
|
|
268
310
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
311
|
+
if (def.hostname && !urlHostnameOk(url, def.hostname)) {
|
|
312
|
+
payload.issues.push({
|
|
313
|
+
code: "invalid_format",
|
|
314
|
+
format: "url",
|
|
315
|
+
note: "Invalid hostname",
|
|
316
|
+
pattern: def.hostname.source,
|
|
317
|
+
input: payload.value,
|
|
318
|
+
inst,
|
|
319
|
+
continue: !def.abort,
|
|
320
|
+
});
|
|
273
321
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
322
|
+
if (def.protocol && !urlProtocolOk(url, def.protocol)) {
|
|
323
|
+
payload.issues.push({
|
|
324
|
+
code: "invalid_format",
|
|
325
|
+
format: "url",
|
|
326
|
+
note: "Invalid protocol",
|
|
327
|
+
pattern: def.protocol.source,
|
|
328
|
+
input: payload.value,
|
|
329
|
+
inst,
|
|
330
|
+
continue: !def.abort,
|
|
331
|
+
});
|
|
277
332
|
}
|
|
333
|
+
// Set the output value based on normalize flag
|
|
334
|
+
payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
|
|
278
335
|
return;
|
|
279
336
|
}
|
|
280
337
|
catch (_) {
|
|
@@ -293,7 +350,9 @@ exports.$ZodEmoji = core.$constructor("$ZodEmoji", (inst, def) => {
|
|
|
293
350
|
exports.$ZodStringFormat.init(inst, def);
|
|
294
351
|
});
|
|
295
352
|
exports.$ZodNanoID = core.$constructor("$ZodNanoID", (inst, def) => {
|
|
296
|
-
def.
|
|
353
|
+
if (def.length !== undefined && (!Number.isInteger(def.length) || def.length < 1))
|
|
354
|
+
throw new Error(`Invalid nanoid length: ${def.length}`);
|
|
355
|
+
def.pattern ?? (def.pattern = def.length === undefined ? regexes.nanoid : regexes.nanoidOfLength(def.length));
|
|
297
356
|
exports.$ZodStringFormat.init(inst, def);
|
|
298
357
|
});
|
|
299
358
|
/**
|
|
@@ -340,19 +399,26 @@ exports.$ZodISODuration = core.$constructor("$ZodISODuration", (inst, def) => {
|
|
|
340
399
|
exports.$ZodIPv4 = core.$constructor("$ZodIPv4", (inst, def) => {
|
|
341
400
|
def.pattern ?? (def.pattern = regexes.ipv4);
|
|
342
401
|
exports.$ZodStringFormat.init(inst, def);
|
|
343
|
-
inst._zod.bag.format = `ipv4`;
|
|
344
402
|
});
|
|
403
|
+
/** 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`. */
|
|
404
|
+
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
405
|
+
function isValidIPv6(value) {
|
|
406
|
+
if (!ipv6Alphabet.test(value))
|
|
407
|
+
return false;
|
|
408
|
+
try {
|
|
409
|
+
// @ts-ignore
|
|
410
|
+
new URL(`http://[${value}]`);
|
|
411
|
+
return true;
|
|
412
|
+
}
|
|
413
|
+
catch {
|
|
414
|
+
return false;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
345
417
|
exports.$ZodIPv6 = core.$constructor("$ZodIPv6", (inst, def) => {
|
|
346
418
|
def.pattern ?? (def.pattern = regexes.ipv6);
|
|
347
419
|
exports.$ZodStringFormat.init(inst, def);
|
|
348
|
-
inst._zod.bag.format = `ipv6`;
|
|
349
420
|
inst._zod.check = (payload) => {
|
|
350
|
-
|
|
351
|
-
// @ts-ignore
|
|
352
|
-
new URL(`http://[${payload.value}]`);
|
|
353
|
-
// return;
|
|
354
|
-
}
|
|
355
|
-
catch {
|
|
421
|
+
if (!isValidIPv6(payload.value)) {
|
|
356
422
|
payload.issues.push({
|
|
357
423
|
code: "invalid_format",
|
|
358
424
|
format: "ipv6",
|
|
@@ -366,32 +432,30 @@ exports.$ZodIPv6 = core.$constructor("$ZodIPv6", (inst, def) => {
|
|
|
366
432
|
exports.$ZodMAC = core.$constructor("$ZodMAC", (inst, def) => {
|
|
367
433
|
def.pattern ?? (def.pattern = regexes.mac(def.delimiter));
|
|
368
434
|
exports.$ZodStringFormat.init(inst, def);
|
|
369
|
-
inst._zod.bag.format = `mac`;
|
|
370
435
|
});
|
|
371
436
|
exports.$ZodCIDRv4 = core.$constructor("$ZodCIDRv4", (inst, def) => {
|
|
372
437
|
def.pattern ?? (def.pattern = regexes.cidrv4);
|
|
373
438
|
exports.$ZodStringFormat.init(inst, def);
|
|
374
439
|
});
|
|
440
|
+
function isValidCIDRv6(value) {
|
|
441
|
+
const parts = value.split("/");
|
|
442
|
+
if (parts.length !== 2)
|
|
443
|
+
return false;
|
|
444
|
+
const [address, prefix] = parts;
|
|
445
|
+
if (!prefix)
|
|
446
|
+
return false;
|
|
447
|
+
const prefixNum = Number(prefix);
|
|
448
|
+
if (`${prefixNum}` !== prefix)
|
|
449
|
+
return false;
|
|
450
|
+
if (prefixNum < 0 || prefixNum > 128)
|
|
451
|
+
return false;
|
|
452
|
+
return isValidIPv6(address);
|
|
453
|
+
}
|
|
375
454
|
exports.$ZodCIDRv6 = core.$constructor("$ZodCIDRv6", (inst, def) => {
|
|
376
455
|
def.pattern ?? (def.pattern = regexes.cidrv6); // not used for validation
|
|
377
456
|
exports.$ZodStringFormat.init(inst, def);
|
|
378
457
|
inst._zod.check = (payload) => {
|
|
379
|
-
|
|
380
|
-
try {
|
|
381
|
-
if (parts.length !== 2)
|
|
382
|
-
throw new Error();
|
|
383
|
-
const [address, prefix] = parts;
|
|
384
|
-
if (!prefix)
|
|
385
|
-
throw new Error();
|
|
386
|
-
const prefixNum = Number(prefix);
|
|
387
|
-
if (`${prefixNum}` !== prefix)
|
|
388
|
-
throw new Error();
|
|
389
|
-
if (prefixNum < 0 || prefixNum > 128)
|
|
390
|
-
throw new Error();
|
|
391
|
-
// @ts-ignore
|
|
392
|
-
new URL(`http://[${address}]`);
|
|
393
|
-
}
|
|
394
|
-
catch {
|
|
458
|
+
if (!isValidCIDRv6(payload.value)) {
|
|
395
459
|
payload.issues.push({
|
|
396
460
|
code: "invalid_format",
|
|
397
461
|
format: "cidrv6",
|
|
@@ -420,10 +484,11 @@ function isValidBase64(data) {
|
|
|
420
484
|
return false;
|
|
421
485
|
}
|
|
422
486
|
}
|
|
487
|
+
// 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
|
|
488
|
+
exports.base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
|
|
423
489
|
exports.$ZodBase64 = core.$constructor("$ZodBase64", (inst, def) => {
|
|
424
|
-
def.pattern ?? (def.pattern =
|
|
490
|
+
def.pattern ?? (def.pattern = exports.base64Charset);
|
|
425
491
|
exports.$ZodStringFormat.init(inst, def);
|
|
426
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
427
492
|
inst._zod.check = (payload) => {
|
|
428
493
|
if (isValidBase64(payload.value))
|
|
429
494
|
return;
|
|
@@ -436,18 +501,19 @@ exports.$ZodBase64 = core.$constructor("$ZodBase64", (inst, def) => {
|
|
|
436
501
|
});
|
|
437
502
|
};
|
|
438
503
|
});
|
|
439
|
-
//////////////////////////////
|
|
504
|
+
////////////////////////////// ZodBase64URL //////////////////////////////
|
|
505
|
+
// lax on purpose: the quantified regexes.base64url overflows the regex stack on multi-MB input; isValidBase64 enforces length on the padded string
|
|
506
|
+
exports.base64urlCharset = /^[A-Za-z0-9_-]*$/;
|
|
440
507
|
function isValidBase64URL(data) {
|
|
441
|
-
if (!
|
|
508
|
+
if (!exports.base64urlCharset.test(data))
|
|
442
509
|
return false;
|
|
443
510
|
const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
|
|
444
511
|
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
|
|
445
512
|
return isValidBase64(padded);
|
|
446
513
|
}
|
|
447
514
|
exports.$ZodBase64URL = core.$constructor("$ZodBase64URL", (inst, def) => {
|
|
448
|
-
def.pattern ?? (def.pattern =
|
|
515
|
+
def.pattern ?? (def.pattern = exports.base64urlCharset);
|
|
449
516
|
exports.$ZodStringFormat.init(inst, def);
|
|
450
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
451
517
|
inst._zod.check = (payload) => {
|
|
452
518
|
if (isValidBase64URL(payload.value))
|
|
453
519
|
return;
|
|
@@ -464,6 +530,77 @@ exports.$ZodE164 = core.$constructor("$ZodE164", (inst, def) => {
|
|
|
464
530
|
def.pattern ?? (def.pattern = regexes.e164);
|
|
465
531
|
exports.$ZodStringFormat.init(inst, def);
|
|
466
532
|
});
|
|
533
|
+
////////////////////////////// ZodCreditCard //////////////////////////////
|
|
534
|
+
const CC_SANITIZE = /[- ]/g;
|
|
535
|
+
/** Luhn checksum on a digit-only string. Adapted from valibot (MIT). */
|
|
536
|
+
function isLuhnAlgo(digits) {
|
|
537
|
+
let length = digits.length;
|
|
538
|
+
let bit = 1;
|
|
539
|
+
let sum = 0;
|
|
540
|
+
while (length) {
|
|
541
|
+
const value = digits.charCodeAt(--length) - 48;
|
|
542
|
+
bit ^= 1;
|
|
543
|
+
sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value;
|
|
544
|
+
}
|
|
545
|
+
return sum % 10 === 0;
|
|
546
|
+
}
|
|
547
|
+
function isValidCreditCard(input) {
|
|
548
|
+
if (!regexes.creditCard.test(input))
|
|
549
|
+
return false;
|
|
550
|
+
return isLuhnAlgo(input.replace(CC_SANITIZE, ""));
|
|
551
|
+
}
|
|
552
|
+
exports.$ZodCreditCard = core.$constructor("$ZodCreditCard", (inst, def) => {
|
|
553
|
+
// 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.
|
|
554
|
+
def.pattern ?? (def.pattern = regexes.creditCard);
|
|
555
|
+
exports.$ZodStringFormat.init(inst, def);
|
|
556
|
+
inst._zod.check = (payload) => {
|
|
557
|
+
if (isValidCreditCard(payload.value))
|
|
558
|
+
return;
|
|
559
|
+
payload.issues.push({
|
|
560
|
+
code: "invalid_format",
|
|
561
|
+
format: "credit_card",
|
|
562
|
+
input: payload.value,
|
|
563
|
+
inst,
|
|
564
|
+
continue: !def.abort,
|
|
565
|
+
});
|
|
566
|
+
};
|
|
567
|
+
});
|
|
568
|
+
////////////////////////////// ZodIBAN //////////////////////////////
|
|
569
|
+
// iso 7064 mod 97-10 checksum without BigInt
|
|
570
|
+
function isIso7064Mod97(iban) {
|
|
571
|
+
let remainder = 0;
|
|
572
|
+
const len = iban.length;
|
|
573
|
+
for (let i = 4; i < len; i++) {
|
|
574
|
+
const code = iban.charCodeAt(i);
|
|
575
|
+
remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
|
|
576
|
+
}
|
|
577
|
+
for (let i = 0; i < 4; i++) {
|
|
578
|
+
const code = iban.charCodeAt(i);
|
|
579
|
+
remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
|
|
580
|
+
}
|
|
581
|
+
return remainder === 1;
|
|
582
|
+
}
|
|
583
|
+
function isValidIBAN(input) {
|
|
584
|
+
if (!regexes.iban.test(input))
|
|
585
|
+
return false;
|
|
586
|
+
return isIso7064Mod97(input);
|
|
587
|
+
}
|
|
588
|
+
exports.$ZodIBAN = core.$constructor("$ZodIBAN", (inst, def) => {
|
|
589
|
+
// shape only — checksum is not expressible as a pattern
|
|
590
|
+
def.pattern ?? (def.pattern = regexes.iban);
|
|
591
|
+
exports.$ZodStringFormat.init(inst, def);
|
|
592
|
+
inst._zod.check = (payload) => {
|
|
593
|
+
if (isValidIBAN(payload.value))
|
|
594
|
+
return;
|
|
595
|
+
payload.issues.push({
|
|
596
|
+
code: "invalid_format",
|
|
597
|
+
format: "iban",
|
|
598
|
+
input: payload.value,
|
|
599
|
+
inst,
|
|
600
|
+
continue: !def.abort,
|
|
601
|
+
});
|
|
602
|
+
};
|
|
603
|
+
});
|
|
467
604
|
////////////////////////////// ZodJWT //////////////////////////////
|
|
468
605
|
function isValidJWT(token, algorithm = null) {
|
|
469
606
|
try {
|
|
@@ -517,7 +654,7 @@ exports.$ZodCustomStringFormat = core.$constructor("$ZodCustomStringFormat", (in
|
|
|
517
654
|
});
|
|
518
655
|
exports.$ZodNumber = core.$constructor("$ZodNumber", (inst, def) => {
|
|
519
656
|
exports.$ZodType.init(inst, def);
|
|
520
|
-
inst._zod.pattern =
|
|
657
|
+
inst._zod.pattern = regexes.number;
|
|
521
658
|
inst._zod.parse = (payload, _ctx) => {
|
|
522
659
|
if (def.coerce)
|
|
523
660
|
try {
|
|
@@ -532,7 +669,7 @@ exports.$ZodNumber = core.$constructor("$ZodNumber", (inst, def) => {
|
|
|
532
669
|
? Number.isNaN(input)
|
|
533
670
|
? "NaN"
|
|
534
671
|
: !Number.isFinite(input)
|
|
535
|
-
?
|
|
672
|
+
? String(input)
|
|
536
673
|
: undefined
|
|
537
674
|
: undefined;
|
|
538
675
|
payload.issues.push({
|
|
@@ -710,6 +847,8 @@ function handleArrayResult(result, final, index) {
|
|
|
710
847
|
}
|
|
711
848
|
exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
|
|
712
849
|
exports.$ZodType.init(inst, def);
|
|
850
|
+
const memo = core.globalConfig.memoizer;
|
|
851
|
+
memo?.attach(inst);
|
|
713
852
|
inst._zod.parse = (payload, ctx) => {
|
|
714
853
|
const input = payload.value;
|
|
715
854
|
if (!Array.isArray(input)) {
|
|
@@ -721,8 +860,9 @@ exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
|
|
|
721
860
|
});
|
|
722
861
|
return payload;
|
|
723
862
|
}
|
|
724
|
-
payload.value = Array(input.length);
|
|
863
|
+
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
725
864
|
const proms = [];
|
|
865
|
+
const abortEarly = ctx?.abortEarly;
|
|
726
866
|
for (let i = 0; i < input.length; i++) {
|
|
727
867
|
const item = input[i];
|
|
728
868
|
const result = def.element._zod.run({
|
|
@@ -734,6 +874,9 @@ exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
|
|
|
734
874
|
}
|
|
735
875
|
else {
|
|
736
876
|
handleArrayResult(result, payload, i);
|
|
877
|
+
// the element's payload is authoritative here, since handleArrayResult forwards every issue; an object's is not, because it drops a failed absent optional
|
|
878
|
+
if (abortEarly && result.issues.length !== 0 && util.aborted(result))
|
|
879
|
+
break;
|
|
737
880
|
}
|
|
738
881
|
}
|
|
739
882
|
if (proms.length) {
|
|
@@ -742,16 +885,21 @@ exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
|
|
|
742
885
|
return payload; //handleArrayResultsAsync(parseResults, final);
|
|
743
886
|
};
|
|
744
887
|
});
|
|
745
|
-
function handlePropertyResult(result, final, key, input,
|
|
888
|
+
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
746
889
|
const isPresent = key in input;
|
|
890
|
+
const isOptionalOut = optout === "optional";
|
|
891
|
+
// 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.
|
|
892
|
+
if (!isPresent && isOptionalOut && optin === "optional") {
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
747
895
|
if (result.issues.length) {
|
|
748
896
|
// For optional-in/out schemas, ignore errors on absent keys.
|
|
749
|
-
if (
|
|
897
|
+
if (optin !== undefined && isOptionalOut && !isPresent) {
|
|
750
898
|
return;
|
|
751
899
|
}
|
|
752
900
|
final.issues.push(...util.prefixIssues(key, result.issues));
|
|
753
901
|
}
|
|
754
|
-
if (!isPresent &&
|
|
902
|
+
if (!isPresent && optin === undefined) {
|
|
755
903
|
if (!result.issues.length) {
|
|
756
904
|
final.issues.push({
|
|
757
905
|
code: "invalid_type",
|
|
@@ -763,7 +911,7 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
763
911
|
return;
|
|
764
912
|
}
|
|
765
913
|
if (result.value === undefined) {
|
|
766
|
-
if (isPresent) {
|
|
914
|
+
if (isPresent || (optin === "defaulted" && !isOptionalOut)) {
|
|
767
915
|
final.value[key] = undefined;
|
|
768
916
|
}
|
|
769
917
|
}
|
|
@@ -771,46 +919,64 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
771
919
|
final.value[key] = result.value;
|
|
772
920
|
}
|
|
773
921
|
}
|
|
922
|
+
// one shared instance; a fresh [] per schema cost 56 bytes retained
|
|
923
|
+
const NO_SYMBOL_KEYS = [];
|
|
774
924
|
function normalizeDef(def) {
|
|
775
925
|
const keys = Object.keys(def.shape);
|
|
776
|
-
|
|
926
|
+
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
927
|
+
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
928
|
+
// aliases `keys` when there are no symbols, so a string-only shape keeps one array
|
|
929
|
+
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
930
|
+
for (const k of allKeys) {
|
|
777
931
|
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
778
|
-
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
932
|
+
throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
|
|
779
933
|
}
|
|
780
934
|
}
|
|
781
935
|
const okeys = util.optionalKeys(def.shape);
|
|
782
936
|
return {
|
|
783
937
|
...def,
|
|
784
|
-
|
|
938
|
+
allKeys,
|
|
939
|
+
symbolKeys,
|
|
940
|
+
// string-only: handleCatchall matches it against `for...in`, which never yields a symbol
|
|
785
941
|
keySet: new Set(keys),
|
|
786
942
|
numKeys: keys.length,
|
|
787
943
|
optionalKeys: new Set(okeys),
|
|
788
944
|
};
|
|
789
945
|
}
|
|
790
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
946
|
+
function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
791
947
|
const unrecognized = [];
|
|
792
948
|
const keySet = def.keySet;
|
|
793
949
|
const _catchall = def.catchall._zod;
|
|
794
950
|
const t = _catchall.def.type;
|
|
795
|
-
const
|
|
796
|
-
const
|
|
951
|
+
const optin = _catchall.optin;
|
|
952
|
+
const optout = _catchall.optout;
|
|
953
|
+
// starts at 0, not the current length: the shape phase already ran and may have aborted
|
|
954
|
+
let seen = 0;
|
|
797
955
|
for (const key in input) {
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
956
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
957
|
+
if (util.aborted(payload, seen))
|
|
958
|
+
break;
|
|
959
|
+
seen = payload.issues.length;
|
|
960
|
+
}
|
|
961
|
+
// Must precede the __proto__ branch: a declared key is not unrecognized, even though the shape loop deliberately strips __proto__ from the parsed output.
|
|
802
962
|
if (keySet.has(key))
|
|
803
963
|
continue;
|
|
964
|
+
// 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.
|
|
965
|
+
if (key === "__proto__") {
|
|
966
|
+
if (t === "never")
|
|
967
|
+
unrecognized.push(key);
|
|
968
|
+
continue;
|
|
969
|
+
}
|
|
804
970
|
if (t === "never") {
|
|
805
971
|
unrecognized.push(key);
|
|
806
972
|
continue;
|
|
807
973
|
}
|
|
808
974
|
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
809
975
|
if (r instanceof Promise) {
|
|
810
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
976
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
811
977
|
}
|
|
812
978
|
else {
|
|
813
|
-
handlePropertyResult(r, payload, key, input,
|
|
979
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
814
980
|
}
|
|
815
981
|
}
|
|
816
982
|
if (unrecognized.length) {
|
|
@@ -819,6 +985,8 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
819
985
|
keys: unrecognized,
|
|
820
986
|
input,
|
|
821
987
|
inst,
|
|
988
|
+
// 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.
|
|
989
|
+
continue: true,
|
|
822
990
|
});
|
|
823
991
|
}
|
|
824
992
|
if (!proms.length)
|
|
@@ -830,30 +998,35 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
830
998
|
exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
|
|
831
999
|
// requires cast because technically $ZodObject doesn't extend
|
|
832
1000
|
exports.$ZodType.init(inst, def);
|
|
833
|
-
// const sh = def.shape;
|
|
834
1001
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
1002
|
+
// 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
|
|
1003
|
+
const sh = desc?.get ? desc.get.raw : (def.shape ?? {});
|
|
1004
|
+
if (sh) {
|
|
1005
|
+
// Freezes the shape on first read, so its getters resolve once and every later read sees the same schemas.
|
|
1006
|
+
const get = () => {
|
|
1007
|
+
const newSh = { ...sh };
|
|
1008
|
+
Object.defineProperty(def, "shape", { value: newSh });
|
|
1009
|
+
get.raw = newSh;
|
|
1010
|
+
return newSh;
|
|
1011
|
+
};
|
|
1012
|
+
get.raw = sh;
|
|
1013
|
+
Object.defineProperty(def, "shape", { get });
|
|
846
1014
|
}
|
|
847
1015
|
const _normalized = util.cached(() => normalizeDef(def));
|
|
848
|
-
util.
|
|
849
|
-
const shape = def.shape;
|
|
1016
|
+
util.defineLazyInternal(inst, "propValues", (zod) => {
|
|
1017
|
+
const shape = zod.def.shape;
|
|
850
1018
|
const propValues = {};
|
|
851
1019
|
for (const key in shape) {
|
|
852
1020
|
const field = shape[key]._zod;
|
|
853
1021
|
if (field.values) {
|
|
854
|
-
|
|
1022
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key)) {
|
|
1023
|
+
util.assignProp(propValues, key, new Set());
|
|
1024
|
+
}
|
|
855
1025
|
for (const v of field.values)
|
|
856
1026
|
propValues[key].add(v);
|
|
1027
|
+
// 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.
|
|
1028
|
+
if (field.optin !== undefined)
|
|
1029
|
+
propValues[key].add(undefined);
|
|
857
1030
|
}
|
|
858
1031
|
}
|
|
859
1032
|
return propValues;
|
|
@@ -861,6 +1034,8 @@ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
|
|
|
861
1034
|
const isObject = util.isObject;
|
|
862
1035
|
const catchall = def.catchall;
|
|
863
1036
|
let value;
|
|
1037
|
+
const memo = core.globalConfig.memoizer;
|
|
1038
|
+
memo?.attach(inst);
|
|
864
1039
|
inst._zod.parse = (payload, ctx) => {
|
|
865
1040
|
value ?? (value = _normalized.value);
|
|
866
1041
|
const input = payload.value;
|
|
@@ -873,25 +1048,34 @@ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
|
|
|
873
1048
|
});
|
|
874
1049
|
return payload;
|
|
875
1050
|
}
|
|
876
|
-
payload.value = {};
|
|
1051
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
877
1052
|
const proms = [];
|
|
878
1053
|
const shape = value.shape;
|
|
879
|
-
|
|
1054
|
+
const abortEarly = ctx?.abortEarly;
|
|
1055
|
+
let seen = payload.issues.length;
|
|
1056
|
+
for (const key of value.allKeys) {
|
|
1057
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1058
|
+
if (util.aborted(payload, seen))
|
|
1059
|
+
break;
|
|
1060
|
+
seen = payload.issues.length;
|
|
1061
|
+
}
|
|
1062
|
+
if (key === "__proto__")
|
|
1063
|
+
continue;
|
|
880
1064
|
const el = shape[key];
|
|
881
|
-
const
|
|
882
|
-
const
|
|
1065
|
+
const optin = el._zod.optin;
|
|
1066
|
+
const optout = el._zod.optout;
|
|
883
1067
|
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
884
1068
|
if (r instanceof Promise) {
|
|
885
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1069
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
886
1070
|
}
|
|
887
1071
|
else {
|
|
888
|
-
handlePropertyResult(r, payload, key, input,
|
|
1072
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
889
1073
|
}
|
|
890
1074
|
}
|
|
891
1075
|
if (!catchall) {
|
|
892
1076
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
893
1077
|
}
|
|
894
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
1078
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
|
|
895
1079
|
};
|
|
896
1080
|
});
|
|
897
1081
|
exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -899,58 +1083,65 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
899
1083
|
exports.$ZodObject.init(inst, def);
|
|
900
1084
|
const superParse = inst._zod.parse;
|
|
901
1085
|
const _normalized = util.cached(() => normalizeDef(def));
|
|
1086
|
+
const memo = core.globalConfig.memoizer;
|
|
902
1087
|
const generateFastpass = (shape) => {
|
|
903
|
-
const doc = new doc_js_1.Doc(["shape", "payload", "ctx"]);
|
|
904
1088
|
const normalized = _normalized.value;
|
|
905
|
-
const
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
}
|
|
1089
|
+
const syms = normalized.symbolKeys;
|
|
1090
|
+
// a symbol has no source literal, so it is read as `syms[i]` off the closed-over scope
|
|
1091
|
+
const doc = new doc_js_1.Doc(["payload", "ctx"], { shape, inst, memo, syms });
|
|
1092
|
+
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1093
|
+
// 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
|
|
1094
|
+
const prefixStr = (id, k) => `
|
|
1095
|
+
let ${id}_ab = false;
|
|
1096
|
+
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
1097
|
+
const iss = ${id}.issues[i];
|
|
1098
|
+
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
1099
|
+
payload.issues.push(iss);
|
|
1100
|
+
if (iss.continue !== true) ${id}_ab = true;
|
|
1101
|
+
}
|
|
1102
|
+
if (${id}_ab && ctx && ctx.abortEarly) {
|
|
1103
|
+
payload.value = newResult;
|
|
1104
|
+
return payload;
|
|
1105
|
+
}`;
|
|
909
1106
|
doc.write(`const input = payload.value;`);
|
|
910
1107
|
const ids = Object.create(null);
|
|
911
1108
|
let counter = 0;
|
|
912
|
-
for (const key of normalized.
|
|
1109
|
+
for (const key of normalized.allKeys) {
|
|
913
1110
|
ids[key] = `key_${counter++}`;
|
|
914
1111
|
}
|
|
915
1112
|
// A: preserve key order {
|
|
916
|
-
doc.write(`const newResult = {};`);
|
|
917
|
-
for (const key of normalized.
|
|
1113
|
+
doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
1114
|
+
for (const key of normalized.allKeys) {
|
|
1115
|
+
if (key === "__proto__")
|
|
1116
|
+
continue;
|
|
918
1117
|
const id = ids[key];
|
|
919
|
-
const k = util.esc(key);
|
|
1118
|
+
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : util.esc(key);
|
|
1119
|
+
const isPresent = `${k} in input`;
|
|
920
1120
|
const schema = shape[key];
|
|
921
|
-
const
|
|
1121
|
+
const optin = schema?._zod?.optin;
|
|
1122
|
+
const isOptionalIn = optin !== undefined;
|
|
922
1123
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
923
|
-
doc.write(`const ${id} = ${parseStr(
|
|
1124
|
+
doc.write(`const ${id} = ${parseStr(k)};`);
|
|
924
1125
|
if (isOptionalIn && isOptionalOut) {
|
|
925
|
-
// For optional-in/out schemas, ignore errors on absent keys
|
|
1126
|
+
// 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.
|
|
1127
|
+
const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
|
|
926
1128
|
doc.write(`
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
...iss,
|
|
931
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
932
|
-
})));
|
|
1129
|
+
const ${id}_present = ${isPresent};
|
|
1130
|
+
if (!${id}.issues.length || ${id}_present) {
|
|
1131
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
933
1132
|
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
if (${k} in input) {
|
|
938
|
-
newResult[${k}] = undefined;
|
|
1133
|
+
|
|
1134
|
+
if (${assign}) {
|
|
1135
|
+
newResult[${k}] = ${id}.value;
|
|
939
1136
|
}
|
|
940
|
-
} else {
|
|
941
|
-
newResult[${k}] = ${id}.value;
|
|
942
1137
|
}
|
|
943
|
-
|
|
1138
|
+
|
|
944
1139
|
`);
|
|
945
1140
|
}
|
|
946
1141
|
else if (!isOptionalIn) {
|
|
947
1142
|
doc.write(`
|
|
948
|
-
const ${id}_present = ${
|
|
949
|
-
if (${id}.issues.length) {
|
|
950
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
951
|
-
...iss,
|
|
952
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
953
|
-
})));
|
|
1143
|
+
const ${id}_present = ${isPresent};
|
|
1144
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
954
1145
|
}
|
|
955
1146
|
if (!${id}_present && !${id}.issues.length) {
|
|
956
1147
|
payload.issues.push({
|
|
@@ -959,42 +1150,39 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
959
1150
|
input: undefined,
|
|
960
1151
|
path: [${k}]
|
|
961
1152
|
});
|
|
1153
|
+
if (ctx && ctx.abortEarly) {
|
|
1154
|
+
payload.value = newResult;
|
|
1155
|
+
return payload;
|
|
1156
|
+
}
|
|
962
1157
|
}
|
|
963
1158
|
|
|
964
1159
|
if (${id}_present) {
|
|
965
|
-
|
|
966
|
-
newResult[${k}] = undefined;
|
|
967
|
-
} else {
|
|
968
|
-
newResult[${k}] = ${id}.value;
|
|
969
|
-
}
|
|
1160
|
+
newResult[${k}] = ${id}.value;
|
|
970
1161
|
}
|
|
971
1162
|
|
|
972
1163
|
`);
|
|
973
1164
|
}
|
|
974
1165
|
else {
|
|
975
1166
|
doc.write(`
|
|
976
|
-
if (${id}.issues.length) {
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
newResult[${k}] = undefined;
|
|
986
|
-
}
|
|
987
|
-
} else {
|
|
1167
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1168
|
+
}
|
|
1169
|
+
`);
|
|
1170
|
+
if (optin === "defaulted") {
|
|
1171
|
+
doc.write(`newResult[${k}] = ${id}.value;`);
|
|
1172
|
+
}
|
|
1173
|
+
else {
|
|
1174
|
+
doc.write(`
|
|
1175
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
988
1176
|
newResult[${k}] = ${id}.value;
|
|
989
1177
|
}
|
|
990
|
-
|
|
991
1178
|
`);
|
|
1179
|
+
}
|
|
992
1180
|
}
|
|
993
1181
|
}
|
|
994
1182
|
doc.write(`payload.value = newResult;`);
|
|
995
1183
|
doc.write(`return payload;`);
|
|
996
|
-
|
|
997
|
-
return (
|
|
1184
|
+
// 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
|
|
1185
|
+
return doc.compile();
|
|
998
1186
|
};
|
|
999
1187
|
let fastpass;
|
|
1000
1188
|
const isObject = util.isObject;
|
|
@@ -1022,7 +1210,7 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
1022
1210
|
payload = fastpass(payload, ctx);
|
|
1023
1211
|
if (!catchall)
|
|
1024
1212
|
return payload;
|
|
1025
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
1213
|
+
return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
|
|
1026
1214
|
}
|
|
1027
1215
|
return superParse(payload, ctx);
|
|
1028
1216
|
};
|
|
@@ -1049,17 +1237,21 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
1049
1237
|
}
|
|
1050
1238
|
exports.$ZodUnion = core.$constructor("$ZodUnion", (inst, def) => {
|
|
1051
1239
|
exports.$ZodType.init(inst, def);
|
|
1052
|
-
util.
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1240
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted")
|
|
1241
|
+
? "defaulted"
|
|
1242
|
+
: zod.def.options.some((o) => o._zod.optin !== undefined)
|
|
1243
|
+
? "optional"
|
|
1244
|
+
: undefined);
|
|
1245
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
|
|
1246
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
1247
|
+
if (zod.def.options.every((o) => o._zod.values)) {
|
|
1248
|
+
return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1057
1249
|
}
|
|
1058
1250
|
return undefined;
|
|
1059
1251
|
});
|
|
1060
|
-
util.
|
|
1061
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
1062
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
1252
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
1253
|
+
if (zod.def.options.every((o) => o._zod.pattern)) {
|
|
1254
|
+
const patterns = zod.def.options.map((o) => o._zod.pattern);
|
|
1063
1255
|
return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join("|")})$`);
|
|
1064
1256
|
}
|
|
1065
1257
|
return undefined;
|
|
@@ -1094,12 +1286,16 @@ exports.$ZodUnion = core.$constructor("$ZodUnion", (inst, def) => {
|
|
|
1094
1286
|
};
|
|
1095
1287
|
});
|
|
1096
1288
|
function handleExclusiveUnionResults(results, final, inst, ctx) {
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1099
|
-
|
|
1289
|
+
const matches = [];
|
|
1290
|
+
for (let i = 0; i < results.length; i++) {
|
|
1291
|
+
if (results[i].issues.length === 0)
|
|
1292
|
+
matches.push(i);
|
|
1293
|
+
}
|
|
1294
|
+
if (matches.length === 1) {
|
|
1295
|
+
final.value = results[matches[0]].value;
|
|
1100
1296
|
return final;
|
|
1101
1297
|
}
|
|
1102
|
-
if (
|
|
1298
|
+
if (matches.length === 0) {
|
|
1103
1299
|
// No matches - same as regular union
|
|
1104
1300
|
final.issues.push({
|
|
1105
1301
|
code: "invalid_union",
|
|
@@ -1116,6 +1312,7 @@ function handleExclusiveUnionResults(results, final, inst, ctx) {
|
|
|
1116
1312
|
inst,
|
|
1117
1313
|
errors: [],
|
|
1118
1314
|
inclusive: false,
|
|
1315
|
+
matches,
|
|
1119
1316
|
});
|
|
1120
1317
|
}
|
|
1121
1318
|
return final;
|
|
@@ -1150,44 +1347,75 @@ exports.$ZodXor = core.$constructor("$ZodXor", (inst, def) => {
|
|
|
1150
1347
|
});
|
|
1151
1348
|
};
|
|
1152
1349
|
});
|
|
1350
|
+
/** Returns the option whose discriminator claims `value`, or throws if ambiguous. */
|
|
1351
|
+
function getDiscriminatedOption(union, value) {
|
|
1352
|
+
const internals = union._zod;
|
|
1353
|
+
let map = internals.bag.optionsMap;
|
|
1354
|
+
if (!map) {
|
|
1355
|
+
map = discriminatorMap(internals.def);
|
|
1356
|
+
internals.bag.optionsMap = map;
|
|
1357
|
+
}
|
|
1358
|
+
const option = map.get(value);
|
|
1359
|
+
if (option === null)
|
|
1360
|
+
throw new Error(`Ambiguous discriminator value "${String(value)}"`);
|
|
1361
|
+
return option;
|
|
1362
|
+
}
|
|
1363
|
+
function discriminatorMap(def) {
|
|
1364
|
+
const map = new Map();
|
|
1365
|
+
for (const option of def.options) {
|
|
1366
|
+
const values = option._zod.propValues?.[def.discriminator];
|
|
1367
|
+
if (!values || values.size === 0)
|
|
1368
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
1369
|
+
for (const value of values) {
|
|
1370
|
+
if (map.has(value)) {
|
|
1371
|
+
if (value !== undefined)
|
|
1372
|
+
throw new Error(`Duplicate discriminator value "${String(value)}"`);
|
|
1373
|
+
// keep the collision marked so a later member cannot reclaim it
|
|
1374
|
+
map.set(value, null);
|
|
1375
|
+
}
|
|
1376
|
+
else {
|
|
1377
|
+
map.set(value, option);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
return map;
|
|
1382
|
+
}
|
|
1153
1383
|
exports.$ZodDiscriminatedUnion =
|
|
1154
1384
|
/*@__PURE__*/
|
|
1155
1385
|
core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
1156
1386
|
def.inclusive = false;
|
|
1157
1387
|
exports.$ZodUnion.init(inst, def);
|
|
1158
1388
|
const _super = inst._zod.parse;
|
|
1159
|
-
util.
|
|
1389
|
+
util.defineLazyInternal(inst, "propValues", (zod) => {
|
|
1160
1390
|
const propValues = {};
|
|
1161
|
-
|
|
1391
|
+
let undefinedCount = 0;
|
|
1392
|
+
for (const option of zod.def.options) {
|
|
1162
1393
|
const pv = option._zod.propValues;
|
|
1163
1394
|
if (!pv || Object.keys(pv).length === 0)
|
|
1164
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
1395
|
+
throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
|
|
1396
|
+
if (pv[zod.def.discriminator]?.has(undefined))
|
|
1397
|
+
undefinedCount++;
|
|
1165
1398
|
for (const [k, v] of Object.entries(pv)) {
|
|
1166
|
-
if (!propValues
|
|
1167
|
-
propValues
|
|
1399
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
|
|
1400
|
+
util.assignProp(propValues, k, new Set());
|
|
1401
|
+
}
|
|
1168
1402
|
for (const val of v) {
|
|
1169
1403
|
propValues[k].add(val);
|
|
1170
1404
|
}
|
|
1171
1405
|
}
|
|
1172
1406
|
}
|
|
1407
|
+
if (!zod.def.unionFallback && undefinedCount > 1)
|
|
1408
|
+
propValues[zod.def.discriminator]?.delete(undefined);
|
|
1173
1409
|
return propValues;
|
|
1174
1410
|
});
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
if (!values || values.size === 0)
|
|
1181
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
1182
|
-
for (const v of values) {
|
|
1183
|
-
if (map.has(v)) {
|
|
1184
|
-
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
1185
|
-
}
|
|
1186
|
-
map.set(v, o);
|
|
1187
|
-
}
|
|
1411
|
+
// 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.
|
|
1412
|
+
def.options.forEach((option, i) => {
|
|
1413
|
+
const propShape = util.rawShape(option._zod.def);
|
|
1414
|
+
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
|
|
1415
|
+
throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
1188
1416
|
}
|
|
1189
|
-
return map;
|
|
1190
1417
|
});
|
|
1418
|
+
const disc = util.cached(() => discriminatorMap(def));
|
|
1191
1419
|
inst._zod.parse = (payload, ctx) => {
|
|
1192
1420
|
const input = payload.value;
|
|
1193
1421
|
if (!util.isObject(input)) {
|
|
@@ -1199,14 +1427,15 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1199
1427
|
});
|
|
1200
1428
|
return payload;
|
|
1201
1429
|
}
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1430
|
+
const value = input?.[def.discriminator];
|
|
1431
|
+
const opt = disc.value.get(value);
|
|
1432
|
+
// forward metadata cannot choose an encoder for an absent tag
|
|
1433
|
+
if (opt && (value !== undefined || ctx.direction !== "backward")) {
|
|
1204
1434
|
return opt._zod.run(payload, ctx);
|
|
1205
1435
|
}
|
|
1206
1436
|
// Fall back to union matching when the fast discriminator path fails:
|
|
1207
1437
|
// - explicitly enabled via unionFallback, or
|
|
1208
|
-
// - during backward direction (encode), since codec-based discriminators
|
|
1209
|
-
// have different values in forward vs backward directions
|
|
1438
|
+
// - during backward direction (encode), since codec-based discriminators have different values in forward vs backward directions
|
|
1210
1439
|
if (def.unionFallback || ctx.direction === "backward") {
|
|
1211
1440
|
return _super(payload, ctx);
|
|
1212
1441
|
}
|
|
@@ -1216,7 +1445,7 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1216
1445
|
errors: [],
|
|
1217
1446
|
note: "No matching discriminator",
|
|
1218
1447
|
discriminator: def.discriminator,
|
|
1219
|
-
options: Array.from(disc.value.keys()),
|
|
1448
|
+
options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
|
|
1220
1449
|
input,
|
|
1221
1450
|
path: [def.discriminator],
|
|
1222
1451
|
inst,
|
|
@@ -1252,7 +1481,11 @@ function mergeValues(a, b) {
|
|
|
1252
1481
|
const bKeys = Object.keys(b);
|
|
1253
1482
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
1254
1483
|
const newObj = { ...a, ...b };
|
|
1484
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
|
|
1485
|
+
delete newObj.__proto__;
|
|
1255
1486
|
for (const key of sharedKeys) {
|
|
1487
|
+
if (key === "__proto__")
|
|
1488
|
+
continue;
|
|
1256
1489
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
1257
1490
|
if (!sharedValue.valid) {
|
|
1258
1491
|
return {
|
|
@@ -1286,43 +1519,55 @@ function mergeValues(a, b) {
|
|
|
1286
1519
|
return { valid: false, mergeErrorPath: [] };
|
|
1287
1520
|
}
|
|
1288
1521
|
function handleIntersectionResults(result, left, right) {
|
|
1289
|
-
// Track which side(s)
|
|
1522
|
+
// 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.
|
|
1290
1523
|
const unrecKeys = new Map();
|
|
1291
1524
|
let unrecIssue;
|
|
1292
|
-
|
|
1293
|
-
|
|
1525
|
+
const keyIssues = new Map();
|
|
1526
|
+
const collect = (iss, side) => {
|
|
1527
|
+
let keys;
|
|
1528
|
+
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
1294
1529
|
unrecIssue ?? (unrecIssue = iss);
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1530
|
+
keys = iss.keys;
|
|
1531
|
+
}
|
|
1532
|
+
else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
1533
|
+
const k = String(iss.path[0]);
|
|
1534
|
+
if (!keyIssues.has(k))
|
|
1535
|
+
keyIssues.set(k, iss);
|
|
1536
|
+
keys = [k];
|
|
1300
1537
|
}
|
|
1301
1538
|
else {
|
|
1302
|
-
|
|
1539
|
+
return false;
|
|
1303
1540
|
}
|
|
1541
|
+
for (const k of keys) {
|
|
1542
|
+
if (!unrecKeys.has(k))
|
|
1543
|
+
unrecKeys.set(k, {});
|
|
1544
|
+
unrecKeys.get(k)[side] = true;
|
|
1545
|
+
}
|
|
1546
|
+
return true;
|
|
1547
|
+
};
|
|
1548
|
+
for (const iss of left.issues) {
|
|
1549
|
+
if (!collect(iss, "l"))
|
|
1550
|
+
result.issues.push(iss);
|
|
1304
1551
|
}
|
|
1305
1552
|
for (const iss of right.issues) {
|
|
1306
|
-
if (iss
|
|
1307
|
-
for (const k of iss.keys) {
|
|
1308
|
-
if (!unrecKeys.has(k))
|
|
1309
|
-
unrecKeys.set(k, {});
|
|
1310
|
-
unrecKeys.get(k).r = true;
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
else {
|
|
1553
|
+
if (!collect(iss, "r"))
|
|
1314
1554
|
result.issues.push(iss);
|
|
1315
|
-
}
|
|
1316
1555
|
}
|
|
1317
|
-
// Report only keys
|
|
1556
|
+
// Report only keys rejected by BOTH sides
|
|
1318
1557
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1319
|
-
if (bothKeys.length
|
|
1320
|
-
|
|
1558
|
+
if (bothKeys.length) {
|
|
1559
|
+
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
1560
|
+
if (aggregated.length)
|
|
1561
|
+
result.issues.push({ ...unrecIssue, keys: aggregated });
|
|
1562
|
+
for (const k of bothKeys) {
|
|
1563
|
+
if (!aggregated.includes(k) && keyIssues.has(k))
|
|
1564
|
+
result.issues.push(keyIssues.get(k));
|
|
1565
|
+
}
|
|
1321
1566
|
}
|
|
1322
|
-
if (util.aborted(result))
|
|
1323
|
-
return result;
|
|
1324
1567
|
const merged = mergeValues(left.value, right.value);
|
|
1325
1568
|
if (!merged.valid) {
|
|
1569
|
+
if (util.aborted(result))
|
|
1570
|
+
return result;
|
|
1326
1571
|
throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
|
|
1327
1572
|
}
|
|
1328
1573
|
result.value = merged.data;
|
|
@@ -1331,6 +1576,8 @@ function handleIntersectionResults(result, left, right) {
|
|
|
1331
1576
|
exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
1332
1577
|
exports.$ZodType.init(inst, def);
|
|
1333
1578
|
const items = def.items;
|
|
1579
|
+
const memo = core.globalConfig.memoizer;
|
|
1580
|
+
memo?.attach(inst);
|
|
1334
1581
|
inst._zod.parse = (payload, ctx) => {
|
|
1335
1582
|
const input = payload.value;
|
|
1336
1583
|
if (!Array.isArray(input)) {
|
|
@@ -1342,7 +1589,7 @@ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
|
1342
1589
|
});
|
|
1343
1590
|
return payload;
|
|
1344
1591
|
}
|
|
1345
|
-
payload.value = [];
|
|
1592
|
+
payload.value = memo ? memo.alloc(inst, payload, [], ctx) : [];
|
|
1346
1593
|
const proms = [];
|
|
1347
1594
|
const optinStart = getTupleOptStart(items, "optin");
|
|
1348
1595
|
const optoutStart = getTupleOptStart(items, "optout");
|
|
@@ -1369,11 +1616,11 @@ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
|
1369
1616
|
});
|
|
1370
1617
|
}
|
|
1371
1618
|
}
|
|
1372
|
-
// Run every item in parallel, collecting results into an indexed
|
|
1373
|
-
// array. The post-processing in `handleTupleResults` walks them in
|
|
1374
|
-
// order so it can decide whether an absent optional-output error can
|
|
1375
|
-
// truncate the tail or must be reported to preserve required output.
|
|
1619
|
+
// 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.
|
|
1376
1620
|
const itemResults = new Array(items.length);
|
|
1621
|
+
// only tracked when there is a rest loop to skip
|
|
1622
|
+
const abortEarly = def.rest ? ctx?.abortEarly : undefined;
|
|
1623
|
+
let itemAborted = false;
|
|
1377
1624
|
for (let i = 0; i < items.length; i++) {
|
|
1378
1625
|
const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
|
|
1379
1626
|
if (r instanceof Promise) {
|
|
@@ -1383,12 +1630,21 @@ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
|
1383
1630
|
}
|
|
1384
1631
|
else {
|
|
1385
1632
|
itemResults[i] = r;
|
|
1633
|
+
if (abortEarly && !itemAborted && r.issues.length)
|
|
1634
|
+
itemAborted = util.aborted(r);
|
|
1386
1635
|
}
|
|
1387
1636
|
}
|
|
1388
|
-
|
|
1637
|
+
// sound because rest is non-empty exactly when every fixed index is present, the one case handleTupleResults cannot discard an item's issues
|
|
1638
|
+
if (def.rest && !itemAborted) {
|
|
1389
1639
|
let i = items.length - 1;
|
|
1390
1640
|
const rest = input.slice(items.length);
|
|
1641
|
+
let seen = payload.issues.length;
|
|
1391
1642
|
for (const el of rest) {
|
|
1643
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1644
|
+
if (util.aborted(payload, seen))
|
|
1645
|
+
break;
|
|
1646
|
+
seen = payload.issues.length;
|
|
1647
|
+
}
|
|
1392
1648
|
i++;
|
|
1393
1649
|
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
1394
1650
|
if (result instanceof Promise) {
|
|
@@ -1407,7 +1663,9 @@ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
|
1407
1663
|
});
|
|
1408
1664
|
function getTupleOptStart(items, key) {
|
|
1409
1665
|
for (let i = items.length - 1; i >= 0; i--) {
|
|
1410
|
-
|
|
1666
|
+
// optin is a three-rung ladder so any rung above `undefined` permits an absent slot; optout stays two-valued.
|
|
1667
|
+
const omittable = key === "optin" ? items[i]._zod.optin !== undefined : items[i]._zod.optout === "optional";
|
|
1668
|
+
if (!omittable)
|
|
1411
1669
|
return i + 1;
|
|
1412
1670
|
}
|
|
1413
1671
|
return 0;
|
|
@@ -1419,12 +1677,15 @@ function handleTupleResult(result, final, index) {
|
|
|
1419
1677
|
final.value[index] = result.value;
|
|
1420
1678
|
}
|
|
1421
1679
|
function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
1422
|
-
// Walk results in order. Mirror $ZodObject's swallow-on-absent-optional
|
|
1423
|
-
// rule, but only after `optoutStart`: the first index where the output
|
|
1424
|
-
// tuple tail can be absent.
|
|
1680
|
+
// 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.
|
|
1425
1681
|
for (let i = 0; i < items.length; i++) {
|
|
1426
1682
|
const r = itemResults[i];
|
|
1427
1683
|
const isPresent = i < input.length;
|
|
1684
|
+
// 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`.
|
|
1685
|
+
if (!isPresent && i >= optoutStart && items[i]._zod.optin === "optional") {
|
|
1686
|
+
final.value.length = i;
|
|
1687
|
+
break;
|
|
1688
|
+
}
|
|
1428
1689
|
if (r.issues.length) {
|
|
1429
1690
|
if (!isPresent && i >= optoutStart) {
|
|
1430
1691
|
final.value.length = i;
|
|
@@ -1452,6 +1713,8 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
1452
1713
|
}
|
|
1453
1714
|
exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
1454
1715
|
exports.$ZodType.init(inst, def);
|
|
1716
|
+
const memo = core.globalConfig.memoizer;
|
|
1717
|
+
memo?.attach(inst);
|
|
1455
1718
|
inst._zod.parse = (payload, ctx) => {
|
|
1456
1719
|
const input = payload.value;
|
|
1457
1720
|
if (!util.isPlainObject(input)) {
|
|
@@ -1463,14 +1726,18 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1463
1726
|
});
|
|
1464
1727
|
return payload;
|
|
1465
1728
|
}
|
|
1729
|
+
// 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
|
|
1466
1730
|
const proms = [];
|
|
1467
1731
|
const values = def.keyType._zod.values;
|
|
1468
|
-
if (values) {
|
|
1469
|
-
payload.value = {};
|
|
1732
|
+
if (values && !def.partial) {
|
|
1733
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1470
1734
|
const recordKeys = new Set();
|
|
1471
1735
|
for (const key of values) {
|
|
1472
1736
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
1473
1737
|
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
1738
|
+
// A declared __proto__ is stripped but is not an unrecognized key.
|
|
1739
|
+
if (key === "__proto__")
|
|
1740
|
+
continue;
|
|
1474
1741
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1475
1742
|
if (keyResult instanceof Promise) {
|
|
1476
1743
|
throw new Error("Async schemas not supported in object keys currently");
|
|
@@ -1487,6 +1754,8 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1487
1754
|
continue;
|
|
1488
1755
|
}
|
|
1489
1756
|
const outKey = keyResult.value;
|
|
1757
|
+
if (outKey === "__proto__")
|
|
1758
|
+
continue;
|
|
1490
1759
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1491
1760
|
if (result instanceof Promise) {
|
|
1492
1761
|
proms.push(result.then((result) => {
|
|
@@ -1507,8 +1776,16 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1507
1776
|
let unrecognized;
|
|
1508
1777
|
for (const key in input) {
|
|
1509
1778
|
if (!recordKeys.has(key)) {
|
|
1510
|
-
|
|
1511
|
-
|
|
1779
|
+
if (def.mode === "loose") {
|
|
1780
|
+
// skip __proto__ so it can't replace the result prototype via the assignment setter on the plain {} we build into
|
|
1781
|
+
if (key === "__proto__")
|
|
1782
|
+
continue;
|
|
1783
|
+
payload.value[key] = input[key];
|
|
1784
|
+
}
|
|
1785
|
+
else {
|
|
1786
|
+
unrecognized = unrecognized ?? [];
|
|
1787
|
+
unrecognized.push(key);
|
|
1788
|
+
}
|
|
1512
1789
|
}
|
|
1513
1790
|
}
|
|
1514
1791
|
if (unrecognized && unrecognized.length > 0) {
|
|
@@ -1517,11 +1794,14 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1517
1794
|
input,
|
|
1518
1795
|
inst,
|
|
1519
1796
|
keys: unrecognized,
|
|
1797
|
+
continue: true,
|
|
1520
1798
|
});
|
|
1521
1799
|
}
|
|
1522
1800
|
}
|
|
1523
1801
|
else {
|
|
1524
|
-
payload.value = {};
|
|
1802
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1803
|
+
// 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.
|
|
1804
|
+
let unrecognized;
|
|
1525
1805
|
// Reflect.ownKeys for Symbol-key support; filter non-enumerable to match z.object()
|
|
1526
1806
|
for (const key of Reflect.ownKeys(input)) {
|
|
1527
1807
|
if (key === "__proto__")
|
|
@@ -1532,8 +1812,7 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1532
1812
|
if (keyResult instanceof Promise) {
|
|
1533
1813
|
throw new Error("Async schemas not supported in object keys currently");
|
|
1534
1814
|
}
|
|
1535
|
-
// Numeric string fallback: if key is a numeric string and failed, retry with Number(key)
|
|
1536
|
-
// This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
|
|
1815
|
+
// 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
|
|
1537
1816
|
const checkNumericKey = typeof key === "string" && regexes.number.test(key) && keyResult.issues.length;
|
|
1538
1817
|
if (checkNumericKey) {
|
|
1539
1818
|
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
@@ -1549,6 +1828,10 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1549
1828
|
// Pass through unchanged
|
|
1550
1829
|
payload.value[key] = input[key];
|
|
1551
1830
|
}
|
|
1831
|
+
else if (values) {
|
|
1832
|
+
unrecognized = unrecognized ?? [];
|
|
1833
|
+
unrecognized.push(key);
|
|
1834
|
+
}
|
|
1552
1835
|
else {
|
|
1553
1836
|
// Default "strict" behavior: error on invalid key
|
|
1554
1837
|
payload.issues.push({
|
|
@@ -1562,22 +1845,35 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1562
1845
|
}
|
|
1563
1846
|
continue;
|
|
1564
1847
|
}
|
|
1848
|
+
// 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
|
|
1849
|
+
const outKey = keyResult.value;
|
|
1850
|
+
if (outKey === "__proto__")
|
|
1851
|
+
continue;
|
|
1565
1852
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1566
1853
|
if (result instanceof Promise) {
|
|
1567
1854
|
proms.push(result.then((result) => {
|
|
1568
1855
|
if (result.issues.length) {
|
|
1569
1856
|
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
1570
1857
|
}
|
|
1571
|
-
payload.value[
|
|
1858
|
+
payload.value[outKey] = result.value;
|
|
1572
1859
|
}));
|
|
1573
1860
|
}
|
|
1574
1861
|
else {
|
|
1575
1862
|
if (result.issues.length) {
|
|
1576
1863
|
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
1577
1864
|
}
|
|
1578
|
-
payload.value[
|
|
1865
|
+
payload.value[outKey] = result.value;
|
|
1579
1866
|
}
|
|
1580
1867
|
}
|
|
1868
|
+
if (unrecognized && unrecognized.length > 0) {
|
|
1869
|
+
payload.issues.push({
|
|
1870
|
+
code: "unrecognized_keys",
|
|
1871
|
+
input,
|
|
1872
|
+
inst,
|
|
1873
|
+
keys: unrecognized,
|
|
1874
|
+
continue: true,
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1581
1877
|
}
|
|
1582
1878
|
if (proms.length) {
|
|
1583
1879
|
return Promise.all(proms).then(() => payload);
|
|
@@ -1587,6 +1883,8 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1587
1883
|
});
|
|
1588
1884
|
exports.$ZodMap = core.$constructor("$ZodMap", (inst, def) => {
|
|
1589
1885
|
exports.$ZodType.init(inst, def);
|
|
1886
|
+
const memo = core.globalConfig.memoizer;
|
|
1887
|
+
memo?.attach(inst);
|
|
1590
1888
|
inst._zod.parse = (payload, ctx) => {
|
|
1591
1889
|
const input = payload.value;
|
|
1592
1890
|
if (!(input instanceof Map)) {
|
|
@@ -1599,8 +1897,15 @@ exports.$ZodMap = core.$constructor("$ZodMap", (inst, def) => {
|
|
|
1599
1897
|
return payload;
|
|
1600
1898
|
}
|
|
1601
1899
|
const proms = [];
|
|
1602
|
-
payload.value = new Map();
|
|
1900
|
+
payload.value = memo ? memo.alloc(inst, payload, new Map(), ctx) : new Map();
|
|
1901
|
+
const abortEarly = ctx?.abortEarly;
|
|
1902
|
+
let seen = payload.issues.length;
|
|
1603
1903
|
for (const [key, value] of input) {
|
|
1904
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1905
|
+
if (util.aborted(payload, seen))
|
|
1906
|
+
break;
|
|
1907
|
+
seen = payload.issues.length;
|
|
1908
|
+
}
|
|
1604
1909
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1605
1910
|
const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
|
|
1606
1911
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
@@ -1651,6 +1956,8 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
1651
1956
|
}
|
|
1652
1957
|
exports.$ZodSet = core.$constructor("$ZodSet", (inst, def) => {
|
|
1653
1958
|
exports.$ZodType.init(inst, def);
|
|
1959
|
+
const memo = core.globalConfig.memoizer;
|
|
1960
|
+
memo?.attach(inst);
|
|
1654
1961
|
inst._zod.parse = (payload, ctx) => {
|
|
1655
1962
|
const input = payload.value;
|
|
1656
1963
|
if (!(input instanceof Set)) {
|
|
@@ -1663,8 +1970,15 @@ exports.$ZodSet = core.$constructor("$ZodSet", (inst, def) => {
|
|
|
1663
1970
|
return payload;
|
|
1664
1971
|
}
|
|
1665
1972
|
const proms = [];
|
|
1666
|
-
payload.value = new Set();
|
|
1973
|
+
payload.value = memo ? memo.alloc(inst, payload, new Set(), ctx) : new Set();
|
|
1974
|
+
const abortEarly = ctx?.abortEarly;
|
|
1975
|
+
let seen = payload.issues.length;
|
|
1667
1976
|
for (const item of input) {
|
|
1977
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1978
|
+
if (util.aborted(payload, seen))
|
|
1979
|
+
break;
|
|
1980
|
+
seen = payload.issues.length;
|
|
1981
|
+
}
|
|
1668
1982
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
1669
1983
|
if (result instanceof Promise) {
|
|
1670
1984
|
proms.push(result.then((result) => handleSetResult(result, payload)));
|
|
@@ -1688,10 +2002,11 @@ exports.$ZodEnum = core.$constructor("$ZodEnum", (inst, def) => {
|
|
|
1688
2002
|
const values = util.getEnumValues(def.entries);
|
|
1689
2003
|
const valuesSet = new Set(values);
|
|
1690
2004
|
inst._zod.values = valuesSet;
|
|
1691
|
-
inst
|
|
1692
|
-
.filter((k) => util.propertyKeyTypes.has(typeof k))
|
|
1693
|
-
|
|
1694
|
-
.join("|")})$`);
|
|
2005
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2006
|
+
const patternValues = util.getEnumValues(zod.def.entries).filter((k) => util.propertyKeyTypes.has(typeof k));
|
|
2007
|
+
// unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
|
|
2008
|
+
return new RegExp(patternValues.length ? `^(${patternValues.map((o) => util.escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
2009
|
+
});
|
|
1695
2010
|
inst._zod.parse = (payload, _ctx) => {
|
|
1696
2011
|
const input = payload.value;
|
|
1697
2012
|
if (valuesSet.has(input)) {
|
|
@@ -1708,14 +2023,17 @@ exports.$ZodEnum = core.$constructor("$ZodEnum", (inst, def) => {
|
|
|
1708
2023
|
});
|
|
1709
2024
|
exports.$ZodLiteral = core.$constructor("$ZodLiteral", (inst, def) => {
|
|
1710
2025
|
exports.$ZodType.init(inst, def);
|
|
1711
|
-
if (def.values.length === 0) {
|
|
1712
|
-
throw new Error("Cannot create literal schema with no valid values");
|
|
1713
|
-
}
|
|
1714
2026
|
const values = new Set(def.values);
|
|
1715
2027
|
inst._zod.values = values;
|
|
1716
|
-
inst
|
|
1717
|
-
|
|
1718
|
-
|
|
2028
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2029
|
+
const vals = zod.def.values;
|
|
2030
|
+
// unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
|
|
2031
|
+
return new RegExp(vals.length
|
|
2032
|
+
? `^(${vals
|
|
2033
|
+
.map((o) => typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o))
|
|
2034
|
+
.join("|")})$`
|
|
2035
|
+
: "^[^\\s\\S]$");
|
|
2036
|
+
});
|
|
1719
2037
|
inst._zod.parse = (payload, _ctx) => {
|
|
1720
2038
|
const input = payload.value;
|
|
1721
2039
|
if (values.has(input)) {
|
|
@@ -1749,6 +2067,7 @@ exports.$ZodFile = core.$constructor("$ZodFile", (inst, def) => {
|
|
|
1749
2067
|
exports.$ZodTransform = core.$constructor("$ZodTransform", (inst, def) => {
|
|
1750
2068
|
exports.$ZodType.init(inst, def);
|
|
1751
2069
|
inst._zod.optin = "optional";
|
|
2070
|
+
core.globalConfig.memoizer?.guard(inst);
|
|
1752
2071
|
inst._zod.parse = (payload, ctx) => {
|
|
1753
2072
|
if (ctx.direction === "backward") {
|
|
1754
2073
|
throw new core.$ZodEncodeError(inst.constructor.name);
|
|
@@ -1758,7 +2077,6 @@ exports.$ZodTransform = core.$constructor("$ZodTransform", (inst, def) => {
|
|
|
1758
2077
|
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
1759
2078
|
return output.then((output) => {
|
|
1760
2079
|
payload.value = output;
|
|
1761
|
-
payload.fallback = true;
|
|
1762
2080
|
return payload;
|
|
1763
2081
|
});
|
|
1764
2082
|
}
|
|
@@ -1766,37 +2084,37 @@ exports.$ZodTransform = core.$constructor("$ZodTransform", (inst, def) => {
|
|
|
1766
2084
|
throw new core.$ZodAsyncError();
|
|
1767
2085
|
}
|
|
1768
2086
|
payload.value = _out;
|
|
1769
|
-
payload.fallback = true;
|
|
1770
2087
|
return payload;
|
|
1771
2088
|
};
|
|
1772
2089
|
});
|
|
1773
|
-
function handleOptionalResult(
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
return result;
|
|
2090
|
+
function handleOptionalResult(payload, result) {
|
|
2091
|
+
// 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.
|
|
2092
|
+
payload.value = result.issues.length ? undefined : result.value;
|
|
2093
|
+
return payload;
|
|
1778
2094
|
}
|
|
1779
2095
|
exports.$ZodOptional = core.$constructor("$ZodOptional", (inst, def) => {
|
|
1780
2096
|
exports.$ZodType.init(inst, def);
|
|
1781
|
-
|
|
2097
|
+
// .optional() propagates absence rather than substituting for it, so a defaulted inner keeps its rung.
|
|
2098
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
1782
2099
|
inst._zod.optout = "optional";
|
|
1783
|
-
util.
|
|
1784
|
-
|
|
2100
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2101
|
+
const values = zod.def.innerType._zod.values;
|
|
2102
|
+
return values ? new Set([...values, undefined]) : undefined;
|
|
1785
2103
|
});
|
|
1786
|
-
util.
|
|
1787
|
-
const pattern = def.innerType._zod.pattern;
|
|
2104
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2105
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
1788
2106
|
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
|
|
1789
2107
|
});
|
|
1790
2108
|
inst._zod.parse = (payload, ctx) => {
|
|
1791
|
-
if (def.innerType._zod.optin === "optional") {
|
|
1792
|
-
const input = payload.value;
|
|
1793
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
1794
|
-
if (result instanceof Promise)
|
|
1795
|
-
return result.then((r) => handleOptionalResult(r, input));
|
|
1796
|
-
return handleOptionalResult(result, input);
|
|
1797
|
-
}
|
|
1798
2109
|
if (payload.value === undefined) {
|
|
1799
|
-
|
|
2110
|
+
// Only the top rung substitutes a value for absence; everything else leaves it intact, which is what .optional() means.
|
|
2111
|
+
if (def.innerType._zod.optin !== "defaulted")
|
|
2112
|
+
return payload;
|
|
2113
|
+
// 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.
|
|
2114
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
2115
|
+
if (result instanceof Promise)
|
|
2116
|
+
return result.then((result) => handleOptionalResult(payload, result));
|
|
2117
|
+
return handleOptionalResult(payload, result);
|
|
1800
2118
|
}
|
|
1801
2119
|
return def.innerType._zod.run(payload, ctx);
|
|
1802
2120
|
};
|
|
@@ -1805,8 +2123,8 @@ exports.$ZodExactOptional = core.$constructor("$ZodExactOptional", (inst, def) =
|
|
|
1805
2123
|
// Call parent init - inherits optin/optout = "optional"
|
|
1806
2124
|
exports.$ZodOptional.init(inst, def);
|
|
1807
2125
|
// Override values/pattern to NOT add undefined
|
|
1808
|
-
util.
|
|
1809
|
-
util.
|
|
2126
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2127
|
+
util.defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
|
|
1810
2128
|
// Override parse to just delegate (no undefined handling)
|
|
1811
2129
|
inst._zod.parse = (payload, ctx) => {
|
|
1812
2130
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1814,14 +2132,14 @@ exports.$ZodExactOptional = core.$constructor("$ZodExactOptional", (inst, def) =
|
|
|
1814
2132
|
});
|
|
1815
2133
|
exports.$ZodNullable = core.$constructor("$ZodNullable", (inst, def) => {
|
|
1816
2134
|
exports.$ZodType.init(inst, def);
|
|
1817
|
-
util.
|
|
1818
|
-
util.
|
|
1819
|
-
util.
|
|
1820
|
-
const pattern = def.innerType._zod.pattern;
|
|
2135
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
|
|
2136
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2137
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2138
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
1821
2139
|
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;
|
|
1822
2140
|
});
|
|
1823
|
-
util.
|
|
1824
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
|
|
2141
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2142
|
+
return zod.def.innerType._zod.values ? new Set([...zod.def.innerType._zod.values, null]) : undefined;
|
|
1825
2143
|
});
|
|
1826
2144
|
inst._zod.parse = (payload, ctx) => {
|
|
1827
2145
|
// Forward direction (decode): allow null to pass through
|
|
@@ -1833,8 +2151,8 @@ exports.$ZodNullable = core.$constructor("$ZodNullable", (inst, def) => {
|
|
|
1833
2151
|
exports.$ZodDefault = core.$constructor("$ZodDefault", (inst, def) => {
|
|
1834
2152
|
exports.$ZodType.init(inst, def);
|
|
1835
2153
|
// inst._zod.qin = "true";
|
|
1836
|
-
inst._zod.optin = "
|
|
1837
|
-
util.
|
|
2154
|
+
inst._zod.optin = "defaulted";
|
|
2155
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1838
2156
|
inst._zod.parse = (payload, ctx) => {
|
|
1839
2157
|
if (ctx.direction === "backward") {
|
|
1840
2158
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1863,8 +2181,8 @@ function handleDefaultResult(payload, def) {
|
|
|
1863
2181
|
}
|
|
1864
2182
|
exports.$ZodPrefault = core.$constructor("$ZodPrefault", (inst, def) => {
|
|
1865
2183
|
exports.$ZodType.init(inst, def);
|
|
1866
|
-
inst._zod.optin = "
|
|
1867
|
-
util.
|
|
2184
|
+
inst._zod.optin = "defaulted";
|
|
2185
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1868
2186
|
inst._zod.parse = (payload, ctx) => {
|
|
1869
2187
|
if (ctx.direction === "backward") {
|
|
1870
2188
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1878,8 +2196,8 @@ exports.$ZodPrefault = core.$constructor("$ZodPrefault", (inst, def) => {
|
|
|
1878
2196
|
});
|
|
1879
2197
|
exports.$ZodNonOptional = core.$constructor("$ZodNonOptional", (inst, def) => {
|
|
1880
2198
|
exports.$ZodType.init(inst, def);
|
|
1881
|
-
util.
|
|
1882
|
-
const v = def.innerType._zod.values;
|
|
2199
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2200
|
+
const v = zod.def.innerType._zod.values;
|
|
1883
2201
|
return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
|
|
1884
2202
|
});
|
|
1885
2203
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -1918,47 +2236,40 @@ exports.$ZodSuccess = core.$constructor("$ZodSuccess", (inst, def) => {
|
|
|
1918
2236
|
return payload;
|
|
1919
2237
|
};
|
|
1920
2238
|
});
|
|
2239
|
+
function handleCatchResult(payload, result, def, ctx) {
|
|
2240
|
+
if (!result.issues.length) {
|
|
2241
|
+
payload.value = result.value;
|
|
2242
|
+
// 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.
|
|
2243
|
+
if (result.memo)
|
|
2244
|
+
payload.memo = true;
|
|
2245
|
+
return payload;
|
|
2246
|
+
}
|
|
2247
|
+
// 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.
|
|
2248
|
+
payload.value = def.catchValue({
|
|
2249
|
+
...result,
|
|
2250
|
+
value: payload.value,
|
|
2251
|
+
error: {
|
|
2252
|
+
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
2253
|
+
},
|
|
2254
|
+
input: payload.value,
|
|
2255
|
+
});
|
|
2256
|
+
return payload;
|
|
2257
|
+
}
|
|
1921
2258
|
exports.$ZodCatch = core.$constructor("$ZodCatch", (inst, def) => {
|
|
1922
2259
|
exports.$ZodType.init(inst, def);
|
|
1923
|
-
inst._zod.optin
|
|
1924
|
-
util.
|
|
1925
|
-
util.
|
|
2260
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2261
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2262
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1926
2263
|
inst._zod.parse = (payload, ctx) => {
|
|
1927
2264
|
if (ctx.direction === "backward") {
|
|
1928
2265
|
return def.innerType._zod.run(payload, ctx);
|
|
1929
2266
|
}
|
|
1930
2267
|
// Forward direction (decode): apply catch logic
|
|
1931
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2268
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
1932
2269
|
if (result instanceof Promise) {
|
|
1933
|
-
return result.then((result) =>
|
|
1934
|
-
payload.value = result.value;
|
|
1935
|
-
if (result.issues.length) {
|
|
1936
|
-
payload.value = def.catchValue({
|
|
1937
|
-
...payload,
|
|
1938
|
-
error: {
|
|
1939
|
-
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
1940
|
-
},
|
|
1941
|
-
input: payload.value,
|
|
1942
|
-
});
|
|
1943
|
-
payload.issues = [];
|
|
1944
|
-
payload.fallback = true;
|
|
1945
|
-
}
|
|
1946
|
-
return payload;
|
|
1947
|
-
});
|
|
2270
|
+
return result.then((result) => handleCatchResult(payload, result, def, ctx));
|
|
1948
2271
|
}
|
|
1949
|
-
payload
|
|
1950
|
-
if (result.issues.length) {
|
|
1951
|
-
payload.value = def.catchValue({
|
|
1952
|
-
...payload,
|
|
1953
|
-
error: {
|
|
1954
|
-
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
1955
|
-
},
|
|
1956
|
-
input: payload.value,
|
|
1957
|
-
});
|
|
1958
|
-
payload.issues = [];
|
|
1959
|
-
payload.fallback = true;
|
|
1960
|
-
}
|
|
1961
|
-
return payload;
|
|
2272
|
+
return handleCatchResult(payload, result, def, ctx);
|
|
1962
2273
|
};
|
|
1963
2274
|
});
|
|
1964
2275
|
exports.$ZodNaN = core.$constructor("$ZodNaN", (inst, def) => {
|
|
@@ -1978,10 +2289,10 @@ exports.$ZodNaN = core.$constructor("$ZodNaN", (inst, def) => {
|
|
|
1978
2289
|
});
|
|
1979
2290
|
exports.$ZodPipe = core.$constructor("$ZodPipe", (inst, def) => {
|
|
1980
2291
|
exports.$ZodType.init(inst, def);
|
|
1981
|
-
util.
|
|
1982
|
-
util.
|
|
1983
|
-
util.
|
|
1984
|
-
util.
|
|
2292
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2293
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2294
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2295
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
1985
2296
|
inst._zod.parse = (payload, ctx) => {
|
|
1986
2297
|
if (ctx.direction === "backward") {
|
|
1987
2298
|
const right = def.out._zod.run(payload, ctx);
|
|
@@ -1998,19 +2309,20 @@ exports.$ZodPipe = core.$constructor("$ZodPipe", (inst, def) => {
|
|
|
1998
2309
|
};
|
|
1999
2310
|
});
|
|
2000
2311
|
function handlePipeResult(left, next, ctx) {
|
|
2001
|
-
|
|
2312
|
+
// 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.
|
|
2313
|
+
if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
|
|
2002
2314
|
// prevent further checks
|
|
2003
2315
|
left.aborted = true;
|
|
2004
2316
|
return left;
|
|
2005
2317
|
}
|
|
2006
|
-
return next._zod.run({ value: left.value, issues: left.issues
|
|
2318
|
+
return next._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
2007
2319
|
}
|
|
2008
2320
|
exports.$ZodCodec = core.$constructor("$ZodCodec", (inst, def) => {
|
|
2009
2321
|
exports.$ZodType.init(inst, def);
|
|
2010
|
-
util.
|
|
2011
|
-
util.
|
|
2012
|
-
util.
|
|
2013
|
-
util.
|
|
2322
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2323
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2324
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2325
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
2014
2326
|
inst._zod.parse = (payload, ctx) => {
|
|
2015
2327
|
const direction = ctx.direction || "forward";
|
|
2016
2328
|
if (direction === "forward") {
|
|
@@ -2064,10 +2376,10 @@ exports.$ZodPreprocess = core.$constructor("$ZodPreprocess", (inst, def) => {
|
|
|
2064
2376
|
});
|
|
2065
2377
|
exports.$ZodReadonly = core.$constructor("$ZodReadonly", (inst, def) => {
|
|
2066
2378
|
exports.$ZodType.init(inst, def);
|
|
2067
|
-
util.
|
|
2068
|
-
util.
|
|
2069
|
-
util.
|
|
2070
|
-
util.
|
|
2379
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
2380
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2381
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
|
|
2382
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
|
|
2071
2383
|
inst._zod.parse = (payload, ctx) => {
|
|
2072
2384
|
if (ctx.direction === "backward") {
|
|
2073
2385
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -2080,25 +2392,72 @@ exports.$ZodReadonly = core.$constructor("$ZodReadonly", (inst, def) => {
|
|
|
2080
2392
|
};
|
|
2081
2393
|
});
|
|
2082
2394
|
function handleReadonlyResult(payload) {
|
|
2083
|
-
|
|
2395
|
+
// 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.
|
|
2396
|
+
if (!payload.memo)
|
|
2397
|
+
payload.value = Object.freeze(payload.value);
|
|
2084
2398
|
return payload;
|
|
2085
2399
|
}
|
|
2400
|
+
// 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
|
|
2401
|
+
function leafPattern(schema) {
|
|
2402
|
+
const def = schema._zod.def;
|
|
2403
|
+
let pattern = def.pattern;
|
|
2404
|
+
let isInt = !!def.format?.includes("int");
|
|
2405
|
+
let minimum;
|
|
2406
|
+
let maximum;
|
|
2407
|
+
for (const ch of def.checks ?? []) {
|
|
2408
|
+
const d = ch._zod.def;
|
|
2409
|
+
if (d.pattern)
|
|
2410
|
+
pattern = d.pattern;
|
|
2411
|
+
isInt || (isInt = !!d.format?.includes("int"));
|
|
2412
|
+
const lo = d.minimum ?? d.length;
|
|
2413
|
+
const hi = d.maximum ?? d.length;
|
|
2414
|
+
if (lo !== undefined && (minimum === undefined || lo > minimum))
|
|
2415
|
+
minimum = lo;
|
|
2416
|
+
if (hi !== undefined && (maximum === undefined || hi < maximum))
|
|
2417
|
+
maximum = hi;
|
|
2418
|
+
}
|
|
2419
|
+
if (pattern)
|
|
2420
|
+
return pattern.source;
|
|
2421
|
+
// an empty range matches nothing at runtime, and `{8,5}` is not a legal quantifier
|
|
2422
|
+
if (minimum !== undefined && maximum !== undefined && minimum > maximum)
|
|
2423
|
+
return "(?!)";
|
|
2424
|
+
if (minimum !== undefined || maximum !== undefined)
|
|
2425
|
+
return regexes.string({ minimum, maximum }).source;
|
|
2426
|
+
const own = schema._zod.pattern;
|
|
2427
|
+
return (isInt && own === regexes.number ? regexes.integer : own)?.source;
|
|
2428
|
+
}
|
|
2429
|
+
// 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
|
|
2430
|
+
function partPattern(schema) {
|
|
2431
|
+
const def = schema._zod.def;
|
|
2432
|
+
const own = schema._zod.pattern?.source;
|
|
2433
|
+
// lazy resolves its inner on the internals, not the def
|
|
2434
|
+
const inner = def.innerType ?? schema._zod.innerType;
|
|
2435
|
+
if (inner) {
|
|
2436
|
+
const before = inner._zod.pattern?.source;
|
|
2437
|
+
const after = partPattern(inner);
|
|
2438
|
+
if (own && before && after && after !== before) {
|
|
2439
|
+
return own.replace(util.cleanRegex(before), () => util.cleanRegex(after));
|
|
2440
|
+
}
|
|
2441
|
+
return own;
|
|
2442
|
+
}
|
|
2443
|
+
if (def.options) {
|
|
2444
|
+
const sources = def.options.map(partPattern);
|
|
2445
|
+
if (sources.every(Boolean))
|
|
2446
|
+
return `^(${sources.map((s) => util.cleanRegex(s)).join("|")})$`;
|
|
2447
|
+
}
|
|
2448
|
+
return leafPattern(schema);
|
|
2449
|
+
}
|
|
2086
2450
|
exports.$ZodTemplateLiteral = core.$constructor("$ZodTemplateLiteral", (inst, def) => {
|
|
2087
2451
|
exports.$ZodType.init(inst, def);
|
|
2088
2452
|
const regexParts = [];
|
|
2089
2453
|
for (const part of def.parts) {
|
|
2090
2454
|
if (typeof part === "object" && part !== null) {
|
|
2091
2455
|
// is Zod schema
|
|
2092
|
-
|
|
2093
|
-
|
|
2456
|
+
const source = partPattern(part);
|
|
2457
|
+
if (!source) {
|
|
2094
2458
|
throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
|
|
2095
2459
|
}
|
|
2096
|
-
|
|
2097
|
-
if (!source)
|
|
2098
|
-
throw new Error(`Invalid template literal part: ${part._zod.traits}`);
|
|
2099
|
-
const start = source.startsWith("^") ? 1 : 0;
|
|
2100
|
-
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
2101
|
-
regexParts.push(source.slice(start, end));
|
|
2460
|
+
regexParts.push(util.cleanRegex(source));
|
|
2102
2461
|
}
|
|
2103
2462
|
else if (part === null || util.primitiveTypes.has(typeof part)) {
|
|
2104
2463
|
regexParts.push(util.escapeRegex(`${part}`));
|
|
@@ -2134,33 +2493,35 @@ exports.$ZodTemplateLiteral = core.$constructor("$ZodTemplateLiteral", (inst, de
|
|
|
2134
2493
|
});
|
|
2135
2494
|
exports.$ZodFunction = core.$constructor("$ZodFunction", (inst, def) => {
|
|
2136
2495
|
exports.$ZodType.init(inst, def);
|
|
2137
|
-
|
|
2496
|
+
// Defined, not assigned: the classic prototype exposes `_def` as a getter with no setter.
|
|
2497
|
+
Object.defineProperty(inst, "_def", { value: def });
|
|
2138
2498
|
inst._zod.def = def;
|
|
2139
2499
|
inst.implement = (func) => {
|
|
2140
2500
|
if (typeof func !== "function") {
|
|
2141
2501
|
throw new Error("implement() must be called with a function");
|
|
2142
2502
|
}
|
|
2143
|
-
|
|
2503
|
+
// Defined inline so the closure stays anonymous: binding it to a `const` first names it, which costs 256 bytes per implemented function.
|
|
2504
|
+
return Object.defineProperty(function (...args) {
|
|
2144
2505
|
const parsedArgs = inst._def.input ? (0, parse_js_1.parse)(inst._def.input, args) : args;
|
|
2145
2506
|
const result = Reflect.apply(func, this, parsedArgs);
|
|
2146
2507
|
if (inst._def.output) {
|
|
2147
2508
|
return (0, parse_js_1.parse)(inst._def.output, result);
|
|
2148
2509
|
}
|
|
2149
2510
|
return result;
|
|
2150
|
-
};
|
|
2511
|
+
}, "_zod", { value: inst._zod, enumerable: false });
|
|
2151
2512
|
};
|
|
2152
2513
|
inst.implementAsync = (func) => {
|
|
2153
2514
|
if (typeof func !== "function") {
|
|
2154
2515
|
throw new Error("implementAsync() must be called with a function");
|
|
2155
2516
|
}
|
|
2156
|
-
return async function (...args) {
|
|
2517
|
+
return Object.defineProperty(async function (...args) {
|
|
2157
2518
|
const parsedArgs = inst._def.input ? await (0, parse_js_1.parseAsync)(inst._def.input, args) : args;
|
|
2158
2519
|
const result = await Reflect.apply(func, this, parsedArgs);
|
|
2159
2520
|
if (inst._def.output) {
|
|
2160
2521
|
return await (0, parse_js_1.parseAsync)(inst._def.output, result);
|
|
2161
2522
|
}
|
|
2162
2523
|
return result;
|
|
2163
|
-
};
|
|
2524
|
+
}, "_zod", { value: inst._zod, enumerable: false });
|
|
2164
2525
|
};
|
|
2165
2526
|
inst._zod.parse = (payload, _ctx) => {
|
|
2166
2527
|
if (typeof payload.value !== "function") {
|
|
@@ -2219,19 +2580,17 @@ exports.$ZodPromise = core.$constructor("$ZodPromise", (inst, def) => {
|
|
|
2219
2580
|
});
|
|
2220
2581
|
exports.$ZodLazy = core.$constructor("$ZodLazy", (inst, def) => {
|
|
2221
2582
|
exports.$ZodType.init(inst, def);
|
|
2222
|
-
// Cache the resolved inner type on the shared `def` so all clones of this
|
|
2223
|
-
// lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance,
|
|
2224
|
-
// preserving identity for cycle detection on recursive schemas.
|
|
2583
|
+
// 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.
|
|
2225
2584
|
util.defineLazy(inst._zod, "innerType", () => {
|
|
2226
2585
|
const d = def;
|
|
2227
2586
|
if (!d._cachedInner)
|
|
2228
2587
|
d._cachedInner = def.getter();
|
|
2229
2588
|
return d._cachedInner;
|
|
2230
2589
|
});
|
|
2231
|
-
util.
|
|
2232
|
-
util.
|
|
2233
|
-
util.
|
|
2234
|
-
util.
|
|
2590
|
+
util.defineLazyInternal(inst, "pattern", (zod) => zod.innerType?._zod?.pattern);
|
|
2591
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.innerType?._zod?.propValues);
|
|
2592
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.innerType?._zod?.optin ?? undefined);
|
|
2593
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.innerType?._zod?.optout ?? undefined);
|
|
2235
2594
|
inst._zod.parse = (payload, ctx) => {
|
|
2236
2595
|
const inner = inst._zod.innerType;
|
|
2237
2596
|
return inner._zod.run(payload, ctx);
|
|
@@ -2268,3 +2627,83 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2268
2627
|
payload.issues.push(util.issue(_iss));
|
|
2269
2628
|
}
|
|
2270
2629
|
}
|
|
2630
|
+
// 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
|
|
2631
|
+
function handlePropertiesResult(result, payload, key) {
|
|
2632
|
+
if (result.issues.length) {
|
|
2633
|
+
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
exports.$ZodProperties = core.$constructor("$ZodProperties", (inst, def) => {
|
|
2637
|
+
// $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.
|
|
2638
|
+
exports.$ZodType.init(inst, def);
|
|
2639
|
+
checks.$ZodCheck.init(inst, def);
|
|
2640
|
+
const memo = core.globalConfig.memoizer;
|
|
2641
|
+
memo?.attach(inst);
|
|
2642
|
+
// 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
|
|
2643
|
+
let entries;
|
|
2644
|
+
const runShape = (payload, ctx) => {
|
|
2645
|
+
entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
|
|
2646
|
+
const input = payload.value;
|
|
2647
|
+
let proms;
|
|
2648
|
+
for (const [key, schema] of entries) {
|
|
2649
|
+
const result = schema._zod.run({ value: input[key], issues: [] }, ctx);
|
|
2650
|
+
if (result instanceof Promise) {
|
|
2651
|
+
proms ?? (proms = []);
|
|
2652
|
+
proms.push(result.then((result) => handlePropertiesResult(result, payload, key)));
|
|
2653
|
+
}
|
|
2654
|
+
else {
|
|
2655
|
+
handlePropertiesResult(result, payload, key);
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
if (proms)
|
|
2659
|
+
return Promise.all(proms).then(() => undefined);
|
|
2660
|
+
return undefined;
|
|
2661
|
+
};
|
|
2662
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2663
|
+
const input = payload.value;
|
|
2664
|
+
// 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.
|
|
2665
|
+
if (input === null || (typeof input !== "object" && typeof input !== "function")) {
|
|
2666
|
+
payload.issues.push({ expected: "object", code: "invalid_type", input, inst });
|
|
2667
|
+
return payload;
|
|
2668
|
+
}
|
|
2669
|
+
// 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
|
|
2670
|
+
if (ctx.direction === "backward")
|
|
2671
|
+
ctx = { ...ctx, direction: "forward" };
|
|
2672
|
+
// 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
|
|
2673
|
+
if (memo)
|
|
2674
|
+
memo.alloc(inst, payload, input, ctx);
|
|
2675
|
+
const result = runShape(payload, ctx);
|
|
2676
|
+
return result instanceof Promise ? result.then(() => payload) : payload;
|
|
2677
|
+
};
|
|
2678
|
+
// 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.
|
|
2679
|
+
inst._zod.check = (payload) => {
|
|
2680
|
+
if (payload.value == null) {
|
|
2681
|
+
payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
|
|
2682
|
+
return undefined;
|
|
2683
|
+
}
|
|
2684
|
+
return runShape(payload, {});
|
|
2685
|
+
};
|
|
2686
|
+
}, {
|
|
2687
|
+
*[Symbol.iterator]() {
|
|
2688
|
+
yield this;
|
|
2689
|
+
},
|
|
2690
|
+
});
|
|
2691
|
+
|
|
2692
|
+
// seal-cjs-exports
|
|
2693
|
+
(function () {
|
|
2694
|
+
var keys = Object.getOwnPropertyNames(exports);
|
|
2695
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2696
|
+
var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
|
|
2697
|
+
if (!desc || !desc.get || !desc.configurable) continue;
|
|
2698
|
+
var value;
|
|
2699
|
+
try {
|
|
2700
|
+
value = desc.get();
|
|
2701
|
+
} catch (e) {
|
|
2702
|
+
continue;
|
|
2703
|
+
}
|
|
2704
|
+
// a circular require may not have settled this one yet, so leave it live
|
|
2705
|
+
if (value === undefined) continue;
|
|
2706
|
+
Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
|
|
2707
|
+
}
|
|
2708
|
+
Object.freeze(exports);
|
|
2709
|
+
})();
|