@farthershore/cli 0.3.10 → 0.3.12

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 (1255) hide show
  1. package/README.md +84 -10
  2. package/dist/index.js +460 -94
  3. package/dist/mcp.js +201 -0
  4. package/package.json +17 -16
  5. package/dist/auth.d.ts +0 -1
  6. package/dist/auth.js +0 -17
  7. package/dist/build-info.d.ts +0 -1
  8. package/dist/build-info.js +0 -10
  9. package/dist/client.d.ts +0 -89
  10. package/dist/client.js +0 -82
  11. package/dist/commands/apply.d.ts +0 -3
  12. package/dist/commands/apply.js +0 -296
  13. package/dist/commands/billing.d.ts +0 -3
  14. package/dist/commands/billing.js +0 -99
  15. package/dist/commands/feature.d.ts +0 -3
  16. package/dist/commands/feature.js +0 -109
  17. package/dist/commands/helpers.d.ts +0 -15
  18. package/dist/commands/helpers.js +0 -93
  19. package/dist/commands/init.d.ts +0 -3
  20. package/dist/commands/init.js +0 -43
  21. package/dist/commands/login.d.ts +0 -2
  22. package/dist/commands/login.js +0 -144
  23. package/dist/commands/meter.d.ts +0 -3
  24. package/dist/commands/meter.js +0 -121
  25. package/dist/commands/plan-transition.d.ts +0 -40
  26. package/dist/commands/plan-transition.js +0 -504
  27. package/dist/commands/plan.d.ts +0 -3
  28. package/dist/commands/plan.js +0 -234
  29. package/dist/commands/product.d.ts +0 -3
  30. package/dist/commands/product.js +0 -137
  31. package/dist/commands/transition.d.ts +0 -3
  32. package/dist/commands/transition.js +0 -80
  33. package/dist/commands/validate.d.ts +0 -28
  34. package/dist/commands/validate.js +0 -216
  35. package/dist/config.d.ts +0 -6
  36. package/dist/config.js +0 -58
  37. package/dist/index.d.ts +0 -2
  38. package/dist/output.d.ts +0 -8
  39. package/dist/output.js +0 -28
  40. package/dist/remediation.d.ts +0 -6
  41. package/dist/remediation.js +0 -53
  42. package/dist/types.d.ts +0 -75
  43. package/dist/types.js +0 -23
  44. package/node_modules/@farther-shore/shared-types/README.md +0 -63
  45. package/node_modules/@farther-shore/shared-types/dist/admin.d.ts +0 -26
  46. package/node_modules/@farther-shore/shared-types/dist/admin.d.ts.map +0 -1
  47. package/node_modules/@farther-shore/shared-types/dist/admin.js +0 -10
  48. package/node_modules/@farther-shore/shared-types/dist/admin.js.map +0 -1
  49. package/node_modules/@farther-shore/shared-types/dist/analytics.d.ts +0 -229
  50. package/node_modules/@farther-shore/shared-types/dist/analytics.d.ts.map +0 -1
  51. package/node_modules/@farther-shore/shared-types/dist/analytics.js +0 -101
  52. package/node_modules/@farther-shore/shared-types/dist/analytics.js.map +0 -1
  53. package/node_modules/@farther-shore/shared-types/dist/api.d.ts +0 -16
  54. package/node_modules/@farther-shore/shared-types/dist/api.d.ts.map +0 -1
  55. package/node_modules/@farther-shore/shared-types/dist/api.js +0 -5
  56. package/node_modules/@farther-shore/shared-types/dist/api.js.map +0 -1
  57. package/node_modules/@farther-shore/shared-types/dist/auth/permissions.d.ts +0 -63
  58. package/node_modules/@farther-shore/shared-types/dist/auth/permissions.d.ts.map +0 -1
  59. package/node_modules/@farther-shore/shared-types/dist/auth/permissions.js +0 -143
  60. package/node_modules/@farther-shore/shared-types/dist/auth/permissions.js.map +0 -1
  61. package/node_modules/@farther-shore/shared-types/dist/base.d.ts +0 -18
  62. package/node_modules/@farther-shore/shared-types/dist/base.d.ts.map +0 -1
  63. package/node_modules/@farther-shore/shared-types/dist/base.js +0 -6
  64. package/node_modules/@farther-shore/shared-types/dist/base.js.map +0 -1
  65. package/node_modules/@farther-shore/shared-types/dist/billing.d.ts +0 -58
  66. package/node_modules/@farther-shore/shared-types/dist/billing.d.ts.map +0 -1
  67. package/node_modules/@farther-shore/shared-types/dist/billing.js +0 -9
  68. package/node_modules/@farther-shore/shared-types/dist/billing.js.map +0 -1
  69. package/node_modules/@farther-shore/shared-types/dist/builder-context.d.ts +0 -33
  70. package/node_modules/@farther-shore/shared-types/dist/builder-context.d.ts.map +0 -1
  71. package/node_modules/@farther-shore/shared-types/dist/builder-context.js +0 -6
  72. package/node_modules/@farther-shore/shared-types/dist/builder-context.js.map +0 -1
  73. package/node_modules/@farther-shore/shared-types/dist/consumer.d.ts +0 -162
  74. package/node_modules/@farther-shore/shared-types/dist/consumer.d.ts.map +0 -1
  75. package/node_modules/@farther-shore/shared-types/dist/consumer.js +0 -37
  76. package/node_modules/@farther-shore/shared-types/dist/consumer.js.map +0 -1
  77. package/node_modules/@farther-shore/shared-types/dist/dlq.d.ts +0 -47
  78. package/node_modules/@farther-shore/shared-types/dist/dlq.d.ts.map +0 -1
  79. package/node_modules/@farther-shore/shared-types/dist/dlq.js +0 -86
  80. package/node_modules/@farther-shore/shared-types/dist/dlq.js.map +0 -1
  81. package/node_modules/@farther-shore/shared-types/dist/edge-kv-keys.d.ts +0 -254
  82. package/node_modules/@farther-shore/shared-types/dist/edge-kv-keys.d.ts.map +0 -1
  83. package/node_modules/@farther-shore/shared-types/dist/edge-kv-keys.js +0 -134
  84. package/node_modules/@farther-shore/shared-types/dist/edge-kv-keys.js.map +0 -1
  85. package/node_modules/@farther-shore/shared-types/dist/entitlements.d.ts +0 -86
  86. package/node_modules/@farther-shore/shared-types/dist/entitlements.d.ts.map +0 -1
  87. package/node_modules/@farther-shore/shared-types/dist/entitlements.js +0 -30
  88. package/node_modules/@farther-shore/shared-types/dist/entitlements.js.map +0 -1
  89. package/node_modules/@farther-shore/shared-types/dist/enums.d.ts +0 -36
  90. package/node_modules/@farther-shore/shared-types/dist/enums.d.ts.map +0 -1
  91. package/node_modules/@farther-shore/shared-types/dist/enums.js +0 -5
  92. package/node_modules/@farther-shore/shared-types/dist/enums.js.map +0 -1
  93. package/node_modules/@farther-shore/shared-types/dist/format.d.ts +0 -8
  94. package/node_modules/@farther-shore/shared-types/dist/format.d.ts.map +0 -1
  95. package/node_modules/@farther-shore/shared-types/dist/format.js +0 -14
  96. package/node_modules/@farther-shore/shared-types/dist/format.js.map +0 -1
  97. package/node_modules/@farther-shore/shared-types/dist/index.d.ts +0 -24
  98. package/node_modules/@farther-shore/shared-types/dist/index.d.ts.map +0 -1
  99. package/node_modules/@farther-shore/shared-types/dist/index.js +0 -24
  100. package/node_modules/@farther-shore/shared-types/dist/index.js.map +0 -1
  101. package/node_modules/@farther-shore/shared-types/dist/limits.d.ts +0 -24
  102. package/node_modules/@farther-shore/shared-types/dist/limits.d.ts.map +0 -1
  103. package/node_modules/@farther-shore/shared-types/dist/limits.js +0 -5
  104. package/node_modules/@farther-shore/shared-types/dist/limits.js.map +0 -1
  105. package/node_modules/@farther-shore/shared-types/dist/logger.d.ts +0 -67
  106. package/node_modules/@farther-shore/shared-types/dist/logger.d.ts.map +0 -1
  107. package/node_modules/@farther-shore/shared-types/dist/logger.js +0 -252
  108. package/node_modules/@farther-shore/shared-types/dist/logger.js.map +0 -1
  109. package/node_modules/@farther-shore/shared-types/dist/metering.d.ts +0 -18
  110. package/node_modules/@farther-shore/shared-types/dist/metering.d.ts.map +0 -1
  111. package/node_modules/@farther-shore/shared-types/dist/metering.js +0 -5
  112. package/node_modules/@farther-shore/shared-types/dist/metering.js.map +0 -1
  113. package/node_modules/@farther-shore/shared-types/dist/plans/index.d.ts +0 -4
  114. package/node_modules/@farther-shore/shared-types/dist/plans/index.d.ts.map +0 -1
  115. package/node_modules/@farther-shore/shared-types/dist/plans/index.js +0 -18
  116. package/node_modules/@farther-shore/shared-types/dist/plans/index.js.map +0 -1
  117. package/node_modules/@farther-shore/shared-types/dist/plans/limits-schema.d.ts +0 -80
  118. package/node_modules/@farther-shore/shared-types/dist/plans/limits-schema.d.ts.map +0 -1
  119. package/node_modules/@farther-shore/shared-types/dist/plans/limits-schema.js +0 -50
  120. package/node_modules/@farther-shore/shared-types/dist/plans/limits-schema.js.map +0 -1
  121. package/node_modules/@farther-shore/shared-types/dist/plans/projections.d.ts +0 -42
  122. package/node_modules/@farther-shore/shared-types/dist/plans/projections.d.ts.map +0 -1
  123. package/node_modules/@farther-shore/shared-types/dist/plans/projections.js +0 -18
  124. package/node_modules/@farther-shore/shared-types/dist/plans/projections.js.map +0 -1
  125. package/node_modules/@farther-shore/shared-types/dist/plans/spec.d.ts +0 -2387
  126. package/node_modules/@farther-shore/shared-types/dist/plans/spec.d.ts.map +0 -1
  127. package/node_modules/@farther-shore/shared-types/dist/plans/spec.js +0 -513
  128. package/node_modules/@farther-shore/shared-types/dist/plans/spec.js.map +0 -1
  129. package/node_modules/@farther-shore/shared-types/dist/portal.d.ts +0 -204
  130. package/node_modules/@farther-shore/shared-types/dist/portal.d.ts.map +0 -1
  131. package/node_modules/@farther-shore/shared-types/dist/portal.js +0 -20
  132. package/node_modules/@farther-shore/shared-types/dist/portal.js.map +0 -1
  133. package/node_modules/@farther-shore/shared-types/dist/pricing-model.d.ts +0 -92
  134. package/node_modules/@farther-shore/shared-types/dist/pricing-model.d.ts.map +0 -1
  135. package/node_modules/@farther-shore/shared-types/dist/pricing-model.js +0 -11
  136. package/node_modules/@farther-shore/shared-types/dist/pricing-model.js.map +0 -1
  137. package/node_modules/@farther-shore/shared-types/dist/projections.d.ts +0 -80
  138. package/node_modules/@farther-shore/shared-types/dist/projections.d.ts.map +0 -1
  139. package/node_modules/@farther-shore/shared-types/dist/projections.js +0 -6
  140. package/node_modules/@farther-shore/shared-types/dist/projections.js.map +0 -1
  141. package/node_modules/@farther-shore/shared-types/dist/scope-matcher.d.ts +0 -49
  142. package/node_modules/@farther-shore/shared-types/dist/scope-matcher.d.ts.map +0 -1
  143. package/node_modules/@farther-shore/shared-types/dist/scope-matcher.js +0 -159
  144. package/node_modules/@farther-shore/shared-types/dist/scope-matcher.js.map +0 -1
  145. package/node_modules/@farther-shore/shared-types/dist/service-auth.d.ts +0 -70
  146. package/node_modules/@farther-shore/shared-types/dist/service-auth.d.ts.map +0 -1
  147. package/node_modules/@farther-shore/shared-types/dist/service-auth.js +0 -253
  148. package/node_modules/@farther-shore/shared-types/dist/service-auth.js.map +0 -1
  149. package/node_modules/@farther-shore/shared-types/dist/web-ui.d.ts +0 -239
  150. package/node_modules/@farther-shore/shared-types/dist/web-ui.d.ts.map +0 -1
  151. package/node_modules/@farther-shore/shared-types/dist/web-ui.js +0 -6
  152. package/node_modules/@farther-shore/shared-types/dist/web-ui.js.map +0 -1
  153. package/node_modules/@farther-shore/shared-types/dist/webhooks/events.d.ts +0 -48
  154. package/node_modules/@farther-shore/shared-types/dist/webhooks/events.d.ts.map +0 -1
  155. package/node_modules/@farther-shore/shared-types/dist/webhooks/events.js +0 -68
  156. package/node_modules/@farther-shore/shared-types/dist/webhooks/events.js.map +0 -1
  157. package/node_modules/@farther-shore/shared-types/dist/webhooks/migration.d.ts +0 -8
  158. package/node_modules/@farther-shore/shared-types/dist/webhooks/migration.d.ts.map +0 -1
  159. package/node_modules/@farther-shore/shared-types/dist/webhooks/migration.js +0 -21
  160. package/node_modules/@farther-shore/shared-types/dist/webhooks/migration.js.map +0 -1
  161. package/node_modules/@farther-shore/shared-types/package.json +0 -156
  162. package/node_modules/@pinojs/redact/.github/dependabot.yml +0 -13
  163. package/node_modules/@pinojs/redact/.github/workflows/ci.yml +0 -48
  164. package/node_modules/@pinojs/redact/.github/workflows/publish-release.yml +0 -43
  165. package/node_modules/@pinojs/redact/LICENSE +0 -21
  166. package/node_modules/@pinojs/redact/README.md +0 -350
  167. package/node_modules/@pinojs/redact/benchmarks/basic.js +0 -184
  168. package/node_modules/@pinojs/redact/eslint.config.js +0 -1
  169. package/node_modules/@pinojs/redact/index.d.ts +0 -52
  170. package/node_modules/@pinojs/redact/index.js +0 -529
  171. package/node_modules/@pinojs/redact/index.test-d.ts +0 -22
  172. package/node_modules/@pinojs/redact/package.json +0 -37
  173. package/node_modules/@pinojs/redact/scripts/sync-version.mjs +0 -20
  174. package/node_modules/@pinojs/redact/test/actual-redact-comparison.test.js +0 -211
  175. package/node_modules/@pinojs/redact/test/index.test.js +0 -824
  176. package/node_modules/@pinojs/redact/test/integration.test.js +0 -390
  177. package/node_modules/@pinojs/redact/test/multiple-wildcards.test.js +0 -227
  178. package/node_modules/@pinojs/redact/test/prototype-pollution.test.js +0 -223
  179. package/node_modules/@pinojs/redact/test/selective-clone.test.js +0 -115
  180. package/node_modules/@pinojs/redact/tsconfig.json +0 -19
  181. package/node_modules/atomic-sleep/.travis.yml +0 -11
  182. package/node_modules/atomic-sleep/LICENSE +0 -22
  183. package/node_modules/atomic-sleep/index.js +0 -38
  184. package/node_modules/atomic-sleep/package.json +0 -37
  185. package/node_modules/atomic-sleep/readme.md +0 -58
  186. package/node_modules/atomic-sleep/test.js +0 -47
  187. package/node_modules/on-exit-leak-free/.github/dependabot.yml +0 -12
  188. package/node_modules/on-exit-leak-free/.github/workflows/ci.yml +0 -46
  189. package/node_modules/on-exit-leak-free/LICENSE +0 -21
  190. package/node_modules/on-exit-leak-free/README.md +0 -54
  191. package/node_modules/on-exit-leak-free/index.js +0 -108
  192. package/node_modules/on-exit-leak-free/package.json +0 -37
  193. package/node_modules/on-exit-leak-free/test/base.test.js +0 -30
  194. package/node_modules/on-exit-leak-free/test/event-emitter-leak.test.js +0 -23
  195. package/node_modules/on-exit-leak-free/test/fixtures/beforeExit.js +0 -33
  196. package/node_modules/on-exit-leak-free/test/fixtures/close.js +0 -21
  197. package/node_modules/on-exit-leak-free/test/fixtures/gc-not-close.js +0 -24
  198. package/node_modules/on-exit-leak-free/test/fixtures/unregister.js +0 -24
  199. package/node_modules/pino/.nojekyll +0 -0
  200. package/node_modules/pino/.prettierignore +0 -1
  201. package/node_modules/pino/CNAME +0 -1
  202. package/node_modules/pino/CONTRIBUTING.md +0 -30
  203. package/node_modules/pino/LICENSE +0 -21
  204. package/node_modules/pino/README.md +0 -177
  205. package/node_modules/pino/SECURITY.md +0 -87
  206. package/node_modules/pino/benchmarks/basic.bench.js +0 -95
  207. package/node_modules/pino/benchmarks/child-child.bench.js +0 -52
  208. package/node_modules/pino/benchmarks/child-creation.bench.js +0 -73
  209. package/node_modules/pino/benchmarks/child.bench.js +0 -62
  210. package/node_modules/pino/benchmarks/deep-object.bench.js +0 -88
  211. package/node_modules/pino/benchmarks/formatters.bench.js +0 -50
  212. package/node_modules/pino/benchmarks/internal/custom-levels.js +0 -67
  213. package/node_modules/pino/benchmarks/internal/just-pino-heavy.bench.js +0 -76
  214. package/node_modules/pino/benchmarks/internal/just-pino.bench.js +0 -182
  215. package/node_modules/pino/benchmarks/internal/parent-vs-child.bench.js +0 -75
  216. package/node_modules/pino/benchmarks/internal/redact.bench.js +0 -86
  217. package/node_modules/pino/benchmarks/long-string.bench.js +0 -81
  218. package/node_modules/pino/benchmarks/multi-arg.bench.js +0 -193
  219. package/node_modules/pino/benchmarks/multistream.js +0 -98
  220. package/node_modules/pino/benchmarks/object.bench.js +0 -82
  221. package/node_modules/pino/benchmarks/utils/generate-benchmark-doc.js +0 -36
  222. package/node_modules/pino/benchmarks/utils/runbench.js +0 -138
  223. package/node_modules/pino/benchmarks/utils/wrap-log-level.js +0 -55
  224. package/node_modules/pino/bin.js +0 -6
  225. package/node_modules/pino/browser.js +0 -547
  226. package/node_modules/pino/build/sync-version.js +0 -25
  227. package/node_modules/pino/docs/api.md +0 -1593
  228. package/node_modules/pino/docs/asynchronous.md +0 -40
  229. package/node_modules/pino/docs/benchmarks.md +0 -55
  230. package/node_modules/pino/docs/browser.md +0 -278
  231. package/node_modules/pino/docs/bundling.md +0 -40
  232. package/node_modules/pino/docs/child-loggers.md +0 -95
  233. package/node_modules/pino/docs/diagnostics.md +0 -16
  234. package/node_modules/pino/docs/ecosystem.md +0 -86
  235. package/node_modules/pino/docs/help.md +0 -345
  236. package/node_modules/pino/docs/lts.md +0 -64
  237. package/node_modules/pino/docs/pretty.md +0 -35
  238. package/node_modules/pino/docs/redaction.md +0 -135
  239. package/node_modules/pino/docs/transports.md +0 -1376
  240. package/node_modules/pino/docs/web.md +0 -309
  241. package/node_modules/pino/eslint.config.js +0 -28
  242. package/node_modules/pino/examples/basic.js +0 -43
  243. package/node_modules/pino/examples/transport.js +0 -68
  244. package/node_modules/pino/favicon.ico +0 -0
  245. package/node_modules/pino/file.js +0 -12
  246. package/node_modules/pino/inc-version.sh +0 -42
  247. package/node_modules/pino/index.html +0 -55
  248. package/node_modules/pino/lib/caller.js +0 -30
  249. package/node_modules/pino/lib/constants.js +0 -28
  250. package/node_modules/pino/lib/deprecations.js +0 -8
  251. package/node_modules/pino/lib/levels.js +0 -241
  252. package/node_modules/pino/lib/meta.js +0 -3
  253. package/node_modules/pino/lib/multistream.js +0 -203
  254. package/node_modules/pino/lib/proto.js +0 -256
  255. package/node_modules/pino/lib/redaction.js +0 -114
  256. package/node_modules/pino/lib/symbols.js +0 -74
  257. package/node_modules/pino/lib/time.js +0 -39
  258. package/node_modules/pino/lib/tools.js +0 -427
  259. package/node_modules/pino/lib/transport-stream.js +0 -56
  260. package/node_modules/pino/lib/transport.js +0 -289
  261. package/node_modules/pino/lib/worker.js +0 -194
  262. package/node_modules/pino/package.json +0 -120
  263. package/node_modules/pino/pino.d.ts +0 -908
  264. package/node_modules/pino/pino.js +0 -234
  265. package/node_modules/pino/test/basic.test.js +0 -886
  266. package/node_modules/pino/test/broken-pipe.test.js +0 -59
  267. package/node_modules/pino/test/browser-child.test.js +0 -132
  268. package/node_modules/pino/test/browser-disabled.test.js +0 -87
  269. package/node_modules/pino/test/browser-early-console-freeze.test.js +0 -12
  270. package/node_modules/pino/test/browser-is-level-enabled.test.js +0 -101
  271. package/node_modules/pino/test/browser-levels.test.js +0 -241
  272. package/node_modules/pino/test/browser-serializers.test.js +0 -352
  273. package/node_modules/pino/test/browser-timestamp.test.js +0 -88
  274. package/node_modules/pino/test/browser-transmit.test.js +0 -417
  275. package/node_modules/pino/test/browser.test.js +0 -698
  276. package/node_modules/pino/test/complex-objects.test.js +0 -36
  277. package/node_modules/pino/test/crlf.test.js +0 -34
  278. package/node_modules/pino/test/custom-levels.test.js +0 -267
  279. package/node_modules/pino/test/diagnostics.test.js +0 -107
  280. package/node_modules/pino/test/error-key.test.js +0 -37
  281. package/node_modules/pino/test/error.test.js +0 -403
  282. package/node_modules/pino/test/escaping.test.js +0 -93
  283. package/node_modules/pino/test/esm/esm.mjs +0 -14
  284. package/node_modules/pino/test/esm/index.test.js +0 -21
  285. package/node_modules/pino/test/esm/named-exports.mjs +0 -29
  286. package/node_modules/pino/test/exit.test.js +0 -79
  287. package/node_modules/pino/test/fixtures/broken-pipe/basic.js +0 -9
  288. package/node_modules/pino/test/fixtures/broken-pipe/destination.js +0 -10
  289. package/node_modules/pino/test/fixtures/broken-pipe/syncfalse.js +0 -12
  290. package/node_modules/pino/test/fixtures/console-transport.js +0 -13
  291. package/node_modules/pino/test/fixtures/crashing-transport.js +0 -13
  292. package/node_modules/pino/test/fixtures/default-exit.js +0 -8
  293. package/node_modules/pino/test/fixtures/destination-exit.js +0 -8
  294. package/node_modules/pino/test/fixtures/eval/index.js +0 -13
  295. package/node_modules/pino/test/fixtures/eval/node_modules/14-files.js +0 -3
  296. package/node_modules/pino/test/fixtures/eval/node_modules/2-files.js +0 -3
  297. package/node_modules/pino/test/fixtures/eval/node_modules/file1.js +0 -5
  298. package/node_modules/pino/test/fixtures/eval/node_modules/file10.js +0 -5
  299. package/node_modules/pino/test/fixtures/eval/node_modules/file11.js +0 -5
  300. package/node_modules/pino/test/fixtures/eval/node_modules/file12.js +0 -5
  301. package/node_modules/pino/test/fixtures/eval/node_modules/file13.js +0 -5
  302. package/node_modules/pino/test/fixtures/eval/node_modules/file14.js +0 -11
  303. package/node_modules/pino/test/fixtures/eval/node_modules/file2.js +0 -5
  304. package/node_modules/pino/test/fixtures/eval/node_modules/file3.js +0 -5
  305. package/node_modules/pino/test/fixtures/eval/node_modules/file4.js +0 -5
  306. package/node_modules/pino/test/fixtures/eval/node_modules/file5.js +0 -5
  307. package/node_modules/pino/test/fixtures/eval/node_modules/file6.js +0 -5
  308. package/node_modules/pino/test/fixtures/eval/node_modules/file7.js +0 -5
  309. package/node_modules/pino/test/fixtures/eval/node_modules/file8.js +0 -5
  310. package/node_modules/pino/test/fixtures/eval/node_modules/file9.js +0 -5
  311. package/node_modules/pino/test/fixtures/noop-transport.js +0 -10
  312. package/node_modules/pino/test/fixtures/pretty/null-prototype.js +0 -8
  313. package/node_modules/pino/test/fixtures/stdout-hack-protection.js +0 -11
  314. package/node_modules/pino/test/fixtures/syncfalse-child.js +0 -6
  315. package/node_modules/pino/test/fixtures/syncfalse-exit.js +0 -9
  316. package/node_modules/pino/test/fixtures/syncfalse-flush-exit.js +0 -10
  317. package/node_modules/pino/test/fixtures/syncfalse.js +0 -6
  318. package/node_modules/pino/test/fixtures/syntax-error-esm.mjs +0 -2
  319. package/node_modules/pino/test/fixtures/to-file-transport-with-transform.js +0 -20
  320. package/node_modules/pino/test/fixtures/to-file-transport.js +0 -13
  321. package/node_modules/pino/test/fixtures/to-file-transport.mjs +0 -8
  322. package/node_modules/pino/test/fixtures/transport/index.js +0 -12
  323. package/node_modules/pino/test/fixtures/transport/package.json +0 -5
  324. package/node_modules/pino/test/fixtures/transport-exit-immediately-with-async-dest.js +0 -16
  325. package/node_modules/pino/test/fixtures/transport-exit-immediately.js +0 -11
  326. package/node_modules/pino/test/fixtures/transport-exit-on-ready.js +0 -12
  327. package/node_modules/pino/test/fixtures/transport-invalid-node-options.js +0 -26
  328. package/node_modules/pino/test/fixtures/transport-main.js +0 -9
  329. package/node_modules/pino/test/fixtures/transport-many-lines.js +0 -29
  330. package/node_modules/pino/test/fixtures/transport-preload-main.mjs +0 -13
  331. package/node_modules/pino/test/fixtures/transport-preload.mjs +0 -13
  332. package/node_modules/pino/test/fixtures/transport-string-stdout.js +0 -9
  333. package/node_modules/pino/test/fixtures/transport-transform.js +0 -21
  334. package/node_modules/pino/test/fixtures/transport-uses-pino-config.js +0 -33
  335. package/node_modules/pino/test/fixtures/transport-with-on-exit.js +0 -12
  336. package/node_modules/pino/test/fixtures/transport-worker-data.js +0 -19
  337. package/node_modules/pino/test/fixtures/transport-worker-name.js +0 -24
  338. package/node_modules/pino/test/fixtures/transport-worker.js +0 -15
  339. package/node_modules/pino/test/fixtures/transport-wrong-export-type.js +0 -3
  340. package/node_modules/pino/test/fixtures/ts/to-file-transport-native.mts +0 -15
  341. package/node_modules/pino/test/fixtures/ts/to-file-transport-with-transform.ts +0 -18
  342. package/node_modules/pino/test/fixtures/ts/to-file-transport.ts +0 -11
  343. package/node_modules/pino/test/fixtures/ts/transpile.cjs +0 -36
  344. package/node_modules/pino/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts +0 -15
  345. package/node_modules/pino/test/fixtures/ts/transport-exit-immediately.ts +0 -10
  346. package/node_modules/pino/test/fixtures/ts/transport-exit-on-ready.ts +0 -11
  347. package/node_modules/pino/test/fixtures/ts/transport-main.ts +0 -8
  348. package/node_modules/pino/test/fixtures/ts/transport-string-stdout.ts +0 -8
  349. package/node_modules/pino/test/fixtures/ts/transport-worker.ts +0 -14
  350. package/node_modules/pino/test/formatters.test.js +0 -364
  351. package/node_modules/pino/test/helper.d.ts +0 -4
  352. package/node_modules/pino/test/helper.js +0 -155
  353. package/node_modules/pino/test/hooks.test.js +0 -114
  354. package/node_modules/pino/test/http.test.js +0 -214
  355. package/node_modules/pino/test/internals/version.test.js +0 -17
  356. package/node_modules/pino/test/is-level-enabled.test.js +0 -179
  357. package/node_modules/pino/test/jest/basic.spec.js +0 -10
  358. package/node_modules/pino/test/levels.test.js +0 -810
  359. package/node_modules/pino/test/metadata.test.js +0 -120
  360. package/node_modules/pino/test/mixin-merge-strategy.test.js +0 -57
  361. package/node_modules/pino/test/mixin.test.js +0 -241
  362. package/node_modules/pino/test/multistream.test.js +0 -729
  363. package/node_modules/pino/test/redact.test.js +0 -893
  364. package/node_modules/pino/test/serializers.test.js +0 -257
  365. package/node_modules/pino/test/stdout-protection.test.js +0 -41
  366. package/node_modules/pino/test/syncfalse.test.js +0 -186
  367. package/node_modules/pino/test/timestamp-nano.test.js +0 -37
  368. package/node_modules/pino/test/timestamp.test.js +0 -124
  369. package/node_modules/pino/test/transport/big.test.js +0 -42
  370. package/node_modules/pino/test/transport/bundlers-support.test.js +0 -99
  371. package/node_modules/pino/test/transport/caller.test.js +0 -24
  372. package/node_modules/pino/test/transport/core.test.js +0 -733
  373. package/node_modules/pino/test/transport/core.transpiled.test.ts +0 -114
  374. package/node_modules/pino/test/transport/crash.test.js +0 -36
  375. package/node_modules/pino/test/transport/module-link.test.js +0 -241
  376. package/node_modules/pino/test/transport/native-type-stripping.test.mjs +0 -151
  377. package/node_modules/pino/test/transport/node-options.test.js +0 -116
  378. package/node_modules/pino/test/transport/pipeline.test.js +0 -137
  379. package/node_modules/pino/test/transport/preload.test.js +0 -54
  380. package/node_modules/pino/test/transport/repl.test.js +0 -15
  381. package/node_modules/pino/test/transport/sync-false.test.js +0 -67
  382. package/node_modules/pino/test/transport/sync-true.test.js +0 -57
  383. package/node_modules/pino/test/transport/targets.test.js +0 -48
  384. package/node_modules/pino/test/transport/uses-pino-config.test.js +0 -166
  385. package/node_modules/pino/test/transport-stream.test.js +0 -40
  386. package/node_modules/pino/test/types/pino-import.test-d.cts +0 -30
  387. package/node_modules/pino/test/types/pino-multistream.test-d.ts +0 -28
  388. package/node_modules/pino/test/types/pino-top-export.test-d.ts +0 -34
  389. package/node_modules/pino/test/types/pino-transport.test-d.ts +0 -156
  390. package/node_modules/pino/test/types/pino-type-only.test-d.ts +0 -75
  391. package/node_modules/pino/test/types/pino.test-d.ts +0 -683
  392. package/node_modules/pino/test/types/pino.ts +0 -91
  393. package/node_modules/pino/tsconfig.json +0 -14
  394. package/node_modules/pino-abstract-transport/.github/dependabot.yml +0 -13
  395. package/node_modules/pino-abstract-transport/.github/workflows/ci.yml +0 -80
  396. package/node_modules/pino-abstract-transport/.husky/pre-commit +0 -4
  397. package/node_modules/pino-abstract-transport/LICENSE +0 -21
  398. package/node_modules/pino-abstract-transport/README.md +0 -171
  399. package/node_modules/pino-abstract-transport/index.d.ts +0 -122
  400. package/node_modules/pino-abstract-transport/index.js +0 -128
  401. package/node_modules/pino-abstract-transport/package.json +0 -41
  402. package/node_modules/pino-abstract-transport/test/base.test.js +0 -473
  403. package/node_modules/pino-abstract-transport/test/fixtures/transport-async-iteration.js +0 -22
  404. package/node_modules/pino-abstract-transport/test/fixtures/transport-on-data.js +0 -22
  405. package/node_modules/pino-abstract-transport/test/fixtures/transport-transform.js +0 -24
  406. package/node_modules/pino-abstract-transport/test/fixtures/worker-pipeline.js +0 -15
  407. package/node_modules/pino-abstract-transport/test/match.js +0 -24
  408. package/node_modules/pino-abstract-transport/test/types/index.test-d.ts +0 -31
  409. package/node_modules/pino-abstract-transport/test/worker.test.js +0 -372
  410. package/node_modules/pino-std-serializers/.editorconfig +0 -13
  411. package/node_modules/pino-std-serializers/.github/dependabot.yml +0 -13
  412. package/node_modules/pino-std-serializers/.github/workflows/ci.yml +0 -81
  413. package/node_modules/pino-std-serializers/LICENSE +0 -7
  414. package/node_modules/pino-std-serializers/Readme.md +0 -182
  415. package/node_modules/pino-std-serializers/eslint.config.js +0 -7
  416. package/node_modules/pino-std-serializers/index.d.ts +0 -145
  417. package/node_modules/pino-std-serializers/index.js +0 -36
  418. package/node_modules/pino-std-serializers/lib/err-helpers.js +0 -118
  419. package/node_modules/pino-std-serializers/lib/err-proto.js +0 -48
  420. package/node_modules/pino-std-serializers/lib/err-with-cause.js +0 -48
  421. package/node_modules/pino-std-serializers/lib/err.js +0 -45
  422. package/node_modules/pino-std-serializers/lib/req.js +0 -100
  423. package/node_modules/pino-std-serializers/lib/res.js +0 -47
  424. package/node_modules/pino-std-serializers/package.json +0 -42
  425. package/node_modules/pino-std-serializers/test/err-with-cause.test.js +0 -187
  426. package/node_modules/pino-std-serializers/test/err.test.js +0 -200
  427. package/node_modules/pino-std-serializers/test/req.test.js +0 -477
  428. package/node_modules/pino-std-serializers/test/res.test.js +0 -120
  429. package/node_modules/pino-std-serializers/test/types/index.test-d.ts +0 -71
  430. package/node_modules/pino-std-serializers/tsconfig.json +0 -13
  431. package/node_modules/process-warning/.gitattributes +0 -2
  432. package/node_modules/process-warning/.github/dependabot.yml +0 -13
  433. package/node_modules/process-warning/.github/workflows/ci.yml +0 -22
  434. package/node_modules/process-warning/LICENSE +0 -21
  435. package/node_modules/process-warning/README.md +0 -118
  436. package/node_modules/process-warning/benchmarks/warn.js +0 -25
  437. package/node_modules/process-warning/eslint.config.js +0 -6
  438. package/node_modules/process-warning/examples/example.js +0 -11
  439. package/node_modules/process-warning/index.js +0 -124
  440. package/node_modules/process-warning/package.json +0 -73
  441. package/node_modules/process-warning/test/emit-interpolated-string.test.js +0 -34
  442. package/node_modules/process-warning/test/emit-once-only.test.js +0 -33
  443. package/node_modules/process-warning/test/emit-reset.test.js +0 -40
  444. package/node_modules/process-warning/test/emit-set.test.js +0 -35
  445. package/node_modules/process-warning/test/emit-unlimited.test.js +0 -42
  446. package/node_modules/process-warning/test/index.test.js +0 -99
  447. package/node_modules/process-warning/test/issue-88.test.js +0 -38
  448. package/node_modules/process-warning/test/jest.test.js +0 -24
  449. package/node_modules/process-warning/test/no-warnings.test.js +0 -80
  450. package/node_modules/process-warning/test/promise.js +0 -10
  451. package/node_modules/process-warning/types/index.d.ts +0 -37
  452. package/node_modules/process-warning/types/index.test-d.ts +0 -36
  453. package/node_modules/quick-format-unescaped/.github/workflows/ci.yml +0 -21
  454. package/node_modules/quick-format-unescaped/LICENSE +0 -21
  455. package/node_modules/quick-format-unescaped/benchmark.js +0 -24
  456. package/node_modules/quick-format-unescaped/index.js +0 -109
  457. package/node_modules/quick-format-unescaped/package.json +0 -29
  458. package/node_modules/quick-format-unescaped/readme.md +0 -66
  459. package/node_modules/quick-format-unescaped/test/index.js +0 -136
  460. package/node_modules/real-require/LICENSE.md +0 -21
  461. package/node_modules/real-require/README.md +0 -51
  462. package/node_modules/real-require/package.json +0 -49
  463. package/node_modules/real-require/src/index.js +0 -14
  464. package/node_modules/safe-stable-stringify/LICENSE +0 -21
  465. package/node_modules/safe-stable-stringify/esm/package.json +0 -4
  466. package/node_modules/safe-stable-stringify/esm/wrapper.d.ts +0 -4
  467. package/node_modules/safe-stable-stringify/esm/wrapper.js +0 -6
  468. package/node_modules/safe-stable-stringify/index.d.ts +0 -22
  469. package/node_modules/safe-stable-stringify/index.js +0 -625
  470. package/node_modules/safe-stable-stringify/package.json +0 -65
  471. package/node_modules/safe-stable-stringify/readme.md +0 -179
  472. package/node_modules/sonic-boom/.eslintignore +0 -2
  473. package/node_modules/sonic-boom/.taprc +0 -3
  474. package/node_modules/sonic-boom/LICENSE +0 -21
  475. package/node_modules/sonic-boom/README.md +0 -153
  476. package/node_modules/sonic-boom/bench.js +0 -98
  477. package/node_modules/sonic-boom/check.js +0 -18
  478. package/node_modules/sonic-boom/example.js +0 -8
  479. package/node_modules/sonic-boom/fixtures/firehose.js +0 -22
  480. package/node_modules/sonic-boom/index.js +0 -733
  481. package/node_modules/sonic-boom/package.json +0 -52
  482. package/node_modules/sonic-boom/test/destroy.test.js +0 -49
  483. package/node_modules/sonic-boom/test/end.test.js +0 -98
  484. package/node_modules/sonic-boom/test/flush-sync.test.js +0 -140
  485. package/node_modules/sonic-boom/test/flush.test.js +0 -419
  486. package/node_modules/sonic-boom/test/fsync.test.js +0 -63
  487. package/node_modules/sonic-boom/test/helper.js +0 -42
  488. package/node_modules/sonic-boom/test/minlength.test.js +0 -35
  489. package/node_modules/sonic-boom/test/mode.test.js +0 -116
  490. package/node_modules/sonic-boom/test/periodicflush.test.js +0 -61
  491. package/node_modules/sonic-boom/test/reopen.test.js +0 -239
  492. package/node_modules/sonic-boom/test/retry.test.js +0 -414
  493. package/node_modules/sonic-boom/test/sync.test.js +0 -261
  494. package/node_modules/sonic-boom/test/write.test.js +0 -515
  495. package/node_modules/sonic-boom/types/index.d.ts +0 -63
  496. package/node_modules/sonic-boom/types/tests/test.ts +0 -4
  497. package/node_modules/split2/LICENSE +0 -13
  498. package/node_modules/split2/README.md +0 -85
  499. package/node_modules/split2/bench.js +0 -27
  500. package/node_modules/split2/index.js +0 -141
  501. package/node_modules/split2/package.json +0 -39
  502. package/node_modules/split2/test.js +0 -409
  503. package/node_modules/thread-stream/.github/dependabot.yml +0 -13
  504. package/node_modules/thread-stream/.github/workflows/ci.yml +0 -74
  505. package/node_modules/thread-stream/.husky/pre-commit +0 -4
  506. package/node_modules/thread-stream/CLAUDE.md +0 -53
  507. package/node_modules/thread-stream/LICENSE +0 -21
  508. package/node_modules/thread-stream/README.md +0 -135
  509. package/node_modules/thread-stream/bench.js +0 -85
  510. package/node_modules/thread-stream/eslint.config.js +0 -10
  511. package/node_modules/thread-stream/index.d.ts +0 -92
  512. package/node_modules/thread-stream/index.js +0 -541
  513. package/node_modules/thread-stream/lib/indexes.js +0 -9
  514. package/node_modules/thread-stream/lib/wait.js +0 -68
  515. package/node_modules/thread-stream/lib/worker.js +0 -179
  516. package/node_modules/thread-stream/package.json +0 -52
  517. package/node_modules/thread-stream/test/base.test.js +0 -259
  518. package/node_modules/thread-stream/test/bench.test.js +0 -38
  519. package/node_modules/thread-stream/test/bundlers.test.js +0 -59
  520. package/node_modules/thread-stream/test/close-on-gc.js +0 -37
  521. package/node_modules/thread-stream/test/commonjs-fallback.test.js +0 -75
  522. package/node_modules/thread-stream/test/context.test.js +0 -21
  523. package/node_modules/thread-stream/test/create-and-exit.js +0 -16
  524. package/node_modules/thread-stream/test/custom-worker.js +0 -9
  525. package/node_modules/thread-stream/test/dir with spaces/test-package.zip +0 -0
  526. package/node_modules/thread-stream/test/emit-event.js +0 -22
  527. package/node_modules/thread-stream/test/end.test.js +0 -56
  528. package/node_modules/thread-stream/test/error.js +0 -14
  529. package/node_modules/thread-stream/test/esm.test.mjs +0 -46
  530. package/node_modules/thread-stream/test/event.test.js +0 -24
  531. package/node_modules/thread-stream/test/exit.js +0 -14
  532. package/node_modules/thread-stream/test/get-context.js +0 -22
  533. package/node_modules/thread-stream/test/helper.d.ts +0 -1
  534. package/node_modules/thread-stream/test/helper.js +0 -26
  535. package/node_modules/thread-stream/test/indexes.test.js +0 -11
  536. package/node_modules/thread-stream/test/multibyte-chars.test.mjs +0 -75
  537. package/node_modules/thread-stream/test/on-message.js +0 -18
  538. package/node_modules/thread-stream/test/pkg/index.js +0 -37
  539. package/node_modules/thread-stream/test/pkg/pkg.config.json +0 -14
  540. package/node_modules/thread-stream/test/pkg/pkg.test.js +0 -45
  541. package/node_modules/thread-stream/test/port.js +0 -16
  542. package/node_modules/thread-stream/test/post-message.test.js +0 -23
  543. package/node_modules/thread-stream/test/string-limit-2.test.js +0 -35
  544. package/node_modules/thread-stream/test/string-limit.test.js +0 -37
  545. package/node_modules/thread-stream/test/syntax-error.mjs +0 -2
  546. package/node_modules/thread-stream/test/thread-management.test.js +0 -138
  547. package/node_modules/thread-stream/test/to-file-on-destroy.js +0 -23
  548. package/node_modules/thread-stream/test/to-file-on-final.js +0 -24
  549. package/node_modules/thread-stream/test/to-file.js +0 -12
  550. package/node_modules/thread-stream/test/to-file.mjs +0 -8
  551. package/node_modules/thread-stream/test/to-next.js +0 -9
  552. package/node_modules/thread-stream/test/transpiled.test.js +0 -29
  553. package/node_modules/thread-stream/test/ts/to-file.ts +0 -10
  554. package/node_modules/thread-stream/test/ts/transpile.sh +0 -19
  555. package/node_modules/thread-stream/test/ts-commonjs-default-export.zip +0 -0
  556. package/node_modules/thread-stream/test/ts-native.test.mjs +0 -35
  557. package/node_modules/thread-stream/test/ts-node-fallback.test.js +0 -35
  558. package/node_modules/thread-stream/test/uncaughtException.js +0 -21
  559. package/node_modules/thread-stream/test/unhandledRejection.js +0 -21
  560. package/node_modules/thread-stream/test/yarnrc.yml +0 -7
  561. package/node_modules/thread-stream/tsconfig.json +0 -8
  562. package/node_modules/zod/LICENSE +0 -21
  563. package/node_modules/zod/README.md +0 -208
  564. package/node_modules/zod/index.cjs +0 -33
  565. package/node_modules/zod/index.d.cts +0 -4
  566. package/node_modules/zod/index.d.ts +0 -4
  567. package/node_modules/zod/index.js +0 -4
  568. package/node_modules/zod/locales/index.cjs +0 -17
  569. package/node_modules/zod/locales/index.d.cts +0 -1
  570. package/node_modules/zod/locales/index.d.ts +0 -1
  571. package/node_modules/zod/locales/index.js +0 -1
  572. package/node_modules/zod/locales/package.json +0 -6
  573. package/node_modules/zod/mini/index.cjs +0 -32
  574. package/node_modules/zod/mini/index.d.cts +0 -3
  575. package/node_modules/zod/mini/index.d.ts +0 -3
  576. package/node_modules/zod/mini/index.js +0 -3
  577. package/node_modules/zod/mini/package.json +0 -6
  578. package/node_modules/zod/package.json +0 -135
  579. package/node_modules/zod/src/index.ts +0 -4
  580. package/node_modules/zod/src/locales/index.ts +0 -1
  581. package/node_modules/zod/src/mini/index.ts +0 -3
  582. package/node_modules/zod/src/v3/ZodError.ts +0 -330
  583. package/node_modules/zod/src/v3/benchmarks/datetime.ts +0 -58
  584. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +0 -80
  585. package/node_modules/zod/src/v3/benchmarks/index.ts +0 -59
  586. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +0 -57
  587. package/node_modules/zod/src/v3/benchmarks/object.ts +0 -69
  588. package/node_modules/zod/src/v3/benchmarks/primitives.ts +0 -162
  589. package/node_modules/zod/src/v3/benchmarks/realworld.ts +0 -63
  590. package/node_modules/zod/src/v3/benchmarks/string.ts +0 -55
  591. package/node_modules/zod/src/v3/benchmarks/union.ts +0 -80
  592. package/node_modules/zod/src/v3/errors.ts +0 -13
  593. package/node_modules/zod/src/v3/external.ts +0 -6
  594. package/node_modules/zod/src/v3/helpers/enumUtil.ts +0 -17
  595. package/node_modules/zod/src/v3/helpers/errorUtil.ts +0 -8
  596. package/node_modules/zod/src/v3/helpers/parseUtil.ts +0 -176
  597. package/node_modules/zod/src/v3/helpers/partialUtil.ts +0 -34
  598. package/node_modules/zod/src/v3/helpers/typeAliases.ts +0 -2
  599. package/node_modules/zod/src/v3/helpers/util.ts +0 -224
  600. package/node_modules/zod/src/v3/index.ts +0 -4
  601. package/node_modules/zod/src/v3/locales/en.ts +0 -124
  602. package/node_modules/zod/src/v3/standard-schema.ts +0 -113
  603. package/node_modules/zod/src/v3/tests/Mocker.ts +0 -54
  604. package/node_modules/zod/src/v3/tests/all-errors.test.ts +0 -157
  605. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +0 -28
  606. package/node_modules/zod/src/v3/tests/array.test.ts +0 -71
  607. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +0 -388
  608. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +0 -46
  609. package/node_modules/zod/src/v3/tests/base.test.ts +0 -29
  610. package/node_modules/zod/src/v3/tests/bigint.test.ts +0 -55
  611. package/node_modules/zod/src/v3/tests/branded.test.ts +0 -53
  612. package/node_modules/zod/src/v3/tests/catch.test.ts +0 -220
  613. package/node_modules/zod/src/v3/tests/coerce.test.ts +0 -133
  614. package/node_modules/zod/src/v3/tests/complex.test.ts +0 -70
  615. package/node_modules/zod/src/v3/tests/custom.test.ts +0 -31
  616. package/node_modules/zod/src/v3/tests/date.test.ts +0 -32
  617. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +0 -186
  618. package/node_modules/zod/src/v3/tests/default.test.ts +0 -112
  619. package/node_modules/zod/src/v3/tests/description.test.ts +0 -33
  620. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +0 -315
  621. package/node_modules/zod/src/v3/tests/enum.test.ts +0 -80
  622. package/node_modules/zod/src/v3/tests/error.test.ts +0 -551
  623. package/node_modules/zod/src/v3/tests/firstparty.test.ts +0 -87
  624. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +0 -21
  625. package/node_modules/zod/src/v3/tests/function.test.ts +0 -261
  626. package/node_modules/zod/src/v3/tests/generics.test.ts +0 -48
  627. package/node_modules/zod/src/v3/tests/instanceof.test.ts +0 -37
  628. package/node_modules/zod/src/v3/tests/intersection.test.ts +0 -110
  629. package/node_modules/zod/src/v3/tests/language-server.source.ts +0 -76
  630. package/node_modules/zod/src/v3/tests/language-server.test.ts +0 -207
  631. package/node_modules/zod/src/v3/tests/literal.test.ts +0 -36
  632. package/node_modules/zod/src/v3/tests/map.test.ts +0 -110
  633. package/node_modules/zod/src/v3/tests/masking.test.ts +0 -4
  634. package/node_modules/zod/src/v3/tests/mocker.test.ts +0 -19
  635. package/node_modules/zod/src/v3/tests/nan.test.ts +0 -24
  636. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +0 -87
  637. package/node_modules/zod/src/v3/tests/nullable.test.ts +0 -42
  638. package/node_modules/zod/src/v3/tests/number.test.ts +0 -176
  639. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +0 -29
  640. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +0 -29
  641. package/node_modules/zod/src/v3/tests/object.test.ts +0 -434
  642. package/node_modules/zod/src/v3/tests/optional.test.ts +0 -42
  643. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +0 -23
  644. package/node_modules/zod/src/v3/tests/parser.test.ts +0 -41
  645. package/node_modules/zod/src/v3/tests/partials.test.ts +0 -243
  646. package/node_modules/zod/src/v3/tests/pickomit.test.ts +0 -111
  647. package/node_modules/zod/src/v3/tests/pipeline.test.ts +0 -29
  648. package/node_modules/zod/src/v3/tests/preprocess.test.ts +0 -186
  649. package/node_modules/zod/src/v3/tests/primitive.test.ts +0 -440
  650. package/node_modules/zod/src/v3/tests/promise.test.ts +0 -90
  651. package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -194
  652. package/node_modules/zod/src/v3/tests/record.test.ts +0 -171
  653. package/node_modules/zod/src/v3/tests/recursive.test.ts +0 -197
  654. package/node_modules/zod/src/v3/tests/refine.test.ts +0 -313
  655. package/node_modules/zod/src/v3/tests/safeparse.test.ts +0 -27
  656. package/node_modules/zod/src/v3/tests/set.test.ts +0 -142
  657. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +0 -83
  658. package/node_modules/zod/src/v3/tests/string.test.ts +0 -916
  659. package/node_modules/zod/src/v3/tests/transformer.test.ts +0 -233
  660. package/node_modules/zod/src/v3/tests/tuple.test.ts +0 -90
  661. package/node_modules/zod/src/v3/tests/unions.test.ts +0 -57
  662. package/node_modules/zod/src/v3/tests/validations.test.ts +0 -133
  663. package/node_modules/zod/src/v3/tests/void.test.ts +0 -15
  664. package/node_modules/zod/src/v3/types.ts +0 -5138
  665. package/node_modules/zod/src/v4/classic/checks.ts +0 -32
  666. package/node_modules/zod/src/v4/classic/coerce.ts +0 -27
  667. package/node_modules/zod/src/v4/classic/compat.ts +0 -70
  668. package/node_modules/zod/src/v4/classic/errors.ts +0 -82
  669. package/node_modules/zod/src/v4/classic/external.ts +0 -51
  670. package/node_modules/zod/src/v4/classic/from-json-schema.ts +0 -643
  671. package/node_modules/zod/src/v4/classic/index.ts +0 -5
  672. package/node_modules/zod/src/v4/classic/iso.ts +0 -90
  673. package/node_modules/zod/src/v4/classic/parse.ts +0 -82
  674. package/node_modules/zod/src/v4/classic/schemas.ts +0 -2409
  675. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +0 -26
  676. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +0 -59
  677. package/node_modules/zod/src/v4/classic/tests/array.test.ts +0 -264
  678. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +0 -210
  679. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +0 -381
  680. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +0 -68
  681. package/node_modules/zod/src/v4/classic/tests/base.test.ts +0 -7
  682. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +0 -54
  683. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +0 -106
  684. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +0 -276
  685. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +0 -20
  686. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +0 -573
  687. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +0 -562
  688. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +0 -160
  689. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +0 -374
  690. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +0 -40
  691. package/node_modules/zod/src/v4/classic/tests/date.test.ts +0 -62
  692. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +0 -302
  693. package/node_modules/zod/src/v4/classic/tests/default.test.ts +0 -365
  694. package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +0 -27
  695. package/node_modules/zod/src/v4/classic/tests/description.test.ts +0 -32
  696. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +0 -661
  697. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +0 -285
  698. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +0 -595
  699. package/node_modules/zod/src/v4/classic/tests/error.test.ts +0 -711
  700. package/node_modules/zod/src/v4/classic/tests/file.test.ts +0 -96
  701. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -179
  702. package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +0 -26
  703. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +0 -734
  704. package/node_modules/zod/src/v4/classic/tests/function.test.ts +0 -360
  705. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +0 -72
  706. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +0 -68
  707. package/node_modules/zod/src/v4/classic/tests/index.test.ts +0 -939
  708. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +0 -60
  709. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +0 -198
  710. package/node_modules/zod/src/v4/classic/tests/json.test.ts +0 -109
  711. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +0 -227
  712. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +0 -117
  713. package/node_modules/zod/src/v4/classic/tests/map.test.ts +0 -330
  714. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +0 -21
  715. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +0 -168
  716. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +0 -101
  717. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +0 -22
  718. package/node_modules/zod/src/v4/classic/tests/number.test.ts +0 -270
  719. package/node_modules/zod/src/v4/classic/tests/object.test.ts +0 -640
  720. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +0 -223
  721. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +0 -427
  722. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +0 -211
  723. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +0 -101
  724. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +0 -74
  725. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +0 -282
  726. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +0 -175
  727. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +0 -81
  728. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +0 -23
  729. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -252
  730. package/node_modules/zod/src/v4/classic/tests/record.test.ts +0 -632
  731. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +0 -582
  732. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +0 -570
  733. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +0 -243
  734. package/node_modules/zod/src/v4/classic/tests/set.test.ts +0 -181
  735. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +0 -134
  736. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +0 -125
  737. package/node_modules/zod/src/v4/classic/tests/string.test.ts +0 -1175
  738. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +0 -106
  739. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +0 -771
  740. package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +0 -438
  741. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +0 -2990
  742. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +0 -361
  743. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +0 -183
  744. package/node_modules/zod/src/v4/classic/tests/union.test.ts +0 -219
  745. package/node_modules/zod/src/v4/classic/tests/url.test.ts +0 -13
  746. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +0 -283
  747. package/node_modules/zod/src/v4/classic/tests/void.test.ts +0 -12
  748. package/node_modules/zod/src/v4/core/api.ts +0 -1798
  749. package/node_modules/zod/src/v4/core/checks.ts +0 -1293
  750. package/node_modules/zod/src/v4/core/config.ts +0 -15
  751. package/node_modules/zod/src/v4/core/core.ts +0 -138
  752. package/node_modules/zod/src/v4/core/doc.ts +0 -44
  753. package/node_modules/zod/src/v4/core/errors.ts +0 -448
  754. package/node_modules/zod/src/v4/core/index.ts +0 -16
  755. package/node_modules/zod/src/v4/core/json-schema-generator.ts +0 -126
  756. package/node_modules/zod/src/v4/core/json-schema-processors.ts +0 -667
  757. package/node_modules/zod/src/v4/core/json-schema.ts +0 -147
  758. package/node_modules/zod/src/v4/core/parse.ts +0 -195
  759. package/node_modules/zod/src/v4/core/regexes.ts +0 -183
  760. package/node_modules/zod/src/v4/core/registries.ts +0 -105
  761. package/node_modules/zod/src/v4/core/schemas.ts +0 -4538
  762. package/node_modules/zod/src/v4/core/standard-schema.ts +0 -159
  763. package/node_modules/zod/src/v4/core/tests/extend.test.ts +0 -59
  764. package/node_modules/zod/src/v4/core/tests/index.test.ts +0 -46
  765. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +0 -124
  766. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +0 -22
  767. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +0 -181
  768. package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +0 -379
  769. package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +0 -46
  770. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +0 -128
  771. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +0 -69
  772. package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +0 -83
  773. package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +0 -67
  774. package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +0 -45
  775. package/node_modules/zod/src/v4/core/to-json-schema.ts +0 -613
  776. package/node_modules/zod/src/v4/core/util.ts +0 -966
  777. package/node_modules/zod/src/v4/core/versions.ts +0 -5
  778. package/node_modules/zod/src/v4/core/zsf.ts +0 -323
  779. package/node_modules/zod/src/v4/index.ts +0 -4
  780. package/node_modules/zod/src/v4/locales/ar.ts +0 -115
  781. package/node_modules/zod/src/v4/locales/az.ts +0 -111
  782. package/node_modules/zod/src/v4/locales/be.ts +0 -176
  783. package/node_modules/zod/src/v4/locales/bg.ts +0 -128
  784. package/node_modules/zod/src/v4/locales/ca.ts +0 -116
  785. package/node_modules/zod/src/v4/locales/cs.ts +0 -118
  786. package/node_modules/zod/src/v4/locales/da.ts +0 -123
  787. package/node_modules/zod/src/v4/locales/de.ts +0 -116
  788. package/node_modules/zod/src/v4/locales/en.ts +0 -119
  789. package/node_modules/zod/src/v4/locales/eo.ts +0 -118
  790. package/node_modules/zod/src/v4/locales/es.ts +0 -141
  791. package/node_modules/zod/src/v4/locales/fa.ts +0 -126
  792. package/node_modules/zod/src/v4/locales/fi.ts +0 -121
  793. package/node_modules/zod/src/v4/locales/fr-CA.ts +0 -116
  794. package/node_modules/zod/src/v4/locales/fr.ts +0 -116
  795. package/node_modules/zod/src/v4/locales/he.ts +0 -246
  796. package/node_modules/zod/src/v4/locales/hu.ts +0 -117
  797. package/node_modules/zod/src/v4/locales/hy.ts +0 -164
  798. package/node_modules/zod/src/v4/locales/id.ts +0 -115
  799. package/node_modules/zod/src/v4/locales/index.ts +0 -49
  800. package/node_modules/zod/src/v4/locales/is.ts +0 -119
  801. package/node_modules/zod/src/v4/locales/it.ts +0 -116
  802. package/node_modules/zod/src/v4/locales/ja.ts +0 -114
  803. package/node_modules/zod/src/v4/locales/ka.ts +0 -123
  804. package/node_modules/zod/src/v4/locales/kh.ts +0 -7
  805. package/node_modules/zod/src/v4/locales/km.ts +0 -119
  806. package/node_modules/zod/src/v4/locales/ko.ts +0 -121
  807. package/node_modules/zod/src/v4/locales/lt.ts +0 -239
  808. package/node_modules/zod/src/v4/locales/mk.ts +0 -118
  809. package/node_modules/zod/src/v4/locales/ms.ts +0 -115
  810. package/node_modules/zod/src/v4/locales/nl.ts +0 -121
  811. package/node_modules/zod/src/v4/locales/no.ts +0 -116
  812. package/node_modules/zod/src/v4/locales/ota.ts +0 -117
  813. package/node_modules/zod/src/v4/locales/pl.ts +0 -118
  814. package/node_modules/zod/src/v4/locales/ps.ts +0 -126
  815. package/node_modules/zod/src/v4/locales/pt.ts +0 -116
  816. package/node_modules/zod/src/v4/locales/ru.ts +0 -176
  817. package/node_modules/zod/src/v4/locales/sl.ts +0 -118
  818. package/node_modules/zod/src/v4/locales/sv.ts +0 -119
  819. package/node_modules/zod/src/v4/locales/ta.ts +0 -118
  820. package/node_modules/zod/src/v4/locales/th.ts +0 -119
  821. package/node_modules/zod/src/v4/locales/tr.ts +0 -111
  822. package/node_modules/zod/src/v4/locales/ua.ts +0 -7
  823. package/node_modules/zod/src/v4/locales/uk.ts +0 -117
  824. package/node_modules/zod/src/v4/locales/ur.ts +0 -119
  825. package/node_modules/zod/src/v4/locales/uz.ts +0 -116
  826. package/node_modules/zod/src/v4/locales/vi.ts +0 -117
  827. package/node_modules/zod/src/v4/locales/yo.ts +0 -124
  828. package/node_modules/zod/src/v4/locales/zh-CN.ts +0 -116
  829. package/node_modules/zod/src/v4/locales/zh-TW.ts +0 -115
  830. package/node_modules/zod/src/v4/mini/checks.ts +0 -32
  831. package/node_modules/zod/src/v4/mini/coerce.ts +0 -27
  832. package/node_modules/zod/src/v4/mini/external.ts +0 -40
  833. package/node_modules/zod/src/v4/mini/index.ts +0 -3
  834. package/node_modules/zod/src/v4/mini/iso.ts +0 -66
  835. package/node_modules/zod/src/v4/mini/parse.ts +0 -14
  836. package/node_modules/zod/src/v4/mini/schemas.ts +0 -1916
  837. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +0 -24
  838. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +0 -129
  839. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +0 -94
  840. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +0 -144
  841. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +0 -529
  842. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +0 -36
  843. package/node_modules/zod/src/v4/mini/tests/error.test.ts +0 -22
  844. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +0 -5
  845. package/node_modules/zod/src/v4/mini/tests/index.test.ts +0 -963
  846. package/node_modules/zod/src/v4/mini/tests/number.test.ts +0 -95
  847. package/node_modules/zod/src/v4/mini/tests/object.test.ts +0 -227
  848. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +0 -43
  849. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +0 -275
  850. package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +0 -50
  851. package/node_modules/zod/src/v4/mini/tests/string.test.ts +0 -347
  852. package/node_modules/zod/src/v4-mini/index.ts +0 -3
  853. package/node_modules/zod/v3/ZodError.cjs +0 -138
  854. package/node_modules/zod/v3/ZodError.d.cts +0 -164
  855. package/node_modules/zod/v3/ZodError.d.ts +0 -164
  856. package/node_modules/zod/v3/ZodError.js +0 -133
  857. package/node_modules/zod/v3/errors.cjs +0 -17
  858. package/node_modules/zod/v3/errors.d.cts +0 -5
  859. package/node_modules/zod/v3/errors.d.ts +0 -5
  860. package/node_modules/zod/v3/errors.js +0 -9
  861. package/node_modules/zod/v3/external.cjs +0 -22
  862. package/node_modules/zod/v3/external.d.cts +0 -6
  863. package/node_modules/zod/v3/external.d.ts +0 -6
  864. package/node_modules/zod/v3/external.js +0 -6
  865. package/node_modules/zod/v3/helpers/enumUtil.cjs +0 -2
  866. package/node_modules/zod/v3/helpers/enumUtil.d.cts +0 -8
  867. package/node_modules/zod/v3/helpers/enumUtil.d.ts +0 -8
  868. package/node_modules/zod/v3/helpers/enumUtil.js +0 -1
  869. package/node_modules/zod/v3/helpers/errorUtil.cjs +0 -9
  870. package/node_modules/zod/v3/helpers/errorUtil.d.cts +0 -9
  871. package/node_modules/zod/v3/helpers/errorUtil.d.ts +0 -9
  872. package/node_modules/zod/v3/helpers/errorUtil.js +0 -6
  873. package/node_modules/zod/v3/helpers/parseUtil.cjs +0 -124
  874. package/node_modules/zod/v3/helpers/parseUtil.d.cts +0 -78
  875. package/node_modules/zod/v3/helpers/parseUtil.d.ts +0 -78
  876. package/node_modules/zod/v3/helpers/parseUtil.js +0 -109
  877. package/node_modules/zod/v3/helpers/partialUtil.cjs +0 -2
  878. package/node_modules/zod/v3/helpers/partialUtil.d.cts +0 -8
  879. package/node_modules/zod/v3/helpers/partialUtil.d.ts +0 -8
  880. package/node_modules/zod/v3/helpers/partialUtil.js +0 -1
  881. package/node_modules/zod/v3/helpers/typeAliases.cjs +0 -2
  882. package/node_modules/zod/v3/helpers/typeAliases.d.cts +0 -2
  883. package/node_modules/zod/v3/helpers/typeAliases.d.ts +0 -2
  884. package/node_modules/zod/v3/helpers/typeAliases.js +0 -1
  885. package/node_modules/zod/v3/helpers/util.cjs +0 -137
  886. package/node_modules/zod/v3/helpers/util.d.cts +0 -85
  887. package/node_modules/zod/v3/helpers/util.d.ts +0 -85
  888. package/node_modules/zod/v3/helpers/util.js +0 -133
  889. package/node_modules/zod/v3/index.cjs +0 -33
  890. package/node_modules/zod/v3/index.d.cts +0 -4
  891. package/node_modules/zod/v3/index.d.ts +0 -4
  892. package/node_modules/zod/v3/index.js +0 -4
  893. package/node_modules/zod/v3/locales/en.cjs +0 -112
  894. package/node_modules/zod/v3/locales/en.d.cts +0 -3
  895. package/node_modules/zod/v3/locales/en.d.ts +0 -3
  896. package/node_modules/zod/v3/locales/en.js +0 -109
  897. package/node_modules/zod/v3/package.json +0 -6
  898. package/node_modules/zod/v3/standard-schema.cjs +0 -2
  899. package/node_modules/zod/v3/standard-schema.d.cts +0 -102
  900. package/node_modules/zod/v3/standard-schema.d.ts +0 -102
  901. package/node_modules/zod/v3/standard-schema.js +0 -1
  902. package/node_modules/zod/v3/types.cjs +0 -3777
  903. package/node_modules/zod/v3/types.d.cts +0 -1034
  904. package/node_modules/zod/v3/types.d.ts +0 -1034
  905. package/node_modules/zod/v3/types.js +0 -3695
  906. package/node_modules/zod/v4/classic/checks.cjs +0 -33
  907. package/node_modules/zod/v4/classic/checks.d.cts +0 -1
  908. package/node_modules/zod/v4/classic/checks.d.ts +0 -1
  909. package/node_modules/zod/v4/classic/checks.js +0 -1
  910. package/node_modules/zod/v4/classic/coerce.cjs +0 -47
  911. package/node_modules/zod/v4/classic/coerce.d.cts +0 -17
  912. package/node_modules/zod/v4/classic/coerce.d.ts +0 -17
  913. package/node_modules/zod/v4/classic/coerce.js +0 -17
  914. package/node_modules/zod/v4/classic/compat.cjs +0 -61
  915. package/node_modules/zod/v4/classic/compat.d.cts +0 -50
  916. package/node_modules/zod/v4/classic/compat.d.ts +0 -50
  917. package/node_modules/zod/v4/classic/compat.js +0 -31
  918. package/node_modules/zod/v4/classic/errors.cjs +0 -74
  919. package/node_modules/zod/v4/classic/errors.d.cts +0 -30
  920. package/node_modules/zod/v4/classic/errors.d.ts +0 -30
  921. package/node_modules/zod/v4/classic/errors.js +0 -48
  922. package/node_modules/zod/v4/classic/external.cjs +0 -73
  923. package/node_modules/zod/v4/classic/external.d.cts +0 -15
  924. package/node_modules/zod/v4/classic/external.d.ts +0 -15
  925. package/node_modules/zod/v4/classic/external.js +0 -20
  926. package/node_modules/zod/v4/classic/from-json-schema.cjs +0 -610
  927. package/node_modules/zod/v4/classic/from-json-schema.d.cts +0 -12
  928. package/node_modules/zod/v4/classic/from-json-schema.d.ts +0 -12
  929. package/node_modules/zod/v4/classic/from-json-schema.js +0 -584
  930. package/node_modules/zod/v4/classic/index.cjs +0 -33
  931. package/node_modules/zod/v4/classic/index.d.cts +0 -4
  932. package/node_modules/zod/v4/classic/index.d.ts +0 -4
  933. package/node_modules/zod/v4/classic/index.js +0 -4
  934. package/node_modules/zod/v4/classic/iso.cjs +0 -60
  935. package/node_modules/zod/v4/classic/iso.d.cts +0 -22
  936. package/node_modules/zod/v4/classic/iso.d.ts +0 -22
  937. package/node_modules/zod/v4/classic/iso.js +0 -30
  938. package/node_modules/zod/v4/classic/package.json +0 -6
  939. package/node_modules/zod/v4/classic/parse.cjs +0 -41
  940. package/node_modules/zod/v4/classic/parse.d.cts +0 -31
  941. package/node_modules/zod/v4/classic/parse.d.ts +0 -31
  942. package/node_modules/zod/v4/classic/parse.js +0 -15
  943. package/node_modules/zod/v4/classic/schemas.cjs +0 -1272
  944. package/node_modules/zod/v4/classic/schemas.d.cts +0 -739
  945. package/node_modules/zod/v4/classic/schemas.d.ts +0 -739
  946. package/node_modules/zod/v4/classic/schemas.js +0 -1157
  947. package/node_modules/zod/v4/core/api.cjs +0 -1222
  948. package/node_modules/zod/v4/core/api.d.cts +0 -304
  949. package/node_modules/zod/v4/core/api.d.ts +0 -304
  950. package/node_modules/zod/v4/core/api.js +0 -1082
  951. package/node_modules/zod/v4/core/checks.cjs +0 -601
  952. package/node_modules/zod/v4/core/checks.d.cts +0 -278
  953. package/node_modules/zod/v4/core/checks.d.ts +0 -278
  954. package/node_modules/zod/v4/core/checks.js +0 -575
  955. package/node_modules/zod/v4/core/core.cjs +0 -83
  956. package/node_modules/zod/v4/core/core.d.cts +0 -70
  957. package/node_modules/zod/v4/core/core.d.ts +0 -70
  958. package/node_modules/zod/v4/core/core.js +0 -76
  959. package/node_modules/zod/v4/core/doc.cjs +0 -39
  960. package/node_modules/zod/v4/core/doc.d.cts +0 -14
  961. package/node_modules/zod/v4/core/doc.d.ts +0 -14
  962. package/node_modules/zod/v4/core/doc.js +0 -35
  963. package/node_modules/zod/v4/core/errors.cjs +0 -213
  964. package/node_modules/zod/v4/core/errors.d.cts +0 -220
  965. package/node_modules/zod/v4/core/errors.d.ts +0 -220
  966. package/node_modules/zod/v4/core/errors.js +0 -182
  967. package/node_modules/zod/v4/core/index.cjs +0 -47
  968. package/node_modules/zod/v4/core/index.d.cts +0 -16
  969. package/node_modules/zod/v4/core/index.d.ts +0 -16
  970. package/node_modules/zod/v4/core/index.js +0 -16
  971. package/node_modules/zod/v4/core/json-schema-generator.cjs +0 -99
  972. package/node_modules/zod/v4/core/json-schema-generator.d.cts +0 -65
  973. package/node_modules/zod/v4/core/json-schema-generator.d.ts +0 -65
  974. package/node_modules/zod/v4/core/json-schema-generator.js +0 -95
  975. package/node_modules/zod/v4/core/json-schema-processors.cjs +0 -648
  976. package/node_modules/zod/v4/core/json-schema-processors.d.cts +0 -49
  977. package/node_modules/zod/v4/core/json-schema-processors.d.ts +0 -49
  978. package/node_modules/zod/v4/core/json-schema-processors.js +0 -605
  979. package/node_modules/zod/v4/core/json-schema.cjs +0 -2
  980. package/node_modules/zod/v4/core/json-schema.d.cts +0 -88
  981. package/node_modules/zod/v4/core/json-schema.d.ts +0 -88
  982. package/node_modules/zod/v4/core/json-schema.js +0 -1
  983. package/node_modules/zod/v4/core/package.json +0 -6
  984. package/node_modules/zod/v4/core/parse.cjs +0 -131
  985. package/node_modules/zod/v4/core/parse.d.cts +0 -49
  986. package/node_modules/zod/v4/core/parse.d.ts +0 -49
  987. package/node_modules/zod/v4/core/parse.js +0 -93
  988. package/node_modules/zod/v4/core/regexes.cjs +0 -166
  989. package/node_modules/zod/v4/core/regexes.d.cts +0 -79
  990. package/node_modules/zod/v4/core/regexes.d.ts +0 -79
  991. package/node_modules/zod/v4/core/regexes.js +0 -133
  992. package/node_modules/zod/v4/core/registries.cjs +0 -56
  993. package/node_modules/zod/v4/core/registries.d.cts +0 -35
  994. package/node_modules/zod/v4/core/registries.d.ts +0 -35
  995. package/node_modules/zod/v4/core/registries.js +0 -51
  996. package/node_modules/zod/v4/core/schemas.cjs +0 -2124
  997. package/node_modules/zod/v4/core/schemas.d.cts +0 -1146
  998. package/node_modules/zod/v4/core/schemas.d.ts +0 -1146
  999. package/node_modules/zod/v4/core/schemas.js +0 -2093
  1000. package/node_modules/zod/v4/core/standard-schema.cjs +0 -2
  1001. package/node_modules/zod/v4/core/standard-schema.d.cts +0 -126
  1002. package/node_modules/zod/v4/core/standard-schema.d.ts +0 -126
  1003. package/node_modules/zod/v4/core/standard-schema.js +0 -1
  1004. package/node_modules/zod/v4/core/to-json-schema.cjs +0 -446
  1005. package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -114
  1006. package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -114
  1007. package/node_modules/zod/v4/core/to-json-schema.js +0 -437
  1008. package/node_modules/zod/v4/core/util.cjs +0 -710
  1009. package/node_modules/zod/v4/core/util.d.cts +0 -199
  1010. package/node_modules/zod/v4/core/util.d.ts +0 -199
  1011. package/node_modules/zod/v4/core/util.js +0 -651
  1012. package/node_modules/zod/v4/core/versions.cjs +0 -8
  1013. package/node_modules/zod/v4/core/versions.d.cts +0 -5
  1014. package/node_modules/zod/v4/core/versions.d.ts +0 -5
  1015. package/node_modules/zod/v4/core/versions.js +0 -5
  1016. package/node_modules/zod/v4/index.cjs +0 -22
  1017. package/node_modules/zod/v4/index.d.cts +0 -3
  1018. package/node_modules/zod/v4/index.d.ts +0 -3
  1019. package/node_modules/zod/v4/index.js +0 -3
  1020. package/node_modules/zod/v4/locales/ar.cjs +0 -133
  1021. package/node_modules/zod/v4/locales/ar.d.cts +0 -5
  1022. package/node_modules/zod/v4/locales/ar.d.ts +0 -4
  1023. package/node_modules/zod/v4/locales/ar.js +0 -106
  1024. package/node_modules/zod/v4/locales/az.cjs +0 -132
  1025. package/node_modules/zod/v4/locales/az.d.cts +0 -5
  1026. package/node_modules/zod/v4/locales/az.d.ts +0 -4
  1027. package/node_modules/zod/v4/locales/az.js +0 -105
  1028. package/node_modules/zod/v4/locales/be.cjs +0 -183
  1029. package/node_modules/zod/v4/locales/be.d.cts +0 -5
  1030. package/node_modules/zod/v4/locales/be.d.ts +0 -4
  1031. package/node_modules/zod/v4/locales/be.js +0 -156
  1032. package/node_modules/zod/v4/locales/bg.cjs +0 -147
  1033. package/node_modules/zod/v4/locales/bg.d.cts +0 -5
  1034. package/node_modules/zod/v4/locales/bg.d.ts +0 -4
  1035. package/node_modules/zod/v4/locales/bg.js +0 -120
  1036. package/node_modules/zod/v4/locales/ca.cjs +0 -134
  1037. package/node_modules/zod/v4/locales/ca.d.cts +0 -5
  1038. package/node_modules/zod/v4/locales/ca.d.ts +0 -4
  1039. package/node_modules/zod/v4/locales/ca.js +0 -107
  1040. package/node_modules/zod/v4/locales/cs.cjs +0 -138
  1041. package/node_modules/zod/v4/locales/cs.d.cts +0 -5
  1042. package/node_modules/zod/v4/locales/cs.d.ts +0 -4
  1043. package/node_modules/zod/v4/locales/cs.js +0 -111
  1044. package/node_modules/zod/v4/locales/da.cjs +0 -142
  1045. package/node_modules/zod/v4/locales/da.d.cts +0 -5
  1046. package/node_modules/zod/v4/locales/da.d.ts +0 -4
  1047. package/node_modules/zod/v4/locales/da.js +0 -115
  1048. package/node_modules/zod/v4/locales/de.cjs +0 -135
  1049. package/node_modules/zod/v4/locales/de.d.cts +0 -5
  1050. package/node_modules/zod/v4/locales/de.d.ts +0 -4
  1051. package/node_modules/zod/v4/locales/de.js +0 -108
  1052. package/node_modules/zod/v4/locales/en.cjs +0 -136
  1053. package/node_modules/zod/v4/locales/en.d.cts +0 -5
  1054. package/node_modules/zod/v4/locales/en.d.ts +0 -4
  1055. package/node_modules/zod/v4/locales/en.js +0 -109
  1056. package/node_modules/zod/v4/locales/eo.cjs +0 -136
  1057. package/node_modules/zod/v4/locales/eo.d.cts +0 -5
  1058. package/node_modules/zod/v4/locales/eo.d.ts +0 -4
  1059. package/node_modules/zod/v4/locales/eo.js +0 -109
  1060. package/node_modules/zod/v4/locales/es.cjs +0 -159
  1061. package/node_modules/zod/v4/locales/es.d.cts +0 -5
  1062. package/node_modules/zod/v4/locales/es.d.ts +0 -4
  1063. package/node_modules/zod/v4/locales/es.js +0 -132
  1064. package/node_modules/zod/v4/locales/fa.cjs +0 -141
  1065. package/node_modules/zod/v4/locales/fa.d.cts +0 -5
  1066. package/node_modules/zod/v4/locales/fa.d.ts +0 -4
  1067. package/node_modules/zod/v4/locales/fa.js +0 -114
  1068. package/node_modules/zod/v4/locales/fi.cjs +0 -139
  1069. package/node_modules/zod/v4/locales/fi.d.cts +0 -5
  1070. package/node_modules/zod/v4/locales/fi.d.ts +0 -4
  1071. package/node_modules/zod/v4/locales/fi.js +0 -112
  1072. package/node_modules/zod/v4/locales/fr-CA.cjs +0 -134
  1073. package/node_modules/zod/v4/locales/fr-CA.d.cts +0 -5
  1074. package/node_modules/zod/v4/locales/fr-CA.d.ts +0 -4
  1075. package/node_modules/zod/v4/locales/fr-CA.js +0 -107
  1076. package/node_modules/zod/v4/locales/fr.cjs +0 -135
  1077. package/node_modules/zod/v4/locales/fr.d.cts +0 -5
  1078. package/node_modules/zod/v4/locales/fr.d.ts +0 -4
  1079. package/node_modules/zod/v4/locales/fr.js +0 -108
  1080. package/node_modules/zod/v4/locales/he.cjs +0 -241
  1081. package/node_modules/zod/v4/locales/he.d.cts +0 -5
  1082. package/node_modules/zod/v4/locales/he.d.ts +0 -4
  1083. package/node_modules/zod/v4/locales/he.js +0 -214
  1084. package/node_modules/zod/v4/locales/hu.cjs +0 -135
  1085. package/node_modules/zod/v4/locales/hu.d.cts +0 -5
  1086. package/node_modules/zod/v4/locales/hu.d.ts +0 -4
  1087. package/node_modules/zod/v4/locales/hu.js +0 -108
  1088. package/node_modules/zod/v4/locales/hy.cjs +0 -174
  1089. package/node_modules/zod/v4/locales/hy.d.cts +0 -5
  1090. package/node_modules/zod/v4/locales/hy.d.ts +0 -4
  1091. package/node_modules/zod/v4/locales/hy.js +0 -147
  1092. package/node_modules/zod/v4/locales/id.cjs +0 -133
  1093. package/node_modules/zod/v4/locales/id.d.cts +0 -5
  1094. package/node_modules/zod/v4/locales/id.d.ts +0 -4
  1095. package/node_modules/zod/v4/locales/id.js +0 -106
  1096. package/node_modules/zod/v4/locales/index.cjs +0 -104
  1097. package/node_modules/zod/v4/locales/index.d.cts +0 -49
  1098. package/node_modules/zod/v4/locales/index.d.ts +0 -49
  1099. package/node_modules/zod/v4/locales/index.js +0 -49
  1100. package/node_modules/zod/v4/locales/is.cjs +0 -136
  1101. package/node_modules/zod/v4/locales/is.d.cts +0 -5
  1102. package/node_modules/zod/v4/locales/is.d.ts +0 -4
  1103. package/node_modules/zod/v4/locales/is.js +0 -109
  1104. package/node_modules/zod/v4/locales/it.cjs +0 -135
  1105. package/node_modules/zod/v4/locales/it.d.cts +0 -5
  1106. package/node_modules/zod/v4/locales/it.d.ts +0 -4
  1107. package/node_modules/zod/v4/locales/it.js +0 -108
  1108. package/node_modules/zod/v4/locales/ja.cjs +0 -134
  1109. package/node_modules/zod/v4/locales/ja.d.cts +0 -5
  1110. package/node_modules/zod/v4/locales/ja.d.ts +0 -4
  1111. package/node_modules/zod/v4/locales/ja.js +0 -107
  1112. package/node_modules/zod/v4/locales/ka.cjs +0 -139
  1113. package/node_modules/zod/v4/locales/ka.d.cts +0 -5
  1114. package/node_modules/zod/v4/locales/ka.d.ts +0 -4
  1115. package/node_modules/zod/v4/locales/ka.js +0 -112
  1116. package/node_modules/zod/v4/locales/kh.cjs +0 -12
  1117. package/node_modules/zod/v4/locales/kh.d.cts +0 -5
  1118. package/node_modules/zod/v4/locales/kh.d.ts +0 -5
  1119. package/node_modules/zod/v4/locales/kh.js +0 -5
  1120. package/node_modules/zod/v4/locales/km.cjs +0 -137
  1121. package/node_modules/zod/v4/locales/km.d.cts +0 -5
  1122. package/node_modules/zod/v4/locales/km.d.ts +0 -4
  1123. package/node_modules/zod/v4/locales/km.js +0 -110
  1124. package/node_modules/zod/v4/locales/ko.cjs +0 -138
  1125. package/node_modules/zod/v4/locales/ko.d.cts +0 -5
  1126. package/node_modules/zod/v4/locales/ko.d.ts +0 -4
  1127. package/node_modules/zod/v4/locales/ko.js +0 -111
  1128. package/node_modules/zod/v4/locales/lt.cjs +0 -230
  1129. package/node_modules/zod/v4/locales/lt.d.cts +0 -5
  1130. package/node_modules/zod/v4/locales/lt.d.ts +0 -4
  1131. package/node_modules/zod/v4/locales/lt.js +0 -203
  1132. package/node_modules/zod/v4/locales/mk.cjs +0 -136
  1133. package/node_modules/zod/v4/locales/mk.d.cts +0 -5
  1134. package/node_modules/zod/v4/locales/mk.d.ts +0 -4
  1135. package/node_modules/zod/v4/locales/mk.js +0 -109
  1136. package/node_modules/zod/v4/locales/ms.cjs +0 -134
  1137. package/node_modules/zod/v4/locales/ms.d.cts +0 -5
  1138. package/node_modules/zod/v4/locales/ms.d.ts +0 -4
  1139. package/node_modules/zod/v4/locales/ms.js +0 -107
  1140. package/node_modules/zod/v4/locales/nl.cjs +0 -137
  1141. package/node_modules/zod/v4/locales/nl.d.cts +0 -5
  1142. package/node_modules/zod/v4/locales/nl.d.ts +0 -4
  1143. package/node_modules/zod/v4/locales/nl.js +0 -110
  1144. package/node_modules/zod/v4/locales/no.cjs +0 -135
  1145. package/node_modules/zod/v4/locales/no.d.cts +0 -5
  1146. package/node_modules/zod/v4/locales/no.d.ts +0 -4
  1147. package/node_modules/zod/v4/locales/no.js +0 -108
  1148. package/node_modules/zod/v4/locales/ota.cjs +0 -136
  1149. package/node_modules/zod/v4/locales/ota.d.cts +0 -5
  1150. package/node_modules/zod/v4/locales/ota.d.ts +0 -4
  1151. package/node_modules/zod/v4/locales/ota.js +0 -109
  1152. package/node_modules/zod/v4/locales/package.json +0 -6
  1153. package/node_modules/zod/v4/locales/pl.cjs +0 -136
  1154. package/node_modules/zod/v4/locales/pl.d.cts +0 -5
  1155. package/node_modules/zod/v4/locales/pl.d.ts +0 -4
  1156. package/node_modules/zod/v4/locales/pl.js +0 -109
  1157. package/node_modules/zod/v4/locales/ps.cjs +0 -141
  1158. package/node_modules/zod/v4/locales/ps.d.cts +0 -5
  1159. package/node_modules/zod/v4/locales/ps.d.ts +0 -4
  1160. package/node_modules/zod/v4/locales/ps.js +0 -114
  1161. package/node_modules/zod/v4/locales/pt.cjs +0 -135
  1162. package/node_modules/zod/v4/locales/pt.d.cts +0 -5
  1163. package/node_modules/zod/v4/locales/pt.d.ts +0 -4
  1164. package/node_modules/zod/v4/locales/pt.js +0 -108
  1165. package/node_modules/zod/v4/locales/ru.cjs +0 -183
  1166. package/node_modules/zod/v4/locales/ru.d.cts +0 -5
  1167. package/node_modules/zod/v4/locales/ru.d.ts +0 -4
  1168. package/node_modules/zod/v4/locales/ru.js +0 -156
  1169. package/node_modules/zod/v4/locales/sl.cjs +0 -136
  1170. package/node_modules/zod/v4/locales/sl.d.cts +0 -5
  1171. package/node_modules/zod/v4/locales/sl.d.ts +0 -4
  1172. package/node_modules/zod/v4/locales/sl.js +0 -109
  1173. package/node_modules/zod/v4/locales/sv.cjs +0 -137
  1174. package/node_modules/zod/v4/locales/sv.d.cts +0 -5
  1175. package/node_modules/zod/v4/locales/sv.d.ts +0 -4
  1176. package/node_modules/zod/v4/locales/sv.js +0 -110
  1177. package/node_modules/zod/v4/locales/ta.cjs +0 -137
  1178. package/node_modules/zod/v4/locales/ta.d.cts +0 -5
  1179. package/node_modules/zod/v4/locales/ta.d.ts +0 -4
  1180. package/node_modules/zod/v4/locales/ta.js +0 -110
  1181. package/node_modules/zod/v4/locales/th.cjs +0 -137
  1182. package/node_modules/zod/v4/locales/th.d.cts +0 -5
  1183. package/node_modules/zod/v4/locales/th.d.ts +0 -4
  1184. package/node_modules/zod/v4/locales/th.js +0 -110
  1185. package/node_modules/zod/v4/locales/tr.cjs +0 -132
  1186. package/node_modules/zod/v4/locales/tr.d.cts +0 -5
  1187. package/node_modules/zod/v4/locales/tr.d.ts +0 -4
  1188. package/node_modules/zod/v4/locales/tr.js +0 -105
  1189. package/node_modules/zod/v4/locales/ua.cjs +0 -12
  1190. package/node_modules/zod/v4/locales/ua.d.cts +0 -5
  1191. package/node_modules/zod/v4/locales/ua.d.ts +0 -5
  1192. package/node_modules/zod/v4/locales/ua.js +0 -5
  1193. package/node_modules/zod/v4/locales/uk.cjs +0 -135
  1194. package/node_modules/zod/v4/locales/uk.d.cts +0 -5
  1195. package/node_modules/zod/v4/locales/uk.d.ts +0 -4
  1196. package/node_modules/zod/v4/locales/uk.js +0 -108
  1197. package/node_modules/zod/v4/locales/ur.cjs +0 -137
  1198. package/node_modules/zod/v4/locales/ur.d.cts +0 -5
  1199. package/node_modules/zod/v4/locales/ur.d.ts +0 -4
  1200. package/node_modules/zod/v4/locales/ur.js +0 -110
  1201. package/node_modules/zod/v4/locales/uz.cjs +0 -136
  1202. package/node_modules/zod/v4/locales/uz.d.cts +0 -5
  1203. package/node_modules/zod/v4/locales/uz.d.ts +0 -4
  1204. package/node_modules/zod/v4/locales/uz.js +0 -109
  1205. package/node_modules/zod/v4/locales/vi.cjs +0 -135
  1206. package/node_modules/zod/v4/locales/vi.d.cts +0 -5
  1207. package/node_modules/zod/v4/locales/vi.d.ts +0 -4
  1208. package/node_modules/zod/v4/locales/vi.js +0 -108
  1209. package/node_modules/zod/v4/locales/yo.cjs +0 -134
  1210. package/node_modules/zod/v4/locales/yo.d.cts +0 -5
  1211. package/node_modules/zod/v4/locales/yo.d.ts +0 -4
  1212. package/node_modules/zod/v4/locales/yo.js +0 -107
  1213. package/node_modules/zod/v4/locales/zh-CN.cjs +0 -136
  1214. package/node_modules/zod/v4/locales/zh-CN.d.cts +0 -5
  1215. package/node_modules/zod/v4/locales/zh-CN.d.ts +0 -4
  1216. package/node_modules/zod/v4/locales/zh-CN.js +0 -109
  1217. package/node_modules/zod/v4/locales/zh-TW.cjs +0 -134
  1218. package/node_modules/zod/v4/locales/zh-TW.d.cts +0 -5
  1219. package/node_modules/zod/v4/locales/zh-TW.d.ts +0 -4
  1220. package/node_modules/zod/v4/locales/zh-TW.js +0 -107
  1221. package/node_modules/zod/v4/mini/checks.cjs +0 -34
  1222. package/node_modules/zod/v4/mini/checks.d.cts +0 -1
  1223. package/node_modules/zod/v4/mini/checks.d.ts +0 -1
  1224. package/node_modules/zod/v4/mini/checks.js +0 -1
  1225. package/node_modules/zod/v4/mini/coerce.cjs +0 -52
  1226. package/node_modules/zod/v4/mini/coerce.d.cts +0 -7
  1227. package/node_modules/zod/v4/mini/coerce.d.ts +0 -7
  1228. package/node_modules/zod/v4/mini/coerce.js +0 -22
  1229. package/node_modules/zod/v4/mini/external.cjs +0 -63
  1230. package/node_modules/zod/v4/mini/external.d.cts +0 -12
  1231. package/node_modules/zod/v4/mini/external.d.ts +0 -12
  1232. package/node_modules/zod/v4/mini/external.js +0 -14
  1233. package/node_modules/zod/v4/mini/index.cjs +0 -32
  1234. package/node_modules/zod/v4/mini/index.d.cts +0 -3
  1235. package/node_modules/zod/v4/mini/index.d.ts +0 -3
  1236. package/node_modules/zod/v4/mini/index.js +0 -3
  1237. package/node_modules/zod/v4/mini/iso.cjs +0 -64
  1238. package/node_modules/zod/v4/mini/iso.d.cts +0 -22
  1239. package/node_modules/zod/v4/mini/iso.d.ts +0 -22
  1240. package/node_modules/zod/v4/mini/iso.js +0 -34
  1241. package/node_modules/zod/v4/mini/package.json +0 -6
  1242. package/node_modules/zod/v4/mini/parse.cjs +0 -16
  1243. package/node_modules/zod/v4/mini/parse.d.cts +0 -1
  1244. package/node_modules/zod/v4/mini/parse.d.ts +0 -1
  1245. package/node_modules/zod/v4/mini/parse.js +0 -1
  1246. package/node_modules/zod/v4/mini/schemas.cjs +0 -1046
  1247. package/node_modules/zod/v4/mini/schemas.d.cts +0 -427
  1248. package/node_modules/zod/v4/mini/schemas.d.ts +0 -427
  1249. package/node_modules/zod/v4/mini/schemas.js +0 -925
  1250. package/node_modules/zod/v4/package.json +0 -6
  1251. package/node_modules/zod/v4-mini/index.cjs +0 -32
  1252. package/node_modules/zod/v4-mini/index.d.cts +0 -3
  1253. package/node_modules/zod/v4-mini/index.d.ts +0 -3
  1254. package/node_modules/zod/v4-mini/index.js +0 -3
  1255. package/node_modules/zod/v4-mini/package.json +0 -6
