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,3842 +0,0 @@
1
- import type { $ZodTypeDiscriminable } from "./api.js";
2
- import * as checks from "./checks.js";
3
- import * as core from "./core.js";
4
- import { Doc } from "./doc.js";
5
- import type * as errors from "./errors.js";
6
- import { safeParse, safeParseAsync } from "./parse.js";
7
- import * as regexes from "./regexes.js";
8
- import type { StandardSchemaV1 } from "./standard-schema.js";
9
- import * as util from "./util.js";
10
- import { version } from "./versions.js";
11
-
12
- ///////////////////////////// PARSE //////////////////////////////
13
-
14
- export interface ParseContext<T extends errors.$ZodIssueBase = never> {
15
- /** Customize error messages. */
16
- readonly error?: errors.$ZodErrorMap<T>;
17
- /** Include the `input` field in issue objects. Default `false`. */
18
- readonly reportInput?: boolean;
19
- /** Skip eval-based fast path. Default `false`. */
20
- readonly jitless?: boolean;
21
- /** Abort validation after the first error. Default `false`. */
22
- // readonly abortEarly?: boolean;
23
- }
24
-
25
- /** @internal */
26
- export interface ParseContextInternal<T extends errors.$ZodIssueBase = never> extends ParseContext<T> {
27
- readonly async?: boolean | undefined;
28
- }
29
-
30
- export interface ParsePayload<T = unknown> {
31
- value: T;
32
- issues: errors.$ZodRawIssue[];
33
- }
34
-
35
- export type CheckFn<T> = (input: ParsePayload<T>) => util.MaybeAsync<void>;
36
-
37
- ///////////////////////////// SCHEMAS //////////////////////////////
38
-
39
- export interface $ZodTypeDef {
40
- type:
41
- | "string"
42
- | "number"
43
- | "int"
44
- | "boolean"
45
- | "bigint"
46
- | "symbol"
47
- | "null"
48
- | "undefined"
49
- | "void" // merge with undefined?
50
- | "never"
51
- | "any"
52
- | "unknown"
53
- | "date"
54
- | "object"
55
- | "record"
56
- | "file"
57
- | "array"
58
- | "tuple"
59
- | "union"
60
- | "intersection"
61
- | "map"
62
- | "set"
63
- | "enum"
64
- | "literal"
65
- | "nullable"
66
- | "optional"
67
- | "nonoptional"
68
- | "success"
69
- | "transform"
70
- | "default"
71
- | "prefault"
72
- | "catch"
73
- | "nan"
74
- | "pipe"
75
- | "readonly"
76
- | "template_literal"
77
- | "promise"
78
- | "lazy"
79
- | "custom";
80
- error?: errors.$ZodErrorMap<never> | undefined;
81
- checks?: checks.$ZodCheck<never>[];
82
- }
83
-
84
- export interface _$ZodTypeInternals {
85
- /** The `@zod/core` version of this schema */
86
- version: typeof version;
87
-
88
- /** Schema definition. */
89
- def: $ZodTypeDef;
90
- // types: Types;
91
-
92
- /** @internal Randomly generated ID for this schema. */
93
- // id: string;
94
-
95
- /** @internal List of deferred initializers. */
96
- deferred: util.AnyFunc[] | undefined;
97
-
98
- /** @internal Parses input and runs all checks (refinements). */
99
- run(payload: ParsePayload<any>, ctx: ParseContextInternal): util.MaybeAsync<ParsePayload>;
100
-
101
- /** @internal Parses input, doesn't run checks. */
102
- parse(payload: ParsePayload<any>, ctx: ParseContextInternal): util.MaybeAsync<ParsePayload>;
103
-
104
- /** @internal Stores identifiers for the set of traits implemented by this schema. */
105
- traits: Set<string>;
106
-
107
- /** @internal Indicates that a schema output type should be considered optional inside objects.
108
- * @default Required
109
- */
110
-
111
- /** @internal */
112
- optin?: "optional" | undefined;
113
- /** @internal */
114
- optout?: "optional" | undefined;
115
-
116
- /** @internal The set of literal values that will pass validation. Must be an exhaustive set. Used to determine optionality in z.record().
117
- *
118
- * Defined on: enum, const, literal, null, undefined
119
- * Passthrough: optional, nullable, branded, default, catch, pipe
120
- * Todo: unions?
121
- */
122
- values?: util.PrimitiveSet | undefined;
123
-
124
- /** @internal A set of literal discriminators used for the fast path in discriminated unions. */
125
- propValues?: util.PropValues | undefined;
126
-
127
- /** @internal This flag indicates that a schema validation can be represented with a regular expression. Used to determine allowable schemas in z.templateLiteral(). */
128
- pattern: RegExp | undefined;
129
-
130
- /** @internal The constructor function of this schema. */
131
- constr: new (
132
- def: any
133
- ) => $ZodType;
134
-
135
- /** @internal A catchall object for bag metadata related to this schema. Commonly modified by checks using `onattach`. */
136
- bag: Record<string, unknown>;
137
-
138
- /** @internal The set of issues this schema might throw during type checking. */
139
- isst: errors.$ZodIssueBase;
140
-
141
- /** An optional method used to override `toJSONSchema` logic. */
142
- toJSONSchema?: () => unknown;
143
-
144
- /** @internal The parent of this schema. Only set during certain clone operations. */
145
- parent?: $ZodType | undefined;
146
- }
147
- /** @internal */
148
- export interface $ZodTypeInternals<out O = unknown, out I = unknown> extends _$ZodTypeInternals {
149
- /** @internal The inferred output type */
150
- output: O; //extends { $out: infer O } ? O : Out;
151
- /** @internal The inferred input type */
152
- input: I; //extends { $in: infer I } ? I : In;
153
- }
154
-
155
- export type $ZodStandardSchema<T> = StandardSchemaV1.Props<core.input<T>, core.output<T>>;
156
-
157
- export type SomeType = { _zod: _$ZodTypeInternals };
158
-
159
- export interface $ZodType<
160
- O = unknown,
161
- I = unknown,
162
- Internals extends $ZodTypeInternals<O, I> = $ZodTypeInternals<O, I>,
163
- > {
164
- _zod: Internals;
165
- "~standard": $ZodStandardSchema<this>;
166
- }
167
- export interface _$ZodType<T extends $ZodTypeInternals = $ZodTypeInternals>
168
- extends $ZodType<T["output"], T["input"], T> {
169
- // _zod: T;
170
- }
171
-
172
- export const $ZodType: core.$constructor<$ZodType> = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def) => {
173
- inst ??= {} as any;
174
-
175
- inst._zod.def = def; // set _def property
176
- inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
177
- inst._zod.version = version;
178
-
179
- const checks = [...(inst._zod.def.checks ?? [])];
180
-
181
- // if inst is itself a checks.$ZodCheck, run it as a check
182
- if (inst._zod.traits.has("$ZodCheck")) {
183
- checks.unshift(inst as any);
184
- }
185
- //
186
-
187
- for (const ch of checks) {
188
- for (const fn of ch._zod.onattach) {
189
- fn(inst);
190
- }
191
- }
192
-
193
- if (checks.length === 0) {
194
- // deferred initializer
195
- // inst._zod.parse is not yet defined
196
- inst._zod.deferred ??= [];
197
- inst._zod.deferred?.push(() => {
198
- inst._zod.run = inst._zod.parse;
199
- });
200
- } else {
201
- const runChecks = (
202
- payload: ParsePayload,
203
- checks: checks.$ZodCheck<never>[],
204
- ctx?: ParseContextInternal | undefined
205
- ): util.MaybeAsync<ParsePayload> => {
206
- let isAborted = util.aborted(payload);
207
-
208
- let asyncResult!: Promise<unknown> | undefined;
209
- for (const ch of checks) {
210
- if (ch._zod.def.when) {
211
- const shouldRun = ch._zod.def.when(payload);
212
- if (!shouldRun) continue;
213
- } else if (isAborted) {
214
- continue;
215
- }
216
- const currLen = payload.issues.length;
217
- const _ = ch._zod.check(payload as any) as any as ParsePayload;
218
-
219
- if (_ instanceof Promise && ctx?.async === false) {
220
- throw new core.$ZodAsyncError();
221
- }
222
- if (asyncResult || _ instanceof Promise) {
223
- asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
224
- await _;
225
- const nextLen = payload.issues.length;
226
- if (nextLen === currLen) return;
227
- if (!isAborted) isAborted = util.aborted(payload, currLen);
228
- });
229
- } else {
230
- const nextLen = payload.issues.length;
231
- if (nextLen === currLen) continue;
232
- if (!isAborted) isAborted = util.aborted(payload, currLen);
233
- }
234
- }
235
-
236
- if (asyncResult) {
237
- return asyncResult.then(() => {
238
- return payload;
239
- });
240
- }
241
- return payload;
242
- };
243
-
244
- inst._zod.run = (payload, ctx) => {
245
- const result = inst._zod.parse(payload, ctx);
246
-
247
- if (result instanceof Promise) {
248
- if (ctx.async === false) throw new core.$ZodAsyncError();
249
- return result.then((result) => runChecks(result, checks, ctx));
250
- }
251
-
252
- return runChecks(result, checks, ctx);
253
- };
254
- }
255
-
256
- inst["~standard"] = {
257
- validate: (value: unknown) => {
258
- try {
259
- const r = safeParse(inst, value);
260
- return r.success ? { value: r.data } : { issues: r.error?.issues };
261
- } catch (_) {
262
- return safeParseAsync(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
263
- }
264
- },
265
- vendor: "zod",
266
- version: 1 as const,
267
- };
268
- });
269
-
270
- export { clone } from "./util.js";
271
-
272
- //////////////////////////////////////////
273
- //////////////////////////////////////////
274
- ////////// //////////
275
- ////////// $ZodString //////////
276
- ////////// //////////
277
- //////////////////////////////////////////
278
- //////////////////////////////////////////
279
- export interface $ZodStringDef extends $ZodTypeDef {
280
- type: "string";
281
- coerce?: boolean;
282
- checks?: checks.$ZodCheck<string>[];
283
- }
284
-
285
- export interface $ZodStringInternals<Input> extends $ZodTypeInternals<string, Input> {
286
- def: $ZodStringDef;
287
- /** @deprecated Internal API, use with caution (not deprecated) */
288
- pattern: RegExp;
289
-
290
- /** @deprecated Internal API, use with caution (not deprecated) */
291
- isst: errors.$ZodIssueInvalidType;
292
- bag: util.LoosePartial<{
293
- minimum: number;
294
- maximum: number;
295
- patterns: Set<RegExp>;
296
- format: string;
297
- contentEncoding: string;
298
- }>;
299
- }
300
-
301
- export interface $ZodString<Input = unknown> extends _$ZodType<$ZodStringInternals<Input>> {
302
- // _zod: $ZodStringInternals<Input>;
303
- }
304
-
305
- export const $ZodString: core.$constructor<$ZodString> = /*@__PURE__*/ core.$constructor("$ZodString", (inst, def) => {
306
- $ZodType.init(inst, def);
307
- inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? regexes.string(inst._zod.bag);
308
- inst._zod.parse = (payload, _) => {
309
- if (def.coerce)
310
- try {
311
- payload.value = String(payload.value);
312
- } catch (_) {}
313
-
314
- if (typeof payload.value === "string") return payload;
315
-
316
- payload.issues.push({
317
- expected: "string",
318
- code: "invalid_type",
319
- input: payload.value,
320
- inst,
321
- });
322
- return payload;
323
- };
324
- });
325
-
326
- ////////////////////////////// ZodStringFormat //////////////////////////////
327
-
328
- export interface $ZodStringFormatDef<Format extends string = string>
329
- extends $ZodStringDef,
330
- checks.$ZodCheckStringFormatDef<Format> {}
331
-
332
- export interface $ZodStringFormatInternals<Format extends string = string>
333
- extends $ZodStringInternals<string>,
334
- checks.$ZodCheckStringFormatInternals {
335
- def: $ZodStringFormatDef<Format>;
336
- }
337
- export interface $ZodStringFormat<Format extends string = string> extends $ZodType {
338
- _zod: $ZodStringFormatInternals<Format>;
339
- }
340
-
341
- export const $ZodStringFormat: core.$constructor<$ZodStringFormat> = /*@__PURE__*/ core.$constructor(
342
- "$ZodStringFormat",
343
- (inst, def): void => {
344
- // check initialization must come first
345
- checks.$ZodCheckStringFormat.init(inst, def);
346
- $ZodString.init(inst, def);
347
- }
348
- );
349
-
350
- ////////////////////////////// ZodGUID //////////////////////////////
351
- export interface $ZodGUIDDef extends $ZodStringFormatDef<"guid"> {}
352
- export interface $ZodGUIDInternals extends $ZodStringFormatInternals<"guid"> {}
353
-
354
- export interface $ZodGUID extends $ZodType {
355
- _zod: $ZodGUIDInternals;
356
- }
357
-
358
- export const $ZodGUID: core.$constructor<$ZodGUID> = /*@__PURE__*/ core.$constructor("$ZodGUID", (inst, def): void => {
359
- def.pattern ??= regexes.guid;
360
- $ZodStringFormat.init(inst, def);
361
- });
362
-
363
- ////////////////////////////// ZodUUID //////////////////////////////
364
-
365
- export interface $ZodUUIDDef extends $ZodStringFormatDef<"uuid"> {
366
- version?: "v1" | "v2" | "v3" | "v4" | "v5" | "v6" | "v7" | "v8";
367
- }
368
-
369
- export interface $ZodUUIDInternals extends $ZodStringFormatInternals<"uuid"> {
370
- def: $ZodUUIDDef;
371
- }
372
-
373
- export interface $ZodUUID extends $ZodType {
374
- _zod: $ZodUUIDInternals;
375
- }
376
-
377
- export const $ZodUUID: core.$constructor<$ZodUUID> = /*@__PURE__*/ core.$constructor("$ZodUUID", (inst, def): void => {
378
- if (def.version) {
379
- const versionMap: Record<string, number> = {
380
- v1: 1,
381
- v2: 2,
382
- v3: 3,
383
- v4: 4,
384
- v5: 5,
385
- v6: 6,
386
- v7: 7,
387
- v8: 8,
388
- };
389
- const v = versionMap[def.version];
390
- if (v === undefined) throw new Error(`Invalid UUID version: "${def.version}"`);
391
- def.pattern ??= regexes.uuid(v);
392
- } else def.pattern ??= regexes.uuid();
393
- $ZodStringFormat.init(inst, def);
394
- });
395
-
396
- ////////////////////////////// ZodEmail //////////////////////////////
397
-
398
- export interface $ZodEmailDef extends $ZodStringFormatDef<"email"> {}
399
- export interface $ZodEmailInternals extends $ZodStringFormatInternals<"email"> {}
400
- export interface $ZodEmail extends $ZodType {
401
- _zod: $ZodEmailInternals;
402
- }
403
-
404
- export const $ZodEmail: core.$constructor<$ZodEmail> = /*@__PURE__*/ core.$constructor(
405
- "$ZodEmail",
406
- (inst, def): void => {
407
- def.pattern ??= regexes.email;
408
- $ZodStringFormat.init(inst, def);
409
- }
410
- );
411
-
412
- ////////////////////////////// ZodURL //////////////////////////////
413
-
414
- export interface $ZodURLDef extends $ZodStringFormatDef<"url"> {
415
- hostname?: RegExp | undefined;
416
- protocol?: RegExp | undefined;
417
- }
418
- export interface $ZodURLInternals extends $ZodStringFormatInternals<"url"> {
419
- def: $ZodURLDef;
420
- }
421
-
422
- export interface $ZodURL extends $ZodType {
423
- _zod: $ZodURLInternals;
424
- }
425
-
426
- export const $ZodURL: core.$constructor<$ZodURL> = /*@__PURE__*/ core.$constructor("$ZodURL", (inst, def) => {
427
- $ZodStringFormat.init(inst, def);
428
- inst._zod.check = (payload) => {
429
- try {
430
- const orig = payload.value;
431
- const url = new URL(orig);
432
- const href = url.href;
433
-
434
- if (def.hostname) {
435
- def.hostname.lastIndex = 0;
436
- if (!def.hostname.test(url.hostname)) {
437
- payload.issues.push({
438
- code: "invalid_format",
439
- format: "url",
440
- note: "Invalid hostname",
441
- pattern: regexes.hostname.source,
442
- input: payload.value,
443
- inst,
444
- continue: !def.abort,
445
- });
446
- }
447
- }
448
-
449
- if (def.protocol) {
450
- def.protocol.lastIndex = 0;
451
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
452
- payload.issues.push({
453
- code: "invalid_format",
454
- format: "url",
455
- note: "Invalid protocol",
456
- pattern: def.protocol.source,
457
- input: payload.value,
458
- inst,
459
- continue: !def.abort,
460
- });
461
- }
462
- }
463
-
464
- // payload.value = url.href;
465
- if (!orig.endsWith("/") && href.endsWith("/")) {
466
- payload.value = href.slice(0, -1);
467
- } else {
468
- payload.value = href;
469
- }
470
-
471
- return;
472
- } catch (_) {
473
- payload.issues.push({
474
- code: "invalid_format",
475
- format: "url",
476
- input: payload.value,
477
- inst,
478
- continue: !def.abort,
479
- });
480
- }
481
- };
482
- });
483
-
484
- ////////////////////////////// ZodEmoji //////////////////////////////
485
-
486
- export interface $ZodEmojiDef extends $ZodStringFormatDef<"emoji"> {}
487
- export interface $ZodEmojiInternals extends $ZodStringFormatInternals<"emoji"> {}
488
-
489
- export interface $ZodEmoji extends $ZodType {
490
- _zod: $ZodEmojiInternals;
491
- }
492
-
493
- export const $ZodEmoji: core.$constructor<$ZodEmoji> = /*@__PURE__*/ core.$constructor(
494
- "$ZodEmoji",
495
- (inst, def): void => {
496
- def.pattern ??= regexes.emoji();
497
- $ZodStringFormat.init(inst, def);
498
- }
499
- );
500
-
501
- ////////////////////////////// ZodNanoID //////////////////////////////
502
-
503
- export interface $ZodNanoIDDef extends $ZodStringFormatDef<"nanoid"> {}
504
- export interface $ZodNanoIDInternals extends $ZodStringFormatInternals<"nanoid"> {}
505
-
506
- export interface $ZodNanoID extends $ZodType {
507
- _zod: $ZodNanoIDInternals;
508
- }
509
-
510
- export const $ZodNanoID: core.$constructor<$ZodNanoID> = /*@__PURE__*/ core.$constructor(
511
- "$ZodNanoID",
512
- (inst, def): void => {
513
- def.pattern ??= regexes.nanoid;
514
- $ZodStringFormat.init(inst, def);
515
- }
516
- );
517
-
518
- ////////////////////////////// ZodCUID //////////////////////////////
519
-
520
- export interface $ZodCUIDDef extends $ZodStringFormatDef<"cuid"> {}
521
- export interface $ZodCUIDInternals extends $ZodStringFormatInternals<"cuid"> {}
522
-
523
- export interface $ZodCUID extends $ZodType {
524
- _zod: $ZodCUIDInternals;
525
- }
526
-
527
- export const $ZodCUID: core.$constructor<$ZodCUID> = /*@__PURE__*/ core.$constructor("$ZodCUID", (inst, def): void => {
528
- def.pattern ??= regexes.cuid;
529
- $ZodStringFormat.init(inst, def);
530
- });
531
-
532
- ////////////////////////////// ZodCUID2 //////////////////////////////
533
-
534
- export interface $ZodCUID2Def extends $ZodStringFormatDef<"cuid2"> {}
535
- export interface $ZodCUID2Internals extends $ZodStringFormatInternals<"cuid2"> {}
536
-
537
- export interface $ZodCUID2 extends $ZodType {
538
- _zod: $ZodCUID2Internals;
539
- }
540
-
541
- export const $ZodCUID2: core.$constructor<$ZodCUID2> = /*@__PURE__*/ core.$constructor(
542
- "$ZodCUID2",
543
- (inst, def): void => {
544
- def.pattern ??= regexes.cuid2;
545
- $ZodStringFormat.init(inst, def);
546
- }
547
- );
548
-
549
- ////////////////////////////// ZodULID //////////////////////////////
550
-
551
- export interface $ZodULIDDef extends $ZodStringFormatDef<"ulid"> {}
552
- export interface $ZodULIDInternals extends $ZodStringFormatInternals<"ulid"> {}
553
-
554
- export interface $ZodULID extends $ZodType {
555
- _zod: $ZodULIDInternals;
556
- }
557
-
558
- export const $ZodULID: core.$constructor<$ZodULID> = /*@__PURE__*/ core.$constructor("$ZodULID", (inst, def): void => {
559
- def.pattern ??= regexes.ulid;
560
- $ZodStringFormat.init(inst, def);
561
- });
562
-
563
- ////////////////////////////// ZodXID //////////////////////////////
564
-
565
- export interface $ZodXIDDef extends $ZodStringFormatDef<"xid"> {}
566
- export interface $ZodXIDInternals extends $ZodStringFormatInternals<"xid"> {}
567
-
568
- export interface $ZodXID extends $ZodType {
569
- _zod: $ZodXIDInternals;
570
- }
571
-
572
- export const $ZodXID: core.$constructor<$ZodXID> = /*@__PURE__*/ core.$constructor("$ZodXID", (inst, def): void => {
573
- def.pattern ??= regexes.xid;
574
- $ZodStringFormat.init(inst, def);
575
- });
576
-
577
- ////////////////////////////// ZodKSUID //////////////////////////////
578
-
579
- export interface $ZodKSUIDDef extends $ZodStringFormatDef<"ksuid"> {}
580
- export interface $ZodKSUIDInternals extends $ZodStringFormatInternals<"ksuid"> {}
581
-
582
- export interface $ZodKSUID extends $ZodType {
583
- _zod: $ZodKSUIDInternals;
584
- }
585
-
586
- export const $ZodKSUID: core.$constructor<$ZodKSUID> = /*@__PURE__*/ core.$constructor(
587
- "$ZodKSUID",
588
- (inst, def): void => {
589
- def.pattern ??= regexes.ksuid;
590
- $ZodStringFormat.init(inst, def);
591
- }
592
- );
593
-
594
- ////////////////////////////// ZodISODateTime //////////////////////////////
595
-
596
- export interface $ZodISODateTimeDef extends $ZodStringFormatDef<"datetime"> {
597
- precision: number | null;
598
- offset: boolean;
599
- local: boolean;
600
- }
601
-
602
- export interface $ZodISODateTimeInternals extends $ZodStringFormatInternals {
603
- def: $ZodISODateTimeDef;
604
- }
605
-
606
- export interface $ZodISODateTime extends $ZodType {
607
- _zod: $ZodISODateTimeInternals;
608
- }
609
-
610
- export const $ZodISODateTime: core.$constructor<$ZodISODateTime> = /*@__PURE__*/ core.$constructor(
611
- "$ZodISODateTime",
612
- (inst, def): void => {
613
- def.pattern ??= regexes.datetime(def);
614
- $ZodStringFormat.init(inst, def);
615
- }
616
- );
617
-
618
- ////////////////////////////// ZodISODate //////////////////////////////
619
-
620
- export interface $ZodISODateDef extends $ZodStringFormatDef<"date"> {}
621
- export interface $ZodISODateInternals extends $ZodStringFormatInternals<"date"> {}
622
-
623
- export interface $ZodISODate extends $ZodType {
624
- _zod: $ZodISODateInternals;
625
- }
626
-
627
- export const $ZodISODate: core.$constructor<$ZodISODate> = /*@__PURE__*/ core.$constructor(
628
- "$ZodISODate",
629
- (inst, def): void => {
630
- def.pattern ??= regexes.date;
631
- $ZodStringFormat.init(inst, def);
632
- }
633
- );
634
-
635
- ////////////////////////////// ZodISOTime //////////////////////////////
636
-
637
- export interface $ZodISOTimeDef extends $ZodStringFormatDef<"time"> {
638
- precision?: number | null;
639
- }
640
-
641
- export interface $ZodISOTimeInternals extends $ZodStringFormatInternals<"time"> {
642
- def: $ZodISOTimeDef;
643
- }
644
-
645
- export interface $ZodISOTime extends $ZodType {
646
- _zod: $ZodISOTimeInternals;
647
- }
648
-
649
- export const $ZodISOTime: core.$constructor<$ZodISOTime> = /*@__PURE__*/ core.$constructor(
650
- "$ZodISOTime",
651
- (inst, def): void => {
652
- def.pattern ??= regexes.time(def);
653
- $ZodStringFormat.init(inst, def);
654
- }
655
- );
656
-
657
- ////////////////////////////// ZodISODuration //////////////////////////////
658
-
659
- export interface $ZodISODurationDef extends $ZodStringFormatDef<"duration"> {}
660
- export interface $ZodISODurationInternals extends $ZodStringFormatInternals<"duration"> {}
661
-
662
- export interface $ZodISODuration extends $ZodType {
663
- _zod: $ZodISODurationInternals;
664
- }
665
-
666
- export const $ZodISODuration: core.$constructor<$ZodISODuration> = /*@__PURE__*/ core.$constructor(
667
- "$ZodISODuration",
668
- (inst, def): void => {
669
- def.pattern ??= regexes.duration;
670
- $ZodStringFormat.init(inst, def);
671
- }
672
- );
673
-
674
- ////////////////////////////// ZodIPv4 //////////////////////////////
675
-
676
- export interface $ZodIPv4Def extends $ZodStringFormatDef<"ipv4"> {
677
- version?: "v4";
678
- }
679
-
680
- export interface $ZodIPv4Internals extends $ZodStringFormatInternals<"ipv4"> {
681
- def: $ZodIPv4Def;
682
- }
683
-
684
- export interface $ZodIPv4 extends $ZodType {
685
- _zod: $ZodIPv4Internals;
686
- }
687
-
688
- export const $ZodIPv4: core.$constructor<$ZodIPv4> = /*@__PURE__*/ core.$constructor("$ZodIPv4", (inst, def): void => {
689
- def.pattern ??= regexes.ipv4;
690
- $ZodStringFormat.init(inst, def);
691
- inst._zod.onattach.push((inst) => {
692
- const bag = inst._zod.bag as $ZodStringInternals<unknown>["bag"];
693
- bag.format = `ipv4`;
694
- });
695
- });
696
-
697
- ////////////////////////////// ZodIPv6 //////////////////////////////
698
-
699
- export interface $ZodIPv6Def extends $ZodStringFormatDef<"ipv6"> {
700
- version?: "v6";
701
- }
702
-
703
- export interface $ZodIPv6Internals extends $ZodStringFormatInternals<"ipv6"> {
704
- def: $ZodIPv6Def;
705
- }
706
-
707
- export interface $ZodIPv6 extends $ZodType {
708
- _zod: $ZodIPv6Internals;
709
- }
710
-
711
- export const $ZodIPv6: core.$constructor<$ZodIPv6> = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def): void => {
712
- def.pattern ??= regexes.ipv6;
713
- $ZodStringFormat.init(inst, def);
714
-
715
- inst._zod.onattach.push((inst) => {
716
- const bag = inst._zod.bag as $ZodStringInternals<unknown>["bag"];
717
- bag.format = `ipv6`;
718
- });
719
-
720
- inst._zod.check = (payload) => {
721
- try {
722
- new URL(`http://[${payload.value}]`);
723
- // return;
724
- } catch {
725
- payload.issues.push({
726
- code: "invalid_format",
727
- format: "ipv6",
728
- input: payload.value,
729
- inst,
730
- continue: !def.abort,
731
- });
732
- }
733
- };
734
- });
735
-
736
- ////////////////////////////// ZodCIDRv4 //////////////////////////////
737
-
738
- export interface $ZodCIDRv4Def extends $ZodStringFormatDef<"cidrv4"> {
739
- version?: "v4";
740
- }
741
-
742
- export interface $ZodCIDRv4Internals extends $ZodStringFormatInternals<"cidrv4"> {
743
- def: $ZodCIDRv4Def;
744
- }
745
-
746
- export interface $ZodCIDRv4 extends $ZodType {
747
- _zod: $ZodCIDRv4Internals;
748
- }
749
-
750
- export const $ZodCIDRv4: core.$constructor<$ZodCIDRv4> = /*@__PURE__*/ core.$constructor(
751
- "$ZodCIDRv4",
752
- (inst, def): void => {
753
- def.pattern ??= regexes.cidrv4;
754
- $ZodStringFormat.init(inst, def);
755
- }
756
- );
757
-
758
- ////////////////////////////// ZodCIDRv6 //////////////////////////////
759
-
760
- export interface $ZodCIDRv6Def extends $ZodStringFormatDef<"cidrv6"> {
761
- version?: "v6";
762
- }
763
-
764
- export interface $ZodCIDRv6Internals extends $ZodStringFormatInternals<"cidrv6"> {
765
- def: $ZodCIDRv6Def;
766
- }
767
-
768
- export interface $ZodCIDRv6 extends $ZodType {
769
- _zod: $ZodCIDRv6Internals;
770
- }
771
-
772
- export const $ZodCIDRv6: core.$constructor<$ZodCIDRv6> = /*@__PURE__*/ core.$constructor(
773
- "$ZodCIDRv6",
774
- (inst, def): void => {
775
- def.pattern ??= regexes.cidrv6; // not used for validation
776
- $ZodStringFormat.init(inst, def);
777
-
778
- inst._zod.check = (payload) => {
779
- const [address, prefix] = payload.value.split("/");
780
- try {
781
- if (!prefix) throw new Error();
782
- const prefixNum = Number(prefix);
783
- if (`${prefixNum}` !== prefix) throw new Error();
784
- if (prefixNum < 0 || prefixNum > 128) throw new Error();
785
- new URL(`http://[${address}]`);
786
- } catch {
787
- payload.issues.push({
788
- code: "invalid_format",
789
- format: "cidrv6",
790
- input: payload.value,
791
- inst,
792
- continue: !def.abort,
793
- });
794
- }
795
- };
796
- }
797
- );
798
-
799
- ////////////////////////////// ZodBase64 //////////////////////////////
800
- export function isValidBase64(data: string): boolean {
801
- if (data === "") return true;
802
- if (data.length % 4 !== 0) return false;
803
- try {
804
- atob(data);
805
- return true;
806
- } catch {
807
- return false;
808
- }
809
- }
810
-
811
- export interface $ZodBase64Def extends $ZodStringFormatDef<"base64"> {}
812
- export interface $ZodBase64Internals extends $ZodStringFormatInternals<"base64"> {}
813
-
814
- export interface $ZodBase64 extends $ZodType {
815
- _zod: $ZodBase64Internals;
816
- }
817
-
818
- export const $ZodBase64: core.$constructor<$ZodBase64> = /*@__PURE__*/ core.$constructor(
819
- "$ZodBase64",
820
- (inst, def): void => {
821
- def.pattern ??= regexes.base64;
822
- $ZodStringFormat.init(inst, def);
823
-
824
- inst._zod.onattach.push((inst) => {
825
- inst._zod.bag.contentEncoding = "base64";
826
- });
827
-
828
- inst._zod.check = (payload) => {
829
- if (isValidBase64(payload.value)) return;
830
-
831
- payload.issues.push({
832
- code: "invalid_format",
833
- format: "base64",
834
- input: payload.value,
835
- inst,
836
- continue: !def.abort,
837
- });
838
- };
839
- }
840
- );
841
-
842
- ////////////////////////////// ZodBase64 //////////////////////////////
843
- export function isValidBase64URL(data: string): boolean {
844
- if (!regexes.base64url.test(data)) return false;
845
- const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
846
- const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
847
- return isValidBase64(padded);
848
- }
849
-
850
- export interface $ZodBase64URLDef extends $ZodStringFormatDef<"base64url"> {}
851
- export interface $ZodBase64URLInternals extends $ZodStringFormatInternals<"base64url"> {}
852
-
853
- export interface $ZodBase64URL extends $ZodType {
854
- _zod: $ZodBase64URLInternals;
855
- }
856
-
857
- export const $ZodBase64URL: core.$constructor<$ZodBase64URL> = /*@__PURE__*/ core.$constructor(
858
- "$ZodBase64URL",
859
- (inst, def): void => {
860
- def.pattern ??= regexes.base64url;
861
- $ZodStringFormat.init(inst, def);
862
-
863
- inst._zod.onattach.push((inst) => {
864
- inst._zod.bag.contentEncoding = "base64url";
865
- });
866
-
867
- inst._zod.check = (payload) => {
868
- if (isValidBase64URL(payload.value)) return;
869
-
870
- payload.issues.push({
871
- code: "invalid_format",
872
- format: "base64url",
873
- input: payload.value,
874
- inst,
875
- continue: !def.abort,
876
- });
877
- };
878
- }
879
- );
880
-
881
- ////////////////////////////// ZodE164 //////////////////////////////
882
-
883
- export interface $ZodE164Def extends $ZodStringFormatDef<"e164"> {}
884
- export interface $ZodE164Internals extends $ZodStringFormatInternals<"e164"> {}
885
-
886
- export interface $ZodE164 extends $ZodType {
887
- _zod: $ZodE164Internals;
888
- }
889
-
890
- export const $ZodE164: core.$constructor<$ZodE164> = /*@__PURE__*/ core.$constructor("$ZodE164", (inst, def): void => {
891
- def.pattern ??= regexes.e164;
892
- $ZodStringFormat.init(inst, def);
893
- });
894
-
895
- ////////////////////////////// ZodJWT //////////////////////////////
896
-
897
- export function isValidJWT(token: string, algorithm: util.JWTAlgorithm | null = null): boolean {
898
- try {
899
- const tokensParts = token.split(".");
900
- if (tokensParts.length !== 3) return false;
901
- const [header] = tokensParts;
902
- if (!header) return false;
903
- const parsedHeader = JSON.parse(atob(header));
904
- if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
905
- if (!parsedHeader.alg) return false;
906
- if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
907
- return true;
908
- } catch {
909
- return false;
910
- }
911
- }
912
-
913
- export interface $ZodJWTDef extends $ZodStringFormatDef<"jwt"> {
914
- alg?: util.JWTAlgorithm | undefined;
915
- }
916
-
917
- export interface $ZodJWTInternals extends $ZodStringFormatInternals<"jwt"> {
918
- def: $ZodJWTDef;
919
- }
920
-
921
- export interface $ZodJWT extends $ZodType {
922
- _zod: $ZodJWTInternals;
923
- }
924
-
925
- export const $ZodJWT: core.$constructor<$ZodJWT> = /*@__PURE__*/ core.$constructor("$ZodJWT", (inst, def): void => {
926
- $ZodStringFormat.init(inst, def);
927
- inst._zod.check = (payload) => {
928
- if (isValidJWT(payload.value, def.alg)) return;
929
-
930
- payload.issues.push({
931
- code: "invalid_format",
932
- format: "jwt",
933
- input: payload.value,
934
- inst,
935
- continue: !def.abort,
936
- });
937
- };
938
- });
939
-
940
- ////////////////////////////// ZodCustomStringFormat //////////////////////////////
941
-
942
- export interface $ZodCustomStringFormatDef<Format extends string = string> extends $ZodStringFormatDef<Format> {
943
- fn: (val: string) => unknown;
944
- }
945
-
946
- export interface $ZodCustomStringFormatInternals<Format extends string = string>
947
- extends $ZodStringFormatInternals<Format> {
948
- def: $ZodCustomStringFormatDef<Format>;
949
- }
950
-
951
- export interface $ZodCustomStringFormat<Format extends string = string> extends $ZodStringFormat<Format> {
952
- _zod: $ZodCustomStringFormatInternals<Format>;
953
- }
954
-
955
- export const $ZodCustomStringFormat: core.$constructor<$ZodCustomStringFormat> = /*@__PURE__*/ core.$constructor(
956
- "$ZodCustomStringFormat",
957
- (inst, def): void => {
958
- $ZodStringFormat.init(inst, def);
959
- inst._zod.check = (payload) => {
960
- if (def.fn(payload.value)) return;
961
-
962
- payload.issues.push({
963
- code: "invalid_format",
964
- format: def.format,
965
- input: payload.value,
966
- inst,
967
- continue: !def.abort,
968
- });
969
- };
970
- }
971
- );
972
-
973
- /////////////////////////////////////////
974
- /////////////////////////////////////////
975
- ////////// //////////
976
- ////////// ZodNumber //////////
977
- ////////// //////////
978
- /////////////////////////////////////////
979
- /////////////////////////////////////////
980
-
981
- export interface $ZodNumberDef extends $ZodTypeDef {
982
- type: "number";
983
- coerce?: boolean;
984
- // checks: checks.$ZodCheck<number>[];
985
- }
986
-
987
- export interface $ZodNumberInternals<Input = unknown> extends $ZodTypeInternals<number, Input> {
988
- def: $ZodNumberDef;
989
- /** @deprecated Internal API, use with caution (not deprecated) */
990
- pattern: RegExp;
991
- /** @deprecated Internal API, use with caution (not deprecated) */
992
- isst: errors.$ZodIssueInvalidType;
993
- bag: util.LoosePartial<{
994
- minimum: number;
995
- maximum: number;
996
- exclusiveMinimum: number;
997
- exclusiveMaximum: number;
998
- format: string;
999
- pattern: RegExp;
1000
- }>;
1001
- }
1002
-
1003
- export interface $ZodNumber<Input = unknown> extends $ZodType {
1004
- _zod: $ZodNumberInternals<Input>;
1005
- }
1006
-
1007
- export const $ZodNumber: core.$constructor<$ZodNumber> = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, def) => {
1008
- $ZodType.init(inst, def);
1009
- inst._zod.pattern = inst._zod.bag.pattern ?? regexes.number;
1010
-
1011
- inst._zod.parse = (payload, _ctx) => {
1012
- if (def.coerce)
1013
- try {
1014
- payload.value = Number(payload.value);
1015
- } catch (_) {}
1016
- const input = payload.value;
1017
- if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
1018
- return payload;
1019
- }
1020
-
1021
- const received =
1022
- typeof input === "number"
1023
- ? Number.isNaN(input)
1024
- ? "NaN"
1025
- : !Number.isFinite(input)
1026
- ? "Infinity"
1027
- : undefined
1028
- : undefined;
1029
-
1030
- payload.issues.push({
1031
- expected: "number",
1032
- code: "invalid_type",
1033
- input,
1034
- inst,
1035
- ...(received ? { received } : {}),
1036
- });
1037
- return payload;
1038
- };
1039
- });
1040
-
1041
- ///////////////////////////////////////////////
1042
- ////////// ZodNumberFormat //////////
1043
- ///////////////////////////////////////////////
1044
- export interface $ZodNumberFormatDef extends $ZodNumberDef, checks.$ZodCheckNumberFormatDef {}
1045
-
1046
- export interface $ZodNumberFormatInternals extends $ZodNumberInternals<number>, checks.$ZodCheckNumberFormatInternals {
1047
- def: $ZodNumberFormatDef;
1048
- isst: errors.$ZodIssueInvalidType;
1049
- }
1050
-
1051
- export interface $ZodNumberFormat extends $ZodType {
1052
- _zod: $ZodNumberFormatInternals;
1053
- }
1054
-
1055
- export const $ZodNumberFormat: core.$constructor<$ZodNumberFormat> = /*@__PURE__*/ core.$constructor(
1056
- "$ZodNumber",
1057
- (inst, def) => {
1058
- checks.$ZodCheckNumberFormat.init(inst, def);
1059
- $ZodNumber.init(inst, def); // no format checksp
1060
- }
1061
- );
1062
-
1063
- ///////////////////////////////////////////
1064
- ///////////////////////////////////////////
1065
- ////////// ///////////
1066
- ////////// $ZodBoolean //////////
1067
- ////////// ///////////
1068
- ///////////////////////////////////////////
1069
- ///////////////////////////////////////////
1070
-
1071
- export interface $ZodBooleanDef extends $ZodTypeDef {
1072
- type: "boolean";
1073
- coerce?: boolean;
1074
- checks?: checks.$ZodCheck<boolean>[];
1075
- }
1076
-
1077
- export interface $ZodBooleanInternals<T = unknown> extends $ZodTypeInternals<boolean, T> {
1078
- pattern: RegExp;
1079
- def: $ZodBooleanDef;
1080
- isst: errors.$ZodIssueInvalidType;
1081
- }
1082
-
1083
- export interface $ZodBoolean<T = unknown> extends $ZodType {
1084
- _zod: $ZodBooleanInternals<T>;
1085
- }
1086
-
1087
- export const $ZodBoolean: core.$constructor<$ZodBoolean> = /*@__PURE__*/ core.$constructor(
1088
- "$ZodBoolean",
1089
- (inst, def) => {
1090
- $ZodType.init(inst, def);
1091
- inst._zod.pattern = regexes.boolean;
1092
-
1093
- inst._zod.parse = (payload, _ctx) => {
1094
- if (def.coerce)
1095
- try {
1096
- payload.value = Boolean(payload.value);
1097
- } catch (_) {}
1098
- const input = payload.value;
1099
- if (typeof input === "boolean") return payload;
1100
- payload.issues.push({
1101
- expected: "boolean",
1102
- code: "invalid_type",
1103
- input,
1104
- inst,
1105
- });
1106
- return payload;
1107
- };
1108
- }
1109
- );
1110
-
1111
- //////////////////////////////////////////
1112
- //////////////////////////////////////////
1113
- ////////// //////////
1114
- ////////// $ZodBigInt //////////
1115
- ////////// //////////
1116
- //////////////////////////////////////////
1117
- //////////////////////////////////////////
1118
-
1119
- export interface $ZodBigIntDef extends $ZodTypeDef {
1120
- type: "bigint";
1121
- coerce?: boolean;
1122
- // checks: checks.$ZodCheck<bigint>[];
1123
- }
1124
-
1125
- export interface $ZodBigIntInternals<T = unknown> extends $ZodTypeInternals<bigint, T> {
1126
- pattern: RegExp;
1127
- /** @internal Internal API, use with caution */
1128
- def: $ZodBigIntDef;
1129
- isst: errors.$ZodIssueInvalidType;
1130
- bag: util.LoosePartial<{
1131
- minimum: bigint;
1132
- maximum: bigint;
1133
- format: string;
1134
- }>;
1135
- }
1136
-
1137
- export interface $ZodBigInt<T = unknown> extends $ZodType {
1138
- _zod: $ZodBigIntInternals<T>;
1139
- }
1140
-
1141
- export const $ZodBigInt: core.$constructor<$ZodBigInt> = /*@__PURE__*/ core.$constructor("$ZodBigInt", (inst, def) => {
1142
- $ZodType.init(inst, def);
1143
- inst._zod.pattern = regexes.bigint;
1144
-
1145
- inst._zod.parse = (payload, _ctx) => {
1146
- if (def.coerce)
1147
- try {
1148
- payload.value = BigInt(payload.value);
1149
- } catch (_) {}
1150
-
1151
- if (typeof payload.value === "bigint") return payload;
1152
- payload.issues.push({
1153
- expected: "bigint",
1154
- code: "invalid_type",
1155
- input: payload.value,
1156
- inst,
1157
- });
1158
- return payload;
1159
- };
1160
- });
1161
-
1162
- ///////////////////////////////////////////////
1163
- ////////// ZodBigIntFormat //////////
1164
- ///////////////////////////////////////////////
1165
- export interface $ZodBigIntFormatDef extends $ZodBigIntDef, checks.$ZodCheckBigIntFormatDef {
1166
- check: "bigint_format";
1167
- }
1168
-
1169
- export interface $ZodBigIntFormatInternals extends $ZodBigIntInternals<bigint>, checks.$ZodCheckBigIntFormatInternals {
1170
- def: $ZodBigIntFormatDef;
1171
- }
1172
-
1173
- export interface $ZodBigIntFormat extends $ZodType {
1174
- _zod: $ZodBigIntFormatInternals;
1175
- }
1176
-
1177
- export const $ZodBigIntFormat: core.$constructor<$ZodBigIntFormat> = /*@__PURE__*/ core.$constructor(
1178
- "$ZodBigInt",
1179
- (inst, def) => {
1180
- checks.$ZodCheckBigIntFormat.init(inst, def);
1181
- $ZodBigInt.init(inst, def); // no format checks
1182
- }
1183
- );
1184
-
1185
- ////////////////////////////////////////////
1186
- ////////////////////////////////////////////
1187
- ////////// //////////
1188
- ////////// $ZodSymbol //////////
1189
- ////////// //////////
1190
- ////////////////////////////////////////////
1191
- ////////////////////////////////////////////
1192
- export interface $ZodSymbolDef extends $ZodTypeDef {
1193
- type: "symbol";
1194
- }
1195
-
1196
- export interface $ZodSymbolInternals extends $ZodTypeInternals<symbol, symbol> {
1197
- def: $ZodSymbolDef;
1198
- isst: errors.$ZodIssueInvalidType;
1199
- }
1200
-
1201
- export interface $ZodSymbol extends $ZodType {
1202
- _zod: $ZodSymbolInternals;
1203
- }
1204
-
1205
- export const $ZodSymbol: core.$constructor<$ZodSymbol> = /*@__PURE__*/ core.$constructor("$ZodSymbol", (inst, def) => {
1206
- $ZodType.init(inst, def);
1207
-
1208
- inst._zod.parse = (payload, _ctx) => {
1209
- const input = payload.value;
1210
- if (typeof input === "symbol") return payload;
1211
- payload.issues.push({
1212
- expected: "symbol",
1213
- code: "invalid_type",
1214
- input,
1215
- inst,
1216
- });
1217
- return payload;
1218
- };
1219
- });
1220
-
1221
- ////////////////////////////////////////////
1222
- ////////////////////////////////////////////
1223
- ////////// //////////
1224
- ////////// $ZodUndefined //////////
1225
- ////////// //////////
1226
- ////////////////////////////////////////////
1227
- ////////////////////////////////////////////
1228
- export interface $ZodUndefinedDef extends $ZodTypeDef {
1229
- type: "undefined";
1230
- }
1231
-
1232
- export interface $ZodUndefinedInternals extends $ZodTypeInternals<undefined, undefined> {
1233
- pattern: RegExp;
1234
- def: $ZodUndefinedDef;
1235
- values: util.PrimitiveSet;
1236
- isst: errors.$ZodIssueInvalidType;
1237
- }
1238
-
1239
- export interface $ZodUndefined extends $ZodType {
1240
- _zod: $ZodUndefinedInternals;
1241
- }
1242
-
1243
- export const $ZodUndefined: core.$constructor<$ZodUndefined> = /*@__PURE__*/ core.$constructor(
1244
- "$ZodUndefined",
1245
- (inst, def) => {
1246
- $ZodType.init(inst, def);
1247
- inst._zod.pattern = regexes.undefined;
1248
- inst._zod.values = new Set([undefined]);
1249
- inst._zod.optin = "optional";
1250
- inst._zod.optout = "optional";
1251
-
1252
- inst._zod.parse = (payload, _ctx) => {
1253
- const input = payload.value;
1254
- if (typeof input === "undefined") return payload;
1255
- payload.issues.push({
1256
- expected: "undefined",
1257
- code: "invalid_type",
1258
- input,
1259
- inst,
1260
- });
1261
- return payload;
1262
- };
1263
- }
1264
- );
1265
-
1266
- ///////////////////////////////////////
1267
- ///////////////////////////////////////
1268
- ////////// //////////
1269
- ////////// $ZodNull /////////
1270
- ////////// //////////
1271
- ///////////////////////////////////////
1272
- ///////////////////////////////////////
1273
-
1274
- export interface $ZodNullDef extends $ZodTypeDef {
1275
- type: "null";
1276
- }
1277
-
1278
- export interface $ZodNullInternals extends $ZodTypeInternals<null, null> {
1279
- pattern: RegExp;
1280
- def: $ZodNullDef;
1281
- values: util.PrimitiveSet;
1282
- isst: errors.$ZodIssueInvalidType;
1283
- }
1284
-
1285
- export interface $ZodNull extends $ZodType {
1286
- _zod: $ZodNullInternals;
1287
- }
1288
-
1289
- export const $ZodNull: core.$constructor<$ZodNull> = /*@__PURE__*/ core.$constructor("$ZodNull", (inst, def) => {
1290
- $ZodType.init(inst, def);
1291
- inst._zod.pattern = regexes.null;
1292
- inst._zod.values = new Set([null]);
1293
-
1294
- inst._zod.parse = (payload, _ctx) => {
1295
- const input = payload.value;
1296
- if (input === null) return payload;
1297
- payload.issues.push({
1298
- expected: "null",
1299
- code: "invalid_type",
1300
- input,
1301
- inst,
1302
- });
1303
- return payload;
1304
- };
1305
- });
1306
-
1307
- //////////////////////////////////////
1308
- //////////////////////////////////////
1309
- ////////// //////////
1310
- ////////// $ZodAny //////////
1311
- ////////// //////////
1312
- //////////////////////////////////////
1313
- //////////////////////////////////////
1314
-
1315
- export interface $ZodAnyDef extends $ZodTypeDef {
1316
- type: "any";
1317
- }
1318
-
1319
- export interface $ZodAnyInternals extends $ZodTypeInternals<any, any> {
1320
- def: $ZodAnyDef;
1321
- isst: never;
1322
- }
1323
-
1324
- export interface $ZodAny extends $ZodType {
1325
- _zod: $ZodAnyInternals;
1326
- }
1327
-
1328
- export const $ZodAny: core.$constructor<$ZodAny> = /*@__PURE__*/ core.$constructor("$ZodAny", (inst, def) => {
1329
- $ZodType.init(inst, def);
1330
-
1331
- inst._zod.parse = (payload) => payload;
1332
- });
1333
-
1334
- //////////////////////////////////////////
1335
- //////////////////////////////////////////
1336
- ////////// //////////
1337
- ////////// $ZodUnknown //////////
1338
- ////////// //////////
1339
- //////////////////////////////////////////
1340
- //////////////////////////////////////////
1341
-
1342
- export interface $ZodUnknownDef extends $ZodTypeDef {
1343
- type: "unknown";
1344
- }
1345
-
1346
- export interface $ZodUnknownInternals extends $ZodTypeInternals<unknown, unknown> {
1347
- def: $ZodUnknownDef;
1348
- isst: never;
1349
- }
1350
-
1351
- export interface $ZodUnknown extends $ZodType {
1352
- _zod: $ZodUnknownInternals;
1353
- }
1354
-
1355
- export const $ZodUnknown: core.$constructor<$ZodUnknown> = /*@__PURE__*/ core.$constructor(
1356
- "$ZodUnknown",
1357
- (inst, def) => {
1358
- $ZodType.init(inst, def);
1359
-
1360
- inst._zod.parse = (payload) => payload;
1361
- }
1362
- );
1363
-
1364
- /////////////////////////////////////////
1365
- /////////////////////////////////////////
1366
- ////////// //////////
1367
- ////////// $ZodNever //////////
1368
- ////////// //////////
1369
- /////////////////////////////////////////
1370
- /////////////////////////////////////////
1371
-
1372
- export interface $ZodNeverDef extends $ZodTypeDef {
1373
- type: "never";
1374
- }
1375
-
1376
- export interface $ZodNeverInternals extends $ZodTypeInternals<never, never> {
1377
- def: $ZodNeverDef;
1378
- isst: errors.$ZodIssueInvalidType;
1379
- }
1380
-
1381
- export interface $ZodNever extends $ZodType {
1382
- _zod: $ZodNeverInternals;
1383
- }
1384
-
1385
- export const $ZodNever: core.$constructor<$ZodNever> = /*@__PURE__*/ core.$constructor("$ZodNever", (inst, def) => {
1386
- $ZodType.init(inst, def);
1387
- inst._zod.parse = (payload, _ctx) => {
1388
- payload.issues.push({
1389
- expected: "never",
1390
- code: "invalid_type",
1391
- input: payload.value,
1392
- inst,
1393
- });
1394
- return payload;
1395
- };
1396
- });
1397
-
1398
- ////////////////////////////////////////
1399
- ////////////////////////////////////////
1400
- ////////// //////////
1401
- ////////// $ZodVoid //////////
1402
- ////////// //////////
1403
- ////////////////////////////////////////
1404
- ////////////////////////////////////////
1405
-
1406
- export interface $ZodVoidDef extends $ZodTypeDef {
1407
- type: "void";
1408
- }
1409
-
1410
- export interface $ZodVoidInternals extends $ZodTypeInternals<void, void> {
1411
- def: $ZodVoidDef;
1412
- isst: errors.$ZodIssueInvalidType;
1413
- }
1414
-
1415
- export interface $ZodVoid extends $ZodType {
1416
- _zod: $ZodVoidInternals;
1417
- }
1418
-
1419
- export const $ZodVoid: core.$constructor<$ZodVoid> = /*@__PURE__*/ core.$constructor("$ZodVoid", (inst, def) => {
1420
- $ZodType.init(inst, def);
1421
-
1422
- inst._zod.parse = (payload, _ctx) => {
1423
- const input = payload.value;
1424
- if (typeof input === "undefined") return payload;
1425
- payload.issues.push({
1426
- expected: "void",
1427
- code: "invalid_type",
1428
- input,
1429
- inst,
1430
- });
1431
- return payload;
1432
- };
1433
- });
1434
-
1435
- ///////////////////////////////////////
1436
- ///////////////////////////////////////
1437
- ////////// ////////
1438
- ////////// $ZodDate ////////
1439
- ////////// ////////
1440
- ///////////////////////////////////////
1441
- ///////////////////////////////////////
1442
- export interface $ZodDateDef extends $ZodTypeDef {
1443
- type: "date";
1444
- coerce?: boolean;
1445
- }
1446
-
1447
- export interface $ZodDateInternals<T = unknown> extends $ZodTypeInternals<Date, T> {
1448
- def: $ZodDateDef;
1449
- isst: errors.$ZodIssueInvalidType; // | errors.$ZodIssueInvalidDate;
1450
- bag: util.LoosePartial<{
1451
- minimum: Date;
1452
- maximum: Date;
1453
- format: string;
1454
- }>;
1455
- }
1456
-
1457
- export interface $ZodDate<T = unknown> extends $ZodType {
1458
- _zod: $ZodDateInternals<T>;
1459
- }
1460
-
1461
- export const $ZodDate: core.$constructor<$ZodDate> = /*@__PURE__*/ core.$constructor("$ZodDate", (inst, def) => {
1462
- $ZodType.init(inst, def);
1463
-
1464
- inst._zod.parse = (payload, _ctx) => {
1465
- if (def.coerce) {
1466
- try {
1467
- payload.value = new Date(payload.value as string | number | Date);
1468
- } catch (_err: any) {}
1469
- }
1470
- const input = payload.value;
1471
-
1472
- const isDate = input instanceof Date;
1473
- const isValidDate = isDate && !Number.isNaN(input.getTime());
1474
- if (isValidDate) return payload;
1475
- payload.issues.push({
1476
- expected: "date",
1477
- code: "invalid_type",
1478
- input,
1479
- ...(isDate ? { received: "Invalid Date" } : {}),
1480
- inst,
1481
- });
1482
-
1483
- return payload;
1484
- };
1485
- });
1486
-
1487
- /////////////////////////////////////////
1488
- /////////////////////////////////////////
1489
- ////////// //////////
1490
- ////////// $ZodArray //////////
1491
- ////////// //////////
1492
- /////////////////////////////////////////
1493
- /////////////////////////////////////////
1494
-
1495
- export interface $ZodArrayDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
1496
- type: "array";
1497
- element: T;
1498
- }
1499
-
1500
- export interface $ZodArrayInternals<T extends SomeType = $ZodType> extends _$ZodTypeInternals {
1501
- //$ZodTypeInternals<core.output<T>[], core.input<T>[]> {
1502
- def: $ZodArrayDef<T>;
1503
- isst: errors.$ZodIssueInvalidType;
1504
- output: core.output<T>[];
1505
- input: core.input<T>[];
1506
- }
1507
-
1508
- export interface $ZodArray<T extends SomeType = $ZodType> extends $ZodType<any, any, $ZodArrayInternals<T>> {}
1509
-
1510
- function handleArrayResult(result: ParsePayload<any>, final: ParsePayload<any[]>, index: number) {
1511
- if (result.issues.length) {
1512
- final.issues.push(...util.prefixIssues(index, result.issues));
1513
- }
1514
- final.value[index] = result.value;
1515
- }
1516
-
1517
- export const $ZodArray: core.$constructor<$ZodArray> = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def) => {
1518
- $ZodType.init(inst, def);
1519
-
1520
- inst._zod.parse = (payload, ctx) => {
1521
- const input = payload.value;
1522
-
1523
- if (!Array.isArray(input)) {
1524
- payload.issues.push({
1525
- expected: "array",
1526
- code: "invalid_type",
1527
- input,
1528
- inst,
1529
- });
1530
- return payload;
1531
- }
1532
-
1533
- payload.value = Array(input.length);
1534
- const proms: Promise<any>[] = [];
1535
- for (let i = 0; i < input.length; i++) {
1536
- const item = input[i];
1537
- const result = def.element._zod.run(
1538
- {
1539
- value: item,
1540
- issues: [],
1541
- },
1542
- ctx
1543
- );
1544
-
1545
- if (result instanceof Promise) {
1546
- proms.push(result.then((result) => handleArrayResult(result, payload, i)));
1547
- } else {
1548
- handleArrayResult(result, payload, i);
1549
- }
1550
- }
1551
-
1552
- if (proms.length) {
1553
- return Promise.all(proms).then(() => payload);
1554
- }
1555
-
1556
- return payload; //handleArrayResultsAsync(parseResults, final);
1557
- };
1558
- });
1559
-
1560
- //////////////////////////////////////////
1561
- //////////////////////////////////////////
1562
- ////////// //////////
1563
- ////////// $ZodObject //////////
1564
- ////////// //////////
1565
- //////////////////////////////////////////
1566
- //////////////////////////////////////////
1567
-
1568
- type OptionalOutSchema = { _zod: { optout: "optional" } };
1569
- type OptionalInSchema = { _zod: { optin: "optional" } };
1570
-
1571
- export type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T
1572
- ? util.IsAny<T[keyof T]> extends true
1573
- ? Record<string, unknown>
1574
- : Record<string, core.output<T[keyof T]>>
1575
- : keyof (T & Extra) extends never
1576
- ? Record<string, never>
1577
- : util.Prettify<
1578
- {
1579
- -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"];
1580
- } & {
1581
- -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"];
1582
- } & Extra
1583
- >;
1584
-
1585
- export type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T
1586
- ? util.IsAny<T[keyof T]> extends true
1587
- ? Record<string, unknown>
1588
- : Record<string, core.input<T[keyof T]>>
1589
- : keyof (T & Extra) extends never
1590
- ? Record<string, never>
1591
- : util.Prettify<
1592
- {
1593
- -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"];
1594
- } & {
1595
- -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"];
1596
- } & Extra
1597
- >;
1598
-
1599
- function handleObjectResult(result: ParsePayload, final: ParsePayload, key: PropertyKey) {
1600
- // if(isOptional)
1601
- if (result.issues.length) {
1602
- final.issues.push(...util.prefixIssues(key, result.issues));
1603
- }
1604
-
1605
- (final.value as any)[key] = result.value;
1606
- }
1607
-
1608
- function handleOptionalObjectResult(result: ParsePayload, final: ParsePayload, key: PropertyKey, input: any) {
1609
- if (result.issues.length) {
1610
- // validation failed against value schema
1611
- if (input[key] === undefined) {
1612
- // if input was undefined, ignore the error
1613
- if (key in input) {
1614
- (final.value as any)[key] = undefined;
1615
- } else {
1616
- (final.value as any)[key] = result.value;
1617
- }
1618
- } else {
1619
- final.issues.push(...util.prefixIssues(key, result.issues));
1620
- }
1621
- } else if (result.value === undefined) {
1622
- // validation returned `undefined`
1623
- if (key in input) (final.value as any)[key] = undefined;
1624
- } else {
1625
- // non-undefined value
1626
- (final.value as any)[key] = result.value;
1627
- }
1628
- }
1629
-
1630
- export type $ZodObjectConfig = { out: Record<string, unknown>; in: Record<string, unknown> };
1631
-
1632
- export type $loose = {
1633
- out: Record<string, unknown>;
1634
- in: Record<string, unknown>;
1635
- };
1636
- export type $strict = {
1637
- out: {};
1638
- in: {};
1639
- };
1640
- export type $strip = {
1641
- out: {};
1642
- in: {};
1643
- };
1644
-
1645
- export type $catchall<T extends SomeType> = {
1646
- out: { [k: string]: core.output<T> };
1647
- in: { [k: string]: core.input<T> };
1648
- };
1649
-
1650
- export type $ZodShape = Readonly<{ [k: string]: $ZodType }>;
1651
-
1652
- export interface $ZodObjectDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef {
1653
- type: "object";
1654
- shape: Shape;
1655
- catchall?: $ZodType | undefined;
1656
- }
1657
-
1658
- export interface $ZodObjectInternals<
1659
- /** @ts-ignore Cast variance */
1660
- out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>,
1661
- out Config extends $ZodObjectConfig = $ZodObjectConfig,
1662
- > extends _$ZodTypeInternals {
1663
- def: $ZodObjectDef<Shape>;
1664
- config: Config;
1665
- isst: errors.$ZodIssueInvalidType | errors.$ZodIssueUnrecognizedKeys;
1666
- propValues: util.PropValues;
1667
- output: $InferObjectOutput<Shape, Config["out"]>;
1668
- input: $InferObjectInput<Shape, Config["in"]>;
1669
- }
1670
- export type $ZodLooseShape = Record<string, any>;
1671
-
1672
- export interface $ZodObject<
1673
- /** @ts-ignore Cast variance */
1674
- out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>,
1675
- out Params extends $ZodObjectConfig = $ZodObjectConfig,
1676
- > extends $ZodType<any, any, $ZodObjectInternals<Shape, Params>> {
1677
- "~standard": $ZodStandardSchema<this>;
1678
- }
1679
-
1680
- export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, def) => {
1681
- // requires cast because technically $ZodObject doesn't extend
1682
- $ZodType.init(inst, def);
1683
-
1684
- const _normalized = util.cached(() => {
1685
- const keys = Object.keys(def.shape);
1686
- for (const k of keys) {
1687
- if (!(def.shape[k] instanceof $ZodType)) {
1688
- throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1689
- }
1690
- }
1691
- const okeys = util.optionalKeys(def.shape);
1692
-
1693
- return {
1694
- shape: def.shape,
1695
- keys,
1696
- keySet: new Set(keys),
1697
- numKeys: keys.length,
1698
- optionalKeys: new Set(okeys),
1699
- };
1700
- });
1701
-
1702
- util.defineLazy(inst._zod, "propValues", () => {
1703
- const shape = def.shape;
1704
- const propValues: util.PropValues = {};
1705
- for (const key in shape) {
1706
- const field = shape[key]!._zod;
1707
- if (field.values) {
1708
- propValues[key] ??= new Set();
1709
- for (const v of field.values) propValues[key].add(v);
1710
- }
1711
- }
1712
- return propValues;
1713
- });
1714
-
1715
- const generateFastpass = (shape: any) => {
1716
- const doc = new Doc(["shape", "payload", "ctx"]);
1717
- const normalized = _normalized.value;
1718
-
1719
- const parseStr = (key: string) => {
1720
- const k = util.esc(key);
1721
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1722
- };
1723
-
1724
- doc.write(`const input = payload.value;`);
1725
-
1726
- const ids: any = Object.create(null);
1727
- let counter = 0;
1728
- for (const key of normalized.keys) {
1729
- ids[key] = `key_${counter++}`;
1730
- }
1731
-
1732
- // A: preserve key order {
1733
- doc.write(`const newResult = {}`);
1734
- for (const key of normalized.keys) {
1735
- if (normalized.optionalKeys.has(key)) {
1736
- const id = ids[key];
1737
- doc.write(`const ${id} = ${parseStr(key)};`);
1738
- const k = util.esc(key);
1739
- doc.write(`
1740
- if (${id}.issues.length) {
1741
- if (input[${k}] === undefined) {
1742
- if (${k} in input) {
1743
- newResult[${k}] = undefined;
1744
- }
1745
- } else {
1746
- payload.issues = payload.issues.concat(
1747
- ${id}.issues.map((iss) => ({
1748
- ...iss,
1749
- path: iss.path ? [${k}, ...iss.path] : [${k}],
1750
- }))
1751
- );
1752
- }
1753
- } else if (${id}.value === undefined) {
1754
- if (${k} in input) newResult[${k}] = undefined;
1755
- } else {
1756
- newResult[${k}] = ${id}.value;
1757
- }
1758
- `);
1759
- } else {
1760
- const id = ids[key];
1761
- // const id = ids[key];
1762
- doc.write(`const ${id} = ${parseStr(key)};`);
1763
- doc.write(`
1764
- if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1765
- ...iss,
1766
- path: iss.path ? [${util.esc(key)}, ...iss.path] : [${util.esc(key)}]
1767
- })));`);
1768
- doc.write(`newResult[${util.esc(key)}] = ${id}.value`);
1769
- }
1770
- }
1771
-
1772
- doc.write(`payload.value = newResult;`);
1773
- doc.write(`return payload;`);
1774
- const fn = doc.compile();
1775
- return (payload: any, ctx: any) => fn(shape, payload, ctx);
1776
- };
1777
-
1778
- let fastpass!: ReturnType<typeof generateFastpass>;
1779
-
1780
- const isObject = util.isObject;
1781
- const jit = !core.globalConfig.jitless;
1782
- const allowsEval = util.allowsEval;
1783
-
1784
- const fastEnabled = jit && allowsEval.value; // && !def.catchall;
1785
- const catchall = def.catchall;
1786
-
1787
- let value!: typeof _normalized.value;
1788
-
1789
- inst._zod.parse = (payload, ctx) => {
1790
- value ??= _normalized.value;
1791
- const input = payload.value;
1792
- if (!isObject(input)) {
1793
- payload.issues.push({
1794
- expected: "object",
1795
- code: "invalid_type",
1796
- input,
1797
- inst,
1798
- });
1799
- return payload;
1800
- }
1801
-
1802
- const proms: Promise<any>[] = [];
1803
-
1804
- if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
1805
- // always synchronous
1806
- if (!fastpass) fastpass = generateFastpass(def.shape);
1807
- payload = fastpass(payload, ctx);
1808
- } else {
1809
- payload.value = {};
1810
-
1811
- const shape = value.shape;
1812
- for (const key of value.keys) {
1813
- const el = shape[key]!;
1814
-
1815
- // do not add omitted optional keys
1816
- // if (!(key in input)) {
1817
- // if (optionalKeys.has(key)) continue;
1818
- // payload.issues.push({
1819
- // code: "invalid_type",
1820
- // path: [key],
1821
- // expected: "nonoptional",
1822
- // note: `Missing required key: "${key}"`,
1823
- // input,
1824
- // inst,
1825
- // });
1826
- // }
1827
-
1828
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
1829
- const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
1830
-
1831
- if (r instanceof Promise) {
1832
- proms.push(
1833
- r.then((r) =>
1834
- isOptional ? handleOptionalObjectResult(r, payload, key, input) : handleObjectResult(r, payload, key)
1835
- )
1836
- );
1837
- } else if (isOptional) {
1838
- handleOptionalObjectResult(r, payload, key, input);
1839
- } else {
1840
- handleObjectResult(r, payload, key);
1841
- }
1842
- }
1843
- }
1844
-
1845
- if (!catchall) {
1846
- // return payload;
1847
- return proms.length ? Promise.all(proms).then(() => payload) : payload;
1848
- }
1849
- const unrecognized: string[] = [];
1850
- // iterate over input keys
1851
- const keySet = value.keySet;
1852
- const _catchall = catchall._zod;
1853
- const t = _catchall.def.type;
1854
- for (const key of Object.keys(input)) {
1855
- if (keySet.has(key)) continue;
1856
- if (t === "never") {
1857
- unrecognized.push(key);
1858
- continue;
1859
- }
1860
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1861
-
1862
- if (r instanceof Promise) {
1863
- proms.push(r.then((r) => handleObjectResult(r, payload, key)));
1864
- } else {
1865
- handleObjectResult(r, payload, key);
1866
- }
1867
- }
1868
-
1869
- if (unrecognized.length) {
1870
- payload.issues.push({
1871
- code: "unrecognized_keys",
1872
- keys: unrecognized,
1873
- input,
1874
- inst,
1875
- });
1876
- }
1877
-
1878
- if (!proms.length) return payload;
1879
- return Promise.all(proms).then(() => {
1880
- return payload;
1881
- });
1882
- };
1883
- });
1884
-
1885
- /////////////////////////////////////////
1886
- /////////////////////////////////////////
1887
- ////////// ///////////
1888
- ////////// $ZodUnion //////////
1889
- ////////// ///////////
1890
- /////////////////////////////////////////
1891
- /////////////////////////////////////////
1892
- // use generic to distribute union types
1893
- export type $InferUnionOutput<T extends SomeType> = T extends any ? core.output<T> : never;
1894
- export type $InferUnionInput<T extends SomeType> = T extends any ? core.input<T> : never;
1895
- export interface $ZodUnionDef<Options extends readonly SomeType[] = readonly $ZodType[]> extends $ZodTypeDef {
1896
- type: "union";
1897
- options: Options;
1898
- }
1899
-
1900
- type IsOptionalIn<T extends SomeType> = T extends OptionalInSchema ? true : false;
1901
- type IsOptionalOut<T extends SomeType> = T extends OptionalOutSchema ? true : false;
1902
-
1903
- export interface $ZodUnionInternals<T extends readonly SomeType[] = readonly $ZodType[]> extends _$ZodTypeInternals {
1904
- def: $ZodUnionDef<T>;
1905
- isst: errors.$ZodIssueInvalidUnion;
1906
- pattern: T[number]["_zod"]["pattern"];
1907
- values: T[number]["_zod"]["values"]; //GetValues<T[number]>;
1908
- output: $InferUnionOutput<T[number]>;
1909
- input: $InferUnionInput<T[number]>;
1910
- // if any element in the union is optional, then the union is optional
1911
- optin: IsOptionalIn<T[number]> extends false ? "optional" | undefined : "optional";
1912
- optout: IsOptionalOut<T[number]> extends false ? "optional" | undefined : "optional";
1913
- }
1914
-
1915
- export interface $ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]>
1916
- extends $ZodType<any, any, $ZodUnionInternals<T>> {
1917
- _zod: $ZodUnionInternals<T>;
1918
- }
1919
-
1920
- function handleUnionResults(results: ParsePayload[], final: ParsePayload, inst: $ZodUnion, ctx?: ParseContext) {
1921
- for (const result of results) {
1922
- if (result.issues.length === 0) {
1923
- final.value = result.value;
1924
- return final;
1925
- }
1926
- }
1927
-
1928
- final.issues.push({
1929
- code: "invalid_union",
1930
- input: final.value,
1931
- inst,
1932
- errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
1933
- });
1934
-
1935
- return final;
1936
- }
1937
-
1938
- export const $ZodUnion: core.$constructor<$ZodUnion> = /*@__PURE__*/ core.$constructor("$ZodUnion", (inst, def) => {
1939
- $ZodType.init(inst, def);
1940
-
1941
- util.defineLazy(inst._zod, "optin", () =>
1942
- def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined
1943
- );
1944
-
1945
- util.defineLazy(inst._zod, "optout", () =>
1946
- def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined
1947
- );
1948
-
1949
- util.defineLazy(inst._zod, "values", () => {
1950
- if (def.options.every((o) => o._zod.values)) {
1951
- return new Set<util.Primitive>(def.options.flatMap((option) => Array.from(option._zod.values!)));
1952
- }
1953
- return undefined;
1954
- });
1955
-
1956
- util.defineLazy(inst._zod, "pattern", () => {
1957
- if (def.options.every((o) => o._zod.pattern)) {
1958
- const patterns = def.options.map((o) => o._zod.pattern);
1959
- return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p!.source)).join("|")})$`);
1960
- }
1961
- return undefined;
1962
- });
1963
-
1964
- inst._zod.parse = (payload, ctx) => {
1965
- let async = false;
1966
-
1967
- const results: util.MaybeAsync<ParsePayload>[] = [];
1968
- for (const option of def.options) {
1969
- const result = option._zod.run(
1970
- {
1971
- value: payload.value,
1972
- issues: [],
1973
- },
1974
- ctx
1975
- );
1976
- if (result instanceof Promise) {
1977
- results.push(result);
1978
- async = true;
1979
- } else {
1980
- if (result.issues.length === 0) return result;
1981
- results.push(result);
1982
- }
1983
- }
1984
-
1985
- if (!async) return handleUnionResults(results as ParsePayload[], payload, inst, ctx);
1986
- return Promise.all(results).then((results) => {
1987
- return handleUnionResults(results as ParsePayload[], payload, inst, ctx);
1988
- });
1989
- };
1990
- });
1991
-
1992
- //////////////////////////////////////////////////////
1993
- //////////////////////////////////////////////////////
1994
- ////////// //////////
1995
- ////////// $ZodDiscriminatedUnion //////////
1996
- ////////// //////////
1997
- //////////////////////////////////////////////////////
1998
- //////////////////////////////////////////////////////
1999
-
2000
- export interface $ZodDiscriminatedUnionDef<Options extends readonly SomeType[] = readonly $ZodType[]>
2001
- extends $ZodUnionDef<Options> {
2002
- discriminator: string;
2003
- unionFallback?: boolean;
2004
- }
2005
-
2006
- export interface $ZodDiscriminatedUnionInternals<Options extends readonly SomeType[] = readonly $ZodType[]>
2007
- extends $ZodUnionInternals<Options> {
2008
- def: $ZodDiscriminatedUnionDef<Options>;
2009
- propValues: util.PropValues;
2010
- }
2011
-
2012
- export interface $ZodDiscriminatedUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends $ZodType {
2013
- _zod: $ZodDiscriminatedUnionInternals<T>;
2014
- }
2015
-
2016
- export const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion> =
2017
- /*@__PURE__*/
2018
- core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
2019
- $ZodUnion.init(inst, def);
2020
-
2021
- const _super = inst._zod.parse;
2022
- util.defineLazy(inst._zod, "propValues", () => {
2023
- const propValues: util.PropValues = {};
2024
- for (const option of def.options) {
2025
- const pv = option._zod.propValues;
2026
- if (!pv || Object.keys(pv).length === 0)
2027
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
2028
- for (const [k, v] of Object.entries(pv!)) {
2029
- if (!propValues[k]) propValues[k] = new Set();
2030
- for (const val of v) {
2031
- propValues[k].add(val);
2032
- }
2033
- }
2034
- }
2035
- return propValues;
2036
- });
2037
-
2038
- const disc = util.cached(() => {
2039
- const opts = def.options as $ZodTypeDiscriminable[];
2040
- const map: Map<util.Primitive, $ZodType> = new Map();
2041
- for (const o of opts) {
2042
- const values = o._zod.propValues[def.discriminator];
2043
- if (!values || values.size === 0)
2044
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
2045
- for (const v of values) {
2046
- if (map.has(v)) {
2047
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
2048
- }
2049
- map.set(v, o);
2050
- }
2051
- }
2052
- return map;
2053
- });
2054
-
2055
- inst._zod.parse = (payload, ctx) => {
2056
- const input = payload.value;
2057
- if (!util.isObject(input)) {
2058
- payload.issues.push({
2059
- code: "invalid_type",
2060
- expected: "object",
2061
- input,
2062
- inst,
2063
- });
2064
- return payload;
2065
- }
2066
-
2067
- const opt = disc.value.get(input?.[def.discriminator] as any);
2068
- if (opt) {
2069
- return opt._zod.run(payload, ctx) as any;
2070
- }
2071
-
2072
- if (def.unionFallback) {
2073
- return _super(payload, ctx);
2074
- }
2075
-
2076
- // no matching discriminator
2077
- payload.issues.push({
2078
- code: "invalid_union",
2079
- errors: [],
2080
- note: "No matching discriminator",
2081
- input,
2082
- path: [def.discriminator],
2083
- inst,
2084
- });
2085
-
2086
- return payload;
2087
- };
2088
- });
2089
-
2090
- ////////////////////////////////////////////////
2091
- ////////////////////////////////////////////////
2092
- ////////// //////////
2093
- ////////// $ZodIntersection //////////
2094
- ////////// //////////
2095
- ////////////////////////////////////////////////
2096
- ////////////////////////////////////////////////
2097
-
2098
- export interface $ZodIntersectionDef<Left extends SomeType = $ZodType, Right extends SomeType = $ZodType>
2099
- extends $ZodTypeDef {
2100
- type: "intersection";
2101
- left: Left;
2102
- right: Right;
2103
- }
2104
-
2105
- export interface $ZodIntersectionInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType>
2106
- extends $ZodTypeInternals<core.output<A> & core.output<B>, core.input<A> & core.input<B>> {
2107
- def: $ZodIntersectionDef<A, B>;
2108
- isst: never;
2109
- optin: A["_zod"]["optin"] | B["_zod"]["optin"];
2110
- optout: A["_zod"]["optout"] | B["_zod"]["optout"];
2111
- }
2112
-
2113
- export interface $ZodIntersection<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
2114
- _zod: $ZodIntersectionInternals<A, B>;
2115
- }
2116
-
2117
- export const $ZodIntersection: core.$constructor<$ZodIntersection> = /*@__PURE__*/ core.$constructor(
2118
- "$ZodIntersection",
2119
- (inst, def) => {
2120
- $ZodType.init(inst, def);
2121
-
2122
- inst._zod.parse = (payload, ctx) => {
2123
- const input = payload.value;
2124
- const left = def.left._zod.run({ value: input, issues: [] }, ctx);
2125
- const right = def.right._zod.run({ value: input, issues: [] }, ctx);
2126
- const async = left instanceof Promise || right instanceof Promise;
2127
-
2128
- if (async) {
2129
- return Promise.all([left, right]).then(([left, right]) => {
2130
- return handleIntersectionResults(payload, left, right);
2131
- });
2132
- }
2133
-
2134
- return handleIntersectionResults(payload, left, right);
2135
- };
2136
- }
2137
- );
2138
-
2139
- function mergeValues(
2140
- a: any,
2141
- b: any
2142
- ): { valid: true; data: any } | { valid: false; mergeErrorPath: (string | number)[] } {
2143
- // const aType = parse.t(a);
2144
- // const bType = parse.t(b);
2145
-
2146
- if (a === b) {
2147
- return { valid: true, data: a };
2148
- }
2149
- if (a instanceof Date && b instanceof Date && +a === +b) {
2150
- return { valid: true, data: a };
2151
- }
2152
- if (util.isPlainObject(a) && util.isPlainObject(b)) {
2153
- const bKeys = Object.keys(b);
2154
- const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
2155
-
2156
- const newObj: any = { ...a, ...b };
2157
- for (const key of sharedKeys) {
2158
- const sharedValue = mergeValues(a[key], b[key]);
2159
- if (!sharedValue.valid) {
2160
- return {
2161
- valid: false,
2162
- mergeErrorPath: [key, ...sharedValue.mergeErrorPath],
2163
- };
2164
- }
2165
- newObj[key] = sharedValue.data;
2166
- }
2167
-
2168
- return { valid: true, data: newObj };
2169
- }
2170
- if (Array.isArray(a) && Array.isArray(b)) {
2171
- if (a.length !== b.length) {
2172
- return { valid: false, mergeErrorPath: [] };
2173
- }
2174
-
2175
- const newArray: unknown[] = [];
2176
- for (let index = 0; index < a.length; index++) {
2177
- const itemA = a[index];
2178
- const itemB = b[index];
2179
- const sharedValue = mergeValues(itemA, itemB);
2180
-
2181
- if (!sharedValue.valid) {
2182
- return {
2183
- valid: false,
2184
- mergeErrorPath: [index, ...sharedValue.mergeErrorPath],
2185
- };
2186
- }
2187
-
2188
- newArray.push(sharedValue.data);
2189
- }
2190
-
2191
- return { valid: true, data: newArray };
2192
- }
2193
-
2194
- return { valid: false, mergeErrorPath: [] };
2195
- }
2196
-
2197
- function handleIntersectionResults(result: ParsePayload, left: ParsePayload, right: ParsePayload): ParsePayload {
2198
- if (left.issues.length) {
2199
- result.issues.push(...left.issues);
2200
- }
2201
- if (right.issues.length) {
2202
- result.issues.push(...right.issues);
2203
- }
2204
- if (util.aborted(result)) return result;
2205
-
2206
- const merged = mergeValues(left.value, right.value);
2207
-
2208
- if (!merged.valid) {
2209
- throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
2210
- }
2211
-
2212
- result.value = merged.data;
2213
- return result;
2214
- }
2215
-
2216
- /////////////////////////////////////////
2217
- /////////////////////////////////////////
2218
- ////////// //////////
2219
- ////////// $ZodTuple //////////
2220
- ////////// //////////
2221
- /////////////////////////////////////////
2222
- /////////////////////////////////////////
2223
-
2224
- export interface $ZodTupleDef<
2225
- T extends util.TupleItems = readonly $ZodType[],
2226
- Rest extends SomeType | null = $ZodType | null,
2227
- > extends $ZodTypeDef {
2228
- type: "tuple";
2229
- items: T;
2230
- rest: Rest;
2231
- }
2232
-
2233
- export type $InferTupleInputType<T extends util.TupleItems, Rest extends SomeType | null> = [
2234
- ...TupleInputTypeWithOptionals<T>,
2235
- ...(Rest extends SomeType ? core.input<Rest>[] : []),
2236
- ];
2237
- type TupleInputTypeNoOptionals<T extends util.TupleItems> = {
2238
- [k in keyof T]: core.input<T[k]>;
2239
- };
2240
- type TupleInputTypeWithOptionals<T extends util.TupleItems> = T extends readonly [
2241
- ...infer Prefix extends SomeType[],
2242
- infer Tail extends SomeType,
2243
- ]
2244
- ? Tail["_zod"]["optin"] extends "optional"
2245
- ? [...TupleInputTypeWithOptionals<Prefix>, core.input<Tail>?]
2246
- : TupleInputTypeNoOptionals<T>
2247
- : [];
2248
-
2249
- export type $InferTupleOutputType<T extends util.TupleItems, Rest extends SomeType | null> = [
2250
- ...TupleOutputTypeWithOptionals<T>,
2251
- ...(Rest extends SomeType ? core.output<Rest>[] : []),
2252
- ];
2253
- type TupleOutputTypeNoOptionals<T extends util.TupleItems> = {
2254
- [k in keyof T]: core.output<T[k]>;
2255
- };
2256
- type TupleOutputTypeWithOptionals<T extends util.TupleItems> = T extends readonly [
2257
- ...infer Prefix extends SomeType[],
2258
- infer Tail extends SomeType,
2259
- ]
2260
- ? Tail["_zod"]["optout"] extends "optional"
2261
- ? [...TupleOutputTypeWithOptionals<Prefix>, core.output<Tail>?]
2262
- : TupleOutputTypeNoOptionals<T>
2263
- : [];
2264
-
2265
- export interface $ZodTupleInternals<
2266
- T extends util.TupleItems = readonly $ZodType[],
2267
- Rest extends SomeType | null = $ZodType | null,
2268
- > extends $ZodTypeInternals<$InferTupleOutputType<T, Rest>, $InferTupleInputType<T, Rest>> {
2269
- def: $ZodTupleDef<T, Rest>;
2270
- isst: errors.$ZodIssueInvalidType | errors.$ZodIssueTooBig<unknown[]> | errors.$ZodIssueTooSmall<unknown[]>;
2271
- }
2272
-
2273
- export interface $ZodTuple<
2274
- T extends util.TupleItems = readonly $ZodType[],
2275
- Rest extends SomeType | null = $ZodType | null,
2276
- > extends $ZodType {
2277
- _zod: $ZodTupleInternals<T, Rest>;
2278
- }
2279
-
2280
- export const $ZodTuple: core.$constructor<$ZodTuple> = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def) => {
2281
- $ZodType.init(inst, def);
2282
- const items = def.items;
2283
- const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
2284
-
2285
- inst._zod.parse = (payload, ctx) => {
2286
- const input = payload.value;
2287
- if (!Array.isArray(input)) {
2288
- payload.issues.push({
2289
- input,
2290
- inst,
2291
- expected: "tuple",
2292
- code: "invalid_type",
2293
- });
2294
- return payload;
2295
- }
2296
-
2297
- payload.value = [];
2298
- const proms: Promise<any>[] = [];
2299
-
2300
- if (!def.rest) {
2301
- const tooBig = input.length > items.length;
2302
- const tooSmall = input.length < optStart - 1;
2303
- if (tooBig || tooSmall) {
2304
- payload.issues.push({
2305
- input,
2306
- inst,
2307
- origin: "array" as const,
2308
- ...(tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }),
2309
- });
2310
- return payload;
2311
- }
2312
- }
2313
-
2314
- let i = -1;
2315
- for (const item of items) {
2316
- i++;
2317
- if (i >= input.length) if (i >= optStart) continue;
2318
- const result = item._zod.run(
2319
- {
2320
- value: input[i],
2321
- issues: [],
2322
- },
2323
- ctx
2324
- );
2325
-
2326
- if (result instanceof Promise) {
2327
- proms.push(result.then((result) => handleTupleResult(result, payload, i)));
2328
- } else {
2329
- handleTupleResult(result, payload, i);
2330
- }
2331
- }
2332
-
2333
- if (def.rest) {
2334
- const rest = input.slice(items.length);
2335
- for (const el of rest) {
2336
- i++;
2337
- const result = def.rest._zod.run(
2338
- {
2339
- value: el,
2340
- issues: [],
2341
- },
2342
- ctx
2343
- );
2344
-
2345
- if (result instanceof Promise) {
2346
- proms.push(result.then((result) => handleTupleResult(result, payload, i)));
2347
- } else {
2348
- handleTupleResult(result, payload, i);
2349
- }
2350
- }
2351
- }
2352
-
2353
- if (proms.length) return Promise.all(proms).then(() => payload);
2354
- return payload;
2355
- };
2356
- });
2357
-
2358
- function handleTupleResult(result: ParsePayload, final: ParsePayload<any[]>, index: number) {
2359
- if (result.issues.length) {
2360
- final.issues.push(...util.prefixIssues(index, result.issues));
2361
- }
2362
- final.value[index] = result.value;
2363
- }
2364
-
2365
- //////////////////////////////////////////
2366
- //////////////////////////////////////////
2367
- ////////// //////////
2368
- ////////// $ZodRecord //////////
2369
- ////////// //////////
2370
- //////////////////////////////////////////
2371
- //////////////////////////////////////////
2372
-
2373
- export type $ZodRecordKey = $ZodType<string | number | symbol, string | number | symbol>; // $HasValues | $HasPattern;
2374
- export interface $ZodRecordDef<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType>
2375
- extends $ZodTypeDef {
2376
- type: "record";
2377
- keyType: Key;
2378
- valueType: Value;
2379
- }
2380
-
2381
- // export type $InferZodRecordOutput<
2382
- // Key extends $ZodRecordKey = $ZodRecordKey,
2383
- // Value extends SomeType = $ZodType,
2384
- // > = undefined extends Key["_zod"]["values"]
2385
- // ? string extends core.output<Key>
2386
- // ? Record<core.output<Key>, core.output<Value>>
2387
- // : number extends core.output<Key>
2388
- // ? Record<core.output<Key>, core.output<Value>>
2389
- // : symbol extends core.output<Key>
2390
- // ? Record<core.output<Key>, core.output<Value>>
2391
- // : Record<core.output<Key>, core.output<Value>>
2392
- // : Record<core.output<Key>, core.output<Value>>;
2393
- export type $InferZodRecordOutput<
2394
- Key extends $ZodRecordKey = $ZodRecordKey,
2395
- Value extends SomeType = $ZodType,
2396
- > = Key extends $partial
2397
- ? Partial<Record<core.output<Key>, core.output<Value>>>
2398
- : Record<core.output<Key>, core.output<Value>>;
2399
-
2400
- // export type $InferZodRecordInput<
2401
- // Key extends $ZodRecordKey = $ZodRecordKey,
2402
- // Value extends SomeType = $ZodType,
2403
- // > = undefined extends Key["_zod"]["values"]
2404
- // ? string extends core.input<Key>
2405
- // ? Record<core.input<Key>, core.input<Value>>
2406
- // : number extends core.input<Key>
2407
- // ? Record<core.input<Key>, core.input<Value>>
2408
- // : symbol extends core.input<Key>
2409
- // ? Record<core.input<Key>, core.input<Value>>
2410
- // : Record<core.input<Key>, core.input<Value>>
2411
- // : Record<core.input<Key>, core.input<Value>>;
2412
- export type $InferZodRecordInput<
2413
- Key extends $ZodRecordKey = $ZodRecordKey,
2414
- Value extends SomeType = $ZodType,
2415
- > = Key extends $partial
2416
- ? Partial<Record<core.input<Key>, core.input<Value>>>
2417
- : Record<core.input<Key>, core.input<Value>>;
2418
-
2419
- export interface $ZodRecordInternals<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType>
2420
- extends $ZodTypeInternals<$InferZodRecordOutput<Key, Value>, $InferZodRecordInput<Key, Value>> {
2421
- def: $ZodRecordDef<Key, Value>;
2422
- isst: errors.$ZodIssueInvalidType | errors.$ZodIssueInvalidKey<Record<PropertyKey, unknown>>;
2423
- optin?: "optional" | undefined;
2424
- optout?: "optional" | undefined;
2425
- }
2426
-
2427
- export type $partial = { "~~partial": true };
2428
- export interface $ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType>
2429
- extends $ZodType {
2430
- _zod: $ZodRecordInternals<Key, Value>;
2431
- }
2432
-
2433
- export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, def) => {
2434
- $ZodType.init(inst, def);
2435
-
2436
- inst._zod.parse = (payload, ctx) => {
2437
- const input = payload.value;
2438
-
2439
- if (!util.isPlainObject(input)) {
2440
- payload.issues.push({
2441
- expected: "record",
2442
- code: "invalid_type",
2443
- input,
2444
- inst,
2445
- });
2446
- return payload;
2447
- }
2448
-
2449
- const proms: Promise<any>[] = [];
2450
-
2451
- if (def.keyType._zod.values) {
2452
- const values = def.keyType._zod.values!;
2453
- payload.value = {};
2454
- for (const key of values) {
2455
- if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
2456
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
2457
-
2458
- if (result instanceof Promise) {
2459
- proms.push(
2460
- result.then((result) => {
2461
- if (result.issues.length) {
2462
- payload.issues.push(...util.prefixIssues(key, result.issues));
2463
- }
2464
- payload.value[key] = result.value;
2465
- })
2466
- );
2467
- } else {
2468
- if (result.issues.length) {
2469
- payload.issues.push(...util.prefixIssues(key, result.issues));
2470
- }
2471
- payload.value[key] = result.value;
2472
- }
2473
- }
2474
- }
2475
-
2476
- let unrecognized!: string[];
2477
- for (const key in input) {
2478
- if (!values.has(key)) {
2479
- unrecognized = unrecognized ?? [];
2480
- unrecognized.push(key);
2481
- }
2482
- }
2483
- if (unrecognized && unrecognized.length > 0) {
2484
- payload.issues.push({
2485
- code: "unrecognized_keys",
2486
- input,
2487
- inst,
2488
- keys: unrecognized,
2489
- });
2490
- }
2491
- } else {
2492
- payload.value = {};
2493
- for (const key of Reflect.ownKeys(input)) {
2494
- if (key === "__proto__") continue;
2495
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
2496
-
2497
- if (keyResult instanceof Promise) {
2498
- throw new Error("Async schemas not supported in object keys currently");
2499
- }
2500
-
2501
- if (keyResult.issues.length) {
2502
- payload.issues.push({
2503
- origin: "record",
2504
- code: "invalid_key",
2505
- issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
2506
- input: key,
2507
- path: [key],
2508
- inst,
2509
- });
2510
- payload.value[keyResult.value as PropertyKey] = keyResult.value;
2511
- continue;
2512
- }
2513
-
2514
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
2515
-
2516
- if (result instanceof Promise) {
2517
- proms.push(
2518
- result.then((result) => {
2519
- if (result.issues.length) {
2520
- payload.issues.push(...util.prefixIssues(key, result.issues));
2521
- }
2522
- payload.value[keyResult.value as PropertyKey] = result.value;
2523
- })
2524
- );
2525
- } else {
2526
- if (result.issues.length) {
2527
- payload.issues.push(...util.prefixIssues(key, result.issues));
2528
- }
2529
- payload.value[keyResult.value as PropertyKey] = result.value;
2530
- }
2531
- }
2532
- }
2533
-
2534
- if (proms.length) {
2535
- return Promise.all(proms).then(() => payload);
2536
- }
2537
- return payload;
2538
- };
2539
- });
2540
-
2541
- ///////////////////////////////////////
2542
- ///////////////////////////////////////
2543
- ////////// //////////
2544
- ////////// $ZodMap //////////
2545
- ////////// //////////
2546
- ///////////////////////////////////////
2547
- ///////////////////////////////////////
2548
- export interface $ZodMapDef<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodTypeDef {
2549
- type: "map";
2550
- keyType: Key;
2551
- valueType: Value;
2552
- }
2553
-
2554
- export interface $ZodMapInternals<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType>
2555
- extends $ZodTypeInternals<Map<core.output<Key>, core.output<Value>>, Map<core.input<Key>, core.input<Value>>> {
2556
- def: $ZodMapDef<Key, Value>;
2557
- isst: errors.$ZodIssueInvalidType | errors.$ZodIssueInvalidKey | errors.$ZodIssueInvalidElement<unknown>;
2558
- optin?: "optional" | undefined;
2559
- optout?: "optional" | undefined;
2560
- }
2561
-
2562
- export interface $ZodMap<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodType {
2563
- _zod: $ZodMapInternals<Key, Value>;
2564
- }
2565
-
2566
- export const $ZodMap: core.$constructor<$ZodMap> = /*@__PURE__*/ core.$constructor("$ZodMap", (inst, def) => {
2567
- $ZodType.init(inst, def);
2568
-
2569
- inst._zod.parse = (payload, ctx) => {
2570
- const input = payload.value;
2571
- if (!(input instanceof Map)) {
2572
- payload.issues.push({
2573
- expected: "map",
2574
- code: "invalid_type",
2575
- input,
2576
- inst,
2577
- });
2578
- return payload;
2579
- }
2580
-
2581
- const proms: Promise<any>[] = [];
2582
- payload.value = new Map();
2583
-
2584
- for (const [key, value] of input) {
2585
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
2586
- const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
2587
-
2588
- if (keyResult instanceof Promise || valueResult instanceof Promise) {
2589
- proms.push(
2590
- Promise.all([keyResult, valueResult]).then(([keyResult, valueResult]) => {
2591
- handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
2592
- })
2593
- );
2594
- } else {
2595
- handleMapResult(keyResult as ParsePayload, valueResult as ParsePayload, payload, key, input, inst, ctx);
2596
- }
2597
- }
2598
-
2599
- if (proms.length) return Promise.all(proms).then(() => payload);
2600
- return payload;
2601
- };
2602
- });
2603
-
2604
- function handleMapResult(
2605
- keyResult: ParsePayload,
2606
- valueResult: ParsePayload,
2607
- final: ParsePayload<Map<unknown, unknown>>,
2608
- key: unknown,
2609
- input: Map<any, any>,
2610
- inst: $ZodMap,
2611
- ctx?: ParseContext | undefined
2612
- ): void {
2613
- if (keyResult.issues.length) {
2614
- if (util.propertyKeyTypes.has(typeof key)) {
2615
- final.issues.push(...util.prefixIssues(key as PropertyKey, keyResult.issues));
2616
- } else {
2617
- final.issues.push({
2618
- origin: "map",
2619
- code: "invalid_key",
2620
- input,
2621
- inst,
2622
- issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
2623
- });
2624
- }
2625
- }
2626
- if (valueResult.issues.length) {
2627
- if (util.propertyKeyTypes.has(typeof key)) {
2628
- final.issues.push(...util.prefixIssues(key as PropertyKey, valueResult.issues));
2629
- } else {
2630
- final.issues.push({
2631
- origin: "map",
2632
- code: "invalid_element",
2633
- input,
2634
- inst,
2635
- key: key,
2636
- issues: valueResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
2637
- });
2638
- }
2639
- }
2640
- final.value.set(keyResult.value, valueResult.value);
2641
- }
2642
-
2643
- ///////////////////////////////////////
2644
- ///////////////////////////////////////
2645
- ////////// //////////
2646
- ////////// $ZodSet //////////
2647
- ////////// //////////
2648
- ///////////////////////////////////////
2649
- ///////////////////////////////////////
2650
- export interface $ZodSetDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
2651
- type: "set";
2652
- valueType: T;
2653
- }
2654
-
2655
- export interface $ZodSetInternals<T extends SomeType = $ZodType>
2656
- extends $ZodTypeInternals<Set<core.output<T>>, Set<core.input<T>>> {
2657
- def: $ZodSetDef<T>;
2658
- isst: errors.$ZodIssueInvalidType;
2659
- optin?: "optional" | undefined;
2660
- optout?: "optional" | undefined;
2661
- }
2662
-
2663
- export interface $ZodSet<T extends SomeType = $ZodType> extends $ZodType {
2664
- _zod: $ZodSetInternals<T>;
2665
- }
2666
-
2667
- export const $ZodSet: core.$constructor<$ZodSet> = /*@__PURE__*/ core.$constructor("$ZodSet", (inst, def) => {
2668
- $ZodType.init(inst, def);
2669
-
2670
- inst._zod.parse = (payload, ctx) => {
2671
- const input = payload.value;
2672
- if (!(input instanceof Set)) {
2673
- payload.issues.push({
2674
- input,
2675
- inst,
2676
- expected: "set",
2677
- code: "invalid_type",
2678
- });
2679
- return payload;
2680
- }
2681
-
2682
- const proms: Promise<any>[] = [];
2683
- payload.value = new Set();
2684
- for (const item of input) {
2685
- const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
2686
- if (result instanceof Promise) {
2687
- proms.push(result.then((result) => handleSetResult(result, payload)));
2688
- } else handleSetResult(result, payload);
2689
- }
2690
-
2691
- if (proms.length) return Promise.all(proms).then(() => payload);
2692
- return payload;
2693
- };
2694
- });
2695
-
2696
- function handleSetResult(result: ParsePayload, final: ParsePayload<Set<any>>) {
2697
- if (result.issues.length) {
2698
- final.issues.push(...result.issues);
2699
- }
2700
- final.value.add(result.value);
2701
- }
2702
-
2703
- ////////////////////////////////////////
2704
- ////////////////////////////////////////
2705
- ////////// //////////
2706
- ////////// $ZodEnum //////////
2707
- ////////// //////////
2708
- ////////////////////////////////////////
2709
- ////////////////////////////////////////
2710
- export type $InferEnumOutput<T extends util.EnumLike> = T[keyof T] & {};
2711
- export type $InferEnumInput<T extends util.EnumLike> = T[keyof T] & {};
2712
-
2713
- export interface $ZodEnumDef<T extends util.EnumLike = util.EnumLike> extends $ZodTypeDef {
2714
- type: "enum";
2715
- entries: T;
2716
- }
2717
-
2718
- export interface $ZodEnumInternals<
2719
- /** @ts-ignore Cast variance */
2720
- out T extends util.EnumLike = util.EnumLike,
2721
- > extends $ZodTypeInternals<$InferEnumOutput<T>, $InferEnumInput<T>> {
2722
- // enum: T;
2723
-
2724
- def: $ZodEnumDef<T>;
2725
- /** @deprecated Internal API, use with caution (not deprecated) */
2726
- values: util.PrimitiveSet;
2727
- /** @deprecated Internal API, use with caution (not deprecated) */
2728
- pattern: RegExp;
2729
- isst: errors.$ZodIssueInvalidValue;
2730
- }
2731
-
2732
- export interface $ZodEnum<T extends util.EnumLike = util.EnumLike> extends $ZodType {
2733
- _zod: $ZodEnumInternals<T>;
2734
- }
2735
-
2736
- export const $ZodEnum: core.$constructor<$ZodEnum> = /*@__PURE__*/ core.$constructor("$ZodEnum", (inst, def) => {
2737
- $ZodType.init(inst, def);
2738
-
2739
- const values = util.getEnumValues(def.entries);
2740
-
2741
- inst._zod.values = new Set<util.Primitive>(values);
2742
-
2743
- inst._zod.pattern = new RegExp(
2744
- `^(${values
2745
- .filter((k) => util.propertyKeyTypes.has(typeof k))
2746
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o.toString()))
2747
- .join("|")})$`
2748
- );
2749
-
2750
- inst._zod.parse = (payload, _ctx) => {
2751
- const input = payload.value;
2752
- if (inst._zod.values.has(input)) {
2753
- return payload;
2754
- }
2755
- payload.issues.push({
2756
- code: "invalid_value",
2757
- values,
2758
- input,
2759
- inst,
2760
- });
2761
- return payload;
2762
- };
2763
- });
2764
-
2765
- ////////////////////////////////////////
2766
- ////////////////////////////////////////
2767
- ////////// //////////
2768
- ////////// $ZodLiteral //////////
2769
- ////////// //////////
2770
- ////////////////////////////////////////
2771
- ////////////////////////////////////////
2772
-
2773
- export interface $ZodLiteralDef<T extends util.Literal> extends $ZodTypeDef {
2774
- type: "literal";
2775
- values: T[];
2776
- }
2777
-
2778
- export interface $ZodLiteralInternals<T extends util.Literal = util.Literal> extends $ZodTypeInternals<T, T> {
2779
- def: $ZodLiteralDef<T>;
2780
- values: Set<T>;
2781
- pattern: RegExp;
2782
- isst: errors.$ZodIssueInvalidValue;
2783
- }
2784
-
2785
- export interface $ZodLiteral<T extends util.Literal = util.Literal> extends $ZodType {
2786
- _zod: $ZodLiteralInternals<T>;
2787
- }
2788
-
2789
- export const $ZodLiteral: core.$constructor<$ZodLiteral> = /*@__PURE__*/ core.$constructor(
2790
- "$ZodLiteral",
2791
- (inst, def) => {
2792
- $ZodType.init(inst, def);
2793
-
2794
- inst._zod.values = new Set<util.Literal>(def.values);
2795
- inst._zod.pattern = new RegExp(
2796
- `^(${def.values
2797
-
2798
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? o.toString() : String(o)))
2799
- .join("|")})$`
2800
- );
2801
-
2802
- inst._zod.parse = (payload, _ctx) => {
2803
- const input = payload.value;
2804
- if (inst._zod.values.has(input)) {
2805
- return payload;
2806
- }
2807
- payload.issues.push({
2808
- code: "invalid_value",
2809
- values: def.values,
2810
- input,
2811
- inst,
2812
- });
2813
- return payload;
2814
- };
2815
- }
2816
- );
2817
-
2818
- ////////////////////////////////////////
2819
- ////////////////////////////////////////
2820
- ////////// //////////
2821
- ////////// $ZodConst //////////
2822
- ////////// //////////
2823
- ////////////////////////////////////////
2824
- ////////////////////////////////////////
2825
-
2826
- // export interface $ZodConstDef extends $ZodTypeDef {
2827
- // type: "const";
2828
- // value: unknown;
2829
- // }
2830
-
2831
- // export _interface $ZodConstInternals<T extends util.Literal = util.Literal> extends $ZodTypeInternals<T, T> {
2832
- // _def: $ZodConstDef;
2833
- // _values: util.PrimitiveSet;
2834
- // _pattern: RegExp;
2835
- // _isst: errors.$ZodIssueInvalidValue;
2836
- // }
2837
-
2838
- // export const $ZodConst: core.$constructor<{_zod: $ZodConstInternals}> = /*@__PURE__*/ core.$constructor("$ZodConst", (inst, def) => {
2839
- // $ZodType.init(inst, def);
2840
-
2841
- // if (util.primitiveTypes.has(typeof def.value) || def.value === null) {
2842
- // inst._zod.values = new Set<util.Primitive>(def.value as any);
2843
- // }
2844
-
2845
- // if (util.propertyKeyTypes.has(typeof def.value)) {
2846
- // inst._zod.pattern = new RegExp(
2847
- // `^(${typeof def.value === "string" ? util.escapeRegex(def.value) : (def.value as any).toString()})$`
2848
- // );
2849
- // } else {
2850
- // throw new Error("Const value cannot be converted to regex");
2851
- // }
2852
-
2853
- // inst._zod.parse = (payload, _ctx) => {
2854
- // payload.value = def.value; // always override
2855
- // return payload;
2856
- // };
2857
- // });
2858
-
2859
- //////////////////////////////////////////
2860
- //////////////////////////////////////////
2861
- ////////// //////////
2862
- ////////// $ZodFile //////////
2863
- ////////// //////////
2864
- //////////////////////////////////////////
2865
- //////////////////////////////////////////
2866
-
2867
- // provide a fallback in case the File interface isn't provided in the environment
2868
- declare global {
2869
- interface File {}
2870
- }
2871
-
2872
- export interface $ZodFileDef extends $ZodTypeDef {
2873
- type: "file";
2874
- }
2875
-
2876
- export interface $ZodFileInternals extends $ZodTypeInternals<File, File> {
2877
- def: $ZodFileDef;
2878
- isst: errors.$ZodIssueInvalidType;
2879
- bag: util.LoosePartial<{
2880
- minimum: number;
2881
- maximum: number;
2882
- mime: util.MimeTypes[];
2883
- }>;
2884
- }
2885
-
2886
- export interface $ZodFile extends $ZodType {
2887
- _zod: $ZodFileInternals;
2888
- }
2889
-
2890
- export const $ZodFile: core.$constructor<$ZodFile> = /*@__PURE__*/ core.$constructor("$ZodFile", (inst, def) => {
2891
- $ZodType.init(inst, def);
2892
-
2893
- inst._zod.parse = (payload, _ctx) => {
2894
- const input = payload.value;
2895
- if (input instanceof File) return payload;
2896
- payload.issues.push({
2897
- expected: "file",
2898
- code: "invalid_type",
2899
- input,
2900
- inst,
2901
- });
2902
- return payload;
2903
- };
2904
- });
2905
-
2906
- //////////////////////////////////////////////
2907
- //////////////////////////////////////////////
2908
- ////////// //////////
2909
- ////////// $ZodTransform //////////
2910
- ////////// //////////
2911
- //////////////////////////////////////////////
2912
- //////////////////////////////////////////////
2913
- export interface $ZodTransformDef extends $ZodTypeDef {
2914
- type: "transform";
2915
- transform: (input: unknown, payload: ParsePayload<unknown>) => util.MaybeAsync<unknown>;
2916
- }
2917
- export interface $ZodTransformInternals<O = unknown, I = unknown> extends $ZodTypeInternals<O, I> {
2918
- def: $ZodTransformDef;
2919
- isst: never;
2920
- }
2921
-
2922
- export interface $ZodTransform<O = unknown, I = unknown> extends $ZodType {
2923
- _zod: $ZodTransformInternals<O, I>;
2924
- }
2925
-
2926
- export const $ZodTransform: core.$constructor<$ZodTransform> = /*@__PURE__*/ core.$constructor(
2927
- "$ZodTransform",
2928
- (inst, def) => {
2929
- $ZodType.init(inst, def);
2930
- inst._zod.parse = (payload, _ctx) => {
2931
- const _out = def.transform(payload.value, payload);
2932
- if (_ctx.async) {
2933
- const output = _out instanceof Promise ? _out : Promise.resolve(_out);
2934
- return output.then((output) => {
2935
- payload.value = output;
2936
- return payload;
2937
- });
2938
- }
2939
-
2940
- if (_out instanceof Promise) {
2941
- throw new core.$ZodAsyncError();
2942
- }
2943
-
2944
- payload.value = _out;
2945
- return payload;
2946
- };
2947
- }
2948
- );
2949
-
2950
- ////////////////////////////////////////////
2951
- ////////////////////////////////////////////
2952
- ////////// //////////
2953
- ////////// $ZodOptional //////////
2954
- ////////// //////////
2955
- ////////////////////////////////////////////
2956
- ////////////////////////////////////////////
2957
- export interface $ZodOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
2958
- type: "optional";
2959
- innerType: T;
2960
- }
2961
-
2962
- export interface $ZodOptionalInternals<T extends SomeType = $ZodType>
2963
- extends $ZodTypeInternals<core.output<T> | undefined, core.input<T> | undefined> {
2964
- def: $ZodOptionalDef<T>;
2965
- optin: "optional";
2966
- optout: "optional";
2967
- isst: never;
2968
- values: T["_zod"]["values"];
2969
- pattern: T["_zod"]["pattern"];
2970
- }
2971
-
2972
- export interface $ZodOptional<T extends SomeType = $ZodType> extends $ZodType {
2973
- _zod: $ZodOptionalInternals<T>;
2974
- }
2975
-
2976
- export const $ZodOptional: core.$constructor<$ZodOptional> = /*@__PURE__*/ core.$constructor(
2977
- "$ZodOptional",
2978
- (inst, def) => {
2979
- $ZodType.init(inst, def);
2980
- inst._zod.optin = "optional";
2981
- inst._zod.optout = "optional";
2982
-
2983
- util.defineLazy(inst._zod, "values", () => {
2984
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
2985
- });
2986
- util.defineLazy(inst._zod, "pattern", () => {
2987
- const pattern = def.innerType._zod.pattern;
2988
- return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
2989
- });
2990
-
2991
- inst._zod.parse = (payload, ctx) => {
2992
- if (def.innerType._zod.optin === "optional") {
2993
- return def.innerType._zod.run(payload, ctx);
2994
- }
2995
- if (payload.value === undefined) {
2996
- return payload;
2997
- }
2998
- return def.innerType._zod.run(payload, ctx);
2999
- };
3000
- }
3001
- );
3002
-
3003
- ////////////////////////////////////////////
3004
- ////////////////////////////////////////////
3005
- ////////// //////////
3006
- ////////// $ZodNullable //////////
3007
- ////////// //////////
3008
- ////////////////////////////////////////////
3009
- ////////////////////////////////////////////
3010
- export interface $ZodNullableDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3011
- type: "nullable";
3012
- innerType: T;
3013
- }
3014
-
3015
- export interface $ZodNullableInternals<T extends SomeType = $ZodType>
3016
- extends $ZodTypeInternals<core.output<T> | null, core.input<T> | null> {
3017
- def: $ZodNullableDef<T>;
3018
- optin: T["_zod"]["optin"];
3019
- optout: T["_zod"]["optout"];
3020
- isst: never;
3021
- values: T["_zod"]["values"];
3022
- pattern: T["_zod"]["pattern"];
3023
- }
3024
-
3025
- export interface $ZodNullable<T extends SomeType = $ZodType> extends $ZodType {
3026
- _zod: $ZodNullableInternals<T>;
3027
- }
3028
-
3029
- export const $ZodNullable: core.$constructor<$ZodNullable> = /*@__PURE__*/ core.$constructor(
3030
- "$ZodNullable",
3031
- (inst, def) => {
3032
- $ZodType.init(inst, def);
3033
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
3034
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
3035
-
3036
- util.defineLazy(inst._zod, "pattern", () => {
3037
- const pattern = def.innerType._zod.pattern;
3038
- return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;
3039
- });
3040
-
3041
- util.defineLazy(inst._zod, "values", () => {
3042
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
3043
- });
3044
-
3045
- inst._zod.parse = (payload, ctx) => {
3046
- if (payload.value === null) return payload;
3047
- return def.innerType._zod.run(payload, ctx);
3048
- };
3049
- }
3050
- );
3051
- // );
3052
-
3053
- ////////////////////////////////////////////
3054
- ////////////////////////////////////////////
3055
- ////////// //////////
3056
- ////////// $ZodDefault //////////
3057
- ////////// //////////
3058
- ////////////////////////////////////////////
3059
- ////////////////////////////////////////////
3060
- export interface $ZodDefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3061
- type: "default";
3062
- innerType: T;
3063
- /** The default value. May be a getter. */
3064
- defaultValue: util.NoUndefined<core.output<T>>;
3065
- }
3066
-
3067
- export interface $ZodDefaultInternals<T extends SomeType = $ZodType>
3068
- extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
3069
- def: $ZodDefaultDef<T>;
3070
- optin: "optional";
3071
- optout?: "optional" | undefined; // required
3072
- isst: never;
3073
- values: T["_zod"]["values"];
3074
- }
3075
-
3076
- export interface $ZodDefault<T extends SomeType = $ZodType> extends $ZodType {
3077
- _zod: $ZodDefaultInternals<T>;
3078
- }
3079
-
3080
- export const $ZodDefault: core.$constructor<$ZodDefault> = /*@__PURE__*/ core.$constructor(
3081
- "$ZodDefault",
3082
- (inst, def) => {
3083
- $ZodType.init(inst, def);
3084
-
3085
- // inst._zod.qin = "true";
3086
- inst._zod.optin = "optional";
3087
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
3088
-
3089
- inst._zod.parse = (payload, ctx) => {
3090
- if (payload.value === undefined) {
3091
- payload.value = def.defaultValue;
3092
- /**
3093
- * $ZodDefault always returns the default value immediately.
3094
- * It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
3095
- return payload;
3096
- }
3097
- const result = def.innerType._zod.run(payload, ctx);
3098
- if (result instanceof Promise) {
3099
- return result.then((result) => handleDefaultResult(result, def));
3100
- }
3101
- return handleDefaultResult(result, def);
3102
- };
3103
- }
3104
- );
3105
-
3106
- function handleDefaultResult(payload: ParsePayload, def: $ZodDefaultDef) {
3107
- if (payload.value === undefined) {
3108
- payload.value = def.defaultValue;
3109
- }
3110
- return payload;
3111
- }
3112
-
3113
- ////////////////////////////////////////////
3114
- ////////////////////////////////////////////
3115
- ////////// //////////
3116
- ////////// $ZodPrefault //////////
3117
- ////////// //////////
3118
- ////////////////////////////////////////////
3119
- ////////////////////////////////////////////
3120
-
3121
- export interface $ZodPrefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3122
- type: "prefault";
3123
- innerType: T;
3124
- /** The default value. May be a getter. */
3125
- defaultValue: core.input<T>;
3126
- }
3127
-
3128
- export interface $ZodPrefaultInternals<T extends SomeType = $ZodType>
3129
- extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
3130
- def: $ZodPrefaultDef<T>;
3131
- optin: "optional";
3132
- optout?: "optional" | undefined;
3133
- isst: never;
3134
- values: T["_zod"]["values"];
3135
- }
3136
-
3137
- export interface $ZodPrefault<T extends SomeType = $ZodType> extends $ZodType {
3138
- _zod: $ZodPrefaultInternals<T>;
3139
- }
3140
-
3141
- export const $ZodPrefault: core.$constructor<$ZodPrefault> = /*@__PURE__*/ core.$constructor(
3142
- "$ZodPrefault",
3143
- (inst, def) => {
3144
- $ZodType.init(inst, def);
3145
-
3146
- inst._zod.optin = "optional";
3147
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
3148
-
3149
- inst._zod.parse = (payload, ctx) => {
3150
- if (payload.value === undefined) {
3151
- payload.value = def.defaultValue;
3152
- }
3153
- return def.innerType._zod.run(payload, ctx);
3154
- };
3155
- }
3156
- );
3157
-
3158
- ///////////////////////////////////////////////
3159
- ///////////////////////////////////////////////
3160
- ////////// //////////
3161
- ////////// $ZodNonOptional //////////
3162
- ////////// //////////
3163
- ///////////////////////////////////////////////
3164
- ///////////////////////////////////////////////
3165
- export interface $ZodNonOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3166
- type: "nonoptional";
3167
- innerType: T;
3168
- }
3169
-
3170
- export interface $ZodNonOptionalInternals<T extends SomeType = $ZodType>
3171
- extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, util.NoUndefined<core.input<T>>> {
3172
- def: $ZodNonOptionalDef<T>;
3173
- isst: errors.$ZodIssueInvalidType;
3174
- values: T["_zod"]["values"];
3175
- optin: "optional" | undefined;
3176
- optout: "optional" | undefined;
3177
- }
3178
-
3179
- export interface $ZodNonOptional<T extends SomeType = $ZodType> extends $ZodType {
3180
- _zod: $ZodNonOptionalInternals<T>;
3181
- }
3182
-
3183
- export const $ZodNonOptional: core.$constructor<$ZodNonOptional> = /*@__PURE__*/ core.$constructor(
3184
- "$ZodNonOptional",
3185
- (inst, def) => {
3186
- $ZodType.init(inst, def);
3187
-
3188
- util.defineLazy(inst._zod, "values", () => {
3189
- const v = def.innerType._zod.values;
3190
- return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
3191
- });
3192
-
3193
- inst._zod.parse = (payload, ctx) => {
3194
- const result = def.innerType._zod.run(payload, ctx);
3195
- if (result instanceof Promise) {
3196
- return result.then((result) => handleNonOptionalResult(result, inst));
3197
- }
3198
- return handleNonOptionalResult(result, inst);
3199
- };
3200
- }
3201
- );
3202
-
3203
- function handleNonOptionalResult(payload: ParsePayload, inst: $ZodNonOptional) {
3204
- if (!payload.issues.length && payload.value === undefined) {
3205
- payload.issues.push({
3206
- code: "invalid_type",
3207
- expected: "nonoptional",
3208
- input: payload.value,
3209
- inst,
3210
- });
3211
- }
3212
- return payload;
3213
- }
3214
-
3215
- ////////////////////////////////////////////
3216
- ////////////////////////////////////////////
3217
- ////////// //////////
3218
- ////////// $ZodCoalesce //////////
3219
- ////////// //////////
3220
- ////////////////////////////////////////////
3221
- ////////////////////////////////////////////
3222
- // export interface $ZodCoalesceDef<T extends $ZodType = $ZodType> extends $ZodTypeDef {
3223
- // type: "coalesce";
3224
- // innerType: T;
3225
- // defaultValue: () => NonNullable<T['_zod']["output"]>;
3226
- // }
3227
-
3228
- // export _interface $ZodCoalesceInternals<T extends $ZodType = $ZodType>
3229
- // extends $ZodTypeInternals<NonNullable<T['_zod']["output"]>, T['_zod']["input"] | undefined | null> {
3230
- // _def: $ZodCoalesceDef<T>;
3231
- // _isst: errors.$ZodIssueInvalidType;
3232
- // _qin: "true";
3233
- // }
3234
-
3235
- // function handleCoalesceResult(payload: ParsePayload, def: $ZodCoalesceDef) {
3236
- // payload.value ??= def.defaultValue();
3237
- // return payload;
3238
- // }
3239
-
3240
- // export const $ZodCoalesce: core.$constructor<{_zod: $ZodCoalesceInternals}> = /*@__PURE__*/ core.$constructor(
3241
- // "$ZodCoalesce",
3242
- // (inst, def) => {
3243
- // $ZodType.init(inst, def);
3244
- // inst._zod.qin = "true";
3245
- // inst._zod.parse = (payload, ctx) => {
3246
- // const result = def.innerType._zod.run(payload, ctx);
3247
- // if (result instanceof Promise) {
3248
- // return result.then((result) => handleCoalesceResult(result, def));
3249
- // }
3250
- // return handleCoalesceResult(result, def);
3251
- // };
3252
- // }
3253
- // );
3254
-
3255
- /////////////////////////////////////////////
3256
- /////////////////////////////////////////////
3257
- ////////// //////////
3258
- ////////// $ZodSuccess //////////
3259
- ////////// //////////
3260
- /////////////////////////////////////////////
3261
- /////////////////////////////////////////////
3262
- export interface $ZodSuccessDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3263
- type: "success";
3264
- innerType: T;
3265
- }
3266
-
3267
- export interface $ZodSuccessInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<boolean, core.input<T>> {
3268
- def: $ZodSuccessDef<T>;
3269
- isst: never;
3270
- optin: T["_zod"]["optin"];
3271
- optout: "optional" | undefined;
3272
- }
3273
-
3274
- export interface $ZodSuccess<T extends SomeType = $ZodType> extends $ZodType {
3275
- _zod: $ZodSuccessInternals<T>;
3276
- }
3277
-
3278
- export const $ZodSuccess: core.$constructor<$ZodSuccess> = /*@__PURE__*/ core.$constructor(
3279
- "$ZodSuccess",
3280
- (inst, def) => {
3281
- $ZodType.init(inst, def);
3282
-
3283
- inst._zod.parse = (payload, ctx) => {
3284
- const result = def.innerType._zod.run(payload, ctx);
3285
- if (result instanceof Promise) {
3286
- return result.then((result) => {
3287
- payload.value = result.issues.length === 0;
3288
- return payload;
3289
- });
3290
- }
3291
- payload.value = result.issues.length === 0;
3292
- return payload;
3293
- };
3294
- }
3295
- );
3296
-
3297
- ////////////////////////////////////////////
3298
- ////////////////////////////////////////////
3299
- ////////// //////////
3300
- ////////// $ZodCatch //////////
3301
- ////////// //////////
3302
- ////////////////////////////////////////////
3303
- ////////////////////////////////////////////
3304
- export interface $ZodCatchCtx extends ParsePayload {
3305
- /** @deprecated Use `ctx.issues` */
3306
- error: { issues: errors.$ZodIssue[] };
3307
- /** @deprecated Use `ctx.value` */
3308
- input: unknown;
3309
- }
3310
- export interface $ZodCatchDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3311
- type: "catch";
3312
- innerType: T;
3313
- catchValue: (ctx: $ZodCatchCtx) => unknown;
3314
- }
3315
-
3316
- export interface $ZodCatchInternals<T extends SomeType = $ZodType>
3317
- extends $ZodTypeInternals<core.output<T>, core.input<T> | util.Whatever> {
3318
- def: $ZodCatchDef<T>;
3319
- // qin: T["_zod"]["qin"];
3320
- // qout: T["_zod"]["qout"];
3321
-
3322
- optin: T["_zod"]["optin"];
3323
- optout: T["_zod"]["optout"];
3324
- isst: never;
3325
- values: T["_zod"]["values"];
3326
- }
3327
-
3328
- export interface $ZodCatch<T extends SomeType = $ZodType> extends $ZodType {
3329
- _zod: $ZodCatchInternals<T>;
3330
- }
3331
-
3332
- export const $ZodCatch: core.$constructor<$ZodCatch> = /*@__PURE__*/ core.$constructor("$ZodCatch", (inst, def) => {
3333
- $ZodType.init(inst, def);
3334
- inst._zod.optin = "optional";
3335
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
3336
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
3337
-
3338
- inst._zod.parse = (payload, ctx) => {
3339
- const result = def.innerType._zod.run(payload, ctx);
3340
- if (result instanceof Promise) {
3341
- return result.then((result) => {
3342
- payload.value = result.value;
3343
- if (result.issues.length) {
3344
- payload.value = def.catchValue({
3345
- ...payload,
3346
- error: {
3347
- issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
3348
- },
3349
- input: payload.value,
3350
- });
3351
- payload.issues = [];
3352
- }
3353
-
3354
- return payload;
3355
- });
3356
- }
3357
-
3358
- payload.value = result.value;
3359
- if (result.issues.length) {
3360
- payload.value = def.catchValue({
3361
- ...payload,
3362
- error: {
3363
- issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
3364
- },
3365
- input: payload.value,
3366
- });
3367
- payload.issues = [];
3368
- }
3369
-
3370
- return payload;
3371
- };
3372
- });
3373
-
3374
- ////////////////////////////////////////////
3375
- ////////////////////////////////////////////
3376
- ////////// //////////
3377
- ////////// $ZodNaN //////////
3378
- ////////// //////////
3379
- ////////////////////////////////////////////
3380
- ////////////////////////////////////////////
3381
- export interface $ZodNaNDef extends $ZodTypeDef {
3382
- type: "nan";
3383
- }
3384
-
3385
- export interface $ZodNaNInternals extends $ZodTypeInternals<number, number> {
3386
- def: $ZodNaNDef;
3387
- isst: errors.$ZodIssueInvalidType;
3388
- }
3389
-
3390
- export interface $ZodNaN extends $ZodType {
3391
- _zod: $ZodNaNInternals;
3392
- }
3393
-
3394
- export const $ZodNaN: core.$constructor<$ZodNaN> = /*@__PURE__*/ core.$constructor("$ZodNaN", (inst, def) => {
3395
- $ZodType.init(inst, def);
3396
-
3397
- inst._zod.parse = (payload, _ctx) => {
3398
- if (typeof payload.value !== "number" || !Number.isNaN(payload.value)) {
3399
- payload.issues.push({
3400
- input: payload.value,
3401
- inst,
3402
- expected: "nan",
3403
- code: "invalid_type",
3404
- });
3405
- return payload;
3406
- }
3407
- return payload;
3408
- };
3409
- });
3410
-
3411
- ////////////////////////////////////////////
3412
- ////////////////////////////////////////////
3413
- ////////// //////////
3414
- ////////// $ZodPipe //////////
3415
- ////////// //////////
3416
- ////////////////////////////////////////////
3417
- ////////////////////////////////////////////
3418
- export interface $ZodPipeDef<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeDef {
3419
- type: "pipe";
3420
- in: A;
3421
- out: B;
3422
- }
3423
-
3424
- export interface $ZodPipeInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType>
3425
- extends $ZodTypeInternals<core.output<B>, core.input<A>> {
3426
- def: $ZodPipeDef<A, B>;
3427
- isst: never;
3428
- values: A["_zod"]["values"];
3429
- optin: A["_zod"]["optin"];
3430
- optout: B["_zod"]["optout"];
3431
- }
3432
-
3433
- export interface $ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
3434
- _zod: $ZodPipeInternals<A, B>;
3435
- }
3436
-
3437
- export const $ZodPipe: core.$constructor<$ZodPipe> = /*@__PURE__*/ core.$constructor("$ZodPipe", (inst, def) => {
3438
- $ZodType.init(inst, def);
3439
- util.defineLazy(inst._zod, "values", () => def.in._zod.values);
3440
- util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
3441
- util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
3442
-
3443
- inst._zod.parse = (payload, ctx) => {
3444
- const left = def.in._zod.run(payload, ctx);
3445
- if (left instanceof Promise) {
3446
- return left.then((left) => handlePipeResult(left, def, ctx));
3447
- }
3448
- return handlePipeResult(left, def, ctx);
3449
- };
3450
- });
3451
-
3452
- function handlePipeResult(left: ParsePayload, def: $ZodPipeDef, ctx: ParseContext) {
3453
- if (util.aborted(left)) {
3454
- return left;
3455
- }
3456
- return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
3457
- }
3458
-
3459
- ////////////////////////////////////////////
3460
- ////////////////////////////////////////////
3461
- ////////// //////////
3462
- ////////// $ZodReadonly //////////
3463
- ////////// //////////
3464
- ////////////////////////////////////////////
3465
- ////////////////////////////////////////////
3466
-
3467
- export interface $ZodReadonlyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3468
- type: "readonly";
3469
- innerType: T;
3470
- }
3471
-
3472
- export interface $ZodReadonlyInternals<T extends SomeType = $ZodType>
3473
- extends $ZodTypeInternals<util.MakeReadonly<core.output<T>>, util.MakeReadonly<core.input<T>>> {
3474
- def: $ZodReadonlyDef<T>;
3475
- optin: T["_zod"]["optin"];
3476
- optout: T["_zod"]["optout"];
3477
- isst: never;
3478
- propValues: T["_zod"]["propValues"];
3479
- values: T["_zod"]["values"];
3480
- }
3481
-
3482
- export interface $ZodReadonly<T extends SomeType = $ZodType> extends $ZodType {
3483
- _zod: $ZodReadonlyInternals<T>;
3484
- }
3485
-
3486
- export const $ZodReadonly: core.$constructor<$ZodReadonly> = /*@__PURE__*/ core.$constructor(
3487
- "$ZodReadonly",
3488
- (inst, def) => {
3489
- $ZodType.init(inst, def);
3490
- util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
3491
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
3492
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
3493
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
3494
-
3495
- inst._zod.parse = (payload, ctx) => {
3496
- const result = def.innerType._zod.run(payload, ctx);
3497
- if (result instanceof Promise) {
3498
- return result.then(handleReadonlyResult);
3499
- }
3500
- return handleReadonlyResult(result);
3501
- };
3502
- }
3503
- );
3504
-
3505
- function handleReadonlyResult(payload: ParsePayload): ParsePayload {
3506
- payload.value = Object.freeze(payload.value);
3507
- return payload;
3508
- }
3509
-
3510
- /////////////////////////////////////////////
3511
- /////////////////////////////////////////////
3512
- ////////// //////////
3513
- ////////// $ZodTemplateLiteral //////////
3514
- ////////// //////////
3515
- /////////////////////////////////////////////
3516
- /////////////////////////////////////////////
3517
-
3518
- export interface $ZodTemplateLiteralDef extends $ZodTypeDef {
3519
- type: "template_literal";
3520
- parts: $ZodTemplateLiteralPart[];
3521
- }
3522
- export interface $ZodTemplateLiteralInternals<Template extends string = string>
3523
- extends $ZodTypeInternals<Template, Template> {
3524
- pattern: RegExp;
3525
- def: $ZodTemplateLiteralDef;
3526
- isst: errors.$ZodIssueInvalidType;
3527
- }
3528
-
3529
- export interface $ZodTemplateLiteral<Template extends string = string> extends $ZodType {
3530
- _zod: $ZodTemplateLiteralInternals<Template>;
3531
- }
3532
-
3533
- type LiteralPart = Exclude<util.Literal, symbol>; //string | number | boolean | null | undefined;
3534
- interface SchemaPartInternals extends $ZodTypeInternals<LiteralPart, LiteralPart> {
3535
- pattern: RegExp;
3536
- }
3537
- interface SchemaPart extends $ZodType {
3538
- _zod: SchemaPartInternals;
3539
- }
3540
- export type $ZodTemplateLiteralPart = LiteralPart | SchemaPart;
3541
-
3542
- type UndefinedToEmptyString<T> = T extends undefined ? "" : T;
3543
- type AppendToTemplateLiteral<
3544
- Template extends string,
3545
- Suffix extends LiteralPart | $ZodType,
3546
- > = Suffix extends LiteralPart
3547
- ? `${Template}${UndefinedToEmptyString<Suffix>}`
3548
- : Suffix extends $ZodType
3549
- ? `${Template}${core.output<Suffix> extends infer T extends LiteralPart ? UndefinedToEmptyString<T> : never}`
3550
- : never;
3551
-
3552
- export type ConcatenateTupleOfStrings<T extends string[]> = T extends [
3553
- infer First extends string,
3554
- ...infer Rest extends string[],
3555
- ]
3556
- ? Rest extends string[]
3557
- ? First extends ""
3558
- ? ConcatenateTupleOfStrings<Rest>
3559
- : `${First}${ConcatenateTupleOfStrings<Rest>}`
3560
- : never
3561
- : "";
3562
- export type ConvertPartsToStringTuple<Parts extends $ZodTemplateLiteralPart[]> = {
3563
- [K in keyof Parts]: Parts[K] extends LiteralPart
3564
- ? `${UndefinedToEmptyString<Parts[K]>}`
3565
- : Parts[K] extends $ZodType
3566
- ? `${core.output<Parts[K]> extends infer T extends LiteralPart ? UndefinedToEmptyString<T> : never}`
3567
- : never;
3568
- };
3569
-
3570
- export type ToTemplateLiteral<Parts extends $ZodTemplateLiteralPart[]> = ConcatenateTupleOfStrings<
3571
- ConvertPartsToStringTuple<Parts>
3572
- >;
3573
- // type lkjasd = ConcatenateTupleOfStrings<["Hello", " ", "World", "!"]>; // "Hello World!"
3574
- export type $PartsToTemplateLiteral<Parts extends $ZodTemplateLiteralPart[]> = [] extends Parts
3575
- ? ``
3576
- : Parts extends [...infer Rest, infer Last extends $ZodTemplateLiteralPart]
3577
- ? Rest extends $ZodTemplateLiteralPart[]
3578
- ? AppendToTemplateLiteral<$PartsToTemplateLiteral<Rest>, Last>
3579
- : never
3580
- : never;
3581
-
3582
- export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__PURE__*/ core.$constructor(
3583
- "$ZodTemplateLiteral",
3584
- (inst, def) => {
3585
- $ZodType.init(inst, def);
3586
- const regexParts: string[] = [];
3587
- for (const part of def.parts) {
3588
- if (part instanceof $ZodType) {
3589
- if (!part._zod.pattern) {
3590
- // if (!source)
3591
- throw new Error(`Invalid template literal part, no pattern found: ${[...(part as any)._zod.traits].shift()}`);
3592
- }
3593
-
3594
- const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
3595
-
3596
- if (!source) throw new Error(`Invalid template literal part: ${part._zod.traits}`);
3597
-
3598
- const start = source.startsWith("^") ? 1 : 0;
3599
- const end = source.endsWith("$") ? source.length - 1 : source.length;
3600
- regexParts.push(source.slice(start, end));
3601
- } else if (part === null || util.primitiveTypes.has(typeof part)) {
3602
- regexParts.push(util.escapeRegex(`${part}`));
3603
- } else {
3604
- throw new Error(`Invalid template literal part: ${part}`);
3605
- }
3606
- }
3607
- inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);
3608
-
3609
- inst._zod.parse = (payload, _ctx) => {
3610
- if (typeof payload.value !== "string") {
3611
- payload.issues.push({
3612
- input: payload.value,
3613
- inst,
3614
- expected: "template_literal",
3615
- code: "invalid_type",
3616
- });
3617
- return payload;
3618
- }
3619
-
3620
- inst._zod.pattern.lastIndex = 0;
3621
-
3622
- if (!inst._zod.pattern.test(payload.value)) {
3623
- payload.issues.push({
3624
- input: payload.value,
3625
- inst,
3626
- code: "invalid_format",
3627
- format: "template_literal",
3628
- pattern: inst._zod.pattern.source,
3629
- });
3630
- return payload;
3631
- }
3632
-
3633
- return payload;
3634
- };
3635
- }
3636
- );
3637
-
3638
- /////////////////////////////////////////
3639
- /////////////////////////////////////////
3640
- ////////// //////////
3641
- ////////// $ZodPromise //////////
3642
- ////////// //////////
3643
- /////////////////////////////////////////
3644
- /////////////////////////////////////////
3645
- export interface $ZodPromiseDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3646
- type: "promise";
3647
- innerType: T;
3648
- }
3649
-
3650
- export interface $ZodPromiseInternals<T extends SomeType = $ZodType>
3651
- extends $ZodTypeInternals<core.output<T>, util.MaybeAsync<core.input<T>>> {
3652
- def: $ZodPromiseDef<T>;
3653
- isst: never;
3654
- }
3655
-
3656
- export interface $ZodPromise<T extends SomeType = $ZodType> extends $ZodType {
3657
- _zod: $ZodPromiseInternals<T>;
3658
- }
3659
-
3660
- export const $ZodPromise: core.$constructor<$ZodPromise> = /*@__PURE__*/ core.$constructor(
3661
- "$ZodPromise",
3662
- (inst, def) => {
3663
- $ZodType.init(inst, def);
3664
-
3665
- inst._zod.parse = (payload, ctx) => {
3666
- return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));
3667
- };
3668
- }
3669
- );
3670
-
3671
- //////////////////////////////////////////
3672
- //////////////////////////////////////////
3673
- ////////// //////////
3674
- ////////// $ZodLazy //////////
3675
- ////////// //////////
3676
- //////////////////////////////////////////
3677
- //////////////////////////////////////////
3678
-
3679
- export interface $ZodLazyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3680
- type: "lazy";
3681
- getter: () => T;
3682
- }
3683
-
3684
- export interface $ZodLazyInternals<T extends SomeType = $ZodType>
3685
- extends $ZodTypeInternals<core.output<T>, core.input<T>> {
3686
- def: $ZodLazyDef<T>;
3687
- isst: never;
3688
- /** Auto-cached way to retrieve the inner schema */
3689
- innerType: T;
3690
- pattern: T["_zod"]["pattern"];
3691
- propValues: T["_zod"]["propValues"];
3692
- optin: T["_zod"]["optin"];
3693
- optout: T["_zod"]["optout"];
3694
- }
3695
-
3696
- export interface $ZodLazy<T extends SomeType = $ZodType> extends $ZodType {
3697
- _zod: $ZodLazyInternals<T>;
3698
- }
3699
-
3700
- export const $ZodLazy: core.$constructor<$ZodLazy> = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def) => {
3701
- $ZodType.init(inst, def);
3702
-
3703
- util.defineLazy(inst._zod, "innerType", () => def.getter() as $ZodType);
3704
- util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
3705
- util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
3706
- util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin);
3707
- util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout);
3708
- inst._zod.parse = (payload, ctx) => {
3709
- const inner = inst._zod.innerType;
3710
- return inner._zod.run(payload, ctx);
3711
- };
3712
- });
3713
-
3714
- ////////////////////////////////////////
3715
- ////////////////////////////////////////
3716
- ////////// //////////
3717
- ////////// $ZodCustom //////////
3718
- ////////// //////////
3719
- ////////////////////////////////////////
3720
- ////////////////////////////////////////
3721
- export interface $ZodCustomDef<O = unknown> extends $ZodTypeDef, checks.$ZodCheckDef {
3722
- type: "custom";
3723
- check: "custom";
3724
- path?: PropertyKey[] | undefined;
3725
- error?: errors.$ZodErrorMap | undefined;
3726
- params?: Record<string, any> | undefined;
3727
- fn: (arg: O) => unknown;
3728
- }
3729
-
3730
- export interface $ZodCustomInternals<O = unknown, I = unknown>
3731
- extends $ZodTypeInternals<O, I>,
3732
- checks.$ZodCheckInternals<O> {
3733
- def: $ZodCustomDef;
3734
- issc: errors.$ZodIssue;
3735
- isst: never;
3736
- bag: util.LoosePartial<{
3737
- Class: typeof util.Class;
3738
- }>;
3739
- }
3740
-
3741
- export interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
3742
- _zod: $ZodCustomInternals<O, I>;
3743
- }
3744
-
3745
- export const $ZodCustom: core.$constructor<$ZodCustom> = /*@__PURE__*/ core.$constructor("$ZodCustom", (inst, def) => {
3746
- checks.$ZodCheck.init(inst, def);
3747
- $ZodType.init(inst, def);
3748
-
3749
- inst._zod.parse = (payload, _) => {
3750
- return payload;
3751
- };
3752
-
3753
- inst._zod.check = (payload) => {
3754
- const input = payload.value;
3755
- const r = def.fn(input as any);
3756
- if (r instanceof Promise) {
3757
- return r.then((r) => handleRefineResult(r, payload, input, inst));
3758
- }
3759
- handleRefineResult(r, payload, input, inst);
3760
- return;
3761
- };
3762
- });
3763
-
3764
- function handleRefineResult(result: unknown, payload: ParsePayload, input: unknown, inst: $ZodCustom): void {
3765
- if (!result) {
3766
- const _iss: any = {
3767
- code: "custom",
3768
- input,
3769
- inst, // incorporates params.error into issue reporting
3770
- path: [...(inst._zod.def.path ?? [])], // incorporates params.error into issue reporting
3771
- continue: !inst._zod.def.abort,
3772
- // params: inst._zod.def.params,
3773
- };
3774
- if (inst._zod.def.params) _iss.params = inst._zod.def.params;
3775
- payload.issues.push(util.issue(_iss));
3776
- }
3777
- }
3778
-
3779
- export type $ZodTypes =
3780
- | $ZodString
3781
- | $ZodNumber
3782
- | $ZodBigInt
3783
- | $ZodBoolean
3784
- | $ZodDate
3785
- | $ZodSymbol
3786
- | $ZodUndefined
3787
- | $ZodNullable
3788
- | $ZodNull
3789
- | $ZodAny
3790
- | $ZodUnknown
3791
- | $ZodNever
3792
- | $ZodVoid
3793
- | $ZodArray
3794
- | $ZodObject
3795
- | $ZodUnion
3796
- | $ZodIntersection
3797
- | $ZodTuple
3798
- | $ZodRecord
3799
- | $ZodMap
3800
- | $ZodSet
3801
- | $ZodLiteral
3802
- | $ZodEnum
3803
- | $ZodPromise
3804
- | $ZodLazy
3805
- | $ZodOptional
3806
- | $ZodDefault
3807
- | $ZodPrefault
3808
- | $ZodTemplateLiteral
3809
- | $ZodCustom
3810
- | $ZodTransform
3811
- | $ZodNonOptional
3812
- | $ZodReadonly
3813
- | $ZodNaN
3814
- | $ZodPipe
3815
- | $ZodSuccess
3816
- | $ZodCatch
3817
- | $ZodFile;
3818
-
3819
- export type $ZodStringFormatTypes =
3820
- | $ZodGUID
3821
- | $ZodUUID
3822
- | $ZodEmail
3823
- | $ZodURL
3824
- | $ZodEmoji
3825
- | $ZodNanoID
3826
- | $ZodCUID
3827
- | $ZodCUID2
3828
- | $ZodULID
3829
- | $ZodXID
3830
- | $ZodKSUID
3831
- | $ZodISODateTime
3832
- | $ZodISODate
3833
- | $ZodISOTime
3834
- | $ZodISODuration
3835
- | $ZodIPv4
3836
- | $ZodIPv6
3837
- | $ZodCIDRv4
3838
- | $ZodCIDRv6
3839
- | $ZodBase64
3840
- | $ZodBase64URL
3841
- | $ZodE164
3842
- | $ZodJWT;