tokentracker-cli 0.5.0 → 0.5.2

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 (1112) hide show
  1. package/README.md +3 -0
  2. package/dashboard/dist/app-icon.png +0 -0
  3. package/dashboard/dist/apple-touch-icon.png +0 -0
  4. package/dashboard/dist/assets/DashboardPage-ccDq1oTb.js +12 -0
  5. package/dashboard/dist/assets/LeaderboardPage-BvhBcafd.js +1 -0
  6. package/dashboard/dist/assets/LeaderboardProfilePage-B5Yw_BZM.js +1 -0
  7. package/dashboard/dist/assets/ThemeToggle-CQvh_d2Z.js +1 -0
  8. package/dashboard/dist/assets/leaderboard-columns-COq9DxPJ.js +1 -0
  9. package/dashboard/dist/assets/main-8JBJiGVQ.js +4759 -0
  10. package/dashboard/dist/assets/main-Cwn9_aQV.css +1 -0
  11. package/dashboard/dist/brand-logos/claude-code.svg +3 -0
  12. package/dashboard/dist/brand-logos/codex.svg +3 -0
  13. package/dashboard/dist/brand-logos/cursor.svg +3 -0
  14. package/dashboard/dist/brand-logos/gemini.svg +20 -0
  15. package/dashboard/dist/brand-logos/openclaw.svg +22 -0
  16. package/dashboard/dist/brand-logos/opencode.svg +3 -0
  17. package/dashboard/dist/dashboard-dark.png +0 -0
  18. package/dashboard/dist/favicon-16.png +0 -0
  19. package/dashboard/dist/favicon-32.png +0 -0
  20. package/dashboard/dist/favicon.ico +0 -0
  21. package/dashboard/dist/feed.xml +7 -7
  22. package/dashboard/dist/icon-192.png +0 -0
  23. package/dashboard/dist/icon-512.png +0 -0
  24. package/dashboard/dist/index.html +5 -5
  25. package/dashboard/dist/llms.txt +13 -13
  26. package/dashboard/dist/robots.txt +3 -3
  27. package/dashboard/dist/share.html +2 -2
  28. package/dashboard/dist/sitemap.xml +2 -2
  29. package/package.json +3 -12
  30. package/src/commands/init.js +8 -95
  31. package/src/commands/serve.js +1 -1
  32. package/src/commands/sync.js +106 -153
  33. package/src/lib/activation-check.js +21 -21
  34. package/src/lib/browser-auth.js +1 -1
  35. package/src/lib/doctor.js +0 -13
  36. package/src/lib/gemini-config.js +1 -1
  37. package/src/lib/local-api.js +94 -12
  38. package/src/lib/openclaw-hook.js +8 -8
  39. package/src/lib/openclaw-session-plugin.js +7 -7
  40. package/src/lib/opencode-config.js +1 -1
  41. package/src/lib/opencode-usage-audit.js +1 -1
  42. package/src/lib/rollout.js +9 -15
  43. package/src/lib/runtime-config.js +1 -11
  44. package/dashboard/dist/assets/DashboardPage-DdwohsIv.js +0 -20
  45. package/dashboard/dist/assets/main-BbLvM6ng.js +0 -2044
  46. package/dashboard/dist/assets/main-_qTSxSnU.css +0 -1
  47. package/dashboard/dist/icon.svg +0 -1
  48. package/dashboard/dist/landing-dashboard.jpg +0 -0
  49. package/dashboard/dist/og-image.jpg +0 -0
  50. package/dashboard/dist/share-dashboard.jpg +0 -0
  51. package/dashboard/dist/social-preview.png +0 -0
  52. package/dashboard/dist/wrapped-2025.png +0 -0
  53. package/node_modules/@insforge/sdk/LICENSE +0 -201
  54. package/node_modules/@insforge/sdk/README.md +0 -259
  55. package/node_modules/@insforge/sdk/dist/index.d.mts +0 -854
  56. package/node_modules/@insforge/sdk/dist/index.d.ts +0 -854
  57. package/node_modules/@insforge/sdk/dist/index.js +0 -1823
  58. package/node_modules/@insforge/sdk/dist/index.js.map +0 -1
  59. package/node_modules/@insforge/sdk/dist/index.mjs +0 -1784
  60. package/node_modules/@insforge/sdk/dist/index.mjs.map +0 -1
  61. package/node_modules/@insforge/sdk/package.json +0 -68
  62. package/node_modules/@insforge/shared-schemas/dist/ai-api.schema.d.ts +0 -583
  63. package/node_modules/@insforge/shared-schemas/dist/ai-api.schema.d.ts.map +0 -1
  64. package/node_modules/@insforge/shared-schemas/dist/ai-api.schema.js +0 -111
  65. package/node_modules/@insforge/shared-schemas/dist/ai-api.schema.js.map +0 -1
  66. package/node_modules/@insforge/shared-schemas/dist/ai.schema.d.ts +0 -188
  67. package/node_modules/@insforge/shared-schemas/dist/ai.schema.d.ts.map +0 -1
  68. package/node_modules/@insforge/shared-schemas/dist/ai.schema.js +0 -48
  69. package/node_modules/@insforge/shared-schemas/dist/ai.schema.js.map +0 -1
  70. package/node_modules/@insforge/shared-schemas/dist/auth-api.schema.d.ts +0 -1127
  71. package/node_modules/@insforge/shared-schemas/dist/auth-api.schema.d.ts.map +0 -1
  72. package/node_modules/@insforge/shared-schemas/dist/auth-api.schema.js +0 -277
  73. package/node_modules/@insforge/shared-schemas/dist/auth-api.schema.js.map +0 -1
  74. package/node_modules/@insforge/shared-schemas/dist/auth.schema.d.ts +0 -187
  75. package/node_modules/@insforge/shared-schemas/dist/auth.schema.d.ts.map +0 -1
  76. package/node_modules/@insforge/shared-schemas/dist/auth.schema.js +0 -105
  77. package/node_modules/@insforge/shared-schemas/dist/auth.schema.js.map +0 -1
  78. package/node_modules/@insforge/shared-schemas/dist/cloud-events.schema.d.ts +0 -144
  79. package/node_modules/@insforge/shared-schemas/dist/cloud-events.schema.d.ts.map +0 -1
  80. package/node_modules/@insforge/shared-schemas/dist/cloud-events.schema.js +0 -41
  81. package/node_modules/@insforge/shared-schemas/dist/cloud-events.schema.js.map +0 -1
  82. package/node_modules/@insforge/shared-schemas/dist/database-api.schema.d.ts +0 -1627
  83. package/node_modules/@insforge/shared-schemas/dist/database-api.schema.d.ts.map +0 -1
  84. package/node_modules/@insforge/shared-schemas/dist/database-api.schema.js +0 -209
  85. package/node_modules/@insforge/shared-schemas/dist/database-api.schema.js.map +0 -1
  86. package/node_modules/@insforge/shared-schemas/dist/database.schema.d.ts +0 -263
  87. package/node_modules/@insforge/shared-schemas/dist/database.schema.d.ts.map +0 -1
  88. package/node_modules/@insforge/shared-schemas/dist/database.schema.js +0 -89
  89. package/node_modules/@insforge/shared-schemas/dist/database.schema.js.map +0 -1
  90. package/node_modules/@insforge/shared-schemas/dist/docs.schema.d.ts +0 -4
  91. package/node_modules/@insforge/shared-schemas/dist/docs.schema.d.ts.map +0 -1
  92. package/node_modules/@insforge/shared-schemas/dist/docs.schema.js +0 -22
  93. package/node_modules/@insforge/shared-schemas/dist/docs.schema.js.map +0 -1
  94. package/node_modules/@insforge/shared-schemas/dist/email-api.schema.d.ts +0 -34
  95. package/node_modules/@insforge/shared-schemas/dist/email-api.schema.d.ts.map +0 -1
  96. package/node_modules/@insforge/shared-schemas/dist/email-api.schema.js +0 -24
  97. package/node_modules/@insforge/shared-schemas/dist/email-api.schema.js.map +0 -1
  98. package/node_modules/@insforge/shared-schemas/dist/functions-api.schema.d.ts +0 -39
  99. package/node_modules/@insforge/shared-schemas/dist/functions-api.schema.d.ts.map +0 -1
  100. package/node_modules/@insforge/shared-schemas/dist/functions-api.schema.js +0 -18
  101. package/node_modules/@insforge/shared-schemas/dist/functions-api.schema.js.map +0 -1
  102. package/node_modules/@insforge/shared-schemas/dist/functions.schema.d.ts +0 -34
  103. package/node_modules/@insforge/shared-schemas/dist/functions.schema.d.ts.map +0 -1
  104. package/node_modules/@insforge/shared-schemas/dist/functions.schema.js +0 -14
  105. package/node_modules/@insforge/shared-schemas/dist/functions.schema.js.map +0 -1
  106. package/node_modules/@insforge/shared-schemas/dist/index.d.ts +0 -19
  107. package/node_modules/@insforge/shared-schemas/dist/index.d.ts.map +0 -1
  108. package/node_modules/@insforge/shared-schemas/dist/index.js +0 -19
  109. package/node_modules/@insforge/shared-schemas/dist/index.js.map +0 -1
  110. package/node_modules/@insforge/shared-schemas/dist/logs-api.schema.d.ts +0 -237
  111. package/node_modules/@insforge/shared-schemas/dist/logs-api.schema.d.ts.map +0 -1
  112. package/node_modules/@insforge/shared-schemas/dist/logs-api.schema.js +0 -41
  113. package/node_modules/@insforge/shared-schemas/dist/logs-api.schema.js.map +0 -1
  114. package/node_modules/@insforge/shared-schemas/dist/logs.schema.d.ts +0 -79
  115. package/node_modules/@insforge/shared-schemas/dist/logs.schema.d.ts.map +0 -1
  116. package/node_modules/@insforge/shared-schemas/dist/logs.schema.js +0 -31
  117. package/node_modules/@insforge/shared-schemas/dist/logs.schema.js.map +0 -1
  118. package/node_modules/@insforge/shared-schemas/dist/metadata.schema.d.ts +0 -940
  119. package/node_modules/@insforge/shared-schemas/dist/metadata.schema.d.ts.map +0 -1
  120. package/node_modules/@insforge/shared-schemas/dist/metadata.schema.js +0 -50
  121. package/node_modules/@insforge/shared-schemas/dist/metadata.schema.js.map +0 -1
  122. package/node_modules/@insforge/shared-schemas/dist/realtime-api.schema.d.ts +0 -395
  123. package/node_modules/@insforge/shared-schemas/dist/realtime-api.schema.d.ts.map +0 -1
  124. package/node_modules/@insforge/shared-schemas/dist/realtime-api.schema.js +0 -73
  125. package/node_modules/@insforge/shared-schemas/dist/realtime-api.schema.js.map +0 -1
  126. package/node_modules/@insforge/shared-schemas/dist/realtime.schema.d.ts +0 -269
  127. package/node_modules/@insforge/shared-schemas/dist/realtime.schema.d.ts.map +0 -1
  128. package/node_modules/@insforge/shared-schemas/dist/realtime.schema.js +0 -109
  129. package/node_modules/@insforge/shared-schemas/dist/realtime.schema.js.map +0 -1
  130. package/node_modules/@insforge/shared-schemas/dist/storage-api.schema.d.ts +0 -166
  131. package/node_modules/@insforge/shared-schemas/dist/storage-api.schema.d.ts.map +0 -1
  132. package/node_modules/@insforge/shared-schemas/dist/storage-api.schema.js +0 -49
  133. package/node_modules/@insforge/shared-schemas/dist/storage-api.schema.js.map +0 -1
  134. package/node_modules/@insforge/shared-schemas/dist/storage.schema.d.ts +0 -39
  135. package/node_modules/@insforge/shared-schemas/dist/storage.schema.d.ts.map +0 -1
  136. package/node_modules/@insforge/shared-schemas/dist/storage.schema.js +0 -15
  137. package/node_modules/@insforge/shared-schemas/dist/storage.schema.js.map +0 -1
  138. package/node_modules/@insforge/shared-schemas/package.json +0 -31
  139. package/node_modules/@socket.io/component-emitter/LICENSE +0 -24
  140. package/node_modules/@socket.io/component-emitter/Readme.md +0 -79
  141. package/node_modules/@socket.io/component-emitter/lib/cjs/index.d.ts +0 -179
  142. package/node_modules/@socket.io/component-emitter/lib/cjs/index.js +0 -176
  143. package/node_modules/@socket.io/component-emitter/lib/cjs/package.json +0 -4
  144. package/node_modules/@socket.io/component-emitter/lib/esm/index.d.ts +0 -179
  145. package/node_modules/@socket.io/component-emitter/lib/esm/index.js +0 -169
  146. package/node_modules/@socket.io/component-emitter/lib/esm/package.json +0 -4
  147. package/node_modules/@socket.io/component-emitter/package.json +0 -28
  148. package/node_modules/@supabase/node-fetch/LICENSE.md +0 -22
  149. package/node_modules/@supabase/node-fetch/README.md +0 -633
  150. package/node_modules/@supabase/node-fetch/browser.js +0 -22
  151. package/node_modules/@supabase/node-fetch/lib/index.es.js +0 -1778
  152. package/node_modules/@supabase/node-fetch/lib/index.js +0 -1787
  153. package/node_modules/@supabase/node-fetch/lib/index.mjs +0 -1776
  154. package/node_modules/@supabase/node-fetch/package.json +0 -80
  155. package/node_modules/@supabase/postgrest-js/LICENSE +0 -21
  156. package/node_modules/@supabase/postgrest-js/README.md +0 -56
  157. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestBuilder.d.ts +0 -71
  158. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestBuilder.d.ts.map +0 -1
  159. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestBuilder.js +0 -222
  160. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestBuilder.js.map +0 -1
  161. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestClient.d.ts +0 -74
  162. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestClient.d.ts.map +0 -1
  163. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestClient.js +0 -121
  164. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestClient.js.map +0 -1
  165. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestError.d.ts +0 -17
  166. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestError.d.ts.map +0 -1
  167. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestError.js +0 -18
  168. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestError.js.map +0 -1
  169. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestFilterBuilder.d.ts +0 -108
  170. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestFilterBuilder.d.ts.map +0 -1
  171. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestFilterBuilder.js +0 -381
  172. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestFilterBuilder.js.map +0 -1
  173. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestQueryBuilder.d.ts +0 -117
  174. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestQueryBuilder.d.ts.map +0 -1
  175. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestQueryBuilder.js +0 -251
  176. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestQueryBuilder.js.map +0 -1
  177. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestTransformBuilder.d.ts +0 -157
  178. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestTransformBuilder.d.ts.map +0 -1
  179. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestTransformBuilder.js +0 -226
  180. package/node_modules/@supabase/postgrest-js/dist/cjs/PostgrestTransformBuilder.js.map +0 -1
  181. package/node_modules/@supabase/postgrest-js/dist/cjs/constants.d.ts +0 -4
  182. package/node_modules/@supabase/postgrest-js/dist/cjs/constants.d.ts.map +0 -1
  183. package/node_modules/@supabase/postgrest-js/dist/cjs/constants.js +0 -6
  184. package/node_modules/@supabase/postgrest-js/dist/cjs/constants.js.map +0 -1
  185. package/node_modules/@supabase/postgrest-js/dist/cjs/index.d.ts +0 -19
  186. package/node_modules/@supabase/postgrest-js/dist/cjs/index.d.ts.map +0 -1
  187. package/node_modules/@supabase/postgrest-js/dist/cjs/index.js +0 -28
  188. package/node_modules/@supabase/postgrest-js/dist/cjs/index.js.map +0 -1
  189. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/parser.d.ts +0 -261
  190. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/parser.d.ts.map +0 -1
  191. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/parser.js +0 -5
  192. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/parser.js.map +0 -1
  193. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/result.d.ts +0 -157
  194. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/result.d.ts.map +0 -1
  195. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/result.js +0 -3
  196. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/result.js.map +0 -1
  197. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/types.d.ts +0 -31
  198. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/types.d.ts.map +0 -1
  199. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/types.js +0 -3
  200. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/types.js.map +0 -1
  201. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/utils.d.ts +0 -264
  202. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/utils.d.ts.map +0 -1
  203. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/utils.js +0 -3
  204. package/node_modules/@supabase/postgrest-js/dist/cjs/select-query-parser/utils.js.map +0 -1
  205. package/node_modules/@supabase/postgrest-js/dist/cjs/types.d.ts +0 -106
  206. package/node_modules/@supabase/postgrest-js/dist/cjs/types.d.ts.map +0 -1
  207. package/node_modules/@supabase/postgrest-js/dist/cjs/types.js +0 -3
  208. package/node_modules/@supabase/postgrest-js/dist/cjs/types.js.map +0 -1
  209. package/node_modules/@supabase/postgrest-js/dist/cjs/version.d.ts +0 -2
  210. package/node_modules/@supabase/postgrest-js/dist/cjs/version.d.ts.map +0 -1
  211. package/node_modules/@supabase/postgrest-js/dist/cjs/version.js +0 -5
  212. package/node_modules/@supabase/postgrest-js/dist/cjs/version.js.map +0 -1
  213. package/node_modules/@supabase/postgrest-js/dist/esm/wrapper.mjs +0 -28
  214. package/node_modules/@supabase/postgrest-js/package.json +0 -75
  215. package/node_modules/@supabase/postgrest-js/src/PostgrestBuilder.ts +0 -300
  216. package/node_modules/@supabase/postgrest-js/src/PostgrestClient.ts +0 -192
  217. package/node_modules/@supabase/postgrest-js/src/PostgrestError.ts +0 -18
  218. package/node_modules/@supabase/postgrest-js/src/PostgrestFilterBuilder.ts +0 -604
  219. package/node_modules/@supabase/postgrest-js/src/PostgrestQueryBuilder.ts +0 -437
  220. package/node_modules/@supabase/postgrest-js/src/PostgrestTransformBuilder.ts +0 -368
  221. package/node_modules/@supabase/postgrest-js/src/constants.ts +0 -2
  222. package/node_modules/@supabase/postgrest-js/src/index.ts +0 -35
  223. package/node_modules/@supabase/postgrest-js/src/select-query-parser/parser.ts +0 -469
  224. package/node_modules/@supabase/postgrest-js/src/select-query-parser/result.ts +0 -503
  225. package/node_modules/@supabase/postgrest-js/src/select-query-parser/types.ts +0 -115
  226. package/node_modules/@supabase/postgrest-js/src/select-query-parser/utils.ts +0 -602
  227. package/node_modules/@supabase/postgrest-js/src/types.ts +0 -201
  228. package/node_modules/@supabase/postgrest-js/src/version.ts +0 -1
  229. package/node_modules/debug/LICENSE +0 -20
  230. package/node_modules/debug/README.md +0 -481
  231. package/node_modules/debug/package.json +0 -60
  232. package/node_modules/debug/src/browser.js +0 -271
  233. package/node_modules/debug/src/common.js +0 -274
  234. package/node_modules/debug/src/index.js +0 -10
  235. package/node_modules/debug/src/node.js +0 -263
  236. package/node_modules/engine.io-client/LICENSE +0 -22
  237. package/node_modules/engine.io-client/README.md +0 -331
  238. package/node_modules/engine.io-client/build/cjs/browser-entrypoint.d.ts +0 -3
  239. package/node_modules/engine.io-client/build/cjs/browser-entrypoint.js +0 -4
  240. package/node_modules/engine.io-client/build/cjs/contrib/has-cors.d.ts +0 -1
  241. package/node_modules/engine.io-client/build/cjs/contrib/has-cors.js +0 -14
  242. package/node_modules/engine.io-client/build/cjs/contrib/parseqs.d.ts +0 -15
  243. package/node_modules/engine.io-client/build/cjs/contrib/parseqs.js +0 -38
  244. package/node_modules/engine.io-client/build/cjs/contrib/parseuri.d.ts +0 -1
  245. package/node_modules/engine.io-client/build/cjs/contrib/parseuri.js +0 -67
  246. package/node_modules/engine.io-client/build/cjs/globals.d.ts +0 -4
  247. package/node_modules/engine.io-client/build/cjs/globals.js +0 -26
  248. package/node_modules/engine.io-client/build/cjs/globals.node.d.ts +0 -21
  249. package/node_modules/engine.io-client/build/cjs/globals.node.js +0 -97
  250. package/node_modules/engine.io-client/build/cjs/index.d.ts +0 -15
  251. package/node_modules/engine.io-client/build/cjs/index.js +0 -32
  252. package/node_modules/engine.io-client/build/cjs/package.json +0 -10
  253. package/node_modules/engine.io-client/build/cjs/socket.d.ts +0 -482
  254. package/node_modules/engine.io-client/build/cjs/socket.js +0 -765
  255. package/node_modules/engine.io-client/build/cjs/transport.d.ts +0 -106
  256. package/node_modules/engine.io-client/build/cjs/transport.js +0 -153
  257. package/node_modules/engine.io-client/build/cjs/transports/index.d.ts +0 -8
  258. package/node_modules/engine.io-client/build/cjs/transports/index.js +0 -11
  259. package/node_modules/engine.io-client/build/cjs/transports/polling-fetch.d.ts +0 -15
  260. package/node_modules/engine.io-client/build/cjs/transports/polling-fetch.js +0 -60
  261. package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.d.ts +0 -108
  262. package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.js +0 -285
  263. package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.d.ts +0 -11
  264. package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.js +0 -44
  265. package/node_modules/engine.io-client/build/cjs/transports/polling.d.ts +0 -52
  266. package/node_modules/engine.io-client/build/cjs/transports/polling.js +0 -165
  267. package/node_modules/engine.io-client/build/cjs/transports/websocket.d.ts +0 -36
  268. package/node_modules/engine.io-client/build/cjs/transports/websocket.js +0 -136
  269. package/node_modules/engine.io-client/build/cjs/transports/websocket.node.d.ts +0 -14
  270. package/node_modules/engine.io-client/build/cjs/transports/websocket.node.js +0 -68
  271. package/node_modules/engine.io-client/build/cjs/transports/webtransport.d.ts +0 -18
  272. package/node_modules/engine.io-client/build/cjs/transports/webtransport.js +0 -94
  273. package/node_modules/engine.io-client/build/cjs/util.d.ts +0 -7
  274. package/node_modules/engine.io-client/build/cjs/util.js +0 -65
  275. package/node_modules/engine.io-client/build/esm/browser-entrypoint.d.ts +0 -3
  276. package/node_modules/engine.io-client/build/esm/browser-entrypoint.js +0 -2
  277. package/node_modules/engine.io-client/build/esm/contrib/has-cors.d.ts +0 -1
  278. package/node_modules/engine.io-client/build/esm/contrib/has-cors.js +0 -11
  279. package/node_modules/engine.io-client/build/esm/contrib/parseqs.d.ts +0 -15
  280. package/node_modules/engine.io-client/build/esm/contrib/parseqs.js +0 -34
  281. package/node_modules/engine.io-client/build/esm/contrib/parseuri.d.ts +0 -1
  282. package/node_modules/engine.io-client/build/esm/contrib/parseuri.js +0 -64
  283. package/node_modules/engine.io-client/build/esm/globals.d.ts +0 -4
  284. package/node_modules/engine.io-client/build/esm/globals.js +0 -22
  285. package/node_modules/engine.io-client/build/esm/globals.node.d.ts +0 -21
  286. package/node_modules/engine.io-client/build/esm/globals.node.js +0 -91
  287. package/node_modules/engine.io-client/build/esm/index.d.ts +0 -15
  288. package/node_modules/engine.io-client/build/esm/index.js +0 -15
  289. package/node_modules/engine.io-client/build/esm/package.json +0 -10
  290. package/node_modules/engine.io-client/build/esm/socket.d.ts +0 -482
  291. package/node_modules/engine.io-client/build/esm/socket.js +0 -727
  292. package/node_modules/engine.io-client/build/esm/transport.d.ts +0 -106
  293. package/node_modules/engine.io-client/build/esm/transport.js +0 -142
  294. package/node_modules/engine.io-client/build/esm/transports/index.d.ts +0 -8
  295. package/node_modules/engine.io-client/build/esm/transports/index.js +0 -8
  296. package/node_modules/engine.io-client/build/esm/transports/polling-fetch.d.ts +0 -15
  297. package/node_modules/engine.io-client/build/esm/transports/polling-fetch.js +0 -56
  298. package/node_modules/engine.io-client/build/esm/transports/polling-xhr.d.ts +0 -108
  299. package/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +0 -271
  300. package/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.d.ts +0 -11
  301. package/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +0 -17
  302. package/node_modules/engine.io-client/build/esm/transports/polling.d.ts +0 -52
  303. package/node_modules/engine.io-client/build/esm/transports/polling.js +0 -145
  304. package/node_modules/engine.io-client/build/esm/transports/websocket.d.ts +0 -36
  305. package/node_modules/engine.io-client/build/esm/transports/websocket.js +0 -125
  306. package/node_modules/engine.io-client/build/esm/transports/websocket.node.d.ts +0 -14
  307. package/node_modules/engine.io-client/build/esm/transports/websocket.node.js +0 -41
  308. package/node_modules/engine.io-client/build/esm/transports/webtransport.d.ts +0 -18
  309. package/node_modules/engine.io-client/build/esm/transports/webtransport.js +0 -80
  310. package/node_modules/engine.io-client/build/esm/util.d.ts +0 -7
  311. package/node_modules/engine.io-client/build/esm/util.js +0 -59
  312. package/node_modules/engine.io-client/build/esm-debug/browser-entrypoint.d.ts +0 -3
  313. package/node_modules/engine.io-client/build/esm-debug/browser-entrypoint.js +0 -2
  314. package/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.d.ts +0 -1
  315. package/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.js +0 -11
  316. package/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.d.ts +0 -15
  317. package/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.js +0 -34
  318. package/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.d.ts +0 -1
  319. package/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.js +0 -64
  320. package/node_modules/engine.io-client/build/esm-debug/globals.d.ts +0 -4
  321. package/node_modules/engine.io-client/build/esm-debug/globals.js +0 -22
  322. package/node_modules/engine.io-client/build/esm-debug/globals.node.d.ts +0 -21
  323. package/node_modules/engine.io-client/build/esm-debug/globals.node.js +0 -91
  324. package/node_modules/engine.io-client/build/esm-debug/index.d.ts +0 -15
  325. package/node_modules/engine.io-client/build/esm-debug/index.js +0 -15
  326. package/node_modules/engine.io-client/build/esm-debug/package.json +0 -10
  327. package/node_modules/engine.io-client/build/esm-debug/socket.d.ts +0 -482
  328. package/node_modules/engine.io-client/build/esm-debug/socket.js +0 -756
  329. package/node_modules/engine.io-client/build/esm-debug/transport.d.ts +0 -106
  330. package/node_modules/engine.io-client/build/esm-debug/transport.js +0 -145
  331. package/node_modules/engine.io-client/build/esm-debug/transports/index.d.ts +0 -8
  332. package/node_modules/engine.io-client/build/esm-debug/transports/index.js +0 -8
  333. package/node_modules/engine.io-client/build/esm-debug/transports/polling-fetch.d.ts +0 -15
  334. package/node_modules/engine.io-client/build/esm-debug/transports/polling-fetch.js +0 -56
  335. package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.d.ts +0 -108
  336. package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.js +0 -276
  337. package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.d.ts +0 -11
  338. package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.js +0 -17
  339. package/node_modules/engine.io-client/build/esm-debug/transports/polling.d.ts +0 -52
  340. package/node_modules/engine.io-client/build/esm-debug/transports/polling.js +0 -158
  341. package/node_modules/engine.io-client/build/esm-debug/transports/websocket.d.ts +0 -36
  342. package/node_modules/engine.io-client/build/esm-debug/transports/websocket.js +0 -128
  343. package/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.d.ts +0 -14
  344. package/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.js +0 -41
  345. package/node_modules/engine.io-client/build/esm-debug/transports/webtransport.d.ts +0 -18
  346. package/node_modules/engine.io-client/build/esm-debug/transports/webtransport.js +0 -87
  347. package/node_modules/engine.io-client/build/esm-debug/util.d.ts +0 -7
  348. package/node_modules/engine.io-client/build/esm-debug/util.js +0 -59
  349. package/node_modules/engine.io-client/dist/engine.io.esm.min.js +0 -7
  350. package/node_modules/engine.io-client/dist/engine.io.esm.min.js.map +0 -1
  351. package/node_modules/engine.io-client/dist/engine.io.js +0 -2968
  352. package/node_modules/engine.io-client/dist/engine.io.js.map +0 -1
  353. package/node_modules/engine.io-client/dist/engine.io.min.js +0 -7
  354. package/node_modules/engine.io-client/dist/engine.io.min.js.map +0 -1
  355. package/node_modules/engine.io-client/package.json +0 -95
  356. package/node_modules/engine.io-parser/LICENSE +0 -22
  357. package/node_modules/engine.io-parser/Readme.md +0 -158
  358. package/node_modules/engine.io-parser/build/cjs/commons.d.ts +0 -14
  359. package/node_modules/engine.io-parser/build/cjs/commons.js +0 -19
  360. package/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.d.ts +0 -2
  361. package/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.js +0 -48
  362. package/node_modules/engine.io-parser/build/cjs/decodePacket.browser.d.ts +0 -2
  363. package/node_modules/engine.io-parser/build/cjs/decodePacket.browser.js +0 -66
  364. package/node_modules/engine.io-parser/build/cjs/decodePacket.d.ts +0 -2
  365. package/node_modules/engine.io-parser/build/cjs/decodePacket.js +0 -59
  366. package/node_modules/engine.io-parser/build/cjs/encodePacket.browser.d.ts +0 -4
  367. package/node_modules/engine.io-parser/build/cjs/encodePacket.browser.js +0 -72
  368. package/node_modules/engine.io-parser/build/cjs/encodePacket.d.ts +0 -3
  369. package/node_modules/engine.io-parser/build/cjs/encodePacket.js +0 -38
  370. package/node_modules/engine.io-parser/build/cjs/index.d.ts +0 -9
  371. package/node_modules/engine.io-parser/build/cjs/index.js +0 -164
  372. package/node_modules/engine.io-parser/build/cjs/package.json +0 -8
  373. package/node_modules/engine.io-parser/build/esm/commons.d.ts +0 -14
  374. package/node_modules/engine.io-parser/build/esm/commons.js +0 -14
  375. package/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.d.ts +0 -2
  376. package/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js +0 -43
  377. package/node_modules/engine.io-parser/build/esm/decodePacket.browser.d.ts +0 -2
  378. package/node_modules/engine.io-parser/build/esm/decodePacket.browser.js +0 -62
  379. package/node_modules/engine.io-parser/build/esm/decodePacket.d.ts +0 -2
  380. package/node_modules/engine.io-parser/build/esm/decodePacket.js +0 -55
  381. package/node_modules/engine.io-parser/build/esm/encodePacket.browser.d.ts +0 -4
  382. package/node_modules/engine.io-parser/build/esm/encodePacket.browser.js +0 -68
  383. package/node_modules/engine.io-parser/build/esm/encodePacket.d.ts +0 -3
  384. package/node_modules/engine.io-parser/build/esm/encodePacket.js +0 -33
  385. package/node_modules/engine.io-parser/build/esm/index.d.ts +0 -9
  386. package/node_modules/engine.io-parser/build/esm/index.js +0 -156
  387. package/node_modules/engine.io-parser/build/esm/package.json +0 -8
  388. package/node_modules/engine.io-parser/package.json +0 -46
  389. package/node_modules/ms/index.js +0 -162
  390. package/node_modules/ms/license.md +0 -21
  391. package/node_modules/ms/package.json +0 -38
  392. package/node_modules/ms/readme.md +0 -59
  393. package/node_modules/socket.io-client/LICENSE +0 -21
  394. package/node_modules/socket.io-client/README.md +0 -29
  395. package/node_modules/socket.io-client/build/cjs/browser-entrypoint.d.ts +0 -2
  396. package/node_modules/socket.io-client/build/cjs/browser-entrypoint.js +0 -4
  397. package/node_modules/socket.io-client/build/cjs/contrib/backo2.d.ts +0 -12
  398. package/node_modules/socket.io-client/build/cjs/contrib/backo2.js +0 -69
  399. package/node_modules/socket.io-client/build/cjs/index.d.ts +0 -29
  400. package/node_modules/socket.io-client/build/cjs/index.js +0 -76
  401. package/node_modules/socket.io-client/build/cjs/manager.d.ts +0 -295
  402. package/node_modules/socket.io-client/build/cjs/manager.js +0 -416
  403. package/node_modules/socket.io-client/build/cjs/on.d.ts +0 -2
  404. package/node_modules/socket.io-client/build/cjs/on.js +0 -9
  405. package/node_modules/socket.io-client/build/cjs/socket.d.ts +0 -593
  406. package/node_modules/socket.io-client/build/cjs/socket.js +0 -910
  407. package/node_modules/socket.io-client/build/cjs/url.d.ts +0 -33
  408. package/node_modules/socket.io-client/build/cjs/url.js +0 -69
  409. package/node_modules/socket.io-client/build/esm/browser-entrypoint.d.ts +0 -2
  410. package/node_modules/socket.io-client/build/esm/browser-entrypoint.js +0 -2
  411. package/node_modules/socket.io-client/build/esm/contrib/backo2.d.ts +0 -12
  412. package/node_modules/socket.io-client/build/esm/contrib/backo2.js +0 -66
  413. package/node_modules/socket.io-client/build/esm/index.d.ts +0 -29
  414. package/node_modules/socket.io-client/build/esm/index.js +0 -58
  415. package/node_modules/socket.io-client/build/esm/manager.d.ts +0 -295
  416. package/node_modules/socket.io-client/build/esm/manager.js +0 -367
  417. package/node_modules/socket.io-client/build/esm/on.d.ts +0 -2
  418. package/node_modules/socket.io-client/build/esm/on.js +0 -6
  419. package/node_modules/socket.io-client/build/esm/package.json +0 -5
  420. package/node_modules/socket.io-client/build/esm/socket.d.ts +0 -593
  421. package/node_modules/socket.io-client/build/esm/socket.js +0 -882
  422. package/node_modules/socket.io-client/build/esm/url.d.ts +0 -33
  423. package/node_modules/socket.io-client/build/esm/url.js +0 -59
  424. package/node_modules/socket.io-client/build/esm-debug/browser-entrypoint.d.ts +0 -2
  425. package/node_modules/socket.io-client/build/esm-debug/browser-entrypoint.js +0 -2
  426. package/node_modules/socket.io-client/build/esm-debug/contrib/backo2.d.ts +0 -12
  427. package/node_modules/socket.io-client/build/esm-debug/contrib/backo2.js +0 -66
  428. package/node_modules/socket.io-client/build/esm-debug/index.d.ts +0 -29
  429. package/node_modules/socket.io-client/build/esm-debug/index.js +0 -62
  430. package/node_modules/socket.io-client/build/esm-debug/manager.d.ts +0 -295
  431. package/node_modules/socket.io-client/build/esm-debug/manager.js +0 -386
  432. package/node_modules/socket.io-client/build/esm-debug/on.d.ts +0 -2
  433. package/node_modules/socket.io-client/build/esm-debug/on.js +0 -6
  434. package/node_modules/socket.io-client/build/esm-debug/package.json +0 -5
  435. package/node_modules/socket.io-client/build/esm-debug/socket.d.ts +0 -593
  436. package/node_modules/socket.io-client/build/esm-debug/socket.js +0 -903
  437. package/node_modules/socket.io-client/build/esm-debug/url.d.ts +0 -33
  438. package/node_modules/socket.io-client/build/esm-debug/url.js +0 -63
  439. package/node_modules/socket.io-client/dist/socket.io.esm.min.js +0 -7
  440. package/node_modules/socket.io-client/dist/socket.io.esm.min.js.map +0 -1
  441. package/node_modules/socket.io-client/dist/socket.io.js +0 -4908
  442. package/node_modules/socket.io-client/dist/socket.io.js.map +0 -1
  443. package/node_modules/socket.io-client/dist/socket.io.min.js +0 -7
  444. package/node_modules/socket.io-client/dist/socket.io.min.js.map +0 -1
  445. package/node_modules/socket.io-client/dist/socket.io.msgpack.min.js +0 -7
  446. package/node_modules/socket.io-client/dist/socket.io.msgpack.min.js.map +0 -1
  447. package/node_modules/socket.io-client/package.json +0 -101
  448. package/node_modules/socket.io-parser/LICENSE +0 -20
  449. package/node_modules/socket.io-parser/Readme.md +0 -81
  450. package/node_modules/socket.io-parser/build/cjs/binary.d.ts +0 -20
  451. package/node_modules/socket.io-parser/build/cjs/binary.js +0 -88
  452. package/node_modules/socket.io-parser/build/cjs/index.d.ts +0 -90
  453. package/node_modules/socket.io-parser/build/cjs/index.js +0 -321
  454. package/node_modules/socket.io-parser/build/cjs/is-binary.d.ts +0 -7
  455. package/node_modules/socket.io-parser/build/cjs/is-binary.js +0 -55
  456. package/node_modules/socket.io-parser/build/cjs/package.json +0 -3
  457. package/node_modules/socket.io-parser/build/esm/binary.d.ts +0 -20
  458. package/node_modules/socket.io-parser/build/esm/binary.js +0 -83
  459. package/node_modules/socket.io-parser/build/esm/index.d.ts +0 -90
  460. package/node_modules/socket.io-parser/build/esm/index.js +0 -311
  461. package/node_modules/socket.io-parser/build/esm/is-binary.d.ts +0 -7
  462. package/node_modules/socket.io-parser/build/esm/is-binary.js +0 -50
  463. package/node_modules/socket.io-parser/build/esm/package.json +0 -3
  464. package/node_modules/socket.io-parser/build/esm-debug/binary.d.ts +0 -20
  465. package/node_modules/socket.io-parser/build/esm-debug/binary.js +0 -83
  466. package/node_modules/socket.io-parser/build/esm-debug/index.d.ts +0 -90
  467. package/node_modules/socket.io-parser/build/esm-debug/index.js +0 -316
  468. package/node_modules/socket.io-parser/build/esm-debug/is-binary.d.ts +0 -7
  469. package/node_modules/socket.io-parser/build/esm-debug/is-binary.js +0 -50
  470. package/node_modules/socket.io-parser/build/esm-debug/package.json +0 -3
  471. package/node_modules/socket.io-parser/package.json +0 -58
  472. package/node_modules/tr46/.npmignore +0 -4
  473. package/node_modules/tr46/index.js +0 -193
  474. package/node_modules/tr46/lib/.gitkeep +0 -0
  475. package/node_modules/tr46/lib/mappingTable.json +0 -1
  476. package/node_modules/tr46/package.json +0 -31
  477. package/node_modules/webidl-conversions/LICENSE.md +0 -12
  478. package/node_modules/webidl-conversions/README.md +0 -53
  479. package/node_modules/webidl-conversions/lib/index.js +0 -189
  480. package/node_modules/webidl-conversions/package.json +0 -23
  481. package/node_modules/whatwg-url/LICENSE.txt +0 -21
  482. package/node_modules/whatwg-url/README.md +0 -67
  483. package/node_modules/whatwg-url/lib/URL-impl.js +0 -200
  484. package/node_modules/whatwg-url/lib/URL.js +0 -196
  485. package/node_modules/whatwg-url/lib/public-api.js +0 -11
  486. package/node_modules/whatwg-url/lib/url-state-machine.js +0 -1297
  487. package/node_modules/whatwg-url/lib/utils.js +0 -20
  488. package/node_modules/whatwg-url/package.json +0 -32
  489. package/node_modules/ws/LICENSE +0 -20
  490. package/node_modules/ws/README.md +0 -548
  491. package/node_modules/ws/browser.js +0 -8
  492. package/node_modules/ws/index.js +0 -13
  493. package/node_modules/ws/lib/buffer-util.js +0 -131
  494. package/node_modules/ws/lib/constants.js +0 -12
  495. package/node_modules/ws/lib/event-target.js +0 -292
  496. package/node_modules/ws/lib/extension.js +0 -203
  497. package/node_modules/ws/lib/limiter.js +0 -55
  498. package/node_modules/ws/lib/permessage-deflate.js +0 -514
  499. package/node_modules/ws/lib/receiver.js +0 -704
  500. package/node_modules/ws/lib/sender.js +0 -497
  501. package/node_modules/ws/lib/stream.js +0 -159
  502. package/node_modules/ws/lib/subprotocol.js +0 -62
  503. package/node_modules/ws/lib/validation.js +0 -130
  504. package/node_modules/ws/lib/websocket-server.js +0 -540
  505. package/node_modules/ws/lib/websocket.js +0 -1338
  506. package/node_modules/ws/package.json +0 -69
  507. package/node_modules/ws/wrapper.mjs +0 -8
  508. package/node_modules/xmlhttprequest-ssl/LICENSE +0 -22
  509. package/node_modules/xmlhttprequest-ssl/README.md +0 -67
  510. package/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +0 -689
  511. package/node_modules/xmlhttprequest-ssl/package.json +0 -40
  512. package/node_modules/zod/LICENSE +0 -21
  513. package/node_modules/zod/README.md +0 -208
  514. package/node_modules/zod/index.cjs +0 -33
  515. package/node_modules/zod/index.d.cts +0 -4
  516. package/node_modules/zod/index.d.ts +0 -4
  517. package/node_modules/zod/index.js +0 -4
  518. package/node_modules/zod/package.json +0 -118
  519. package/node_modules/zod/src/index.ts +0 -4
  520. package/node_modules/zod/src/v3/ZodError.ts +0 -330
  521. package/node_modules/zod/src/v3/benchmarks/datetime.ts +0 -58
  522. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +0 -80
  523. package/node_modules/zod/src/v3/benchmarks/index.ts +0 -59
  524. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +0 -57
  525. package/node_modules/zod/src/v3/benchmarks/object.ts +0 -69
  526. package/node_modules/zod/src/v3/benchmarks/primitives.ts +0 -162
  527. package/node_modules/zod/src/v3/benchmarks/realworld.ts +0 -63
  528. package/node_modules/zod/src/v3/benchmarks/string.ts +0 -55
  529. package/node_modules/zod/src/v3/benchmarks/union.ts +0 -80
  530. package/node_modules/zod/src/v3/errors.ts +0 -13
  531. package/node_modules/zod/src/v3/external.ts +0 -6
  532. package/node_modules/zod/src/v3/helpers/enumUtil.ts +0 -17
  533. package/node_modules/zod/src/v3/helpers/errorUtil.ts +0 -8
  534. package/node_modules/zod/src/v3/helpers/parseUtil.ts +0 -176
  535. package/node_modules/zod/src/v3/helpers/partialUtil.ts +0 -34
  536. package/node_modules/zod/src/v3/helpers/typeAliases.ts +0 -2
  537. package/node_modules/zod/src/v3/helpers/util.ts +0 -224
  538. package/node_modules/zod/src/v3/index.ts +0 -4
  539. package/node_modules/zod/src/v3/locales/en.ts +0 -124
  540. package/node_modules/zod/src/v3/standard-schema.ts +0 -113
  541. package/node_modules/zod/src/v3/tests/Mocker.ts +0 -54
  542. package/node_modules/zod/src/v3/tests/all-errors.test.ts +0 -157
  543. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +0 -28
  544. package/node_modules/zod/src/v3/tests/array.test.ts +0 -71
  545. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +0 -388
  546. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +0 -46
  547. package/node_modules/zod/src/v3/tests/base.test.ts +0 -29
  548. package/node_modules/zod/src/v3/tests/bigint.test.ts +0 -55
  549. package/node_modules/zod/src/v3/tests/branded.test.ts +0 -53
  550. package/node_modules/zod/src/v3/tests/catch.test.ts +0 -220
  551. package/node_modules/zod/src/v3/tests/coerce.test.ts +0 -133
  552. package/node_modules/zod/src/v3/tests/complex.test.ts +0 -56
  553. package/node_modules/zod/src/v3/tests/custom.test.ts +0 -31
  554. package/node_modules/zod/src/v3/tests/date.test.ts +0 -32
  555. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +0 -186
  556. package/node_modules/zod/src/v3/tests/default.test.ts +0 -112
  557. package/node_modules/zod/src/v3/tests/description.test.ts +0 -33
  558. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +0 -315
  559. package/node_modules/zod/src/v3/tests/enum.test.ts +0 -80
  560. package/node_modules/zod/src/v3/tests/error.test.ts +0 -551
  561. package/node_modules/zod/src/v3/tests/firstparty.test.ts +0 -87
  562. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +0 -21
  563. package/node_modules/zod/src/v3/tests/function.test.ts +0 -257
  564. package/node_modules/zod/src/v3/tests/generics.test.ts +0 -48
  565. package/node_modules/zod/src/v3/tests/instanceof.test.ts +0 -37
  566. package/node_modules/zod/src/v3/tests/intersection.test.ts +0 -110
  567. package/node_modules/zod/src/v3/tests/language-server.source.ts +0 -76
  568. package/node_modules/zod/src/v3/tests/language-server.test.ts +0 -207
  569. package/node_modules/zod/src/v3/tests/literal.test.ts +0 -36
  570. package/node_modules/zod/src/v3/tests/map.test.ts +0 -110
  571. package/node_modules/zod/src/v3/tests/masking.test.ts +0 -4
  572. package/node_modules/zod/src/v3/tests/mocker.test.ts +0 -19
  573. package/node_modules/zod/src/v3/tests/nan.test.ts +0 -21
  574. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +0 -87
  575. package/node_modules/zod/src/v3/tests/nullable.test.ts +0 -42
  576. package/node_modules/zod/src/v3/tests/number.test.ts +0 -176
  577. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +0 -29
  578. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +0 -29
  579. package/node_modules/zod/src/v3/tests/object.test.ts +0 -434
  580. package/node_modules/zod/src/v3/tests/optional.test.ts +0 -42
  581. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +0 -23
  582. package/node_modules/zod/src/v3/tests/parser.test.ts +0 -41
  583. package/node_modules/zod/src/v3/tests/partials.test.ts +0 -243
  584. package/node_modules/zod/src/v3/tests/pickomit.test.ts +0 -111
  585. package/node_modules/zod/src/v3/tests/pipeline.test.ts +0 -29
  586. package/node_modules/zod/src/v3/tests/preprocess.test.ts +0 -186
  587. package/node_modules/zod/src/v3/tests/primitive.test.ts +0 -440
  588. package/node_modules/zod/src/v3/tests/promise.test.ts +0 -90
  589. package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -194
  590. package/node_modules/zod/src/v3/tests/record.test.ts +0 -171
  591. package/node_modules/zod/src/v3/tests/recursive.test.ts +0 -197
  592. package/node_modules/zod/src/v3/tests/refine.test.ts +0 -313
  593. package/node_modules/zod/src/v3/tests/safeparse.test.ts +0 -27
  594. package/node_modules/zod/src/v3/tests/set.test.ts +0 -142
  595. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +0 -83
  596. package/node_modules/zod/src/v3/tests/string.test.ts +0 -916
  597. package/node_modules/zod/src/v3/tests/transformer.test.ts +0 -233
  598. package/node_modules/zod/src/v3/tests/tuple.test.ts +0 -90
  599. package/node_modules/zod/src/v3/tests/unions.test.ts +0 -57
  600. package/node_modules/zod/src/v3/tests/validations.test.ts +0 -133
  601. package/node_modules/zod/src/v3/tests/void.test.ts +0 -15
  602. package/node_modules/zod/src/v3/types.ts +0 -5136
  603. package/node_modules/zod/src/v4/classic/checks.ts +0 -30
  604. package/node_modules/zod/src/v4/classic/coerce.ts +0 -27
  605. package/node_modules/zod/src/v4/classic/compat.ts +0 -66
  606. package/node_modules/zod/src/v4/classic/errors.ts +0 -75
  607. package/node_modules/zod/src/v4/classic/external.ts +0 -50
  608. package/node_modules/zod/src/v4/classic/index.ts +0 -5
  609. package/node_modules/zod/src/v4/classic/iso.ts +0 -90
  610. package/node_modules/zod/src/v4/classic/parse.ts +0 -33
  611. package/node_modules/zod/src/v4/classic/schemas.ts +0 -2054
  612. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +0 -26
  613. package/node_modules/zod/src/v4/classic/tests/array.test.ts +0 -264
  614. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +0 -210
  615. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +0 -381
  616. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +0 -68
  617. package/node_modules/zod/src/v4/classic/tests/base.test.ts +0 -7
  618. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +0 -54
  619. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +0 -63
  620. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +0 -252
  621. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +0 -20
  622. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +0 -160
  623. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +0 -352
  624. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +0 -40
  625. package/node_modules/zod/src/v4/classic/tests/date.test.ts +0 -31
  626. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +0 -296
  627. package/node_modules/zod/src/v4/classic/tests/default.test.ts +0 -313
  628. package/node_modules/zod/src/v4/classic/tests/description.test.ts +0 -32
  629. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +0 -619
  630. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +0 -285
  631. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +0 -527
  632. package/node_modules/zod/src/v4/classic/tests/error.test.ts +0 -711
  633. package/node_modules/zod/src/v4/classic/tests/file.test.ts +0 -91
  634. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -175
  635. package/node_modules/zod/src/v4/classic/tests/function.test.ts +0 -268
  636. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +0 -72
  637. package/node_modules/zod/src/v4/classic/tests/index.test.ts +0 -829
  638. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +0 -34
  639. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +0 -171
  640. package/node_modules/zod/src/v4/classic/tests/json.test.ts +0 -108
  641. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +0 -227
  642. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +0 -92
  643. package/node_modules/zod/src/v4/classic/tests/map.test.ts +0 -196
  644. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +0 -21
  645. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +0 -168
  646. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +0 -86
  647. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +0 -22
  648. package/node_modules/zod/src/v4/classic/tests/number.test.ts +0 -247
  649. package/node_modules/zod/src/v4/classic/tests/object.test.ts +0 -563
  650. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +0 -123
  651. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +0 -147
  652. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +0 -127
  653. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +0 -81
  654. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +0 -37
  655. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +0 -298
  656. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +0 -175
  657. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +0 -81
  658. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +0 -23
  659. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -252
  660. package/node_modules/zod/src/v4/classic/tests/record.test.ts +0 -342
  661. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +0 -356
  662. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +0 -532
  663. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +0 -204
  664. package/node_modules/zod/src/v4/classic/tests/set.test.ts +0 -179
  665. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +0 -57
  666. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +0 -109
  667. package/node_modules/zod/src/v4/classic/tests/string.test.ts +0 -881
  668. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +0 -66
  669. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +0 -758
  670. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +0 -2314
  671. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +0 -250
  672. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +0 -163
  673. package/node_modules/zod/src/v4/classic/tests/union.test.ts +0 -94
  674. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +0 -283
  675. package/node_modules/zod/src/v4/classic/tests/void.test.ts +0 -12
  676. package/node_modules/zod/src/v4/core/api.ts +0 -1594
  677. package/node_modules/zod/src/v4/core/checks.ts +0 -1283
  678. package/node_modules/zod/src/v4/core/config.ts +0 -15
  679. package/node_modules/zod/src/v4/core/core.ts +0 -134
  680. package/node_modules/zod/src/v4/core/doc.ts +0 -44
  681. package/node_modules/zod/src/v4/core/errors.ts +0 -424
  682. package/node_modules/zod/src/v4/core/function.ts +0 -176
  683. package/node_modules/zod/src/v4/core/index.ts +0 -15
  684. package/node_modules/zod/src/v4/core/json-schema.ts +0 -143
  685. package/node_modules/zod/src/v4/core/parse.ts +0 -94
  686. package/node_modules/zod/src/v4/core/regexes.ts +0 -135
  687. package/node_modules/zod/src/v4/core/registries.ts +0 -96
  688. package/node_modules/zod/src/v4/core/schemas.ts +0 -3842
  689. package/node_modules/zod/src/v4/core/standard-schema.ts +0 -64
  690. package/node_modules/zod/src/v4/core/tests/index.test.ts +0 -46
  691. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +0 -124
  692. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +0 -22
  693. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +0 -128
  694. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +0 -69
  695. package/node_modules/zod/src/v4/core/to-json-schema.ts +0 -977
  696. package/node_modules/zod/src/v4/core/util.ts +0 -775
  697. package/node_modules/zod/src/v4/core/versions.ts +0 -5
  698. package/node_modules/zod/src/v4/core/zsf.ts +0 -323
  699. package/node_modules/zod/src/v4/index.ts +0 -4
  700. package/node_modules/zod/src/v4/locales/ar.ts +0 -125
  701. package/node_modules/zod/src/v4/locales/az.ts +0 -121
  702. package/node_modules/zod/src/v4/locales/be.ts +0 -184
  703. package/node_modules/zod/src/v4/locales/ca.ts +0 -127
  704. package/node_modules/zod/src/v4/locales/cs.ts +0 -142
  705. package/node_modules/zod/src/v4/locales/de.ts +0 -124
  706. package/node_modules/zod/src/v4/locales/en.ts +0 -127
  707. package/node_modules/zod/src/v4/locales/eo.ts +0 -125
  708. package/node_modules/zod/src/v4/locales/es.ts +0 -125
  709. package/node_modules/zod/src/v4/locales/fa.ts +0 -134
  710. package/node_modules/zod/src/v4/locales/fi.ts +0 -131
  711. package/node_modules/zod/src/v4/locales/fr-CA.ts +0 -126
  712. package/node_modules/zod/src/v4/locales/fr.ts +0 -124
  713. package/node_modules/zod/src/v4/locales/he.ts +0 -125
  714. package/node_modules/zod/src/v4/locales/hu.ts +0 -126
  715. package/node_modules/zod/src/v4/locales/id.ts +0 -125
  716. package/node_modules/zod/src/v4/locales/index.ts +0 -39
  717. package/node_modules/zod/src/v4/locales/it.ts +0 -125
  718. package/node_modules/zod/src/v4/locales/ja.ts +0 -122
  719. package/node_modules/zod/src/v4/locales/kh.ts +0 -126
  720. package/node_modules/zod/src/v4/locales/ko.ts +0 -131
  721. package/node_modules/zod/src/v4/locales/mk.ts +0 -127
  722. package/node_modules/zod/src/v4/locales/ms.ts +0 -124
  723. package/node_modules/zod/src/v4/locales/nl.ts +0 -126
  724. package/node_modules/zod/src/v4/locales/no.ts +0 -124
  725. package/node_modules/zod/src/v4/locales/ota.ts +0 -125
  726. package/node_modules/zod/src/v4/locales/pl.ts +0 -126
  727. package/node_modules/zod/src/v4/locales/ps.ts +0 -133
  728. package/node_modules/zod/src/v4/locales/pt.ts +0 -123
  729. package/node_modules/zod/src/v4/locales/ru.ts +0 -184
  730. package/node_modules/zod/src/v4/locales/sl.ts +0 -126
  731. package/node_modules/zod/src/v4/locales/sv.ts +0 -127
  732. package/node_modules/zod/src/v4/locales/ta.ts +0 -125
  733. package/node_modules/zod/src/v4/locales/th.ts +0 -126
  734. package/node_modules/zod/src/v4/locales/tr.ts +0 -121
  735. package/node_modules/zod/src/v4/locales/ua.ts +0 -126
  736. package/node_modules/zod/src/v4/locales/ur.ts +0 -126
  737. package/node_modules/zod/src/v4/locales/vi.ts +0 -125
  738. package/node_modules/zod/src/v4/locales/zh-CN.ts +0 -123
  739. package/node_modules/zod/src/v4/locales/zh-TW.ts +0 -125
  740. package/node_modules/zod/src/v4/mini/checks.ts +0 -32
  741. package/node_modules/zod/src/v4/mini/coerce.ts +0 -22
  742. package/node_modules/zod/src/v4/mini/external.ts +0 -40
  743. package/node_modules/zod/src/v4/mini/index.ts +0 -3
  744. package/node_modules/zod/src/v4/mini/iso.ts +0 -62
  745. package/node_modules/zod/src/v4/mini/parse.ts +0 -1
  746. package/node_modules/zod/src/v4/mini/schemas.ts +0 -1579
  747. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +0 -129
  748. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +0 -51
  749. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +0 -144
  750. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +0 -36
  751. package/node_modules/zod/src/v4/mini/tests/error.test.ts +0 -22
  752. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +0 -43
  753. package/node_modules/zod/src/v4/mini/tests/index.test.ts +0 -871
  754. package/node_modules/zod/src/v4/mini/tests/number.test.ts +0 -95
  755. package/node_modules/zod/src/v4/mini/tests/object.test.ts +0 -185
  756. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +0 -43
  757. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +0 -275
  758. package/node_modules/zod/src/v4/mini/tests/string.test.ts +0 -299
  759. package/node_modules/zod/src/v4-mini/index.ts +0 -1
  760. package/node_modules/zod/v3/ZodError.cjs +0 -138
  761. package/node_modules/zod/v3/ZodError.d.cts +0 -164
  762. package/node_modules/zod/v3/ZodError.d.ts +0 -164
  763. package/node_modules/zod/v3/ZodError.js +0 -133
  764. package/node_modules/zod/v3/errors.cjs +0 -17
  765. package/node_modules/zod/v3/errors.d.cts +0 -5
  766. package/node_modules/zod/v3/errors.d.ts +0 -5
  767. package/node_modules/zod/v3/errors.js +0 -9
  768. package/node_modules/zod/v3/external.cjs +0 -22
  769. package/node_modules/zod/v3/external.d.cts +0 -6
  770. package/node_modules/zod/v3/external.d.ts +0 -6
  771. package/node_modules/zod/v3/external.js +0 -6
  772. package/node_modules/zod/v3/helpers/enumUtil.cjs +0 -2
  773. package/node_modules/zod/v3/helpers/enumUtil.d.cts +0 -8
  774. package/node_modules/zod/v3/helpers/enumUtil.d.ts +0 -8
  775. package/node_modules/zod/v3/helpers/enumUtil.js +0 -1
  776. package/node_modules/zod/v3/helpers/errorUtil.cjs +0 -9
  777. package/node_modules/zod/v3/helpers/errorUtil.d.cts +0 -9
  778. package/node_modules/zod/v3/helpers/errorUtil.d.ts +0 -9
  779. package/node_modules/zod/v3/helpers/errorUtil.js +0 -6
  780. package/node_modules/zod/v3/helpers/parseUtil.cjs +0 -124
  781. package/node_modules/zod/v3/helpers/parseUtil.d.cts +0 -78
  782. package/node_modules/zod/v3/helpers/parseUtil.d.ts +0 -78
  783. package/node_modules/zod/v3/helpers/parseUtil.js +0 -109
  784. package/node_modules/zod/v3/helpers/partialUtil.cjs +0 -2
  785. package/node_modules/zod/v3/helpers/partialUtil.d.cts +0 -8
  786. package/node_modules/zod/v3/helpers/partialUtil.d.ts +0 -8
  787. package/node_modules/zod/v3/helpers/partialUtil.js +0 -1
  788. package/node_modules/zod/v3/helpers/typeAliases.cjs +0 -2
  789. package/node_modules/zod/v3/helpers/typeAliases.d.cts +0 -2
  790. package/node_modules/zod/v3/helpers/typeAliases.d.ts +0 -2
  791. package/node_modules/zod/v3/helpers/typeAliases.js +0 -1
  792. package/node_modules/zod/v3/helpers/util.cjs +0 -137
  793. package/node_modules/zod/v3/helpers/util.d.cts +0 -85
  794. package/node_modules/zod/v3/helpers/util.d.ts +0 -85
  795. package/node_modules/zod/v3/helpers/util.js +0 -133
  796. package/node_modules/zod/v3/index.cjs +0 -33
  797. package/node_modules/zod/v3/index.d.cts +0 -4
  798. package/node_modules/zod/v3/index.d.ts +0 -4
  799. package/node_modules/zod/v3/index.js +0 -4
  800. package/node_modules/zod/v3/locales/en.cjs +0 -111
  801. package/node_modules/zod/v3/locales/en.d.cts +0 -3
  802. package/node_modules/zod/v3/locales/en.d.ts +0 -3
  803. package/node_modules/zod/v3/locales/en.js +0 -109
  804. package/node_modules/zod/v3/standard-schema.cjs +0 -2
  805. package/node_modules/zod/v3/standard-schema.d.cts +0 -102
  806. package/node_modules/zod/v3/standard-schema.d.ts +0 -102
  807. package/node_modules/zod/v3/standard-schema.js +0 -1
  808. package/node_modules/zod/v3/types.cjs +0 -3775
  809. package/node_modules/zod/v3/types.d.cts +0 -1031
  810. package/node_modules/zod/v3/types.d.ts +0 -1031
  811. package/node_modules/zod/v3/types.js +0 -3693
  812. package/node_modules/zod/v4/classic/checks.cjs +0 -32
  813. package/node_modules/zod/v4/classic/checks.d.cts +0 -1
  814. package/node_modules/zod/v4/classic/checks.d.ts +0 -1
  815. package/node_modules/zod/v4/classic/checks.js +0 -1
  816. package/node_modules/zod/v4/classic/coerce.cjs +0 -47
  817. package/node_modules/zod/v4/classic/coerce.d.cts +0 -17
  818. package/node_modules/zod/v4/classic/coerce.d.ts +0 -17
  819. package/node_modules/zod/v4/classic/coerce.js +0 -17
  820. package/node_modules/zod/v4/classic/compat.cjs +0 -57
  821. package/node_modules/zod/v4/classic/compat.d.cts +0 -46
  822. package/node_modules/zod/v4/classic/compat.d.ts +0 -46
  823. package/node_modules/zod/v4/classic/compat.js +0 -27
  824. package/node_modules/zod/v4/classic/errors.cjs +0 -67
  825. package/node_modules/zod/v4/classic/errors.d.cts +0 -30
  826. package/node_modules/zod/v4/classic/errors.d.ts +0 -30
  827. package/node_modules/zod/v4/classic/errors.js +0 -41
  828. package/node_modules/zod/v4/classic/external.cjs +0 -70
  829. package/node_modules/zod/v4/classic/external.d.cts +0 -13
  830. package/node_modules/zod/v4/classic/external.d.ts +0 -13
  831. package/node_modules/zod/v4/classic/external.js +0 -18
  832. package/node_modules/zod/v4/classic/index.cjs +0 -33
  833. package/node_modules/zod/v4/classic/index.d.cts +0 -4
  834. package/node_modules/zod/v4/classic/index.d.ts +0 -4
  835. package/node_modules/zod/v4/classic/index.js +0 -4
  836. package/node_modules/zod/v4/classic/iso.cjs +0 -60
  837. package/node_modules/zod/v4/classic/iso.d.cts +0 -22
  838. package/node_modules/zod/v4/classic/iso.d.ts +0 -22
  839. package/node_modules/zod/v4/classic/iso.js +0 -30
  840. package/node_modules/zod/v4/classic/parse.cjs +0 -32
  841. package/node_modules/zod/v4/classic/parse.d.cts +0 -23
  842. package/node_modules/zod/v4/classic/parse.d.ts +0 -23
  843. package/node_modules/zod/v4/classic/parse.js +0 -6
  844. package/node_modules/zod/v4/classic/schemas.cjs +0 -1109
  845. package/node_modules/zod/v4/classic/schemas.d.cts +0 -630
  846. package/node_modules/zod/v4/classic/schemas.d.ts +0 -630
  847. package/node_modules/zod/v4/classic/schemas.js +0 -1006
  848. package/node_modules/zod/v4/core/api.cjs +0 -1039
  849. package/node_modules/zod/v4/core/api.d.cts +0 -284
  850. package/node_modules/zod/v4/core/api.d.ts +0 -284
  851. package/node_modules/zod/v4/core/api.js +0 -906
  852. package/node_modules/zod/v4/core/checks.cjs +0 -591
  853. package/node_modules/zod/v4/core/checks.d.cts +0 -278
  854. package/node_modules/zod/v4/core/checks.d.ts +0 -278
  855. package/node_modules/zod/v4/core/checks.js +0 -565
  856. package/node_modules/zod/v4/core/core.cjs +0 -67
  857. package/node_modules/zod/v4/core/core.d.cts +0 -49
  858. package/node_modules/zod/v4/core/core.d.ts +0 -49
  859. package/node_modules/zod/v4/core/core.js +0 -61
  860. package/node_modules/zod/v4/core/doc.cjs +0 -39
  861. package/node_modules/zod/v4/core/doc.d.cts +0 -14
  862. package/node_modules/zod/v4/core/doc.d.ts +0 -14
  863. package/node_modules/zod/v4/core/doc.js +0 -35
  864. package/node_modules/zod/v4/core/errors.cjs +0 -226
  865. package/node_modules/zod/v4/core/errors.d.cts +0 -208
  866. package/node_modules/zod/v4/core/errors.d.ts +0 -208
  867. package/node_modules/zod/v4/core/errors.js +0 -195
  868. package/node_modules/zod/v4/core/function.cjs +0 -102
  869. package/node_modules/zod/v4/core/function.d.cts +0 -52
  870. package/node_modules/zod/v4/core/function.d.ts +0 -52
  871. package/node_modules/zod/v4/core/function.js +0 -75
  872. package/node_modules/zod/v4/core/index.cjs +0 -44
  873. package/node_modules/zod/v4/core/index.d.cts +0 -15
  874. package/node_modules/zod/v4/core/index.d.ts +0 -15
  875. package/node_modules/zod/v4/core/index.js +0 -15
  876. package/node_modules/zod/v4/core/json-schema.cjs +0 -2
  877. package/node_modules/zod/v4/core/json-schema.d.cts +0 -87
  878. package/node_modules/zod/v4/core/json-schema.d.ts +0 -87
  879. package/node_modules/zod/v4/core/json-schema.js +0 -1
  880. package/node_modules/zod/v4/core/parse.cjs +0 -87
  881. package/node_modules/zod/v4/core/parse.d.cts +0 -25
  882. package/node_modules/zod/v4/core/parse.d.ts +0 -25
  883. package/node_modules/zod/v4/core/parse.js +0 -57
  884. package/node_modules/zod/v4/core/regexes.cjs +0 -103
  885. package/node_modules/zod/v4/core/regexes.d.cts +0 -62
  886. package/node_modules/zod/v4/core/regexes.d.ts +0 -62
  887. package/node_modules/zod/v4/core/regexes.js +0 -95
  888. package/node_modules/zod/v4/core/registries.cjs +0 -56
  889. package/node_modules/zod/v4/core/registries.d.cts +0 -35
  890. package/node_modules/zod/v4/core/registries.d.ts +0 -35
  891. package/node_modules/zod/v4/core/registries.js +0 -51
  892. package/node_modules/zod/v4/core/schemas.cjs +0 -1748
  893. package/node_modules/zod/v4/core/schemas.d.cts +0 -1041
  894. package/node_modules/zod/v4/core/schemas.d.ts +0 -1041
  895. package/node_modules/zod/v4/core/schemas.js +0 -1717
  896. package/node_modules/zod/v4/core/standard-schema.cjs +0 -2
  897. package/node_modules/zod/v4/core/standard-schema.d.cts +0 -55
  898. package/node_modules/zod/v4/core/standard-schema.d.ts +0 -55
  899. package/node_modules/zod/v4/core/standard-schema.js +0 -1
  900. package/node_modules/zod/v4/core/to-json-schema.cjs +0 -854
  901. package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -88
  902. package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -88
  903. package/node_modules/zod/v4/core/to-json-schema.js +0 -849
  904. package/node_modules/zod/v4/core/util.cjs +0 -539
  905. package/node_modules/zod/v4/core/util.d.cts +0 -183
  906. package/node_modules/zod/v4/core/util.d.ts +0 -183
  907. package/node_modules/zod/v4/core/util.js +0 -493
  908. package/node_modules/zod/v4/core/versions.cjs +0 -8
  909. package/node_modules/zod/v4/core/versions.d.cts +0 -5
  910. package/node_modules/zod/v4/core/versions.d.ts +0 -5
  911. package/node_modules/zod/v4/core/versions.js +0 -5
  912. package/node_modules/zod/v4/index.cjs +0 -22
  913. package/node_modules/zod/v4/index.d.cts +0 -3
  914. package/node_modules/zod/v4/index.d.ts +0 -3
  915. package/node_modules/zod/v4/index.js +0 -3
  916. package/node_modules/zod/v4/locales/ar.cjs +0 -142
  917. package/node_modules/zod/v4/locales/ar.d.cts +0 -4
  918. package/node_modules/zod/v4/locales/ar.d.ts +0 -4
  919. package/node_modules/zod/v4/locales/ar.js +0 -116
  920. package/node_modules/zod/v4/locales/az.cjs +0 -141
  921. package/node_modules/zod/v4/locales/az.d.cts +0 -4
  922. package/node_modules/zod/v4/locales/az.d.ts +0 -4
  923. package/node_modules/zod/v4/locales/az.js +0 -115
  924. package/node_modules/zod/v4/locales/be.cjs +0 -190
  925. package/node_modules/zod/v4/locales/be.d.cts +0 -4
  926. package/node_modules/zod/v4/locales/be.d.ts +0 -4
  927. package/node_modules/zod/v4/locales/be.js +0 -164
  928. package/node_modules/zod/v4/locales/ca.cjs +0 -144
  929. package/node_modules/zod/v4/locales/ca.d.cts +0 -4
  930. package/node_modules/zod/v4/locales/ca.d.ts +0 -4
  931. package/node_modules/zod/v4/locales/ca.js +0 -118
  932. package/node_modules/zod/v4/locales/cs.cjs +0 -161
  933. package/node_modules/zod/v4/locales/cs.d.cts +0 -4
  934. package/node_modules/zod/v4/locales/cs.d.ts +0 -4
  935. package/node_modules/zod/v4/locales/cs.js +0 -135
  936. package/node_modules/zod/v4/locales/de.cjs +0 -142
  937. package/node_modules/zod/v4/locales/de.d.cts +0 -4
  938. package/node_modules/zod/v4/locales/de.d.ts +0 -4
  939. package/node_modules/zod/v4/locales/de.js +0 -116
  940. package/node_modules/zod/v4/locales/en.cjs +0 -145
  941. package/node_modules/zod/v4/locales/en.d.cts +0 -5
  942. package/node_modules/zod/v4/locales/en.d.ts +0 -5
  943. package/node_modules/zod/v4/locales/en.js +0 -117
  944. package/node_modules/zod/v4/locales/eo.cjs +0 -144
  945. package/node_modules/zod/v4/locales/eo.d.cts +0 -5
  946. package/node_modules/zod/v4/locales/eo.d.ts +0 -5
  947. package/node_modules/zod/v4/locales/eo.js +0 -116
  948. package/node_modules/zod/v4/locales/es.cjs +0 -143
  949. package/node_modules/zod/v4/locales/es.d.cts +0 -4
  950. package/node_modules/zod/v4/locales/es.d.ts +0 -4
  951. package/node_modules/zod/v4/locales/es.js +0 -117
  952. package/node_modules/zod/v4/locales/fa.cjs +0 -148
  953. package/node_modules/zod/v4/locales/fa.d.cts +0 -4
  954. package/node_modules/zod/v4/locales/fa.d.ts +0 -4
  955. package/node_modules/zod/v4/locales/fa.js +0 -122
  956. package/node_modules/zod/v4/locales/fi.cjs +0 -148
  957. package/node_modules/zod/v4/locales/fi.d.cts +0 -4
  958. package/node_modules/zod/v4/locales/fi.d.ts +0 -4
  959. package/node_modules/zod/v4/locales/fi.js +0 -122
  960. package/node_modules/zod/v4/locales/fr-CA.cjs +0 -143
  961. package/node_modules/zod/v4/locales/fr-CA.d.cts +0 -4
  962. package/node_modules/zod/v4/locales/fr-CA.d.ts +0 -4
  963. package/node_modules/zod/v4/locales/fr-CA.js +0 -117
  964. package/node_modules/zod/v4/locales/fr.cjs +0 -142
  965. package/node_modules/zod/v4/locales/fr.d.cts +0 -4
  966. package/node_modules/zod/v4/locales/fr.d.ts +0 -4
  967. package/node_modules/zod/v4/locales/fr.js +0 -116
  968. package/node_modules/zod/v4/locales/he.cjs +0 -143
  969. package/node_modules/zod/v4/locales/he.d.cts +0 -4
  970. package/node_modules/zod/v4/locales/he.d.ts +0 -4
  971. package/node_modules/zod/v4/locales/he.js +0 -117
  972. package/node_modules/zod/v4/locales/hu.cjs +0 -143
  973. package/node_modules/zod/v4/locales/hu.d.cts +0 -4
  974. package/node_modules/zod/v4/locales/hu.d.ts +0 -4
  975. package/node_modules/zod/v4/locales/hu.js +0 -117
  976. package/node_modules/zod/v4/locales/id.cjs +0 -142
  977. package/node_modules/zod/v4/locales/id.d.cts +0 -4
  978. package/node_modules/zod/v4/locales/id.d.ts +0 -4
  979. package/node_modules/zod/v4/locales/id.js +0 -116
  980. package/node_modules/zod/v4/locales/index.cjs +0 -84
  981. package/node_modules/zod/v4/locales/index.d.cts +0 -39
  982. package/node_modules/zod/v4/locales/index.d.ts +0 -39
  983. package/node_modules/zod/v4/locales/index.js +0 -39
  984. package/node_modules/zod/v4/locales/it.cjs +0 -143
  985. package/node_modules/zod/v4/locales/it.d.cts +0 -4
  986. package/node_modules/zod/v4/locales/it.d.ts +0 -4
  987. package/node_modules/zod/v4/locales/it.js +0 -117
  988. package/node_modules/zod/v4/locales/ja.cjs +0 -141
  989. package/node_modules/zod/v4/locales/ja.d.cts +0 -4
  990. package/node_modules/zod/v4/locales/ja.d.ts +0 -4
  991. package/node_modules/zod/v4/locales/ja.js +0 -115
  992. package/node_modules/zod/v4/locales/kh.cjs +0 -143
  993. package/node_modules/zod/v4/locales/kh.d.cts +0 -4
  994. package/node_modules/zod/v4/locales/kh.d.ts +0 -4
  995. package/node_modules/zod/v4/locales/kh.js +0 -117
  996. package/node_modules/zod/v4/locales/ko.cjs +0 -147
  997. package/node_modules/zod/v4/locales/ko.d.cts +0 -4
  998. package/node_modules/zod/v4/locales/ko.d.ts +0 -4
  999. package/node_modules/zod/v4/locales/ko.js +0 -121
  1000. package/node_modules/zod/v4/locales/mk.cjs +0 -144
  1001. package/node_modules/zod/v4/locales/mk.d.cts +0 -4
  1002. package/node_modules/zod/v4/locales/mk.d.ts +0 -4
  1003. package/node_modules/zod/v4/locales/mk.js +0 -118
  1004. package/node_modules/zod/v4/locales/ms.cjs +0 -142
  1005. package/node_modules/zod/v4/locales/ms.d.cts +0 -4
  1006. package/node_modules/zod/v4/locales/ms.d.ts +0 -4
  1007. package/node_modules/zod/v4/locales/ms.js +0 -116
  1008. package/node_modules/zod/v4/locales/nl.cjs +0 -143
  1009. package/node_modules/zod/v4/locales/nl.d.cts +0 -4
  1010. package/node_modules/zod/v4/locales/nl.d.ts +0 -4
  1011. package/node_modules/zod/v4/locales/nl.js +0 -117
  1012. package/node_modules/zod/v4/locales/no.cjs +0 -142
  1013. package/node_modules/zod/v4/locales/no.d.cts +0 -4
  1014. package/node_modules/zod/v4/locales/no.d.ts +0 -4
  1015. package/node_modules/zod/v4/locales/no.js +0 -116
  1016. package/node_modules/zod/v4/locales/ota.cjs +0 -143
  1017. package/node_modules/zod/v4/locales/ota.d.cts +0 -4
  1018. package/node_modules/zod/v4/locales/ota.d.ts +0 -4
  1019. package/node_modules/zod/v4/locales/ota.js +0 -117
  1020. package/node_modules/zod/v4/locales/pl.cjs +0 -143
  1021. package/node_modules/zod/v4/locales/pl.d.cts +0 -4
  1022. package/node_modules/zod/v4/locales/pl.d.ts +0 -4
  1023. package/node_modules/zod/v4/locales/pl.js +0 -117
  1024. package/node_modules/zod/v4/locales/ps.cjs +0 -148
  1025. package/node_modules/zod/v4/locales/ps.d.cts +0 -4
  1026. package/node_modules/zod/v4/locales/ps.d.ts +0 -4
  1027. package/node_modules/zod/v4/locales/ps.js +0 -122
  1028. package/node_modules/zod/v4/locales/pt.cjs +0 -142
  1029. package/node_modules/zod/v4/locales/pt.d.cts +0 -4
  1030. package/node_modules/zod/v4/locales/pt.d.ts +0 -4
  1031. package/node_modules/zod/v4/locales/pt.js +0 -116
  1032. package/node_modules/zod/v4/locales/ru.cjs +0 -190
  1033. package/node_modules/zod/v4/locales/ru.d.cts +0 -4
  1034. package/node_modules/zod/v4/locales/ru.d.ts +0 -4
  1035. package/node_modules/zod/v4/locales/ru.js +0 -164
  1036. package/node_modules/zod/v4/locales/sl.cjs +0 -143
  1037. package/node_modules/zod/v4/locales/sl.d.cts +0 -4
  1038. package/node_modules/zod/v4/locales/sl.d.ts +0 -4
  1039. package/node_modules/zod/v4/locales/sl.js +0 -117
  1040. package/node_modules/zod/v4/locales/sv.cjs +0 -144
  1041. package/node_modules/zod/v4/locales/sv.d.cts +0 -4
  1042. package/node_modules/zod/v4/locales/sv.d.ts +0 -4
  1043. package/node_modules/zod/v4/locales/sv.js +0 -118
  1044. package/node_modules/zod/v4/locales/ta.cjs +0 -143
  1045. package/node_modules/zod/v4/locales/ta.d.cts +0 -4
  1046. package/node_modules/zod/v4/locales/ta.d.ts +0 -4
  1047. package/node_modules/zod/v4/locales/ta.js +0 -117
  1048. package/node_modules/zod/v4/locales/th.cjs +0 -143
  1049. package/node_modules/zod/v4/locales/th.d.cts +0 -4
  1050. package/node_modules/zod/v4/locales/th.d.ts +0 -4
  1051. package/node_modules/zod/v4/locales/th.js +0 -117
  1052. package/node_modules/zod/v4/locales/tr.cjs +0 -143
  1053. package/node_modules/zod/v4/locales/tr.d.cts +0 -5
  1054. package/node_modules/zod/v4/locales/tr.d.ts +0 -5
  1055. package/node_modules/zod/v4/locales/tr.js +0 -115
  1056. package/node_modules/zod/v4/locales/ua.cjs +0 -143
  1057. package/node_modules/zod/v4/locales/ua.d.cts +0 -4
  1058. package/node_modules/zod/v4/locales/ua.d.ts +0 -4
  1059. package/node_modules/zod/v4/locales/ua.js +0 -117
  1060. package/node_modules/zod/v4/locales/ur.cjs +0 -143
  1061. package/node_modules/zod/v4/locales/ur.d.cts +0 -4
  1062. package/node_modules/zod/v4/locales/ur.d.ts +0 -4
  1063. package/node_modules/zod/v4/locales/ur.js +0 -117
  1064. package/node_modules/zod/v4/locales/vi.cjs +0 -142
  1065. package/node_modules/zod/v4/locales/vi.d.cts +0 -4
  1066. package/node_modules/zod/v4/locales/vi.d.ts +0 -4
  1067. package/node_modules/zod/v4/locales/vi.js +0 -116
  1068. package/node_modules/zod/v4/locales/zh-CN.cjs +0 -142
  1069. package/node_modules/zod/v4/locales/zh-CN.d.cts +0 -4
  1070. package/node_modules/zod/v4/locales/zh-CN.d.ts +0 -4
  1071. package/node_modules/zod/v4/locales/zh-CN.js +0 -116
  1072. package/node_modules/zod/v4/locales/zh-TW.cjs +0 -143
  1073. package/node_modules/zod/v4/locales/zh-TW.d.cts +0 -4
  1074. package/node_modules/zod/v4/locales/zh-TW.d.ts +0 -4
  1075. package/node_modules/zod/v4/locales/zh-TW.js +0 -117
  1076. package/node_modules/zod/v4/mini/checks.cjs +0 -34
  1077. package/node_modules/zod/v4/mini/checks.d.cts +0 -1
  1078. package/node_modules/zod/v4/mini/checks.d.ts +0 -1
  1079. package/node_modules/zod/v4/mini/checks.js +0 -1
  1080. package/node_modules/zod/v4/mini/coerce.cjs +0 -47
  1081. package/node_modules/zod/v4/mini/coerce.d.cts +0 -7
  1082. package/node_modules/zod/v4/mini/coerce.d.ts +0 -7
  1083. package/node_modules/zod/v4/mini/coerce.js +0 -17
  1084. package/node_modules/zod/v4/mini/external.cjs +0 -62
  1085. package/node_modules/zod/v4/mini/external.d.cts +0 -11
  1086. package/node_modules/zod/v4/mini/external.d.ts +0 -11
  1087. package/node_modules/zod/v4/mini/external.js +0 -13
  1088. package/node_modules/zod/v4/mini/index.cjs +0 -32
  1089. package/node_modules/zod/v4/mini/index.d.cts +0 -3
  1090. package/node_modules/zod/v4/mini/index.d.ts +0 -3
  1091. package/node_modules/zod/v4/mini/index.js +0 -3
  1092. package/node_modules/zod/v4/mini/iso.cjs +0 -60
  1093. package/node_modules/zod/v4/mini/iso.d.cts +0 -22
  1094. package/node_modules/zod/v4/mini/iso.d.ts +0 -22
  1095. package/node_modules/zod/v4/mini/iso.js +0 -30
  1096. package/node_modules/zod/v4/mini/parse.cjs +0 -8
  1097. package/node_modules/zod/v4/mini/parse.d.cts +0 -1
  1098. package/node_modules/zod/v4/mini/parse.d.ts +0 -1
  1099. package/node_modules/zod/v4/mini/parse.js +0 -1
  1100. package/node_modules/zod/v4/mini/schemas.cjs +0 -839
  1101. package/node_modules/zod/v4/mini/schemas.d.cts +0 -356
  1102. package/node_modules/zod/v4/mini/schemas.d.ts +0 -356
  1103. package/node_modules/zod/v4/mini/schemas.js +0 -732
  1104. package/node_modules/zod/v4-mini/index.cjs +0 -17
  1105. package/node_modules/zod/v4-mini/index.d.cts +0 -1
  1106. package/node_modules/zod/v4-mini/index.d.ts +0 -1
  1107. package/node_modules/zod/v4-mini/index.js +0 -1
  1108. package/src/lib/insforge-client.js +0 -79
  1109. package/src/lib/insforge.js +0 -29
  1110. package/src/lib/uploader.js +0 -224
  1111. package/src/lib/vibeusage-api.js +0 -243
  1112. package/src/lib/vibeusage-public-repo.js +0 -105
@@ -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;