increase 0.1.0 → 0.3.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 (538) hide show
  1. package/.github/workflows/publish-npm.yml +28 -0
  2. package/.github/workflows/release-doctor.yml +20 -0
  3. package/.github/workflows/release.yml +38 -0
  4. package/.prettierignore +1 -0
  5. package/.release-please-manifest.json +3 -0
  6. package/.stats.yml +1 -1
  7. package/CHANGELOG.md +84 -0
  8. package/README.md +17 -2
  9. package/api.md +88 -0
  10. package/bin/check-release-environment +25 -0
  11. package/bin/publish-npm +6 -0
  12. package/check-version.ts +4 -1
  13. package/core.ts +60 -18
  14. package/dist/cjs/check-version.d.ts +1 -0
  15. package/dist/cjs/check-version.d.ts.map +1 -0
  16. package/dist/cjs/check-version.js +3 -1
  17. package/dist/cjs/check-version.js.map +1 -1
  18. package/dist/cjs/core.d.ts +23 -3
  19. package/dist/cjs/core.d.ts.map +1 -0
  20. package/dist/cjs/core.js +61 -18
  21. package/dist/cjs/core.js.map +1 -1
  22. package/dist/cjs/error.d.ts +163 -0
  23. package/dist/cjs/error.d.ts.map +1 -0
  24. package/dist/cjs/error.js +204 -0
  25. package/dist/cjs/error.js.map +1 -0
  26. package/dist/cjs/examples/api-error.d.ts +3 -0
  27. package/dist/cjs/examples/api-error.d.ts.map +1 -0
  28. package/dist/cjs/examples/api-error.js +92 -0
  29. package/dist/cjs/examples/api-error.js.map +1 -0
  30. package/dist/cjs/fetch-polyfill.d.ts +1 -0
  31. package/dist/cjs/fetch-polyfill.d.ts.map +1 -0
  32. package/dist/cjs/fetch-polyfill.js +5 -3
  33. package/dist/cjs/fetch-polyfill.js.map +1 -1
  34. package/dist/cjs/index.d.ts +66 -3
  35. package/dist/cjs/index.d.ts.map +1 -0
  36. package/dist/cjs/index.js +108 -4
  37. package/dist/cjs/index.js.map +1 -1
  38. package/dist/cjs/pagination.d.ts +4 -0
  39. package/dist/cjs/pagination.d.ts.map +1 -0
  40. package/dist/cjs/pagination.js.map +1 -1
  41. package/dist/cjs/resource.d.ts +1 -0
  42. package/dist/cjs/resource.d.ts.map +1 -0
  43. package/dist/cjs/resources/account-numbers.d.ts +45 -0
  44. package/dist/cjs/resources/account-numbers.d.ts.map +1 -0
  45. package/dist/cjs/resources/account-numbers.js.map +1 -1
  46. package/dist/cjs/resources/account-statements.d.ts +21 -1
  47. package/dist/cjs/resources/account-statements.d.ts.map +1 -0
  48. package/dist/cjs/resources/account-statements.js.map +1 -1
  49. package/dist/cjs/resources/account-transfers.d.ts +40 -12
  50. package/dist/cjs/resources/account-transfers.d.ts.map +1 -0
  51. package/dist/cjs/resources/account-transfers.js.map +1 -1
  52. package/dist/cjs/resources/accounts.d.ts +53 -23
  53. package/dist/cjs/resources/accounts.d.ts.map +1 -0
  54. package/dist/cjs/resources/accounts.js.map +1 -1
  55. package/dist/cjs/resources/ach-prenotifications.d.ts +29 -6
  56. package/dist/cjs/resources/ach-prenotifications.d.ts.map +1 -0
  57. package/dist/cjs/resources/ach-prenotifications.js.map +1 -1
  58. package/dist/cjs/resources/ach-transfers.d.ts +70 -23
  59. package/dist/cjs/resources/ach-transfers.d.ts.map +1 -0
  60. package/dist/cjs/resources/ach-transfers.js.map +1 -1
  61. package/dist/cjs/resources/balance-lookups.d.ts +47 -0
  62. package/dist/cjs/resources/balance-lookups.d.ts.map +1 -0
  63. package/dist/cjs/resources/balance-lookups.js +15 -0
  64. package/dist/cjs/resources/balance-lookups.js.map +1 -0
  65. package/dist/cjs/resources/bookkeeping-accounts.d.ts +71 -0
  66. package/dist/cjs/resources/bookkeeping-accounts.d.ts.map +1 -0
  67. package/dist/cjs/resources/bookkeeping-accounts.js +29 -0
  68. package/dist/cjs/resources/bookkeeping-accounts.js.map +1 -0
  69. package/dist/cjs/resources/bookkeeping-entries.d.ts +43 -0
  70. package/dist/cjs/resources/bookkeeping-entries.d.ts.map +1 -0
  71. package/dist/cjs/resources/bookkeeping-entries.js +19 -0
  72. package/dist/cjs/resources/bookkeeping-entries.js.map +1 -0
  73. package/dist/cjs/resources/bookkeeping-entry-sets.d.ts +95 -0
  74. package/dist/cjs/resources/bookkeeping-entry-sets.d.ts.map +1 -0
  75. package/dist/cjs/resources/bookkeeping-entry-sets.js +15 -0
  76. package/dist/cjs/resources/bookkeeping-entry-sets.js.map +1 -0
  77. package/dist/cjs/resources/card-disputes.d.ts +39 -5
  78. package/dist/cjs/resources/card-disputes.d.ts.map +1 -0
  79. package/dist/cjs/resources/card-disputes.js.map +1 -1
  80. package/dist/cjs/resources/card-profiles.d.ts +81 -3
  81. package/dist/cjs/resources/card-profiles.d.ts.map +1 -0
  82. package/dist/cjs/resources/card-profiles.js.map +1 -1
  83. package/dist/cjs/resources/cards.d.ts +147 -3
  84. package/dist/cjs/resources/cards.d.ts.map +1 -0
  85. package/dist/cjs/resources/cards.js.map +1 -1
  86. package/dist/cjs/resources/check-deposits.d.ts +34 -1
  87. package/dist/cjs/resources/check-deposits.d.ts.map +1 -0
  88. package/dist/cjs/resources/check-deposits.js.map +1 -1
  89. package/dist/cjs/resources/check-transfers.d.ts +161 -14
  90. package/dist/cjs/resources/check-transfers.d.ts.map +1 -0
  91. package/dist/cjs/resources/check-transfers.js.map +1 -1
  92. package/dist/cjs/resources/declined-transactions.d.ts +116 -8
  93. package/dist/cjs/resources/declined-transactions.d.ts.map +1 -0
  94. package/dist/cjs/resources/declined-transactions.js.map +1 -1
  95. package/dist/cjs/resources/digital-wallet-tokens.d.ts +21 -1
  96. package/dist/cjs/resources/digital-wallet-tokens.d.ts.map +1 -0
  97. package/dist/cjs/resources/digital-wallet-tokens.js.map +1 -1
  98. package/dist/cjs/resources/documents.d.ts +181 -6
  99. package/dist/cjs/resources/documents.d.ts.map +1 -0
  100. package/dist/cjs/resources/documents.js.map +1 -1
  101. package/dist/cjs/resources/entities/entities.d.ts +1177 -10
  102. package/dist/cjs/resources/entities/entities.d.ts.map +1 -0
  103. package/dist/cjs/resources/entities/entities.js +1 -1
  104. package/dist/cjs/resources/entities/entities.js.map +1 -1
  105. package/dist/cjs/resources/entities/index.d.ts +1 -0
  106. package/dist/cjs/resources/entities/index.d.ts.map +1 -0
  107. package/dist/cjs/resources/entities/supplemental-documents.d.ts +1 -0
  108. package/dist/cjs/resources/entities/supplemental-documents.d.ts.map +1 -0
  109. package/dist/cjs/resources/event-subscriptions.d.ts +9 -4
  110. package/dist/cjs/resources/event-subscriptions.d.ts.map +1 -0
  111. package/dist/cjs/resources/event-subscriptions.js.map +1 -1
  112. package/dist/cjs/resources/events.d.ts +85 -4
  113. package/dist/cjs/resources/events.d.ts.map +1 -0
  114. package/dist/cjs/resources/events.js.map +1 -1
  115. package/dist/cjs/resources/exports.d.ts +244 -0
  116. package/dist/cjs/resources/exports.d.ts.map +1 -0
  117. package/dist/cjs/resources/exports.js +31 -0
  118. package/dist/cjs/resources/exports.js.map +1 -0
  119. package/dist/cjs/resources/external-accounts.d.ts +14 -7
  120. package/dist/cjs/resources/external-accounts.d.ts.map +1 -0
  121. package/dist/cjs/resources/external-accounts.js.map +1 -1
  122. package/dist/cjs/resources/files.d.ts +53 -10
  123. package/dist/cjs/resources/files.d.ts.map +1 -0
  124. package/dist/cjs/resources/files.js.map +1 -1
  125. package/dist/cjs/resources/groups.d.ts +1 -0
  126. package/dist/cjs/resources/groups.d.ts.map +1 -0
  127. package/dist/cjs/resources/inbound-ach-transfer-returns.d.ts +4 -0
  128. package/dist/cjs/resources/inbound-ach-transfer-returns.d.ts.map +1 -0
  129. package/dist/cjs/resources/inbound-ach-transfer-returns.js.map +1 -1
  130. package/dist/cjs/resources/inbound-wire-drawdown-requests.d.ts +1 -0
  131. package/dist/cjs/resources/inbound-wire-drawdown-requests.d.ts.map +1 -0
  132. package/dist/cjs/resources/inbound-wire-drawdown-requests.js.map +1 -1
  133. package/dist/cjs/resources/index.d.ts +29 -0
  134. package/dist/cjs/resources/index.d.ts.map +1 -0
  135. package/dist/cjs/resources/index.js +100 -9
  136. package/dist/cjs/resources/index.js.map +1 -1
  137. package/dist/cjs/resources/limits.d.ts +5 -4
  138. package/dist/cjs/resources/limits.d.ts.map +1 -0
  139. package/dist/cjs/resources/limits.js.map +1 -1
  140. package/dist/cjs/resources/oauth-connections.d.ts +1 -0
  141. package/dist/cjs/resources/oauth-connections.d.ts.map +1 -0
  142. package/dist/cjs/resources/oauth-connections.js.map +1 -1
  143. package/dist/cjs/resources/pending-transactions.d.ts +160 -6
  144. package/dist/cjs/resources/pending-transactions.d.ts.map +1 -0
  145. package/dist/cjs/resources/pending-transactions.js.map +1 -1
  146. package/dist/cjs/resources/programs.d.ts +48 -0
  147. package/dist/cjs/resources/programs.d.ts.map +1 -0
  148. package/dist/cjs/resources/programs.js +25 -0
  149. package/dist/cjs/resources/programs.js.map +1 -0
  150. package/dist/cjs/resources/real-time-decisions.d.ts +106 -1
  151. package/dist/cjs/resources/real-time-decisions.d.ts.map +1 -0
  152. package/dist/cjs/resources/real-time-payments-transfers.d.ts +306 -0
  153. package/dist/cjs/resources/real-time-payments-transfers.d.ts.map +1 -0
  154. package/dist/cjs/resources/real-time-payments-transfers.js +35 -0
  155. package/dist/cjs/resources/real-time-payments-transfers.js.map +1 -0
  156. package/dist/cjs/resources/routing-numbers.d.ts +1 -0
  157. package/dist/cjs/resources/routing-numbers.d.ts.map +1 -0
  158. package/dist/cjs/resources/shared.d.ts +1 -0
  159. package/dist/cjs/resources/shared.d.ts.map +1 -0
  160. package/dist/cjs/resources/simulations/account-statements.d.ts +1 -0
  161. package/dist/cjs/resources/simulations/account-statements.d.ts.map +1 -0
  162. package/dist/cjs/resources/simulations/account-transfers.d.ts +1 -0
  163. package/dist/cjs/resources/simulations/account-transfers.d.ts.map +1 -0
  164. package/dist/cjs/resources/simulations/ach-transfers.d.ts +431 -12
  165. package/dist/cjs/resources/simulations/ach-transfers.d.ts.map +1 -0
  166. package/dist/cjs/resources/simulations/card-disputes.d.ts +5 -4
  167. package/dist/cjs/resources/simulations/card-disputes.d.ts.map +1 -0
  168. package/dist/cjs/resources/simulations/card-refunds.d.ts +1 -0
  169. package/dist/cjs/resources/simulations/card-refunds.d.ts.map +1 -0
  170. package/dist/cjs/resources/simulations/cards.d.ts +222 -13
  171. package/dist/cjs/resources/simulations/cards.d.ts.map +1 -0
  172. package/dist/cjs/resources/simulations/check-deposits.d.ts +1 -0
  173. package/dist/cjs/resources/simulations/check-deposits.d.ts.map +1 -0
  174. package/dist/cjs/resources/simulations/check-transfers.d.ts +16 -0
  175. package/dist/cjs/resources/simulations/check-transfers.d.ts.map +1 -0
  176. package/dist/cjs/resources/simulations/check-transfers.js +10 -0
  177. package/dist/cjs/resources/simulations/check-transfers.js.map +1 -1
  178. package/dist/cjs/resources/simulations/digital-wallet-token-requests.d.ts +1 -0
  179. package/dist/cjs/resources/simulations/digital-wallet-token-requests.d.ts.map +1 -0
  180. package/dist/cjs/resources/simulations/documents.d.ts +1 -0
  181. package/dist/cjs/resources/simulations/documents.d.ts.map +1 -0
  182. package/dist/cjs/resources/simulations/inbound-wire-drawdown-requests.d.ts +26 -25
  183. package/dist/cjs/resources/simulations/inbound-wire-drawdown-requests.d.ts.map +1 -0
  184. package/dist/cjs/resources/simulations/index.d.ts +4 -0
  185. package/dist/cjs/resources/simulations/index.d.ts.map +1 -0
  186. package/dist/cjs/resources/simulations/interest-payments.d.ts +1364 -0
  187. package/dist/cjs/resources/simulations/interest-payments.d.ts.map +1 -0
  188. package/dist/cjs/resources/simulations/interest-payments.js +16 -0
  189. package/dist/cjs/resources/simulations/interest-payments.js.map +1 -0
  190. package/dist/cjs/resources/simulations/real-time-payments-transfers.d.ts +511 -12
  191. package/dist/cjs/resources/simulations/real-time-payments-transfers.d.ts.map +1 -0
  192. package/dist/cjs/resources/simulations/real-time-payments-transfers.js +11 -0
  193. package/dist/cjs/resources/simulations/real-time-payments-transfers.js.map +1 -1
  194. package/dist/cjs/resources/simulations/simulations.d.ts +3 -0
  195. package/dist/cjs/resources/simulations/simulations.d.ts.map +1 -0
  196. package/dist/cjs/resources/simulations/simulations.js +2 -0
  197. package/dist/cjs/resources/simulations/simulations.js.map +1 -1
  198. package/dist/cjs/resources/simulations/wire-transfers.d.ts +332 -6
  199. package/dist/cjs/resources/simulations/wire-transfers.d.ts.map +1 -0
  200. package/dist/cjs/resources/transactions.d.ts +397 -9
  201. package/dist/cjs/resources/transactions.d.ts.map +1 -0
  202. package/dist/cjs/resources/transactions.js.map +1 -1
  203. package/dist/cjs/resources/wire-drawdown-requests.d.ts +13 -8
  204. package/dist/cjs/resources/wire-drawdown-requests.d.ts.map +1 -0
  205. package/dist/cjs/resources/wire-drawdown-requests.js.map +1 -1
  206. package/dist/cjs/resources/wire-transfers.d.ts +71 -17
  207. package/dist/cjs/resources/wire-transfers.d.ts.map +1 -0
  208. package/dist/cjs/resources/wire-transfers.js.map +1 -1
  209. package/dist/cjs/tests/api-resources/account-numbers.test.d.ts +1 -0
  210. package/dist/cjs/tests/api-resources/account-numbers.test.d.ts.map +1 -0
  211. package/dist/cjs/tests/api-resources/account-numbers.test.js +24 -26
  212. package/dist/cjs/tests/api-resources/account-numbers.test.js.map +1 -1
  213. package/dist/cjs/tests/api-resources/account-statements.test.d.ts +1 -0
  214. package/dist/cjs/tests/api-resources/account-statements.test.d.ts.map +1 -0
  215. package/dist/cjs/tests/api-resources/account-statements.test.js +11 -26
  216. package/dist/cjs/tests/api-resources/account-statements.test.js.map +1 -1
  217. package/dist/cjs/tests/api-resources/account-transfers.test.d.ts +1 -0
  218. package/dist/cjs/tests/api-resources/account-transfers.test.d.ts.map +1 -0
  219. package/dist/cjs/tests/api-resources/account-transfers.test.js +20 -34
  220. package/dist/cjs/tests/api-resources/account-transfers.test.js.map +1 -1
  221. package/dist/cjs/tests/api-resources/accounts.test.d.ts +1 -0
  222. package/dist/cjs/tests/api-resources/accounts.test.d.ts.map +1 -0
  223. package/dist/cjs/tests/api-resources/accounts.test.js +25 -24
  224. package/dist/cjs/tests/api-resources/accounts.test.js.map +1 -1
  225. package/dist/cjs/tests/api-resources/ach-prenotifications.test.d.ts +1 -0
  226. package/dist/cjs/tests/api-resources/ach-prenotifications.test.d.ts.map +1 -0
  227. package/dist/cjs/tests/api-resources/ach-prenotifications.test.js +24 -28
  228. package/dist/cjs/tests/api-resources/ach-prenotifications.test.js.map +1 -1
  229. package/dist/cjs/tests/api-resources/ach-transfers.test.d.ts +1 -0
  230. package/dist/cjs/tests/api-resources/ach-transfers.test.d.ts.map +1 -0
  231. package/dist/cjs/tests/api-resources/ach-transfers.test.js +34 -36
  232. package/dist/cjs/tests/api-resources/ach-transfers.test.js.map +1 -1
  233. package/dist/cjs/tests/api-resources/balance-lookups.test.d.ts +2 -0
  234. package/dist/cjs/tests/api-resources/balance-lookups.test.d.ts.map +1 -0
  235. package/dist/cjs/tests/api-resources/balance-lookups.test.js +58 -0
  236. package/dist/cjs/tests/api-resources/balance-lookups.test.js.map +1 -0
  237. package/dist/cjs/tests/api-resources/bookkeeping-accounts.test.d.ts +2 -0
  238. package/dist/cjs/tests/api-resources/bookkeeping-accounts.test.d.ts.map +1 -0
  239. package/dist/cjs/tests/api-resources/bookkeeping-accounts.test.js +83 -0
  240. package/dist/cjs/tests/api-resources/bookkeeping-accounts.test.js.map +1 -0
  241. package/dist/cjs/tests/api-resources/bookkeeping-entries.test.d.ts +2 -0
  242. package/dist/cjs/tests/api-resources/bookkeeping-entries.test.d.ts.map +1 -0
  243. package/dist/cjs/tests/api-resources/bookkeeping-entries.test.js +65 -0
  244. package/dist/cjs/tests/api-resources/bookkeeping-entries.test.js.map +1 -0
  245. package/dist/cjs/tests/api-resources/bookkeeping-entry-sets.test.d.ts +2 -0
  246. package/dist/cjs/tests/api-resources/bookkeeping-entry-sets.test.d.ts.map +1 -0
  247. package/dist/cjs/tests/api-resources/bookkeeping-entry-sets.test.js +68 -0
  248. package/dist/cjs/tests/api-resources/bookkeeping-entry-sets.test.js.map +1 -0
  249. package/dist/cjs/tests/api-resources/card-disputes.test.d.ts +1 -0
  250. package/dist/cjs/tests/api-resources/card-disputes.test.d.ts.map +1 -0
  251. package/dist/cjs/tests/api-resources/card-disputes.test.js +21 -29
  252. package/dist/cjs/tests/api-resources/card-disputes.test.js.map +1 -1
  253. package/dist/cjs/tests/api-resources/card-profiles.test.d.ts +1 -0
  254. package/dist/cjs/tests/api-resources/card-profiles.test.d.ts.map +1 -0
  255. package/dist/cjs/tests/api-resources/card-profiles.test.js +29 -20
  256. package/dist/cjs/tests/api-resources/card-profiles.test.js.map +1 -1
  257. package/dist/cjs/tests/api-resources/cards.test.d.ts +1 -0
  258. package/dist/cjs/tests/api-resources/cards.test.d.ts.map +1 -0
  259. package/dist/cjs/tests/api-resources/cards.test.js +24 -38
  260. package/dist/cjs/tests/api-resources/cards.test.js.map +1 -1
  261. package/dist/cjs/tests/api-resources/check-deposits.test.d.ts +1 -0
  262. package/dist/cjs/tests/api-resources/check-deposits.test.d.ts.map +1 -0
  263. package/dist/cjs/tests/api-resources/check-deposits.test.js +27 -32
  264. package/dist/cjs/tests/api-resources/check-deposits.test.js.map +1 -1
  265. package/dist/cjs/tests/api-resources/check-transfers.test.d.ts +1 -0
  266. package/dist/cjs/tests/api-resources/check-transfers.test.d.ts.map +1 -0
  267. package/dist/cjs/tests/api-resources/check-transfers.test.js +34 -45
  268. package/dist/cjs/tests/api-resources/check-transfers.test.js.map +1 -1
  269. package/dist/cjs/tests/api-resources/declined-transactions.test.d.ts +1 -0
  270. package/dist/cjs/tests/api-resources/declined-transactions.test.d.ts.map +1 -0
  271. package/dist/cjs/tests/api-resources/declined-transactions.test.js +11 -27
  272. package/dist/cjs/tests/api-resources/declined-transactions.test.js.map +1 -1
  273. package/dist/cjs/tests/api-resources/digital-wallet-tokens.test.d.ts +1 -0
  274. package/dist/cjs/tests/api-resources/digital-wallet-tokens.test.d.ts.map +1 -0
  275. package/dist/cjs/tests/api-resources/digital-wallet-tokens.test.js +11 -26
  276. package/dist/cjs/tests/api-resources/digital-wallet-tokens.test.js.map +1 -1
  277. package/dist/cjs/tests/api-resources/documents.test.d.ts +1 -0
  278. package/dist/cjs/tests/api-resources/documents.test.d.ts.map +1 -0
  279. package/dist/cjs/tests/api-resources/documents.test.js +15 -27
  280. package/dist/cjs/tests/api-resources/documents.test.js.map +1 -1
  281. package/dist/cjs/tests/api-resources/entities/entities.test.d.ts +1 -0
  282. package/dist/cjs/tests/api-resources/entities/entities.test.d.ts.map +1 -0
  283. package/dist/cjs/tests/api-resources/entities/entities.test.js +109 -32
  284. package/dist/cjs/tests/api-resources/entities/entities.test.js.map +1 -1
  285. package/dist/cjs/tests/api-resources/entities/supplemental-documents.test.d.ts +1 -0
  286. package/dist/cjs/tests/api-resources/entities/supplemental-documents.test.d.ts.map +1 -0
  287. package/dist/cjs/tests/api-resources/entities/supplemental-documents.test.js +13 -6
  288. package/dist/cjs/tests/api-resources/entities/supplemental-documents.test.js.map +1 -1
  289. package/dist/cjs/tests/api-resources/event-subscriptions.test.d.ts +1 -0
  290. package/dist/cjs/tests/api-resources/event-subscriptions.test.d.ts.map +1 -0
  291. package/dist/cjs/tests/api-resources/event-subscriptions.test.js +14 -20
  292. package/dist/cjs/tests/api-resources/event-subscriptions.test.js.map +1 -1
  293. package/dist/cjs/tests/api-resources/events.test.d.ts +1 -0
  294. package/dist/cjs/tests/api-resources/events.test.d.ts.map +1 -0
  295. package/dist/cjs/tests/api-resources/events.test.js +11 -27
  296. package/dist/cjs/tests/api-resources/events.test.js.map +1 -1
  297. package/dist/cjs/tests/api-resources/exports.test.d.ts +2 -0
  298. package/dist/cjs/tests/api-resources/exports.test.d.ts.map +1 -0
  299. package/dist/cjs/tests/api-resources/exports.test.js +105 -0
  300. package/dist/cjs/tests/api-resources/exports.test.js.map +1 -0
  301. package/dist/cjs/tests/api-resources/external-accounts.test.d.ts +1 -0
  302. package/dist/cjs/tests/api-resources/external-accounts.test.d.ts.map +1 -0
  303. package/dist/cjs/tests/api-resources/external-accounts.test.js +16 -26
  304. package/dist/cjs/tests/api-resources/external-accounts.test.js.map +1 -1
  305. package/dist/cjs/tests/api-resources/files.test.d.ts +1 -0
  306. package/dist/cjs/tests/api-resources/files.test.d.ts.map +1 -0
  307. package/dist/cjs/tests/api-resources/files.test.js +12 -26
  308. package/dist/cjs/tests/api-resources/files.test.js.map +1 -1
  309. package/dist/cjs/tests/api-resources/groups.test.d.ts +1 -0
  310. package/dist/cjs/tests/api-resources/groups.test.d.ts.map +1 -0
  311. package/dist/cjs/tests/api-resources/groups.test.js +6 -5
  312. package/dist/cjs/tests/api-resources/groups.test.js.map +1 -1
  313. package/dist/cjs/tests/api-resources/inbound-ach-transfer-returns.test.d.ts +1 -0
  314. package/dist/cjs/tests/api-resources/inbound-ach-transfer-returns.test.d.ts.map +1 -0
  315. package/dist/cjs/tests/api-resources/inbound-ach-transfer-returns.test.js +16 -12
  316. package/dist/cjs/tests/api-resources/inbound-ach-transfer-returns.test.js.map +1 -1
  317. package/dist/cjs/tests/api-resources/inbound-wire-drawdown-requests.test.d.ts +1 -0
  318. package/dist/cjs/tests/api-resources/inbound-wire-drawdown-requests.test.d.ts.map +1 -0
  319. package/dist/cjs/tests/api-resources/inbound-wire-drawdown-requests.test.js +6 -9
  320. package/dist/cjs/tests/api-resources/inbound-wire-drawdown-requests.test.js.map +1 -1
  321. package/dist/cjs/tests/api-resources/limits.test.d.ts +1 -0
  322. package/dist/cjs/tests/api-resources/limits.test.d.ts.map +1 -0
  323. package/dist/cjs/tests/api-resources/limits.test.js +17 -15
  324. package/dist/cjs/tests/api-resources/limits.test.js.map +1 -1
  325. package/dist/cjs/tests/api-resources/oauth-connections.test.d.ts +1 -0
  326. package/dist/cjs/tests/api-resources/oauth-connections.test.d.ts.map +1 -0
  327. package/dist/cjs/tests/api-resources/oauth-connections.test.js +6 -9
  328. package/dist/cjs/tests/api-resources/oauth-connections.test.js.map +1 -1
  329. package/dist/cjs/tests/api-resources/pending-transactions.test.d.ts +1 -0
  330. package/dist/cjs/tests/api-resources/pending-transactions.test.d.ts.map +1 -0
  331. package/dist/cjs/tests/api-resources/pending-transactions.test.js +12 -18
  332. package/dist/cjs/tests/api-resources/pending-transactions.test.js.map +1 -1
  333. package/dist/cjs/tests/api-resources/programs.test.d.ts +2 -0
  334. package/dist/cjs/tests/api-resources/programs.test.d.ts.map +1 -0
  335. package/dist/cjs/tests/api-resources/programs.test.js +73 -0
  336. package/dist/cjs/tests/api-resources/programs.test.js.map +1 -0
  337. package/dist/cjs/tests/api-resources/real-time-decisions.test.d.ts +1 -0
  338. package/dist/cjs/tests/api-resources/real-time-decisions.test.d.ts.map +1 -0
  339. package/dist/cjs/tests/api-resources/real-time-decisions.test.js +7 -13
  340. package/dist/cjs/tests/api-resources/real-time-decisions.test.js.map +1 -1
  341. package/dist/cjs/tests/api-resources/real-time-payments-transfers.test.d.ts +2 -0
  342. package/dist/cjs/tests/api-resources/real-time-payments-transfers.test.d.ts.map +1 -0
  343. package/dist/cjs/tests/api-resources/real-time-payments-transfers.test.js +115 -0
  344. package/dist/cjs/tests/api-resources/real-time-payments-transfers.test.js.map +1 -0
  345. package/dist/cjs/tests/api-resources/routing-numbers.test.d.ts +1 -0
  346. package/dist/cjs/tests/api-resources/routing-numbers.test.d.ts.map +1 -0
  347. package/dist/cjs/tests/api-resources/routing-numbers.test.js +10 -5
  348. package/dist/cjs/tests/api-resources/routing-numbers.test.js.map +1 -1
  349. package/dist/cjs/tests/api-resources/simulations/account-statements.test.d.ts +1 -0
  350. package/dist/cjs/tests/api-resources/simulations/account-statements.test.d.ts.map +1 -0
  351. package/dist/cjs/tests/api-resources/simulations/account-statements.test.js +11 -8
  352. package/dist/cjs/tests/api-resources/simulations/account-statements.test.js.map +1 -1
  353. package/dist/cjs/tests/api-resources/simulations/account-transfers.test.d.ts +1 -0
  354. package/dist/cjs/tests/api-resources/simulations/account-transfers.test.d.ts.map +1 -0
  355. package/dist/cjs/tests/api-resources/simulations/account-transfers.test.js +5 -4
  356. package/dist/cjs/tests/api-resources/simulations/account-transfers.test.js.map +1 -1
  357. package/dist/cjs/tests/api-resources/simulations/ach-transfers.test.d.ts +1 -0
  358. package/dist/cjs/tests/api-resources/simulations/ach-transfers.test.d.ts.map +1 -0
  359. package/dist/cjs/tests/api-resources/simulations/ach-transfers.test.js +18 -20
  360. package/dist/cjs/tests/api-resources/simulations/ach-transfers.test.js.map +1 -1
  361. package/dist/cjs/tests/api-resources/simulations/card-disputes.test.d.ts +1 -0
  362. package/dist/cjs/tests/api-resources/simulations/card-disputes.test.d.ts.map +1 -0
  363. package/dist/cjs/tests/api-resources/simulations/card-disputes.test.js +9 -7
  364. package/dist/cjs/tests/api-resources/simulations/card-disputes.test.js.map +1 -1
  365. package/dist/cjs/tests/api-resources/simulations/card-refunds.test.d.ts +1 -0
  366. package/dist/cjs/tests/api-resources/simulations/card-refunds.test.d.ts.map +1 -0
  367. package/dist/cjs/tests/api-resources/simulations/card-refunds.test.js +11 -8
  368. package/dist/cjs/tests/api-resources/simulations/card-refunds.test.js.map +1 -1
  369. package/dist/cjs/tests/api-resources/simulations/cards.test.d.ts +1 -0
  370. package/dist/cjs/tests/api-resources/simulations/cards.test.d.ts.map +1 -0
  371. package/dist/cjs/tests/api-resources/simulations/cards.test.js +18 -10
  372. package/dist/cjs/tests/api-resources/simulations/cards.test.js.map +1 -1
  373. package/dist/cjs/tests/api-resources/simulations/check-deposits.test.d.ts +1 -0
  374. package/dist/cjs/tests/api-resources/simulations/check-deposits.test.d.ts.map +1 -0
  375. package/dist/cjs/tests/api-resources/simulations/check-deposits.test.js +5 -4
  376. package/dist/cjs/tests/api-resources/simulations/check-deposits.test.js.map +1 -1
  377. package/dist/cjs/tests/api-resources/simulations/check-transfers.test.d.ts +1 -0
  378. package/dist/cjs/tests/api-resources/simulations/check-transfers.test.d.ts.map +1 -0
  379. package/dist/cjs/tests/api-resources/simulations/check-transfers.test.js +23 -4
  380. package/dist/cjs/tests/api-resources/simulations/check-transfers.test.js.map +1 -1
  381. package/dist/cjs/tests/api-resources/simulations/digital-wallet-token-requests.test.d.ts +1 -0
  382. package/dist/cjs/tests/api-resources/simulations/digital-wallet-token-requests.test.d.ts.map +1 -0
  383. package/dist/cjs/tests/api-resources/simulations/digital-wallet-token-requests.test.js +11 -8
  384. package/dist/cjs/tests/api-resources/simulations/digital-wallet-token-requests.test.js.map +1 -1
  385. package/dist/cjs/tests/api-resources/simulations/documents.test.d.ts +1 -0
  386. package/dist/cjs/tests/api-resources/simulations/documents.test.d.ts.map +1 -0
  387. package/dist/cjs/tests/api-resources/simulations/documents.test.js +10 -7
  388. package/dist/cjs/tests/api-resources/simulations/documents.test.js.map +1 -1
  389. package/dist/cjs/tests/api-resources/simulations/inbound-wire-drawdown-requests.test.d.ts +1 -0
  390. package/dist/cjs/tests/api-resources/simulations/inbound-wire-drawdown-requests.test.d.ts.map +1 -0
  391. package/dist/cjs/tests/api-resources/simulations/inbound-wire-drawdown-requests.test.js +41 -28
  392. package/dist/cjs/tests/api-resources/simulations/inbound-wire-drawdown-requests.test.js.map +1 -1
  393. package/dist/cjs/tests/api-resources/simulations/interest-payments.test.d.ts +2 -0
  394. package/dist/cjs/tests/api-resources/simulations/interest-payments.test.d.ts.map +1 -0
  395. package/dist/cjs/tests/api-resources/simulations/interest-payments.test.js +58 -0
  396. package/dist/cjs/tests/api-resources/simulations/interest-payments.test.js.map +1 -0
  397. package/dist/cjs/tests/api-resources/simulations/real-time-payments-transfers.test.d.ts +1 -0
  398. package/dist/cjs/tests/api-resources/simulations/real-time-payments-transfers.test.d.ts.map +1 -0
  399. package/dist/cjs/tests/api-resources/simulations/real-time-payments-transfers.test.js +25 -12
  400. package/dist/cjs/tests/api-resources/simulations/real-time-payments-transfers.test.js.map +1 -1
  401. package/dist/cjs/tests/api-resources/simulations/wire-transfers.test.d.ts +1 -0
  402. package/dist/cjs/tests/api-resources/simulations/wire-transfers.test.d.ts.map +1 -0
  403. package/dist/cjs/tests/api-resources/simulations/wire-transfers.test.js +24 -10
  404. package/dist/cjs/tests/api-resources/simulations/wire-transfers.test.js.map +1 -1
  405. package/dist/cjs/tests/api-resources/transactions.test.d.ts +1 -0
  406. package/dist/cjs/tests/api-resources/transactions.test.d.ts.map +1 -0
  407. package/dist/cjs/tests/api-resources/transactions.test.js +15 -32
  408. package/dist/cjs/tests/api-resources/transactions.test.js.map +1 -1
  409. package/dist/cjs/tests/api-resources/wire-drawdown-requests.test.d.ts +1 -0
  410. package/dist/cjs/tests/api-resources/wire-drawdown-requests.test.d.ts.map +1 -0
  411. package/dist/cjs/tests/api-resources/wire-drawdown-requests.test.js +23 -23
  412. package/dist/cjs/tests/api-resources/wire-drawdown-requests.test.js.map +1 -1
  413. package/dist/cjs/tests/api-resources/wire-transfers.test.d.ts +1 -0
  414. package/dist/cjs/tests/api-resources/wire-transfers.test.d.ts.map +1 -0
  415. package/dist/cjs/tests/api-resources/wire-transfers.test.js +32 -41
  416. package/dist/cjs/tests/api-resources/wire-transfers.test.js.map +1 -1
  417. package/dist/cjs/tests/form.test.d.ts +1 -0
  418. package/dist/cjs/tests/form.test.d.ts.map +1 -0
  419. package/dist/cjs/tests/form.test.js +4 -3
  420. package/dist/cjs/tests/index.test.d.ts +1 -0
  421. package/dist/cjs/tests/index.test.d.ts.map +1 -0
  422. package/dist/cjs/tests/index.test.js +64 -0
  423. package/dist/cjs/tests/index.test.js.map +1 -1
  424. package/dist/cjs/tests/responses.test.d.ts +1 -0
  425. package/dist/cjs/tests/responses.test.d.ts.map +1 -0
  426. package/dist/cjs/tests/responses.test.js +4 -3
  427. package/dist/cjs/version.d.ts +2 -1
  428. package/dist/cjs/version.d.ts.map +1 -0
  429. package/dist/cjs/version.js +1 -1
  430. package/dist/cjs/version.js.map +1 -1
  431. package/error.ts +337 -0
  432. package/examples/api-error.ts +21 -0
  433. package/fetch-polyfill.ts +5 -5
  434. package/index.ts +143 -2
  435. package/package.json +2 -2
  436. package/pagination.ts +3 -0
  437. package/release-please-config.json +64 -0
  438. package/resources/account-numbers.ts +52 -1
  439. package/resources/account-statements.ts +23 -2
  440. package/resources/account-transfers.ts +44 -14
  441. package/resources/accounts.ts +62 -28
  442. package/resources/ach-prenotifications.ts +32 -8
  443. package/resources/ach-transfers.ts +77 -27
  444. package/resources/balance-lookups.ts +57 -0
  445. package/resources/bookkeeping-accounts.ts +98 -0
  446. package/resources/bookkeeping-entries.ts +62 -0
  447. package/resources/bookkeeping-entry-sets.ts +114 -0
  448. package/resources/card-disputes.ts +41 -6
  449. package/resources/card-profiles.ts +91 -4
  450. package/resources/cards.ts +165 -4
  451. package/resources/check-deposits.ts +36 -2
  452. package/resources/check-transfers.ts +184 -17
  453. package/resources/declined-transactions.ts +136 -9
  454. package/resources/digital-wallet-tokens.ts +23 -2
  455. package/resources/documents.ts +183 -7
  456. package/resources/entities/entities.ts +1343 -14
  457. package/resources/event-subscriptions.ts +9 -6
  458. package/resources/events.ts +87 -5
  459. package/resources/exports.ts +298 -0
  460. package/resources/external-accounts.ts +14 -9
  461. package/resources/files.ts +55 -11
  462. package/resources/inbound-ach-transfer-returns.ts +3 -1
  463. package/resources/inbound-wire-drawdown-requests.ts +0 -1
  464. package/resources/index.ts +28 -0
  465. package/resources/limits.ts +5 -6
  466. package/resources/oauth-connections.ts +0 -1
  467. package/resources/pending-transactions.ts +177 -7
  468. package/resources/programs.ts +70 -0
  469. package/resources/real-time-decisions.ts +113 -1
  470. package/resources/real-time-payments-transfers.ts +373 -0
  471. package/resources/simulations/ach-transfers.ts +479 -13
  472. package/resources/simulations/card-disputes.ts +4 -4
  473. package/resources/simulations/cards.ts +251 -14
  474. package/resources/simulations/check-transfers.ts +19 -0
  475. package/resources/simulations/inbound-wire-drawdown-requests.ts +28 -28
  476. package/resources/simulations/index.ts +3 -0
  477. package/resources/simulations/interest-payments.ts +1667 -0
  478. package/resources/simulations/real-time-payments-transfers.ts +568 -13
  479. package/resources/simulations/simulations.ts +2 -0
  480. package/resources/simulations/wire-transfers.ts +362 -7
  481. package/resources/transactions.ts +430 -11
  482. package/resources/wire-drawdown-requests.ts +14 -11
  483. package/resources/wire-transfers.ts +80 -21
  484. package/tests/api-resources/account-numbers.test.ts +21 -23
  485. package/tests/api-resources/account-statements.test.ts +8 -23
  486. package/tests/api-resources/account-transfers.test.ts +17 -31
  487. package/tests/api-resources/accounts.test.ts +22 -21
  488. package/tests/api-resources/ach-prenotifications.test.ts +21 -25
  489. package/tests/api-resources/ach-transfers.test.ts +31 -33
  490. package/tests/api-resources/balance-lookups.test.ts +21 -0
  491. package/tests/api-resources/bookkeeping-accounts.test.ts +43 -0
  492. package/tests/api-resources/bookkeeping-entries.test.ts +25 -0
  493. package/tests/api-resources/bookkeeping-entry-sets.test.ts +31 -0
  494. package/tests/api-resources/card-disputes.test.ts +18 -26
  495. package/tests/api-resources/card-profiles.test.ts +26 -17
  496. package/tests/api-resources/cards.test.ts +21 -35
  497. package/tests/api-resources/check-deposits.test.ts +24 -29
  498. package/tests/api-resources/check-transfers.test.ts +31 -42
  499. package/tests/api-resources/declined-transactions.test.ts +8 -24
  500. package/tests/api-resources/digital-wallet-tokens.test.ts +8 -23
  501. package/tests/api-resources/documents.test.ts +12 -24
  502. package/tests/api-resources/entities/entities.test.ts +106 -29
  503. package/tests/api-resources/entities/supplemental-documents.test.ts +10 -3
  504. package/tests/api-resources/event-subscriptions.test.ts +11 -17
  505. package/tests/api-resources/events.test.ts +8 -24
  506. package/tests/api-resources/exports.test.ts +68 -0
  507. package/tests/api-resources/external-accounts.test.ts +13 -23
  508. package/tests/api-resources/files.test.ts +9 -24
  509. package/tests/api-resources/groups.test.ts +3 -2
  510. package/tests/api-resources/inbound-ach-transfer-returns.test.ts +13 -9
  511. package/tests/api-resources/inbound-wire-drawdown-requests.test.ts +3 -6
  512. package/tests/api-resources/limits.test.ts +14 -12
  513. package/tests/api-resources/oauth-connections.test.ts +3 -6
  514. package/tests/api-resources/pending-transactions.test.ts +9 -15
  515. package/tests/api-resources/programs.test.ts +36 -0
  516. package/tests/api-resources/real-time-decisions.test.ts +4 -10
  517. package/tests/api-resources/real-time-payments-transfers.test.ts +78 -0
  518. package/tests/api-resources/routing-numbers.test.ts +7 -2
  519. package/tests/api-resources/simulations/account-statements.test.ts +8 -5
  520. package/tests/api-resources/simulations/account-transfers.test.ts +2 -1
  521. package/tests/api-resources/simulations/ach-transfers.test.ts +15 -14
  522. package/tests/api-resources/simulations/card-disputes.test.ts +6 -4
  523. package/tests/api-resources/simulations/card-refunds.test.ts +8 -5
  524. package/tests/api-resources/simulations/cards.test.ts +15 -7
  525. package/tests/api-resources/simulations/check-deposits.test.ts +2 -1
  526. package/tests/api-resources/simulations/check-transfers.test.ts +14 -1
  527. package/tests/api-resources/simulations/digital-wallet-token-requests.test.ts +8 -5
  528. package/tests/api-resources/simulations/documents.test.ts +7 -4
  529. package/tests/api-resources/simulations/inbound-wire-drawdown-requests.test.ts +38 -25
  530. package/tests/api-resources/simulations/interest-payments.test.ts +15 -0
  531. package/tests/api-resources/simulations/real-time-payments-transfers.test.ts +22 -9
  532. package/tests/api-resources/simulations/wire-transfers.test.ts +21 -7
  533. package/tests/api-resources/transactions.test.ts +12 -29
  534. package/tests/api-resources/wire-drawdown-requests.test.ts +20 -20
  535. package/tests/api-resources/wire-transfers.test.ts +29 -38
  536. package/tests/index.test.ts +31 -0
  537. package/tsconfig.json +2 -0
  538. package/version.ts +1 -1
