@openclaw/feishu 2026.9.4 → 2026.9.6

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.
Files changed (796) hide show
  1. package/assets/activity.svg +3 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/{accounts-cCMNFBKg.js → .setup/accounts-DmU0xYPx.mjs} +1 -1
  4. package/dist/{app-registration-BI99e_JI.js → .setup/app-registration-Bv4mvauR.mjs} +1 -1
  5. package/dist/{channel-HDnQAH4Z.js → .setup/channel-DsndN1sp.mjs} +93 -86
  6. package/dist/{channel.runtime-B-f6ajOp.js → .setup/channel.runtime-tihKUwVI.mjs} +32 -18
  7. package/dist/{chat-zhIPXu4X.js → .setup/chat-BlvUjdN9.mjs} +2 -2
  8. package/dist/{client-DMbIL3UH.js → .setup/client-DCwNVFZg.mjs} +128 -11
  9. package/dist/{conversation-id-VYgGQ-GX.js → .setup/conversation-id-H-lUayji.mjs} +49 -14
  10. package/dist/{monitor-EuNsFn2T.js → .setup/monitor-OTT7VckU.mjs} +7 -6
  11. package/dist/{monitor.account-CZ7EtqYS.js → .setup/monitor.account-D5j6WomE.mjs} +297 -127
  12. package/dist/{probe-D_SatdZl.js → .setup/probe-bdidyhAn.mjs} +2 -2
  13. package/dist/{reply-delivery-result-C3smdVzb.js → .setup/reply-delivery-result-CRIHpSze.mjs} +136 -118
  14. package/dist/.setup/runtime-setter-api-CG-RC4_r.mjs +3 -0
  15. package/dist/.setup/secret-contract-api-jmCkqVLc.mjs +3 -0
  16. package/dist/{security-audit-DKfR4Cv3.js → .setup/security-audit-CmiKKfU-.mjs} +1 -1
  17. package/dist/{session-conversation-DFCIvQK-.js → .setup/session-conversation-ZC6TC1zk.mjs} +1 -1
  18. package/dist/.setup/setup-api-VAUkwtTi.mjs +3 -0
  19. package/dist/{subagent-hooks-Buadpie_.js → .setup/subagent-hooks-BBfF1hZk.mjs} +3 -19
  20. package/dist/api.js +29 -15
  21. package/dist/channel-plugin-api.js +1 -1
  22. package/dist/contract-api.js +3 -3
  23. package/dist/doctor-contract-api.js +1 -1
  24. package/dist/runtime-api.js +1 -1
  25. package/dist/runtime-setter-api.js +1 -1
  26. package/dist/secret-contract-api.js +1 -1
  27. package/dist/security-contract-api.js +1 -1
  28. package/dist/session-binding-contract-api.js +1 -1
  29. package/dist/session-key-api.js +1 -1
  30. package/dist/setup-api.js +1 -1
  31. package/dist/setup-entry.js +4 -3
  32. package/dist/subagent-hooks-api.js +1 -1
  33. package/node_modules/@larksuiteoapi/node-sdk/es/index.js +199 -35
  34. package/node_modules/@larksuiteoapi/node-sdk/lib/index.js +199 -35
  35. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/CHANGELOG.md +62 -0
  36. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/README.md +233 -5
  37. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/axios.js +387 -89
  38. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/axios.min.js +3 -3
  39. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/axios.min.js.map +1 -1
  40. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/browser/axios.cjs +458 -98
  41. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/esm/axios.js +458 -98
  42. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/esm/axios.min.js +2 -2
  43. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  44. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/dist/node/axios.cjs +568 -116
  45. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/index.d.cts +4 -0
  46. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/index.d.ts +4 -0
  47. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/adapters/fetch.js +64 -11
  48. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/adapters/http.js +134 -50
  49. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/adapters/xhr.js +52 -3
  50. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/Axios.js +19 -14
  51. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/InterceptorManager.js +107 -8
  52. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/buildFullPath.js +1 -13
  53. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/dispatchRequest.js +8 -2
  54. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/mergeConfig.js +1 -1
  55. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/methodList.js +17 -0
  56. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/defaults/index.js +2 -1
  57. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/env/data.js +1 -1
  58. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/Http2Sessions.js +2 -0
  59. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/HttpStatusCode.js +11 -1
  60. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/fromDataURI.js +5 -4
  61. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
  62. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/progressEventReducer.js +1 -1
  63. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/resolveConfig.js +4 -2
  64. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/shouldBypassProxy.js +182 -6
  65. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/throttle.js +3 -2
  66. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/toFormData.js +14 -21
  67. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/utils.js +134 -13
  68. package/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/package.json +1 -1
  69. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/README.md +24 -17
  70. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/light/protobuf.js +124 -14
  71. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  72. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  73. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  74. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/minimal/protobuf.js +63 -9
  75. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
  76. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
  77. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
  78. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/protobuf.js +133 -18
  79. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  80. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  81. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  82. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/ext/descriptor.generated.d.ts +7 -0
  83. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/ext/descriptor.js +24 -0
  84. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/ext/protojson.js +14 -4
  85. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/ext/textformat.js +8 -4
  86. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/google/protobuf/descriptor.json +20 -1
  87. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/google/protobuf/descriptor.proto +14 -1
  88. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/index.d.ts +12 -0
  89. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/package.json +1 -1
  90. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/src/decoder.js +31 -2
  91. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/src/enum.js +10 -0
  92. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/src/object.js +5 -2
  93. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/src/parse.js +9 -4
  94. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/src/reader.js +61 -7
  95. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/src/type.js +10 -0
  96. package/node_modules/@larksuiteoapi/node-sdk/node_modules/protobufjs/src/wrappers.js +5 -1
  97. package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/.github/THREAT_MODEL.md +3 -3
  98. package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/CHANGELOG.md +15 -0
  99. package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/README.md +19 -1
  100. package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/dist/qs.js +21 -21
  101. package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/eslint.config.mjs +1 -1
  102. package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/lib/parse.js +3 -4
  103. package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/lib/stringify.js +23 -8
  104. package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/lib/utils.js +10 -3
  105. package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/package.json +4 -4
  106. package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/test/parse.js +192 -3
  107. package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/test/stringify.js +317 -0
  108. package/node_modules/@larksuiteoapi/node-sdk/node_modules/qs/test/utils.js +12 -0
  109. package/node_modules/@larksuiteoapi/node-sdk/package.json +1 -1
  110. package/node_modules/@larksuiteoapi/node-sdk/types/index.d.ts +35 -0
  111. package/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.d.ts +13 -0
  112. package/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.d.ts.map +1 -1
  113. package/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.js +35 -16
  114. package/node_modules/micromark-extension-gfm-table/dev/lib/html.js +5 -0
  115. package/node_modules/micromark-extension-gfm-table/dev/lib/syntax.js +26 -3
  116. package/node_modules/micromark-extension-gfm-table/lib/edit-map.d.ts +13 -0
  117. package/node_modules/micromark-extension-gfm-table/lib/edit-map.d.ts.map +1 -1
  118. package/node_modules/micromark-extension-gfm-table/lib/edit-map.js +37 -17
  119. package/node_modules/micromark-extension-gfm-table/lib/html.js +5 -0
  120. package/node_modules/micromark-extension-gfm-table/lib/syntax.js +29 -2
  121. package/node_modules/micromark-extension-gfm-table/package.json +6 -48
  122. package/node_modules/micromark-extension-gfm-table/readme.md +40 -40
  123. package/node_modules/typebox/build/compile/validator.d.mts +1 -1
  124. package/node_modules/typebox/build/compile/validator.mjs +1 -1
  125. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +7 -5
  126. package/node_modules/typebox/build/format/iri.mjs +5 -1
  127. package/node_modules/typebox/build/guard/emit.mjs +2 -4
  128. package/node_modules/typebox/build/guard/guard.mjs +6 -18
  129. package/node_modules/typebox/build/guard/string.mjs +16 -24
  130. package/node_modules/typebox/build/schema/build.mjs +2 -2
  131. package/node_modules/typebox/build/schema/check.mjs +1 -1
  132. package/node_modules/typebox/build/schema/compile.d.mts +3 -2
  133. package/node_modules/typebox/build/schema/compile.mjs +8 -8
  134. package/node_modules/typebox/build/schema/engine/_context.d.mts +6 -7
  135. package/node_modules/typebox/build/schema/engine/_context.mjs +23 -15
  136. package/node_modules/typebox/build/schema/engine/_functions.d.mts +2 -2
  137. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
  138. package/node_modules/typebox/build/schema/engine/_reducer.d.mts +3 -3
  139. package/node_modules/typebox/build/schema/engine/_refine.d.mts +5 -5
  140. package/node_modules/typebox/build/schema/engine/_refine.mjs +4 -7
  141. package/node_modules/typebox/build/schema/engine/_stack.d.mts +34 -16
  142. package/node_modules/typebox/build/schema/engine/_stack.mjs +148 -104
  143. package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +4 -4
  144. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +8 -8
  145. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +26 -18
  146. package/node_modules/typebox/build/schema/engine/allOf.d.mts +4 -4
  147. package/node_modules/typebox/build/schema/engine/allOf.mjs +3 -3
  148. package/node_modules/typebox/build/schema/engine/anyOf.d.mts +4 -4
  149. package/node_modules/typebox/build/schema/engine/anyOf.mjs +5 -10
  150. package/node_modules/typebox/build/schema/engine/boolean.d.mts +4 -4
  151. package/node_modules/typebox/build/schema/engine/boolean.mjs +2 -6
  152. package/node_modules/typebox/build/schema/engine/const.d.mts +4 -4
  153. package/node_modules/typebox/build/schema/engine/const.mjs +2 -6
  154. package/node_modules/typebox/build/schema/engine/contains.d.mts +4 -4
  155. package/node_modules/typebox/build/schema/engine/contains.mjs +2 -6
  156. package/node_modules/typebox/build/schema/engine/dependencies.d.mts +4 -4
  157. package/node_modules/typebox/build/schema/engine/dependencies.mjs +3 -6
  158. package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +4 -4
  159. package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +2 -6
  160. package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +4 -4
  161. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +4 -4
  162. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +11 -7
  163. package/node_modules/typebox/build/schema/engine/enum.d.mts +4 -4
  164. package/node_modules/typebox/build/schema/engine/enum.mjs +2 -6
  165. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +4 -4
  166. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +2 -6
  167. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +4 -4
  168. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +2 -6
  169. package/node_modules/typebox/build/schema/engine/format.d.mts +4 -4
  170. package/node_modules/typebox/build/schema/engine/format.mjs +2 -6
  171. package/node_modules/typebox/build/schema/engine/if.d.mts +4 -4
  172. package/node_modules/typebox/build/schema/engine/if.mjs +7 -15
  173. package/node_modules/typebox/build/schema/engine/items.d.mts +4 -4
  174. package/node_modules/typebox/build/schema/engine/items.mjs +1 -1
  175. package/node_modules/typebox/build/schema/engine/maxContains.d.mts +4 -4
  176. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -6
  177. package/node_modules/typebox/build/schema/engine/maxItems.d.mts +4 -4
  178. package/node_modules/typebox/build/schema/engine/maxItems.mjs +2 -6
  179. package/node_modules/typebox/build/schema/engine/maxLength.d.mts +4 -4
  180. package/node_modules/typebox/build/schema/engine/maxLength.mjs +2 -6
  181. package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +4 -4
  182. package/node_modules/typebox/build/schema/engine/maxProperties.mjs +2 -6
  183. package/node_modules/typebox/build/schema/engine/maximum.d.mts +4 -4
  184. package/node_modules/typebox/build/schema/engine/maximum.mjs +2 -6
  185. package/node_modules/typebox/build/schema/engine/minContains.d.mts +4 -4
  186. package/node_modules/typebox/build/schema/engine/minContains.mjs +2 -6
  187. package/node_modules/typebox/build/schema/engine/minItems.d.mts +5 -5
  188. package/node_modules/typebox/build/schema/engine/minItems.mjs +2 -6
  189. package/node_modules/typebox/build/schema/engine/minLength.d.mts +4 -4
  190. package/node_modules/typebox/build/schema/engine/minLength.mjs +2 -6
  191. package/node_modules/typebox/build/schema/engine/minProperties.d.mts +4 -4
  192. package/node_modules/typebox/build/schema/engine/minProperties.mjs +2 -6
  193. package/node_modules/typebox/build/schema/engine/minimum.d.mts +4 -4
  194. package/node_modules/typebox/build/schema/engine/minimum.mjs +2 -6
  195. package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +4 -4
  196. package/node_modules/typebox/build/schema/engine/multipleOf.mjs +2 -6
  197. package/node_modules/typebox/build/schema/engine/not.d.mts +4 -4
  198. package/node_modules/typebox/build/schema/engine/not.mjs +4 -8
  199. package/node_modules/typebox/build/schema/engine/oneOf.d.mts +4 -4
  200. package/node_modules/typebox/build/schema/engine/oneOf.mjs +6 -11
  201. package/node_modules/typebox/build/schema/engine/pattern.d.mts +4 -4
  202. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -7
  203. package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +4 -4
  204. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +1 -1
  205. package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +4 -4
  206. package/node_modules/typebox/build/schema/engine/prefixItems.mjs +1 -1
  207. package/node_modules/typebox/build/schema/engine/properties.d.mts +4 -4
  208. package/node_modules/typebox/build/schema/engine/properties.mjs +1 -1
  209. package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +4 -4
  210. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +4 -10
  211. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +4 -4
  212. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +11 -7
  213. package/node_modules/typebox/build/schema/engine/ref.d.mts +4 -4
  214. package/node_modules/typebox/build/schema/engine/ref.mjs +19 -15
  215. package/node_modules/typebox/build/schema/engine/required.d.mts +4 -4
  216. package/node_modules/typebox/build/schema/engine/required.mjs +2 -6
  217. package/node_modules/typebox/build/schema/engine/schema.d.mts +7 -7
  218. package/node_modules/typebox/build/schema/engine/schema.mjs +137 -133
  219. package/node_modules/typebox/build/schema/engine/type.d.mts +4 -4
  220. package/node_modules/typebox/build/schema/engine/type.mjs +2 -6
  221. package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +4 -4
  222. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +5 -9
  223. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +4 -4
  224. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +5 -9
  225. package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +4 -4
  226. package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +2 -6
  227. package/node_modules/typebox/build/schema/errors.d.mts +2 -2
  228. package/node_modules/typebox/build/schema/errors.mjs +8 -14
  229. package/node_modules/typebox/build/schema/intern/index.d.mts +1 -0
  230. package/node_modules/typebox/build/schema/intern/index.mjs +1 -0
  231. package/node_modules/typebox/build/schema/intern/intern.d.mts +11 -0
  232. package/node_modules/typebox/build/schema/intern/intern.mjs +293 -0
  233. package/node_modules/typebox/build/schema/meta/draft_2019_09.d.mts +2 -0
  234. package/node_modules/typebox/build/schema/meta/draft_2019_09.mjs +288 -0
  235. package/node_modules/typebox/build/schema/meta/draft_2020_12.d.mts +2 -0
  236. package/node_modules/typebox/build/schema/meta/draft_2020_12.mjs +300 -0
  237. package/node_modules/typebox/build/schema/meta/draft_3.d.mts +2 -0
  238. package/node_modules/typebox/build/schema/meta/draft_3.mjs +143 -0
  239. package/node_modules/typebox/build/schema/meta/draft_4.d.mts +2 -0
  240. package/node_modules/typebox/build/schema/meta/draft_4.mjs +149 -0
  241. package/node_modules/typebox/build/schema/meta/draft_6.d.mts +2 -0
  242. package/node_modules/typebox/build/schema/meta/draft_6.mjs +155 -0
  243. package/node_modules/typebox/build/schema/meta/draft_7.d.mts +2 -0
  244. package/node_modules/typebox/build/schema/meta/draft_7.mjs +172 -0
  245. package/node_modules/typebox/build/schema/meta/index.d.mts +2 -0
  246. package/node_modules/typebox/build/schema/meta/index.mjs +2 -0
  247. package/node_modules/typebox/build/schema/meta/meta.d.mts +9 -0
  248. package/node_modules/typebox/build/schema/meta/meta.mjs +15 -0
  249. package/node_modules/typebox/build/schema/meta/schema.d.mts +6 -0
  250. package/node_modules/typebox/build/schema/meta/schema.mjs +1 -0
  251. package/node_modules/typebox/build/schema/parse.d.mts +1 -0
  252. package/node_modules/typebox/build/schema/parse.mjs +10 -5
  253. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +8 -3
  254. package/node_modules/typebox/build/schema/resolve/resolve.mjs +268 -139
  255. package/node_modules/typebox/build/schema/schema.d.mts +2 -0
  256. package/node_modules/typebox/build/schema/schema.mjs +2 -0
  257. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -12
  258. package/node_modules/typebox/build/value/errors/errors.mjs +2 -7
  259. package/node_modules/typebox/package.json +1 -1
  260. package/node_modules/typebox/readme.md +59 -89
  261. package/node_modules/zod/README.md +29 -2
  262. package/node_modules/zod/compile.cjs +96 -0
  263. package/node_modules/zod/compile.d.cts +1 -0
  264. package/node_modules/zod/compile.d.ts +1 -0
  265. package/node_modules/zod/compile.js +52 -0
  266. package/node_modules/zod/index.cjs +21 -2
  267. package/node_modules/zod/index.d.cts +1 -2
  268. package/node_modules/zod/index.d.ts +1 -2
  269. package/node_modules/zod/index.js +5 -2
  270. package/node_modules/zod/locales/index.cjs +19 -0
  271. package/node_modules/zod/mini/index.cjs +19 -0
  272. package/node_modules/zod/package.json +20 -8
  273. package/node_modules/zod/src/compile.ts +56 -0
  274. package/node_modules/zod/src/index.ts +5 -2
  275. package/node_modules/zod/src/v3/ZodError.ts +22 -12
  276. package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
  277. package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
  278. package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
  279. package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
  280. package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
  281. package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
  282. package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
  283. package/node_modules/zod/src/v3/types.ts +5 -5
  284. package/node_modules/zod/src/v4/classic/checks.ts +1 -0
  285. package/node_modules/zod/src/v4/classic/compat.ts +26 -18
  286. package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
  287. package/node_modules/zod/src/v4/classic/errors.ts +59 -44
  288. package/node_modules/zod/src/v4/classic/external.ts +14 -9
  289. package/node_modules/zod/src/v4/classic/from-json-schema.ts +363 -78
  290. package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
  291. package/node_modules/zod/src/v4/classic/index.ts +2 -2
  292. package/node_modules/zod/src/v4/classic/iso.ts +2 -72
  293. package/node_modules/zod/src/v4/classic/parse.ts +10 -4
  294. package/node_modules/zod/src/v4/classic/schemas.ts +640 -375
  295. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
  296. package/node_modules/zod/src/v4/classic/tests/array.test.ts +2 -2
  297. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +186 -0
  298. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +36 -1
  299. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
  300. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
  301. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
  302. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +3 -3
  303. package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
  304. package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
  305. package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
  306. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
  307. package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
  308. package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
  309. package/node_modules/zod/src/v4/classic/tests/default.test.ts +46 -0
  310. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
  311. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +261 -13
  312. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +20 -0
  313. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
  314. package/node_modules/zod/src/v4/classic/tests/error.test.ts +403 -6
  315. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +582 -10
  316. package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
  317. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
  318. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
  319. package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
  320. package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
  321. package/node_modules/zod/src/v4/classic/tests/index.test.ts +21 -2
  322. package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
  323. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +67 -0
  324. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
  325. package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
  326. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +3 -10
  327. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
  328. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
  329. package/node_modules/zod/src/v4/classic/tests/map.test.ts +12 -0
  330. package/node_modules/zod/src/v4/classic/tests/number.test.ts +85 -9
  331. package/node_modules/zod/src/v4/classic/tests/object.test.ts +301 -12
  332. package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
  333. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +49 -16
  334. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
  335. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
  336. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
  337. package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
  338. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
  339. package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
  340. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +79 -3
  341. package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
  342. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
  343. package/node_modules/zod/src/v4/classic/tests/set.test.ts +9 -0
  344. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
  345. package/node_modules/zod/src/v4/classic/tests/string.test.ts +222 -6
  346. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
  347. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +44 -3
  348. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1812 -204
  349. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
  350. package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
  351. package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
  352. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
  353. package/node_modules/zod/src/v4/core/api.ts +87 -35
  354. package/node_modules/zod/src/v4/core/checks.ts +119 -146
  355. package/node_modules/zod/src/v4/core/compile.ts +2313 -0
  356. package/node_modules/zod/src/v4/core/core.ts +99 -22
  357. package/node_modules/zod/src/v4/core/doc.ts +17 -9
  358. package/node_modules/zod/src/v4/core/errors.ts +113 -25
  359. package/node_modules/zod/src/v4/core/index.ts +3 -0
  360. package/node_modules/zod/src/v4/core/json-schema-generator.ts +8 -3
  361. package/node_modules/zod/src/v4/core/json-schema-processors.ts +424 -156
  362. package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
  363. package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
  364. package/node_modules/zod/src/v4/core/parse.ts +164 -50
  365. package/node_modules/zod/src/v4/core/regexes.ts +42 -15
  366. package/node_modules/zod/src/v4/core/registries.ts +2 -2
  367. package/node_modules/zod/src/v4/core/schemas.ts +1000 -538
  368. package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
  369. package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
  370. package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
  371. package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
  372. package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
  373. package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
  374. package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
  375. package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
  376. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
  377. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
  378. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
  379. package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
  380. package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
  381. package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
  382. package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
  383. package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
  384. package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
  385. package/node_modules/zod/src/v4/core/to-json-schema.ts +283 -48
  386. package/node_modules/zod/src/v4/core/util.ts +454 -157
  387. package/node_modules/zod/src/v4/core/versions.ts +2 -2
  388. package/node_modules/zod/src/v4/core/visit.ts +193 -0
  389. package/node_modules/zod/src/v4/index.ts +3 -3
  390. package/node_modules/zod/src/v4/locales/ar.ts +5 -0
  391. package/node_modules/zod/src/v4/locales/az.ts +5 -0
  392. package/node_modules/zod/src/v4/locales/be.ts +12 -0
  393. package/node_modules/zod/src/v4/locales/bg.ts +5 -0
  394. package/node_modules/zod/src/v4/locales/bn.ts +123 -0
  395. package/node_modules/zod/src/v4/locales/ca.ts +5 -0
  396. package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
  397. package/node_modules/zod/src/v4/locales/cs.ts +5 -0
  398. package/node_modules/zod/src/v4/locales/da.ts +7 -2
  399. package/node_modules/zod/src/v4/locales/de.ts +5 -0
  400. package/node_modules/zod/src/v4/locales/el.ts +3 -0
  401. package/node_modules/zod/src/v4/locales/en.ts +17 -4
  402. package/node_modules/zod/src/v4/locales/eo.ts +5 -0
  403. package/node_modules/zod/src/v4/locales/es.ts +4 -0
  404. package/node_modules/zod/src/v4/locales/fa.ts +5 -0
  405. package/node_modules/zod/src/v4/locales/fi.ts +5 -0
  406. package/node_modules/zod/src/v4/locales/fr-CA.ts +5 -0
  407. package/node_modules/zod/src/v4/locales/fr.ts +21 -14
  408. package/node_modules/zod/src/v4/locales/gu.ts +123 -0
  409. package/node_modules/zod/src/v4/locales/he.ts +8 -1
  410. package/node_modules/zod/src/v4/locales/hi.ts +126 -0
  411. package/node_modules/zod/src/v4/locales/hr.ts +4 -0
  412. package/node_modules/zod/src/v4/locales/hu.ts +5 -0
  413. package/node_modules/zod/src/v4/locales/hy.ts +11 -0
  414. package/node_modules/zod/src/v4/locales/id.ts +5 -0
  415. package/node_modules/zod/src/v4/locales/index.ts +11 -0
  416. package/node_modules/zod/src/v4/locales/is.ts +5 -0
  417. package/node_modules/zod/src/v4/locales/it.ts +5 -0
  418. package/node_modules/zod/src/v4/locales/ja.ts +5 -0
  419. package/node_modules/zod/src/v4/locales/ka.ts +5 -0
  420. package/node_modules/zod/src/v4/locales/km.ts +5 -0
  421. package/node_modules/zod/src/v4/locales/kn.ts +126 -0
  422. package/node_modules/zod/src/v4/locales/ko.ts +5 -0
  423. package/node_modules/zod/src/v4/locales/lt.ts +4 -0
  424. package/node_modules/zod/src/v4/locales/mk.ts +5 -0
  425. package/node_modules/zod/src/v4/locales/ms.ts +5 -0
  426. package/node_modules/zod/src/v4/locales/ne.ts +128 -0
  427. package/node_modules/zod/src/v4/locales/nl.ts +5 -0
  428. package/node_modules/zod/src/v4/locales/nn.ts +121 -0
  429. package/node_modules/zod/src/v4/locales/no.ts +7 -2
  430. package/node_modules/zod/src/v4/locales/ota.ts +5 -0
  431. package/node_modules/zod/src/v4/locales/pl.ts +5 -0
  432. package/node_modules/zod/src/v4/locales/ps.ts +5 -0
  433. package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
  434. package/node_modules/zod/src/v4/locales/pt.ts +101 -58
  435. package/node_modules/zod/src/v4/locales/ro.ts +3 -0
  436. package/node_modules/zod/src/v4/locales/ru.ts +12 -0
  437. package/node_modules/zod/src/v4/locales/sk.ts +123 -0
  438. package/node_modules/zod/src/v4/locales/sl.ts +5 -0
  439. package/node_modules/zod/src/v4/locales/sv.ts +7 -2
  440. package/node_modules/zod/src/v4/locales/ta.ts +5 -0
  441. package/node_modules/zod/src/v4/locales/tg.ts +135 -0
  442. package/node_modules/zod/src/v4/locales/th.ts +5 -0
  443. package/node_modules/zod/src/v4/locales/tk.ts +113 -0
  444. package/node_modules/zod/src/v4/locales/tr.ts +5 -0
  445. package/node_modules/zod/src/v4/locales/uk.ts +5 -0
  446. package/node_modules/zod/src/v4/locales/ur.ts +5 -0
  447. package/node_modules/zod/src/v4/locales/uz.ts +3 -0
  448. package/node_modules/zod/src/v4/locales/vi.ts +5 -0
  449. package/node_modules/zod/src/v4/locales/yo.ts +5 -0
  450. package/node_modules/zod/src/v4/locales/zh-CN.ts +5 -0
  451. package/node_modules/zod/src/v4/locales/zh-TW.ts +5 -0
  452. package/node_modules/zod/src/v4/mini/checks.ts +1 -0
  453. package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
  454. package/node_modules/zod/src/v4/mini/external.ts +12 -1
  455. package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
  456. package/node_modules/zod/src/v4/mini/parse.ts +2 -0
  457. package/node_modules/zod/src/v4/mini/schemas.ts +167 -63
  458. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
  459. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
  460. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
  461. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
  462. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
  463. package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
  464. package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
  465. package/node_modules/zod/src/v4/mini/tests/error.test.ts +23 -4
  466. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
  467. package/node_modules/zod/src/v4/mini/tests/index.test.ts +158 -5
  468. package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
  469. package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
  470. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
  471. package/node_modules/zod/src/v4/mini/tests/string.test.ts +44 -0
  472. package/node_modules/zod/v3/ZodError.cjs +41 -12
  473. package/node_modules/zod/v3/ZodError.d.cts +1 -1
  474. package/node_modules/zod/v3/ZodError.d.ts +1 -1
  475. package/node_modules/zod/v3/ZodError.js +22 -12
  476. package/node_modules/zod/v3/errors.cjs +19 -0
  477. package/node_modules/zod/v3/external.cjs +19 -0
  478. package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
  479. package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
  480. package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
  481. package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
  482. package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
  483. package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
  484. package/node_modules/zod/v3/helpers/util.cjs +19 -0
  485. package/node_modules/zod/v3/index.cjs +19 -0
  486. package/node_modules/zod/v3/standard-schema.cjs +19 -0
  487. package/node_modules/zod/v3/types.cjs +26 -5
  488. package/node_modules/zod/v3/types.js +7 -5
  489. package/node_modules/zod/v4/classic/checks.cjs +21 -1
  490. package/node_modules/zod/v4/classic/checks.d.cts +1 -1
  491. package/node_modules/zod/v4/classic/checks.d.ts +1 -1
  492. package/node_modules/zod/v4/classic/checks.js +1 -1
  493. package/node_modules/zod/v4/classic/coerce.cjs +19 -0
  494. package/node_modules/zod/v4/classic/compat.cjs +19 -0
  495. package/node_modules/zod/v4/classic/compat.d.cts +9 -11
  496. package/node_modules/zod/v4/classic/compat.d.ts +9 -11
  497. package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
  498. package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
  499. package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
  500. package/node_modules/zod/v4/classic/deep-partial.js +13 -0
  501. package/node_modules/zod/v4/classic/errors.cjs +62 -34
  502. package/node_modules/zod/v4/classic/errors.d.cts +3 -4
  503. package/node_modules/zod/v4/classic/errors.d.ts +3 -4
  504. package/node_modules/zod/v4/classic/errors.js +43 -34
  505. package/node_modules/zod/v4/classic/external.cjs +51 -27
  506. package/node_modules/zod/v4/classic/external.d.cts +5 -2
  507. package/node_modules/zod/v4/classic/external.d.ts +5 -2
  508. package/node_modules/zod/v4/classic/external.js +5 -8
  509. package/node_modules/zod/v4/classic/from-json-schema.cjs +376 -75
  510. package/node_modules/zod/v4/classic/from-json-schema.js +357 -75
  511. package/node_modules/zod/v4/classic/in-out.cjs +82 -0
  512. package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
  513. package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
  514. package/node_modules/zod/v4/classic/in-out.js +36 -0
  515. package/node_modules/zod/v4/classic/index.cjs +21 -2
  516. package/node_modules/zod/v4/classic/index.d.cts +1 -2
  517. package/node_modules/zod/v4/classic/index.d.ts +1 -2
  518. package/node_modules/zod/v4/classic/index.js +2 -2
  519. package/node_modules/zod/v4/classic/iso.cjs +30 -22
  520. package/node_modules/zod/v4/classic/iso.d.cts +2 -17
  521. package/node_modules/zod/v4/classic/iso.d.ts +2 -17
  522. package/node_modules/zod/v4/classic/iso.js +2 -17
  523. package/node_modules/zod/v4/classic/parse.cjs +23 -1
  524. package/node_modules/zod/v4/classic/parse.d.cts +17 -4
  525. package/node_modules/zod/v4/classic/parse.d.ts +17 -4
  526. package/node_modules/zod/v4/classic/parse.js +1 -0
  527. package/node_modules/zod/v4/classic/schemas.cjs +591 -426
  528. package/node_modules/zod/v4/classic/schemas.d.cts +68 -19
  529. package/node_modules/zod/v4/classic/schemas.d.ts +68 -19
  530. package/node_modules/zod/v4/classic/schemas.js +564 -424
  531. package/node_modules/zod/v4/core/api.cjs +66 -24
  532. package/node_modules/zod/v4/core/api.d.cts +22 -12
  533. package/node_modules/zod/v4/core/api.d.ts +22 -12
  534. package/node_modules/zod/v4/core/api.js +44 -24
  535. package/node_modules/zod/v4/core/checks.cjs +88 -128
  536. package/node_modules/zod/v4/core/checks.d.cts +29 -13
  537. package/node_modules/zod/v4/core/checks.d.ts +29 -13
  538. package/node_modules/zod/v4/core/checks.js +68 -127
  539. package/node_modules/zod/v4/core/compile.cjs +1908 -0
  540. package/node_modules/zod/v4/core/compile.d.cts +65 -0
  541. package/node_modules/zod/v4/core/compile.d.ts +65 -0
  542. package/node_modules/zod/v4/core/compile.js +1858 -0
  543. package/node_modules/zod/v4/core/core.cjs +101 -19
  544. package/node_modules/zod/v4/core/core.d.cts +16 -4
  545. package/node_modules/zod/v4/core/core.d.ts +16 -4
  546. package/node_modules/zod/v4/core/core.js +83 -20
  547. package/node_modules/zod/v4/core/doc.cjs +31 -9
  548. package/node_modules/zod/v4/core/doc.d.cts +3 -1
  549. package/node_modules/zod/v4/core/doc.d.ts +3 -1
  550. package/node_modules/zod/v4/core/doc.js +12 -9
  551. package/node_modules/zod/v4/core/errors.cjs +126 -25
  552. package/node_modules/zod/v4/core/errors.d.cts +4 -0
  553. package/node_modules/zod/v4/core/errors.d.ts +4 -0
  554. package/node_modules/zod/v4/core/errors.js +107 -25
  555. package/node_modules/zod/v4/core/index.cjs +24 -1
  556. package/node_modules/zod/v4/core/index.d.cts +3 -0
  557. package/node_modules/zod/v4/core/index.d.ts +3 -0
  558. package/node_modules/zod/v4/core/index.js +3 -0
  559. package/node_modules/zod/v4/core/json-schema-generator.cjs +24 -1
  560. package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
  561. package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
  562. package/node_modules/zod/v4/core/json-schema-generator.js +6 -2
  563. package/node_modules/zod/v4/core/json-schema-processors.cjs +441 -156
  564. package/node_modules/zod/v4/core/json-schema-processors.d.cts +16 -0
  565. package/node_modules/zod/v4/core/json-schema-processors.d.ts +16 -0
  566. package/node_modules/zod/v4/core/json-schema-processors.js +400 -158
  567. package/node_modules/zod/v4/core/json-schema.cjs +19 -0
  568. package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
  569. package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
  570. package/node_modules/zod/v4/core/memoizer.cjs +360 -0
  571. package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
  572. package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
  573. package/node_modules/zod/v4/core/memoizer.js +311 -0
  574. package/node_modules/zod/v4/core/parse.cjs +148 -46
  575. package/node_modules/zod/v4/core/parse.d.cts +14 -11
  576. package/node_modules/zod/v4/core/parse.d.ts +14 -11
  577. package/node_modules/zod/v4/core/parse.js +127 -45
  578. package/node_modules/zod/v4/core/regexes.cjs +54 -17
  579. package/node_modules/zod/v4/core/regexes.d.cts +5 -0
  580. package/node_modules/zod/v4/core/regexes.d.ts +5 -0
  581. package/node_modules/zod/v4/core/regexes.js +32 -15
  582. package/node_modules/zod/v4/core/registries.cjs +19 -0
  583. package/node_modules/zod/v4/core/registries.js +2 -2
  584. package/node_modules/zod/v4/core/schemas.cjs +785 -386
  585. package/node_modules/zod/v4/core/schemas.d.cts +123 -34
  586. package/node_modules/zod/v4/core/schemas.d.ts +123 -34
  587. package/node_modules/zod/v4/core/schemas.js +753 -386
  588. package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
  589. package/node_modules/zod/v4/core/to-json-schema.cjs +269 -45
  590. package/node_modules/zod/v4/core/to-json-schema.d.cts +45 -5
  591. package/node_modules/zod/v4/core/to-json-schema.d.ts +45 -5
  592. package/node_modules/zod/v4/core/to-json-schema.js +247 -44
  593. package/node_modules/zod/v4/core/util.cjs +372 -157
  594. package/node_modules/zod/v4/core/util.d.cts +79 -1
  595. package/node_modules/zod/v4/core/util.d.ts +79 -1
  596. package/node_modules/zod/v4/core/util.js +341 -156
  597. package/node_modules/zod/v4/core/versions.cjs +21 -2
  598. package/node_modules/zod/v4/core/versions.d.cts +1 -1
  599. package/node_modules/zod/v4/core/versions.d.ts +1 -1
  600. package/node_modules/zod/v4/core/versions.js +2 -2
  601. package/node_modules/zod/v4/core/visit.cjs +214 -0
  602. package/node_modules/zod/v4/core/visit.d.cts +30 -0
  603. package/node_modules/zod/v4/core/visit.d.ts +30 -0
  604. package/node_modules/zod/v4/core/visit.js +169 -0
  605. package/node_modules/zod/v4/index.cjs +34 -5
  606. package/node_modules/zod/v4/index.d.cts +2 -2
  607. package/node_modules/zod/v4/index.d.ts +2 -2
  608. package/node_modules/zod/v4/index.js +3 -2
  609. package/node_modules/zod/v4/locales/ar.cjs +5 -0
  610. package/node_modules/zod/v4/locales/ar.js +5 -0
  611. package/node_modules/zod/v4/locales/az.cjs +5 -0
  612. package/node_modules/zod/v4/locales/az.js +5 -0
  613. package/node_modules/zod/v4/locales/be.cjs +12 -0
  614. package/node_modules/zod/v4/locales/be.js +12 -0
  615. package/node_modules/zod/v4/locales/bg.cjs +5 -0
  616. package/node_modules/zod/v4/locales/bg.js +5 -0
  617. package/node_modules/zod/v4/locales/bn.cjs +140 -0
  618. package/node_modules/zod/v4/locales/bn.d.cts +5 -0
  619. package/node_modules/zod/v4/locales/bn.d.ts +4 -0
  620. package/node_modules/zod/v4/locales/bn.js +113 -0
  621. package/node_modules/zod/v4/locales/ca.cjs +5 -0
  622. package/node_modules/zod/v4/locales/ca.js +5 -0
  623. package/node_modules/zod/v4/locales/ckb.cjs +160 -0
  624. package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
  625. package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
  626. package/node_modules/zod/v4/locales/ckb.js +133 -0
  627. package/node_modules/zod/v4/locales/cs.cjs +5 -0
  628. package/node_modules/zod/v4/locales/cs.js +5 -0
  629. package/node_modules/zod/v4/locales/da.cjs +7 -2
  630. package/node_modules/zod/v4/locales/da.js +7 -2
  631. package/node_modules/zod/v4/locales/de.cjs +5 -0
  632. package/node_modules/zod/v4/locales/de.js +5 -0
  633. package/node_modules/zod/v4/locales/el.cjs +3 -0
  634. package/node_modules/zod/v4/locales/el.js +3 -0
  635. package/node_modules/zod/v4/locales/en.cjs +16 -4
  636. package/node_modules/zod/v4/locales/en.js +16 -4
  637. package/node_modules/zod/v4/locales/eo.cjs +5 -0
  638. package/node_modules/zod/v4/locales/eo.js +5 -0
  639. package/node_modules/zod/v4/locales/es.cjs +4 -0
  640. package/node_modules/zod/v4/locales/es.js +4 -0
  641. package/node_modules/zod/v4/locales/fa.cjs +5 -0
  642. package/node_modules/zod/v4/locales/fa.js +5 -0
  643. package/node_modules/zod/v4/locales/fi.cjs +5 -0
  644. package/node_modules/zod/v4/locales/fi.js +5 -0
  645. package/node_modules/zod/v4/locales/fr-CA.cjs +5 -0
  646. package/node_modules/zod/v4/locales/fr-CA.js +5 -0
  647. package/node_modules/zod/v4/locales/fr.cjs +18 -14
  648. package/node_modules/zod/v4/locales/fr.js +18 -14
  649. package/node_modules/zod/v4/locales/gu.cjs +140 -0
  650. package/node_modules/zod/v4/locales/gu.d.cts +5 -0
  651. package/node_modules/zod/v4/locales/gu.d.ts +4 -0
  652. package/node_modules/zod/v4/locales/gu.js +113 -0
  653. package/node_modules/zod/v4/locales/he.cjs +7 -0
  654. package/node_modules/zod/v4/locales/he.js +7 -0
  655. package/node_modules/zod/v4/locales/hi.cjs +138 -0
  656. package/node_modules/zod/v4/locales/hi.d.cts +5 -0
  657. package/node_modules/zod/v4/locales/hi.d.ts +4 -0
  658. package/node_modules/zod/v4/locales/hi.js +111 -0
  659. package/node_modules/zod/v4/locales/hr.cjs +4 -0
  660. package/node_modules/zod/v4/locales/hr.js +4 -0
  661. package/node_modules/zod/v4/locales/hu.cjs +5 -0
  662. package/node_modules/zod/v4/locales/hu.js +5 -0
  663. package/node_modules/zod/v4/locales/hy.cjs +11 -0
  664. package/node_modules/zod/v4/locales/hy.js +11 -0
  665. package/node_modules/zod/v4/locales/id.cjs +5 -0
  666. package/node_modules/zod/v4/locales/id.js +5 -0
  667. package/node_modules/zod/v4/locales/index.cjs +43 -2
  668. package/node_modules/zod/v4/locales/index.d.cts +11 -0
  669. package/node_modules/zod/v4/locales/index.d.ts +11 -0
  670. package/node_modules/zod/v4/locales/index.js +11 -0
  671. package/node_modules/zod/v4/locales/is.cjs +5 -0
  672. package/node_modules/zod/v4/locales/is.js +5 -0
  673. package/node_modules/zod/v4/locales/it.cjs +5 -0
  674. package/node_modules/zod/v4/locales/it.js +5 -0
  675. package/node_modules/zod/v4/locales/ja.cjs +5 -0
  676. package/node_modules/zod/v4/locales/ja.js +5 -0
  677. package/node_modules/zod/v4/locales/ka.cjs +5 -0
  678. package/node_modules/zod/v4/locales/ka.js +5 -0
  679. package/node_modules/zod/v4/locales/km.cjs +5 -0
  680. package/node_modules/zod/v4/locales/km.js +5 -0
  681. package/node_modules/zod/v4/locales/kn.cjs +143 -0
  682. package/node_modules/zod/v4/locales/kn.d.cts +5 -0
  683. package/node_modules/zod/v4/locales/kn.d.ts +4 -0
  684. package/node_modules/zod/v4/locales/kn.js +116 -0
  685. package/node_modules/zod/v4/locales/ko.cjs +5 -0
  686. package/node_modules/zod/v4/locales/ko.js +5 -0
  687. package/node_modules/zod/v4/locales/lt.cjs +4 -0
  688. package/node_modules/zod/v4/locales/lt.js +4 -0
  689. package/node_modules/zod/v4/locales/mk.cjs +5 -0
  690. package/node_modules/zod/v4/locales/mk.js +5 -0
  691. package/node_modules/zod/v4/locales/ms.cjs +5 -0
  692. package/node_modules/zod/v4/locales/ms.js +5 -0
  693. package/node_modules/zod/v4/locales/ne.cjs +138 -0
  694. package/node_modules/zod/v4/locales/ne.d.cts +5 -0
  695. package/node_modules/zod/v4/locales/ne.d.ts +4 -0
  696. package/node_modules/zod/v4/locales/ne.js +111 -0
  697. package/node_modules/zod/v4/locales/nl.cjs +5 -0
  698. package/node_modules/zod/v4/locales/nl.js +5 -0
  699. package/node_modules/zod/v4/locales/nn.cjs +140 -0
  700. package/node_modules/zod/v4/locales/nn.d.cts +5 -0
  701. package/node_modules/zod/v4/locales/nn.d.ts +4 -0
  702. package/node_modules/zod/v4/locales/nn.js +113 -0
  703. package/node_modules/zod/v4/locales/no.cjs +7 -2
  704. package/node_modules/zod/v4/locales/no.js +7 -2
  705. package/node_modules/zod/v4/locales/ota.cjs +5 -0
  706. package/node_modules/zod/v4/locales/ota.js +5 -0
  707. package/node_modules/zod/v4/locales/pl.cjs +5 -0
  708. package/node_modules/zod/v4/locales/pl.js +5 -0
  709. package/node_modules/zod/v4/locales/ps.cjs +5 -0
  710. package/node_modules/zod/v4/locales/ps.js +5 -0
  711. package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
  712. package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
  713. package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
  714. package/node_modules/zod/v4/locales/pt-BR.js +143 -0
  715. package/node_modules/zod/v4/locales/pt.cjs +89 -55
  716. package/node_modules/zod/v4/locales/pt.js +89 -55
  717. package/node_modules/zod/v4/locales/ro.cjs +3 -0
  718. package/node_modules/zod/v4/locales/ro.js +3 -0
  719. package/node_modules/zod/v4/locales/ru.cjs +12 -0
  720. package/node_modules/zod/v4/locales/ru.js +12 -0
  721. package/node_modules/zod/v4/locales/sk.cjs +143 -0
  722. package/node_modules/zod/v4/locales/sk.d.cts +5 -0
  723. package/node_modules/zod/v4/locales/sk.d.ts +4 -0
  724. package/node_modules/zod/v4/locales/sk.js +116 -0
  725. package/node_modules/zod/v4/locales/sl.cjs +5 -0
  726. package/node_modules/zod/v4/locales/sl.js +5 -0
  727. package/node_modules/zod/v4/locales/sv.cjs +7 -2
  728. package/node_modules/zod/v4/locales/sv.js +7 -2
  729. package/node_modules/zod/v4/locales/ta.cjs +5 -0
  730. package/node_modules/zod/v4/locales/ta.js +5 -0
  731. package/node_modules/zod/v4/locales/tg.cjs +144 -0
  732. package/node_modules/zod/v4/locales/tg.d.cts +5 -0
  733. package/node_modules/zod/v4/locales/tg.d.ts +4 -0
  734. package/node_modules/zod/v4/locales/tg.js +117 -0
  735. package/node_modules/zod/v4/locales/th.cjs +5 -0
  736. package/node_modules/zod/v4/locales/th.js +5 -0
  737. package/node_modules/zod/v4/locales/tk.cjs +134 -0
  738. package/node_modules/zod/v4/locales/tk.d.cts +5 -0
  739. package/node_modules/zod/v4/locales/tk.d.ts +4 -0
  740. package/node_modules/zod/v4/locales/tk.js +107 -0
  741. package/node_modules/zod/v4/locales/tr.cjs +5 -0
  742. package/node_modules/zod/v4/locales/tr.js +5 -0
  743. package/node_modules/zod/v4/locales/uk.cjs +5 -0
  744. package/node_modules/zod/v4/locales/uk.js +5 -0
  745. package/node_modules/zod/v4/locales/ur.cjs +5 -0
  746. package/node_modules/zod/v4/locales/ur.js +5 -0
  747. package/node_modules/zod/v4/locales/uz.cjs +3 -0
  748. package/node_modules/zod/v4/locales/uz.js +3 -0
  749. package/node_modules/zod/v4/locales/vi.cjs +5 -0
  750. package/node_modules/zod/v4/locales/vi.js +5 -0
  751. package/node_modules/zod/v4/locales/yo.cjs +5 -0
  752. package/node_modules/zod/v4/locales/yo.js +5 -0
  753. package/node_modules/zod/v4/locales/zh-CN.cjs +5 -0
  754. package/node_modules/zod/v4/locales/zh-CN.js +5 -0
  755. package/node_modules/zod/v4/locales/zh-TW.cjs +5 -0
  756. package/node_modules/zod/v4/locales/zh-TW.js +5 -0
  757. package/node_modules/zod/v4/mini/checks.cjs +21 -1
  758. package/node_modules/zod/v4/mini/checks.d.cts +1 -1
  759. package/node_modules/zod/v4/mini/checks.d.ts +1 -1
  760. package/node_modules/zod/v4/mini/checks.js +1 -1
  761. package/node_modules/zod/v4/mini/coerce.cjs +19 -0
  762. package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
  763. package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
  764. package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
  765. package/node_modules/zod/v4/mini/deep-partial.js +13 -0
  766. package/node_modules/zod/v4/mini/external.cjs +33 -1
  767. package/node_modules/zod/v4/mini/external.d.cts +5 -2
  768. package/node_modules/zod/v4/mini/external.d.ts +5 -2
  769. package/node_modules/zod/v4/mini/external.js +3 -1
  770. package/node_modules/zod/v4/mini/in-out.cjs +82 -0
  771. package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
  772. package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
  773. package/node_modules/zod/v4/mini/in-out.js +36 -0
  774. package/node_modules/zod/v4/mini/index.cjs +19 -0
  775. package/node_modules/zod/v4/mini/iso.cjs +19 -0
  776. package/node_modules/zod/v4/mini/parse.cjs +22 -1
  777. package/node_modules/zod/v4/mini/parse.d.cts +1 -1
  778. package/node_modules/zod/v4/mini/parse.d.ts +1 -1
  779. package/node_modules/zod/v4/mini/parse.js +1 -1
  780. package/node_modules/zod/v4/mini/schemas.cjs +117 -53
  781. package/node_modules/zod/v4/mini/schemas.d.cts +49 -14
  782. package/node_modules/zod/v4/mini/schemas.d.ts +49 -14
  783. package/node_modules/zod/v4/mini/schemas.js +92 -51
  784. package/node_modules/zod/v4-mini/index.cjs +19 -0
  785. package/openclaw.plugin.json +25 -58
  786. package/package.json +11 -8
  787. package/dist/targets-BTQCYRZQ.js +0 -48
  788. package/node_modules/zod/src/v4/core/config.ts +0 -15
  789. /package/dist/{audio-preflight.runtime-BBfC9elv.js → .setup/audio-preflight.runtime-BBfC9elv.mjs} +0 -0
  790. /package/dist/{doctor-contract-w6FpMypv.js → .setup/doctor-contract-w6FpMypv.mjs} +0 -0
  791. /package/dist/{json-response-DXajw_FU.js → .setup/json-response-DXajw_FU.mjs} +0 -0
  792. /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
  793. /package/dist/{runtime-C5JxBWZp.js → .setup/runtime-C5JxBWZp.mjs} +0 -0
  794. /package/dist/{secret-contract-BCpDLdg9.js → .setup/secret-contract-BCpDLdg9.mjs} +0 -0
  795. /package/dist/{security-audit-shared-CK5rVR-1.js → .setup/security-audit-shared-CK5rVR-1.mjs} +0 -0
  796. /package/dist/{thread-bindings-BiL1wGqK.js → .setup/thread-bindings-BiL1wGqK.mjs} +0 -0