@@ -1,4538 +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 type * as JSONSchema from "./json-schema.js";
7
- import { parse, parseAsync, safeParse, safeParseAsync } from "./parse.js";
8
- import * as regexes from "./regexes.js";
9
- import type { StandardSchemaV1 } from "./standard-schema.js";
10
- import type { ProcessParams, ToJSONSchemaContext } from "./to-json-schema.js";
11
- import * as util from "./util.js";
12
- import { version } from "./versions.js";
13
-
14
- ///////////////////////////// PARSE //////////////////////////////
15
-
16
- export interface ParseContext<T extends errors.$ZodIssueBase = never> {
17
- /** Customize error messages. */
18
- readonly error?: errors.$ZodErrorMap<T>;
19
- /** Include the `input` field in issue objects. Default `false`. */
20
- readonly reportInput?: boolean;
21
- /** Skip eval-based fast path. Default `false`. */
22
- readonly jitless?: boolean;
23
- /** Abort validation after the first error. Default `false`. */
24
- // readonly abortEarly?: boolean;
25
- }
26
-
27
- /** @internal */
28
- export interface ParseContextInternal<T extends errors.$ZodIssueBase = never> extends ParseContext<T> {
29
- readonly async?: boolean | undefined;
30
- readonly direction?: "forward" | "backward";
31
- readonly skipChecks?: boolean;
32
- }
33
-
34
- export interface ParsePayload<T = unknown> {
35
- value: T;
36
- issues: errors.$ZodRawIssue[];
37
- /** A may to mark a whole payload as aborted. Used in codecs/pipes. */
38
- aborted?: boolean;
39
- }
40
-
41
- export type CheckFn<T> = (input: ParsePayload<T>) => util.MaybeAsync<void>;
42
-
43
- ///////////////////////////// SCHEMAS //////////////////////////////
44
-
45
- export interface $ZodTypeDef {
46
- type:
47
- | "string"
48
- | "number"
49
- | "int"
50
- | "boolean"
51
- | "bigint"
52
- | "symbol"
53
- | "null"
54
- | "undefined"
55
- | "void" // merge with undefined?
56
- | "never"
57
- | "any"
58
- | "unknown"
59
- | "date"
60
- | "object"
61
- | "record"
62
- | "file"
63
- | "array"
64
- | "tuple"
65
- | "union"
66
- | "intersection"
67
- | "map"
68
- | "set"
69
- | "enum"
70
- | "literal"
71
- | "nullable"
72
- | "optional"
73
- | "nonoptional"
74
- | "success"
75
- | "transform"
76
- | "default"
77
- | "prefault"
78
- | "catch"
79
- | "nan"
80
- | "pipe"
81
- | "readonly"
82
- | "template_literal"
83
- | "promise"
84
- | "lazy"
85
- | "function"
86
- | "custom";
87
- error?: errors.$ZodErrorMap<never> | undefined;
88
- checks?: checks.$ZodCheck<never>[];
89
- }
90
-
91
- export interface _$ZodTypeInternals {
92
- /** The `@zod/core` version of this schema */
93
- version: typeof version;
94
-
95
- /** Schema definition. */
96
- def: $ZodTypeDef;
97
- // types: Types;
98
-
99
- /** @internal Randomly generated ID for this schema. */
100
- // id: string;
101
-
102
- /** @internal List of deferred initializers. */
103
- deferred: util.AnyFunc[] | undefined;
104
-
105
- /** @internal Parses input and runs all checks (refinements). */
106
- run(payload: ParsePayload<any>, ctx: ParseContextInternal): util.MaybeAsync<ParsePayload>;
107
-
108
- /** @internal Parses input, doesn't run checks. */
109
- parse(payload: ParsePayload<any>, ctx: ParseContextInternal): util.MaybeAsync<ParsePayload>;
110
-
111
- /** @internal Stores identifiers for the set of traits implemented by this schema. */
112
- traits: Set<string>;
113
-
114
- /** @internal Indicates that a schema output type should be considered optional inside objects.
115
- * @default Required
116
- */
117
-
118
- /** @internal */
119
- optin?: "optional" | undefined;
120
- /** @internal */
121
- optout?: "optional" | undefined;
122
-
123
- /** @internal The set of literal values that will pass validation. Must be an exhaustive set. Used to determine optionality in z.record().
124
- *
125
- * Defined on: enum, const, literal, null, undefined
126
- * Passthrough: optional, nullable, branded, default, catch, pipe
127
- * Todo: unions?
128
- */
129
- values?: util.PrimitiveSet | undefined;
130
-
131
- /** Default value bubbled up from */
132
- // default?: unknown | undefined;
133
-
134
- /** @internal A set of literal discriminators used for the fast path in discriminated unions. */
135
- propValues?: util.PropValues | undefined;
136
-
137
- /** @internal This flag indicates that a schema validation can be represented with a regular expression. Used to determine allowable schemas in z.templateLiteral(). */
138
- pattern: RegExp | undefined;
139
-
140
- /** @internal The constructor function of this schema. */
141
- constr: new (
142
- def: any
143
- ) => $ZodType;
144
-
145
- /** @internal A catchall object for bag metadata related to this schema. Commonly modified by checks using `onattach`. */
146
- bag: Record<string, unknown>;
147
-
148
- /** @internal The set of issues this schema might throw during type checking. */
149
- isst: errors.$ZodIssueBase;
150
-
151
- /** @internal Subject to change, not a public API. */
152
- processJSONSchema?:
153
- | ((ctx: ToJSONSchemaContext, json: JSONSchema.BaseSchema, params: ProcessParams) => void)
154
- | undefined;
155
-
156
- /** An optional method used to override `toJSONSchema` logic. */
157
- toJSONSchema?: () => unknown;
158
-
159
- /** @internal The parent of this schema. Only set during certain clone operations. */
160
- parent?: $ZodType | undefined;
161
- }
162
- /** @internal */
163
- export interface $ZodTypeInternals<out O = unknown, out I = unknown> extends _$ZodTypeInternals {
164
- /** @internal The inferred output type */
165
- output: O; //extends { $out: infer O } ? O : Out;
166
- /** @internal The inferred input type */
167
- input: I; //extends { $in: infer I } ? I : In;
168
- }
169
-
170
- export type $ZodStandardSchema<T> = StandardSchemaV1.Props<core.input<T>, core.output<T>>;
171
-
172
- export type SomeType = { _zod: _$ZodTypeInternals };
173
-
174
- export interface $ZodType<
175
- O = unknown,
176
- I = unknown,
177
- Internals extends $ZodTypeInternals<O, I> = $ZodTypeInternals<O, I>,
178
- > {
179
- _zod: Internals;
180
- "~standard": $ZodStandardSchema<this>;
181
- }
182
- export interface _$ZodType<T extends $ZodTypeInternals = $ZodTypeInternals>
183
- extends $ZodType<T["output"], T["input"], T> {}
184
-
185
- export const $ZodType: core.$constructor<$ZodType> = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def) => {
186
- inst ??= {} as any;
187
-
188
- inst._zod.def = def; // set _def property
189
- inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
190
- inst._zod.version = version;
191
-
192
- const checks = [...(inst._zod.def.checks ?? [])];
193
-
194
- // if inst is itself a checks.$ZodCheck, run it as a check
195
- if (inst._zod.traits.has("$ZodCheck")) {
196
- checks.unshift(inst as any);
197
- }
198
-
199
- for (const ch of checks) {
200
- for (const fn of ch._zod.onattach) {
201
- fn(inst);
202
- }
203
- }
204
-
205
- if (checks.length === 0) {
206
- // deferred initializer
207
- // inst._zod.parse is not yet defined
208
- inst._zod.deferred ??= [];
209
- inst._zod.deferred?.push(() => {
210
- inst._zod.run = inst._zod.parse;
211
- });
212
- } else {
213
- const runChecks = (
214
- payload: ParsePayload,
215
- checks: checks.$ZodCheck<never>[],
216
- ctx?: ParseContextInternal | undefined
217
- ): util.MaybeAsync<ParsePayload> => {
218
- let isAborted = util.aborted(payload);
219
-
220
- let asyncResult!: Promise<unknown> | undefined;
221
- for (const ch of checks) {
222
- if (ch._zod.def.when) {
223
- const shouldRun = ch._zod.def.when(payload);
224
- if (!shouldRun) continue;
225
- } else if (isAborted) {
226
- continue;
227
- }
228
- const currLen = payload.issues.length;
229
- const _ = ch._zod.check(payload as any) as any as ParsePayload;
230
-
231
- if (_ instanceof Promise && ctx?.async === false) {
232
- throw new core.$ZodAsyncError();
233
- }
234
- if (asyncResult || _ instanceof Promise) {
235
- asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
236
- await _;
237
- const nextLen = payload.issues.length;
238
- if (nextLen === currLen) return;
239
- if (!isAborted) isAborted = util.aborted(payload, currLen);
240
- });
241
- } else {
242
- const nextLen = payload.issues.length;
243
- if (nextLen === currLen) continue;
244
- if (!isAborted) isAborted = util.aborted(payload, currLen);
245
- }
246
- }
247
-
248
- if (asyncResult) {
249
- return asyncResult.then(() => {
250
- return payload;
251
- });
252
- }
253
- return payload;
254
- };
255
-
256
- const handleCanaryResult = (canary: ParsePayload, payload: ParsePayload, ctx: ParseContextInternal) => {
257
- // abort if the canary is aborted
258
- if (util.aborted(canary)) {
259
- canary.aborted = true;
260
- return canary;
261
- }
262
-
263
- // run checks first, then
264
- const checkResult = runChecks(payload, checks, ctx);
265
- if (checkResult instanceof Promise) {
266
- if (ctx.async === false) throw new core.$ZodAsyncError();
267
- return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
268
- }
269
- return inst._zod.parse(checkResult, ctx);
270
- };
271
-
272
- inst._zod.run = (payload, ctx) => {
273
- if (ctx.skipChecks) {
274
- return inst._zod.parse(payload, ctx);
275
- }
276
- if (ctx.direction === "backward") {
277
- // run canary
278
- // initial pass (no checks)
279
- const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
280
-
281
- if (canary instanceof Promise) {
282
- return canary.then((canary) => {
283
- return handleCanaryResult(canary, payload, ctx);
284
- });
285
- }
286
-
287
- return handleCanaryResult(canary, payload, ctx);
288
- }
289
-
290
- // forward
291
- const result = inst._zod.parse(payload, ctx);
292
- if (result instanceof Promise) {
293
- if (ctx.async === false) throw new core.$ZodAsyncError();
294
- return result.then((result) => runChecks(result, checks, ctx));
295
- }
296
-
297
- return runChecks(result, checks, ctx);
298
- };
299
- }
300
-
301
- // Lazy initialize ~standard to avoid creating objects for every schema
302
- util.defineLazy(inst, "~standard", () => ({
303
- validate: (value: unknown) => {
304
- try {
305
- const r = safeParse(inst, value);
306
- return r.success ? { value: r.data } : { issues: r.error?.issues };
307
- } catch (_) {
308
- return safeParseAsync(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
309
- }
310
- },
311
- vendor: "zod",
312
- version: 1 as const,
313
- }));
314
- });
315
-
316
- export { clone } from "./util.js";
317
-
318
- //////////////////////////////////////////
319
- //////////////////////////////////////////
320
- ////////// //////////
321
- ////////// $ZodString //////////
322
- ////////// //////////
323
- //////////////////////////////////////////
324
- //////////////////////////////////////////
325
- export interface $ZodStringDef extends $ZodTypeDef {
326
- type: "string";
327
- coerce?: boolean;
328
- checks?: checks.$ZodCheck<string>[];
329
- }
330
-
331
- export interface $ZodStringInternals<Input> extends $ZodTypeInternals<string, Input> {
332
- def: $ZodStringDef;
333
- /** @deprecated Internal API, use with caution (not deprecated) */
334
- pattern: RegExp;
335
-
336
- /** @deprecated Internal API, use with caution (not deprecated) */
337
- isst: errors.$ZodIssueInvalidType;
338
- bag: util.LoosePartial<{
339
- minimum: number;
340
- maximum: number;
341
- patterns: Set<RegExp>;
342
- format: string;
343
- contentEncoding: string;
344
- }>;
345
- }
346
-
347
- export interface $ZodString<Input = unknown> extends _$ZodType<$ZodStringInternals<Input>> {
348
- // _zod: $ZodStringInternals<Input>;
349
- }
350
-
351
- export const $ZodString: core.$constructor<$ZodString> = /*@__PURE__*/ core.$constructor("$ZodString", (inst, def) => {
352
- $ZodType.init(inst, def);
353
- inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? regexes.string(inst._zod.bag);
354
- inst._zod.parse = (payload, _) => {
355
- if (def.coerce)
356
- try {
357
- payload.value = String(payload.value);
358
- } catch (_) {}
359
-
360
- if (typeof payload.value === "string") return payload;
361
-
362
- payload.issues.push({
363
- expected: "string",
364
- code: "invalid_type",
365
-
366
- input: payload.value,
367
- inst,
368
- });
369
- return payload;
370
- };
371
- });
372
-
373
- ////////////////////////////// ZodStringFormat //////////////////////////////
374
-
375
- export interface $ZodStringFormatDef<Format extends string = string>
376
- extends $ZodStringDef,
377
- checks.$ZodCheckStringFormatDef<Format> {}
378
-
379
- export interface $ZodStringFormatInternals<Format extends string = string>
380
- extends $ZodStringInternals<string>,
381
- checks.$ZodCheckStringFormatInternals {
382
- def: $ZodStringFormatDef<Format>;
383
- }
384
- export interface $ZodStringFormat<Format extends string = string> extends $ZodType {
385
- _zod: $ZodStringFormatInternals<Format>;
386
- }
387
-
388
- export const $ZodStringFormat: core.$constructor<$ZodStringFormat> = /*@__PURE__*/ core.$constructor(
389
- "$ZodStringFormat",
390
- (inst, def): void => {
391
- // check initialization must come first
392
- checks.$ZodCheckStringFormat.init(inst, def);
393
- $ZodString.init(inst, def);
394
- }
395
- );
396
-
397
- ////////////////////////////// ZodGUID //////////////////////////////
398
- export interface $ZodGUIDDef extends $ZodStringFormatDef<"guid"> {}
399
- export interface $ZodGUIDInternals extends $ZodStringFormatInternals<"guid"> {}
400
-
401
- export interface $ZodGUID extends $ZodType {
402
- _zod: $ZodGUIDInternals;
403
- }
404
-
405
- export const $ZodGUID: core.$constructor<$ZodGUID> = /*@__PURE__*/ core.$constructor("$ZodGUID", (inst, def): void => {
406
- def.pattern ??= regexes.guid;
407
- $ZodStringFormat.init(inst, def);
408
- });
409
-
410
- ////////////////////////////// ZodUUID //////////////////////////////
411
-
412
- export interface $ZodUUIDDef extends $ZodStringFormatDef<"uuid"> {
413
- version?: "v1" | "v2" | "v3" | "v4" | "v5" | "v6" | "v7" | "v8";
414
- }
415
-
416
- export interface $ZodUUIDInternals extends $ZodStringFormatInternals<"uuid"> {
417
- def: $ZodUUIDDef;
418
- }
419
-
420
- export interface $ZodUUID extends $ZodType {
421
- _zod: $ZodUUIDInternals;
422
- }
423
-
424
- export const $ZodUUID: core.$constructor<$ZodUUID> = /*@__PURE__*/ core.$constructor("$ZodUUID", (inst, def): void => {
425
- if (def.version) {
426
- const versionMap: Record<string, number> = {
427
- v1: 1,
428
- v2: 2,
429
- v3: 3,
430
- v4: 4,
431
- v5: 5,
432
- v6: 6,
433
- v7: 7,
434
- v8: 8,
435
- };
436
- const v = versionMap[def.version];
437
- if (v === undefined) throw new Error(`Invalid UUID version: "${def.version}"`);
438
- def.pattern ??= regexes.uuid(v);
439
- } else def.pattern ??= regexes.uuid();
440
- $ZodStringFormat.init(inst, def);
441
- });
442
-
443
- ////////////////////////////// ZodEmail //////////////////////////////
444
-
445
- export interface $ZodEmailDef extends $ZodStringFormatDef<"email"> {}
446
- export interface $ZodEmailInternals extends $ZodStringFormatInternals<"email"> {}
447
- export interface $ZodEmail extends $ZodType {
448
- _zod: $ZodEmailInternals;
449
- }
450
-
451
- export const $ZodEmail: core.$constructor<$ZodEmail> = /*@__PURE__*/ core.$constructor(
452
- "$ZodEmail",
453
- (inst, def): void => {
454
- def.pattern ??= regexes.email;
455
- $ZodStringFormat.init(inst, def);
456
- }
457
- );
458
-
459
- ////////////////////////////// ZodURL //////////////////////////////
460
-
461
- export interface $ZodURLDef extends $ZodStringFormatDef<"url"> {
462
- hostname?: RegExp | undefined;
463
- protocol?: RegExp | undefined;
464
- normalize?: boolean | undefined;
465
- }
466
- export interface $ZodURLInternals extends $ZodStringFormatInternals<"url"> {
467
- def: $ZodURLDef;
468
- }
469
-
470
- export interface $ZodURL extends $ZodType {
471
- _zod: $ZodURLInternals;
472
- }
473
-
474
- export const $ZodURL: core.$constructor<$ZodURL> = /*@__PURE__*/ core.$constructor("$ZodURL", (inst, def) => {
475
- $ZodStringFormat.init(inst, def);
476
- inst._zod.check = (payload) => {
477
- try {
478
- // Trim whitespace from input
479
- const trimmed = payload.value.trim();
480
- // @ts-ignore
481
- const url = new URL(trimmed);
482
-
483
- if (def.hostname) {
484
- def.hostname.lastIndex = 0;
485
- if (!def.hostname.test(url.hostname)) {
486
- payload.issues.push({
487
- code: "invalid_format",
488
- format: "url",
489
- note: "Invalid hostname",
490
- pattern: def.hostname.source,
491
- input: payload.value,
492
- inst,
493
- continue: !def.abort,
494
- });
495
- }
496
- }
497
-
498
- if (def.protocol) {
499
- def.protocol.lastIndex = 0;
500
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
501
- payload.issues.push({
502
- code: "invalid_format",
503
- format: "url",
504
- note: "Invalid protocol",
505
- pattern: def.protocol.source,
506
- input: payload.value,
507
- inst,
508
- continue: !def.abort,
509
- });
510
- }
511
- }
512
-
513
- // Set the output value based on normalize flag
514
- if (def.normalize) {
515
- // Use normalized URL
516
- payload.value = url.href;
517
- } else {
518
- // Preserve the original input (trimmed)
519
- payload.value = trimmed;
520
- }
521
-
522
- return;
523
- } catch (_) {
524
- payload.issues.push({
525
- code: "invalid_format",
526
- format: "url",
527
- input: payload.value,
528
- inst,
529
- continue: !def.abort,
530
- });
531
- }
532
- };
533
- });
534
-
535
- ////////////////////////////// ZodEmoji //////////////////////////////
536
-
537
- export interface $ZodEmojiDef extends $ZodStringFormatDef<"emoji"> {}
538
- export interface $ZodEmojiInternals extends $ZodStringFormatInternals<"emoji"> {}
539
-
540
- export interface $ZodEmoji extends $ZodType {
541
- _zod: $ZodEmojiInternals;
542
- }
543
-
544
- export const $ZodEmoji: core.$constructor<$ZodEmoji> = /*@__PURE__*/ core.$constructor(
545
- "$ZodEmoji",
546
- (inst, def): void => {
547
- def.pattern ??= regexes.emoji();
548
- $ZodStringFormat.init(inst, def);
549
- }
550
- );
551
-
552
- ////////////////////////////// ZodNanoID //////////////////////////////
553
-
554
- export interface $ZodNanoIDDef extends $ZodStringFormatDef<"nanoid"> {}
555
- export interface $ZodNanoIDInternals extends $ZodStringFormatInternals<"nanoid"> {}
556
-
557
- export interface $ZodNanoID extends $ZodType {
558
- _zod: $ZodNanoIDInternals;
559
- }
560
-
561
- export const $ZodNanoID: core.$constructor<$ZodNanoID> = /*@__PURE__*/ core.$constructor(
562
- "$ZodNanoID",
563
- (inst, def): void => {
564
- def.pattern ??= regexes.nanoid;
565
- $ZodStringFormat.init(inst, def);
566
- }
567
- );
568
-
569
- ////////////////////////////// ZodCUID //////////////////////////////
570
-
571
- export interface $ZodCUIDDef extends $ZodStringFormatDef<"cuid"> {}
572
- export interface $ZodCUIDInternals extends $ZodStringFormatInternals<"cuid"> {}
573
-
574
- export interface $ZodCUID extends $ZodType {
575
- _zod: $ZodCUIDInternals;
576
- }
577
-
578
- export const $ZodCUID: core.$constructor<$ZodCUID> = /*@__PURE__*/ core.$constructor("$ZodCUID", (inst, def): void => {
579
- def.pattern ??= regexes.cuid;
580
- $ZodStringFormat.init(inst, def);
581
- });
582
-
583
- ////////////////////////////// ZodCUID2 //////////////////////////////
584
-
585
- export interface $ZodCUID2Def extends $ZodStringFormatDef<"cuid2"> {}
586
- export interface $ZodCUID2Internals extends $ZodStringFormatInternals<"cuid2"> {}
587
-
588
- export interface $ZodCUID2 extends $ZodType {
589
- _zod: $ZodCUID2Internals;
590
- }
591
-
592
- export const $ZodCUID2: core.$constructor<$ZodCUID2> = /*@__PURE__*/ core.$constructor(
593
- "$ZodCUID2",
594
- (inst, def): void => {
595
- def.pattern ??= regexes.cuid2;
596
- $ZodStringFormat.init(inst, def);
597
- }
598
- );
599
-
600
- ////////////////////////////// ZodULID //////////////////////////////
601
-
602
- export interface $ZodULIDDef extends $ZodStringFormatDef<"ulid"> {}
603
- export interface $ZodULIDInternals extends $ZodStringFormatInternals<"ulid"> {}
604
-
605
- export interface $ZodULID extends $ZodType {
606
- _zod: $ZodULIDInternals;
607
- }
608
-
609
- export const $ZodULID: core.$constructor<$ZodULID> = /*@__PURE__*/ core.$constructor("$ZodULID", (inst, def): void => {
610
- def.pattern ??= regexes.ulid;
611
- $ZodStringFormat.init(inst, def);
612
- });
613
-
614
- ////////////////////////////// ZodXID //////////////////////////////
615
-
616
- export interface $ZodXIDDef extends $ZodStringFormatDef<"xid"> {}
617
- export interface $ZodXIDInternals extends $ZodStringFormatInternals<"xid"> {}
618
-
619
- export interface $ZodXID extends $ZodType {
620
- _zod: $ZodXIDInternals;
621
- }
622
-
623
- export const $ZodXID: core.$constructor<$ZodXID> = /*@__PURE__*/ core.$constructor("$ZodXID", (inst, def): void => {
624
- def.pattern ??= regexes.xid;
625
- $ZodStringFormat.init(inst, def);
626
- });
627
-
628
- ////////////////////////////// ZodKSUID //////////////////////////////
629
-
630
- export interface $ZodKSUIDDef extends $ZodStringFormatDef<"ksuid"> {}
631
- export interface $ZodKSUIDInternals extends $ZodStringFormatInternals<"ksuid"> {}
632
-
633
- export interface $ZodKSUID extends $ZodType {
634
- _zod: $ZodKSUIDInternals;
635
- }
636
-
637
- export const $ZodKSUID: core.$constructor<$ZodKSUID> = /*@__PURE__*/ core.$constructor(
638
- "$ZodKSUID",
639
- (inst, def): void => {
640
- def.pattern ??= regexes.ksuid;
641
- $ZodStringFormat.init(inst, def);
642
- }
643
- );
644
-
645
- ////////////////////////////// ZodISODateTime //////////////////////////////
646
-
647
- export interface $ZodISODateTimeDef extends $ZodStringFormatDef<"datetime"> {
648
- precision: number | null;
649
- offset: boolean;
650
- local: boolean;
651
- }
652
-
653
- export interface $ZodISODateTimeInternals extends $ZodStringFormatInternals {
654
- def: $ZodISODateTimeDef;
655
- }
656
-
657
- export interface $ZodISODateTime extends $ZodType {
658
- _zod: $ZodISODateTimeInternals;
659
- }
660
-
661
- export const $ZodISODateTime: core.$constructor<$ZodISODateTime> = /*@__PURE__*/ core.$constructor(
662
- "$ZodISODateTime",
663
- (inst, def): void => {
664
- def.pattern ??= regexes.datetime(def);
665
- $ZodStringFormat.init(inst, def);
666
- }
667
- );
668
-
669
- ////////////////////////////// ZodISODate //////////////////////////////
670
-
671
- export interface $ZodISODateDef extends $ZodStringFormatDef<"date"> {}
672
- export interface $ZodISODateInternals extends $ZodStringFormatInternals<"date"> {}
673
-
674
- export interface $ZodISODate extends $ZodType {
675
- _zod: $ZodISODateInternals;
676
- }
677
-
678
- export const $ZodISODate: core.$constructor<$ZodISODate> = /*@__PURE__*/ core.$constructor(
679
- "$ZodISODate",
680
- (inst, def): void => {
681
- def.pattern ??= regexes.date;
682
- $ZodStringFormat.init(inst, def);
683
- }
684
- );
685
-
686
- ////////////////////////////// ZodISOTime //////////////////////////////
687
-
688
- export interface $ZodISOTimeDef extends $ZodStringFormatDef<"time"> {
689
- precision?: number | null;
690
- }
691
-
692
- export interface $ZodISOTimeInternals extends $ZodStringFormatInternals<"time"> {
693
- def: $ZodISOTimeDef;
694
- }
695
-
696
- export interface $ZodISOTime extends $ZodType {
697
- _zod: $ZodISOTimeInternals;
698
- }
699
-
700
- export const $ZodISOTime: core.$constructor<$ZodISOTime> = /*@__PURE__*/ core.$constructor(
701
- "$ZodISOTime",
702
- (inst, def): void => {
703
- def.pattern ??= regexes.time(def);
704
- $ZodStringFormat.init(inst, def);
705
- }
706
- );
707
-
708
- ////////////////////////////// ZodISODuration //////////////////////////////
709
-
710
- export interface $ZodISODurationDef extends $ZodStringFormatDef<"duration"> {}
711
- export interface $ZodISODurationInternals extends $ZodStringFormatInternals<"duration"> {}
712
-
713
- export interface $ZodISODuration extends $ZodType {
714
- _zod: $ZodISODurationInternals;
715
- }
716
-
717
- export const $ZodISODuration: core.$constructor<$ZodISODuration> = /*@__PURE__*/ core.$constructor(
718
- "$ZodISODuration",
719
- (inst, def): void => {
720
- def.pattern ??= regexes.duration;
721
- $ZodStringFormat.init(inst, def);
722
- }
723
- );
724
-
725
- ////////////////////////////// ZodIPv4 //////////////////////////////
726
-
727
- export interface $ZodIPv4Def extends $ZodStringFormatDef<"ipv4"> {
728
- version?: "v4";
729
- }
730
-
731
- export interface $ZodIPv4Internals extends $ZodStringFormatInternals<"ipv4"> {
732
- def: $ZodIPv4Def;
733
- }
734
-
735
- export interface $ZodIPv4 extends $ZodType {
736
- _zod: $ZodIPv4Internals;
737
- }
738
-
739
- export const $ZodIPv4: core.$constructor<$ZodIPv4> = /*@__PURE__*/ core.$constructor("$ZodIPv4", (inst, def): void => {
740
- def.pattern ??= regexes.ipv4;
741
- $ZodStringFormat.init(inst, def);
742
-
743
- inst._zod.bag.format = `ipv4`;
744
- });
745
-
746
- ////////////////////////////// ZodIPv6 //////////////////////////////
747
-
748
- export interface $ZodIPv6Def extends $ZodStringFormatDef<"ipv6"> {
749
- version?: "v6";
750
- }
751
-
752
- export interface $ZodIPv6Internals extends $ZodStringFormatInternals<"ipv6"> {
753
- def: $ZodIPv6Def;
754
- }
755
-
756
- export interface $ZodIPv6 extends $ZodType {
757
- _zod: $ZodIPv6Internals;
758
- }
759
-
760
- export const $ZodIPv6: core.$constructor<$ZodIPv6> = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def): void => {
761
- def.pattern ??= regexes.ipv6;
762
- $ZodStringFormat.init(inst, def);
763
-
764
- inst._zod.bag.format = `ipv6`;
765
-
766
- inst._zod.check = (payload) => {
767
- try {
768
- // @ts-ignore
769
- new URL(`http://[${payload.value}]`);
770
- // return;
771
- } catch {
772
- payload.issues.push({
773
- code: "invalid_format",
774
- format: "ipv6",
775
- input: payload.value,
776
- inst,
777
- continue: !def.abort,
778
- });
779
- }
780
- };
781
- });
782
-
783
- ////////////////////////////// ZodMAC //////////////////////////////
784
- export interface $ZodMACDef extends $ZodStringFormatDef<"mac"> {
785
- delimiter?: string;
786
- }
787
-
788
- export interface $ZodMACInternals extends $ZodStringFormatInternals<"mac"> {
789
- def: $ZodMACDef;
790
- }
791
-
792
- export interface $ZodMAC extends $ZodType {
793
- _zod: $ZodMACInternals;
794
- }
795
-
796
- export const $ZodMAC: core.$constructor<$ZodMAC> = /*@__PURE__*/ core.$constructor("$ZodMAC", (inst, def): void => {
797
- def.pattern ??= regexes.mac(def.delimiter);
798
- $ZodStringFormat.init(inst, def);
799
-
800
- inst._zod.bag.format = `mac`;
801
- });
802
-
803
- ////////////////////////////// ZodCIDRv4 //////////////////////////////
804
-
805
- export interface $ZodCIDRv4Def extends $ZodStringFormatDef<"cidrv4"> {
806
- version?: "v4";
807
- }
808
-
809
- export interface $ZodCIDRv4Internals extends $ZodStringFormatInternals<"cidrv4"> {
810
- def: $ZodCIDRv4Def;
811
- }
812
-
813
- export interface $ZodCIDRv4 extends $ZodType {
814
- _zod: $ZodCIDRv4Internals;
815
- }
816
-
817
- export const $ZodCIDRv4: core.$constructor<$ZodCIDRv4> = /*@__PURE__*/ core.$constructor(
818
- "$ZodCIDRv4",
819
- (inst, def): void => {
820
- def.pattern ??= regexes.cidrv4;
821
- $ZodStringFormat.init(inst, def);
822
- }
823
- );
824
-
825
- ////////////////////////////// ZodCIDRv6 //////////////////////////////
826
-
827
- export interface $ZodCIDRv6Def extends $ZodStringFormatDef<"cidrv6"> {
828
- version?: "v6";
829
- }
830
-
831
- export interface $ZodCIDRv6Internals extends $ZodStringFormatInternals<"cidrv6"> {
832
- def: $ZodCIDRv6Def;
833
- }
834
-
835
- export interface $ZodCIDRv6 extends $ZodType {
836
- _zod: $ZodCIDRv6Internals;
837
- }
838
-
839
- export const $ZodCIDRv6: core.$constructor<$ZodCIDRv6> = /*@__PURE__*/ core.$constructor(
840
- "$ZodCIDRv6",
841
- (inst, def): void => {
842
- def.pattern ??= regexes.cidrv6; // not used for validation
843
- $ZodStringFormat.init(inst, def);
844
-
845
- inst._zod.check = (payload) => {
846
- const parts = payload.value.split("/");
847
- try {
848
- if (parts.length !== 2) throw new Error();
849
- const [address, prefix] = parts;
850
- if (!prefix) throw new Error();
851
- const prefixNum = Number(prefix);
852
- if (`${prefixNum}` !== prefix) throw new Error();
853
- if (prefixNum < 0 || prefixNum > 128) throw new Error();
854
- // @ts-ignore
855
- new URL(`http://[${address}]`);
856
- } catch {
857
- payload.issues.push({
858
- code: "invalid_format",
859
- format: "cidrv6",
860
- input: payload.value,
861
- inst,
862
- continue: !def.abort,
863
- });
864
- }
865
- };
866
- }
867
- );
868
-
869
- ////////////////////////////// ZodBase64 //////////////////////////////
870
- export function isValidBase64(data: string): boolean {
871
- if (data === "") return true;
872
- if (data.length % 4 !== 0) return false;
873
- try {
874
- // @ts-ignore
875
- atob(data);
876
- return true;
877
- } catch {
878
- return false;
879
- }
880
- }
881
-
882
- export interface $ZodBase64Def extends $ZodStringFormatDef<"base64"> {}
883
- export interface $ZodBase64Internals extends $ZodStringFormatInternals<"base64"> {}
884
-
885
- export interface $ZodBase64 extends $ZodType {
886
- _zod: $ZodBase64Internals;
887
- }
888
-
889
- export const $ZodBase64: core.$constructor<$ZodBase64> = /*@__PURE__*/ core.$constructor(
890
- "$ZodBase64",
891
- (inst, def): void => {
892
- def.pattern ??= regexes.base64;
893
- $ZodStringFormat.init(inst, def);
894
-
895
- inst._zod.bag.contentEncoding = "base64";
896
-
897
- inst._zod.check = (payload) => {
898
- if (isValidBase64(payload.value)) return;
899
-
900
- payload.issues.push({
901
- code: "invalid_format",
902
- format: "base64",
903
- input: payload.value,
904
- inst,
905
- continue: !def.abort,
906
- });
907
- };
908
- }
909
- );
910
-
911
- ////////////////////////////// ZodBase64 //////////////////////////////
912
- export function isValidBase64URL(data: string): boolean {
913
- if (!regexes.base64url.test(data)) return false;
914
- const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
915
- const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
916
- return isValidBase64(padded);
917
- }
918
-
919
- export interface $ZodBase64URLDef extends $ZodStringFormatDef<"base64url"> {}
920
- export interface $ZodBase64URLInternals extends $ZodStringFormatInternals<"base64url"> {}
921
-
922
- export interface $ZodBase64URL extends $ZodType {
923
- _zod: $ZodBase64URLInternals;
924
- }
925
-
926
- export const $ZodBase64URL: core.$constructor<$ZodBase64URL> = /*@__PURE__*/ core.$constructor(
927
- "$ZodBase64URL",
928
- (inst, def): void => {
929
- def.pattern ??= regexes.base64url;
930
- $ZodStringFormat.init(inst, def);
931
-
932
- inst._zod.bag.contentEncoding = "base64url";
933
-
934
- inst._zod.check = (payload) => {
935
- if (isValidBase64URL(payload.value)) return;
936
-
937
- payload.issues.push({
938
- code: "invalid_format",
939
- format: "base64url",
940
- input: payload.value,
941
- inst,
942
- continue: !def.abort,
943
- });
944
- };
945
- }
946
- );
947
-
948
- ////////////////////////////// ZodE164 //////////////////////////////
949
-
950
- export interface $ZodE164Def extends $ZodStringFormatDef<"e164"> {}
951
- export interface $ZodE164Internals extends $ZodStringFormatInternals<"e164"> {}
952
-
953
- export interface $ZodE164 extends $ZodType {
954
- _zod: $ZodE164Internals;
955
- }
956
-
957
- export const $ZodE164: core.$constructor<$ZodE164> = /*@__PURE__*/ core.$constructor("$ZodE164", (inst, def): void => {
958
- def.pattern ??= regexes.e164;
959
- $ZodStringFormat.init(inst, def);
960
- });
961
-
962
- ////////////////////////////// ZodJWT //////////////////////////////
963
-
964
- export function isValidJWT(token: string, algorithm: util.JWTAlgorithm | null = null): boolean {
965
- try {
966
- const tokensParts = token.split(".");
967
- if (tokensParts.length !== 3) return false;
968
- const [header] = tokensParts;
969
- if (!header) return false;
970
- // @ts-ignore
971
- const parsedHeader = JSON.parse(atob(header));
972
- if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
973
- if (!parsedHeader.alg) return false;
974
- if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
975
- return true;
976
- } catch {
977
- return false;
978
- }
979
- }
980
-
981
- export interface $ZodJWTDef extends $ZodStringFormatDef<"jwt"> {
982
- alg?: util.JWTAlgorithm | undefined;
983
- }
984
-
985
- export interface $ZodJWTInternals extends $ZodStringFormatInternals<"jwt"> {
986
- def: $ZodJWTDef;
987
- }
988
-
989
- export interface $ZodJWT extends $ZodType {
990
- _zod: $ZodJWTInternals;
991
- }
992
-
993
- export const $ZodJWT: core.$constructor<$ZodJWT> = /*@__PURE__*/ core.$constructor("$ZodJWT", (inst, def): void => {
994
- $ZodStringFormat.init(inst, def);
995
- inst._zod.check = (payload) => {
996
- if (isValidJWT(payload.value, def.alg)) return;
997
-
998
- payload.issues.push({
999
- code: "invalid_format",
1000
- format: "jwt",
1001
- input: payload.value,
1002
- inst,
1003
- continue: !def.abort,
1004
- });
1005
- };
1006
- });
1007
-
1008
- ////////////////////////////// ZodCustomStringFormat //////////////////////////////
1009
-
1010
- export interface $ZodCustomStringFormatDef<Format extends string = string> extends $ZodStringFormatDef<Format> {
1011
- fn: (val: string) => unknown;
1012
- }
1013
-
1014
- export interface $ZodCustomStringFormatInternals<Format extends string = string>
1015
- extends $ZodStringFormatInternals<Format> {
1016
- def: $ZodCustomStringFormatDef<Format>;
1017
- }
1018
-
1019
- export interface $ZodCustomStringFormat<Format extends string = string> extends $ZodStringFormat<Format> {
1020
- _zod: $ZodCustomStringFormatInternals<Format>;
1021
- }
1022
-
1023
- export const $ZodCustomStringFormat: core.$constructor<$ZodCustomStringFormat> = /*@__PURE__*/ core.$constructor(
1024
- "$ZodCustomStringFormat",
1025
- (inst, def): void => {
1026
- $ZodStringFormat.init(inst, def);
1027
- inst._zod.check = (payload) => {
1028
- if (def.fn(payload.value)) return;
1029
-
1030
- payload.issues.push({
1031
- code: "invalid_format",
1032
- format: def.format,
1033
- input: payload.value,
1034
- inst,
1035
- continue: !def.abort,
1036
- });
1037
- };
1038
- }
1039
- );
1040
-
1041
- /////////////////////////////////////////
1042
- /////////////////////////////////////////
1043
- ////////// //////////
1044
- ////////// ZodNumber //////////
1045
- ////////// //////////
1046
- /////////////////////////////////////////
1047
- /////////////////////////////////////////
1048
-
1049
- export interface $ZodNumberDef extends $ZodTypeDef {
1050
- type: "number";
1051
- coerce?: boolean;
1052
- // checks: checks.$ZodCheck<number>[];
1053
- }
1054
-
1055
- export interface $ZodNumberInternals<Input = unknown> extends $ZodTypeInternals<number, Input> {
1056
- def: $ZodNumberDef;
1057
- /** @deprecated Internal API, use with caution (not deprecated) */
1058
- pattern: RegExp;
1059
- /** @deprecated Internal API, use with caution (not deprecated) */
1060
- isst: errors.$ZodIssueInvalidType;
1061
- bag: util.LoosePartial<{
1062
- minimum: number;
1063
- maximum: number;
1064
- exclusiveMinimum: number;
1065
- exclusiveMaximum: number;
1066
- format: string;
1067
- pattern: RegExp;
1068
- }>;
1069
- }
1070
-
1071
- export interface $ZodNumber<Input = unknown> extends $ZodType {
1072
- _zod: $ZodNumberInternals<Input>;
1073
- }
1074
-
1075
- export const $ZodNumber: core.$constructor<$ZodNumber> = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, def) => {
1076
- $ZodType.init(inst, def);
1077
-
1078
- inst._zod.pattern = inst._zod.bag.pattern ?? regexes.number;
1079
- inst._zod.parse = (payload, _ctx) => {
1080
- if (def.coerce)
1081
- try {
1082
- payload.value = Number(payload.value);
1083
- } catch (_) {}
1084
- const input = payload.value;
1085
- if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
1086
- return payload;
1087
- }
1088
-
1089
- const received =
1090
- typeof input === "number"
1091
- ? Number.isNaN(input)
1092
- ? "NaN"
1093
- : !Number.isFinite(input)
1094
- ? "Infinity"
1095
- : undefined
1096
- : undefined;
1097
-
1098
- payload.issues.push({
1099
- expected: "number",
1100
- code: "invalid_type",
1101
-
1102
- input,
1103
- inst,
1104
- ...(received ? { received } : {}),
1105
- });
1106
- return payload;
1107
- };
1108
- });
1109
-
1110
- ///////////////////////////////////////////////
1111
- ////////// ZodNumberFormat //////////
1112
- ///////////////////////////////////////////////
1113
- export interface $ZodNumberFormatDef extends $ZodNumberDef, checks.$ZodCheckNumberFormatDef {}
1114
-
1115
- export interface $ZodNumberFormatInternals extends $ZodNumberInternals<number>, checks.$ZodCheckNumberFormatInternals {
1116
- def: $ZodNumberFormatDef;
1117
- isst: errors.$ZodIssueInvalidType;
1118
- }
1119
-
1120
- export interface $ZodNumberFormat extends $ZodType {
1121
- _zod: $ZodNumberFormatInternals;
1122
- }
1123
-
1124
- export const $ZodNumberFormat: core.$constructor<$ZodNumberFormat> = /*@__PURE__*/ core.$constructor(
1125
- "$ZodNumberFormat",
1126
- (inst, def) => {
1127
- checks.$ZodCheckNumberFormat.init(inst, def);
1128
- $ZodNumber.init(inst, def); // no format checks
1129
- }
1130
- );
1131
-
1132
- ///////////////////////////////////////////
1133
- ///////////////////////////////////////////
1134
- ////////// ///////////
1135
- ////////// $ZodBoolean //////////
1136
- ////////// ///////////
1137
- ///////////////////////////////////////////
1138
- ///////////////////////////////////////////
1139
-
1140
- export interface $ZodBooleanDef extends $ZodTypeDef {
1141
- type: "boolean";
1142
- coerce?: boolean;
1143
- checks?: checks.$ZodCheck<boolean>[];
1144
- }
1145
-
1146
- export interface $ZodBooleanInternals<T = unknown> extends $ZodTypeInternals<boolean, T> {
1147
- pattern: RegExp;
1148
- def: $ZodBooleanDef;
1149
- isst: errors.$ZodIssueInvalidType;
1150
- }
1151
-
1152
- export interface $ZodBoolean<T = unknown> extends $ZodType {
1153
- _zod: $ZodBooleanInternals<T>;
1154
- }
1155
-
1156
- export const $ZodBoolean: core.$constructor<$ZodBoolean> = /*@__PURE__*/ core.$constructor(
1157
- "$ZodBoolean",
1158
- (inst, def) => {
1159
- $ZodType.init(inst, def);
1160
- inst._zod.pattern = regexes.boolean;
1161
-
1162
- inst._zod.parse = (payload, _ctx) => {
1163
- if (def.coerce)
1164
- try {
1165
- payload.value = Boolean(payload.value);
1166
- } catch (_) {}
1167
- const input = payload.value;
1168
- if (typeof input === "boolean") return payload;
1169
- payload.issues.push({
1170
- expected: "boolean",
1171
- code: "invalid_type",
1172
-
1173
- input,
1174
- inst,
1175
- });
1176
- return payload;
1177
- };
1178
- }
1179
- );
1180
-
1181
- //////////////////////////////////////////
1182
- //////////////////////////////////////////
1183
- ////////// //////////
1184
- ////////// $ZodBigInt //////////
1185
- ////////// //////////
1186
- //////////////////////////////////////////
1187
- //////////////////////////////////////////
1188
-
1189
- export interface $ZodBigIntDef extends $ZodTypeDef {
1190
- type: "bigint";
1191
- coerce?: boolean;
1192
- // checks: checks.$ZodCheck<bigint>[];
1193
- }
1194
-
1195
- export interface $ZodBigIntInternals<T = unknown> extends $ZodTypeInternals<bigint, T> {
1196
- pattern: RegExp;
1197
- /** @internal Internal API, use with caution */
1198
- def: $ZodBigIntDef;
1199
- isst: errors.$ZodIssueInvalidType;
1200
- bag: util.LoosePartial<{
1201
- minimum: bigint;
1202
- maximum: bigint;
1203
- format: string;
1204
- }>;
1205
- }
1206
-
1207
- export interface $ZodBigInt<T = unknown> extends $ZodType {
1208
- _zod: $ZodBigIntInternals<T>;
1209
- }
1210
-
1211
- export const $ZodBigInt: core.$constructor<$ZodBigInt> = /*@__PURE__*/ core.$constructor("$ZodBigInt", (inst, def) => {
1212
- $ZodType.init(inst, def);
1213
- inst._zod.pattern = regexes.bigint;
1214
-
1215
- inst._zod.parse = (payload, _ctx) => {
1216
- if (def.coerce)
1217
- try {
1218
- payload.value = BigInt(payload.value);
1219
- } catch (_) {}
1220
-
1221
- if (typeof payload.value === "bigint") return payload;
1222
- payload.issues.push({
1223
- expected: "bigint",
1224
- code: "invalid_type",
1225
-
1226
- input: payload.value,
1227
- inst,
1228
- });
1229
- return payload;
1230
- };
1231
- });
1232
-
1233
- ///////////////////////////////////////////////
1234
- ////////// ZodBigIntFormat //////////
1235
- ///////////////////////////////////////////////
1236
- export interface $ZodBigIntFormatDef extends $ZodBigIntDef, checks.$ZodCheckBigIntFormatDef {
1237
- check: "bigint_format";
1238
- }
1239
-
1240
- export interface $ZodBigIntFormatInternals extends $ZodBigIntInternals<bigint>, checks.$ZodCheckBigIntFormatInternals {
1241
- def: $ZodBigIntFormatDef;
1242
- }
1243
-
1244
- export interface $ZodBigIntFormat extends $ZodType {
1245
- _zod: $ZodBigIntFormatInternals;
1246
- }
1247
-
1248
- export const $ZodBigIntFormat: core.$constructor<$ZodBigIntFormat> = /*@__PURE__*/ core.$constructor(
1249
- "$ZodBigIntFormat",
1250
- (inst, def) => {
1251
- checks.$ZodCheckBigIntFormat.init(inst, def);
1252
- $ZodBigInt.init(inst, def); // no format checks
1253
- }
1254
- );
1255
-
1256
- ////////////////////////////////////////////
1257
- ////////////////////////////////////////////
1258
- ////////// //////////
1259
- ////////// $ZodSymbol //////////
1260
- ////////// //////////
1261
- ////////////////////////////////////////////
1262
- ////////////////////////////////////////////
1263
- export interface $ZodSymbolDef extends $ZodTypeDef {
1264
- type: "symbol";
1265
- }
1266
-
1267
- export interface $ZodSymbolInternals extends $ZodTypeInternals<symbol, symbol> {
1268
- def: $ZodSymbolDef;
1269
- isst: errors.$ZodIssueInvalidType;
1270
- }
1271
-
1272
- export interface $ZodSymbol extends $ZodType {
1273
- _zod: $ZodSymbolInternals;
1274
- }
1275
-
1276
- export const $ZodSymbol: core.$constructor<$ZodSymbol> = /*@__PURE__*/ core.$constructor("$ZodSymbol", (inst, def) => {
1277
- $ZodType.init(inst, def);
1278
-
1279
- inst._zod.parse = (payload, _ctx) => {
1280
- const input = payload.value;
1281
- if (typeof input === "symbol") return payload;
1282
- payload.issues.push({
1283
- expected: "symbol",
1284
- code: "invalid_type",
1285
-
1286
- input,
1287
- inst,
1288
- });
1289
- return payload;
1290
- };
1291
- });
1292
-
1293
- ////////////////////////////////////////////
1294
- ////////////////////////////////////////////
1295
- ////////// //////////
1296
- ////////// $ZodUndefined //////////
1297
- ////////// //////////
1298
- ////////////////////////////////////////////
1299
- ////////////////////////////////////////////
1300
- export interface $ZodUndefinedDef extends $ZodTypeDef {
1301
- type: "undefined";
1302
- }
1303
-
1304
- export interface $ZodUndefinedInternals extends $ZodTypeInternals<undefined, undefined> {
1305
- pattern: RegExp;
1306
- def: $ZodUndefinedDef;
1307
- values: util.PrimitiveSet;
1308
- isst: errors.$ZodIssueInvalidType;
1309
- }
1310
-
1311
- export interface $ZodUndefined extends $ZodType {
1312
- _zod: $ZodUndefinedInternals;
1313
- }
1314
-
1315
- export const $ZodUndefined: core.$constructor<$ZodUndefined> = /*@__PURE__*/ core.$constructor(
1316
- "$ZodUndefined",
1317
- (inst, def) => {
1318
- $ZodType.init(inst, def);
1319
- inst._zod.pattern = regexes.undefined;
1320
- inst._zod.values = new Set([undefined]);
1321
- inst._zod.optin = "optional";
1322
- inst._zod.optout = "optional";
1323
-
1324
- inst._zod.parse = (payload, _ctx) => {
1325
- const input = payload.value;
1326
- if (typeof input === "undefined") return payload;
1327
- payload.issues.push({
1328
- expected: "undefined",
1329
- code: "invalid_type",
1330
-
1331
- input,
1332
- inst,
1333
- });
1334
- return payload;
1335
- };
1336
- }
1337
- );
1338
-
1339
- ///////////////////////////////////////
1340
- ///////////////////////////////////////
1341
- ////////// //////////
1342
- ////////// $ZodNull /////////
1343
- ////////// //////////
1344
- ///////////////////////////////////////
1345
- ///////////////////////////////////////
1346
-
1347
- export interface $ZodNullDef extends $ZodTypeDef {
1348
- type: "null";
1349
- }
1350
-
1351
- export interface $ZodNullInternals extends $ZodTypeInternals<null, null> {
1352
- pattern: RegExp;
1353
- def: $ZodNullDef;
1354
- values: util.PrimitiveSet;
1355
- isst: errors.$ZodIssueInvalidType;
1356
- }
1357
-
1358
- export interface $ZodNull extends $ZodType {
1359
- _zod: $ZodNullInternals;
1360
- }
1361
-
1362
- export const $ZodNull: core.$constructor<$ZodNull> = /*@__PURE__*/ core.$constructor("$ZodNull", (inst, def) => {
1363
- $ZodType.init(inst, def);
1364
- inst._zod.pattern = regexes.null;
1365
- inst._zod.values = new Set([null]);
1366
-
1367
- inst._zod.parse = (payload, _ctx) => {
1368
- const input = payload.value;
1369
- if (input === null) return payload;
1370
- payload.issues.push({
1371
- expected: "null",
1372
- code: "invalid_type",
1373
-
1374
- input,
1375
- inst,
1376
- });
1377
- return payload;
1378
- };
1379
- });
1380
-
1381
- //////////////////////////////////////
1382
- //////////////////////////////////////
1383
- ////////// //////////
1384
- ////////// $ZodAny //////////
1385
- ////////// //////////
1386
- //////////////////////////////////////
1387
- //////////////////////////////////////
1388
-
1389
- export interface $ZodAnyDef extends $ZodTypeDef {
1390
- type: "any";
1391
- }
1392
-
1393
- export interface $ZodAnyInternals extends $ZodTypeInternals<any, any> {
1394
- def: $ZodAnyDef;
1395
- isst: never;
1396
- }
1397
-
1398
- export interface $ZodAny extends $ZodType {
1399
- _zod: $ZodAnyInternals;
1400
- }
1401
-
1402
- export const $ZodAny: core.$constructor<$ZodAny> = /*@__PURE__*/ core.$constructor("$ZodAny", (inst, def) => {
1403
- $ZodType.init(inst, def);
1404
-
1405
- inst._zod.parse = (payload) => payload;
1406
- });
1407
-
1408
- //////////////////////////////////////////
1409
- //////////////////////////////////////////
1410
- ////////// //////////
1411
- ////////// $ZodUnknown //////////
1412
- ////////// //////////
1413
- //////////////////////////////////////////
1414
- //////////////////////////////////////////
1415
-
1416
- export interface $ZodUnknownDef extends $ZodTypeDef {
1417
- type: "unknown";
1418
- }
1419
-
1420
- export interface $ZodUnknownInternals extends $ZodTypeInternals<unknown, unknown> {
1421
- def: $ZodUnknownDef;
1422
- isst: never;
1423
- }
1424
-
1425
- export interface $ZodUnknown extends $ZodType {
1426
- _zod: $ZodUnknownInternals;
1427
- }
1428
-
1429
- export const $ZodUnknown: core.$constructor<$ZodUnknown> = /*@__PURE__*/ core.$constructor(
1430
- "$ZodUnknown",
1431
- (inst, def) => {
1432
- $ZodType.init(inst, def);
1433
-
1434
- inst._zod.parse = (payload) => payload;
1435
- }
1436
- );
1437
-
1438
- /////////////////////////////////////////
1439
- /////////////////////////////////////////
1440
- ////////// //////////
1441
- ////////// $ZodNever //////////
1442
- ////////// //////////
1443
- /////////////////////////////////////////
1444
- /////////////////////////////////////////
1445
-
1446
- export interface $ZodNeverDef extends $ZodTypeDef {
1447
- type: "never";
1448
- }
1449
-
1450
- export interface $ZodNeverInternals extends $ZodTypeInternals<never, never> {
1451
- def: $ZodNeverDef;
1452
- isst: errors.$ZodIssueInvalidType;
1453
- }
1454
-
1455
- export interface $ZodNever extends $ZodType {
1456
- _zod: $ZodNeverInternals;
1457
- }
1458
-
1459
- export const $ZodNever: core.$constructor<$ZodNever> = /*@__PURE__*/ core.$constructor("$ZodNever", (inst, def) => {
1460
- $ZodType.init(inst, def);
1461
- inst._zod.parse = (payload, _ctx) => {
1462
- payload.issues.push({
1463
- expected: "never",
1464
- code: "invalid_type",
1465
-
1466
- input: payload.value,
1467
- inst,
1468
- });
1469
- return payload;
1470
- };
1471
- });
1472
-
1473
- ////////////////////////////////////////
1474
- ////////////////////////////////////////
1475
- ////////// //////////
1476
- ////////// $ZodVoid //////////
1477
- ////////// //////////
1478
- ////////////////////////////////////////
1479
- ////////////////////////////////////////
1480
-
1481
- export interface $ZodVoidDef extends $ZodTypeDef {
1482
- type: "void";
1483
- }
1484
-
1485
- export interface $ZodVoidInternals extends $ZodTypeInternals<void, void> {
1486
- def: $ZodVoidDef;
1487
- isst: errors.$ZodIssueInvalidType;
1488
- }
1489
-
1490
- export interface $ZodVoid extends $ZodType {
1491
- _zod: $ZodVoidInternals;
1492
- }
1493
-
1494
- export const $ZodVoid: core.$constructor<$ZodVoid> = /*@__PURE__*/ core.$constructor("$ZodVoid", (inst, def) => {
1495
- $ZodType.init(inst, def);
1496
-
1497
- inst._zod.parse = (payload, _ctx) => {
1498
- const input = payload.value;
1499
- if (typeof input === "undefined") return payload;
1500
- payload.issues.push({
1501
- expected: "void",
1502
- code: "invalid_type",
1503
-
1504
- input,
1505
- inst,
1506
- });
1507
- return payload;
1508
- };
1509
- });
1510
-
1511
- ///////////////////////////////////////
1512
- ///////////////////////////////////////
1513
- ////////// ////////
1514
- ////////// $ZodDate ////////
1515
- ////////// ////////
1516
- ///////////////////////////////////////
1517
- ///////////////////////////////////////
1518
- export interface $ZodDateDef extends $ZodTypeDef {
1519
- type: "date";
1520
- coerce?: boolean;
1521
- }
1522
-
1523
- export interface $ZodDateInternals<T = unknown> extends $ZodTypeInternals<Date, T> {
1524
- def: $ZodDateDef;
1525
- isst: errors.$ZodIssueInvalidType; // | errors.$ZodIssueInvalidDate;
1526
- bag: util.LoosePartial<{
1527
- minimum: Date;
1528
- maximum: Date;
1529
- format: string;
1530
- }>;
1531
- }
1532
-
1533
- export interface $ZodDate<T = unknown> extends $ZodType {
1534
- _zod: $ZodDateInternals<T>;
1535
- }
1536
-
1537
- export const $ZodDate: core.$constructor<$ZodDate> = /*@__PURE__*/ core.$constructor("$ZodDate", (inst, def) => {
1538
- $ZodType.init(inst, def);
1539
-
1540
- inst._zod.parse = (payload, _ctx) => {
1541
- if (def.coerce) {
1542
- try {
1543
- payload.value = new Date(payload.value as string | number | Date);
1544
- } catch (_err: any) {}
1545
- }
1546
- const input = payload.value;
1547
-
1548
- const isDate = input instanceof Date;
1549
- const isValidDate = isDate && !Number.isNaN(input.getTime());
1550
- if (isValidDate) return payload;
1551
- payload.issues.push({
1552
- expected: "date",
1553
- code: "invalid_type",
1554
-
1555
- input,
1556
- ...(isDate ? { received: "Invalid Date" } : {}),
1557
- inst,
1558
- });
1559
-
1560
- return payload;
1561
- };
1562
- });
1563
-
1564
- /////////////////////////////////////////
1565
- /////////////////////////////////////////
1566
- ////////// //////////
1567
- ////////// $ZodArray //////////
1568
- ////////// //////////
1569
- /////////////////////////////////////////
1570
- /////////////////////////////////////////
1571
-
1572
- export interface $ZodArrayDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
1573
- type: "array";
1574
- element: T;
1575
- }
1576
-
1577
- export interface $ZodArrayInternals<T extends SomeType = $ZodType> extends _$ZodTypeInternals {
1578
- //$ZodTypeInternals<core.output<T>[], core.input<T>[]> {
1579
- def: $ZodArrayDef<T>;
1580
- isst: errors.$ZodIssueInvalidType;
1581
- output: core.output<T>[];
1582
- input: core.input<T>[];
1583
- }
1584
-
1585
- export interface $ZodArray<T extends SomeType = $ZodType> extends $ZodType<any, any, $ZodArrayInternals<T>> {}
1586
-
1587
- function handleArrayResult(result: ParsePayload<any>, final: ParsePayload<any[]>, index: number) {
1588
- if (result.issues.length) {
1589
- final.issues.push(...util.prefixIssues(index, result.issues));
1590
- }
1591
- final.value[index] = result.value;
1592
- }
1593
-
1594
- export const $ZodArray: core.$constructor<$ZodArray> = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def) => {
1595
- $ZodType.init(inst, def);
1596
-
1597
- inst._zod.parse = (payload, ctx) => {
1598
- const input = payload.value;
1599
-
1600
- if (!Array.isArray(input)) {
1601
- payload.issues.push({
1602
- expected: "array",
1603
- code: "invalid_type",
1604
-
1605
- input,
1606
- inst,
1607
- });
1608
- return payload;
1609
- }
1610
-
1611
- payload.value = Array(input.length);
1612
- const proms: Promise<any>[] = [];
1613
- for (let i = 0; i < input.length; i++) {
1614
- const item = input[i];
1615
- const result = def.element._zod.run(
1616
- {
1617
- value: item,
1618
- issues: [],
1619
- },
1620
- ctx
1621
- );
1622
-
1623
- if (result instanceof Promise) {
1624
- proms.push(result.then((result) => handleArrayResult(result, payload, i)));
1625
- } else {
1626
- handleArrayResult(result, payload, i);
1627
- }
1628
- }
1629
-
1630
- if (proms.length) {
1631
- return Promise.all(proms).then(() => payload);
1632
- }
1633
-
1634
- return payload; //handleArrayResultsAsync(parseResults, final);
1635
- };
1636
- });
1637
-
1638
- //////////////////////////////////////////
1639
- //////////////////////////////////////////
1640
- ////////// //////////
1641
- ////////// $ZodObject //////////
1642
- ////////// //////////
1643
- //////////////////////////////////////////
1644
- //////////////////////////////////////////
1645
-
1646
- type OptionalOutSchema = { _zod: { optout: "optional" } };
1647
- type OptionalInSchema = { _zod: { optin: "optional" } };
1648
-
1649
- export type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T
1650
- ? util.IsAny<T[keyof T]> extends true
1651
- ? Record<string, unknown>
1652
- : Record<string, core.output<T[keyof T]>>
1653
- : keyof (T & Extra) extends never
1654
- ? Record<string, never>
1655
- : util.Prettify<
1656
- {
1657
- -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"];
1658
- } & {
1659
- -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"];
1660
- } & Extra
1661
- >;
1662
-
1663
- // experimental
1664
- // export type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = keyof (T &
1665
- // Extra) extends never
1666
- // ? Record<string, never>
1667
- // : string extends keyof T
1668
- // ? util.Prettify<
1669
- // {
1670
- // [k: string]: util.IsAny<T[string]["_zod"]["output"]> extends true ? unknown : T[string]["_zod"]["output"];
1671
- // } & $InferObjectOutputNoIndex<util.OmitIndexSignature<T>, Extra>
1672
- // >
1673
- // : util.Prettify<$InferObjectOutputNoIndex<T, Extra>>;
1674
-
1675
- // export type $InferObjectOutputNoIndex<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = {
1676
- // [k in keyof T as string extends k
1677
- // ? never
1678
- // : k extends string
1679
- // ? T[k] extends OptionalOutSchema
1680
- // ? never
1681
- // : k
1682
- // : never]: T[k]["_zod"]["output"];
1683
- // } & {
1684
- // [k in keyof T as string extends k
1685
- // ? never
1686
- // : k extends string
1687
- // ? T[k] extends OptionalOutSchema
1688
- // ? k
1689
- // : never
1690
- // : never]?: T[k]["_zod"]["output"];
1691
- // } & Extra;
1692
-
1693
- export type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T
1694
- ? util.IsAny<T[keyof T]> extends true
1695
- ? Record<string, unknown>
1696
- : Record<string, core.input<T[keyof T]>>
1697
- : keyof (T & Extra) extends never
1698
- ? Record<string, never>
1699
- : util.Prettify<
1700
- {
1701
- -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"];
1702
- } & {
1703
- -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"];
1704
- } & Extra
1705
- >;
1706
-
1707
- function handlePropertyResult(
1708
- result: ParsePayload,
1709
- final: ParsePayload,
1710
- key: PropertyKey,
1711
- input: any,
1712
- isOptionalOut: boolean
1713
- ) {
1714
- if (result.issues.length) {
1715
- // For optional-out schemas, ignore errors on absent keys
1716
- if (isOptionalOut && !(key in input)) {
1717
- return;
1718
- }
1719
- final.issues.push(...util.prefixIssues(key, result.issues));
1720
- }
1721
-
1722
- if (result.value === undefined) {
1723
- if (key in input) {
1724
- (final.value as any)[key] = undefined;
1725
- }
1726
- } else {
1727
- (final.value as any)[key] = result.value;
1728
- }
1729
- }
1730
-
1731
- export type $ZodObjectConfig = { out: Record<string, unknown>; in: Record<string, unknown> };
1732
-
1733
- export type $loose = {
1734
- out: Record<string, unknown>;
1735
- in: Record<string, unknown>;
1736
- };
1737
- export type $strict = {
1738
- out: {};
1739
- in: {};
1740
- };
1741
- export type $strip = {
1742
- out: {};
1743
- in: {};
1744
- };
1745
-
1746
- export type $catchall<T extends SomeType> = {
1747
- out: { [k: string]: core.output<T> };
1748
- in: { [k: string]: core.input<T> };
1749
- };
1750
-
1751
- export type $ZodShape = Readonly<{ [k: string]: $ZodType }>;
1752
-
1753
- export interface $ZodObjectDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef {
1754
- type: "object";
1755
- shape: Shape;
1756
- catchall?: $ZodType | undefined;
1757
- }
1758
-
1759
- export interface $ZodObjectInternals<
1760
- /** @ts-ignore Cast variance */
1761
- out Shape extends $ZodShape = $ZodShape,
1762
- out Config extends $ZodObjectConfig = $ZodObjectConfig,
1763
- > extends _$ZodTypeInternals {
1764
- def: $ZodObjectDef<Shape>;
1765
- config: Config;
1766
- isst: errors.$ZodIssueInvalidType | errors.$ZodIssueUnrecognizedKeys;
1767
- propValues: util.PropValues;
1768
- output: $InferObjectOutput<Shape, Config["out"]>;
1769
- input: $InferObjectInput<Shape, Config["in"]>;
1770
- optin?: "optional" | undefined;
1771
- optout?: "optional" | undefined;
1772
- }
1773
- export type $ZodLooseShape = Record<string, any>;
1774
-
1775
- export interface $ZodObject<
1776
- /** @ts-ignore Cast variance */
1777
- out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>,
1778
- out Params extends $ZodObjectConfig = $ZodObjectConfig,
1779
- > extends $ZodType<any, any, $ZodObjectInternals<Shape, Params>> {}
1780
-
1781
- function normalizeDef(def: $ZodObjectDef) {
1782
- const keys = Object.keys(def.shape);
1783
- for (const k of keys) {
1784
- if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
1785
- throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1786
- }
1787
- }
1788
- const okeys = util.optionalKeys(def.shape);
1789
-
1790
- return {
1791
- ...def,
1792
- keys,
1793
- keySet: new Set(keys),
1794
- numKeys: keys.length,
1795
- optionalKeys: new Set(okeys),
1796
- };
1797
- }
1798
-
1799
- function handleCatchall(
1800
- proms: Promise<any>[],
1801
- input: any,
1802
- payload: ParsePayload,
1803
- ctx: ParseContext,
1804
- def: ReturnType<typeof normalizeDef>,
1805
- inst: $ZodObject
1806
- ) {
1807
- const unrecognized: string[] = [];
1808
- // iterate over input keys
1809
- const keySet = def.keySet;
1810
- const _catchall = def.catchall!._zod;
1811
- const t = _catchall.def.type;
1812
- const isOptionalOut = _catchall.optout === "optional";
1813
- for (const key in input) {
1814
- if (keySet.has(key)) continue;
1815
- if (t === "never") {
1816
- unrecognized.push(key);
1817
- continue;
1818
- }
1819
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1820
-
1821
- if (r instanceof Promise) {
1822
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
1823
- } else {
1824
- handlePropertyResult(r, payload, key, input, isOptionalOut);
1825
- }
1826
- }
1827
-
1828
- if (unrecognized.length) {
1829
- payload.issues.push({
1830
- code: "unrecognized_keys",
1831
- keys: unrecognized,
1832
- input,
1833
- inst,
1834
- });
1835
- }
1836
-
1837
- if (!proms.length) return payload;
1838
- return Promise.all(proms).then(() => {
1839
- return payload;
1840
- });
1841
- }
1842
-
1843
- export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, def) => {
1844
- // requires cast because technically $ZodObject doesn't extend
1845
- $ZodType.init(inst, def);
1846
- // const sh = def.shape;
1847
- const desc = Object.getOwnPropertyDescriptor(def, "shape");
1848
- if (!desc?.get) {
1849
- const sh = def.shape;
1850
- Object.defineProperty(def, "shape", {
1851
- get: () => {
1852
- const newSh = { ...sh };
1853
- Object.defineProperty(def, "shape", {
1854
- value: newSh,
1855
- });
1856
-
1857
- return newSh;
1858
- },
1859
- });
1860
- }
1861
-
1862
- const _normalized = util.cached(() => normalizeDef(def));
1863
-
1864
- util.defineLazy(inst._zod, "propValues", () => {
1865
- const shape = def.shape;
1866
- const propValues: util.PropValues = {};
1867
- for (const key in shape) {
1868
- const field = shape[key]!._zod;
1869
- if (field.values) {
1870
- propValues[key] ??= new Set();
1871
- for (const v of field.values) propValues[key].add(v);
1872
- }
1873
- }
1874
- return propValues;
1875
- });
1876
-
1877
- const isObject = util.isObject;
1878
- const catchall = def.catchall;
1879
-
1880
- let value!: typeof _normalized.value;
1881
-
1882
- inst._zod.parse = (payload, ctx) => {
1883
- value ??= _normalized.value;
1884
- const input = payload.value;
1885
- if (!isObject(input)) {
1886
- payload.issues.push({
1887
- expected: "object",
1888
- code: "invalid_type",
1889
- input,
1890
- inst,
1891
- });
1892
- return payload;
1893
- }
1894
-
1895
- payload.value = {};
1896
-
1897
- const proms: Promise<any>[] = [];
1898
- const shape = value.shape;
1899
-
1900
- for (const key of value.keys) {
1901
- const el = shape[key]!;
1902
- const isOptionalOut = el._zod.optout === "optional";
1903
-
1904
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
1905
- if (r instanceof Promise) {
1906
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
1907
- } else {
1908
- handlePropertyResult(r, payload, key, input, isOptionalOut);
1909
- }
1910
- }
1911
-
1912
- if (!catchall) {
1913
- return proms.length ? Promise.all(proms).then(() => payload) : payload;
1914
- }
1915
-
1916
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
1917
- };
1918
- });
1919
-
1920
- export const $ZodObjectJIT: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$constructor(
1921
- "$ZodObjectJIT",
1922
- (inst, def) => {
1923
- // requires cast because technically $ZodObject doesn't extend
1924
- $ZodObject.init(inst, def);
1925
-
1926
- const superParse = inst._zod.parse;
1927
- const _normalized = util.cached(() => normalizeDef(def));
1928
-
1929
- const generateFastpass = (shape: any) => {
1930
- const doc = new Doc(["shape", "payload", "ctx"]);
1931
- const normalized = _normalized.value;
1932
-
1933
- const parseStr = (key: string) => {
1934
- const k = util.esc(key);
1935
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1936
- };
1937
-
1938
- doc.write(`const input = payload.value;`);
1939
-
1940
- const ids: any = Object.create(null);
1941
- let counter = 0;
1942
- for (const key of normalized.keys) {
1943
- ids[key] = `key_${counter++}`;
1944
- }
1945
-
1946
- // A: preserve key order {
1947
- doc.write(`const newResult = {};`);
1948
- for (const key of normalized.keys) {
1949
- const id = ids[key];
1950
- const k = util.esc(key);
1951
- const schema = shape[key];
1952
- const isOptionalOut = schema?._zod?.optout === "optional";
1953
-
1954
- doc.write(`const ${id} = ${parseStr(key)};`);
1955
-
1956
- if (isOptionalOut) {
1957
- // For optional-out schemas, ignore errors on absent keys
1958
- doc.write(`
1959
- if (${id}.issues.length) {
1960
- if (${k} in input) {
1961
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1962
- ...iss,
1963
- path: iss.path ? [${k}, ...iss.path] : [${k}]
1964
- })));
1965
- }
1966
- }
1967
-
1968
- if (${id}.value === undefined) {
1969
- if (${k} in input) {
1970
- newResult[${k}] = undefined;
1971
- }
1972
- } else {
1973
- newResult[${k}] = ${id}.value;
1974
- }
1975
-
1976
- `);
1977
- } else {
1978
- doc.write(`
1979
- if (${id}.issues.length) {
1980
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1981
- ...iss,
1982
- path: iss.path ? [${k}, ...iss.path] : [${k}]
1983
- })));
1984
- }
1985
-
1986
- if (${id}.value === undefined) {
1987
- if (${k} in input) {
1988
- newResult[${k}] = undefined;
1989
- }
1990
- } else {
1991
- newResult[${k}] = ${id}.value;
1992
- }
1993
-
1994
- `);
1995
- }
1996
- }
1997
-
1998
- doc.write(`payload.value = newResult;`);
1999
- doc.write(`return payload;`);
2000
- const fn = doc.compile();
2001
- return (payload: any, ctx: any) => fn(shape, payload, ctx);
2002
- };
2003
-
2004
- let fastpass!: ReturnType<typeof generateFastpass>;
2005
-
2006
- const isObject = util.isObject;
2007
- const jit = !core.globalConfig.jitless;
2008
- const allowsEval = util.allowsEval;
2009
-
2010
- const fastEnabled = jit && allowsEval.value; // && !def.catchall;
2011
- const catchall = def.catchall;
2012
-
2013
- let value!: typeof _normalized.value;
2014
-
2015
- inst._zod.parse = (payload, ctx) => {
2016
- value ??= _normalized.value;
2017
- const input = payload.value;
2018
- if (!isObject(input)) {
2019
- payload.issues.push({
2020
- expected: "object",
2021
- code: "invalid_type",
2022
- input,
2023
- inst,
2024
- });
2025
- return payload;
2026
- }
2027
-
2028
- if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
2029
- // always synchronous
2030
- if (!fastpass) fastpass = generateFastpass(def.shape);
2031
- payload = fastpass(payload, ctx);
2032
-
2033
- if (!catchall) return payload;
2034
- return handleCatchall([], input, payload, ctx, value, inst);
2035
- }
2036
-
2037
- return superParse(payload, ctx);
2038
- };
2039
- }
2040
- );
2041
-
2042
- /////////////////////////////////////////
2043
- /////////////////////////////////////////
2044
- ////////// ///////////
2045
- ////////// $ZodUnion //////////
2046
- ////////// ///////////
2047
- /////////////////////////////////////////
2048
- /////////////////////////////////////////
2049
- // use generic to distribute union types
2050
- export type $InferUnionOutput<T extends SomeType> = T extends any ? core.output<T> : never;
2051
- export type $InferUnionInput<T extends SomeType> = T extends any ? core.input<T> : never;
2052
- export interface $ZodUnionDef<Options extends readonly SomeType[] = readonly $ZodType[]> extends $ZodTypeDef {
2053
- type: "union";
2054
- options: Options;
2055
- inclusive?: boolean;
2056
- }
2057
-
2058
- type IsOptionalIn<T extends SomeType> = T extends OptionalInSchema ? true : false;
2059
- type IsOptionalOut<T extends SomeType> = T extends OptionalOutSchema ? true : false;
2060
-
2061
- export interface $ZodUnionInternals<T extends readonly SomeType[] = readonly $ZodType[]> extends _$ZodTypeInternals {
2062
- def: $ZodUnionDef<T>;
2063
- isst: errors.$ZodIssueInvalidUnion;
2064
- pattern: T[number]["_zod"]["pattern"];
2065
- values: T[number]["_zod"]["values"]; //GetValues<T[number]>;
2066
- output: $InferUnionOutput<T[number]>;
2067
- input: $InferUnionInput<T[number]>;
2068
- // if any element in the union is optional, then the union is optional
2069
- optin: IsOptionalIn<T[number]> extends false ? "optional" | undefined : "optional";
2070
- optout: IsOptionalOut<T[number]> extends false ? "optional" | undefined : "optional";
2071
- }
2072
-
2073
- export interface $ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]>
2074
- extends $ZodType<any, any, $ZodUnionInternals<T>> {
2075
- _zod: $ZodUnionInternals<T>;
2076
- }
2077
-
2078
- function handleUnionResults(results: ParsePayload[], final: ParsePayload, inst: $ZodUnion, ctx?: ParseContext) {
2079
- for (const result of results) {
2080
- if (result.issues.length === 0) {
2081
- final.value = result.value;
2082
- return final;
2083
- }
2084
- }
2085
-
2086
- const nonaborted = results.filter((r) => !util.aborted(r));
2087
- if (nonaborted.length === 1) {
2088
- final.value = nonaborted[0].value;
2089
- return nonaborted[0];
2090
- }
2091
-
2092
- final.issues.push({
2093
- code: "invalid_union",
2094
-
2095
- input: final.value,
2096
- inst,
2097
- errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
2098
- });
2099
-
2100
- return final;
2101
- }
2102
-
2103
- export const $ZodUnion: core.$constructor<$ZodUnion> = /*@__PURE__*/ core.$constructor("$ZodUnion", (inst, def) => {
2104
- $ZodType.init(inst, def);
2105
-
2106
- util.defineLazy(inst._zod, "optin", () =>
2107
- def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined
2108
- );
2109
-
2110
- util.defineLazy(inst._zod, "optout", () =>
2111
- def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined
2112
- );
2113
-
2114
- util.defineLazy(inst._zod, "values", () => {
2115
- if (def.options.every((o) => o._zod.values)) {
2116
- return new Set<util.Primitive>(def.options.flatMap((option) => Array.from(option._zod.values!)));
2117
- }
2118
- return undefined;
2119
- });
2120
-
2121
- util.defineLazy(inst._zod, "pattern", () => {
2122
- if (def.options.every((o) => o._zod.pattern)) {
2123
- const patterns = def.options.map((o) => o._zod.pattern);
2124
- return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p!.source)).join("|")})$`);
2125
- }
2126
- return undefined;
2127
- });
2128
-
2129
- const single = def.options.length === 1;
2130
- const first = def.options[0]._zod.run;
2131
-
2132
- inst._zod.parse = (payload, ctx) => {
2133
- if (single) {
2134
- return first(payload, ctx);
2135
- }
2136
- let async = false;
2137
-
2138
- const results: util.MaybeAsync<ParsePayload>[] = [];
2139
- for (const option of def.options) {
2140
- const result = option._zod.run(
2141
- {
2142
- value: payload.value,
2143
- issues: [],
2144
- },
2145
- ctx
2146
- );
2147
- if (result instanceof Promise) {
2148
- results.push(result);
2149
- async = true;
2150
- } else {
2151
- if (result.issues.length === 0) return result;
2152
- results.push(result);
2153
- }
2154
- }
2155
-
2156
- if (!async) return handleUnionResults(results as ParsePayload[], payload, inst, ctx);
2157
- return Promise.all(results).then((results) => {
2158
- return handleUnionResults(results as ParsePayload[], payload, inst, ctx);
2159
- });
2160
- };
2161
- });
2162
-
2163
- function handleExclusiveUnionResults(
2164
- results: ParsePayload[],
2165
- final: ParsePayload,
2166
- inst: $ZodUnion,
2167
- ctx?: ParseContext
2168
- ) {
2169
- const successes = results.filter((r) => r.issues.length === 0);
2170
-
2171
- if (successes.length === 1) {
2172
- final.value = successes[0].value;
2173
- return final;
2174
- }
2175
-
2176
- if (successes.length === 0) {
2177
- // No matches - same as regular union
2178
- final.issues.push({
2179
- code: "invalid_union",
2180
- input: final.value,
2181
- inst,
2182
- errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
2183
- });
2184
- } else {
2185
- // Multiple matches - exclusive union failure
2186
- final.issues.push({
2187
- code: "invalid_union",
2188
- input: final.value,
2189
- inst,
2190
- errors: [],
2191
- inclusive: false,
2192
- });
2193
- }
2194
-
2195
- return final;
2196
- }
2197
-
2198
- export interface $ZodXorInternals<T extends readonly SomeType[] = readonly $ZodType[]> extends $ZodUnionInternals<T> {}
2199
-
2200
- export interface $ZodXor<T extends readonly SomeType[] = readonly $ZodType[]>
2201
- extends $ZodType<any, any, $ZodXorInternals<T>> {
2202
- _zod: $ZodXorInternals<T>;
2203
- }
2204
-
2205
- export const $ZodXor: core.$constructor<$ZodXor> = /*@__PURE__*/ core.$constructor("$ZodXor", (inst, def) => {
2206
- $ZodUnion.init(inst, def);
2207
- def.inclusive = false;
2208
-
2209
- const single = def.options.length === 1;
2210
- const first = def.options[0]._zod.run;
2211
-
2212
- inst._zod.parse = (payload, ctx) => {
2213
- if (single) {
2214
- return first(payload, ctx);
2215
- }
2216
- let async = false;
2217
-
2218
- const results: util.MaybeAsync<ParsePayload>[] = [];
2219
- for (const option of def.options) {
2220
- const result = option._zod.run(
2221
- {
2222
- value: payload.value,
2223
- issues: [],
2224
- },
2225
- ctx
2226
- );
2227
- if (result instanceof Promise) {
2228
- results.push(result);
2229
- async = true;
2230
- } else {
2231
- results.push(result);
2232
- }
2233
- }
2234
-
2235
- if (!async) return handleExclusiveUnionResults(results as ParsePayload[], payload, inst, ctx);
2236
- return Promise.all(results).then((results) => {
2237
- return handleExclusiveUnionResults(results as ParsePayload[], payload, inst, ctx);
2238
- });
2239
- };
2240
- });
2241
-
2242
- //////////////////////////////////////////////////////
2243
- //////////////////////////////////////////////////////
2244
- ////////// //////////
2245
- ////////// $ZodDiscriminatedUnion //////////
2246
- ////////// //////////
2247
- //////////////////////////////////////////////////////
2248
- //////////////////////////////////////////////////////
2249
-
2250
- export interface $ZodDiscriminatedUnionDef<
2251
- Options extends readonly SomeType[] = readonly $ZodType[],
2252
- Disc extends string = string,
2253
- > extends $ZodUnionDef<Options> {
2254
- discriminator: Disc;
2255
- unionFallback?: boolean;
2256
- }
2257
-
2258
- export interface $ZodDiscriminatedUnionInternals<
2259
- Options extends readonly SomeType[] = readonly $ZodType[],
2260
- Disc extends string = string,
2261
- > extends $ZodUnionInternals<Options> {
2262
- def: $ZodDiscriminatedUnionDef<Options, Disc>;
2263
- propValues: util.PropValues;
2264
- }
2265
-
2266
- export interface $ZodDiscriminatedUnion<
2267
- Options extends readonly SomeType[] = readonly $ZodType[],
2268
- Disc extends string = string,
2269
- > extends $ZodType {
2270
- _zod: $ZodDiscriminatedUnionInternals<Options, Disc>;
2271
- }
2272
-
2273
- export const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion> =
2274
- /*@__PURE__*/
2275
- core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
2276
- def.inclusive = false;
2277
-
2278
- $ZodUnion.init(inst, def);
2279
-
2280
- const _super = inst._zod.parse;
2281
- util.defineLazy(inst._zod, "propValues", () => {
2282
- const propValues: util.PropValues = {};
2283
- for (const option of def.options) {
2284
- const pv = option._zod.propValues;
2285
- if (!pv || Object.keys(pv).length === 0)
2286
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
2287
- for (const [k, v] of Object.entries(pv!)) {
2288
- if (!propValues[k]) propValues[k] = new Set();
2289
- for (const val of v) {
2290
- propValues[k].add(val);
2291
- }
2292
- }
2293
- }
2294
- return propValues;
2295
- });
2296
-
2297
- const disc = util.cached(() => {
2298
- const opts = def.options as $ZodTypeDiscriminable[];
2299
- const map: Map<util.Primitive, $ZodType> = new Map();
2300
- for (const o of opts) {
2301
- const values = o._zod.propValues?.[def.discriminator];
2302
- if (!values || values.size === 0)
2303
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
2304
- for (const v of values) {
2305
- if (map.has(v)) {
2306
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
2307
- }
2308
- map.set(v, o);
2309
- }
2310
- }
2311
- return map;
2312
- });
2313
-
2314
- inst._zod.parse = (payload, ctx) => {
2315
- const input = payload.value;
2316
- if (!util.isObject(input)) {
2317
- payload.issues.push({
2318
- code: "invalid_type",
2319
-
2320
- expected: "object",
2321
- input,
2322
- inst,
2323
- });
2324
- return payload;
2325
- }
2326
-
2327
- const opt = disc.value.get(input?.[def.discriminator] as any);
2328
- if (opt) {
2329
- return opt._zod.run(payload, ctx) as any;
2330
- }
2331
-
2332
- if (def.unionFallback) {
2333
- return _super(payload, ctx);
2334
- }
2335
-
2336
- // no matching discriminator
2337
- payload.issues.push({
2338
- code: "invalid_union",
2339
-
2340
- errors: [],
2341
- note: "No matching discriminator",
2342
- discriminator: def.discriminator,
2343
- input,
2344
- path: [def.discriminator],
2345
- inst,
2346
- });
2347
-
2348
- return payload;
2349
- };
2350
- });
2351
-
2352
- ////////////////////////////////////////////////
2353
- ////////////////////////////////////////////////
2354
- ////////// //////////
2355
- ////////// $ZodIntersection //////////
2356
- ////////// //////////
2357
- ////////////////////////////////////////////////
2358
- ////////////////////////////////////////////////
2359
-
2360
- export interface $ZodIntersectionDef<Left extends SomeType = $ZodType, Right extends SomeType = $ZodType>
2361
- extends $ZodTypeDef {
2362
- type: "intersection";
2363
- left: Left;
2364
- right: Right;
2365
- }
2366
-
2367
- export interface $ZodIntersectionInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType>
2368
- extends _$ZodTypeInternals {
2369
- // $ZodTypeInternals<core.output<A> & core.output<B>, core.input<A> & core.input<B>>
2370
- def: $ZodIntersectionDef<A, B>;
2371
- isst: never;
2372
- optin: A["_zod"]["optin"] | B["_zod"]["optin"];
2373
- optout: A["_zod"]["optout"] | B["_zod"]["optout"];
2374
- output: core.output<A> & core.output<B>;
2375
- input: core.input<A> & core.input<B>;
2376
- }
2377
-
2378
- export interface $ZodIntersection<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
2379
- _zod: $ZodIntersectionInternals<A, B>;
2380
- }
2381
-
2382
- export const $ZodIntersection: core.$constructor<$ZodIntersection> = /*@__PURE__*/ core.$constructor(
2383
- "$ZodIntersection",
2384
- (inst, def) => {
2385
- $ZodType.init(inst, def);
2386
-
2387
- inst._zod.parse = (payload, ctx) => {
2388
- const input = payload.value;
2389
- const left = def.left._zod.run({ value: input, issues: [] }, ctx);
2390
- const right = def.right._zod.run({ value: input, issues: [] }, ctx);
2391
- const async = left instanceof Promise || right instanceof Promise;
2392
-
2393
- if (async) {
2394
- return Promise.all([left, right]).then(([left, right]) => {
2395
- return handleIntersectionResults(payload, left, right);
2396
- });
2397
- }
2398
-
2399
- return handleIntersectionResults(payload, left, right);
2400
- };
2401
- }
2402
- );
2403
-
2404
- function mergeValues(
2405
- a: any,
2406
- b: any
2407
- ): { valid: true; data: any } | { valid: false; mergeErrorPath: (string | number)[] } {
2408
- // const aType = parse.t(a);
2409
- // const bType = parse.t(b);
2410
-
2411
- if (a === b) {
2412
- return { valid: true, data: a };
2413
- }
2414
- if (a instanceof Date && b instanceof Date && +a === +b) {
2415
- return { valid: true, data: a };
2416
- }
2417
- if (util.isPlainObject(a) && util.isPlainObject(b)) {
2418
- const bKeys = Object.keys(b);
2419
- const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
2420
-
2421
- const newObj: any = { ...a, ...b };
2422
- for (const key of sharedKeys) {
2423
- const sharedValue = mergeValues(a[key], b[key]);
2424
- if (!sharedValue.valid) {
2425
- return {
2426
- valid: false,
2427
- mergeErrorPath: [key, ...sharedValue.mergeErrorPath],
2428
- };
2429
- }
2430
- newObj[key] = sharedValue.data;
2431
- }
2432
-
2433
- return { valid: true, data: newObj };
2434
- }
2435
- if (Array.isArray(a) && Array.isArray(b)) {
2436
- if (a.length !== b.length) {
2437
- return { valid: false, mergeErrorPath: [] };
2438
- }
2439
-
2440
- const newArray: unknown[] = [];
2441
- for (let index = 0; index < a.length; index++) {
2442
- const itemA = a[index];
2443
- const itemB = b[index];
2444
- const sharedValue = mergeValues(itemA, itemB);
2445
-
2446
- if (!sharedValue.valid) {
2447
- return {
2448
- valid: false,
2449
- mergeErrorPath: [index, ...sharedValue.mergeErrorPath],
2450
- };
2451
- }
2452
-
2453
- newArray.push(sharedValue.data);
2454
- }
2455
-
2456
- return { valid: true, data: newArray };
2457
- }
2458
-
2459
- return { valid: false, mergeErrorPath: [] };
2460
- }
2461
-
2462
- function handleIntersectionResults(result: ParsePayload, left: ParsePayload, right: ParsePayload): ParsePayload {
2463
- // Track which side(s) report each key as unrecognized
2464
- const unrecKeys = new Map<string, { l?: true; r?: true }>();
2465
- let unrecIssue: errors.$ZodRawIssue | undefined;
2466
-
2467
- for (const iss of left.issues) {
2468
- if (iss.code === "unrecognized_keys") {
2469
- unrecIssue ??= iss;
2470
- for (const k of iss.keys) {
2471
- if (!unrecKeys.has(k)) unrecKeys.set(k, {});
2472
- unrecKeys.get(k)!.l = true;
2473
- }
2474
- } else {
2475
- result.issues.push(iss);
2476
- }
2477
- }
2478
-
2479
- for (const iss of right.issues) {
2480
- if (iss.code === "unrecognized_keys") {
2481
- for (const k of iss.keys) {
2482
- if (!unrecKeys.has(k)) unrecKeys.set(k, {});
2483
- unrecKeys.get(k)!.r = true;
2484
- }
2485
- } else {
2486
- result.issues.push(iss);
2487
- }
2488
- }
2489
-
2490
- // Report only keys unrecognized by BOTH sides
2491
- const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
2492
- if (bothKeys.length && unrecIssue) {
2493
- result.issues.push({ ...unrecIssue, keys: bothKeys });
2494
- }
2495
-
2496
- if (util.aborted(result)) return result;
2497
-
2498
- const merged = mergeValues(left.value, right.value);
2499
-
2500
- if (!merged.valid) {
2501
- throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
2502
- }
2503
-
2504
- result.value = merged.data;
2505
- return result;
2506
- }
2507
-
2508
- /////////////////////////////////////////
2509
- /////////////////////////////////////////
2510
- ////////// //////////
2511
- ////////// $ZodTuple //////////
2512
- ////////// //////////
2513
- /////////////////////////////////////////
2514
- /////////////////////////////////////////
2515
-
2516
- export interface $ZodTupleDef<
2517
- T extends util.TupleItems = readonly $ZodType[],
2518
- Rest extends SomeType | null = $ZodType | null,
2519
- > extends $ZodTypeDef {
2520
- type: "tuple";
2521
- items: T;
2522
- rest: Rest;
2523
- }
2524
-
2525
- export type $InferTupleInputType<T extends util.TupleItems, Rest extends SomeType | null> = [
2526
- ...TupleInputTypeWithOptionals<T>,
2527
- ...(Rest extends SomeType ? core.input<Rest>[] : []),
2528
- ];
2529
- type TupleInputTypeNoOptionals<T extends util.TupleItems> = {
2530
- [k in keyof T]: core.input<T[k]>;
2531
- };
2532
- type TupleInputTypeWithOptionals<T extends util.TupleItems> = T extends readonly [
2533
- ...infer Prefix extends SomeType[],
2534
- infer Tail extends SomeType,
2535
- ]
2536
- ? Tail["_zod"]["optin"] extends "optional"
2537
- ? [...TupleInputTypeWithOptionals<Prefix>, core.input<Tail>?]
2538
- : TupleInputTypeNoOptionals<T>
2539
- : [];
2540
-
2541
- export type $InferTupleOutputType<T extends util.TupleItems, Rest extends SomeType | null> = [
2542
- ...TupleOutputTypeWithOptionals<T>,
2543
- ...(Rest extends SomeType ? core.output<Rest>[] : []),
2544
- ];
2545
- type TupleOutputTypeNoOptionals<T extends util.TupleItems> = {
2546
- [k in keyof T]: core.output<T[k]>;
2547
- };
2548
- type TupleOutputTypeWithOptionals<T extends util.TupleItems> = T extends readonly [
2549
- ...infer Prefix extends SomeType[],
2550
- infer Tail extends SomeType,
2551
- ]
2552
- ? Tail["_zod"]["optout"] extends "optional"
2553
- ? [...TupleOutputTypeWithOptionals<Prefix>, core.output<Tail>?]
2554
- : TupleOutputTypeNoOptionals<T>
2555
- : [];
2556
-
2557
- export interface $ZodTupleInternals<
2558
- T extends util.TupleItems = readonly $ZodType[],
2559
- Rest extends SomeType | null = $ZodType | null,
2560
- > extends _$ZodTypeInternals {
2561
- def: $ZodTupleDef<T, Rest>;
2562
- isst: errors.$ZodIssueInvalidType | errors.$ZodIssueTooBig<unknown[]> | errors.$ZodIssueTooSmall<unknown[]>;
2563
- // $ZodTypeInternals<$InferTupleOutputType<T, Rest>, $InferTupleInputType<T, Rest>>
2564
- output: $InferTupleOutputType<T, Rest>;
2565
- input: $InferTupleInputType<T, Rest>;
2566
- }
2567
-
2568
- export interface $ZodTuple<
2569
- T extends util.TupleItems = readonly $ZodType[],
2570
- Rest extends SomeType | null = $ZodType | null,
2571
- > extends $ZodType {
2572
- _zod: $ZodTupleInternals<T, Rest>;
2573
- }
2574
-
2575
- export const $ZodTuple: core.$constructor<$ZodTuple> = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def) => {
2576
- $ZodType.init(inst, def);
2577
- const items = def.items;
2578
-
2579
- inst._zod.parse = (payload, ctx) => {
2580
- const input = payload.value;
2581
- if (!Array.isArray(input)) {
2582
- payload.issues.push({
2583
- input,
2584
- inst,
2585
- expected: "tuple",
2586
- code: "invalid_type",
2587
- });
2588
- return payload;
2589
- }
2590
-
2591
- payload.value = [];
2592
- const proms: Promise<any>[] = [];
2593
-
2594
- const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
2595
- const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
2596
-
2597
- if (!def.rest) {
2598
- const tooBig = input.length > items.length;
2599
- const tooSmall = input.length < optStart - 1;
2600
- if (tooBig || tooSmall) {
2601
- payload.issues.push({
2602
- ...(tooBig
2603
- ? { code: "too_big", maximum: items.length, inclusive: true }
2604
- : { code: "too_small", minimum: items.length }),
2605
-
2606
- input,
2607
- inst,
2608
- origin: "array" as const,
2609
- });
2610
- return payload;
2611
- }
2612
- }
2613
-
2614
- let i = -1;
2615
- for (const item of items) {
2616
- i++;
2617
- if (i >= input.length) if (i >= optStart) continue;
2618
- const result = item._zod.run(
2619
- {
2620
- value: input[i],
2621
- issues: [],
2622
- },
2623
- ctx
2624
- );
2625
-
2626
- if (result instanceof Promise) {
2627
- proms.push(result.then((result) => handleTupleResult(result, payload, i)));
2628
- } else {
2629
- handleTupleResult(result, payload, i);
2630
- }
2631
- }
2632
-
2633
- if (def.rest) {
2634
- const rest = input.slice(items.length);
2635
- for (const el of rest) {
2636
- i++;
2637
- const result = def.rest._zod.run(
2638
- {
2639
- value: el,
2640
- issues: [],
2641
- },
2642
- ctx
2643
- );
2644
-
2645
- if (result instanceof Promise) {
2646
- proms.push(result.then((result) => handleTupleResult(result, payload, i)));
2647
- } else {
2648
- handleTupleResult(result, payload, i);
2649
- }
2650
- }
2651
- }
2652
-
2653
- if (proms.length) return Promise.all(proms).then(() => payload);
2654
- return payload;
2655
- };
2656
- });
2657
-
2658
- function handleTupleResult(result: ParsePayload, final: ParsePayload<any[]>, index: number) {
2659
- if (result.issues.length) {
2660
- final.issues.push(...util.prefixIssues(index, result.issues));
2661
- }
2662
- final.value[index] = result.value;
2663
- }
2664
-
2665
- //////////////////////////////////////////
2666
- //////////////////////////////////////////
2667
- ////////// //////////
2668
- ////////// $ZodRecord //////////
2669
- ////////// //////////
2670
- //////////////////////////////////////////
2671
- //////////////////////////////////////////
2672
-
2673
- export type $ZodRecordKey = $ZodType<string | number | symbol, unknown>; // $HasValues | $HasPattern;
2674
- export interface $ZodRecordDef<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType>
2675
- extends $ZodTypeDef {
2676
- type: "record";
2677
- keyType: Key;
2678
- valueType: Value;
2679
- /** @default "strict" - errors on keys not matching keyType. "loose" passes through non-matching keys unchanged. */
2680
- mode?: "strict" | "loose";
2681
- }
2682
-
2683
- // export type $InferZodRecordOutput<
2684
- // Key extends $ZodRecordKey = $ZodRecordKey,
2685
- // Value extends SomeType = $ZodType,
2686
- // > = undefined extends Key["_zod"]["values"]
2687
- // ? string extends core.output<Key>
2688
- // ? Record<core.output<Key>, core.output<Value>>
2689
- // : number extends core.output<Key>
2690
- // ? Record<core.output<Key>, core.output<Value>>
2691
- // : symbol extends core.output<Key>
2692
- // ? Record<core.output<Key>, core.output<Value>>
2693
- // : Record<core.output<Key>, core.output<Value>>
2694
- // : Record<core.output<Key>, core.output<Value>>;
2695
- export type $InferZodRecordOutput<
2696
- Key extends $ZodRecordKey = $ZodRecordKey,
2697
- Value extends SomeType = $ZodType,
2698
- > = Key extends $partial
2699
- ? Partial<Record<core.output<Key>, core.output<Value>>>
2700
- : Record<core.output<Key>, core.output<Value>>;
2701
-
2702
- // export type $InferZodRecordInput<
2703
- // Key extends $ZodRecordKey = $ZodRecordKey,
2704
- // Value extends SomeType = $ZodType,
2705
- // > = undefined extends Key["_zod"]["values"]
2706
- // ? string extends core.input<Key>
2707
- // ? Record<core.input<Key>, core.input<Value>>
2708
- // : number extends core.input<Key>
2709
- // ? Record<core.input<Key>, core.input<Value>>
2710
- // : symbol extends core.input<Key>
2711
- // ? Record<core.input<Key>, core.input<Value>>
2712
- // : Record<core.input<Key>, core.input<Value>>
2713
- // : Record<core.input<Key>, core.input<Value>>;
2714
-
2715
- export type $InferZodRecordInput<
2716
- Key extends $ZodRecordKey = $ZodRecordKey,
2717
- Value extends SomeType = $ZodType,
2718
- > = Key extends $partial
2719
- ? Partial<Record<core.input<Key> & PropertyKey, core.input<Value>>>
2720
- : Record<core.input<Key> & PropertyKey, core.input<Value>>;
2721
-
2722
- export interface $ZodRecordInternals<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType>
2723
- extends $ZodTypeInternals<$InferZodRecordOutput<Key, Value>, $InferZodRecordInput<Key, Value>> {
2724
- def: $ZodRecordDef<Key, Value>;
2725
- isst: errors.$ZodIssueInvalidType | errors.$ZodIssueInvalidKey<Record<PropertyKey, unknown>>;
2726
- optin?: "optional" | undefined;
2727
- optout?: "optional" | undefined;
2728
- }
2729
-
2730
- export type $partial = { "~~partial": true };
2731
- export interface $ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType>
2732
- extends $ZodType {
2733
- _zod: $ZodRecordInternals<Key, Value>;
2734
- }
2735
-
2736
- export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, def) => {
2737
- $ZodType.init(inst, def);
2738
-
2739
- inst._zod.parse = (payload, ctx) => {
2740
- const input = payload.value;
2741
-
2742
- if (!util.isPlainObject(input)) {
2743
- payload.issues.push({
2744
- expected: "record",
2745
- code: "invalid_type",
2746
-
2747
- input,
2748
- inst,
2749
- });
2750
- return payload;
2751
- }
2752
-
2753
- const proms: Promise<any>[] = [];
2754
-
2755
- const values = def.keyType._zod.values;
2756
- if (values) {
2757
- payload.value = {};
2758
- const recordKeys = new Set<string | symbol>();
2759
- for (const key of values) {
2760
- if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
2761
- recordKeys.add(typeof key === "number" ? key.toString() : key);
2762
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
2763
-
2764
- if (result instanceof Promise) {
2765
- proms.push(
2766
- result.then((result) => {
2767
- if (result.issues.length) {
2768
- payload.issues.push(...util.prefixIssues(key, result.issues));
2769
- }
2770
- payload.value[key] = result.value;
2771
- })
2772
- );
2773
- } else {
2774
- if (result.issues.length) {
2775
- payload.issues.push(...util.prefixIssues(key, result.issues));
2776
- }
2777
- payload.value[key] = result.value;
2778
- }
2779
- }
2780
- }
2781
-
2782
- let unrecognized!: string[];
2783
- for (const key in input) {
2784
- if (!recordKeys.has(key)) {
2785
- unrecognized = unrecognized ?? [];
2786
- unrecognized.push(key);
2787
- }
2788
- }
2789
- if (unrecognized && unrecognized.length > 0) {
2790
- payload.issues.push({
2791
- code: "unrecognized_keys",
2792
-
2793
- input,
2794
- inst,
2795
- keys: unrecognized,
2796
- });
2797
- }
2798
- } else {
2799
- payload.value = {};
2800
- for (const key of Reflect.ownKeys(input)) {
2801
- if (key === "__proto__") continue;
2802
- let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
2803
- if (keyResult instanceof Promise) {
2804
- throw new Error("Async schemas not supported in object keys currently");
2805
- }
2806
-
2807
- // Numeric string fallback: if key is a numeric string and failed, retry with Number(key)
2808
- // This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
2809
- const checkNumericKey = typeof key === "string" && regexes.number.test(key) && keyResult.issues.length;
2810
- if (checkNumericKey) {
2811
- const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
2812
- if (retryResult instanceof Promise) {
2813
- throw new Error("Async schemas not supported in object keys currently");
2814
- }
2815
- if (retryResult.issues.length === 0) {
2816
- keyResult = retryResult;
2817
- }
2818
- }
2819
-
2820
- if (keyResult.issues.length) {
2821
- if (def.mode === "loose") {
2822
- // Pass through unchanged
2823
- payload.value[key] = input[key];
2824
- } else {
2825
- // Default "strict" behavior: error on invalid key
2826
- payload.issues.push({
2827
- code: "invalid_key",
2828
- origin: "record",
2829
- issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
2830
- input: key,
2831
- path: [key],
2832
- inst,
2833
- });
2834
- }
2835
- continue;
2836
- }
2837
-
2838
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
2839
-
2840
- if (result instanceof Promise) {
2841
- proms.push(
2842
- result.then((result) => {
2843
- if (result.issues.length) {
2844
- payload.issues.push(...util.prefixIssues(key, result.issues));
2845
- }
2846
- payload.value[keyResult.value as PropertyKey] = result.value;
2847
- })
2848
- );
2849
- } else {
2850
- if (result.issues.length) {
2851
- payload.issues.push(...util.prefixIssues(key, result.issues));
2852
- }
2853
- payload.value[keyResult.value as PropertyKey] = result.value;
2854
- }
2855
- }
2856
- }
2857
-
2858
- if (proms.length) {
2859
- return Promise.all(proms).then(() => payload);
2860
- }
2861
- return payload;
2862
- };
2863
- });
2864
-
2865
- ///////////////////////////////////////
2866
- ///////////////////////////////////////
2867
- ////////// //////////
2868
- ////////// $ZodMap //////////
2869
- ////////// //////////
2870
- ///////////////////////////////////////
2871
- ///////////////////////////////////////
2872
- export interface $ZodMapDef<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodTypeDef {
2873
- type: "map";
2874
- keyType: Key;
2875
- valueType: Value;
2876
- }
2877
-
2878
- export interface $ZodMapInternals<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType>
2879
- extends $ZodTypeInternals<Map<core.output<Key>, core.output<Value>>, Map<core.input<Key>, core.input<Value>>> {
2880
- def: $ZodMapDef<Key, Value>;
2881
- isst: errors.$ZodIssueInvalidType | errors.$ZodIssueInvalidKey | errors.$ZodIssueInvalidElement<unknown>;
2882
- optin?: "optional" | undefined;
2883
- optout?: "optional" | undefined;
2884
- }
2885
-
2886
- export interface $ZodMap<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodType {
2887
- _zod: $ZodMapInternals<Key, Value>;
2888
- }
2889
-
2890
- export const $ZodMap: core.$constructor<$ZodMap> = /*@__PURE__*/ core.$constructor("$ZodMap", (inst, def) => {
2891
- $ZodType.init(inst, def);
2892
-
2893
- inst._zod.parse = (payload, ctx) => {
2894
- const input = payload.value;
2895
- if (!(input instanceof Map)) {
2896
- payload.issues.push({
2897
- expected: "map",
2898
- code: "invalid_type",
2899
-
2900
- input,
2901
- inst,
2902
- });
2903
- return payload;
2904
- }
2905
-
2906
- const proms: Promise<any>[] = [];
2907
- payload.value = new Map();
2908
-
2909
- for (const [key, value] of input) {
2910
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
2911
- const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
2912
-
2913
- if (keyResult instanceof Promise || valueResult instanceof Promise) {
2914
- proms.push(
2915
- Promise.all([keyResult, valueResult]).then(([keyResult, valueResult]) => {
2916
- handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
2917
- })
2918
- );
2919
- } else {
2920
- handleMapResult(keyResult as ParsePayload, valueResult as ParsePayload, payload, key, input, inst, ctx);
2921
- }
2922
- }
2923
-
2924
- if (proms.length) return Promise.all(proms).then(() => payload);
2925
- return payload;
2926
- };
2927
- });
2928
-
2929
- function handleMapResult(
2930
- keyResult: ParsePayload,
2931
- valueResult: ParsePayload,
2932
- final: ParsePayload<Map<unknown, unknown>>,
2933
- key: unknown,
2934
- input: Map<any, any>,
2935
- inst: $ZodMap,
2936
- ctx?: ParseContext | undefined
2937
- ): void {
2938
- if (keyResult.issues.length) {
2939
- if (util.propertyKeyTypes.has(typeof key)) {
2940
- final.issues.push(...util.prefixIssues(key as PropertyKey, keyResult.issues));
2941
- } else {
2942
- final.issues.push({
2943
- code: "invalid_key",
2944
-
2945
- origin: "map",
2946
- input,
2947
- inst,
2948
- issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
2949
- });
2950
- }
2951
- }
2952
- if (valueResult.issues.length) {
2953
- if (util.propertyKeyTypes.has(typeof key)) {
2954
- final.issues.push(...util.prefixIssues(key as PropertyKey, valueResult.issues));
2955
- } else {
2956
- final.issues.push({
2957
- origin: "map",
2958
- code: "invalid_element",
2959
-
2960
- input,
2961
- inst,
2962
- key: key,
2963
- issues: valueResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
2964
- });
2965
- }
2966
- }
2967
- final.value.set(keyResult.value, valueResult.value);
2968
- }
2969
-
2970
- ///////////////////////////////////////
2971
- ///////////////////////////////////////
2972
- ////////// //////////
2973
- ////////// $ZodSet //////////
2974
- ////////// //////////
2975
- ///////////////////////////////////////
2976
- ///////////////////////////////////////
2977
- export interface $ZodSetDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
2978
- type: "set";
2979
- valueType: T;
2980
- }
2981
-
2982
- export interface $ZodSetInternals<T extends SomeType = $ZodType>
2983
- extends $ZodTypeInternals<Set<core.output<T>>, Set<core.input<T>>> {
2984
- def: $ZodSetDef<T>;
2985
- isst: errors.$ZodIssueInvalidType;
2986
- optin?: "optional" | undefined;
2987
- optout?: "optional" | undefined;
2988
- }
2989
-
2990
- export interface $ZodSet<T extends SomeType = $ZodType> extends $ZodType {
2991
- _zod: $ZodSetInternals<T>;
2992
- }
2993
-
2994
- export const $ZodSet: core.$constructor<$ZodSet> = /*@__PURE__*/ core.$constructor("$ZodSet", (inst, def) => {
2995
- $ZodType.init(inst, def);
2996
-
2997
- inst._zod.parse = (payload, ctx) => {
2998
- const input = payload.value;
2999
- if (!(input instanceof Set)) {
3000
- payload.issues.push({
3001
- input,
3002
- inst,
3003
- expected: "set",
3004
- code: "invalid_type",
3005
- });
3006
- return payload;
3007
- }
3008
-
3009
- const proms: Promise<any>[] = [];
3010
- payload.value = new Set();
3011
- for (const item of input) {
3012
- const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
3013
- if (result instanceof Promise) {
3014
- proms.push(result.then((result) => handleSetResult(result, payload)));
3015
- } else handleSetResult(result, payload);
3016
- }
3017
-
3018
- if (proms.length) return Promise.all(proms).then(() => payload);
3019
- return payload;
3020
- };
3021
- });
3022
-
3023
- function handleSetResult(result: ParsePayload, final: ParsePayload<Set<any>>) {
3024
- if (result.issues.length) {
3025
- final.issues.push(...result.issues);
3026
- }
3027
- final.value.add(result.value);
3028
- }
3029
-
3030
- ////////////////////////////////////////
3031
- ////////////////////////////////////////
3032
- ////////// //////////
3033
- ////////// $ZodEnum //////////
3034
- ////////// //////////
3035
- ////////////////////////////////////////
3036
- ////////////////////////////////////////
3037
- export type $InferEnumOutput<T extends util.EnumLike> = T[keyof T] & {};
3038
- export type $InferEnumInput<T extends util.EnumLike> = T[keyof T] & {};
3039
-
3040
- export interface $ZodEnumDef<T extends util.EnumLike = util.EnumLike> extends $ZodTypeDef {
3041
- type: "enum";
3042
- entries: T;
3043
- }
3044
-
3045
- export interface $ZodEnumInternals<
3046
- /** @ts-ignore Cast variance */
3047
- out T extends util.EnumLike = util.EnumLike,
3048
- > extends $ZodTypeInternals<$InferEnumOutput<T>, $InferEnumInput<T>> {
3049
- // enum: T;
3050
-
3051
- def: $ZodEnumDef<T>;
3052
- /** @deprecated Internal API, use with caution (not deprecated) */
3053
- values: util.PrimitiveSet;
3054
- /** @deprecated Internal API, use with caution (not deprecated) */
3055
- pattern: RegExp;
3056
- isst: errors.$ZodIssueInvalidValue;
3057
- }
3058
-
3059
- export interface $ZodEnum<T extends util.EnumLike = util.EnumLike> extends $ZodType {
3060
- _zod: $ZodEnumInternals<T>;
3061
- }
3062
-
3063
- export const $ZodEnum: core.$constructor<$ZodEnum> = /*@__PURE__*/ core.$constructor("$ZodEnum", (inst, def) => {
3064
- $ZodType.init(inst, def);
3065
-
3066
- const values = util.getEnumValues(def.entries);
3067
- const valuesSet = new Set<util.Primitive>(values);
3068
- inst._zod.values = valuesSet;
3069
-
3070
- inst._zod.pattern = new RegExp(
3071
- `^(${values
3072
- .filter((k) => util.propertyKeyTypes.has(typeof k))
3073
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o.toString()))
3074
- .join("|")})$`
3075
- );
3076
-
3077
- inst._zod.parse = (payload, _ctx) => {
3078
- const input = payload.value;
3079
- if (valuesSet.has(input)) {
3080
- return payload;
3081
- }
3082
- payload.issues.push({
3083
- code: "invalid_value",
3084
-
3085
- values,
3086
- input,
3087
- inst,
3088
- });
3089
- return payload;
3090
- };
3091
- });
3092
-
3093
- ////////////////////////////////////////
3094
- ////////////////////////////////////////
3095
- ////////// //////////
3096
- ////////// $ZodLiteral //////////
3097
- ////////// //////////
3098
- ////////////////////////////////////////
3099
- ////////////////////////////////////////
3100
-
3101
- export interface $ZodLiteralDef<T extends util.Literal> extends $ZodTypeDef {
3102
- type: "literal";
3103
- values: T[];
3104
- }
3105
-
3106
- export interface $ZodLiteralInternals<T extends util.Literal = util.Literal> extends $ZodTypeInternals<T, T> {
3107
- def: $ZodLiteralDef<T>;
3108
- values: Set<T>;
3109
- pattern: RegExp;
3110
- isst: errors.$ZodIssueInvalidValue;
3111
- }
3112
-
3113
- export interface $ZodLiteral<T extends util.Literal = util.Literal> extends $ZodType {
3114
- _zod: $ZodLiteralInternals<T>;
3115
- }
3116
-
3117
- export const $ZodLiteral: core.$constructor<$ZodLiteral> = /*@__PURE__*/ core.$constructor(
3118
- "$ZodLiteral",
3119
- (inst, def) => {
3120
- $ZodType.init(inst, def);
3121
- if (def.values.length === 0) {
3122
- throw new Error("Cannot create literal schema with no valid values");
3123
- }
3124
-
3125
- const values = new Set<util.Literal>(def.values);
3126
- inst._zod.values = values;
3127
- inst._zod.pattern = new RegExp(
3128
- `^(${def.values
3129
-
3130
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)))
3131
- .join("|")})$`
3132
- );
3133
-
3134
- inst._zod.parse = (payload, _ctx) => {
3135
- const input = payload.value;
3136
- if (values.has(input)) {
3137
- return payload;
3138
- }
3139
- payload.issues.push({
3140
- code: "invalid_value",
3141
-
3142
- values: def.values,
3143
- input,
3144
- inst,
3145
- });
3146
- return payload;
3147
- };
3148
- }
3149
- );
3150
-
3151
- ////////////////////////////////////////
3152
- ////////////////////////////////////////
3153
- ////////// //////////
3154
- ////////// $ZodConst //////////
3155
- ////////// //////////
3156
- ////////////////////////////////////////
3157
- ////////////////////////////////////////
3158
-
3159
- // export interface $ZodConstDef extends $ZodTypeDef {
3160
- // type: "const";
3161
- // value: unknown;
3162
- // }
3163
-
3164
- // export _interface $ZodConstInternals<T extends util.Literal = util.Literal> extends $ZodTypeInternals<T, T> {
3165
- // _def: $ZodConstDef;
3166
- // _values: util.PrimitiveSet;
3167
- // _pattern: RegExp;
3168
- // _isst: errors.$ZodIssueInvalidValue;
3169
- // }
3170
-
3171
- // export const $ZodConst: core.$constructor<{_zod: $ZodConstInternals}> = /*@__PURE__*/ core.$constructor("$ZodConst", (inst, def) => {
3172
- // $ZodType.init(inst, def);
3173
-
3174
- // if (util.primitiveTypes.has(typeof def.value) || def.value === null) {
3175
- // inst._zod.values = new Set<util.Primitive>(def.value as any);
3176
- // }
3177
-
3178
- // if (util.propertyKeyTypes.has(typeof def.value)) {
3179
- // inst._zod.pattern = new RegExp(
3180
- // `^(${typeof def.value === "string" ? util.escapeRegex(def.value) : (def.value as any).toString()})$`
3181
- // );
3182
- // } else {
3183
- // throw new Error("Const value cannot be converted to regex");
3184
- // }
3185
-
3186
- // inst._zod.parse = (payload, _ctx) => {
3187
- // payload.value = def.value; // always override
3188
- // return payload;
3189
- // };
3190
- // });
3191
-
3192
- //////////////////////////////////////////
3193
- //////////////////////////////////////////
3194
- ////////// //////////
3195
- ////////// $ZodFile //////////
3196
- ////////// //////////
3197
- //////////////////////////////////////////
3198
- //////////////////////////////////////////
3199
-
3200
- // provide a fallback in case the File interface isn't provided in the environment
3201
- type _File = typeof globalThis extends { File: infer F extends new (...args: any[]) => any } ? InstanceType<F> : {};
3202
- /** Do not reference this directly. */
3203
- export interface File extends _File {
3204
- readonly type: string;
3205
- readonly size: number;
3206
- }
3207
-
3208
- export interface $ZodFileDef extends $ZodTypeDef {
3209
- type: "file";
3210
- }
3211
-
3212
- export interface $ZodFileInternals extends $ZodTypeInternals<File, File> {
3213
- def: $ZodFileDef;
3214
- isst: errors.$ZodIssueInvalidType;
3215
- bag: util.LoosePartial<{
3216
- minimum: number;
3217
- maximum: number;
3218
- mime: util.MimeTypes[];
3219
- }>;
3220
- }
3221
-
3222
- export interface $ZodFile extends $ZodType {
3223
- _zod: $ZodFileInternals;
3224
- }
3225
-
3226
- export const $ZodFile: core.$constructor<$ZodFile> = /*@__PURE__*/ core.$constructor("$ZodFile", (inst, def) => {
3227
- $ZodType.init(inst, def);
3228
-
3229
- inst._zod.parse = (payload, _ctx) => {
3230
- const input = payload.value;
3231
- // @ts-ignore
3232
- if (input instanceof File) return payload;
3233
- payload.issues.push({
3234
- expected: "file",
3235
- code: "invalid_type",
3236
-
3237
- input,
3238
- inst,
3239
- });
3240
- return payload;
3241
- };
3242
- });
3243
-
3244
- //////////////////////////////////////////////
3245
- //////////////////////////////////////////////
3246
- ////////// //////////
3247
- ////////// $ZodTransform //////////
3248
- ////////// //////////
3249
- //////////////////////////////////////////////
3250
- //////////////////////////////////////////////
3251
- export interface $ZodTransformDef extends $ZodTypeDef {
3252
- type: "transform";
3253
- transform: (input: unknown, payload: ParsePayload<unknown>) => util.MaybeAsync<unknown>;
3254
- }
3255
- export interface $ZodTransformInternals<O = unknown, I = unknown> extends $ZodTypeInternals<O, I> {
3256
- def: $ZodTransformDef;
3257
- isst: never;
3258
- }
3259
-
3260
- export interface $ZodTransform<O = unknown, I = unknown> extends $ZodType {
3261
- _zod: $ZodTransformInternals<O, I>;
3262
- }
3263
-
3264
- export const $ZodTransform: core.$constructor<$ZodTransform> = /*@__PURE__*/ core.$constructor(
3265
- "$ZodTransform",
3266
- (inst, def) => {
3267
- $ZodType.init(inst, def);
3268
- inst._zod.parse = (payload, ctx) => {
3269
- if (ctx.direction === "backward") {
3270
- throw new core.$ZodEncodeError(inst.constructor.name);
3271
- }
3272
-
3273
- const _out = def.transform(payload.value, payload);
3274
- if (ctx.async) {
3275
- const output = _out instanceof Promise ? _out : Promise.resolve(_out);
3276
- return output.then((output) => {
3277
- payload.value = output;
3278
- return payload;
3279
- });
3280
- }
3281
-
3282
- if (_out instanceof Promise) {
3283
- throw new core.$ZodAsyncError();
3284
- }
3285
-
3286
- payload.value = _out;
3287
- return payload;
3288
- };
3289
- }
3290
- );
3291
-
3292
- ////////////////////////////////////////////
3293
- ////////////////////////////////////////////
3294
- ////////// //////////
3295
- ////////// $ZodOptional //////////
3296
- ////////// //////////
3297
- ////////////////////////////////////////////
3298
- ////////////////////////////////////////////
3299
- export interface $ZodOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3300
- type: "optional";
3301
- innerType: T;
3302
- }
3303
-
3304
- export interface $ZodOptionalInternals<T extends SomeType = $ZodType>
3305
- extends $ZodTypeInternals<core.output<T> | undefined, core.input<T> | undefined> {
3306
- def: $ZodOptionalDef<T>;
3307
- optin: "optional";
3308
- optout: "optional";
3309
- isst: never;
3310
- values: T["_zod"]["values"];
3311
- pattern: T["_zod"]["pattern"];
3312
- }
3313
-
3314
- export interface $ZodOptional<T extends SomeType = $ZodType> extends $ZodType {
3315
- _zod: $ZodOptionalInternals<T>;
3316
- }
3317
-
3318
- function handleOptionalResult(result: ParsePayload, input: unknown) {
3319
- if (result.issues.length && input === undefined) {
3320
- return { issues: [], value: undefined };
3321
- }
3322
- return result;
3323
- }
3324
-
3325
- export const $ZodOptional: core.$constructor<$ZodOptional> = /*@__PURE__*/ core.$constructor(
3326
- "$ZodOptional",
3327
- (inst, def) => {
3328
- $ZodType.init(inst, def);
3329
- inst._zod.optin = "optional";
3330
- inst._zod.optout = "optional";
3331
-
3332
- util.defineLazy(inst._zod, "values", () => {
3333
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
3334
- });
3335
- util.defineLazy(inst._zod, "pattern", () => {
3336
- const pattern = def.innerType._zod.pattern;
3337
- return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
3338
- });
3339
-
3340
- inst._zod.parse = (payload, ctx) => {
3341
- if (def.innerType._zod.optin === "optional") {
3342
- const result = def.innerType._zod.run(payload, ctx);
3343
- if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, payload.value));
3344
- return handleOptionalResult(result, payload.value);
3345
- }
3346
- if (payload.value === undefined) {
3347
- return payload;
3348
- }
3349
- return def.innerType._zod.run(payload, ctx);
3350
- };
3351
- }
3352
- );
3353
-
3354
- ////////////////////////////////////////////////
3355
- ////////////////////////////////////////////////
3356
- ////////// //////////
3357
- ////////// $ZodExactOptional //////////
3358
- ////////// //////////
3359
- ////////////////////////////////////////////////
3360
- ////////////////////////////////////////////////
3361
-
3362
- // Def extends $ZodOptionalDef (no additional fields needed)
3363
- export interface $ZodExactOptionalDef<T extends SomeType = $ZodType> extends $ZodOptionalDef<T> {}
3364
-
3365
- // Internals extends $ZodOptionalInternals but narrows output/input types (removes | undefined)
3366
- export interface $ZodExactOptionalInternals<T extends SomeType = $ZodType> extends $ZodOptionalInternals<T> {
3367
- def: $ZodExactOptionalDef<T>;
3368
- output: core.output<T>; // NO | undefined (narrowed from parent)
3369
- input: core.input<T>; // NO | undefined (narrowed from parent)
3370
- }
3371
-
3372
- export interface $ZodExactOptional<T extends SomeType = $ZodType> extends $ZodType {
3373
- _zod: $ZodExactOptionalInternals<T>;
3374
- }
3375
-
3376
- export const $ZodExactOptional: core.$constructor<$ZodExactOptional> = /*@__PURE__*/ core.$constructor(
3377
- "$ZodExactOptional",
3378
- (inst, def) => {
3379
- // Call parent init - inherits optin/optout = "optional"
3380
- $ZodOptional.init(inst, def);
3381
-
3382
- // Override values/pattern to NOT add undefined
3383
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
3384
- util.defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
3385
-
3386
- // Override parse to just delegate (no undefined handling)
3387
- inst._zod.parse = (payload, ctx) => {
3388
- return def.innerType._zod.run(payload, ctx);
3389
- };
3390
- }
3391
- );
3392
-
3393
- ////////////////////////////////////////////
3394
- ////////////////////////////////////////////
3395
- ////////// //////////
3396
- ////////// $ZodNullable //////////
3397
- ////////// //////////
3398
- ////////////////////////////////////////////
3399
- ////////////////////////////////////////////
3400
- export interface $ZodNullableDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3401
- type: "nullable";
3402
- innerType: T;
3403
- }
3404
-
3405
- export interface $ZodNullableInternals<T extends SomeType = $ZodType>
3406
- extends $ZodTypeInternals<core.output<T> | null, core.input<T> | null> {
3407
- def: $ZodNullableDef<T>;
3408
- optin: T["_zod"]["optin"];
3409
- optout: T["_zod"]["optout"];
3410
- isst: never;
3411
- values: T["_zod"]["values"];
3412
- pattern: T["_zod"]["pattern"];
3413
- }
3414
-
3415
- export interface $ZodNullable<T extends SomeType = $ZodType> extends $ZodType {
3416
- _zod: $ZodNullableInternals<T>;
3417
- }
3418
-
3419
- export const $ZodNullable: core.$constructor<$ZodNullable> = /*@__PURE__*/ core.$constructor(
3420
- "$ZodNullable",
3421
- (inst, def) => {
3422
- $ZodType.init(inst, def);
3423
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
3424
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
3425
-
3426
- util.defineLazy(inst._zod, "pattern", () => {
3427
- const pattern = def.innerType._zod.pattern;
3428
- return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;
3429
- });
3430
-
3431
- util.defineLazy(inst._zod, "values", () => {
3432
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
3433
- });
3434
-
3435
- inst._zod.parse = (payload, ctx) => {
3436
- // Forward direction (decode): allow null to pass through
3437
- if (payload.value === null) return payload;
3438
- return def.innerType._zod.run(payload, ctx);
3439
- };
3440
- }
3441
- );
3442
- // );
3443
-
3444
- ////////////////////////////////////////////
3445
- ////////////////////////////////////////////
3446
- ////////// //////////
3447
- ////////// $ZodDefault //////////
3448
- ////////// //////////
3449
- ////////////////////////////////////////////
3450
- ////////////////////////////////////////////
3451
- export interface $ZodDefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3452
- type: "default";
3453
- innerType: T;
3454
- /** The default value. May be a getter. */
3455
- defaultValue: util.NoUndefined<core.output<T>>;
3456
- }
3457
-
3458
- export interface $ZodDefaultInternals<T extends SomeType = $ZodType>
3459
- extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
3460
- def: $ZodDefaultDef<T>;
3461
- optin: "optional";
3462
- optout?: "optional" | undefined; // required
3463
- isst: never;
3464
- values: T["_zod"]["values"];
3465
- }
3466
-
3467
- export interface $ZodDefault<T extends SomeType = $ZodType> extends $ZodType {
3468
- _zod: $ZodDefaultInternals<T>;
3469
- }
3470
-
3471
- export const $ZodDefault: core.$constructor<$ZodDefault> = /*@__PURE__*/ core.$constructor(
3472
- "$ZodDefault",
3473
- (inst, def) => {
3474
- $ZodType.init(inst, def);
3475
-
3476
- // inst._zod.qin = "true";
3477
- inst._zod.optin = "optional";
3478
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
3479
-
3480
- inst._zod.parse = (payload, ctx) => {
3481
- if (ctx.direction === "backward") {
3482
- return def.innerType._zod.run(payload, ctx);
3483
- }
3484
-
3485
- // Forward direction (decode): apply defaults for undefined input
3486
- if (payload.value === undefined) {
3487
- payload.value = def.defaultValue;
3488
- /**
3489
- * $ZodDefault returns the default value immediately in forward direction.
3490
- * 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. */
3491
- return payload;
3492
- }
3493
- // Forward direction: continue with default handling
3494
- const result = def.innerType._zod.run(payload, ctx);
3495
- if (result instanceof Promise) {
3496
- return result.then((result) => handleDefaultResult(result, def));
3497
- }
3498
- return handleDefaultResult(result, def);
3499
- };
3500
- }
3501
- );
3502
-
3503
- function handleDefaultResult(payload: ParsePayload, def: $ZodDefaultDef) {
3504
- if (payload.value === undefined) {
3505
- payload.value = def.defaultValue;
3506
- }
3507
- return payload;
3508
- }
3509
-
3510
- ////////////////////////////////////////////
3511
- ////////////////////////////////////////////
3512
- ////////// //////////
3513
- ////////// $ZodPrefault //////////
3514
- ////////// //////////
3515
- ////////////////////////////////////////////
3516
- ////////////////////////////////////////////
3517
-
3518
- export interface $ZodPrefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3519
- type: "prefault";
3520
- innerType: T;
3521
- /** The default value. May be a getter. */
3522
- defaultValue: core.input<T>;
3523
- }
3524
-
3525
- export interface $ZodPrefaultInternals<T extends SomeType = $ZodType>
3526
- extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
3527
- def: $ZodPrefaultDef<T>;
3528
- optin: "optional";
3529
- optout?: "optional" | undefined;
3530
- isst: never;
3531
- values: T["_zod"]["values"];
3532
- }
3533
-
3534
- export interface $ZodPrefault<T extends SomeType = $ZodType> extends $ZodType {
3535
- _zod: $ZodPrefaultInternals<T>;
3536
- }
3537
-
3538
- export const $ZodPrefault: core.$constructor<$ZodPrefault> = /*@__PURE__*/ core.$constructor(
3539
- "$ZodPrefault",
3540
- (inst, def) => {
3541
- $ZodType.init(inst, def);
3542
-
3543
- inst._zod.optin = "optional";
3544
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
3545
-
3546
- inst._zod.parse = (payload, ctx) => {
3547
- if (ctx.direction === "backward") {
3548
- return def.innerType._zod.run(payload, ctx);
3549
- }
3550
-
3551
- // Forward direction (decode): apply prefault for undefined input
3552
- if (payload.value === undefined) {
3553
- payload.value = def.defaultValue;
3554
- }
3555
- return def.innerType._zod.run(payload, ctx);
3556
- };
3557
- }
3558
- );
3559
-
3560
- ///////////////////////////////////////////////
3561
- ///////////////////////////////////////////////
3562
- ////////// //////////
3563
- ////////// $ZodNonOptional //////////
3564
- ////////// //////////
3565
- ///////////////////////////////////////////////
3566
- ///////////////////////////////////////////////
3567
- export interface $ZodNonOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3568
- type: "nonoptional";
3569
- innerType: T;
3570
- }
3571
-
3572
- export interface $ZodNonOptionalInternals<T extends SomeType = $ZodType>
3573
- extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, util.NoUndefined<core.input<T>>> {
3574
- def: $ZodNonOptionalDef<T>;
3575
- isst: errors.$ZodIssueInvalidType;
3576
- values: T["_zod"]["values"];
3577
- optin: "optional" | undefined;
3578
- optout: "optional" | undefined;
3579
- }
3580
-
3581
- export interface $ZodNonOptional<T extends SomeType = $ZodType> extends $ZodType {
3582
- _zod: $ZodNonOptionalInternals<T>;
3583
- }
3584
-
3585
- export const $ZodNonOptional: core.$constructor<$ZodNonOptional> = /*@__PURE__*/ core.$constructor(
3586
- "$ZodNonOptional",
3587
- (inst, def) => {
3588
- $ZodType.init(inst, def);
3589
-
3590
- util.defineLazy(inst._zod, "values", () => {
3591
- const v = def.innerType._zod.values;
3592
- return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
3593
- });
3594
-
3595
- inst._zod.parse = (payload, ctx) => {
3596
- const result = def.innerType._zod.run(payload, ctx);
3597
- if (result instanceof Promise) {
3598
- return result.then((result) => handleNonOptionalResult(result, inst));
3599
- }
3600
- return handleNonOptionalResult(result, inst);
3601
- };
3602
- }
3603
- );
3604
-
3605
- function handleNonOptionalResult(payload: ParsePayload, inst: $ZodNonOptional) {
3606
- if (!payload.issues.length && payload.value === undefined) {
3607
- payload.issues.push({
3608
- code: "invalid_type",
3609
- expected: "nonoptional",
3610
- input: payload.value,
3611
- inst,
3612
- });
3613
- }
3614
- return payload;
3615
- }
3616
-
3617
- ////////////////////////////////////////////
3618
- ////////////////////////////////////////////
3619
- ////////// //////////
3620
- ////////// $ZodCoalesce //////////
3621
- ////////// //////////
3622
- ////////////////////////////////////////////
3623
- ////////////////////////////////////////////
3624
- // export interface $ZodCoalesceDef<T extends $ZodType = $ZodType> extends $ZodTypeDef {
3625
- // type: "coalesce";
3626
- // innerType: T;
3627
- // defaultValue: () => NonNullable<T['_zod']["output"]>;
3628
- // }
3629
-
3630
- // export _interface $ZodCoalesceInternals<T extends $ZodType = $ZodType>
3631
- // extends $ZodTypeInternals<NonNullable<T['_zod']["output"]>, T['_zod']["input"] | undefined | null> {
3632
- // _def: $ZodCoalesceDef<T>;
3633
- // _isst: errors.$ZodIssueInvalidType;
3634
- // _qin: "true";
3635
- // }
3636
-
3637
- // function handleCoalesceResult(payload: ParsePayload, def: $ZodCoalesceDef) {
3638
- // payload.value ??= def.defaultValue();
3639
- // return payload;
3640
- // }
3641
-
3642
- // export const $ZodCoalesce: core.$constructor<{_zod: $ZodCoalesceInternals}> = /*@__PURE__*/ core.$constructor(
3643
- // "$ZodCoalesce",
3644
- // (inst, def) => {
3645
- // $ZodType.init(inst, def);
3646
- // inst._zod.qin = "true";
3647
- // inst._zod.parse = (payload, ctx) => {
3648
- // const result = def.innerType._zod.run(payload, ctx);
3649
- // if (result instanceof Promise) {
3650
- // return result.then((result) => handleCoalesceResult(result, def));
3651
- // }
3652
- // return handleCoalesceResult(result, def);
3653
- // };
3654
- // }
3655
- // );
3656
-
3657
- /////////////////////////////////////////////
3658
- /////////////////////////////////////////////
3659
- ////////// //////////
3660
- ////////// $ZodSuccess //////////
3661
- ////////// //////////
3662
- /////////////////////////////////////////////
3663
- /////////////////////////////////////////////
3664
- export interface $ZodSuccessDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3665
- type: "success";
3666
- innerType: T;
3667
- }
3668
-
3669
- export interface $ZodSuccessInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<boolean, core.input<T>> {
3670
- def: $ZodSuccessDef<T>;
3671
- isst: never;
3672
- optin: T["_zod"]["optin"];
3673
- optout: "optional" | undefined;
3674
- }
3675
-
3676
- export interface $ZodSuccess<T extends SomeType = $ZodType> extends $ZodType {
3677
- _zod: $ZodSuccessInternals<T>;
3678
- }
3679
-
3680
- export const $ZodSuccess: core.$constructor<$ZodSuccess> = /*@__PURE__*/ core.$constructor(
3681
- "$ZodSuccess",
3682
- (inst, def) => {
3683
- $ZodType.init(inst, def);
3684
-
3685
- inst._zod.parse = (payload, ctx) => {
3686
- if (ctx.direction === "backward") {
3687
- throw new core.$ZodEncodeError("ZodSuccess");
3688
- }
3689
-
3690
- const result = def.innerType._zod.run(payload, ctx);
3691
- if (result instanceof Promise) {
3692
- return result.then((result) => {
3693
- payload.value = result.issues.length === 0;
3694
- return payload;
3695
- });
3696
- }
3697
- payload.value = result.issues.length === 0;
3698
- return payload;
3699
- };
3700
- }
3701
- );
3702
-
3703
- ////////////////////////////////////////////
3704
- ////////////////////////////////////////////
3705
- ////////// //////////
3706
- ////////// $ZodCatch //////////
3707
- ////////// //////////
3708
- ////////////////////////////////////////////
3709
- ////////////////////////////////////////////
3710
- export interface $ZodCatchCtx extends ParsePayload {
3711
- /** @deprecated Use `ctx.issues` */
3712
- error: { issues: errors.$ZodIssue[] };
3713
- /** @deprecated Use `ctx.value` */
3714
- input: unknown;
3715
- }
3716
- export interface $ZodCatchDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3717
- type: "catch";
3718
- innerType: T;
3719
- catchValue: (ctx: $ZodCatchCtx) => unknown;
3720
- }
3721
-
3722
- export interface $ZodCatchInternals<T extends SomeType = $ZodType>
3723
- extends $ZodTypeInternals<core.output<T>, core.input<T>> {
3724
- def: $ZodCatchDef<T>;
3725
- optin: T["_zod"]["optin"];
3726
- optout: T["_zod"]["optout"];
3727
- isst: never;
3728
- values: T["_zod"]["values"];
3729
- }
3730
-
3731
- export interface $ZodCatch<T extends SomeType = $ZodType> extends $ZodType {
3732
- _zod: $ZodCatchInternals<T>;
3733
- }
3734
-
3735
- export const $ZodCatch: core.$constructor<$ZodCatch> = /*@__PURE__*/ core.$constructor("$ZodCatch", (inst, def) => {
3736
- $ZodType.init(inst, def);
3737
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
3738
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
3739
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
3740
-
3741
- inst._zod.parse = (payload, ctx) => {
3742
- if (ctx.direction === "backward") {
3743
- return def.innerType._zod.run(payload, ctx);
3744
- }
3745
-
3746
- // Forward direction (decode): apply catch logic
3747
- const result = def.innerType._zod.run(payload, ctx);
3748
- if (result instanceof Promise) {
3749
- return result.then((result) => {
3750
- payload.value = result.value;
3751
- if (result.issues.length) {
3752
- payload.value = def.catchValue({
3753
- ...payload,
3754
- error: {
3755
- issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
3756
- },
3757
- input: payload.value,
3758
- });
3759
- payload.issues = [];
3760
- }
3761
-
3762
- return payload;
3763
- });
3764
- }
3765
-
3766
- payload.value = result.value;
3767
- if (result.issues.length) {
3768
- payload.value = def.catchValue({
3769
- ...payload,
3770
- error: {
3771
- issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
3772
- },
3773
- input: payload.value,
3774
- });
3775
-
3776
- payload.issues = [];
3777
- }
3778
-
3779
- return payload;
3780
- };
3781
- });
3782
-
3783
- ////////////////////////////////////////////
3784
- ////////////////////////////////////////////
3785
- ////////// //////////
3786
- ////////// $ZodNaN //////////
3787
- ////////// //////////
3788
- ////////////////////////////////////////////
3789
- ////////////////////////////////////////////
3790
- export interface $ZodNaNDef extends $ZodTypeDef {
3791
- type: "nan";
3792
- }
3793
-
3794
- export interface $ZodNaNInternals extends $ZodTypeInternals<number, number> {
3795
- def: $ZodNaNDef;
3796
- isst: errors.$ZodIssueInvalidType;
3797
- }
3798
-
3799
- export interface $ZodNaN extends $ZodType {
3800
- _zod: $ZodNaNInternals;
3801
- }
3802
-
3803
- export const $ZodNaN: core.$constructor<$ZodNaN> = /*@__PURE__*/ core.$constructor("$ZodNaN", (inst, def) => {
3804
- $ZodType.init(inst, def);
3805
-
3806
- inst._zod.parse = (payload, _ctx) => {
3807
- if (typeof payload.value !== "number" || !Number.isNaN(payload.value)) {
3808
- payload.issues.push({
3809
- input: payload.value,
3810
- inst,
3811
- expected: "nan",
3812
- code: "invalid_type",
3813
- });
3814
- return payload;
3815
- }
3816
- return payload;
3817
- };
3818
- });
3819
-
3820
- ////////////////////////////////////////////
3821
- ////////////////////////////////////////////
3822
- ////////// //////////
3823
- ////////// $ZodPipe //////////
3824
- ////////// //////////
3825
- ////////////////////////////////////////////
3826
- ////////////////////////////////////////////
3827
- export interface $ZodPipeDef<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeDef {
3828
- type: "pipe";
3829
- in: A;
3830
- out: B;
3831
- /** Only defined inside $ZodCodec instances. */
3832
- transform?: (value: core.output<A>, payload: ParsePayload<core.output<A>>) => util.MaybeAsync<core.input<B>>;
3833
- /** Only defined inside $ZodCodec instances. */
3834
- reverseTransform?: (value: core.input<B>, payload: ParsePayload<core.input<B>>) => util.MaybeAsync<core.output<A>>;
3835
- }
3836
-
3837
- export interface $ZodPipeInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType>
3838
- extends $ZodTypeInternals<core.output<B>, core.input<A>> {
3839
- def: $ZodPipeDef<A, B>;
3840
- isst: never;
3841
- values: A["_zod"]["values"];
3842
- optin: A["_zod"]["optin"];
3843
- optout: B["_zod"]["optout"];
3844
- propValues: A["_zod"]["propValues"];
3845
- }
3846
-
3847
- export interface $ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
3848
- _zod: $ZodPipeInternals<A, B>;
3849
- }
3850
-
3851
- export const $ZodPipe: core.$constructor<$ZodPipe> = /*@__PURE__*/ core.$constructor("$ZodPipe", (inst, def) => {
3852
- $ZodType.init(inst, def);
3853
- util.defineLazy(inst._zod, "values", () => def.in._zod.values);
3854
- util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
3855
- util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
3856
- util.defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
3857
-
3858
- inst._zod.parse = (payload, ctx) => {
3859
- if (ctx.direction === "backward") {
3860
- const right = def.out._zod.run(payload, ctx);
3861
- if (right instanceof Promise) {
3862
- return right.then((right) => handlePipeResult(right, def.in, ctx));
3863
- }
3864
- return handlePipeResult(right, def.in, ctx);
3865
- }
3866
-
3867
- const left = def.in._zod.run(payload, ctx);
3868
- if (left instanceof Promise) {
3869
- return left.then((left) => handlePipeResult(left, def.out, ctx));
3870
- }
3871
- return handlePipeResult(left, def.out, ctx);
3872
- };
3873
- });
3874
-
3875
- function handlePipeResult(left: ParsePayload, next: $ZodType, ctx: ParseContextInternal) {
3876
- if (left.issues.length) {
3877
- // prevent further checks
3878
- left.aborted = true;
3879
- return left;
3880
- }
3881
- return next._zod.run({ value: left.value, issues: left.issues }, ctx);
3882
- }
3883
-
3884
- ////////////////////////////////////////////
3885
- ////////////////////////////////////////////
3886
- ////////// //////////
3887
- ////////// $ZodCodec //////////
3888
- ////////// //////////
3889
- ////////////////////////////////////////////
3890
- ////////////////////////////////////////////
3891
- export interface $ZodCodecDef<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodPipeDef<A, B> {
3892
- transform: (value: core.output<A>, payload: ParsePayload<core.output<A>>) => util.MaybeAsync<core.input<B>>;
3893
- reverseTransform: (value: core.input<B>, payload: ParsePayload<core.input<B>>) => util.MaybeAsync<core.output<A>>;
3894
- }
3895
-
3896
- export interface $ZodCodecInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType>
3897
- extends $ZodTypeInternals<core.output<B>, core.input<A>> {
3898
- def: $ZodCodecDef<A, B>;
3899
- isst: never;
3900
- values: A["_zod"]["values"];
3901
- optin: A["_zod"]["optin"];
3902
- optout: B["_zod"]["optout"];
3903
- propValues: A["_zod"]["propValues"];
3904
- }
3905
-
3906
- export interface $ZodCodec<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
3907
- _zod: $ZodCodecInternals<A, B>;
3908
- }
3909
-
3910
- export const $ZodCodec: core.$constructor<$ZodCodec> = /*@__PURE__*/ core.$constructor("$ZodCodec", (inst, def) => {
3911
- $ZodType.init(inst, def);
3912
- util.defineLazy(inst._zod, "values", () => def.in._zod.values);
3913
- util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
3914
- util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
3915
- util.defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
3916
-
3917
- inst._zod.parse = (payload, ctx) => {
3918
- const direction = ctx.direction || "forward";
3919
- if (direction === "forward") {
3920
- const left = def.in._zod.run(payload, ctx);
3921
- if (left instanceof Promise) {
3922
- return left.then((left) => handleCodecAResult(left, def, ctx));
3923
- }
3924
- return handleCodecAResult(left, def, ctx);
3925
- } else {
3926
- const right = def.out._zod.run(payload, ctx);
3927
- if (right instanceof Promise) {
3928
- return right.then((right) => handleCodecAResult(right, def, ctx));
3929
- }
3930
- return handleCodecAResult(right, def, ctx);
3931
- }
3932
- };
3933
- });
3934
-
3935
- function handleCodecAResult(result: ParsePayload, def: $ZodCodecDef, ctx: ParseContextInternal) {
3936
- if (result.issues.length) {
3937
- // prevent further checks
3938
- result.aborted = true;
3939
- return result;
3940
- }
3941
-
3942
- const direction = ctx.direction || "forward";
3943
-
3944
- if (direction === "forward") {
3945
- const transformed = def.transform(result.value, result);
3946
- if (transformed instanceof Promise) {
3947
- return transformed.then((value) => handleCodecTxResult(result, value, def.out, ctx));
3948
- }
3949
- return handleCodecTxResult(result, transformed, def.out, ctx);
3950
- } else {
3951
- const transformed = def.reverseTransform(result.value, result);
3952
- if (transformed instanceof Promise) {
3953
- return transformed.then((value) => handleCodecTxResult(result, value, def.in, ctx));
3954
- }
3955
- return handleCodecTxResult(result, transformed, def.in, ctx);
3956
- }
3957
- }
3958
-
3959
- function handleCodecTxResult(left: ParsePayload, value: any, nextSchema: SomeType, ctx: ParseContextInternal) {
3960
- // Check if transform added any issues
3961
- if (left.issues.length) {
3962
- left.aborted = true;
3963
- return left;
3964
- }
3965
-
3966
- return nextSchema._zod.run({ value, issues: left.issues }, ctx);
3967
- }
3968
-
3969
- ////////////////////////////////////////////
3970
- ////////////////////////////////////////////
3971
- ////////// //////////
3972
- ////////// $ZodReadonly //////////
3973
- ////////// //////////
3974
- ////////////////////////////////////////////
3975
- ////////////////////////////////////////////
3976
-
3977
- export interface $ZodReadonlyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
3978
- type: "readonly";
3979
- innerType: T;
3980
- }
3981
-
3982
- export interface $ZodReadonlyInternals<T extends SomeType = $ZodType>
3983
- extends $ZodTypeInternals<util.MakeReadonly<core.output<T>>, util.MakeReadonly<core.input<T>>> {
3984
- def: $ZodReadonlyDef<T>;
3985
- optin: T["_zod"]["optin"];
3986
- optout: T["_zod"]["optout"];
3987
- isst: never;
3988
- propValues: T["_zod"]["propValues"];
3989
- values: T["_zod"]["values"];
3990
- }
3991
-
3992
- export interface $ZodReadonly<T extends SomeType = $ZodType> extends $ZodType {
3993
- _zod: $ZodReadonlyInternals<T>;
3994
- }
3995
-
3996
- export const $ZodReadonly: core.$constructor<$ZodReadonly> = /*@__PURE__*/ core.$constructor(
3997
- "$ZodReadonly",
3998
- (inst, def) => {
3999
- $ZodType.init(inst, def);
4000
- util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
4001
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
4002
- util.defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
4003
- util.defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
4004
-
4005
- inst._zod.parse = (payload, ctx) => {
4006
- if (ctx.direction === "backward") {
4007
- return def.innerType._zod.run(payload, ctx);
4008
- }
4009
- const result = def.innerType._zod.run(payload, ctx);
4010
- if (result instanceof Promise) {
4011
- return result.then(handleReadonlyResult);
4012
- }
4013
- return handleReadonlyResult(result);
4014
- };
4015
- }
4016
- );
4017
-
4018
- function handleReadonlyResult(payload: ParsePayload): ParsePayload {
4019
- payload.value = Object.freeze(payload.value);
4020
- return payload;
4021
- }
4022
-
4023
- /////////////////////////////////////////////
4024
- /////////////////////////////////////////////
4025
- ////////// //////////
4026
- ////////// $ZodTemplateLiteral //////////
4027
- ////////// //////////
4028
- /////////////////////////////////////////////
4029
- /////////////////////////////////////////////
4030
-
4031
- export interface $ZodTemplateLiteralDef extends $ZodTypeDef {
4032
- type: "template_literal";
4033
- parts: $ZodTemplateLiteralPart[];
4034
- format?: string | undefined;
4035
- }
4036
- export interface $ZodTemplateLiteralInternals<Template extends string = string>
4037
- extends $ZodTypeInternals<Template, Template> {
4038
- pattern: RegExp;
4039
- def: $ZodTemplateLiteralDef;
4040
- isst: errors.$ZodIssueInvalidType;
4041
- }
4042
-
4043
- export interface $ZodTemplateLiteral<Template extends string = string> extends $ZodType {
4044
- _zod: $ZodTemplateLiteralInternals<Template>;
4045
- }
4046
-
4047
- type LiteralPart = Exclude<util.Literal, symbol>; //string | number | boolean | null | undefined;
4048
- interface SchemaPartInternals extends $ZodTypeInternals<LiteralPart, LiteralPart> {
4049
- pattern: RegExp;
4050
- }
4051
- interface SchemaPart extends $ZodType {
4052
- _zod: SchemaPartInternals;
4053
- }
4054
- export type $ZodTemplateLiteralPart = LiteralPart | SchemaPart;
4055
-
4056
- type UndefinedToEmptyString<T> = T extends undefined ? "" : T;
4057
- type AppendToTemplateLiteral<
4058
- Template extends string,
4059
- Suffix extends LiteralPart | $ZodType,
4060
- > = Suffix extends LiteralPart
4061
- ? `${Template}${UndefinedToEmptyString<Suffix>}`
4062
- : Suffix extends $ZodType
4063
- ? `${Template}${core.output<Suffix> extends infer T extends LiteralPart ? UndefinedToEmptyString<T> : never}`
4064
- : never;
4065
-
4066
- export type ConcatenateTupleOfStrings<T extends string[]> = T extends [
4067
- infer First extends string,
4068
- ...infer Rest extends string[],
4069
- ]
4070
- ? Rest extends string[]
4071
- ? First extends ""
4072
- ? ConcatenateTupleOfStrings<Rest>
4073
- : `${First}${ConcatenateTupleOfStrings<Rest>}`
4074
- : never
4075
- : "";
4076
- export type ConvertPartsToStringTuple<Parts extends $ZodTemplateLiteralPart[]> = {
4077
- [K in keyof Parts]: Parts[K] extends LiteralPart
4078
- ? `${UndefinedToEmptyString<Parts[K]>}`
4079
- : Parts[K] extends $ZodType
4080
- ? `${core.output<Parts[K]> extends infer T extends LiteralPart ? UndefinedToEmptyString<T> : never}`
4081
- : never;
4082
- };
4083
-
4084
- export type ToTemplateLiteral<Parts extends $ZodTemplateLiteralPart[]> = ConcatenateTupleOfStrings<
4085
- ConvertPartsToStringTuple<Parts>
4086
- >;
4087
- // type lkjasd = ConcatenateTupleOfStrings<["Hello", " ", "World", "!"]>; // "Hello World!"
4088
- export type $PartsToTemplateLiteral<Parts extends $ZodTemplateLiteralPart[]> = [] extends Parts
4089
- ? ``
4090
- : Parts extends [...infer Rest, infer Last extends $ZodTemplateLiteralPart]
4091
- ? Rest extends $ZodTemplateLiteralPart[]
4092
- ? AppendToTemplateLiteral<$PartsToTemplateLiteral<Rest>, Last>
4093
- : never
4094
- : never;
4095
-
4096
- export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__PURE__*/ core.$constructor(
4097
- "$ZodTemplateLiteral",
4098
- (inst, def) => {
4099
- $ZodType.init(inst, def);
4100
- const regexParts: string[] = [];
4101
- for (const part of def.parts) {
4102
- if (typeof part === "object" && part !== null) {
4103
- // is Zod schema
4104
- if (!part._zod.pattern) {
4105
- // if (!source)
4106
- throw new Error(`Invalid template literal part, no pattern found: ${[...(part as any)._zod.traits].shift()}`);
4107
- }
4108
-
4109
- const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
4110
-
4111
- if (!source) throw new Error(`Invalid template literal part: ${part._zod.traits}`);
4112
-
4113
- const start = source.startsWith("^") ? 1 : 0;
4114
- const end = source.endsWith("$") ? source.length - 1 : source.length;
4115
- regexParts.push(source.slice(start, end));
4116
- } else if (part === null || util.primitiveTypes.has(typeof part)) {
4117
- regexParts.push(util.escapeRegex(`${part}`));
4118
- } else {
4119
- throw new Error(`Invalid template literal part: ${part}`);
4120
- }
4121
- }
4122
- inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);
4123
-
4124
- inst._zod.parse = (payload, _ctx) => {
4125
- if (typeof payload.value !== "string") {
4126
- payload.issues.push({
4127
- input: payload.value,
4128
- inst,
4129
- expected: "string",
4130
- code: "invalid_type",
4131
- });
4132
- return payload;
4133
- }
4134
-
4135
- inst._zod.pattern.lastIndex = 0;
4136
-
4137
- if (!inst._zod.pattern.test(payload.value)) {
4138
- payload.issues.push({
4139
- input: payload.value,
4140
- inst,
4141
-
4142
- code: "invalid_format",
4143
- format: def.format ?? "template_literal",
4144
- pattern: inst._zod.pattern.source,
4145
- });
4146
- return payload;
4147
- }
4148
-
4149
- return payload;
4150
- };
4151
- }
4152
- );
4153
-
4154
- //////////////////////////////////////////
4155
- //////////////////////////////////////////
4156
- ////////// //////////
4157
- ////////// $ZodFunction //////////
4158
- ////////// //////////
4159
- //////////////////////////////////////////
4160
- //////////////////////////////////////////
4161
- export type $ZodFunctionArgs = $ZodType<unknown[], unknown[]>;
4162
- export type $ZodFunctionIn = $ZodFunctionArgs;
4163
- export type $ZodFunctionOut = $ZodType;
4164
-
4165
- export type $InferInnerFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
4166
- ...args: $ZodFunctionIn extends Args ? never[] : core.output<Args>
4167
- ) => core.input<Returns>;
4168
-
4169
- export type $InferInnerFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
4170
- ...args: $ZodFunctionIn extends Args ? never[] : core.output<Args>
4171
- ) => util.MaybeAsync<core.input<Returns>>;
4172
-
4173
- export type $InferOuterFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
4174
- ...args: $ZodFunctionIn extends Args ? never[] : core.input<Args>
4175
- ) => core.output<Returns>;
4176
-
4177
- export type $InferOuterFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
4178
- ...args: $ZodFunctionIn extends Args ? never[] : core.input<Args>
4179
- ) => Promise<core.output<Returns>>;
4180
-
4181
- export interface $ZodFunctionDef<
4182
- In extends $ZodFunctionIn = $ZodFunctionIn,
4183
- Out extends $ZodFunctionOut = $ZodFunctionOut,
4184
- > extends $ZodTypeDef {
4185
- type: "function";
4186
- input: In;
4187
- output: Out;
4188
- }
4189
-
4190
- export interface $ZodFunctionInternals<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut>
4191
- extends $ZodTypeInternals<$InferOuterFunctionType<Args, Returns>, $InferInnerFunctionType<Args, Returns>> {
4192
- def: $ZodFunctionDef<Args, Returns>;
4193
- isst: errors.$ZodIssueInvalidType;
4194
- }
4195
-
4196
- export interface $ZodFunction<
4197
- Args extends $ZodFunctionIn = $ZodFunctionIn,
4198
- Returns extends $ZodFunctionOut = $ZodFunctionOut,
4199
- > extends $ZodType<any, any, $ZodFunctionInternals<Args, Returns>> {
4200
- /** @deprecated */
4201
- _def: $ZodFunctionDef<Args, Returns>;
4202
- _input: $InferInnerFunctionType<Args, Returns>;
4203
- _output: $InferOuterFunctionType<Args, Returns>;
4204
-
4205
- implement<F extends $InferInnerFunctionType<Args, Returns>>(
4206
- func: F
4207
- ): // allow for return type inference
4208
- (
4209
- ...args: Parameters<this["_output"]>
4210
- ) => ReturnType<F> extends ReturnType<this["_output"]> ? ReturnType<F> : ReturnType<this["_output"]>;
4211
-
4212
- implementAsync<F extends $InferInnerFunctionTypeAsync<Args, Returns>>(
4213
- func: F
4214
- ): F extends $InferOuterFunctionTypeAsync<Args, Returns> ? F : $InferOuterFunctionTypeAsync<Args, Returns>;
4215
-
4216
- input<const Items extends util.TupleItems, const Rest extends $ZodFunctionOut = $ZodFunctionOut>(
4217
- args: Items,
4218
- rest?: Rest
4219
- ): $ZodFunction<$ZodTuple<Items, Rest>, Returns>;
4220
- input<NewArgs extends $ZodFunctionIn>(args: NewArgs): $ZodFunction<NewArgs, Returns>;
4221
- input(...args: any[]): $ZodFunction<any, Returns>;
4222
-
4223
- output<NewReturns extends $ZodType>(output: NewReturns): $ZodFunction<Args, NewReturns>;
4224
- }
4225
-
4226
- export interface $ZodFunctionParams<I extends $ZodFunctionIn, O extends $ZodType> {
4227
- input?: I;
4228
- output?: O;
4229
- }
4230
-
4231
- export const $ZodFunction: core.$constructor<$ZodFunction> = /*@__PURE__*/ core.$constructor(
4232
- "$ZodFunction",
4233
- (inst, def) => {
4234
- $ZodType.init(inst, def);
4235
- inst._def = def;
4236
- inst._zod.def = def;
4237
-
4238
- inst.implement = (func) => {
4239
- if (typeof func !== "function") {
4240
- throw new Error("implement() must be called with a function");
4241
- }
4242
- return function (this: any, ...args: never[]) {
4243
- const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
4244
- const result = Reflect.apply(func, this, parsedArgs as never[]);
4245
- if (inst._def.output) {
4246
- return parse(inst._def.output, result);
4247
- }
4248
- return result as any;
4249
- };
4250
- };
4251
-
4252
- inst.implementAsync = (func) => {
4253
- if (typeof func !== "function") {
4254
- throw new Error("implementAsync() must be called with a function");
4255
- }
4256
- return async function (this: any, ...args: never[]) {
4257
- const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
4258
- const result = await Reflect.apply(func, this, parsedArgs as never[]);
4259
- if (inst._def.output) {
4260
- return await parseAsync(inst._def.output, result);
4261
- }
4262
- return result;
4263
- } as any;
4264
- };
4265
-
4266
- inst._zod.parse = (payload, _ctx) => {
4267
- if (typeof payload.value !== "function") {
4268
- payload.issues.push({
4269
- code: "invalid_type",
4270
- expected: "function",
4271
- input: payload.value,
4272
- inst,
4273
- });
4274
- return payload;
4275
- }
4276
-
4277
- // Check if output is a promise type to determine if we should use async implementation
4278
- const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === "promise";
4279
-
4280
- if (hasPromiseOutput) {
4281
- payload.value = inst.implementAsync(payload.value);
4282
- } else {
4283
- payload.value = inst.implement(payload.value);
4284
- }
4285
- return payload;
4286
- };
4287
-
4288
- inst.input = (...args: any[]): $ZodFunction<any, any> => {
4289
- const F: any = inst.constructor;
4290
- if (Array.isArray(args[0])) {
4291
- return new F({
4292
- type: "function",
4293
- input: new $ZodTuple({
4294
- type: "tuple",
4295
- items: args[0],
4296
- rest: args[1],
4297
- }),
4298
- output: inst._def.output,
4299
- });
4300
- }
4301
-
4302
- return new F({
4303
- type: "function",
4304
- input: args[0],
4305
- output: inst._def.output,
4306
- });
4307
- };
4308
-
4309
- inst.output = (output) => {
4310
- const F: any = inst.constructor;
4311
- return new F({
4312
- type: "function",
4313
- input: inst._def.input,
4314
- output,
4315
- });
4316
- };
4317
-
4318
- return inst;
4319
- }
4320
- );
4321
-
4322
- /////////////////////////////////////////
4323
- /////////////////////////////////////////
4324
- ////////// //////////
4325
- ////////// $ZodPromise //////////
4326
- ////////// //////////
4327
- /////////////////////////////////////////
4328
- /////////////////////////////////////////
4329
- export interface $ZodPromiseDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
4330
- type: "promise";
4331
- innerType: T;
4332
- }
4333
-
4334
- export interface $ZodPromiseInternals<T extends SomeType = $ZodType>
4335
- extends $ZodTypeInternals<Promise<core.output<T>>, util.MaybeAsync<core.input<T>>> {
4336
- def: $ZodPromiseDef<T>;
4337
- isst: never;
4338
- }
4339
-
4340
- export interface $ZodPromise<T extends SomeType = $ZodType> extends $ZodType {
4341
- _zod: $ZodPromiseInternals<T>;
4342
- }
4343
-
4344
- export const $ZodPromise: core.$constructor<$ZodPromise> = /*@__PURE__*/ core.$constructor(
4345
- "$ZodPromise",
4346
- (inst, def) => {
4347
- $ZodType.init(inst, def);
4348
-
4349
- inst._zod.parse = (payload, ctx) => {
4350
- return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));
4351
- };
4352
- }
4353
- );
4354
-
4355
- //////////////////////////////////////////
4356
- //////////////////////////////////////////
4357
- ////////// //////////
4358
- ////////// $ZodLazy //////////
4359
- ////////// //////////
4360
- //////////////////////////////////////////
4361
- //////////////////////////////////////////
4362
-
4363
- export interface $ZodLazyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
4364
- type: "lazy";
4365
- getter: () => T;
4366
- }
4367
-
4368
- export interface $ZodLazyInternals<T extends SomeType = $ZodType>
4369
- extends $ZodTypeInternals<core.output<T>, core.input<T>> {
4370
- def: $ZodLazyDef<T>;
4371
- isst: never;
4372
- /** Auto-cached way to retrieve the inner schema */
4373
- innerType: T;
4374
- pattern: T["_zod"]["pattern"];
4375
- propValues: T["_zod"]["propValues"];
4376
- optin: T["_zod"]["optin"];
4377
- optout: T["_zod"]["optout"];
4378
- }
4379
-
4380
- export interface $ZodLazy<T extends SomeType = $ZodType> extends $ZodType {
4381
- _zod: $ZodLazyInternals<T>;
4382
- }
4383
-
4384
- export const $ZodLazy: core.$constructor<$ZodLazy> = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def) => {
4385
- $ZodType.init(inst, def);
4386
-
4387
- // let _innerType!: any;
4388
- // util.defineLazy(def, "getter", () => {
4389
- // if (!_innerType) {
4390
- // _innerType = def.getter();
4391
- // }
4392
- // return () => _innerType;
4393
- // });
4394
- util.defineLazy(inst._zod, "innerType", () => def.getter() as $ZodType);
4395
- util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
4396
- util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
4397
- util.defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? undefined);
4398
- util.defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? undefined);
4399
- inst._zod.parse = (payload, ctx) => {
4400
- const inner = inst._zod.innerType;
4401
- return inner._zod.run(payload, ctx);
4402
- };
4403
- });
4404
-
4405
- ////////////////////////////////////////
4406
- ////////////////////////////////////////
4407
- ////////// //////////
4408
- ////////// $ZodCustom //////////
4409
- ////////// //////////
4410
- ////////////////////////////////////////
4411
- ////////////////////////////////////////
4412
- export interface $ZodCustomDef<O = unknown> extends $ZodTypeDef, checks.$ZodCheckDef {
4413
- type: "custom";
4414
- check: "custom";
4415
- path?: PropertyKey[] | undefined;
4416
- error?: errors.$ZodErrorMap | undefined;
4417
- params?: Record<string, any> | undefined;
4418
- fn: (arg: O) => unknown;
4419
- }
4420
-
4421
- export interface $ZodCustomInternals<O = unknown, I = unknown>
4422
- extends $ZodTypeInternals<O, I>,
4423
- checks.$ZodCheckInternals<O> {
4424
- def: $ZodCustomDef;
4425
- issc: errors.$ZodIssue;
4426
- isst: never;
4427
- bag: util.LoosePartial<{
4428
- Class: typeof util.Class;
4429
- }>;
4430
- }
4431
-
4432
- export interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
4433
- _zod: $ZodCustomInternals<O, I>;
4434
- }
4435
-
4436
- export const $ZodCustom: core.$constructor<$ZodCustom> = /*@__PURE__*/ core.$constructor("$ZodCustom", (inst, def) => {
4437
- checks.$ZodCheck.init(inst, def);
4438
- $ZodType.init(inst, def);
4439
-
4440
- inst._zod.parse = (payload, _) => {
4441
- return payload;
4442
- };
4443
-
4444
- inst._zod.check = (payload) => {
4445
- const input = payload.value;
4446
- const r = def.fn(input as any);
4447
- if (r instanceof Promise) {
4448
- return r.then((r) => handleRefineResult(r, payload, input, inst));
4449
- }
4450
- handleRefineResult(r, payload, input, inst);
4451
- return;
4452
- };
4453
- });
4454
-
4455
- function handleRefineResult(result: unknown, payload: ParsePayload, input: unknown, inst: $ZodCustom): void {
4456
- if (!result) {
4457
- const _iss: any = {
4458
- code: "custom",
4459
- input,
4460
- inst, // incorporates params.error into issue reporting
4461
- path: [...(inst._zod.def.path ?? [])], // incorporates params.error into issue reporting
4462
- continue: !inst._zod.def.abort,
4463
- // params: inst._zod.def.params,
4464
- };
4465
- if (inst._zod.def.params) _iss.params = inst._zod.def.params;
4466
- payload.issues.push(util.issue(_iss));
4467
- }
4468
- }
4469
-
4470
- export type $ZodTypes =
4471
- | $ZodString
4472
- | $ZodNumber
4473
- | $ZodBigInt
4474
- | $ZodBoolean
4475
- | $ZodDate
4476
- | $ZodSymbol
4477
- | $ZodUndefined
4478
- | $ZodNullable
4479
- | $ZodNull
4480
- | $ZodAny
4481
- | $ZodUnknown
4482
- | $ZodNever
4483
- | $ZodVoid
4484
- | $ZodArray
4485
- | $ZodObject
4486
- | $ZodUnion
4487
- | $ZodIntersection
4488
- | $ZodTuple
4489
- | $ZodRecord
4490
- | $ZodMap
4491
- | $ZodSet
4492
- | $ZodLiteral
4493
- | $ZodEnum
4494
- | $ZodFunction
4495
- | $ZodPromise
4496
- | $ZodLazy
4497
- | $ZodOptional
4498
- | $ZodDefault
4499
- | $ZodPrefault
4500
- | $ZodTemplateLiteral
4501
- | $ZodCustom
4502
- | $ZodTransform
4503
- | $ZodNonOptional
4504
- | $ZodReadonly
4505
- | $ZodNaN
4506
- | $ZodPipe
4507
- | $ZodSuccess
4508
- | $ZodCatch
4509
- | $ZodFile;
4510
-
4511
- export type $ZodStringFormatTypes =
4512
- | $ZodGUID
4513
- | $ZodUUID
4514
- | $ZodEmail
4515
- | $ZodURL
4516
- | $ZodEmoji
4517
- | $ZodNanoID
4518
- | $ZodCUID
4519
- | $ZodCUID2
4520
- | $ZodULID
4521
- | $ZodXID
4522
- | $ZodKSUID
4523
- | $ZodISODateTime
4524
- | $ZodISODate
4525
- | $ZodISOTime
4526
- | $ZodISODuration
4527
- | $ZodIPv4
4528
- | $ZodIPv6
4529
- | $ZodMAC
4530
- | $ZodCIDRv4
4531
- | $ZodCIDRv6
4532
- | $ZodBase64
4533
- | $ZodBase64URL
4534
- | $ZodE164
4535
- | $ZodJWT
4536
- | $ZodCustomStringFormat<"hex">
4537
- | $ZodCustomStringFormat<util.HashFormat>
4538
- | $ZodCustomStringFormat<"hostname">;