@psnext/slingcli 3.3.20260911-1 → 3.3.20260914-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/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-VDBOM5UG.js → chunk-BRL3MDQL.js} +1 -1
- 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/dist/modes/interactive/components/model-selector.js +79 -32
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +2 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +25 -8
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +2 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/getAwsChunkedEncodingStream.browser.js +2 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/getAwsChunkedEncodingStream.js +23 -8
- package/node_modules/@smithy/core/package.json +1 -1
- package/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/node/assert/strict.d.ts +13 -56
- package/node_modules/@types/node/assert.d.ts +189 -190
- package/node_modules/@types/node/async_hooks.d.ts +151 -43
- package/node_modules/@types/node/buffer.buffer.d.ts +12 -13
- package/node_modules/@types/node/buffer.d.ts +103 -237
- package/node_modules/@types/node/child_process.d.ts +39 -154
- package/node_modules/@types/node/cluster.d.ts +238 -384
- package/node_modules/@types/node/console.d.ts +45 -404
- package/node_modules/@types/node/constants.d.ts +3 -10
- package/node_modules/@types/node/crypto.d.ts +1000 -1593
- package/node_modules/@types/node/dgram.d.ts +133 -81
- package/node_modules/@types/node/diagnostics_channel.d.ts +277 -59
- package/node_modules/@types/node/dns/promises.d.ts +9 -15
- package/node_modules/@types/node/dns.d.ts +136 -183
- package/node_modules/@types/node/domain.d.ts +12 -32
- package/node_modules/@types/node/events.d.ts +872 -840
- package/node_modules/@types/node/ffi.d.ts +486 -0
- package/node_modules/@types/node/fs/promises.d.ts +256 -85
- package/node_modules/@types/node/fs.d.ts +865 -525
- package/node_modules/@types/node/globals.d.ts +12 -34
- package/node_modules/@types/node/globals.typedarray.d.ts +63 -0
- package/node_modules/@types/node/http.d.ts +433 -312
- package/node_modules/@types/node/http2.d.ts +545 -891
- package/node_modules/@types/node/https.d.ts +64 -243
- package/node_modules/@types/node/index.d.ts +25 -7
- package/node_modules/@types/node/inspector/promises.d.ts +35 -0
- package/node_modules/@types/node/inspector.d.ts +70 -58
- package/node_modules/@types/node/inspector.generated.d.ts +764 -410
- package/node_modules/@types/node/module.d.ts +54 -219
- package/node_modules/@types/node/net.d.ts +208 -222
- package/node_modules/@types/node/os.d.ts +41 -49
- package/node_modules/@types/node/package.json +13 -3
- package/node_modules/@types/node/path/posix.d.ts +8 -0
- package/node_modules/@types/node/path/win32.d.ts +8 -0
- package/node_modules/@types/node/path.d.ts +119 -141
- package/node_modules/@types/node/perf_hooks.d.ts +339 -690
- package/node_modules/@types/node/process.d.ts +389 -205
- package/node_modules/@types/node/punycode.d.ts +3 -31
- package/node_modules/@types/node/querystring.d.ts +3 -16
- package/node_modules/@types/node/quic.d.ts +2153 -0
- package/node_modules/@types/node/readline/promises.d.ts +3 -6
- package/node_modules/@types/node/readline.d.ts +66 -152
- package/node_modules/@types/node/repl.d.ts +101 -109
- package/node_modules/@types/node/sea.d.ts +1 -116
- package/node_modules/@types/node/sqlite.d.ts +486 -68
- package/node_modules/@types/node/stream/consumers.d.ts +91 -15
- package/node_modules/@types/node/stream/iter.d.ts +452 -0
- package/node_modules/@types/node/stream/promises.d.ts +136 -15
- package/node_modules/@types/node/stream/web.d.ts +197 -454
- package/node_modules/@types/node/stream.d.ts +603 -491
- package/node_modules/@types/node/string_decoder.d.ts +3 -43
- package/node_modules/@types/node/test/reporters.d.ts +59 -0
- package/node_modules/@types/node/test.d.ts +513 -292
- package/node_modules/@types/node/timers/promises.d.ts +3 -18
- package/node_modules/@types/node/timers.d.ts +3 -141
- package/node_modules/@types/node/tls.d.ts +166 -257
- package/node_modules/@types/node/trace_events.d.ts +3 -97
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +7 -8
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +2 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +26 -6
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +118 -0
- package/node_modules/@types/node/tty.d.ts +61 -43
- package/node_modules/@types/node/url.d.ts +156 -584
- package/node_modules/@types/node/util/types.d.ts +558 -0
- package/node_modules/@types/node/util.d.ts +170 -1099
- package/node_modules/@types/node/v8.d.ts +175 -36
- package/node_modules/@types/node/vfs.d.ts +211 -0
- package/node_modules/@types/node/vm.d.ts +292 -209
- package/node_modules/@types/node/wasi.d.ts +24 -74
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +27 -2
- package/node_modules/@types/node/web-globals/blob.d.ts +23 -0
- package/node_modules/@types/node/web-globals/console.d.ts +9 -0
- package/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +15 -0
- package/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
- package/node_modules/@types/node/web-globals/events.d.ts +9 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +14 -0
- package/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
- package/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +3 -0
- package/node_modules/@types/node/web-globals/performance.d.ts +45 -0
- package/node_modules/@types/node/web-globals/streams.d.ts +97 -0
- package/node_modules/@types/node/web-globals/timers.d.ts +44 -0
- package/node_modules/@types/node/web-globals/url.d.ts +24 -0
- package/node_modules/@types/node/worker_threads.d.ts +257 -407
- package/node_modules/@types/node/zlib/iter.d.ts +131 -0
- package/node_modules/@types/node/zlib.d.ts +24 -165
- package/node_modules/undici-types/agent.d.ts +12 -13
- package/node_modules/undici-types/api.d.ts +26 -26
- package/node_modules/undici-types/balanced-pool.d.ts +13 -12
- package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
- package/node_modules/undici-types/client-stats.d.ts +15 -0
- package/node_modules/undici-types/client.d.ts +63 -37
- package/node_modules/undici-types/connector.d.ts +5 -2
- package/node_modules/undici-types/cookies.d.ts +3 -1
- package/node_modules/undici-types/diagnostics-channel.d.ts +18 -10
- package/node_modules/undici-types/dispatcher.d.ts +136 -139
- package/node_modules/undici-types/dispatcher1-wrapper.d.ts +7 -0
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +4 -3
- package/node_modules/undici-types/errors.d.ts +92 -54
- package/node_modules/undici-types/eventsource.d.ts +9 -4
- package/node_modules/undici-types/fetch.d.ts +51 -25
- 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/h2c-client.d.ts +73 -0
- package/node_modules/undici-types/handlers.d.ts +10 -9
- package/node_modules/undici-types/header.d.ts +162 -1
- package/node_modules/undici-types/index.d.ts +69 -47
- package/node_modules/undici-types/interceptors.d.ts +72 -9
- package/node_modules/undici-types/mock-agent.d.ts +36 -18
- package/node_modules/undici-types/mock-call-history.d.ts +111 -0
- package/node_modules/undici-types/mock-client.d.ts +6 -4
- package/node_modules/undici-types/mock-errors.d.ts +3 -3
- package/node_modules/undici-types/mock-interceptor.d.ts +26 -21
- package/node_modules/undici-types/mock-pool.d.ts +6 -4
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/patch.d.ts +0 -4
- 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 +14 -6
- package/node_modules/undici-types/readable.d.ts +19 -16
- package/node_modules/undici-types/retry-agent.d.ts +1 -1
- package/node_modules/undici-types/retry-handler.d.ts +19 -10
- package/node_modules/undici-types/round-robin-pool.d.ts +39 -0
- package/node_modules/undici-types/snapshot-agent.d.ts +113 -0
- package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
- package/node_modules/undici-types/util.d.ts +3 -3
- package/node_modules/undici-types/utility.d.ts +7 -0
- package/node_modules/undici-types/webidl.d.ts +148 -30
- package/node_modules/undici-types/websocket.d.ts +48 -10
- package/node_modules/zod/README.md +2 -2
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v4/classic/checks.ts +1 -0
- package/node_modules/zod/src/v4/classic/schemas.ts +14 -30
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +1 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +2 -11
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -4
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +22 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +53 -137
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +70 -1
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +87 -35
- package/node_modules/zod/src/v4/core/api.ts +21 -29
- package/node_modules/zod/src/v4/core/checks.ts +61 -1
- package/node_modules/zod/src/v4/core/compile.ts +35 -24
- package/node_modules/zod/src/v4/core/core.ts +1 -3
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +9 -63
- package/node_modules/zod/src/v4/core/memoizer.ts +2 -5
- package/node_modules/zod/src/v4/core/regexes.ts +4 -0
- package/node_modules/zod/src/v4/core/schemas.ts +36 -109
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +35 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +177 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +118 -16
- package/node_modules/zod/src/v4/core/to-json-schema.ts +1 -1
- package/node_modules/zod/src/v4/core/util.ts +0 -4
- package/node_modules/zod/src/v4/core/versions.ts +1 -1
- package/node_modules/zod/src/v4/core/visit.ts +0 -11
- package/node_modules/zod/src/v4/locales/ar.ts +1 -0
- package/node_modules/zod/src/v4/locales/az.ts +1 -0
- package/node_modules/zod/src/v4/locales/be.ts +1 -0
- package/node_modules/zod/src/v4/locales/bg.ts +1 -0
- package/node_modules/zod/src/v4/locales/bn.ts +1 -0
- package/node_modules/zod/src/v4/locales/ca.ts +1 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +1 -0
- package/node_modules/zod/src/v4/locales/cs.ts +1 -0
- package/node_modules/zod/src/v4/locales/da.ts +1 -0
- package/node_modules/zod/src/v4/locales/de.ts +1 -0
- package/node_modules/zod/src/v4/locales/el.ts +1 -0
- package/node_modules/zod/src/v4/locales/en.ts +1 -0
- package/node_modules/zod/src/v4/locales/eo.ts +1 -0
- package/node_modules/zod/src/v4/locales/es.ts +1 -0
- package/node_modules/zod/src/v4/locales/fa.ts +1 -0
- package/node_modules/zod/src/v4/locales/fi.ts +1 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +1 -0
- package/node_modules/zod/src/v4/locales/fr.ts +1 -0
- package/node_modules/zod/src/v4/locales/gu.ts +1 -0
- package/node_modules/zod/src/v4/locales/he.ts +1 -0
- package/node_modules/zod/src/v4/locales/hi.ts +1 -0
- package/node_modules/zod/src/v4/locales/hr.ts +1 -0
- package/node_modules/zod/src/v4/locales/hu.ts +1 -0
- package/node_modules/zod/src/v4/locales/hy.ts +1 -0
- package/node_modules/zod/src/v4/locales/id.ts +1 -0
- package/node_modules/zod/src/v4/locales/is.ts +1 -0
- package/node_modules/zod/src/v4/locales/it.ts +1 -0
- package/node_modules/zod/src/v4/locales/ja.ts +1 -0
- package/node_modules/zod/src/v4/locales/ka.ts +1 -0
- package/node_modules/zod/src/v4/locales/km.ts +1 -0
- package/node_modules/zod/src/v4/locales/kn.ts +1 -0
- package/node_modules/zod/src/v4/locales/ko.ts +1 -0
- package/node_modules/zod/src/v4/locales/lt.ts +1 -0
- package/node_modules/zod/src/v4/locales/mk.ts +1 -0
- package/node_modules/zod/src/v4/locales/ms.ts +1 -0
- package/node_modules/zod/src/v4/locales/ne.ts +1 -0
- package/node_modules/zod/src/v4/locales/nl.ts +1 -0
- package/node_modules/zod/src/v4/locales/nn.ts +1 -0
- package/node_modules/zod/src/v4/locales/no.ts +1 -0
- package/node_modules/zod/src/v4/locales/ota.ts +1 -0
- package/node_modules/zod/src/v4/locales/pl.ts +1 -0
- package/node_modules/zod/src/v4/locales/ps.ts +1 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +1 -0
- package/node_modules/zod/src/v4/locales/pt.ts +1 -0
- package/node_modules/zod/src/v4/locales/ro.ts +1 -0
- package/node_modules/zod/src/v4/locales/ru.ts +1 -0
- package/node_modules/zod/src/v4/locales/sk.ts +1 -0
- package/node_modules/zod/src/v4/locales/sl.ts +1 -0
- package/node_modules/zod/src/v4/locales/sv.ts +1 -0
- package/node_modules/zod/src/v4/locales/ta.ts +1 -0
- package/node_modules/zod/src/v4/locales/tg.ts +1 -0
- package/node_modules/zod/src/v4/locales/th.ts +1 -0
- package/node_modules/zod/src/v4/locales/tk.ts +1 -0
- package/node_modules/zod/src/v4/locales/tr.ts +1 -0
- package/node_modules/zod/src/v4/locales/uk.ts +1 -0
- package/node_modules/zod/src/v4/locales/ur.ts +1 -0
- package/node_modules/zod/src/v4/locales/uz.ts +1 -0
- package/node_modules/zod/src/v4/locales/vi.ts +1 -0
- package/node_modules/zod/src/v4/locales/yo.ts +1 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +1 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +1 -0
- package/node_modules/zod/src/v4/mini/checks.ts +1 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +12 -23
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +56 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +7 -0
- package/node_modules/zod/v4/classic/checks.cjs +2 -1
- package/node_modules/zod/v4/classic/checks.d.cts +1 -1
- package/node_modules/zod/v4/classic/checks.d.ts +1 -1
- package/node_modules/zod/v4/classic/checks.js +1 -1
- package/node_modules/zod/v4/classic/schemas.cjs +11 -15
- package/node_modules/zod/v4/classic/schemas.d.cts +4 -6
- package/node_modules/zod/v4/classic/schemas.d.ts +4 -6
- package/node_modules/zod/v4/classic/schemas.js +9 -13
- package/node_modules/zod/v4/core/api.cjs +11 -23
- package/node_modules/zod/v4/core/api.d.cts +8 -4
- package/node_modules/zod/v4/core/api.d.ts +8 -4
- package/node_modules/zod/v4/core/api.js +11 -23
- package/node_modules/zod/v4/core/checks.cjs +32 -1
- package/node_modules/zod/v4/core/checks.d.cts +16 -0
- package/node_modules/zod/v4/core/checks.d.ts +16 -0
- package/node_modules/zod/v4/core/checks.js +31 -0
- package/node_modules/zod/v4/core/compile.cjs +12 -17
- package/node_modules/zod/v4/core/compile.js +13 -18
- package/node_modules/zod/v4/core/core.cjs +1 -1
- package/node_modules/zod/v4/core/core.js +1 -1
- package/node_modules/zod/v4/core/json-schema-processors.cjs +8 -44
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +0 -1
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +0 -1
- package/node_modules/zod/v4/core/json-schema-processors.js +8 -43
- package/node_modules/zod/v4/core/memoizer.cjs +2 -5
- package/node_modules/zod/v4/core/memoizer.js +2 -5
- package/node_modules/zod/v4/core/regexes.cjs +4 -2
- package/node_modules/zod/v4/core/regexes.d.cts +1 -0
- package/node_modules/zod/v4/core/regexes.d.ts +1 -0
- package/node_modules/zod/v4/core/regexes.js +2 -0
- package/node_modules/zod/v4/core/schemas.cjs +33 -73
- package/node_modules/zod/v4/core/schemas.d.cts +7 -22
- package/node_modules/zod/v4/core/schemas.d.ts +7 -22
- package/node_modules/zod/v4/core/schemas.js +30 -72
- package/node_modules/zod/v4/core/to-json-schema.cjs +0 -1
- package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -3
- package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -3
- package/node_modules/zod/v4/core/to-json-schema.js +1 -1
- package/node_modules/zod/v4/core/util.cjs +0 -4
- package/node_modules/zod/v4/core/util.js +0 -4
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/node_modules/zod/v4/core/visit.cjs +0 -12
- package/node_modules/zod/v4/core/visit.js +0 -12
- package/node_modules/zod/v4/locales/ar.cjs +1 -0
- package/node_modules/zod/v4/locales/ar.js +1 -0
- package/node_modules/zod/v4/locales/az.cjs +1 -0
- package/node_modules/zod/v4/locales/az.js +1 -0
- package/node_modules/zod/v4/locales/be.cjs +1 -0
- package/node_modules/zod/v4/locales/be.js +1 -0
- package/node_modules/zod/v4/locales/bg.cjs +1 -0
- package/node_modules/zod/v4/locales/bg.js +1 -0
- package/node_modules/zod/v4/locales/bn.cjs +1 -0
- package/node_modules/zod/v4/locales/bn.js +1 -0
- package/node_modules/zod/v4/locales/ca.cjs +1 -0
- package/node_modules/zod/v4/locales/ca.js +1 -0
- package/node_modules/zod/v4/locales/ckb.cjs +1 -0
- package/node_modules/zod/v4/locales/ckb.js +1 -0
- package/node_modules/zod/v4/locales/cs.cjs +1 -0
- package/node_modules/zod/v4/locales/cs.js +1 -0
- package/node_modules/zod/v4/locales/da.cjs +1 -0
- package/node_modules/zod/v4/locales/da.js +1 -0
- package/node_modules/zod/v4/locales/de.cjs +1 -0
- package/node_modules/zod/v4/locales/de.js +1 -0
- package/node_modules/zod/v4/locales/el.cjs +1 -0
- package/node_modules/zod/v4/locales/el.js +1 -0
- package/node_modules/zod/v4/locales/en.cjs +1 -0
- package/node_modules/zod/v4/locales/en.js +1 -0
- package/node_modules/zod/v4/locales/eo.cjs +1 -0
- package/node_modules/zod/v4/locales/eo.js +1 -0
- package/node_modules/zod/v4/locales/es.cjs +1 -0
- package/node_modules/zod/v4/locales/es.js +1 -0
- package/node_modules/zod/v4/locales/fa.cjs +1 -0
- package/node_modules/zod/v4/locales/fa.js +1 -0
- package/node_modules/zod/v4/locales/fi.cjs +1 -0
- package/node_modules/zod/v4/locales/fi.js +1 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +1 -0
- package/node_modules/zod/v4/locales/fr-CA.js +1 -0
- package/node_modules/zod/v4/locales/fr.cjs +1 -0
- package/node_modules/zod/v4/locales/fr.js +1 -0
- package/node_modules/zod/v4/locales/gu.cjs +1 -0
- package/node_modules/zod/v4/locales/gu.js +1 -0
- package/node_modules/zod/v4/locales/he.cjs +1 -0
- package/node_modules/zod/v4/locales/he.js +1 -0
- package/node_modules/zod/v4/locales/hi.cjs +1 -0
- package/node_modules/zod/v4/locales/hi.js +1 -0
- package/node_modules/zod/v4/locales/hr.cjs +1 -0
- package/node_modules/zod/v4/locales/hr.js +1 -0
- package/node_modules/zod/v4/locales/hu.cjs +1 -0
- package/node_modules/zod/v4/locales/hu.js +1 -0
- package/node_modules/zod/v4/locales/hy.cjs +1 -0
- package/node_modules/zod/v4/locales/hy.js +1 -0
- package/node_modules/zod/v4/locales/id.cjs +1 -0
- package/node_modules/zod/v4/locales/id.js +1 -0
- package/node_modules/zod/v4/locales/is.cjs +1 -0
- package/node_modules/zod/v4/locales/is.js +1 -0
- package/node_modules/zod/v4/locales/it.cjs +1 -0
- package/node_modules/zod/v4/locales/it.js +1 -0
- package/node_modules/zod/v4/locales/ja.cjs +1 -0
- package/node_modules/zod/v4/locales/ja.js +1 -0
- package/node_modules/zod/v4/locales/ka.cjs +1 -0
- package/node_modules/zod/v4/locales/ka.js +1 -0
- package/node_modules/zod/v4/locales/km.cjs +1 -0
- package/node_modules/zod/v4/locales/km.js +1 -0
- package/node_modules/zod/v4/locales/kn.cjs +1 -0
- package/node_modules/zod/v4/locales/kn.js +1 -0
- package/node_modules/zod/v4/locales/ko.cjs +1 -0
- package/node_modules/zod/v4/locales/ko.js +1 -0
- package/node_modules/zod/v4/locales/lt.cjs +1 -0
- package/node_modules/zod/v4/locales/lt.js +1 -0
- package/node_modules/zod/v4/locales/mk.cjs +1 -0
- package/node_modules/zod/v4/locales/mk.js +1 -0
- package/node_modules/zod/v4/locales/ms.cjs +1 -0
- package/node_modules/zod/v4/locales/ms.js +1 -0
- package/node_modules/zod/v4/locales/ne.cjs +1 -0
- package/node_modules/zod/v4/locales/ne.js +1 -0
- package/node_modules/zod/v4/locales/nl.cjs +1 -0
- package/node_modules/zod/v4/locales/nl.js +1 -0
- package/node_modules/zod/v4/locales/nn.cjs +1 -0
- package/node_modules/zod/v4/locales/nn.js +1 -0
- package/node_modules/zod/v4/locales/no.cjs +1 -0
- package/node_modules/zod/v4/locales/no.js +1 -0
- package/node_modules/zod/v4/locales/ota.cjs +1 -0
- package/node_modules/zod/v4/locales/ota.js +1 -0
- package/node_modules/zod/v4/locales/pl.cjs +1 -0
- package/node_modules/zod/v4/locales/pl.js +1 -0
- package/node_modules/zod/v4/locales/ps.cjs +1 -0
- package/node_modules/zod/v4/locales/ps.js +1 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +1 -0
- package/node_modules/zod/v4/locales/pt-BR.js +1 -0
- package/node_modules/zod/v4/locales/pt.cjs +1 -0
- package/node_modules/zod/v4/locales/pt.js +1 -0
- package/node_modules/zod/v4/locales/ro.cjs +1 -0
- package/node_modules/zod/v4/locales/ro.js +1 -0
- package/node_modules/zod/v4/locales/ru.cjs +1 -0
- package/node_modules/zod/v4/locales/ru.js +1 -0
- package/node_modules/zod/v4/locales/sk.cjs +1 -0
- package/node_modules/zod/v4/locales/sk.js +1 -0
- package/node_modules/zod/v4/locales/sl.cjs +1 -0
- package/node_modules/zod/v4/locales/sl.js +1 -0
- package/node_modules/zod/v4/locales/sv.cjs +1 -0
- package/node_modules/zod/v4/locales/sv.js +1 -0
- package/node_modules/zod/v4/locales/ta.cjs +1 -0
- package/node_modules/zod/v4/locales/ta.js +1 -0
- package/node_modules/zod/v4/locales/tg.cjs +1 -0
- package/node_modules/zod/v4/locales/tg.js +1 -0
- package/node_modules/zod/v4/locales/th.cjs +1 -0
- package/node_modules/zod/v4/locales/th.js +1 -0
- package/node_modules/zod/v4/locales/tk.cjs +1 -0
- package/node_modules/zod/v4/locales/tk.js +1 -0
- package/node_modules/zod/v4/locales/tr.cjs +1 -0
- package/node_modules/zod/v4/locales/tr.js +1 -0
- package/node_modules/zod/v4/locales/uk.cjs +1 -0
- package/node_modules/zod/v4/locales/uk.js +1 -0
- package/node_modules/zod/v4/locales/ur.cjs +1 -0
- package/node_modules/zod/v4/locales/ur.js +1 -0
- package/node_modules/zod/v4/locales/uz.cjs +1 -0
- package/node_modules/zod/v4/locales/uz.js +1 -0
- package/node_modules/zod/v4/locales/vi.cjs +1 -0
- package/node_modules/zod/v4/locales/vi.js +1 -0
- package/node_modules/zod/v4/locales/yo.cjs +1 -0
- package/node_modules/zod/v4/locales/yo.js +1 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +1 -0
- package/node_modules/zod/v4/locales/zh-CN.js +1 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +1 -0
- package/node_modules/zod/v4/locales/zh-TW.js +1 -0
- package/node_modules/zod/v4/mini/checks.cjs +2 -1
- package/node_modules/zod/v4/mini/checks.d.cts +1 -1
- package/node_modules/zod/v4/mini/checks.d.ts +1 -1
- package/node_modules/zod/v4/mini/checks.js +1 -1
- package/node_modules/zod/v4/mini/schemas.cjs +11 -13
- package/node_modules/zod/v4/mini/schemas.d.cts +1 -4
- package/node_modules/zod/v4/mini/schemas.d.ts +1 -4
- package/node_modules/zod/v4/mini/schemas.js +9 -11
- package/package.json +2 -2
- package/slingshot/index.js +183 -182
- package/node_modules/@types/node/compatibility/disposable.d.ts +0 -14
- package/node_modules/@types/node/compatibility/index.d.ts +0 -9
- package/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
- package/node_modules/@types/node/compatibility/iterators.d.ts +0 -20
- package/node_modules/undici-types/file.d.ts +0 -39
- package/node_modules/undici-types/filereader.d.ts +0 -54
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
import { expect, expectTypeOf, test } from "vitest";
|
|
2
2
|
import * as z from "zod/v4";
|
|
3
3
|
|
|
4
|
-
test("z.properties is a
|
|
5
|
-
const
|
|
4
|
+
test("z.properties is a check", () => {
|
|
5
|
+
const s = z.object({ a: z.string(), b: z.string() }).check(z.properties({ a: z.literal("x"), b: z.literal("y") }));
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// asserts in place: extra keys pass, and every failing key reports
|
|
8
|
+
expect(s.safeParse({ a: "x", b: "y", extra: 1 }).success).toBe(true);
|
|
9
|
+
expect(s.safeParse({ a: "!", b: "!" }).error!.issues.map((i) => i.path)).toEqual([["a"], ["b"]]);
|
|
8
10
|
|
|
9
|
-
//
|
|
10
|
-
const
|
|
11
|
-
expect(p.parse(ok)).toBe(ok);
|
|
12
|
-
|
|
13
|
-
// every failing key reports
|
|
14
|
-
expect(p.safeParse({ a: "!", b: "!" }).error!.issues.map((i) => i.path)).toEqual([["a"], ["b"]]);
|
|
15
|
-
|
|
16
|
-
// as a schema it is the type gate and infers an object shape, so a primitive is a type error
|
|
17
|
-
for (const input of [null, undefined, 5, "abc"]) {
|
|
18
|
-
expect(p.safeParse(input).error!.issues.map((i) => [i.code, i.path])).toEqual([["invalid_type", []]]);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// as a check the base already typed the value, so the properties are asserted on whatever it produced — a string's length, as z.property() does
|
|
22
|
-
const long = z.string().check(...z.properties({ length: z.number().min(3) }));
|
|
11
|
+
// the base already typed the value, so the properties are asserted on whatever it produced — a string's length, as z.property() does
|
|
12
|
+
const long = z.string().check(z.properties({ length: z.number().min(3) }));
|
|
23
13
|
expect(long.parse("abc")).toBe("abc");
|
|
24
14
|
expect(long.safeParse("ab").error!.issues.map((i) => i.path)).toEqual([["length"]]);
|
|
25
15
|
expect(
|
|
@@ -29,29 +19,19 @@ test("z.properties is a schema", () => {
|
|
|
29
19
|
.error!.issues.map((i) => i.path)
|
|
30
20
|
).toEqual([["length"]]);
|
|
31
21
|
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
expectTypeOf<z.infer<typeof opt>>().toEqualTypeOf<{ a?: string | undefined }>();
|
|
22
|
+
// not a schema
|
|
23
|
+
// @ts-expect-error a check has no parse of its own
|
|
24
|
+
z.properties({ a: z.string() }).parse;
|
|
36
25
|
});
|
|
37
26
|
|
|
38
27
|
test("z.properties discards transformed output", () => {
|
|
39
28
|
// asserts and never writes back, exactly as z.property() behaves; a nested object schema rebuilds its output even without transforms, so identity cannot distinguish the two
|
|
40
|
-
const
|
|
29
|
+
const s = z.any().check(z.properties({ a: z.string().transform((s) => s.toUpperCase()) }));
|
|
41
30
|
const input = { a: "hi" };
|
|
42
|
-
expect(
|
|
31
|
+
expect(s.parse(input)).toBe(input);
|
|
43
32
|
expect(input.a).toBe("hi");
|
|
44
33
|
});
|
|
45
34
|
|
|
46
|
-
test("z.properties narrows through intersection", () => {
|
|
47
|
-
const httpsUrl = z.instanceof(URL).and(z.properties({ protocol: z.literal("https:") }));
|
|
48
|
-
expectTypeOf<z.infer<typeof httpsUrl>>().toEqualTypeOf<URL & { protocol: "https:" }>();
|
|
49
|
-
|
|
50
|
-
const u = new URL("https://example.com");
|
|
51
|
-
expect(httpsUrl.parse(u)).toBe(u);
|
|
52
|
-
expect(httpsUrl.safeParse(new URL("http://example.com")).success).toBe(false);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
35
|
test("z.instanceof().properties()", () => {
|
|
56
36
|
const httpsUrl = z.instanceof(URL).properties({ protocol: z.literal("https:") });
|
|
57
37
|
expectTypeOf<z.infer<typeof httpsUrl>>().toEqualTypeOf<URL & { protocol: "https:" }>();
|
|
@@ -65,38 +45,42 @@ test("z.instanceof().properties()", () => {
|
|
|
65
45
|
expectTypeOf<z.infer<typeof chained>>().toEqualTypeOf<URL & { protocol: "https:" } & { port: "" }>();
|
|
66
46
|
expect(chained.safeParse(u).success).toBe(true);
|
|
67
47
|
expect(chained.safeParse(new URL("https://example.com:8443")).error!.issues.map((i) => i.path)).toEqual([["port"]]);
|
|
48
|
+
|
|
49
|
+
// nothing is written back, so the narrowing is over the shape's input side
|
|
50
|
+
const W = z.instanceof(URL).properties({ search: z.string().transform((s) => s.length) });
|
|
51
|
+
expectTypeOf<z.infer<typeof W>>().toEqualTypeOf<URL & { search: string }>();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("z.instanceof().properties() constrains the shape to the instance type", () => {
|
|
55
|
+
const file = z.instanceof(File).properties({ name: z.string(), size: z.number().max(1024) });
|
|
56
|
+
expectTypeOf<z.infer<typeof file>>().toEqualTypeOf<File & { name: string; size: number }>();
|
|
57
|
+
|
|
58
|
+
// @ts-expect-error no such property on File
|
|
59
|
+
z.instanceof(File).properties({ nmae: z.string() });
|
|
60
|
+
|
|
61
|
+
// @ts-expect-error File["size"] is a number
|
|
62
|
+
z.instanceof(File).properties({ size: z.string() });
|
|
63
|
+
|
|
64
|
+
// methods are out of the shape, so an object literal's inherited toString can't collide with the constraint
|
|
65
|
+
// @ts-expect-error
|
|
66
|
+
z.instanceof(File).properties({ text: z.any() });
|
|
67
|
+
|
|
68
|
+
// a literal still narrows a wider property
|
|
69
|
+
const png = z.instanceof(File).properties({ type: z.literal("image/png") });
|
|
70
|
+
expectTypeOf<z.infer<typeof png>>().toEqualTypeOf<File & { type: "image/png" }>();
|
|
68
71
|
});
|
|
69
72
|
|
|
70
73
|
test("z.properties spreads into .check()", () => {
|
|
71
|
-
// the
|
|
74
|
+
// the 4.5 array call sites: the check yields itself from Symbol.iterator
|
|
72
75
|
const p = z.properties({ a: z.literal("x") });
|
|
73
|
-
|
|
74
|
-
expect(spread).toEqual([p]);
|
|
76
|
+
expect([...p]).toEqual([p]);
|
|
75
77
|
|
|
76
78
|
const s = z.object({ a: z.string() }).check(...z.properties({ a: z.literal("x") }));
|
|
77
79
|
expect(s.safeParse({ a: "x" }).success).toBe(true);
|
|
78
80
|
expect(s.safeParse({ a: "!" }).error!.issues.map((i) => i.path)).toEqual([["a"]]);
|
|
79
81
|
});
|
|
80
82
|
|
|
81
|
-
test("z.properties
|
|
82
|
-
const p = z.properties({ a: z.string(), b: z.number().optional() });
|
|
83
|
-
expect(z.toJSONSchema(p)).toEqual({
|
|
84
|
-
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
85
|
-
type: "object",
|
|
86
|
-
properties: { a: { type: "string" }, b: { type: "number" } },
|
|
87
|
-
required: ["a"],
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test("z.properties compiles", () => {
|
|
92
|
-
const p = z.properties({ a: z.literal("x"), b: z.literal("y") });
|
|
93
|
-
const compiled = z.compile(p);
|
|
94
|
-
const ok = { a: "x", b: "y", extra: 1 };
|
|
95
|
-
expect(compiled.parse(ok)).toBe(ok);
|
|
96
|
-
expect(compiled.safeParse({ a: "!", b: "!" }).error!.issues.map((i) => i.path)).toEqual([["a"], ["b"]]);
|
|
97
|
-
expect(compiled.safeParse(null).error!.issues.map((i) => [i.code, i.path])).toEqual([["invalid_type", []]]);
|
|
98
|
-
|
|
99
|
-
// nested in a container
|
|
83
|
+
test("z.properties compiles inside a container", () => {
|
|
100
84
|
const outer = z.compile(z.object({ url: z.instanceof(URL).properties({ protocol: z.literal("https:") }) }));
|
|
101
85
|
expect(outer.safeParse({ url: new URL("http://example.com") }).error!.issues.map((i) => i.path)).toEqual([
|
|
102
86
|
["url", "protocol"],
|
|
@@ -104,43 +88,28 @@ test("z.properties compiles", () => {
|
|
|
104
88
|
});
|
|
105
89
|
|
|
106
90
|
test("z.properties async", async () => {
|
|
107
|
-
const
|
|
91
|
+
const s = z.any().check(z.properties({ a: z.string().refine(async (s) => s.length > 1) }));
|
|
108
92
|
const ok = { a: "hi" };
|
|
109
|
-
await expect(
|
|
110
|
-
const bad = await
|
|
93
|
+
await expect(s.parseAsync(ok)).resolves.toBe(ok);
|
|
94
|
+
const bad = await s.safeParseAsync({ a: "!" });
|
|
111
95
|
expect(bad.error!.issues.map((i) => i.path)).toEqual([["a"]]);
|
|
112
96
|
});
|
|
113
97
|
|
|
114
|
-
test("z.properties infers the input side", () => {
|
|
115
|
-
// nothing is written back, so an output-typed inference would lie for every shape entry whose output differs from its input
|
|
116
|
-
const withDefault = z.properties({ a: z.string().default("x") });
|
|
117
|
-
expectTypeOf<z.infer<typeof withDefault>>().toEqualTypeOf<{ a?: string | undefined }>();
|
|
118
|
-
expect(withDefault.parse({})).toEqual({});
|
|
119
|
-
|
|
120
|
-
const withTransform = z.properties({ a: z.string().transform((s) => s.length) });
|
|
121
|
-
expectTypeOf<z.infer<typeof withTransform>>().toEqualTypeOf<{ a: string }>();
|
|
122
|
-
expect(withTransform.parse({ a: "hi" })).toEqual({ a: "hi" });
|
|
123
|
-
|
|
124
|
-
// a plain schema has the same input and output, so the documented narrowing is unchanged
|
|
125
|
-
const W = z.instanceof(URL).properties({ protocol: z.literal("https:") });
|
|
126
|
-
expectTypeOf<z.infer<typeof W>>().toEqualTypeOf<URL & { protocol: "https:" }>();
|
|
127
|
-
});
|
|
128
|
-
|
|
129
98
|
test("z.properties validates symbol keys", () => {
|
|
130
99
|
const sym = Symbol("tag");
|
|
131
|
-
const
|
|
132
|
-
expect(
|
|
133
|
-
expect(
|
|
100
|
+
const s = z.any().check(z.properties({ [sym]: z.string() }));
|
|
101
|
+
expect(s.safeParse({ [sym]: "ok" }).success).toBe(true);
|
|
102
|
+
expect(s.safeParse({ [sym]: 123 }).error!.issues.map((i) => i.path)).toEqual([[sym]]);
|
|
134
103
|
expect(
|
|
135
104
|
z
|
|
136
|
-
.compile(
|
|
105
|
+
.compile(s)
|
|
137
106
|
.safeParse({ [sym]: 123 })
|
|
138
107
|
.error!.issues.map((i) => i.path)
|
|
139
108
|
).toEqual([[sym]]);
|
|
140
109
|
});
|
|
141
110
|
|
|
142
111
|
test("z.properties compiled and interpreted agree on a nullish value", () => {
|
|
143
|
-
// a base that permits null reaches the check
|
|
112
|
+
// a base that permits null reaches the check with one; the compiled property read must not throw where the runtime reports an issue
|
|
144
113
|
const s = z.any().check(...z.properties({ a: z.string() }));
|
|
145
114
|
const expected = [["invalid_type", []]];
|
|
146
115
|
expect(s.safeParse(null).error!.issues.map((i) => [i.code, i.path])).toEqual(expected);
|
|
@@ -153,73 +122,20 @@ test("z.properties compiled and interpreted agree on a nullish value", () => {
|
|
|
153
122
|
});
|
|
154
123
|
|
|
155
124
|
test("z.properties with a custom when refuses to compile", () => {
|
|
156
|
-
// `when` is not publicly settable, since it gates
|
|
157
|
-
const p = new z.core.$
|
|
158
|
-
|
|
159
|
-
check: "properties",
|
|
160
|
-
shape: { a: z.literal("x") },
|
|
161
|
-
when: () => false,
|
|
162
|
-
});
|
|
163
|
-
const s = z.union([p as unknown as z.ZodType, z.object({ b: z.string() })]);
|
|
125
|
+
// `when` is not publicly settable, since it gates the assertion inside the run loop. A hand-built def can still carry one, and compiling it must refuse rather than run the shape unconditionally: a union branch compiles to its own IIFE, so a wrong rejection is absorbed as a branch failure with no fallback.
|
|
126
|
+
const p = new z.core.$ZodCheckProperties({ check: "properties", shape: { a: z.literal("x") }, when: () => false });
|
|
127
|
+
const s = z.union([z.any().check(p), z.object({ b: z.string() })]);
|
|
164
128
|
const input = { a: "wrong", b: "hello" };
|
|
165
129
|
expect(z.compile(s).safeParse(input)).toEqual(s.safeParse(input));
|
|
166
130
|
});
|
|
167
131
|
|
|
168
|
-
test("z.properties parses cyclic input", () => {
|
|
169
|
-
// the input is its own output, so it registers as its own memo entry; without that a cycle re-enters forever
|
|
170
|
-
const Node: z.ZodType<{ id: string; next?: unknown }> = z.lazy(() =>
|
|
171
|
-
z.properties({ id: z.string(), next: Node.optional() })
|
|
172
|
-
);
|
|
173
|
-
const cyclic: Record<string, unknown> = { id: "a" };
|
|
174
|
-
cyclic.next = cyclic;
|
|
175
|
-
expect(Node.parse(cyclic)).toBe(cyclic);
|
|
176
|
-
expect(z.compile(Node).parse(cyclic)).toBe(cyclic);
|
|
177
|
-
|
|
178
|
-
// the cycle guard must not swallow a real failure further down
|
|
179
|
-
expect(Node.safeParse({ id: "a", next: { id: 1 } }).error!.issues.map((i) => i.path)).toEqual([["next", "id"]]);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
test("z.properties asserts forward while encoding", () => {
|
|
183
|
-
// both sides declare the shape's input type, so encoding must still check the value against it; running the children backward would encode them and reject that type
|
|
184
|
-
const codec = z.codec(z.string(), z.number(), { decode: (s) => Number(s), encode: (n) => String(n) });
|
|
185
|
-
const p = z.properties({ a: codec, b: z.string().transform((s) => s.length) });
|
|
186
|
-
const value = { a: "1", b: "hi" };
|
|
187
|
-
expect(z.decode(p, value)).toBe(value);
|
|
188
|
-
expect(z.encode(p, value)).toBe(value);
|
|
189
|
-
expect(z.safeEncode(p, { a: 1, b: "hi" } as never).error!.issues.map((i) => i.path)).toEqual([["a"]]);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
test("z.properties parses a cyclic callable", () => {
|
|
193
|
-
// property reads work on a function too, so the cycle guard has to recognize one as a reference
|
|
194
|
-
const Fn: z.ZodType<{ self?: unknown }> = z.lazy(() => z.properties({ self: Fn.optional() }));
|
|
195
|
-
const fn = (() => {}) as unknown as Record<string, unknown>;
|
|
196
|
-
fn.self = fn;
|
|
197
|
-
expect(Fn.parse(fn)).toBe(fn);
|
|
198
|
-
});
|
|
199
|
-
|
|
200
132
|
test("z.properties survives shape mutation", () => {
|
|
201
133
|
// key and schema are snapshotted together; caching one and reading the other live paired a stale key with a missing schema
|
|
202
134
|
const shape: Record<string, z.ZodType> = { a: z.string() };
|
|
203
|
-
const
|
|
204
|
-
expect(
|
|
135
|
+
const s = z.any().check(z.properties(shape));
|
|
136
|
+
expect(s.safeParse({ a: "x" }).success).toBe(true);
|
|
205
137
|
delete shape.a;
|
|
206
|
-
expect(
|
|
138
|
+
expect(s.safeParse({ a: "x" }).success).toBe(true);
|
|
207
139
|
shape.b = z.string();
|
|
208
|
-
expect(
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
test("z.properties JSON Schema describes the input side", () => {
|
|
212
|
-
// the parsed value is the input, so a defaulted key that stays absent must not be required of the output either
|
|
213
|
-
const p = z.properties({ a: z.string().default("x") });
|
|
214
|
-
expect(p.parse({})).toEqual({});
|
|
215
|
-
expect(z.toJSONSchema(p, { io: "output" })).toEqual({
|
|
216
|
-
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
217
|
-
type: "object",
|
|
218
|
-
properties: { a: { default: "x", type: "string" } },
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
// an output mode emission for a transforming child would describe a value this schema never returns
|
|
222
|
-
const t = z.properties({ a: z.string().transform((s) => s.length) });
|
|
223
|
-
expect(() => z.toJSONSchema(t, { io: "output" })).toThrow(/cannot be represented/);
|
|
224
|
-
expect(z.toJSONSchema(t, { io: "input" })).toMatchObject({ properties: { a: { type: "string" } }, required: ["a"] });
|
|
140
|
+
expect(s.safeParse({ a: "x" }).success).toBe(true);
|
|
225
141
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
|
-
import { expect, test } from "vitest";
|
|
2
|
+
import { expect, expectTypeOf, test } from "vitest";
|
|
3
3
|
|
|
4
4
|
import * as z from "zod/v4";
|
|
5
5
|
|
|
@@ -12,6 +12,63 @@ const includesFromIndex2 = z.string().includes("includes", { position: 2 });
|
|
|
12
12
|
const startsWith = z.string().startsWith("startsWith");
|
|
13
13
|
const endsWith = z.string().endsWith("endsWith");
|
|
14
14
|
|
|
15
|
+
test("string factory checks", async () => {
|
|
16
|
+
const schema = z.string({ checks: [z.minLength(1), z.maxLength(3)] as const });
|
|
17
|
+
const chained = z.string().min(1).max(3);
|
|
18
|
+
expectTypeOf<z.output<typeof schema>>().toEqualTypeOf<string>();
|
|
19
|
+
for (const value of ["", "ab", "abcd", 1, undefined]) {
|
|
20
|
+
expect(z.validate(schema, value)).toBe(z.validate(chained, value));
|
|
21
|
+
expect(schema.safeParse(value)).toEqual(chained.safeParse(value));
|
|
22
|
+
}
|
|
23
|
+
expect(z.toJSONSchema(schema)).toEqual(z.toJSONSchema(chained));
|
|
24
|
+
expect(schema.minLength).toBe(1);
|
|
25
|
+
expect(schema.maxLength).toBe(3);
|
|
26
|
+
expect(schema._zod.parent).toBeUndefined();
|
|
27
|
+
expect([...schema._zod.traits]).toEqual([...chained._zod.traits]);
|
|
28
|
+
const extended = schema.max(2);
|
|
29
|
+
expect(extended._zod.parent).toBe(schema);
|
|
30
|
+
expect(z.validate(schema, "abc")).toBe(true);
|
|
31
|
+
expect(z.validate(extended, "abc")).toBe(false);
|
|
32
|
+
const coerce = z.coerce.string({ checks: [z.minLength(2)] });
|
|
33
|
+
expect(coerce.parse(12)).toBe("12");
|
|
34
|
+
expect(z.validate(coerce, 1)).toBe(false);
|
|
35
|
+
const asyncSchema = z.string({
|
|
36
|
+
checks: [
|
|
37
|
+
z.check<string>(async (ctx) => {
|
|
38
|
+
if (ctx.value !== "ok") ctx.issues.push({ code: "custom", input: ctx.value });
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
41
|
+
});
|
|
42
|
+
expect(await asyncSchema.safeParseAsync("ok")).toEqual({ success: true, data: "ok" });
|
|
43
|
+
expect((await asyncSchema.safeParseAsync("bad")).success).toBe(false);
|
|
44
|
+
// @ts-expect-error numeric checks cannot validate strings
|
|
45
|
+
z.string({ checks: [z.gte(1)] });
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("factory checks snapshot caller arrays", () => {
|
|
49
|
+
for (const factory of [z.string, z.coerce.string]) {
|
|
50
|
+
for (const initial of [[], [z.minLength(1)]]) {
|
|
51
|
+
const schema = factory({ checks: initial });
|
|
52
|
+
let reads = 0;
|
|
53
|
+
const getterSchema = factory({
|
|
54
|
+
get checks() {
|
|
55
|
+
if (++reads > 1) throw new Error("checks read twice");
|
|
56
|
+
return initial;
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
expect(reads).toBe(1);
|
|
60
|
+
expect(z.validate(getterSchema, "long")).toBe(true);
|
|
61
|
+
const before = z.toJSONSchema(schema);
|
|
62
|
+
initial.push(z.minLength(10));
|
|
63
|
+
expect(schema._zod.def.checks).not.toBe(initial);
|
|
64
|
+
expect(z.validate(schema, "long")).toBe(true);
|
|
65
|
+
expect(z.validate(z.compile(schema), "long")).toBe(true);
|
|
66
|
+
expect(z.toJSONSchema(schema)).toEqual(before);
|
|
67
|
+
expect(z.validate(schema.check(z.minLength(2)), "long")).toBe(true);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
15
72
|
test("length checks", () => {
|
|
16
73
|
minFive.parse("12345");
|
|
17
74
|
minFive.parse("123456");
|
|
@@ -1289,6 +1346,18 @@ test("hostname", () => {
|
|
|
1289
1346
|
expect(() => hostname.parse("example..com")).toThrow();
|
|
1290
1347
|
});
|
|
1291
1348
|
|
|
1349
|
+
test("currency code", () => {
|
|
1350
|
+
const currency = z.currencyCode();
|
|
1351
|
+
for (const code of ["USD", "EUR", "XXX", "XCG", "XAD"]) expect(currency.parse(code)).toBe(code);
|
|
1352
|
+
for (const input of ["", "usd", "US", "USDX", " USD", "ANG", "BGN"])
|
|
1353
|
+
expect(currency.safeParse(input).success).toBe(false);
|
|
1354
|
+
expect(currency.safeParse("usd").error!.issues[0]).toMatchObject({
|
|
1355
|
+
code: "invalid_format",
|
|
1356
|
+
format: "currency_code",
|
|
1357
|
+
message: "Invalid currency code",
|
|
1358
|
+
});
|
|
1359
|
+
});
|
|
1360
|
+
|
|
1292
1361
|
test("hash validation", () => {
|
|
1293
1362
|
// MD5 tests
|
|
1294
1363
|
const md5hex = z.hash("md5");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Validator } from "@seriousme/openapi-schema-validator";
|
|
2
|
-
import { describe, expect, test } from "vitest";
|
|
2
|
+
import { describe, expect, test, vi } from "vitest";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
// import * as zCore from "zod/v4/core";
|
|
5
5
|
|
|
@@ -3235,11 +3235,31 @@ test("basic registry", () => {
|
|
|
3235
3235
|
`);
|
|
3236
3236
|
});
|
|
3237
3237
|
|
|
3238
|
-
|
|
3239
|
-
const
|
|
3240
|
-
const
|
|
3238
|
+
function countMapScanWork<T>(convert: () => T): { result: T; work: number } {
|
|
3239
|
+
const entries = Map.prototype.entries;
|
|
3240
|
+
const values = Map.prototype.values;
|
|
3241
|
+
let work = 0;
|
|
3242
|
+
const entriesSpy = vi.spyOn(Map.prototype, "entries").mockImplementation(function (this: Map<unknown, unknown>) {
|
|
3243
|
+
work += this.size;
|
|
3244
|
+
return entries.call(this);
|
|
3245
|
+
} as typeof Map.prototype.entries);
|
|
3246
|
+
const valuesSpy = vi.spyOn(Map.prototype, "values").mockImplementation(function (this: Map<unknown, unknown>) {
|
|
3247
|
+
work += this.size;
|
|
3248
|
+
return values.call(this);
|
|
3249
|
+
} as typeof Map.prototype.values);
|
|
3250
|
+
try {
|
|
3251
|
+
return { result: convert(), work };
|
|
3252
|
+
} finally {
|
|
3253
|
+
entriesSpy.mockRestore();
|
|
3254
|
+
valuesSpy.mockRestore();
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
|
|
3258
|
+
test("large registry conversion performs linear map-scan work", () => {
|
|
3259
|
+
const count = 64;
|
|
3260
|
+
const convert = (size: number, withIntersection: boolean) => {
|
|
3241
3261
|
const registry = z.registry<{ id: string }>();
|
|
3242
|
-
for (let i = 0; i <
|
|
3262
|
+
for (let i = 0; i < size; i++) {
|
|
3243
3263
|
registry.add(
|
|
3244
3264
|
z.object({ id: z.string(), name: z.string(), count: z.number(), nested: z.object({ a: z.boolean() }) }),
|
|
3245
3265
|
{ id: `Type${i}` }
|
|
@@ -3247,55 +3267,53 @@ test("large registry converts in linear time", () => {
|
|
|
3247
3267
|
}
|
|
3248
3268
|
if (withIntersection) registry.add(z.object({ a: z.string() }).and(z.object({ b: z.string() })), { id: "Inter" });
|
|
3249
3269
|
|
|
3250
|
-
|
|
3251
|
-
const { schemas } = z.toJSONSchema(registry, { uri: (id) => `https://example.com/${id}.json` });
|
|
3252
|
-
return { schemas, elapsed: performance.now() - start };
|
|
3270
|
+
return countMapScanWork(() => z.toJSONSchema(registry, { uri: (id) => `https://example.com/${id}.json` }));
|
|
3253
3271
|
};
|
|
3254
3272
|
|
|
3255
|
-
const plain = convert(false);
|
|
3256
|
-
|
|
3257
|
-
expect(plain.schemas
|
|
3273
|
+
const plain = convert(count, false);
|
|
3274
|
+
const plainDouble = convert(count * 2, false);
|
|
3275
|
+
expect(Object.keys(plain.result.schemas)).toHaveLength(count);
|
|
3276
|
+
expect(plain.result.schemas.Type0).toMatchObject({
|
|
3258
3277
|
$id: "https://example.com/Type0.json",
|
|
3259
3278
|
type: "object",
|
|
3260
3279
|
properties: { nested: { type: "object" } },
|
|
3261
3280
|
});
|
|
3262
|
-
expect(plain.schemas[`Type${count - 1}`]!.$id).toBe(`https://example.com/Type${count - 1}.json`);
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
expect(plain.elapsed).toBeLessThan(5000);
|
|
3281
|
+
expect(plain.result.schemas[`Type${count - 1}`]!.$id).toBe(`https://example.com/Type${count - 1}.json`);
|
|
3282
|
+
expect(plain.work).toBeGreaterThan(0);
|
|
3283
|
+
expect(plainDouble.work).toBeLessThanOrEqual(plain.work * 2);
|
|
3266
3284
|
|
|
3267
|
-
|
|
3268
|
-
const
|
|
3269
|
-
expect(folded.schemas.Inter).toMatchObject({ type: "object", properties: { a: {}, b: {} } });
|
|
3270
|
-
expect(folded.
|
|
3285
|
+
const folded = convert(count, true);
|
|
3286
|
+
const foldedDouble = convert(count * 2, true);
|
|
3287
|
+
expect(folded.result.schemas.Inter).toMatchObject({ type: "object", properties: { a: {}, b: {} } });
|
|
3288
|
+
expect(folded.work).toBeGreaterThan(0);
|
|
3289
|
+
expect(foldedDouble.work).toBeLessThanOrEqual(folded.work * 2);
|
|
3271
3290
|
});
|
|
3272
3291
|
|
|
3273
|
-
test("a registry of records with numeric keys
|
|
3274
|
-
const count =
|
|
3275
|
-
const convert = (key: (i: number) => z.core.$ZodType) => {
|
|
3292
|
+
test("a registry of records with numeric keys performs linear map-scan work", () => {
|
|
3293
|
+
const count = 64;
|
|
3294
|
+
const convert = (size: number, key: (i: number) => z.core.$ZodType) => {
|
|
3276
3295
|
const registry = z.registry<{ id: string }>();
|
|
3277
|
-
for (let i = 0; i <
|
|
3296
|
+
for (let i = 0; i < size; i++) {
|
|
3278
3297
|
registry.add(z.object({ m: z.record(key(i) as z.core.$ZodRecordKey, z.boolean()) }), { id: `Type${i}` });
|
|
3279
3298
|
}
|
|
3280
|
-
|
|
3281
|
-
const { schemas } = z.toJSONSchema(registry, { uri: (id) => `https://example.com/${id}.json` });
|
|
3282
|
-
return { schemas, elapsed: performance.now() - start };
|
|
3299
|
+
return countMapScanWork(() => z.toJSONSchema(registry, { uri: (id) => `https://example.com/${id}.json` }));
|
|
3283
3300
|
};
|
|
3284
3301
|
|
|
3285
|
-
const
|
|
3286
|
-
const
|
|
3287
|
-
expect(numeric.schemas.Type0).toMatchObject({
|
|
3302
|
+
const numeric = convert(count, () => z.number());
|
|
3303
|
+
const numericDouble = convert(count * 2, () => z.number());
|
|
3304
|
+
expect(numeric.result.schemas.Type0).toMatchObject({
|
|
3288
3305
|
properties: { m: { propertyNames: { type: "string", pattern: "^-?\\d+(?:\\.\\d+)?$" } } },
|
|
3289
3306
|
});
|
|
3307
|
+
expect(numeric.work).toBeGreaterThan(0);
|
|
3308
|
+
expect(numericDouble.work).toBeLessThanOrEqual(numeric.work * 2);
|
|
3290
3309
|
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
// An extracted key resolves through a map built once per conversion rather than a search per reference. There is no stable timing control for that — extraction has its own $defs cost, which swamps the difference — so this only pins the shape.
|
|
3295
|
-
const extracted = convert((i) => z.number().meta({ id: `Key${i}` }));
|
|
3296
|
-
expect(extracted.schemas.Type0).toMatchObject({
|
|
3310
|
+
const extracted = convert(count, (i) => z.number().meta({ id: `Key${i}` }));
|
|
3311
|
+
const extractedDouble = convert(count * 2, (i) => z.number().meta({ id: `Key${i}` }));
|
|
3312
|
+
expect(extracted.result.schemas.Type0).toMatchObject({
|
|
3297
3313
|
properties: { m: { propertyNames: { type: "string", pattern: "^-?\\d+(?:\\.\\d+)?$" } } },
|
|
3298
3314
|
});
|
|
3315
|
+
expect(extracted.work).toBeGreaterThan(0);
|
|
3316
|
+
expect(extractedDouble.work).toBeLessThanOrEqual(extracted.work * 2);
|
|
3299
3317
|
});
|
|
3300
3318
|
|
|
3301
3319
|
test("registry extracts unregistered subschemas into __shared", () => {
|
|
@@ -3849,6 +3867,31 @@ test("input JSON schema resolves requiredness past transform and catch wrappers"
|
|
|
3849
3867
|
expect(required(z.object({ a: z.transform((v: unknown) => String(v)).pipe(z.string()) }))).toEqual(["a"]);
|
|
3850
3868
|
});
|
|
3851
3869
|
|
|
3870
|
+
test("object required keys preserve shape order and direction", () => {
|
|
3871
|
+
const symbol = Symbol("symbol");
|
|
3872
|
+
const shape: z.ZodRawShape = {
|
|
3873
|
+
10: z.string(),
|
|
3874
|
+
2: z.string().optional(),
|
|
3875
|
+
plain: z.string(),
|
|
3876
|
+
optional: z.string().optional(),
|
|
3877
|
+
defaulted: z.string().default("x"),
|
|
3878
|
+
caught: z.string().catch("x"),
|
|
3879
|
+
[symbol]: z.string(),
|
|
3880
|
+
};
|
|
3881
|
+
Object.defineProperty(shape, "__proto__", { value: z.string(), enumerable: true });
|
|
3882
|
+
Object.defineProperty(shape, "hidden", { value: z.string(), enumerable: false });
|
|
3883
|
+
|
|
3884
|
+
const input = z.toJSONSchema(z.object(shape), { io: "input", unrepresentable: "any" });
|
|
3885
|
+
const output = z.toJSONSchema(z.object(shape), { io: "output", unrepresentable: "any" });
|
|
3886
|
+
|
|
3887
|
+
expect(Object.keys(input.properties!)).toEqual(["2", "10", "plain", "optional", "defaulted", "caught", "__proto__"]);
|
|
3888
|
+
expect(input.required).toEqual(["10", "plain", "caught", "__proto__"]);
|
|
3889
|
+
expect(output.required).toEqual(["10", "plain", "defaulted", "caught", "__proto__"]);
|
|
3890
|
+
expect(Object.prototype.hasOwnProperty.call(input.properties!, "__proto__")).toBe(true);
|
|
3891
|
+
expect(input.properties).not.toHaveProperty("hidden");
|
|
3892
|
+
expect(Object.getOwnPropertySymbols(input.properties!)).toEqual([]);
|
|
3893
|
+
});
|
|
3894
|
+
|
|
3852
3895
|
test("strip output-side examples from input JSON schema for codec", () => {
|
|
3853
3896
|
const codec = z
|
|
3854
3897
|
.codec(z.string(), z.number(), { decode: (s) => Number(s), encode: (n) => String(n) })
|
|
@@ -4679,3 +4722,12 @@ describe("intersection folding declines", () => {
|
|
|
4679
4722
|
expect(allOf(schema)).toHaveLength(3);
|
|
4680
4723
|
});
|
|
4681
4724
|
});
|
|
4725
|
+
|
|
4726
|
+
test("currency code", () => {
|
|
4727
|
+
expect(z.toJSONSchema(z.currencyCode())).toEqual({
|
|
4728
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
4729
|
+
type: "string",
|
|
4730
|
+
format: "currency_code",
|
|
4731
|
+
pattern: z.regexes.currencyCode.source,
|
|
4732
|
+
});
|
|
4733
|
+
});
|
|
@@ -58,16 +58,20 @@ export type CheckTypeParams<
|
|
|
58
58
|
> = Params<T, NonNullable<T["_zod"]["isst"] | T["_zod"]["issc"]>, "type" | "checks" | "error" | "check" | AlsoOmit>;
|
|
59
59
|
|
|
60
60
|
// String
|
|
61
|
-
export type $ZodStringParams = TypeParams<schemas.$ZodString<string>, "coerce"
|
|
61
|
+
export type $ZodStringParams = TypeParams<schemas.$ZodString<string>, "coerce"> & {
|
|
62
|
+
checks?: readonly checks.$ZodCheck<string>[];
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
function snapshotChecks<T extends { checks?: readonly checks.$ZodCheck<never>[] }>(def: T) {
|
|
66
|
+
if (def.checks) def.checks = [...def.checks];
|
|
67
|
+
return def as T & { checks?: NonNullable<T["checks"]>[number][] };
|
|
68
|
+
}
|
|
62
69
|
// @__NO_SIDE_EFFECTS__
|
|
63
70
|
export function _string<T extends schemas.$ZodString>(
|
|
64
71
|
Class: util.SchemaClass<T>,
|
|
65
72
|
params?: string | $ZodStringParams
|
|
66
73
|
): T {
|
|
67
|
-
return new Class({
|
|
68
|
-
type: "string",
|
|
69
|
-
...util.normalizeParams(params),
|
|
70
|
-
});
|
|
74
|
+
return new Class(snapshotChecks({ type: "string" as const, ...util.normalizeParams(params) }));
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -75,11 +79,7 @@ export function _coercedString<T extends schemas.$ZodString>(
|
|
|
75
79
|
Class: util.SchemaClass<T>,
|
|
76
80
|
params?: string | $ZodStringParams
|
|
77
81
|
): T {
|
|
78
|
-
return new Class({
|
|
79
|
-
type: "string",
|
|
80
|
-
coerce: true,
|
|
81
|
-
...util.normalizeParams(params),
|
|
82
|
-
});
|
|
82
|
+
return new Class(snapshotChecks({ type: "string" as const, coerce: true, ...util.normalizeParams(params) }));
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
export type $ZodStringFormatParams = CheckTypeParams<
|
|
@@ -608,7 +608,9 @@ export function _isoDuration<T extends schemas.$ZodISODuration>(
|
|
|
608
608
|
}
|
|
609
609
|
|
|
610
610
|
// Number
|
|
611
|
-
export type $ZodNumberParams = TypeParams<schemas.$ZodNumber<number>, "coerce"
|
|
611
|
+
export type $ZodNumberParams = TypeParams<schemas.$ZodNumber<number>, "coerce"> & {
|
|
612
|
+
checks?: readonly checks.$ZodCheck<number>[];
|
|
613
|
+
};
|
|
612
614
|
export type $ZodNumberFormatParams = CheckTypeParams<schemas.$ZodNumberFormat, "format" | "coerce">;
|
|
613
615
|
export type $ZodCheckNumberFormatParams = CheckParams<checks.$ZodCheckNumberFormat, "format" | "when">;
|
|
614
616
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -616,11 +618,7 @@ export function _number<T extends schemas.$ZodNumber>(
|
|
|
616
618
|
Class: util.SchemaClass<T>,
|
|
617
619
|
params?: string | $ZodNumberParams
|
|
618
620
|
): T {
|
|
619
|
-
return new Class({
|
|
620
|
-
type: "number",
|
|
621
|
-
checks: [],
|
|
622
|
-
...util.normalizeParams(params),
|
|
623
|
-
});
|
|
621
|
+
return new Class(snapshotChecks({ type: "number" as const, checks: [], ...util.normalizeParams(params) }));
|
|
624
622
|
}
|
|
625
623
|
|
|
626
624
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -628,12 +626,9 @@ export function _coercedNumber<T extends schemas.$ZodNumber>(
|
|
|
628
626
|
Class: util.SchemaClass<T>,
|
|
629
627
|
params?: string | $ZodNumberParams
|
|
630
628
|
): T {
|
|
631
|
-
return new Class(
|
|
632
|
-
type: "number",
|
|
633
|
-
|
|
634
|
-
checks: [],
|
|
635
|
-
...util.normalizeParams(params),
|
|
636
|
-
});
|
|
629
|
+
return new Class(
|
|
630
|
+
snapshotChecks({ type: "number" as const, coerce: true, checks: [], ...util.normalizeParams(params) })
|
|
631
|
+
);
|
|
637
632
|
}
|
|
638
633
|
|
|
639
634
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -1144,16 +1139,13 @@ export function _property<K extends string, T extends schemas.$ZodType>(
|
|
|
1144
1139
|
});
|
|
1145
1140
|
}
|
|
1146
1141
|
|
|
1147
|
-
|
|
1148
|
-
export type $ZodPropertiesParams = CheckTypeParams<schemas.$ZodProperties, "shape" | "when">;
|
|
1142
|
+
export type $ZodCheckPropertiesParams = CheckParams<checks.$ZodCheckProperties, "shape" | "when">;
|
|
1149
1143
|
// @__NO_SIDE_EFFECTS__
|
|
1150
1144
|
export function _properties<Shape extends schemas.$ZodShape>(
|
|
1151
|
-
Class: util.SchemaClass<schemas.$ZodProperties>,
|
|
1152
1145
|
shape: Shape,
|
|
1153
|
-
params?: string | $
|
|
1154
|
-
):
|
|
1155
|
-
return new
|
|
1156
|
-
type: "properties",
|
|
1146
|
+
params?: string | $ZodCheckPropertiesParams
|
|
1147
|
+
): checks.$ZodCheckProperties<Shape> {
|
|
1148
|
+
return new checks.$ZodCheckProperties({
|
|
1157
1149
|
check: "properties",
|
|
1158
1150
|
shape,
|
|
1159
1151
|
...util.normalizeParams(params),
|