@getivy/node-sdk 1.7.0 → 2.0.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 (639) hide show
  1. package/CHANGELOG.md +149 -563
  2. package/README.md +112 -42
  3. package/api-promise.d.mts +2 -0
  4. package/api-promise.d.mts.map +1 -0
  5. package/api-promise.d.ts +2 -0
  6. package/api-promise.d.ts.map +1 -0
  7. package/api-promise.js +6 -0
  8. package/api-promise.js.map +1 -0
  9. package/api-promise.mjs +2 -0
  10. package/api-promise.mjs.map +1 -0
  11. package/bin/cli +53 -0
  12. package/bin/migration-config.json +6 -0
  13. package/client.d.mts +243 -0
  14. package/client.d.mts.map +1 -0
  15. package/client.d.ts +243 -0
  16. package/client.d.ts.map +1 -0
  17. package/client.js +524 -0
  18. package/client.js.map +1 -0
  19. package/client.mjs +520 -0
  20. package/client.mjs.map +1 -0
  21. package/core/api-promise.d.mts +46 -0
  22. package/core/api-promise.d.mts.map +1 -0
  23. package/core/api-promise.d.ts +46 -0
  24. package/core/api-promise.d.ts.map +1 -0
  25. package/core/api-promise.js +74 -0
  26. package/core/api-promise.js.map +1 -0
  27. package/core/api-promise.mjs +70 -0
  28. package/core/api-promise.mjs.map +1 -0
  29. package/core/error.d.mts +46 -0
  30. package/core/error.d.mts.map +1 -0
  31. package/core/error.d.ts +46 -0
  32. package/core/error.d.ts.map +1 -0
  33. package/core/error.js +113 -0
  34. package/core/error.js.map +1 -0
  35. package/core/error.mjs +97 -0
  36. package/core/error.mjs.map +1 -0
  37. package/core/resource.d.mts +6 -0
  38. package/core/resource.d.mts.map +1 -0
  39. package/core/resource.d.ts +6 -0
  40. package/core/resource.d.ts.map +1 -0
  41. package/core/resource.js +11 -0
  42. package/core/resource.js.map +1 -0
  43. package/core/resource.mjs +7 -0
  44. package/core/resource.mjs.map +1 -0
  45. package/core/uploads.d.mts +3 -0
  46. package/core/uploads.d.mts.map +1 -0
  47. package/core/uploads.d.ts +3 -0
  48. package/core/uploads.d.ts.map +1 -0
  49. package/core/uploads.js +6 -0
  50. package/core/uploads.js.map +1 -0
  51. package/core/uploads.mjs +2 -0
  52. package/core/uploads.mjs.map +1 -0
  53. package/error.d.mts +2 -0
  54. package/error.d.mts.map +1 -0
  55. package/error.d.ts +1 -46
  56. package/error.d.ts.map +1 -1
  57. package/error.js +3 -110
  58. package/error.js.map +1 -1
  59. package/error.mjs +1 -96
  60. package/error.mjs.map +1 -1
  61. package/index.d.mts +6 -175
  62. package/index.d.mts.map +1 -0
  63. package/index.d.ts +5 -174
  64. package/index.d.ts.map +1 -1
  65. package/index.js +12 -166
  66. package/index.js.map +1 -1
  67. package/index.mjs +5 -139
  68. package/index.mjs.map +1 -1
  69. package/internal/builtin-types.d.mts +73 -0
  70. package/internal/builtin-types.d.mts.map +1 -0
  71. package/internal/builtin-types.d.ts +73 -0
  72. package/internal/builtin-types.d.ts.map +1 -0
  73. package/internal/builtin-types.js +4 -0
  74. package/internal/builtin-types.js.map +1 -0
  75. package/internal/builtin-types.mjs +3 -0
  76. package/internal/builtin-types.mjs.map +1 -0
  77. package/internal/detect-platform.d.mts +15 -0
  78. package/internal/detect-platform.d.mts.map +1 -0
  79. package/internal/detect-platform.d.ts +15 -0
  80. package/internal/detect-platform.d.ts.map +1 -0
  81. package/internal/detect-platform.js +162 -0
  82. package/internal/detect-platform.js.map +1 -0
  83. package/internal/detect-platform.mjs +157 -0
  84. package/internal/detect-platform.mjs.map +1 -0
  85. package/internal/errors.d.mts +3 -0
  86. package/internal/errors.d.mts.map +1 -0
  87. package/internal/errors.d.ts +3 -0
  88. package/internal/errors.d.ts.map +1 -0
  89. package/internal/errors.js +41 -0
  90. package/internal/errors.js.map +1 -0
  91. package/internal/errors.mjs +36 -0
  92. package/internal/errors.mjs.map +1 -0
  93. package/internal/headers.d.mts +20 -0
  94. package/internal/headers.d.mts.map +1 -0
  95. package/internal/headers.d.ts +20 -0
  96. package/internal/headers.d.ts.map +1 -0
  97. package/internal/headers.js +79 -0
  98. package/internal/headers.js.map +1 -0
  99. package/internal/headers.mjs +74 -0
  100. package/internal/headers.mjs.map +1 -0
  101. package/internal/parse.d.mts +12 -0
  102. package/internal/parse.d.mts.map +1 -0
  103. package/internal/parse.d.ts +12 -0
  104. package/internal/parse.d.ts.map +1 -0
  105. package/internal/parse.js +40 -0
  106. package/internal/parse.js.map +1 -0
  107. package/internal/parse.mjs +37 -0
  108. package/internal/parse.mjs.map +1 -0
  109. package/internal/request-options.d.mts +75 -0
  110. package/internal/request-options.d.mts.map +1 -0
  111. package/internal/request-options.d.ts +75 -0
  112. package/internal/request-options.d.ts.map +1 -0
  113. package/internal/request-options.js +14 -0
  114. package/internal/request-options.js.map +1 -0
  115. package/internal/request-options.mjs +10 -0
  116. package/internal/request-options.mjs.map +1 -0
  117. package/internal/shim-types.d.mts +17 -0
  118. package/internal/shim-types.d.mts.map +1 -0
  119. package/internal/shim-types.d.ts +17 -0
  120. package/internal/shim-types.d.ts.map +1 -0
  121. package/internal/shim-types.js +4 -0
  122. package/internal/shim-types.js.map +1 -0
  123. package/internal/shim-types.mjs +3 -0
  124. package/internal/shim-types.mjs.map +1 -0
  125. package/internal/shims.d.mts +20 -0
  126. package/internal/shims.d.mts.map +1 -0
  127. package/internal/shims.d.ts +20 -0
  128. package/internal/shims.d.ts.map +1 -0
  129. package/internal/shims.js +92 -0
  130. package/internal/shims.js.map +1 -0
  131. package/internal/shims.mjs +85 -0
  132. package/internal/shims.mjs.map +1 -0
  133. package/internal/to-file.d.mts +45 -0
  134. package/internal/to-file.d.mts.map +1 -0
  135. package/internal/to-file.d.ts +45 -0
  136. package/internal/to-file.d.ts.map +1 -0
  137. package/internal/to-file.js +91 -0
  138. package/internal/to-file.js.map +1 -0
  139. package/internal/to-file.mjs +88 -0
  140. package/internal/to-file.mjs.map +1 -0
  141. package/internal/tslib.js +81 -0
  142. package/internal/tslib.mjs +17 -0
  143. package/internal/types.d.mts +69 -0
  144. package/internal/types.d.mts.map +1 -0
  145. package/internal/types.d.ts +69 -0
  146. package/internal/types.d.ts.map +1 -0
  147. package/internal/types.js +4 -0
  148. package/internal/types.js.map +1 -0
  149. package/internal/types.mjs +3 -0
  150. package/internal/types.mjs.map +1 -0
  151. package/internal/uploads.d.mts +42 -0
  152. package/internal/uploads.d.mts.map +1 -0
  153. package/internal/uploads.d.ts +42 -0
  154. package/internal/uploads.d.ts.map +1 -0
  155. package/internal/uploads.js +141 -0
  156. package/internal/uploads.js.map +1 -0
  157. package/internal/uploads.mjs +131 -0
  158. package/internal/uploads.mjs.map +1 -0
  159. package/internal/utils/base64.d.mts +3 -0
  160. package/internal/utils/base64.d.mts.map +1 -0
  161. package/internal/utils/base64.d.ts +3 -0
  162. package/internal/utils/base64.d.ts.map +1 -0
  163. package/internal/utils/base64.js +38 -0
  164. package/internal/utils/base64.js.map +1 -0
  165. package/internal/utils/base64.mjs +33 -0
  166. package/internal/utils/base64.mjs.map +1 -0
  167. package/internal/utils/bytes.d.mts +4 -0
  168. package/internal/utils/bytes.d.mts.map +1 -0
  169. package/internal/utils/bytes.d.ts +4 -0
  170. package/internal/utils/bytes.d.ts.map +1 -0
  171. package/internal/utils/bytes.js +31 -0
  172. package/internal/utils/bytes.js.map +1 -0
  173. package/internal/utils/bytes.mjs +26 -0
  174. package/internal/utils/bytes.mjs.map +1 -0
  175. package/internal/utils/env.d.mts +9 -0
  176. package/internal/utils/env.d.mts.map +1 -0
  177. package/internal/utils/env.d.ts +9 -0
  178. package/internal/utils/env.d.ts.map +1 -0
  179. package/internal/utils/env.js +22 -0
  180. package/internal/utils/env.js.map +1 -0
  181. package/internal/utils/env.mjs +18 -0
  182. package/internal/utils/env.mjs.map +1 -0
  183. package/internal/utils/log.d.mts +37 -0
  184. package/internal/utils/log.d.mts.map +1 -0
  185. package/internal/utils/log.d.ts +37 -0
  186. package/internal/utils/log.d.ts.map +1 -0
  187. package/internal/utils/log.js +86 -0
  188. package/internal/utils/log.js.map +1 -0
  189. package/internal/utils/log.mjs +80 -0
  190. package/internal/utils/log.mjs.map +1 -0
  191. package/internal/utils/path.d.mts +15 -0
  192. package/internal/utils/path.d.mts.map +1 -0
  193. package/internal/utils/path.d.ts +15 -0
  194. package/internal/utils/path.d.ts.map +1 -0
  195. package/internal/utils/path.js +79 -0
  196. package/internal/utils/path.js.map +1 -0
  197. package/internal/utils/path.mjs +74 -0
  198. package/internal/utils/path.mjs.map +1 -0
  199. package/internal/utils/query.d.mts +5 -0
  200. package/internal/utils/query.d.mts.map +1 -0
  201. package/internal/utils/query.js +2 -3
  202. package/internal/utils/query.js.map +1 -1
  203. package/internal/utils/query.mjs +1 -1
  204. package/internal/utils/query.mjs.map +1 -1
  205. package/internal/utils/sleep.d.mts +2 -0
  206. package/internal/utils/sleep.d.mts.map +1 -0
  207. package/internal/utils/sleep.d.ts +2 -0
  208. package/internal/utils/sleep.d.ts.map +1 -0
  209. package/internal/utils/sleep.js +7 -0
  210. package/internal/utils/sleep.js.map +1 -0
  211. package/internal/utils/sleep.mjs +3 -0
  212. package/internal/utils/sleep.mjs.map +1 -0
  213. package/internal/utils/uuid.d.mts +5 -0
  214. package/internal/utils/uuid.d.mts.map +1 -0
  215. package/internal/utils/uuid.d.ts +5 -0
  216. package/internal/utils/uuid.d.ts.map +1 -0
  217. package/internal/utils/uuid.js +19 -0
  218. package/internal/utils/uuid.js.map +1 -0
  219. package/internal/utils/uuid.mjs +15 -0
  220. package/internal/utils/uuid.mjs.map +1 -0
  221. package/internal/utils/values.d.mts +18 -0
  222. package/internal/utils/values.d.mts.map +1 -0
  223. package/internal/utils/values.d.ts +18 -0
  224. package/internal/utils/values.d.ts.map +1 -0
  225. package/internal/utils/values.js +112 -0
  226. package/internal/utils/values.js.map +1 -0
  227. package/internal/utils/values.mjs +94 -0
  228. package/internal/utils/values.mjs.map +1 -0
  229. package/internal/utils.d.mts +8 -0
  230. package/internal/utils.d.mts.map +1 -0
  231. package/internal/utils.d.ts +8 -0
  232. package/internal/utils.d.ts.map +1 -0
  233. package/internal/utils.js +12 -0
  234. package/internal/utils.js.map +1 -0
  235. package/internal/utils.mjs +9 -0
  236. package/internal/utils.mjs.map +1 -0
  237. package/package.json +114 -64
  238. package/resource.d.mts +2 -0
  239. package/resource.d.mts.map +1 -0
  240. package/resource.d.ts +1 -5
  241. package/resource.d.ts.map +1 -1
  242. package/resource.js +3 -8
  243. package/resource.js.map +1 -1
  244. package/resource.mjs +1 -6
  245. package/resource.mjs.map +1 -1
  246. package/resources/balance.d.mts +44 -0
  247. package/resources/balance.d.mts.map +1 -0
  248. package/resources/balance.d.ts +4 -3
  249. package/resources/balance.d.ts.map +1 -1
  250. package/resources/balance.js +1 -1
  251. package/resources/balance.js.map +1 -1
  252. package/resources/balance.mjs +1 -1
  253. package/resources/balance.mjs.map +1 -1
  254. package/resources/banks.d.mts +251 -0
  255. package/resources/banks.d.mts.map +1 -0
  256. package/resources/banks.d.ts +6 -5
  257. package/resources/banks.d.ts.map +1 -1
  258. package/resources/banks.js +1 -1
  259. package/resources/banks.js.map +1 -1
  260. package/resources/banks.mjs +1 -1
  261. package/resources/banks.mjs.map +1 -1
  262. package/resources/beneficiary-payouts.d.mts +64 -0
  263. package/resources/beneficiary-payouts.d.mts.map +1 -0
  264. package/resources/beneficiary-payouts.d.ts +4 -3
  265. package/resources/beneficiary-payouts.d.ts.map +1 -1
  266. package/resources/beneficiary-payouts.js +1 -1
  267. package/resources/beneficiary-payouts.js.map +1 -1
  268. package/resources/beneficiary-payouts.mjs +1 -1
  269. package/resources/beneficiary-payouts.mjs.map +1 -1
  270. package/resources/capabilities.d.mts +20 -0
  271. package/resources/capabilities.d.mts.map +1 -0
  272. package/resources/capabilities.d.ts +4 -3
  273. package/resources/capabilities.d.ts.map +1 -1
  274. package/resources/capabilities.js +1 -1
  275. package/resources/capabilities.js.map +1 -1
  276. package/resources/capabilities.mjs +1 -1
  277. package/resources/capabilities.mjs.map +1 -1
  278. package/resources/checkoutsession.d.mts +659 -0
  279. package/resources/checkoutsession.d.mts.map +1 -0
  280. package/resources/checkoutsession.d.ts +6 -5
  281. package/resources/checkoutsession.d.ts.map +1 -1
  282. package/resources/checkoutsession.js +1 -1
  283. package/resources/checkoutsession.js.map +1 -1
  284. package/resources/checkoutsession.mjs +1 -1
  285. package/resources/checkoutsession.mjs.map +1 -1
  286. package/resources/customers.d.mts +668 -0
  287. package/resources/customers.d.mts.map +1 -0
  288. package/resources/customers.d.ts +8 -7
  289. package/resources/customers.d.ts.map +1 -1
  290. package/resources/customers.js +1 -1
  291. package/resources/customers.js.map +1 -1
  292. package/resources/customers.mjs +1 -1
  293. package/resources/customers.mjs.map +1 -1
  294. package/resources/data/accounts.d.mts +95 -0
  295. package/resources/data/accounts.d.mts.map +1 -0
  296. package/resources/data/accounts.d.ts +4 -3
  297. package/resources/data/accounts.d.ts.map +1 -1
  298. package/resources/data/accounts.js +1 -1
  299. package/resources/data/accounts.js.map +1 -1
  300. package/resources/data/accounts.mjs +1 -1
  301. package/resources/data/accounts.mjs.map +1 -1
  302. package/resources/data/balances.d.mts +49 -0
  303. package/resources/data/balances.d.mts.map +1 -0
  304. package/resources/data/balances.d.ts +4 -3
  305. package/resources/data/balances.d.ts.map +1 -1
  306. package/resources/data/balances.js +1 -1
  307. package/resources/data/balances.js.map +1 -1
  308. package/resources/data/balances.mjs +1 -1
  309. package/resources/data/balances.mjs.map +1 -1
  310. package/resources/data/consent.d.mts +81 -0
  311. package/resources/data/consent.d.mts.map +1 -0
  312. package/resources/data/consent.d.ts +5 -4
  313. package/resources/data/consent.d.ts.map +1 -1
  314. package/resources/data/consent.js +1 -1
  315. package/resources/data/consent.js.map +1 -1
  316. package/resources/data/consent.mjs +1 -1
  317. package/resources/data/consent.mjs.map +1 -1
  318. package/resources/data/data.d.mts +26 -0
  319. package/resources/data/data.d.mts.map +1 -0
  320. package/resources/data/data.d.ts +1 -1
  321. package/resources/data/data.d.ts.map +1 -1
  322. package/resources/data/data.js +7 -29
  323. package/resources/data/data.js.map +1 -1
  324. package/resources/data/data.mjs +1 -1
  325. package/resources/data/index.d.mts +7 -0
  326. package/resources/data/index.d.mts.map +1 -0
  327. package/resources/data/index.d.ts.map +1 -1
  328. package/resources/data/session.d.mts +259 -0
  329. package/resources/data/session.d.mts.map +1 -0
  330. package/resources/data/session.d.ts +5 -4
  331. package/resources/data/session.d.ts.map +1 -1
  332. package/resources/data/session.js +1 -1
  333. package/resources/data/session.js.map +1 -1
  334. package/resources/data/session.mjs +1 -1
  335. package/resources/data/session.mjs.map +1 -1
  336. package/resources/data/transactions.d.mts +62 -0
  337. package/resources/data/transactions.d.mts.map +1 -0
  338. package/resources/data/transactions.d.ts +4 -3
  339. package/resources/data/transactions.d.ts.map +1 -1
  340. package/resources/data/transactions.js +1 -1
  341. package/resources/data/transactions.js.map +1 -1
  342. package/resources/data/transactions.mjs +1 -1
  343. package/resources/data/transactions.mjs.map +1 -1
  344. package/resources/data.d.mts +2 -0
  345. package/resources/data.d.mts.map +1 -0
  346. package/resources/data.d.ts.map +1 -1
  347. package/resources/data.js +2 -15
  348. package/resources/data.js.map +1 -1
  349. package/resources/deposits.d.mts +192 -0
  350. package/resources/deposits.d.mts.map +1 -0
  351. package/resources/deposits.d.ts +4 -3
  352. package/resources/deposits.d.ts.map +1 -1
  353. package/resources/deposits.js +1 -1
  354. package/resources/deposits.js.map +1 -1
  355. package/resources/deposits.mjs +1 -1
  356. package/resources/deposits.mjs.map +1 -1
  357. package/resources/fx.d.mts +155 -0
  358. package/resources/fx.d.mts.map +1 -0
  359. package/resources/fx.d.ts +6 -5
  360. package/resources/fx.d.ts.map +1 -1
  361. package/resources/fx.js +1 -1
  362. package/resources/fx.js.map +1 -1
  363. package/resources/fx.mjs +1 -1
  364. package/resources/fx.mjs.map +1 -1
  365. package/resources/index.d.mts +18 -0
  366. package/resources/index.d.mts.map +1 -0
  367. package/resources/index.d.ts.map +1 -1
  368. package/resources/orders.d.mts +1251 -0
  369. package/resources/orders.d.mts.map +1 -0
  370. package/resources/orders.d.ts +6 -5
  371. package/resources/orders.d.ts.map +1 -1
  372. package/resources/orders.js +1 -1
  373. package/resources/orders.js.map +1 -1
  374. package/resources/orders.mjs +1 -1
  375. package/resources/orders.mjs.map +1 -1
  376. package/resources/payee.d.mts +51 -0
  377. package/resources/payee.d.mts.map +1 -0
  378. package/resources/payee.d.ts +4 -3
  379. package/resources/payee.d.ts.map +1 -1
  380. package/resources/payee.js +1 -1
  381. package/resources/payee.js.map +1 -1
  382. package/resources/payee.mjs +1 -1
  383. package/resources/payee.mjs.map +1 -1
  384. package/resources/payouts.d.mts +459 -0
  385. package/resources/payouts.d.mts.map +1 -0
  386. package/resources/payouts.d.ts +6 -5
  387. package/resources/payouts.d.ts.map +1 -1
  388. package/resources/payouts.js +1 -1
  389. package/resources/payouts.js.map +1 -1
  390. package/resources/payouts.mjs +1 -1
  391. package/resources/payouts.mjs.map +1 -1
  392. package/resources/refunds.d.mts +97 -0
  393. package/resources/refunds.d.mts.map +1 -0
  394. package/resources/refunds.d.ts +5 -4
  395. package/resources/refunds.d.ts.map +1 -1
  396. package/resources/refunds.js +1 -1
  397. package/resources/refunds.js.map +1 -1
  398. package/resources/refunds.mjs +1 -1
  399. package/resources/refunds.mjs.map +1 -1
  400. package/resources/returns.d.mts +105 -0
  401. package/resources/returns.d.mts.map +1 -0
  402. package/resources/returns.d.ts +5 -4
  403. package/resources/returns.d.ts.map +1 -1
  404. package/resources/returns.js +1 -1
  405. package/resources/returns.js.map +1 -1
  406. package/resources/returns.mjs +1 -1
  407. package/resources/returns.mjs.map +1 -1
  408. package/resources/subaccounts.d.mts +60 -0
  409. package/resources/subaccounts.d.mts.map +1 -0
  410. package/resources/subaccounts.d.ts +5 -4
  411. package/resources/subaccounts.d.ts.map +1 -1
  412. package/resources/subaccounts.js +1 -1
  413. package/resources/subaccounts.js.map +1 -1
  414. package/resources/subaccounts.mjs +1 -1
  415. package/resources/subaccounts.mjs.map +1 -1
  416. package/resources/transactions.d.mts +198 -0
  417. package/resources/transactions.d.mts.map +1 -0
  418. package/resources/transactions.d.ts +4 -3
  419. package/resources/transactions.d.ts.map +1 -1
  420. package/resources/transactions.js +1 -1
  421. package/resources/transactions.js.map +1 -1
  422. package/resources/transactions.mjs +1 -1
  423. package/resources/transactions.mjs.map +1 -1
  424. package/resources/webhook/index.d.mts +3 -0
  425. package/resources/webhook/index.d.mts.map +1 -0
  426. package/resources/webhook/index.d.ts.map +1 -1
  427. package/resources/webhook/subscription.d.mts +153 -0
  428. package/resources/webhook/subscription.d.mts.map +1 -0
  429. package/resources/webhook/subscription.d.ts +8 -7
  430. package/resources/webhook/subscription.d.ts.map +1 -1
  431. package/resources/webhook/subscription.js +1 -1
  432. package/resources/webhook/subscription.js.map +1 -1
  433. package/resources/webhook/subscription.mjs +1 -1
  434. package/resources/webhook/subscription.mjs.map +1 -1
  435. package/resources/webhook/webhook.d.mts +29 -0
  436. package/resources/webhook/webhook.d.mts.map +1 -0
  437. package/resources/webhook/webhook.d.ts +4 -3
  438. package/resources/webhook/webhook.d.ts.map +1 -1
  439. package/resources/webhook/webhook.js +3 -25
  440. package/resources/webhook/webhook.js.map +1 -1
  441. package/resources/webhook/webhook.mjs +1 -1
  442. package/resources/webhook/webhook.mjs.map +1 -1
  443. package/resources/webhook.d.mts +2 -0
  444. package/resources/webhook.d.mts.map +1 -0
  445. package/resources/webhook.d.ts.map +1 -1
  446. package/resources/webhook.js +2 -15
  447. package/resources/webhook.js.map +1 -1
  448. package/resources.d.mts +2 -0
  449. package/resources.d.mts.map +1 -0
  450. package/resources.d.ts.map +1 -1
  451. package/resources.js +2 -15
  452. package/resources.js.map +1 -1
  453. package/src/api-promise.ts +2 -0
  454. package/src/client.ts +1002 -0
  455. package/src/core/README.md +3 -0
  456. package/src/core/api-promise.ts +89 -0
  457. package/src/core/error.ts +130 -0
  458. package/src/core/resource.ts +11 -0
  459. package/src/core/uploads.ts +2 -0
  460. package/src/error.ts +2 -130
  461. package/src/index.ts +5 -450
  462. package/src/internal/README.md +3 -0
  463. package/src/internal/builtin-types.ts +93 -0
  464. package/src/internal/detect-platform.ts +196 -0
  465. package/src/internal/errors.ts +33 -0
  466. package/src/internal/headers.ts +97 -0
  467. package/src/internal/parse.ts +56 -0
  468. package/src/internal/request-options.ts +91 -0
  469. package/src/internal/shim-types.ts +26 -0
  470. package/src/internal/shims.ts +107 -0
  471. package/src/internal/to-file.ts +154 -0
  472. package/src/internal/types.ts +95 -0
  473. package/src/internal/uploads.ts +187 -0
  474. package/src/internal/utils/base64.ts +40 -0
  475. package/src/internal/utils/bytes.ts +32 -0
  476. package/src/internal/utils/env.ts +18 -0
  477. package/src/internal/utils/log.ts +127 -0
  478. package/src/internal/utils/path.ts +88 -0
  479. package/src/internal/utils/query.ts +1 -1
  480. package/src/internal/utils/sleep.ts +3 -0
  481. package/src/internal/utils/uuid.ts +17 -0
  482. package/src/internal/utils/values.ts +105 -0
  483. package/src/internal/utils.ts +9 -0
  484. package/src/resource.ts +2 -11
  485. package/src/resources/balance.ts +4 -6
  486. package/src/resources/banks.ts +6 -5
  487. package/src/resources/beneficiary-payouts.ts +4 -3
  488. package/src/resources/capabilities.ts +4 -6
  489. package/src/resources/checkoutsession.ts +9 -8
  490. package/src/resources/customers.ts +8 -10
  491. package/src/resources/data/accounts.ts +4 -3
  492. package/src/resources/data/balances.ts +4 -3
  493. package/src/resources/data/consent.ts +5 -7
  494. package/src/resources/data/data.ts +1 -1
  495. package/src/resources/data/session.ts +5 -7
  496. package/src/resources/data/transactions.ts +4 -3
  497. package/src/resources/deposits.ts +4 -6
  498. package/src/resources/fx.ts +6 -8
  499. package/src/resources/orders.ts +6 -5
  500. package/src/resources/payee.ts +4 -3
  501. package/src/resources/payouts.ts +6 -8
  502. package/src/resources/refunds.ts +5 -4
  503. package/src/resources/returns.ts +5 -7
  504. package/src/resources/subaccounts.ts +5 -7
  505. package/src/resources/transactions.ts +4 -3
  506. package/src/resources/webhook/subscription.ts +8 -22
  507. package/src/resources/webhook/webhook.ts +4 -6
  508. package/src/tsconfig.json +2 -2
  509. package/src/uploads.ts +2 -255
  510. package/src/version.ts +1 -1
  511. package/uploads.d.mts +2 -0
  512. package/uploads.d.mts.map +1 -0
  513. package/uploads.d.ts +1 -74
  514. package/uploads.d.ts.map +1 -1
  515. package/uploads.js +3 -168
  516. package/uploads.js.map +1 -1
  517. package/uploads.mjs +1 -157
  518. package/uploads.mjs.map +1 -1
  519. package/version.d.mts +2 -0
  520. package/version.d.mts.map +1 -0
  521. package/version.d.ts +1 -1
  522. package/version.js +1 -1
  523. package/version.mjs +1 -1
  524. package/_shims/MultipartBody.d.ts +0 -9
  525. package/_shims/MultipartBody.d.ts.map +0 -1
  526. package/_shims/MultipartBody.js +0 -16
  527. package/_shims/MultipartBody.js.map +0 -1
  528. package/_shims/MultipartBody.mjs +0 -12
  529. package/_shims/MultipartBody.mjs.map +0 -1
  530. package/_shims/README.md +0 -46
  531. package/_shims/auto/runtime-bun.d.ts +0 -5
  532. package/_shims/auto/runtime-bun.d.ts.map +0 -1
  533. package/_shims/auto/runtime-bun.js +0 -21
  534. package/_shims/auto/runtime-bun.js.map +0 -1
  535. package/_shims/auto/runtime-bun.mjs +0 -2
  536. package/_shims/auto/runtime-bun.mjs.map +0 -1
  537. package/_shims/auto/runtime-node.d.ts +0 -5
  538. package/_shims/auto/runtime-node.d.ts.map +0 -1
  539. package/_shims/auto/runtime-node.js +0 -21
  540. package/_shims/auto/runtime-node.js.map +0 -1
  541. package/_shims/auto/runtime-node.mjs +0 -2
  542. package/_shims/auto/runtime-node.mjs.map +0 -1
  543. package/_shims/auto/runtime.d.ts +0 -5
  544. package/_shims/auto/runtime.d.ts.map +0 -1
  545. package/_shims/auto/runtime.js +0 -21
  546. package/_shims/auto/runtime.js.map +0 -1
  547. package/_shims/auto/runtime.mjs +0 -2
  548. package/_shims/auto/runtime.mjs.map +0 -1
  549. package/_shims/auto/types-node.d.ts +0 -5
  550. package/_shims/auto/types-node.d.ts.map +0 -1
  551. package/_shims/auto/types-node.js +0 -21
  552. package/_shims/auto/types-node.js.map +0 -1
  553. package/_shims/auto/types-node.mjs +0 -2
  554. package/_shims/auto/types-node.mjs.map +0 -1
  555. package/_shims/auto/types.d.ts +0 -101
  556. package/_shims/auto/types.js +0 -3
  557. package/_shims/auto/types.mjs +0 -3
  558. package/_shims/bun-runtime.d.ts +0 -6
  559. package/_shims/bun-runtime.d.ts.map +0 -1
  560. package/_shims/bun-runtime.js +0 -14
  561. package/_shims/bun-runtime.js.map +0 -1
  562. package/_shims/bun-runtime.mjs +0 -10
  563. package/_shims/bun-runtime.mjs.map +0 -1
  564. package/_shims/index.d.ts +0 -83
  565. package/_shims/index.js +0 -17
  566. package/_shims/index.mjs +0 -11
  567. package/_shims/manual-types.d.ts +0 -12
  568. package/_shims/manual-types.js +0 -3
  569. package/_shims/manual-types.mjs +0 -3
  570. package/_shims/node-runtime.d.ts +0 -3
  571. package/_shims/node-runtime.d.ts.map +0 -1
  572. package/_shims/node-runtime.js +0 -89
  573. package/_shims/node-runtime.js.map +0 -1
  574. package/_shims/node-runtime.mjs +0 -56
  575. package/_shims/node-runtime.mjs.map +0 -1
  576. package/_shims/node-types.d.ts +0 -42
  577. package/_shims/node-types.js +0 -3
  578. package/_shims/node-types.mjs +0 -3
  579. package/_shims/registry.d.ts +0 -37
  580. package/_shims/registry.d.ts.map +0 -1
  581. package/_shims/registry.js +0 -41
  582. package/_shims/registry.js.map +0 -1
  583. package/_shims/registry.mjs +0 -37
  584. package/_shims/registry.mjs.map +0 -1
  585. package/_shims/web-runtime.d.ts +0 -5
  586. package/_shims/web-runtime.d.ts.map +0 -1
  587. package/_shims/web-runtime.js +0 -78
  588. package/_shims/web-runtime.js.map +0 -1
  589. package/_shims/web-runtime.mjs +0 -71
  590. package/_shims/web-runtime.mjs.map +0 -1
  591. package/_shims/web-types.d.ts +0 -83
  592. package/_shims/web-types.js +0 -3
  593. package/_shims/web-types.mjs +0 -3
  594. package/core.d.ts +0 -255
  595. package/core.d.ts.map +0 -1
  596. package/core.js +0 -920
  597. package/core.js.map +0 -1
  598. package/core.mjs +0 -888
  599. package/core.mjs.map +0 -1
  600. package/shims/node.d.ts +0 -30
  601. package/shims/node.d.ts.map +0 -1
  602. package/shims/node.js +0 -31
  603. package/shims/node.js.map +0 -1
  604. package/shims/node.mjs +0 -5
  605. package/shims/node.mjs.map +0 -1
  606. package/shims/web.d.ts +0 -26
  607. package/shims/web.d.ts.map +0 -1
  608. package/shims/web.js +0 -31
  609. package/shims/web.js.map +0 -1
  610. package/shims/web.mjs +0 -5
  611. package/shims/web.mjs.map +0 -1
  612. package/src/_shims/MultipartBody.ts +0 -9
  613. package/src/_shims/README.md +0 -46
  614. package/src/_shims/auto/runtime-bun.ts +0 -4
  615. package/src/_shims/auto/runtime-node.ts +0 -4
  616. package/src/_shims/auto/runtime.ts +0 -4
  617. package/src/_shims/auto/types-node.ts +0 -4
  618. package/src/_shims/auto/types.d.ts +0 -101
  619. package/src/_shims/auto/types.js +0 -3
  620. package/src/_shims/auto/types.mjs +0 -3
  621. package/src/_shims/bun-runtime.ts +0 -14
  622. package/src/_shims/index.d.ts +0 -83
  623. package/src/_shims/index.js +0 -17
  624. package/src/_shims/index.mjs +0 -11
  625. package/src/_shims/manual-types.d.ts +0 -12
  626. package/src/_shims/manual-types.js +0 -3
  627. package/src/_shims/manual-types.mjs +0 -3
  628. package/src/_shims/node-runtime.ts +0 -81
  629. package/src/_shims/node-types.d.ts +0 -42
  630. package/src/_shims/node-types.js +0 -3
  631. package/src/_shims/node-types.mjs +0 -3
  632. package/src/_shims/registry.ts +0 -67
  633. package/src/_shims/web-runtime.ts +0 -103
  634. package/src/_shims/web-types.d.ts +0 -83
  635. package/src/_shims/web-types.js +0 -3
  636. package/src/_shims/web-types.mjs +0 -3
  637. package/src/core.ts +0 -1231
  638. package/src/shims/node.ts +0 -50
  639. package/src/shims/web.ts +0 -50
