wapi-client 0.12.5-beta.6 → 0.13.0

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 (587) hide show
  1. package/dist/api/http-client.browser.cjs +520 -500
  2. package/dist/api/http-client.browser.js +520 -500
  3. package/dist/api/http-client.cjs +3 -4
  4. package/dist/api/http-client.js +1 -2
  5. package/dist/client-options.schema.zod.browser.cjs +14 -4008
  6. package/dist/client-options.schema.zod.browser.js +1 -3996
  7. package/dist/client-options.schema.zod.cjs +1 -1
  8. package/dist/client-options.schema.zod.d.ts +1 -1
  9. package/dist/client-options.schema.zod.js +1 -1
  10. package/dist/db/consts.browser.cjs +79 -4056
  11. package/dist/db/consts.browser.js +1 -3978
  12. package/dist/db/consts.cjs +79 -89
  13. package/dist/db/consts.d.ts +1 -1
  14. package/dist/db/consts.enums.d.ts +1 -1
  15. package/dist/db/consts.js +1 -1
  16. package/dist/db/token/token.enums.d.ts +1 -1
  17. package/dist/db/token/token.schema.zod.browser.cjs +10 -4004
  18. package/dist/db/token/token.schema.zod.browser.js +1 -3998
  19. package/dist/db/token/token.schema.zod.cjs +10 -20
  20. package/dist/db/token/token.schema.zod.d.ts +1 -1
  21. package/dist/db/token/token.schema.zod.js +1 -1
  22. package/dist/db/transfer/transfer.enums.d.ts +1 -1
  23. package/dist/db/transfer/transfer.schema.zod.browser.cjs +16 -4010
  24. package/dist/db/transfer/transfer.schema.zod.browser.js +1 -3998
  25. package/dist/db/transfer/transfer.schema.zod.cjs +16 -26
  26. package/dist/db/transfer/transfer.schema.zod.d.ts +1 -1
  27. package/dist/db/transfer/transfer.schema.zod.js +1 -1
  28. package/dist/db/transfer-group/transfer-group.enums.d.ts +1 -1
  29. package/dist/db/transfer-group/transfer-group.schema.zod.browser.cjs +10 -4004
  30. package/dist/db/transfer-group/transfer-group.schema.zod.browser.js +1 -3998
  31. package/dist/db/transfer-group/transfer-group.schema.zod.cjs +10 -20
  32. package/dist/db/transfer-group/transfer-group.schema.zod.d.ts +1 -1
  33. package/dist/db/transfer-group/transfer-group.schema.zod.js +1 -1
  34. package/dist/db/transfer-log/transfer-log.enums.d.ts +1 -1
  35. package/dist/db/transfer-log/transfer-log.schema.zod.browser.cjs +20 -4014
  36. package/dist/db/transfer-log/transfer-log.schema.zod.browser.js +1 -3998
  37. package/dist/db/transfer-log/transfer-log.schema.zod.cjs +20 -30
  38. package/dist/db/transfer-log/transfer-log.schema.zod.d.ts +1 -1
  39. package/dist/db/transfer-log/transfer-log.schema.zod.js +1 -1
  40. package/dist/db/wallet/wallet.enums.d.ts +1 -1
  41. package/dist/db/wallet/wallet.schema.zod.browser.cjs +11 -4005
  42. package/dist/db/wallet/wallet.schema.zod.browser.js +1 -3998
  43. package/dist/db/wallet/wallet.schema.zod.cjs +11 -21
  44. package/dist/db/wallet/wallet.schema.zod.d.ts +1 -1
  45. package/dist/db/wallet/wallet.schema.zod.js +1 -1
  46. package/dist/db/wallet-token-setting/wallet-token-setting.enums.d.ts +1 -1
  47. package/dist/db/wallet-token-setting/wallet-token-setting.schema.zod.browser.cjs +9 -4003
  48. package/dist/db/wallet-token-setting/wallet-token-setting.schema.zod.browser.js +1 -3998
  49. package/dist/db/wallet-token-setting/wallet-token-setting.schema.zod.cjs +9 -19
  50. package/dist/db/wallet-token-setting/wallet-token-setting.schema.zod.d.ts +1 -1
  51. package/dist/db/wallet-token-setting/wallet-token-setting.schema.zod.js +1 -1
  52. package/dist/db/wapi-setting/wapi-setting.enums.d.ts +1 -1
  53. package/dist/db/wapi-setting/wapi-setting.schema.zod.browser.cjs +7 -4001
  54. package/dist/db/wapi-setting/wapi-setting.schema.zod.browser.js +1 -3998
  55. package/dist/db/wapi-setting/wapi-setting.schema.zod.cjs +7 -17
  56. package/dist/db/wapi-setting/wapi-setting.schema.zod.d.ts +1 -1
  57. package/dist/db/wapi-setting/wapi-setting.schema.zod.js +1 -1
  58. package/dist/db/wapi-statistic/wapi-statistic.enums.d.ts +1 -1
  59. package/dist/db/wapi-statistic/wapi-statistic.schema.zod.browser.cjs +6 -4000
  60. package/dist/db/wapi-statistic/wapi-statistic.schema.zod.browser.js +1 -3998
  61. package/dist/db/wapi-statistic/wapi-statistic.schema.zod.cjs +6 -16
  62. package/dist/db/wapi-statistic/wapi-statistic.schema.zod.d.ts +1 -1
  63. package/dist/db/wapi-statistic/wapi-statistic.schema.zod.js +1 -1
  64. package/dist/fns/aggregate-transfers/aggregate-transfers.enums.d.ts +1 -1
  65. package/dist/fns/aggregate-transfers/aggregate-transfers.schema.zod.browser.cjs +2 -3996
  66. package/dist/fns/aggregate-transfers/aggregate-transfers.schema.zod.browser.js +1 -3996
  67. package/dist/fns/aggregate-transfers/aggregate-transfers.schema.zod.cjs +1 -1
  68. package/dist/fns/aggregate-transfers/aggregate-transfers.schema.zod.d.ts +1 -1
  69. package/dist/fns/aggregate-transfers/aggregate-transfers.schema.zod.js +1 -1
  70. package/dist/fns/consts.browser.cjs +8 -4002
  71. package/dist/fns/consts.browser.js +1 -3998
  72. package/dist/fns/consts.cjs +8 -18
  73. package/dist/fns/consts.d.ts +1 -1
  74. package/dist/fns/consts.enums.d.ts +1 -1
  75. package/dist/fns/consts.js +1 -1
  76. package/dist/fns/create-access-token/create-access-token.enums.d.ts +1 -1
  77. package/dist/fns/create-access-token/create-access-token.schema.zod.browser.cjs +4 -3998
  78. package/dist/fns/create-access-token/create-access-token.schema.zod.browser.js +1 -3996
  79. package/dist/fns/create-access-token/create-access-token.schema.zod.cjs +1 -1
  80. package/dist/fns/create-access-token/create-access-token.schema.zod.d.ts +1 -1
  81. package/dist/fns/create-access-token/create-access-token.schema.zod.js +1 -1
  82. package/dist/fns/create-contract/create-contract.enums.d.ts +1 -1
  83. package/dist/fns/create-contract/create-contract.schema.zod.browser.cjs +5 -3999
  84. package/dist/fns/create-contract/create-contract.schema.zod.browser.js +1 -3998
  85. package/dist/fns/create-contract/create-contract.schema.zod.cjs +1 -1
  86. package/dist/fns/create-contract/create-contract.schema.zod.d.ts +1 -1
  87. package/dist/fns/create-contract/create-contract.schema.zod.js +1 -1
  88. package/dist/fns/create-deposit/create-deposit.enums.d.ts +1 -1
  89. package/dist/fns/create-deposit/create-deposit.schema.zod.browser.cjs +4 -3998
  90. package/dist/fns/create-deposit/create-deposit.schema.zod.browser.js +1 -3996
  91. package/dist/fns/create-deposit/create-deposit.schema.zod.cjs +1 -1
  92. package/dist/fns/create-deposit/create-deposit.schema.zod.d.ts +1 -1
  93. package/dist/fns/create-deposit/create-deposit.schema.zod.js +1 -1
  94. package/dist/fns/create-exchange/create-exchange.enums.d.ts +1 -1
  95. package/dist/fns/create-exchange/create-exchange.schema.zod.browser.cjs +2 -3996
  96. package/dist/fns/create-exchange/create-exchange.schema.zod.browser.js +1 -3996
  97. package/dist/fns/create-exchange/create-exchange.schema.zod.cjs +1 -1
  98. package/dist/fns/create-exchange/create-exchange.schema.zod.d.ts +1 -1
  99. package/dist/fns/create-exchange/create-exchange.schema.zod.js +1 -1
  100. package/dist/fns/create-token/create-token.enums.d.ts +1 -1
  101. package/dist/fns/create-transfer/create-transfer.enums.d.ts +1 -1
  102. package/dist/fns/create-transfer/create-transfer.schema.zod.browser.cjs +8 -4002
  103. package/dist/fns/create-transfer/create-transfer.schema.zod.browser.js +1 -3996
  104. package/dist/fns/create-transfer/create-transfer.schema.zod.cjs +1 -1
  105. package/dist/fns/create-transfer/create-transfer.schema.zod.d.ts +1 -1
  106. package/dist/fns/create-transfer/create-transfer.schema.zod.js +1 -1
  107. package/dist/fns/create-transfer-group/create-transfer-group.enums.d.ts +1 -1
  108. package/dist/fns/create-transfer-group/create-transfer-group.schema.zod.browser.cjs +2 -3996
  109. package/dist/fns/create-transfer-group/create-transfer-group.schema.zod.browser.js +1 -3996
  110. package/dist/fns/create-transfer-group/create-transfer-group.schema.zod.cjs +1 -1
  111. package/dist/fns/create-transfer-group/create-transfer-group.schema.zod.d.ts +1 -1
  112. package/dist/fns/create-transfer-group/create-transfer-group.schema.zod.js +1 -1
  113. package/dist/fns/create-transfers/create-transfers.enums.d.ts +1 -1
  114. package/dist/fns/create-transfers/create-transfers.schema.zod.browser.cjs +2 -3996
  115. package/dist/fns/create-transfers/create-transfers.schema.zod.browser.js +1 -3996
  116. package/dist/fns/create-transfers/create-transfers.schema.zod.cjs +1 -1
  117. package/dist/fns/create-transfers/create-transfers.schema.zod.d.ts +1 -1
  118. package/dist/fns/create-transfers/create-transfers.schema.zod.js +1 -1
  119. package/dist/fns/create-wallet/create-wallet.enums.d.ts +1 -1
  120. package/dist/fns/create-withdrawal/create-withdrawal.enums.d.ts +1 -1
  121. package/dist/fns/create-withdrawal/create-withdrawal.schema.zod.browser.cjs +3 -3997
  122. package/dist/fns/create-withdrawal/create-withdrawal.schema.zod.browser.js +1 -3996
  123. package/dist/fns/create-withdrawal/create-withdrawal.schema.zod.cjs +1 -1
  124. package/dist/fns/create-withdrawal/create-withdrawal.schema.zod.d.ts +1 -1
  125. package/dist/fns/create-withdrawal/create-withdrawal.schema.zod.js +1 -1
  126. package/dist/fns/export-balance-history/export-balance-history.enums.d.ts +1 -1
  127. package/dist/fns/export-balance-history/export-balance-history.schema.zod.browser.cjs +2 -3996
  128. package/dist/fns/export-balance-history/export-balance-history.schema.zod.browser.js +1 -3996
  129. package/dist/fns/export-balance-history/export-balance-history.schema.zod.cjs +1 -1
  130. package/dist/fns/export-balance-history/export-balance-history.schema.zod.d.ts +1 -1
  131. package/dist/fns/export-balance-history/export-balance-history.schema.zod.js +1 -1
  132. package/dist/fns/export-tokens/export-tokens.enums.d.ts +1 -1
  133. package/dist/fns/export-transfer-groups/export-transfer-groups.enums.d.ts +1 -1
  134. package/dist/fns/export-transfers/export-transfers.enums.d.ts +1 -1
  135. package/dist/fns/export-wallets/export-wallets.enums.d.ts +1 -1
  136. package/dist/fns/find-balances/find-balances.enums.d.ts +1 -1
  137. package/dist/fns/find-balances/find-balances.schema.zod.browser.cjs +2 -3996
  138. package/dist/fns/find-balances/find-balances.schema.zod.browser.js +1 -3996
  139. package/dist/fns/find-balances/find-balances.schema.zod.cjs +1 -1
  140. package/dist/fns/find-balances/find-balances.schema.zod.d.ts +1 -1
  141. package/dist/fns/find-balances/find-balances.schema.zod.js +1 -1
  142. package/dist/fns/find-tokens/find-tokens.enums.d.ts +1 -1
  143. package/dist/fns/find-tokens/find-tokens.schema.zod.browser.cjs +2 -3996
  144. package/dist/fns/find-tokens/find-tokens.schema.zod.browser.js +1 -3996
  145. package/dist/fns/find-tokens/find-tokens.schema.zod.cjs +1 -1
  146. package/dist/fns/find-tokens/find-tokens.schema.zod.d.ts +1 -1
  147. package/dist/fns/find-tokens/find-tokens.schema.zod.js +1 -1
  148. package/dist/fns/find-transfer-groups/find-transfer-groups.enums.d.ts +1 -1
  149. package/dist/fns/find-transfer-groups/find-transfer-groups.schema.zod.browser.cjs +2 -3996
  150. package/dist/fns/find-transfer-groups/find-transfer-groups.schema.zod.browser.js +1 -3996
  151. package/dist/fns/find-transfer-groups/find-transfer-groups.schema.zod.cjs +1 -1
  152. package/dist/fns/find-transfer-groups/find-transfer-groups.schema.zod.d.ts +1 -1
  153. package/dist/fns/find-transfer-groups/find-transfer-groups.schema.zod.js +1 -1
  154. package/dist/fns/find-transfers/find-transfers.enums.d.ts +1 -1
  155. package/dist/fns/find-transfers/find-transfers.schema.zod.browser.cjs +5 -3982
  156. package/dist/fns/find-transfers/find-transfers.schema.zod.browser.js +1 -3976
  157. package/dist/fns/find-transfers/find-transfers.schema.zod.cjs +1 -1
  158. package/dist/fns/find-transfers/find-transfers.schema.zod.d.ts +1 -1
  159. package/dist/fns/find-transfers/find-transfers.schema.zod.js +1 -1
  160. package/dist/fns/find-wallets/find-wallets.enums.d.ts +1 -1
  161. package/dist/fns/find-wallets/find-wallets.schema.zod.browser.cjs +3 -3997
  162. package/dist/fns/find-wallets/find-wallets.schema.zod.browser.js +1 -3996
  163. package/dist/fns/find-wallets/find-wallets.schema.zod.cjs +1 -1
  164. package/dist/fns/find-wallets/find-wallets.schema.zod.d.ts +1 -1
  165. package/dist/fns/find-wallets/find-wallets.schema.zod.js +1 -1
  166. package/dist/fns/get-balance/get-balance.enums.d.ts +1 -1
  167. package/dist/fns/get-balance/get-balance.schema.zod.browser.cjs +2 -3996
  168. package/dist/fns/get-balance/get-balance.schema.zod.browser.js +1 -3996
  169. package/dist/fns/get-balance/get-balance.schema.zod.cjs +1 -1
  170. package/dist/fns/get-balance/get-balance.schema.zod.d.ts +1 -1
  171. package/dist/fns/get-balance/get-balance.schema.zod.js +1 -1
  172. package/dist/fns/get-balance-history/get-balance-history.enums.d.ts +1 -1
  173. package/dist/fns/get-balance-history/get-balance-history.schema.zod.browser.cjs +2 -3996
  174. package/dist/fns/get-balance-history/get-balance-history.schema.zod.browser.js +1 -3996
  175. package/dist/fns/get-balance-history/get-balance-history.schema.zod.cjs +1 -1
  176. package/dist/fns/get-balance-history/get-balance-history.schema.zod.d.ts +1 -1
  177. package/dist/fns/get-balance-history/get-balance-history.schema.zod.js +1 -1
  178. package/dist/fns/get-export/get-export.enums.d.ts +1 -1
  179. package/dist/fns/get-export/get-export.schema.zod.browser.cjs +3 -3997
  180. package/dist/fns/get-export/get-export.schema.zod.browser.js +1 -3996
  181. package/dist/fns/get-export/get-export.schema.zod.cjs +1 -1
  182. package/dist/fns/get-export/get-export.schema.zod.d.ts +1 -1
  183. package/dist/fns/get-export/get-export.schema.zod.js +1 -1
  184. package/dist/fns/get-flags/get-flags.enums.d.ts +1 -1
  185. package/dist/fns/get-flags/get-flags.schema.zod.browser.cjs +2 -3996
  186. package/dist/fns/get-flags/get-flags.schema.zod.browser.js +1 -3996
  187. package/dist/fns/get-flags/get-flags.schema.zod.cjs +1 -1
  188. package/dist/fns/get-flags/get-flags.schema.zod.d.ts +1 -1
  189. package/dist/fns/get-flags/get-flags.schema.zod.js +1 -1
  190. package/dist/fns/get-statistics/get-statistics.enums.d.ts +1 -1
  191. package/dist/fns/get-statistics/get-statistics.schema.zod.browser.cjs +7 -4001
  192. package/dist/fns/get-statistics/get-statistics.schema.zod.browser.js +1 -3996
  193. package/dist/fns/get-statistics/get-statistics.schema.zod.cjs +1 -1
  194. package/dist/fns/get-statistics/get-statistics.schema.zod.d.ts +1 -1
  195. package/dist/fns/get-statistics/get-statistics.schema.zod.js +1 -1
  196. package/dist/fns/get-token/get-token.enums.d.ts +1 -1
  197. package/dist/fns/get-token/get-token.schema.zod.browser.cjs +2 -3996
  198. package/dist/fns/get-token/get-token.schema.zod.browser.js +1 -3996
  199. package/dist/fns/get-token/get-token.schema.zod.cjs +1 -1
  200. package/dist/fns/get-token/get-token.schema.zod.d.ts +1 -1
  201. package/dist/fns/get-token/get-token.schema.zod.js +1 -1
  202. package/dist/fns/get-transfer/get-transfer.enums.d.ts +1 -1
  203. package/dist/fns/get-transfer/get-transfer.schema.zod.browser.cjs +2 -3996
  204. package/dist/fns/get-transfer/get-transfer.schema.zod.browser.js +1 -3996
  205. package/dist/fns/get-transfer/get-transfer.schema.zod.cjs +1 -1
  206. package/dist/fns/get-transfer/get-transfer.schema.zod.d.ts +1 -1
  207. package/dist/fns/get-transfer/get-transfer.schema.zod.js +1 -1
  208. package/dist/fns/get-transfer-group/get-transfer-group.enums.d.ts +1 -1
  209. package/dist/fns/get-transfer-group/get-transfer-group.schema.zod.browser.cjs +2 -3996
  210. package/dist/fns/get-transfer-group/get-transfer-group.schema.zod.browser.js +1 -3996
  211. package/dist/fns/get-transfer-group/get-transfer-group.schema.zod.cjs +1 -1
  212. package/dist/fns/get-transfer-group/get-transfer-group.schema.zod.d.ts +1 -1
  213. package/dist/fns/get-transfer-group/get-transfer-group.schema.zod.js +1 -1
  214. package/dist/fns/get-wallet/get-wallet.enums.d.ts +1 -1
  215. package/dist/fns/get-wallet/get-wallet.schema.zod.browser.cjs +2 -3996
  216. package/dist/fns/get-wallet/get-wallet.schema.zod.browser.js +1 -3996
  217. package/dist/fns/get-wallet/get-wallet.schema.zod.cjs +1 -1
  218. package/dist/fns/get-wallet/get-wallet.schema.zod.d.ts +1 -1
  219. package/dist/fns/get-wallet/get-wallet.schema.zod.js +1 -1
  220. package/dist/fns/healthcheck/healthcheck.enums.d.ts +1 -1
  221. package/dist/fns/healthcheck/healthcheck.schema.zod.browser.cjs +2 -3996
  222. package/dist/fns/healthcheck/healthcheck.schema.zod.browser.js +1 -3996
  223. package/dist/fns/healthcheck/healthcheck.schema.zod.cjs +1 -1
  224. package/dist/fns/healthcheck/healthcheck.schema.zod.d.ts +1 -1
  225. package/dist/fns/healthcheck/healthcheck.schema.zod.js +1 -1
  226. package/dist/fns/list-exports/list-exports.enums.d.ts +1 -1
  227. package/dist/fns/list-exports/list-exports.schema.zod.browser.cjs +3 -3997
  228. package/dist/fns/list-exports/list-exports.schema.zod.browser.js +1 -3996
  229. package/dist/fns/list-exports/list-exports.schema.zod.cjs +1 -1
  230. package/dist/fns/list-exports/list-exports.schema.zod.d.ts +1 -1
  231. package/dist/fns/list-exports/list-exports.schema.zod.js +1 -1
  232. package/dist/fns/reverse-transfer/reverse-transfer.enums.d.ts +1 -1
  233. package/dist/fns/reverse-transfer/reverse-transfer.schema.zod.browser.cjs +2 -3996
  234. package/dist/fns/reverse-transfer/reverse-transfer.schema.zod.browser.js +1 -3996
  235. package/dist/fns/reverse-transfer/reverse-transfer.schema.zod.cjs +1 -1
  236. package/dist/fns/reverse-transfer/reverse-transfer.schema.zod.d.ts +1 -1
  237. package/dist/fns/reverse-transfer/reverse-transfer.schema.zod.js +1 -1
  238. package/dist/fns/reverse-transfer-group/reverse-transfer-group.enums.d.ts +1 -1
  239. package/dist/fns/reverse-transfer-group/reverse-transfer-group.schema.zod.browser.cjs +2 -3996
  240. package/dist/fns/reverse-transfer-group/reverse-transfer-group.schema.zod.browser.js +1 -3996
  241. package/dist/fns/reverse-transfer-group/reverse-transfer-group.schema.zod.cjs +1 -1
  242. package/dist/fns/reverse-transfer-group/reverse-transfer-group.schema.zod.d.ts +1 -1
  243. package/dist/fns/reverse-transfer-group/reverse-transfer-group.schema.zod.js +1 -1
  244. package/dist/fns/reverse-transfers/reverse-transfers.enums.d.ts +1 -1
  245. package/dist/fns/set-flags/set-flags.enums.d.ts +1 -1
  246. package/dist/fns/update-token/update-token.enums.d.ts +1 -1
  247. package/dist/fns/update-token/update-token.schema.zod.browser.cjs +2 -3996
  248. package/dist/fns/update-token/update-token.schema.zod.browser.js +1 -3996
  249. package/dist/fns/update-token/update-token.schema.zod.cjs +1 -1
  250. package/dist/fns/update-token/update-token.schema.zod.d.ts +1 -1
  251. package/dist/fns/update-token/update-token.schema.zod.js +1 -1
  252. package/dist/fns/update-transfer/update-transfer.enums.d.ts +1 -1
  253. package/dist/fns/update-transfer/update-transfer.schema.zod.browser.cjs +3 -3997
  254. package/dist/fns/update-transfer/update-transfer.schema.zod.browser.js +1 -3996
  255. package/dist/fns/update-transfer/update-transfer.schema.zod.cjs +1 -1
  256. package/dist/fns/update-transfer/update-transfer.schema.zod.d.ts +1 -1
  257. package/dist/fns/update-transfer/update-transfer.schema.zod.js +1 -1
  258. package/dist/fns/update-transfer-group/update-transfer-group.enums.d.ts +1 -1
  259. package/dist/fns/update-transfer-group/update-transfer-group.schema.zod.browser.cjs +3 -3997
  260. package/dist/fns/update-transfer-group/update-transfer-group.schema.zod.browser.js +1 -3996
  261. package/dist/fns/update-transfer-group/update-transfer-group.schema.zod.cjs +1 -1
  262. package/dist/fns/update-transfer-group/update-transfer-group.schema.zod.d.ts +1 -1
  263. package/dist/fns/update-transfer-group/update-transfer-group.schema.zod.js +1 -1
  264. package/dist/fns/update-transfer-groups/update-transfer-groups.enums.d.ts +1 -1
  265. package/dist/fns/update-transfer-groups/update-transfer-groups.schema.zod.browser.cjs +2 -3996
  266. package/dist/fns/update-transfer-groups/update-transfer-groups.schema.zod.browser.js +1 -3996
  267. package/dist/fns/update-transfer-groups/update-transfer-groups.schema.zod.cjs +1 -1
  268. package/dist/fns/update-transfer-groups/update-transfer-groups.schema.zod.d.ts +1 -1
  269. package/dist/fns/update-transfer-groups/update-transfer-groups.schema.zod.js +1 -1
  270. package/dist/fns/update-transfers/update-transfers.enums.d.ts +1 -1
  271. package/dist/fns/update-transfers/update-transfers.schema.zod.browser.cjs +3 -3997
  272. package/dist/fns/update-transfers/update-transfers.schema.zod.browser.js +1 -3996
  273. package/dist/fns/update-transfers/update-transfers.schema.zod.cjs +1 -1
  274. package/dist/fns/update-transfers/update-transfers.schema.zod.d.ts +1 -1
  275. package/dist/fns/update-transfers/update-transfers.schema.zod.js +1 -1
  276. package/dist/fns/update-wallet/update-wallet.enums.d.ts +1 -1
  277. package/dist/fns/update-wallet/update-wallet.schema.zod.browser.cjs +2 -3996
  278. package/dist/fns/update-wallet/update-wallet.schema.zod.browser.js +1 -3996
  279. package/dist/fns/update-wallet/update-wallet.schema.zod.cjs +1 -1
  280. package/dist/fns/update-wallet/update-wallet.schema.zod.d.ts +1 -1
  281. package/dist/fns/update-wallet/update-wallet.schema.zod.js +1 -1
  282. package/dist/lib/env.browser.cjs +1 -1
  283. package/dist/lib/env.browser.js +1 -1
  284. package/dist/lib/env.cjs +1 -1
  285. package/dist/lib/env.js +1 -1
  286. package/dist/lib/validation.d.ts +16 -16
  287. package/dist/lib/zod.browser.cjs +4018 -0
  288. package/dist/lib/zod.browser.js +3998 -0
  289. package/dist/lib/zod.cjs +30 -0
  290. package/dist/lib/zod.d.ts +2 -0
  291. package/dist/lib/zod.js +5 -0
  292. package/dist/txs/aggregate-transfer-many/aggregate-transfer-many.enums.d.ts +1 -1
  293. package/dist/txs/aggregate-transfer-many/aggregate-transfer-many.schema.zod.browser.cjs +8 -4002
  294. package/dist/txs/aggregate-transfer-many/aggregate-transfer-many.schema.zod.browser.js +1 -3996
  295. package/dist/txs/aggregate-transfer-many/aggregate-transfer-many.schema.zod.cjs +8 -18
  296. package/dist/txs/aggregate-transfer-many/aggregate-transfer-many.schema.zod.d.ts +1 -1
  297. package/dist/txs/aggregate-transfer-many/aggregate-transfer-many.schema.zod.js +1 -1
  298. package/dist/txs/authentication-check/authentication-check.enums.d.ts +1 -1
  299. package/dist/txs/authentication-check/authentication-check.schema.zod.browser.cjs +3 -3997
  300. package/dist/txs/authentication-check/authentication-check.schema.zod.browser.js +1 -3996
  301. package/dist/txs/authentication-check/authentication-check.schema.zod.cjs +3 -13
  302. package/dist/txs/authentication-check/authentication-check.schema.zod.d.ts +1 -1
  303. package/dist/txs/authentication-check/authentication-check.schema.zod.js +1 -1
  304. package/dist/txs/consts.browser.cjs +64 -4058
  305. package/dist/txs/consts.browser.js +1 -3998
  306. package/dist/txs/consts.cjs +64 -74
  307. package/dist/txs/consts.d.ts +1 -1
  308. package/dist/txs/consts.enums.d.ts +1 -1
  309. package/dist/txs/consts.js +1 -1
  310. package/dist/txs/create-access-token/create-access-token.enums.d.ts +1 -1
  311. package/dist/txs/create-access-token/create-access-token.schema.zod.browser.cjs +13 -4007
  312. package/dist/txs/create-access-token/create-access-token.schema.zod.browser.js +1 -3996
  313. package/dist/txs/create-access-token/create-access-token.schema.zod.cjs +13 -23
  314. package/dist/txs/create-access-token/create-access-token.schema.zod.d.ts +1 -1
  315. package/dist/txs/create-access-token/create-access-token.schema.zod.js +1 -1
  316. package/dist/txs/create-contract/create-contract.enums.d.ts +1 -1
  317. package/dist/txs/create-contract/create-contract.schema.zod.browser.cjs +7 -4001
  318. package/dist/txs/create-contract/create-contract.schema.zod.browser.js +1 -3996
  319. package/dist/txs/create-contract/create-contract.schema.zod.cjs +7 -17
  320. package/dist/txs/create-contract/create-contract.schema.zod.d.ts +1 -1
  321. package/dist/txs/create-contract/create-contract.schema.zod.js +1 -1
  322. package/dist/txs/create-deposit/create-deposit.enums.d.ts +1 -1
  323. package/dist/txs/create-deposit/create-deposit.schema.zod.browser.cjs +3 -3997
  324. package/dist/txs/create-deposit/create-deposit.schema.zod.browser.js +1 -3996
  325. package/dist/txs/create-deposit/create-deposit.schema.zod.cjs +3 -13
  326. package/dist/txs/create-deposit/create-deposit.schema.zod.d.ts +1 -1
  327. package/dist/txs/create-deposit/create-deposit.schema.zod.js +1 -1
  328. package/dist/txs/create-distribution/create-distribution.enums.d.ts +1 -1
  329. package/dist/txs/create-distribution/create-distribution.schema.zod.browser.cjs +13 -4007
  330. package/dist/txs/create-distribution/create-distribution.schema.zod.browser.js +1 -3996
  331. package/dist/txs/create-distribution/create-distribution.schema.zod.cjs +13 -23
  332. package/dist/txs/create-distribution/create-distribution.schema.zod.d.ts +1 -1
  333. package/dist/txs/create-distribution/create-distribution.schema.zod.js +1 -1
  334. package/dist/txs/create-token/create-token.enums.d.ts +1 -1
  335. package/dist/txs/create-token/create-token.schema.zod.browser.cjs +4 -3998
  336. package/dist/txs/create-token/create-token.schema.zod.browser.js +1 -3996
  337. package/dist/txs/create-token/create-token.schema.zod.cjs +4 -14
  338. package/dist/txs/create-token/create-token.schema.zod.d.ts +1 -1
  339. package/dist/txs/create-token/create-token.schema.zod.js +1 -1
  340. package/dist/txs/create-transfer/create-transfer.enums.d.ts +1 -1
  341. package/dist/txs/create-transfer/create-transfer.schema.zod.browser.cjs +12 -4006
  342. package/dist/txs/create-transfer/create-transfer.schema.zod.browser.js +1 -3996
  343. package/dist/txs/create-transfer/create-transfer.schema.zod.cjs +12 -22
  344. package/dist/txs/create-transfer/create-transfer.schema.zod.d.ts +1 -1
  345. package/dist/txs/create-transfer/create-transfer.schema.zod.js +1 -1
  346. package/dist/txs/create-transfer-group/create-transfer-group.enums.d.ts +1 -1
  347. package/dist/txs/create-transfer-group/create-transfer-group.schema.zod.browser.cjs +7 -4001
  348. package/dist/txs/create-transfer-group/create-transfer-group.schema.zod.browser.js +1 -3996
  349. package/dist/txs/create-transfer-group/create-transfer-group.schema.zod.cjs +7 -17
  350. package/dist/txs/create-transfer-group/create-transfer-group.schema.zod.d.ts +1 -1
  351. package/dist/txs/create-transfer-group/create-transfer-group.schema.zod.js +1 -1
  352. package/dist/txs/create-transfer-many/create-transfer-many.enums.d.ts +1 -1
  353. package/dist/txs/create-transfer-many/create-transfer-many.schema.zod.browser.cjs +3 -3997
  354. package/dist/txs/create-transfer-many/create-transfer-many.schema.zod.browser.js +1 -3996
  355. package/dist/txs/create-transfer-many/create-transfer-many.schema.zod.cjs +3 -13
  356. package/dist/txs/create-transfer-many/create-transfer-many.schema.zod.d.ts +1 -1
  357. package/dist/txs/create-transfer-many/create-transfer-many.schema.zod.js +1 -1
  358. package/dist/txs/create-wallet/create-wallet.enums.d.ts +1 -1
  359. package/dist/txs/create-wallet/create-wallet.schema.zod.browser.cjs +4 -3998
  360. package/dist/txs/create-wallet/create-wallet.schema.zod.browser.js +1 -3996
  361. package/dist/txs/create-wallet/create-wallet.schema.zod.cjs +4 -14
  362. package/dist/txs/create-wallet/create-wallet.schema.zod.d.ts +1 -1
  363. package/dist/txs/create-wallet/create-wallet.schema.zod.js +1 -1
  364. package/dist/txs/create-withdrawal/create-withdrawal.enums.d.ts +1 -1
  365. package/dist/txs/create-withdrawal/create-withdrawal.schema.zod.browser.cjs +3 -3997
  366. package/dist/txs/create-withdrawal/create-withdrawal.schema.zod.browser.js +1 -3996
  367. package/dist/txs/create-withdrawal/create-withdrawal.schema.zod.cjs +3 -13
  368. package/dist/txs/create-withdrawal/create-withdrawal.schema.zod.d.ts +1 -1
  369. package/dist/txs/create-withdrawal/create-withdrawal.schema.zod.js +1 -1
  370. package/dist/txs/export-balance-history/export-balance-history.enums.d.ts +1 -1
  371. package/dist/txs/export-balance-history/export-balance-history.schema.zod.browser.cjs +3 -3997
  372. package/dist/txs/export-balance-history/export-balance-history.schema.zod.browser.js +1 -3996
  373. package/dist/txs/export-balance-history/export-balance-history.schema.zod.cjs +3 -13
  374. package/dist/txs/export-balance-history/export-balance-history.schema.zod.d.ts +1 -1
  375. package/dist/txs/export-balance-history/export-balance-history.schema.zod.js +1 -1
  376. package/dist/txs/export-token-many/export-token-many.enums.d.ts +1 -1
  377. package/dist/txs/export-transfer-group-many/export-transfer-group-many.enums.d.ts +1 -1
  378. package/dist/txs/export-transfer-many/export-transfer-many.enums.d.ts +1 -1
  379. package/dist/txs/export-wallet-many/export-wallet-many.enums.d.ts +1 -1
  380. package/dist/txs/find-balance-many/find-balance-many.enums.d.ts +1 -1
  381. package/dist/txs/find-balance-many/find-balance-many.schema.zod.browser.cjs +5 -3999
  382. package/dist/txs/find-balance-many/find-balance-many.schema.zod.browser.js +1 -3996
  383. package/dist/txs/find-balance-many/find-balance-many.schema.zod.cjs +5 -15
  384. package/dist/txs/find-balance-many/find-balance-many.schema.zod.d.ts +1 -1
  385. package/dist/txs/find-balance-many/find-balance-many.schema.zod.js +1 -1
  386. package/dist/txs/find-token-many/find-token-many.enums.d.ts +1 -1
  387. package/dist/txs/find-token-many/find-token-many.schema.zod.browser.cjs +6 -4000
  388. package/dist/txs/find-token-many/find-token-many.schema.zod.browser.js +1 -3996
  389. package/dist/txs/find-token-many/find-token-many.schema.zod.cjs +6 -16
  390. package/dist/txs/find-token-many/find-token-many.schema.zod.d.ts +1 -1
  391. package/dist/txs/find-token-many/find-token-many.schema.zod.js +1 -1
  392. package/dist/txs/find-transfer-group-many/find-transfer-group-many.enums.d.ts +1 -1
  393. package/dist/txs/find-transfer-group-many/find-transfer-group-many.schema.zod.browser.cjs +7 -4001
  394. package/dist/txs/find-transfer-group-many/find-transfer-group-many.schema.zod.browser.js +1 -3996
  395. package/dist/txs/find-transfer-group-many/find-transfer-group-many.schema.zod.cjs +7 -17
  396. package/dist/txs/find-transfer-group-many/find-transfer-group-many.schema.zod.d.ts +1 -1
  397. package/dist/txs/find-transfer-group-many/find-transfer-group-many.schema.zod.js +1 -1
  398. package/dist/txs/find-transfer-many/find-transfer-many.enums.d.ts +1 -1
  399. package/dist/txs/find-transfer-many/find-transfer-many.schema.zod.browser.cjs +6 -4000
  400. package/dist/txs/find-transfer-many/find-transfer-many.schema.zod.browser.js +1 -3996
  401. package/dist/txs/find-transfer-many/find-transfer-many.schema.zod.cjs +6 -16
  402. package/dist/txs/find-transfer-many/find-transfer-many.schema.zod.d.ts +1 -1
  403. package/dist/txs/find-transfer-many/find-transfer-many.schema.zod.js +1 -1
  404. package/dist/txs/find-wallet-many/find-wallet-many.enums.d.ts +1 -1
  405. package/dist/txs/find-wallet-many/find-wallet-many.schema.zod.browser.cjs +9 -4003
  406. package/dist/txs/find-wallet-many/find-wallet-many.schema.zod.browser.js +1 -3996
  407. package/dist/txs/find-wallet-many/find-wallet-many.schema.zod.cjs +9 -19
  408. package/dist/txs/find-wallet-many/find-wallet-many.schema.zod.d.ts +1 -1
  409. package/dist/txs/find-wallet-many/find-wallet-many.schema.zod.js +1 -1
  410. package/dist/txs/finish-transaction/finish-transaction.enums.d.ts +1 -1
  411. package/dist/txs/finish-transaction/finish-transaction.schema.zod.browser.cjs +6 -4000
  412. package/dist/txs/finish-transaction/finish-transaction.schema.zod.browser.js +1 -3996
  413. package/dist/txs/finish-transaction/finish-transaction.schema.zod.cjs +6 -16
  414. package/dist/txs/finish-transaction/finish-transaction.schema.zod.d.ts +1 -1
  415. package/dist/txs/finish-transaction/finish-transaction.schema.zod.js +1 -1
  416. package/dist/txs/get-balance/get-balance.enums.d.ts +1 -1
  417. package/dist/txs/get-balance/get-balance.schema.zod.browser.cjs +9 -4003
  418. package/dist/txs/get-balance/get-balance.schema.zod.browser.js +1 -3996
  419. package/dist/txs/get-balance/get-balance.schema.zod.cjs +9 -19
  420. package/dist/txs/get-balance/get-balance.schema.zod.d.ts +1 -1
  421. package/dist/txs/get-balance/get-balance.schema.zod.js +1 -1
  422. package/dist/txs/get-balance-history/get-balance-history.enums.d.ts +1 -1
  423. package/dist/txs/get-balance-history/get-balance-history.schema.zod.browser.cjs +12 -4006
  424. package/dist/txs/get-balance-history/get-balance-history.schema.zod.browser.js +1 -3996
  425. package/dist/txs/get-balance-history/get-balance-history.schema.zod.cjs +12 -22
  426. package/dist/txs/get-balance-history/get-balance-history.schema.zod.d.ts +1 -1
  427. package/dist/txs/get-balance-history/get-balance-history.schema.zod.js +1 -1
  428. package/dist/txs/get-export/get-export.enums.d.ts +1 -1
  429. package/dist/txs/get-export/get-export.schema.zod.browser.cjs +14 -4008
  430. package/dist/txs/get-export/get-export.schema.zod.browser.js +1 -3996
  431. package/dist/txs/get-export/get-export.schema.zod.cjs +14 -24
  432. package/dist/txs/get-export/get-export.schema.zod.d.ts +1 -1
  433. package/dist/txs/get-export/get-export.schema.zod.js +1 -1
  434. package/dist/txs/get-flags/get-flags.enums.d.ts +1 -1
  435. package/dist/txs/get-flags/get-flags.schema.zod.browser.cjs +3 -3997
  436. package/dist/txs/get-flags/get-flags.schema.zod.browser.js +1 -3996
  437. package/dist/txs/get-flags/get-flags.schema.zod.cjs +3 -13
  438. package/dist/txs/get-flags/get-flags.schema.zod.d.ts +1 -1
  439. package/dist/txs/get-flags/get-flags.schema.zod.js +1 -1
  440. package/dist/txs/get-statistics/get-statistics.enums.d.ts +1 -1
  441. package/dist/txs/get-statistics/get-statistics.schema.zod.browser.cjs +6 -4000
  442. package/dist/txs/get-statistics/get-statistics.schema.zod.browser.js +1 -3996
  443. package/dist/txs/get-statistics/get-statistics.schema.zod.cjs +6 -16
  444. package/dist/txs/get-statistics/get-statistics.schema.zod.d.ts +1 -1
  445. package/dist/txs/get-statistics/get-statistics.schema.zod.js +1 -1
  446. package/dist/txs/get-token/get-token.enums.d.ts +1 -1
  447. package/dist/txs/get-token/get-token.schema.zod.browser.cjs +8 -4002
  448. package/dist/txs/get-token/get-token.schema.zod.browser.js +1 -3996
  449. package/dist/txs/get-token/get-token.schema.zod.cjs +8 -18
  450. package/dist/txs/get-token/get-token.schema.zod.d.ts +1 -1
  451. package/dist/txs/get-token/get-token.schema.zod.js +1 -1
  452. package/dist/txs/get-token-many/get-token-many.enums.d.ts +1 -1
  453. package/dist/txs/get-token-many/get-token-many.schema.zod.browser.cjs +3 -3997
  454. package/dist/txs/get-token-many/get-token-many.schema.zod.browser.js +1 -3996
  455. package/dist/txs/get-token-many/get-token-many.schema.zod.cjs +3 -13
  456. package/dist/txs/get-token-many/get-token-many.schema.zod.d.ts +1 -1
  457. package/dist/txs/get-token-many/get-token-many.schema.zod.js +1 -1
  458. package/dist/txs/get-transfer/get-transfer.enums.d.ts +1 -1
  459. package/dist/txs/get-transfer/get-transfer.schema.zod.browser.cjs +3 -3997
  460. package/dist/txs/get-transfer/get-transfer.schema.zod.browser.js +1 -3996
  461. package/dist/txs/get-transfer/get-transfer.schema.zod.cjs +3 -13
  462. package/dist/txs/get-transfer/get-transfer.schema.zod.d.ts +1 -1
  463. package/dist/txs/get-transfer/get-transfer.schema.zod.js +1 -1
  464. package/dist/txs/get-transfer-group/get-transfer-group.enums.d.ts +1 -1
  465. package/dist/txs/get-transfer-group/get-transfer-group.schema.zod.browser.cjs +5 -3999
  466. package/dist/txs/get-transfer-group/get-transfer-group.schema.zod.browser.js +1 -3996
  467. package/dist/txs/get-transfer-group/get-transfer-group.schema.zod.cjs +5 -15
  468. package/dist/txs/get-transfer-group/get-transfer-group.schema.zod.d.ts +1 -1
  469. package/dist/txs/get-transfer-group/get-transfer-group.schema.zod.js +1 -1
  470. package/dist/txs/get-wallet/get-wallet.enums.d.ts +1 -1
  471. package/dist/txs/get-wallet/get-wallet.schema.zod.browser.cjs +7 -4001
  472. package/dist/txs/get-wallet/get-wallet.schema.zod.browser.js +1 -3996
  473. package/dist/txs/get-wallet/get-wallet.schema.zod.cjs +7 -17
  474. package/dist/txs/get-wallet/get-wallet.schema.zod.d.ts +1 -1
  475. package/dist/txs/get-wallet/get-wallet.schema.zod.js +1 -1
  476. package/dist/txs/get-wallet-many/get-wallet-many.enums.d.ts +1 -1
  477. package/dist/txs/get-wallet-many/get-wallet-many.schema.zod.browser.cjs +3 -3997
  478. package/dist/txs/get-wallet-many/get-wallet-many.schema.zod.browser.js +1 -3996
  479. package/dist/txs/get-wallet-many/get-wallet-many.schema.zod.cjs +3 -13
  480. package/dist/txs/get-wallet-many/get-wallet-many.schema.zod.d.ts +1 -1
  481. package/dist/txs/get-wallet-many/get-wallet-many.schema.zod.js +1 -1
  482. package/dist/txs/healthcheck/healthcheck.enums.d.ts +1 -1
  483. package/dist/txs/healthcheck/healthcheck.schema.zod.browser.cjs +9 -4003
  484. package/dist/txs/healthcheck/healthcheck.schema.zod.browser.js +1 -3996
  485. package/dist/txs/healthcheck/healthcheck.schema.zod.cjs +9 -19
  486. package/dist/txs/healthcheck/healthcheck.schema.zod.d.ts +1 -1
  487. package/dist/txs/healthcheck/healthcheck.schema.zod.js +1 -1
  488. package/dist/txs/import-actions/import-actions.enums.d.ts +1 -1
  489. package/dist/txs/import-actions/import-actions.schema.zod.browser.cjs +19 -4013
  490. package/dist/txs/import-actions/import-actions.schema.zod.browser.js +1 -3998
  491. package/dist/txs/import-actions/import-actions.schema.zod.cjs +19 -29
  492. package/dist/txs/import-actions/import-actions.schema.zod.d.ts +1 -1
  493. package/dist/txs/import-actions/import-actions.schema.zod.js +1 -1
  494. package/dist/txs/list-export-many/list-export-many.enums.d.ts +1 -1
  495. package/dist/txs/list-export-many/list-export-many.schema.zod.browser.cjs +6 -4000
  496. package/dist/txs/list-export-many/list-export-many.schema.zod.browser.js +1 -3996
  497. package/dist/txs/list-export-many/list-export-many.schema.zod.cjs +6 -16
  498. package/dist/txs/list-export-many/list-export-many.schema.zod.d.ts +1 -1
  499. package/dist/txs/list-export-many/list-export-many.schema.zod.js +1 -1
  500. package/dist/txs/query-logs/query-logs.enums.d.ts +1 -1
  501. package/dist/txs/query-logs/query-logs.schema.zod.browser.cjs +10 -4004
  502. package/dist/txs/query-logs/query-logs.schema.zod.browser.js +1 -3996
  503. package/dist/txs/query-logs/query-logs.schema.zod.cjs +10 -20
  504. package/dist/txs/query-logs/query-logs.schema.zod.d.ts +1 -1
  505. package/dist/txs/query-logs/query-logs.schema.zod.js +1 -1
  506. package/dist/txs/reset-database/reset-database.enums.d.ts +1 -1
  507. package/dist/txs/reset-database/reset-database.schema.zod.browser.cjs +7 -4001
  508. package/dist/txs/reset-database/reset-database.schema.zod.browser.js +1 -3996
  509. package/dist/txs/reset-database/reset-database.schema.zod.cjs +7 -17
  510. package/dist/txs/reset-database/reset-database.schema.zod.d.ts +1 -1
  511. package/dist/txs/reset-database/reset-database.schema.zod.js +1 -1
  512. package/dist/txs/reverse-transfer/reverse-transfer.enums.d.ts +1 -1
  513. package/dist/txs/reverse-transfer/reverse-transfer.schema.zod.browser.cjs +8 -4002
  514. package/dist/txs/reverse-transfer/reverse-transfer.schema.zod.browser.js +1 -3996
  515. package/dist/txs/reverse-transfer/reverse-transfer.schema.zod.cjs +8 -18
  516. package/dist/txs/reverse-transfer/reverse-transfer.schema.zod.d.ts +1 -1
  517. package/dist/txs/reverse-transfer/reverse-transfer.schema.zod.js +1 -1
  518. package/dist/txs/reverse-transfer-group/reverse-transfer-group.enums.d.ts +1 -1
  519. package/dist/txs/reverse-transfer-group/reverse-transfer-group.schema.zod.browser.cjs +9 -4003
  520. package/dist/txs/reverse-transfer-group/reverse-transfer-group.schema.zod.browser.js +1 -3996
  521. package/dist/txs/reverse-transfer-group/reverse-transfer-group.schema.zod.cjs +9 -19
  522. package/dist/txs/reverse-transfer-group/reverse-transfer-group.schema.zod.d.ts +1 -1
  523. package/dist/txs/reverse-transfer-group/reverse-transfer-group.schema.zod.js +1 -1
  524. package/dist/txs/reverse-transfer-group-many/reverse-transfer-group-many.enums.d.ts +1 -1
  525. package/dist/txs/reverse-transfer-group-many/reverse-transfer-group-many.schema.zod.browser.cjs +3 -3997
  526. package/dist/txs/reverse-transfer-group-many/reverse-transfer-group-many.schema.zod.browser.js +1 -3996
  527. package/dist/txs/reverse-transfer-group-many/reverse-transfer-group-many.schema.zod.cjs +3 -13
  528. package/dist/txs/reverse-transfer-group-many/reverse-transfer-group-many.schema.zod.d.ts +1 -1
  529. package/dist/txs/reverse-transfer-group-many/reverse-transfer-group-many.schema.zod.js +1 -1
  530. package/dist/txs/reverse-transfer-many/reverse-transfer-many.enums.d.ts +1 -1
  531. package/dist/txs/reverse-transfer-many/reverse-transfer-many.schema.zod.browser.cjs +6 -4000
  532. package/dist/txs/reverse-transfer-many/reverse-transfer-many.schema.zod.browser.js +1 -3996
  533. package/dist/txs/reverse-transfer-many/reverse-transfer-many.schema.zod.cjs +6 -16
  534. package/dist/txs/reverse-transfer-many/reverse-transfer-many.schema.zod.d.ts +1 -1
  535. package/dist/txs/reverse-transfer-many/reverse-transfer-many.schema.zod.js +1 -1
  536. package/dist/txs/set-flags/set-flags.enums.d.ts +1 -1
  537. package/dist/txs/set-flags/set-flags.schema.zod.browser.cjs +4 -3998
  538. package/dist/txs/set-flags/set-flags.schema.zod.browser.js +1 -3996
  539. package/dist/txs/set-flags/set-flags.schema.zod.cjs +4 -14
  540. package/dist/txs/set-flags/set-flags.schema.zod.d.ts +1 -1
  541. package/dist/txs/set-flags/set-flags.schema.zod.js +1 -1
  542. package/dist/txs/start-transaction/start-transaction.enums.d.ts +1 -1
  543. package/dist/txs/start-transaction/start-transaction.schema.zod.browser.cjs +4 -3998
  544. package/dist/txs/start-transaction/start-transaction.schema.zod.browser.js +1 -3996
  545. package/dist/txs/start-transaction/start-transaction.schema.zod.cjs +4 -14
  546. package/dist/txs/start-transaction/start-transaction.schema.zod.d.ts +1 -1
  547. package/dist/txs/start-transaction/start-transaction.schema.zod.js +1 -1
  548. package/dist/txs/update-token/update-token.enums.d.ts +1 -1
  549. package/dist/txs/update-token/update-token.schema.zod.browser.cjs +5 -3999
  550. package/dist/txs/update-token/update-token.schema.zod.browser.js +1 -3996
  551. package/dist/txs/update-token/update-token.schema.zod.cjs +5 -15
  552. package/dist/txs/update-token/update-token.schema.zod.d.ts +1 -1
  553. package/dist/txs/update-token/update-token.schema.zod.js +1 -1
  554. package/dist/txs/update-transfer/update-transfer.enums.d.ts +1 -1
  555. package/dist/txs/update-transfer/update-transfer.schema.zod.browser.cjs +7 -4001
  556. package/dist/txs/update-transfer/update-transfer.schema.zod.browser.js +1 -3996
  557. package/dist/txs/update-transfer/update-transfer.schema.zod.cjs +7 -17
  558. package/dist/txs/update-transfer/update-transfer.schema.zod.d.ts +1 -1
  559. package/dist/txs/update-transfer/update-transfer.schema.zod.js +1 -1
  560. package/dist/txs/update-transfer-group/update-transfer-group.enums.d.ts +1 -1
  561. package/dist/txs/update-transfer-group/update-transfer-group.schema.zod.browser.cjs +7 -4001
  562. package/dist/txs/update-transfer-group/update-transfer-group.schema.zod.browser.js +1 -3996
  563. package/dist/txs/update-transfer-group/update-transfer-group.schema.zod.cjs +7 -17
  564. package/dist/txs/update-transfer-group/update-transfer-group.schema.zod.d.ts +1 -1
  565. package/dist/txs/update-transfer-group/update-transfer-group.schema.zod.js +1 -1
  566. package/dist/txs/update-transfer-group-many/update-transfer-group-many.enums.d.ts +1 -1
  567. package/dist/txs/update-transfer-group-many/update-transfer-group-many.schema.zod.browser.cjs +4 -3998
  568. package/dist/txs/update-transfer-group-many/update-transfer-group-many.schema.zod.browser.js +1 -3996
  569. package/dist/txs/update-transfer-group-many/update-transfer-group-many.schema.zod.cjs +4 -14
  570. package/dist/txs/update-transfer-group-many/update-transfer-group-many.schema.zod.d.ts +1 -1
  571. package/dist/txs/update-transfer-group-many/update-transfer-group-many.schema.zod.js +1 -1
  572. package/dist/txs/update-transfer-many/update-transfer-many.enums.d.ts +1 -1
  573. package/dist/txs/update-transfer-many/update-transfer-many.schema.zod.browser.cjs +4 -3998
  574. package/dist/txs/update-transfer-many/update-transfer-many.schema.zod.browser.js +1 -3996
  575. package/dist/txs/update-transfer-many/update-transfer-many.schema.zod.cjs +4 -14
  576. package/dist/txs/update-transfer-many/update-transfer-many.schema.zod.d.ts +1 -1
  577. package/dist/txs/update-transfer-many/update-transfer-many.schema.zod.js +1 -1
  578. package/dist/txs/update-wallet/update-wallet.enums.d.ts +1 -1
  579. package/dist/txs/update-wallet/update-wallet.schema.zod.browser.cjs +5 -3999
  580. package/dist/txs/update-wallet/update-wallet.schema.zod.browser.js +1 -3996
  581. package/dist/txs/update-wallet/update-wallet.schema.zod.cjs +5 -15
  582. package/dist/txs/update-wallet/update-wallet.schema.zod.d.ts +1 -1
  583. package/dist/txs/update-wallet/update-wallet.schema.zod.js +1 -1
  584. package/dist/types/wapi-client.d.ts +217 -213
  585. package/dist/wapi-client-web.iife.js +2 -2
  586. package/dist/wapi-client.iife.js +2 -2
  587. package/package.json +5 -5
