@ubundi/openclaw-cortex 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (599) hide show
  1. package/dist/internal/identity/api-key.js +1 -1
  2. package/openclaw.plugin.json +1 -1
  3. package/package.json +1 -4
  4. package/node_modules/zod/LICENSE +0 -21
  5. package/node_modules/zod/README.md +0 -208
  6. package/node_modules/zod/index.cjs +0 -33
  7. package/node_modules/zod/index.d.cts +0 -4
  8. package/node_modules/zod/index.d.ts +0 -4
  9. package/node_modules/zod/index.js +0 -4
  10. package/node_modules/zod/package.json +0 -118
  11. package/node_modules/zod/src/index.ts +0 -4
  12. package/node_modules/zod/src/v3/ZodError.ts +0 -330
  13. package/node_modules/zod/src/v3/benchmarks/datetime.ts +0 -58
  14. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +0 -80
  15. package/node_modules/zod/src/v3/benchmarks/index.ts +0 -59
  16. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +0 -57
  17. package/node_modules/zod/src/v3/benchmarks/object.ts +0 -69
  18. package/node_modules/zod/src/v3/benchmarks/primitives.ts +0 -162
  19. package/node_modules/zod/src/v3/benchmarks/realworld.ts +0 -63
  20. package/node_modules/zod/src/v3/benchmarks/string.ts +0 -55
  21. package/node_modules/zod/src/v3/benchmarks/union.ts +0 -80
  22. package/node_modules/zod/src/v3/errors.ts +0 -13
  23. package/node_modules/zod/src/v3/external.ts +0 -6
  24. package/node_modules/zod/src/v3/helpers/enumUtil.ts +0 -17
  25. package/node_modules/zod/src/v3/helpers/errorUtil.ts +0 -8
  26. package/node_modules/zod/src/v3/helpers/parseUtil.ts +0 -176
  27. package/node_modules/zod/src/v3/helpers/partialUtil.ts +0 -34
  28. package/node_modules/zod/src/v3/helpers/typeAliases.ts +0 -2
  29. package/node_modules/zod/src/v3/helpers/util.ts +0 -224
  30. package/node_modules/zod/src/v3/index.ts +0 -4
  31. package/node_modules/zod/src/v3/locales/en.ts +0 -124
  32. package/node_modules/zod/src/v3/standard-schema.ts +0 -113
  33. package/node_modules/zod/src/v3/tests/Mocker.ts +0 -54
  34. package/node_modules/zod/src/v3/tests/all-errors.test.ts +0 -157
  35. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +0 -28
  36. package/node_modules/zod/src/v3/tests/array.test.ts +0 -71
  37. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +0 -388
  38. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +0 -46
  39. package/node_modules/zod/src/v3/tests/base.test.ts +0 -29
  40. package/node_modules/zod/src/v3/tests/bigint.test.ts +0 -55
  41. package/node_modules/zod/src/v3/tests/branded.test.ts +0 -53
  42. package/node_modules/zod/src/v3/tests/catch.test.ts +0 -220
  43. package/node_modules/zod/src/v3/tests/coerce.test.ts +0 -133
  44. package/node_modules/zod/src/v3/tests/complex.test.ts +0 -56
  45. package/node_modules/zod/src/v3/tests/custom.test.ts +0 -31
  46. package/node_modules/zod/src/v3/tests/date.test.ts +0 -32
  47. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +0 -186
  48. package/node_modules/zod/src/v3/tests/default.test.ts +0 -112
  49. package/node_modules/zod/src/v3/tests/description.test.ts +0 -33
  50. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +0 -315
  51. package/node_modules/zod/src/v3/tests/enum.test.ts +0 -80
  52. package/node_modules/zod/src/v3/tests/error.test.ts +0 -551
  53. package/node_modules/zod/src/v3/tests/firstparty.test.ts +0 -87
  54. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +0 -21
  55. package/node_modules/zod/src/v3/tests/function.test.ts +0 -257
  56. package/node_modules/zod/src/v3/tests/generics.test.ts +0 -48
  57. package/node_modules/zod/src/v3/tests/instanceof.test.ts +0 -37
  58. package/node_modules/zod/src/v3/tests/intersection.test.ts +0 -110
  59. package/node_modules/zod/src/v3/tests/language-server.source.ts +0 -76
  60. package/node_modules/zod/src/v3/tests/language-server.test.ts +0 -207
  61. package/node_modules/zod/src/v3/tests/literal.test.ts +0 -36
  62. package/node_modules/zod/src/v3/tests/map.test.ts +0 -110
  63. package/node_modules/zod/src/v3/tests/masking.test.ts +0 -4
  64. package/node_modules/zod/src/v3/tests/mocker.test.ts +0 -19
  65. package/node_modules/zod/src/v3/tests/nan.test.ts +0 -21
  66. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +0 -87
  67. package/node_modules/zod/src/v3/tests/nullable.test.ts +0 -42
  68. package/node_modules/zod/src/v3/tests/number.test.ts +0 -176
  69. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +0 -29
  70. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +0 -29
  71. package/node_modules/zod/src/v3/tests/object.test.ts +0 -434
  72. package/node_modules/zod/src/v3/tests/optional.test.ts +0 -42
  73. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +0 -23
  74. package/node_modules/zod/src/v3/tests/parser.test.ts +0 -41
  75. package/node_modules/zod/src/v3/tests/partials.test.ts +0 -243
  76. package/node_modules/zod/src/v3/tests/pickomit.test.ts +0 -111
  77. package/node_modules/zod/src/v3/tests/pipeline.test.ts +0 -29
  78. package/node_modules/zod/src/v3/tests/preprocess.test.ts +0 -186
  79. package/node_modules/zod/src/v3/tests/primitive.test.ts +0 -440
  80. package/node_modules/zod/src/v3/tests/promise.test.ts +0 -90
  81. package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -194
  82. package/node_modules/zod/src/v3/tests/record.test.ts +0 -171
  83. package/node_modules/zod/src/v3/tests/recursive.test.ts +0 -197
  84. package/node_modules/zod/src/v3/tests/refine.test.ts +0 -313
  85. package/node_modules/zod/src/v3/tests/safeparse.test.ts +0 -27
  86. package/node_modules/zod/src/v3/tests/set.test.ts +0 -142
  87. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +0 -83
  88. package/node_modules/zod/src/v3/tests/string.test.ts +0 -916
  89. package/node_modules/zod/src/v3/tests/transformer.test.ts +0 -233
  90. package/node_modules/zod/src/v3/tests/tuple.test.ts +0 -90
  91. package/node_modules/zod/src/v3/tests/unions.test.ts +0 -57
  92. package/node_modules/zod/src/v3/tests/validations.test.ts +0 -133
  93. package/node_modules/zod/src/v3/tests/void.test.ts +0 -15
  94. package/node_modules/zod/src/v3/types.ts +0 -5136
  95. package/node_modules/zod/src/v4/classic/checks.ts +0 -30
  96. package/node_modules/zod/src/v4/classic/coerce.ts +0 -27
  97. package/node_modules/zod/src/v4/classic/compat.ts +0 -66
  98. package/node_modules/zod/src/v4/classic/errors.ts +0 -75
  99. package/node_modules/zod/src/v4/classic/external.ts +0 -50
  100. package/node_modules/zod/src/v4/classic/index.ts +0 -5
  101. package/node_modules/zod/src/v4/classic/iso.ts +0 -90
  102. package/node_modules/zod/src/v4/classic/parse.ts +0 -33
  103. package/node_modules/zod/src/v4/classic/schemas.ts +0 -2054
  104. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +0 -26
  105. package/node_modules/zod/src/v4/classic/tests/array.test.ts +0 -264
  106. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +0 -210
  107. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +0 -381
  108. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +0 -68
  109. package/node_modules/zod/src/v4/classic/tests/base.test.ts +0 -7
  110. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +0 -54
  111. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +0 -63
  112. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +0 -252
  113. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +0 -20
  114. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +0 -160
  115. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +0 -352
  116. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +0 -40
  117. package/node_modules/zod/src/v4/classic/tests/date.test.ts +0 -31
  118. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +0 -296
  119. package/node_modules/zod/src/v4/classic/tests/default.test.ts +0 -313
  120. package/node_modules/zod/src/v4/classic/tests/description.test.ts +0 -32
  121. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +0 -619
  122. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +0 -285
  123. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +0 -527
  124. package/node_modules/zod/src/v4/classic/tests/error.test.ts +0 -711
  125. package/node_modules/zod/src/v4/classic/tests/file.test.ts +0 -91
  126. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -175
  127. package/node_modules/zod/src/v4/classic/tests/function.test.ts +0 -268
  128. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +0 -72
  129. package/node_modules/zod/src/v4/classic/tests/index.test.ts +0 -829
  130. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +0 -34
  131. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +0 -171
  132. package/node_modules/zod/src/v4/classic/tests/json.test.ts +0 -108
  133. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +0 -227
  134. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +0 -92
  135. package/node_modules/zod/src/v4/classic/tests/map.test.ts +0 -196
  136. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +0 -21
  137. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +0 -168
  138. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +0 -86
  139. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +0 -22
  140. package/node_modules/zod/src/v4/classic/tests/number.test.ts +0 -247
  141. package/node_modules/zod/src/v4/classic/tests/object.test.ts +0 -563
  142. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +0 -123
  143. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +0 -147
  144. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +0 -127
  145. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +0 -81
  146. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +0 -37
  147. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +0 -298
  148. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +0 -175
  149. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +0 -81
  150. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +0 -23
  151. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -252
  152. package/node_modules/zod/src/v4/classic/tests/record.test.ts +0 -342
  153. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +0 -356
  154. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +0 -532
  155. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +0 -204
  156. package/node_modules/zod/src/v4/classic/tests/set.test.ts +0 -179
  157. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +0 -57
  158. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +0 -109
  159. package/node_modules/zod/src/v4/classic/tests/string.test.ts +0 -881
  160. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +0 -66
  161. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +0 -758
  162. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +0 -2314
  163. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +0 -250
  164. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +0 -163
  165. package/node_modules/zod/src/v4/classic/tests/union.test.ts +0 -94
  166. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +0 -283
  167. package/node_modules/zod/src/v4/classic/tests/void.test.ts +0 -12
  168. package/node_modules/zod/src/v4/core/api.ts +0 -1594
  169. package/node_modules/zod/src/v4/core/checks.ts +0 -1283
  170. package/node_modules/zod/src/v4/core/config.ts +0 -15
  171. package/node_modules/zod/src/v4/core/core.ts +0 -134
  172. package/node_modules/zod/src/v4/core/doc.ts +0 -44
  173. package/node_modules/zod/src/v4/core/errors.ts +0 -424
  174. package/node_modules/zod/src/v4/core/function.ts +0 -176
  175. package/node_modules/zod/src/v4/core/index.ts +0 -15
  176. package/node_modules/zod/src/v4/core/json-schema.ts +0 -143
  177. package/node_modules/zod/src/v4/core/parse.ts +0 -94
  178. package/node_modules/zod/src/v4/core/regexes.ts +0 -135
  179. package/node_modules/zod/src/v4/core/registries.ts +0 -96
  180. package/node_modules/zod/src/v4/core/schemas.ts +0 -3842
  181. package/node_modules/zod/src/v4/core/standard-schema.ts +0 -64
  182. package/node_modules/zod/src/v4/core/tests/index.test.ts +0 -46
  183. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +0 -124
  184. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +0 -22
  185. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +0 -128
  186. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +0 -69
  187. package/node_modules/zod/src/v4/core/to-json-schema.ts +0 -977
  188. package/node_modules/zod/src/v4/core/util.ts +0 -775
  189. package/node_modules/zod/src/v4/core/versions.ts +0 -5
  190. package/node_modules/zod/src/v4/core/zsf.ts +0 -323
  191. package/node_modules/zod/src/v4/index.ts +0 -4
  192. package/node_modules/zod/src/v4/locales/ar.ts +0 -125
  193. package/node_modules/zod/src/v4/locales/az.ts +0 -121
  194. package/node_modules/zod/src/v4/locales/be.ts +0 -184
  195. package/node_modules/zod/src/v4/locales/ca.ts +0 -127
  196. package/node_modules/zod/src/v4/locales/cs.ts +0 -142
  197. package/node_modules/zod/src/v4/locales/de.ts +0 -124
  198. package/node_modules/zod/src/v4/locales/en.ts +0 -127
  199. package/node_modules/zod/src/v4/locales/eo.ts +0 -125
  200. package/node_modules/zod/src/v4/locales/es.ts +0 -125
  201. package/node_modules/zod/src/v4/locales/fa.ts +0 -134
  202. package/node_modules/zod/src/v4/locales/fi.ts +0 -131
  203. package/node_modules/zod/src/v4/locales/fr-CA.ts +0 -126
  204. package/node_modules/zod/src/v4/locales/fr.ts +0 -124
  205. package/node_modules/zod/src/v4/locales/he.ts +0 -125
  206. package/node_modules/zod/src/v4/locales/hu.ts +0 -126
  207. package/node_modules/zod/src/v4/locales/id.ts +0 -125
  208. package/node_modules/zod/src/v4/locales/index.ts +0 -39
  209. package/node_modules/zod/src/v4/locales/it.ts +0 -125
  210. package/node_modules/zod/src/v4/locales/ja.ts +0 -122
  211. package/node_modules/zod/src/v4/locales/kh.ts +0 -126
  212. package/node_modules/zod/src/v4/locales/ko.ts +0 -131
  213. package/node_modules/zod/src/v4/locales/mk.ts +0 -127
  214. package/node_modules/zod/src/v4/locales/ms.ts +0 -124
  215. package/node_modules/zod/src/v4/locales/nl.ts +0 -126
  216. package/node_modules/zod/src/v4/locales/no.ts +0 -124
  217. package/node_modules/zod/src/v4/locales/ota.ts +0 -125
  218. package/node_modules/zod/src/v4/locales/pl.ts +0 -126
  219. package/node_modules/zod/src/v4/locales/ps.ts +0 -133
  220. package/node_modules/zod/src/v4/locales/pt.ts +0 -123
  221. package/node_modules/zod/src/v4/locales/ru.ts +0 -184
  222. package/node_modules/zod/src/v4/locales/sl.ts +0 -126
  223. package/node_modules/zod/src/v4/locales/sv.ts +0 -127
  224. package/node_modules/zod/src/v4/locales/ta.ts +0 -125
  225. package/node_modules/zod/src/v4/locales/th.ts +0 -126
  226. package/node_modules/zod/src/v4/locales/tr.ts +0 -121
  227. package/node_modules/zod/src/v4/locales/ua.ts +0 -126
  228. package/node_modules/zod/src/v4/locales/ur.ts +0 -126
  229. package/node_modules/zod/src/v4/locales/vi.ts +0 -125
  230. package/node_modules/zod/src/v4/locales/zh-CN.ts +0 -123
  231. package/node_modules/zod/src/v4/locales/zh-TW.ts +0 -125
  232. package/node_modules/zod/src/v4/mini/checks.ts +0 -32
  233. package/node_modules/zod/src/v4/mini/coerce.ts +0 -22
  234. package/node_modules/zod/src/v4/mini/external.ts +0 -40
  235. package/node_modules/zod/src/v4/mini/index.ts +0 -3
  236. package/node_modules/zod/src/v4/mini/iso.ts +0 -62
  237. package/node_modules/zod/src/v4/mini/parse.ts +0 -1
  238. package/node_modules/zod/src/v4/mini/schemas.ts +0 -1579
  239. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +0 -129
  240. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +0 -51
  241. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +0 -144
  242. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +0 -36
  243. package/node_modules/zod/src/v4/mini/tests/error.test.ts +0 -22
  244. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +0 -43
  245. package/node_modules/zod/src/v4/mini/tests/index.test.ts +0 -871
  246. package/node_modules/zod/src/v4/mini/tests/number.test.ts +0 -95
  247. package/node_modules/zod/src/v4/mini/tests/object.test.ts +0 -185
  248. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +0 -43
  249. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +0 -275
  250. package/node_modules/zod/src/v4/mini/tests/string.test.ts +0 -299
  251. package/node_modules/zod/src/v4-mini/index.ts +0 -1
  252. package/node_modules/zod/v3/ZodError.cjs +0 -138
  253. package/node_modules/zod/v3/ZodError.d.cts +0 -164
  254. package/node_modules/zod/v3/ZodError.d.ts +0 -164
  255. package/node_modules/zod/v3/ZodError.js +0 -133
  256. package/node_modules/zod/v3/errors.cjs +0 -17
  257. package/node_modules/zod/v3/errors.d.cts +0 -5
  258. package/node_modules/zod/v3/errors.d.ts +0 -5
  259. package/node_modules/zod/v3/errors.js +0 -9
  260. package/node_modules/zod/v3/external.cjs +0 -22
  261. package/node_modules/zod/v3/external.d.cts +0 -6
  262. package/node_modules/zod/v3/external.d.ts +0 -6
  263. package/node_modules/zod/v3/external.js +0 -6
  264. package/node_modules/zod/v3/helpers/enumUtil.cjs +0 -2
  265. package/node_modules/zod/v3/helpers/enumUtil.d.cts +0 -8
  266. package/node_modules/zod/v3/helpers/enumUtil.d.ts +0 -8
  267. package/node_modules/zod/v3/helpers/enumUtil.js +0 -1
  268. package/node_modules/zod/v3/helpers/errorUtil.cjs +0 -9
  269. package/node_modules/zod/v3/helpers/errorUtil.d.cts +0 -9
  270. package/node_modules/zod/v3/helpers/errorUtil.d.ts +0 -9
  271. package/node_modules/zod/v3/helpers/errorUtil.js +0 -6
  272. package/node_modules/zod/v3/helpers/parseUtil.cjs +0 -124
  273. package/node_modules/zod/v3/helpers/parseUtil.d.cts +0 -78
  274. package/node_modules/zod/v3/helpers/parseUtil.d.ts +0 -78
  275. package/node_modules/zod/v3/helpers/parseUtil.js +0 -109
  276. package/node_modules/zod/v3/helpers/partialUtil.cjs +0 -2
  277. package/node_modules/zod/v3/helpers/partialUtil.d.cts +0 -8
  278. package/node_modules/zod/v3/helpers/partialUtil.d.ts +0 -8
  279. package/node_modules/zod/v3/helpers/partialUtil.js +0 -1
  280. package/node_modules/zod/v3/helpers/typeAliases.cjs +0 -2
  281. package/node_modules/zod/v3/helpers/typeAliases.d.cts +0 -2
  282. package/node_modules/zod/v3/helpers/typeAliases.d.ts +0 -2
  283. package/node_modules/zod/v3/helpers/typeAliases.js +0 -1
  284. package/node_modules/zod/v3/helpers/util.cjs +0 -137
  285. package/node_modules/zod/v3/helpers/util.d.cts +0 -85
  286. package/node_modules/zod/v3/helpers/util.d.ts +0 -85
  287. package/node_modules/zod/v3/helpers/util.js +0 -133
  288. package/node_modules/zod/v3/index.cjs +0 -33
  289. package/node_modules/zod/v3/index.d.cts +0 -4
  290. package/node_modules/zod/v3/index.d.ts +0 -4
  291. package/node_modules/zod/v3/index.js +0 -4
  292. package/node_modules/zod/v3/locales/en.cjs +0 -111
  293. package/node_modules/zod/v3/locales/en.d.cts +0 -3
  294. package/node_modules/zod/v3/locales/en.d.ts +0 -3
  295. package/node_modules/zod/v3/locales/en.js +0 -109
  296. package/node_modules/zod/v3/standard-schema.cjs +0 -2
  297. package/node_modules/zod/v3/standard-schema.d.cts +0 -102
  298. package/node_modules/zod/v3/standard-schema.d.ts +0 -102
  299. package/node_modules/zod/v3/standard-schema.js +0 -1
  300. package/node_modules/zod/v3/types.cjs +0 -3775
  301. package/node_modules/zod/v3/types.d.cts +0 -1031
  302. package/node_modules/zod/v3/types.d.ts +0 -1031
  303. package/node_modules/zod/v3/types.js +0 -3693
  304. package/node_modules/zod/v4/classic/checks.cjs +0 -32
  305. package/node_modules/zod/v4/classic/checks.d.cts +0 -1
  306. package/node_modules/zod/v4/classic/checks.d.ts +0 -1
  307. package/node_modules/zod/v4/classic/checks.js +0 -1
  308. package/node_modules/zod/v4/classic/coerce.cjs +0 -47
  309. package/node_modules/zod/v4/classic/coerce.d.cts +0 -17
  310. package/node_modules/zod/v4/classic/coerce.d.ts +0 -17
  311. package/node_modules/zod/v4/classic/coerce.js +0 -17
  312. package/node_modules/zod/v4/classic/compat.cjs +0 -57
  313. package/node_modules/zod/v4/classic/compat.d.cts +0 -46
  314. package/node_modules/zod/v4/classic/compat.d.ts +0 -46
  315. package/node_modules/zod/v4/classic/compat.js +0 -27
  316. package/node_modules/zod/v4/classic/errors.cjs +0 -67
  317. package/node_modules/zod/v4/classic/errors.d.cts +0 -30
  318. package/node_modules/zod/v4/classic/errors.d.ts +0 -30
  319. package/node_modules/zod/v4/classic/errors.js +0 -41
  320. package/node_modules/zod/v4/classic/external.cjs +0 -70
  321. package/node_modules/zod/v4/classic/external.d.cts +0 -13
  322. package/node_modules/zod/v4/classic/external.d.ts +0 -13
  323. package/node_modules/zod/v4/classic/external.js +0 -18
  324. package/node_modules/zod/v4/classic/index.cjs +0 -33
  325. package/node_modules/zod/v4/classic/index.d.cts +0 -4
  326. package/node_modules/zod/v4/classic/index.d.ts +0 -4
  327. package/node_modules/zod/v4/classic/index.js +0 -4
  328. package/node_modules/zod/v4/classic/iso.cjs +0 -60
  329. package/node_modules/zod/v4/classic/iso.d.cts +0 -22
  330. package/node_modules/zod/v4/classic/iso.d.ts +0 -22
  331. package/node_modules/zod/v4/classic/iso.js +0 -30
  332. package/node_modules/zod/v4/classic/parse.cjs +0 -32
  333. package/node_modules/zod/v4/classic/parse.d.cts +0 -23
  334. package/node_modules/zod/v4/classic/parse.d.ts +0 -23
  335. package/node_modules/zod/v4/classic/parse.js +0 -6
  336. package/node_modules/zod/v4/classic/schemas.cjs +0 -1109
  337. package/node_modules/zod/v4/classic/schemas.d.cts +0 -630
  338. package/node_modules/zod/v4/classic/schemas.d.ts +0 -630
  339. package/node_modules/zod/v4/classic/schemas.js +0 -1006
  340. package/node_modules/zod/v4/core/api.cjs +0 -1039
  341. package/node_modules/zod/v4/core/api.d.cts +0 -284
  342. package/node_modules/zod/v4/core/api.d.ts +0 -284
  343. package/node_modules/zod/v4/core/api.js +0 -906
  344. package/node_modules/zod/v4/core/checks.cjs +0 -591
  345. package/node_modules/zod/v4/core/checks.d.cts +0 -278
  346. package/node_modules/zod/v4/core/checks.d.ts +0 -278
  347. package/node_modules/zod/v4/core/checks.js +0 -565
  348. package/node_modules/zod/v4/core/core.cjs +0 -67
  349. package/node_modules/zod/v4/core/core.d.cts +0 -49
  350. package/node_modules/zod/v4/core/core.d.ts +0 -49
  351. package/node_modules/zod/v4/core/core.js +0 -61
  352. package/node_modules/zod/v4/core/doc.cjs +0 -39
  353. package/node_modules/zod/v4/core/doc.d.cts +0 -14
  354. package/node_modules/zod/v4/core/doc.d.ts +0 -14
  355. package/node_modules/zod/v4/core/doc.js +0 -35
  356. package/node_modules/zod/v4/core/errors.cjs +0 -226
  357. package/node_modules/zod/v4/core/errors.d.cts +0 -208
  358. package/node_modules/zod/v4/core/errors.d.ts +0 -208
  359. package/node_modules/zod/v4/core/errors.js +0 -195
  360. package/node_modules/zod/v4/core/function.cjs +0 -102
  361. package/node_modules/zod/v4/core/function.d.cts +0 -52
  362. package/node_modules/zod/v4/core/function.d.ts +0 -52
  363. package/node_modules/zod/v4/core/function.js +0 -75
  364. package/node_modules/zod/v4/core/index.cjs +0 -44
  365. package/node_modules/zod/v4/core/index.d.cts +0 -15
  366. package/node_modules/zod/v4/core/index.d.ts +0 -15
  367. package/node_modules/zod/v4/core/index.js +0 -15
  368. package/node_modules/zod/v4/core/json-schema.cjs +0 -2
  369. package/node_modules/zod/v4/core/json-schema.d.cts +0 -87
  370. package/node_modules/zod/v4/core/json-schema.d.ts +0 -87
  371. package/node_modules/zod/v4/core/json-schema.js +0 -1
  372. package/node_modules/zod/v4/core/parse.cjs +0 -87
  373. package/node_modules/zod/v4/core/parse.d.cts +0 -25
  374. package/node_modules/zod/v4/core/parse.d.ts +0 -25
  375. package/node_modules/zod/v4/core/parse.js +0 -57
  376. package/node_modules/zod/v4/core/regexes.cjs +0 -103
  377. package/node_modules/zod/v4/core/regexes.d.cts +0 -62
  378. package/node_modules/zod/v4/core/regexes.d.ts +0 -62
  379. package/node_modules/zod/v4/core/regexes.js +0 -95
  380. package/node_modules/zod/v4/core/registries.cjs +0 -56
  381. package/node_modules/zod/v4/core/registries.d.cts +0 -35
  382. package/node_modules/zod/v4/core/registries.d.ts +0 -35
  383. package/node_modules/zod/v4/core/registries.js +0 -51
  384. package/node_modules/zod/v4/core/schemas.cjs +0 -1748
  385. package/node_modules/zod/v4/core/schemas.d.cts +0 -1041
  386. package/node_modules/zod/v4/core/schemas.d.ts +0 -1041
  387. package/node_modules/zod/v4/core/schemas.js +0 -1717
  388. package/node_modules/zod/v4/core/standard-schema.cjs +0 -2
  389. package/node_modules/zod/v4/core/standard-schema.d.cts +0 -55
  390. package/node_modules/zod/v4/core/standard-schema.d.ts +0 -55
  391. package/node_modules/zod/v4/core/standard-schema.js +0 -1
  392. package/node_modules/zod/v4/core/to-json-schema.cjs +0 -854
  393. package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -88
  394. package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -88
  395. package/node_modules/zod/v4/core/to-json-schema.js +0 -849
  396. package/node_modules/zod/v4/core/util.cjs +0 -539
  397. package/node_modules/zod/v4/core/util.d.cts +0 -183
  398. package/node_modules/zod/v4/core/util.d.ts +0 -183
  399. package/node_modules/zod/v4/core/util.js +0 -493
  400. package/node_modules/zod/v4/core/versions.cjs +0 -8
  401. package/node_modules/zod/v4/core/versions.d.cts +0 -5
  402. package/node_modules/zod/v4/core/versions.d.ts +0 -5
  403. package/node_modules/zod/v4/core/versions.js +0 -5
  404. package/node_modules/zod/v4/index.cjs +0 -22
  405. package/node_modules/zod/v4/index.d.cts +0 -3
  406. package/node_modules/zod/v4/index.d.ts +0 -3
  407. package/node_modules/zod/v4/index.js +0 -3
  408. package/node_modules/zod/v4/locales/ar.cjs +0 -142
  409. package/node_modules/zod/v4/locales/ar.d.cts +0 -4
  410. package/node_modules/zod/v4/locales/ar.d.ts +0 -4
  411. package/node_modules/zod/v4/locales/ar.js +0 -116
  412. package/node_modules/zod/v4/locales/az.cjs +0 -141
  413. package/node_modules/zod/v4/locales/az.d.cts +0 -4
  414. package/node_modules/zod/v4/locales/az.d.ts +0 -4
  415. package/node_modules/zod/v4/locales/az.js +0 -115
  416. package/node_modules/zod/v4/locales/be.cjs +0 -190
  417. package/node_modules/zod/v4/locales/be.d.cts +0 -4
  418. package/node_modules/zod/v4/locales/be.d.ts +0 -4
  419. package/node_modules/zod/v4/locales/be.js +0 -164
  420. package/node_modules/zod/v4/locales/ca.cjs +0 -144
  421. package/node_modules/zod/v4/locales/ca.d.cts +0 -4
  422. package/node_modules/zod/v4/locales/ca.d.ts +0 -4
  423. package/node_modules/zod/v4/locales/ca.js +0 -118
  424. package/node_modules/zod/v4/locales/cs.cjs +0 -161
  425. package/node_modules/zod/v4/locales/cs.d.cts +0 -4
  426. package/node_modules/zod/v4/locales/cs.d.ts +0 -4
  427. package/node_modules/zod/v4/locales/cs.js +0 -135
  428. package/node_modules/zod/v4/locales/de.cjs +0 -142
  429. package/node_modules/zod/v4/locales/de.d.cts +0 -4
  430. package/node_modules/zod/v4/locales/de.d.ts +0 -4
  431. package/node_modules/zod/v4/locales/de.js +0 -116
  432. package/node_modules/zod/v4/locales/en.cjs +0 -145
  433. package/node_modules/zod/v4/locales/en.d.cts +0 -5
  434. package/node_modules/zod/v4/locales/en.d.ts +0 -5
  435. package/node_modules/zod/v4/locales/en.js +0 -117
  436. package/node_modules/zod/v4/locales/eo.cjs +0 -144
  437. package/node_modules/zod/v4/locales/eo.d.cts +0 -5
  438. package/node_modules/zod/v4/locales/eo.d.ts +0 -5
  439. package/node_modules/zod/v4/locales/eo.js +0 -116
  440. package/node_modules/zod/v4/locales/es.cjs +0 -143
  441. package/node_modules/zod/v4/locales/es.d.cts +0 -4
  442. package/node_modules/zod/v4/locales/es.d.ts +0 -4
  443. package/node_modules/zod/v4/locales/es.js +0 -117
  444. package/node_modules/zod/v4/locales/fa.cjs +0 -148
  445. package/node_modules/zod/v4/locales/fa.d.cts +0 -4
  446. package/node_modules/zod/v4/locales/fa.d.ts +0 -4
  447. package/node_modules/zod/v4/locales/fa.js +0 -122
  448. package/node_modules/zod/v4/locales/fi.cjs +0 -148
  449. package/node_modules/zod/v4/locales/fi.d.cts +0 -4
  450. package/node_modules/zod/v4/locales/fi.d.ts +0 -4
  451. package/node_modules/zod/v4/locales/fi.js +0 -122
  452. package/node_modules/zod/v4/locales/fr-CA.cjs +0 -143
  453. package/node_modules/zod/v4/locales/fr-CA.d.cts +0 -4
  454. package/node_modules/zod/v4/locales/fr-CA.d.ts +0 -4
  455. package/node_modules/zod/v4/locales/fr-CA.js +0 -117
  456. package/node_modules/zod/v4/locales/fr.cjs +0 -142
  457. package/node_modules/zod/v4/locales/fr.d.cts +0 -4
  458. package/node_modules/zod/v4/locales/fr.d.ts +0 -4
  459. package/node_modules/zod/v4/locales/fr.js +0 -116
  460. package/node_modules/zod/v4/locales/he.cjs +0 -143
  461. package/node_modules/zod/v4/locales/he.d.cts +0 -4
  462. package/node_modules/zod/v4/locales/he.d.ts +0 -4
  463. package/node_modules/zod/v4/locales/he.js +0 -117
  464. package/node_modules/zod/v4/locales/hu.cjs +0 -143
  465. package/node_modules/zod/v4/locales/hu.d.cts +0 -4
  466. package/node_modules/zod/v4/locales/hu.d.ts +0 -4
  467. package/node_modules/zod/v4/locales/hu.js +0 -117
  468. package/node_modules/zod/v4/locales/id.cjs +0 -142
  469. package/node_modules/zod/v4/locales/id.d.cts +0 -4
  470. package/node_modules/zod/v4/locales/id.d.ts +0 -4
  471. package/node_modules/zod/v4/locales/id.js +0 -116
  472. package/node_modules/zod/v4/locales/index.cjs +0 -84
  473. package/node_modules/zod/v4/locales/index.d.cts +0 -39
  474. package/node_modules/zod/v4/locales/index.d.ts +0 -39
  475. package/node_modules/zod/v4/locales/index.js +0 -39
  476. package/node_modules/zod/v4/locales/it.cjs +0 -143
  477. package/node_modules/zod/v4/locales/it.d.cts +0 -4
  478. package/node_modules/zod/v4/locales/it.d.ts +0 -4
  479. package/node_modules/zod/v4/locales/it.js +0 -117
  480. package/node_modules/zod/v4/locales/ja.cjs +0 -141
  481. package/node_modules/zod/v4/locales/ja.d.cts +0 -4
  482. package/node_modules/zod/v4/locales/ja.d.ts +0 -4
  483. package/node_modules/zod/v4/locales/ja.js +0 -115
  484. package/node_modules/zod/v4/locales/kh.cjs +0 -143
  485. package/node_modules/zod/v4/locales/kh.d.cts +0 -4
  486. package/node_modules/zod/v4/locales/kh.d.ts +0 -4
  487. package/node_modules/zod/v4/locales/kh.js +0 -117
  488. package/node_modules/zod/v4/locales/ko.cjs +0 -147
  489. package/node_modules/zod/v4/locales/ko.d.cts +0 -4
  490. package/node_modules/zod/v4/locales/ko.d.ts +0 -4
  491. package/node_modules/zod/v4/locales/ko.js +0 -121
  492. package/node_modules/zod/v4/locales/mk.cjs +0 -144
  493. package/node_modules/zod/v4/locales/mk.d.cts +0 -4
  494. package/node_modules/zod/v4/locales/mk.d.ts +0 -4
  495. package/node_modules/zod/v4/locales/mk.js +0 -118
  496. package/node_modules/zod/v4/locales/ms.cjs +0 -142
  497. package/node_modules/zod/v4/locales/ms.d.cts +0 -4
  498. package/node_modules/zod/v4/locales/ms.d.ts +0 -4
  499. package/node_modules/zod/v4/locales/ms.js +0 -116
  500. package/node_modules/zod/v4/locales/nl.cjs +0 -143
  501. package/node_modules/zod/v4/locales/nl.d.cts +0 -4
  502. package/node_modules/zod/v4/locales/nl.d.ts +0 -4
  503. package/node_modules/zod/v4/locales/nl.js +0 -117
  504. package/node_modules/zod/v4/locales/no.cjs +0 -142
  505. package/node_modules/zod/v4/locales/no.d.cts +0 -4
  506. package/node_modules/zod/v4/locales/no.d.ts +0 -4
  507. package/node_modules/zod/v4/locales/no.js +0 -116
  508. package/node_modules/zod/v4/locales/ota.cjs +0 -143
  509. package/node_modules/zod/v4/locales/ota.d.cts +0 -4
  510. package/node_modules/zod/v4/locales/ota.d.ts +0 -4
  511. package/node_modules/zod/v4/locales/ota.js +0 -117
  512. package/node_modules/zod/v4/locales/pl.cjs +0 -143
  513. package/node_modules/zod/v4/locales/pl.d.cts +0 -4
  514. package/node_modules/zod/v4/locales/pl.d.ts +0 -4
  515. package/node_modules/zod/v4/locales/pl.js +0 -117
  516. package/node_modules/zod/v4/locales/ps.cjs +0 -148
  517. package/node_modules/zod/v4/locales/ps.d.cts +0 -4
  518. package/node_modules/zod/v4/locales/ps.d.ts +0 -4
  519. package/node_modules/zod/v4/locales/ps.js +0 -122
  520. package/node_modules/zod/v4/locales/pt.cjs +0 -142
  521. package/node_modules/zod/v4/locales/pt.d.cts +0 -4
  522. package/node_modules/zod/v4/locales/pt.d.ts +0 -4
  523. package/node_modules/zod/v4/locales/pt.js +0 -116
  524. package/node_modules/zod/v4/locales/ru.cjs +0 -190
  525. package/node_modules/zod/v4/locales/ru.d.cts +0 -4
  526. package/node_modules/zod/v4/locales/ru.d.ts +0 -4
  527. package/node_modules/zod/v4/locales/ru.js +0 -164
  528. package/node_modules/zod/v4/locales/sl.cjs +0 -143
  529. package/node_modules/zod/v4/locales/sl.d.cts +0 -4
  530. package/node_modules/zod/v4/locales/sl.d.ts +0 -4
  531. package/node_modules/zod/v4/locales/sl.js +0 -117
  532. package/node_modules/zod/v4/locales/sv.cjs +0 -144
  533. package/node_modules/zod/v4/locales/sv.d.cts +0 -4
  534. package/node_modules/zod/v4/locales/sv.d.ts +0 -4
  535. package/node_modules/zod/v4/locales/sv.js +0 -118
  536. package/node_modules/zod/v4/locales/ta.cjs +0 -143
  537. package/node_modules/zod/v4/locales/ta.d.cts +0 -4
  538. package/node_modules/zod/v4/locales/ta.d.ts +0 -4
  539. package/node_modules/zod/v4/locales/ta.js +0 -117
  540. package/node_modules/zod/v4/locales/th.cjs +0 -143
  541. package/node_modules/zod/v4/locales/th.d.cts +0 -4
  542. package/node_modules/zod/v4/locales/th.d.ts +0 -4
  543. package/node_modules/zod/v4/locales/th.js +0 -117
  544. package/node_modules/zod/v4/locales/tr.cjs +0 -143
  545. package/node_modules/zod/v4/locales/tr.d.cts +0 -5
  546. package/node_modules/zod/v4/locales/tr.d.ts +0 -5
  547. package/node_modules/zod/v4/locales/tr.js +0 -115
  548. package/node_modules/zod/v4/locales/ua.cjs +0 -143
  549. package/node_modules/zod/v4/locales/ua.d.cts +0 -4
  550. package/node_modules/zod/v4/locales/ua.d.ts +0 -4
  551. package/node_modules/zod/v4/locales/ua.js +0 -117
  552. package/node_modules/zod/v4/locales/ur.cjs +0 -143
  553. package/node_modules/zod/v4/locales/ur.d.cts +0 -4
  554. package/node_modules/zod/v4/locales/ur.d.ts +0 -4
  555. package/node_modules/zod/v4/locales/ur.js +0 -117
  556. package/node_modules/zod/v4/locales/vi.cjs +0 -142
  557. package/node_modules/zod/v4/locales/vi.d.cts +0 -4
  558. package/node_modules/zod/v4/locales/vi.d.ts +0 -4
  559. package/node_modules/zod/v4/locales/vi.js +0 -116
  560. package/node_modules/zod/v4/locales/zh-CN.cjs +0 -142
  561. package/node_modules/zod/v4/locales/zh-CN.d.cts +0 -4
  562. package/node_modules/zod/v4/locales/zh-CN.d.ts +0 -4
  563. package/node_modules/zod/v4/locales/zh-CN.js +0 -116
  564. package/node_modules/zod/v4/locales/zh-TW.cjs +0 -143
  565. package/node_modules/zod/v4/locales/zh-TW.d.cts +0 -4
  566. package/node_modules/zod/v4/locales/zh-TW.d.ts +0 -4
  567. package/node_modules/zod/v4/locales/zh-TW.js +0 -117
  568. package/node_modules/zod/v4/mini/checks.cjs +0 -34
  569. package/node_modules/zod/v4/mini/checks.d.cts +0 -1
  570. package/node_modules/zod/v4/mini/checks.d.ts +0 -1
  571. package/node_modules/zod/v4/mini/checks.js +0 -1
  572. package/node_modules/zod/v4/mini/coerce.cjs +0 -47
  573. package/node_modules/zod/v4/mini/coerce.d.cts +0 -7
  574. package/node_modules/zod/v4/mini/coerce.d.ts +0 -7
  575. package/node_modules/zod/v4/mini/coerce.js +0 -17
  576. package/node_modules/zod/v4/mini/external.cjs +0 -62
  577. package/node_modules/zod/v4/mini/external.d.cts +0 -11
  578. package/node_modules/zod/v4/mini/external.d.ts +0 -11
  579. package/node_modules/zod/v4/mini/external.js +0 -13
  580. package/node_modules/zod/v4/mini/index.cjs +0 -32
  581. package/node_modules/zod/v4/mini/index.d.cts +0 -3
  582. package/node_modules/zod/v4/mini/index.d.ts +0 -3
  583. package/node_modules/zod/v4/mini/index.js +0 -3
  584. package/node_modules/zod/v4/mini/iso.cjs +0 -60
  585. package/node_modules/zod/v4/mini/iso.d.cts +0 -22
  586. package/node_modules/zod/v4/mini/iso.d.ts +0 -22
  587. package/node_modules/zod/v4/mini/iso.js +0 -30
  588. package/node_modules/zod/v4/mini/parse.cjs +0 -8
  589. package/node_modules/zod/v4/mini/parse.d.cts +0 -1
  590. package/node_modules/zod/v4/mini/parse.d.ts +0 -1
  591. package/node_modules/zod/v4/mini/parse.js +0 -1
  592. package/node_modules/zod/v4/mini/schemas.cjs +0 -839
  593. package/node_modules/zod/v4/mini/schemas.d.cts +0 -356
  594. package/node_modules/zod/v4/mini/schemas.d.ts +0 -356
  595. package/node_modules/zod/v4/mini/schemas.js +0 -732
  596. package/node_modules/zod/v4-mini/index.cjs +0 -17
  597. package/node_modules/zod/v4-mini/index.d.cts +0 -1
  598. package/node_modules/zod/v4-mini/index.d.ts +0 -1
  599. 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
- }