package/client.mjs ADDED
@@ -0,0 +1,520 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ var _Ivy_instances, _a, _Ivy_encoder, _Ivy_baseURLOverridden;
3
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "./internal/tslib.mjs";
4
+ import { uuid4 } from "./internal/utils/uuid.mjs";
5
+ import { validatePositiveInteger, isAbsoluteURL, safeJSON } from "./internal/utils/values.mjs";
6
+ import { sleep } from "./internal/utils/sleep.mjs";
7
+ import { castToError, isAbortError } from "./internal/errors.mjs";
8
+ import { getPlatformHeaders } from "./internal/detect-platform.mjs";
9
+ import * as Shims from "./internal/shims.mjs";
10
+ import * as Opts from "./internal/request-options.mjs";
11
+ import { stringifyQuery } from "./internal/utils/query.mjs";
12
+ import { VERSION } from "./version.mjs";
13
+ import * as Errors from "./core/error.mjs";
14
+ import * as Uploads from "./core/uploads.mjs";
15
+ import * as API from "./resources/index.mjs";
16
+ import { APIPromise } from "./core/api-promise.mjs";
17
+ import { Balance } from "./resources/balance.mjs";
18
+ import { Banks, } from "./resources/banks.mjs";
19
+ import { BeneficiaryPayouts } from "./resources/beneficiary-payouts.mjs";
20
+ import { Capabilities } from "./resources/capabilities.mjs";
21
+ import { Checkoutsession, } from "./resources/checkoutsession.mjs";
22
+ import { Customers, } from "./resources/customers.mjs";
23
+ import { Deposits } from "./resources/deposits.mjs";
24
+ import { Fx, } from "./resources/fx.mjs";
25
+ import { Orders, } from "./resources/orders.mjs";
26
+ import { Payee } from "./resources/payee.mjs";
27
+ import { Payouts, } from "./resources/payouts.mjs";
28
+ import { Refunds, } from "./resources/refunds.mjs";
29
+ import { Returns, } from "./resources/returns.mjs";
30
+ import { Subaccounts, } from "./resources/subaccounts.mjs";
31
+ import { Transactions } from "./resources/transactions.mjs";
32
+ import { Data } from "./resources/data/data.mjs";
33
+ import { Webhook } from "./resources/webhook/webhook.mjs";
34
+ import { buildHeaders } from "./internal/headers.mjs";
35
+ import { readEnv } from "./internal/utils/env.mjs";
36
+ import { formatRequestDetails, loggerFor, parseLogLevel, } from "./internal/utils/log.mjs";
37
+ import { isEmptyObj } from "./internal/utils/values.mjs";
38
+ const environments = {
39
+ production: 'https://api.getivy.de',
40
+ sandbox: 'https://api.sand.getivy.de',
41
+ };
42
+ /**
43
+ * API Client for interfacing with the Ivy API.
44
+ */
45
+ export class Ivy {
46
+ /**
47
+ * API Client for interfacing with the Ivy API.
48
+ *
49
+ * @param {string | undefined} [opts.apiKey=process.env['IVY_API_KEY'] ?? undefined]
50
+ * @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
51
+ * @param {string} [opts.baseURL=process.env['IVY_BASE_URL'] ?? https://api.getivy.de] - Override the default base URL for the API.
52
+ * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
53
+ * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
54
+ * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
55
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
56
+ * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
57
+ * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
58
+ */
59
+ constructor({ baseURL = readEnv('IVY_BASE_URL'), apiKey = readEnv('IVY_API_KEY'), ...opts } = {}) {
60
+ _Ivy_instances.add(this);
61
+ _Ivy_encoder.set(this, void 0);
62
+ this.banks = new API.Banks(this);
63
+ this.checkoutsession = new API.Checkoutsession(this);
64
+ this.data = new API.Data(this);
65
+ this.customers = new API.Customers(this);
66
+ this.orders = new API.Orders(this);
67
+ this.deposits = new API.Deposits(this);
68
+ this.returns = new API.Returns(this);
69
+ this.fx = new API.Fx(this);
70
+ this.beneficiaryPayouts = new API.BeneficiaryPayouts(this);
71
+ this.transactions = new API.Transactions(this);
72
+ this.capabilities = new API.Capabilities(this);
73
+ this.refunds = new API.Refunds(this);
74
+ this.payouts = new API.Payouts(this);
75
+ this.subaccounts = new API.Subaccounts(this);
76
+ this.balance = new API.Balance(this);
77
+ this.webhook = new API.Webhook(this);
78
+ this.payee = new API.Payee(this);
79
+ if (apiKey === undefined) {
80
+ throw new Errors.IvyError("The IVY_API_KEY environment variable is missing or empty; either provide it, or instantiate the Ivy client with an apiKey option, like new Ivy({ apiKey: 'My API Key' }).");
81
+ }
82
+ const options = {
83
+ apiKey,
84
+ ...opts,
85
+ baseURL,
86
+ environment: opts.environment ?? 'production',
87
+ };
88
+ if (baseURL && opts.environment) {
89
+ throw new Errors.IvyError('Ambiguous URL; The `baseURL` option (or IVY_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null');
90
+ }
91
+ this.baseURL = options.baseURL || environments[options.environment || 'production'];
92
+ this.timeout = options.timeout ?? _a.DEFAULT_TIMEOUT /* 1 minute */;
93
+ this.logger = options.logger ?? console;
94
+ const defaultLogLevel = 'warn';
95
+ // Set default logLevel early so that we can log a warning in parseLogLevel.
96
+ this.logLevel = defaultLogLevel;
97
+ this.logLevel =
98
+ parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ??
99
+ parseLogLevel(readEnv('IVY_LOG'), "process.env['IVY_LOG']", this) ??
100
+ defaultLogLevel;
101
+ this.fetchOptions = options.fetchOptions;
102
+ this.maxRetries = options.maxRetries ?? 2;
103
+ this.fetch = options.fetch ?? Shims.getDefaultFetch();
104
+ __classPrivateFieldSet(this, _Ivy_encoder, Opts.FallbackEncoder, "f");
105
+ this._options = options;
106
+ this.idempotencyHeader = 'Idempotency-Key';
107
+ this.apiKey = apiKey;
108
+ }
109
+ /**
110
+ * Create a new client instance re-using the same options given to the current client with optional overriding.
111
+ */
112
+ withOptions(options) {
113
+ const client = new this.constructor({
114
+ ...this._options,
115
+ environment: options.environment ? options.environment : undefined,
116
+ baseURL: options.environment ? undefined : this.baseURL,
117
+ maxRetries: this.maxRetries,
118
+ timeout: this.timeout,
119
+ logger: this.logger,
120
+ logLevel: this.logLevel,
121
+ fetch: this.fetch,
122
+ fetchOptions: this.fetchOptions,
123
+ apiKey: this.apiKey,
124
+ ...options,
125
+ });
126
+ return client;
127
+ }
128
+ defaultQuery() {
129
+ return this._options.defaultQuery;
130
+ }
131
+ validateHeaders({ values, nulls }) {
132
+ return;
133
+ }
134
+ async authHeaders(opts) {
135
+ return buildHeaders([{ 'X-Ivy-Api-Key': this.apiKey }]);
136
+ }
137
+ /**
138
+ * Basic re-implementation of `qs.stringify` for primitive types.
139
+ */
140
+ stringifyQuery(query) {
141
+ return stringifyQuery(query);
142
+ }
143
+ getUserAgent() {
144
+ return `${this.constructor.name}/JS ${VERSION}`;
145
+ }
146
+ defaultIdempotencyKey() {
147
+ return `stainless-node-retry-${uuid4()}`;
148
+ }
149
+ makeStatusError(status, error, message, headers) {
150
+ return Errors.APIError.generate(status, error, message, headers);
151
+ }
152
+ buildURL(path, query, defaultBaseURL) {
153
+ const baseURL = (!__classPrivateFieldGet(this, _Ivy_instances, "m", _Ivy_baseURLOverridden).call(this) && defaultBaseURL) || this.baseURL;
154
+ const url = isAbsoluteURL(path) ?
155
+ new URL(path)
156
+ : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
157
+ const defaultQuery = this.defaultQuery();
158
+ const pathQuery = Object.fromEntries(url.searchParams);
159
+ if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
160
+ query = { ...pathQuery, ...defaultQuery, ...query };
161
+ }
162
+ if (typeof query === 'object' && query && !Array.isArray(query)) {
163
+ url.search = this.stringifyQuery(query);
164
+ }
165
+ return url.toString();
166
+ }
167
+ /**
168
+ * Used as a callback for mutating the given `FinalRequestOptions` object.
169
+ */
170
+ async prepareOptions(options) { }
171
+ /**
172
+ * Used as a callback for mutating the given `RequestInit` object.
173
+ *
174
+ * This is useful for cases where you want to add certain headers based off of
175
+ * the request properties, e.g. `method` or `url`.
176
+ */
177
+ async prepareRequest(request, { url, options }) { }
178
+ get(path, opts) {
179
+ return this.methodRequest('get', path, opts);
180
+ }
181
+ post(path, opts) {
182
+ return this.methodRequest('post', path, opts);
183
+ }
184
+ patch(path, opts) {
185
+ return this.methodRequest('patch', path, opts);
186
+ }
187
+ put(path, opts) {
188
+ return this.methodRequest('put', path, opts);
189
+ }
190
+ delete(path, opts) {
191
+ return this.methodRequest('delete', path, opts);
192
+ }
193
+ methodRequest(method, path, opts) {
194
+ return this.request(Promise.resolve(opts).then((opts) => {
195
+ return { method, path, ...opts };
196
+ }));
197
+ }
198
+ request(options, remainingRetries = null) {
199
+ return new APIPromise(this, this.makeRequest(options, remainingRetries, undefined));
200
+ }
201
+ async makeRequest(optionsInput, retriesRemaining, retryOfRequestLogID) {
202
+ const options = await optionsInput;
203
+ const maxRetries = options.maxRetries ?? this.maxRetries;
204
+ if (retriesRemaining == null) {
205
+ retriesRemaining = maxRetries;
206
+ }
207
+ await this.prepareOptions(options);
208
+ const { req, url, timeout } = await this.buildRequest(options, {
209
+ retryCount: maxRetries - retriesRemaining,
210
+ });
211
+ await this.prepareRequest(req, { url, options });
212
+ /** Not an API request ID, just for correlating local log entries. */
213
+ const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0');
214
+ const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`;
215
+ const startTime = Date.now();
216
+ loggerFor(this).debug(`[${requestLogID}] sending request`, formatRequestDetails({
217
+ retryOfRequestLogID,
218
+ method: options.method,
219
+ url,
220
+ options,
221
+ headers: req.headers,
222
+ }));
223
+ if (options.signal?.aborted) {
224
+ throw new Errors.APIUserAbortError();
225
+ }
226
+ const controller = new AbortController();
227
+ const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
228
+ const headersTime = Date.now();
229
+ if (response instanceof globalThis.Error) {
230
+ const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
231
+ if (options.signal?.aborted) {
232
+ throw new Errors.APIUserAbortError();
233
+ }
234
+ // detect native connection timeout errors
235
+ // deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)"
236
+ // undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)"
237
+ // others do not provide enough information to distinguish timeouts from other connection errors
238
+ const isTimeout = isAbortError(response) ||
239
+ /timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''));
240
+ if (retriesRemaining) {
241
+ loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`);
242
+ loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, formatRequestDetails({
243
+ retryOfRequestLogID,
244
+ url,
245
+ durationMs: headersTime - startTime,
246
+ message: response.message,
247
+ }));
248
+ return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID);
249
+ }
250
+ loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`);
251
+ loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`, formatRequestDetails({
252
+ retryOfRequestLogID,
253
+ url,
254
+ durationMs: headersTime - startTime,
255
+ message: response.message,
256
+ }));
257
+ if (isTimeout) {
258
+ throw new Errors.APIConnectionTimeoutError();
259
+ }
260
+ throw new Errors.APIConnectionError({ cause: response });
261
+ }
262
+ const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${response.ok ? 'succeeded' : 'failed'} with status ${response.status} in ${headersTime - startTime}ms`;
263
+ if (!response.ok) {
264
+ const shouldRetry = await this.shouldRetry(response);
265
+ if (retriesRemaining && shouldRetry) {
266
+ const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
267
+ // We don't need the body of this response.
268
+ await Shims.CancelReadableStream(response.body);
269
+ loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
270
+ loggerFor(this).debug(`[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({
271
+ retryOfRequestLogID,
272
+ url: response.url,
273
+ status: response.status,
274
+ headers: response.headers,
275
+ durationMs: headersTime - startTime,
276
+ }));
277
+ return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID, response.headers);
278
+ }
279
+ const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`;
280
+ loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
281
+ const errText = await response.text().catch((err) => castToError(err).message);
282
+ const errJSON = safeJSON(errText);
283
+ const errMessage = errJSON ? undefined : errText;
284
+ loggerFor(this).debug(`[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({
285
+ retryOfRequestLogID,
286
+ url: response.url,
287
+ status: response.status,
288
+ headers: response.headers,
289
+ message: errMessage,
290
+ durationMs: Date.now() - startTime,
291
+ }));
292
+ const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers);
293
+ throw err;
294
+ }
295
+ loggerFor(this).info(responseInfo);
296
+ loggerFor(this).debug(`[${requestLogID}] response start`, formatRequestDetails({
297
+ retryOfRequestLogID,
298
+ url: response.url,
299
+ status: response.status,
300
+ headers: response.headers,
301
+ durationMs: headersTime - startTime,
302
+ }));
303
+ return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
304
+ }
305
+ async fetchWithTimeout(url, init, ms, controller) {
306
+ const { signal, method, ...options } = init || {};
307
+ const abort = this._makeAbort(controller);
308
+ if (signal)
309
+ signal.addEventListener('abort', abort, { once: true });
310
+ const timeout = setTimeout(abort, ms);
311
+ const isReadableBody = (globalThis.ReadableStream && options.body instanceof globalThis.ReadableStream) ||
312
+ (typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
313
+ const fetchOptions = {
314
+ signal: controller.signal,
315
+ ...(isReadableBody ? { duplex: 'half' } : {}),
316
+ method: 'GET',
317
+ ...options,
318
+ };
319
+ if (method) {
320
+ // Custom methods like 'patch' need to be uppercased
321
+ // See https://github.com/nodejs/undici/issues/2294
322
+ fetchOptions.method = method.toUpperCase();
323
+ }
324
+ try {
325
+ // use undefined this binding; fetch errors if bound to something else in browser/cloudflare
326
+ return await this.fetch.call(undefined, url, fetchOptions);
327
+ }
328
+ finally {
329
+ clearTimeout(timeout);
330
+ }
331
+ }
332
+ async shouldRetry(response) {
333
+ // Note this is not a standard header.
334
+ const shouldRetryHeader = response.headers.get('x-should-retry');
335
+ // If the server explicitly says whether or not to retry, obey.
336
+ if (shouldRetryHeader === 'true')
337
+ return true;
338
+ if (shouldRetryHeader === 'false')
339
+ return false;
340
+ // Retry on request timeouts.
341
+ if (response.status === 408)
342
+ return true;
343
+ // Retry on lock timeouts.
344
+ if (response.status === 409)
345
+ return true;
346
+ // Retry on rate limits.
347
+ if (response.status === 429)
348
+ return true;
349
+ // Retry internal errors.
350
+ if (response.status >= 500)
351
+ return true;
352
+ return false;
353
+ }
354
+ async retryRequest(options, retriesRemaining, requestLogID, responseHeaders) {
355
+ let timeoutMillis;
356
+ // Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it.
357
+ const retryAfterMillisHeader = responseHeaders?.get('retry-after-ms');
358
+ if (retryAfterMillisHeader) {
359
+ const timeoutMs = parseFloat(retryAfterMillisHeader);
360
+ if (!Number.isNaN(timeoutMs)) {
361
+ timeoutMillis = timeoutMs;
362
+ }
363
+ }
364
+ // About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
365
+ const retryAfterHeader = responseHeaders?.get('retry-after');
366
+ if (retryAfterHeader && !timeoutMillis) {
367
+ const timeoutSeconds = parseFloat(retryAfterHeader);
368
+ if (!Number.isNaN(timeoutSeconds)) {
369
+ timeoutMillis = timeoutSeconds * 1000;
370
+ }
371
+ else {
372
+ timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
373
+ }
374
+ }
375
+ // If the API asks us to wait a certain amount of time, just do what it
376
+ // says, but otherwise calculate a default
377
+ if (timeoutMillis === undefined) {
378
+ const maxRetries = options.maxRetries ?? this.maxRetries;
379
+ timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
380
+ }
381
+ await sleep(timeoutMillis);
382
+ return this.makeRequest(options, retriesRemaining - 1, requestLogID);
383
+ }
384
+ calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries) {
385
+ const initialRetryDelay = 0.5;
386
+ const maxRetryDelay = 8.0;
387
+ const numRetries = maxRetries - retriesRemaining;
388
+ // Apply exponential backoff, but not more than the max.
389
+ const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay);
390
+ // Apply some jitter, take up to at most 25 percent of the retry time.
391
+ const jitter = 1 - Math.random() * 0.25;
392
+ return sleepSeconds * jitter * 1000;
393
+ }
394
+ async buildRequest(inputOptions, { retryCount = 0 } = {}) {
395
+ const options = { ...inputOptions };
396
+ const { method, path, query, defaultBaseURL } = options;
397
+ const url = this.buildURL(path, query, defaultBaseURL);
398
+ if ('timeout' in options)
399
+ validatePositiveInteger('timeout', options.timeout);
400
+ options.timeout = options.timeout ?? this.timeout;
401
+ const { bodyHeaders, body } = this.buildBody({ options });
402
+ const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
403
+ const req = {
404
+ method,
405
+ headers: reqHeaders,
406
+ ...(options.signal && { signal: options.signal }),
407
+ ...(globalThis.ReadableStream &&
408
+ body instanceof globalThis.ReadableStream && { duplex: 'half' }),
409
+ ...(body && { body }),
410
+ ...(this.fetchOptions ?? {}),
411
+ ...(options.fetchOptions ?? {}),
412
+ };
413
+ return { req, url, timeout: options.timeout };
414
+ }
415
+ async buildHeaders({ options, method, bodyHeaders, retryCount, }) {
416
+ let idempotencyHeaders = {};
417
+ if (this.idempotencyHeader && method !== 'get') {
418
+ if (!options.idempotencyKey)
419
+ options.idempotencyKey = this.defaultIdempotencyKey();
420
+ idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
421
+ }
422
+ const headers = buildHeaders([
423
+ idempotencyHeaders,
424
+ {
425
+ Accept: 'application/json',
426
+ 'User-Agent': this.getUserAgent(),
427
+ 'X-Stainless-Retry-Count': String(retryCount),
428
+ ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
429
+ ...getPlatformHeaders(),
430
+ },
431
+ await this.authHeaders(options),
432
+ this._options.defaultHeaders,
433
+ bodyHeaders,
434
+ options.headers,
435
+ ]);
436
+ this.validateHeaders(headers);
437
+ return headers.values;
438
+ }
439
+ _makeAbort(controller) {
440
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
441
+ // would capture all request options, and cause a memory leak.
442
+ return () => controller.abort();
443
+ }
444
+ buildBody({ options: { body, headers: rawHeaders } }) {
445
+ if (!body) {
446
+ return { bodyHeaders: undefined, body: undefined };
447
+ }
448
+ const headers = buildHeaders([rawHeaders]);
449
+ if (
450
+ // Pass raw type verbatim
451
+ ArrayBuffer.isView(body) ||
452
+ body instanceof ArrayBuffer ||
453
+ body instanceof DataView ||
454
+ (typeof body === 'string' &&
455
+ // Preserve legacy string encoding behavior for now
456
+ headers.values.has('content-type')) ||
457
+ // `Blob` is superset of `File`
458
+ (globalThis.Blob && body instanceof globalThis.Blob) ||
459
+ // `FormData` -> `multipart/form-data`
460
+ body instanceof FormData ||
461
+ // `URLSearchParams` -> `application/x-www-form-urlencoded`
462
+ body instanceof URLSearchParams ||
463
+ // Send chunked stream (each chunk has own `length`)
464
+ (globalThis.ReadableStream && body instanceof globalThis.ReadableStream)) {
465
+ return { bodyHeaders: undefined, body: body };
466
+ }
467
+ else if (typeof body === 'object' &&
468
+ (Symbol.asyncIterator in body ||
469
+ (Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))) {
470
+ return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body) };
471
+ }
472
+ else if (typeof body === 'object' &&
473
+ headers.values.get('content-type') === 'application/x-www-form-urlencoded') {
474
+ return {
475
+ bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
476
+ body: this.stringifyQuery(body),
477
+ };
478
+ }
479
+ else {
480
+ return __classPrivateFieldGet(this, _Ivy_encoder, "f").call(this, { body, headers });
481
+ }
482
+ }
483
+ }
484
+ _a = Ivy, _Ivy_encoder = new WeakMap(), _Ivy_instances = new WeakSet(), _Ivy_baseURLOverridden = function _Ivy_baseURLOverridden() {
485
+ return this.baseURL !== environments[this._options.environment || 'production'];
486
+ };
487
+ Ivy.Ivy = _a;
488
+ Ivy.DEFAULT_TIMEOUT = 60000; // 1 minute
489
+ Ivy.IvyError = Errors.IvyError;
490
+ Ivy.APIError = Errors.APIError;
491
+ Ivy.APIConnectionError = Errors.APIConnectionError;
492
+ Ivy.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
493
+ Ivy.APIUserAbortError = Errors.APIUserAbortError;
494
+ Ivy.NotFoundError = Errors.NotFoundError;
495
+ Ivy.ConflictError = Errors.ConflictError;
496
+ Ivy.RateLimitError = Errors.RateLimitError;
497
+ Ivy.BadRequestError = Errors.BadRequestError;
498
+ Ivy.AuthenticationError = Errors.AuthenticationError;
499
+ Ivy.InternalServerError = Errors.InternalServerError;
500
+ Ivy.PermissionDeniedError = Errors.PermissionDeniedError;
501
+ Ivy.UnprocessableEntityError = Errors.UnprocessableEntityError;
502
+ Ivy.toFile = Uploads.toFile;
503
+ Ivy.Banks = Banks;
504
+ Ivy.Checkoutsession = Checkoutsession;
505
+ Ivy.Data = Data;
506
+ Ivy.Customers = Customers;
507
+ Ivy.Orders = Orders;
508
+ Ivy.Deposits = Deposits;
509
+ Ivy.Returns = Returns;
510
+ Ivy.Fx = Fx;
511
+ Ivy.BeneficiaryPayouts = BeneficiaryPayouts;
512
+ Ivy.Transactions = Transactions;
513
+ Ivy.Capabilities = Capabilities;
514
+ Ivy.Refunds = Refunds;
515
+ Ivy.Payouts = Payouts;
516
+ Ivy.Subaccounts = Subaccounts;
517
+ Ivy.Balance = Balance;
518
+ Ivy.Webhook = Webhook;
519
+ Ivy.Payee = Payee;
520
+ //# sourceMappingURL=client.mjs.map
package/client.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version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OAAO,CAAC;AACtB,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;AACtB,GAAG,CAAC,WAAW,GAAG,WAAW,CAAC;AAC9B,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;AACtB,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;AACtB,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { type Ivy } from "../client.mjs";
2
+ import { type PromiseOrValue } from "../internal/types.mjs";
3
+ import { APIResponseProps } from "../internal/parse.mjs";
4
+ /**
5
+ * A subclass of `Promise` providing additional helper methods
6
+ * for interacting with the SDK.
7
+ */
8
+ export declare class APIPromise<T> extends Promise<T> {
9
+ #private;
10
+ private responsePromise;
11
+ private parseResponse;
12
+ private parsedPromise;
13
+ constructor(client: Ivy, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: Ivy, props: APIResponseProps) => PromiseOrValue<T>);
14
+ _thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U>;
15
+ /**
16
+ * Gets the raw `Response` instance instead of parsing the response
17
+ * data.
18
+ *
19
+ * If you want to parse the response body but still get the `Response`
20
+ * instance, you can use {@link withResponse()}.
21
+ *
22
+ * 👋 Getting the wrong TypeScript type for `Response`?
23
+ * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
24
+ * to your `tsconfig.json`.
25
+ */
26
+ asResponse(): Promise<Response>;
27
+ /**
28
+ * Gets the parsed response data and the raw `Response` instance.
29
+ *
30
+ * If you just want to get the raw `Response` instance without parsing it,
31
+ * you can use {@link asResponse()}.
32
+ *
33
+ * 👋 Getting the wrong TypeScript type for `Response`?
34
+ * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
35
+ * to your `tsconfig.json`.
36
+ */
37
+ withResponse(): Promise<{
38
+ data: T;
39
+ response: Response;
40
+ }>;
41
+ private parse;
42
+ then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
43
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
44
+ finally(onfinally?: (() => void) | undefined | null): Promise<T>;
45
+ }
46
+ //# sourceMappingURL=api-promise.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.d.mts","sourceRoot":"","sources":["../src/core/api-promise.ts"],"names":[],"mappings":"OAEO,EAAE,KAAK,GAAG,EAAE;OAEZ,EAAE,KAAK,cAAc,EAAE;OACvB,EAAE,gBAAgB,EAAwB;AAEjD;;;GAGG;AACH,qBAAa,UAAU,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;;IAMzC,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,aAAa;IANvB,OAAO,CAAC,aAAa,CAAyB;gBAI5C,MAAM,EAAE,GAAG,EACH,eAAe,EAAE,OAAO,CAAC,gBAAgB,CAAC,EAC1C,aAAa,GAAE,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,gBAAgB,KAAK,cAAc,CAAC,CAAC,CAAwB;IAW3G,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,KAAK,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAMjF;;;;;;;;;;OAUG;IACH,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC;IAI/B;;;;;;;;;OASG;IACG,YAAY,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAA;KAAE,CAAC;IAK9D,OAAO,CAAC,KAAK;IAOJ,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EAC1C,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,EACjF,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAClF,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAItB,KAAK,CAAC,OAAO,GAAG,KAAK,EAC5B,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAChF,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC;IAId,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;CAG1E"}
@@ -0,0 +1,46 @@
1
+ import { type Ivy } from "../client.js";
2
+ import { type PromiseOrValue } from "../internal/types.js";
3
+ import { APIResponseProps } from "../internal/parse.js";
4
+ /**
5
+ * A subclass of `Promise` providing additional helper methods
6
+ * for interacting with the SDK.
7
+ */
8
+ export declare class APIPromise<T> extends Promise<T> {
9
+ #private;
10
+ private responsePromise;
11
+ private parseResponse;
12
+ private parsedPromise;
13
+ constructor(client: Ivy, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: Ivy, props: APIResponseProps) => PromiseOrValue<T>);
14
+ _thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U>;
15
+ /**
16
+ * Gets the raw `Response` instance instead of parsing the response
17
+ * data.
18
+ *
19
+ * If you want to parse the response body but still get the `Response`
20
+ * instance, you can use {@link withResponse()}.
21
+ *
22
+ * 👋 Getting the wrong TypeScript type for `Response`?
23
+ * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
24
+ * to your `tsconfig.json`.
25
+ */
26
+ asResponse(): Promise<Response>;
27
+ /**
28
+ * Gets the parsed response data and the raw `Response` instance.
29
+ *
30
+ * If you just want to get the raw `Response` instance without parsing it,
31
+ * you can use {@link asResponse()}.
32
+ *
33
+ * 👋 Getting the wrong TypeScript type for `Response`?
34
+ * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
35
+ * to your `tsconfig.json`.
36
+ */
37
+ withResponse(): Promise<{
38
+ data: T;
39
+ response: Response;
40
+ }>;
41
+ private parse;
42
+ then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
43
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
44
+ finally(onfinally?: (() => void) | undefined | null): Promise<T>;
45
+ }
46
+ //# sourceMappingURL=api-promise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.d.ts","sourceRoot":"","sources":["../src/core/api-promise.ts"],"names":[],"mappings":"OAEO,EAAE,KAAK,GAAG,EAAE;OAEZ,EAAE,KAAK,cAAc,EAAE;OACvB,EAAE,gBAAgB,EAAwB;AAEjD;;;GAGG;AACH,qBAAa,UAAU,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;;IAMzC,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,aAAa;IANvB,OAAO,CAAC,aAAa,CAAyB;gBAI5C,MAAM,EAAE,GAAG,EACH,eAAe,EAAE,OAAO,CAAC,gBAAgB,CAAC,EAC1C,aAAa,GAAE,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,gBAAgB,KAAK,cAAc,CAAC,CAAC,CAAwB;IAW3G,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,KAAK,CAAC,GAAG,UAAU,CAAC,CAAC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