@deriv-com/fe-mcp-servers 0.0.4 → 0.0.5

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 (772) hide show
  1. package/README.md +53 -27
  2. package/package.json +4 -4
  3. package/node_modules/@modelcontextprotocol/sdk/LICENSE +0 -21
  4. package/node_modules/@modelcontextprotocol/sdk/README.md +0 -105
  5. package/node_modules/@modelcontextprotocol/sdk/dist/cli.d.ts +0 -2
  6. package/node_modules/@modelcontextprotocol/sdk/dist/cli.d.ts.map +0 -1
  7. package/node_modules/@modelcontextprotocol/sdk/dist/cli.js +0 -129
  8. package/node_modules/@modelcontextprotocol/sdk/dist/cli.js.map +0 -1
  9. package/node_modules/@modelcontextprotocol/sdk/dist/client/index.d.ts +0 -773
  10. package/node_modules/@modelcontextprotocol/sdk/dist/client/index.d.ts.map +0 -1
  11. package/node_modules/@modelcontextprotocol/sdk/dist/client/index.js +0 -206
  12. package/node_modules/@modelcontextprotocol/sdk/dist/client/index.js.map +0 -1
  13. package/node_modules/@modelcontextprotocol/sdk/dist/client/index.test.d.ts +0 -2
  14. package/node_modules/@modelcontextprotocol/sdk/dist/client/index.test.d.ts.map +0 -1
  15. package/node_modules/@modelcontextprotocol/sdk/dist/client/index.test.js +0 -393
  16. package/node_modules/@modelcontextprotocol/sdk/dist/client/index.test.js.map +0 -1
  17. package/node_modules/@modelcontextprotocol/sdk/dist/client/sse.d.ts +0 -22
  18. package/node_modules/@modelcontextprotocol/sdk/dist/client/sse.d.ts.map +0 -1
  19. package/node_modules/@modelcontextprotocol/sdk/dist/client/sse.js +0 -91
  20. package/node_modules/@modelcontextprotocol/sdk/dist/client/sse.js.map +0 -1
  21. package/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.d.ts +0 -56
  22. package/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.d.ts.map +0 -1
  23. package/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.js +0 -147
  24. package/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.js.map +0 -1
  25. package/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.test.d.ts +0 -2
  26. package/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.test.d.ts.map +0 -1
  27. package/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.test.js +0 -51
  28. package/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.test.js.map +0 -1
  29. package/node_modules/@modelcontextprotocol/sdk/dist/client/websocket.d.ts +0 -17
  30. package/node_modules/@modelcontextprotocol/sdk/dist/client/websocket.d.ts.map +0 -1
  31. package/node_modules/@modelcontextprotocol/sdk/dist/client/websocket.js +0 -61
  32. package/node_modules/@modelcontextprotocol/sdk/dist/client/websocket.js.map +0 -1
  33. package/node_modules/@modelcontextprotocol/sdk/dist/inMemory.d.ts +0 -20
  34. package/node_modules/@modelcontextprotocol/sdk/dist/inMemory.d.ts.map +0 -1
  35. package/node_modules/@modelcontextprotocol/sdk/dist/inMemory.js +0 -47
  36. package/node_modules/@modelcontextprotocol/sdk/dist/inMemory.js.map +0 -1
  37. package/node_modules/@modelcontextprotocol/sdk/dist/inMemory.test.d.ts +0 -2
  38. package/node_modules/@modelcontextprotocol/sdk/dist/inMemory.test.d.ts.map +0 -1
  39. package/node_modules/@modelcontextprotocol/sdk/dist/inMemory.test.js +0 -74
  40. package/node_modules/@modelcontextprotocol/sdk/dist/inMemory.test.js.map +0 -1
  41. package/node_modules/@modelcontextprotocol/sdk/dist/server/index.d.ts +0 -112
  42. package/node_modules/@modelcontextprotocol/sdk/dist/server/index.d.ts.map +0 -1
  43. package/node_modules/@modelcontextprotocol/sdk/dist/server/index.js +0 -182
  44. package/node_modules/@modelcontextprotocol/sdk/dist/server/index.js.map +0 -1
  45. package/node_modules/@modelcontextprotocol/sdk/dist/server/index.test.d.ts +0 -2
  46. package/node_modules/@modelcontextprotocol/sdk/dist/server/index.test.d.ts.map +0 -1
  47. package/node_modules/@modelcontextprotocol/sdk/dist/server/index.test.js +0 -408
  48. package/node_modules/@modelcontextprotocol/sdk/dist/server/index.test.js.map +0 -1
  49. package/node_modules/@modelcontextprotocol/sdk/dist/server/sse.d.ts +0 -46
  50. package/node_modules/@modelcontextprotocol/sdk/dist/server/sse.d.ts.map +0 -1
  51. package/node_modules/@modelcontextprotocol/sdk/dist/server/sse.js +0 -116
  52. package/node_modules/@modelcontextprotocol/sdk/dist/server/sse.js.map +0 -1
  53. package/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.d.ts +0 -28
  54. package/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.d.ts.map +0 -1
  55. package/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.js +0 -69
  56. package/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.js.map +0 -1
  57. package/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.test.d.ts +0 -2
  58. package/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.test.d.ts.map +0 -1
  59. package/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.test.js +0 -87
  60. package/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.test.js.map +0 -1
  61. package/node_modules/@modelcontextprotocol/sdk/dist/shared/protocol.d.ts +0 -157
  62. package/node_modules/@modelcontextprotocol/sdk/dist/shared/protocol.d.ts.map +0 -1
  63. package/node_modules/@modelcontextprotocol/sdk/dist/shared/protocol.js +0 -297
  64. package/node_modules/@modelcontextprotocol/sdk/dist/shared/protocol.js.map +0 -1
  65. package/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.d.ts +0 -13
  66. package/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.d.ts.map +0 -1
  67. package/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.js +0 -31
  68. package/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.js.map +0 -1
  69. package/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.test.d.ts +0 -2
  70. package/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.test.d.ts.map +0 -1
  71. package/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.test.js +0 -27
  72. package/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.test.js.map +0 -1
  73. package/node_modules/@modelcontextprotocol/sdk/dist/shared/transport.d.ts +0 -39
  74. package/node_modules/@modelcontextprotocol/sdk/dist/shared/transport.d.ts.map +0 -1
  75. package/node_modules/@modelcontextprotocol/sdk/dist/shared/transport.js +0 -2
  76. package/node_modules/@modelcontextprotocol/sdk/dist/shared/transport.js.map +0 -1
  77. package/node_modules/@modelcontextprotocol/sdk/dist/types.d.ts +0 -26425
  78. package/node_modules/@modelcontextprotocol/sdk/dist/types.d.ts.map +0 -1
  79. package/node_modules/@modelcontextprotocol/sdk/dist/types.js +0 -997
  80. package/node_modules/@modelcontextprotocol/sdk/dist/types.js.map +0 -1
  81. package/node_modules/@modelcontextprotocol/sdk/package.json +0 -61
  82. package/node_modules/bytes/History.md +0 -97
  83. package/node_modules/bytes/LICENSE +0 -23
  84. package/node_modules/bytes/Readme.md +0 -152
  85. package/node_modules/bytes/index.js +0 -170
  86. package/node_modules/bytes/package.json +0 -42
  87. package/node_modules/content-type/HISTORY.md +0 -29
  88. package/node_modules/content-type/LICENSE +0 -22
  89. package/node_modules/content-type/README.md +0 -94
  90. package/node_modules/content-type/index.js +0 -225
  91. package/node_modules/content-type/package.json +0 -42
  92. package/node_modules/depd/History.md +0 -103
  93. package/node_modules/depd/LICENSE +0 -22
  94. package/node_modules/depd/Readme.md +0 -280
  95. package/node_modules/depd/index.js +0 -538
  96. package/node_modules/depd/lib/browser/index.js +0 -77
  97. package/node_modules/depd/package.json +0 -45
  98. package/node_modules/http-errors/HISTORY.md +0 -180
  99. package/node_modules/http-errors/LICENSE +0 -23
  100. package/node_modules/http-errors/README.md +0 -169
  101. package/node_modules/http-errors/index.js +0 -289
  102. package/node_modules/http-errors/package.json +0 -50
  103. package/node_modules/iconv-lite/.github/dependabot.yml +0 -11
  104. package/node_modules/iconv-lite/.idea/codeStyles/Project.xml +0 -47
  105. package/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml +0 -5
  106. package/node_modules/iconv-lite/.idea/iconv-lite.iml +0 -12
  107. package/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml +0 -6
  108. package/node_modules/iconv-lite/.idea/modules.xml +0 -8
  109. package/node_modules/iconv-lite/.idea/vcs.xml +0 -6
  110. package/node_modules/iconv-lite/Changelog.md +0 -212
  111. package/node_modules/iconv-lite/LICENSE +0 -21
  112. package/node_modules/iconv-lite/README.md +0 -130
  113. package/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -597
  114. package/node_modules/iconv-lite/encodings/dbcs-data.js +0 -188
  115. package/node_modules/iconv-lite/encodings/index.js +0 -23
  116. package/node_modules/iconv-lite/encodings/internal.js +0 -198
  117. package/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -72
  118. package/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
  119. package/node_modules/iconv-lite/encodings/sbcs-data.js +0 -179
  120. package/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
  121. package/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
  122. package/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
  123. package/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
  124. package/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
  125. package/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
  126. package/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -56
  127. package/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
  128. package/node_modules/iconv-lite/encodings/utf16.js +0 -197
  129. package/node_modules/iconv-lite/encodings/utf32.js +0 -319
  130. package/node_modules/iconv-lite/encodings/utf7.js +0 -290
  131. package/node_modules/iconv-lite/lib/bom-handling.js +0 -52
  132. package/node_modules/iconv-lite/lib/index.d.ts +0 -41
  133. package/node_modules/iconv-lite/lib/index.js +0 -180
  134. package/node_modules/iconv-lite/lib/streams.js +0 -109
  135. package/node_modules/iconv-lite/package.json +0 -44
  136. package/node_modules/inherits/LICENSE +0 -16
  137. package/node_modules/inherits/README.md +0 -42
  138. package/node_modules/inherits/inherits.js +0 -9
  139. package/node_modules/inherits/inherits_browser.js +0 -27
  140. package/node_modules/inherits/package.json +0 -29
  141. package/node_modules/raw-body/HISTORY.md +0 -325
  142. package/node_modules/raw-body/LICENSE +0 -22
  143. package/node_modules/raw-body/README.md +0 -223
  144. package/node_modules/raw-body/SECURITY.md +0 -24
  145. package/node_modules/raw-body/index.d.ts +0 -85
  146. package/node_modules/raw-body/index.js +0 -336
  147. package/node_modules/raw-body/package.json +0 -50
  148. package/node_modules/safer-buffer/LICENSE +0 -21
  149. package/node_modules/safer-buffer/Porting-Buffer.md +0 -268
  150. package/node_modules/safer-buffer/Readme.md +0 -156
  151. package/node_modules/safer-buffer/dangerous.js +0 -58
  152. package/node_modules/safer-buffer/package.json +0 -34
  153. package/node_modules/safer-buffer/safer.js +0 -77
  154. package/node_modules/safer-buffer/tests.js +0 -406
  155. package/node_modules/setprototypeof/LICENSE +0 -13
  156. package/node_modules/setprototypeof/README.md +0 -31
  157. package/node_modules/setprototypeof/index.d.ts +0 -2
  158. package/node_modules/setprototypeof/index.js +0 -17
  159. package/node_modules/setprototypeof/package.json +0 -38
  160. package/node_modules/setprototypeof/test/index.js +0 -24
  161. package/node_modules/statuses/HISTORY.md +0 -82
  162. package/node_modules/statuses/LICENSE +0 -23
  163. package/node_modules/statuses/README.md +0 -136
  164. package/node_modules/statuses/codes.json +0 -65
  165. package/node_modules/statuses/index.js +0 -146
  166. package/node_modules/statuses/package.json +0 -49
  167. package/node_modules/toidentifier/HISTORY.md +0 -9
  168. package/node_modules/toidentifier/LICENSE +0 -21
  169. package/node_modules/toidentifier/README.md +0 -61
  170. package/node_modules/toidentifier/index.js +0 -32
  171. package/node_modules/toidentifier/package.json +0 -38
  172. package/node_modules/unpipe/HISTORY.md +0 -4
  173. package/node_modules/unpipe/LICENSE +0 -22
  174. package/node_modules/unpipe/README.md +0 -43
  175. package/node_modules/unpipe/index.js +0 -69
  176. package/node_modules/unpipe/package.json +0 -27
  177. package/node_modules/zod/LICENSE +0 -21
  178. package/node_modules/zod/README.md +0 -208
  179. package/node_modules/zod/index.cjs +0 -33
  180. package/node_modules/zod/index.d.cts +0 -4
  181. package/node_modules/zod/index.d.ts +0 -4
  182. package/node_modules/zod/index.js +0 -4
  183. package/node_modules/zod/package.json +0 -118
  184. package/node_modules/zod/src/index.ts +0 -4
  185. package/node_modules/zod/src/v3/ZodError.ts +0 -330
  186. package/node_modules/zod/src/v3/benchmarks/datetime.ts +0 -58
  187. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +0 -80
  188. package/node_modules/zod/src/v3/benchmarks/index.ts +0 -59
  189. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +0 -57
  190. package/node_modules/zod/src/v3/benchmarks/object.ts +0 -69
  191. package/node_modules/zod/src/v3/benchmarks/primitives.ts +0 -162
  192. package/node_modules/zod/src/v3/benchmarks/realworld.ts +0 -63
  193. package/node_modules/zod/src/v3/benchmarks/string.ts +0 -55
  194. package/node_modules/zod/src/v3/benchmarks/union.ts +0 -80
  195. package/node_modules/zod/src/v3/errors.ts +0 -13
  196. package/node_modules/zod/src/v3/external.ts +0 -6
  197. package/node_modules/zod/src/v3/helpers/enumUtil.ts +0 -17
  198. package/node_modules/zod/src/v3/helpers/errorUtil.ts +0 -8
  199. package/node_modules/zod/src/v3/helpers/parseUtil.ts +0 -176
  200. package/node_modules/zod/src/v3/helpers/partialUtil.ts +0 -34
  201. package/node_modules/zod/src/v3/helpers/typeAliases.ts +0 -2
  202. package/node_modules/zod/src/v3/helpers/util.ts +0 -224
  203. package/node_modules/zod/src/v3/index.ts +0 -4
  204. package/node_modules/zod/src/v3/locales/en.ts +0 -124
  205. package/node_modules/zod/src/v3/standard-schema.ts +0 -113
  206. package/node_modules/zod/src/v3/tests/Mocker.ts +0 -54
  207. package/node_modules/zod/src/v3/tests/all-errors.test.ts +0 -157
  208. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +0 -28
  209. package/node_modules/zod/src/v3/tests/array.test.ts +0 -71
  210. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +0 -388
  211. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +0 -46
  212. package/node_modules/zod/src/v3/tests/base.test.ts +0 -29
  213. package/node_modules/zod/src/v3/tests/bigint.test.ts +0 -55
  214. package/node_modules/zod/src/v3/tests/branded.test.ts +0 -53
  215. package/node_modules/zod/src/v3/tests/catch.test.ts +0 -220
  216. package/node_modules/zod/src/v3/tests/coerce.test.ts +0 -133
  217. package/node_modules/zod/src/v3/tests/complex.test.ts +0 -56
  218. package/node_modules/zod/src/v3/tests/custom.test.ts +0 -31
  219. package/node_modules/zod/src/v3/tests/date.test.ts +0 -32
  220. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +0 -186
  221. package/node_modules/zod/src/v3/tests/default.test.ts +0 -112
  222. package/node_modules/zod/src/v3/tests/description.test.ts +0 -33
  223. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +0 -315
  224. package/node_modules/zod/src/v3/tests/enum.test.ts +0 -80
  225. package/node_modules/zod/src/v3/tests/error.test.ts +0 -551
  226. package/node_modules/zod/src/v3/tests/firstparty.test.ts +0 -87
  227. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +0 -21
  228. package/node_modules/zod/src/v3/tests/function.test.ts +0 -257
  229. package/node_modules/zod/src/v3/tests/generics.test.ts +0 -48
  230. package/node_modules/zod/src/v3/tests/instanceof.test.ts +0 -37
  231. package/node_modules/zod/src/v3/tests/intersection.test.ts +0 -110
  232. package/node_modules/zod/src/v3/tests/language-server.source.ts +0 -76
  233. package/node_modules/zod/src/v3/tests/language-server.test.ts +0 -207
  234. package/node_modules/zod/src/v3/tests/literal.test.ts +0 -36
  235. package/node_modules/zod/src/v3/tests/map.test.ts +0 -110
  236. package/node_modules/zod/src/v3/tests/masking.test.ts +0 -4
  237. package/node_modules/zod/src/v3/tests/mocker.test.ts +0 -19
  238. package/node_modules/zod/src/v3/tests/nan.test.ts +0 -21
  239. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +0 -87
  240. package/node_modules/zod/src/v3/tests/nullable.test.ts +0 -42
  241. package/node_modules/zod/src/v3/tests/number.test.ts +0 -176
  242. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +0 -29
  243. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +0 -29
  244. package/node_modules/zod/src/v3/tests/object.test.ts +0 -434
  245. package/node_modules/zod/src/v3/tests/optional.test.ts +0 -42
  246. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +0 -23
  247. package/node_modules/zod/src/v3/tests/parser.test.ts +0 -41
  248. package/node_modules/zod/src/v3/tests/partials.test.ts +0 -243
  249. package/node_modules/zod/src/v3/tests/pickomit.test.ts +0 -111
  250. package/node_modules/zod/src/v3/tests/pipeline.test.ts +0 -29
  251. package/node_modules/zod/src/v3/tests/preprocess.test.ts +0 -186
  252. package/node_modules/zod/src/v3/tests/primitive.test.ts +0 -440
  253. package/node_modules/zod/src/v3/tests/promise.test.ts +0 -90
  254. package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -194
  255. package/node_modules/zod/src/v3/tests/record.test.ts +0 -171
  256. package/node_modules/zod/src/v3/tests/recursive.test.ts +0 -197
  257. package/node_modules/zod/src/v3/tests/refine.test.ts +0 -313
  258. package/node_modules/zod/src/v3/tests/safeparse.test.ts +0 -27
  259. package/node_modules/zod/src/v3/tests/set.test.ts +0 -142
  260. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +0 -83
  261. package/node_modules/zod/src/v3/tests/string.test.ts +0 -916
  262. package/node_modules/zod/src/v3/tests/transformer.test.ts +0 -233
  263. package/node_modules/zod/src/v3/tests/tuple.test.ts +0 -90
  264. package/node_modules/zod/src/v3/tests/unions.test.ts +0 -57
  265. package/node_modules/zod/src/v3/tests/validations.test.ts +0 -133
  266. package/node_modules/zod/src/v3/tests/void.test.ts +0 -15
  267. package/node_modules/zod/src/v3/types.ts +0 -5136
  268. package/node_modules/zod/src/v4/classic/checks.ts +0 -30
  269. package/node_modules/zod/src/v4/classic/coerce.ts +0 -27
  270. package/node_modules/zod/src/v4/classic/compat.ts +0 -66
  271. package/node_modules/zod/src/v4/classic/errors.ts +0 -75
  272. package/node_modules/zod/src/v4/classic/external.ts +0 -50
  273. package/node_modules/zod/src/v4/classic/index.ts +0 -5
  274. package/node_modules/zod/src/v4/classic/iso.ts +0 -90
  275. package/node_modules/zod/src/v4/classic/parse.ts +0 -33
  276. package/node_modules/zod/src/v4/classic/schemas.ts +0 -2054
  277. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +0 -26
  278. package/node_modules/zod/src/v4/classic/tests/array.test.ts +0 -264
  279. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +0 -210
  280. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +0 -381
  281. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +0 -68
  282. package/node_modules/zod/src/v4/classic/tests/base.test.ts +0 -7
  283. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +0 -54
  284. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +0 -63
  285. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +0 -252
  286. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +0 -20
  287. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +0 -160
  288. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +0 -352
  289. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +0 -40
  290. package/node_modules/zod/src/v4/classic/tests/date.test.ts +0 -31
  291. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +0 -296
  292. package/node_modules/zod/src/v4/classic/tests/default.test.ts +0 -313
  293. package/node_modules/zod/src/v4/classic/tests/description.test.ts +0 -32
  294. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +0 -619
  295. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +0 -285
  296. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +0 -527
  297. package/node_modules/zod/src/v4/classic/tests/error.test.ts +0 -711
  298. package/node_modules/zod/src/v4/classic/tests/file.test.ts +0 -91
  299. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -175
  300. package/node_modules/zod/src/v4/classic/tests/function.test.ts +0 -268
  301. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +0 -72
  302. package/node_modules/zod/src/v4/classic/tests/index.test.ts +0 -829
  303. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +0 -34
  304. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +0 -171
  305. package/node_modules/zod/src/v4/classic/tests/json.test.ts +0 -108
  306. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +0 -227
  307. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +0 -92
  308. package/node_modules/zod/src/v4/classic/tests/map.test.ts +0 -196
  309. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +0 -21
  310. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +0 -168
  311. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +0 -86
  312. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +0 -22
  313. package/node_modules/zod/src/v4/classic/tests/number.test.ts +0 -247
  314. package/node_modules/zod/src/v4/classic/tests/object.test.ts +0 -563
  315. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +0 -123
  316. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +0 -147
  317. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +0 -127
  318. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +0 -81
  319. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +0 -37
  320. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +0 -298
  321. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +0 -175
  322. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +0 -81
  323. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +0 -23
  324. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -252
  325. package/node_modules/zod/src/v4/classic/tests/record.test.ts +0 -342
  326. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +0 -356
  327. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +0 -532
  328. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +0 -204
  329. package/node_modules/zod/src/v4/classic/tests/set.test.ts +0 -179
  330. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +0 -57
  331. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +0 -109
  332. package/node_modules/zod/src/v4/classic/tests/string.test.ts +0 -881
  333. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +0 -66
  334. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +0 -758
  335. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +0 -2314
  336. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +0 -250
  337. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +0 -163
  338. package/node_modules/zod/src/v4/classic/tests/union.test.ts +0 -94
  339. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +0 -283
  340. package/node_modules/zod/src/v4/classic/tests/void.test.ts +0 -12
  341. package/node_modules/zod/src/v4/core/api.ts +0 -1594
  342. package/node_modules/zod/src/v4/core/checks.ts +0 -1283
  343. package/node_modules/zod/src/v4/core/config.ts +0 -15
  344. package/node_modules/zod/src/v4/core/core.ts +0 -134
  345. package/node_modules/zod/src/v4/core/doc.ts +0 -44
  346. package/node_modules/zod/src/v4/core/errors.ts +0 -424
  347. package/node_modules/zod/src/v4/core/function.ts +0 -176
  348. package/node_modules/zod/src/v4/core/index.ts +0 -15
  349. package/node_modules/zod/src/v4/core/json-schema.ts +0 -143
  350. package/node_modules/zod/src/v4/core/parse.ts +0 -94
  351. package/node_modules/zod/src/v4/core/regexes.ts +0 -135
  352. package/node_modules/zod/src/v4/core/registries.ts +0 -96
  353. package/node_modules/zod/src/v4/core/schemas.ts +0 -3842
  354. package/node_modules/zod/src/v4/core/standard-schema.ts +0 -64
  355. package/node_modules/zod/src/v4/core/tests/index.test.ts +0 -46
  356. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +0 -124
  357. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +0 -22
  358. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +0 -128
  359. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +0 -69
  360. package/node_modules/zod/src/v4/core/to-json-schema.ts +0 -977
  361. package/node_modules/zod/src/v4/core/util.ts +0 -775
  362. package/node_modules/zod/src/v4/core/versions.ts +0 -5
  363. package/node_modules/zod/src/v4/core/zsf.ts +0 -323
  364. package/node_modules/zod/src/v4/index.ts +0 -4
  365. package/node_modules/zod/src/v4/locales/ar.ts +0 -125
  366. package/node_modules/zod/src/v4/locales/az.ts +0 -121
  367. package/node_modules/zod/src/v4/locales/be.ts +0 -184
  368. package/node_modules/zod/src/v4/locales/ca.ts +0 -127
  369. package/node_modules/zod/src/v4/locales/cs.ts +0 -142
  370. package/node_modules/zod/src/v4/locales/de.ts +0 -124
  371. package/node_modules/zod/src/v4/locales/en.ts +0 -127
  372. package/node_modules/zod/src/v4/locales/eo.ts +0 -125
  373. package/node_modules/zod/src/v4/locales/es.ts +0 -125
  374. package/node_modules/zod/src/v4/locales/fa.ts +0 -134
  375. package/node_modules/zod/src/v4/locales/fi.ts +0 -131
  376. package/node_modules/zod/src/v4/locales/fr-CA.ts +0 -126
  377. package/node_modules/zod/src/v4/locales/fr.ts +0 -124
  378. package/node_modules/zod/src/v4/locales/he.ts +0 -125
  379. package/node_modules/zod/src/v4/locales/hu.ts +0 -126
  380. package/node_modules/zod/src/v4/locales/id.ts +0 -125
  381. package/node_modules/zod/src/v4/locales/index.ts +0 -39
  382. package/node_modules/zod/src/v4/locales/it.ts +0 -125
  383. package/node_modules/zod/src/v4/locales/ja.ts +0 -122
  384. package/node_modules/zod/src/v4/locales/kh.ts +0 -126
  385. package/node_modules/zod/src/v4/locales/ko.ts +0 -131
  386. package/node_modules/zod/src/v4/locales/mk.ts +0 -127
  387. package/node_modules/zod/src/v4/locales/ms.ts +0 -124
  388. package/node_modules/zod/src/v4/locales/nl.ts +0 -126
  389. package/node_modules/zod/src/v4/locales/no.ts +0 -124
  390. package/node_modules/zod/src/v4/locales/ota.ts +0 -125
  391. package/node_modules/zod/src/v4/locales/pl.ts +0 -126
  392. package/node_modules/zod/src/v4/locales/ps.ts +0 -133
  393. package/node_modules/zod/src/v4/locales/pt.ts +0 -123
  394. package/node_modules/zod/src/v4/locales/ru.ts +0 -184
  395. package/node_modules/zod/src/v4/locales/sl.ts +0 -126
  396. package/node_modules/zod/src/v4/locales/sv.ts +0 -127
  397. package/node_modules/zod/src/v4/locales/ta.ts +0 -125
  398. package/node_modules/zod/src/v4/locales/th.ts +0 -126
  399. package/node_modules/zod/src/v4/locales/tr.ts +0 -121
  400. package/node_modules/zod/src/v4/locales/ua.ts +0 -126
  401. package/node_modules/zod/src/v4/locales/ur.ts +0 -126
  402. package/node_modules/zod/src/v4/locales/vi.ts +0 -125
  403. package/node_modules/zod/src/v4/locales/zh-CN.ts +0 -123
  404. package/node_modules/zod/src/v4/locales/zh-TW.ts +0 -125
  405. package/node_modules/zod/src/v4/mini/checks.ts +0 -32
  406. package/node_modules/zod/src/v4/mini/coerce.ts +0 -22
  407. package/node_modules/zod/src/v4/mini/external.ts +0 -40
  408. package/node_modules/zod/src/v4/mini/index.ts +0 -3
  409. package/node_modules/zod/src/v4/mini/iso.ts +0 -62
  410. package/node_modules/zod/src/v4/mini/parse.ts +0 -1
  411. package/node_modules/zod/src/v4/mini/schemas.ts +0 -1579
  412. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +0 -129
  413. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +0 -51
  414. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +0 -144
  415. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +0 -36
  416. package/node_modules/zod/src/v4/mini/tests/error.test.ts +0 -22
  417. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +0 -43
  418. package/node_modules/zod/src/v4/mini/tests/index.test.ts +0 -871
  419. package/node_modules/zod/src/v4/mini/tests/number.test.ts +0 -95
  420. package/node_modules/zod/src/v4/mini/tests/object.test.ts +0 -185
  421. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +0 -43
  422. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +0 -275
  423. package/node_modules/zod/src/v4/mini/tests/string.test.ts +0 -299
  424. package/node_modules/zod/src/v4-mini/index.ts +0 -1
  425. package/node_modules/zod/v3/ZodError.cjs +0 -138
  426. package/node_modules/zod/v3/ZodError.d.cts +0 -164
  427. package/node_modules/zod/v3/ZodError.d.ts +0 -164
  428. package/node_modules/zod/v3/ZodError.js +0 -133
  429. package/node_modules/zod/v3/errors.cjs +0 -17
  430. package/node_modules/zod/v3/errors.d.cts +0 -5
  431. package/node_modules/zod/v3/errors.d.ts +0 -5
  432. package/node_modules/zod/v3/errors.js +0 -9
  433. package/node_modules/zod/v3/external.cjs +0 -22
  434. package/node_modules/zod/v3/external.d.cts +0 -6
  435. package/node_modules/zod/v3/external.d.ts +0 -6
  436. package/node_modules/zod/v3/external.js +0 -6
  437. package/node_modules/zod/v3/helpers/enumUtil.cjs +0 -2
  438. package/node_modules/zod/v3/helpers/enumUtil.d.cts +0 -8
  439. package/node_modules/zod/v3/helpers/enumUtil.d.ts +0 -8
  440. package/node_modules/zod/v3/helpers/enumUtil.js +0 -1
  441. package/node_modules/zod/v3/helpers/errorUtil.cjs +0 -9
  442. package/node_modules/zod/v3/helpers/errorUtil.d.cts +0 -9
  443. package/node_modules/zod/v3/helpers/errorUtil.d.ts +0 -9
  444. package/node_modules/zod/v3/helpers/errorUtil.js +0 -6
  445. package/node_modules/zod/v3/helpers/parseUtil.cjs +0 -124
  446. package/node_modules/zod/v3/helpers/parseUtil.d.cts +0 -78
  447. package/node_modules/zod/v3/helpers/parseUtil.d.ts +0 -78
  448. package/node_modules/zod/v3/helpers/parseUtil.js +0 -109
  449. package/node_modules/zod/v3/helpers/partialUtil.cjs +0 -2
  450. package/node_modules/zod/v3/helpers/partialUtil.d.cts +0 -8
  451. package/node_modules/zod/v3/helpers/partialUtil.d.ts +0 -8
  452. package/node_modules/zod/v3/helpers/partialUtil.js +0 -1
  453. package/node_modules/zod/v3/helpers/typeAliases.cjs +0 -2
  454. package/node_modules/zod/v3/helpers/typeAliases.d.cts +0 -2
  455. package/node_modules/zod/v3/helpers/typeAliases.d.ts +0 -2
  456. package/node_modules/zod/v3/helpers/typeAliases.js +0 -1
  457. package/node_modules/zod/v3/helpers/util.cjs +0 -137
  458. package/node_modules/zod/v3/helpers/util.d.cts +0 -85
  459. package/node_modules/zod/v3/helpers/util.d.ts +0 -85
  460. package/node_modules/zod/v3/helpers/util.js +0 -133
  461. package/node_modules/zod/v3/index.cjs +0 -33
  462. package/node_modules/zod/v3/index.d.cts +0 -4
  463. package/node_modules/zod/v3/index.d.ts +0 -4
  464. package/node_modules/zod/v3/index.js +0 -4
  465. package/node_modules/zod/v3/locales/en.cjs +0 -111
  466. package/node_modules/zod/v3/locales/en.d.cts +0 -3
  467. package/node_modules/zod/v3/locales/en.d.ts +0 -3
  468. package/node_modules/zod/v3/locales/en.js +0 -109
  469. package/node_modules/zod/v3/standard-schema.cjs +0 -2
  470. package/node_modules/zod/v3/standard-schema.d.cts +0 -102
  471. package/node_modules/zod/v3/standard-schema.d.ts +0 -102
  472. package/node_modules/zod/v3/standard-schema.js +0 -1
  473. package/node_modules/zod/v3/types.cjs +0 -3775
  474. package/node_modules/zod/v3/types.d.cts +0 -1031
  475. package/node_modules/zod/v3/types.d.ts +0 -1031
  476. package/node_modules/zod/v3/types.js +0 -3693
  477. package/node_modules/zod/v4/classic/checks.cjs +0 -32
  478. package/node_modules/zod/v4/classic/checks.d.cts +0 -1
  479. package/node_modules/zod/v4/classic/checks.d.ts +0 -1
  480. package/node_modules/zod/v4/classic/checks.js +0 -1
  481. package/node_modules/zod/v4/classic/coerce.cjs +0 -47
  482. package/node_modules/zod/v4/classic/coerce.d.cts +0 -17
  483. package/node_modules/zod/v4/classic/coerce.d.ts +0 -17
  484. package/node_modules/zod/v4/classic/coerce.js +0 -17
  485. package/node_modules/zod/v4/classic/compat.cjs +0 -57
  486. package/node_modules/zod/v4/classic/compat.d.cts +0 -46
  487. package/node_modules/zod/v4/classic/compat.d.ts +0 -46
  488. package/node_modules/zod/v4/classic/compat.js +0 -27
  489. package/node_modules/zod/v4/classic/errors.cjs +0 -67
  490. package/node_modules/zod/v4/classic/errors.d.cts +0 -30
  491. package/node_modules/zod/v4/classic/errors.d.ts +0 -30
  492. package/node_modules/zod/v4/classic/errors.js +0 -41
  493. package/node_modules/zod/v4/classic/external.cjs +0 -70
  494. package/node_modules/zod/v4/classic/external.d.cts +0 -13
  495. package/node_modules/zod/v4/classic/external.d.ts +0 -13
  496. package/node_modules/zod/v4/classic/external.js +0 -18
  497. package/node_modules/zod/v4/classic/index.cjs +0 -33
  498. package/node_modules/zod/v4/classic/index.d.cts +0 -4
  499. package/node_modules/zod/v4/classic/index.d.ts +0 -4
  500. package/node_modules/zod/v4/classic/index.js +0 -4
  501. package/node_modules/zod/v4/classic/iso.cjs +0 -60
  502. package/node_modules/zod/v4/classic/iso.d.cts +0 -22
  503. package/node_modules/zod/v4/classic/iso.d.ts +0 -22
  504. package/node_modules/zod/v4/classic/iso.js +0 -30
  505. package/node_modules/zod/v4/classic/parse.cjs +0 -32
  506. package/node_modules/zod/v4/classic/parse.d.cts +0 -23
  507. package/node_modules/zod/v4/classic/parse.d.ts +0 -23
  508. package/node_modules/zod/v4/classic/parse.js +0 -6
  509. package/node_modules/zod/v4/classic/schemas.cjs +0 -1109
  510. package/node_modules/zod/v4/classic/schemas.d.cts +0 -630
  511. package/node_modules/zod/v4/classic/schemas.d.ts +0 -630
  512. package/node_modules/zod/v4/classic/schemas.js +0 -1006
  513. package/node_modules/zod/v4/core/api.cjs +0 -1039
  514. package/node_modules/zod/v4/core/api.d.cts +0 -284
  515. package/node_modules/zod/v4/core/api.d.ts +0 -284
  516. package/node_modules/zod/v4/core/api.js +0 -906
  517. package/node_modules/zod/v4/core/checks.cjs +0 -591
  518. package/node_modules/zod/v4/core/checks.d.cts +0 -278
  519. package/node_modules/zod/v4/core/checks.d.ts +0 -278
  520. package/node_modules/zod/v4/core/checks.js +0 -565
  521. package/node_modules/zod/v4/core/core.cjs +0 -67
  522. package/node_modules/zod/v4/core/core.d.cts +0 -49
  523. package/node_modules/zod/v4/core/core.d.ts +0 -49
  524. package/node_modules/zod/v4/core/core.js +0 -61
  525. package/node_modules/zod/v4/core/doc.cjs +0 -39
  526. package/node_modules/zod/v4/core/doc.d.cts +0 -14
  527. package/node_modules/zod/v4/core/doc.d.ts +0 -14
  528. package/node_modules/zod/v4/core/doc.js +0 -35
  529. package/node_modules/zod/v4/core/errors.cjs +0 -226
  530. package/node_modules/zod/v4/core/errors.d.cts +0 -208
  531. package/node_modules/zod/v4/core/errors.d.ts +0 -208
  532. package/node_modules/zod/v4/core/errors.js +0 -195
  533. package/node_modules/zod/v4/core/function.cjs +0 -102
  534. package/node_modules/zod/v4/core/function.d.cts +0 -52
  535. package/node_modules/zod/v4/core/function.d.ts +0 -52
  536. package/node_modules/zod/v4/core/function.js +0 -75
  537. package/node_modules/zod/v4/core/index.cjs +0 -44
  538. package/node_modules/zod/v4/core/index.d.cts +0 -15
  539. package/node_modules/zod/v4/core/index.d.ts +0 -15
  540. package/node_modules/zod/v4/core/index.js +0 -15
  541. package/node_modules/zod/v4/core/json-schema.cjs +0 -2
  542. package/node_modules/zod/v4/core/json-schema.d.cts +0 -87
  543. package/node_modules/zod/v4/core/json-schema.d.ts +0 -87
  544. package/node_modules/zod/v4/core/json-schema.js +0 -1
  545. package/node_modules/zod/v4/core/parse.cjs +0 -87
  546. package/node_modules/zod/v4/core/parse.d.cts +0 -25
  547. package/node_modules/zod/v4/core/parse.d.ts +0 -25
  548. package/node_modules/zod/v4/core/parse.js +0 -57
  549. package/node_modules/zod/v4/core/regexes.cjs +0 -103
  550. package/node_modules/zod/v4/core/regexes.d.cts +0 -62
  551. package/node_modules/zod/v4/core/regexes.d.ts +0 -62
  552. package/node_modules/zod/v4/core/regexes.js +0 -95
  553. package/node_modules/zod/v4/core/registries.cjs +0 -56
  554. package/node_modules/zod/v4/core/registries.d.cts +0 -35
  555. package/node_modules/zod/v4/core/registries.d.ts +0 -35
  556. package/node_modules/zod/v4/core/registries.js +0 -51
  557. package/node_modules/zod/v4/core/schemas.cjs +0 -1748
  558. package/node_modules/zod/v4/core/schemas.d.cts +0 -1041
  559. package/node_modules/zod/v4/core/schemas.d.ts +0 -1041
  560. package/node_modules/zod/v4/core/schemas.js +0 -1717
  561. package/node_modules/zod/v4/core/standard-schema.cjs +0 -2
  562. package/node_modules/zod/v4/core/standard-schema.d.cts +0 -55
  563. package/node_modules/zod/v4/core/standard-schema.d.ts +0 -55
  564. package/node_modules/zod/v4/core/standard-schema.js +0 -1
  565. package/node_modules/zod/v4/core/to-json-schema.cjs +0 -854
  566. package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -88
  567. package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -88
  568. package/node_modules/zod/v4/core/to-json-schema.js +0 -849
  569. package/node_modules/zod/v4/core/util.cjs +0 -539
  570. package/node_modules/zod/v4/core/util.d.cts +0 -183
  571. package/node_modules/zod/v4/core/util.d.ts +0 -183
  572. package/node_modules/zod/v4/core/util.js +0 -493
  573. package/node_modules/zod/v4/core/versions.cjs +0 -8
  574. package/node_modules/zod/v4/core/versions.d.cts +0 -5
  575. package/node_modules/zod/v4/core/versions.d.ts +0 -5
  576. package/node_modules/zod/v4/core/versions.js +0 -5
  577. package/node_modules/zod/v4/index.cjs +0 -22
  578. package/node_modules/zod/v4/index.d.cts +0 -3
  579. package/node_modules/zod/v4/index.d.ts +0 -3
  580. package/node_modules/zod/v4/index.js +0 -3
  581. package/node_modules/zod/v4/locales/ar.cjs +0 -142
  582. package/node_modules/zod/v4/locales/ar.d.cts +0 -4
  583. package/node_modules/zod/v4/locales/ar.d.ts +0 -4
  584. package/node_modules/zod/v4/locales/ar.js +0 -116
  585. package/node_modules/zod/v4/locales/az.cjs +0 -141
  586. package/node_modules/zod/v4/locales/az.d.cts +0 -4
  587. package/node_modules/zod/v4/locales/az.d.ts +0 -4
  588. package/node_modules/zod/v4/locales/az.js +0 -115
  589. package/node_modules/zod/v4/locales/be.cjs +0 -190
  590. package/node_modules/zod/v4/locales/be.d.cts +0 -4
  591. package/node_modules/zod/v4/locales/be.d.ts +0 -4
  592. package/node_modules/zod/v4/locales/be.js +0 -164
  593. package/node_modules/zod/v4/locales/ca.cjs +0 -144
  594. package/node_modules/zod/v4/locales/ca.d.cts +0 -4
  595. package/node_modules/zod/v4/locales/ca.d.ts +0 -4
  596. package/node_modules/zod/v4/locales/ca.js +0 -118
  597. package/node_modules/zod/v4/locales/cs.cjs +0 -161
  598. package/node_modules/zod/v4/locales/cs.d.cts +0 -4
  599. package/node_modules/zod/v4/locales/cs.d.ts +0 -4
  600. package/node_modules/zod/v4/locales/cs.js +0 -135
  601. package/node_modules/zod/v4/locales/de.cjs +0 -142
  602. package/node_modules/zod/v4/locales/de.d.cts +0 -4
  603. package/node_modules/zod/v4/locales/de.d.ts +0 -4
  604. package/node_modules/zod/v4/locales/de.js +0 -116
  605. package/node_modules/zod/v4/locales/en.cjs +0 -145
  606. package/node_modules/zod/v4/locales/en.d.cts +0 -5
  607. package/node_modules/zod/v4/locales/en.d.ts +0 -5
  608. package/node_modules/zod/v4/locales/en.js +0 -117
  609. package/node_modules/zod/v4/locales/eo.cjs +0 -144
  610. package/node_modules/zod/v4/locales/eo.d.cts +0 -5
  611. package/node_modules/zod/v4/locales/eo.d.ts +0 -5
  612. package/node_modules/zod/v4/locales/eo.js +0 -116
  613. package/node_modules/zod/v4/locales/es.cjs +0 -143
  614. package/node_modules/zod/v4/locales/es.d.cts +0 -4
  615. package/node_modules/zod/v4/locales/es.d.ts +0 -4
  616. package/node_modules/zod/v4/locales/es.js +0 -117
  617. package/node_modules/zod/v4/locales/fa.cjs +0 -148
  618. package/node_modules/zod/v4/locales/fa.d.cts +0 -4
  619. package/node_modules/zod/v4/locales/fa.d.ts +0 -4
  620. package/node_modules/zod/v4/locales/fa.js +0 -122
  621. package/node_modules/zod/v4/locales/fi.cjs +0 -148
  622. package/node_modules/zod/v4/locales/fi.d.cts +0 -4
  623. package/node_modules/zod/v4/locales/fi.d.ts +0 -4
  624. package/node_modules/zod/v4/locales/fi.js +0 -122
  625. package/node_modules/zod/v4/locales/fr-CA.cjs +0 -143
  626. package/node_modules/zod/v4/locales/fr-CA.d.cts +0 -4
  627. package/node_modules/zod/v4/locales/fr-CA.d.ts +0 -4
  628. package/node_modules/zod/v4/locales/fr-CA.js +0 -117
  629. package/node_modules/zod/v4/locales/fr.cjs +0 -142
  630. package/node_modules/zod/v4/locales/fr.d.cts +0 -4
  631. package/node_modules/zod/v4/locales/fr.d.ts +0 -4
  632. package/node_modules/zod/v4/locales/fr.js +0 -116
  633. package/node_modules/zod/v4/locales/he.cjs +0 -143
  634. package/node_modules/zod/v4/locales/he.d.cts +0 -4
  635. package/node_modules/zod/v4/locales/he.d.ts +0 -4
  636. package/node_modules/zod/v4/locales/he.js +0 -117
  637. package/node_modules/zod/v4/locales/hu.cjs +0 -143
  638. package/node_modules/zod/v4/locales/hu.d.cts +0 -4
  639. package/node_modules/zod/v4/locales/hu.d.ts +0 -4
  640. package/node_modules/zod/v4/locales/hu.js +0 -117
  641. package/node_modules/zod/v4/locales/id.cjs +0 -142
  642. package/node_modules/zod/v4/locales/id.d.cts +0 -4
  643. package/node_modules/zod/v4/locales/id.d.ts +0 -4
  644. package/node_modules/zod/v4/locales/id.js +0 -116
  645. package/node_modules/zod/v4/locales/index.cjs +0 -84
  646. package/node_modules/zod/v4/locales/index.d.cts +0 -39
  647. package/node_modules/zod/v4/locales/index.d.ts +0 -39
  648. package/node_modules/zod/v4/locales/index.js +0 -39
  649. package/node_modules/zod/v4/locales/it.cjs +0 -143
  650. package/node_modules/zod/v4/locales/it.d.cts +0 -4
  651. package/node_modules/zod/v4/locales/it.d.ts +0 -4
  652. package/node_modules/zod/v4/locales/it.js +0 -117
  653. package/node_modules/zod/v4/locales/ja.cjs +0 -141
  654. package/node_modules/zod/v4/locales/ja.d.cts +0 -4
  655. package/node_modules/zod/v4/locales/ja.d.ts +0 -4
  656. package/node_modules/zod/v4/locales/ja.js +0 -115
  657. package/node_modules/zod/v4/locales/kh.cjs +0 -143
  658. package/node_modules/zod/v4/locales/kh.d.cts +0 -4
  659. package/node_modules/zod/v4/locales/kh.d.ts +0 -4
  660. package/node_modules/zod/v4/locales/kh.js +0 -117
  661. package/node_modules/zod/v4/locales/ko.cjs +0 -147
  662. package/node_modules/zod/v4/locales/ko.d.cts +0 -4
  663. package/node_modules/zod/v4/locales/ko.d.ts +0 -4
  664. package/node_modules/zod/v4/locales/ko.js +0 -121
  665. package/node_modules/zod/v4/locales/mk.cjs +0 -144
  666. package/node_modules/zod/v4/locales/mk.d.cts +0 -4
  667. package/node_modules/zod/v4/locales/mk.d.ts +0 -4
  668. package/node_modules/zod/v4/locales/mk.js +0 -118
  669. package/node_modules/zod/v4/locales/ms.cjs +0 -142
  670. package/node_modules/zod/v4/locales/ms.d.cts +0 -4
  671. package/node_modules/zod/v4/locales/ms.d.ts +0 -4
  672. package/node_modules/zod/v4/locales/ms.js +0 -116
  673. package/node_modules/zod/v4/locales/nl.cjs +0 -143
  674. package/node_modules/zod/v4/locales/nl.d.cts +0 -4
  675. package/node_modules/zod/v4/locales/nl.d.ts +0 -4
  676. package/node_modules/zod/v4/locales/nl.js +0 -117
  677. package/node_modules/zod/v4/locales/no.cjs +0 -142
  678. package/node_modules/zod/v4/locales/no.d.cts +0 -4
  679. package/node_modules/zod/v4/locales/no.d.ts +0 -4
  680. package/node_modules/zod/v4/locales/no.js +0 -116
  681. package/node_modules/zod/v4/locales/ota.cjs +0 -143
  682. package/node_modules/zod/v4/locales/ota.d.cts +0 -4
  683. package/node_modules/zod/v4/locales/ota.d.ts +0 -4
  684. package/node_modules/zod/v4/locales/ota.js +0 -117
  685. package/node_modules/zod/v4/locales/pl.cjs +0 -143
  686. package/node_modules/zod/v4/locales/pl.d.cts +0 -4
  687. package/node_modules/zod/v4/locales/pl.d.ts +0 -4
  688. package/node_modules/zod/v4/locales/pl.js +0 -117
  689. package/node_modules/zod/v4/locales/ps.cjs +0 -148
  690. package/node_modules/zod/v4/locales/ps.d.cts +0 -4
  691. package/node_modules/zod/v4/locales/ps.d.ts +0 -4
  692. package/node_modules/zod/v4/locales/ps.js +0 -122
  693. package/node_modules/zod/v4/locales/pt.cjs +0 -142
  694. package/node_modules/zod/v4/locales/pt.d.cts +0 -4
  695. package/node_modules/zod/v4/locales/pt.d.ts +0 -4
  696. package/node_modules/zod/v4/locales/pt.js +0 -116
  697. package/node_modules/zod/v4/locales/ru.cjs +0 -190
  698. package/node_modules/zod/v4/locales/ru.d.cts +0 -4
  699. package/node_modules/zod/v4/locales/ru.d.ts +0 -4
  700. package/node_modules/zod/v4/locales/ru.js +0 -164
  701. package/node_modules/zod/v4/locales/sl.cjs +0 -143
  702. package/node_modules/zod/v4/locales/sl.d.cts +0 -4
  703. package/node_modules/zod/v4/locales/sl.d.ts +0 -4
  704. package/node_modules/zod/v4/locales/sl.js +0 -117
  705. package/node_modules/zod/v4/locales/sv.cjs +0 -144
  706. package/node_modules/zod/v4/locales/sv.d.cts +0 -4
  707. package/node_modules/zod/v4/locales/sv.d.ts +0 -4
  708. package/node_modules/zod/v4/locales/sv.js +0 -118
  709. package/node_modules/zod/v4/locales/ta.cjs +0 -143
  710. package/node_modules/zod/v4/locales/ta.d.cts +0 -4
  711. package/node_modules/zod/v4/locales/ta.d.ts +0 -4
  712. package/node_modules/zod/v4/locales/ta.js +0 -117
  713. package/node_modules/zod/v4/locales/th.cjs +0 -143
  714. package/node_modules/zod/v4/locales/th.d.cts +0 -4
  715. package/node_modules/zod/v4/locales/th.d.ts +0 -4
  716. package/node_modules/zod/v4/locales/th.js +0 -117
  717. package/node_modules/zod/v4/locales/tr.cjs +0 -143
  718. package/node_modules/zod/v4/locales/tr.d.cts +0 -5
  719. package/node_modules/zod/v4/locales/tr.d.ts +0 -5
  720. package/node_modules/zod/v4/locales/tr.js +0 -115
  721. package/node_modules/zod/v4/locales/ua.cjs +0 -143
  722. package/node_modules/zod/v4/locales/ua.d.cts +0 -4
  723. package/node_modules/zod/v4/locales/ua.d.ts +0 -4
  724. package/node_modules/zod/v4/locales/ua.js +0 -117
  725. package/node_modules/zod/v4/locales/ur.cjs +0 -143
  726. package/node_modules/zod/v4/locales/ur.d.cts +0 -4
  727. package/node_modules/zod/v4/locales/ur.d.ts +0 -4
  728. package/node_modules/zod/v4/locales/ur.js +0 -117
  729. package/node_modules/zod/v4/locales/vi.cjs +0 -142
  730. package/node_modules/zod/v4/locales/vi.d.cts +0 -4
  731. package/node_modules/zod/v4/locales/vi.d.ts +0 -4
  732. package/node_modules/zod/v4/locales/vi.js +0 -116
  733. package/node_modules/zod/v4/locales/zh-CN.cjs +0 -142
  734. package/node_modules/zod/v4/locales/zh-CN.d.cts +0 -4
  735. package/node_modules/zod/v4/locales/zh-CN.d.ts +0 -4
  736. package/node_modules/zod/v4/locales/zh-CN.js +0 -116
  737. package/node_modules/zod/v4/locales/zh-TW.cjs +0 -143
  738. package/node_modules/zod/v4/locales/zh-TW.d.cts +0 -4
  739. package/node_modules/zod/v4/locales/zh-TW.d.ts +0 -4
  740. package/node_modules/zod/v4/locales/zh-TW.js +0 -117
  741. package/node_modules/zod/v4/mini/checks.cjs +0 -34
  742. package/node_modules/zod/v4/mini/checks.d.cts +0 -1
  743. package/node_modules/zod/v4/mini/checks.d.ts +0 -1
  744. package/node_modules/zod/v4/mini/checks.js +0 -1
  745. package/node_modules/zod/v4/mini/coerce.cjs +0 -47
  746. package/node_modules/zod/v4/mini/coerce.d.cts +0 -7
  747. package/node_modules/zod/v4/mini/coerce.d.ts +0 -7
  748. package/node_modules/zod/v4/mini/coerce.js +0 -17
  749. package/node_modules/zod/v4/mini/external.cjs +0 -62
  750. package/node_modules/zod/v4/mini/external.d.cts +0 -11
  751. package/node_modules/zod/v4/mini/external.d.ts +0 -11
  752. package/node_modules/zod/v4/mini/external.js +0 -13
  753. package/node_modules/zod/v4/mini/index.cjs +0 -32
  754. package/node_modules/zod/v4/mini/index.d.cts +0 -3
  755. package/node_modules/zod/v4/mini/index.d.ts +0 -3
  756. package/node_modules/zod/v4/mini/index.js +0 -3
  757. package/node_modules/zod/v4/mini/iso.cjs +0 -60
  758. package/node_modules/zod/v4/mini/iso.d.cts +0 -22
  759. package/node_modules/zod/v4/mini/iso.d.ts +0 -22
  760. package/node_modules/zod/v4/mini/iso.js +0 -30
  761. package/node_modules/zod/v4/mini/parse.cjs +0 -8
  762. package/node_modules/zod/v4/mini/parse.d.cts +0 -1
  763. package/node_modules/zod/v4/mini/parse.d.ts +0 -1
  764. package/node_modules/zod/v4/mini/parse.js +0 -1
  765. package/node_modules/zod/v4/mini/schemas.cjs +0 -839
  766. package/node_modules/zod/v4/mini/schemas.d.cts +0 -356
  767. package/node_modules/zod/v4/mini/schemas.d.ts +0 -356
  768. package/node_modules/zod/v4/mini/schemas.js +0 -732
  769. package/node_modules/zod/v4-mini/index.cjs +0 -17
  770. package/node_modules/zod/v4-mini/index.d.cts +0 -1
  771. package/node_modules/zod/v4-mini/index.d.ts +0 -1
  772. package/node_modules/zod/v4-mini/index.js +0 -1
