@openclaw/feishu 2026.9.3 → 2026.9.5
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/assets/activity.svg +3 -0
- package/assets/icon.png +0 -0
- package/dist/{accounts-cCMNFBKg.js → .setup/accounts-DmU0xYPx.mjs} +1 -1
- package/dist/{app-registration-BI99e_JI.js → .setup/app-registration-Bv4mvauR.mjs} +1 -1
- package/dist/{channel-DrAqd5ED.js → .setup/channel-C1KrXXJa.mjs} +100 -99
- package/dist/{channel.runtime-BZzuDlOS.js → .setup/channel.runtime-Bizuv7WZ.mjs} +32 -18
- package/dist/{chat-BZSnEtgb.js → .setup/chat-dWJYS63b.mjs} +89 -88
- package/dist/{client-DMbIL3UH.js → .setup/client-DCwNVFZg.mjs} +128 -11
- package/dist/{conversation-id-VYgGQ-GX.js → .setup/conversation-id-H-lUayji.mjs} +49 -14
- package/dist/{monitor-DSGtOPio.js → .setup/monitor-C69OLzgO.mjs} +4 -4
- package/dist/{monitor.account-BRDUsS_q.js → .setup/monitor.account-zwHb3HKM.mjs} +76 -52
- package/dist/{probe-D_SatdZl.js → .setup/probe-bdidyhAn.mjs} +2 -2
- package/dist/{reply-delivery-result-BXEmtKpf.js → .setup/reply-delivery-result-DFjxGLgX.mjs} +162 -163
- package/dist/.setup/runtime-setter-api-CG-RC4_r.mjs +3 -0
- package/dist/.setup/secret-contract-api-jmCkqVLc.mjs +3 -0
- package/dist/{security-audit-DKfR4Cv3.js → .setup/security-audit-CmiKKfU-.mjs} +1 -1
- package/dist/{session-conversation-DFCIvQK-.js → .setup/session-conversation-ZC6TC1zk.mjs} +1 -1
- package/dist/.setup/setup-api-CTRwX09n.mjs +3 -0
- package/dist/{subagent-hooks-Buadpie_.js → .setup/subagent-hooks-BBfF1hZk.mjs} +3 -19
- package/dist/api.js +125 -121
- package/dist/channel-plugin-api.js +1 -1
- package/dist/contract-api.js +3 -3
- package/dist/doctor-contract-api.js +1 -1
- package/dist/runtime-api.js +1 -1
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-api.js +1 -1
- package/dist/setup-entry.js +4 -3
- package/dist/subagent-hooks-api.js +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/es/index.js +199 -35
- package/node_modules/@larksuiteoapi/node-sdk/lib/index.js +199 -35
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/CHANGELOG.md +62 -0
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/README.md +233 -5
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/axios.js +387 -89
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/axios.min.js +3 -3
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/browser/axios.cjs +458 -98
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/esm/axios.js +458 -98
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/node/axios.cjs +568 -116
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/index.d.cts +4 -0
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/index.d.ts +4 -0
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/adapters/fetch.js +64 -11
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/adapters/http.js +134 -50
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/adapters/xhr.js +52 -3
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/Axios.js +19 -14
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/InterceptorManager.js +107 -8
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/buildFullPath.js +1 -13
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/dispatchRequest.js +8 -2
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/mergeConfig.js +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/methodList.js +17 -0
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/defaults/index.js +2 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/Http2Sessions.js +2 -0
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/HttpStatusCode.js +11 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/fromDataURI.js +5 -4
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/progressEventReducer.js +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/resolveConfig.js +4 -2
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/shouldBypassProxy.js +182 -6
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/throttle.js +3 -2
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/toFormData.js +14 -21
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/utils.js +134 -13
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/package.json +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/README.md +24 -17
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/light/protobuf.js +124 -14
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/minimal/protobuf.js +63 -9
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/protobuf.js +133 -18
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/ext/descriptor.generated.d.ts +7 -0
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/ext/descriptor.js +24 -0
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/ext/protojson.js +14 -4
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/ext/textformat.js +8 -4
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/google/protobuf/descriptor.json +20 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/google/protobuf/descriptor.proto +14 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/index.d.ts +12 -0
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/package.json +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/src/decoder.js +31 -2
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/src/enum.js +10 -0
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/src/object.js +5 -2
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/src/parse.js +9 -4
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/src/reader.js +61 -7
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/src/type.js +10 -0
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/src/wrappers.js +5 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/.github/THREAT_MODEL.md +3 -3
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/CHANGELOG.md +15 -0
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/README.md +19 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/dist/qs.js +21 -21
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/eslint.config.mjs +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/lib/parse.js +3 -4
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/lib/stringify.js +23 -8
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/lib/utils.js +10 -3
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/package.json +4 -4
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/test/parse.js +192 -3
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/test/stringify.js +317 -0
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/test/utils.js +12 -0
- package/node_modules/@larksuiteoapi/node-sdk/package.json +1 -1
- package/node_modules/@larksuiteoapi/node-sdk/types/index.d.ts +35 -0
- package/node_modules/typebox/build/compile/validator.d.mts +1 -1
- package/node_modules/typebox/build/compile/validator.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +7 -5
- package/node_modules/typebox/build/format/iri.mjs +5 -1
- package/node_modules/typebox/build/guard/emit.mjs +2 -4
- package/node_modules/typebox/build/guard/guard.mjs +6 -18
- package/node_modules/typebox/build/guard/string.mjs +16 -24
- package/node_modules/typebox/build/schema/build.mjs +2 -2
- package/node_modules/typebox/build/schema/check.mjs +1 -1
- package/node_modules/typebox/build/schema/compile.d.mts +3 -2
- package/node_modules/typebox/build/schema/compile.mjs +8 -8
- package/node_modules/typebox/build/schema/engine/_context.d.mts +6 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +23 -15
- package/node_modules/typebox/build/schema/engine/_functions.d.mts +2 -2
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/_reducer.d.mts +3 -3
- package/node_modules/typebox/build/schema/engine/_refine.d.mts +5 -5
- package/node_modules/typebox/build/schema/engine/_refine.mjs +4 -7
- package/node_modules/typebox/build/schema/engine/_stack.d.mts +34 -16
- package/node_modules/typebox/build/schema/engine/_stack.mjs +148 -104
- package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +8 -8
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +26 -18
- package/node_modules/typebox/build/schema/engine/allOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/allOf.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/anyOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/anyOf.mjs +5 -10
- package/node_modules/typebox/build/schema/engine/boolean.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/boolean.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/const.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/const.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/contains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/contains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/dependencies.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +3 -6
- package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +11 -7
- package/node_modules/typebox/build/schema/engine/enum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/enum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/format.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/format.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/if.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/if.mjs +7 -15
- package/node_modules/typebox/build/schema/engine/items.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/items.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/maxContains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxItems.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxLength.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxLength.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxProperties.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maximum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maximum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minContains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minContains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minItems.d.mts +5 -5
- package/node_modules/typebox/build/schema/engine/minItems.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minLength.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minLength.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minProperties.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minimum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minimum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/multipleOf.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/not.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -8
- package/node_modules/typebox/build/schema/engine/oneOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +6 -11
- package/node_modules/typebox/build/schema/engine/pattern.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -7
- package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/prefixItems.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/properties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/properties.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +4 -10
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +11 -7
- package/node_modules/typebox/build/schema/engine/ref.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/ref.mjs +19 -15
- package/node_modules/typebox/build/schema/engine/required.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/required.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/schema.d.mts +7 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +137 -133
- package/node_modules/typebox/build/schema/engine/type.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +5 -9
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +5 -9
- package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +2 -6
- package/node_modules/typebox/build/schema/errors.d.mts +2 -2
- package/node_modules/typebox/build/schema/errors.mjs +8 -14
- package/node_modules/typebox/build/schema/intern/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/intern/index.mjs +1 -0
- package/node_modules/typebox/build/schema/intern/intern.d.mts +11 -0
- package/node_modules/typebox/build/schema/intern/intern.mjs +293 -0
- package/node_modules/typebox/build/schema/meta/draft_2019_09.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_2019_09.mjs +288 -0
- package/node_modules/typebox/build/schema/meta/draft_2020_12.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_2020_12.mjs +300 -0
- package/node_modules/typebox/build/schema/meta/draft_3.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_3.mjs +143 -0
- package/node_modules/typebox/build/schema/meta/draft_4.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_4.mjs +149 -0
- package/node_modules/typebox/build/schema/meta/draft_6.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_6.mjs +155 -0
- package/node_modules/typebox/build/schema/meta/draft_7.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_7.mjs +172 -0
- package/node_modules/typebox/build/schema/meta/index.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/index.mjs +2 -0
- package/node_modules/typebox/build/schema/meta/meta.d.mts +9 -0
- package/node_modules/typebox/build/schema/meta/meta.mjs +15 -0
- package/node_modules/typebox/build/schema/meta/schema.d.mts +6 -0
- package/node_modules/typebox/build/schema/meta/schema.mjs +1 -0
- package/node_modules/typebox/build/schema/parse.d.mts +1 -0
- package/node_modules/typebox/build/schema/parse.mjs +10 -5
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +8 -3
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +268 -139
- package/node_modules/typebox/build/schema/schema.d.mts +2 -0
- package/node_modules/typebox/build/schema/schema.mjs +2 -0
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -12
- package/node_modules/typebox/build/value/errors/errors.mjs +2 -7
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +59 -89
- package/node_modules/zod/README.md +27 -0
- package/node_modules/zod/compile.cjs +77 -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 +2 -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/package.json +13 -2
- 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/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/checks.ts +1 -0
- 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 +12 -9
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +140 -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 +452 -262
- 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 +135 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +30 -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 +2 -2
- 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 +720 -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 +155 -13
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +11 -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 +274 -6
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +425 -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/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 +281 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +47 -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 +183 -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 +245 -12
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +234 -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/preprocess-types.test.ts +20 -2
- 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 +33 -2
- 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/string.test.ts +127 -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 +11 -2
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1585 -173
- 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 +76 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
- package/node_modules/zod/src/v4/core/api.ts +48 -12
- package/node_modules/zod/src/v4/core/checks.ts +57 -44
- package/node_modules/zod/src/v4/core/compile.ts +2188 -0
- package/node_modules/zod/src/v4/core/core.ts +98 -19
- package/node_modules/zod/src/v4/core/doc.ts +11 -7
- package/node_modules/zod/src/v4/core/errors.ts +115 -24
- package/node_modules/zod/src/v4/core/index.ts +3 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +6 -1
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +257 -93
- package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
- package/node_modules/zod/src/v4/core/memoizer.ts +284 -0
- package/node_modules/zod/src/v4/core/parse.ts +131 -38
- package/node_modules/zod/src/v4/core/regexes.ts +30 -13
- package/node_modules/zod/src/v4/core/registries.ts +2 -2
- package/node_modules/zod/src/v4/core/schemas.ts +759 -461
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +969 -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 +1639 -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/tk.test.ts +69 -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 +275 -42
- package/node_modules/zod/src/v4/core/util.ts +268 -42
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/index.ts +3 -3
- package/node_modules/zod/src/v4/locales/ar.ts +3 -0
- package/node_modules/zod/src/v4/locales/az.ts +3 -0
- package/node_modules/zod/src/v4/locales/be.ts +10 -0
- package/node_modules/zod/src/v4/locales/bg.ts +3 -0
- package/node_modules/zod/src/v4/locales/bn.ts +121 -0
- package/node_modules/zod/src/v4/locales/ca.ts +3 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +138 -0
- package/node_modules/zod/src/v4/locales/cs.ts +3 -0
- package/node_modules/zod/src/v4/locales/da.ts +5 -2
- package/node_modules/zod/src/v4/locales/de.ts +3 -0
- package/node_modules/zod/src/v4/locales/el.ts +1 -0
- package/node_modules/zod/src/v4/locales/en.ts +15 -4
- package/node_modules/zod/src/v4/locales/eo.ts +3 -0
- package/node_modules/zod/src/v4/locales/es.ts +2 -0
- package/node_modules/zod/src/v4/locales/fa.ts +3 -0
- package/node_modules/zod/src/v4/locales/fi.ts +3 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +3 -0
- package/node_modules/zod/src/v4/locales/fr.ts +19 -14
- package/node_modules/zod/src/v4/locales/gu.ts +121 -0
- package/node_modules/zod/src/v4/locales/he.ts +6 -1
- package/node_modules/zod/src/v4/locales/hi.ts +124 -0
- package/node_modules/zod/src/v4/locales/hr.ts +2 -0
- package/node_modules/zod/src/v4/locales/hu.ts +3 -0
- package/node_modules/zod/src/v4/locales/hy.ts +9 -0
- package/node_modules/zod/src/v4/locales/id.ts +3 -0
- package/node_modules/zod/src/v4/locales/index.ts +10 -0
- package/node_modules/zod/src/v4/locales/is.ts +3 -0
- package/node_modules/zod/src/v4/locales/it.ts +3 -0
- package/node_modules/zod/src/v4/locales/ja.ts +3 -0
- package/node_modules/zod/src/v4/locales/ka.ts +3 -0
- package/node_modules/zod/src/v4/locales/km.ts +3 -0
- package/node_modules/zod/src/v4/locales/kn.ts +124 -0
- package/node_modules/zod/src/v4/locales/ko.ts +3 -0
- package/node_modules/zod/src/v4/locales/lt.ts +2 -0
- package/node_modules/zod/src/v4/locales/mk.ts +3 -0
- package/node_modules/zod/src/v4/locales/ms.ts +3 -0
- package/node_modules/zod/src/v4/locales/ne.ts +126 -0
- package/node_modules/zod/src/v4/locales/nl.ts +3 -0
- package/node_modules/zod/src/v4/locales/nn.ts +119 -0
- package/node_modules/zod/src/v4/locales/no.ts +5 -2
- package/node_modules/zod/src/v4/locales/ota.ts +3 -0
- package/node_modules/zod/src/v4/locales/pl.ts +3 -0
- package/node_modules/zod/src/v4/locales/ps.ts +3 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +159 -0
- package/node_modules/zod/src/v4/locales/pt.ts +99 -58
- package/node_modules/zod/src/v4/locales/ro.ts +1 -0
- package/node_modules/zod/src/v4/locales/ru.ts +10 -0
- package/node_modules/zod/src/v4/locales/sk.ts +121 -0
- package/node_modules/zod/src/v4/locales/sl.ts +3 -0
- package/node_modules/zod/src/v4/locales/sv.ts +5 -2
- package/node_modules/zod/src/v4/locales/ta.ts +3 -0
- package/node_modules/zod/src/v4/locales/th.ts +3 -0
- package/node_modules/zod/src/v4/locales/tk.ts +111 -0
- package/node_modules/zod/src/v4/locales/tr.ts +3 -0
- package/node_modules/zod/src/v4/locales/uk.ts +3 -0
- package/node_modules/zod/src/v4/locales/ur.ts +3 -0
- package/node_modules/zod/src/v4/locales/uz.ts +1 -0
- package/node_modules/zod/src/v4/locales/vi.ts +3 -0
- package/node_modules/zod/src/v4/locales/yo.ts +3 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +3 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +3 -0
- package/node_modules/zod/src/v4/mini/checks.ts +1 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +10 -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 +135 -56
- 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/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 +72 -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/string.test.ts +21 -0
- package/node_modules/zod/v3/ZodError.cjs +22 -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/types.cjs +7 -5
- package/node_modules/zod/v3/types.js +7 -5
- 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/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 +39 -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 +43 -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 +30 -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 +136 -75
- package/node_modules/zod/v4/classic/from-json-schema.js +136 -75
- package/node_modules/zod/v4/classic/in-out.cjs +63 -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 +2 -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 +11 -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 +4 -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 +498 -398
- package/node_modules/zod/v4/classic/schemas.d.cts +53 -18
- package/node_modules/zod/v4/classic/schemas.d.ts +53 -18
- package/node_modules/zod/v4/classic/schemas.js +492 -396
- package/node_modules/zod/v4/core/api.cjs +23 -4
- package/node_modules/zod/v4/core/api.d.cts +13 -9
- package/node_modules/zod/v4/core/api.d.ts +13 -9
- package/node_modules/zod/v4/core/api.js +21 -4
- package/node_modules/zod/v4/core/checks.cjs +37 -31
- 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 -31
- package/node_modules/zod/v4/core/compile.cjs +1813 -0
- package/node_modules/zod/v4/core/compile.d.cts +51 -0
- package/node_modules/zod/v4/core/compile.d.ts +51 -0
- package/node_modules/zod/v4/core/compile.js +1783 -0
- package/node_modules/zod/v4/core/core.cjs +81 -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 +5 -7
- 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 +5 -7
- package/node_modules/zod/v4/core/errors.cjs +110 -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 +110 -25
- package/node_modules/zod/v4/core/index.cjs +5 -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 +4 -0
- 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 +4 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +264 -95
- package/node_modules/zod/v4/core/json-schema-processors.js +243 -97
- 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 +272 -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 +265 -0
- package/node_modules/zod/v4/core/parse.cjs +96 -34
- 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 +94 -33
- package/node_modules/zod/v4/core/regexes.cjs +27 -15
- package/node_modules/zod/v4/core/regexes.d.cts +2 -0
- package/node_modules/zod/v4/core/regexes.d.ts +2 -0
- package/node_modules/zod/v4/core/regexes.js +24 -13
- package/node_modules/zod/v4/core/registries.js +2 -2
- package/node_modules/zod/v4/core/schemas.cjs +537 -326
- package/node_modules/zod/v4/core/schemas.d.cts +100 -31
- package/node_modules/zod/v4/core/schemas.d.ts +100 -31
- package/node_modules/zod/v4/core/schemas.js +526 -325
- package/node_modules/zod/v4/core/to-json-schema.cjs +242 -39
- package/node_modules/zod/v4/core/to-json-schema.d.cts +42 -3
- package/node_modules/zod/v4/core/to-json-schema.d.ts +42 -3
- package/node_modules/zod/v4/core/to-json-schema.js +241 -39
- package/node_modules/zod/v4/core/util.cjs +212 -31
- package/node_modules/zod/v4/core/util.d.cts +58 -1
- package/node_modules/zod/v4/core/util.d.ts +58 -1
- package/node_modules/zod/v4/core/util.js +202 -30
- package/node_modules/zod/v4/core/versions.cjs +2 -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 +195 -0
- package/node_modules/zod/v4/core/visit.d.cts +30 -0
- package/node_modules/zod/v4/core/visit.d.ts +30 -0
- package/node_modules/zod/v4/core/visit.js +169 -0
- package/node_modules/zod/v4/index.cjs +15 -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 +3 -0
- package/node_modules/zod/v4/locales/ar.js +3 -0
- package/node_modules/zod/v4/locales/az.cjs +3 -0
- package/node_modules/zod/v4/locales/az.js +3 -0
- package/node_modules/zod/v4/locales/be.cjs +10 -0
- package/node_modules/zod/v4/locales/be.js +10 -0
- package/node_modules/zod/v4/locales/bg.cjs +3 -0
- package/node_modules/zod/v4/locales/bg.js +3 -0
- package/node_modules/zod/v4/locales/bn.cjs +138 -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 +111 -0
- package/node_modules/zod/v4/locales/ca.cjs +3 -0
- package/node_modules/zod/v4/locales/ca.js +3 -0
- package/node_modules/zod/v4/locales/ckb.cjs +158 -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 +131 -0
- package/node_modules/zod/v4/locales/cs.cjs +3 -0
- package/node_modules/zod/v4/locales/cs.js +3 -0
- package/node_modules/zod/v4/locales/da.cjs +5 -2
- package/node_modules/zod/v4/locales/da.js +5 -2
- package/node_modules/zod/v4/locales/de.cjs +3 -0
- package/node_modules/zod/v4/locales/de.js +3 -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 +14 -4
- package/node_modules/zod/v4/locales/en.js +14 -4
- package/node_modules/zod/v4/locales/eo.cjs +3 -0
- package/node_modules/zod/v4/locales/eo.js +3 -0
- package/node_modules/zod/v4/locales/es.cjs +2 -0
- package/node_modules/zod/v4/locales/es.js +2 -0
- package/node_modules/zod/v4/locales/fa.cjs +3 -0
- package/node_modules/zod/v4/locales/fa.js +3 -0
- package/node_modules/zod/v4/locales/fi.cjs +3 -0
- package/node_modules/zod/v4/locales/fi.js +3 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +3 -0
- package/node_modules/zod/v4/locales/fr-CA.js +3 -0
- package/node_modules/zod/v4/locales/fr.cjs +16 -14
- package/node_modules/zod/v4/locales/fr.js +16 -14
- package/node_modules/zod/v4/locales/gu.cjs +138 -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 +111 -0
- package/node_modules/zod/v4/locales/he.cjs +5 -0
- package/node_modules/zod/v4/locales/he.js +5 -0
- package/node_modules/zod/v4/locales/hi.cjs +136 -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 +109 -0
- package/node_modules/zod/v4/locales/hr.cjs +2 -0
- package/node_modules/zod/v4/locales/hr.js +2 -0
- package/node_modules/zod/v4/locales/hu.cjs +3 -0
- package/node_modules/zod/v4/locales/hu.js +3 -0
- package/node_modules/zod/v4/locales/hy.cjs +9 -0
- package/node_modules/zod/v4/locales/hy.js +9 -0
- package/node_modules/zod/v4/locales/id.cjs +3 -0
- package/node_modules/zod/v4/locales/id.js +3 -0
- package/node_modules/zod/v4/locales/index.cjs +22 -2
- package/node_modules/zod/v4/locales/index.d.cts +10 -0
- package/node_modules/zod/v4/locales/index.d.ts +10 -0
- package/node_modules/zod/v4/locales/index.js +10 -0
- package/node_modules/zod/v4/locales/is.cjs +3 -0
- package/node_modules/zod/v4/locales/is.js +3 -0
- package/node_modules/zod/v4/locales/it.cjs +3 -0
- package/node_modules/zod/v4/locales/it.js +3 -0
- package/node_modules/zod/v4/locales/ja.cjs +3 -0
- package/node_modules/zod/v4/locales/ja.js +3 -0
- package/node_modules/zod/v4/locales/ka.cjs +3 -0
- package/node_modules/zod/v4/locales/ka.js +3 -0
- package/node_modules/zod/v4/locales/km.cjs +3 -0
- package/node_modules/zod/v4/locales/km.js +3 -0
- package/node_modules/zod/v4/locales/kn.cjs +141 -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 +114 -0
- package/node_modules/zod/v4/locales/ko.cjs +3 -0
- package/node_modules/zod/v4/locales/ko.js +3 -0
- package/node_modules/zod/v4/locales/lt.cjs +2 -0
- package/node_modules/zod/v4/locales/lt.js +2 -0
- package/node_modules/zod/v4/locales/mk.cjs +3 -0
- package/node_modules/zod/v4/locales/mk.js +3 -0
- package/node_modules/zod/v4/locales/ms.cjs +3 -0
- package/node_modules/zod/v4/locales/ms.js +3 -0
- package/node_modules/zod/v4/locales/ne.cjs +136 -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 +109 -0
- package/node_modules/zod/v4/locales/nl.cjs +3 -0
- package/node_modules/zod/v4/locales/nl.js +3 -0
- package/node_modules/zod/v4/locales/nn.cjs +138 -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 +111 -0
- package/node_modules/zod/v4/locales/no.cjs +5 -2
- package/node_modules/zod/v4/locales/no.js +5 -2
- package/node_modules/zod/v4/locales/ota.cjs +3 -0
- package/node_modules/zod/v4/locales/ota.js +3 -0
- package/node_modules/zod/v4/locales/pl.cjs +3 -0
- package/node_modules/zod/v4/locales/pl.js +3 -0
- package/node_modules/zod/v4/locales/ps.cjs +3 -0
- package/node_modules/zod/v4/locales/ps.js +3 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +168 -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 +141 -0
- package/node_modules/zod/v4/locales/pt.cjs +87 -55
- package/node_modules/zod/v4/locales/pt.js +87 -55
- 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 +10 -0
- package/node_modules/zod/v4/locales/ru.js +10 -0
- package/node_modules/zod/v4/locales/sk.cjs +141 -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 +114 -0
- package/node_modules/zod/v4/locales/sl.cjs +3 -0
- package/node_modules/zod/v4/locales/sl.js +3 -0
- package/node_modules/zod/v4/locales/sv.cjs +5 -2
- package/node_modules/zod/v4/locales/sv.js +5 -2
- package/node_modules/zod/v4/locales/ta.cjs +3 -0
- package/node_modules/zod/v4/locales/ta.js +3 -0
- package/node_modules/zod/v4/locales/th.cjs +3 -0
- package/node_modules/zod/v4/locales/th.js +3 -0
- package/node_modules/zod/v4/locales/tk.cjs +132 -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 +105 -0
- package/node_modules/zod/v4/locales/tr.cjs +3 -0
- package/node_modules/zod/v4/locales/tr.js +3 -0
- package/node_modules/zod/v4/locales/uk.cjs +3 -0
- package/node_modules/zod/v4/locales/uk.js +3 -0
- package/node_modules/zod/v4/locales/ur.cjs +3 -0
- package/node_modules/zod/v4/locales/ur.js +3 -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 +3 -0
- package/node_modules/zod/v4/locales/vi.js +3 -0
- package/node_modules/zod/v4/locales/yo.cjs +3 -0
- package/node_modules/zod/v4/locales/yo.js +3 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +3 -0
- package/node_modules/zod/v4/locales/zh-CN.js +3 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +3 -0
- package/node_modules/zod/v4/locales/zh-TW.js +3 -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/deep-partial.cjs +39 -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 +12 -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 +63 -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/parse.cjs +3 -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 +75 -47
- package/node_modules/zod/v4/mini/schemas.d.cts +43 -13
- package/node_modules/zod/v4/mini/schemas.d.ts +43 -13
- package/node_modules/zod/v4/mini/schemas.js +71 -45
- package/openclaw.plugin.json +27 -56
- package/package.json +10 -7
- package/dist/targets-BTQCYRZQ.js +0 -48
- package/node_modules/zod/src/v4/core/config.ts +0 -15
- /package/dist/{audio-preflight.runtime-BBfC9elv.js → .setup/audio-preflight.runtime-BBfC9elv.mjs} +0 -0
- /package/dist/{doctor-contract-w6FpMypv.js → .setup/doctor-contract-w6FpMypv.mjs} +0 -0
- /package/dist/{json-response-DXajw_FU.js → .setup/json-response-DXajw_FU.mjs} +0 -0
- /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{runtime-C5JxBWZp.js → .setup/runtime-C5JxBWZp.mjs} +0 -0
- /package/dist/{secret-contract-BCpDLdg9.js → .setup/secret-contract-BCpDLdg9.mjs} +0 -0
- /package/dist/{security-audit-shared-CK5rVR-1.js → .setup/security-audit-shared-CK5rVR-1.mjs} +0 -0
- /package/dist/{thread-bindings-BiL1wGqK.js → .setup/thread-bindings-BiL1wGqK.mjs} +0 -0
|
@@ -86,6 +86,40 @@ export type ParsedTypes =
|
|
|
86
86
|
export type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
|
|
87
87
|
export type AssertNotEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? false : true;
|
|
88
88
|
export type AssertExtends<T, U> = T extends U ? T : never;
|
|
89
|
+
type ToZodMismatch<T, S extends schemas.$ZodType> = {
|
|
90
|
+
"types do not match": {
|
|
91
|
+
expected: T;
|
|
92
|
+
received: S["_zod"]["output"];
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// Stays a `$ZodType` so it still satisfies the shape constraint, and carries a brand no real schema has so the offending property is the one TypeScript reports as unassignable.
|
|
97
|
+
type ToZodKeyMismatch<Expected, Received> = schemas.$ZodType & {
|
|
98
|
+
"types do not match": { expected: Expected; received: Received };
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Rebuilds the shape with a marker on each key that disagrees, so the diagnostic names the key instead of failing the whole schema at the top level. A key the target lacks reports `expected: never`; a key the schema lacks reports `received: never`.
|
|
102
|
+
type ToZodShape<Shape, T> = {
|
|
103
|
+
[K in keyof Shape]: Shape[K] extends schemas.$ZodType
|
|
104
|
+
? K extends keyof T
|
|
105
|
+
? AssertEqual<Shape[K]["_zod"]["output"], T[K]> extends true
|
|
106
|
+
? Shape[K]
|
|
107
|
+
: ToZodKeyMismatch<T[K], Shape[K]["_zod"]["output"]>
|
|
108
|
+
: ToZodKeyMismatch<never, Shape[K]["_zod"]["output"]>
|
|
109
|
+
: Shape[K];
|
|
110
|
+
} & { [K in Exclude<keyof T, keyof Shape>]: ToZodKeyMismatch<T[K], never> };
|
|
111
|
+
|
|
112
|
+
// Forces the mapped type to display expanded, so the error prints the keys rather than the alias name.
|
|
113
|
+
type ToZodExpand<X> = { [K in keyof X]: X[K] } & {};
|
|
114
|
+
|
|
115
|
+
// Only localizes when a key is genuinely at fault. A whole-type difference the per-key walk cannot see — a `readonly` modifier, an intersection versus the flat object with the same keys — leaves every key agreeing, and reporting nothing there would silently accept what the top-level check rejected.
|
|
116
|
+
type ToZodTarget<S extends schemas.$ZodType, T> = S extends schemas.$ZodObject<infer Shape, infer Config>
|
|
117
|
+
? T extends object
|
|
118
|
+
? AssertEqual<ToZodExpand<ToZodShape<Shape, T>>, ToZodExpand<Shape>> extends true
|
|
119
|
+
? S & ToZodMismatch<T, S>
|
|
120
|
+
: schemas.$ZodObject<ToZodExpand<ToZodShape<Shape, T>>, Config>
|
|
121
|
+
: S & ToZodMismatch<T, S>
|
|
122
|
+
: S & ToZodMismatch<T, S>;
|
|
89
123
|
export type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
90
124
|
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
91
125
|
export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
|
|
@@ -197,6 +231,12 @@ export function assertNotEqual<A, B>(val: AssertNotEqual<A, B>): AssertNotEqual<
|
|
|
197
231
|
return val;
|
|
198
232
|
}
|
|
199
233
|
|
|
234
|
+
export function toZod<T>(): <S extends schemas.$ZodType>(
|
|
235
|
+
schema: AssertEqual<S["_zod"]["output"], T> extends true ? S : ToZodTarget<S, T>
|
|
236
|
+
) => S {
|
|
237
|
+
return (schema) => schema as any;
|
|
238
|
+
}
|
|
239
|
+
|
|
200
240
|
export function assertIs<T>(_arg: T): void {}
|
|
201
241
|
|
|
202
242
|
export function assertNever(_x: never): never {
|
|
@@ -248,8 +288,8 @@ export function cleanRegex(source: string): string {
|
|
|
248
288
|
export function floatSafeRemainder(val: number, step: number): number {
|
|
249
289
|
const ratio = val / step;
|
|
250
290
|
const roundedRatio = Math.round(ratio);
|
|
251
|
-
//
|
|
252
|
-
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
291
|
+
// `val` and `step` each round to a double before the division rounds again, so a true decimal multiple's quotient can sit up to 1.5 of these scaled epsilons from the integer. A 1x tolerance therefore rejected 2.03 as a multiple of 0.07; 4x covers the worst case with margin.
|
|
292
|
+
const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
253
293
|
if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
|
|
254
294
|
return ratio - roundedRatio;
|
|
255
295
|
}
|
|
@@ -362,8 +402,7 @@ export function isObject(data: any): data is Record<PropertyKey, unknown> {
|
|
|
362
402
|
}
|
|
363
403
|
|
|
364
404
|
export const allowsEval: { value: boolean } = /* @__PURE__*/ cached(() => {
|
|
365
|
-
// Skip the probe under `jitless`: strict CSPs report the caught `new Function`
|
|
366
|
-
// as a `securitypolicyviolation` even though the throw is swallowed.
|
|
405
|
+
// Skip the probe under `jitless`: strict CSPs report the caught `new Function` as a `securitypolicyviolation` even though the throw is swallowed.
|
|
367
406
|
if (globalConfig.jitless) {
|
|
368
407
|
return false;
|
|
369
408
|
}
|
|
@@ -573,7 +612,7 @@ export function stringifyPrimitive(value: any): string {
|
|
|
573
612
|
|
|
574
613
|
export function optionalKeys(shape: schemas.$ZodShape): string[] {
|
|
575
614
|
return Object.keys(shape).filter((k) => {
|
|
576
|
-
return shape[k]!._zod.optin
|
|
615
|
+
return shape[k]!._zod.optin !== undefined && shape[k]!._zod.optout === "optional";
|
|
577
616
|
});
|
|
578
617
|
}
|
|
579
618
|
|
|
@@ -585,13 +624,14 @@ export type FromCleanMap<T extends schemas.$ZodLooseShape> = {
|
|
|
585
624
|
[k in keyof T as k extends `?${infer K}` ? K : k extends `${infer K}?` ? K : k]: k;
|
|
586
625
|
};
|
|
587
626
|
|
|
588
|
-
|
|
627
|
+
// Wrapped in a `@__PURE__` IIFE: esbuild never tree-shakes a top-level initializer that contains a member access on `Number`, so the bare object literal survived into every bundle.
|
|
628
|
+
export const NUMBER_FORMAT_RANGES: Record<checks.$ZodNumberFormats, [number, number]> = /*@__PURE__*/ (() => ({
|
|
589
629
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
590
630
|
int32: [-2147483648, 2147483647],
|
|
591
631
|
uint32: [0, 4294967295],
|
|
592
632
|
float32: [-3.4028234663852886e38, 3.4028234663852886e38],
|
|
593
633
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE],
|
|
594
|
-
};
|
|
634
|
+
}))();
|
|
595
635
|
|
|
596
636
|
export const BIGINT_FORMAT_RANGES: Record<checks.$ZodBigIntFormats, [bigint, bigint]> = {
|
|
597
637
|
int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
|
|
@@ -610,12 +650,13 @@ export function pick(schema: schemas.$ZodObject, mask: Record<string, unknown>):
|
|
|
610
650
|
const def = mergeDefs(schema._zod.def, {
|
|
611
651
|
get shape() {
|
|
612
652
|
const newShape: Writeable<schemas.$ZodShape> = {};
|
|
613
|
-
for
|
|
614
|
-
|
|
615
|
-
|
|
653
|
+
// `for...in` skips symbols, so a symbol in the mask would select nothing
|
|
654
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
655
|
+
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
|
|
656
|
+
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
616
657
|
}
|
|
617
|
-
if (!mask[key]) continue;
|
|
618
|
-
newShape
|
|
658
|
+
if (!mask[key as string]) continue;
|
|
659
|
+
assignProp(newShape, key as string, (currDef.shape as any)[key]!);
|
|
619
660
|
}
|
|
620
661
|
|
|
621
662
|
assignProp(this, "shape", newShape); // self-caching
|
|
@@ -639,13 +680,13 @@ export function omit(schema: schemas.$ZodObject, mask: object): any {
|
|
|
639
680
|
const def = mergeDefs(schema._zod.def, {
|
|
640
681
|
get shape() {
|
|
641
682
|
const newShape: Writeable<schemas.$ZodShape> = { ...schema._zod.def.shape };
|
|
642
|
-
for (const key
|
|
643
|
-
if (!(
|
|
644
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
683
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
684
|
+
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
|
|
685
|
+
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
645
686
|
}
|
|
646
687
|
if (!(mask as any)[key]) continue;
|
|
647
688
|
|
|
648
|
-
delete newShape[key];
|
|
689
|
+
delete newShape[key as string];
|
|
649
690
|
}
|
|
650
691
|
assignProp(this, "shape", newShape); // self-caching
|
|
651
692
|
return newShape;
|
|
@@ -664,10 +705,9 @@ export function extend(schema: schemas.$ZodObject, shape: schemas.$ZodShape): an
|
|
|
664
705
|
const checks = schema._zod.def.checks;
|
|
665
706
|
const hasChecks = checks && checks.length > 0;
|
|
666
707
|
if (hasChecks) {
|
|
667
|
-
// Only throw if new shape overlaps with existing shape
|
|
668
|
-
// Use getOwnPropertyDescriptor to check key existence without accessing values
|
|
708
|
+
// Only throw if new shape overlaps with existing shape. Use getOwnPropertyDescriptor to check key existence without accessing values
|
|
669
709
|
const existingShape = schema._zod.def.shape;
|
|
670
|
-
for (const key
|
|
710
|
+
for (const key of Reflect.ownKeys(shape)) {
|
|
671
711
|
if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
|
|
672
712
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
673
713
|
}
|
|
@@ -699,6 +739,9 @@ export function safeExtend(schema: schemas.$ZodObject, shape: schemas.$ZodShape)
|
|
|
699
739
|
}
|
|
700
740
|
|
|
701
741
|
export function merge(a: schemas.$ZodObject, b: schemas.$ZodObject): any {
|
|
742
|
+
if (!b?._zod?.def) {
|
|
743
|
+
throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
744
|
+
}
|
|
702
745
|
if (a._zod.def.checks?.length) {
|
|
703
746
|
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
704
747
|
}
|
|
@@ -720,13 +763,14 @@ export function merge(a: schemas.$ZodObject, b: schemas.$ZodObject): any {
|
|
|
720
763
|
export function partial(
|
|
721
764
|
Class: SchemaClass<schemas.$ZodOptional> | null,
|
|
722
765
|
schema: schemas.$ZodObject,
|
|
723
|
-
mask: object | undefined
|
|
766
|
+
mask: object | undefined,
|
|
767
|
+
name = "partial"
|
|
724
768
|
): any {
|
|
725
769
|
const currDef = schema._zod.def;
|
|
726
770
|
const checks = currDef.checks;
|
|
727
771
|
const hasChecks = checks && checks.length > 0;
|
|
728
772
|
if (hasChecks) {
|
|
729
|
-
throw new Error(
|
|
773
|
+
throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
730
774
|
}
|
|
731
775
|
|
|
732
776
|
const def = mergeDefs(schema._zod.def, {
|
|
@@ -735,28 +779,29 @@ export function partial(
|
|
|
735
779
|
const shape: Writeable<schemas.$ZodShape> = { ...oldShape };
|
|
736
780
|
|
|
737
781
|
if (mask) {
|
|
738
|
-
for (const key
|
|
739
|
-
if (!(key
|
|
740
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
782
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
783
|
+
if (!Object.prototype.hasOwnProperty.call(oldShape, key)) {
|
|
784
|
+
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
741
785
|
}
|
|
742
786
|
if (!(mask as any)[key]) continue;
|
|
743
787
|
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
744
|
-
shape[key] = Class
|
|
788
|
+
(shape as any)[key] = Class
|
|
745
789
|
? new Class({
|
|
746
790
|
type: "optional",
|
|
747
|
-
innerType: oldShape[key]!,
|
|
791
|
+
innerType: (oldShape as any)[key]!,
|
|
748
792
|
})
|
|
749
|
-
: oldShape[key]!;
|
|
793
|
+
: (oldShape as any)[key]!;
|
|
750
794
|
}
|
|
751
795
|
} else {
|
|
752
|
-
|
|
796
|
+
// the spread copies symbol keys; `for...in` would not reach them
|
|
797
|
+
for (const key of Reflect.ownKeys(oldShape)) {
|
|
753
798
|
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
754
|
-
shape[key] = Class
|
|
799
|
+
(shape as any)[key] = Class
|
|
755
800
|
? new Class({
|
|
756
801
|
type: "optional",
|
|
757
|
-
innerType: oldShape[key]!,
|
|
802
|
+
innerType: (oldShape as any)[key]!,
|
|
758
803
|
})
|
|
759
|
-
: oldShape[key]!;
|
|
804
|
+
: (oldShape as any)[key]!;
|
|
760
805
|
}
|
|
761
806
|
}
|
|
762
807
|
|
|
@@ -780,23 +825,23 @@ export function required(
|
|
|
780
825
|
const shape: Writeable<schemas.$ZodShape> = { ...oldShape };
|
|
781
826
|
|
|
782
827
|
if (mask) {
|
|
783
|
-
for (const key
|
|
784
|
-
if (!(key
|
|
785
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
828
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
829
|
+
if (!Object.prototype.hasOwnProperty.call(shape, key)) {
|
|
830
|
+
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
786
831
|
}
|
|
787
832
|
if (!(mask as any)[key]) continue;
|
|
788
833
|
// overwrite with non-optional
|
|
789
|
-
shape[key] = new Class({
|
|
834
|
+
(shape as any)[key] = new Class({
|
|
790
835
|
type: "nonoptional",
|
|
791
|
-
innerType: oldShape[key]!,
|
|
836
|
+
innerType: (oldShape as any)[key]!,
|
|
792
837
|
});
|
|
793
838
|
}
|
|
794
839
|
} else {
|
|
795
|
-
for (const key
|
|
840
|
+
for (const key of Reflect.ownKeys(oldShape)) {
|
|
796
841
|
// overwrite with non-optional
|
|
797
|
-
shape[key] = new Class({
|
|
842
|
+
(shape as any)[key] = new Class({
|
|
798
843
|
type: "nonoptional",
|
|
799
|
-
innerType: oldShape[key]!,
|
|
844
|
+
innerType: (oldShape as any)[key]!,
|
|
800
845
|
});
|
|
801
846
|
}
|
|
802
847
|
}
|
|
@@ -822,8 +867,7 @@ export function aborted(x: schemas.ParsePayload, startIndex = 0): boolean {
|
|
|
822
867
|
return false;
|
|
823
868
|
}
|
|
824
869
|
|
|
825
|
-
// Checks for explicit abort (continue === false), as opposed to implicit abort (continue === undefined).
|
|
826
|
-
// Used to respect `abort: true` in .refine() even for checks that have a `when` function.
|
|
870
|
+
// Checks for explicit abort (continue === false), as opposed to implicit abort (continue === undefined). Used to respect `abort: true` in .refine() even for checks that have a `when` function.
|
|
827
871
|
export function explicitlyAborted(x: schemas.ParsePayload, startIndex = 0): boolean {
|
|
828
872
|
if (x.aborted === true) return true;
|
|
829
873
|
for (let i = startIndex; i < x.issues.length; i++) {
|
|
@@ -846,20 +890,37 @@ export function unwrapMessage(message: string | { message: string } | undefined
|
|
|
846
890
|
return typeof message === "string" ? message : message?.message;
|
|
847
891
|
}
|
|
848
892
|
|
|
893
|
+
/* A check holds no link back to the schema it is attached to — the same check instance is shared by every clone of that schema — so the owner is stamped onto the issues a check just raised, at the only point where both are in scope. Runs on the failure path only; `start` is the issue count from before the check ran. */
|
|
894
|
+
export function attachSchema(issues: errors.$ZodRawIssue[], start: number, inst: schemas.$ZodType): void {
|
|
895
|
+
for (let i = start; i < issues.length; i++) {
|
|
896
|
+
(issues[i] as any).schema ??= inst;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
|
|
849
900
|
export function finalizeIssue(
|
|
850
901
|
iss: errors.$ZodRawIssue,
|
|
851
902
|
ctx: schemas.ParseContextInternal | undefined,
|
|
852
903
|
config: $ZodConfig
|
|
853
904
|
): errors.$ZodIssue {
|
|
905
|
+
// A schema that raised an issue itself owns it outright, and outranks any stamp an enclosing check left in `attachSchema`. String formats and z.custom() are schema and check at once, so when they act as a check they defer to that stamp instead.
|
|
906
|
+
const traits: Set<string> | undefined = (iss.inst as any)?._zod?.traits;
|
|
907
|
+
if (traits?.has("$ZodType")) {
|
|
908
|
+
if (traits.has("$ZodCheck")) (iss as any).schema ??= iss.inst;
|
|
909
|
+
else (iss as any).schema = iss.inst;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
// Decreasing specificity, first map to return a message wins. `inst` is whatever raised the issue, so a check's own map outranks the owning schema's.
|
|
913
|
+
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : undefined;
|
|
854
914
|
const message = iss.message
|
|
855
915
|
? iss.message
|
|
856
916
|
: (unwrapMessage(iss.inst?._zod.def?.error?.(iss as never)) ??
|
|
917
|
+
unwrapMessage(schemaError?.(iss as never)) ??
|
|
857
918
|
unwrapMessage(ctx?.error?.(iss as never)) ??
|
|
858
919
|
unwrapMessage(config.customError?.(iss)) ??
|
|
859
920
|
unwrapMessage(config.localeError?.(iss)) ??
|
|
860
921
|
"Invalid input");
|
|
861
922
|
|
|
862
|
-
const { inst: _inst, continue: _continue, input: _input, ...rest } = iss as any;
|
|
923
|
+
const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss as any;
|
|
863
924
|
rest.path ??= [];
|
|
864
925
|
rest.message = message;
|
|
865
926
|
if (ctx?.reportInput) {
|
|
@@ -876,6 +937,22 @@ export function getSizableOrigin(input: any): "set" | "map" | "file" | "unknown"
|
|
|
876
937
|
return "unknown";
|
|
877
938
|
}
|
|
878
939
|
|
|
940
|
+
const highSurrogate = /[\uD800-\uDBFF]/;
|
|
941
|
+
|
|
942
|
+
// Code points in `str`: a surrogate pair counts once, a lone surrogate as itself. Hand-rolled because the string iterator allocates and runs ~250x slower on this path; the regex probe exits ~50x quicker for a string with no astral characters.
|
|
943
|
+
export function codePointLength(str: string): number {
|
|
944
|
+
const units = str.length;
|
|
945
|
+
if (!highSurrogate.test(str)) return units;
|
|
946
|
+
let count = units;
|
|
947
|
+
for (let i = 0; i < units - 1; i++) {
|
|
948
|
+
if ((str.charCodeAt(i) & 0xfc00) === 0xd800 && (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {
|
|
949
|
+
count--;
|
|
950
|
+
i++;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
return count;
|
|
954
|
+
}
|
|
955
|
+
|
|
879
956
|
export function getLengthableOrigin(input: any): "array" | "string" | "unknown" {
|
|
880
957
|
if (Array.isArray(input)) return "array";
|
|
881
958
|
if (typeof input === "string") return "string";
|
|
@@ -981,3 +1058,152 @@ export function uint8ArrayToHex(bytes: Uint8Array): string {
|
|
|
981
1058
|
export abstract class Class {
|
|
982
1059
|
constructor(..._args: any[]) {}
|
|
983
1060
|
}
|
|
1061
|
+
|
|
1062
|
+
////////// PROTOTYPE INSTALLERS //////////
|
|
1063
|
+
//
|
|
1064
|
+
// Members live on the prototype and materialize per instance on first read, which keeps own-property count under the step where V8 stops using inline slots. Changing anything here means re-measuring runtime, memory and bundle size together — see "The three axes" in AGENTS.md.
|
|
1065
|
+
|
|
1066
|
+
/**
|
|
1067
|
+
* Installs a trait's members on its prototype. Each value builds that member for the instance on first read; the built value shadows the accessor as an own property, so a detached `const { parse } = schema` keeps working.
|
|
1068
|
+
*
|
|
1069
|
+
* Call this from a `proto` initializer, which runs once per prototype — never per instance.
|
|
1070
|
+
*/
|
|
1071
|
+
export function members(proto: object, table: object): void {
|
|
1072
|
+
for (const key in table) {
|
|
1073
|
+
const desc = Object.getOwnPropertyDescriptor(table, key)!;
|
|
1074
|
+
// a getter installs as written, so it stays live: `description` reads through to the registry on every access. not enumerable: an object literal's is, and a prototype member never was
|
|
1075
|
+
if (desc.get) Object.defineProperty(proto, key, { ...desc, enumerable: false });
|
|
1076
|
+
// a method materializes bound on first read, which is what keeps a detached member working: `const opt = schema.optional; opt()`
|
|
1077
|
+
else defineBound(proto, key, desc.value);
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
/** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
|
|
1082
|
+
export function own<T>(inst: object, key: string, value: T, enumerable = true): T {
|
|
1083
|
+
Object.defineProperty(inst, key, { configurable: true, writable: true, enumerable, value });
|
|
1084
|
+
return value;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
/** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
|
|
1088
|
+
export function hide<T>(inst: object, key: string, value: T): T {
|
|
1089
|
+
return own(inst, key, value, false);
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
function defineBound(proto: object, key: string, fn: AnyFunc): void {
|
|
1093
|
+
Object.defineProperty(proto, key, {
|
|
1094
|
+
configurable: true,
|
|
1095
|
+
get(this: any) {
|
|
1096
|
+
// vitest's spyOn calls a prototype getter bare to find the function it wraps, so a nullish receiver answers the raw method
|
|
1097
|
+
return this == null ? fn : own(this, key, fn.bind(this));
|
|
1098
|
+
},
|
|
1099
|
+
set(this: any, value: unknown) {
|
|
1100
|
+
own(this, key, value);
|
|
1101
|
+
},
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
/** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
|
|
1106
|
+
function claim(inst: object, sentinel: string): object | undefined {
|
|
1107
|
+
const proto = Object.getPrototypeOf(inst);
|
|
1108
|
+
// Runs on every construction, so `in` rather than the costlier `hasOwnProperty.call`. Sentinels are keys the group itself defines.
|
|
1109
|
+
return sentinel in proto ? undefined : proto;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
/** A trait's prototype members: a partial view of its own interface, with `this` typed as the instance. */
|
|
1113
|
+
export type ProtoOf<T> = {
|
|
1114
|
+
// `infer R` resolves a polymorphic `this` return type to `T`, which a method written here can actually produce
|
|
1115
|
+
[K in keyof T]?: (T[K] extends (...args: infer A) => infer R ? (...args: A) => R : T[K]) | undefined;
|
|
1116
|
+
} & ThisType<T>;
|
|
1117
|
+
|
|
1118
|
+
// The internals whose init chain is installing. A second call for the same one is a derived constructor overriding its base, so it must not construct another schema in between or the override is dropped.
|
|
1119
|
+
let installing: object | undefined;
|
|
1120
|
+
|
|
1121
|
+
// Set while a getter is running, so a value that resolved through a recursion break is not memoized. One shared descriptor shadows the key for the duration, which costs no per-key allocation.
|
|
1122
|
+
let broke = false;
|
|
1123
|
+
const breaker: PropertyDescriptor = {
|
|
1124
|
+
configurable: true,
|
|
1125
|
+
get() {
|
|
1126
|
+
broke = true;
|
|
1127
|
+
return undefined;
|
|
1128
|
+
},
|
|
1129
|
+
};
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
|
|
1133
|
+
* constructor, computed from the internals object itself and cached there on
|
|
1134
|
+
* first read. One accessor per constructor rather than one per instance.
|
|
1135
|
+
*/
|
|
1136
|
+
export function defineLazyInternal<T extends { _zod: any }>(
|
|
1137
|
+
inst: T,
|
|
1138
|
+
key: string,
|
|
1139
|
+
compute: (zod: T["_zod"]) => unknown
|
|
1140
|
+
): void {
|
|
1141
|
+
const proto = Object.getPrototypeOf(inst._zod);
|
|
1142
|
+
if (key in proto && installing !== inst._zod) {
|
|
1143
|
+
// A repeat construction: everything is installed already. Cleared here so the reference is not held past the first construction of every type.
|
|
1144
|
+
installing = undefined;
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
installing = inst._zod;
|
|
1148
|
+
|
|
1149
|
+
Object.defineProperty(proto, key, {
|
|
1150
|
+
configurable: true,
|
|
1151
|
+
get(this: any) {
|
|
1152
|
+
// Shadowed before computing so a re-entrant read from a recursive schema resolves to undefined instead of running the getter again.
|
|
1153
|
+
Object.defineProperty(this, key, breaker);
|
|
1154
|
+
const outer = broke;
|
|
1155
|
+
broke = false;
|
|
1156
|
+
try {
|
|
1157
|
+
const value = compute(this);
|
|
1158
|
+
// A result that resolved through a recursion break is recomputed once the graph is complete; everything else memoizes, undefined included.
|
|
1159
|
+
if (broke) delete this[key];
|
|
1160
|
+
else Object.defineProperty(this, key, { configurable: true, writable: true, value });
|
|
1161
|
+
broke = broke || outer;
|
|
1162
|
+
return value;
|
|
1163
|
+
} catch (err) {
|
|
1164
|
+
// A compute that threw memoizes nothing, so a later read runs it again and fails the same way. The shadow goes with it, since leaving it installed would answer undefined for every later read.
|
|
1165
|
+
delete this[key];
|
|
1166
|
+
broke = broke || outer;
|
|
1167
|
+
throw err;
|
|
1168
|
+
}
|
|
1169
|
+
},
|
|
1170
|
+
set(this: any, value: unknown) {
|
|
1171
|
+
Object.defineProperty(this, key, { configurable: true, writable: true, value });
|
|
1172
|
+
},
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
|
|
1178
|
+
* data property. One accessor per constructor rather than one per instance, because an own accessor
|
|
1179
|
+
* puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
|
|
1180
|
+
*/
|
|
1181
|
+
export function installLazyProp(inst: object, key: string, make: (self: any) => unknown, enumerable: boolean): void {
|
|
1182
|
+
const proto = claim(inst, key);
|
|
1183
|
+
if (!proto) return;
|
|
1184
|
+
Object.defineProperty(proto, key, {
|
|
1185
|
+
configurable: true,
|
|
1186
|
+
get(this: any) {
|
|
1187
|
+
// Shadowed before computing, so a re-entrant read from a self-referential shape resolves to undefined instead of running the getter again. A data property rather than an accessor: an own accessor is the dictionary-mode transition this exists to avoid.
|
|
1188
|
+
const desc = { configurable: true, writable: true, enumerable, value: undefined as unknown };
|
|
1189
|
+
Object.defineProperty(this, key, desc);
|
|
1190
|
+
// a compute that throws leaves the shadow behind, so later reads answer undefined instead of re-throwing; `defineLazy` did the same, and `defineLazyInternal`'s delete-on-catch would cost bytes in every bundle for a case only a throwing user getter reaches
|
|
1191
|
+
desc.value = make(this);
|
|
1192
|
+
Object.defineProperty(this, key, desc);
|
|
1193
|
+
return desc.value;
|
|
1194
|
+
},
|
|
1195
|
+
set(this: any, value: unknown) {
|
|
1196
|
+
Object.defineProperty(this, key, { configurable: true, writable: true, enumerable, value });
|
|
1197
|
+
},
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
/** Marks the thunk `_catch` synthesises for a constant catch value. `Function.length` cannot tell that thunk from a user callback — rest and defaulted parameters both report arity 0 — and a user callback reads `ctx.error`, whose issues only finalize correctly against the caller's per-parse error map. Provenance can say what arity cannot. A plain string key rather than `Symbol.for`, whose call at module scope no bundler can prove pure — the same shape that anchored `urlCanParse` into every build. */
|
|
1202
|
+
export const CONSTANT_CATCH = "~constantCatch";
|
|
1203
|
+
|
|
1204
|
+
/** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
|
|
1205
|
+
export function constantCatch<T>(value: T): () => T {
|
|
1206
|
+
const fn = () => value;
|
|
1207
|
+
(fn as { [CONSTANT_CATCH]?: boolean })[CONSTANT_CATCH] = true;
|
|
1208
|
+
return fn;
|
|
1209
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// Traversal pattern adapted from Jaen's v3 `mapOnSchema` (Apache-2.0): https://gist.github.com/jaens/7e15ae1984bb338c86eb5e452dee3010
|
|
2
|
+
|
|
3
|
+
import * as schemas from "./schemas.js";
|
|
4
|
+
import { clone } from "./util.js";
|
|
5
|
+
|
|
6
|
+
const RESOLVING: unique symbol = Symbol("z.visit/resolving");
|
|
7
|
+
type Resolving = typeof RESOLVING;
|
|
8
|
+
|
|
9
|
+
type AnyZod = schemas.$ZodType;
|
|
10
|
+
type Kind = schemas.$ZodTypeDef["type"];
|
|
11
|
+
|
|
12
|
+
/** The concrete schema class for a `def.type`, or `$ZodType` for kinds with no dedicated class. */
|
|
13
|
+
type SchemaOfKind<K extends Kind> = [Extract<schemas.$ZodTypes, { _zod: { def: { type: K } } }>] extends [never]
|
|
14
|
+
? AnyZod
|
|
15
|
+
: Extract<schemas.$ZodTypes, { _zod: { def: { type: K } } }>;
|
|
16
|
+
|
|
17
|
+
export type VisitFn = (node: AnyZod, rewritten: boolean) => AnyZod;
|
|
18
|
+
export type VisitHandlers = { [K in Kind]?: (node: SchemaOfKind<K>, rewritten: boolean) => AnyZod };
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @internal Bottom-up rewrite of a schema tree. Unhandled kinds and unchanged branches keep their
|
|
22
|
+
* identity. Returns `$ZodType`: a visitor can swap in a schema of any type, so callers declare
|
|
23
|
+
* their own return type. `rewritten` tells a handler whether the traversal replaced anything
|
|
24
|
+
* below the node it is looking at.
|
|
25
|
+
*/
|
|
26
|
+
export function visit(schema: schemas.SomeType, fn: VisitFn): AnyZod;
|
|
27
|
+
export function visit(schema: schemas.SomeType, handlers: VisitHandlers): AnyZod;
|
|
28
|
+
export function visit(schema: schemas.SomeType, fnOrHandlers: VisitFn | VisitHandlers): AnyZod {
|
|
29
|
+
const fn: VisitFn =
|
|
30
|
+
typeof fnOrHandlers === "function"
|
|
31
|
+
? fnOrHandlers
|
|
32
|
+
: (node, rewritten) => {
|
|
33
|
+
// A union of handlers isn't callable with one argument; handler `K` only ever sees kind `K`.
|
|
34
|
+
const h = (fnOrHandlers as VisitHandlers)[node._zod.def.type] as
|
|
35
|
+
| ((n: AnyZod, rewritten: boolean) => AnyZod)
|
|
36
|
+
| undefined;
|
|
37
|
+
return h ? h(node, rewritten) : node;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const cache = new Map<AnyZod, AnyZod | Resolving>();
|
|
41
|
+
|
|
42
|
+
function run(s: AnyZod): AnyZod {
|
|
43
|
+
const cached = cache.get(s);
|
|
44
|
+
if (cached === RESOLVING) {
|
|
45
|
+
// Non-lazy cycle. Defer to parse time, when the cache holds the finished node.
|
|
46
|
+
return new schemas.$ZodLazy({
|
|
47
|
+
type: "lazy",
|
|
48
|
+
getter: () => cache.get(s) as AnyZod,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (cached !== undefined) return cached;
|
|
52
|
+
cache.set(s, RESOLVING);
|
|
53
|
+
const inner = mapInner(s);
|
|
54
|
+
const mapped = fn(inner, inner !== s);
|
|
55
|
+
cache.set(s, mapped);
|
|
56
|
+
return mapped;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function mapInner(s: AnyZod): AnyZod {
|
|
60
|
+
const def = s._zod.def as any;
|
|
61
|
+
const kind = def.type as Kind;
|
|
62
|
+
switch (kind) {
|
|
63
|
+
case "object": {
|
|
64
|
+
const oldShape = def.shape as Record<string, AnyZod>;
|
|
65
|
+
const keys = Object.keys(oldShape);
|
|
66
|
+
let changed = false;
|
|
67
|
+
const newShape: Record<string, AnyZod> = {};
|
|
68
|
+
for (const k of keys) {
|
|
69
|
+
const mapped = run(oldShape[k]!);
|
|
70
|
+
if (mapped !== oldShape[k]) changed = true;
|
|
71
|
+
newShape[k] = mapped;
|
|
72
|
+
}
|
|
73
|
+
let newCatchall = def.catchall;
|
|
74
|
+
if (def.catchall) {
|
|
75
|
+
newCatchall = run(def.catchall);
|
|
76
|
+
if (newCatchall !== def.catchall) changed = true;
|
|
77
|
+
}
|
|
78
|
+
return changed ? clone(s, { ...def, shape: newShape, catchall: newCatchall }) : s;
|
|
79
|
+
}
|
|
80
|
+
case "array": {
|
|
81
|
+
const mapped = run(def.element);
|
|
82
|
+
return mapped === def.element ? s : clone(s, { ...def, element: mapped });
|
|
83
|
+
}
|
|
84
|
+
case "tuple": {
|
|
85
|
+
const oldItems = def.items as AnyZod[];
|
|
86
|
+
let changed = false;
|
|
87
|
+
const newItems: AnyZod[] = [];
|
|
88
|
+
for (const item of oldItems) {
|
|
89
|
+
const mapped = run(item);
|
|
90
|
+
if (mapped !== item) changed = true;
|
|
91
|
+
newItems.push(mapped);
|
|
92
|
+
}
|
|
93
|
+
let newRest = def.rest;
|
|
94
|
+
if (def.rest) {
|
|
95
|
+
newRest = run(def.rest);
|
|
96
|
+
if (newRest !== def.rest) changed = true;
|
|
97
|
+
}
|
|
98
|
+
return changed ? clone(s, { ...def, items: newItems, rest: newRest }) : s;
|
|
99
|
+
}
|
|
100
|
+
case "record":
|
|
101
|
+
case "map": {
|
|
102
|
+
const newKey = run(def.keyType);
|
|
103
|
+
const newVal = run(def.valueType);
|
|
104
|
+
return newKey === def.keyType && newVal === def.valueType
|
|
105
|
+
? s
|
|
106
|
+
: clone(s, { ...def, keyType: newKey, valueType: newVal });
|
|
107
|
+
}
|
|
108
|
+
case "set": {
|
|
109
|
+
const newVal = run(def.valueType);
|
|
110
|
+
return newVal === def.valueType ? s : clone(s, { ...def, valueType: newVal });
|
|
111
|
+
}
|
|
112
|
+
case "union": {
|
|
113
|
+
const oldOptions = def.options as AnyZod[];
|
|
114
|
+
let changed = false;
|
|
115
|
+
const newOptions: AnyZod[] = [];
|
|
116
|
+
for (const opt of oldOptions) {
|
|
117
|
+
const mapped = run(opt);
|
|
118
|
+
if (mapped !== opt) changed = true;
|
|
119
|
+
newOptions.push(mapped);
|
|
120
|
+
}
|
|
121
|
+
return changed ? clone(s, { ...def, options: newOptions }) : s;
|
|
122
|
+
}
|
|
123
|
+
case "intersection": {
|
|
124
|
+
const newLeft = run(def.left);
|
|
125
|
+
const newRight = run(def.right);
|
|
126
|
+
return newLeft === def.left && newRight === def.right
|
|
127
|
+
? s
|
|
128
|
+
: clone(s, { ...def, left: newLeft, right: newRight });
|
|
129
|
+
}
|
|
130
|
+
case "optional":
|
|
131
|
+
case "nullable":
|
|
132
|
+
case "default":
|
|
133
|
+
case "prefault":
|
|
134
|
+
case "catch":
|
|
135
|
+
case "readonly":
|
|
136
|
+
case "nonoptional":
|
|
137
|
+
case "promise":
|
|
138
|
+
case "success": {
|
|
139
|
+
const newInner = run(def.innerType);
|
|
140
|
+
return newInner === def.innerType ? s : clone(s, { ...def, innerType: newInner });
|
|
141
|
+
}
|
|
142
|
+
case "pipe": {
|
|
143
|
+
const newIn = run(def.in);
|
|
144
|
+
const newOut = run(def.out);
|
|
145
|
+
return newIn === def.in && newOut === def.out ? s : clone(s, { ...def, in: newIn, out: newOut });
|
|
146
|
+
}
|
|
147
|
+
case "function": {
|
|
148
|
+
const newInput = run(def.input);
|
|
149
|
+
const newOutput = run(def.output);
|
|
150
|
+
return newInput === def.input && newOutput === def.output
|
|
151
|
+
? s
|
|
152
|
+
: clone(s, { ...def, input: newInput, output: newOutput });
|
|
153
|
+
}
|
|
154
|
+
case "lazy": {
|
|
155
|
+
// Invoking the getter here would trip the cycle check, so lazy nodes always re-clone.
|
|
156
|
+
const original = def.getter as () => AnyZod;
|
|
157
|
+
// Drop the memo, or it shadows the new getter forever.
|
|
158
|
+
const { _cachedInner, ...rest } = def;
|
|
159
|
+
return clone(s, { ...rest, getter: () => run(original()) });
|
|
160
|
+
}
|
|
161
|
+
// A leaf by choice: `parts` are regex fragments, not data positions.
|
|
162
|
+
case "template_literal":
|
|
163
|
+
// Leaves.
|
|
164
|
+
case "string":
|
|
165
|
+
case "number":
|
|
166
|
+
case "int":
|
|
167
|
+
case "boolean":
|
|
168
|
+
case "bigint":
|
|
169
|
+
case "symbol":
|
|
170
|
+
case "undefined":
|
|
171
|
+
case "null":
|
|
172
|
+
case "void":
|
|
173
|
+
case "never":
|
|
174
|
+
case "any":
|
|
175
|
+
case "unknown":
|
|
176
|
+
case "date":
|
|
177
|
+
case "nan":
|
|
178
|
+
case "enum":
|
|
179
|
+
case "literal":
|
|
180
|
+
case "file":
|
|
181
|
+
case "transform":
|
|
182
|
+
case "custom":
|
|
183
|
+
return s;
|
|
184
|
+
default: {
|
|
185
|
+
// A new built-in kind becomes a compile error here; unknown user kinds fall through.
|
|
186
|
+
kind satisfies never;
|
|
187
|
+
return s;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return run(schema as AnyZod);
|
|
193
|
+
}
|