wapi-client 0.12.5-beta.6 → 0.13.0

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