@@ -1,25 +1,8 @@
1
1
  "use strict";
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
6
  var __export = (target, all) => {
24
7
  for (var name in all)
25
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -33,26 +16,6 @@ var __copyProps = (to, from, except, desc) => {
33
16
  return to;
34
17
  };
35
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
- var __async = (__this, __arguments, generator) => {
37
- return new Promise((resolve, reject) => {
38
- var fulfilled = (value) => {
39
- try {
40
- step(generator.next(value));
41
- } catch (e) {
42
- reject(e);
43
- }
44
- };
45
- var rejected = (value) => {
46
- try {
47
- step(generator.throw(value));
48
- } catch (e) {
49
- reject(e);
50
- }
51
- };
52
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
53
- step((generator = generator.apply(__this, __arguments)).next());
54
- });
55
- };
56
19
 
57
20
  // src/txs/import-actions/import-actions.schema.zod.ts
58
21
  var import_actions_schema_zod_exports = {};
@@ -83,3971 +46,14 @@ var import_get_token_schema = require('../get-token/get-token.schema.zod.cjs');
83
46
  var import_get_transfer_group_schema = require('../get-transfer-group/get-transfer-group.schema.zod.cjs');
84
47
  var import_get_wallet_schema = require('../get-wallet/get-wallet.schema.zod.cjs');
85
48
  var import_consts2 = require('../consts.cjs');
86
-
87
- // node_modules/zod/lib/index.mjs
88
- var util;
89
- (function(util2) {
90
- util2.assertEqual = (val) => val;
91
- function assertIs(_arg) {
92
- }
93
- util2.assertIs = assertIs;
94
- function assertNever(_x) {
95
- throw new Error();
96
- }
97
- util2.assertNever = assertNever;
98
- util2.arrayToEnum = (items) => {
99
- const obj = {};
100
- for (const item of items) {
101
- obj[item] = item;
102
- }
103
- return obj;
104
- };
105
- util2.getValidEnumValues = (obj) => {
106
- const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
107
- const filtered = {};
108
- for (const k of validKeys) {
109
- filtered[k] = obj[k];
110
- }
111
- return util2.objectValues(filtered);
112
- };
113
- util2.objectValues = (obj) => {
114
- return util2.objectKeys(obj).map(function(e) {
115
- return obj[e];
116
- });
117
- };
118
- util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
119
- const keys = [];
120
- for (const key in object) {
121
- if (Object.prototype.hasOwnProperty.call(object, key)) {
122
- keys.push(key);
123
- }
124
- }
125
- return keys;
126
- };
127
- util2.find = (arr, checker) => {
128
- for (const item of arr) {
129
- if (checker(item))
130
- return item;
131
- }
132
- return void 0;
133
- };
134
- util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
135
- function joinValues(array, separator = " | ") {
136
- return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
137
- }
138
- util2.joinValues = joinValues;
139
- util2.jsonStringifyReplacer = (_, value) => {
140
- if (typeof value === "bigint") {
141
- return value.toString();
142
- }
143
- return value;
144
- };
145
- })(util || (util = {}));
146
- var objectUtil;
147
- (function(objectUtil2) {
148
- objectUtil2.mergeShapes = (first, second) => {
149
- return __spreadValues(__spreadValues({}, first), second);
150
- };
151
- })(objectUtil || (objectUtil = {}));
152
- var ZodParsedType = util.arrayToEnum([
153
- "string",
154
- "nan",
155
- "number",
156
- "integer",
157
- "float",
158
- "boolean",
159
- "date",
160
- "bigint",
161
- "symbol",
162
- "function",
163
- "undefined",
164
- "null",
165
- "array",
166
- "object",
167
- "unknown",
168
- "promise",
169
- "void",
170
- "never",
171
- "map",
172
- "set"
173
- ]);
174
- var getParsedType = (data) => {
175
- const t = typeof data;
176
- switch (t) {
177
- case "undefined":
178
- return ZodParsedType.undefined;
179
- case "string":
180
- return ZodParsedType.string;
181
- case "number":
182
- return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
183
- case "boolean":
184
- return ZodParsedType.boolean;
185
- case "function":
186
- return ZodParsedType.function;
187
- case "bigint":
188
- return ZodParsedType.bigint;
189
- case "symbol":
190
- return ZodParsedType.symbol;
191
- case "object":
192
- if (Array.isArray(data)) {
193
- return ZodParsedType.array;
194
- }
195
- if (data === null) {
196
- return ZodParsedType.null;
197
- }
198
- if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
199
- return ZodParsedType.promise;
200
- }
201
- if (typeof Map !== "undefined" && data instanceof Map) {
202
- return ZodParsedType.map;
203
- }
204
- if (typeof Set !== "undefined" && data instanceof Set) {
205
- return ZodParsedType.set;
206
- }
207
- if (typeof Date !== "undefined" && data instanceof Date) {
208
- return ZodParsedType.date;
209
- }
210
- return ZodParsedType.object;
211
- default:
212
- return ZodParsedType.unknown;
213
- }
214
- };
215
- var ZodIssueCode = util.arrayToEnum([
216
- "invalid_type",
217
- "invalid_literal",
218
- "custom",
219
- "invalid_union",
220
- "invalid_union_discriminator",
221
- "invalid_enum_value",
222
- "unrecognized_keys",
223
- "invalid_arguments",
224
- "invalid_return_type",
225
- "invalid_date",
226
- "invalid_string",
227
- "too_small",
228
- "too_big",
229
- "invalid_intersection_types",
230
- "not_multiple_of",
231
- "not_finite"
232
- ]);
233
- var quotelessJson = (obj) => {
234
- const json = JSON.stringify(obj, null, 2);
235
- return json.replace(/"([^"]+)":/g, "$1:");
236
- };
237
- var ZodError = class _ZodError extends Error {
238
- get errors() {
239
- return this.issues;
240
- }
241
- constructor(issues) {
242
- super();
243
- this.issues = [];
244
- this.addIssue = (sub) => {
245
- this.issues = [...this.issues, sub];
246
- };
247
- this.addIssues = (subs = []) => {
248
- this.issues = [...this.issues, ...subs];
249
- };
250
- const actualProto = new.target.prototype;
251
- if (Object.setPrototypeOf) {
252
- Object.setPrototypeOf(this, actualProto);
253
- } else {
254
- this.__proto__ = actualProto;
255
- }
256
- this.name = "ZodError";
257
- this.issues = issues;
258
- }
259
- format(_mapper) {
260
- const mapper = _mapper || function(issue) {
261
- return issue.message;
262
- };
263
- const fieldErrors = { _errors: [] };
264
- const processError = (error) => {
265
- for (const issue of error.issues) {
266
- if (issue.code === "invalid_union") {
267
- issue.unionErrors.map(processError);
268
- } else if (issue.code === "invalid_return_type") {
269
- processError(issue.returnTypeError);
270
- } else if (issue.code === "invalid_arguments") {
271
- processError(issue.argumentsError);
272
- } else if (issue.path.length === 0) {
273
- fieldErrors._errors.push(mapper(issue));
274
- } else {
275
- let curr = fieldErrors;
276
- let i = 0;
277
- while (i < issue.path.length) {
278
- const el = issue.path[i];
279
- const terminal = i === issue.path.length - 1;
280
- if (!terminal) {
281
- curr[el] = curr[el] || { _errors: [] };
282
- } else {
283
- curr[el] = curr[el] || { _errors: [] };
284
- curr[el]._errors.push(mapper(issue));
285
- }
286
- curr = curr[el];
287
- i++;
288
- }
289
- }
290
- }
291
- };
292
- processError(this);
293
- return fieldErrors;
294
- }
295
- static assert(value) {
296
- if (!(value instanceof _ZodError)) {
297
- throw new Error(`Not a ZodError: ${value}`);
298
- }
299
- }
300
- toString() {
301
- return this.message;
302
- }
303
- get message() {
304
- return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
305
- }
306
- get isEmpty() {
307
- return this.issues.length === 0;
308
- }
309
- flatten(mapper = (issue) => issue.message) {
310
- const fieldErrors = {};
311
- const formErrors = [];
312
- for (const sub of this.issues) {
313
- if (sub.path.length > 0) {
314
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
315
- fieldErrors[sub.path[0]].push(mapper(sub));
316
- } else {
317
- formErrors.push(mapper(sub));
318
- }
319
- }
320
- return { formErrors, fieldErrors };
321
- }
322
- get formErrors() {
323
- return this.flatten();
324
- }
325
- };
326
- ZodError.create = (issues) => {
327
- const error = new ZodError(issues);
328
- return error;
329
- };
330
- var errorMap = (issue, _ctx) => {
331
- let message;
332
- switch (issue.code) {
333
- case ZodIssueCode.invalid_type:
334
- if (issue.received === ZodParsedType.undefined) {
335
- message = "Required";
336
- } else {
337
- message = `Expected ${issue.expected}, received ${issue.received}`;
338
- }
339
- break;
340
- case ZodIssueCode.invalid_literal:
341
- message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
342
- break;
343
- case ZodIssueCode.unrecognized_keys:
344
- message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
345
- break;
346
- case ZodIssueCode.invalid_union:
347
- message = `Invalid input`;
348
- break;
349
- case ZodIssueCode.invalid_union_discriminator:
350
- message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
351
- break;
352
- case ZodIssueCode.invalid_enum_value:
353
- message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
354
- break;
355
- case ZodIssueCode.invalid_arguments:
356
- message = `Invalid function arguments`;
357
- break;
358
- case ZodIssueCode.invalid_return_type:
359
- message = `Invalid function return type`;
360
- break;
361
- case ZodIssueCode.invalid_date:
362
- message = `Invalid date`;
363
- break;
364
- case ZodIssueCode.invalid_string:
365
- if (typeof issue.validation === "object") {
366
- if ("includes" in issue.validation) {
367
- message = `Invalid input: must include "${issue.validation.includes}"`;
368
- if (typeof issue.validation.position === "number") {
369
- message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
370
- }
371
- } else if ("startsWith" in issue.validation) {
372
- message = `Invalid input: must start with "${issue.validation.startsWith}"`;
373
- } else if ("endsWith" in issue.validation) {
374
- message = `Invalid input: must end with "${issue.validation.endsWith}"`;
375
- } else {
376
- util.assertNever(issue.validation);
377
- }
378
- } else if (issue.validation !== "regex") {
379
- message = `Invalid ${issue.validation}`;
380
- } else {
381
- message = "Invalid";
382
- }
383
- break;
384
- case ZodIssueCode.too_small:
385
- if (issue.type === "array")
386
- message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
387
- else if (issue.type === "string")
388
- message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
389
- else if (issue.type === "number")
390
- message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
391
- else if (issue.type === "date")
392
- message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
393
- else
394
- message = "Invalid input";
395
- break;
396
- case ZodIssueCode.too_big:
397
- if (issue.type === "array")
398
- message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
399
- else if (issue.type === "string")
400
- message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
401
- else if (issue.type === "number")
402
- message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
403
- else if (issue.type === "bigint")
404
- message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
405
- else if (issue.type === "date")
406
- message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
407
- else
408
- message = "Invalid input";
409
- break;
410
- case ZodIssueCode.custom:
411
- message = `Invalid input`;
412
- break;
413
- case ZodIssueCode.invalid_intersection_types:
414
- message = `Intersection results could not be merged`;
415
- break;
416
- case ZodIssueCode.not_multiple_of:
417
- message = `Number must be a multiple of ${issue.multipleOf}`;
418
- break;
419
- case ZodIssueCode.not_finite:
420
- message = "Number must be finite";
421
- break;
422
- default:
423
- message = _ctx.defaultError;
424
- util.assertNever(issue);
425
- }
426
- return { message };
427
- };
428
- var overrideErrorMap = errorMap;
429
- function setErrorMap(map) {
430
- overrideErrorMap = map;
431
- }
432
- function getErrorMap() {
433
- return overrideErrorMap;
434
- }
435
- var makeIssue = (params) => {
436
- const { data, path, errorMaps, issueData } = params;
437
- const fullPath = [...path, ...issueData.path || []];
438
- const fullIssue = __spreadProps(__spreadValues({}, issueData), {
439
- path: fullPath
440
- });
441
- if (issueData.message !== void 0) {
442
- return __spreadProps(__spreadValues({}, issueData), {
443
- path: fullPath,
444
- message: issueData.message
445
- });
446
- }
447
- let errorMessage = "";
448
- const maps = errorMaps.filter((m) => !!m).slice().reverse();
449
- for (const map of maps) {
450
- errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
451
- }
452
- return __spreadProps(__spreadValues({}, issueData), {
453
- path: fullPath,
454
- message: errorMessage
455
- });
456
- };
457
- var EMPTY_PATH = [];
458
- function addIssueToContext(ctx, issueData) {
459
- const overrideMap = getErrorMap();
460
- const issue = makeIssue({
461
- issueData,
462
- data: ctx.data,
463
- path: ctx.path,
464
- errorMaps: [
465
- ctx.common.contextualErrorMap,
466
- // contextual error map is first priority
467
- ctx.schemaErrorMap,
468
- // then schema-bound map if available
469
- overrideMap,
470
- // then global override map
471
- overrideMap === errorMap ? void 0 : errorMap
472
- // then global default map
473
- ].filter((x) => !!x)
474
- });
475
- ctx.common.issues.push(issue);
476
- }
477
- var ParseStatus = class _ParseStatus {
478
- constructor() {
479
- this.value = "valid";
480
- }
481
- dirty() {
482
- if (this.value === "valid")
483
- this.value = "dirty";
484
- }
485
- abort() {
486
- if (this.value !== "aborted")
487
- this.value = "aborted";
488
- }
489
- static mergeArray(status, results) {
490
- const arrayValue = [];
491
- for (const s of results) {
492
- if (s.status === "aborted")
493
- return INVALID;
494
- if (s.status === "dirty")
495
- status.dirty();
496
- arrayValue.push(s.value);
497
- }
498
- return { status: status.value, value: arrayValue };
499
- }
500
- static mergeObjectAsync(status, pairs) {
501
- return __async(this, null, function* () {
502
- const syncPairs = [];
503
- for (const pair of pairs) {
504
- const key = yield pair.key;
505
- const value = yield pair.value;
506
- syncPairs.push({
507
- key,
508
- value
509
- });
510
- }
511
- return _ParseStatus.mergeObjectSync(status, syncPairs);
512
- });
513
- }
514
- static mergeObjectSync(status, pairs) {
515
- const finalObject = {};
516
- for (const pair of pairs) {
517
- const { key, value } = pair;
518
- if (key.status === "aborted")
519
- return INVALID;
520
- if (value.status === "aborted")
521
- return INVALID;
522
- if (key.status === "dirty")
523
- status.dirty();
524
- if (value.status === "dirty")
525
- status.dirty();
526
- if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
527
- finalObject[key.value] = value.value;
528
- }
529
- }
530
- return { status: status.value, value: finalObject };
531
- }
532
- };
533
- var INVALID = Object.freeze({
534
- status: "aborted"
535
- });
536
- var DIRTY = (value) => ({ status: "dirty", value });
537
- var OK = (value) => ({ status: "valid", value });
538
- var isAborted = (x) => x.status === "aborted";
539
- var isDirty = (x) => x.status === "dirty";
540
- var isValid = (x) => x.status === "valid";
541
- var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
542
- function __classPrivateFieldGet(receiver, state, kind, f) {
543
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
544
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
545
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
546
- }
547
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
548
- if (kind === "m") throw new TypeError("Private method is not writable");
549
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
550
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
551
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
552
- }
553
- var errorUtil;
554
- (function(errorUtil2) {
555
- errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
556
- errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
557
- })(errorUtil || (errorUtil = {}));
558
- var _ZodEnum_cache;
559
- var _ZodNativeEnum_cache;
560
- var ParseInputLazyPath = class {
561
- constructor(parent, value, path, key) {
562
- this._cachedPath = [];
563
- this.parent = parent;
564
- this.data = value;
565
- this._path = path;
566
- this._key = key;
567
- }
568
- get path() {
569
- if (!this._cachedPath.length) {
570
- if (this._key instanceof Array) {
571
- this._cachedPath.push(...this._path, ...this._key);
572
- } else {
573
- this._cachedPath.push(...this._path, this._key);
574
- }
575
- }
576
- return this._cachedPath;
577
- }
578
- };
579
- var handleResult = (ctx, result) => {
580
- if (isValid(result)) {
581
- return { success: true, data: result.value };
582
- } else {
583
- if (!ctx.common.issues.length) {
584
- throw new Error("Validation failed but no issues detected.");
585
- }
586
- return {
587
- success: false,
588
- get error() {
589
- if (this._error)
590
- return this._error;
591
- const error = new ZodError(ctx.common.issues);
592
- this._error = error;
593
- return this._error;
594
- }
595
- };
596
- }
597
- };
598
- function processCreateParams(params) {
599
- if (!params)
600
- return {};
601
- const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
602
- if (errorMap2 && (invalid_type_error || required_error)) {
603
- throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
604
- }
605
- if (errorMap2)
606
- return { errorMap: errorMap2, description };
607
- const customMap = (iss, ctx) => {
608
- var _a, _b;
609
- const { message } = params;
610
- if (iss.code === "invalid_enum_value") {
611
- return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
612
- }
613
- if (typeof ctx.data === "undefined") {
614
- return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
615
- }
616
- if (iss.code !== "invalid_type")
617
- return { message: ctx.defaultError };
618
- return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
619
- };
620
- return { errorMap: customMap, description };
621
- }
622
- var ZodType = class {
623
- get description() {
624
- return this._def.description;
625
- }
626
- _getType(input) {
627
- return getParsedType(input.data);
628
- }
629
- _getOrReturnCtx(input, ctx) {
630
- return ctx || {
631
- common: input.parent.common,
632
- data: input.data,
633
- parsedType: getParsedType(input.data),
634
- schemaErrorMap: this._def.errorMap,
635
- path: input.path,
636
- parent: input.parent
637
- };
638
- }
639
- _processInputParams(input) {
640
- return {
641
- status: new ParseStatus(),
642
- ctx: {
643
- common: input.parent.common,
644
- data: input.data,
645
- parsedType: getParsedType(input.data),
646
- schemaErrorMap: this._def.errorMap,
647
- path: input.path,
648
- parent: input.parent
649
- }
650
- };
651
- }
652
- _parseSync(input) {
653
- const result = this._parse(input);
654
- if (isAsync(result)) {
655
- throw new Error("Synchronous parse encountered promise.");
656
- }
657
- return result;
658
- }
659
- _parseAsync(input) {
660
- const result = this._parse(input);
661
- return Promise.resolve(result);
662
- }
663
- parse(data, params) {
664
- const result = this.safeParse(data, params);
665
- if (result.success)
666
- return result.data;
667
- throw result.error;
668
- }
669
- safeParse(data, params) {
670
- var _a;
671
- const ctx = {
672
- common: {
673
- issues: [],
674
- async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
675
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
676
- },
677
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
678
- schemaErrorMap: this._def.errorMap,
679
- parent: null,
680
- data,
681
- parsedType: getParsedType(data)
682
- };
683
- const result = this._parseSync({ data, path: ctx.path, parent: ctx });
684
- return handleResult(ctx, result);
685
- }
686
- "~validate"(data) {
687
- var _a, _b;
688
- const ctx = {
689
- common: {
690
- issues: [],
691
- async: !!this["~standard"].async
692
- },
693
- path: [],
694
- schemaErrorMap: this._def.errorMap,
695
- parent: null,
696
- data,
697
- parsedType: getParsedType(data)
698
- };
699
- if (!this["~standard"].async) {
700
- try {
701
- const result = this._parseSync({ data, path: [], parent: ctx });
702
- return isValid(result) ? {
703
- value: result.value
704
- } : {
705
- issues: ctx.common.issues
706
- };
707
- } catch (err) {
708
- if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
709
- this["~standard"].async = true;
710
- }
711
- ctx.common = {
712
- issues: [],
713
- async: true
714
- };
715
- }
716
- }
717
- return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
718
- value: result.value
719
- } : {
720
- issues: ctx.common.issues
721
- });
722
- }
723
- parseAsync(data, params) {
724
- return __async(this, null, function* () {
725
- const result = yield this.safeParseAsync(data, params);
726
- if (result.success)
727
- return result.data;
728
- throw result.error;
729
- });
730
- }
731
- safeParseAsync(data, params) {
732
- return __async(this, null, function* () {
733
- const ctx = {
734
- common: {
735
- issues: [],
736
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
737
- async: true
738
- },
739
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
740
- schemaErrorMap: this._def.errorMap,
741
- parent: null,
742
- data,
743
- parsedType: getParsedType(data)
744
- };
745
- const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
746
- const result = yield isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult);
747
- return handleResult(ctx, result);
748
- });
749
- }
750
- refine(check, message) {
751
- const getIssueProperties = (val) => {
752
- if (typeof message === "string" || typeof message === "undefined") {
753
- return { message };
754
- } else if (typeof message === "function") {
755
- return message(val);
756
- } else {
757
- return message;
758
- }
759
- };
760
- return this._refinement((val, ctx) => {
761
- const result = check(val);
762
- const setError = () => ctx.addIssue(__spreadValues({
763
- code: ZodIssueCode.custom
764
- }, getIssueProperties(val)));
765
- if (typeof Promise !== "undefined" && result instanceof Promise) {
766
- return result.then((data) => {
767
- if (!data) {
768
- setError();
769
- return false;
770
- } else {
771
- return true;
772
- }
773
- });
774
- }
775
- if (!result) {
776
- setError();
777
- return false;
778
- } else {
779
- return true;
780
- }
781
- });
782
- }
783
- refinement(check, refinementData) {
784
- return this._refinement((val, ctx) => {
785
- if (!check(val)) {
786
- ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
787
- return false;
788
- } else {
789
- return true;
790
- }
791
- });
792
- }
793
- _refinement(refinement) {
794
- return new ZodEffects({
795
- schema: this,
796
- typeName: ZodFirstPartyTypeKind.ZodEffects,
797
- effect: { type: "refinement", refinement }
798
- });
799
- }
800
- superRefine(refinement) {
801
- return this._refinement(refinement);
802
- }
803
- constructor(def) {
804
- this.spa = this.safeParseAsync;
805
- this._def = def;
806
- this.parse = this.parse.bind(this);
807
- this.safeParse = this.safeParse.bind(this);
808
- this.parseAsync = this.parseAsync.bind(this);
809
- this.safeParseAsync = this.safeParseAsync.bind(this);
810
- this.spa = this.spa.bind(this);
811
- this.refine = this.refine.bind(this);
812
- this.refinement = this.refinement.bind(this);
813
- this.superRefine = this.superRefine.bind(this);
814
- this.optional = this.optional.bind(this);
815
- this.nullable = this.nullable.bind(this);
816
- this.nullish = this.nullish.bind(this);
817
- this.array = this.array.bind(this);
818
- this.promise = this.promise.bind(this);
819
- this.or = this.or.bind(this);
820
- this.and = this.and.bind(this);
821
- this.transform = this.transform.bind(this);
822
- this.brand = this.brand.bind(this);
823
- this.default = this.default.bind(this);
824
- this.catch = this.catch.bind(this);
825
- this.describe = this.describe.bind(this);
826
- this.pipe = this.pipe.bind(this);
827
- this.readonly = this.readonly.bind(this);
828
- this.isNullable = this.isNullable.bind(this);
829
- this.isOptional = this.isOptional.bind(this);
830
- this["~standard"] = {
831
- version: 1,
832
- vendor: "zod",
833
- validate: (data) => this["~validate"](data)
834
- };
835
- }
836
- optional() {
837
- return ZodOptional.create(this, this._def);
838
- }
839
- nullable() {
840
- return ZodNullable.create(this, this._def);
841
- }
842
- nullish() {
843
- return this.nullable().optional();
844
- }
845
- array() {
846
- return ZodArray.create(this);
847
- }
848
- promise() {
849
- return ZodPromise.create(this, this._def);
850
- }
851
- or(option) {
852
- return ZodUnion.create([this, option], this._def);
853
- }
854
- and(incoming) {
855
- return ZodIntersection.create(this, incoming, this._def);
856
- }
857
- transform(transform) {
858
- return new ZodEffects(__spreadProps(__spreadValues({}, processCreateParams(this._def)), {
859
- schema: this,
860
- typeName: ZodFirstPartyTypeKind.ZodEffects,
861
- effect: { type: "transform", transform }
862
- }));
863
- }
864
- default(def) {
865
- const defaultValueFunc = typeof def === "function" ? def : () => def;
866
- return new ZodDefault(__spreadProps(__spreadValues({}, processCreateParams(this._def)), {
867
- innerType: this,
868
- defaultValue: defaultValueFunc,
869
- typeName: ZodFirstPartyTypeKind.ZodDefault
870
- }));
871
- }
872
- brand() {
873
- return new ZodBranded(__spreadValues({
874
- typeName: ZodFirstPartyTypeKind.ZodBranded,
875
- type: this
876
- }, processCreateParams(this._def)));
877
- }
878
- catch(def) {
879
- const catchValueFunc = typeof def === "function" ? def : () => def;
880
- return new ZodCatch(__spreadProps(__spreadValues({}, processCreateParams(this._def)), {
881
- innerType: this,
882
- catchValue: catchValueFunc,
883
- typeName: ZodFirstPartyTypeKind.ZodCatch
884
- }));
885
- }
886
- describe(description) {
887
- const This = this.constructor;
888
- return new This(__spreadProps(__spreadValues({}, this._def), {
889
- description
890
- }));
891
- }
892
- pipe(target) {
893
- return ZodPipeline.create(this, target);
894
- }
895
- readonly() {
896
- return ZodReadonly.create(this);
897
- }
898
- isOptional() {
899
- return this.safeParse(void 0).success;
900
- }
901
- isNullable() {
902
- return this.safeParse(null).success;
903
- }
904
- };
905
- var cuidRegex = /^c[^\s-]{8,}$/i;
906
- var cuid2Regex = /^[0-9a-z]+$/;
907
- var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
908
- var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
909
- var nanoidRegex = /^[a-z0-9_-]{21}$/i;
910
- var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
911
- var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
912
- var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
913
- var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
914
- var emojiRegex;
915
- var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
916
- var ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
917
- var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
918
- var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
919
- var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
920
- var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
921
- var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
922
- var dateRegex = new RegExp(`^${dateRegexSource}$`);
923
- function timeRegexSource(args) {
924
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
925
- if (args.precision) {
926
- regex = `${regex}\\.\\d{${args.precision}}`;
927
- } else if (args.precision == null) {
928
- regex = `${regex}(\\.\\d+)?`;
929
- }
930
- return regex;
931
- }
932
- function timeRegex(args) {
933
- return new RegExp(`^${timeRegexSource(args)}$`);
934
- }
935
- function datetimeRegex(args) {
936
- let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
937
- const opts = [];
938
- opts.push(args.local ? `Z?` : `Z`);
939
- if (args.offset)
940
- opts.push(`([+-]\\d{2}:?\\d{2})`);
941
- regex = `${regex}(${opts.join("|")})`;
942
- return new RegExp(`^${regex}$`);
943
- }
944
- function isValidIP(ip, version) {
945
- if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
946
- return true;
947
- }
948
- if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
949
- return true;
950
- }
951
- return false;
952
- }
953
- function isValidJWT(jwt, alg) {
954
- if (!jwtRegex.test(jwt))
955
- return false;
956
- try {
957
- const [header] = jwt.split(".");
958
- const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
959
- const decoded = JSON.parse(atob(base64));
960
- if (typeof decoded !== "object" || decoded === null)
961
- return false;
962
- if (!decoded.typ || !decoded.alg)
963
- return false;
964
- if (alg && decoded.alg !== alg)
965
- return false;
966
- return true;
967
- } catch (_a) {
968
- return false;
969
- }
970
- }
971
- function isValidCidr(ip, version) {
972
- if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
973
- return true;
974
- }
975
- if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
976
- return true;
977
- }
978
- return false;
979
- }
980
- var ZodString = class _ZodString extends ZodType {
981
- _parse(input) {
982
- if (this._def.coerce) {
983
- input.data = String(input.data);
984
- }
985
- const parsedType = this._getType(input);
986
- if (parsedType !== ZodParsedType.string) {
987
- const ctx2 = this._getOrReturnCtx(input);
988
- addIssueToContext(ctx2, {
989
- code: ZodIssueCode.invalid_type,
990
- expected: ZodParsedType.string,
991
- received: ctx2.parsedType
992
- });
993
- return INVALID;
994
- }
995
- const status = new ParseStatus();
996
- let ctx = void 0;
997
- for (const check of this._def.checks) {
998
- if (check.kind === "min") {
999
- if (input.data.length < check.value) {
1000
- ctx = this._getOrReturnCtx(input, ctx);
1001
- addIssueToContext(ctx, {
1002
- code: ZodIssueCode.too_small,
1003
- minimum: check.value,
1004
- type: "string",
1005
- inclusive: true,
1006
- exact: false,
1007
- message: check.message
1008
- });
1009
- status.dirty();
1010
- }
1011
- } else if (check.kind === "max") {
1012
- if (input.data.length > check.value) {
1013
- ctx = this._getOrReturnCtx(input, ctx);
1014
- addIssueToContext(ctx, {
1015
- code: ZodIssueCode.too_big,
1016
- maximum: check.value,
1017
- type: "string",
1018
- inclusive: true,
1019
- exact: false,
1020
- message: check.message
1021
- });
1022
- status.dirty();
1023
- }
1024
- } else if (check.kind === "length") {
1025
- const tooBig = input.data.length > check.value;
1026
- const tooSmall = input.data.length < check.value;
1027
- if (tooBig || tooSmall) {
1028
- ctx = this._getOrReturnCtx(input, ctx);
1029
- if (tooBig) {
1030
- addIssueToContext(ctx, {
1031
- code: ZodIssueCode.too_big,
1032
- maximum: check.value,
1033
- type: "string",
1034
- inclusive: true,
1035
- exact: true,
1036
- message: check.message
1037
- });
1038
- } else if (tooSmall) {
1039
- addIssueToContext(ctx, {
1040
- code: ZodIssueCode.too_small,
1041
- minimum: check.value,
1042
- type: "string",
1043
- inclusive: true,
1044
- exact: true,
1045
- message: check.message
1046
- });
1047
- }
1048
- status.dirty();
1049
- }
1050
- } else if (check.kind === "email") {
1051
- if (!emailRegex.test(input.data)) {
1052
- ctx = this._getOrReturnCtx(input, ctx);
1053
- addIssueToContext(ctx, {
1054
- validation: "email",
1055
- code: ZodIssueCode.invalid_string,
1056
- message: check.message
1057
- });
1058
- status.dirty();
1059
- }
1060
- } else if (check.kind === "emoji") {
1061
- if (!emojiRegex) {
1062
- emojiRegex = new RegExp(_emojiRegex, "u");
1063
- }
1064
- if (!emojiRegex.test(input.data)) {
1065
- ctx = this._getOrReturnCtx(input, ctx);
1066
- addIssueToContext(ctx, {
1067
- validation: "emoji",
1068
- code: ZodIssueCode.invalid_string,
1069
- message: check.message
1070
- });
1071
- status.dirty();
1072
- }
1073
- } else if (check.kind === "uuid") {
1074
- if (!uuidRegex.test(input.data)) {
1075
- ctx = this._getOrReturnCtx(input, ctx);
1076
- addIssueToContext(ctx, {
1077
- validation: "uuid",
1078
- code: ZodIssueCode.invalid_string,
1079
- message: check.message
1080
- });
1081
- status.dirty();
1082
- }
1083
- } else if (check.kind === "nanoid") {
1084
- if (!nanoidRegex.test(input.data)) {
1085
- ctx = this._getOrReturnCtx(input, ctx);
1086
- addIssueToContext(ctx, {
1087
- validation: "nanoid",
1088
- code: ZodIssueCode.invalid_string,
1089
- message: check.message
1090
- });
1091
- status.dirty();
1092
- }
1093
- } else if (check.kind === "cuid") {
1094
- if (!cuidRegex.test(input.data)) {
1095
- ctx = this._getOrReturnCtx(input, ctx);
1096
- addIssueToContext(ctx, {
1097
- validation: "cuid",
1098
- code: ZodIssueCode.invalid_string,
1099
- message: check.message
1100
- });
1101
- status.dirty();
1102
- }
1103
- } else if (check.kind === "cuid2") {
1104
- if (!cuid2Regex.test(input.data)) {
1105
- ctx = this._getOrReturnCtx(input, ctx);
1106
- addIssueToContext(ctx, {
1107
- validation: "cuid2",
1108
- code: ZodIssueCode.invalid_string,
1109
- message: check.message
1110
- });
1111
- status.dirty();
1112
- }
1113
- } else if (check.kind === "ulid") {
1114
- if (!ulidRegex.test(input.data)) {
1115
- ctx = this._getOrReturnCtx(input, ctx);
1116
- addIssueToContext(ctx, {
1117
- validation: "ulid",
1118
- code: ZodIssueCode.invalid_string,
1119
- message: check.message
1120
- });
1121
- status.dirty();
1122
- }
1123
- } else if (check.kind === "url") {
1124
- try {
1125
- new URL(input.data);
1126
- } catch (_a) {
1127
- ctx = this._getOrReturnCtx(input, ctx);
1128
- addIssueToContext(ctx, {
1129
- validation: "url",
1130
- code: ZodIssueCode.invalid_string,
1131
- message: check.message
1132
- });
1133
- status.dirty();
1134
- }
1135
- } else if (check.kind === "regex") {
1136
- check.regex.lastIndex = 0;
1137
- const testResult = check.regex.test(input.data);
1138
- if (!testResult) {
1139
- ctx = this._getOrReturnCtx(input, ctx);
1140
- addIssueToContext(ctx, {
1141
- validation: "regex",
1142
- code: ZodIssueCode.invalid_string,
1143
- message: check.message
1144
- });
1145
- status.dirty();
1146
- }
1147
- } else if (check.kind === "trim") {
1148
- input.data = input.data.trim();
1149
- } else if (check.kind === "includes") {
1150
- if (!input.data.includes(check.value, check.position)) {
1151
- ctx = this._getOrReturnCtx(input, ctx);
1152
- addIssueToContext(ctx, {
1153
- code: ZodIssueCode.invalid_string,
1154
- validation: { includes: check.value, position: check.position },
1155
- message: check.message
1156
- });
1157
- status.dirty();
1158
- }
1159
- } else if (check.kind === "toLowerCase") {
1160
- input.data = input.data.toLowerCase();
1161
- } else if (check.kind === "toUpperCase") {
1162
- input.data = input.data.toUpperCase();
1163
- } else if (check.kind === "startsWith") {
1164
- if (!input.data.startsWith(check.value)) {
1165
- ctx = this._getOrReturnCtx(input, ctx);
1166
- addIssueToContext(ctx, {
1167
- code: ZodIssueCode.invalid_string,
1168
- validation: { startsWith: check.value },
1169
- message: check.message
1170
- });
1171
- status.dirty();
1172
- }
1173
- } else if (check.kind === "endsWith") {
1174
- if (!input.data.endsWith(check.value)) {
1175
- ctx = this._getOrReturnCtx(input, ctx);
1176
- addIssueToContext(ctx, {
1177
- code: ZodIssueCode.invalid_string,
1178
- validation: { endsWith: check.value },
1179
- message: check.message
1180
- });
1181
- status.dirty();
1182
- }
1183
- } else if (check.kind === "datetime") {
1184
- const regex = datetimeRegex(check);
1185
- if (!regex.test(input.data)) {
1186
- ctx = this._getOrReturnCtx(input, ctx);
1187
- addIssueToContext(ctx, {
1188
- code: ZodIssueCode.invalid_string,
1189
- validation: "datetime",
1190
- message: check.message
1191
- });
1192
- status.dirty();
1193
- }
1194
- } else if (check.kind === "date") {
1195
- const regex = dateRegex;
1196
- if (!regex.test(input.data)) {
1197
- ctx = this._getOrReturnCtx(input, ctx);
1198
- addIssueToContext(ctx, {
1199
- code: ZodIssueCode.invalid_string,
1200
- validation: "date",
1201
- message: check.message
1202
- });
1203
- status.dirty();
1204
- }
1205
- } else if (check.kind === "time") {
1206
- const regex = timeRegex(check);
1207
- if (!regex.test(input.data)) {
1208
- ctx = this._getOrReturnCtx(input, ctx);
1209
- addIssueToContext(ctx, {
1210
- code: ZodIssueCode.invalid_string,
1211
- validation: "time",
1212
- message: check.message
1213
- });
1214
- status.dirty();
1215
- }
1216
- } else if (check.kind === "duration") {
1217
- if (!durationRegex.test(input.data)) {
1218
- ctx = this._getOrReturnCtx(input, ctx);
1219
- addIssueToContext(ctx, {
1220
- validation: "duration",
1221
- code: ZodIssueCode.invalid_string,
1222
- message: check.message
1223
- });
1224
- status.dirty();
1225
- }
1226
- } else if (check.kind === "ip") {
1227
- if (!isValidIP(input.data, check.version)) {
1228
- ctx = this._getOrReturnCtx(input, ctx);
1229
- addIssueToContext(ctx, {
1230
- validation: "ip",
1231
- code: ZodIssueCode.invalid_string,
1232
- message: check.message
1233
- });
1234
- status.dirty();
1235
- }
1236
- } else if (check.kind === "jwt") {
1237
- if (!isValidJWT(input.data, check.alg)) {
1238
- ctx = this._getOrReturnCtx(input, ctx);
1239
- addIssueToContext(ctx, {
1240
- validation: "jwt",
1241
- code: ZodIssueCode.invalid_string,
1242
- message: check.message
1243
- });
1244
- status.dirty();
1245
- }
1246
- } else if (check.kind === "cidr") {
1247
- if (!isValidCidr(input.data, check.version)) {
1248
- ctx = this._getOrReturnCtx(input, ctx);
1249
- addIssueToContext(ctx, {
1250
- validation: "cidr",
1251
- code: ZodIssueCode.invalid_string,
1252
- message: check.message
1253
- });
1254
- status.dirty();
1255
- }
1256
- } else if (check.kind === "base64") {
1257
- if (!base64Regex.test(input.data)) {
1258
- ctx = this._getOrReturnCtx(input, ctx);
1259
- addIssueToContext(ctx, {
1260
- validation: "base64",
1261
- code: ZodIssueCode.invalid_string,
1262
- message: check.message
1263
- });
1264
- status.dirty();
1265
- }
1266
- } else if (check.kind === "base64url") {
1267
- if (!base64urlRegex.test(input.data)) {
1268
- ctx = this._getOrReturnCtx(input, ctx);
1269
- addIssueToContext(ctx, {
1270
- validation: "base64url",
1271
- code: ZodIssueCode.invalid_string,
1272
- message: check.message
1273
- });
1274
- status.dirty();
1275
- }
1276
- } else {
1277
- util.assertNever(check);
1278
- }
1279
- }
1280
- return { status: status.value, value: input.data };
1281
- }
1282
- _regex(regex, validation, message) {
1283
- return this.refinement((data) => regex.test(data), __spreadValues({
1284
- validation,
1285
- code: ZodIssueCode.invalid_string
1286
- }, errorUtil.errToObj(message)));
1287
- }
1288
- _addCheck(check) {
1289
- return new _ZodString(__spreadProps(__spreadValues({}, this._def), {
1290
- checks: [...this._def.checks, check]
1291
- }));
1292
- }
1293
- email(message) {
1294
- return this._addCheck(__spreadValues({ kind: "email" }, errorUtil.errToObj(message)));
1295
- }
1296
- url(message) {
1297
- return this._addCheck(__spreadValues({ kind: "url" }, errorUtil.errToObj(message)));
1298
- }
1299
- emoji(message) {
1300
- return this._addCheck(__spreadValues({ kind: "emoji" }, errorUtil.errToObj(message)));
1301
- }
1302
- uuid(message) {
1303
- return this._addCheck(__spreadValues({ kind: "uuid" }, errorUtil.errToObj(message)));
1304
- }
1305
- nanoid(message) {
1306
- return this._addCheck(__spreadValues({ kind: "nanoid" }, errorUtil.errToObj(message)));
1307
- }
1308
- cuid(message) {
1309
- return this._addCheck(__spreadValues({ kind: "cuid" }, errorUtil.errToObj(message)));
1310
- }
1311
- cuid2(message) {
1312
- return this._addCheck(__spreadValues({ kind: "cuid2" }, errorUtil.errToObj(message)));
1313
- }
1314
- ulid(message) {
1315
- return this._addCheck(__spreadValues({ kind: "ulid" }, errorUtil.errToObj(message)));
1316
- }
1317
- base64(message) {
1318
- return this._addCheck(__spreadValues({ kind: "base64" }, errorUtil.errToObj(message)));
1319
- }
1320
- base64url(message) {
1321
- return this._addCheck(__spreadValues({
1322
- kind: "base64url"
1323
- }, errorUtil.errToObj(message)));
1324
- }
1325
- jwt(options) {
1326
- return this._addCheck(__spreadValues({ kind: "jwt" }, errorUtil.errToObj(options)));
1327
- }
1328
- ip(options) {
1329
- return this._addCheck(__spreadValues({ kind: "ip" }, errorUtil.errToObj(options)));
1330
- }
1331
- cidr(options) {
1332
- return this._addCheck(__spreadValues({ kind: "cidr" }, errorUtil.errToObj(options)));
1333
- }
1334
- datetime(options) {
1335
- var _a, _b;
1336
- if (typeof options === "string") {
1337
- return this._addCheck({
1338
- kind: "datetime",
1339
- precision: null,
1340
- offset: false,
1341
- local: false,
1342
- message: options
1343
- });
1344
- }
1345
- return this._addCheck(__spreadValues({
1346
- kind: "datetime",
1347
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1348
- offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1349
- local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false
1350
- }, errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)));
1351
- }
1352
- date(message) {
1353
- return this._addCheck({ kind: "date", message });
1354
- }
1355
- time(options) {
1356
- if (typeof options === "string") {
1357
- return this._addCheck({
1358
- kind: "time",
1359
- precision: null,
1360
- message: options
1361
- });
1362
- }
1363
- return this._addCheck(__spreadValues({
1364
- kind: "time",
1365
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision
1366
- }, errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)));
1367
- }
1368
- duration(message) {
1369
- return this._addCheck(__spreadValues({ kind: "duration" }, errorUtil.errToObj(message)));
1370
- }
1371
- regex(regex, message) {
1372
- return this._addCheck(__spreadValues({
1373
- kind: "regex",
1374
- regex
1375
- }, errorUtil.errToObj(message)));
1376
- }
1377
- includes(value, options) {
1378
- return this._addCheck(__spreadValues({
1379
- kind: "includes",
1380
- value,
1381
- position: options === null || options === void 0 ? void 0 : options.position
1382
- }, errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)));
1383
- }
1384
- startsWith(value, message) {
1385
- return this._addCheck(__spreadValues({
1386
- kind: "startsWith",
1387
- value
1388
- }, errorUtil.errToObj(message)));
1389
- }
1390
- endsWith(value, message) {
1391
- return this._addCheck(__spreadValues({
1392
- kind: "endsWith",
1393
- value
1394
- }, errorUtil.errToObj(message)));
1395
- }
1396
- min(minLength, message) {
1397
- return this._addCheck(__spreadValues({
1398
- kind: "min",
1399
- value: minLength
1400
- }, errorUtil.errToObj(message)));
1401
- }
1402
- max(maxLength, message) {
1403
- return this._addCheck(__spreadValues({
1404
- kind: "max",
1405
- value: maxLength
1406
- }, errorUtil.errToObj(message)));
1407
- }
1408
- length(len, message) {
1409
- return this._addCheck(__spreadValues({
1410
- kind: "length",
1411
- value: len
1412
- }, errorUtil.errToObj(message)));
1413
- }
1414
- /**
1415
- * Equivalent to `.min(1)`
1416
- */
1417
- nonempty(message) {
1418
- return this.min(1, errorUtil.errToObj(message));
1419
- }
1420
- trim() {
1421
- return new _ZodString(__spreadProps(__spreadValues({}, this._def), {
1422
- checks: [...this._def.checks, { kind: "trim" }]
1423
- }));
1424
- }
1425
- toLowerCase() {
1426
- return new _ZodString(__spreadProps(__spreadValues({}, this._def), {
1427
- checks: [...this._def.checks, { kind: "toLowerCase" }]
1428
- }));
1429
- }
1430
- toUpperCase() {
1431
- return new _ZodString(__spreadProps(__spreadValues({}, this._def), {
1432
- checks: [...this._def.checks, { kind: "toUpperCase" }]
1433
- }));
1434
- }
1435
- get isDatetime() {
1436
- return !!this._def.checks.find((ch) => ch.kind === "datetime");
1437
- }
1438
- get isDate() {
1439
- return !!this._def.checks.find((ch) => ch.kind === "date");
1440
- }
1441
- get isTime() {
1442
- return !!this._def.checks.find((ch) => ch.kind === "time");
1443
- }
1444
- get isDuration() {
1445
- return !!this._def.checks.find((ch) => ch.kind === "duration");
1446
- }
1447
- get isEmail() {
1448
- return !!this._def.checks.find((ch) => ch.kind === "email");
1449
- }
1450
- get isURL() {
1451
- return !!this._def.checks.find((ch) => ch.kind === "url");
1452
- }
1453
- get isEmoji() {
1454
- return !!this._def.checks.find((ch) => ch.kind === "emoji");
1455
- }
1456
- get isUUID() {
1457
- return !!this._def.checks.find((ch) => ch.kind === "uuid");
1458
- }
1459
- get isNANOID() {
1460
- return !!this._def.checks.find((ch) => ch.kind === "nanoid");
1461
- }
1462
- get isCUID() {
1463
- return !!this._def.checks.find((ch) => ch.kind === "cuid");
1464
- }
1465
- get isCUID2() {
1466
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1467
- }
1468
- get isULID() {
1469
- return !!this._def.checks.find((ch) => ch.kind === "ulid");
1470
- }
1471
- get isIP() {
1472
- return !!this._def.checks.find((ch) => ch.kind === "ip");
1473
- }
1474
- get isCIDR() {
1475
- return !!this._def.checks.find((ch) => ch.kind === "cidr");
1476
- }
1477
- get isBase64() {
1478
- return !!this._def.checks.find((ch) => ch.kind === "base64");
1479
- }
1480
- get isBase64url() {
1481
- return !!this._def.checks.find((ch) => ch.kind === "base64url");
1482
- }
1483
- get minLength() {
1484
- let min = null;
1485
- for (const ch of this._def.checks) {
1486
- if (ch.kind === "min") {
1487
- if (min === null || ch.value > min)
1488
- min = ch.value;
1489
- }
1490
- }
1491
- return min;
1492
- }
1493
- get maxLength() {
1494
- let max = null;
1495
- for (const ch of this._def.checks) {
1496
- if (ch.kind === "max") {
1497
- if (max === null || ch.value < max)
1498
- max = ch.value;
1499
- }
1500
- }
1501
- return max;
1502
- }
1503
- };
1504
- ZodString.create = (params) => {
1505
- var _a;
1506
- return new ZodString(__spreadValues({
1507
- checks: [],
1508
- typeName: ZodFirstPartyTypeKind.ZodString,
1509
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false
1510
- }, processCreateParams(params)));
1511
- };
1512
- function floatSafeRemainder(val, step) {
1513
- const valDecCount = (val.toString().split(".")[1] || "").length;
1514
- const stepDecCount = (step.toString().split(".")[1] || "").length;
1515
- const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
1516
- const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
1517
- const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
1518
- return valInt % stepInt / Math.pow(10, decCount);
1519
- }
1520
- var ZodNumber = class _ZodNumber extends ZodType {
1521
- constructor() {
1522
- super(...arguments);
1523
- this.min = this.gte;
1524
- this.max = this.lte;
1525
- this.step = this.multipleOf;
1526
- }
1527
- _parse(input) {
1528
- if (this._def.coerce) {
1529
- input.data = Number(input.data);
1530
- }
1531
- const parsedType = this._getType(input);
1532
- if (parsedType !== ZodParsedType.number) {
1533
- const ctx2 = this._getOrReturnCtx(input);
1534
- addIssueToContext(ctx2, {
1535
- code: ZodIssueCode.invalid_type,
1536
- expected: ZodParsedType.number,
1537
- received: ctx2.parsedType
1538
- });
1539
- return INVALID;
1540
- }
1541
- let ctx = void 0;
1542
- const status = new ParseStatus();
1543
- for (const check of this._def.checks) {
1544
- if (check.kind === "int") {
1545
- if (!util.isInteger(input.data)) {
1546
- ctx = this._getOrReturnCtx(input, ctx);
1547
- addIssueToContext(ctx, {
1548
- code: ZodIssueCode.invalid_type,
1549
- expected: "integer",
1550
- received: "float",
1551
- message: check.message
1552
- });
1553
- status.dirty();
1554
- }
1555
- } else if (check.kind === "min") {
1556
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1557
- if (tooSmall) {
1558
- ctx = this._getOrReturnCtx(input, ctx);
1559
- addIssueToContext(ctx, {
1560
- code: ZodIssueCode.too_small,
1561
- minimum: check.value,
1562
- type: "number",
1563
- inclusive: check.inclusive,
1564
- exact: false,
1565
- message: check.message
1566
- });
1567
- status.dirty();
1568
- }
1569
- } else if (check.kind === "max") {
1570
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1571
- if (tooBig) {
1572
- ctx = this._getOrReturnCtx(input, ctx);
1573
- addIssueToContext(ctx, {
1574
- code: ZodIssueCode.too_big,
1575
- maximum: check.value,
1576
- type: "number",
1577
- inclusive: check.inclusive,
1578
- exact: false,
1579
- message: check.message
1580
- });
1581
- status.dirty();
1582
- }
1583
- } else if (check.kind === "multipleOf") {
1584
- if (floatSafeRemainder(input.data, check.value) !== 0) {
1585
- ctx = this._getOrReturnCtx(input, ctx);
1586
- addIssueToContext(ctx, {
1587
- code: ZodIssueCode.not_multiple_of,
1588
- multipleOf: check.value,
1589
- message: check.message
1590
- });
1591
- status.dirty();
1592
- }
1593
- } else if (check.kind === "finite") {
1594
- if (!Number.isFinite(input.data)) {
1595
- ctx = this._getOrReturnCtx(input, ctx);
1596
- addIssueToContext(ctx, {
1597
- code: ZodIssueCode.not_finite,
1598
- message: check.message
1599
- });
1600
- status.dirty();
1601
- }
1602
- } else {
1603
- util.assertNever(check);
1604
- }
1605
- }
1606
- return { status: status.value, value: input.data };
1607
- }
1608
- gte(value, message) {
1609
- return this.setLimit("min", value, true, errorUtil.toString(message));
1610
- }
1611
- gt(value, message) {
1612
- return this.setLimit("min", value, false, errorUtil.toString(message));
1613
- }
1614
- lte(value, message) {
1615
- return this.setLimit("max", value, true, errorUtil.toString(message));
1616
- }
1617
- lt(value, message) {
1618
- return this.setLimit("max", value, false, errorUtil.toString(message));
1619
- }
1620
- setLimit(kind, value, inclusive, message) {
1621
- return new _ZodNumber(__spreadProps(__spreadValues({}, this._def), {
1622
- checks: [
1623
- ...this._def.checks,
1624
- {
1625
- kind,
1626
- value,
1627
- inclusive,
1628
- message: errorUtil.toString(message)
1629
- }
1630
- ]
1631
- }));
1632
- }
1633
- _addCheck(check) {
1634
- return new _ZodNumber(__spreadProps(__spreadValues({}, this._def), {
1635
- checks: [...this._def.checks, check]
1636
- }));
1637
- }
1638
- int(message) {
1639
- return this._addCheck({
1640
- kind: "int",
1641
- message: errorUtil.toString(message)
1642
- });
1643
- }
1644
- positive(message) {
1645
- return this._addCheck({
1646
- kind: "min",
1647
- value: 0,
1648
- inclusive: false,
1649
- message: errorUtil.toString(message)
1650
- });
1651
- }
1652
- negative(message) {
1653
- return this._addCheck({
1654
- kind: "max",
1655
- value: 0,
1656
- inclusive: false,
1657
- message: errorUtil.toString(message)
1658
- });
1659
- }
1660
- nonpositive(message) {
1661
- return this._addCheck({
1662
- kind: "max",
1663
- value: 0,
1664
- inclusive: true,
1665
- message: errorUtil.toString(message)
1666
- });
1667
- }
1668
- nonnegative(message) {
1669
- return this._addCheck({
1670
- kind: "min",
1671
- value: 0,
1672
- inclusive: true,
1673
- message: errorUtil.toString(message)
1674
- });
1675
- }
1676
- multipleOf(value, message) {
1677
- return this._addCheck({
1678
- kind: "multipleOf",
1679
- value,
1680
- message: errorUtil.toString(message)
1681
- });
1682
- }
1683
- finite(message) {
1684
- return this._addCheck({
1685
- kind: "finite",
1686
- message: errorUtil.toString(message)
1687
- });
1688
- }
1689
- safe(message) {
1690
- return this._addCheck({
1691
- kind: "min",
1692
- inclusive: true,
1693
- value: Number.MIN_SAFE_INTEGER,
1694
- message: errorUtil.toString(message)
1695
- })._addCheck({
1696
- kind: "max",
1697
- inclusive: true,
1698
- value: Number.MAX_SAFE_INTEGER,
1699
- message: errorUtil.toString(message)
1700
- });
1701
- }
1702
- get minValue() {
1703
- let min = null;
1704
- for (const ch of this._def.checks) {
1705
- if (ch.kind === "min") {
1706
- if (min === null || ch.value > min)
1707
- min = ch.value;
1708
- }
1709
- }
1710
- return min;
1711
- }
1712
- get maxValue() {
1713
- let max = null;
1714
- for (const ch of this._def.checks) {
1715
- if (ch.kind === "max") {
1716
- if (max === null || ch.value < max)
1717
- max = ch.value;
1718
- }
1719
- }
1720
- return max;
1721
- }
1722
- get isInt() {
1723
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
1724
- }
1725
- get isFinite() {
1726
- let max = null, min = null;
1727
- for (const ch of this._def.checks) {
1728
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
1729
- return true;
1730
- } else if (ch.kind === "min") {
1731
- if (min === null || ch.value > min)
1732
- min = ch.value;
1733
- } else if (ch.kind === "max") {
1734
- if (max === null || ch.value < max)
1735
- max = ch.value;
1736
- }
1737
- }
1738
- return Number.isFinite(min) && Number.isFinite(max);
1739
- }
1740
- };
1741
- ZodNumber.create = (params) => {
1742
- return new ZodNumber(__spreadValues({
1743
- checks: [],
1744
- typeName: ZodFirstPartyTypeKind.ZodNumber,
1745
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false
1746
- }, processCreateParams(params)));
1747
- };
1748
- var ZodBigInt = class _ZodBigInt extends ZodType {
1749
- constructor() {
1750
- super(...arguments);
1751
- this.min = this.gte;
1752
- this.max = this.lte;
1753
- }
1754
- _parse(input) {
1755
- if (this._def.coerce) {
1756
- try {
1757
- input.data = BigInt(input.data);
1758
- } catch (_a) {
1759
- return this._getInvalidInput(input);
1760
- }
1761
- }
1762
- const parsedType = this._getType(input);
1763
- if (parsedType !== ZodParsedType.bigint) {
1764
- return this._getInvalidInput(input);
1765
- }
1766
- let ctx = void 0;
1767
- const status = new ParseStatus();
1768
- for (const check of this._def.checks) {
1769
- if (check.kind === "min") {
1770
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1771
- if (tooSmall) {
1772
- ctx = this._getOrReturnCtx(input, ctx);
1773
- addIssueToContext(ctx, {
1774
- code: ZodIssueCode.too_small,
1775
- type: "bigint",
1776
- minimum: check.value,
1777
- inclusive: check.inclusive,
1778
- message: check.message
1779
- });
1780
- status.dirty();
1781
- }
1782
- } else if (check.kind === "max") {
1783
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1784
- if (tooBig) {
1785
- ctx = this._getOrReturnCtx(input, ctx);
1786
- addIssueToContext(ctx, {
1787
- code: ZodIssueCode.too_big,
1788
- type: "bigint",
1789
- maximum: check.value,
1790
- inclusive: check.inclusive,
1791
- message: check.message
1792
- });
1793
- status.dirty();
1794
- }
1795
- } else if (check.kind === "multipleOf") {
1796
- if (input.data % check.value !== BigInt(0)) {
1797
- ctx = this._getOrReturnCtx(input, ctx);
1798
- addIssueToContext(ctx, {
1799
- code: ZodIssueCode.not_multiple_of,
1800
- multipleOf: check.value,
1801
- message: check.message
1802
- });
1803
- status.dirty();
1804
- }
1805
- } else {
1806
- util.assertNever(check);
1807
- }
1808
- }
1809
- return { status: status.value, value: input.data };
1810
- }
1811
- _getInvalidInput(input) {
1812
- const ctx = this._getOrReturnCtx(input);
1813
- addIssueToContext(ctx, {
1814
- code: ZodIssueCode.invalid_type,
1815
- expected: ZodParsedType.bigint,
1816
- received: ctx.parsedType
1817
- });
1818
- return INVALID;
1819
- }
1820
- gte(value, message) {
1821
- return this.setLimit("min", value, true, errorUtil.toString(message));
1822
- }
1823
- gt(value, message) {
1824
- return this.setLimit("min", value, false, errorUtil.toString(message));
1825
- }
1826
- lte(value, message) {
1827
- return this.setLimit("max", value, true, errorUtil.toString(message));
1828
- }
1829
- lt(value, message) {
1830
- return this.setLimit("max", value, false, errorUtil.toString(message));
1831
- }
1832
- setLimit(kind, value, inclusive, message) {
1833
- return new _ZodBigInt(__spreadProps(__spreadValues({}, this._def), {
1834
- checks: [
1835
- ...this._def.checks,
1836
- {
1837
- kind,
1838
- value,
1839
- inclusive,
1840
- message: errorUtil.toString(message)
1841
- }
1842
- ]
1843
- }));
1844
- }
1845
- _addCheck(check) {
1846
- return new _ZodBigInt(__spreadProps(__spreadValues({}, this._def), {
1847
- checks: [...this._def.checks, check]
1848
- }));
1849
- }
1850
- positive(message) {
1851
- return this._addCheck({
1852
- kind: "min",
1853
- value: BigInt(0),
1854
- inclusive: false,
1855
- message: errorUtil.toString(message)
1856
- });
1857
- }
1858
- negative(message) {
1859
- return this._addCheck({
1860
- kind: "max",
1861
- value: BigInt(0),
1862
- inclusive: false,
1863
- message: errorUtil.toString(message)
1864
- });
1865
- }
1866
- nonpositive(message) {
1867
- return this._addCheck({
1868
- kind: "max",
1869
- value: BigInt(0),
1870
- inclusive: true,
1871
- message: errorUtil.toString(message)
1872
- });
1873
- }
1874
- nonnegative(message) {
1875
- return this._addCheck({
1876
- kind: "min",
1877
- value: BigInt(0),
1878
- inclusive: true,
1879
- message: errorUtil.toString(message)
1880
- });
1881
- }
1882
- multipleOf(value, message) {
1883
- return this._addCheck({
1884
- kind: "multipleOf",
1885
- value,
1886
- message: errorUtil.toString(message)
1887
- });
1888
- }
1889
- get minValue() {
1890
- let min = null;
1891
- for (const ch of this._def.checks) {
1892
- if (ch.kind === "min") {
1893
- if (min === null || ch.value > min)
1894
- min = ch.value;
1895
- }
1896
- }
1897
- return min;
1898
- }
1899
- get maxValue() {
1900
- let max = null;
1901
- for (const ch of this._def.checks) {
1902
- if (ch.kind === "max") {
1903
- if (max === null || ch.value < max)
1904
- max = ch.value;
1905
- }
1906
- }
1907
- return max;
1908
- }
1909
- };
1910
- ZodBigInt.create = (params) => {
1911
- var _a;
1912
- return new ZodBigInt(__spreadValues({
1913
- checks: [],
1914
- typeName: ZodFirstPartyTypeKind.ZodBigInt,
1915
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false
1916
- }, processCreateParams(params)));
1917
- };
1918
- var ZodBoolean = class extends ZodType {
1919
- _parse(input) {
1920
- if (this._def.coerce) {
1921
- input.data = Boolean(input.data);
1922
- }
1923
- const parsedType = this._getType(input);
1924
- if (parsedType !== ZodParsedType.boolean) {
1925
- const ctx = this._getOrReturnCtx(input);
1926
- addIssueToContext(ctx, {
1927
- code: ZodIssueCode.invalid_type,
1928
- expected: ZodParsedType.boolean,
1929
- received: ctx.parsedType
1930
- });
1931
- return INVALID;
1932
- }
1933
- return OK(input.data);
1934
- }
1935
- };
1936
- ZodBoolean.create = (params) => {
1937
- return new ZodBoolean(__spreadValues({
1938
- typeName: ZodFirstPartyTypeKind.ZodBoolean,
1939
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false
1940
- }, processCreateParams(params)));
1941
- };
1942
- var ZodDate = class _ZodDate extends ZodType {
1943
- _parse(input) {
1944
- if (this._def.coerce) {
1945
- input.data = new Date(input.data);
1946
- }
1947
- const parsedType = this._getType(input);
1948
- if (parsedType !== ZodParsedType.date) {
1949
- const ctx2 = this._getOrReturnCtx(input);
1950
- addIssueToContext(ctx2, {
1951
- code: ZodIssueCode.invalid_type,
1952
- expected: ZodParsedType.date,
1953
- received: ctx2.parsedType
1954
- });
1955
- return INVALID;
1956
- }
1957
- if (isNaN(input.data.getTime())) {
1958
- const ctx2 = this._getOrReturnCtx(input);
1959
- addIssueToContext(ctx2, {
1960
- code: ZodIssueCode.invalid_date
1961
- });
1962
- return INVALID;
1963
- }
1964
- const status = new ParseStatus();
1965
- let ctx = void 0;
1966
- for (const check of this._def.checks) {
1967
- if (check.kind === "min") {
1968
- if (input.data.getTime() < check.value) {
1969
- ctx = this._getOrReturnCtx(input, ctx);
1970
- addIssueToContext(ctx, {
1971
- code: ZodIssueCode.too_small,
1972
- message: check.message,
1973
- inclusive: true,
1974
- exact: false,
1975
- minimum: check.value,
1976
- type: "date"
1977
- });
1978
- status.dirty();
1979
- }
1980
- } else if (check.kind === "max") {
1981
- if (input.data.getTime() > check.value) {
1982
- ctx = this._getOrReturnCtx(input, ctx);
1983
- addIssueToContext(ctx, {
1984
- code: ZodIssueCode.too_big,
1985
- message: check.message,
1986
- inclusive: true,
1987
- exact: false,
1988
- maximum: check.value,
1989
- type: "date"
1990
- });
1991
- status.dirty();
1992
- }
1993
- } else {
1994
- util.assertNever(check);
1995
- }
1996
- }
1997
- return {
1998
- status: status.value,
1999
- value: new Date(input.data.getTime())
2000
- };
2001
- }
2002
- _addCheck(check) {
2003
- return new _ZodDate(__spreadProps(__spreadValues({}, this._def), {
2004
- checks: [...this._def.checks, check]
2005
- }));
2006
- }
2007
- min(minDate, message) {
2008
- return this._addCheck({
2009
- kind: "min",
2010
- value: minDate.getTime(),
2011
- message: errorUtil.toString(message)
2012
- });
2013
- }
2014
- max(maxDate, message) {
2015
- return this._addCheck({
2016
- kind: "max",
2017
- value: maxDate.getTime(),
2018
- message: errorUtil.toString(message)
2019
- });
2020
- }
2021
- get minDate() {
2022
- let min = null;
2023
- for (const ch of this._def.checks) {
2024
- if (ch.kind === "min") {
2025
- if (min === null || ch.value > min)
2026
- min = ch.value;
2027
- }
2028
- }
2029
- return min != null ? new Date(min) : null;
2030
- }
2031
- get maxDate() {
2032
- let max = null;
2033
- for (const ch of this._def.checks) {
2034
- if (ch.kind === "max") {
2035
- if (max === null || ch.value < max)
2036
- max = ch.value;
2037
- }
2038
- }
2039
- return max != null ? new Date(max) : null;
2040
- }
2041
- };
2042
- ZodDate.create = (params) => {
2043
- return new ZodDate(__spreadValues({
2044
- checks: [],
2045
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2046
- typeName: ZodFirstPartyTypeKind.ZodDate
2047
- }, processCreateParams(params)));
2048
- };
2049
- var ZodSymbol = class extends ZodType {
2050
- _parse(input) {
2051
- const parsedType = this._getType(input);
2052
- if (parsedType !== ZodParsedType.symbol) {
2053
- const ctx = this._getOrReturnCtx(input);
2054
- addIssueToContext(ctx, {
2055
- code: ZodIssueCode.invalid_type,
2056
- expected: ZodParsedType.symbol,
2057
- received: ctx.parsedType
2058
- });
2059
- return INVALID;
2060
- }
2061
- return OK(input.data);
2062
- }
2063
- };
2064
- ZodSymbol.create = (params) => {
2065
- return new ZodSymbol(__spreadValues({
2066
- typeName: ZodFirstPartyTypeKind.ZodSymbol
2067
- }, processCreateParams(params)));
2068
- };
2069
- var ZodUndefined = class extends ZodType {
2070
- _parse(input) {
2071
- const parsedType = this._getType(input);
2072
- if (parsedType !== ZodParsedType.undefined) {
2073
- const ctx = this._getOrReturnCtx(input);
2074
- addIssueToContext(ctx, {
2075
- code: ZodIssueCode.invalid_type,
2076
- expected: ZodParsedType.undefined,
2077
- received: ctx.parsedType
2078
- });
2079
- return INVALID;
2080
- }
2081
- return OK(input.data);
2082
- }
2083
- };
2084
- ZodUndefined.create = (params) => {
2085
- return new ZodUndefined(__spreadValues({
2086
- typeName: ZodFirstPartyTypeKind.ZodUndefined
2087
- }, processCreateParams(params)));
2088
- };
2089
- var ZodNull = class extends ZodType {
2090
- _parse(input) {
2091
- const parsedType = this._getType(input);
2092
- if (parsedType !== ZodParsedType.null) {
2093
- const ctx = this._getOrReturnCtx(input);
2094
- addIssueToContext(ctx, {
2095
- code: ZodIssueCode.invalid_type,
2096
- expected: ZodParsedType.null,
2097
- received: ctx.parsedType
2098
- });
2099
- return INVALID;
2100
- }
2101
- return OK(input.data);
2102
- }
2103
- };
2104
- ZodNull.create = (params) => {
2105
- return new ZodNull(__spreadValues({
2106
- typeName: ZodFirstPartyTypeKind.ZodNull
2107
- }, processCreateParams(params)));
2108
- };
2109
- var ZodAny = class extends ZodType {
2110
- constructor() {
2111
- super(...arguments);
2112
- this._any = true;
2113
- }
2114
- _parse(input) {
2115
- return OK(input.data);
2116
- }
2117
- };
2118
- ZodAny.create = (params) => {
2119
- return new ZodAny(__spreadValues({
2120
- typeName: ZodFirstPartyTypeKind.ZodAny
2121
- }, processCreateParams(params)));
2122
- };
2123
- var ZodUnknown = class extends ZodType {
2124
- constructor() {
2125
- super(...arguments);
2126
- this._unknown = true;
2127
- }
2128
- _parse(input) {
2129
- return OK(input.data);
2130
- }
2131
- };
2132
- ZodUnknown.create = (params) => {
2133
- return new ZodUnknown(__spreadValues({
2134
- typeName: ZodFirstPartyTypeKind.ZodUnknown
2135
- }, processCreateParams(params)));
2136
- };
2137
- var ZodNever = class extends ZodType {
2138
- _parse(input) {
2139
- const ctx = this._getOrReturnCtx(input);
2140
- addIssueToContext(ctx, {
2141
- code: ZodIssueCode.invalid_type,
2142
- expected: ZodParsedType.never,
2143
- received: ctx.parsedType
2144
- });
2145
- return INVALID;
2146
- }
2147
- };
2148
- ZodNever.create = (params) => {
2149
- return new ZodNever(__spreadValues({
2150
- typeName: ZodFirstPartyTypeKind.ZodNever
2151
- }, processCreateParams(params)));
2152
- };
2153
- var ZodVoid = class extends ZodType {
2154
- _parse(input) {
2155
- const parsedType = this._getType(input);
2156
- if (parsedType !== ZodParsedType.undefined) {
2157
- const ctx = this._getOrReturnCtx(input);
2158
- addIssueToContext(ctx, {
2159
- code: ZodIssueCode.invalid_type,
2160
- expected: ZodParsedType.void,
2161
- received: ctx.parsedType
2162
- });
2163
- return INVALID;
2164
- }
2165
- return OK(input.data);
2166
- }
2167
- };
2168
- ZodVoid.create = (params) => {
2169
- return new ZodVoid(__spreadValues({
2170
- typeName: ZodFirstPartyTypeKind.ZodVoid
2171
- }, processCreateParams(params)));
2172
- };
2173
- var ZodArray = class _ZodArray extends ZodType {
2174
- _parse(input) {
2175
- const { ctx, status } = this._processInputParams(input);
2176
- const def = this._def;
2177
- if (ctx.parsedType !== ZodParsedType.array) {
2178
- addIssueToContext(ctx, {
2179
- code: ZodIssueCode.invalid_type,
2180
- expected: ZodParsedType.array,
2181
- received: ctx.parsedType
2182
- });
2183
- return INVALID;
2184
- }
2185
- if (def.exactLength !== null) {
2186
- const tooBig = ctx.data.length > def.exactLength.value;
2187
- const tooSmall = ctx.data.length < def.exactLength.value;
2188
- if (tooBig || tooSmall) {
2189
- addIssueToContext(ctx, {
2190
- code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
2191
- minimum: tooSmall ? def.exactLength.value : void 0,
2192
- maximum: tooBig ? def.exactLength.value : void 0,
2193
- type: "array",
2194
- inclusive: true,
2195
- exact: true,
2196
- message: def.exactLength.message
2197
- });
2198
- status.dirty();
2199
- }
2200
- }
2201
- if (def.minLength !== null) {
2202
- if (ctx.data.length < def.minLength.value) {
2203
- addIssueToContext(ctx, {
2204
- code: ZodIssueCode.too_small,
2205
- minimum: def.minLength.value,
2206
- type: "array",
2207
- inclusive: true,
2208
- exact: false,
2209
- message: def.minLength.message
2210
- });
2211
- status.dirty();
2212
- }
2213
- }
2214
- if (def.maxLength !== null) {
2215
- if (ctx.data.length > def.maxLength.value) {
2216
- addIssueToContext(ctx, {
2217
- code: ZodIssueCode.too_big,
2218
- maximum: def.maxLength.value,
2219
- type: "array",
2220
- inclusive: true,
2221
- exact: false,
2222
- message: def.maxLength.message
2223
- });
2224
- status.dirty();
2225
- }
2226
- }
2227
- if (ctx.common.async) {
2228
- return Promise.all([...ctx.data].map((item, i) => {
2229
- return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2230
- })).then((result2) => {
2231
- return ParseStatus.mergeArray(status, result2);
2232
- });
2233
- }
2234
- const result = [...ctx.data].map((item, i) => {
2235
- return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2236
- });
2237
- return ParseStatus.mergeArray(status, result);
2238
- }
2239
- get element() {
2240
- return this._def.type;
2241
- }
2242
- min(minLength, message) {
2243
- return new _ZodArray(__spreadProps(__spreadValues({}, this._def), {
2244
- minLength: { value: minLength, message: errorUtil.toString(message) }
2245
- }));
2246
- }
2247
- max(maxLength, message) {
2248
- return new _ZodArray(__spreadProps(__spreadValues({}, this._def), {
2249
- maxLength: { value: maxLength, message: errorUtil.toString(message) }
2250
- }));
2251
- }
2252
- length(len, message) {
2253
- return new _ZodArray(__spreadProps(__spreadValues({}, this._def), {
2254
- exactLength: { value: len, message: errorUtil.toString(message) }
2255
- }));
2256
- }
2257
- nonempty(message) {
2258
- return this.min(1, message);
2259
- }
2260
- };
2261
- ZodArray.create = (schema, params) => {
2262
- return new ZodArray(__spreadValues({
2263
- type: schema,
2264
- minLength: null,
2265
- maxLength: null,
2266
- exactLength: null,
2267
- typeName: ZodFirstPartyTypeKind.ZodArray
2268
- }, processCreateParams(params)));
2269
- };
2270
- function deepPartialify(schema) {
2271
- if (schema instanceof ZodObject) {
2272
- const newShape = {};
2273
- for (const key in schema.shape) {
2274
- const fieldSchema = schema.shape[key];
2275
- newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
2276
- }
2277
- return new ZodObject(__spreadProps(__spreadValues({}, schema._def), {
2278
- shape: () => newShape
2279
- }));
2280
- } else if (schema instanceof ZodArray) {
2281
- return new ZodArray(__spreadProps(__spreadValues({}, schema._def), {
2282
- type: deepPartialify(schema.element)
2283
- }));
2284
- } else if (schema instanceof ZodOptional) {
2285
- return ZodOptional.create(deepPartialify(schema.unwrap()));
2286
- } else if (schema instanceof ZodNullable) {
2287
- return ZodNullable.create(deepPartialify(schema.unwrap()));
2288
- } else if (schema instanceof ZodTuple) {
2289
- return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
2290
- } else {
2291
- return schema;
2292
- }
2293
- }
2294
- var ZodObject = class _ZodObject extends ZodType {
2295
- constructor() {
2296
- super(...arguments);
2297
- this._cached = null;
2298
- this.nonstrict = this.passthrough;
2299
- this.augment = this.extend;
2300
- }
2301
- _getCached() {
2302
- if (this._cached !== null)
2303
- return this._cached;
2304
- const shape = this._def.shape();
2305
- const keys = util.objectKeys(shape);
2306
- return this._cached = { shape, keys };
2307
- }
2308
- _parse(input) {
2309
- const parsedType = this._getType(input);
2310
- if (parsedType !== ZodParsedType.object) {
2311
- const ctx2 = this._getOrReturnCtx(input);
2312
- addIssueToContext(ctx2, {
2313
- code: ZodIssueCode.invalid_type,
2314
- expected: ZodParsedType.object,
2315
- received: ctx2.parsedType
2316
- });
2317
- return INVALID;
2318
- }
2319
- const { status, ctx } = this._processInputParams(input);
2320
- const { shape, keys: shapeKeys } = this._getCached();
2321
- const extraKeys = [];
2322
- if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
2323
- for (const key in ctx.data) {
2324
- if (!shapeKeys.includes(key)) {
2325
- extraKeys.push(key);
2326
- }
2327
- }
2328
- }
2329
- const pairs = [];
2330
- for (const key of shapeKeys) {
2331
- const keyValidator = shape[key];
2332
- const value = ctx.data[key];
2333
- pairs.push({
2334
- key: { status: "valid", value: key },
2335
- value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
2336
- alwaysSet: key in ctx.data
2337
- });
2338
- }
2339
- if (this._def.catchall instanceof ZodNever) {
2340
- const unknownKeys = this._def.unknownKeys;
2341
- if (unknownKeys === "passthrough") {
2342
- for (const key of extraKeys) {
2343
- pairs.push({
2344
- key: { status: "valid", value: key },
2345
- value: { status: "valid", value: ctx.data[key] }
2346
- });
2347
- }
2348
- } else if (unknownKeys === "strict") {
2349
- if (extraKeys.length > 0) {
2350
- addIssueToContext(ctx, {
2351
- code: ZodIssueCode.unrecognized_keys,
2352
- keys: extraKeys
2353
- });
2354
- status.dirty();
2355
- }
2356
- } else if (unknownKeys === "strip") ;
2357
- else {
2358
- throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
2359
- }
2360
- } else {
2361
- const catchall = this._def.catchall;
2362
- for (const key of extraKeys) {
2363
- const value = ctx.data[key];
2364
- pairs.push({
2365
- key: { status: "valid", value: key },
2366
- value: catchall._parse(
2367
- new ParseInputLazyPath(ctx, value, ctx.path, key)
2368
- //, ctx.child(key), value, getParsedType(value)
2369
- ),
2370
- alwaysSet: key in ctx.data
2371
- });
2372
- }
2373
- }
2374
- if (ctx.common.async) {
2375
- return Promise.resolve().then(() => __async(this, null, function* () {
2376
- const syncPairs = [];
2377
- for (const pair of pairs) {
2378
- const key = yield pair.key;
2379
- const value = yield pair.value;
2380
- syncPairs.push({
2381
- key,
2382
- value,
2383
- alwaysSet: pair.alwaysSet
2384
- });
2385
- }
2386
- return syncPairs;
2387
- })).then((syncPairs) => {
2388
- return ParseStatus.mergeObjectSync(status, syncPairs);
2389
- });
2390
- } else {
2391
- return ParseStatus.mergeObjectSync(status, pairs);
2392
- }
2393
- }
2394
- get shape() {
2395
- return this._def.shape();
2396
- }
2397
- strict(message) {
2398
- errorUtil.errToObj;
2399
- return new _ZodObject(__spreadValues(__spreadProps(__spreadValues({}, this._def), {
2400
- unknownKeys: "strict"
2401
- }), message !== void 0 ? {
2402
- errorMap: (issue, ctx) => {
2403
- var _a, _b, _c, _d;
2404
- const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
2405
- if (issue.code === "unrecognized_keys")
2406
- return {
2407
- message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
2408
- };
2409
- return {
2410
- message: defaultError
2411
- };
2412
- }
2413
- } : {}));
2414
- }
2415
- strip() {
2416
- return new _ZodObject(__spreadProps(__spreadValues({}, this._def), {
2417
- unknownKeys: "strip"
2418
- }));
2419
- }
2420
- passthrough() {
2421
- return new _ZodObject(__spreadProps(__spreadValues({}, this._def), {
2422
- unknownKeys: "passthrough"
2423
- }));
2424
- }
2425
- // const AugmentFactory =
2426
- // <Def extends ZodObjectDef>(def: Def) =>
2427
- // <Augmentation extends ZodRawShape>(
2428
- // augmentation: Augmentation
2429
- // ): ZodObject<
2430
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
2431
- // Def["unknownKeys"],
2432
- // Def["catchall"]
2433
- // > => {
2434
- // return new ZodObject({
2435
- // ...def,
2436
- // shape: () => ({
2437
- // ...def.shape(),
2438
- // ...augmentation,
2439
- // }),
2440
- // }) as any;
2441
- // };
2442
- extend(augmentation) {
2443
- return new _ZodObject(__spreadProps(__spreadValues({}, this._def), {
2444
- shape: () => __spreadValues(__spreadValues({}, this._def.shape()), augmentation)
2445
- }));
2446
- }
2447
- /**
2448
- * Prior to zod@1.0.12 there was a bug in the
2449
- * inferred type of merged objects. Please
2450
- * upgrade if you are experiencing issues.
2451
- */
2452
- merge(merging) {
2453
- const merged = new _ZodObject({
2454
- unknownKeys: merging._def.unknownKeys,
2455
- catchall: merging._def.catchall,
2456
- shape: () => __spreadValues(__spreadValues({}, this._def.shape()), merging._def.shape()),
2457
- typeName: ZodFirstPartyTypeKind.ZodObject
2458
- });
2459
- return merged;
2460
- }
2461
- // merge<
2462
- // Incoming extends AnyZodObject,
2463
- // Augmentation extends Incoming["shape"],
2464
- // NewOutput extends {
2465
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2466
- // ? Augmentation[k]["_output"]
2467
- // : k extends keyof Output
2468
- // ? Output[k]
2469
- // : never;
2470
- // },
2471
- // NewInput extends {
2472
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2473
- // ? Augmentation[k]["_input"]
2474
- // : k extends keyof Input
2475
- // ? Input[k]
2476
- // : never;
2477
- // }
2478
- // >(
2479
- // merging: Incoming
2480
- // ): ZodObject<
2481
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2482
- // Incoming["_def"]["unknownKeys"],
2483
- // Incoming["_def"]["catchall"],
2484
- // NewOutput,
2485
- // NewInput
2486
- // > {
2487
- // const merged: any = new ZodObject({
2488
- // unknownKeys: merging._def.unknownKeys,
2489
- // catchall: merging._def.catchall,
2490
- // shape: () =>
2491
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2492
- // typeName: ZodFirstPartyTypeKind.ZodObject,
2493
- // }) as any;
2494
- // return merged;
2495
- // }
2496
- setKey(key, schema) {
2497
- return this.augment({ [key]: schema });
2498
- }
2499
- // merge<Incoming extends AnyZodObject>(
2500
- // merging: Incoming
2501
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
2502
- // ZodObject<
2503
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2504
- // Incoming["_def"]["unknownKeys"],
2505
- // Incoming["_def"]["catchall"]
2506
- // > {
2507
- // // const mergedShape = objectUtil.mergeShapes(
2508
- // // this._def.shape(),
2509
- // // merging._def.shape()
2510
- // // );
2511
- // const merged: any = new ZodObject({
2512
- // unknownKeys: merging._def.unknownKeys,
2513
- // catchall: merging._def.catchall,
2514
- // shape: () =>
2515
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2516
- // typeName: ZodFirstPartyTypeKind.ZodObject,
2517
- // }) as any;
2518
- // return merged;
2519
- // }
2520
- catchall(index) {
2521
- return new _ZodObject(__spreadProps(__spreadValues({}, this._def), {
2522
- catchall: index
2523
- }));
2524
- }
2525
- pick(mask) {
2526
- const shape = {};
2527
- util.objectKeys(mask).forEach((key) => {
2528
- if (mask[key] && this.shape[key]) {
2529
- shape[key] = this.shape[key];
2530
- }
2531
- });
2532
- return new _ZodObject(__spreadProps(__spreadValues({}, this._def), {
2533
- shape: () => shape
2534
- }));
2535
- }
2536
- omit(mask) {
2537
- const shape = {};
2538
- util.objectKeys(this.shape).forEach((key) => {
2539
- if (!mask[key]) {
2540
- shape[key] = this.shape[key];
2541
- }
2542
- });
2543
- return new _ZodObject(__spreadProps(__spreadValues({}, this._def), {
2544
- shape: () => shape
2545
- }));
2546
- }
2547
- /**
2548
- * @deprecated
2549
- */
2550
- deepPartial() {
2551
- return deepPartialify(this);
2552
- }
2553
- partial(mask) {
2554
- const newShape = {};
2555
- util.objectKeys(this.shape).forEach((key) => {
2556
- const fieldSchema = this.shape[key];
2557
- if (mask && !mask[key]) {
2558
- newShape[key] = fieldSchema;
2559
- } else {
2560
- newShape[key] = fieldSchema.optional();
2561
- }
2562
- });
2563
- return new _ZodObject(__spreadProps(__spreadValues({}, this._def), {
2564
- shape: () => newShape
2565
- }));
2566
- }
2567
- required(mask) {
2568
- const newShape = {};
2569
- util.objectKeys(this.shape).forEach((key) => {
2570
- if (mask && !mask[key]) {
2571
- newShape[key] = this.shape[key];
2572
- } else {
2573
- const fieldSchema = this.shape[key];
2574
- let newField = fieldSchema;
2575
- while (newField instanceof ZodOptional) {
2576
- newField = newField._def.innerType;
2577
- }
2578
- newShape[key] = newField;
2579
- }
2580
- });
2581
- return new _ZodObject(__spreadProps(__spreadValues({}, this._def), {
2582
- shape: () => newShape
2583
- }));
2584
- }
2585
- keyof() {
2586
- return createZodEnum(util.objectKeys(this.shape));
2587
- }
2588
- };
2589
- ZodObject.create = (shape, params) => {
2590
- return new ZodObject(__spreadValues({
2591
- shape: () => shape,
2592
- unknownKeys: "strip",
2593
- catchall: ZodNever.create(),
2594
- typeName: ZodFirstPartyTypeKind.ZodObject
2595
- }, processCreateParams(params)));
2596
- };
2597
- ZodObject.strictCreate = (shape, params) => {
2598
- return new ZodObject(__spreadValues({
2599
- shape: () => shape,
2600
- unknownKeys: "strict",
2601
- catchall: ZodNever.create(),
2602
- typeName: ZodFirstPartyTypeKind.ZodObject
2603
- }, processCreateParams(params)));
2604
- };
2605
- ZodObject.lazycreate = (shape, params) => {
2606
- return new ZodObject(__spreadValues({
2607
- shape,
2608
- unknownKeys: "strip",
2609
- catchall: ZodNever.create(),
2610
- typeName: ZodFirstPartyTypeKind.ZodObject
2611
- }, processCreateParams(params)));
2612
- };
2613
- var ZodUnion = class extends ZodType {
2614
- _parse(input) {
2615
- const { ctx } = this._processInputParams(input);
2616
- const options = this._def.options;
2617
- function handleResults(results) {
2618
- for (const result of results) {
2619
- if (result.result.status === "valid") {
2620
- return result.result;
2621
- }
2622
- }
2623
- for (const result of results) {
2624
- if (result.result.status === "dirty") {
2625
- ctx.common.issues.push(...result.ctx.common.issues);
2626
- return result.result;
2627
- }
2628
- }
2629
- const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
2630
- addIssueToContext(ctx, {
2631
- code: ZodIssueCode.invalid_union,
2632
- unionErrors
2633
- });
2634
- return INVALID;
2635
- }
2636
- if (ctx.common.async) {
2637
- return Promise.all(options.map((option) => __async(this, null, function* () {
2638
- const childCtx = __spreadProps(__spreadValues({}, ctx), {
2639
- common: __spreadProps(__spreadValues({}, ctx.common), {
2640
- issues: []
2641
- }),
2642
- parent: null
2643
- });
2644
- return {
2645
- result: yield option._parseAsync({
2646
- data: ctx.data,
2647
- path: ctx.path,
2648
- parent: childCtx
2649
- }),
2650
- ctx: childCtx
2651
- };
2652
- }))).then(handleResults);
2653
- } else {
2654
- let dirty = void 0;
2655
- const issues = [];
2656
- for (const option of options) {
2657
- const childCtx = __spreadProps(__spreadValues({}, ctx), {
2658
- common: __spreadProps(__spreadValues({}, ctx.common), {
2659
- issues: []
2660
- }),
2661
- parent: null
2662
- });
2663
- const result = option._parseSync({
2664
- data: ctx.data,
2665
- path: ctx.path,
2666
- parent: childCtx
2667
- });
2668
- if (result.status === "valid") {
2669
- return result;
2670
- } else if (result.status === "dirty" && !dirty) {
2671
- dirty = { result, ctx: childCtx };
2672
- }
2673
- if (childCtx.common.issues.length) {
2674
- issues.push(childCtx.common.issues);
2675
- }
2676
- }
2677
- if (dirty) {
2678
- ctx.common.issues.push(...dirty.ctx.common.issues);
2679
- return dirty.result;
2680
- }
2681
- const unionErrors = issues.map((issues2) => new ZodError(issues2));
2682
- addIssueToContext(ctx, {
2683
- code: ZodIssueCode.invalid_union,
2684
- unionErrors
2685
- });
2686
- return INVALID;
2687
- }
2688
- }
2689
- get options() {
2690
- return this._def.options;
2691
- }
2692
- };
2693
- ZodUnion.create = (types, params) => {
2694
- return new ZodUnion(__spreadValues({
2695
- options: types,
2696
- typeName: ZodFirstPartyTypeKind.ZodUnion
2697
- }, processCreateParams(params)));
2698
- };
2699
- var getDiscriminator = (type) => {
2700
- if (type instanceof ZodLazy) {
2701
- return getDiscriminator(type.schema);
2702
- } else if (type instanceof ZodEffects) {
2703
- return getDiscriminator(type.innerType());
2704
- } else if (type instanceof ZodLiteral) {
2705
- return [type.value];
2706
- } else if (type instanceof ZodEnum) {
2707
- return type.options;
2708
- } else if (type instanceof ZodNativeEnum) {
2709
- return util.objectValues(type.enum);
2710
- } else if (type instanceof ZodDefault) {
2711
- return getDiscriminator(type._def.innerType);
2712
- } else if (type instanceof ZodUndefined) {
2713
- return [void 0];
2714
- } else if (type instanceof ZodNull) {
2715
- return [null];
2716
- } else if (type instanceof ZodOptional) {
2717
- return [void 0, ...getDiscriminator(type.unwrap())];
2718
- } else if (type instanceof ZodNullable) {
2719
- return [null, ...getDiscriminator(type.unwrap())];
2720
- } else if (type instanceof ZodBranded) {
2721
- return getDiscriminator(type.unwrap());
2722
- } else if (type instanceof ZodReadonly) {
2723
- return getDiscriminator(type.unwrap());
2724
- } else if (type instanceof ZodCatch) {
2725
- return getDiscriminator(type._def.innerType);
2726
- } else {
2727
- return [];
2728
- }
2729
- };
2730
- var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
2731
- _parse(input) {
2732
- const { ctx } = this._processInputParams(input);
2733
- if (ctx.parsedType !== ZodParsedType.object) {
2734
- addIssueToContext(ctx, {
2735
- code: ZodIssueCode.invalid_type,
2736
- expected: ZodParsedType.object,
2737
- received: ctx.parsedType
2738
- });
2739
- return INVALID;
2740
- }
2741
- const discriminator = this.discriminator;
2742
- const discriminatorValue = ctx.data[discriminator];
2743
- const option = this.optionsMap.get(discriminatorValue);
2744
- if (!option) {
2745
- addIssueToContext(ctx, {
2746
- code: ZodIssueCode.invalid_union_discriminator,
2747
- options: Array.from(this.optionsMap.keys()),
2748
- path: [discriminator]
2749
- });
2750
- return INVALID;
2751
- }
2752
- if (ctx.common.async) {
2753
- return option._parseAsync({
2754
- data: ctx.data,
2755
- path: ctx.path,
2756
- parent: ctx
2757
- });
2758
- } else {
2759
- return option._parseSync({
2760
- data: ctx.data,
2761
- path: ctx.path,
2762
- parent: ctx
2763
- });
2764
- }
2765
- }
2766
- get discriminator() {
2767
- return this._def.discriminator;
2768
- }
2769
- get options() {
2770
- return this._def.options;
2771
- }
2772
- get optionsMap() {
2773
- return this._def.optionsMap;
2774
- }
2775
- /**
2776
- * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2777
- * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2778
- * have a different value for each object in the union.
2779
- * @param discriminator the name of the discriminator property
2780
- * @param types an array of object schemas
2781
- * @param params
2782
- */
2783
- static create(discriminator, options, params) {
2784
- const optionsMap = /* @__PURE__ */ new Map();
2785
- for (const type of options) {
2786
- const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2787
- if (!discriminatorValues.length) {
2788
- throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
2789
- }
2790
- for (const value of discriminatorValues) {
2791
- if (optionsMap.has(value)) {
2792
- throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
2793
- }
2794
- optionsMap.set(value, type);
2795
- }
2796
- }
2797
- return new _ZodDiscriminatedUnion(__spreadValues({
2798
- typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
2799
- discriminator,
2800
- options,
2801
- optionsMap
2802
- }, processCreateParams(params)));
2803
- }
2804
- };
2805
- function mergeValues(a, b) {
2806
- const aType = getParsedType(a);
2807
- const bType = getParsedType(b);
2808
- if (a === b) {
2809
- return { valid: true, data: a };
2810
- } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
2811
- const bKeys = util.objectKeys(b);
2812
- const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
2813
- const newObj = __spreadValues(__spreadValues({}, a), b);
2814
- for (const key of sharedKeys) {
2815
- const sharedValue = mergeValues(a[key], b[key]);
2816
- if (!sharedValue.valid) {
2817
- return { valid: false };
2818
- }
2819
- newObj[key] = sharedValue.data;
2820
- }
2821
- return { valid: true, data: newObj };
2822
- } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
2823
- if (a.length !== b.length) {
2824
- return { valid: false };
2825
- }
2826
- const newArray = [];
2827
- for (let index = 0; index < a.length; index++) {
2828
- const itemA = a[index];
2829
- const itemB = b[index];
2830
- const sharedValue = mergeValues(itemA, itemB);
2831
- if (!sharedValue.valid) {
2832
- return { valid: false };
2833
- }
2834
- newArray.push(sharedValue.data);
2835
- }
2836
- return { valid: true, data: newArray };
2837
- } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
2838
- return { valid: true, data: a };
2839
- } else {
2840
- return { valid: false };
2841
- }
2842
- }
2843
- var ZodIntersection = class extends ZodType {
2844
- _parse(input) {
2845
- const { status, ctx } = this._processInputParams(input);
2846
- const handleParsed = (parsedLeft, parsedRight) => {
2847
- if (isAborted(parsedLeft) || isAborted(parsedRight)) {
2848
- return INVALID;
2849
- }
2850
- const merged = mergeValues(parsedLeft.value, parsedRight.value);
2851
- if (!merged.valid) {
2852
- addIssueToContext(ctx, {
2853
- code: ZodIssueCode.invalid_intersection_types
2854
- });
2855
- return INVALID;
2856
- }
2857
- if (isDirty(parsedLeft) || isDirty(parsedRight)) {
2858
- status.dirty();
2859
- }
2860
- return { status: status.value, value: merged.data };
2861
- };
2862
- if (ctx.common.async) {
2863
- return Promise.all([
2864
- this._def.left._parseAsync({
2865
- data: ctx.data,
2866
- path: ctx.path,
2867
- parent: ctx
2868
- }),
2869
- this._def.right._parseAsync({
2870
- data: ctx.data,
2871
- path: ctx.path,
2872
- parent: ctx
2873
- })
2874
- ]).then(([left, right]) => handleParsed(left, right));
2875
- } else {
2876
- return handleParsed(this._def.left._parseSync({
2877
- data: ctx.data,
2878
- path: ctx.path,
2879
- parent: ctx
2880
- }), this._def.right._parseSync({
2881
- data: ctx.data,
2882
- path: ctx.path,
2883
- parent: ctx
2884
- }));
2885
- }
2886
- }
2887
- };
2888
- ZodIntersection.create = (left, right, params) => {
2889
- return new ZodIntersection(__spreadValues({
2890
- left,
2891
- right,
2892
- typeName: ZodFirstPartyTypeKind.ZodIntersection
2893
- }, processCreateParams(params)));
2894
- };
2895
- var ZodTuple = class _ZodTuple extends ZodType {
2896
- _parse(input) {
2897
- const { status, ctx } = this._processInputParams(input);
2898
- if (ctx.parsedType !== ZodParsedType.array) {
2899
- addIssueToContext(ctx, {
2900
- code: ZodIssueCode.invalid_type,
2901
- expected: ZodParsedType.array,
2902
- received: ctx.parsedType
2903
- });
2904
- return INVALID;
2905
- }
2906
- if (ctx.data.length < this._def.items.length) {
2907
- addIssueToContext(ctx, {
2908
- code: ZodIssueCode.too_small,
2909
- minimum: this._def.items.length,
2910
- inclusive: true,
2911
- exact: false,
2912
- type: "array"
2913
- });
2914
- return INVALID;
2915
- }
2916
- const rest = this._def.rest;
2917
- if (!rest && ctx.data.length > this._def.items.length) {
2918
- addIssueToContext(ctx, {
2919
- code: ZodIssueCode.too_big,
2920
- maximum: this._def.items.length,
2921
- inclusive: true,
2922
- exact: false,
2923
- type: "array"
2924
- });
2925
- status.dirty();
2926
- }
2927
- const items = [...ctx.data].map((item, itemIndex) => {
2928
- const schema = this._def.items[itemIndex] || this._def.rest;
2929
- if (!schema)
2930
- return null;
2931
- return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
2932
- }).filter((x) => !!x);
2933
- if (ctx.common.async) {
2934
- return Promise.all(items).then((results) => {
2935
- return ParseStatus.mergeArray(status, results);
2936
- });
2937
- } else {
2938
- return ParseStatus.mergeArray(status, items);
2939
- }
2940
- }
2941
- get items() {
2942
- return this._def.items;
2943
- }
2944
- rest(rest) {
2945
- return new _ZodTuple(__spreadProps(__spreadValues({}, this._def), {
2946
- rest
2947
- }));
2948
- }
2949
- };
2950
- ZodTuple.create = (schemas, params) => {
2951
- if (!Array.isArray(schemas)) {
2952
- throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2953
- }
2954
- return new ZodTuple(__spreadValues({
2955
- items: schemas,
2956
- typeName: ZodFirstPartyTypeKind.ZodTuple,
2957
- rest: null
2958
- }, processCreateParams(params)));
2959
- };
2960
- var ZodRecord = class _ZodRecord extends ZodType {
2961
- get keySchema() {
2962
- return this._def.keyType;
2963
- }
2964
- get valueSchema() {
2965
- return this._def.valueType;
2966
- }
2967
- _parse(input) {
2968
- const { status, ctx } = this._processInputParams(input);
2969
- if (ctx.parsedType !== ZodParsedType.object) {
2970
- addIssueToContext(ctx, {
2971
- code: ZodIssueCode.invalid_type,
2972
- expected: ZodParsedType.object,
2973
- received: ctx.parsedType
2974
- });
2975
- return INVALID;
2976
- }
2977
- const pairs = [];
2978
- const keyType = this._def.keyType;
2979
- const valueType = this._def.valueType;
2980
- for (const key in ctx.data) {
2981
- pairs.push({
2982
- key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
2983
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
2984
- alwaysSet: key in ctx.data
2985
- });
2986
- }
2987
- if (ctx.common.async) {
2988
- return ParseStatus.mergeObjectAsync(status, pairs);
2989
- } else {
2990
- return ParseStatus.mergeObjectSync(status, pairs);
2991
- }
2992
- }
2993
- get element() {
2994
- return this._def.valueType;
2995
- }
2996
- static create(first, second, third) {
2997
- if (second instanceof ZodType) {
2998
- return new _ZodRecord(__spreadValues({
2999
- keyType: first,
3000
- valueType: second,
3001
- typeName: ZodFirstPartyTypeKind.ZodRecord
3002
- }, processCreateParams(third)));
3003
- }
3004
- return new _ZodRecord(__spreadValues({
3005
- keyType: ZodString.create(),
3006
- valueType: first,
3007
- typeName: ZodFirstPartyTypeKind.ZodRecord
3008
- }, processCreateParams(second)));
3009
- }
3010
- };
3011
- var ZodMap = class extends ZodType {
3012
- get keySchema() {
3013
- return this._def.keyType;
3014
- }
3015
- get valueSchema() {
3016
- return this._def.valueType;
3017
- }
3018
- _parse(input) {
3019
- const { status, ctx } = this._processInputParams(input);
3020
- if (ctx.parsedType !== ZodParsedType.map) {
3021
- addIssueToContext(ctx, {
3022
- code: ZodIssueCode.invalid_type,
3023
- expected: ZodParsedType.map,
3024
- received: ctx.parsedType
3025
- });
3026
- return INVALID;
3027
- }
3028
- const keyType = this._def.keyType;
3029
- const valueType = this._def.valueType;
3030
- const pairs = [...ctx.data.entries()].map(([key, value], index) => {
3031
- return {
3032
- key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
3033
- value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
3034
- };
3035
- });
3036
- if (ctx.common.async) {
3037
- const finalMap = /* @__PURE__ */ new Map();
3038
- return Promise.resolve().then(() => __async(this, null, function* () {
3039
- for (const pair of pairs) {
3040
- const key = yield pair.key;
3041
- const value = yield pair.value;
3042
- if (key.status === "aborted" || value.status === "aborted") {
3043
- return INVALID;
3044
- }
3045
- if (key.status === "dirty" || value.status === "dirty") {
3046
- status.dirty();
3047
- }
3048
- finalMap.set(key.value, value.value);
3049
- }
3050
- return { status: status.value, value: finalMap };
3051
- }));
3052
- } else {
3053
- const finalMap = /* @__PURE__ */ new Map();
3054
- for (const pair of pairs) {
3055
- const key = pair.key;
3056
- const value = pair.value;
3057
- if (key.status === "aborted" || value.status === "aborted") {
3058
- return INVALID;
3059
- }
3060
- if (key.status === "dirty" || value.status === "dirty") {
3061
- status.dirty();
3062
- }
3063
- finalMap.set(key.value, value.value);
3064
- }
3065
- return { status: status.value, value: finalMap };
3066
- }
3067
- }
3068
- };
3069
- ZodMap.create = (keyType, valueType, params) => {
3070
- return new ZodMap(__spreadValues({
3071
- valueType,
3072
- keyType,
3073
- typeName: ZodFirstPartyTypeKind.ZodMap
3074
- }, processCreateParams(params)));
3075
- };
3076
- var ZodSet = class _ZodSet extends ZodType {
3077
- _parse(input) {
3078
- const { status, ctx } = this._processInputParams(input);
3079
- if (ctx.parsedType !== ZodParsedType.set) {
3080
- addIssueToContext(ctx, {
3081
- code: ZodIssueCode.invalid_type,
3082
- expected: ZodParsedType.set,
3083
- received: ctx.parsedType
3084
- });
3085
- return INVALID;
3086
- }
3087
- const def = this._def;
3088
- if (def.minSize !== null) {
3089
- if (ctx.data.size < def.minSize.value) {
3090
- addIssueToContext(ctx, {
3091
- code: ZodIssueCode.too_small,
3092
- minimum: def.minSize.value,
3093
- type: "set",
3094
- inclusive: true,
3095
- exact: false,
3096
- message: def.minSize.message
3097
- });
3098
- status.dirty();
3099
- }
3100
- }
3101
- if (def.maxSize !== null) {
3102
- if (ctx.data.size > def.maxSize.value) {
3103
- addIssueToContext(ctx, {
3104
- code: ZodIssueCode.too_big,
3105
- maximum: def.maxSize.value,
3106
- type: "set",
3107
- inclusive: true,
3108
- exact: false,
3109
- message: def.maxSize.message
3110
- });
3111
- status.dirty();
3112
- }
3113
- }
3114
- const valueType = this._def.valueType;
3115
- function finalizeSet(elements2) {
3116
- const parsedSet = /* @__PURE__ */ new Set();
3117
- for (const element of elements2) {
3118
- if (element.status === "aborted")
3119
- return INVALID;
3120
- if (element.status === "dirty")
3121
- status.dirty();
3122
- parsedSet.add(element.value);
3123
- }
3124
- return { status: status.value, value: parsedSet };
3125
- }
3126
- const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
3127
- if (ctx.common.async) {
3128
- return Promise.all(elements).then((elements2) => finalizeSet(elements2));
3129
- } else {
3130
- return finalizeSet(elements);
3131
- }
3132
- }
3133
- min(minSize, message) {
3134
- return new _ZodSet(__spreadProps(__spreadValues({}, this._def), {
3135
- minSize: { value: minSize, message: errorUtil.toString(message) }
3136
- }));
3137
- }
3138
- max(maxSize, message) {
3139
- return new _ZodSet(__spreadProps(__spreadValues({}, this._def), {
3140
- maxSize: { value: maxSize, message: errorUtil.toString(message) }
3141
- }));
3142
- }
3143
- size(size, message) {
3144
- return this.min(size, message).max(size, message);
3145
- }
3146
- nonempty(message) {
3147
- return this.min(1, message);
3148
- }
3149
- };
3150
- ZodSet.create = (valueType, params) => {
3151
- return new ZodSet(__spreadValues({
3152
- valueType,
3153
- minSize: null,
3154
- maxSize: null,
3155
- typeName: ZodFirstPartyTypeKind.ZodSet
3156
- }, processCreateParams(params)));
3157
- };
3158
- var ZodFunction = class _ZodFunction extends ZodType {
3159
- constructor() {
3160
- super(...arguments);
3161
- this.validate = this.implement;
3162
- }
3163
- _parse(input) {
3164
- const { ctx } = this._processInputParams(input);
3165
- if (ctx.parsedType !== ZodParsedType.function) {
3166
- addIssueToContext(ctx, {
3167
- code: ZodIssueCode.invalid_type,
3168
- expected: ZodParsedType.function,
3169
- received: ctx.parsedType
3170
- });
3171
- return INVALID;
3172
- }
3173
- function makeArgsIssue(args, error) {
3174
- return makeIssue({
3175
- data: args,
3176
- path: ctx.path,
3177
- errorMaps: [
3178
- ctx.common.contextualErrorMap,
3179
- ctx.schemaErrorMap,
3180
- getErrorMap(),
3181
- errorMap
3182
- ].filter((x) => !!x),
3183
- issueData: {
3184
- code: ZodIssueCode.invalid_arguments,
3185
- argumentsError: error
3186
- }
3187
- });
3188
- }
3189
- function makeReturnsIssue(returns, error) {
3190
- return makeIssue({
3191
- data: returns,
3192
- path: ctx.path,
3193
- errorMaps: [
3194
- ctx.common.contextualErrorMap,
3195
- ctx.schemaErrorMap,
3196
- getErrorMap(),
3197
- errorMap
3198
- ].filter((x) => !!x),
3199
- issueData: {
3200
- code: ZodIssueCode.invalid_return_type,
3201
- returnTypeError: error
3202
- }
3203
- });
3204
- }
3205
- const params = { errorMap: ctx.common.contextualErrorMap };
3206
- const fn = ctx.data;
3207
- if (this._def.returns instanceof ZodPromise) {
3208
- const me = this;
3209
- return OK(function(...args) {
3210
- return __async(this, null, function* () {
3211
- const error = new ZodError([]);
3212
- const parsedArgs = yield me._def.args.parseAsync(args, params).catch((e) => {
3213
- error.addIssue(makeArgsIssue(args, e));
3214
- throw error;
3215
- });
3216
- const result = yield Reflect.apply(fn, this, parsedArgs);
3217
- const parsedReturns = yield me._def.returns._def.type.parseAsync(result, params).catch((e) => {
3218
- error.addIssue(makeReturnsIssue(result, e));
3219
- throw error;
3220
- });
3221
- return parsedReturns;
3222
- });
3223
- });
3224
- } else {
3225
- const me = this;
3226
- return OK(function(...args) {
3227
- const parsedArgs = me._def.args.safeParse(args, params);
3228
- if (!parsedArgs.success) {
3229
- throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
3230
- }
3231
- const result = Reflect.apply(fn, this, parsedArgs.data);
3232
- const parsedReturns = me._def.returns.safeParse(result, params);
3233
- if (!parsedReturns.success) {
3234
- throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3235
- }
3236
- return parsedReturns.data;
3237
- });
3238
- }
3239
- }
3240
- parameters() {
3241
- return this._def.args;
3242
- }
3243
- returnType() {
3244
- return this._def.returns;
3245
- }
3246
- args(...items) {
3247
- return new _ZodFunction(__spreadProps(__spreadValues({}, this._def), {
3248
- args: ZodTuple.create(items).rest(ZodUnknown.create())
3249
- }));
3250
- }
3251
- returns(returnType) {
3252
- return new _ZodFunction(__spreadProps(__spreadValues({}, this._def), {
3253
- returns: returnType
3254
- }));
3255
- }
3256
- implement(func) {
3257
- const validatedFunc = this.parse(func);
3258
- return validatedFunc;
3259
- }
3260
- strictImplement(func) {
3261
- const validatedFunc = this.parse(func);
3262
- return validatedFunc;
3263
- }
3264
- static create(args, returns, params) {
3265
- return new _ZodFunction(__spreadValues({
3266
- args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
3267
- returns: returns || ZodUnknown.create(),
3268
- typeName: ZodFirstPartyTypeKind.ZodFunction
3269
- }, processCreateParams(params)));
3270
- }
3271
- };
3272
- var ZodLazy = class extends ZodType {
3273
- get schema() {
3274
- return this._def.getter();
3275
- }
3276
- _parse(input) {
3277
- const { ctx } = this._processInputParams(input);
3278
- const lazySchema = this._def.getter();
3279
- return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
3280
- }
3281
- };
3282
- ZodLazy.create = (getter, params) => {
3283
- return new ZodLazy(__spreadValues({
3284
- getter,
3285
- typeName: ZodFirstPartyTypeKind.ZodLazy
3286
- }, processCreateParams(params)));
3287
- };
3288
- var ZodLiteral = class extends ZodType {
3289
- _parse(input) {
3290
- if (input.data !== this._def.value) {
3291
- const ctx = this._getOrReturnCtx(input);
3292
- addIssueToContext(ctx, {
3293
- received: ctx.data,
3294
- code: ZodIssueCode.invalid_literal,
3295
- expected: this._def.value
3296
- });
3297
- return INVALID;
3298
- }
3299
- return { status: "valid", value: input.data };
3300
- }
3301
- get value() {
3302
- return this._def.value;
3303
- }
3304
- };
3305
- ZodLiteral.create = (value, params) => {
3306
- return new ZodLiteral(__spreadValues({
3307
- value,
3308
- typeName: ZodFirstPartyTypeKind.ZodLiteral
3309
- }, processCreateParams(params)));
3310
- };
3311
- function createZodEnum(values, params) {
3312
- return new ZodEnum(__spreadValues({
3313
- values,
3314
- typeName: ZodFirstPartyTypeKind.ZodEnum
3315
- }, processCreateParams(params)));
3316
- }
3317
- var ZodEnum = class _ZodEnum extends ZodType {
3318
- constructor() {
3319
- super(...arguments);
3320
- _ZodEnum_cache.set(this, void 0);
3321
- }
3322
- _parse(input) {
3323
- if (typeof input.data !== "string") {
3324
- const ctx = this._getOrReturnCtx(input);
3325
- const expectedValues = this._def.values;
3326
- addIssueToContext(ctx, {
3327
- expected: util.joinValues(expectedValues),
3328
- received: ctx.parsedType,
3329
- code: ZodIssueCode.invalid_type
3330
- });
3331
- return INVALID;
3332
- }
3333
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
3334
- __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
3335
- }
3336
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
3337
- const ctx = this._getOrReturnCtx(input);
3338
- const expectedValues = this._def.values;
3339
- addIssueToContext(ctx, {
3340
- received: ctx.data,
3341
- code: ZodIssueCode.invalid_enum_value,
3342
- options: expectedValues
3343
- });
3344
- return INVALID;
3345
- }
3346
- return OK(input.data);
3347
- }
3348
- get options() {
3349
- return this._def.values;
3350
- }
3351
- get enum() {
3352
- const enumValues = {};
3353
- for (const val of this._def.values) {
3354
- enumValues[val] = val;
3355
- }
3356
- return enumValues;
3357
- }
3358
- get Values() {
3359
- const enumValues = {};
3360
- for (const val of this._def.values) {
3361
- enumValues[val] = val;
3362
- }
3363
- return enumValues;
3364
- }
3365
- get Enum() {
3366
- const enumValues = {};
3367
- for (const val of this._def.values) {
3368
- enumValues[val] = val;
3369
- }
3370
- return enumValues;
3371
- }
3372
- extract(values, newDef = this._def) {
3373
- return _ZodEnum.create(values, __spreadValues(__spreadValues({}, this._def), newDef));
3374
- }
3375
- exclude(values, newDef = this._def) {
3376
- return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), __spreadValues(__spreadValues({}, this._def), newDef));
3377
- }
3378
- };
3379
- _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
3380
- ZodEnum.create = createZodEnum;
3381
- var ZodNativeEnum = class extends ZodType {
3382
- constructor() {
3383
- super(...arguments);
3384
- _ZodNativeEnum_cache.set(this, void 0);
3385
- }
3386
- _parse(input) {
3387
- const nativeEnumValues = util.getValidEnumValues(this._def.values);
3388
- const ctx = this._getOrReturnCtx(input);
3389
- if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
3390
- const expectedValues = util.objectValues(nativeEnumValues);
3391
- addIssueToContext(ctx, {
3392
- expected: util.joinValues(expectedValues),
3393
- received: ctx.parsedType,
3394
- code: ZodIssueCode.invalid_type
3395
- });
3396
- return INVALID;
3397
- }
3398
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
3399
- __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
3400
- }
3401
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
3402
- const expectedValues = util.objectValues(nativeEnumValues);
3403
- addIssueToContext(ctx, {
3404
- received: ctx.data,
3405
- code: ZodIssueCode.invalid_enum_value,
3406
- options: expectedValues
3407
- });
3408
- return INVALID;
3409
- }
3410
- return OK(input.data);
3411
- }
3412
- get enum() {
3413
- return this._def.values;
3414
- }
3415
- };
3416
- _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
3417
- ZodNativeEnum.create = (values, params) => {
3418
- return new ZodNativeEnum(__spreadValues({
3419
- values,
3420
- typeName: ZodFirstPartyTypeKind.ZodNativeEnum
3421
- }, processCreateParams(params)));
3422
- };
3423
- var ZodPromise = class extends ZodType {
3424
- unwrap() {
3425
- return this._def.type;
3426
- }
3427
- _parse(input) {
3428
- const { ctx } = this._processInputParams(input);
3429
- if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
3430
- addIssueToContext(ctx, {
3431
- code: ZodIssueCode.invalid_type,
3432
- expected: ZodParsedType.promise,
3433
- received: ctx.parsedType
3434
- });
3435
- return INVALID;
3436
- }
3437
- const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
3438
- return OK(promisified.then((data) => {
3439
- return this._def.type.parseAsync(data, {
3440
- path: ctx.path,
3441
- errorMap: ctx.common.contextualErrorMap
3442
- });
3443
- }));
3444
- }
3445
- };
3446
- ZodPromise.create = (schema, params) => {
3447
- return new ZodPromise(__spreadValues({
3448
- type: schema,
3449
- typeName: ZodFirstPartyTypeKind.ZodPromise
3450
- }, processCreateParams(params)));
3451
- };
3452
- var ZodEffects = class extends ZodType {
3453
- innerType() {
3454
- return this._def.schema;
3455
- }
3456
- sourceType() {
3457
- return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
3458
- }
3459
- _parse(input) {
3460
- const { status, ctx } = this._processInputParams(input);
3461
- const effect = this._def.effect || null;
3462
- const checkCtx = {
3463
- addIssue: (arg) => {
3464
- addIssueToContext(ctx, arg);
3465
- if (arg.fatal) {
3466
- status.abort();
3467
- } else {
3468
- status.dirty();
3469
- }
3470
- },
3471
- get path() {
3472
- return ctx.path;
3473
- }
3474
- };
3475
- checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3476
- if (effect.type === "preprocess") {
3477
- const processed = effect.transform(ctx.data, checkCtx);
3478
- if (ctx.common.async) {
3479
- return Promise.resolve(processed).then((processed2) => __async(this, null, function* () {
3480
- if (status.value === "aborted")
3481
- return INVALID;
3482
- const result = yield this._def.schema._parseAsync({
3483
- data: processed2,
3484
- path: ctx.path,
3485
- parent: ctx
3486
- });
3487
- if (result.status === "aborted")
3488
- return INVALID;
3489
- if (result.status === "dirty")
3490
- return DIRTY(result.value);
3491
- if (status.value === "dirty")
3492
- return DIRTY(result.value);
3493
- return result;
3494
- }));
3495
- } else {
3496
- if (status.value === "aborted")
3497
- return INVALID;
3498
- const result = this._def.schema._parseSync({
3499
- data: processed,
3500
- path: ctx.path,
3501
- parent: ctx
3502
- });
3503
- if (result.status === "aborted")
3504
- return INVALID;
3505
- if (result.status === "dirty")
3506
- return DIRTY(result.value);
3507
- if (status.value === "dirty")
3508
- return DIRTY(result.value);
3509
- return result;
3510
- }
3511
- }
3512
- if (effect.type === "refinement") {
3513
- const executeRefinement = (acc) => {
3514
- const result = effect.refinement(acc, checkCtx);
3515
- if (ctx.common.async) {
3516
- return Promise.resolve(result);
3517
- }
3518
- if (result instanceof Promise) {
3519
- throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
3520
- }
3521
- return acc;
3522
- };
3523
- if (ctx.common.async === false) {
3524
- const inner = this._def.schema._parseSync({
3525
- data: ctx.data,
3526
- path: ctx.path,
3527
- parent: ctx
3528
- });
3529
- if (inner.status === "aborted")
3530
- return INVALID;
3531
- if (inner.status === "dirty")
3532
- status.dirty();
3533
- executeRefinement(inner.value);
3534
- return { status: status.value, value: inner.value };
3535
- } else {
3536
- return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
3537
- if (inner.status === "aborted")
3538
- return INVALID;
3539
- if (inner.status === "dirty")
3540
- status.dirty();
3541
- return executeRefinement(inner.value).then(() => {
3542
- return { status: status.value, value: inner.value };
3543
- });
3544
- });
3545
- }
3546
- }
3547
- if (effect.type === "transform") {
3548
- if (ctx.common.async === false) {
3549
- const base = this._def.schema._parseSync({
3550
- data: ctx.data,
3551
- path: ctx.path,
3552
- parent: ctx
3553
- });
3554
- if (!isValid(base))
3555
- return base;
3556
- const result = effect.transform(base.value, checkCtx);
3557
- if (result instanceof Promise) {
3558
- throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
3559
- }
3560
- return { status: status.value, value: result };
3561
- } else {
3562
- return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
3563
- if (!isValid(base))
3564
- return base;
3565
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
3566
- });
3567
- }
3568
- }
3569
- util.assertNever(effect);
3570
- }
3571
- };
3572
- ZodEffects.create = (schema, effect, params) => {
3573
- return new ZodEffects(__spreadValues({
3574
- schema,
3575
- typeName: ZodFirstPartyTypeKind.ZodEffects,
3576
- effect
3577
- }, processCreateParams(params)));
3578
- };
3579
- ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
3580
- return new ZodEffects(__spreadValues({
3581
- schema,
3582
- effect: { type: "preprocess", transform: preprocess },
3583
- typeName: ZodFirstPartyTypeKind.ZodEffects
3584
- }, processCreateParams(params)));
3585
- };
3586
- var ZodOptional = class extends ZodType {
3587
- _parse(input) {
3588
- const parsedType = this._getType(input);
3589
- if (parsedType === ZodParsedType.undefined) {
3590
- return OK(void 0);
3591
- }
3592
- return this._def.innerType._parse(input);
3593
- }
3594
- unwrap() {
3595
- return this._def.innerType;
3596
- }
3597
- };
3598
- ZodOptional.create = (type, params) => {
3599
- return new ZodOptional(__spreadValues({
3600
- innerType: type,
3601
- typeName: ZodFirstPartyTypeKind.ZodOptional
3602
- }, processCreateParams(params)));
3603
- };
3604
- var ZodNullable = class extends ZodType {
3605
- _parse(input) {
3606
- const parsedType = this._getType(input);
3607
- if (parsedType === ZodParsedType.null) {
3608
- return OK(null);
3609
- }
3610
- return this._def.innerType._parse(input);
3611
- }
3612
- unwrap() {
3613
- return this._def.innerType;
3614
- }
3615
- };
3616
- ZodNullable.create = (type, params) => {
3617
- return new ZodNullable(__spreadValues({
3618
- innerType: type,
3619
- typeName: ZodFirstPartyTypeKind.ZodNullable
3620
- }, processCreateParams(params)));
3621
- };
3622
- var ZodDefault = class extends ZodType {
3623
- _parse(input) {
3624
- const { ctx } = this._processInputParams(input);
3625
- let data = ctx.data;
3626
- if (ctx.parsedType === ZodParsedType.undefined) {
3627
- data = this._def.defaultValue();
3628
- }
3629
- return this._def.innerType._parse({
3630
- data,
3631
- path: ctx.path,
3632
- parent: ctx
3633
- });
3634
- }
3635
- removeDefault() {
3636
- return this._def.innerType;
3637
- }
3638
- };
3639
- ZodDefault.create = (type, params) => {
3640
- return new ZodDefault(__spreadValues({
3641
- innerType: type,
3642
- typeName: ZodFirstPartyTypeKind.ZodDefault,
3643
- defaultValue: typeof params.default === "function" ? params.default : () => params.default
3644
- }, processCreateParams(params)));
3645
- };
3646
- var ZodCatch = class extends ZodType {
3647
- _parse(input) {
3648
- const { ctx } = this._processInputParams(input);
3649
- const newCtx = __spreadProps(__spreadValues({}, ctx), {
3650
- common: __spreadProps(__spreadValues({}, ctx.common), {
3651
- issues: []
3652
- })
3653
- });
3654
- const result = this._def.innerType._parse({
3655
- data: newCtx.data,
3656
- path: newCtx.path,
3657
- parent: __spreadValues({}, newCtx)
3658
- });
3659
- if (isAsync(result)) {
3660
- return result.then((result2) => {
3661
- return {
3662
- status: "valid",
3663
- value: result2.status === "valid" ? result2.value : this._def.catchValue({
3664
- get error() {
3665
- return new ZodError(newCtx.common.issues);
3666
- },
3667
- input: newCtx.data
3668
- })
3669
- };
3670
- });
3671
- } else {
3672
- return {
3673
- status: "valid",
3674
- value: result.status === "valid" ? result.value : this._def.catchValue({
3675
- get error() {
3676
- return new ZodError(newCtx.common.issues);
3677
- },
3678
- input: newCtx.data
3679
- })
3680
- };
3681
- }
3682
- }
3683
- removeCatch() {
3684
- return this._def.innerType;
3685
- }
3686
- };
3687
- ZodCatch.create = (type, params) => {
3688
- return new ZodCatch(__spreadValues({
3689
- innerType: type,
3690
- typeName: ZodFirstPartyTypeKind.ZodCatch,
3691
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch
3692
- }, processCreateParams(params)));
3693
- };
3694
- var ZodNaN = class extends ZodType {
3695
- _parse(input) {
3696
- const parsedType = this._getType(input);
3697
- if (parsedType !== ZodParsedType.nan) {
3698
- const ctx = this._getOrReturnCtx(input);
3699
- addIssueToContext(ctx, {
3700
- code: ZodIssueCode.invalid_type,
3701
- expected: ZodParsedType.nan,
3702
- received: ctx.parsedType
3703
- });
3704
- return INVALID;
3705
- }
3706
- return { status: "valid", value: input.data };
3707
- }
3708
- };
3709
- ZodNaN.create = (params) => {
3710
- return new ZodNaN(__spreadValues({
3711
- typeName: ZodFirstPartyTypeKind.ZodNaN
3712
- }, processCreateParams(params)));
3713
- };
3714
- var BRAND = Symbol("zod_brand");
3715
- var ZodBranded = class extends ZodType {
3716
- _parse(input) {
3717
- const { ctx } = this._processInputParams(input);
3718
- const data = ctx.data;
3719
- return this._def.type._parse({
3720
- data,
3721
- path: ctx.path,
3722
- parent: ctx
3723
- });
3724
- }
3725
- unwrap() {
3726
- return this._def.type;
3727
- }
3728
- };
3729
- var ZodPipeline = class _ZodPipeline extends ZodType {
3730
- _parse(input) {
3731
- const { status, ctx } = this._processInputParams(input);
3732
- if (ctx.common.async) {
3733
- const handleAsync = () => __async(this, null, function* () {
3734
- const inResult = yield this._def.in._parseAsync({
3735
- data: ctx.data,
3736
- path: ctx.path,
3737
- parent: ctx
3738
- });
3739
- if (inResult.status === "aborted")
3740
- return INVALID;
3741
- if (inResult.status === "dirty") {
3742
- status.dirty();
3743
- return DIRTY(inResult.value);
3744
- } else {
3745
- return this._def.out._parseAsync({
3746
- data: inResult.value,
3747
- path: ctx.path,
3748
- parent: ctx
3749
- });
3750
- }
3751
- });
3752
- return handleAsync();
3753
- } else {
3754
- const inResult = this._def.in._parseSync({
3755
- data: ctx.data,
3756
- path: ctx.path,
3757
- parent: ctx
3758
- });
3759
- if (inResult.status === "aborted")
3760
- return INVALID;
3761
- if (inResult.status === "dirty") {
3762
- status.dirty();
3763
- return {
3764
- status: "dirty",
3765
- value: inResult.value
3766
- };
3767
- } else {
3768
- return this._def.out._parseSync({
3769
- data: inResult.value,
3770
- path: ctx.path,
3771
- parent: ctx
3772
- });
3773
- }
3774
- }
3775
- }
3776
- static create(a, b) {
3777
- return new _ZodPipeline({
3778
- in: a,
3779
- out: b,
3780
- typeName: ZodFirstPartyTypeKind.ZodPipeline
3781
- });
3782
- }
3783
- };
3784
- var ZodReadonly = class extends ZodType {
3785
- _parse(input) {
3786
- const result = this._def.innerType._parse(input);
3787
- const freeze = (data) => {
3788
- if (isValid(data)) {
3789
- data.value = Object.freeze(data.value);
3790
- }
3791
- return data;
3792
- };
3793
- return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
3794
- }
3795
- unwrap() {
3796
- return this._def.innerType;
3797
- }
3798
- };
3799
- ZodReadonly.create = (type, params) => {
3800
- return new ZodReadonly(__spreadValues({
3801
- innerType: type,
3802
- typeName: ZodFirstPartyTypeKind.ZodReadonly
3803
- }, processCreateParams(params)));
3804
- };
3805
- function cleanParams(params, data) {
3806
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3807
- const p2 = typeof p === "string" ? { message: p } : p;
3808
- return p2;
3809
- }
3810
- function custom(check, _params = {}, fatal) {
3811
- if (check)
3812
- return ZodAny.create().superRefine((data, ctx) => {
3813
- var _a, _b;
3814
- const r = check(data);
3815
- if (r instanceof Promise) {
3816
- return r.then((r2) => {
3817
- var _a2, _b2;
3818
- if (!r2) {
3819
- const params = cleanParams(_params, data);
3820
- const _fatal = (_b2 = (_a2 = params.fatal) !== null && _a2 !== void 0 ? _a2 : fatal) !== null && _b2 !== void 0 ? _b2 : true;
3821
- ctx.addIssue(__spreadProps(__spreadValues({ code: "custom" }, params), { fatal: _fatal }));
3822
- }
3823
- });
3824
- }
3825
- if (!r) {
3826
- const params = cleanParams(_params, data);
3827
- const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
3828
- ctx.addIssue(__spreadProps(__spreadValues({ code: "custom" }, params), { fatal: _fatal }));
3829
- }
3830
- return;
3831
- });
3832
- return ZodAny.create();
3833
- }
3834
- var late = {
3835
- object: ZodObject.lazycreate
3836
- };
3837
- var ZodFirstPartyTypeKind;
3838
- (function(ZodFirstPartyTypeKind2) {
3839
- ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
3840
- ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
3841
- ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
3842
- ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
3843
- ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
3844
- ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
3845
- ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
3846
- ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
3847
- ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
3848
- ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
3849
- ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
3850
- ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
3851
- ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
3852
- ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
3853
- ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
3854
- ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
3855
- ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
3856
- ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
3857
- ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
3858
- ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
3859
- ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
3860
- ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
3861
- ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
3862
- ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
3863
- ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
3864
- ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
3865
- ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
3866
- ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
3867
- ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
3868
- ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
3869
- ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
3870
- ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
3871
- ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
3872
- ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
3873
- ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
3874
- ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
3875
- })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
3876
- var instanceOfType = (cls, params = {
3877
- message: `Input not instance of ${cls.name}`
3878
- }) => custom((data) => data instanceof cls, params);
3879
- var stringType = ZodString.create;
3880
- var numberType = ZodNumber.create;
3881
- var nanType = ZodNaN.create;
3882
- var bigIntType = ZodBigInt.create;
3883
- var booleanType = ZodBoolean.create;
3884
- var dateType = ZodDate.create;
3885
- var symbolType = ZodSymbol.create;
3886
- var undefinedType = ZodUndefined.create;
3887
- var nullType = ZodNull.create;
3888
- var anyType = ZodAny.create;
3889
- var unknownType = ZodUnknown.create;
3890
- var neverType = ZodNever.create;
3891
- var voidType = ZodVoid.create;
3892
- var arrayType = ZodArray.create;
3893
- var objectType = ZodObject.create;
3894
- var strictObjectType = ZodObject.strictCreate;
3895
- var unionType = ZodUnion.create;
3896
- var discriminatedUnionType = ZodDiscriminatedUnion.create;
3897
- var intersectionType = ZodIntersection.create;
3898
- var tupleType = ZodTuple.create;
3899
- var recordType = ZodRecord.create;
3900
- var mapType = ZodMap.create;
3901
- var setType = ZodSet.create;
3902
- var functionType = ZodFunction.create;
3903
- var lazyType = ZodLazy.create;
3904
- var literalType = ZodLiteral.create;
3905
- var enumType = ZodEnum.create;
3906
- var nativeEnumType = ZodNativeEnum.create;
3907
- var promiseType = ZodPromise.create;
3908
- var effectsType = ZodEffects.create;
3909
- var optionalType = ZodOptional.create;
3910
- var nullableType = ZodNullable.create;
3911
- var preprocessType = ZodEffects.createWithPreprocess;
3912
- var pipelineType = ZodPipeline.create;
3913
- var ostring = () => stringType().optional();
3914
- var onumber = () => numberType().optional();
3915
- var oboolean = () => booleanType().optional();
3916
- var coerce = {
3917
- string: (arg) => ZodString.create(__spreadProps(__spreadValues({}, arg), { coerce: true })),
3918
- number: (arg) => ZodNumber.create(__spreadProps(__spreadValues({}, arg), { coerce: true })),
3919
- boolean: (arg) => ZodBoolean.create(__spreadProps(__spreadValues({}, arg), {
3920
- coerce: true
3921
- })),
3922
- bigint: (arg) => ZodBigInt.create(__spreadProps(__spreadValues({}, arg), { coerce: true })),
3923
- date: (arg) => ZodDate.create(__spreadProps(__spreadValues({}, arg), { coerce: true }))
3924
- };
3925
- var NEVER = INVALID;
3926
- var z = /* @__PURE__ */ Object.freeze({
3927
- __proto__: null,
3928
- defaultErrorMap: errorMap,
3929
- setErrorMap,
3930
- getErrorMap,
3931
- makeIssue,
3932
- EMPTY_PATH,
3933
- addIssueToContext,
3934
- ParseStatus,
3935
- INVALID,
3936
- DIRTY,
3937
- OK,
3938
- isAborted,
3939
- isDirty,
3940
- isValid,
3941
- isAsync,
3942
- get util() {
3943
- return util;
3944
- },
3945
- get objectUtil() {
3946
- return objectUtil;
3947
- },
3948
- ZodParsedType,
3949
- getParsedType,
3950
- ZodType,
3951
- datetimeRegex,
3952
- ZodString,
3953
- ZodNumber,
3954
- ZodBigInt,
3955
- ZodBoolean,
3956
- ZodDate,
3957
- ZodSymbol,
3958
- ZodUndefined,
3959
- ZodNull,
3960
- ZodAny,
3961
- ZodUnknown,
3962
- ZodNever,
3963
- ZodVoid,
3964
- ZodArray,
3965
- ZodObject,
3966
- ZodUnion,
3967
- ZodDiscriminatedUnion,
3968
- ZodIntersection,
3969
- ZodTuple,
3970
- ZodRecord,
3971
- ZodMap,
3972
- ZodSet,
3973
- ZodFunction,
3974
- ZodLazy,
3975
- ZodLiteral,
3976
- ZodEnum,
3977
- ZodNativeEnum,
3978
- ZodPromise,
3979
- ZodEffects,
3980
- ZodTransformer: ZodEffects,
3981
- ZodOptional,
3982
- ZodNullable,
3983
- ZodDefault,
3984
- ZodCatch,
3985
- ZodNaN,
3986
- BRAND,
3987
- ZodBranded,
3988
- ZodPipeline,
3989
- ZodReadonly,
3990
- custom,
3991
- Schema: ZodType,
3992
- ZodSchema: ZodType,
3993
- late,
3994
- get ZodFirstPartyTypeKind() {
3995
- return ZodFirstPartyTypeKind;
3996
- },
3997
- coerce,
3998
- any: anyType,
3999
- array: arrayType,
4000
- bigint: bigIntType,
4001
- boolean: booleanType,
4002
- date: dateType,
4003
- discriminatedUnion: discriminatedUnionType,
4004
- effect: effectsType,
4005
- "enum": enumType,
4006
- "function": functionType,
4007
- "instanceof": instanceOfType,
4008
- intersection: intersectionType,
4009
- lazy: lazyType,
4010
- literal: literalType,
4011
- map: mapType,
4012
- nan: nanType,
4013
- nativeEnum: nativeEnumType,
4014
- never: neverType,
4015
- "null": nullType,
4016
- nullable: nullableType,
4017
- number: numberType,
4018
- object: objectType,
4019
- oboolean,
4020
- onumber,
4021
- optional: optionalType,
4022
- ostring,
4023
- pipeline: pipelineType,
4024
- preprocess: preprocessType,
4025
- promise: promiseType,
4026
- record: recordType,
4027
- set: setType,
4028
- strictObject: strictObjectType,
4029
- string: stringType,
4030
- symbol: symbolType,
4031
- transformer: effectsType,
4032
- tuple: tupleType,
4033
- "undefined": undefinedType,
4034
- union: unionType,
4035
- unknown: unknownType,
4036
- "void": voidType,
4037
- NEVER,
4038
- ZodIssueCode,
4039
- quotelessJson,
4040
- ZodError
4041
- });
4042
-
4043
- // src/txs/import-actions/import-actions.schema.zod.ts
49
+ var import_zod = require('../../lib/zod.cjs');
4044
50
  var importActionsTxInputOptionsSchema = import_consts2.iTxGeneralOptions.partial();
