@nocobase/plugin-ai 1.9.32 → 1.9.34

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 (990) hide show
  1. package/dist/externalVersion.js +6 -6
  2. package/dist/node_modules/@langchain/core/dist/caches/base.cjs +28 -5
  3. package/dist/node_modules/@langchain/core/dist/caches/base.d.ts +13 -1
  4. package/dist/node_modules/@langchain/core/dist/caches/base.js +25 -2
  5. package/dist/node_modules/@langchain/core/dist/callbacks/base.cjs +19 -9
  6. package/dist/node_modules/@langchain/core/dist/callbacks/base.d.ts +37 -22
  7. package/dist/node_modules/@langchain/core/dist/callbacks/dispatch/index.cjs +1 -2
  8. package/dist/node_modules/@langchain/core/dist/callbacks/dispatch/web.cjs +1 -2
  9. package/dist/node_modules/@langchain/core/dist/callbacks/manager.cjs +15 -10
  10. package/dist/node_modules/@langchain/core/dist/callbacks/manager.d.ts +3 -3
  11. package/dist/node_modules/@langchain/core/dist/callbacks/manager.js +11 -6
  12. package/dist/node_modules/@langchain/core/dist/embeddings.d.ts +6 -6
  13. package/dist/node_modules/@langchain/core/dist/errors/index.cjs +1 -2
  14. package/dist/node_modules/@langchain/core/dist/example_selectors/conditional.cjs +3 -3
  15. package/dist/node_modules/@langchain/core/dist/index.cjs +3 -0
  16. package/dist/node_modules/@langchain/core/dist/index.d.ts +3 -0
  17. package/dist/node_modules/@langchain/core/dist/index.js +3 -0
  18. package/dist/node_modules/@langchain/core/dist/indexing/base.cjs +19 -7
  19. package/dist/node_modules/@langchain/core/dist/indexing/base.d.ts +3 -0
  20. package/dist/node_modules/@langchain/core/dist/indexing/base.js +14 -2
  21. package/dist/node_modules/@langchain/core/dist/language_models/base.cjs +31 -7
  22. package/dist/node_modules/@langchain/core/dist/language_models/base.d.ts +40 -9
  23. package/dist/node_modules/@langchain/core/dist/language_models/base.js +29 -5
  24. package/dist/node_modules/@langchain/core/dist/language_models/chat_models.cjs +37 -10
  25. package/dist/node_modules/@langchain/core/dist/language_models/chat_models.d.ts +9 -3
  26. package/dist/node_modules/@langchain/core/dist/language_models/chat_models.js +36 -9
  27. package/dist/node_modules/@langchain/core/dist/load/import_map.cjs +17 -7
  28. package/dist/node_modules/@langchain/core/dist/load/index.cjs +18 -9
  29. package/dist/node_modules/@langchain/core/dist/load/map_keys.cjs +3 -4
  30. package/dist/node_modules/@langchain/core/dist/load/serializable.cjs +2 -2
  31. package/dist/node_modules/@langchain/core/dist/memory.cjs +2 -2
  32. package/dist/node_modules/@langchain/core/dist/messages/ai.cjs +46 -12
  33. package/dist/node_modules/@langchain/core/dist/messages/ai.d.ts +26 -10
  34. package/dist/node_modules/@langchain/core/dist/messages/ai.js +43 -9
  35. package/dist/node_modules/@langchain/core/dist/messages/base.cjs +74 -20
  36. package/dist/node_modules/@langchain/core/dist/messages/base.d.ts +5 -6
  37. package/dist/node_modules/@langchain/core/dist/messages/base.js +64 -10
  38. package/dist/node_modules/@langchain/core/dist/messages/chat.cjs +3 -3
  39. package/dist/node_modules/@langchain/core/dist/messages/content_blocks.cjs +165 -0
  40. package/dist/node_modules/@langchain/core/dist/messages/content_blocks.d.ts +151 -0
  41. package/dist/node_modules/@langchain/core/dist/messages/content_blocks.js +154 -0
  42. package/dist/node_modules/@langchain/core/dist/messages/function.cjs +3 -3
  43. package/dist/node_modules/@langchain/core/dist/messages/human.cjs +13 -3
  44. package/dist/node_modules/@langchain/core/dist/messages/human.d.ts +13 -1
  45. package/dist/node_modules/@langchain/core/dist/messages/human.js +10 -0
  46. package/dist/node_modules/@langchain/core/dist/messages/index.cjs +1 -0
  47. package/dist/node_modules/@langchain/core/dist/messages/index.d.ts +1 -0
  48. package/dist/node_modules/@langchain/core/dist/messages/index.js +1 -0
  49. package/dist/node_modules/@langchain/core/dist/messages/system.cjs +13 -3
  50. package/dist/node_modules/@langchain/core/dist/messages/system.d.ts +13 -1
  51. package/dist/node_modules/@langchain/core/dist/messages/system.js +10 -0
  52. package/dist/node_modules/@langchain/core/dist/messages/tool.cjs +12 -5
  53. package/dist/node_modules/@langchain/core/dist/messages/tool.d.ts +13 -5
  54. package/dist/node_modules/@langchain/core/dist/messages/tool.js +7 -0
  55. package/dist/node_modules/@langchain/core/dist/messages/transformers.cjs +5 -6
  56. package/dist/node_modules/@langchain/core/dist/messages/transformers.js +1 -1
  57. package/dist/node_modules/@langchain/core/dist/messages/utils.cjs +10 -7
  58. package/dist/node_modules/@langchain/core/dist/messages/utils.js +4 -0
  59. package/dist/node_modules/@langchain/core/dist/output_parsers/json.cjs +7 -0
  60. package/dist/node_modules/@langchain/core/dist/output_parsers/json.d.ts +2 -0
  61. package/dist/node_modules/@langchain/core/dist/output_parsers/json.js +7 -0
  62. package/dist/node_modules/@langchain/core/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts +1 -1
  63. package/dist/node_modules/@langchain/core/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs +7 -6
  64. package/dist/node_modules/@langchain/core/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts +19 -5
  65. package/dist/node_modules/@langchain/core/dist/output_parsers/openai_tools/json_output_tools_parsers.js +3 -2
  66. package/dist/node_modules/@langchain/core/dist/output_parsers/string.cjs +1 -1
  67. package/dist/node_modules/@langchain/core/dist/output_parsers/string.d.ts +1 -1
  68. package/dist/node_modules/@langchain/core/dist/output_parsers/string.js +1 -1
  69. package/dist/node_modules/@langchain/core/dist/output_parsers/structured.cjs +17 -11
  70. package/dist/node_modules/@langchain/core/dist/output_parsers/structured.d.ts +10 -9
  71. package/dist/node_modules/@langchain/core/dist/output_parsers/structured.js +15 -9
  72. package/dist/node_modules/@langchain/core/dist/output_parsers/xml.cjs +2 -2
  73. package/dist/node_modules/@langchain/core/dist/prompts/base.cjs +36 -3
  74. package/dist/node_modules/@langchain/core/dist/prompts/chat.cjs +72 -24
  75. package/dist/node_modules/@langchain/core/dist/prompts/chat.d.ts +5 -4
  76. package/dist/node_modules/@langchain/core/dist/prompts/chat.js +72 -24
  77. package/dist/node_modules/@langchain/core/dist/prompts/dict.cjs +114 -0
  78. package/dist/node_modules/@langchain/core/dist/prompts/dict.d.ts +18 -0
  79. package/dist/node_modules/@langchain/core/dist/prompts/dict.js +110 -0
  80. package/dist/node_modules/@langchain/core/dist/prompts/index.cjs +1 -0
  81. package/dist/node_modules/@langchain/core/dist/prompts/index.d.ts +1 -0
  82. package/dist/node_modules/@langchain/core/dist/prompts/index.js +1 -0
  83. package/dist/node_modules/@langchain/core/dist/prompts/structured.cjs +16 -6
  84. package/dist/node_modules/@langchain/core/dist/prompts/structured.d.ts +3 -1
  85. package/dist/node_modules/@langchain/core/dist/prompts/structured.js +16 -6
  86. package/dist/node_modules/@langchain/core/dist/prompts/template.cjs +24 -13
  87. package/dist/node_modules/@langchain/core/dist/prompts/template.js +24 -13
  88. package/dist/node_modules/@langchain/core/dist/runnables/base.cjs +81 -38
  89. package/dist/node_modules/@langchain/core/dist/runnables/base.d.ts +44 -18
  90. package/dist/node_modules/@langchain/core/dist/runnables/base.js +74 -31
  91. package/dist/node_modules/@langchain/core/dist/runnables/config.cjs +6 -6
  92. package/dist/node_modules/@langchain/core/dist/runnables/graph.cjs +2 -2
  93. package/dist/node_modules/@langchain/core/dist/runnables/graph.js +2 -2
  94. package/dist/node_modules/@langchain/core/dist/runnables/graph_mermaid.cjs +29 -6
  95. package/dist/node_modules/@langchain/core/dist/runnables/graph_mermaid.d.ts +25 -1
  96. package/dist/node_modules/@langchain/core/dist/runnables/graph_mermaid.js +26 -3
  97. package/dist/node_modules/@langchain/core/dist/runnables/iter.cjs +5 -5
  98. package/dist/node_modules/@langchain/core/dist/runnables/iter.d.ts +1 -1
  99. package/dist/node_modules/@langchain/core/dist/runnables/passthrough.cjs +1 -1
  100. package/dist/node_modules/@langchain/core/dist/runnables/passthrough.d.ts +1 -1
  101. package/dist/node_modules/@langchain/core/dist/runnables/passthrough.js +1 -1
  102. package/dist/node_modules/@langchain/core/dist/runnables/remote.cjs +2 -0
  103. package/dist/node_modules/@langchain/core/dist/runnables/remote.d.ts +2 -0
  104. package/dist/node_modules/@langchain/core/dist/runnables/remote.js +2 -0
  105. package/dist/node_modules/@langchain/core/dist/runnables/types.d.ts +2 -2
  106. package/dist/node_modules/@langchain/core/dist/runnables/utils.cjs +2 -2
  107. package/dist/node_modules/@langchain/core/dist/runnables/wrappers.cjs +1 -2
  108. package/dist/node_modules/@langchain/core/dist/runnables/wrappers.d.ts +1 -1
  109. package/dist/node_modules/@langchain/core/dist/singletons/async_local_storage/context.cjs +3 -3
  110. package/dist/node_modules/@langchain/core/dist/singletons/async_local_storage/index.cjs +1 -1
  111. package/dist/node_modules/@langchain/core/dist/singletons/async_local_storage/index.js +1 -1
  112. package/dist/node_modules/@langchain/core/dist/singletons/callbacks.cjs +10 -6
  113. package/dist/node_modules/@langchain/core/dist/singletons/callbacks.d.ts +1 -1
  114. package/dist/node_modules/@langchain/core/dist/singletons/callbacks.js +7 -2
  115. package/dist/node_modules/@langchain/core/dist/structured_query/utils.cjs +7 -8
  116. package/dist/node_modules/@langchain/core/dist/tools/index.cjs +99 -45
  117. package/dist/node_modules/@langchain/core/dist/tools/index.d.ts +51 -151
  118. package/dist/node_modules/@langchain/core/dist/tools/index.js +94 -44
  119. package/dist/node_modules/@langchain/core/dist/tools/types.cjs +64 -0
  120. package/dist/node_modules/@langchain/core/dist/tools/types.d.ts +272 -0
  121. package/dist/node_modules/@langchain/core/dist/tools/types.js +58 -0
  122. package/dist/node_modules/@langchain/core/dist/tools/utils.cjs +12 -2
  123. package/dist/node_modules/@langchain/core/dist/tools/utils.d.ts +5 -0
  124. package/dist/node_modules/@langchain/core/dist/tools/utils.js +9 -0
  125. package/dist/node_modules/@langchain/core/dist/tracers/base.cjs +96 -32
  126. package/dist/node_modules/@langchain/core/dist/tracers/base.d.ts +104 -84
  127. package/dist/node_modules/@langchain/core/dist/tracers/base.js +94 -30
  128. package/dist/node_modules/@langchain/core/dist/tracers/initialize.cjs +2 -3
  129. package/dist/node_modules/@langchain/core/dist/tracers/tracer_langchain.cjs +39 -75
  130. package/dist/node_modules/@langchain/core/dist/tracers/tracer_langchain.d.ts +6 -4
  131. package/dist/node_modules/@langchain/core/dist/tracers/tracer_langchain.js +39 -75
  132. package/dist/node_modules/@langchain/core/dist/utils/async_caller.cjs +9 -9
  133. package/dist/node_modules/@langchain/core/dist/utils/async_caller.js +9 -9
  134. package/dist/node_modules/@langchain/core/dist/utils/env.cjs +11 -6
  135. package/dist/node_modules/@langchain/core/dist/utils/env.d.ts +4 -0
  136. package/dist/node_modules/@langchain/core/dist/utils/env.js +7 -3
  137. package/dist/node_modules/@langchain/core/dist/utils/event_source_parse.cjs +5 -5
  138. package/dist/node_modules/@langchain/core/dist/utils/fast-json-patch/index.cjs +17 -7
  139. package/dist/node_modules/@langchain/core/dist/utils/fast-json-patch/index.d.ts +4 -4
  140. package/dist/node_modules/@langchain/core/dist/utils/fast-json-patch/src/core.cjs +8 -8
  141. package/dist/node_modules/@langchain/core/dist/utils/fast-json-patch/src/duplex.cjs +4 -5
  142. package/dist/node_modules/@langchain/core/dist/utils/fast-json-patch/src/helpers.cjs +10 -10
  143. package/dist/node_modules/@langchain/core/dist/utils/fast-json-patch/src/helpers.d.ts +3 -3
  144. package/dist/node_modules/@langchain/core/dist/utils/function_calling.cjs +20 -72
  145. package/dist/node_modules/@langchain/core/dist/utils/function_calling.d.ts +8 -38
  146. package/dist/node_modules/@langchain/core/dist/utils/function_calling.js +12 -64
  147. package/dist/node_modules/@langchain/core/dist/utils/hash.cjs +3 -1
  148. package/dist/node_modules/@langchain/core/dist/utils/hash.d.ts +7 -0
  149. package/dist/node_modules/@langchain/core/dist/utils/hash.js +1 -0
  150. package/dist/node_modules/@langchain/core/dist/utils/js-sha1/hash.cjs +17 -0
  151. package/dist/node_modules/@langchain/core/dist/utils/js-sha1/hash.d.ts +4 -0
  152. package/dist/node_modules/@langchain/core/dist/utils/js-sha1/hash.js +17 -0
  153. package/dist/node_modules/@langchain/core/dist/utils/js-sha256/hash.cjs +448 -0
  154. package/dist/node_modules/@langchain/core/dist/utils/js-sha256/hash.d.ts +1 -0
  155. package/dist/node_modules/@langchain/core/dist/utils/js-sha256/hash.js +445 -0
  156. package/dist/node_modules/@langchain/core/dist/utils/json.cjs +19 -7
  157. package/dist/node_modules/@langchain/core/dist/utils/json.js +17 -4
  158. package/dist/node_modules/@langchain/core/dist/utils/json_schema.cjs +95 -3
  159. package/dist/node_modules/@langchain/core/dist/utils/json_schema.d.ts +18 -0
  160. package/dist/node_modules/@langchain/core/dist/utils/json_schema.js +90 -0
  161. package/dist/node_modules/@langchain/core/dist/utils/math.cjs +6 -7
  162. package/dist/node_modules/@langchain/core/dist/utils/ml-distance/distances.cjs +1 -2
  163. package/dist/node_modules/@langchain/core/dist/utils/ml-distance/similarities.cjs +1 -2
  164. package/dist/node_modules/@langchain/core/dist/utils/ml-distance-euclidean/euclidean.cjs +2 -3
  165. package/dist/node_modules/@langchain/core/dist/utils/sax-js/sax.cjs +35 -35
  166. package/dist/node_modules/@langchain/core/dist/utils/sax-js/sax.js +35 -35
  167. package/dist/node_modules/@langchain/core/dist/utils/signal.cjs +1 -2
  168. package/dist/node_modules/@langchain/core/dist/utils/stream.cjs +4 -4
  169. package/dist/node_modules/@langchain/core/dist/utils/testing/helpers.cjs +7 -0
  170. package/dist/node_modules/@langchain/core/dist/utils/testing/helpers.d.ts +3 -0
  171. package/dist/node_modules/@langchain/core/dist/utils/testing/helpers.js +3 -0
  172. package/dist/node_modules/@langchain/core/dist/utils/testing/index.cjs +109 -24
  173. package/dist/node_modules/@langchain/core/dist/utils/testing/index.d.ts +43 -16
  174. package/dist/node_modules/@langchain/core/dist/utils/testing/index.js +109 -24
  175. package/dist/node_modules/@langchain/core/dist/utils/tiktoken.cjs +2 -3
  176. package/dist/node_modules/@langchain/core/dist/utils/types/index.cjs +1 -1
  177. package/dist/node_modules/@langchain/core/dist/utils/types/index.d.ts +1 -1
  178. package/dist/node_modules/@langchain/core/dist/utils/types/index.js +1 -1
  179. package/dist/node_modules/@langchain/core/dist/utils/types/zod.cjs +619 -0
  180. package/dist/node_modules/@langchain/core/dist/utils/types/zod.d.ts +212 -0
  181. package/dist/node_modules/@langchain/core/dist/utils/types/zod.js +595 -0
  182. package/dist/node_modules/@langchain/core/index.cjs +1 -1
  183. package/dist/node_modules/@langchain/core/index.d.cts +3 -0
  184. package/dist/node_modules/@langchain/core/index.d.ts +3 -0
  185. package/dist/node_modules/@langchain/core/index.js +3 -0
  186. package/dist/node_modules/@langchain/core/node_modules/langsmith/README.md +1 -0
  187. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/anonymizer/index.cjs +1 -2
  188. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/client.cjs +1153 -542
  189. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/client.d.ts +157 -18
  190. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/client.js +1136 -535
  191. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/evaluation/_random_name.cjs +1 -2
  192. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/evaluation/_runner.cjs +6 -3
  193. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/evaluation/_runner.js +5 -2
  194. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/evaluation/evaluate_comparative.cjs +7 -3
  195. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/evaluation/evaluate_comparative.d.ts +1 -0
  196. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/evaluation/evaluate_comparative.js +6 -1
  197. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/evaluation/evaluator.cjs +8 -4
  198. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/evaluation/evaluator.js +6 -2
  199. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/evaluation/langchain.cjs +1 -2
  200. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/constants.cjs +60 -0
  201. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/constants.d.ts +49 -0
  202. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/constants.js +57 -0
  203. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/exporter.cjs +222 -0
  204. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/exporter.d.ts +60 -0
  205. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/exporter.js +185 -0
  206. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/processor.cjs +90 -0
  207. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/processor.d.ts +13 -0
  208. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/processor.js +85 -0
  209. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/setup.cjs +93 -0
  210. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/setup.d.ts +64 -0
  211. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/setup.js +89 -0
  212. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/translator.cjs +447 -0
  213. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/translator.d.ts +22 -0
  214. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/translator.js +410 -0
  215. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/types.cjs +5 -0
  216. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/types.d.ts +29 -0
  217. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/types.js +4 -0
  218. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/utils.cjs +23 -0
  219. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/utils.d.ts +12 -0
  220. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/otel/utils.js +19 -0
  221. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/vercel/index.cjs +439 -0
  222. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/vercel/index.d.ts +240 -0
  223. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/vercel/index.js +435 -0
  224. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/vercel/middleware.cjs +235 -0
  225. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/vercel/middleware.d.ts +27 -0
  226. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/vercel/middleware.js +232 -0
  227. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/vercel/utils.cjs +170 -0
  228. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/vercel/utils.d.ts +4 -0
  229. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/experimental/vercel/utils.js +165 -0
  230. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/index.cjs +4 -2
  231. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/index.d.ts +2 -1
  232. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/index.js +2 -1
  233. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/jest/index.cjs +70 -3
  234. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/jest/index.d.ts +182 -60
  235. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/jest/index.js +70 -4
  236. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/langchain.cjs +6 -2
  237. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/langchain.d.ts +1 -0
  238. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/langchain.js +4 -0
  239. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/run_trees.cjs +350 -63
  240. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/run_trees.d.ts +35 -8
  241. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/run_trees.js +324 -47
  242. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/schemas.d.ts +32 -5
  243. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/singletons/fetch.cjs +30 -4
  244. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/singletons/fetch.d.ts +2 -0
  245. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/singletons/fetch.js +27 -3
  246. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/singletons/otel.cjs +155 -0
  247. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/singletons/otel.d.ts +63 -0
  248. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/singletons/otel.js +147 -0
  249. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/singletons/traceable.cjs +8 -19
  250. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/singletons/traceable.d.ts +7 -5
  251. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/singletons/traceable.js +4 -15
  252. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/singletons/types.cjs +1 -0
  253. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/singletons/types.d.ts +4 -0
  254. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/singletons/types.js +1 -1
  255. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/traceable.cjs +250 -64
  256. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/traceable.d.ts +21 -18
  257. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/traceable.js +249 -63
  258. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/_uuid.cjs +6 -27
  259. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/_uuid.js +5 -2
  260. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/asserts.cjs +3 -3
  261. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/asserts.d.ts +3 -3
  262. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/async_caller.cjs +16 -28
  263. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/async_caller.d.ts +1 -1
  264. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/async_caller.js +16 -28
  265. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/atee.cjs +1 -2
  266. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/env.cjs +48 -62
  267. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/env.d.ts +8 -18
  268. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/env.js +39 -53
  269. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/error.cjs +68 -10
  270. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/error.d.ts +7 -1
  271. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/error.js +63 -7
  272. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs +54 -6
  273. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/fast-safe-stringify/index.d.ts +1 -1
  274. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js +53 -4
  275. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/jestlike/globals.cjs +3 -3
  276. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/jestlike/globals.d.ts +2 -1
  277. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/jestlike/index.cjs +170 -70
  278. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/jestlike/index.d.ts +79 -67
  279. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/jestlike/index.js +148 -58
  280. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/jestlike/matchers.cjs +3 -4
  281. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/jestlike/reporter.cjs +18 -9
  282. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/jestlike/types.d.ts +19 -4
  283. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/jestlike/vendor/chain.cjs +1 -2
  284. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/jestlike/vendor/chain.d.ts +0 -1
  285. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/jestlike/vendor/evaluatedBy.cjs +13 -7
  286. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/jestlike/vendor/evaluatedBy.js +12 -5
  287. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/messages.cjs +2 -3
  288. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/project.cjs +10 -0
  289. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/project.d.ts +1 -0
  290. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/project.js +6 -0
  291. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/prompts.cjs +2 -3
  292. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/shuffle.cjs +1 -2
  293. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/vercel.cjs +155 -0
  294. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/vercel.d.ts +10 -0
  295. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/vercel.js +150 -0
  296. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/utils/warn.cjs +1 -2
  297. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vercel.cjs +277 -84
  298. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vercel.d.ts +17 -5
  299. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vercel.js +275 -83
  300. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/index.cjs +11 -9
  301. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/index.d.mts +392 -0
  302. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/index.d.ts +73 -116
  303. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/index.js +8 -7
  304. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/index.mjs +324 -0
  305. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/reporter.cjs +2 -17
  306. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/reporter.d.mts +5 -0
  307. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/reporter.js +2 -17
  308. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/reporter.mjs +12 -0
  309. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/utils/esm.d.mts +8 -0
  310. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/utils/esm.mjs +38 -0
  311. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/utils/reporter.cjs +25 -0
  312. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/utils/reporter.d.ts +1 -0
  313. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/utils/reporter.js +21 -0
  314. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/utils/wrapper.cjs +63 -0
  315. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/utils/wrapper.d.ts +167 -0
  316. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/vitest/utils/wrapper.js +59 -0
  317. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/wrappers/openai.cjs +162 -90
  318. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/wrappers/openai.d.ts +10 -11
  319. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/wrappers/openai.js +163 -91
  320. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/wrappers/vercel.cjs +1 -0
  321. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/wrappers/vercel.d.ts +1 -0
  322. package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/wrappers/vercel.js +1 -0
  323. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/otel/exporter.cjs +1 -0
  324. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/otel/exporter.d.cts +1 -0
  325. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/otel/exporter.d.ts +1 -0
  326. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/otel/exporter.js +1 -0
  327. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/otel/processor.cjs +1 -0
  328. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/otel/processor.d.cts +1 -0
  329. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/otel/processor.d.ts +1 -0
  330. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/otel/processor.js +1 -0
  331. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/otel/setup.cjs +1 -0
  332. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/otel/setup.d.cts +1 -0
  333. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/otel/setup.d.ts +1 -0
  334. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/otel/setup.js +1 -0
  335. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/vercel.cjs +1 -0
  336. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/vercel.d.cts +1 -0
  337. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/vercel.d.ts +1 -0
  338. package/dist/node_modules/@langchain/core/node_modules/langsmith/experimental/vercel.js +1 -0
  339. package/dist/node_modules/@langchain/core/node_modules/langsmith/package.json +84 -14
  340. package/dist/node_modules/@langchain/core/node_modules/langsmith/vitest/reporter.d.ts +1 -1
  341. package/dist/node_modules/@langchain/core/node_modules/langsmith/vitest/reporter.js +1 -1
  342. package/dist/node_modules/@langchain/core/node_modules/langsmith/vitest.d.ts +1 -1
  343. package/dist/node_modules/@langchain/core/node_modules/langsmith/vitest.js +1 -1
  344. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/index.js +22 -0
  345. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/package.json +3 -0
  346. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/ZodError.js +137 -0
  347. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/benchmarks/datetime.js +54 -0
  348. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/benchmarks/discriminatedUnion.js +79 -0
  349. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/benchmarks/index.js +59 -0
  350. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/benchmarks/ipv4.js +54 -0
  351. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/benchmarks/object.js +70 -0
  352. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/benchmarks/primitives.js +159 -0
  353. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/benchmarks/realworld.js +56 -0
  354. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/benchmarks/string.js +55 -0
  355. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/benchmarks/union.js +79 -0
  356. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/errors.js +17 -0
  357. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/external.js +22 -0
  358. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/helpers/enumUtil.js +2 -0
  359. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/helpers/errorUtil.js +9 -0
  360. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/helpers/parseUtil.js +124 -0
  361. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/helpers/partialUtil.js +2 -0
  362. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/helpers/typeAliases.js +2 -0
  363. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/helpers/util.js +137 -0
  364. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/index.js +33 -0
  365. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/locales/en.js +109 -0
  366. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/standard-schema.js +2 -0
  367. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/tests/Mocker.js +57 -0
  368. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v3/types.js +3773 -0
  369. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/classic/checks.js +32 -0
  370. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/classic/coerce.js +47 -0
  371. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/classic/compat.js +63 -0
  372. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/classic/errors.js +67 -0
  373. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/classic/external.js +69 -0
  374. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/classic/index.js +33 -0
  375. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/classic/iso.js +60 -0
  376. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/classic/parse.js +32 -0
  377. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/classic/schemas.js +1100 -0
  378. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/api.js +1021 -0
  379. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/checks.js +580 -0
  380. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/config.js +10 -0
  381. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/core.js +63 -0
  382. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/doc.js +39 -0
  383. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/errors.js +222 -0
  384. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/function.js +102 -0
  385. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/index.js +44 -0
  386. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/json-schema.js +2 -0
  387. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/parse.js +87 -0
  388. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/regexes.js +103 -0
  389. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/registries.js +47 -0
  390. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/schemas.js +1719 -0
  391. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/standard-schema.js +2 -0
  392. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/to-json-schema.js +833 -0
  393. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/util.js +537 -0
  394. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/versions.js +8 -0
  395. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/core/zsf.js +172 -0
  396. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/index.js +22 -0
  397. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/ar.js +142 -0
  398. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/az.js +141 -0
  399. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/be.js +190 -0
  400. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/ca.js +144 -0
  401. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/cs.js +161 -0
  402. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/de.js +142 -0
  403. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/en.js +145 -0
  404. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/es.js +143 -0
  405. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/fa.js +148 -0
  406. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/fi.js +148 -0
  407. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/fr-CA.js +143 -0
  408. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/fr.js +142 -0
  409. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/he.js +143 -0
  410. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/hu.js +143 -0
  411. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/id.js +142 -0
  412. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/index.js +82 -0
  413. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/it.js +143 -0
  414. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/ja.js +141 -0
  415. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/kh.js +143 -0
  416. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/ko.js +147 -0
  417. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/mk.js +144 -0
  418. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/ms.js +142 -0
  419. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/nl.js +143 -0
  420. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/no.js +142 -0
  421. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/ota.js +143 -0
  422. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/pl.js +143 -0
  423. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/ps.js +148 -0
  424. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/pt.js +142 -0
  425. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/ru.js +190 -0
  426. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/sl.js +143 -0
  427. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/sv.js +144 -0
  428. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/ta.js +143 -0
  429. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/th.js +143 -0
  430. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/tr.js +143 -0
  431. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/ua.js +143 -0
  432. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/ur.js +143 -0
  433. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/vi.js +142 -0
  434. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/zh-CN.js +142 -0
  435. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/locales/zh-TW.js +143 -0
  436. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/mini/checks.js +34 -0
  437. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/mini/coerce.js +47 -0
  438. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/mini/external.js +61 -0
  439. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/mini/index.js +32 -0
  440. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/mini/iso.js +60 -0
  441. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/mini/parse.js +8 -0
  442. package/dist/node_modules/@langchain/core/node_modules/zod/dist/cjs/v4/mini/schemas.js +831 -0
  443. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/index.js +3 -0
  444. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/package.json +3 -0
  445. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/ZodError.js +132 -0
  446. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/benchmarks/datetime.js +49 -0
  447. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/benchmarks/discriminatedUnion.js +74 -0
  448. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/benchmarks/index.js +54 -0
  449. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/benchmarks/ipv4.js +49 -0
  450. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/benchmarks/object.js +65 -0
  451. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/benchmarks/primitives.js +154 -0
  452. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/benchmarks/realworld.js +51 -0
  453. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/benchmarks/string.js +50 -0
  454. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/benchmarks/union.js +74 -0
  455. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/errors.js +9 -0
  456. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/external.js +6 -0
  457. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/helpers/enumUtil.js +1 -0
  458. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/helpers/errorUtil.js +6 -0
  459. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/helpers/parseUtil.js +109 -0
  460. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/helpers/partialUtil.js +1 -0
  461. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/helpers/typeAliases.js +1 -0
  462. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/helpers/util.js +133 -0
  463. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/index.js +4 -0
  464. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/locales/en.js +107 -0
  465. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/standard-schema.js +1 -0
  466. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/tests/Mocker.js +53 -0
  467. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v3/types.js +3691 -0
  468. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/classic/checks.js +1 -0
  469. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/classic/coerce.js +17 -0
  470. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/classic/compat.js +33 -0
  471. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/classic/errors.js +41 -0
  472. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/classic/external.js +18 -0
  473. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/classic/index.js +4 -0
  474. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/classic/iso.js +30 -0
  475. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/classic/parse.js +6 -0
  476. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/classic/schemas.js +998 -0
  477. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/api.js +889 -0
  478. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/checks.js +554 -0
  479. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/config.js +6 -0
  480. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/core.js +57 -0
  481. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/doc.js +35 -0
  482. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/errors.js +191 -0
  483. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/function.js +75 -0
  484. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/index.js +15 -0
  485. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/json-schema.js +1 -0
  486. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/parse.js +57 -0
  487. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/regexes.js +95 -0
  488. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/registries.js +42 -0
  489. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/schemas.js +1688 -0
  490. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/standard-schema.js +1 -0
  491. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/to-json-schema.js +828 -0
  492. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/util.js +491 -0
  493. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/versions.js +5 -0
  494. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/core/zsf.js +171 -0
  495. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/index.js +3 -0
  496. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/ar.js +116 -0
  497. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/az.js +115 -0
  498. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/be.js +164 -0
  499. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/ca.js +118 -0
  500. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/cs.js +135 -0
  501. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/de.js +116 -0
  502. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/en.js +117 -0
  503. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/es.js +117 -0
  504. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/fa.js +122 -0
  505. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/fi.js +122 -0
  506. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/fr-CA.js +117 -0
  507. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/fr.js +116 -0
  508. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/he.js +117 -0
  509. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/hu.js +117 -0
  510. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/id.js +116 -0
  511. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/index.js +38 -0
  512. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/it.js +117 -0
  513. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/ja.js +115 -0
  514. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/kh.js +117 -0
  515. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/ko.js +121 -0
  516. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/mk.js +118 -0
  517. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/ms.js +116 -0
  518. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/nl.js +117 -0
  519. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/no.js +116 -0
  520. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/ota.js +117 -0
  521. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/pl.js +117 -0
  522. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/ps.js +122 -0
  523. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/pt.js +116 -0
  524. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/ru.js +164 -0
  525. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/sl.js +117 -0
  526. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/sv.js +118 -0
  527. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/ta.js +117 -0
  528. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/th.js +117 -0
  529. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/tr.js +115 -0
  530. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/ua.js +117 -0
  531. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/ur.js +117 -0
  532. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/vi.js +116 -0
  533. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/zh-CN.js +116 -0
  534. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/locales/zh-TW.js +117 -0
  535. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/mini/checks.js +1 -0
  536. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/mini/coerce.js +17 -0
  537. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/mini/external.js +13 -0
  538. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/mini/index.js +3 -0
  539. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/mini/iso.js +30 -0
  540. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/mini/parse.js +1 -0
  541. package/dist/node_modules/@langchain/core/node_modules/zod/dist/esm/v4/mini/schemas.js +725 -0
  542. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/index.d.ts +3 -0
  543. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/package.json +3 -0
  544. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/ZodError.d.ts +164 -0
  545. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/benchmarks/datetime.d.ts +5 -0
  546. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/benchmarks/discriminatedUnion.d.ts +5 -0
  547. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/benchmarks/index.d.ts +1 -0
  548. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/benchmarks/ipv4.d.ts +5 -0
  549. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/benchmarks/object.d.ts +5 -0
  550. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/benchmarks/primitives.d.ts +5 -0
  551. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/benchmarks/realworld.d.ts +5 -0
  552. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/benchmarks/string.d.ts +5 -0
  553. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/benchmarks/union.d.ts +5 -0
  554. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/errors.d.ts +5 -0
  555. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/external.d.ts +6 -0
  556. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/helpers/enumUtil.d.ts +8 -0
  557. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/helpers/errorUtil.d.ts +9 -0
  558. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/helpers/parseUtil.d.ts +78 -0
  559. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/helpers/partialUtil.d.ts +8 -0
  560. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/helpers/typeAliases.d.ts +2 -0
  561. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/helpers/util.d.ts +85 -0
  562. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/index.d.ts +4 -0
  563. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/locales/en.d.ts +3 -0
  564. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/standard-schema.d.ts +102 -0
  565. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/tests/Mocker.d.ts +17 -0
  566. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v3/types.d.ts +1031 -0
  567. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/classic/checks.d.ts +1 -0
  568. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/classic/coerce.d.ts +17 -0
  569. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/classic/compat.d.ts +48 -0
  570. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/classic/errors.d.ts +30 -0
  571. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/classic/external.d.ts +13 -0
  572. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/classic/index.d.ts +4 -0
  573. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/classic/iso.d.ts +22 -0
  574. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/classic/parse.d.ts +23 -0
  575. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/classic/schemas.d.ts +624 -0
  576. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/api.d.ts +281 -0
  577. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/checks.d.ts +277 -0
  578. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/config.d.ts +9 -0
  579. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/core.d.ts +47 -0
  580. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/doc.d.ts +14 -0
  581. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/errors.d.ts +204 -0
  582. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/function.d.ts +52 -0
  583. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/index.d.ts +15 -0
  584. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/json-schema.d.ts +87 -0
  585. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/parse.d.ts +25 -0
  586. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/regexes.d.ts +62 -0
  587. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/registries.d.ts +39 -0
  588. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/schemas.d.ts +1005 -0
  589. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/standard-schema.d.ts +55 -0
  590. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/to-json-schema.d.ts +84 -0
  591. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/util.d.ts +183 -0
  592. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/versions.d.ts +5 -0
  593. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/core/zsf.d.ts +91 -0
  594. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/index.d.ts +3 -0
  595. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/ar.d.ts +4 -0
  596. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/az.d.ts +4 -0
  597. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/be.d.ts +4 -0
  598. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/ca.d.ts +4 -0
  599. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/cs.d.ts +4 -0
  600. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/de.d.ts +4 -0
  601. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/en.d.ts +5 -0
  602. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/es.d.ts +4 -0
  603. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/fa.d.ts +4 -0
  604. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/fi.d.ts +4 -0
  605. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/fr-CA.d.ts +4 -0
  606. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/fr.d.ts +4 -0
  607. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/he.d.ts +4 -0
  608. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/hu.d.ts +4 -0
  609. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/id.d.ts +4 -0
  610. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/index.d.ts +38 -0
  611. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/it.d.ts +4 -0
  612. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/ja.d.ts +4 -0
  613. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/kh.d.ts +4 -0
  614. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/ko.d.ts +4 -0
  615. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/mk.d.ts +4 -0
  616. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/ms.d.ts +4 -0
  617. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/nl.d.ts +4 -0
  618. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/no.d.ts +4 -0
  619. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/ota.d.ts +4 -0
  620. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/pl.d.ts +4 -0
  621. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/ps.d.ts +4 -0
  622. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/pt.d.ts +4 -0
  623. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/ru.d.ts +4 -0
  624. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/sl.d.ts +4 -0
  625. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/sv.d.ts +4 -0
  626. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/ta.d.ts +4 -0
  627. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/th.d.ts +4 -0
  628. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/tr.d.ts +5 -0
  629. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/ua.d.ts +4 -0
  630. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/ur.d.ts +4 -0
  631. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/vi.d.ts +4 -0
  632. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/zh-CN.d.ts +4 -0
  633. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/locales/zh-TW.d.ts +4 -0
  634. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/mini/checks.d.ts +1 -0
  635. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/mini/coerce.d.ts +7 -0
  636. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/mini/external.d.ts +11 -0
  637. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/mini/index.d.ts +3 -0
  638. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/mini/iso.d.ts +22 -0
  639. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/mini/parse.d.ts +1 -0
  640. package/dist/node_modules/@langchain/core/node_modules/zod/dist/types/v4/mini/schemas.d.ts +351 -0
  641. package/dist/node_modules/@langchain/core/node_modules/zod/v3/index.d.ts +3 -0
  642. package/dist/node_modules/@langchain/core/node_modules/zod/v3/index.js +1 -0
  643. package/dist/node_modules/@langchain/core/node_modules/zod/v4/core/index.d.ts +1 -0
  644. package/dist/node_modules/@langchain/core/node_modules/zod/v4/core/index.js +1 -0
  645. package/dist/node_modules/@langchain/core/node_modules/zod/v4/index.d.ts +3 -0
  646. package/dist/node_modules/@langchain/core/node_modules/zod/v4/index.js +1 -0
  647. package/dist/node_modules/@langchain/core/node_modules/zod/v4/locales/en.d.ts +2 -0
  648. package/dist/node_modules/@langchain/core/node_modules/zod/v4/locales/en.js +2 -0
  649. package/dist/node_modules/@langchain/core/node_modules/zod/v4/locales/index.d.ts +1 -0
  650. package/dist/node_modules/@langchain/core/node_modules/zod/v4/locales/index.js +1 -0
  651. package/dist/node_modules/@langchain/core/node_modules/zod/v4-mini/index.d.ts +1 -0
  652. package/dist/node_modules/@langchain/core/node_modules/zod/v4-mini/index.js +1 -0
  653. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/LICENSE +21 -0
  654. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/README.md +208 -0
  655. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/index.js +22 -0
  656. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/package.json +3 -0
  657. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/ZodError.js +137 -0
  658. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/benchmarks/datetime.js +54 -0
  659. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/benchmarks/discriminatedUnion.js +79 -0
  660. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/benchmarks/index.js +59 -0
  661. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/benchmarks/ipv4.js +54 -0
  662. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/benchmarks/object.js +70 -0
  663. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/benchmarks/primitives.js +159 -0
  664. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/benchmarks/realworld.js +56 -0
  665. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/benchmarks/string.js +55 -0
  666. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/benchmarks/union.js +79 -0
  667. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/errors.js +17 -0
  668. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/external.js +22 -0
  669. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/helpers/enumUtil.js +2 -0
  670. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/helpers/errorUtil.js +9 -0
  671. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/helpers/parseUtil.js +124 -0
  672. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/helpers/partialUtil.js +2 -0
  673. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/helpers/typeAliases.js +2 -0
  674. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/helpers/util.js +137 -0
  675. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/index.js +33 -0
  676. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/locales/en.js +109 -0
  677. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/standard-schema.js +2 -0
  678. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/tests/Mocker.js +57 -0
  679. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v3/types.js +3773 -0
  680. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/classic/checks.js +32 -0
  681. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/classic/coerce.js +47 -0
  682. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/classic/compat.js +63 -0
  683. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/classic/errors.js +67 -0
  684. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/classic/external.js +69 -0
  685. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/classic/index.js +33 -0
  686. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/classic/iso.js +60 -0
  687. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/classic/parse.js +32 -0
  688. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/classic/schemas.js +1100 -0
  689. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/api.js +1021 -0
  690. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/checks.js +580 -0
  691. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/config.js +10 -0
  692. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/core.js +63 -0
  693. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/doc.js +39 -0
  694. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/errors.js +222 -0
  695. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/function.js +102 -0
  696. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/index.js +44 -0
  697. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/json-schema.js +2 -0
  698. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/parse.js +87 -0
  699. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/regexes.js +103 -0
  700. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/registries.js +47 -0
  701. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/schemas.js +1719 -0
  702. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/standard-schema.js +2 -0
  703. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/to-json-schema.js +833 -0
  704. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/util.js +537 -0
  705. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/versions.js +8 -0
  706. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/core/zsf.js +172 -0
  707. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/index.js +22 -0
  708. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/ar.js +142 -0
  709. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/az.js +141 -0
  710. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/be.js +190 -0
  711. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/ca.js +144 -0
  712. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/cs.js +161 -0
  713. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/de.js +142 -0
  714. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/en.js +145 -0
  715. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/es.js +143 -0
  716. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/fa.js +148 -0
  717. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/fi.js +148 -0
  718. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/fr-CA.js +143 -0
  719. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/fr.js +142 -0
  720. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/he.js +143 -0
  721. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/hu.js +143 -0
  722. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/id.js +142 -0
  723. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/index.js +82 -0
  724. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/it.js +143 -0
  725. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/ja.js +141 -0
  726. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/kh.js +143 -0
  727. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/ko.js +147 -0
  728. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/mk.js +144 -0
  729. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/ms.js +142 -0
  730. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/nl.js +143 -0
  731. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/no.js +142 -0
  732. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/ota.js +143 -0
  733. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/pl.js +143 -0
  734. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/ps.js +148 -0
  735. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/pt.js +142 -0
  736. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/ru.js +190 -0
  737. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/sl.js +143 -0
  738. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/sv.js +144 -0
  739. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/ta.js +143 -0
  740. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/th.js +143 -0
  741. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/tr.js +143 -0
  742. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/ua.js +143 -0
  743. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/ur.js +143 -0
  744. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/vi.js +142 -0
  745. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/zh-CN.js +142 -0
  746. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/locales/zh-TW.js +143 -0
  747. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/mini/checks.js +34 -0
  748. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/mini/coerce.js +47 -0
  749. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/mini/external.js +61 -0
  750. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/mini/index.js +32 -0
  751. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/mini/iso.js +60 -0
  752. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/mini/parse.js +8 -0
  753. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/cjs/v4/mini/schemas.js +831 -0
  754. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/index.js +3 -0
  755. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/package.json +3 -0
  756. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/ZodError.js +132 -0
  757. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/benchmarks/datetime.js +49 -0
  758. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/benchmarks/discriminatedUnion.js +74 -0
  759. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/benchmarks/index.js +54 -0
  760. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/benchmarks/ipv4.js +49 -0
  761. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/benchmarks/object.js +65 -0
  762. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/benchmarks/primitives.js +154 -0
  763. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/benchmarks/realworld.js +51 -0
  764. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/benchmarks/string.js +50 -0
  765. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/benchmarks/union.js +74 -0
  766. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/errors.js +9 -0
  767. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/external.js +6 -0
  768. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/helpers/enumUtil.js +1 -0
  769. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/helpers/errorUtil.js +6 -0
  770. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/helpers/parseUtil.js +109 -0
  771. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/helpers/partialUtil.js +1 -0
  772. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/helpers/typeAliases.js +1 -0
  773. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/helpers/util.js +133 -0
  774. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/index.js +4 -0
  775. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/locales/en.js +107 -0
  776. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/standard-schema.js +1 -0
  777. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/tests/Mocker.js +53 -0
  778. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v3/types.js +3691 -0
  779. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/classic/checks.js +1 -0
  780. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/classic/coerce.js +17 -0
  781. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/classic/compat.js +33 -0
  782. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/classic/errors.js +41 -0
  783. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/classic/external.js +18 -0
  784. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/classic/index.js +4 -0
  785. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/classic/iso.js +30 -0
  786. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/classic/parse.js +6 -0
  787. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/classic/schemas.js +998 -0
  788. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/api.js +889 -0
  789. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/checks.js +554 -0
  790. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/config.js +6 -0
  791. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/core.js +57 -0
  792. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/doc.js +35 -0
  793. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/errors.js +191 -0
  794. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/function.js +75 -0
  795. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/index.js +15 -0
  796. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/json-schema.js +1 -0
  797. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/parse.js +57 -0
  798. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/regexes.js +95 -0
  799. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/registries.js +42 -0
  800. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/schemas.js +1688 -0
  801. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/standard-schema.js +1 -0
  802. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/to-json-schema.js +828 -0
  803. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/util.js +491 -0
  804. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/versions.js +5 -0
  805. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/core/zsf.js +171 -0
  806. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/index.js +3 -0
  807. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/ar.js +116 -0
  808. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/az.js +115 -0
  809. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/be.js +164 -0
  810. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/ca.js +118 -0
  811. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/cs.js +135 -0
  812. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/de.js +116 -0
  813. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/en.js +117 -0
  814. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/es.js +117 -0
  815. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/fa.js +122 -0
  816. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/fi.js +122 -0
  817. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/fr-CA.js +117 -0
  818. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/fr.js +116 -0
  819. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/he.js +117 -0
  820. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/hu.js +117 -0
  821. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/id.js +116 -0
  822. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/index.js +38 -0
  823. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/it.js +117 -0
  824. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/ja.js +115 -0
  825. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/kh.js +117 -0
  826. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/ko.js +121 -0
  827. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/mk.js +118 -0
  828. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/ms.js +116 -0
  829. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/nl.js +117 -0
  830. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/no.js +116 -0
  831. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/ota.js +117 -0
  832. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/pl.js +117 -0
  833. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/ps.js +122 -0
  834. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/pt.js +116 -0
  835. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/ru.js +164 -0
  836. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/sl.js +117 -0
  837. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/sv.js +118 -0
  838. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/ta.js +117 -0
  839. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/th.js +117 -0
  840. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/tr.js +115 -0
  841. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/ua.js +117 -0
  842. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/ur.js +117 -0
  843. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/vi.js +116 -0
  844. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/zh-CN.js +116 -0
  845. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/locales/zh-TW.js +117 -0
  846. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/mini/checks.js +1 -0
  847. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/mini/coerce.js +17 -0
  848. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/mini/external.js +13 -0
  849. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/mini/index.js +3 -0
  850. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/mini/iso.js +30 -0
  851. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/mini/parse.js +1 -0
  852. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/esm/v4/mini/schemas.js +725 -0
  853. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/index.d.ts +3 -0
  854. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/package.json +3 -0
  855. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/ZodError.d.ts +164 -0
  856. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/benchmarks/datetime.d.ts +5 -0
  857. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/benchmarks/discriminatedUnion.d.ts +5 -0
  858. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/benchmarks/index.d.ts +1 -0
  859. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/benchmarks/ipv4.d.ts +5 -0
  860. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/benchmarks/object.d.ts +5 -0
  861. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/benchmarks/primitives.d.ts +5 -0
  862. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/benchmarks/realworld.d.ts +5 -0
  863. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/benchmarks/string.d.ts +5 -0
  864. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/benchmarks/union.d.ts +5 -0
  865. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/errors.d.ts +5 -0
  866. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/external.d.ts +6 -0
  867. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/helpers/enumUtil.d.ts +8 -0
  868. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/helpers/errorUtil.d.ts +9 -0
  869. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/helpers/parseUtil.d.ts +78 -0
  870. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/helpers/partialUtil.d.ts +8 -0
  871. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/helpers/typeAliases.d.ts +2 -0
  872. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/helpers/util.d.ts +85 -0
  873. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/index.d.ts +4 -0
  874. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/locales/en.d.ts +3 -0
  875. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/standard-schema.d.ts +102 -0
  876. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/tests/Mocker.d.ts +17 -0
  877. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v3/types.d.ts +1031 -0
  878. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/classic/checks.d.ts +1 -0
  879. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/classic/coerce.d.ts +17 -0
  880. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/classic/compat.d.ts +48 -0
  881. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/classic/errors.d.ts +30 -0
  882. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/classic/external.d.ts +13 -0
  883. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/classic/index.d.ts +4 -0
  884. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/classic/iso.d.ts +22 -0
  885. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/classic/parse.d.ts +23 -0
  886. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/classic/schemas.d.ts +624 -0
  887. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/api.d.ts +281 -0
  888. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/checks.d.ts +277 -0
  889. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/config.d.ts +9 -0
  890. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/core.d.ts +47 -0
  891. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/doc.d.ts +14 -0
  892. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/errors.d.ts +204 -0
  893. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/function.d.ts +52 -0
  894. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/index.d.ts +15 -0
  895. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/json-schema.d.ts +87 -0
  896. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/parse.d.ts +25 -0
  897. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/regexes.d.ts +62 -0
  898. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/registries.d.ts +39 -0
  899. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/schemas.d.ts +1005 -0
  900. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/standard-schema.d.ts +55 -0
  901. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/to-json-schema.d.ts +84 -0
  902. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/util.d.ts +183 -0
  903. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/versions.d.ts +5 -0
  904. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/core/zsf.d.ts +91 -0
  905. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/index.d.ts +3 -0
  906. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/ar.d.ts +4 -0
  907. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/az.d.ts +4 -0
  908. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/be.d.ts +4 -0
  909. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/ca.d.ts +4 -0
  910. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/cs.d.ts +4 -0
  911. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/de.d.ts +4 -0
  912. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/en.d.ts +5 -0
  913. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/es.d.ts +4 -0
  914. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/fa.d.ts +4 -0
  915. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/fi.d.ts +4 -0
  916. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/fr-CA.d.ts +4 -0
  917. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/fr.d.ts +4 -0
  918. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/he.d.ts +4 -0
  919. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/hu.d.ts +4 -0
  920. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/id.d.ts +4 -0
  921. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/index.d.ts +38 -0
  922. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/it.d.ts +4 -0
  923. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/ja.d.ts +4 -0
  924. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/kh.d.ts +4 -0
  925. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/ko.d.ts +4 -0
  926. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/mk.d.ts +4 -0
  927. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/ms.d.ts +4 -0
  928. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/nl.d.ts +4 -0
  929. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/no.d.ts +4 -0
  930. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/ota.d.ts +4 -0
  931. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/pl.d.ts +4 -0
  932. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/ps.d.ts +4 -0
  933. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/pt.d.ts +4 -0
  934. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/ru.d.ts +4 -0
  935. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/sl.d.ts +4 -0
  936. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/sv.d.ts +4 -0
  937. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/ta.d.ts +4 -0
  938. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/th.d.ts +4 -0
  939. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/tr.d.ts +5 -0
  940. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/ua.d.ts +4 -0
  941. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/ur.d.ts +4 -0
  942. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/vi.d.ts +4 -0
  943. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/zh-CN.d.ts +4 -0
  944. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/locales/zh-TW.d.ts +4 -0
  945. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/mini/checks.d.ts +1 -0
  946. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/mini/coerce.d.ts +7 -0
  947. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/mini/external.d.ts +11 -0
  948. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/mini/index.d.ts +3 -0
  949. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/mini/iso.d.ts +22 -0
  950. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/mini/parse.d.ts +1 -0
  951. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/dist/types/v4/mini/schemas.d.ts +351 -0
  952. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/package.json +120 -0
  953. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/v3/index.d.ts +3 -0
  954. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/v3/index.js +1 -0
  955. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/v4/core/index.d.ts +1 -0
  956. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/v4/core/index.js +1 -0
  957. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/v4/index.d.ts +3 -0
  958. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/v4/index.js +1 -0
  959. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/v4/locales/en.d.ts +2 -0
  960. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/v4/locales/en.js +2 -0
  961. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/v4/locales/index.d.ts +1 -0
  962. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/v4/locales/index.js +1 -0
  963. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/v4-mini/index.d.ts +1 -0
  964. package/dist/node_modules/@langchain/core/node_modules/zod-to-json-schema/node_modules/zod/v4-mini/index.js +1 -0
  965. package/dist/node_modules/@langchain/core/package.json +1 -1
  966. package/dist/node_modules/@langchain/core/utils/hash/insecure.cjs +1 -0
  967. package/dist/node_modules/@langchain/core/utils/hash/insecure.d.cts +1 -0
  968. package/dist/node_modules/@langchain/core/utils/hash/insecure.d.ts +1 -0
  969. package/dist/node_modules/@langchain/core/utils/hash/insecure.js +1 -0
  970. package/dist/node_modules/@langchain/core/utils/hash/sha256.cjs +1 -0
  971. package/dist/node_modules/@langchain/core/utils/hash/sha256.d.cts +1 -0
  972. package/dist/node_modules/@langchain/core/utils/hash/sha256.d.ts +1 -0
  973. package/dist/node_modules/@langchain/core/utils/hash/sha256.js +1 -0
  974. package/dist/node_modules/@langchain/deepseek/index.cjs +18 -10
  975. package/dist/node_modules/@langchain/deepseek/package.json +1 -1
  976. package/dist/node_modules/@langchain/openai/dist/chat_models.cjs +527 -11
  977. package/dist/node_modules/@langchain/openai/dist/chat_models.d.ts +46 -5
  978. package/dist/node_modules/@langchain/openai/dist/chat_models.js +528 -12
  979. package/dist/node_modules/@langchain/openai/dist/llms.cjs +1 -1
  980. package/dist/node_modules/@langchain/openai/dist/llms.js +1 -1
  981. package/dist/node_modules/@langchain/openai/dist/types.d.ts +1 -1
  982. package/dist/node_modules/@langchain/openai/index.cjs +18 -10
  983. package/dist/node_modules/@langchain/openai/package.json +1 -1
  984. package/package.json +2 -2
  985. package/dist/node_modules/@langchain/core/dist/utils/types/is_zod_schema.cjs +0 -16
  986. package/dist/node_modules/@langchain/core/dist/utils/types/is_zod_schema.d.ts +0 -8
  987. package/dist/node_modules/@langchain/core/dist/utils/types/is_zod_schema.js +0 -12
  988. /package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/{vercel.types.cjs → utils/vercel.types.cjs} +0 -0
  989. /package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/{vercel.types.d.ts → utils/vercel.types.d.ts} +0 -0
  990. /package/dist/node_modules/@langchain/core/node_modules/langsmith/dist/{vercel.types.js → utils/vercel.types.js} +0 -0
