@supersoniks/concorde 3.2.1 → 3.2.3

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