wapi-client 0.12.5-beta.4 → 0.12.5-beta.9

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