@@ -0,0 +1,3773 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.discriminatedUnion = exports.date = exports.boolean = exports.bigint = exports.array = exports.any = exports.coerce = exports.ZodFirstPartyTypeKind = exports.late = exports.ZodSchema = exports.Schema = exports.ZodReadonly = exports.ZodPipeline = exports.ZodBranded = exports.BRAND = exports.ZodNaN = exports.ZodCatch = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = exports.ZodTransformer = exports.ZodEffects = exports.ZodPromise = exports.ZodNativeEnum = exports.ZodEnum = exports.ZodLiteral = exports.ZodLazy = exports.ZodFunction = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodSymbol = exports.ZodDate = exports.ZodBoolean = exports.ZodBigInt = exports.ZodNumber = exports.ZodString = exports.ZodType = void 0;
4
+ exports.NEVER = exports.void = exports.unknown = exports.union = exports.undefined = exports.tuple = exports.transformer = exports.symbol = exports.string = exports.strictObject = exports.set = exports.record = exports.promise = exports.preprocess = exports.pipeline = exports.ostring = exports.optional = exports.onumber = exports.oboolean = exports.object = exports.number = exports.nullable = exports.null = exports.never = exports.nativeEnum = exports.nan = exports.map = exports.literal = exports.lazy = exports.intersection = exports.instanceof = exports.function = exports.enum = exports.effect = void 0;
5
+ exports.datetimeRegex = datetimeRegex;
6
+ exports.custom = custom;
7
+ const ZodError_js_1 = require("./ZodError.js");
8
+ const errors_js_1 = require("./errors.js");
9
+ const errorUtil_js_1 = require("./helpers/errorUtil.js");
10
+ const parseUtil_js_1 = require("./helpers/parseUtil.js");
11
+ const util_js_1 = require("./helpers/util.js");
12
+ class ParseInputLazyPath {
13
+ constructor(parent, value, path, key) {
14
+ this._cachedPath = [];
15
+ this.parent = parent;
16
+ this.data = value;
17
+ this._path = path;
18
+ this._key = key;
19
+ }
20
+ get path() {
21
+ if (!this._cachedPath.length) {
22
+ if (Array.isArray(this._key)) {
23
+ this._cachedPath.push(...this._path, ...this._key);
24
+ }
25
+ else {
26
+ this._cachedPath.push(...this._path, this._key);
27
+ }
28
+ }
29
+ return this._cachedPath;
30
+ }
31
+ }
32
+ const handleResult = (ctx, result) => {
33
+ if ((0, parseUtil_js_1.isValid)(result)) {
34
+ return { success: true, data: result.value };
35
+ }
36
+ else {
37
+ if (!ctx.common.issues.length) {
38
+ throw new Error("Validation failed but no issues detected.");
39
+ }
40
+ return {
41
+ success: false,
42
+ get error() {
43
+ if (this._error)
44
+ return this._error;
45
+ const error = new ZodError_js_1.ZodError(ctx.common.issues);
46
+ this._error = error;
47
+ return this._error;
48
+ },
49
+ };
50
+ }
51
+ };
52
+ function processCreateParams(params) {
53
+ if (!params)
54
+ return {};
55
+ const { errorMap, invalid_type_error, required_error, description } = params;
56
+ if (errorMap && (invalid_type_error || required_error)) {
57
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
58
+ }
59
+ if (errorMap)
60
+ return { errorMap: errorMap, description };
61
+ const customMap = (iss, ctx) => {
62
+ const { message } = params;
63
+ if (iss.code === "invalid_enum_value") {
64
+ return { message: message ?? ctx.defaultError };
65
+ }
66
+ if (typeof ctx.data === "undefined") {
67
+ return { message: message ?? required_error ?? ctx.defaultError };
68
+ }
69
+ if (iss.code !== "invalid_type")
70
+ return { message: ctx.defaultError };
71
+ return { message: message ?? invalid_type_error ?? ctx.defaultError };
72
+ };
73
+ return { errorMap: customMap, description };
74
+ }
75
+ class ZodType {
76
+ get description() {
77
+ return this._def.description;
78
+ }
79
+ _getType(input) {
80
+ return (0, util_js_1.getParsedType)(input.data);
81
+ }
82
+ _getOrReturnCtx(input, ctx) {
83
+ return (ctx || {
84
+ common: input.parent.common,
85
+ data: input.data,
86
+ parsedType: (0, util_js_1.getParsedType)(input.data),
87
+ schemaErrorMap: this._def.errorMap,
88
+ path: input.path,
89
+ parent: input.parent,
90
+ });
91
+ }
92
+ _processInputParams(input) {
93
+ return {
94
+ status: new parseUtil_js_1.ParseStatus(),
95
+ ctx: {
96
+ common: input.parent.common,
97
+ data: input.data,
98
+ parsedType: (0, util_js_1.getParsedType)(input.data),
99
+ schemaErrorMap: this._def.errorMap,
100
+ path: input.path,
101
+ parent: input.parent,
102
+ },
103
+ };
104
+ }
105
+ _parseSync(input) {
106
+ const result = this._parse(input);
107
+ if ((0, parseUtil_js_1.isAsync)(result)) {
108
+ throw new Error("Synchronous parse encountered promise.");
109
+ }
110
+ return result;
111
+ }
112
+ _parseAsync(input) {
113
+ const result = this._parse(input);
114
+ return Promise.resolve(result);
115
+ }
116
+ parse(data, params) {
117
+ const result = this.safeParse(data, params);
118
+ if (result.success)
119
+ return result.data;
120
+ throw result.error;
121
+ }
122
+ safeParse(data, params) {
123
+ const ctx = {
124
+ common: {
125
+ issues: [],
126
+ async: params?.async ?? false,
127
+ contextualErrorMap: params?.errorMap,
128
+ },
129
+ path: params?.path || [],
130
+ schemaErrorMap: this._def.errorMap,
131
+ parent: null,
132
+ data,
133
+ parsedType: (0, util_js_1.getParsedType)(data),
134
+ };
135
+ const result = this._parseSync({ data, path: ctx.path, parent: ctx });
136
+ return handleResult(ctx, result);
137
+ }
138
+ "~validate"(data) {
139
+ const ctx = {
140
+ common: {
141
+ issues: [],
142
+ async: !!this["~standard"].async,
143
+ },
144
+ path: [],
145
+ schemaErrorMap: this._def.errorMap,
146
+ parent: null,
147
+ data,
148
+ parsedType: (0, util_js_1.getParsedType)(data),
149
+ };
150
+ if (!this["~standard"].async) {
151
+ try {
152
+ const result = this._parseSync({ data, path: [], parent: ctx });
153
+ return (0, parseUtil_js_1.isValid)(result)
154
+ ? {
155
+ value: result.value,
156
+ }
157
+ : {
158
+ issues: ctx.common.issues,
159
+ };
160
+ }
161
+ catch (err) {
162
+ if (err?.message?.toLowerCase()?.includes("encountered")) {
163
+ this["~standard"].async = true;
164
+ }
165
+ ctx.common = {
166
+ issues: [],
167
+ async: true,
168
+ };
169
+ }
170
+ }
171
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result) => (0, parseUtil_js_1.isValid)(result)
172
+ ? {
173
+ value: result.value,
174
+ }
175
+ : {
176
+ issues: ctx.common.issues,
177
+ });
178
+ }
179
+ async parseAsync(data, params) {
180
+ const result = await this.safeParseAsync(data, params);
181
+ if (result.success)
182
+ return result.data;
183
+ throw result.error;
184
+ }
185
+ async safeParseAsync(data, params) {
186
+ const ctx = {
187
+ common: {
188
+ issues: [],
189
+ contextualErrorMap: params?.errorMap,
190
+ async: true,
191
+ },
192
+ path: params?.path || [],
193
+ schemaErrorMap: this._def.errorMap,
194
+ parent: null,
195
+ data,
196
+ parsedType: (0, util_js_1.getParsedType)(data),
197
+ };
198
+ const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
199
+ const result = await ((0, parseUtil_js_1.isAsync)(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
200
+ return handleResult(ctx, result);
201
+ }
202
+ refine(check, message) {
203
+ const getIssueProperties = (val) => {
204
+ if (typeof message === "string" || typeof message === "undefined") {
205
+ return { message };
206
+ }
207
+ else if (typeof message === "function") {
208
+ return message(val);
209
+ }
210
+ else {
211
+ return message;
212
+ }
213
+ };
214
+ return this._refinement((val, ctx) => {
215
+ const result = check(val);
216
+ const setError = () => ctx.addIssue({
217
+ code: ZodError_js_1.ZodIssueCode.custom,
218
+ ...getIssueProperties(val),
219
+ });
220
+ if (typeof Promise !== "undefined" && result instanceof Promise) {
221
+ return result.then((data) => {
222
+ if (!data) {
223
+ setError();
224
+ return false;
225
+ }
226
+ else {
227
+ return true;
228
+ }
229
+ });
230
+ }
231
+ if (!result) {
232
+ setError();
233
+ return false;
234
+ }
235
+ else {
236
+ return true;
237
+ }
238
+ });
239
+ }
240
+ refinement(check, refinementData) {
241
+ return this._refinement((val, ctx) => {
242
+ if (!check(val)) {
243
+ ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
244
+ return false;
245
+ }
246
+ else {
247
+ return true;
248
+ }
249
+ });
250
+ }
251
+ _refinement(refinement) {
252
+ return new ZodEffects({
253
+ schema: this,
254
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
255
+ effect: { type: "refinement", refinement },
256
+ });
257
+ }
258
+ superRefine(refinement) {
259
+ return this._refinement(refinement);
260
+ }
261
+ constructor(def) {
262
+ /** Alias of safeParseAsync */
263
+ this.spa = this.safeParseAsync;
264
+ this._def = def;
265
+ this.parse = this.parse.bind(this);
266
+ this.safeParse = this.safeParse.bind(this);
267
+ this.parseAsync = this.parseAsync.bind(this);
268
+ this.safeParseAsync = this.safeParseAsync.bind(this);
269
+ this.spa = this.spa.bind(this);
270
+ this.refine = this.refine.bind(this);
271
+ this.refinement = this.refinement.bind(this);
272
+ this.superRefine = this.superRefine.bind(this);
273
+ this.optional = this.optional.bind(this);
274
+ this.nullable = this.nullable.bind(this);
275
+ this.nullish = this.nullish.bind(this);
276
+ this.array = this.array.bind(this);
277
+ this.promise = this.promise.bind(this);
278
+ this.or = this.or.bind(this);
279
+ this.and = this.and.bind(this);
280
+ this.transform = this.transform.bind(this);
281
+ this.brand = this.brand.bind(this);
282
+ this.default = this.default.bind(this);
283
+ this.catch = this.catch.bind(this);
284
+ this.describe = this.describe.bind(this);
285
+ this.pipe = this.pipe.bind(this);
286
+ this.readonly = this.readonly.bind(this);
287
+ this.isNullable = this.isNullable.bind(this);
288
+ this.isOptional = this.isOptional.bind(this);
289
+ this["~standard"] = {
290
+ version: 1,
291
+ vendor: "zod",
292
+ validate: (data) => this["~validate"](data),
293
+ };
294
+ }
295
+ optional() {
296
+ return ZodOptional.create(this, this._def);
297
+ }
298
+ nullable() {
299
+ return ZodNullable.create(this, this._def);
300
+ }
301
+ nullish() {
302
+ return this.nullable().optional();
303
+ }
304
+ array() {
305
+ return ZodArray.create(this);
306
+ }
307
+ promise() {
308
+ return ZodPromise.create(this, this._def);
309
+ }
310
+ or(option) {
311
+ return ZodUnion.create([this, option], this._def);
312
+ }
313
+ and(incoming) {
314
+ return ZodIntersection.create(this, incoming, this._def);
315
+ }
316
+ transform(transform) {
317
+ return new ZodEffects({
318
+ ...processCreateParams(this._def),
319
+ schema: this,
320
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
321
+ effect: { type: "transform", transform },
322
+ });
323
+ }
324
+ default(def) {
325
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
326
+ return new ZodDefault({
327
+ ...processCreateParams(this._def),
328
+ innerType: this,
329
+ defaultValue: defaultValueFunc,
330
+ typeName: ZodFirstPartyTypeKind.ZodDefault,
331
+ });
332
+ }
333
+ brand() {
334
+ return new ZodBranded({
335
+ typeName: ZodFirstPartyTypeKind.ZodBranded,
336
+ type: this,
337
+ ...processCreateParams(this._def),
338
+ });
339
+ }
340
+ catch(def) {
341
+ const catchValueFunc = typeof def === "function" ? def : () => def;
342
+ return new ZodCatch({
343
+ ...processCreateParams(this._def),
344
+ innerType: this,
345
+ catchValue: catchValueFunc,
346
+ typeName: ZodFirstPartyTypeKind.ZodCatch,
347
+ });
348
+ }
349
+ describe(description) {
350
+ const This = this.constructor;
351
+ return new This({
352
+ ...this._def,
353
+ description,
354
+ });
355
+ }
356
+ pipe(target) {
357
+ return ZodPipeline.create(this, target);
358
+ }
359
+ readonly() {
360
+ return ZodReadonly.create(this);
361
+ }
362
+ isOptional() {
363
+ return this.safeParse(undefined).success;
364
+ }
365
+ isNullable() {
366
+ return this.safeParse(null).success;
367
+ }
368
+ }
369
+ exports.ZodType = ZodType;
370
+ exports.Schema = ZodType;
371
+ exports.ZodSchema = ZodType;
372
+ const cuidRegex = /^c[^\s-]{8,}$/i;
373
+ const cuid2Regex = /^[0-9a-z]+$/;
374
+ const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
375
+ // const uuidRegex =
376
+ // /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
377
+ const uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
378
+ const nanoidRegex = /^[a-z0-9_-]{21}$/i;
379
+ const jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
380
+ const durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
381
+ // from https://stackoverflow.com/a/46181/1550155
382
+ // old version: too slow, didn't support unicode
383
+ // const emailRegex = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;
384
+ //old email regex
385
+ // const emailRegex = /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@((?!-)([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{1,})[^-<>()[\].,;:\s@"]$/i;
386
+ // eslint-disable-next-line
387
+ // const emailRegex =
388
+ // /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/;
389
+ // const emailRegex =
390
+ // /^[a-zA-Z0-9\.\!\#\$\%\&\'\*\+\/\=\?\^\_\`\{\|\}\~\-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
391
+ // const emailRegex =
392
+ // /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i;
393
+ const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
394
+ // const emailRegex =
395
+ // /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\.[a-z0-9\-]+)*$/i;
396
+ // from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
397
+ const _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
398
+ let emojiRegex;
399
+ // faster, simpler, safer
400
+ const ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
401
+ const ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
402
+ // const ipv6Regex =
403
+ // /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
404
+ const ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
405
+ const ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
406
+ // https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
407
+ const base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
408
+ // https://base64.guru/standards/base64url
409
+ const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
410
+ // simple
411
+ // const dateRegexSource = `\\d{4}-\\d{2}-\\d{2}`;
412
+ // no leap year validation
413
+ // const dateRegexSource = `\\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\\d|2\\d))`;
414
+ // with leap year validation
415
+ const dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
416
+ const dateRegex = new RegExp(`^${dateRegexSource}$`);
417
+ function timeRegexSource(args) {
418
+ let secondsRegexSource = `[0-5]\\d`;
419
+ if (args.precision) {
420
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
421
+ }
422
+ else if (args.precision == null) {
423
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
424
+ }
425
+ const secondsQuantifier = args.precision ? "+" : "?"; // require seconds if precision is nonzero
426
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
427
+ }
428
+ function timeRegex(args) {
429
+ return new RegExp(`^${timeRegexSource(args)}$`);
430
+ }
431
+ // Adapted from https://stackoverflow.com/a/3143231
432
+ function datetimeRegex(args) {
433
+ let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
434
+ const opts = [];
435
+ opts.push(args.local ? `Z?` : `Z`);
436
+ if (args.offset)
437
+ opts.push(`([+-]\\d{2}:?\\d{2})`);
438
+ regex = `${regex}(${opts.join("|")})`;
439
+ return new RegExp(`^${regex}$`);
440
+ }
441
+ function isValidIP(ip, version) {
442
+ if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
443
+ return true;
444
+ }
445
+ if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
446
+ return true;
447
+ }
448
+ return false;
449
+ }
450
+ function isValidJWT(jwt, alg) {
451
+ if (!jwtRegex.test(jwt))
452
+ return false;
453
+ try {
454
+ const [header] = jwt.split(".");
455
+ // Convert base64url to base64
456
+ const base64 = header
457
+ .replace(/-/g, "+")
458
+ .replace(/_/g, "/")
459
+ .padEnd(header.length + ((4 - (header.length % 4)) % 4), "=");
460
+ const decoded = JSON.parse(atob(base64));
461
+ if (typeof decoded !== "object" || decoded === null)
462
+ return false;
463
+ if ("typ" in decoded && decoded?.typ !== "JWT")
464
+ return false;
465
+ if (!decoded.alg)
466
+ return false;
467
+ if (alg && decoded.alg !== alg)
468
+ return false;
469
+ return true;
470
+ }
471
+ catch {
472
+ return false;
473
+ }
474
+ }
475
+ function isValidCidr(ip, version) {
476
+ if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
477
+ return true;
478
+ }
479
+ if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
480
+ return true;
481
+ }
482
+ return false;
483
+ }
484
+ class ZodString extends ZodType {
485
+ _parse(input) {
486
+ if (this._def.coerce) {
487
+ input.data = String(input.data);
488
+ }
489
+ const parsedType = this._getType(input);
490
+ if (parsedType !== util_js_1.ZodParsedType.string) {
491
+ const ctx = this._getOrReturnCtx(input);
492
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
493
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
494
+ expected: util_js_1.ZodParsedType.string,
495
+ received: ctx.parsedType,
496
+ });
497
+ return parseUtil_js_1.INVALID;
498
+ }
499
+ const status = new parseUtil_js_1.ParseStatus();
500
+ let ctx = undefined;
501
+ for (const check of this._def.checks) {
502
+ if (check.kind === "min") {
503
+ if (input.data.length < check.value) {
504
+ ctx = this._getOrReturnCtx(input, ctx);
505
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
506
+ code: ZodError_js_1.ZodIssueCode.too_small,
507
+ minimum: check.value,
508
+ type: "string",
509
+ inclusive: true,
510
+ exact: false,
511
+ message: check.message,
512
+ });
513
+ status.dirty();
514
+ }
515
+ }
516
+ else if (check.kind === "max") {
517
+ if (input.data.length > check.value) {
518
+ ctx = this._getOrReturnCtx(input, ctx);
519
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
520
+ code: ZodError_js_1.ZodIssueCode.too_big,
521
+ maximum: check.value,
522
+ type: "string",
523
+ inclusive: true,
524
+ exact: false,
525
+ message: check.message,
526
+ });
527
+ status.dirty();
528
+ }
529
+ }
530
+ else if (check.kind === "length") {
531
+ const tooBig = input.data.length > check.value;
532
+ const tooSmall = input.data.length < check.value;
533
+ if (tooBig || tooSmall) {
534
+ ctx = this._getOrReturnCtx(input, ctx);
535
+ if (tooBig) {
536
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
537
+ code: ZodError_js_1.ZodIssueCode.too_big,
538
+ maximum: check.value,
539
+ type: "string",
540
+ inclusive: true,
541
+ exact: true,
542
+ message: check.message,
543
+ });
544
+ }
545
+ else if (tooSmall) {
546
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
547
+ code: ZodError_js_1.ZodIssueCode.too_small,
548
+ minimum: check.value,
549
+ type: "string",
550
+ inclusive: true,
551
+ exact: true,
552
+ message: check.message,
553
+ });
554
+ }
555
+ status.dirty();
556
+ }
557
+ }
558
+ else if (check.kind === "email") {
559
+ if (!emailRegex.test(input.data)) {
560
+ ctx = this._getOrReturnCtx(input, ctx);
561
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
562
+ validation: "email",
563
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
564
+ message: check.message,
565
+ });
566
+ status.dirty();
567
+ }
568
+ }
569
+ else if (check.kind === "emoji") {
570
+ if (!emojiRegex) {
571
+ emojiRegex = new RegExp(_emojiRegex, "u");
572
+ }
573
+ if (!emojiRegex.test(input.data)) {
574
+ ctx = this._getOrReturnCtx(input, ctx);
575
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
576
+ validation: "emoji",
577
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
578
+ message: check.message,
579
+ });
580
+ status.dirty();
581
+ }
582
+ }
583
+ else if (check.kind === "uuid") {
584
+ if (!uuidRegex.test(input.data)) {
585
+ ctx = this._getOrReturnCtx(input, ctx);
586
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
587
+ validation: "uuid",
588
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
589
+ message: check.message,
590
+ });
591
+ status.dirty();
592
+ }
593
+ }
594
+ else if (check.kind === "nanoid") {
595
+ if (!nanoidRegex.test(input.data)) {
596
+ ctx = this._getOrReturnCtx(input, ctx);
597
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
598
+ validation: "nanoid",
599
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
600
+ message: check.message,
601
+ });
602
+ status.dirty();
603
+ }
604
+ }
605
+ else if (check.kind === "cuid") {
606
+ if (!cuidRegex.test(input.data)) {
607
+ ctx = this._getOrReturnCtx(input, ctx);
608
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
609
+ validation: "cuid",
610
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
611
+ message: check.message,
612
+ });
613
+ status.dirty();
614
+ }
615
+ }
616
+ else if (check.kind === "cuid2") {
617
+ if (!cuid2Regex.test(input.data)) {
618
+ ctx = this._getOrReturnCtx(input, ctx);
619
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
620
+ validation: "cuid2",
621
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
622
+ message: check.message,
623
+ });
624
+ status.dirty();
625
+ }
626
+ }
627
+ else if (check.kind === "ulid") {
628
+ if (!ulidRegex.test(input.data)) {
629
+ ctx = this._getOrReturnCtx(input, ctx);
630
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
631
+ validation: "ulid",
632
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
633
+ message: check.message,
634
+ });
635
+ status.dirty();
636
+ }
637
+ }
638
+ else if (check.kind === "url") {
639
+ try {
640
+ new URL(input.data);
641
+ }
642
+ catch {
643
+ ctx = this._getOrReturnCtx(input, ctx);
644
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
645
+ validation: "url",
646
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
647
+ message: check.message,
648
+ });
649
+ status.dirty();
650
+ }
651
+ }
652
+ else if (check.kind === "regex") {
653
+ check.regex.lastIndex = 0;
654
+ const testResult = check.regex.test(input.data);
655
+ if (!testResult) {
656
+ ctx = this._getOrReturnCtx(input, ctx);
657
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
658
+ validation: "regex",
659
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
660
+ message: check.message,
661
+ });
662
+ status.dirty();
663
+ }
664
+ }
665
+ else if (check.kind === "trim") {
666
+ input.data = input.data.trim();
667
+ }
668
+ else if (check.kind === "includes") {
669
+ if (!input.data.includes(check.value, check.position)) {
670
+ ctx = this._getOrReturnCtx(input, ctx);
671
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
672
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
673
+ validation: { includes: check.value, position: check.position },
674
+ message: check.message,
675
+ });
676
+ status.dirty();
677
+ }
678
+ }
679
+ else if (check.kind === "toLowerCase") {
680
+ input.data = input.data.toLowerCase();
681
+ }
682
+ else if (check.kind === "toUpperCase") {
683
+ input.data = input.data.toUpperCase();
684
+ }
685
+ else if (check.kind === "startsWith") {
686
+ if (!input.data.startsWith(check.value)) {
687
+ ctx = this._getOrReturnCtx(input, ctx);
688
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
689
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
690
+ validation: { startsWith: check.value },
691
+ message: check.message,
692
+ });
693
+ status.dirty();
694
+ }
695
+ }
696
+ else if (check.kind === "endsWith") {
697
+ if (!input.data.endsWith(check.value)) {
698
+ ctx = this._getOrReturnCtx(input, ctx);
699
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
700
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
701
+ validation: { endsWith: check.value },
702
+ message: check.message,
703
+ });
704
+ status.dirty();
705
+ }
706
+ }
707
+ else if (check.kind === "datetime") {
708
+ const regex = datetimeRegex(check);
709
+ if (!regex.test(input.data)) {
710
+ ctx = this._getOrReturnCtx(input, ctx);
711
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
712
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
713
+ validation: "datetime",
714
+ message: check.message,
715
+ });
716
+ status.dirty();
717
+ }
718
+ }
719
+ else if (check.kind === "date") {
720
+ const regex = dateRegex;
721
+ if (!regex.test(input.data)) {
722
+ ctx = this._getOrReturnCtx(input, ctx);
723
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
724
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
725
+ validation: "date",
726
+ message: check.message,
727
+ });
728
+ status.dirty();
729
+ }
730
+ }
731
+ else if (check.kind === "time") {
732
+ const regex = timeRegex(check);
733
+ if (!regex.test(input.data)) {
734
+ ctx = this._getOrReturnCtx(input, ctx);
735
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
736
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
737
+ validation: "time",
738
+ message: check.message,
739
+ });
740
+ status.dirty();
741
+ }
742
+ }
743
+ else if (check.kind === "duration") {
744
+ if (!durationRegex.test(input.data)) {
745
+ ctx = this._getOrReturnCtx(input, ctx);
746
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
747
+ validation: "duration",
748
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
749
+ message: check.message,
750
+ });
751
+ status.dirty();
752
+ }
753
+ }
754
+ else if (check.kind === "ip") {
755
+ if (!isValidIP(input.data, check.version)) {
756
+ ctx = this._getOrReturnCtx(input, ctx);
757
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
758
+ validation: "ip",
759
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
760
+ message: check.message,
761
+ });
762
+ status.dirty();
763
+ }
764
+ }
765
+ else if (check.kind === "jwt") {
766
+ if (!isValidJWT(input.data, check.alg)) {
767
+ ctx = this._getOrReturnCtx(input, ctx);
768
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
769
+ validation: "jwt",
770
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
771
+ message: check.message,
772
+ });
773
+ status.dirty();
774
+ }
775
+ }
776
+ else if (check.kind === "cidr") {
777
+ if (!isValidCidr(input.data, check.version)) {
778
+ ctx = this._getOrReturnCtx(input, ctx);
779
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
780
+ validation: "cidr",
781
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
782
+ message: check.message,
783
+ });
784
+ status.dirty();
785
+ }
786
+ }
787
+ else if (check.kind === "base64") {
788
+ if (!base64Regex.test(input.data)) {
789
+ ctx = this._getOrReturnCtx(input, ctx);
790
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
791
+ validation: "base64",
792
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
793
+ message: check.message,
794
+ });
795
+ status.dirty();
796
+ }
797
+ }
798
+ else if (check.kind === "base64url") {
799
+ if (!base64urlRegex.test(input.data)) {
800
+ ctx = this._getOrReturnCtx(input, ctx);
801
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
802
+ validation: "base64url",
803
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
804
+ message: check.message,
805
+ });
806
+ status.dirty();
807
+ }
808
+ }
809
+ else {
810
+ util_js_1.util.assertNever(check);
811
+ }
812
+ }
813
+ return { status: status.value, value: input.data };
814
+ }
815
+ _regex(regex, validation, message) {
816
+ return this.refinement((data) => regex.test(data), {
817
+ validation,
818
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
819
+ ...errorUtil_js_1.errorUtil.errToObj(message),
820
+ });
821
+ }
822
+ _addCheck(check) {
823
+ return new ZodString({
824
+ ...this._def,
825
+ checks: [...this._def.checks, check],
826
+ });
827
+ }
828
+ email(message) {
829
+ return this._addCheck({ kind: "email", ...errorUtil_js_1.errorUtil.errToObj(message) });
830
+ }
831
+ url(message) {
832
+ return this._addCheck({ kind: "url", ...errorUtil_js_1.errorUtil.errToObj(message) });
833
+ }
834
+ emoji(message) {
835
+ return this._addCheck({ kind: "emoji", ...errorUtil_js_1.errorUtil.errToObj(message) });
836
+ }
837
+ uuid(message) {
838
+ return this._addCheck({ kind: "uuid", ...errorUtil_js_1.errorUtil.errToObj(message) });
839
+ }
840
+ nanoid(message) {
841
+ return this._addCheck({ kind: "nanoid", ...errorUtil_js_1.errorUtil.errToObj(message) });
842
+ }
843
+ cuid(message) {
844
+ return this._addCheck({ kind: "cuid", ...errorUtil_js_1.errorUtil.errToObj(message) });
845
+ }
846
+ cuid2(message) {
847
+ return this._addCheck({ kind: "cuid2", ...errorUtil_js_1.errorUtil.errToObj(message) });
848
+ }
849
+ ulid(message) {
850
+ return this._addCheck({ kind: "ulid", ...errorUtil_js_1.errorUtil.errToObj(message) });
851
+ }
852
+ base64(message) {
853
+ return this._addCheck({ kind: "base64", ...errorUtil_js_1.errorUtil.errToObj(message) });
854
+ }
855
+ base64url(message) {
856
+ // base64url encoding is a modification of base64 that can safely be used in URLs and filenames
857
+ return this._addCheck({
858
+ kind: "base64url",
859
+ ...errorUtil_js_1.errorUtil.errToObj(message),
860
+ });
861
+ }
862
+ jwt(options) {
863
+ return this._addCheck({ kind: "jwt", ...errorUtil_js_1.errorUtil.errToObj(options) });
864
+ }
865
+ ip(options) {
866
+ return this._addCheck({ kind: "ip", ...errorUtil_js_1.errorUtil.errToObj(options) });
867
+ }
868
+ cidr(options) {
869
+ return this._addCheck({ kind: "cidr", ...errorUtil_js_1.errorUtil.errToObj(options) });
870
+ }
871
+ datetime(options) {
872
+ if (typeof options === "string") {
873
+ return this._addCheck({
874
+ kind: "datetime",
875
+ precision: null,
876
+ offset: false,
877
+ local: false,
878
+ message: options,
879
+ });
880
+ }
881
+ return this._addCheck({
882
+ kind: "datetime",
883
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
884
+ offset: options?.offset ?? false,
885
+ local: options?.local ?? false,
886
+ ...errorUtil_js_1.errorUtil.errToObj(options?.message),
887
+ });
888
+ }
889
+ date(message) {
890
+ return this._addCheck({ kind: "date", message });
891
+ }
892
+ time(options) {
893
+ if (typeof options === "string") {
894
+ return this._addCheck({
895
+ kind: "time",
896
+ precision: null,
897
+ message: options,
898
+ });
899
+ }
900
+ return this._addCheck({
901
+ kind: "time",
902
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
903
+ ...errorUtil_js_1.errorUtil.errToObj(options?.message),
904
+ });
905
+ }
906
+ duration(message) {
907
+ return this._addCheck({ kind: "duration", ...errorUtil_js_1.errorUtil.errToObj(message) });
908
+ }
909
+ regex(regex, message) {
910
+ return this._addCheck({
911
+ kind: "regex",
912
+ regex: regex,
913
+ ...errorUtil_js_1.errorUtil.errToObj(message),
914
+ });
915
+ }
916
+ includes(value, options) {
917
+ return this._addCheck({
918
+ kind: "includes",
919
+ value: value,
920
+ position: options?.position,
921
+ ...errorUtil_js_1.errorUtil.errToObj(options?.message),
922
+ });
923
+ }
924
+ startsWith(value, message) {
925
+ return this._addCheck({
926
+ kind: "startsWith",
927
+ value: value,
928
+ ...errorUtil_js_1.errorUtil.errToObj(message),
929
+ });
930
+ }
931
+ endsWith(value, message) {
932
+ return this._addCheck({
933
+ kind: "endsWith",
934
+ value: value,
935
+ ...errorUtil_js_1.errorUtil.errToObj(message),
936
+ });
937
+ }
938
+ min(minLength, message) {
939
+ return this._addCheck({
940
+ kind: "min",
941
+ value: minLength,
942
+ ...errorUtil_js_1.errorUtil.errToObj(message),
943
+ });
944
+ }
945
+ max(maxLength, message) {
946
+ return this._addCheck({
947
+ kind: "max",
948
+ value: maxLength,
949
+ ...errorUtil_js_1.errorUtil.errToObj(message),
950
+ });
951
+ }
952
+ length(len, message) {
953
+ return this._addCheck({
954
+ kind: "length",
955
+ value: len,
956
+ ...errorUtil_js_1.errorUtil.errToObj(message),
957
+ });
958
+ }
959
+ /**
960
+ * Equivalent to `.min(1)`
961
+ */
962
+ nonempty(message) {
963
+ return this.min(1, errorUtil_js_1.errorUtil.errToObj(message));
964
+ }
965
+ trim() {
966
+ return new ZodString({
967
+ ...this._def,
968
+ checks: [...this._def.checks, { kind: "trim" }],
969
+ });
970
+ }
971
+ toLowerCase() {
972
+ return new ZodString({
973
+ ...this._def,
974
+ checks: [...this._def.checks, { kind: "toLowerCase" }],
975
+ });
976
+ }
977
+ toUpperCase() {
978
+ return new ZodString({
979
+ ...this._def,
980
+ checks: [...this._def.checks, { kind: "toUpperCase" }],
981
+ });
982
+ }
983
+ get isDatetime() {
984
+ return !!this._def.checks.find((ch) => ch.kind === "datetime");
985
+ }
986
+ get isDate() {
987
+ return !!this._def.checks.find((ch) => ch.kind === "date");
988
+ }
989
+ get isTime() {
990
+ return !!this._def.checks.find((ch) => ch.kind === "time");
991
+ }
992
+ get isDuration() {
993
+ return !!this._def.checks.find((ch) => ch.kind === "duration");
994
+ }
995
+ get isEmail() {
996
+ return !!this._def.checks.find((ch) => ch.kind === "email");
997
+ }
998
+ get isURL() {
999
+ return !!this._def.checks.find((ch) => ch.kind === "url");
1000
+ }
1001
+ get isEmoji() {
1002
+ return !!this._def.checks.find((ch) => ch.kind === "emoji");
1003
+ }
1004
+ get isUUID() {
1005
+ return !!this._def.checks.find((ch) => ch.kind === "uuid");
1006
+ }
1007
+ get isNANOID() {
1008
+ return !!this._def.checks.find((ch) => ch.kind === "nanoid");
1009
+ }
1010
+ get isCUID() {
1011
+ return !!this._def.checks.find((ch) => ch.kind === "cuid");
1012
+ }
1013
+ get isCUID2() {
1014
+ return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1015
+ }
1016
+ get isULID() {
1017
+ return !!this._def.checks.find((ch) => ch.kind === "ulid");
1018
+ }
1019
+ get isIP() {
1020
+ return !!this._def.checks.find((ch) => ch.kind === "ip");
1021
+ }
1022
+ get isCIDR() {
1023
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
1024
+ }
1025
+ get isBase64() {
1026
+ return !!this._def.checks.find((ch) => ch.kind === "base64");
1027
+ }
1028
+ get isBase64url() {
1029
+ // base64url encoding is a modification of base64 that can safely be used in URLs and filenames
1030
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
1031
+ }
1032
+ get minLength() {
1033
+ let min = null;
1034
+ for (const ch of this._def.checks) {
1035
+ if (ch.kind === "min") {
1036
+ if (min === null || ch.value > min)
1037
+ min = ch.value;
1038
+ }
1039
+ }
1040
+ return min;
1041
+ }
1042
+ get maxLength() {
1043
+ let max = null;
1044
+ for (const ch of this._def.checks) {
1045
+ if (ch.kind === "max") {
1046
+ if (max === null || ch.value < max)
1047
+ max = ch.value;
1048
+ }
1049
+ }
1050
+ return max;
1051
+ }
1052
+ }
1053
+ exports.ZodString = ZodString;
1054
+ ZodString.create = (params) => {
1055
+ return new ZodString({
1056
+ checks: [],
1057
+ typeName: ZodFirstPartyTypeKind.ZodString,
1058
+ coerce: params?.coerce ?? false,
1059
+ ...processCreateParams(params),
1060
+ });
1061
+ };
1062
+ // https://stackoverflow.com/questions/3966484/why-does-modulus-operator-return-fractional-number-in-javascript/31711034#31711034
1063
+ function floatSafeRemainder(val, step) {
1064
+ const valDecCount = (val.toString().split(".")[1] || "").length;
1065
+ const stepDecCount = (step.toString().split(".")[1] || "").length;
1066
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
1067
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
1068
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
1069
+ return (valInt % stepInt) / 10 ** decCount;
1070
+ }
1071
+ class ZodNumber extends ZodType {
1072
+ constructor() {
1073
+ super(...arguments);
1074
+ this.min = this.gte;
1075
+ this.max = this.lte;
1076
+ this.step = this.multipleOf;
1077
+ }
1078
+ _parse(input) {
1079
+ if (this._def.coerce) {
1080
+ input.data = Number(input.data);
1081
+ }
1082
+ const parsedType = this._getType(input);
1083
+ if (parsedType !== util_js_1.ZodParsedType.number) {
1084
+ const ctx = this._getOrReturnCtx(input);
1085
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1086
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1087
+ expected: util_js_1.ZodParsedType.number,
1088
+ received: ctx.parsedType,
1089
+ });
1090
+ return parseUtil_js_1.INVALID;
1091
+ }
1092
+ let ctx = undefined;
1093
+ const status = new parseUtil_js_1.ParseStatus();
1094
+ for (const check of this._def.checks) {
1095
+ if (check.kind === "int") {
1096
+ if (!util_js_1.util.isInteger(input.data)) {
1097
+ ctx = this._getOrReturnCtx(input, ctx);
1098
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1099
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1100
+ expected: "integer",
1101
+ received: "float",
1102
+ message: check.message,
1103
+ });
1104
+ status.dirty();
1105
+ }
1106
+ }
1107
+ else if (check.kind === "min") {
1108
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1109
+ if (tooSmall) {
1110
+ ctx = this._getOrReturnCtx(input, ctx);
1111
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1112
+ code: ZodError_js_1.ZodIssueCode.too_small,
1113
+ minimum: check.value,
1114
+ type: "number",
1115
+ inclusive: check.inclusive,
1116
+ exact: false,
1117
+ message: check.message,
1118
+ });
1119
+ status.dirty();
1120
+ }
1121
+ }
1122
+ else if (check.kind === "max") {
1123
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1124
+ if (tooBig) {
1125
+ ctx = this._getOrReturnCtx(input, ctx);
1126
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1127
+ code: ZodError_js_1.ZodIssueCode.too_big,
1128
+ maximum: check.value,
1129
+ type: "number",
1130
+ inclusive: check.inclusive,
1131
+ exact: false,
1132
+ message: check.message,
1133
+ });
1134
+ status.dirty();
1135
+ }
1136
+ }
1137
+ else if (check.kind === "multipleOf") {
1138
+ if (floatSafeRemainder(input.data, check.value) !== 0) {
1139
+ ctx = this._getOrReturnCtx(input, ctx);
1140
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1141
+ code: ZodError_js_1.ZodIssueCode.not_multiple_of,
1142
+ multipleOf: check.value,
1143
+ message: check.message,
1144
+ });
1145
+ status.dirty();
1146
+ }
1147
+ }
1148
+ else if (check.kind === "finite") {
1149
+ if (!Number.isFinite(input.data)) {
1150
+ ctx = this._getOrReturnCtx(input, ctx);
1151
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1152
+ code: ZodError_js_1.ZodIssueCode.not_finite,
1153
+ message: check.message,
1154
+ });
1155
+ status.dirty();
1156
+ }
1157
+ }
1158
+ else {
1159
+ util_js_1.util.assertNever(check);
1160
+ }
1161
+ }
1162
+ return { status: status.value, value: input.data };
1163
+ }
1164
+ gte(value, message) {
1165
+ return this.setLimit("min", value, true, errorUtil_js_1.errorUtil.toString(message));
1166
+ }
1167
+ gt(value, message) {
1168
+ return this.setLimit("min", value, false, errorUtil_js_1.errorUtil.toString(message));
1169
+ }
1170
+ lte(value, message) {
1171
+ return this.setLimit("max", value, true, errorUtil_js_1.errorUtil.toString(message));
1172
+ }
1173
+ lt(value, message) {
1174
+ return this.setLimit("max", value, false, errorUtil_js_1.errorUtil.toString(message));
1175
+ }
1176
+ setLimit(kind, value, inclusive, message) {
1177
+ return new ZodNumber({
1178
+ ...this._def,
1179
+ checks: [
1180
+ ...this._def.checks,
1181
+ {
1182
+ kind,
1183
+ value,
1184
+ inclusive,
1185
+ message: errorUtil_js_1.errorUtil.toString(message),
1186
+ },
1187
+ ],
1188
+ });
1189
+ }
1190
+ _addCheck(check) {
1191
+ return new ZodNumber({
1192
+ ...this._def,
1193
+ checks: [...this._def.checks, check],
1194
+ });
1195
+ }
1196
+ int(message) {
1197
+ return this._addCheck({
1198
+ kind: "int",
1199
+ message: errorUtil_js_1.errorUtil.toString(message),
1200
+ });
1201
+ }
1202
+ positive(message) {
1203
+ return this._addCheck({
1204
+ kind: "min",
1205
+ value: 0,
1206
+ inclusive: false,
1207
+ message: errorUtil_js_1.errorUtil.toString(message),
1208
+ });
1209
+ }
1210
+ negative(message) {
1211
+ return this._addCheck({
1212
+ kind: "max",
1213
+ value: 0,
1214
+ inclusive: false,
1215
+ message: errorUtil_js_1.errorUtil.toString(message),
1216
+ });
1217
+ }
1218
+ nonpositive(message) {
1219
+ return this._addCheck({
1220
+ kind: "max",
1221
+ value: 0,
1222
+ inclusive: true,
1223
+ message: errorUtil_js_1.errorUtil.toString(message),
1224
+ });
1225
+ }
1226
+ nonnegative(message) {
1227
+ return this._addCheck({
1228
+ kind: "min",
1229
+ value: 0,
1230
+ inclusive: true,
1231
+ message: errorUtil_js_1.errorUtil.toString(message),
1232
+ });
1233
+ }
1234
+ multipleOf(value, message) {
1235
+ return this._addCheck({
1236
+ kind: "multipleOf",
1237
+ value: value,
1238
+ message: errorUtil_js_1.errorUtil.toString(message),
1239
+ });
1240
+ }
1241
+ finite(message) {
1242
+ return this._addCheck({
1243
+ kind: "finite",
1244
+ message: errorUtil_js_1.errorUtil.toString(message),
1245
+ });
1246
+ }
1247
+ safe(message) {
1248
+ return this._addCheck({
1249
+ kind: "min",
1250
+ inclusive: true,
1251
+ value: Number.MIN_SAFE_INTEGER,
1252
+ message: errorUtil_js_1.errorUtil.toString(message),
1253
+ })._addCheck({
1254
+ kind: "max",
1255
+ inclusive: true,
1256
+ value: Number.MAX_SAFE_INTEGER,
1257
+ message: errorUtil_js_1.errorUtil.toString(message),
1258
+ });
1259
+ }
1260
+ get minValue() {
1261
+ let min = null;
1262
+ for (const ch of this._def.checks) {
1263
+ if (ch.kind === "min") {
1264
+ if (min === null || ch.value > min)
1265
+ min = ch.value;
1266
+ }
1267
+ }
1268
+ return min;
1269
+ }
1270
+ get maxValue() {
1271
+ let max = null;
1272
+ for (const ch of this._def.checks) {
1273
+ if (ch.kind === "max") {
1274
+ if (max === null || ch.value < max)
1275
+ max = ch.value;
1276
+ }
1277
+ }
1278
+ return max;
1279
+ }
1280
+ get isInt() {
1281
+ return !!this._def.checks.find((ch) => ch.kind === "int" || (ch.kind === "multipleOf" && util_js_1.util.isInteger(ch.value)));
1282
+ }
1283
+ get isFinite() {
1284
+ let max = null;
1285
+ let min = null;
1286
+ for (const ch of this._def.checks) {
1287
+ if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
1288
+ return true;
1289
+ }
1290
+ else if (ch.kind === "min") {
1291
+ if (min === null || ch.value > min)
1292
+ min = ch.value;
1293
+ }
1294
+ else if (ch.kind === "max") {
1295
+ if (max === null || ch.value < max)
1296
+ max = ch.value;
1297
+ }
1298
+ }
1299
+ return Number.isFinite(min) && Number.isFinite(max);
1300
+ }
1301
+ }
1302
+ exports.ZodNumber = ZodNumber;
1303
+ ZodNumber.create = (params) => {
1304
+ return new ZodNumber({
1305
+ checks: [],
1306
+ typeName: ZodFirstPartyTypeKind.ZodNumber,
1307
+ coerce: params?.coerce || false,
1308
+ ...processCreateParams(params),
1309
+ });
1310
+ };
1311
+ class ZodBigInt extends ZodType {
1312
+ constructor() {
1313
+ super(...arguments);
1314
+ this.min = this.gte;
1315
+ this.max = this.lte;
1316
+ }
1317
+ _parse(input) {
1318
+ if (this._def.coerce) {
1319
+ try {
1320
+ input.data = BigInt(input.data);
1321
+ }
1322
+ catch {
1323
+ return this._getInvalidInput(input);
1324
+ }
1325
+ }
1326
+ const parsedType = this._getType(input);
1327
+ if (parsedType !== util_js_1.ZodParsedType.bigint) {
1328
+ return this._getInvalidInput(input);
1329
+ }
1330
+ let ctx = undefined;
1331
+ const status = new parseUtil_js_1.ParseStatus();
1332
+ for (const check of this._def.checks) {
1333
+ if (check.kind === "min") {
1334
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1335
+ if (tooSmall) {
1336
+ ctx = this._getOrReturnCtx(input, ctx);
1337
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1338
+ code: ZodError_js_1.ZodIssueCode.too_small,
1339
+ type: "bigint",
1340
+ minimum: check.value,
1341
+ inclusive: check.inclusive,
1342
+ message: check.message,
1343
+ });
1344
+ status.dirty();
1345
+ }
1346
+ }
1347
+ else if (check.kind === "max") {
1348
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1349
+ if (tooBig) {
1350
+ ctx = this._getOrReturnCtx(input, ctx);
1351
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1352
+ code: ZodError_js_1.ZodIssueCode.too_big,
1353
+ type: "bigint",
1354
+ maximum: check.value,
1355
+ inclusive: check.inclusive,
1356
+ message: check.message,
1357
+ });
1358
+ status.dirty();
1359
+ }
1360
+ }
1361
+ else if (check.kind === "multipleOf") {
1362
+ if (input.data % check.value !== BigInt(0)) {
1363
+ ctx = this._getOrReturnCtx(input, ctx);
1364
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1365
+ code: ZodError_js_1.ZodIssueCode.not_multiple_of,
1366
+ multipleOf: check.value,
1367
+ message: check.message,
1368
+ });
1369
+ status.dirty();
1370
+ }
1371
+ }
1372
+ else {
1373
+ util_js_1.util.assertNever(check);
1374
+ }
1375
+ }
1376
+ return { status: status.value, value: input.data };
1377
+ }
1378
+ _getInvalidInput(input) {
1379
+ const ctx = this._getOrReturnCtx(input);
1380
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1381
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1382
+ expected: util_js_1.ZodParsedType.bigint,
1383
+ received: ctx.parsedType,
1384
+ });
1385
+ return parseUtil_js_1.INVALID;
1386
+ }
1387
+ gte(value, message) {
1388
+ return this.setLimit("min", value, true, errorUtil_js_1.errorUtil.toString(message));
1389
+ }
1390
+ gt(value, message) {
1391
+ return this.setLimit("min", value, false, errorUtil_js_1.errorUtil.toString(message));
1392
+ }
1393
+ lte(value, message) {
1394
+ return this.setLimit("max", value, true, errorUtil_js_1.errorUtil.toString(message));
1395
+ }
1396
+ lt(value, message) {
1397
+ return this.setLimit("max", value, false, errorUtil_js_1.errorUtil.toString(message));
1398
+ }
1399
+ setLimit(kind, value, inclusive, message) {
1400
+ return new ZodBigInt({
1401
+ ...this._def,
1402
+ checks: [
1403
+ ...this._def.checks,
1404
+ {
1405
+ kind,
1406
+ value,
1407
+ inclusive,
1408
+ message: errorUtil_js_1.errorUtil.toString(message),
1409
+ },
1410
+ ],
1411
+ });
1412
+ }
1413
+ _addCheck(check) {
1414
+ return new ZodBigInt({
1415
+ ...this._def,
1416
+ checks: [...this._def.checks, check],
1417
+ });
1418
+ }
1419
+ positive(message) {
1420
+ return this._addCheck({
1421
+ kind: "min",
1422
+ value: BigInt(0),
1423
+ inclusive: false,
1424
+ message: errorUtil_js_1.errorUtil.toString(message),
1425
+ });
1426
+ }
1427
+ negative(message) {
1428
+ return this._addCheck({
1429
+ kind: "max",
1430
+ value: BigInt(0),
1431
+ inclusive: false,
1432
+ message: errorUtil_js_1.errorUtil.toString(message),
1433
+ });
1434
+ }
1435
+ nonpositive(message) {
1436
+ return this._addCheck({
1437
+ kind: "max",
1438
+ value: BigInt(0),
1439
+ inclusive: true,
1440
+ message: errorUtil_js_1.errorUtil.toString(message),
1441
+ });
1442
+ }
1443
+ nonnegative(message) {
1444
+ return this._addCheck({
1445
+ kind: "min",
1446
+ value: BigInt(0),
1447
+ inclusive: true,
1448
+ message: errorUtil_js_1.errorUtil.toString(message),
1449
+ });
1450
+ }
1451
+ multipleOf(value, message) {
1452
+ return this._addCheck({
1453
+ kind: "multipleOf",
1454
+ value,
1455
+ message: errorUtil_js_1.errorUtil.toString(message),
1456
+ });
1457
+ }
1458
+ get minValue() {
1459
+ let min = null;
1460
+ for (const ch of this._def.checks) {
1461
+ if (ch.kind === "min") {
1462
+ if (min === null || ch.value > min)
1463
+ min = ch.value;
1464
+ }
1465
+ }
1466
+ return min;
1467
+ }
1468
+ get maxValue() {
1469
+ let max = null;
1470
+ for (const ch of this._def.checks) {
1471
+ if (ch.kind === "max") {
1472
+ if (max === null || ch.value < max)
1473
+ max = ch.value;
1474
+ }
1475
+ }
1476
+ return max;
1477
+ }
1478
+ }
1479
+ exports.ZodBigInt = ZodBigInt;
1480
+ ZodBigInt.create = (params) => {
1481
+ return new ZodBigInt({
1482
+ checks: [],
1483
+ typeName: ZodFirstPartyTypeKind.ZodBigInt,
1484
+ coerce: params?.coerce ?? false,
1485
+ ...processCreateParams(params),
1486
+ });
1487
+ };
1488
+ class ZodBoolean extends ZodType {
1489
+ _parse(input) {
1490
+ if (this._def.coerce) {
1491
+ input.data = Boolean(input.data);
1492
+ }
1493
+ const parsedType = this._getType(input);
1494
+ if (parsedType !== util_js_1.ZodParsedType.boolean) {
1495
+ const ctx = this._getOrReturnCtx(input);
1496
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1497
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1498
+ expected: util_js_1.ZodParsedType.boolean,
1499
+ received: ctx.parsedType,
1500
+ });
1501
+ return parseUtil_js_1.INVALID;
1502
+ }
1503
+ return (0, parseUtil_js_1.OK)(input.data);
1504
+ }
1505
+ }
1506
+ exports.ZodBoolean = ZodBoolean;
1507
+ ZodBoolean.create = (params) => {
1508
+ return new ZodBoolean({
1509
+ typeName: ZodFirstPartyTypeKind.ZodBoolean,
1510
+ coerce: params?.coerce || false,
1511
+ ...processCreateParams(params),
1512
+ });
1513
+ };
1514
+ class ZodDate extends ZodType {
1515
+ _parse(input) {
1516
+ if (this._def.coerce) {
1517
+ input.data = new Date(input.data);
1518
+ }
1519
+ const parsedType = this._getType(input);
1520
+ if (parsedType !== util_js_1.ZodParsedType.date) {
1521
+ const ctx = this._getOrReturnCtx(input);
1522
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1523
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1524
+ expected: util_js_1.ZodParsedType.date,
1525
+ received: ctx.parsedType,
1526
+ });
1527
+ return parseUtil_js_1.INVALID;
1528
+ }
1529
+ if (Number.isNaN(input.data.getTime())) {
1530
+ const ctx = this._getOrReturnCtx(input);
1531
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1532
+ code: ZodError_js_1.ZodIssueCode.invalid_date,
1533
+ });
1534
+ return parseUtil_js_1.INVALID;
1535
+ }
1536
+ const status = new parseUtil_js_1.ParseStatus();
1537
+ let ctx = undefined;
1538
+ for (const check of this._def.checks) {
1539
+ if (check.kind === "min") {
1540
+ if (input.data.getTime() < check.value) {
1541
+ ctx = this._getOrReturnCtx(input, ctx);
1542
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1543
+ code: ZodError_js_1.ZodIssueCode.too_small,
1544
+ message: check.message,
1545
+ inclusive: true,
1546
+ exact: false,
1547
+ minimum: check.value,
1548
+ type: "date",
1549
+ });
1550
+ status.dirty();
1551
+ }
1552
+ }
1553
+ else if (check.kind === "max") {
1554
+ if (input.data.getTime() > check.value) {
1555
+ ctx = this._getOrReturnCtx(input, ctx);
1556
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1557
+ code: ZodError_js_1.ZodIssueCode.too_big,
1558
+ message: check.message,
1559
+ inclusive: true,
1560
+ exact: false,
1561
+ maximum: check.value,
1562
+ type: "date",
1563
+ });
1564
+ status.dirty();
1565
+ }
1566
+ }
1567
+ else {
1568
+ util_js_1.util.assertNever(check);
1569
+ }
1570
+ }
1571
+ return {
1572
+ status: status.value,
1573
+ value: new Date(input.data.getTime()),
1574
+ };
1575
+ }
1576
+ _addCheck(check) {
1577
+ return new ZodDate({
1578
+ ...this._def,
1579
+ checks: [...this._def.checks, check],
1580
+ });
1581
+ }
1582
+ min(minDate, message) {
1583
+ return this._addCheck({
1584
+ kind: "min",
1585
+ value: minDate.getTime(),
1586
+ message: errorUtil_js_1.errorUtil.toString(message),
1587
+ });
1588
+ }
1589
+ max(maxDate, message) {
1590
+ return this._addCheck({
1591
+ kind: "max",
1592
+ value: maxDate.getTime(),
1593
+ message: errorUtil_js_1.errorUtil.toString(message),
1594
+ });
1595
+ }
1596
+ get minDate() {
1597
+ let min = null;
1598
+ for (const ch of this._def.checks) {
1599
+ if (ch.kind === "min") {
1600
+ if (min === null || ch.value > min)
1601
+ min = ch.value;
1602
+ }
1603
+ }
1604
+ return min != null ? new Date(min) : null;
1605
+ }
1606
+ get maxDate() {
1607
+ let max = null;
1608
+ for (const ch of this._def.checks) {
1609
+ if (ch.kind === "max") {
1610
+ if (max === null || ch.value < max)
1611
+ max = ch.value;
1612
+ }
1613
+ }
1614
+ return max != null ? new Date(max) : null;
1615
+ }
1616
+ }
1617
+ exports.ZodDate = ZodDate;
1618
+ ZodDate.create = (params) => {
1619
+ return new ZodDate({
1620
+ checks: [],
1621
+ coerce: params?.coerce || false,
1622
+ typeName: ZodFirstPartyTypeKind.ZodDate,
1623
+ ...processCreateParams(params),
1624
+ });
1625
+ };
1626
+ class ZodSymbol extends ZodType {
1627
+ _parse(input) {
1628
+ const parsedType = this._getType(input);
1629
+ if (parsedType !== util_js_1.ZodParsedType.symbol) {
1630
+ const ctx = this._getOrReturnCtx(input);
1631
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1632
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1633
+ expected: util_js_1.ZodParsedType.symbol,
1634
+ received: ctx.parsedType,
1635
+ });
1636
+ return parseUtil_js_1.INVALID;
1637
+ }
1638
+ return (0, parseUtil_js_1.OK)(input.data);
1639
+ }
1640
+ }
1641
+ exports.ZodSymbol = ZodSymbol;
1642
+ ZodSymbol.create = (params) => {
1643
+ return new ZodSymbol({
1644
+ typeName: ZodFirstPartyTypeKind.ZodSymbol,
1645
+ ...processCreateParams(params),
1646
+ });
1647
+ };
1648
+ class ZodUndefined extends ZodType {
1649
+ _parse(input) {
1650
+ const parsedType = this._getType(input);
1651
+ if (parsedType !== util_js_1.ZodParsedType.undefined) {
1652
+ const ctx = this._getOrReturnCtx(input);
1653
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1654
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1655
+ expected: util_js_1.ZodParsedType.undefined,
1656
+ received: ctx.parsedType,
1657
+ });
1658
+ return parseUtil_js_1.INVALID;
1659
+ }
1660
+ return (0, parseUtil_js_1.OK)(input.data);
1661
+ }
1662
+ }
1663
+ exports.ZodUndefined = ZodUndefined;
1664
+ ZodUndefined.create = (params) => {
1665
+ return new ZodUndefined({
1666
+ typeName: ZodFirstPartyTypeKind.ZodUndefined,
1667
+ ...processCreateParams(params),
1668
+ });
1669
+ };
1670
+ class ZodNull extends ZodType {
1671
+ _parse(input) {
1672
+ const parsedType = this._getType(input);
1673
+ if (parsedType !== util_js_1.ZodParsedType.null) {
1674
+ const ctx = this._getOrReturnCtx(input);
1675
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1676
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1677
+ expected: util_js_1.ZodParsedType.null,
1678
+ received: ctx.parsedType,
1679
+ });
1680
+ return parseUtil_js_1.INVALID;
1681
+ }
1682
+ return (0, parseUtil_js_1.OK)(input.data);
1683
+ }
1684
+ }
1685
+ exports.ZodNull = ZodNull;
1686
+ ZodNull.create = (params) => {
1687
+ return new ZodNull({
1688
+ typeName: ZodFirstPartyTypeKind.ZodNull,
1689
+ ...processCreateParams(params),
1690
+ });
1691
+ };
1692
+ class ZodAny extends ZodType {
1693
+ constructor() {
1694
+ super(...arguments);
1695
+ // to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.
1696
+ this._any = true;
1697
+ }
1698
+ _parse(input) {
1699
+ return (0, parseUtil_js_1.OK)(input.data);
1700
+ }
1701
+ }
1702
+ exports.ZodAny = ZodAny;
1703
+ ZodAny.create = (params) => {
1704
+ return new ZodAny({
1705
+ typeName: ZodFirstPartyTypeKind.ZodAny,
1706
+ ...processCreateParams(params),
1707
+ });
1708
+ };
1709
+ class ZodUnknown extends ZodType {
1710
+ constructor() {
1711
+ super(...arguments);
1712
+ // required
1713
+ this._unknown = true;
1714
+ }
1715
+ _parse(input) {
1716
+ return (0, parseUtil_js_1.OK)(input.data);
1717
+ }
1718
+ }
1719
+ exports.ZodUnknown = ZodUnknown;
1720
+ ZodUnknown.create = (params) => {
1721
+ return new ZodUnknown({
1722
+ typeName: ZodFirstPartyTypeKind.ZodUnknown,
1723
+ ...processCreateParams(params),
1724
+ });
1725
+ };
1726
+ class ZodNever extends ZodType {
1727
+ _parse(input) {
1728
+ const ctx = this._getOrReturnCtx(input);
1729
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1730
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1731
+ expected: util_js_1.ZodParsedType.never,
1732
+ received: ctx.parsedType,
1733
+ });
1734
+ return parseUtil_js_1.INVALID;
1735
+ }
1736
+ }
1737
+ exports.ZodNever = ZodNever;
1738
+ ZodNever.create = (params) => {
1739
+ return new ZodNever({
1740
+ typeName: ZodFirstPartyTypeKind.ZodNever,
1741
+ ...processCreateParams(params),
1742
+ });
1743
+ };
1744
+ class ZodVoid extends ZodType {
1745
+ _parse(input) {
1746
+ const parsedType = this._getType(input);
1747
+ if (parsedType !== util_js_1.ZodParsedType.undefined) {
1748
+ const ctx = this._getOrReturnCtx(input);
1749
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1750
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1751
+ expected: util_js_1.ZodParsedType.void,
1752
+ received: ctx.parsedType,
1753
+ });
1754
+ return parseUtil_js_1.INVALID;
1755
+ }
1756
+ return (0, parseUtil_js_1.OK)(input.data);
1757
+ }
1758
+ }
1759
+ exports.ZodVoid = ZodVoid;
1760
+ ZodVoid.create = (params) => {
1761
+ return new ZodVoid({
1762
+ typeName: ZodFirstPartyTypeKind.ZodVoid,
1763
+ ...processCreateParams(params),
1764
+ });
1765
+ };
1766
+ class ZodArray extends ZodType {
1767
+ _parse(input) {
1768
+ const { ctx, status } = this._processInputParams(input);
1769
+ const def = this._def;
1770
+ if (ctx.parsedType !== util_js_1.ZodParsedType.array) {
1771
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1772
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1773
+ expected: util_js_1.ZodParsedType.array,
1774
+ received: ctx.parsedType,
1775
+ });
1776
+ return parseUtil_js_1.INVALID;
1777
+ }
1778
+ if (def.exactLength !== null) {
1779
+ const tooBig = ctx.data.length > def.exactLength.value;
1780
+ const tooSmall = ctx.data.length < def.exactLength.value;
1781
+ if (tooBig || tooSmall) {
1782
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1783
+ code: tooBig ? ZodError_js_1.ZodIssueCode.too_big : ZodError_js_1.ZodIssueCode.too_small,
1784
+ minimum: (tooSmall ? def.exactLength.value : undefined),
1785
+ maximum: (tooBig ? def.exactLength.value : undefined),
1786
+ type: "array",
1787
+ inclusive: true,
1788
+ exact: true,
1789
+ message: def.exactLength.message,
1790
+ });
1791
+ status.dirty();
1792
+ }
1793
+ }
1794
+ if (def.minLength !== null) {
1795
+ if (ctx.data.length < def.minLength.value) {
1796
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1797
+ code: ZodError_js_1.ZodIssueCode.too_small,
1798
+ minimum: def.minLength.value,
1799
+ type: "array",
1800
+ inclusive: true,
1801
+ exact: false,
1802
+ message: def.minLength.message,
1803
+ });
1804
+ status.dirty();
1805
+ }
1806
+ }
1807
+ if (def.maxLength !== null) {
1808
+ if (ctx.data.length > def.maxLength.value) {
1809
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1810
+ code: ZodError_js_1.ZodIssueCode.too_big,
1811
+ maximum: def.maxLength.value,
1812
+ type: "array",
1813
+ inclusive: true,
1814
+ exact: false,
1815
+ message: def.maxLength.message,
1816
+ });
1817
+ status.dirty();
1818
+ }
1819
+ }
1820
+ if (ctx.common.async) {
1821
+ return Promise.all([...ctx.data].map((item, i) => {
1822
+ return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
1823
+ })).then((result) => {
1824
+ return parseUtil_js_1.ParseStatus.mergeArray(status, result);
1825
+ });
1826
+ }
1827
+ const result = [...ctx.data].map((item, i) => {
1828
+ return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
1829
+ });
1830
+ return parseUtil_js_1.ParseStatus.mergeArray(status, result);
1831
+ }
1832
+ get element() {
1833
+ return this._def.type;
1834
+ }
1835
+ min(minLength, message) {
1836
+ return new ZodArray({
1837
+ ...this._def,
1838
+ minLength: { value: minLength, message: errorUtil_js_1.errorUtil.toString(message) },
1839
+ });
1840
+ }
1841
+ max(maxLength, message) {
1842
+ return new ZodArray({
1843
+ ...this._def,
1844
+ maxLength: { value: maxLength, message: errorUtil_js_1.errorUtil.toString(message) },
1845
+ });
1846
+ }
1847
+ length(len, message) {
1848
+ return new ZodArray({
1849
+ ...this._def,
1850
+ exactLength: { value: len, message: errorUtil_js_1.errorUtil.toString(message) },
1851
+ });
1852
+ }
1853
+ nonempty(message) {
1854
+ return this.min(1, message);
1855
+ }
1856
+ }
1857
+ exports.ZodArray = ZodArray;
1858
+ ZodArray.create = (schema, params) => {
1859
+ return new ZodArray({
1860
+ type: schema,
1861
+ minLength: null,
1862
+ maxLength: null,
1863
+ exactLength: null,
1864
+ typeName: ZodFirstPartyTypeKind.ZodArray,
1865
+ ...processCreateParams(params),
1866
+ });
1867
+ };
1868
+ function deepPartialify(schema) {
1869
+ if (schema instanceof ZodObject) {
1870
+ const newShape = {};
1871
+ for (const key in schema.shape) {
1872
+ const fieldSchema = schema.shape[key];
1873
+ newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
1874
+ }
1875
+ return new ZodObject({
1876
+ ...schema._def,
1877
+ shape: () => newShape,
1878
+ });
1879
+ }
1880
+ else if (schema instanceof ZodArray) {
1881
+ return new ZodArray({
1882
+ ...schema._def,
1883
+ type: deepPartialify(schema.element),
1884
+ });
1885
+ }
1886
+ else if (schema instanceof ZodOptional) {
1887
+ return ZodOptional.create(deepPartialify(schema.unwrap()));
1888
+ }
1889
+ else if (schema instanceof ZodNullable) {
1890
+ return ZodNullable.create(deepPartialify(schema.unwrap()));
1891
+ }
1892
+ else if (schema instanceof ZodTuple) {
1893
+ return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
1894
+ }
1895
+ else {
1896
+ return schema;
1897
+ }
1898
+ }
1899
+ class ZodObject extends ZodType {
1900
+ constructor() {
1901
+ super(...arguments);
1902
+ this._cached = null;
1903
+ /**
1904
+ * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
1905
+ * If you want to pass through unknown properties, use `.passthrough()` instead.
1906
+ */
1907
+ this.nonstrict = this.passthrough;
1908
+ // extend<
1909
+ // Augmentation extends ZodRawShape,
1910
+ // NewOutput extends util.flatten<{
1911
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1912
+ // ? Augmentation[k]["_output"]
1913
+ // : k extends keyof Output
1914
+ // ? Output[k]
1915
+ // : never;
1916
+ // }>,
1917
+ // NewInput extends util.flatten<{
1918
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1919
+ // ? Augmentation[k]["_input"]
1920
+ // : k extends keyof Input
1921
+ // ? Input[k]
1922
+ // : never;
1923
+ // }>
1924
+ // >(
1925
+ // augmentation: Augmentation
1926
+ // ): ZodObject<
1927
+ // extendShape<T, Augmentation>,
1928
+ // UnknownKeys,
1929
+ // Catchall,
1930
+ // NewOutput,
1931
+ // NewInput
1932
+ // > {
1933
+ // return new ZodObject({
1934
+ // ...this._def,
1935
+ // shape: () => ({
1936
+ // ...this._def.shape(),
1937
+ // ...augmentation,
1938
+ // }),
1939
+ // }) as any;
1940
+ // }
1941
+ /**
1942
+ * @deprecated Use `.extend` instead
1943
+ * */
1944
+ this.augment = this.extend;
1945
+ }
1946
+ _getCached() {
1947
+ if (this._cached !== null)
1948
+ return this._cached;
1949
+ const shape = this._def.shape();
1950
+ const keys = util_js_1.util.objectKeys(shape);
1951
+ this._cached = { shape, keys };
1952
+ return this._cached;
1953
+ }
1954
+ _parse(input) {
1955
+ const parsedType = this._getType(input);
1956
+ if (parsedType !== util_js_1.ZodParsedType.object) {
1957
+ const ctx = this._getOrReturnCtx(input);
1958
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1959
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1960
+ expected: util_js_1.ZodParsedType.object,
1961
+ received: ctx.parsedType,
1962
+ });
1963
+ return parseUtil_js_1.INVALID;
1964
+ }
1965
+ const { status, ctx } = this._processInputParams(input);
1966
+ const { shape, keys: shapeKeys } = this._getCached();
1967
+ const extraKeys = [];
1968
+ if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
1969
+ for (const key in ctx.data) {
1970
+ if (!shapeKeys.includes(key)) {
1971
+ extraKeys.push(key);
1972
+ }
1973
+ }
1974
+ }
1975
+ const pairs = [];
1976
+ for (const key of shapeKeys) {
1977
+ const keyValidator = shape[key];
1978
+ const value = ctx.data[key];
1979
+ pairs.push({
1980
+ key: { status: "valid", value: key },
1981
+ value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
1982
+ alwaysSet: key in ctx.data,
1983
+ });
1984
+ }
1985
+ if (this._def.catchall instanceof ZodNever) {
1986
+ const unknownKeys = this._def.unknownKeys;
1987
+ if (unknownKeys === "passthrough") {
1988
+ for (const key of extraKeys) {
1989
+ pairs.push({
1990
+ key: { status: "valid", value: key },
1991
+ value: { status: "valid", value: ctx.data[key] },
1992
+ });
1993
+ }
1994
+ }
1995
+ else if (unknownKeys === "strict") {
1996
+ if (extraKeys.length > 0) {
1997
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1998
+ code: ZodError_js_1.ZodIssueCode.unrecognized_keys,
1999
+ keys: extraKeys,
2000
+ });
2001
+ status.dirty();
2002
+ }
2003
+ }
2004
+ else if (unknownKeys === "strip") {
2005
+ }
2006
+ else {
2007
+ throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
2008
+ }
2009
+ }
2010
+ else {
2011
+ // run catchall validation
2012
+ const catchall = this._def.catchall;
2013
+ for (const key of extraKeys) {
2014
+ const value = ctx.data[key];
2015
+ pairs.push({
2016
+ key: { status: "valid", value: key },
2017
+ value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value)
2018
+ ),
2019
+ alwaysSet: key in ctx.data,
2020
+ });
2021
+ }
2022
+ }
2023
+ if (ctx.common.async) {
2024
+ return Promise.resolve()
2025
+ .then(async () => {
2026
+ const syncPairs = [];
2027
+ for (const pair of pairs) {
2028
+ const key = await pair.key;
2029
+ const value = await pair.value;
2030
+ syncPairs.push({
2031
+ key,
2032
+ value,
2033
+ alwaysSet: pair.alwaysSet,
2034
+ });
2035
+ }
2036
+ return syncPairs;
2037
+ })
2038
+ .then((syncPairs) => {
2039
+ return parseUtil_js_1.ParseStatus.mergeObjectSync(status, syncPairs);
2040
+ });
2041
+ }
2042
+ else {
2043
+ return parseUtil_js_1.ParseStatus.mergeObjectSync(status, pairs);
2044
+ }
2045
+ }
2046
+ get shape() {
2047
+ return this._def.shape();
2048
+ }
2049
+ strict(message) {
2050
+ errorUtil_js_1.errorUtil.errToObj;
2051
+ return new ZodObject({
2052
+ ...this._def,
2053
+ unknownKeys: "strict",
2054
+ ...(message !== undefined
2055
+ ? {
2056
+ errorMap: (issue, ctx) => {
2057
+ const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
2058
+ if (issue.code === "unrecognized_keys")
2059
+ return {
2060
+ message: errorUtil_js_1.errorUtil.errToObj(message).message ?? defaultError,
2061
+ };
2062
+ return {
2063
+ message: defaultError,
2064
+ };
2065
+ },
2066
+ }
2067
+ : {}),
2068
+ });
2069
+ }
2070
+ strip() {
2071
+ return new ZodObject({
2072
+ ...this._def,
2073
+ unknownKeys: "strip",
2074
+ });
2075
+ }
2076
+ passthrough() {
2077
+ return new ZodObject({
2078
+ ...this._def,
2079
+ unknownKeys: "passthrough",
2080
+ });
2081
+ }
2082
+ // const AugmentFactory =
2083
+ // <Def extends ZodObjectDef>(def: Def) =>
2084
+ // <Augmentation extends ZodRawShape>(
2085
+ // augmentation: Augmentation
2086
+ // ): ZodObject<
2087
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
2088
+ // Def["unknownKeys"],
2089
+ // Def["catchall"]
2090
+ // > => {
2091
+ // return new ZodObject({
2092
+ // ...def,
2093
+ // shape: () => ({
2094
+ // ...def.shape(),
2095
+ // ...augmentation,
2096
+ // }),
2097
+ // }) as any;
2098
+ // };
2099
+ extend(augmentation) {
2100
+ return new ZodObject({
2101
+ ...this._def,
2102
+ shape: () => ({
2103
+ ...this._def.shape(),
2104
+ ...augmentation,
2105
+ }),
2106
+ });
2107
+ }
2108
+ /**
2109
+ * Prior to zod@1.0.12 there was a bug in the
2110
+ * inferred type of merged objects. Please
2111
+ * upgrade if you are experiencing issues.
2112
+ */
2113
+ merge(merging) {
2114
+ const merged = new ZodObject({
2115
+ unknownKeys: merging._def.unknownKeys,
2116
+ catchall: merging._def.catchall,
2117
+ shape: () => ({
2118
+ ...this._def.shape(),
2119
+ ...merging._def.shape(),
2120
+ }),
2121
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2122
+ });
2123
+ return merged;
2124
+ }
2125
+ // merge<
2126
+ // Incoming extends AnyZodObject,
2127
+ // Augmentation extends Incoming["shape"],
2128
+ // NewOutput extends {
2129
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2130
+ // ? Augmentation[k]["_output"]
2131
+ // : k extends keyof Output
2132
+ // ? Output[k]
2133
+ // : never;
2134
+ // },
2135
+ // NewInput extends {
2136
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2137
+ // ? Augmentation[k]["_input"]
2138
+ // : k extends keyof Input
2139
+ // ? Input[k]
2140
+ // : never;
2141
+ // }
2142
+ // >(
2143
+ // merging: Incoming
2144
+ // ): ZodObject<
2145
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2146
+ // Incoming["_def"]["unknownKeys"],
2147
+ // Incoming["_def"]["catchall"],
2148
+ // NewOutput,
2149
+ // NewInput
2150
+ // > {
2151
+ // const merged: any = new ZodObject({
2152
+ // unknownKeys: merging._def.unknownKeys,
2153
+ // catchall: merging._def.catchall,
2154
+ // shape: () =>
2155
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2156
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2157
+ // }) as any;
2158
+ // return merged;
2159
+ // }
2160
+ setKey(key, schema) {
2161
+ return this.augment({ [key]: schema });
2162
+ }
2163
+ // merge<Incoming extends AnyZodObject>(
2164
+ // merging: Incoming
2165
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
2166
+ // ZodObject<
2167
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2168
+ // Incoming["_def"]["unknownKeys"],
2169
+ // Incoming["_def"]["catchall"]
2170
+ // > {
2171
+ // // const mergedShape = objectUtil.mergeShapes(
2172
+ // // this._def.shape(),
2173
+ // // merging._def.shape()
2174
+ // // );
2175
+ // const merged: any = new ZodObject({
2176
+ // unknownKeys: merging._def.unknownKeys,
2177
+ // catchall: merging._def.catchall,
2178
+ // shape: () =>
2179
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2180
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2181
+ // }) as any;
2182
+ // return merged;
2183
+ // }
2184
+ catchall(index) {
2185
+ return new ZodObject({
2186
+ ...this._def,
2187
+ catchall: index,
2188
+ });
2189
+ }
2190
+ pick(mask) {
2191
+ const shape = {};
2192
+ for (const key of util_js_1.util.objectKeys(mask)) {
2193
+ if (mask[key] && this.shape[key]) {
2194
+ shape[key] = this.shape[key];
2195
+ }
2196
+ }
2197
+ return new ZodObject({
2198
+ ...this._def,
2199
+ shape: () => shape,
2200
+ });
2201
+ }
2202
+ omit(mask) {
2203
+ const shape = {};
2204
+ for (const key of util_js_1.util.objectKeys(this.shape)) {
2205
+ if (!mask[key]) {
2206
+ shape[key] = this.shape[key];
2207
+ }
2208
+ }
2209
+ return new ZodObject({
2210
+ ...this._def,
2211
+ shape: () => shape,
2212
+ });
2213
+ }
2214
+ /**
2215
+ * @deprecated
2216
+ */
2217
+ deepPartial() {
2218
+ return deepPartialify(this);
2219
+ }
2220
+ partial(mask) {
2221
+ const newShape = {};
2222
+ for (const key of util_js_1.util.objectKeys(this.shape)) {
2223
+ const fieldSchema = this.shape[key];
2224
+ if (mask && !mask[key]) {
2225
+ newShape[key] = fieldSchema;
2226
+ }
2227
+ else {
2228
+ newShape[key] = fieldSchema.optional();
2229
+ }
2230
+ }
2231
+ return new ZodObject({
2232
+ ...this._def,
2233
+ shape: () => newShape,
2234
+ });
2235
+ }
2236
+ required(mask) {
2237
+ const newShape = {};
2238
+ for (const key of util_js_1.util.objectKeys(this.shape)) {
2239
+ if (mask && !mask[key]) {
2240
+ newShape[key] = this.shape[key];
2241
+ }
2242
+ else {
2243
+ const fieldSchema = this.shape[key];
2244
+ let newField = fieldSchema;
2245
+ while (newField instanceof ZodOptional) {
2246
+ newField = newField._def.innerType;
2247
+ }
2248
+ newShape[key] = newField;
2249
+ }
2250
+ }
2251
+ return new ZodObject({
2252
+ ...this._def,
2253
+ shape: () => newShape,
2254
+ });
2255
+ }
2256
+ keyof() {
2257
+ return createZodEnum(util_js_1.util.objectKeys(this.shape));
2258
+ }
2259
+ }
2260
+ exports.ZodObject = ZodObject;
2261
+ ZodObject.create = (shape, params) => {
2262
+ return new ZodObject({
2263
+ shape: () => shape,
2264
+ unknownKeys: "strip",
2265
+ catchall: ZodNever.create(),
2266
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2267
+ ...processCreateParams(params),
2268
+ });
2269
+ };
2270
+ ZodObject.strictCreate = (shape, params) => {
2271
+ return new ZodObject({
2272
+ shape: () => shape,
2273
+ unknownKeys: "strict",
2274
+ catchall: ZodNever.create(),
2275
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2276
+ ...processCreateParams(params),
2277
+ });
2278
+ };
2279
+ ZodObject.lazycreate = (shape, params) => {
2280
+ return new ZodObject({
2281
+ shape,
2282
+ unknownKeys: "strip",
2283
+ catchall: ZodNever.create(),
2284
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2285
+ ...processCreateParams(params),
2286
+ });
2287
+ };
2288
+ class ZodUnion extends ZodType {
2289
+ _parse(input) {
2290
+ const { ctx } = this._processInputParams(input);
2291
+ const options = this._def.options;
2292
+ function handleResults(results) {
2293
+ // return first issue-free validation if it exists
2294
+ for (const result of results) {
2295
+ if (result.result.status === "valid") {
2296
+ return result.result;
2297
+ }
2298
+ }
2299
+ for (const result of results) {
2300
+ if (result.result.status === "dirty") {
2301
+ // add issues from dirty option
2302
+ ctx.common.issues.push(...result.ctx.common.issues);
2303
+ return result.result;
2304
+ }
2305
+ }
2306
+ // return invalid
2307
+ const unionErrors = results.map((result) => new ZodError_js_1.ZodError(result.ctx.common.issues));
2308
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2309
+ code: ZodError_js_1.ZodIssueCode.invalid_union,
2310
+ unionErrors,
2311
+ });
2312
+ return parseUtil_js_1.INVALID;
2313
+ }
2314
+ if (ctx.common.async) {
2315
+ return Promise.all(options.map(async (option) => {
2316
+ const childCtx = {
2317
+ ...ctx,
2318
+ common: {
2319
+ ...ctx.common,
2320
+ issues: [],
2321
+ },
2322
+ parent: null,
2323
+ };
2324
+ return {
2325
+ result: await option._parseAsync({
2326
+ data: ctx.data,
2327
+ path: ctx.path,
2328
+ parent: childCtx,
2329
+ }),
2330
+ ctx: childCtx,
2331
+ };
2332
+ })).then(handleResults);
2333
+ }
2334
+ else {
2335
+ let dirty = undefined;
2336
+ const issues = [];
2337
+ for (const option of options) {
2338
+ const childCtx = {
2339
+ ...ctx,
2340
+ common: {
2341
+ ...ctx.common,
2342
+ issues: [],
2343
+ },
2344
+ parent: null,
2345
+ };
2346
+ const result = option._parseSync({
2347
+ data: ctx.data,
2348
+ path: ctx.path,
2349
+ parent: childCtx,
2350
+ });
2351
+ if (result.status === "valid") {
2352
+ return result;
2353
+ }
2354
+ else if (result.status === "dirty" && !dirty) {
2355
+ dirty = { result, ctx: childCtx };
2356
+ }
2357
+ if (childCtx.common.issues.length) {
2358
+ issues.push(childCtx.common.issues);
2359
+ }
2360
+ }
2361
+ if (dirty) {
2362
+ ctx.common.issues.push(...dirty.ctx.common.issues);
2363
+ return dirty.result;
2364
+ }
2365
+ const unionErrors = issues.map((issues) => new ZodError_js_1.ZodError(issues));
2366
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2367
+ code: ZodError_js_1.ZodIssueCode.invalid_union,
2368
+ unionErrors,
2369
+ });
2370
+ return parseUtil_js_1.INVALID;
2371
+ }
2372
+ }
2373
+ get options() {
2374
+ return this._def.options;
2375
+ }
2376
+ }
2377
+ exports.ZodUnion = ZodUnion;
2378
+ ZodUnion.create = (types, params) => {
2379
+ return new ZodUnion({
2380
+ options: types,
2381
+ typeName: ZodFirstPartyTypeKind.ZodUnion,
2382
+ ...processCreateParams(params),
2383
+ });
2384
+ };
2385
+ /////////////////////////////////////////////////////
2386
+ /////////////////////////////////////////////////////
2387
+ ////////// //////////
2388
+ ////////// ZodDiscriminatedUnion //////////
2389
+ ////////// //////////
2390
+ /////////////////////////////////////////////////////
2391
+ /////////////////////////////////////////////////////
2392
+ const getDiscriminator = (type) => {
2393
+ if (type instanceof ZodLazy) {
2394
+ return getDiscriminator(type.schema);
2395
+ }
2396
+ else if (type instanceof ZodEffects) {
2397
+ return getDiscriminator(type.innerType());
2398
+ }
2399
+ else if (type instanceof ZodLiteral) {
2400
+ return [type.value];
2401
+ }
2402
+ else if (type instanceof ZodEnum) {
2403
+ return type.options;
2404
+ }
2405
+ else if (type instanceof ZodNativeEnum) {
2406
+ // eslint-disable-next-line ban/ban
2407
+ return util_js_1.util.objectValues(type.enum);
2408
+ }
2409
+ else if (type instanceof ZodDefault) {
2410
+ return getDiscriminator(type._def.innerType);
2411
+ }
2412
+ else if (type instanceof ZodUndefined) {
2413
+ return [undefined];
2414
+ }
2415
+ else if (type instanceof ZodNull) {
2416
+ return [null];
2417
+ }
2418
+ else if (type instanceof ZodOptional) {
2419
+ return [undefined, ...getDiscriminator(type.unwrap())];
2420
+ }
2421
+ else if (type instanceof ZodNullable) {
2422
+ return [null, ...getDiscriminator(type.unwrap())];
2423
+ }
2424
+ else if (type instanceof ZodBranded) {
2425
+ return getDiscriminator(type.unwrap());
2426
+ }
2427
+ else if (type instanceof ZodReadonly) {
2428
+ return getDiscriminator(type.unwrap());
2429
+ }
2430
+ else if (type instanceof ZodCatch) {
2431
+ return getDiscriminator(type._def.innerType);
2432
+ }
2433
+ else {
2434
+ return [];
2435
+ }
2436
+ };
2437
+ class ZodDiscriminatedUnion extends ZodType {
2438
+ _parse(input) {
2439
+ const { ctx } = this._processInputParams(input);
2440
+ if (ctx.parsedType !== util_js_1.ZodParsedType.object) {
2441
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2442
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2443
+ expected: util_js_1.ZodParsedType.object,
2444
+ received: ctx.parsedType,
2445
+ });
2446
+ return parseUtil_js_1.INVALID;
2447
+ }
2448
+ const discriminator = this.discriminator;
2449
+ const discriminatorValue = ctx.data[discriminator];
2450
+ const option = this.optionsMap.get(discriminatorValue);
2451
+ if (!option) {
2452
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2453
+ code: ZodError_js_1.ZodIssueCode.invalid_union_discriminator,
2454
+ options: Array.from(this.optionsMap.keys()),
2455
+ path: [discriminator],
2456
+ });
2457
+ return parseUtil_js_1.INVALID;
2458
+ }
2459
+ if (ctx.common.async) {
2460
+ return option._parseAsync({
2461
+ data: ctx.data,
2462
+ path: ctx.path,
2463
+ parent: ctx,
2464
+ });
2465
+ }
2466
+ else {
2467
+ return option._parseSync({
2468
+ data: ctx.data,
2469
+ path: ctx.path,
2470
+ parent: ctx,
2471
+ });
2472
+ }
2473
+ }
2474
+ get discriminator() {
2475
+ return this._def.discriminator;
2476
+ }
2477
+ get options() {
2478
+ return this._def.options;
2479
+ }
2480
+ get optionsMap() {
2481
+ return this._def.optionsMap;
2482
+ }
2483
+ /**
2484
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2485
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2486
+ * have a different value for each object in the union.
2487
+ * @param discriminator the name of the discriminator property
2488
+ * @param types an array of object schemas
2489
+ * @param params
2490
+ */
2491
+ static create(discriminator, options, params) {
2492
+ // Get all the valid discriminator values
2493
+ const optionsMap = new Map();
2494
+ // try {
2495
+ for (const type of options) {
2496
+ const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2497
+ if (!discriminatorValues.length) {
2498
+ throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
2499
+ }
2500
+ for (const value of discriminatorValues) {
2501
+ if (optionsMap.has(value)) {
2502
+ throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
2503
+ }
2504
+ optionsMap.set(value, type);
2505
+ }
2506
+ }
2507
+ return new ZodDiscriminatedUnion({
2508
+ typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
2509
+ discriminator,
2510
+ options,
2511
+ optionsMap,
2512
+ ...processCreateParams(params),
2513
+ });
2514
+ }
2515
+ }
2516
+ exports.ZodDiscriminatedUnion = ZodDiscriminatedUnion;
2517
+ function mergeValues(a, b) {
2518
+ const aType = (0, util_js_1.getParsedType)(a);
2519
+ const bType = (0, util_js_1.getParsedType)(b);
2520
+ if (a === b) {
2521
+ return { valid: true, data: a };
2522
+ }
2523
+ else if (aType === util_js_1.ZodParsedType.object && bType === util_js_1.ZodParsedType.object) {
2524
+ const bKeys = util_js_1.util.objectKeys(b);
2525
+ const sharedKeys = util_js_1.util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
2526
+ const newObj = { ...a, ...b };
2527
+ for (const key of sharedKeys) {
2528
+ const sharedValue = mergeValues(a[key], b[key]);
2529
+ if (!sharedValue.valid) {
2530
+ return { valid: false };
2531
+ }
2532
+ newObj[key] = sharedValue.data;
2533
+ }
2534
+ return { valid: true, data: newObj };
2535
+ }
2536
+ else if (aType === util_js_1.ZodParsedType.array && bType === util_js_1.ZodParsedType.array) {
2537
+ if (a.length !== b.length) {
2538
+ return { valid: false };
2539
+ }
2540
+ const newArray = [];
2541
+ for (let index = 0; index < a.length; index++) {
2542
+ const itemA = a[index];
2543
+ const itemB = b[index];
2544
+ const sharedValue = mergeValues(itemA, itemB);
2545
+ if (!sharedValue.valid) {
2546
+ return { valid: false };
2547
+ }
2548
+ newArray.push(sharedValue.data);
2549
+ }
2550
+ return { valid: true, data: newArray };
2551
+ }
2552
+ else if (aType === util_js_1.ZodParsedType.date && bType === util_js_1.ZodParsedType.date && +a === +b) {
2553
+ return { valid: true, data: a };
2554
+ }
2555
+ else {
2556
+ return { valid: false };
2557
+ }
2558
+ }
2559
+ class ZodIntersection extends ZodType {
2560
+ _parse(input) {
2561
+ const { status, ctx } = this._processInputParams(input);
2562
+ const handleParsed = (parsedLeft, parsedRight) => {
2563
+ if ((0, parseUtil_js_1.isAborted)(parsedLeft) || (0, parseUtil_js_1.isAborted)(parsedRight)) {
2564
+ return parseUtil_js_1.INVALID;
2565
+ }
2566
+ const merged = mergeValues(parsedLeft.value, parsedRight.value);
2567
+ if (!merged.valid) {
2568
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2569
+ code: ZodError_js_1.ZodIssueCode.invalid_intersection_types,
2570
+ });
2571
+ return parseUtil_js_1.INVALID;
2572
+ }
2573
+ if ((0, parseUtil_js_1.isDirty)(parsedLeft) || (0, parseUtil_js_1.isDirty)(parsedRight)) {
2574
+ status.dirty();
2575
+ }
2576
+ return { status: status.value, value: merged.data };
2577
+ };
2578
+ if (ctx.common.async) {
2579
+ return Promise.all([
2580
+ this._def.left._parseAsync({
2581
+ data: ctx.data,
2582
+ path: ctx.path,
2583
+ parent: ctx,
2584
+ }),
2585
+ this._def.right._parseAsync({
2586
+ data: ctx.data,
2587
+ path: ctx.path,
2588
+ parent: ctx,
2589
+ }),
2590
+ ]).then(([left, right]) => handleParsed(left, right));
2591
+ }
2592
+ else {
2593
+ return handleParsed(this._def.left._parseSync({
2594
+ data: ctx.data,
2595
+ path: ctx.path,
2596
+ parent: ctx,
2597
+ }), this._def.right._parseSync({
2598
+ data: ctx.data,
2599
+ path: ctx.path,
2600
+ parent: ctx,
2601
+ }));
2602
+ }
2603
+ }
2604
+ }
2605
+ exports.ZodIntersection = ZodIntersection;
2606
+ ZodIntersection.create = (left, right, params) => {
2607
+ return new ZodIntersection({
2608
+ left: left,
2609
+ right: right,
2610
+ typeName: ZodFirstPartyTypeKind.ZodIntersection,
2611
+ ...processCreateParams(params),
2612
+ });
2613
+ };
2614
+ // type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
2615
+ class ZodTuple extends ZodType {
2616
+ _parse(input) {
2617
+ const { status, ctx } = this._processInputParams(input);
2618
+ if (ctx.parsedType !== util_js_1.ZodParsedType.array) {
2619
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2620
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2621
+ expected: util_js_1.ZodParsedType.array,
2622
+ received: ctx.parsedType,
2623
+ });
2624
+ return parseUtil_js_1.INVALID;
2625
+ }
2626
+ if (ctx.data.length < this._def.items.length) {
2627
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2628
+ code: ZodError_js_1.ZodIssueCode.too_small,
2629
+ minimum: this._def.items.length,
2630
+ inclusive: true,
2631
+ exact: false,
2632
+ type: "array",
2633
+ });
2634
+ return parseUtil_js_1.INVALID;
2635
+ }
2636
+ const rest = this._def.rest;
2637
+ if (!rest && ctx.data.length > this._def.items.length) {
2638
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2639
+ code: ZodError_js_1.ZodIssueCode.too_big,
2640
+ maximum: this._def.items.length,
2641
+ inclusive: true,
2642
+ exact: false,
2643
+ type: "array",
2644
+ });
2645
+ status.dirty();
2646
+ }
2647
+ const items = [...ctx.data]
2648
+ .map((item, itemIndex) => {
2649
+ const schema = this._def.items[itemIndex] || this._def.rest;
2650
+ if (!schema)
2651
+ return null;
2652
+ return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
2653
+ })
2654
+ .filter((x) => !!x); // filter nulls
2655
+ if (ctx.common.async) {
2656
+ return Promise.all(items).then((results) => {
2657
+ return parseUtil_js_1.ParseStatus.mergeArray(status, results);
2658
+ });
2659
+ }
2660
+ else {
2661
+ return parseUtil_js_1.ParseStatus.mergeArray(status, items);
2662
+ }
2663
+ }
2664
+ get items() {
2665
+ return this._def.items;
2666
+ }
2667
+ rest(rest) {
2668
+ return new ZodTuple({
2669
+ ...this._def,
2670
+ rest,
2671
+ });
2672
+ }
2673
+ }
2674
+ exports.ZodTuple = ZodTuple;
2675
+ ZodTuple.create = (schemas, params) => {
2676
+ if (!Array.isArray(schemas)) {
2677
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2678
+ }
2679
+ return new ZodTuple({
2680
+ items: schemas,
2681
+ typeName: ZodFirstPartyTypeKind.ZodTuple,
2682
+ rest: null,
2683
+ ...processCreateParams(params),
2684
+ });
2685
+ };
2686
+ class ZodRecord extends ZodType {
2687
+ get keySchema() {
2688
+ return this._def.keyType;
2689
+ }
2690
+ get valueSchema() {
2691
+ return this._def.valueType;
2692
+ }
2693
+ _parse(input) {
2694
+ const { status, ctx } = this._processInputParams(input);
2695
+ if (ctx.parsedType !== util_js_1.ZodParsedType.object) {
2696
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2697
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2698
+ expected: util_js_1.ZodParsedType.object,
2699
+ received: ctx.parsedType,
2700
+ });
2701
+ return parseUtil_js_1.INVALID;
2702
+ }
2703
+ const pairs = [];
2704
+ const keyType = this._def.keyType;
2705
+ const valueType = this._def.valueType;
2706
+ for (const key in ctx.data) {
2707
+ pairs.push({
2708
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
2709
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
2710
+ alwaysSet: key in ctx.data,
2711
+ });
2712
+ }
2713
+ if (ctx.common.async) {
2714
+ return parseUtil_js_1.ParseStatus.mergeObjectAsync(status, pairs);
2715
+ }
2716
+ else {
2717
+ return parseUtil_js_1.ParseStatus.mergeObjectSync(status, pairs);
2718
+ }
2719
+ }
2720
+ get element() {
2721
+ return this._def.valueType;
2722
+ }
2723
+ static create(first, second, third) {
2724
+ if (second instanceof ZodType) {
2725
+ return new ZodRecord({
2726
+ keyType: first,
2727
+ valueType: second,
2728
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
2729
+ ...processCreateParams(third),
2730
+ });
2731
+ }
2732
+ return new ZodRecord({
2733
+ keyType: ZodString.create(),
2734
+ valueType: first,
2735
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
2736
+ ...processCreateParams(second),
2737
+ });
2738
+ }
2739
+ }
2740
+ exports.ZodRecord = ZodRecord;
2741
+ class ZodMap extends ZodType {
2742
+ get keySchema() {
2743
+ return this._def.keyType;
2744
+ }
2745
+ get valueSchema() {
2746
+ return this._def.valueType;
2747
+ }
2748
+ _parse(input) {
2749
+ const { status, ctx } = this._processInputParams(input);
2750
+ if (ctx.parsedType !== util_js_1.ZodParsedType.map) {
2751
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2752
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2753
+ expected: util_js_1.ZodParsedType.map,
2754
+ received: ctx.parsedType,
2755
+ });
2756
+ return parseUtil_js_1.INVALID;
2757
+ }
2758
+ const keyType = this._def.keyType;
2759
+ const valueType = this._def.valueType;
2760
+ const pairs = [...ctx.data.entries()].map(([key, value], index) => {
2761
+ return {
2762
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
2763
+ value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"])),
2764
+ };
2765
+ });
2766
+ if (ctx.common.async) {
2767
+ const finalMap = new Map();
2768
+ return Promise.resolve().then(async () => {
2769
+ for (const pair of pairs) {
2770
+ const key = await pair.key;
2771
+ const value = await pair.value;
2772
+ if (key.status === "aborted" || value.status === "aborted") {
2773
+ return parseUtil_js_1.INVALID;
2774
+ }
2775
+ if (key.status === "dirty" || value.status === "dirty") {
2776
+ status.dirty();
2777
+ }
2778
+ finalMap.set(key.value, value.value);
2779
+ }
2780
+ return { status: status.value, value: finalMap };
2781
+ });
2782
+ }
2783
+ else {
2784
+ const finalMap = new Map();
2785
+ for (const pair of pairs) {
2786
+ const key = pair.key;
2787
+ const value = pair.value;
2788
+ if (key.status === "aborted" || value.status === "aborted") {
2789
+ return parseUtil_js_1.INVALID;
2790
+ }
2791
+ if (key.status === "dirty" || value.status === "dirty") {
2792
+ status.dirty();
2793
+ }
2794
+ finalMap.set(key.value, value.value);
2795
+ }
2796
+ return { status: status.value, value: finalMap };
2797
+ }
2798
+ }
2799
+ }
2800
+ exports.ZodMap = ZodMap;
2801
+ ZodMap.create = (keyType, valueType, params) => {
2802
+ return new ZodMap({
2803
+ valueType,
2804
+ keyType,
2805
+ typeName: ZodFirstPartyTypeKind.ZodMap,
2806
+ ...processCreateParams(params),
2807
+ });
2808
+ };
2809
+ class ZodSet extends ZodType {
2810
+ _parse(input) {
2811
+ const { status, ctx } = this._processInputParams(input);
2812
+ if (ctx.parsedType !== util_js_1.ZodParsedType.set) {
2813
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2814
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2815
+ expected: util_js_1.ZodParsedType.set,
2816
+ received: ctx.parsedType,
2817
+ });
2818
+ return parseUtil_js_1.INVALID;
2819
+ }
2820
+ const def = this._def;
2821
+ if (def.minSize !== null) {
2822
+ if (ctx.data.size < def.minSize.value) {
2823
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2824
+ code: ZodError_js_1.ZodIssueCode.too_small,
2825
+ minimum: def.minSize.value,
2826
+ type: "set",
2827
+ inclusive: true,
2828
+ exact: false,
2829
+ message: def.minSize.message,
2830
+ });
2831
+ status.dirty();
2832
+ }
2833
+ }
2834
+ if (def.maxSize !== null) {
2835
+ if (ctx.data.size > def.maxSize.value) {
2836
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2837
+ code: ZodError_js_1.ZodIssueCode.too_big,
2838
+ maximum: def.maxSize.value,
2839
+ type: "set",
2840
+ inclusive: true,
2841
+ exact: false,
2842
+ message: def.maxSize.message,
2843
+ });
2844
+ status.dirty();
2845
+ }
2846
+ }
2847
+ const valueType = this._def.valueType;
2848
+ function finalizeSet(elements) {
2849
+ const parsedSet = new Set();
2850
+ for (const element of elements) {
2851
+ if (element.status === "aborted")
2852
+ return parseUtil_js_1.INVALID;
2853
+ if (element.status === "dirty")
2854
+ status.dirty();
2855
+ parsedSet.add(element.value);
2856
+ }
2857
+ return { status: status.value, value: parsedSet };
2858
+ }
2859
+ const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
2860
+ if (ctx.common.async) {
2861
+ return Promise.all(elements).then((elements) => finalizeSet(elements));
2862
+ }
2863
+ else {
2864
+ return finalizeSet(elements);
2865
+ }
2866
+ }
2867
+ min(minSize, message) {
2868
+ return new ZodSet({
2869
+ ...this._def,
2870
+ minSize: { value: minSize, message: errorUtil_js_1.errorUtil.toString(message) },
2871
+ });
2872
+ }
2873
+ max(maxSize, message) {
2874
+ return new ZodSet({
2875
+ ...this._def,
2876
+ maxSize: { value: maxSize, message: errorUtil_js_1.errorUtil.toString(message) },
2877
+ });
2878
+ }
2879
+ size(size, message) {
2880
+ return this.min(size, message).max(size, message);
2881
+ }
2882
+ nonempty(message) {
2883
+ return this.min(1, message);
2884
+ }
2885
+ }
2886
+ exports.ZodSet = ZodSet;
2887
+ ZodSet.create = (valueType, params) => {
2888
+ return new ZodSet({
2889
+ valueType,
2890
+ minSize: null,
2891
+ maxSize: null,
2892
+ typeName: ZodFirstPartyTypeKind.ZodSet,
2893
+ ...processCreateParams(params),
2894
+ });
2895
+ };
2896
+ class ZodFunction extends ZodType {
2897
+ constructor() {
2898
+ super(...arguments);
2899
+ this.validate = this.implement;
2900
+ }
2901
+ _parse(input) {
2902
+ const { ctx } = this._processInputParams(input);
2903
+ if (ctx.parsedType !== util_js_1.ZodParsedType.function) {
2904
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2905
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2906
+ expected: util_js_1.ZodParsedType.function,
2907
+ received: ctx.parsedType,
2908
+ });
2909
+ return parseUtil_js_1.INVALID;
2910
+ }
2911
+ function makeArgsIssue(args, error) {
2912
+ return (0, parseUtil_js_1.makeIssue)({
2913
+ data: args,
2914
+ path: ctx.path,
2915
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, (0, errors_js_1.getErrorMap)(), errors_js_1.defaultErrorMap].filter((x) => !!x),
2916
+ issueData: {
2917
+ code: ZodError_js_1.ZodIssueCode.invalid_arguments,
2918
+ argumentsError: error,
2919
+ },
2920
+ });
2921
+ }
2922
+ function makeReturnsIssue(returns, error) {
2923
+ return (0, parseUtil_js_1.makeIssue)({
2924
+ data: returns,
2925
+ path: ctx.path,
2926
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, (0, errors_js_1.getErrorMap)(), errors_js_1.defaultErrorMap].filter((x) => !!x),
2927
+ issueData: {
2928
+ code: ZodError_js_1.ZodIssueCode.invalid_return_type,
2929
+ returnTypeError: error,
2930
+ },
2931
+ });
2932
+ }
2933
+ const params = { errorMap: ctx.common.contextualErrorMap };
2934
+ const fn = ctx.data;
2935
+ if (this._def.returns instanceof ZodPromise) {
2936
+ // Would love a way to avoid disabling this rule, but we need
2937
+ // an alias (using an arrow function was what caused 2651).
2938
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
2939
+ const me = this;
2940
+ return (0, parseUtil_js_1.OK)(async function (...args) {
2941
+ const error = new ZodError_js_1.ZodError([]);
2942
+ const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
2943
+ error.addIssue(makeArgsIssue(args, e));
2944
+ throw error;
2945
+ });
2946
+ const result = await Reflect.apply(fn, this, parsedArgs);
2947
+ const parsedReturns = await me._def.returns._def.type
2948
+ .parseAsync(result, params)
2949
+ .catch((e) => {
2950
+ error.addIssue(makeReturnsIssue(result, e));
2951
+ throw error;
2952
+ });
2953
+ return parsedReturns;
2954
+ });
2955
+ }
2956
+ else {
2957
+ // Would love a way to avoid disabling this rule, but we need
2958
+ // an alias (using an arrow function was what caused 2651).
2959
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
2960
+ const me = this;
2961
+ return (0, parseUtil_js_1.OK)(function (...args) {
2962
+ const parsedArgs = me._def.args.safeParse(args, params);
2963
+ if (!parsedArgs.success) {
2964
+ throw new ZodError_js_1.ZodError([makeArgsIssue(args, parsedArgs.error)]);
2965
+ }
2966
+ const result = Reflect.apply(fn, this, parsedArgs.data);
2967
+ const parsedReturns = me._def.returns.safeParse(result, params);
2968
+ if (!parsedReturns.success) {
2969
+ throw new ZodError_js_1.ZodError([makeReturnsIssue(result, parsedReturns.error)]);
2970
+ }
2971
+ return parsedReturns.data;
2972
+ });
2973
+ }
2974
+ }
2975
+ parameters() {
2976
+ return this._def.args;
2977
+ }
2978
+ returnType() {
2979
+ return this._def.returns;
2980
+ }
2981
+ args(...items) {
2982
+ return new ZodFunction({
2983
+ ...this._def,
2984
+ args: ZodTuple.create(items).rest(ZodUnknown.create()),
2985
+ });
2986
+ }
2987
+ returns(returnType) {
2988
+ return new ZodFunction({
2989
+ ...this._def,
2990
+ returns: returnType,
2991
+ });
2992
+ }
2993
+ implement(func) {
2994
+ const validatedFunc = this.parse(func);
2995
+ return validatedFunc;
2996
+ }
2997
+ strictImplement(func) {
2998
+ const validatedFunc = this.parse(func);
2999
+ return validatedFunc;
3000
+ }
3001
+ static create(args, returns, params) {
3002
+ return new ZodFunction({
3003
+ args: (args ? args : ZodTuple.create([]).rest(ZodUnknown.create())),
3004
+ returns: returns || ZodUnknown.create(),
3005
+ typeName: ZodFirstPartyTypeKind.ZodFunction,
3006
+ ...processCreateParams(params),
3007
+ });
3008
+ }
3009
+ }
3010
+ exports.ZodFunction = ZodFunction;
3011
+ class ZodLazy extends ZodType {
3012
+ get schema() {
3013
+ return this._def.getter();
3014
+ }
3015
+ _parse(input) {
3016
+ const { ctx } = this._processInputParams(input);
3017
+ const lazySchema = this._def.getter();
3018
+ return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
3019
+ }
3020
+ }
3021
+ exports.ZodLazy = ZodLazy;
3022
+ ZodLazy.create = (getter, params) => {
3023
+ return new ZodLazy({
3024
+ getter: getter,
3025
+ typeName: ZodFirstPartyTypeKind.ZodLazy,
3026
+ ...processCreateParams(params),
3027
+ });
3028
+ };
3029
+ class ZodLiteral extends ZodType {
3030
+ _parse(input) {
3031
+ if (input.data !== this._def.value) {
3032
+ const ctx = this._getOrReturnCtx(input);
3033
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3034
+ received: ctx.data,
3035
+ code: ZodError_js_1.ZodIssueCode.invalid_literal,
3036
+ expected: this._def.value,
3037
+ });
3038
+ return parseUtil_js_1.INVALID;
3039
+ }
3040
+ return { status: "valid", value: input.data };
3041
+ }
3042
+ get value() {
3043
+ return this._def.value;
3044
+ }
3045
+ }
3046
+ exports.ZodLiteral = ZodLiteral;
3047
+ ZodLiteral.create = (value, params) => {
3048
+ return new ZodLiteral({
3049
+ value: value,
3050
+ typeName: ZodFirstPartyTypeKind.ZodLiteral,
3051
+ ...processCreateParams(params),
3052
+ });
3053
+ };
3054
+ function createZodEnum(values, params) {
3055
+ return new ZodEnum({
3056
+ values,
3057
+ typeName: ZodFirstPartyTypeKind.ZodEnum,
3058
+ ...processCreateParams(params),
3059
+ });
3060
+ }
3061
+ class ZodEnum extends ZodType {
3062
+ _parse(input) {
3063
+ if (typeof input.data !== "string") {
3064
+ const ctx = this._getOrReturnCtx(input);
3065
+ const expectedValues = this._def.values;
3066
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3067
+ expected: util_js_1.util.joinValues(expectedValues),
3068
+ received: ctx.parsedType,
3069
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3070
+ });
3071
+ return parseUtil_js_1.INVALID;
3072
+ }
3073
+ if (!this._cache) {
3074
+ this._cache = new Set(this._def.values);
3075
+ }
3076
+ if (!this._cache.has(input.data)) {
3077
+ const ctx = this._getOrReturnCtx(input);
3078
+ const expectedValues = this._def.values;
3079
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3080
+ received: ctx.data,
3081
+ code: ZodError_js_1.ZodIssueCode.invalid_enum_value,
3082
+ options: expectedValues,
3083
+ });
3084
+ return parseUtil_js_1.INVALID;
3085
+ }
3086
+ return (0, parseUtil_js_1.OK)(input.data);
3087
+ }
3088
+ get options() {
3089
+ return this._def.values;
3090
+ }
3091
+ get enum() {
3092
+ const enumValues = {};
3093
+ for (const val of this._def.values) {
3094
+ enumValues[val] = val;
3095
+ }
3096
+ return enumValues;
3097
+ }
3098
+ get Values() {
3099
+ const enumValues = {};
3100
+ for (const val of this._def.values) {
3101
+ enumValues[val] = val;
3102
+ }
3103
+ return enumValues;
3104
+ }
3105
+ get Enum() {
3106
+ const enumValues = {};
3107
+ for (const val of this._def.values) {
3108
+ enumValues[val] = val;
3109
+ }
3110
+ return enumValues;
3111
+ }
3112
+ extract(values, newDef = this._def) {
3113
+ return ZodEnum.create(values, {
3114
+ ...this._def,
3115
+ ...newDef,
3116
+ });
3117
+ }
3118
+ exclude(values, newDef = this._def) {
3119
+ return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
3120
+ ...this._def,
3121
+ ...newDef,
3122
+ });
3123
+ }
3124
+ }
3125
+ exports.ZodEnum = ZodEnum;
3126
+ ZodEnum.create = createZodEnum;
3127
+ class ZodNativeEnum extends ZodType {
3128
+ _parse(input) {
3129
+ const nativeEnumValues = util_js_1.util.getValidEnumValues(this._def.values);
3130
+ const ctx = this._getOrReturnCtx(input);
3131
+ if (ctx.parsedType !== util_js_1.ZodParsedType.string && ctx.parsedType !== util_js_1.ZodParsedType.number) {
3132
+ const expectedValues = util_js_1.util.objectValues(nativeEnumValues);
3133
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3134
+ expected: util_js_1.util.joinValues(expectedValues),
3135
+ received: ctx.parsedType,
3136
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3137
+ });
3138
+ return parseUtil_js_1.INVALID;
3139
+ }
3140
+ if (!this._cache) {
3141
+ this._cache = new Set(util_js_1.util.getValidEnumValues(this._def.values));
3142
+ }
3143
+ if (!this._cache.has(input.data)) {
3144
+ const expectedValues = util_js_1.util.objectValues(nativeEnumValues);
3145
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3146
+ received: ctx.data,
3147
+ code: ZodError_js_1.ZodIssueCode.invalid_enum_value,
3148
+ options: expectedValues,
3149
+ });
3150
+ return parseUtil_js_1.INVALID;
3151
+ }
3152
+ return (0, parseUtil_js_1.OK)(input.data);
3153
+ }
3154
+ get enum() {
3155
+ return this._def.values;
3156
+ }
3157
+ }
3158
+ exports.ZodNativeEnum = ZodNativeEnum;
3159
+ ZodNativeEnum.create = (values, params) => {
3160
+ return new ZodNativeEnum({
3161
+ values: values,
3162
+ typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
3163
+ ...processCreateParams(params),
3164
+ });
3165
+ };
3166
+ class ZodPromise extends ZodType {
3167
+ unwrap() {
3168
+ return this._def.type;
3169
+ }
3170
+ _parse(input) {
3171
+ const { ctx } = this._processInputParams(input);
3172
+ if (ctx.parsedType !== util_js_1.ZodParsedType.promise && ctx.common.async === false) {
3173
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3174
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3175
+ expected: util_js_1.ZodParsedType.promise,
3176
+ received: ctx.parsedType,
3177
+ });
3178
+ return parseUtil_js_1.INVALID;
3179
+ }
3180
+ const promisified = ctx.parsedType === util_js_1.ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
3181
+ return (0, parseUtil_js_1.OK)(promisified.then((data) => {
3182
+ return this._def.type.parseAsync(data, {
3183
+ path: ctx.path,
3184
+ errorMap: ctx.common.contextualErrorMap,
3185
+ });
3186
+ }));
3187
+ }
3188
+ }
3189
+ exports.ZodPromise = ZodPromise;
3190
+ ZodPromise.create = (schema, params) => {
3191
+ return new ZodPromise({
3192
+ type: schema,
3193
+ typeName: ZodFirstPartyTypeKind.ZodPromise,
3194
+ ...processCreateParams(params),
3195
+ });
3196
+ };
3197
+ class ZodEffects extends ZodType {
3198
+ innerType() {
3199
+ return this._def.schema;
3200
+ }
3201
+ sourceType() {
3202
+ return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects
3203
+ ? this._def.schema.sourceType()
3204
+ : this._def.schema;
3205
+ }
3206
+ _parse(input) {
3207
+ const { status, ctx } = this._processInputParams(input);
3208
+ const effect = this._def.effect || null;
3209
+ const checkCtx = {
3210
+ addIssue: (arg) => {
3211
+ (0, parseUtil_js_1.addIssueToContext)(ctx, arg);
3212
+ if (arg.fatal) {
3213
+ status.abort();
3214
+ }
3215
+ else {
3216
+ status.dirty();
3217
+ }
3218
+ },
3219
+ get path() {
3220
+ return ctx.path;
3221
+ },
3222
+ };
3223
+ checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3224
+ if (effect.type === "preprocess") {
3225
+ const processed = effect.transform(ctx.data, checkCtx);
3226
+ if (ctx.common.async) {
3227
+ return Promise.resolve(processed).then(async (processed) => {
3228
+ if (status.value === "aborted")
3229
+ return parseUtil_js_1.INVALID;
3230
+ const result = await this._def.schema._parseAsync({
3231
+ data: processed,
3232
+ path: ctx.path,
3233
+ parent: ctx,
3234
+ });
3235
+ if (result.status === "aborted")
3236
+ return parseUtil_js_1.INVALID;
3237
+ if (result.status === "dirty")
3238
+ return (0, parseUtil_js_1.DIRTY)(result.value);
3239
+ if (status.value === "dirty")
3240
+ return (0, parseUtil_js_1.DIRTY)(result.value);
3241
+ return result;
3242
+ });
3243
+ }
3244
+ else {
3245
+ if (status.value === "aborted")
3246
+ return parseUtil_js_1.INVALID;
3247
+ const result = this._def.schema._parseSync({
3248
+ data: processed,
3249
+ path: ctx.path,
3250
+ parent: ctx,
3251
+ });
3252
+ if (result.status === "aborted")
3253
+ return parseUtil_js_1.INVALID;
3254
+ if (result.status === "dirty")
3255
+ return (0, parseUtil_js_1.DIRTY)(result.value);
3256
+ if (status.value === "dirty")
3257
+ return (0, parseUtil_js_1.DIRTY)(result.value);
3258
+ return result;
3259
+ }
3260
+ }
3261
+ if (effect.type === "refinement") {
3262
+ const executeRefinement = (acc) => {
3263
+ const result = effect.refinement(acc, checkCtx);
3264
+ if (ctx.common.async) {
3265
+ return Promise.resolve(result);
3266
+ }
3267
+ if (result instanceof Promise) {
3268
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
3269
+ }
3270
+ return acc;
3271
+ };
3272
+ if (ctx.common.async === false) {
3273
+ const inner = this._def.schema._parseSync({
3274
+ data: ctx.data,
3275
+ path: ctx.path,
3276
+ parent: ctx,
3277
+ });
3278
+ if (inner.status === "aborted")
3279
+ return parseUtil_js_1.INVALID;
3280
+ if (inner.status === "dirty")
3281
+ status.dirty();
3282
+ // return value is ignored
3283
+ executeRefinement(inner.value);
3284
+ return { status: status.value, value: inner.value };
3285
+ }
3286
+ else {
3287
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
3288
+ if (inner.status === "aborted")
3289
+ return parseUtil_js_1.INVALID;
3290
+ if (inner.status === "dirty")
3291
+ status.dirty();
3292
+ return executeRefinement(inner.value).then(() => {
3293
+ return { status: status.value, value: inner.value };
3294
+ });
3295
+ });
3296
+ }
3297
+ }
3298
+ if (effect.type === "transform") {
3299
+ if (ctx.common.async === false) {
3300
+ const base = this._def.schema._parseSync({
3301
+ data: ctx.data,
3302
+ path: ctx.path,
3303
+ parent: ctx,
3304
+ });
3305
+ if (!(0, parseUtil_js_1.isValid)(base))
3306
+ return parseUtil_js_1.INVALID;
3307
+ const result = effect.transform(base.value, checkCtx);
3308
+ if (result instanceof Promise) {
3309
+ throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
3310
+ }
3311
+ return { status: status.value, value: result };
3312
+ }
3313
+ else {
3314
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
3315
+ if (!(0, parseUtil_js_1.isValid)(base))
3316
+ return parseUtil_js_1.INVALID;
3317
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
3318
+ status: status.value,
3319
+ value: result,
3320
+ }));
3321
+ });
3322
+ }
3323
+ }
3324
+ util_js_1.util.assertNever(effect);
3325
+ }
3326
+ }
3327
+ exports.ZodEffects = ZodEffects;
3328
+ exports.ZodTransformer = ZodEffects;
3329
+ ZodEffects.create = (schema, effect, params) => {
3330
+ return new ZodEffects({
3331
+ schema,
3332
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
3333
+ effect,
3334
+ ...processCreateParams(params),
3335
+ });
3336
+ };
3337
+ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
3338
+ return new ZodEffects({
3339
+ schema,
3340
+ effect: { type: "preprocess", transform: preprocess },
3341
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
3342
+ ...processCreateParams(params),
3343
+ });
3344
+ };
3345
+ class ZodOptional extends ZodType {
3346
+ _parse(input) {
3347
+ const parsedType = this._getType(input);
3348
+ if (parsedType === util_js_1.ZodParsedType.undefined) {
3349
+ return (0, parseUtil_js_1.OK)(undefined);
3350
+ }
3351
+ return this._def.innerType._parse(input);
3352
+ }
3353
+ unwrap() {
3354
+ return this._def.innerType;
3355
+ }
3356
+ }
3357
+ exports.ZodOptional = ZodOptional;
3358
+ ZodOptional.create = (type, params) => {
3359
+ return new ZodOptional({
3360
+ innerType: type,
3361
+ typeName: ZodFirstPartyTypeKind.ZodOptional,
3362
+ ...processCreateParams(params),
3363
+ });
3364
+ };
3365
+ class ZodNullable extends ZodType {
3366
+ _parse(input) {
3367
+ const parsedType = this._getType(input);
3368
+ if (parsedType === util_js_1.ZodParsedType.null) {
3369
+ return (0, parseUtil_js_1.OK)(null);
3370
+ }
3371
+ return this._def.innerType._parse(input);
3372
+ }
3373
+ unwrap() {
3374
+ return this._def.innerType;
3375
+ }
3376
+ }
3377
+ exports.ZodNullable = ZodNullable;
3378
+ ZodNullable.create = (type, params) => {
3379
+ return new ZodNullable({
3380
+ innerType: type,
3381
+ typeName: ZodFirstPartyTypeKind.ZodNullable,
3382
+ ...processCreateParams(params),
3383
+ });
3384
+ };
3385
+ class ZodDefault extends ZodType {
3386
+ _parse(input) {
3387
+ const { ctx } = this._processInputParams(input);
3388
+ let data = ctx.data;
3389
+ if (ctx.parsedType === util_js_1.ZodParsedType.undefined) {
3390
+ data = this._def.defaultValue();
3391
+ }
3392
+ return this._def.innerType._parse({
3393
+ data,
3394
+ path: ctx.path,
3395
+ parent: ctx,
3396
+ });
3397
+ }
3398
+ removeDefault() {
3399
+ return this._def.innerType;
3400
+ }
3401
+ }
3402
+ exports.ZodDefault = ZodDefault;
3403
+ ZodDefault.create = (type, params) => {
3404
+ return new ZodDefault({
3405
+ innerType: type,
3406
+ typeName: ZodFirstPartyTypeKind.ZodDefault,
3407
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
3408
+ ...processCreateParams(params),
3409
+ });
3410
+ };
3411
+ class ZodCatch extends ZodType {
3412
+ _parse(input) {
3413
+ const { ctx } = this._processInputParams(input);
3414
+ // newCtx is used to not collect issues from inner types in ctx
3415
+ const newCtx = {
3416
+ ...ctx,
3417
+ common: {
3418
+ ...ctx.common,
3419
+ issues: [],
3420
+ },
3421
+ };
3422
+ const result = this._def.innerType._parse({
3423
+ data: newCtx.data,
3424
+ path: newCtx.path,
3425
+ parent: {
3426
+ ...newCtx,
3427
+ },
3428
+ });
3429
+ if ((0, parseUtil_js_1.isAsync)(result)) {
3430
+ return result.then((result) => {
3431
+ return {
3432
+ status: "valid",
3433
+ value: result.status === "valid"
3434
+ ? result.value
3435
+ : this._def.catchValue({
3436
+ get error() {
3437
+ return new ZodError_js_1.ZodError(newCtx.common.issues);
3438
+ },
3439
+ input: newCtx.data,
3440
+ }),
3441
+ };
3442
+ });
3443
+ }
3444
+ else {
3445
+ return {
3446
+ status: "valid",
3447
+ value: result.status === "valid"
3448
+ ? result.value
3449
+ : this._def.catchValue({
3450
+ get error() {
3451
+ return new ZodError_js_1.ZodError(newCtx.common.issues);
3452
+ },
3453
+ input: newCtx.data,
3454
+ }),
3455
+ };
3456
+ }
3457
+ }
3458
+ removeCatch() {
3459
+ return this._def.innerType;
3460
+ }
3461
+ }
3462
+ exports.ZodCatch = ZodCatch;
3463
+ ZodCatch.create = (type, params) => {
3464
+ return new ZodCatch({
3465
+ innerType: type,
3466
+ typeName: ZodFirstPartyTypeKind.ZodCatch,
3467
+ catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
3468
+ ...processCreateParams(params),
3469
+ });
3470
+ };
3471
+ class ZodNaN extends ZodType {
3472
+ _parse(input) {
3473
+ const parsedType = this._getType(input);
3474
+ if (parsedType !== util_js_1.ZodParsedType.nan) {
3475
+ const ctx = this._getOrReturnCtx(input);
3476
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3477
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3478
+ expected: util_js_1.ZodParsedType.nan,
3479
+ received: ctx.parsedType,
3480
+ });
3481
+ return parseUtil_js_1.INVALID;
3482
+ }
3483
+ return { status: "valid", value: input.data };
3484
+ }
3485
+ }
3486
+ exports.ZodNaN = ZodNaN;
3487
+ ZodNaN.create = (params) => {
3488
+ return new ZodNaN({
3489
+ typeName: ZodFirstPartyTypeKind.ZodNaN,
3490
+ ...processCreateParams(params),
3491
+ });
3492
+ };
3493
+ exports.BRAND = Symbol("zod_brand");
3494
+ class ZodBranded extends ZodType {
3495
+ _parse(input) {
3496
+ const { ctx } = this._processInputParams(input);
3497
+ const data = ctx.data;
3498
+ return this._def.type._parse({
3499
+ data,
3500
+ path: ctx.path,
3501
+ parent: ctx,
3502
+ });
3503
+ }
3504
+ unwrap() {
3505
+ return this._def.type;
3506
+ }
3507
+ }
3508
+ exports.ZodBranded = ZodBranded;
3509
+ class ZodPipeline extends ZodType {
3510
+ _parse(input) {
3511
+ const { status, ctx } = this._processInputParams(input);
3512
+ if (ctx.common.async) {
3513
+ const handleAsync = async () => {
3514
+ const inResult = await this._def.in._parseAsync({
3515
+ data: ctx.data,
3516
+ path: ctx.path,
3517
+ parent: ctx,
3518
+ });
3519
+ if (inResult.status === "aborted")
3520
+ return parseUtil_js_1.INVALID;
3521
+ if (inResult.status === "dirty") {
3522
+ status.dirty();
3523
+ return (0, parseUtil_js_1.DIRTY)(inResult.value);
3524
+ }
3525
+ else {
3526
+ return this._def.out._parseAsync({
3527
+ data: inResult.value,
3528
+ path: ctx.path,
3529
+ parent: ctx,
3530
+ });
3531
+ }
3532
+ };
3533
+ return handleAsync();
3534
+ }
3535
+ else {
3536
+ const inResult = this._def.in._parseSync({
3537
+ data: ctx.data,
3538
+ path: ctx.path,
3539
+ parent: ctx,
3540
+ });
3541
+ if (inResult.status === "aborted")
3542
+ return parseUtil_js_1.INVALID;
3543
+ if (inResult.status === "dirty") {
3544
+ status.dirty();
3545
+ return {
3546
+ status: "dirty",
3547
+ value: inResult.value,
3548
+ };
3549
+ }
3550
+ else {
3551
+ return this._def.out._parseSync({
3552
+ data: inResult.value,
3553
+ path: ctx.path,
3554
+ parent: ctx,
3555
+ });
3556
+ }
3557
+ }
3558
+ }
3559
+ static create(a, b) {
3560
+ return new ZodPipeline({
3561
+ in: a,
3562
+ out: b,
3563
+ typeName: ZodFirstPartyTypeKind.ZodPipeline,
3564
+ });
3565
+ }
3566
+ }
3567
+ exports.ZodPipeline = ZodPipeline;
3568
+ class ZodReadonly extends ZodType {
3569
+ _parse(input) {
3570
+ const result = this._def.innerType._parse(input);
3571
+ const freeze = (data) => {
3572
+ if ((0, parseUtil_js_1.isValid)(data)) {
3573
+ data.value = Object.freeze(data.value);
3574
+ }
3575
+ return data;
3576
+ };
3577
+ return (0, parseUtil_js_1.isAsync)(result) ? result.then((data) => freeze(data)) : freeze(result);
3578
+ }
3579
+ unwrap() {
3580
+ return this._def.innerType;
3581
+ }
3582
+ }
3583
+ exports.ZodReadonly = ZodReadonly;
3584
+ ZodReadonly.create = (type, params) => {
3585
+ return new ZodReadonly({
3586
+ innerType: type,
3587
+ typeName: ZodFirstPartyTypeKind.ZodReadonly,
3588
+ ...processCreateParams(params),
3589
+ });
3590
+ };
3591
+ ////////////////////////////////////////
3592
+ ////////////////////////////////////////
3593
+ ////////// //////////
3594
+ ////////// z.custom //////////
3595
+ ////////// //////////
3596
+ ////////////////////////////////////////
3597
+ ////////////////////////////////////////
3598
+ function cleanParams(params, data) {
3599
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3600
+ const p2 = typeof p === "string" ? { message: p } : p;
3601
+ return p2;
3602
+ }
3603
+ function custom(check, _params = {},
3604
+ /**
3605
+ * @deprecated
3606
+ *
3607
+ * Pass `fatal` into the params object instead:
3608
+ *
3609
+ * ```ts
3610
+ * z.string().custom((val) => val.length > 5, { fatal: false })
3611
+ * ```
3612
+ *
3613
+ */
3614
+ fatal) {
3615
+ if (check)
3616
+ return ZodAny.create().superRefine((data, ctx) => {
3617
+ const r = check(data);
3618
+ if (r instanceof Promise) {
3619
+ return r.then((r) => {
3620
+ if (!r) {
3621
+ const params = cleanParams(_params, data);
3622
+ const _fatal = params.fatal ?? fatal ?? true;
3623
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
3624
+ }
3625
+ });
3626
+ }
3627
+ if (!r) {
3628
+ const params = cleanParams(_params, data);
3629
+ const _fatal = params.fatal ?? fatal ?? true;
3630
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
3631
+ }
3632
+ return;
3633
+ });
3634
+ return ZodAny.create();
3635
+ }
3636
+ exports.late = {
3637
+ object: ZodObject.lazycreate,
3638
+ };
3639
+ var ZodFirstPartyTypeKind;
3640
+ (function (ZodFirstPartyTypeKind) {
3641
+ ZodFirstPartyTypeKind["ZodString"] = "ZodString";
3642
+ ZodFirstPartyTypeKind["ZodNumber"] = "ZodNumber";
3643
+ ZodFirstPartyTypeKind["ZodNaN"] = "ZodNaN";
3644
+ ZodFirstPartyTypeKind["ZodBigInt"] = "ZodBigInt";
3645
+ ZodFirstPartyTypeKind["ZodBoolean"] = "ZodBoolean";
3646
+ ZodFirstPartyTypeKind["ZodDate"] = "ZodDate";
3647
+ ZodFirstPartyTypeKind["ZodSymbol"] = "ZodSymbol";
3648
+ ZodFirstPartyTypeKind["ZodUndefined"] = "ZodUndefined";
3649
+ ZodFirstPartyTypeKind["ZodNull"] = "ZodNull";
3650
+ ZodFirstPartyTypeKind["ZodAny"] = "ZodAny";
3651
+ ZodFirstPartyTypeKind["ZodUnknown"] = "ZodUnknown";
3652
+ ZodFirstPartyTypeKind["ZodNever"] = "ZodNever";
3653
+ ZodFirstPartyTypeKind["ZodVoid"] = "ZodVoid";
3654
+ ZodFirstPartyTypeKind["ZodArray"] = "ZodArray";
3655
+ ZodFirstPartyTypeKind["ZodObject"] = "ZodObject";
3656
+ ZodFirstPartyTypeKind["ZodUnion"] = "ZodUnion";
3657
+ ZodFirstPartyTypeKind["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
3658
+ ZodFirstPartyTypeKind["ZodIntersection"] = "ZodIntersection";
3659
+ ZodFirstPartyTypeKind["ZodTuple"] = "ZodTuple";
3660
+ ZodFirstPartyTypeKind["ZodRecord"] = "ZodRecord";
3661
+ ZodFirstPartyTypeKind["ZodMap"] = "ZodMap";
3662
+ ZodFirstPartyTypeKind["ZodSet"] = "ZodSet";
3663
+ ZodFirstPartyTypeKind["ZodFunction"] = "ZodFunction";
3664
+ ZodFirstPartyTypeKind["ZodLazy"] = "ZodLazy";
3665
+ ZodFirstPartyTypeKind["ZodLiteral"] = "ZodLiteral";
3666
+ ZodFirstPartyTypeKind["ZodEnum"] = "ZodEnum";
3667
+ ZodFirstPartyTypeKind["ZodEffects"] = "ZodEffects";
3668
+ ZodFirstPartyTypeKind["ZodNativeEnum"] = "ZodNativeEnum";
3669
+ ZodFirstPartyTypeKind["ZodOptional"] = "ZodOptional";
3670
+ ZodFirstPartyTypeKind["ZodNullable"] = "ZodNullable";
3671
+ ZodFirstPartyTypeKind["ZodDefault"] = "ZodDefault";
3672
+ ZodFirstPartyTypeKind["ZodCatch"] = "ZodCatch";
3673
+ ZodFirstPartyTypeKind["ZodPromise"] = "ZodPromise";
3674
+ ZodFirstPartyTypeKind["ZodBranded"] = "ZodBranded";
3675
+ ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
3676
+ ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
3677
+ })(ZodFirstPartyTypeKind || (exports.ZodFirstPartyTypeKind = ZodFirstPartyTypeKind = {}));
3678
+ // requires TS 4.4+
3679
+ class Class {
3680
+ constructor(..._) { }
3681
+ }
3682
+ const instanceOfType = (
3683
+ // const instanceOfType = <T extends new (...args: any[]) => any>(
3684
+ cls, params = {
3685
+ message: `Input not instance of ${cls.name}`,
3686
+ }) => custom((data) => data instanceof cls, params);
3687
+ exports.instanceof = instanceOfType;
3688
+ const stringType = ZodString.create;
3689
+ exports.string = stringType;
3690
+ const numberType = ZodNumber.create;
3691
+ exports.number = numberType;
3692
+ const nanType = ZodNaN.create;
3693
+ exports.nan = nanType;
3694
+ const bigIntType = ZodBigInt.create;
3695
+ exports.bigint = bigIntType;
3696
+ const booleanType = ZodBoolean.create;
3697
+ exports.boolean = booleanType;
3698
+ const dateType = ZodDate.create;
3699
+ exports.date = dateType;
3700
+ const symbolType = ZodSymbol.create;
3701
+ exports.symbol = symbolType;
3702
+ const undefinedType = ZodUndefined.create;
3703
+ exports.undefined = undefinedType;
3704
+ const nullType = ZodNull.create;
3705
+ exports.null = nullType;
3706
+ const anyType = ZodAny.create;
3707
+ exports.any = anyType;
3708
+ const unknownType = ZodUnknown.create;
3709
+ exports.unknown = unknownType;
3710
+ const neverType = ZodNever.create;
3711
+ exports.never = neverType;
3712
+ const voidType = ZodVoid.create;
3713
+ exports.void = voidType;
3714
+ const arrayType = ZodArray.create;
3715
+ exports.array = arrayType;
3716
+ const objectType = ZodObject.create;
3717
+ exports.object = objectType;
3718
+ const strictObjectType = ZodObject.strictCreate;
3719
+ exports.strictObject = strictObjectType;
3720
+ const unionType = ZodUnion.create;
3721
+ exports.union = unionType;
3722
+ const discriminatedUnionType = ZodDiscriminatedUnion.create;
3723
+ exports.discriminatedUnion = discriminatedUnionType;
3724
+ const intersectionType = ZodIntersection.create;
3725
+ exports.intersection = intersectionType;
3726
+ const tupleType = ZodTuple.create;
3727
+ exports.tuple = tupleType;
3728
+ const recordType = ZodRecord.create;
3729
+ exports.record = recordType;
3730
+ const mapType = ZodMap.create;
3731
+ exports.map = mapType;
3732
+ const setType = ZodSet.create;
3733
+ exports.set = setType;
3734
+ const functionType = ZodFunction.create;
3735
+ exports.function = functionType;
3736
+ const lazyType = ZodLazy.create;
3737
+ exports.lazy = lazyType;
3738
+ const literalType = ZodLiteral.create;
3739
+ exports.literal = literalType;
3740
+ const enumType = ZodEnum.create;
3741
+ exports.enum = enumType;
3742
+ const nativeEnumType = ZodNativeEnum.create;
3743
+ exports.nativeEnum = nativeEnumType;
3744
+ const promiseType = ZodPromise.create;
3745
+ exports.promise = promiseType;
3746
+ const effectsType = ZodEffects.create;
3747
+ exports.effect = effectsType;
3748
+ exports.transformer = effectsType;
3749
+ const optionalType = ZodOptional.create;
3750
+ exports.optional = optionalType;
3751
+ const nullableType = ZodNullable.create;
3752
+ exports.nullable = nullableType;
3753
+ const preprocessType = ZodEffects.createWithPreprocess;
3754
+ exports.preprocess = preprocessType;
3755
+ const pipelineType = ZodPipeline.create;
3756
+ exports.pipeline = pipelineType;
3757
+ const ostring = () => stringType().optional();
3758
+ exports.ostring = ostring;
3759
+ const onumber = () => numberType().optional();
3760
+ exports.onumber = onumber;
3761
+ const oboolean = () => booleanType().optional();
3762
+ exports.oboolean = oboolean;
3763
+ exports.coerce = {
3764
+ string: ((arg) => ZodString.create({ ...arg, coerce: true })),
3765
+ number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
3766
+ boolean: ((arg) => ZodBoolean.create({
3767
+ ...arg,
3768
+ coerce: true,
3769
+ })),
3770
+ bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
3771
+ date: ((arg) => ZodDate.create({ ...arg, coerce: true })),
3772
+ };
3773
+ exports.NEVER = parseUtil_js_1.INVALID;