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