4045
- var importActionWalletSchema = z.object({
4046
- target: z.literal("wallet"),
51
+ var importActionWalletSchema = import_zod.z.object({
52
+ target: import_zod.z.literal("wallet"),
4047
53
  data: import_create_wallet_schema.walletInputSchema
4048
54
  });
4049
- var importActionTokenSchema = z.object({
4050
- target: z.literal("token"),
55
+ var importActionTokenSchema = import_zod.z.object({
56
+ target: import_zod.z.literal("token"),
4051
57
  data: import_create_token_schema.tokenInputSchema
4052
58
  });
4053
59
  var importActionTransferGroupDataSchema = import_create_transfer_group_schema.transferGroupInputSchema.extend({
@@ -4055,11 +61,11 @@ var importActionTransferGroupDataSchema = import_create_transfer_group_schema.tr
4055
61
  status_finalized_at: import_consts.DatetimeSchema.optional(),
4056
62
  transfer_status_finalized_at: import_consts.DatetimeSchema.optional()
4057
63
  });
4058
- var importActionTransferGroupSchema = z.object({
4059
- target: z.literal("transfer_group"),
64
+ var importActionTransferGroupSchema = import_zod.z.object({
65
+ target: import_zod.z.literal("transfer_group"),
4060
66
  data: importActionTransferGroupDataSchema
4061
67
  });
4062
- var importActionTransferDataCommonSchema = z.object({
68
+ var importActionTransferDataCommonSchema = import_zod.z.object({
4063
69
  identifier: import_transfer_schema.transferTableSchema.shape.identifier,
4064
70
  from_wallet: import_get_wallet_schema.uniqueWalletFilter,
4065
71
  to_wallet: import_get_wallet_schema.uniqueWalletFilter,
@@ -4072,7 +78,7 @@ var importActionTransferDataCommonSchema = z.object({
4072
78
  status_finalized_at: import_consts.DatetimeSchema
4073
79
  });
4074
80
  var importActionTransferDataRegularSchema = importActionTransferDataCommonSchema.extend({
4075
- type: z.literal("regular")
81
+ type: import_zod.z.literal("regular")
4076
82
  }).partial().required({
4077
83
  from_wallet: true,
4078
84
  to_wallet: true,
@@ -4081,7 +87,7 @@ var importActionTransferDataRegularSchema = importActionTransferDataCommonSchema
4081
87
  type: true
4082
88
  });
4083
89
  var importActionTransferDataDepositSchema = importActionTransferDataCommonSchema.extend({
4084
- type: z.literal("deposit")
90
+ type: import_zod.z.literal("deposit")
4085
91
  }).partial().required({
4086
92
  to_wallet: true,
4087
93
  token: true,
@@ -4089,37 +95,37 @@ var importActionTransferDataDepositSchema = importActionTransferDataCommonSchema
4089
95
  type: true
4090
96
  });
4091
97
  var importActionTransferDataWithdrawalSchema = importActionTransferDataCommonSchema.extend({
4092
- type: z.literal("withdrawal")
98
+ type: import_zod.z.literal("withdrawal")
4093
99
  }).partial().required({
4094
100
  from_wallet: true,
4095
101
  token: true,
4096
102
  amount: true,
4097
103
  type: true
4098
104
  });
4099
- var importActionTransferDataSchema = z.union([
105
+ var importActionTransferDataSchema = import_zod.z.union([
4100
106
  importActionTransferDataRegularSchema,
4101
107
  importActionTransferDataDepositSchema,
4102
108
  importActionTransferDataWithdrawalSchema
4103
109
  ]);
4104
- var importActionTransferSchema = z.object({
4105
- target: z.literal("transfer"),
110
+ var importActionTransferSchema = import_zod.z.object({
111
+ target: import_zod.z.literal("transfer"),
4106
112
  data: importActionTransferDataSchema
4107
113
  });
4108
- var importActionsTxStreamChunkSchema = z.union([
114
+ var importActionsTxStreamChunkSchema = import_zod.z.union([
4109
115
  importActionWalletSchema,
4110
116
  importActionTokenSchema,
4111
117
  importActionTransferGroupSchema,
4112
118
  importActionTransferSchema
4113
119
  ]);
4114
- var importActionsTxInputSchema = z.object({
120
+ var importActionsTxInputSchema = import_zod.z.object({
4115
121
  actions: importActionsTxStreamChunkSchema.array().describe("Array of actions to import."),
4116
122
  options: importActionsTxInputOptionsSchema
4117
123
  }).partial().required({
4118
124
  actions: true
4119
125
  }).describe("Input for importActions");
4120
- var importActionsTxOutputSchema = z.object({
4121
- progress: z.unknown().array(),
4122
- erroneous: z.unknown().array()
126
+ var importActionsTxOutputSchema = import_zod.z.object({
127
+ progress: import_zod.z.unknown().array(),
128
+ erroneous: import_zod.z.unknown().array()
4123
129
  }).partial().describe("Output of importActions");
4124
130
  var config = {
4125
131
  streamable: true