@@ -0,0 +1,985 @@
1
+ import v8 from "node:v8";
2
+ import vm from "node:vm";
3
+ import { expect, test } from "vitest";
4
+ import * as z from "zod/v4";
5
+
6
+ test("parses a self-referential object and preserves identity", () => {
7
+ const Node: any = z.object({
8
+ id: z.number(),
9
+ get self() {
10
+ return Node;
11
+ },
12
+ });
13
+
14
+ const input: any = { id: 1 };
15
+ input.self = input;
16
+
17
+ const result = Node.parse(input);
18
+ expect(result.id).toBe(1);
19
+ expect(result.self).toBe(result);
20
+ expect(result).not.toBe(input);
21
+ });
22
+
23
+ test("validates a node against every schema that reaches it", () => {
24
+ const A: any = z.object({
25
+ x: z.string(),
26
+ get b() {
27
+ return B;
28
+ },
29
+ });
30
+ const B: any = z.object({
31
+ y: z.number(),
32
+ get a() {
33
+ return A;
34
+ },
35
+ });
36
+
37
+ const input: any = { x: "s", y: 1 };
38
+ input.b = input;
39
+ input.a = input;
40
+
41
+ const result = A.parse(input);
42
+ expect(Object.keys(result).sort()).toEqual(["b", "x"]);
43
+ expect(Object.keys(result.b).sort()).toEqual(["a", "y"]);
44
+ expect(result.b.y).toBe(1);
45
+ expect(result.b.a).toBe(result);
46
+
47
+ const bad: any = { x: "s", y: "not a number" };
48
+ bad.b = bad;
49
+ bad.a = bad;
50
+ expect(A.safeParse(bad).success).toBe(false);
51
+ });
52
+
53
+ test("breaks cycles through every container", () => {
54
+ const cases: [string, () => { schema: any; input: any }][] = [
55
+ [
56
+ "array",
57
+ () => {
58
+ const S: any = z.object({
59
+ id: z.number(),
60
+ get kids() {
61
+ return z.array(S);
62
+ },
63
+ });
64
+ const a: any = { id: 1, kids: [] };
65
+ a.kids.push(a);
66
+ return { schema: S, input: a };
67
+ },
68
+ ],
69
+ [
70
+ "record",
71
+ () => {
72
+ const S: any = z.object({
73
+ id: z.number(),
74
+ get kids() {
75
+ return z.record(z.string(), S);
76
+ },
77
+ });
78
+ const a: any = { id: 1, kids: {} };
79
+ a.kids.self = a;
80
+ return { schema: S, input: a };
81
+ },
82
+ ],
83
+ [
84
+ "tuple",
85
+ () => {
86
+ const S: any = z.object({
87
+ id: z.number(),
88
+ get pair() {
89
+ return z.tuple([z.number(), S]);
90
+ },
91
+ });
92
+ const a: any = { id: 1 };
93
+ a.pair = [1, a];
94
+ return { schema: S, input: a };
95
+ },
96
+ ],
97
+ [
98
+ "set",
99
+ () => {
100
+ const S: any = z.object({
101
+ id: z.number(),
102
+ get peers() {
103
+ return z.set(S);
104
+ },
105
+ });
106
+ const a: any = { id: 1, peers: new Set() };
107
+ a.peers.add(a);
108
+ return { schema: S, input: a };
109
+ },
110
+ ],
111
+ [
112
+ "map",
113
+ () => {
114
+ const S: any = z.object({
115
+ id: z.number(),
116
+ get links() {
117
+ return z.map(z.string(), S);
118
+ },
119
+ });
120
+ const a: any = { id: 1, links: new Map() };
121
+ a.links.set("s", a);
122
+ return { schema: S, input: a };
123
+ },
124
+ ],
125
+ [
126
+ "union",
127
+ () => {
128
+ const S: any = z.object({
129
+ id: z.number(),
130
+ get self() {
131
+ return z.union([z.string(), S]);
132
+ },
133
+ });
134
+ const a: any = { id: 1 };
135
+ a.self = a;
136
+ return { schema: S, input: a };
137
+ },
138
+ ],
139
+ [
140
+ "discriminated union",
141
+ () => {
142
+ const S: any = z.discriminatedUnion("kind", [
143
+ z.object({ kind: z.literal("leaf"), v: z.number() }),
144
+ z.object({
145
+ kind: z.literal("branch"),
146
+ get next() {
147
+ return S;
148
+ },
149
+ }),
150
+ ]);
151
+ const a: any = { kind: "branch" };
152
+ a.next = a;
153
+ return { schema: S, input: a };
154
+ },
155
+ ],
156
+ [
157
+ "lazy",
158
+ () => {
159
+ const S: any = z.object({ id: z.number(), self: z.lazy(() => S) });
160
+ const a: any = { id: 1 };
161
+ a.self = a;
162
+ return { schema: S, input: a };
163
+ },
164
+ ],
165
+ [
166
+ "mutual recursion five hops apart",
167
+ () => {
168
+ const A: any = z.object({
169
+ get b() {
170
+ return B;
171
+ },
172
+ });
173
+ const B: any = z.object({
174
+ get c() {
175
+ return C;
176
+ },
177
+ });
178
+ const C: any = z.object({
179
+ get d() {
180
+ return D;
181
+ },
182
+ });
183
+ const D: any = z.object({
184
+ get e() {
185
+ return E;
186
+ },
187
+ });
188
+ const E: any = z.object({
189
+ get a() {
190
+ return A;
191
+ },
192
+ });
193
+ const a: any = {};
194
+ a.b = { c: { d: { e: { a } } } };
195
+ return { schema: A, input: a };
196
+ },
197
+ ],
198
+ ];
199
+
200
+ for (const [name, build] of cases) {
201
+ for (const jitless of [false, true]) {
202
+ const { schema, input } = build();
203
+ expect(() => schema.parse(input, { jitless }), `${name} (jitless: ${jitless})`).not.toThrow();
204
+ }
205
+ }
206
+ });
207
+
208
+ test("checks run once per node and never against a half-built object", () => {
209
+ const seen: number[] = [];
210
+ const Node: any = z
211
+ .object({
212
+ id: z.number(),
213
+ get self() {
214
+ return Node;
215
+ },
216
+ })
217
+ .refine((value: any) => {
218
+ seen.push(Object.keys(value).length);
219
+ return true;
220
+ });
221
+
222
+ const input: any = { id: 1 };
223
+ input.self = input;
224
+ Node.parse(input);
225
+
226
+ expect(seen).toEqual([2]);
227
+ });
228
+
229
+ test("reports a failing check inside a cycle", () => {
230
+ const Node: any = z
231
+ .object({
232
+ id: z.number(),
233
+ get self() {
234
+ return Node;
235
+ },
236
+ })
237
+ .refine((value: any) => value.id > 100, "too small");
238
+
239
+ const input: any = { id: 1 };
240
+ input.self = input;
241
+ expect(Node.safeParse(input).success).toBe(false);
242
+ });
243
+
244
+ test("reports an invalid value inside a cycle once, at its own path", () => {
245
+ const Node: any = z.object({
246
+ id: z.number(),
247
+ get self() {
248
+ return Node;
249
+ },
250
+ });
251
+
252
+ const input: any = { id: "nope" };
253
+ input.self = input;
254
+
255
+ const result = Node.safeParse(input);
256
+ expect(result.success).toBe(false);
257
+ expect(result.error!.issues).toHaveLength(1);
258
+ expect(result.error!.issues[0].path).toEqual(["id"]);
259
+ });
260
+
261
+ test("rejects a cycle that closes through a transform", () => {
262
+ const Inner: any = z.object({
263
+ name: z.string(),
264
+ get self() {
265
+ return Wrapped;
266
+ },
267
+ });
268
+ const Wrapped: any = Inner.transform((value: any) => ({ wrapped: value }));
269
+
270
+ const input: any = { name: "x" };
271
+ input.self = input;
272
+
273
+ expect(() => Wrapped.parse(input)).toThrow(/reference cycle/);
274
+ });
275
+
276
+ test("leaves a transform that is not on the cycle alone", () => {
277
+ const Node: any = z.object({
278
+ n: z.number().transform((value: number) => value * 2),
279
+ get self() {
280
+ return Node;
281
+ },
282
+ });
283
+
284
+ const input: any = { n: 21 };
285
+ input.self = input;
286
+
287
+ const result = Node.parse(input);
288
+ expect(result.n).toBe(42);
289
+ expect(result.self).toBe(result);
290
+ });
291
+
292
+ test("encodes through a cycle", () => {
293
+ const Stringified = z.codec(z.string(), z.number(), {
294
+ decode: (value) => Number(value),
295
+ encode: (value) => String(value),
296
+ });
297
+ const Node: any = z.object({
298
+ n: Stringified,
299
+ get self() {
300
+ return Node;
301
+ },
302
+ });
303
+
304
+ const input: any = { n: 5 };
305
+ input.self = input;
306
+
307
+ const result: any = z.encode(Node, input);
308
+ expect(result.n).toBe("5");
309
+ expect(result.self).toBe(result);
310
+ });
311
+
312
+ test("keeps separate parses independent", () => {
313
+ const Node: any = z.object({
314
+ id: z.number(),
315
+ get self() {
316
+ return Node;
317
+ },
318
+ });
319
+
320
+ const input: any = { id: 1 };
321
+ input.self = input;
322
+
323
+ const first = Node.parse(input);
324
+ const second = Node.parse(input);
325
+ expect(first).not.toBe(second);
326
+ expect(first.self).toBe(first);
327
+ expect(second.self).toBe(second);
328
+
329
+ const bad: any = { id: "x" };
330
+ bad.self = bad;
331
+ expect(Node.safeParse(bad).success).toBe(false);
332
+ expect(Node.safeParse(input).success).toBe(true);
333
+ });
334
+
335
+ test("parses a cycle asynchronously", async () => {
336
+ const Node: any = z.object({
337
+ id: z.number().refine(async (value: number) => value > 0),
338
+ get self() {
339
+ return Node;
340
+ },
341
+ });
342
+
343
+ const input: any = { id: 1 };
344
+ input.self = input;
345
+
346
+ const result = await Node.parseAsync(input);
347
+ expect(result.self).toBe(result);
348
+
349
+ const bad: any = { id: -1 };
350
+ bad.self = bad;
351
+ expect((await Node.safeParseAsync(bad)).success).toBe(false);
352
+ });
353
+
354
+ test("a non-recursive schema still copies a shared reference twice", () => {
355
+ const Leaf = z.object({ v: z.number() });
356
+ const Pair = z.object({ a: Leaf, b: Leaf });
357
+
358
+ const shared = { v: 1 };
359
+ const result = Pair.parse({ a: shared, b: shared });
360
+
361
+ expect(result.a).not.toBe(result.b);
362
+ expect(result.a.v).toBe(1);
363
+ expect(result.b.v).toBe(1);
364
+ });
365
+
366
+ test("a recursive schema shares one output node per input node", () => {
367
+ const Node: any = z.object({
368
+ v: z.number(),
369
+ get kids() {
370
+ return z.array(Node);
371
+ },
372
+ });
373
+
374
+ const shared: any = { v: 1, kids: [] };
375
+ const result = Node.parse({ v: 0, kids: [shared, shared] });
376
+
377
+ expect(result.kids[0]).toBe(result.kids[1]);
378
+ });
379
+
380
+ test("sync and async agree on a shared reference", async () => {
381
+ const build = (asyncCheck: boolean) => {
382
+ const Node: any = z.object({
383
+ v: asyncCheck ? z.number().refine(async (n: number) => n >= 0) : z.number(),
384
+ get kids() {
385
+ return z.array(Node);
386
+ },
387
+ });
388
+ return Node;
389
+ };
390
+
391
+ const shared: any = { v: 1, kids: [] };
392
+ const input = { v: 0, kids: [shared, shared] };
393
+
394
+ const syncResult = build(false).parse(input);
395
+ const asyncResult = await build(true).parseAsync(input);
396
+
397
+ expect(syncResult.kids[0]).toBe(syncResult.kids[1]);
398
+ expect(asyncResult.kids[0]).toBe(asyncResult.kids[1]);
399
+ });
400
+
401
+ test("a cycle through .readonly() keeps the node intact", () => {
402
+ const Node: any = z.object({
403
+ id: z.number(),
404
+ get self() {
405
+ return Node.readonly();
406
+ },
407
+ });
408
+
409
+ const input: any = { id: 1 };
410
+ input.self = input;
411
+
412
+ // Freezing a node that is still being built would make its remaining keys fail to assign, silently, because generated code is not strict mode.
413
+ const result = Node.parse(input);
414
+ expect(Object.keys(result).sort()).toEqual(["id", "self"]);
415
+ expect(result.self).toBe(result);
416
+ });
417
+
418
+ test("a cycle through z.intersection validates but does not mirror the graph", () => {
419
+ const Node: any = z.object({
420
+ id: z.number(),
421
+ get self() {
422
+ return z.intersection(Node, z.object({ id: z.number() }));
423
+ },
424
+ });
425
+
426
+ const input: any = { id: 7 };
427
+ input.self = input;
428
+
429
+ // The merged value is built after both sides are parsed, so it cannot be the object a back-edge already resolved to. Values are right, the graph is not.
430
+ const result = Node.parse(input);
431
+ expect(result.id).toBe(7);
432
+ expect(result.self.id).toBe(7);
433
+ expect(result.self).not.toBe(result);
434
+ expect(result.self.self).toBeUndefined();
435
+
436
+ const bad: any = { id: "nope" };
437
+ bad.self = bad;
438
+ expect(Node.safeParse(bad).success).toBe(false);
439
+ });
440
+
441
+ test("keeps two cycles and a shared node distinct in one input", () => {
442
+ const Node: any = z.object({
443
+ id: z.number(),
444
+ get kids() {
445
+ return z.array(Node);
446
+ },
447
+ });
448
+
449
+ const shared: any = { id: 9, kids: [] };
450
+ const root: any = { id: 0, kids: [shared, shared] };
451
+ root.kids.push(root);
452
+
453
+ const result = Node.parse(root);
454
+ expect(result.kids[0]).toBe(result.kids[1]);
455
+ expect(result.kids[2]).toBe(result);
456
+ });
457
+
458
+ test("closes a cycle through a Map key and a Set member", () => {
459
+ const Keyed: any = z.object({
460
+ id: z.number(),
461
+ get keyed() {
462
+ return z.map(Keyed, z.string());
463
+ },
464
+ });
465
+ const k: any = { id: 1, keyed: new Map() };
466
+ k.keyed.set(k, "v");
467
+ const keyedOut = Keyed.parse(k);
468
+ expect([...keyedOut.keyed.keys()][0]).toBe(keyedOut);
469
+
470
+ const Peered: any = z.object({
471
+ id: z.number(),
472
+ get peers() {
473
+ return z.set(Peered);
474
+ },
475
+ });
476
+ const p: any = { id: 1, peers: new Set() };
477
+ p.peers.add(p);
478
+ const peeredOut = Peered.parse(p);
479
+ expect([...peeredOut.peers][0]).toBe(peeredOut);
480
+ });
481
+
482
+ test("does not mutate the input, and tolerates a frozen one", () => {
483
+ const Node: any = z.object({
484
+ id: z.number(),
485
+ get self() {
486
+ return Node;
487
+ },
488
+ });
489
+
490
+ const input: any = { id: 1 };
491
+ input.self = input;
492
+ Object.freeze(input);
493
+
494
+ const result = Node.parse(input);
495
+ expect(result).not.toBe(input);
496
+ expect(result.self).toBe(result);
497
+ expect(Reflect.ownKeys(input)).toEqual(["id", "self"]);
498
+ });
499
+
500
+ test("keys identity on the schema, not just the input", () => {
501
+ const Node: any = z.object({
502
+ id: z.number(),
503
+ get self() {
504
+ return Node.optional();
505
+ },
506
+ });
507
+ const Partial: any = Node.partial();
508
+
509
+ const input: any = { id: 1 };
510
+ input.self = input;
511
+
512
+ // `Partial` and `Node` are different schemas, so the root and the node its cycle points back to are different output objects. Same rule that lets one input node be validated against two schemas in mutual recursion.
513
+ const result = Partial.parse(input);
514
+ expect(result.self).not.toBe(result);
515
+ expect(result.self.self).toBe(result.self);
516
+ expect(result.id).toBe(1);
517
+ expect(result.self.id).toBe(1);
518
+ });
519
+
520
+ test("keeps concurrent async parses of one schema independent", async () => {
521
+ const Node: any = z.object({
522
+ id: z.number().refine(async (n: number) => {
523
+ await new Promise((r) => setTimeout(r, 5 + (n % 3)));
524
+ return true;
525
+ }),
526
+ get self() {
527
+ return Node;
528
+ },
529
+ });
530
+
531
+ const make = (id: number) => {
532
+ const o: any = { id };
533
+ o.self = o;
534
+ return o;
535
+ };
536
+
537
+ const [a, b, c] = await Promise.all([Node.parseAsync(make(1)), Node.parseAsync(make(2)), Node.parseAsync(make(3))]);
538
+
539
+ expect([a.id, b.id, c.id]).toEqual([1, 2, 3]);
540
+ expect(a.self).toBe(a);
541
+ expect(b.self).toBe(b);
542
+ expect(c.self).toBe(c);
543
+ });
544
+
545
+ test("runs checks once per reference, as it does without a cycle", () => {
546
+ let calls = 0;
547
+ const Node: any = z
548
+ .object({
549
+ id: z.number(),
550
+ get kids() {
551
+ return z.array(Node);
552
+ },
553
+ })
554
+ .refine(() => {
555
+ calls++;
556
+ return true;
557
+ });
558
+
559
+ const shared: any = { id: 1, kids: [] };
560
+ Node.parse({ id: 0, kids: [shared, shared] });
561
+
562
+ // Memoization skips the container's parse, not the checks layered on it.
563
+ expect(calls).toBe(3);
564
+ });
565
+
566
+ test("a schema wrapped at the root adds one node and no more", () => {
567
+ const Node: any = z.object({
568
+ id: z.number(),
569
+ get self() {
570
+ return Node.optional();
571
+ },
572
+ });
573
+
574
+ const input: any = { id: 1 };
575
+ input.self = input;
576
+
577
+ // The root is keyed on the wrapper, everything under it on `Node`, so the graph closes one level down rather than at the root. It does not compound: stacking wrappers still yields exactly two nodes.
578
+ const count = (root: any) => {
579
+ const seen: any[] = [];
580
+ let n = root;
581
+ while (n && !seen.includes(n)) {
582
+ seen.push(n);
583
+ n = n.self;
584
+ }
585
+ return seen.length;
586
+ };
587
+
588
+ expect(count(Node.parse(input))).toBe(1);
589
+ expect(count(Node.partial().parse(input))).toBe(2);
590
+ expect(count(Node.partial().partial().parse(input))).toBe(2);
591
+ expect(count(Node.extend({ extra: z.string().optional() }).parse(input))).toBe(2);
592
+ });
593
+
594
+ test("resolves a recursive reference once, however it is written", () => {
595
+ // This is what bounds the above: core caches a shape getter and a lazy getter, so a getter returning a fresh clone still yields a finite schema graph rather than a new schema per node.
596
+ let getterCalls = 0;
597
+ const ViaGetter: any = z.object({
598
+ id: z.number(),
599
+ get self() {
600
+ getterCalls++;
601
+ return ViaGetter.partial();
602
+ },
603
+ });
604
+
605
+ let lazyCalls = 0;
606
+ const ViaLazy: any = z.object({
607
+ id: z.number(),
608
+ self: z.lazy(() => {
609
+ lazyCalls++;
610
+ return ViaLazy.partial();
611
+ }),
612
+ });
613
+
614
+ const input: any = { id: 1 };
615
+ input.self = input;
616
+
617
+ expect(() => ViaGetter.parse(input)).not.toThrow();
618
+ expect(() => ViaLazy.parse(input)).not.toThrow();
619
+ expect(getterCalls).toBe(1);
620
+ expect(lazyCalls).toBe(1);
621
+ });
622
+
623
+ // The second visitor of a shared node must not prefix onto the first visitor's path.
624
+ test.each([false, true])("prefixes a shared node's issues once per reference (jitless: %s)", (jitless) => {
625
+ z.config({ jitless });
626
+ try {
627
+ const Node: any = z.object({
628
+ name: z.string(),
629
+ get left() {
630
+ return z.optional(Node);
631
+ },
632
+ get right() {
633
+ return z.optional(Node);
634
+ },
635
+ });
636
+
637
+ const shared: any = { name: 123 };
638
+ const result = Node.safeParse({ name: "root", left: shared, right: shared });
639
+
640
+ expect(result.success).toBe(false);
641
+ expect(result.error.issues.map((iss: any) => iss.path)).toEqual([
642
+ ["left", "name"],
643
+ ["right", "name"],
644
+ ]);
645
+ } finally {
646
+ z.config({ jitless: false });
647
+ }
648
+ });
649
+
650
+ test("the default memoizer is installed before the first container reads it", () => {
651
+ // the delete manufactures the fresh-process state; a container with only getter keys then constructs no leaf before the config read
652
+ delete z.config().memoizer;
653
+ const Node: any = z.object({
654
+ get self() {
655
+ return Node;
656
+ },
657
+ });
658
+ const input: any = {};
659
+ input.self = input;
660
+ const out = Node.parse(input);
661
+ expect(out.self).toBe(out);
662
+ });
663
+
664
+ test("guards a transform built before any container", () => {
665
+ // the guard attaches at construction, so a transform predating the first container must still get the default
666
+ delete z.config().memoizer;
667
+ const wrap = z.transform((value: any) => ({ wrapped: value }));
668
+ const Inner: any = z.object({
669
+ name: z.string(),
670
+ get self() {
671
+ return Wrapped;
672
+ },
673
+ });
674
+ const Wrapped: any = z.pipe(Inner, wrap);
675
+
676
+ const input: any = { name: "x" };
677
+ input.self = input;
678
+
679
+ expect(() => Wrapped.parse(input)).toThrow(/reference cycle/);
680
+ });
681
+
682
+ test("detects a cycle reachable only through a merged catchall", () => {
683
+ const Cyclic: any = z.object({
684
+ id: z.string(),
685
+ get next() {
686
+ return z.optional(Root);
687
+ },
688
+ });
689
+ const Root: any = z.object({ tag: z.string() }).merge(z.object({}).catchall(Cyclic));
690
+
691
+ const input: any = { tag: "root" };
692
+ input.child = { id: "1", next: input };
693
+
694
+ const out: any = Root.parse(input);
695
+ expect(out.child.next).toBe(out);
696
+ });
697
+
698
+ // the per-type switch can only enumerate kinds Zod ships, so an unknown `def.type` falls back to scanning the def; without it a cycle through a third-party container overflows the stack
699
+ test("detects a cycle through a user-defined container type", () => {
700
+ const MyBox: any = z.core.$constructor("MyBox", (inst: any, def: any) => {
701
+ z.core.$ZodType.init(inst, def);
702
+ inst._zod.parse = (payload: any, ctx: any) => {
703
+ if (payload.value === null || typeof payload.value !== "object") return payload;
704
+ const inner = def.inner._zod.run({ value: payload.value.v, issues: [] }, ctx);
705
+ payload.value = { v: inner.value };
706
+ return payload;
707
+ };
708
+ });
709
+
710
+ const Node: any = z.object({
711
+ id: z.string(),
712
+ get boxed() {
713
+ return z.optional(new MyBox({ type: "mybox", inner: z.lazy(() => Node) }));
714
+ },
715
+ });
716
+
717
+ const input: any = { id: "1" };
718
+ input.boxed = { v: input };
719
+
720
+ const out: any = Node.parse(input);
721
+ expect(out.boxed.v).toBe(out);
722
+ });
723
+
724
+ // #6526: a factory returns fresh instances, so the identity walk never revisits a node; it descends until the stack overflows unless it stops at the deferred edge
725
+ test("parses a factory-built recursive schema", () => {
726
+ const Node = (): any =>
727
+ z.object({
728
+ id: z.number(),
729
+ get kids() {
730
+ return z.array(Node());
731
+ },
732
+ });
733
+
734
+ const S = z.object({ root: Node() });
735
+ const out = S.parse({ root: { id: 1, kids: [{ id: 2, kids: [] }] } });
736
+ expect(out.root.kids[0].id).toBe(2);
737
+ expect(S.safeParse({ root: { id: 1, kids: [{ id: "x", kids: [] }] } }).success).toBe(false);
738
+ });
739
+
740
+ test("parses a factory-built recursive discriminated union at the root and nested", () => {
741
+ const Geometry = (): any =>
742
+ z.discriminatedUnion("type", [
743
+ z.object({ type: z.literal("Point"), coordinates: z.array(z.number()) }),
744
+ z.looseObject({
745
+ type: z.literal("GeometryCollection"),
746
+ get geometries() {
747
+ return z.array(Geometry());
748
+ },
749
+ }),
750
+ ]);
751
+
752
+ const collection = { type: "GeometryCollection", geometries: [{ type: "Point", coordinates: [1, 2] }] };
753
+ expect(Geometry().parse(collection).geometries[0].coordinates).toEqual([1, 2]);
754
+ expect(z.object({ g: Geometry() }).parse({ g: collection }).g.type).toBe("GeometryCollection");
755
+ });
756
+
757
+ test("the walk reports a cycle for a deferred edge instead of resolving it", () => {
758
+ const Node = (): any =>
759
+ z.object({
760
+ get self() {
761
+ return Node();
762
+ },
763
+ });
764
+ expect(z.core.isRecursiveSchema(Node())).toBe(true);
765
+
766
+ // conservative by design: a getter that closes no cycle is reported too, and pays only the memoizer it keeps
767
+ const Leaf = z.object({ id: z.string() });
768
+ const forward: any = z.object({
769
+ get leaf() {
770
+ return Leaf;
771
+ },
772
+ });
773
+ expect(z.core.isRecursiveSchema(forward)).toBe(true);
774
+
775
+ // a lazy is followed one hop, which is what lets z.compile see past it; past that hop it is deferred like any other edge
776
+ expect(z.core.isRecursiveSchema(z.lazy(() => Leaf) as any)).toBe(false);
777
+ expect(z.core.isRecursiveSchema(z.lazy(() => z.lazy(() => Leaf)) as any)).toBe(true);
778
+ });
779
+
780
+ // the builders answer `shape` from an accessor that resolves the source's getters, so the walk has to reach the source schema itself
781
+ test("parses a factory-built recursive schema through every object builder", () => {
782
+ const wraps: [string, (base: () => any) => any][] = [
783
+ ["extend", (b) => b().extend({ x: z.string() })],
784
+ ["safeExtend", (b) => b().safeExtend({ x: z.string() })],
785
+ ["merge", (b) => z.object({ x: z.string() }).merge(b())],
786
+ ["partial", (b) => b().partial()],
787
+ ["required", (b) => b().required()],
788
+ ["pick", (b) => b().pick({ self: true })],
789
+ ["omit", (b) => b().omit({ y: true })],
790
+ ["chained", (b) => b().extend({ x: z.string() }).partial()],
791
+ // rebuilds the def without touching the shape, so the clone carries the source's accessor rather than a shape of its own
792
+ ["strict", (b) => b().extend({ x: z.string() }).strict()],
793
+ ["catchall", (b) => b().extend({ x: z.string() }).catchall(z.unknown())],
794
+ ["meta", (b) => b().extend({ x: z.string() }).meta({ id: "node" })],
795
+ ];
796
+
797
+ for (const [name, wrap] of wraps) {
798
+ const Node = (): any =>
799
+ wrap(() =>
800
+ z.object({
801
+ y: z.string(),
802
+ get self() {
803
+ return z.optional(Node());
804
+ },
805
+ })
806
+ );
807
+ const S = z.object({ r: Node() });
808
+ for (const attempt of ["first", "second"]) {
809
+ expect(() => S.safeParse({ r: { y: "s", x: "s" } }), `${name} (${attempt} parse)`).not.toThrow();
810
+ }
811
+ }
812
+ });
813
+
814
+ test("an ordinary builder stays exact, so it still compiles", () => {
815
+ const plain = z.object({ a: z.string(), b: z.number() });
816
+ const derived: [string, any][] = [
817
+ ["extend", plain.extend({ c: z.boolean() })],
818
+ ["merge", plain.merge(z.object({ d: z.string() }))],
819
+ ["partial", plain.partial()],
820
+ ["required", plain.partial().required()],
821
+ ["pick", plain.pick({ a: true })],
822
+ ["omit", plain.omit({ a: true })],
823
+ ["strict", plain.extend({ c: z.boolean() }).strict()],
824
+ ["catchall", plain.extend({ c: z.boolean() }).catchall(z.unknown())],
825
+ ["meta", plain.extend({ c: z.boolean() }).meta({ id: "plain" })],
826
+ ];
827
+ for (const [name, schema] of derived) {
828
+ expect(z.core.isRecursiveSchema(schema), name).toBe(false);
829
+ expect(() => z.compile(schema, { strict: true }), name).not.toThrow();
830
+ }
831
+ });
832
+
833
+ // a derived shape mirrors its source's descriptors, so dropping or overwriting the key that carries the cycle leaves nothing deferred and the walk is exact before anything parses
834
+ test("a builder that drops the recursive key ends up exact", () => {
835
+ const Node: any = z.object({
836
+ id: z.number(),
837
+ get self() {
838
+ return z.optional(Node);
839
+ },
840
+ });
841
+
842
+ const derived: [string, any, any][] = [
843
+ ["omit", Node.omit({ self: true }), { id: 1 }],
844
+ ["pick", Node.pick({ id: true }), { id: 1 }],
845
+ ["extend overwrites it", Node.extend({ self: z.string() }), { id: 1, self: "x" }],
846
+ ];
847
+ for (const [name, schema, input] of derived) {
848
+ expect(z.core.isRecursiveSchema(schema), name).toBe(false);
849
+ expect(() => z.compile(schema, { strict: true }), name).not.toThrow();
850
+ expect(schema.parse(input), name).toEqual(input);
851
+ }
852
+
853
+ // the branch that stays is still found
854
+ const kept = Node.extend({ x: z.string() });
855
+ expect(z.core.isRecursiveSchema(kept)).toBe(true);
856
+ });
857
+
858
+ // resolving a lazy runs user code, which can re-enter the walk; a walk that kept its certainty outside its own frames would have the inner one clobber the outer
859
+ test("a nested walk can't corrupt the one that resolved into it", () => {
860
+ const Node: any = z.object({
861
+ id: z.number(),
862
+ self: z.lazy(() => {
863
+ z.compile(z.string(), { strict: true });
864
+ return z.optional(Node);
865
+ }),
866
+ });
867
+
868
+ const omitted = Node.omit({ self: true });
869
+ // exact before anything parses: the mirrored shape kept only `id`, so nothing here is deferred
870
+ expect(z.core.isRecursiveSchema(omitted)).toBe(false);
871
+ omitted.parse({ id: 1 });
872
+ expect(z.core.isRecursiveSchema(omitted)).toBe(false);
873
+ expect(() => z.compile(omitted, { strict: true })).not.toThrow();
874
+
875
+ const shared = { id: 1 };
876
+ const out: any = z.object({ a: omitted, b: omitted }).parse({ a: shared, b: shared });
877
+ expect(out.a).not.toBe(out.b);
878
+ expect(z.core.isRecursiveSchema(Node)).toBe(true);
879
+ });
880
+
881
+ test("detects a cycle that closes through a builder", () => {
882
+ const Node: any = z
883
+ .object({
884
+ id: z.number(),
885
+ get self() {
886
+ return z.optional(Node);
887
+ },
888
+ })
889
+ .extend({ x: z.string() });
890
+
891
+ const input: any = { id: 1, x: "s" };
892
+ input.self = input;
893
+ const out = Node.parse(input);
894
+ expect(out.self).toBe(out);
895
+ });
896
+
897
+ test("a deferred edge stops being assumed a cycle once the graph resolves", () => {
898
+ const Leaf = z.object({ n: z.number() });
899
+ const Forward: any = z.object({
900
+ get a() {
901
+ return Leaf;
902
+ },
903
+ });
904
+ expect(z.core.isRecursiveSchema(Forward)).toBe(true);
905
+ Forward.parse({ a: { n: 1 } });
906
+ // the parse resolved the getter, so the walk can follow it and drop the assumption
907
+ expect(z.core.isRecursiveSchema(Forward)).toBe(false);
908
+
909
+ // a factory hands back a fresh subtree every time, so no parse ever resolves it into a finite graph
910
+ const Node = (): any =>
911
+ z.object({
912
+ get kids() {
913
+ return z.array(Node());
914
+ },
915
+ });
916
+ const Generated = Node();
917
+ expect(z.core.isRecursiveSchema(Generated)).toBe(true);
918
+ Generated.parse({ kids: [] });
919
+ expect(z.core.isRecursiveSchema(Generated)).toBe(true);
920
+
921
+ // a lazy that closes a real cycle stays recursive however often it resolves
922
+ const Cyclic: any = z.object({ id: z.number(), self: z.lazy(() => z.optional(Cyclic)) });
923
+ Cyclic.parse({ id: 1 });
924
+ expect(z.core.isRecursiveSchema(Cyclic)).toBe(true);
925
+ });
926
+
927
+ // `z.object` resolves its shape by spread, so a non-enumerable key is no part of it
928
+ test("a non-enumerable key does not count for z.object", () => {
929
+ const object = (enumerable: boolean) => {
930
+ const shape: Record<string, any> = { id: z.number() };
931
+ const O: any = z.object(shape);
932
+ Object.defineProperty(shape, "next", { value: z.lazy(() => z.optional(O)), enumerable, configurable: true });
933
+ return O;
934
+ };
935
+ expect(z.core.isRecursiveSchema(object(true))).toBe(true);
936
+ // the spread drops it, so nothing can ever parse it
937
+ expect(z.core.isRecursiveSchema(object(false))).toBe(false);
938
+ });
939
+
940
+ test("the walk stays exact where nothing is deferred", () => {
941
+ let deep: any = z.string();
942
+ for (let i = 0; i < 300; i++) deep = z.object({ v: deep });
943
+ expect(z.core.isRecursiveSchema(deep)).toBe(false);
944
+ });
945
+
946
+ test("parses a factory-built recursive schema through z.lazy", () => {
947
+ const Node = (): any =>
948
+ z.object({
949
+ id: z.number(),
950
+ child: z.lazy(() => z.optional(Node())),
951
+ });
952
+
953
+ const out = z.object({ root: Node() }).parse({ root: { id: 1, child: { id: 2, child: undefined } } });
954
+ expect(out.root.child.id).toBe(2);
955
+ });
956
+
957
+ test("a finished parse pins nothing on the schema", async () => {
958
+ // es2020 is the target, and its lib predates WeakRef
959
+ type Weak<T extends object> = { deref(): T | undefined };
960
+ const { WeakRef: Weak } = globalThis as unknown as { WeakRef: new <T extends object>(target: T) => Weak<T> };
961
+ // vitest carries no --expose-gc, so reach the collector the way node's own tests do
962
+ v8.setFlagsFromString("--expose-gc");
963
+ const gc = vm.runInNewContext("gc") as () => void;
964
+
965
+ const Node: any = z.object({
966
+ id: z.number(),
967
+ get next() {
968
+ return z.optional(Node);
969
+ },
970
+ });
971
+
972
+ const ref = ((): Weak<object> => {
973
+ const input = { id: 1, next: { id: 2, next: undefined } };
974
+ Node.parse(input);
975
+ return new Weak(input);
976
+ })();
977
+
978
+ for (let attempt = 0; attempt < 10 && ref.deref(); attempt++) {
979
+ // the input stays on the stack until a macrotask boundary
980
+ await new Promise((resolve) => setTimeout(resolve, 0));
981
+ gc();
982
+ }
983
+
984
+ expect(ref.deref()).toBeUndefined();
985
+ });