@@ -0,0 +1,28 @@
1
+ # workflow for re-running publishing to NPM in case it fails for some reason
2
+ # you can run this workflow by navigating to https://www.github.com/increase/increase-node/actions/workflows/publish-npm.yml
3
+ name: Publish NPM
4
+ on:
5
+ workflow_dispatch:
6
+
7
+ jobs:
8
+ publish:
9
+ name: publish
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+
15
+ - name: Set up Node
16
+ uses: actions/setup-node@v3
17
+ with:
18
+ node-version: '16'
19
+
20
+ - name: Install dependencies
21
+ run: |
22
+ yarn install
23
+
24
+ - name: Publish to NPM
25
+ run: |
26
+ bash ./bin/publish-npm
27
+ env:
28
+ NPM_TOKEN: ${{ secrets.INCREASE_NPM_TOKEN }}
@@ -0,0 +1,20 @@
1
+ name: Release Doctor
2
+ on:
3
+ pull_request:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ release_doctor:
8
+ name: release doctor
9
+ runs-on: ubuntu-latest
10
+ if: github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next'
11
+
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+
15
+ - name: Check release environment
16
+ run: |
17
+ bash ./bin/check-release-environment
18
+ env:
19
+ STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
20
+ NPM_TOKEN: ${{ secrets.INCREASE_NPM_TOKEN }}
@@ -0,0 +1,38 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+
7
+ jobs:
8
+ release:
9
+ name: release
10
+ if: github.ref == 'refs/heads/main' && github.repository == 'increase/increase-node'
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+
16
+ - uses: stainless-api/trigger-release-please@v1
17
+ id: release
18
+ with:
19
+ repo: ${{ github.event.repository.full_name }}
20
+ stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
21
+
22
+ - name: Set up Node
23
+ if: ${{ steps.release.outputs.releases_created }}
24
+ uses: actions/setup-node@v3
25
+ with:
26
+ node-version: '16'
27
+
28
+ - name: Install dependencies
29
+ if: ${{ steps.release.outputs.releases_created }}
30
+ run: |
31
+ yarn install
32
+
33
+ - name: Publish to NPM
34
+ if: ${{ steps.release.outputs.releases_created }}
35
+ run: |
36
+ bash ./bin/publish-npm
37
+ env:
38
+ NPM_TOKEN: ${{ secrets.INCREASE_NPM_TOKEN }}
@@ -0,0 +1 @@
1
+ CHANGELOG.md
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.3.0"
3
+ }
package/.stats.yml CHANGED
@@ -1 +1 @@
1
- configured_endpoints: 115
1
+ configured_endpoints: 131
package/CHANGELOG.md ADDED
@@ -0,0 +1,84 @@
1
+ # Changelog
2
+
3
+ ## [0.3.0](https://github.com/Increase/increase-node/compare/increase-v0.2.0...increase-v0.3.0) (2023-05-31)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * **api:** `notification_of_change` has been removed in favor of the new `notifications_of_change` list field
9
+
10
+ ### Features
11
+
12
+ * add additional coercion functions ([5f106bf](https://github.com/Increase/increase-node/commit/5f106bf9d3e0ee1c5b5fc81d112677e2c7580b82))
13
+ * add internal support for streaming responses ([a1c321e](https://github.com/Increase/increase-node/commit/a1c321edc8fd648c9f318e047db5dafb7e37eabe))
14
+ * add internal support for streaming responses ([a1c321e](https://github.com/Increase/increase-node/commit/a1c321edc8fd648c9f318e047db5dafb7e37eabe))
15
+ * add webhook HMAC verification helper methods ([7a00853](https://github.com/Increase/increase-node/commit/7a00853a03b5b606df2c5c9095c53db2a4957af8))
16
+ * **api:** add `at_time` property for balance lookups ([0b6c0de](https://github.com/Increase/increase-node/commit/0b6c0de8d25b04fb95b16d902d90d116d617af76))
17
+ * **api:** add `collection_receivable` to transaction source category enum ([e743cc9](https://github.com/Increase/increase-node/commit/e743cc9ad5855d7c16b2c1f3a1a41dc06581d01d))
18
+ * **api:** add `expires_at` property ([c257707](https://github.com/Increase/increase-node/commit/c2577077bd280793bedf9ff8f802017784da7468))
19
+ * **api:** add `simulations.checkTransfers.return()` method ([e7d330a](https://github.com/Increase/increase-node/commit/e7d330ab5d899ed2305530c0f23fe1fe36eee1a8))
20
+ * **api:** add `simulations.checkTransfers.return()` method ([e7d330a](https://github.com/Increase/increase-node/commit/e7d330ab5d899ed2305530c0f23fe1fe36eee1a8))
21
+ * **api:** add bookkeeping accounts, entries, and entry sets, and several other changes ([d63d4e7](https://github.com/Increase/increase-node/commit/d63d4e71e0d10e70f8d9257ff3ad903b41c64fbe))
22
+ * **api:** add new endpoints ([7d4ebe6](https://github.com/Increase/increase-node/commit/7d4ebe6f0a38e7fade250ece8e50c8d9f6c6d653))
23
+ * **api:** add new endpoints, several params, fields, enum members, and documentation updates ([8ffb013](https://github.com/Increase/increase-node/commit/8ffb0130a53a90c5b00c314850f33bc5af4cb070))
24
+ * **api:** add new enum members ([0785f7a](https://github.com/Increase/increase-node/commit/0785f7a13f2c7194ed3f9f940a34b262c6b25027))
25
+ * **api:** add new fields ([3d9c69b](https://github.com/Increase/increase-node/commit/3d9c69bddf970739f0b91eb4962a058e9ee756c8))
26
+ * **api:** add new methods ([ca41987](https://github.com/Increase/increase-node/commit/ca41987401784ddb2266bd1a32b08f2f58864ceb))
27
+ * **api:** add optional `pending_transaction_id` field to pending transaction ([fa011e7](https://github.com/Increase/increase-node/commit/fa011e7adb44fb954efa3024b01f88aab3d789ed))
28
+ * **api:** add wire decline object ([2d2e77e](https://github.com/Increase/increase-node/commit/2d2e77eaf2c7244d7491153f32f70aae537a62c9))
29
+ * **api:** enum updates ([f09e25a](https://github.com/Increase/increase-node/commit/f09e25a7e4683beb2779fd76a46c2c629414810b))
30
+ * **api:** make routeType an enum & add ACHTransfer.effectiveDate ([77fd8ea](https://github.com/Increase/increase-node/commit/77fd8ea44236307fb6a8e7d464db55f8e3ba5fd9))
31
+ * **api:** make routeType an enum & add ACHTransfer.effectiveDate ([77fd8ea](https://github.com/Increase/increase-node/commit/77fd8ea44236307fb6a8e7d464db55f8e3ba5fd9))
32
+ * **api:** replace notification_of_change with a list, and add merchant_acceptor_id ([831e49e](https://github.com/Increase/increase-node/commit/831e49e0d1fbf8dd57ea204d89b1be2d69d1ee75))
33
+ * **api:** updates ([ad907d5](https://github.com/Increase/increase-node/commit/ad907d5bf9f6fd2ffe7c8fb89c884d5ba0065593))
34
+ * **api:** updates ([ca80997](https://github.com/Increase/increase-node/commit/ca80997fc7397066ac6149e8db65d6541bf012de))
35
+ * **api:** updates ([ca80997](https://github.com/Increase/increase-node/commit/ca80997fc7397066ac6149e8db65d6541bf012de))
36
+ * **api:** updates ([651bf76](https://github.com/Increase/increase-node/commit/651bf7670c167ffc41eb40c0e226fc76062a4305))
37
+ * **api:** updates ([e58e324](https://github.com/Increase/increase-node/commit/e58e3241015e95afac62550f5b0f1d152dba999b))
38
+ * **client:** handle trailing slash in base url properly ([a03d867](https://github.com/Increase/increase-node/commit/a03d86797fa71036cc45b241a1de1b5edb82e416))
39
+ * **docs:** add more doc comments ([b8bc790](https://github.com/Increase/increase-node/commit/b8bc790a3e06fa3b8a9e6a5299c9e8e1db0b671d))
40
+ * **docs:** updates ([6cea39c](https://github.com/Increase/increase-node/commit/6cea39cd892b2fdae5b7b2a171f9acbcab0e6f62))
41
+ * improve docs and add new property ([418fe83](https://github.com/Increase/increase-node/commit/418fe831af1fcb216ea938930a956b6f1d3083d7))
42
+ * improve error types ([db09c19](https://github.com/Increase/increase-node/commit/db09c19c6017817aba695bffd29c63cf5e31f5f3))
43
+ * improve error types ([db09c19](https://github.com/Increase/increase-node/commit/db09c19c6017817aba695bffd29c63cf5e31f5f3))
44
+ * **internal:** add support for positional params ([9cafda3](https://github.com/Increase/increase-node/commit/9cafda3db2f6d124839dabd66e4997826384d197))
45
+ * **internal:** add support for positional params ([9cafda3](https://github.com/Increase/increase-node/commit/9cafda3db2f6d124839dabd66e4997826384d197))
46
+ * **internal:** improve example generation ([e0fa5b3](https://github.com/Increase/increase-node/commit/e0fa5b3a5654d032d0ff98964ed055a27be4c5e7))
47
+ * **internal:** improve example generation ([e0fa5b3](https://github.com/Increase/increase-node/commit/e0fa5b3a5654d032d0ff98964ed055a27be4c5e7))
48
+ * **internal:** internal fixes ([4848450](https://github.com/Increase/increase-node/commit/4848450f8a0cbfa465097b154ccf866766146490))
49
+ * **internal:** internal fixes ([4848450](https://github.com/Increase/increase-node/commit/4848450f8a0cbfa465097b154ccf866766146490))
50
+ * **internal:** re-export `fileFromPath` helper util from the root ([09c0c79](https://github.com/Increase/increase-node/commit/09c0c795a42f8f15ae6008aa8e6baaaa22261dc2))
51
+ * **internal:** re-export `fileFromPath` helper util from the root ([09c0c79](https://github.com/Increase/increase-node/commit/09c0c795a42f8f15ae6008aa8e6baaaa22261dc2))
52
+ * send Idempotency-Key by default for POST requests ([4c15f76](https://github.com/Increase/increase-node/commit/4c15f76c2f04b92e0dd99045f4f801013c105afc))
53
+ * send Idempotency-Key by default for POST requests ([4c15f76](https://github.com/Increase/increase-node/commit/4c15f76c2f04b92e0dd99045f4f801013c105afc))
54
+ * **tsconfig:** set declarationMap: true ([50c755f](https://github.com/Increase/increase-node/commit/50c755f0f5df98074094175e71670d4f45366fb4))
55
+ * **tsconfig:** set declarationMap: true ([50c755f](https://github.com/Increase/increase-node/commit/50c755f0f5df98074094175e71670d4f45366fb4))
56
+ * update docs ([facb322](https://github.com/Increase/increase-node/commit/facb322b04c7951ea764b7db610902812cf5a7be))
57
+
58
+
59
+ ### Bug Fixes
60
+
61
+ * allow importing in typescript without manually installing @types/web ([d802d9e](https://github.com/Increase/increase-node/commit/d802d9e0d145e1b183d476b47764a48f0de08497))
62
+ * bump @types/node version ([7915638](https://github.com/Increase/increase-node/commit/7915638b2e4302a5ed0b9adc024916fccde742c4))
63
+ * change unknown type generation to `interface{}` ([532c5ec](https://github.com/Increase/increase-node/commit/532c5ec12522300e92b4a05f731f8911a6afd3ec))
64
+ * change unknown type generation to `interface{}` ([532c5ec](https://github.com/Increase/increase-node/commit/532c5ec12522300e92b4a05f731f8911a6afd3ec))
65
+ * **client:** properly expose `maxRetries` option ([dfdce20](https://github.com/Increase/increase-node/commit/dfdce20b7a485d0f15182546f47ae340c6280ae7))
66
+ * **internal:** fix TS error when setting global AbortController polyfill ([00c0df8](https://github.com/Increase/increase-node/commit/00c0df83c4ad058271e7207db244ed12c3fe856d))
67
+ * **internal:** fix TS error when setting global AbortController polyfill ([00c0df8](https://github.com/Increase/increase-node/commit/00c0df83c4ad058271e7207db244ed12c3fe856d))
68
+ * polyfill AbortController more safely ([71e0db3](https://github.com/Increase/increase-node/commit/71e0db32ccd0073e052edf6b33bd170e6c5bf7c8))
69
+ * polyfill AbortController more safely ([71e0db3](https://github.com/Increase/increase-node/commit/71e0db32ccd0073e052edf6b33bd170e6c5bf7c8))
70
+ * **sse:** handle server-sent events more robustly ([8dddf91](https://github.com/Increase/increase-node/commit/8dddf917c64db1623b7f4c756539abfe67ab4dd0))
71
+
72
+
73
+ ### Reverts
74
+
75
+ * remove `crypto` module import ([b82e4b7](https://github.com/Increase/increase-node/commit/b82e4b7b2755d9ae1556a0d2bb9d5f30218e56fd))
76
+ * remove `crypto` module import ([b82e4b7](https://github.com/Increase/increase-node/commit/b82e4b7b2755d9ae1556a0d2bb9d5f30218e56fd))
77
+
78
+
79
+ ### Refactors
80
+
81
+ * **docs:** cleanup api.md response types ([539848e](https://github.com/Increase/increase-node/commit/539848e9001e424f9492f60d82cfb861316cfcb2))
82
+ * remove ability to read the api key from the environment ([3051874](https://github.com/Increase/increase-node/commit/30518740b1c8226ee79d959febb32b517631d0bd))
83
+ * reorganize pagination class definitions ([972a30e](https://github.com/Increase/increase-node/commit/972a30e58fb19c4e46d38dddd2b2acd1288f1e36))
84
+ * reorganize pagination class definitions ([972a30e](https://github.com/Increase/increase-node/commit/972a30e58fb19c4e46d38dddd2b2acd1288f1e36))
package/README.md CHANGED
@@ -66,7 +66,7 @@ Request parameters that correspond to file uploads can be passed as either a `Fo
66
66
  We provide a `fileFromPath` helper function to easily create `FormData.File` instances from a given class.
67
67
 
68
68
  ```ts
69
- import ModernTreasury, { fileFromPath } from 'increase';
69
+ import Increase, { fileFromPath } from 'increase';
70
70
 
71
71
  const increase = new Increase();
72
72
 
@@ -155,7 +155,7 @@ Note that requests which time out will be [retried twice by default](#retries).
155
155
  ## Auto-pagination
156
156
 
157
157
  List methods in the Increase API are paginated.
158
- Use `for await … of` syntax to iterate through items across all pages.
158
+ You can use `for await … of` syntax to iterate through items across all pages:
159
159
 
160
160
  ```ts
161
161
  async function fetchAllAccounts(params) {
@@ -168,6 +168,21 @@ async function fetchAllAccounts(params) {
168
168
  }
169
169
  ```
170
170
 
171
+ Alternatively, you can make request a single page at a time:
172
+
173
+ ```ts
174
+ let page = await increase.accounts.list();
175
+ for (const account of page.data) {
176
+ console.log(account);
177
+ }
178
+
179
+ // Convenience methods are provided for manually paginating:
180
+ while (page.hasNextPage()) {
181
+ page = page.getNextPage();
182
+ // ...
183
+ }
184
+ ```
185
+
171
186
  ## Configuring an HTTP(S) Agent (e.g., for proxies)
172
187
 
173
188
  By default, this library uses a stable agent for all http/https requests to reuse TCP connections, eliminating many TCP & TLS handshakes and shaving around 100ms off most requests.
package/api.md CHANGED
@@ -25,6 +25,37 @@ Methods:
25
25
  - <code title="patch /account_numbers/{account_number_id}">client.accountNumbers.<a href="./resources/account-numbers.ts">update</a>(accountNumberId, { ...params }) -> AccountNumber</code>
26
26
  - <code title="get /account_numbers">client.accountNumbers.<a href="./resources/account-numbers.ts">list</a>({ ...params }) -> AccountNumbersPage</code>
27
27
 
28
+ # BookkeepingAccounts
29
+
30
+ Models:
31
+
32
+ - <code><a href="./resources/bookkeeping-accounts.ts">BookkeepingAccount</a></code>
33
+
34
+ Methods:
35
+
36
+ - <code title="post /bookkeeping_accounts">client.bookkeepingAccounts.<a href="./resources/bookkeeping-accounts.ts">create</a>({ ...params }) -> BookkeepingAccount</code>
37
+ - <code title="get /bookkeeping_accounts">client.bookkeepingAccounts.<a href="./resources/bookkeeping-accounts.ts">list</a>({ ...params }) -> BookkeepingAccountsPage</code>
38
+
39
+ # BookkeepingEntrySets
40
+
41
+ Models:
42
+
43
+ - <code><a href="./resources/bookkeeping-entry-sets.ts">BookkeepingEntrySet</a></code>
44
+
45
+ Methods:
46
+
47
+ - <code title="post /bookkeeping_entry_sets">client.bookkeepingEntrySets.<a href="./resources/bookkeeping-entry-sets.ts">create</a>({ ...params }) -> BookkeepingEntrySet</code>
48
+
49
+ # BookkeepingEntries
50
+
51
+ Models:
52
+
53
+ - <code><a href="./resources/bookkeeping-entries.ts">BookkeepingEntry</a></code>
54
+
55
+ Methods:
56
+
57
+ - <code title="get /bookkeeping_entries">client.bookkeepingEntries.<a href="./resources/bookkeeping-entries.ts">list</a>({ ...params }) -> BookkeepingEntriesPage</code>
58
+
28
59
  # RealTimeDecisions
29
60
 
30
61
  Models:
@@ -36,6 +67,28 @@ Methods:
36
67
  - <code title="get /real_time_decisions/{real_time_decision_id}">client.realTimeDecisions.<a href="./resources/real-time-decisions.ts">retrieve</a>(realTimeDecisionId) -> RealTimeDecision</code>
37
68
  - <code title="post /real_time_decisions/{real_time_decision_id}/action">client.realTimeDecisions.<a href="./resources/real-time-decisions.ts">action</a>(realTimeDecisionId, { ...params }) -> RealTimeDecision</code>
38
69
 
70
+ # RealTimePaymentsTransfers
71
+
72
+ Models:
73
+
74
+ - <code><a href="./resources/real-time-payments-transfers.ts">RealTimePaymentsTransfer</a></code>
75
+
76
+ Methods:
77
+
78
+ - <code title="post /real_time_payments_transfers">client.realTimePaymentsTransfers.<a href="./resources/real-time-payments-transfers.ts">create</a>({ ...params }) -> RealTimePaymentsTransfer</code>
79
+ - <code title="get /real_time_payments_transfers/{real_time_payments_transfer_id}">client.realTimePaymentsTransfers.<a href="./resources/real-time-payments-transfers.ts">retrieve</a>(realTimePaymentsTransferId) -> RealTimePaymentsTransfer</code>
80
+ - <code title="get /real_time_payments_transfers">client.realTimePaymentsTransfers.<a href="./resources/real-time-payments-transfers.ts">list</a>({ ...params }) -> RealTimePaymentsTransfersPage</code>
81
+
82
+ # BalanceLookups
83
+
84
+ Models:
85
+
86
+ - <code><a href="./resources/balance-lookups.ts">BalanceLookupLookupResponse</a></code>
87
+
88
+ Methods:
89
+
90
+ - <code title="post /balance_lookups">client.balanceLookups.<a href="./resources/balance-lookups.ts">lookup</a>({ ...params }) -> BalanceLookupLookupResponse</code>
91
+
39
92
  # Cards
40
93
 
41
94
  Models:
@@ -88,6 +141,18 @@ Methods:
88
141
  - <code title="patch /external_accounts/{external_account_id}">client.externalAccounts.<a href="./resources/external-accounts.ts">update</a>(externalAccountId, { ...params }) -> ExternalAccount</code>
89
142
  - <code title="get /external_accounts">client.externalAccounts.<a href="./resources/external-accounts.ts">list</a>({ ...params }) -> ExternalAccountsPage</code>
90
143
 
144
+ # Exports
145
+
146
+ Models:
147
+
148
+ - <code><a href="./resources/exports.ts">Export</a></code>
149
+
150
+ Methods:
151
+
152
+ - <code title="post /exports">client.exports.<a href="./resources/exports.ts">create</a>({ ...params }) -> Export</code>
153
+ - <code title="get /exports/{export_id}">client.exports.<a href="./resources/exports.ts">retrieve</a>(exportId) -> Export</code>
154
+ - <code title="get /exports">client.exports.<a href="./resources/exports.ts">list</a>({ ...params }) -> ExportsPage</code>
155
+
91
156
  # DigitalWalletTokens
92
157
 
93
158
  Models:
@@ -121,6 +186,17 @@ Methods:
121
186
  - <code title="get /pending_transactions/{pending_transaction_id}">client.pendingTransactions.<a href="./resources/pending-transactions.ts">retrieve</a>(pendingTransactionId) -> PendingTransaction</code>
122
187
  - <code title="get /pending_transactions">client.pendingTransactions.<a href="./resources/pending-transactions.ts">list</a>({ ...params }) -> PendingTransactionsPage</code>
123
188
 
189
+ # Programs
190
+
191
+ Models:
192
+
193
+ - <code><a href="./resources/programs.ts">Program</a></code>
194
+
195
+ Methods:
196
+
197
+ - <code title="get /programs/{program_id}">client.programs.<a href="./resources/programs.ts">retrieve</a>(programId) -> Program</code>
198
+ - <code title="get /programs">client.programs.<a href="./resources/programs.ts">list</a>({ ...params }) -> ProgramsPage</code>
199
+
124
200
  # DeclinedTransactions
125
201
 
126
202
  Models:
@@ -414,6 +490,7 @@ Methods:
414
490
 
415
491
  - <code title="post /simulations/check_transfers/{check_transfer_id}/deposit">client.simulations.checkTransfers.<a href="./resources/simulations/check-transfers.ts">deposit</a>(checkTransferId) -> CheckTransfer</code>
416
492
  - <code title="post /simulations/check_transfers/{check_transfer_id}/mail">client.simulations.checkTransfers.<a href="./resources/simulations/check-transfers.ts">mail</a>(checkTransferId) -> CheckTransfer</code>
493
+ - <code title="post /simulations/check_transfers/{check_transfer_id}/return">client.simulations.checkTransfers.<a href="./resources/simulations/check-transfers.ts">return</a>(checkTransferId, { ...params }) -> CheckTransfer</code>
417
494
 
418
495
  ## Documents
419
496
 
@@ -445,6 +522,16 @@ Methods:
445
522
 
446
523
  - <code title="post /simulations/inbound_wire_drawdown_requests">client.simulations.inboundWireDrawdownRequests.<a href="./resources/simulations/inbound-wire-drawdown-requests.ts">create</a>({ ...params }) -> InboundWireDrawdownRequest</code>
447
524
 
525
+ ## InterestPayments
526
+
527
+ Models:
528
+
529
+ - <code><a href="./resources/simulations/interest-payments.ts">InterestPaymentSimulationResult</a></code>
530
+
531
+ Methods:
532
+
533
+ - <code title="post /simulations/interest_payment">client.simulations.interestPayments.<a href="./resources/simulations/interest-payments.ts">create</a>({ ...params }) -> InterestPaymentSimulationResult</code>
534
+
448
535
  ## WireTransfers
449
536
 
450
537
  Models:
@@ -474,4 +561,5 @@ Models:
474
561
 
475
562
  Methods:
476
563
 
564
+ - <code title="post /simulations/real_time_payments_transfers/{real_time_payments_transfer_id}/complete">client.simulations.realTimePaymentsTransfers.<a href="./resources/simulations/real-time-payments-transfers.ts">complete</a>(realTimePaymentsTransferId, { ...params }) -> RealTimePaymentsTransfer</code>
477
565
  - <code title="post /simulations/inbound_real_time_payments_transfers">client.simulations.realTimePaymentsTransfers.<a href="./resources/simulations/real-time-payments-transfers.ts">createInbound</a>({ ...params }) -> InboundRealTimePaymentsTransferSimulationResult</code>
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+
3
+ errors=()
4
+
5
+ if [ -z "${STAINLESS_API_KEY}" ]; then
6
+ errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organisation secrets on GitHub.")
7
+ fi
8
+
9
+ if [ -z "${NPM_TOKEN}" ]; then
10
+ errors+=("The INCREASE_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organisation secrets")
11
+ fi
12
+
13
+ len=${#errors[@]}
14
+
15
+ if [[ len -gt 0 ]]; then
16
+ echo -e "Found the following errors in the release environment:\n"
17
+
18
+ for error in "${errors[@]}"; do
19
+ echo -e "- $error\n"
20
+ done
21
+
22
+ exit 1
23
+ fi
24
+
25
+ echo "The environment is ready to push releases!"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -eux
4
+
5
+ npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
6
+ yarn publish --build --access public
package/check-version.ts CHANGED
@@ -7,7 +7,10 @@ const main = () => {
7
7
  if (typeof version !== 'string') {
8
8
  throw `Unexpected type for the package.json version field; got ${typeof version}, expected string`;
9
9
  }
10
- fs.writeFileSync('version.ts', `export const VERSION = '${version}';\n`);
10
+
11
+ const contents = fs.readFileSync('version.ts', 'utf8');
12
+ const output = contents.replace(/(export const VERSION = ')(.*)(')/g, `$1${version}$3`);
13
+ fs.writeFileSync('version.ts', output);
11
14
  };
12
15
 
13
16
  if (require.main === module) {
package/core.ts CHANGED
@@ -9,6 +9,8 @@ import { Readable } from 'stream';
9
9
  import { VERSION } from './version';
10
10
  import { Fetch, getDefaultAgent, getFetch } from './fetch-polyfill';
11
11
 
12
+ const MAX_RETRIES = 2;
13
+
12
14
  export abstract class APIClient {
13
15
  baseURL: string;
14
16
  maxRetries: number;
@@ -20,17 +22,17 @@ export abstract class APIClient {
20
22
 
21
23
  constructor({
22
24
  baseURL,
23
- maxRetries = 2,
25
+ maxRetries,
24
26
  timeout = 60 * 1000, // 60s
25
27
  httpAgent,
26
28
  }: {
27
29
  baseURL: string;
28
- maxRetries?: number;
30
+ maxRetries?: number | undefined;
29
31
  timeout: number | undefined;
30
32
  httpAgent: Agent | undefined;
31
33
  }) {
32
34
  this.baseURL = baseURL;
33
- this.maxRetries = validatePositiveInteger('maxRetries', maxRetries);
35
+ this.maxRetries = validatePositiveInteger('maxRetries', maxRetries ?? MAX_RETRIES);
34
36
  this.timeout = validatePositiveInteger('timeout', timeout);
35
37
  this.httpAgent = httpAgent;
36
38
 
@@ -144,11 +146,29 @@ export abstract class APIClient {
144
146
  return { req, url, timeout };
145
147
  }
146
148
 
149
+ /**
150
+ * Used as a callback for mutating the given `RequestInit` object.
151
+ *
152
+ * This is useful for cases where you want to add certain headers based off of
153
+ * the request properties, e.g. `method` or `url`.
154
+ */
155
+ protected async prepareRequest(request: RequestInit, { url }: { url: string }): Promise<void> {}
156
+
157
+ protected makeStatusError(
158
+ status: number | undefined,
159
+ error: Object | undefined,
160
+ message: string | undefined,
161
+ headers: Headers | undefined,
162
+ ) {
163
+ return APIError.generate(status, error, message, headers);
164
+ }
165
+
147
166
  async request<Req extends {}, Rsp>(
148
167
  options: FinalRequestOptions<Req>,
149
168
  retriesRemaining = options.maxRetries ?? this.maxRetries,
150
169
  ): Promise<APIResponse<Rsp>> {
151
170
  const { req, url, timeout } = this.buildRequest(options);
171
+ await this.prepareRequest(req, { url });
152
172
 
153
173
  this.debug('request', url, options, req.headers);
154
174
 
@@ -174,13 +194,13 @@ export abstract class APIClient {
174
194
 
175
195
  this.debug('response', response.status, url, responseHeaders, errMessage);
176
196
 
177
- const err = APIError.generate(response.status, errJSON, errMessage, responseHeaders);
178
-
197
+ const err = this.makeStatusError(response.status, errJSON, errMessage, responseHeaders);
179
198
  throw err;
180
199
  }
181
200
 
182
201
  if (options.stream) {
183
- // TODO: see if any cast can be removed
202
+ // Note: there is an invariant here that isn't represented in the type system
203
+ // that if you set `stream: true` the response type must also be `Stream<T>`
184
204
  return new Stream<Rsp>(response, controller) as any;
185
205
  }
186
206
 
@@ -217,7 +237,10 @@ export abstract class APIClient {
217
237
  }
218
238
 
219
239
  buildURL<Req>(path: string, query: Req | undefined): string {
220
- const url = isAbsoluteURL(path) ? new URL(path) : new URL(this.baseURL + path);
240
+ const url =
241
+ isAbsoluteURL(path) ?
242
+ new URL(path)
243
+ : new URL(this.baseURL + (this.baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
221
244
 
222
245
  if (query) {
223
246
  url.search = qs.stringify(query, this.qsOptions());
@@ -456,8 +479,7 @@ export class PagePromise<
456
479
  export class Stream<Item> implements AsyncIterable<Item>, APIResponse<Stream<Item>> {
457
480
  response: Response;
458
481
  responseHeaders: Headers;
459
-
460
- private controller: AbortController;
482
+ controller: AbortController;
461
483
 
462
484
  constructor(response: Response, controller: AbortController) {
463
485
  this.response = response;
@@ -467,27 +489,47 @@ export class Stream<Item> implements AsyncIterable<Item>, APIResponse<Stream<Ite
467
489
 
468
490
  async *[Symbol.asyncIterator](): AsyncIterator<Item, any, undefined> {
469
491
  if (!this.response.body) {
470
- // TODO: abort?
492
+ this.controller.abort();
471
493
  throw new Error(`Attempted to iterate over a response with no body`);
472
494
  }
473
495
 
474
496
  for await (const chunk of this.response.body) {
475
- let text;
497
+ let text, done;
476
498
  if (chunk instanceof Buffer) {
477
499
  text = chunk.toString();
478
500
  } else {
479
501
  text = chunk;
480
502
  }
481
503
 
482
- if (text.startsWith('data: ')) {
483
- text = text.substring(6);
484
- }
485
-
486
- if (text.startsWith('[DONE]')) {
487
- break;
504
+ // https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format
505
+ const messages = text.split('\n\n');
506
+ for (const msg of messages) {
507
+ let data = '';
508
+ for (const line of msg.split('\n')) {
509
+ if (line.startsWith('event: ping')) {
510
+ break;
511
+ }
512
+ if (line.startsWith('data: [DONE]')) {
513
+ done = true;
514
+ break;
515
+ }
516
+
517
+ if (line.startsWith('data: ')) {
518
+ data += line.substring(6);
519
+ }
520
+ }
521
+
522
+ if (!data) continue;
523
+ try {
524
+ yield JSON.parse(data);
525
+ } catch (e) {
526
+ console.error(`Could not parse message into JSON:`, data);
527
+ console.error(`From chunk:`, text);
528
+ throw e;
529
+ }
488
530
  }
489
531
 
490
- yield JSON.parse(text);
532
+ if (done) break;
491
533
  }
492
534
 
493
535
  this.controller.abort();
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=check-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-version.d.ts","sourceRoot":"","sources":["../../check-version.ts"],"names":[],"mappings":""}
@@ -13,7 +13,9 @@ const main = () => {
13
13
  if (typeof version !== 'string') {
14
14
  throw `Unexpected type for the package.json version field; got ${typeof version}, expected string`;
15
15
  }
16
- fs_1.default.writeFileSync('version.ts', `export const VERSION = '${version}';\n`);
16
+ const contents = fs_1.default.readFileSync('version.ts', 'utf8');
17
+ const output = contents.replace(/(export const VERSION = ')(.*)(')/g, `$1${version}$3`);
18
+ fs_1.default.writeFileSync('version.ts', output);
17
19
  };
18
20
  if (require.main === module) {
19
21
  main();
@@ -1 +1 @@
1
- {"version":3,"file":"check-version.js","sourceRoot":"","sources":["../../check-version.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AAEpB,MAAM,IAAI,GAAG,GAAG,EAAE;IAChB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,CAA4B,CAAC;IAC9F,MAAM,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;IAC/B,IAAI,CAAC,OAAO;QAAE,MAAM,0DAA0D,CAAC;IAC/E,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,MAAM,2DAA2D,OAAO,OAAO,mBAAmB,CAAC;KACpG;IACD,YAAE,CAAC,aAAa,CAAC,YAAY,EAAE,2BAA2B,OAAO,MAAM,CAAC,CAAC;AAC3E,CAAC,CAAC;AAEF,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;IAC3B,IAAI,EAAE,CAAC;CACR"}
1
+ {"version":3,"file":"check-version.js","sourceRoot":"","sources":["../../check-version.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AAEpB,MAAM,IAAI,GAAG,GAAG,EAAE;IAChB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,CAA4B,CAAC;IAC9F,MAAM,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;IAC/B,IAAI,CAAC,OAAO;QAAE,MAAM,0DAA0D,CAAC;IAC/E,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,MAAM,2DAA2D,OAAO,OAAO,mBAAmB,CAAC;KACpG;IAED,MAAM,QAAQ,GAAG,YAAE,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,oCAAoC,EAAE,KAAK,OAAO,IAAI,CAAC,CAAC;IACxF,YAAE,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;IAC3B,IAAI,EAAE,CAAC;CACR"}
@@ -1,6 +1,5 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- /// <reference types="web" />
4
3
  /// <reference types="node" />
5
4
  /// <reference types="node" />
6
5
  import qs from 'qs';
@@ -22,7 +21,7 @@ export declare abstract class APIClient {
22
21
  httpAgent,
23
22
  }: {
24
23
  baseURL: string;
25
- maxRetries?: number;
24
+ maxRetries?: number | undefined;
26
25
  timeout: number | undefined;
27
26
  httpAgent: Agent | undefined;
28
27
  });
@@ -67,6 +66,26 @@ export declare abstract class APIClient {
67
66
  url: string;
68
67
  timeout: number;
69
68
  };
69
+ /**
70
+ * Used as a callback for mutating the given `RequestInit` object.
71
+ *
72
+ * This is useful for cases where you want to add certain headers based off of
73
+ * the request properties, e.g. `method` or `url`.
74
+ */
75
+ protected prepareRequest(
76
+ request: RequestInit,
77
+ {
78
+ url,
79
+ }: {
80
+ url: string;
81
+ },
82
+ ): Promise<void>;
83
+ protected makeStatusError(
84
+ status: number | undefined,
85
+ error: Object | undefined,
86
+ message: string | undefined,
87
+ headers: Headers | undefined,
88
+ ): APIError;
70
89
  request<Req extends {}, Rsp>(
71
90
  options: FinalRequestOptions<Req>,
72
91
  retriesRemaining?: number,
@@ -154,7 +173,7 @@ export declare class PagePromise<
154
173
  export declare class Stream<Item> implements AsyncIterable<Item>, APIResponse<Stream<Item>> {
155
174
  response: Response;
156
175
  responseHeaders: Headers;
157
- private controller;
176
+ controller: AbortController;
158
177
  constructor(response: Response, controller: AbortController);
159
178
  [Symbol.asyncIterator](): AsyncIterator<Item, any, undefined>;
160
179
  }
@@ -260,3 +279,4 @@ export type HeadersLike = Record<string, string | string[] | undefined> | Header
260
279
  export declare const isHeadersProtocol: (headers: any) => headers is HeadersProtocol;
261
280
  export declare const getHeader: (headers: HeadersLike, key: string) => string | null | undefined;
262
281
  export {};
282
+ //# sourceMappingURL=core.d.ts.map