@@ -1,1748 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.$ZodSet = exports.$ZodMap = exports.$ZodRecord = exports.$ZodTuple = exports.$ZodIntersection = exports.$ZodDiscriminatedUnion = exports.$ZodUnion = exports.$ZodObject = exports.$ZodArray = exports.$ZodDate = exports.$ZodVoid = exports.$ZodNever = exports.$ZodUnknown = exports.$ZodAny = exports.$ZodNull = exports.$ZodUndefined = exports.$ZodSymbol = exports.$ZodBigIntFormat = exports.$ZodBigInt = exports.$ZodBoolean = exports.$ZodNumberFormat = exports.$ZodNumber = exports.$ZodCustomStringFormat = exports.$ZodJWT = exports.$ZodE164 = exports.$ZodBase64URL = exports.$ZodBase64 = exports.$ZodCIDRv6 = exports.$ZodCIDRv4 = exports.$ZodIPv6 = exports.$ZodIPv4 = exports.$ZodISODuration = exports.$ZodISOTime = exports.$ZodISODate = exports.$ZodISODateTime = exports.$ZodKSUID = exports.$ZodXID = exports.$ZodULID = exports.$ZodCUID2 = exports.$ZodCUID = exports.$ZodNanoID = exports.$ZodEmoji = exports.$ZodURL = exports.$ZodEmail = exports.$ZodUUID = exports.$ZodGUID = exports.$ZodStringFormat = exports.$ZodString = exports.clone = exports.$ZodType = void 0;
27
- exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = void 0;
28
- exports.isValidBase64 = isValidBase64;
29
- exports.isValidBase64URL = isValidBase64URL;
30
- exports.isValidJWT = isValidJWT;
31
- const checks = __importStar(require("./checks.cjs"));
32
- const core = __importStar(require("./core.cjs"));
33
- const doc_js_1 = require("./doc.cjs");
34
- const parse_js_1 = require("./parse.cjs");
35
- const regexes = __importStar(require("./regexes.cjs"));
36
- const util = __importStar(require("./util.cjs"));
37
- const versions_js_1 = require("./versions.cjs");
38
- exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
39
- var _a;
40
- inst ?? (inst = {});
41
- inst._zod.def = def; // set _def property
42
- inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
43
- inst._zod.version = versions_js_1.version;
44
- const checks = [...(inst._zod.def.checks ?? [])];
45
- // if inst is itself a checks.$ZodCheck, run it as a check
46
- if (inst._zod.traits.has("$ZodCheck")) {
47
- checks.unshift(inst);
48
- }
49
- //
50
- for (const ch of checks) {
51
- for (const fn of ch._zod.onattach) {
52
- fn(inst);
53
- }
54
- }
55
- if (checks.length === 0) {
56
- // deferred initializer
57
- // inst._zod.parse is not yet defined
58
- (_a = inst._zod).deferred ?? (_a.deferred = []);
59
- inst._zod.deferred?.push(() => {
60
- inst._zod.run = inst._zod.parse;
61
- });
62
- }
63
- else {
64
- const runChecks = (payload, checks, ctx) => {
65
- let isAborted = util.aborted(payload);
66
- let asyncResult;
67
- for (const ch of checks) {
68
- if (ch._zod.def.when) {
69
- const shouldRun = ch._zod.def.when(payload);
70
- if (!shouldRun)
71
- continue;
72
- }
73
- else if (isAborted) {
74
- continue;
75
- }
76
- const currLen = payload.issues.length;
77
- const _ = ch._zod.check(payload);
78
- if (_ instanceof Promise && ctx?.async === false) {
79
- throw new core.$ZodAsyncError();
80
- }
81
- if (asyncResult || _ instanceof Promise) {
82
- asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
83
- await _;
84
- const nextLen = payload.issues.length;
85
- if (nextLen === currLen)
86
- return;
87
- if (!isAborted)
88
- isAborted = util.aborted(payload, currLen);
89
- });
90
- }
91
- else {
92
- const nextLen = payload.issues.length;
93
- if (nextLen === currLen)
94
- continue;
95
- if (!isAborted)
96
- isAborted = util.aborted(payload, currLen);
97
- }
98
- }
99
- if (asyncResult) {
100
- return asyncResult.then(() => {
101
- return payload;
102
- });
103
- }
104
- return payload;
105
- };
106
- inst._zod.run = (payload, ctx) => {
107
- const result = inst._zod.parse(payload, ctx);
108
- if (result instanceof Promise) {
109
- if (ctx.async === false)
110
- throw new core.$ZodAsyncError();
111
- return result.then((result) => runChecks(result, checks, ctx));
112
- }
113
- return runChecks(result, checks, ctx);
114
- };
115
- }
116
- inst["~standard"] = {
117
- validate: (value) => {
118
- try {
119
- const r = (0, parse_js_1.safeParse)(inst, value);
120
- return r.success ? { value: r.data } : { issues: r.error?.issues };
121
- }
122
- catch (_) {
123
- return (0, parse_js_1.safeParseAsync)(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
124
- }
125
- },
126
- vendor: "zod",
127
- version: 1,
128
- };
129
- });
130
- var util_js_1 = require("./util.cjs");
131
- Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return util_js_1.clone; } });
132
- exports.$ZodString = core.$constructor("$ZodString", (inst, def) => {
133
- exports.$ZodType.init(inst, def);
134
- inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? regexes.string(inst._zod.bag);
135
- inst._zod.parse = (payload, _) => {
136
- if (def.coerce)
137
- try {
138
- payload.value = String(payload.value);
139
- }
140
- catch (_) { }
141
- if (typeof payload.value === "string")
142
- return payload;
143
- payload.issues.push({
144
- expected: "string",
145
- code: "invalid_type",
146
- input: payload.value,
147
- inst,
148
- });
149
- return payload;
150
- };
151
- });
152
- exports.$ZodStringFormat = core.$constructor("$ZodStringFormat", (inst, def) => {
153
- // check initialization must come first
154
- checks.$ZodCheckStringFormat.init(inst, def);
155
- exports.$ZodString.init(inst, def);
156
- });
157
- exports.$ZodGUID = core.$constructor("$ZodGUID", (inst, def) => {
158
- def.pattern ?? (def.pattern = regexes.guid);
159
- exports.$ZodStringFormat.init(inst, def);
160
- });
161
- exports.$ZodUUID = core.$constructor("$ZodUUID", (inst, def) => {
162
- if (def.version) {
163
- const versionMap = {
164
- v1: 1,
165
- v2: 2,
166
- v3: 3,
167
- v4: 4,
168
- v5: 5,
169
- v6: 6,
170
- v7: 7,
171
- v8: 8,
172
- };
173
- const v = versionMap[def.version];
174
- if (v === undefined)
175
- throw new Error(`Invalid UUID version: "${def.version}"`);
176
- def.pattern ?? (def.pattern = regexes.uuid(v));
177
- }
178
- else
179
- def.pattern ?? (def.pattern = regexes.uuid());
180
- exports.$ZodStringFormat.init(inst, def);
181
- });
182
- exports.$ZodEmail = core.$constructor("$ZodEmail", (inst, def) => {
183
- def.pattern ?? (def.pattern = regexes.email);
184
- exports.$ZodStringFormat.init(inst, def);
185
- });
186
- exports.$ZodURL = core.$constructor("$ZodURL", (inst, def) => {
187
- exports.$ZodStringFormat.init(inst, def);
188
- inst._zod.check = (payload) => {
189
- try {
190
- const orig = payload.value;
191
- const url = new URL(orig);
192
- const href = url.href;
193
- if (def.hostname) {
194
- def.hostname.lastIndex = 0;
195
- if (!def.hostname.test(url.hostname)) {
196
- payload.issues.push({
197
- code: "invalid_format",
198
- format: "url",
199
- note: "Invalid hostname",
200
- pattern: regexes.hostname.source,
201
- input: payload.value,
202
- inst,
203
- continue: !def.abort,
204
- });
205
- }
206
- }
207
- if (def.protocol) {
208
- def.protocol.lastIndex = 0;
209
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
210
- payload.issues.push({
211
- code: "invalid_format",
212
- format: "url",
213
- note: "Invalid protocol",
214
- pattern: def.protocol.source,
215
- input: payload.value,
216
- inst,
217
- continue: !def.abort,
218
- });
219
- }
220
- }
221
- // payload.value = url.href;
222
- if (!orig.endsWith("/") && href.endsWith("/")) {
223
- payload.value = href.slice(0, -1);
224
- }
225
- else {
226
- payload.value = href;
227
- }
228
- return;
229
- }
230
- catch (_) {
231
- payload.issues.push({
232
- code: "invalid_format",
233
- format: "url",
234
- input: payload.value,
235
- inst,
236
- continue: !def.abort,
237
- });
238
- }
239
- };
240
- });
241
- exports.$ZodEmoji = core.$constructor("$ZodEmoji", (inst, def) => {
242
- def.pattern ?? (def.pattern = regexes.emoji());
243
- exports.$ZodStringFormat.init(inst, def);
244
- });
245
- exports.$ZodNanoID = core.$constructor("$ZodNanoID", (inst, def) => {
246
- def.pattern ?? (def.pattern = regexes.nanoid);
247
- exports.$ZodStringFormat.init(inst, def);
248
- });
249
- exports.$ZodCUID = core.$constructor("$ZodCUID", (inst, def) => {
250
- def.pattern ?? (def.pattern = regexes.cuid);
251
- exports.$ZodStringFormat.init(inst, def);
252
- });
253
- exports.$ZodCUID2 = core.$constructor("$ZodCUID2", (inst, def) => {
254
- def.pattern ?? (def.pattern = regexes.cuid2);
255
- exports.$ZodStringFormat.init(inst, def);
256
- });
257
- exports.$ZodULID = core.$constructor("$ZodULID", (inst, def) => {
258
- def.pattern ?? (def.pattern = regexes.ulid);
259
- exports.$ZodStringFormat.init(inst, def);
260
- });
261
- exports.$ZodXID = core.$constructor("$ZodXID", (inst, def) => {
262
- def.pattern ?? (def.pattern = regexes.xid);
263
- exports.$ZodStringFormat.init(inst, def);
264
- });
265
- exports.$ZodKSUID = core.$constructor("$ZodKSUID", (inst, def) => {
266
- def.pattern ?? (def.pattern = regexes.ksuid);
267
- exports.$ZodStringFormat.init(inst, def);
268
- });
269
- exports.$ZodISODateTime = core.$constructor("$ZodISODateTime", (inst, def) => {
270
- def.pattern ?? (def.pattern = regexes.datetime(def));
271
- exports.$ZodStringFormat.init(inst, def);
272
- });
273
- exports.$ZodISODate = core.$constructor("$ZodISODate", (inst, def) => {
274
- def.pattern ?? (def.pattern = regexes.date);
275
- exports.$ZodStringFormat.init(inst, def);
276
- });
277
- exports.$ZodISOTime = core.$constructor("$ZodISOTime", (inst, def) => {
278
- def.pattern ?? (def.pattern = regexes.time(def));
279
- exports.$ZodStringFormat.init(inst, def);
280
- });
281
- exports.$ZodISODuration = core.$constructor("$ZodISODuration", (inst, def) => {
282
- def.pattern ?? (def.pattern = regexes.duration);
283
- exports.$ZodStringFormat.init(inst, def);
284
- });
285
- exports.$ZodIPv4 = core.$constructor("$ZodIPv4", (inst, def) => {
286
- def.pattern ?? (def.pattern = regexes.ipv4);
287
- exports.$ZodStringFormat.init(inst, def);
288
- inst._zod.onattach.push((inst) => {
289
- const bag = inst._zod.bag;
290
- bag.format = `ipv4`;
291
- });
292
- });
293
- exports.$ZodIPv6 = core.$constructor("$ZodIPv6", (inst, def) => {
294
- def.pattern ?? (def.pattern = regexes.ipv6);
295
- exports.$ZodStringFormat.init(inst, def);
296
- inst._zod.onattach.push((inst) => {
297
- const bag = inst._zod.bag;
298
- bag.format = `ipv6`;
299
- });
300
- inst._zod.check = (payload) => {
301
- try {
302
- new URL(`http://[${payload.value}]`);
303
- // return;
304
- }
305
- catch {
306
- payload.issues.push({
307
- code: "invalid_format",
308
- format: "ipv6",
309
- input: payload.value,
310
- inst,
311
- continue: !def.abort,
312
- });
313
- }
314
- };
315
- });
316
- exports.$ZodCIDRv4 = core.$constructor("$ZodCIDRv4", (inst, def) => {
317
- def.pattern ?? (def.pattern = regexes.cidrv4);
318
- exports.$ZodStringFormat.init(inst, def);
319
- });
320
- exports.$ZodCIDRv6 = core.$constructor("$ZodCIDRv6", (inst, def) => {
321
- def.pattern ?? (def.pattern = regexes.cidrv6); // not used for validation
322
- exports.$ZodStringFormat.init(inst, def);
323
- inst._zod.check = (payload) => {
324
- const [address, prefix] = payload.value.split("/");
325
- try {
326
- if (!prefix)
327
- throw new Error();
328
- const prefixNum = Number(prefix);
329
- if (`${prefixNum}` !== prefix)
330
- throw new Error();
331
- if (prefixNum < 0 || prefixNum > 128)
332
- throw new Error();
333
- new URL(`http://[${address}]`);
334
- }
335
- catch {
336
- payload.issues.push({
337
- code: "invalid_format",
338
- format: "cidrv6",
339
- input: payload.value,
340
- inst,
341
- continue: !def.abort,
342
- });
343
- }
344
- };
345
- });
346
- ////////////////////////////// ZodBase64 //////////////////////////////
347
- function isValidBase64(data) {
348
- if (data === "")
349
- return true;
350
- if (data.length % 4 !== 0)
351
- return false;
352
- try {
353
- atob(data);
354
- return true;
355
- }
356
- catch {
357
- return false;
358
- }
359
- }
360
- exports.$ZodBase64 = core.$constructor("$ZodBase64", (inst, def) => {
361
- def.pattern ?? (def.pattern = regexes.base64);
362
- exports.$ZodStringFormat.init(inst, def);
363
- inst._zod.onattach.push((inst) => {
364
- inst._zod.bag.contentEncoding = "base64";
365
- });
366
- inst._zod.check = (payload) => {
367
- if (isValidBase64(payload.value))
368
- return;
369
- payload.issues.push({
370
- code: "invalid_format",
371
- format: "base64",
372
- input: payload.value,
373
- inst,
374
- continue: !def.abort,
375
- });
376
- };
377
- });
378
- ////////////////////////////// ZodBase64 //////////////////////////////
379
- function isValidBase64URL(data) {
380
- if (!regexes.base64url.test(data))
381
- return false;
382
- const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
383
- const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
384
- return isValidBase64(padded);
385
- }
386
- exports.$ZodBase64URL = core.$constructor("$ZodBase64URL", (inst, def) => {
387
- def.pattern ?? (def.pattern = regexes.base64url);
388
- exports.$ZodStringFormat.init(inst, def);
389
- inst._zod.onattach.push((inst) => {
390
- inst._zod.bag.contentEncoding = "base64url";
391
- });
392
- inst._zod.check = (payload) => {
393
- if (isValidBase64URL(payload.value))
394
- return;
395
- payload.issues.push({
396
- code: "invalid_format",
397
- format: "base64url",
398
- input: payload.value,
399
- inst,
400
- continue: !def.abort,
401
- });
402
- };
403
- });
404
- exports.$ZodE164 = core.$constructor("$ZodE164", (inst, def) => {
405
- def.pattern ?? (def.pattern = regexes.e164);
406
- exports.$ZodStringFormat.init(inst, def);
407
- });
408
- ////////////////////////////// ZodJWT //////////////////////////////
409
- function isValidJWT(token, algorithm = null) {
410
- try {
411
- const tokensParts = token.split(".");
412
- if (tokensParts.length !== 3)
413
- return false;
414
- const [header] = tokensParts;
415
- if (!header)
416
- return false;
417
- const parsedHeader = JSON.parse(atob(header));
418
- if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
419
- return false;
420
- if (!parsedHeader.alg)
421
- return false;
422
- if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
423
- return false;
424
- return true;
425
- }
426
- catch {
427
- return false;
428
- }
429
- }
430
- exports.$ZodJWT = core.$constructor("$ZodJWT", (inst, def) => {
431
- exports.$ZodStringFormat.init(inst, def);
432
- inst._zod.check = (payload) => {
433
- if (isValidJWT(payload.value, def.alg))
434
- return;
435
- payload.issues.push({
436
- code: "invalid_format",
437
- format: "jwt",
438
- input: payload.value,
439
- inst,
440
- continue: !def.abort,
441
- });
442
- };
443
- });
444
- exports.$ZodCustomStringFormat = core.$constructor("$ZodCustomStringFormat", (inst, def) => {
445
- exports.$ZodStringFormat.init(inst, def);
446
- inst._zod.check = (payload) => {
447
- if (def.fn(payload.value))
448
- return;
449
- payload.issues.push({
450
- code: "invalid_format",
451
- format: def.format,
452
- input: payload.value,
453
- inst,
454
- continue: !def.abort,
455
- });
456
- };
457
- });
458
- exports.$ZodNumber = core.$constructor("$ZodNumber", (inst, def) => {
459
- exports.$ZodType.init(inst, def);
460
- inst._zod.pattern = inst._zod.bag.pattern ?? regexes.number;
461
- inst._zod.parse = (payload, _ctx) => {
462
- if (def.coerce)
463
- try {
464
- payload.value = Number(payload.value);
465
- }
466
- catch (_) { }
467
- const input = payload.value;
468
- if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
469
- return payload;
470
- }
471
- const received = typeof input === "number"
472
- ? Number.isNaN(input)
473
- ? "NaN"
474
- : !Number.isFinite(input)
475
- ? "Infinity"
476
- : undefined
477
- : undefined;
478
- payload.issues.push({
479
- expected: "number",
480
- code: "invalid_type",
481
- input,
482
- inst,
483
- ...(received ? { received } : {}),
484
- });
485
- return payload;
486
- };
487
- });
488
- exports.$ZodNumberFormat = core.$constructor("$ZodNumber", (inst, def) => {
489
- checks.$ZodCheckNumberFormat.init(inst, def);
490
- exports.$ZodNumber.init(inst, def); // no format checksp
491
- });
492
- exports.$ZodBoolean = core.$constructor("$ZodBoolean", (inst, def) => {
493
- exports.$ZodType.init(inst, def);
494
- inst._zod.pattern = regexes.boolean;
495
- inst._zod.parse = (payload, _ctx) => {
496
- if (def.coerce)
497
- try {
498
- payload.value = Boolean(payload.value);
499
- }
500
- catch (_) { }
501
- const input = payload.value;
502
- if (typeof input === "boolean")
503
- return payload;
504
- payload.issues.push({
505
- expected: "boolean",
506
- code: "invalid_type",
507
- input,
508
- inst,
509
- });
510
- return payload;
511
- };
512
- });
513
- exports.$ZodBigInt = core.$constructor("$ZodBigInt", (inst, def) => {
514
- exports.$ZodType.init(inst, def);
515
- inst._zod.pattern = regexes.bigint;
516
- inst._zod.parse = (payload, _ctx) => {
517
- if (def.coerce)
518
- try {
519
- payload.value = BigInt(payload.value);
520
- }
521
- catch (_) { }
522
- if (typeof payload.value === "bigint")
523
- return payload;
524
- payload.issues.push({
525
- expected: "bigint",
526
- code: "invalid_type",
527
- input: payload.value,
528
- inst,
529
- });
530
- return payload;
531
- };
532
- });
533
- exports.$ZodBigIntFormat = core.$constructor("$ZodBigInt", (inst, def) => {
534
- checks.$ZodCheckBigIntFormat.init(inst, def);
535
- exports.$ZodBigInt.init(inst, def); // no format checks
536
- });
537
- exports.$ZodSymbol = core.$constructor("$ZodSymbol", (inst, def) => {
538
- exports.$ZodType.init(inst, def);
539
- inst._zod.parse = (payload, _ctx) => {
540
- const input = payload.value;
541
- if (typeof input === "symbol")
542
- return payload;
543
- payload.issues.push({
544
- expected: "symbol",
545
- code: "invalid_type",
546
- input,
547
- inst,
548
- });
549
- return payload;
550
- };
551
- });
552
- exports.$ZodUndefined = core.$constructor("$ZodUndefined", (inst, def) => {
553
- exports.$ZodType.init(inst, def);
554
- inst._zod.pattern = regexes.undefined;
555
- inst._zod.values = new Set([undefined]);
556
- inst._zod.optin = "optional";
557
- inst._zod.optout = "optional";
558
- inst._zod.parse = (payload, _ctx) => {
559
- const input = payload.value;
560
- if (typeof input === "undefined")
561
- return payload;
562
- payload.issues.push({
563
- expected: "undefined",
564
- code: "invalid_type",
565
- input,
566
- inst,
567
- });
568
- return payload;
569
- };
570
- });
571
- exports.$ZodNull = core.$constructor("$ZodNull", (inst, def) => {
572
- exports.$ZodType.init(inst, def);
573
- inst._zod.pattern = regexes.null;
574
- inst._zod.values = new Set([null]);
575
- inst._zod.parse = (payload, _ctx) => {
576
- const input = payload.value;
577
- if (input === null)
578
- return payload;
579
- payload.issues.push({
580
- expected: "null",
581
- code: "invalid_type",
582
- input,
583
- inst,
584
- });
585
- return payload;
586
- };
587
- });
588
- exports.$ZodAny = core.$constructor("$ZodAny", (inst, def) => {
589
- exports.$ZodType.init(inst, def);
590
- inst._zod.parse = (payload) => payload;
591
- });
592
- exports.$ZodUnknown = core.$constructor("$ZodUnknown", (inst, def) => {
593
- exports.$ZodType.init(inst, def);
594
- inst._zod.parse = (payload) => payload;
595
- });
596
- exports.$ZodNever = core.$constructor("$ZodNever", (inst, def) => {
597
- exports.$ZodType.init(inst, def);
598
- inst._zod.parse = (payload, _ctx) => {
599
- payload.issues.push({
600
- expected: "never",
601
- code: "invalid_type",
602
- input: payload.value,
603
- inst,
604
- });
605
- return payload;
606
- };
607
- });
608
- exports.$ZodVoid = core.$constructor("$ZodVoid", (inst, def) => {
609
- exports.$ZodType.init(inst, def);
610
- inst._zod.parse = (payload, _ctx) => {
611
- const input = payload.value;
612
- if (typeof input === "undefined")
613
- return payload;
614
- payload.issues.push({
615
- expected: "void",
616
- code: "invalid_type",
617
- input,
618
- inst,
619
- });
620
- return payload;
621
- };
622
- });
623
- exports.$ZodDate = core.$constructor("$ZodDate", (inst, def) => {
624
- exports.$ZodType.init(inst, def);
625
- inst._zod.parse = (payload, _ctx) => {
626
- if (def.coerce) {
627
- try {
628
- payload.value = new Date(payload.value);
629
- }
630
- catch (_err) { }
631
- }
632
- const input = payload.value;
633
- const isDate = input instanceof Date;
634
- const isValidDate = isDate && !Number.isNaN(input.getTime());
635
- if (isValidDate)
636
- return payload;
637
- payload.issues.push({
638
- expected: "date",
639
- code: "invalid_type",
640
- input,
641
- ...(isDate ? { received: "Invalid Date" } : {}),
642
- inst,
643
- });
644
- return payload;
645
- };
646
- });
647
- function handleArrayResult(result, final, index) {
648
- if (result.issues.length) {
649
- final.issues.push(...util.prefixIssues(index, result.issues));
650
- }
651
- final.value[index] = result.value;
652
- }
653
- exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
654
- exports.$ZodType.init(inst, def);
655
- inst._zod.parse = (payload, ctx) => {
656
- const input = payload.value;
657
- if (!Array.isArray(input)) {
658
- payload.issues.push({
659
- expected: "array",
660
- code: "invalid_type",
661
- input,
662
- inst,
663
- });
664
- return payload;
665
- }
666
- payload.value = Array(input.length);
667
- const proms = [];
668
- for (let i = 0; i < input.length; i++) {
669
- const item = input[i];
670
- const result = def.element._zod.run({
671
- value: item,
672
- issues: [],
673
- }, ctx);
674
- if (result instanceof Promise) {
675
- proms.push(result.then((result) => handleArrayResult(result, payload, i)));
676
- }
677
- else {
678
- handleArrayResult(result, payload, i);
679
- }
680
- }
681
- if (proms.length) {
682
- return Promise.all(proms).then(() => payload);
683
- }
684
- return payload; //handleArrayResultsAsync(parseResults, final);
685
- };
686
- });
687
- function handleObjectResult(result, final, key) {
688
- // if(isOptional)
689
- if (result.issues.length) {
690
- final.issues.push(...util.prefixIssues(key, result.issues));
691
- }
692
- final.value[key] = result.value;
693
- }
694
- function handleOptionalObjectResult(result, final, key, input) {
695
- if (result.issues.length) {
696
- // validation failed against value schema
697
- if (input[key] === undefined) {
698
- // if input was undefined, ignore the error
699
- if (key in input) {
700
- final.value[key] = undefined;
701
- }
702
- else {
703
- final.value[key] = result.value;
704
- }
705
- }
706
- else {
707
- final.issues.push(...util.prefixIssues(key, result.issues));
708
- }
709
- }
710
- else if (result.value === undefined) {
711
- // validation returned `undefined`
712
- if (key in input)
713
- final.value[key] = undefined;
714
- }
715
- else {
716
- // non-undefined value
717
- final.value[key] = result.value;
718
- }
719
- }
720
- exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
721
- // requires cast because technically $ZodObject doesn't extend
722
- exports.$ZodType.init(inst, def);
723
- const _normalized = util.cached(() => {
724
- const keys = Object.keys(def.shape);
725
- for (const k of keys) {
726
- if (!(def.shape[k] instanceof exports.$ZodType)) {
727
- throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
728
- }
729
- }
730
- const okeys = util.optionalKeys(def.shape);
731
- return {
732
- shape: def.shape,
733
- keys,
734
- keySet: new Set(keys),
735
- numKeys: keys.length,
736
- optionalKeys: new Set(okeys),
737
- };
738
- });
739
- util.defineLazy(inst._zod, "propValues", () => {
740
- const shape = def.shape;
741
- const propValues = {};
742
- for (const key in shape) {
743
- const field = shape[key]._zod;
744
- if (field.values) {
745
- propValues[key] ?? (propValues[key] = new Set());
746
- for (const v of field.values)
747
- propValues[key].add(v);
748
- }
749
- }
750
- return propValues;
751
- });
752
- const generateFastpass = (shape) => {
753
- const doc = new doc_js_1.Doc(["shape", "payload", "ctx"]);
754
- const normalized = _normalized.value;
755
- const parseStr = (key) => {
756
- const k = util.esc(key);
757
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
758
- };
759
- doc.write(`const input = payload.value;`);
760
- const ids = Object.create(null);
761
- let counter = 0;
762
- for (const key of normalized.keys) {
763
- ids[key] = `key_${counter++}`;
764
- }
765
- // A: preserve key order {
766
- doc.write(`const newResult = {}`);
767
- for (const key of normalized.keys) {
768
- if (normalized.optionalKeys.has(key)) {
769
- const id = ids[key];
770
- doc.write(`const ${id} = ${parseStr(key)};`);
771
- const k = util.esc(key);
772
- doc.write(`
773
- if (${id}.issues.length) {
774
- if (input[${k}] === undefined) {
775
- if (${k} in input) {
776
- newResult[${k}] = undefined;
777
- }
778
- } else {
779
- payload.issues = payload.issues.concat(
780
- ${id}.issues.map((iss) => ({
781
- ...iss,
782
- path: iss.path ? [${k}, ...iss.path] : [${k}],
783
- }))
784
- );
785
- }
786
- } else if (${id}.value === undefined) {
787
- if (${k} in input) newResult[${k}] = undefined;
788
- } else {
789
- newResult[${k}] = ${id}.value;
790
- }
791
- `);
792
- }
793
- else {
794
- const id = ids[key];
795
- // const id = ids[key];
796
- doc.write(`const ${id} = ${parseStr(key)};`);
797
- doc.write(`
798
- if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
799
- ...iss,
800
- path: iss.path ? [${util.esc(key)}, ...iss.path] : [${util.esc(key)}]
801
- })));`);
802
- doc.write(`newResult[${util.esc(key)}] = ${id}.value`);
803
- }
804
- }
805
- doc.write(`payload.value = newResult;`);
806
- doc.write(`return payload;`);
807
- const fn = doc.compile();
808
- return (payload, ctx) => fn(shape, payload, ctx);
809
- };
810
- let fastpass;
811
- const isObject = util.isObject;
812
- const jit = !core.globalConfig.jitless;
813
- const allowsEval = util.allowsEval;
814
- const fastEnabled = jit && allowsEval.value; // && !def.catchall;
815
- const catchall = def.catchall;
816
- let value;
817
- inst._zod.parse = (payload, ctx) => {
818
- value ?? (value = _normalized.value);
819
- const input = payload.value;
820
- if (!isObject(input)) {
821
- payload.issues.push({
822
- expected: "object",
823
- code: "invalid_type",
824
- input,
825
- inst,
826
- });
827
- return payload;
828
- }
829
- const proms = [];
830
- if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
831
- // always synchronous
832
- if (!fastpass)
833
- fastpass = generateFastpass(def.shape);
834
- payload = fastpass(payload, ctx);
835
- }
836
- else {
837
- payload.value = {};
838
- const shape = value.shape;
839
- for (const key of value.keys) {
840
- const el = shape[key];
841
- // do not add omitted optional keys
842
- // if (!(key in input)) {
843
- // if (optionalKeys.has(key)) continue;
844
- // payload.issues.push({
845
- // code: "invalid_type",
846
- // path: [key],
847
- // expected: "nonoptional",
848
- // note: `Missing required key: "${key}"`,
849
- // input,
850
- // inst,
851
- // });
852
- // }
853
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
854
- const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
855
- if (r instanceof Promise) {
856
- proms.push(r.then((r) => isOptional ? handleOptionalObjectResult(r, payload, key, input) : handleObjectResult(r, payload, key)));
857
- }
858
- else if (isOptional) {
859
- handleOptionalObjectResult(r, payload, key, input);
860
- }
861
- else {
862
- handleObjectResult(r, payload, key);
863
- }
864
- }
865
- }
866
- if (!catchall) {
867
- // return payload;
868
- return proms.length ? Promise.all(proms).then(() => payload) : payload;
869
- }
870
- const unrecognized = [];
871
- // iterate over input keys
872
- const keySet = value.keySet;
873
- const _catchall = catchall._zod;
874
- const t = _catchall.def.type;
875
- for (const key of Object.keys(input)) {
876
- if (keySet.has(key))
877
- continue;
878
- if (t === "never") {
879
- unrecognized.push(key);
880
- continue;
881
- }
882
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
883
- if (r instanceof Promise) {
884
- proms.push(r.then((r) => handleObjectResult(r, payload, key)));
885
- }
886
- else {
887
- handleObjectResult(r, payload, key);
888
- }
889
- }
890
- if (unrecognized.length) {
891
- payload.issues.push({
892
- code: "unrecognized_keys",
893
- keys: unrecognized,
894
- input,
895
- inst,
896
- });
897
- }
898
- if (!proms.length)
899
- return payload;
900
- return Promise.all(proms).then(() => {
901
- return payload;
902
- });
903
- };
904
- });
905
- function handleUnionResults(results, final, inst, ctx) {
906
- for (const result of results) {
907
- if (result.issues.length === 0) {
908
- final.value = result.value;
909
- return final;
910
- }
911
- }
912
- final.issues.push({
913
- code: "invalid_union",
914
- input: final.value,
915
- inst,
916
- errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
917
- });
918
- return final;
919
- }
920
- exports.$ZodUnion = core.$constructor("$ZodUnion", (inst, def) => {
921
- exports.$ZodType.init(inst, def);
922
- util.defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined);
923
- util.defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
924
- util.defineLazy(inst._zod, "values", () => {
925
- if (def.options.every((o) => o._zod.values)) {
926
- return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
927
- }
928
- return undefined;
929
- });
930
- util.defineLazy(inst._zod, "pattern", () => {
931
- if (def.options.every((o) => o._zod.pattern)) {
932
- const patterns = def.options.map((o) => o._zod.pattern);
933
- return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join("|")})$`);
934
- }
935
- return undefined;
936
- });
937
- inst._zod.parse = (payload, ctx) => {
938
- let async = false;
939
- const results = [];
940
- for (const option of def.options) {
941
- const result = option._zod.run({
942
- value: payload.value,
943
- issues: [],
944
- }, ctx);
945
- if (result instanceof Promise) {
946
- results.push(result);
947
- async = true;
948
- }
949
- else {
950
- if (result.issues.length === 0)
951
- return result;
952
- results.push(result);
953
- }
954
- }
955
- if (!async)
956
- return handleUnionResults(results, payload, inst, ctx);
957
- return Promise.all(results).then((results) => {
958
- return handleUnionResults(results, payload, inst, ctx);
959
- });
960
- };
961
- });
962
- exports.$ZodDiscriminatedUnion =
963
- /*@__PURE__*/
964
- core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
965
- exports.$ZodUnion.init(inst, def);
966
- const _super = inst._zod.parse;
967
- util.defineLazy(inst._zod, "propValues", () => {
968
- const propValues = {};
969
- for (const option of def.options) {
970
- const pv = option._zod.propValues;
971
- if (!pv || Object.keys(pv).length === 0)
972
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
973
- for (const [k, v] of Object.entries(pv)) {
974
- if (!propValues[k])
975
- propValues[k] = new Set();
976
- for (const val of v) {
977
- propValues[k].add(val);
978
- }
979
- }
980
- }
981
- return propValues;
982
- });
983
- const disc = util.cached(() => {
984
- const opts = def.options;
985
- const map = new Map();
986
- for (const o of opts) {
987
- const values = o._zod.propValues[def.discriminator];
988
- if (!values || values.size === 0)
989
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
990
- for (const v of values) {
991
- if (map.has(v)) {
992
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
993
- }
994
- map.set(v, o);
995
- }
996
- }
997
- return map;
998
- });
999
- inst._zod.parse = (payload, ctx) => {
1000
- const input = payload.value;
1001
- if (!util.isObject(input)) {
1002
- payload.issues.push({
1003
- code: "invalid_type",
1004
- expected: "object",
1005
- input,
1006
- inst,
1007
- });
1008
- return payload;
1009
- }
1010
- const opt = disc.value.get(input?.[def.discriminator]);
1011
- if (opt) {
1012
- return opt._zod.run(payload, ctx);
1013
- }
1014
- if (def.unionFallback) {
1015
- return _super(payload, ctx);
1016
- }
1017
- // no matching discriminator
1018
- payload.issues.push({
1019
- code: "invalid_union",
1020
- errors: [],
1021
- note: "No matching discriminator",
1022
- input,
1023
- path: [def.discriminator],
1024
- inst,
1025
- });
1026
- return payload;
1027
- };
1028
- });
1029
- exports.$ZodIntersection = core.$constructor("$ZodIntersection", (inst, def) => {
1030
- exports.$ZodType.init(inst, def);
1031
- inst._zod.parse = (payload, ctx) => {
1032
- const input = payload.value;
1033
- const left = def.left._zod.run({ value: input, issues: [] }, ctx);
1034
- const right = def.right._zod.run({ value: input, issues: [] }, ctx);
1035
- const async = left instanceof Promise || right instanceof Promise;
1036
- if (async) {
1037
- return Promise.all([left, right]).then(([left, right]) => {
1038
- return handleIntersectionResults(payload, left, right);
1039
- });
1040
- }
1041
- return handleIntersectionResults(payload, left, right);
1042
- };
1043
- });
1044
- function mergeValues(a, b) {
1045
- // const aType = parse.t(a);
1046
- // const bType = parse.t(b);
1047
- if (a === b) {
1048
- return { valid: true, data: a };
1049
- }
1050
- if (a instanceof Date && b instanceof Date && +a === +b) {
1051
- return { valid: true, data: a };
1052
- }
1053
- if (util.isPlainObject(a) && util.isPlainObject(b)) {
1054
- const bKeys = Object.keys(b);
1055
- const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
1056
- const newObj = { ...a, ...b };
1057
- for (const key of sharedKeys) {
1058
- const sharedValue = mergeValues(a[key], b[key]);
1059
- if (!sharedValue.valid) {
1060
- return {
1061
- valid: false,
1062
- mergeErrorPath: [key, ...sharedValue.mergeErrorPath],
1063
- };
1064
- }
1065
- newObj[key] = sharedValue.data;
1066
- }
1067
- return { valid: true, data: newObj };
1068
- }
1069
- if (Array.isArray(a) && Array.isArray(b)) {
1070
- if (a.length !== b.length) {
1071
- return { valid: false, mergeErrorPath: [] };
1072
- }
1073
- const newArray = [];
1074
- for (let index = 0; index < a.length; index++) {
1075
- const itemA = a[index];
1076
- const itemB = b[index];
1077
- const sharedValue = mergeValues(itemA, itemB);
1078
- if (!sharedValue.valid) {
1079
- return {
1080
- valid: false,
1081
- mergeErrorPath: [index, ...sharedValue.mergeErrorPath],
1082
- };
1083
- }
1084
- newArray.push(sharedValue.data);
1085
- }
1086
- return { valid: true, data: newArray };
1087
- }
1088
- return { valid: false, mergeErrorPath: [] };
1089
- }
1090
- function handleIntersectionResults(result, left, right) {
1091
- if (left.issues.length) {
1092
- result.issues.push(...left.issues);
1093
- }
1094
- if (right.issues.length) {
1095
- result.issues.push(...right.issues);
1096
- }
1097
- if (util.aborted(result))
1098
- return result;
1099
- const merged = mergeValues(left.value, right.value);
1100
- if (!merged.valid) {
1101
- throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
1102
- }
1103
- result.value = merged.data;
1104
- return result;
1105
- }
1106
- exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
1107
- exports.$ZodType.init(inst, def);
1108
- const items = def.items;
1109
- const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
1110
- inst._zod.parse = (payload, ctx) => {
1111
- const input = payload.value;
1112
- if (!Array.isArray(input)) {
1113
- payload.issues.push({
1114
- input,
1115
- inst,
1116
- expected: "tuple",
1117
- code: "invalid_type",
1118
- });
1119
- return payload;
1120
- }
1121
- payload.value = [];
1122
- const proms = [];
1123
- if (!def.rest) {
1124
- const tooBig = input.length > items.length;
1125
- const tooSmall = input.length < optStart - 1;
1126
- if (tooBig || tooSmall) {
1127
- payload.issues.push({
1128
- input,
1129
- inst,
1130
- origin: "array",
1131
- ...(tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }),
1132
- });
1133
- return payload;
1134
- }
1135
- }
1136
- let i = -1;
1137
- for (const item of items) {
1138
- i++;
1139
- if (i >= input.length)
1140
- if (i >= optStart)
1141
- continue;
1142
- const result = item._zod.run({
1143
- value: input[i],
1144
- issues: [],
1145
- }, ctx);
1146
- if (result instanceof Promise) {
1147
- proms.push(result.then((result) => handleTupleResult(result, payload, i)));
1148
- }
1149
- else {
1150
- handleTupleResult(result, payload, i);
1151
- }
1152
- }
1153
- if (def.rest) {
1154
- const rest = input.slice(items.length);
1155
- for (const el of rest) {
1156
- i++;
1157
- const result = def.rest._zod.run({
1158
- value: el,
1159
- issues: [],
1160
- }, ctx);
1161
- if (result instanceof Promise) {
1162
- proms.push(result.then((result) => handleTupleResult(result, payload, i)));
1163
- }
1164
- else {
1165
- handleTupleResult(result, payload, i);
1166
- }
1167
- }
1168
- }
1169
- if (proms.length)
1170
- return Promise.all(proms).then(() => payload);
1171
- return payload;
1172
- };
1173
- });
1174
- function handleTupleResult(result, final, index) {
1175
- if (result.issues.length) {
1176
- final.issues.push(...util.prefixIssues(index, result.issues));
1177
- }
1178
- final.value[index] = result.value;
1179
- }
1180
- exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
1181
- exports.$ZodType.init(inst, def);
1182
- inst._zod.parse = (payload, ctx) => {
1183
- const input = payload.value;
1184
- if (!util.isPlainObject(input)) {
1185
- payload.issues.push({
1186
- expected: "record",
1187
- code: "invalid_type",
1188
- input,
1189
- inst,
1190
- });
1191
- return payload;
1192
- }
1193
- const proms = [];
1194
- if (def.keyType._zod.values) {
1195
- const values = def.keyType._zod.values;
1196
- payload.value = {};
1197
- for (const key of values) {
1198
- if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1199
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1200
- if (result instanceof Promise) {
1201
- proms.push(result.then((result) => {
1202
- if (result.issues.length) {
1203
- payload.issues.push(...util.prefixIssues(key, result.issues));
1204
- }
1205
- payload.value[key] = result.value;
1206
- }));
1207
- }
1208
- else {
1209
- if (result.issues.length) {
1210
- payload.issues.push(...util.prefixIssues(key, result.issues));
1211
- }
1212
- payload.value[key] = result.value;
1213
- }
1214
- }
1215
- }
1216
- let unrecognized;
1217
- for (const key in input) {
1218
- if (!values.has(key)) {
1219
- unrecognized = unrecognized ?? [];
1220
- unrecognized.push(key);
1221
- }
1222
- }
1223
- if (unrecognized && unrecognized.length > 0) {
1224
- payload.issues.push({
1225
- code: "unrecognized_keys",
1226
- input,
1227
- inst,
1228
- keys: unrecognized,
1229
- });
1230
- }
1231
- }
1232
- else {
1233
- payload.value = {};
1234
- for (const key of Reflect.ownKeys(input)) {
1235
- if (key === "__proto__")
1236
- continue;
1237
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1238
- if (keyResult instanceof Promise) {
1239
- throw new Error("Async schemas not supported in object keys currently");
1240
- }
1241
- if (keyResult.issues.length) {
1242
- payload.issues.push({
1243
- origin: "record",
1244
- code: "invalid_key",
1245
- issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1246
- input: key,
1247
- path: [key],
1248
- inst,
1249
- });
1250
- payload.value[keyResult.value] = keyResult.value;
1251
- continue;
1252
- }
1253
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1254
- if (result instanceof Promise) {
1255
- proms.push(result.then((result) => {
1256
- if (result.issues.length) {
1257
- payload.issues.push(...util.prefixIssues(key, result.issues));
1258
- }
1259
- payload.value[keyResult.value] = result.value;
1260
- }));
1261
- }
1262
- else {
1263
- if (result.issues.length) {
1264
- payload.issues.push(...util.prefixIssues(key, result.issues));
1265
- }
1266
- payload.value[keyResult.value] = result.value;
1267
- }
1268
- }
1269
- }
1270
- if (proms.length) {
1271
- return Promise.all(proms).then(() => payload);
1272
- }
1273
- return payload;
1274
- };
1275
- });
1276
- exports.$ZodMap = core.$constructor("$ZodMap", (inst, def) => {
1277
- exports.$ZodType.init(inst, def);
1278
- inst._zod.parse = (payload, ctx) => {
1279
- const input = payload.value;
1280
- if (!(input instanceof Map)) {
1281
- payload.issues.push({
1282
- expected: "map",
1283
- code: "invalid_type",
1284
- input,
1285
- inst,
1286
- });
1287
- return payload;
1288
- }
1289
- const proms = [];
1290
- payload.value = new Map();
1291
- for (const [key, value] of input) {
1292
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1293
- const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
1294
- if (keyResult instanceof Promise || valueResult instanceof Promise) {
1295
- proms.push(Promise.all([keyResult, valueResult]).then(([keyResult, valueResult]) => {
1296
- handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
1297
- }));
1298
- }
1299
- else {
1300
- handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
1301
- }
1302
- }
1303
- if (proms.length)
1304
- return Promise.all(proms).then(() => payload);
1305
- return payload;
1306
- };
1307
- });
1308
- function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
1309
- if (keyResult.issues.length) {
1310
- if (util.propertyKeyTypes.has(typeof key)) {
1311
- final.issues.push(...util.prefixIssues(key, keyResult.issues));
1312
- }
1313
- else {
1314
- final.issues.push({
1315
- origin: "map",
1316
- code: "invalid_key",
1317
- input,
1318
- inst,
1319
- issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1320
- });
1321
- }
1322
- }
1323
- if (valueResult.issues.length) {
1324
- if (util.propertyKeyTypes.has(typeof key)) {
1325
- final.issues.push(...util.prefixIssues(key, valueResult.issues));
1326
- }
1327
- else {
1328
- final.issues.push({
1329
- origin: "map",
1330
- code: "invalid_element",
1331
- input,
1332
- inst,
1333
- key: key,
1334
- issues: valueResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1335
- });
1336
- }
1337
- }
1338
- final.value.set(keyResult.value, valueResult.value);
1339
- }
1340
- exports.$ZodSet = core.$constructor("$ZodSet", (inst, def) => {
1341
- exports.$ZodType.init(inst, def);
1342
- inst._zod.parse = (payload, ctx) => {
1343
- const input = payload.value;
1344
- if (!(input instanceof Set)) {
1345
- payload.issues.push({
1346
- input,
1347
- inst,
1348
- expected: "set",
1349
- code: "invalid_type",
1350
- });
1351
- return payload;
1352
- }
1353
- const proms = [];
1354
- payload.value = new Set();
1355
- for (const item of input) {
1356
- const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
1357
- if (result instanceof Promise) {
1358
- proms.push(result.then((result) => handleSetResult(result, payload)));
1359
- }
1360
- else
1361
- handleSetResult(result, payload);
1362
- }
1363
- if (proms.length)
1364
- return Promise.all(proms).then(() => payload);
1365
- return payload;
1366
- };
1367
- });
1368
- function handleSetResult(result, final) {
1369
- if (result.issues.length) {
1370
- final.issues.push(...result.issues);
1371
- }
1372
- final.value.add(result.value);
1373
- }
1374
- exports.$ZodEnum = core.$constructor("$ZodEnum", (inst, def) => {
1375
- exports.$ZodType.init(inst, def);
1376
- const values = util.getEnumValues(def.entries);
1377
- inst._zod.values = new Set(values);
1378
- inst._zod.pattern = new RegExp(`^(${values
1379
- .filter((k) => util.propertyKeyTypes.has(typeof k))
1380
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o.toString()))
1381
- .join("|")})$`);
1382
- inst._zod.parse = (payload, _ctx) => {
1383
- const input = payload.value;
1384
- if (inst._zod.values.has(input)) {
1385
- return payload;
1386
- }
1387
- payload.issues.push({
1388
- code: "invalid_value",
1389
- values,
1390
- input,
1391
- inst,
1392
- });
1393
- return payload;
1394
- };
1395
- });
1396
- exports.$ZodLiteral = core.$constructor("$ZodLiteral", (inst, def) => {
1397
- exports.$ZodType.init(inst, def);
1398
- inst._zod.values = new Set(def.values);
1399
- inst._zod.pattern = new RegExp(`^(${def.values
1400
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? o.toString() : String(o)))
1401
- .join("|")})$`);
1402
- inst._zod.parse = (payload, _ctx) => {
1403
- const input = payload.value;
1404
- if (inst._zod.values.has(input)) {
1405
- return payload;
1406
- }
1407
- payload.issues.push({
1408
- code: "invalid_value",
1409
- values: def.values,
1410
- input,
1411
- inst,
1412
- });
1413
- return payload;
1414
- };
1415
- });
1416
- exports.$ZodFile = core.$constructor("$ZodFile", (inst, def) => {
1417
- exports.$ZodType.init(inst, def);
1418
- inst._zod.parse = (payload, _ctx) => {
1419
- const input = payload.value;
1420
- if (input instanceof File)
1421
- return payload;
1422
- payload.issues.push({
1423
- expected: "file",
1424
- code: "invalid_type",
1425
- input,
1426
- inst,
1427
- });
1428
- return payload;
1429
- };
1430
- });
1431
- exports.$ZodTransform = core.$constructor("$ZodTransform", (inst, def) => {
1432
- exports.$ZodType.init(inst, def);
1433
- inst._zod.parse = (payload, _ctx) => {
1434
- const _out = def.transform(payload.value, payload);
1435
- if (_ctx.async) {
1436
- const output = _out instanceof Promise ? _out : Promise.resolve(_out);
1437
- return output.then((output) => {
1438
- payload.value = output;
1439
- return payload;
1440
- });
1441
- }
1442
- if (_out instanceof Promise) {
1443
- throw new core.$ZodAsyncError();
1444
- }
1445
- payload.value = _out;
1446
- return payload;
1447
- };
1448
- });
1449
- exports.$ZodOptional = core.$constructor("$ZodOptional", (inst, def) => {
1450
- exports.$ZodType.init(inst, def);
1451
- inst._zod.optin = "optional";
1452
- inst._zod.optout = "optional";
1453
- util.defineLazy(inst._zod, "values", () => {
1454
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
1455
- });
1456
- util.defineLazy(inst._zod, "pattern", () => {
1457
- const pattern = def.innerType._zod.pattern;
1458
- return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
1459
- });
1460
- inst._zod.parse = (payload, ctx) => {
1461
- if (def.innerType._zod.optin === "optional") {
1462
- return def.innerType._zod.run(payload, ctx);
1463
- }
1464
- if (payload.value === undefined) {
1465
- return payload;
1466
- }
1467
- return def.innerType._zod.run(payload, ctx);
1468
- };
1469
- });
1470
- exports.$ZodNullable = core.$constructor("$ZodNullable", (inst, def) => {
1471
- exports.$ZodType.init(inst, def);
1472
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1473
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1474
- util.defineLazy(inst._zod, "pattern", () => {
1475
- const pattern = def.innerType._zod.pattern;
1476
- return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;
1477
- });
1478
- util.defineLazy(inst._zod, "values", () => {
1479
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
1480
- });
1481
- inst._zod.parse = (payload, ctx) => {
1482
- if (payload.value === null)
1483
- return payload;
1484
- return def.innerType._zod.run(payload, ctx);
1485
- };
1486
- });
1487
- exports.$ZodDefault = core.$constructor("$ZodDefault", (inst, def) => {
1488
- exports.$ZodType.init(inst, def);
1489
- // inst._zod.qin = "true";
1490
- inst._zod.optin = "optional";
1491
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1492
- inst._zod.parse = (payload, ctx) => {
1493
- if (payload.value === undefined) {
1494
- payload.value = def.defaultValue;
1495
- /**
1496
- * $ZodDefault always returns the default value immediately.
1497
- * 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. */
1498
- return payload;
1499
- }
1500
- const result = def.innerType._zod.run(payload, ctx);
1501
- if (result instanceof Promise) {
1502
- return result.then((result) => handleDefaultResult(result, def));
1503
- }
1504
- return handleDefaultResult(result, def);
1505
- };
1506
- });
1507
- function handleDefaultResult(payload, def) {
1508
- if (payload.value === undefined) {
1509
- payload.value = def.defaultValue;
1510
- }
1511
- return payload;
1512
- }
1513
- exports.$ZodPrefault = core.$constructor("$ZodPrefault", (inst, def) => {
1514
- exports.$ZodType.init(inst, def);
1515
- inst._zod.optin = "optional";
1516
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1517
- inst._zod.parse = (payload, ctx) => {
1518
- if (payload.value === undefined) {
1519
- payload.value = def.defaultValue;
1520
- }
1521
- return def.innerType._zod.run(payload, ctx);
1522
- };
1523
- });
1524
- exports.$ZodNonOptional = core.$constructor("$ZodNonOptional", (inst, def) => {
1525
- exports.$ZodType.init(inst, def);
1526
- util.defineLazy(inst._zod, "values", () => {
1527
- const v = def.innerType._zod.values;
1528
- return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
1529
- });
1530
- inst._zod.parse = (payload, ctx) => {
1531
- const result = def.innerType._zod.run(payload, ctx);
1532
- if (result instanceof Promise) {
1533
- return result.then((result) => handleNonOptionalResult(result, inst));
1534
- }
1535
- return handleNonOptionalResult(result, inst);
1536
- };
1537
- });
1538
- function handleNonOptionalResult(payload, inst) {
1539
- if (!payload.issues.length && payload.value === undefined) {
1540
- payload.issues.push({
1541
- code: "invalid_type",
1542
- expected: "nonoptional",
1543
- input: payload.value,
1544
- inst,
1545
- });
1546
- }
1547
- return payload;
1548
- }
1549
- exports.$ZodSuccess = core.$constructor("$ZodSuccess", (inst, def) => {
1550
- exports.$ZodType.init(inst, def);
1551
- inst._zod.parse = (payload, ctx) => {
1552
- const result = def.innerType._zod.run(payload, ctx);
1553
- if (result instanceof Promise) {
1554
- return result.then((result) => {
1555
- payload.value = result.issues.length === 0;
1556
- return payload;
1557
- });
1558
- }
1559
- payload.value = result.issues.length === 0;
1560
- return payload;
1561
- };
1562
- });
1563
- exports.$ZodCatch = core.$constructor("$ZodCatch", (inst, def) => {
1564
- exports.$ZodType.init(inst, def);
1565
- inst._zod.optin = "optional";
1566
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1567
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1568
- inst._zod.parse = (payload, ctx) => {
1569
- const result = def.innerType._zod.run(payload, ctx);
1570
- if (result instanceof Promise) {
1571
- return result.then((result) => {
1572
- payload.value = result.value;
1573
- if (result.issues.length) {
1574
- payload.value = def.catchValue({
1575
- ...payload,
1576
- error: {
1577
- issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1578
- },
1579
- input: payload.value,
1580
- });
1581
- payload.issues = [];
1582
- }
1583
- return payload;
1584
- });
1585
- }
1586
- payload.value = result.value;
1587
- if (result.issues.length) {
1588
- payload.value = def.catchValue({
1589
- ...payload,
1590
- error: {
1591
- issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1592
- },
1593
- input: payload.value,
1594
- });
1595
- payload.issues = [];
1596
- }
1597
- return payload;
1598
- };
1599
- });
1600
- exports.$ZodNaN = core.$constructor("$ZodNaN", (inst, def) => {
1601
- exports.$ZodType.init(inst, def);
1602
- inst._zod.parse = (payload, _ctx) => {
1603
- if (typeof payload.value !== "number" || !Number.isNaN(payload.value)) {
1604
- payload.issues.push({
1605
- input: payload.value,
1606
- inst,
1607
- expected: "nan",
1608
- code: "invalid_type",
1609
- });
1610
- return payload;
1611
- }
1612
- return payload;
1613
- };
1614
- });
1615
- exports.$ZodPipe = core.$constructor("$ZodPipe", (inst, def) => {
1616
- exports.$ZodType.init(inst, def);
1617
- util.defineLazy(inst._zod, "values", () => def.in._zod.values);
1618
- util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
1619
- util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
1620
- inst._zod.parse = (payload, ctx) => {
1621
- const left = def.in._zod.run(payload, ctx);
1622
- if (left instanceof Promise) {
1623
- return left.then((left) => handlePipeResult(left, def, ctx));
1624
- }
1625
- return handlePipeResult(left, def, ctx);
1626
- };
1627
- });
1628
- function handlePipeResult(left, def, ctx) {
1629
- if (util.aborted(left)) {
1630
- return left;
1631
- }
1632
- return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
1633
- }
1634
- exports.$ZodReadonly = core.$constructor("$ZodReadonly", (inst, def) => {
1635
- exports.$ZodType.init(inst, def);
1636
- util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
1637
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1638
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1639
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1640
- inst._zod.parse = (payload, ctx) => {
1641
- const result = def.innerType._zod.run(payload, ctx);
1642
- if (result instanceof Promise) {
1643
- return result.then(handleReadonlyResult);
1644
- }
1645
- return handleReadonlyResult(result);
1646
- };
1647
- });
1648
- function handleReadonlyResult(payload) {
1649
- payload.value = Object.freeze(payload.value);
1650
- return payload;
1651
- }
1652
- exports.$ZodTemplateLiteral = core.$constructor("$ZodTemplateLiteral", (inst, def) => {
1653
- exports.$ZodType.init(inst, def);
1654
- const regexParts = [];
1655
- for (const part of def.parts) {
1656
- if (part instanceof exports.$ZodType) {
1657
- if (!part._zod.pattern) {
1658
- // if (!source)
1659
- throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
1660
- }
1661
- const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
1662
- if (!source)
1663
- throw new Error(`Invalid template literal part: ${part._zod.traits}`);
1664
- const start = source.startsWith("^") ? 1 : 0;
1665
- const end = source.endsWith("$") ? source.length - 1 : source.length;
1666
- regexParts.push(source.slice(start, end));
1667
- }
1668
- else if (part === null || util.primitiveTypes.has(typeof part)) {
1669
- regexParts.push(util.escapeRegex(`${part}`));
1670
- }
1671
- else {
1672
- throw new Error(`Invalid template literal part: ${part}`);
1673
- }
1674
- }
1675
- inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);
1676
- inst._zod.parse = (payload, _ctx) => {
1677
- if (typeof payload.value !== "string") {
1678
- payload.issues.push({
1679
- input: payload.value,
1680
- inst,
1681
- expected: "template_literal",
1682
- code: "invalid_type",
1683
- });
1684
- return payload;
1685
- }
1686
- inst._zod.pattern.lastIndex = 0;
1687
- if (!inst._zod.pattern.test(payload.value)) {
1688
- payload.issues.push({
1689
- input: payload.value,
1690
- inst,
1691
- code: "invalid_format",
1692
- format: "template_literal",
1693
- pattern: inst._zod.pattern.source,
1694
- });
1695
- return payload;
1696
- }
1697
- return payload;
1698
- };
1699
- });
1700
- exports.$ZodPromise = core.$constructor("$ZodPromise", (inst, def) => {
1701
- exports.$ZodType.init(inst, def);
1702
- inst._zod.parse = (payload, ctx) => {
1703
- return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));
1704
- };
1705
- });
1706
- exports.$ZodLazy = core.$constructor("$ZodLazy", (inst, def) => {
1707
- exports.$ZodType.init(inst, def);
1708
- util.defineLazy(inst._zod, "innerType", () => def.getter());
1709
- util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
1710
- util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
1711
- util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin);
1712
- util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout);
1713
- inst._zod.parse = (payload, ctx) => {
1714
- const inner = inst._zod.innerType;
1715
- return inner._zod.run(payload, ctx);
1716
- };
1717
- });
1718
- exports.$ZodCustom = core.$constructor("$ZodCustom", (inst, def) => {
1719
- checks.$ZodCheck.init(inst, def);
1720
- exports.$ZodType.init(inst, def);
1721
- inst._zod.parse = (payload, _) => {
1722
- return payload;
1723
- };
1724
- inst._zod.check = (payload) => {
1725
- const input = payload.value;
1726
- const r = def.fn(input);
1727
- if (r instanceof Promise) {
1728
- return r.then((r) => handleRefineResult(r, payload, input, inst));
1729
- }
1730
- handleRefineResult(r, payload, input, inst);
1731
- return;
1732
- };
1733
- });
1734
- function handleRefineResult(result, payload, input, inst) {
1735
- if (!result) {
1736
- const _iss = {
1737
- code: "custom",
1738
- input,
1739
- inst, // incorporates params.error into issue reporting
1740
- path: [...(inst._zod.def.path ?? [])], // incorporates params.error into issue reporting
1741
- continue: !inst._zod.def.abort,
1742
- // params: inst._zod.def.params,
1743
- };
1744
- if (inst._zod.def.params)
1745
- _iss.params = inst._zod.def.params;
1746
- payload.issues.push(util.issue(_iss));
1747
- }
1748
- }