@payabli/sdk-node 0.0.116 → 0.0.123

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 (271) hide show
  1. package/README.md +31 -2
  2. package/dist/cjs/BaseClient.d.ts +13 -4
  3. package/dist/cjs/BaseClient.js +59 -0
  4. package/dist/cjs/Client.d.ts +88 -88
  5. package/dist/cjs/Client.js +31 -72
  6. package/dist/cjs/api/errors/BadRequestError.js +5 -1
  7. package/dist/cjs/api/errors/ConflictError.js +5 -1
  8. package/dist/cjs/api/errors/ForbiddenError.js +5 -1
  9. package/dist/cjs/api/errors/InternalServerError.js +5 -1
  10. package/dist/cjs/api/errors/ServiceUnavailableError.js +5 -1
  11. package/dist/cjs/api/errors/UnauthorizedError.js +5 -1
  12. package/dist/cjs/api/resources/bill/client/Client.d.ts +34 -35
  13. package/dist/cjs/api/resources/bill/client/Client.js +69 -216
  14. package/dist/cjs/api/resources/boarding/client/Client.d.ts +28 -29
  15. package/dist/cjs/api/resources/boarding/client/Client.js +51 -198
  16. package/dist/cjs/api/resources/chargeBacks/client/Client.d.ts +18 -17
  17. package/dist/cjs/api/resources/chargeBacks/client/Client.js +38 -79
  18. package/dist/cjs/api/resources/checkCapture/client/Client.d.ts +8 -9
  19. package/dist/cjs/api/resources/checkCapture/client/Client.js +11 -28
  20. package/dist/cjs/api/resources/cloud/client/Client.d.ts +18 -19
  21. package/dist/cjs/api/resources/cloud/client/Client.js +33 -89
  22. package/dist/cjs/api/resources/customer/client/Client.d.ts +18 -19
  23. package/dist/cjs/api/resources/customer/client/Client.js +31 -113
  24. package/dist/cjs/api/resources/export/client/Client.d.ts +94 -91
  25. package/dist/cjs/api/resources/export/client/Client.js +205 -582
  26. package/dist/cjs/api/resources/hostedPaymentPages/client/Client.d.ts +12 -13
  27. package/dist/cjs/api/resources/hostedPaymentPages/client/Client.js +19 -62
  28. package/dist/cjs/api/resources/import/client/Client.d.ts +12 -13
  29. package/dist/cjs/api/resources/import/client/Client.js +19 -62
  30. package/dist/cjs/api/resources/invoice/client/Client.d.ts +37 -36
  31. package/dist/cjs/api/resources/invoice/client/Client.js +67 -212
  32. package/dist/cjs/api/resources/invoice/client/requests/AddInvoiceRequest.d.ts +5 -3
  33. package/dist/cjs/api/resources/lineItem/client/Client.d.ts +16 -17
  34. package/dist/cjs/api/resources/lineItem/client/Client.js +27 -96
  35. package/dist/cjs/api/resources/moneyIn/client/Client.d.ts +40 -41
  36. package/dist/cjs/api/resources/moneyIn/client/Client.js +79 -249
  37. package/dist/cjs/api/resources/moneyIn/errors/CaptureError.js +5 -1
  38. package/dist/cjs/api/resources/moneyIn/errors/InvalidTransStatusError.js +5 -1
  39. package/dist/cjs/api/resources/moneyOut/client/Client.d.ts +44 -28
  40. package/dist/cjs/api/resources/moneyOut/client/Client.js +105 -168
  41. package/dist/cjs/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.d.ts +2 -1
  42. package/dist/cjs/api/resources/moneyOutTypes/types/AuthorizePayoutBody.d.ts +3 -1
  43. package/dist/cjs/api/resources/notification/client/Client.d.ts +30 -18
  44. package/dist/cjs/api/resources/notification/client/Client.js +45 -101
  45. package/dist/cjs/api/resources/notificationlogs/client/Client.d.ts +14 -15
  46. package/dist/cjs/api/resources/notificationlogs/client/Client.js +23 -79
  47. package/dist/cjs/api/resources/ocr/client/Client.d.ts +14 -11
  48. package/dist/cjs/api/resources/ocr/client/Client.js +19 -45
  49. package/dist/cjs/api/resources/organization/client/Client.d.ts +20 -21
  50. package/dist/cjs/api/resources/organization/client/Client.js +35 -130
  51. package/dist/cjs/api/resources/paymentLink/client/Client.d.ts +27 -28
  52. package/dist/cjs/api/resources/paymentLink/client/Client.js +46 -167
  53. package/dist/cjs/api/resources/paymentLink/client/requests/PayLinkDataBill.d.ts +1 -1
  54. package/dist/cjs/api/resources/paymentLink/client/requests/PayLinkDataInvoice.d.ts +1 -1
  55. package/dist/cjs/api/resources/paymentLink/client/requests/PayLinkDataOut.d.ts +1 -1
  56. package/dist/cjs/api/resources/paymentLink/types/PaymentPageRequestBody.d.ts +2 -2
  57. package/dist/cjs/api/resources/paymentMethodDomain/client/Client.d.ts +20 -21
  58. package/dist/cjs/api/resources/paymentMethodDomain/client/Client.js +35 -130
  59. package/dist/cjs/api/resources/paypoint/client/Client.d.ts +23 -24
  60. package/dist/cjs/api/resources/paypoint/client/Client.js +44 -152
  61. package/dist/cjs/api/resources/query/client/Client.d.ts +72 -73
  62. package/dist/cjs/api/resources/query/client/Client.js +137 -572
  63. package/dist/cjs/api/resources/query/client/requests/ListPayoutOrgRequest.d.ts +1 -0
  64. package/dist/cjs/api/resources/query/client/requests/ListPayoutRequest.d.ts +1 -0
  65. package/dist/cjs/api/resources/query/client/requests/ListTransactionsRequest.d.ts +1 -0
  66. package/dist/cjs/api/resources/statistic/client/Client.d.ts +51 -52
  67. package/dist/cjs/api/resources/statistic/client/Client.js +80 -133
  68. package/dist/cjs/api/resources/statistic/client/requests/BasicStatsRequest.d.ts +2 -2
  69. package/dist/cjs/api/resources/statistic/types/StatBasicExtendedQueryRecord.d.ts +76 -0
  70. package/dist/cjs/api/resources/statistic/types/StatBasicExtendedQueryRecord.js +3 -0
  71. package/dist/cjs/api/resources/statistic/types/index.d.ts +1 -0
  72. package/dist/cjs/api/resources/statistic/types/index.js +1 -0
  73. package/dist/cjs/api/resources/subscription/client/Client.d.ts +14 -15
  74. package/dist/cjs/api/resources/subscription/client/Client.js +23 -79
  75. package/dist/cjs/api/resources/templates/client/Client.d.ts +16 -17
  76. package/dist/cjs/api/resources/templates/client/Client.js +28 -84
  77. package/dist/cjs/api/resources/tokenStorage/client/Client.d.ts +14 -15
  78. package/dist/cjs/api/resources/tokenStorage/client/Client.js +23 -79
  79. package/dist/cjs/api/resources/tokenStorage/types/GetMethodResponse.d.ts +1 -1
  80. package/dist/cjs/api/resources/user/client/Client.d.ts +55 -34
  81. package/dist/cjs/api/resources/user/client/Client.js +84 -222
  82. package/dist/cjs/api/resources/vendor/client/Client.d.ts +14 -15
  83. package/dist/cjs/api/resources/vendor/client/Client.js +23 -79
  84. package/dist/cjs/api/resources/wallet/client/Client.d.ts +14 -15
  85. package/dist/cjs/api/resources/wallet/client/Client.js +23 -79
  86. package/dist/cjs/api/types/ApplicationDetailsRecord.d.ts +2 -2
  87. package/dist/cjs/api/types/Frequency.d.ts +1 -1
  88. package/dist/cjs/api/types/Frequency.js +1 -1
  89. package/dist/cjs/api/types/FrequencyList.d.ts +1 -1
  90. package/dist/cjs/api/types/NotificationContent.d.ts +1 -0
  91. package/dist/cjs/api/types/NotificationContent.js +1 -0
  92. package/dist/cjs/api/types/NotificationStandardRequest.d.ts +1 -0
  93. package/dist/cjs/api/types/NotificationStandardRequest.js +1 -0
  94. package/dist/cjs/api/types/PayorDataResponse.d.ts +1 -1
  95. package/dist/cjs/api/types/QueryResponseSettlements.d.ts +1 -1
  96. package/dist/cjs/auth/HeaderAuthProvider.d.ts +16 -0
  97. package/dist/cjs/auth/HeaderAuthProvider.js +71 -0
  98. package/dist/cjs/auth/index.d.ts +1 -0
  99. package/dist/cjs/auth/index.js +5 -0
  100. package/dist/cjs/core/auth/AuthProvider.d.ts +7 -0
  101. package/dist/cjs/core/auth/AuthProvider.js +2 -0
  102. package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
  103. package/dist/cjs/core/auth/AuthRequest.js +2 -0
  104. package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
  105. package/dist/cjs/core/auth/BasicAuth.js +27 -0
  106. package/dist/cjs/core/auth/BearerToken.d.ts +7 -0
  107. package/dist/cjs/core/auth/BearerToken.js +16 -0
  108. package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
  109. package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
  110. package/dist/cjs/core/auth/index.d.ts +5 -0
  111. package/dist/cjs/core/auth/index.js +9 -0
  112. package/dist/cjs/core/base64.d.ts +2 -0
  113. package/dist/cjs/core/base64.js +26 -0
  114. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +6 -7
  115. package/dist/cjs/core/fetcher/Fetcher.d.ts +5 -1
  116. package/dist/cjs/core/fetcher/Fetcher.js +42 -24
  117. package/dist/cjs/core/fetcher/getResponseBody.js +18 -4
  118. package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
  119. package/dist/cjs/core/fetcher/makeRequest.js +0 -2
  120. package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
  121. package/dist/cjs/core/fetcher/signals.d.ts +1 -7
  122. package/dist/cjs/core/fetcher/signals.js +0 -12
  123. package/dist/cjs/core/index.d.ts +2 -0
  124. package/dist/cjs/core/index.js +2 -0
  125. package/dist/cjs/core/logging/logger.js +1 -1
  126. package/dist/cjs/core/runtime/runtime.js +11 -10
  127. package/dist/cjs/core/url/join.js +0 -1
  128. package/dist/cjs/errors/PayabliError.js +5 -1
  129. package/dist/cjs/errors/PayabliTimeoutError.js +5 -1
  130. package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
  131. package/dist/cjs/errors/handleNonStatusCodeError.js +65 -0
  132. package/dist/cjs/version.d.ts +1 -1
  133. package/dist/cjs/version.js +1 -1
  134. package/dist/esm/BaseClient.d.mts +13 -4
  135. package/dist/esm/BaseClient.mjs +24 -1
  136. package/dist/esm/Client.d.mts +88 -88
  137. package/dist/esm/Client.mjs +59 -67
  138. package/dist/esm/api/errors/BadRequestError.mjs +5 -1
  139. package/dist/esm/api/errors/ConflictError.mjs +5 -1
  140. package/dist/esm/api/errors/ForbiddenError.mjs +5 -1
  141. package/dist/esm/api/errors/InternalServerError.mjs +5 -1
  142. package/dist/esm/api/errors/ServiceUnavailableError.mjs +5 -1
  143. package/dist/esm/api/errors/UnauthorizedError.mjs +5 -1
  144. package/dist/esm/api/resources/bill/client/Client.d.mts +34 -35
  145. package/dist/esm/api/resources/bill/client/Client.mjs +67 -214
  146. package/dist/esm/api/resources/boarding/client/Client.d.mts +28 -29
  147. package/dist/esm/api/resources/boarding/client/Client.mjs +50 -197
  148. package/dist/esm/api/resources/chargeBacks/client/Client.d.mts +18 -17
  149. package/dist/esm/api/resources/chargeBacks/client/Client.mjs +36 -77
  150. package/dist/esm/api/resources/checkCapture/client/Client.d.mts +8 -9
  151. package/dist/esm/api/resources/checkCapture/client/Client.mjs +10 -27
  152. package/dist/esm/api/resources/cloud/client/Client.d.mts +18 -19
  153. package/dist/esm/api/resources/cloud/client/Client.mjs +31 -87
  154. package/dist/esm/api/resources/customer/client/Client.d.mts +18 -19
  155. package/dist/esm/api/resources/customer/client/Client.mjs +29 -111
  156. package/dist/esm/api/resources/export/client/Client.d.mts +94 -91
  157. package/dist/esm/api/resources/export/client/Client.mjs +204 -581
  158. package/dist/esm/api/resources/hostedPaymentPages/client/Client.d.mts +12 -13
  159. package/dist/esm/api/resources/hostedPaymentPages/client/Client.mjs +17 -60
  160. package/dist/esm/api/resources/import/client/Client.d.mts +12 -13
  161. package/dist/esm/api/resources/import/client/Client.mjs +17 -60
  162. package/dist/esm/api/resources/invoice/client/Client.d.mts +37 -36
  163. package/dist/esm/api/resources/invoice/client/Client.mjs +65 -210
  164. package/dist/esm/api/resources/invoice/client/requests/AddInvoiceRequest.d.mts +5 -3
  165. package/dist/esm/api/resources/lineItem/client/Client.d.mts +16 -17
  166. package/dist/esm/api/resources/lineItem/client/Client.mjs +25 -94
  167. package/dist/esm/api/resources/moneyIn/client/Client.d.mts +40 -41
  168. package/dist/esm/api/resources/moneyIn/client/Client.mjs +77 -247
  169. package/dist/esm/api/resources/moneyIn/errors/CaptureError.mjs +5 -1
  170. package/dist/esm/api/resources/moneyIn/errors/InvalidTransStatusError.mjs +5 -1
  171. package/dist/esm/api/resources/moneyOut/client/Client.d.mts +44 -28
  172. package/dist/esm/api/resources/moneyOut/client/Client.mjs +103 -166
  173. package/dist/esm/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.d.mts +2 -1
  174. package/dist/esm/api/resources/moneyOutTypes/types/AuthorizePayoutBody.d.mts +3 -1
  175. package/dist/esm/api/resources/notification/client/Client.d.mts +30 -18
  176. package/dist/esm/api/resources/notification/client/Client.mjs +44 -100
  177. package/dist/esm/api/resources/notificationlogs/client/Client.d.mts +14 -15
  178. package/dist/esm/api/resources/notificationlogs/client/Client.mjs +22 -78
  179. package/dist/esm/api/resources/ocr/client/Client.d.mts +14 -11
  180. package/dist/esm/api/resources/ocr/client/Client.mjs +18 -44
  181. package/dist/esm/api/resources/organization/client/Client.d.mts +20 -21
  182. package/dist/esm/api/resources/organization/client/Client.mjs +33 -128
  183. package/dist/esm/api/resources/paymentLink/client/Client.d.mts +27 -28
  184. package/dist/esm/api/resources/paymentLink/client/Client.mjs +44 -165
  185. package/dist/esm/api/resources/paymentLink/client/requests/PayLinkDataBill.d.mts +1 -1
  186. package/dist/esm/api/resources/paymentLink/client/requests/PayLinkDataInvoice.d.mts +1 -1
  187. package/dist/esm/api/resources/paymentLink/client/requests/PayLinkDataOut.d.mts +1 -1
  188. package/dist/esm/api/resources/paymentLink/types/PaymentPageRequestBody.d.mts +2 -2
  189. package/dist/esm/api/resources/paymentMethodDomain/client/Client.d.mts +20 -21
  190. package/dist/esm/api/resources/paymentMethodDomain/client/Client.mjs +34 -129
  191. package/dist/esm/api/resources/paypoint/client/Client.d.mts +23 -24
  192. package/dist/esm/api/resources/paypoint/client/Client.mjs +43 -151
  193. package/dist/esm/api/resources/query/client/Client.d.mts +72 -73
  194. package/dist/esm/api/resources/query/client/Client.mjs +136 -571
  195. package/dist/esm/api/resources/query/client/requests/ListPayoutOrgRequest.d.mts +1 -0
  196. package/dist/esm/api/resources/query/client/requests/ListPayoutRequest.d.mts +1 -0
  197. package/dist/esm/api/resources/query/client/requests/ListTransactionsRequest.d.mts +1 -0
  198. package/dist/esm/api/resources/statistic/client/Client.d.mts +51 -52
  199. package/dist/esm/api/resources/statistic/client/Client.mjs +79 -132
  200. package/dist/esm/api/resources/statistic/client/requests/BasicStatsRequest.d.mts +2 -2
  201. package/dist/esm/api/resources/statistic/types/StatBasicExtendedQueryRecord.d.mts +76 -0
  202. package/dist/esm/api/resources/statistic/types/StatBasicExtendedQueryRecord.mjs +2 -0
  203. package/dist/esm/api/resources/statistic/types/index.d.mts +1 -0
  204. package/dist/esm/api/resources/statistic/types/index.mjs +1 -0
  205. package/dist/esm/api/resources/subscription/client/Client.d.mts +14 -15
  206. package/dist/esm/api/resources/subscription/client/Client.mjs +21 -77
  207. package/dist/esm/api/resources/templates/client/Client.d.mts +16 -17
  208. package/dist/esm/api/resources/templates/client/Client.mjs +27 -83
  209. package/dist/esm/api/resources/tokenStorage/client/Client.d.mts +14 -15
  210. package/dist/esm/api/resources/tokenStorage/client/Client.mjs +21 -77
  211. package/dist/esm/api/resources/tokenStorage/types/GetMethodResponse.d.mts +1 -1
  212. package/dist/esm/api/resources/user/client/Client.d.mts +55 -34
  213. package/dist/esm/api/resources/user/client/Client.mjs +83 -221
  214. package/dist/esm/api/resources/vendor/client/Client.d.mts +14 -15
  215. package/dist/esm/api/resources/vendor/client/Client.mjs +22 -78
  216. package/dist/esm/api/resources/wallet/client/Client.d.mts +14 -15
  217. package/dist/esm/api/resources/wallet/client/Client.mjs +22 -78
  218. package/dist/esm/api/types/ApplicationDetailsRecord.d.mts +2 -2
  219. package/dist/esm/api/types/Frequency.d.mts +1 -1
  220. package/dist/esm/api/types/Frequency.mjs +1 -1
  221. package/dist/esm/api/types/FrequencyList.d.mts +1 -1
  222. package/dist/esm/api/types/NotificationContent.d.mts +1 -0
  223. package/dist/esm/api/types/NotificationContent.mjs +1 -0
  224. package/dist/esm/api/types/NotificationStandardRequest.d.mts +1 -0
  225. package/dist/esm/api/types/NotificationStandardRequest.mjs +1 -0
  226. package/dist/esm/api/types/PayorDataResponse.d.mts +1 -1
  227. package/dist/esm/api/types/QueryResponseSettlements.d.mts +1 -1
  228. package/dist/esm/auth/HeaderAuthProvider.d.mts +16 -0
  229. package/dist/esm/auth/HeaderAuthProvider.mjs +34 -0
  230. package/dist/esm/auth/index.d.mts +1 -0
  231. package/dist/esm/auth/index.mjs +1 -0
  232. package/dist/esm/core/auth/AuthProvider.d.mts +7 -0
  233. package/dist/esm/core/auth/AuthProvider.mjs +1 -0
  234. package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
  235. package/dist/esm/core/auth/AuthRequest.mjs +1 -0
  236. package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
  237. package/dist/esm/core/auth/BasicAuth.mjs +24 -0
  238. package/dist/esm/core/auth/BearerToken.d.mts +7 -0
  239. package/dist/esm/core/auth/BearerToken.mjs +13 -0
  240. package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
  241. package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
  242. package/dist/esm/core/auth/index.d.mts +5 -0
  243. package/dist/esm/core/auth/index.mjs +3 -0
  244. package/dist/esm/core/base64.d.mts +2 -0
  245. package/dist/esm/core/base64.mjs +22 -0
  246. package/dist/esm/core/fetcher/BinaryResponse.d.mts +6 -7
  247. package/dist/esm/core/fetcher/Fetcher.d.mts +5 -1
  248. package/dist/esm/core/fetcher/Fetcher.mjs +42 -24
  249. package/dist/esm/core/fetcher/getResponseBody.mjs +18 -4
  250. package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
  251. package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
  252. package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
  253. package/dist/esm/core/fetcher/signals.d.mts +1 -7
  254. package/dist/esm/core/fetcher/signals.mjs +0 -12
  255. package/dist/esm/core/index.d.mts +2 -0
  256. package/dist/esm/core/index.mjs +2 -0
  257. package/dist/esm/core/logging/logger.mjs +1 -1
  258. package/dist/esm/core/runtime/runtime.mjs +11 -10
  259. package/dist/esm/core/url/join.mjs +0 -1
  260. package/dist/esm/errors/PayabliError.mjs +5 -1
  261. package/dist/esm/errors/PayabliTimeoutError.mjs +5 -1
  262. package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
  263. package/dist/esm/errors/handleNonStatusCodeError.mjs +29 -0
  264. package/dist/esm/version.d.mts +1 -1
  265. package/dist/esm/version.mjs +1 -1
  266. package/package.json +5 -2
  267. package/reference.md +768 -478
  268. package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +0 -4
  269. package/dist/cjs/core/fetcher/ResponseWithBody.js +0 -6
  270. package/dist/esm/core/fetcher/ResponseWithBody.d.mts +0 -4
  271. package/dist/esm/core/fetcher/ResponseWithBody.mjs +0 -3
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.HeaderAuthProvider = void 0;
47
+ const core = __importStar(require("../core/index.js"));
48
+ const errors = __importStar(require("../errors/index.js"));
49
+ class HeaderAuthProvider {
50
+ constructor(options) {
51
+ this.headerValue = options.apiKey;
52
+ }
53
+ static canCreate(options) {
54
+ return options.apiKey != null;
55
+ }
56
+ getAuthRequest(_arg) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ const apiKey = yield core.Supplier.get(this.headerValue);
59
+ if (apiKey == null) {
60
+ throw new errors.PayabliError({
61
+ message: "Please specify a apiKey by passing it in to the constructor",
62
+ });
63
+ }
64
+ const headerValue = apiKey;
65
+ return {
66
+ headers: { requestToken: headerValue },
67
+ };
68
+ });
69
+ }
70
+ }
71
+ exports.HeaderAuthProvider = HeaderAuthProvider;
@@ -0,0 +1 @@
1
+ export { HeaderAuthProvider } from "./HeaderAuthProvider.js";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HeaderAuthProvider = void 0;
4
+ var HeaderAuthProvider_js_1 = require("./HeaderAuthProvider.js");
5
+ Object.defineProperty(exports, "HeaderAuthProvider", { enumerable: true, get: function () { return HeaderAuthProvider_js_1.HeaderAuthProvider; } });
@@ -0,0 +1,7 @@
1
+ import type { EndpointMetadata } from "../fetcher/EndpointMetadata.js";
2
+ import type { AuthRequest } from "./AuthRequest.js";
3
+ export interface AuthProvider {
4
+ getAuthRequest(arg?: {
5
+ endpointMetadata?: EndpointMetadata;
6
+ }): Promise<AuthRequest>;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Request parameters for authentication requests.
3
+ */
4
+ export interface AuthRequest {
5
+ /**
6
+ * The headers to be included in the request.
7
+ */
8
+ headers: Record<string, string>;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ export interface BasicAuth {
2
+ username: string;
3
+ password: string;
4
+ }
5
+ export declare const BasicAuth: {
6
+ toAuthorizationHeader: (basicAuth: BasicAuth | undefined) => string | undefined;
7
+ fromAuthorizationHeader: (header: string) => BasicAuth;
8
+ };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasicAuth = void 0;
4
+ const base64_js_1 = require("../base64.js");
5
+ const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
6
+ exports.BasicAuth = {
7
+ toAuthorizationHeader: (basicAuth) => {
8
+ if (basicAuth == null) {
9
+ return undefined;
10
+ }
11
+ const token = (0, base64_js_1.base64Encode)(`${basicAuth.username}:${basicAuth.password}`);
12
+ return `Basic ${token}`;
13
+ },
14
+ fromAuthorizationHeader: (header) => {
15
+ const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, "");
16
+ const decoded = (0, base64_js_1.base64Decode)(credentials);
17
+ const [username, ...passwordParts] = decoded.split(":");
18
+ const password = passwordParts.length > 0 ? passwordParts.join(":") : undefined;
19
+ if (username == null || password == null) {
20
+ throw new Error("Invalid basic auth");
21
+ }
22
+ return {
23
+ username,
24
+ password,
25
+ };
26
+ },
27
+ };
@@ -0,0 +1,7 @@
1
+ export type BearerToken = string;
2
+ declare function toAuthorizationHeader(token: string | undefined): string | undefined;
3
+ export declare const BearerToken: {
4
+ toAuthorizationHeader: typeof toAuthorizationHeader;
5
+ fromAuthorizationHeader: (header: string) => BearerToken;
6
+ };
7
+ export {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BearerToken = void 0;
4
+ const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i;
5
+ function toAuthorizationHeader(token) {
6
+ if (token == null) {
7
+ return undefined;
8
+ }
9
+ return `Bearer ${token}`;
10
+ }
11
+ exports.BearerToken = {
12
+ toAuthorizationHeader: toAuthorizationHeader,
13
+ fromAuthorizationHeader: (header) => {
14
+ return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim();
15
+ },
16
+ };
@@ -0,0 +1,5 @@
1
+ import type { AuthProvider } from "./AuthProvider.js";
2
+ import type { AuthRequest } from "./AuthRequest.js";
3
+ export declare class NoOpAuthProvider implements AuthProvider {
4
+ getAuthRequest(): Promise<AuthRequest>;
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NoOpAuthProvider = void 0;
4
+ class NoOpAuthProvider {
5
+ getAuthRequest() {
6
+ return Promise.resolve({ headers: {} });
7
+ }
8
+ }
9
+ exports.NoOpAuthProvider = NoOpAuthProvider;
@@ -0,0 +1,5 @@
1
+ export type { AuthProvider } from "./AuthProvider.js";
2
+ export type { AuthRequest } from "./AuthRequest.js";
3
+ export { BasicAuth } from "./BasicAuth.js";
4
+ export { BearerToken } from "./BearerToken.js";
5
+ export { NoOpAuthProvider } from "./NoOpAuthProvider.js";
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NoOpAuthProvider = exports.BearerToken = exports.BasicAuth = void 0;
4
+ var BasicAuth_js_1 = require("./BasicAuth.js");
5
+ Object.defineProperty(exports, "BasicAuth", { enumerable: true, get: function () { return BasicAuth_js_1.BasicAuth; } });
6
+ var BearerToken_js_1 = require("./BearerToken.js");
7
+ Object.defineProperty(exports, "BearerToken", { enumerable: true, get: function () { return BearerToken_js_1.BearerToken; } });
8
+ var NoOpAuthProvider_js_1 = require("./NoOpAuthProvider.js");
9
+ Object.defineProperty(exports, "NoOpAuthProvider", { enumerable: true, get: function () { return NoOpAuthProvider_js_1.NoOpAuthProvider; } });
@@ -0,0 +1,2 @@
1
+ export declare function base64Encode(input: string): string;
2
+ export declare function base64Decode(input: string): string;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.base64Encode = base64Encode;
4
+ exports.base64Decode = base64Decode;
5
+ function base64ToBytes(base64) {
6
+ const binString = atob(base64);
7
+ return Uint8Array.from(binString, (m) => m.codePointAt(0));
8
+ }
9
+ function bytesToBase64(bytes) {
10
+ const binString = String.fromCodePoint(...bytes);
11
+ return btoa(binString);
12
+ }
13
+ function base64Encode(input) {
14
+ if (typeof Buffer !== "undefined") {
15
+ return Buffer.from(input, "utf8").toString("base64");
16
+ }
17
+ const bytes = new TextEncoder().encode(input);
18
+ return bytesToBase64(bytes);
19
+ }
20
+ function base64Decode(input) {
21
+ if (typeof Buffer !== "undefined") {
22
+ return Buffer.from(input, "base64").toString("utf8");
23
+ }
24
+ const bytes = base64ToBytes(input);
25
+ return new TextDecoder().decode(bytes);
26
+ }
@@ -1,20 +1,19 @@
1
- import type { ResponseWithBody } from "./ResponseWithBody.js";
2
1
  export type BinaryResponse = {
3
2
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
4
- bodyUsed: boolean;
3
+ bodyUsed: Response["bodyUsed"];
5
4
  /**
6
5
  * Returns a ReadableStream of the response body.
7
6
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body)
8
7
  */
9
- stream: () => ReadableStream<Uint8Array>;
8
+ stream: () => Response["body"];
10
9
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
11
- arrayBuffer: () => Promise<ArrayBuffer>;
10
+ arrayBuffer: () => ReturnType<Response["arrayBuffer"]>;
12
11
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */
13
- blob: () => Promise<Blob>;
12
+ blob: () => ReturnType<Response["blob"]>;
14
13
  /**
15
14
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes)
16
15
  * Some versions of the Fetch API may not support this method.
17
16
  */
18
- bytes?(): Promise<Uint8Array>;
17
+ bytes?(): ReturnType<Response["bytes"]>;
19
18
  };
20
- export declare function getBinaryResponse(response: ResponseWithBody): BinaryResponse;
19
+ export declare function getBinaryResponse(response: Response): BinaryResponse;
@@ -22,7 +22,7 @@ export declare namespace Fetcher {
22
22
  fetchFn?: typeof fetch;
23
23
  logging?: LogConfig | Logger;
24
24
  }
25
- type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError;
25
+ type Error = FailedStatusCodeError | NonJsonError | BodyIsNullError | TimeoutError | UnknownError;
26
26
  interface FailedStatusCodeError {
27
27
  reason: "status-code";
28
28
  statusCode: number;
@@ -33,6 +33,10 @@ export declare namespace Fetcher {
33
33
  statusCode: number;
34
34
  rawBody: string;
35
35
  }
36
+ interface BodyIsNullError {
37
+ reason: "body-is-null";
38
+ statusCode: number;
39
+ }
36
40
  interface TimeoutError {
37
41
  reason: "timeout";
38
42
  }
@@ -19,23 +19,31 @@ const getErrorResponseBody_js_1 = require("./getErrorResponseBody.js");
19
19
  const getFetchFn_js_1 = require("./getFetchFn.js");
20
20
  const getRequestBody_js_1 = require("./getRequestBody.js");
21
21
  const getResponseBody_js_1 = require("./getResponseBody.js");
22
+ const Headers_js_1 = require("./Headers.js");
22
23
  const makeRequest_js_1 = require("./makeRequest.js");
23
24
  const RawResponse_js_1 = require("./RawResponse.js");
24
25
  const requestWithRetries_js_1 = require("./requestWithRetries.js");
25
26
  const SENSITIVE_HEADERS = new Set([
26
27
  "authorization",
28
+ "www-authenticate",
27
29
  "x-api-key",
28
30
  "api-key",
31
+ "apikey",
32
+ "x-api-token",
29
33
  "x-auth-token",
34
+ "auth-token",
30
35
  "cookie",
31
36
  "set-cookie",
32
37
  "proxy-authorization",
38
+ "proxy-authenticate",
33
39
  "x-csrf-token",
34
40
  "x-xsrf-token",
41
+ "x-session-token",
42
+ "x-access-token",
35
43
  ]);
36
44
  function redactHeaders(headers) {
37
45
  const filtered = {};
38
- for (const [key, value] of Object.entries(headers)) {
46
+ for (const [key, value] of headers instanceof Headers_js_1.Headers ? headers.entries() : Object.entries(headers)) {
39
47
  if (SENSITIVE_HEADERS.has(key.toLowerCase())) {
40
48
  filtered[key] = "[REDACTED]";
41
49
  }
@@ -85,20 +93,26 @@ function redactUrl(url) {
85
93
  if (protocolIndex === -1)
86
94
  return url;
87
95
  const afterProtocol = protocolIndex + 3;
88
- const atIndex = url.indexOf("@", afterProtocol);
89
- if (atIndex !== -1) {
90
- const pathStart = url.indexOf("/", afterProtocol);
91
- const queryStart = url.indexOf("?", afterProtocol);
92
- const fragmentStart = url.indexOf("#", afterProtocol);
93
- const firstDelimiter = Math.min(pathStart === -1 ? url.length : pathStart, queryStart === -1 ? url.length : queryStart, fragmentStart === -1 ? url.length : fragmentStart);
94
- if (atIndex < firstDelimiter) {
95
- url = `${url.slice(0, afterProtocol)}[REDACTED]@${url.slice(atIndex + 1)}`;
96
+ // Find the first delimiter that marks the end of the authority section
97
+ const pathStart = url.indexOf("/", afterProtocol);
98
+ let queryStart = url.indexOf("?", afterProtocol);
99
+ let fragmentStart = url.indexOf("#", afterProtocol);
100
+ const firstDelimiter = Math.min(pathStart === -1 ? url.length : pathStart, queryStart === -1 ? url.length : queryStart, fragmentStart === -1 ? url.length : fragmentStart);
101
+ // Find the LAST @ before the delimiter (handles multiple @ in credentials)
102
+ let atIndex = -1;
103
+ for (let i = afterProtocol; i < firstDelimiter; i++) {
104
+ if (url[i] === "@") {
105
+ atIndex = i;
96
106
  }
97
107
  }
98
- const queryStart = url.indexOf("?");
108
+ if (atIndex !== -1) {
109
+ url = `${url.slice(0, afterProtocol)}[REDACTED]@${url.slice(atIndex + 1)}`;
110
+ }
111
+ // Recalculate queryStart since url might have changed
112
+ queryStart = url.indexOf("?");
99
113
  if (queryStart === -1)
100
114
  return url;
101
- const fragmentStart = url.indexOf("#", queryStart);
115
+ fragmentStart = url.indexOf("#", queryStart);
102
116
  const queryEnd = fragmentStart !== -1 ? fragmentStart : url.length;
103
117
  const queryString = url.slice(queryStart + 1, queryEnd);
104
118
  if (queryString.length === 0)
@@ -106,15 +120,15 @@ function redactUrl(url) {
106
120
  // FAST PATH: Quick check if any sensitive keywords present
107
121
  // Using indexOf is faster than regex for simple substring matching
108
122
  const lower = queryString.toLowerCase();
109
- const hasSensitive = lower.includes("token") || // catches token, access_token, auth_token, etc.
110
- lower.includes("key") || // catches key, api_key, apikey, api-key, etc.
111
- lower.includes("password") || // catches password
112
- lower.includes("passwd") || // catches passwd
113
- lower.includes("secret") || // catches secret, api_secret, etc.
114
- lower.includes("session") || // catches session, session_id, session-id
115
- lower.includes("auth"); // catches auth_token, auth-token, etc.
123
+ const hasSensitive = lower.includes("token") ||
124
+ lower.includes("key") ||
125
+ lower.includes("password") ||
126
+ lower.includes("passwd") ||
127
+ lower.includes("secret") ||
128
+ lower.includes("session") ||
129
+ lower.includes("auth");
116
130
  if (!hasSensitive) {
117
- return url; // Early exit - no sensitive params
131
+ return url;
118
132
  }
119
133
  // SLOW PATH: Parse and redact
120
134
  const redactedParams = [];
@@ -141,9 +155,10 @@ function redactUrl(url) {
141
155
  function getHeaders(args) {
142
156
  return __awaiter(this, void 0, void 0, function* () {
143
157
  var _a;
144
- const newHeaders = {};
158
+ const newHeaders = new Headers_js_1.Headers();
159
+ newHeaders.set("Accept", args.responseType === "json" ? "application/json" : args.responseType === "text" ? "text/plain" : "*/*");
145
160
  if (args.body !== undefined && args.contentType != null) {
146
- newHeaders["Content-Type"] = args.contentType;
161
+ newHeaders.set("Content-Type", args.contentType);
147
162
  }
148
163
  if (args.headers == null) {
149
164
  return newHeaders;
@@ -151,13 +166,13 @@ function getHeaders(args) {
151
166
  for (const [key, value] of Object.entries(args.headers)) {
152
167
  const result = yield EndpointSupplier_js_1.EndpointSupplier.get(value, { endpointMetadata: (_a = args.endpointMetadata) !== null && _a !== void 0 ? _a : {} });
153
168
  if (typeof result === "string") {
154
- newHeaders[key] = result;
169
+ newHeaders.set(key, result);
155
170
  continue;
156
171
  }
157
172
  if (result == null) {
158
173
  continue;
159
174
  }
160
- newHeaders[key] = `${result}`;
175
+ newHeaders.set(key, `${result}`);
161
176
  }
162
177
  return newHeaders;
163
178
  });
@@ -193,12 +208,14 @@ function fetcherImpl(args) {
193
208
  method: args.method,
194
209
  url: redactUrl(url),
195
210
  statusCode: response.status,
211
+ responseHeaders: redactHeaders(response.headers),
196
212
  };
197
213
  logger.debug("HTTP request succeeded", metadata);
198
214
  }
215
+ const body = yield (0, getResponseBody_js_1.getResponseBody)(response, args.responseType);
199
216
  return {
200
217
  ok: true,
201
- body: (yield (0, getResponseBody_js_1.getResponseBody)(response, args.responseType)),
218
+ body: body,
202
219
  headers: response.headers,
203
220
  rawResponse: (0, RawResponse_js_1.toRawResponse)(response),
204
221
  };
@@ -209,6 +226,7 @@ function fetcherImpl(args) {
209
226
  method: args.method,
210
227
  url: redactUrl(url),
211
228
  statusCode: response.status,
229
+ responseHeaders: redactHeaders(Object.fromEntries(response.headers.entries())),
212
230
  };
213
231
  logger.error("HTTP request failed with error status", metadata);
214
232
  }
@@ -12,12 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getResponseBody = getResponseBody;
13
13
  const json_js_1 = require("../json.js");
14
14
  const BinaryResponse_js_1 = require("./BinaryResponse.js");
15
- const ResponseWithBody_js_1 = require("./ResponseWithBody.js");
16
15
  function getResponseBody(response, responseType) {
17
16
  return __awaiter(this, void 0, void 0, function* () {
18
- if (!(0, ResponseWithBody_js_1.isResponseWithBody)(response)) {
19
- return undefined;
20
- }
21
17
  switch (responseType) {
22
18
  case "binary-response":
23
19
  return (0, BinaryResponse_js_1.getBinaryResponse)(response);
@@ -26,8 +22,26 @@ function getResponseBody(response, responseType) {
26
22
  case "arrayBuffer":
27
23
  return yield response.arrayBuffer();
28
24
  case "sse":
25
+ if (response.body == null) {
26
+ return {
27
+ ok: false,
28
+ error: {
29
+ reason: "body-is-null",
30
+ statusCode: response.status,
31
+ },
32
+ };
33
+ }
29
34
  return response.body;
30
35
  case "streaming":
36
+ if (response.body == null) {
37
+ return {
38
+ ok: false,
39
+ error: {
40
+ reason: "body-is-null",
41
+ statusCode: response.status,
42
+ },
43
+ };
44
+ }
31
45
  return response.body;
32
46
  case "text":
33
47
  return yield response.text();
@@ -1 +1 @@
1
- export declare const makeRequest: (fetchFn: (url: string, init: RequestInit) => Promise<Response>, url: string, method: string, headers: Record<string, string>, requestBody: BodyInit | undefined, timeoutMs?: number, abortSignal?: AbortSignal, withCredentials?: boolean, duplex?: "half") => Promise<Response>;
1
+ export declare const makeRequest: (fetchFn: (url: string, init: RequestInit) => Promise<Response>, url: string, method: string, headers: Headers | Record<string, string>, requestBody: BodyInit | undefined, timeoutMs?: number, abortSignal?: AbortSignal, withCredentials?: boolean, duplex?: "half") => Promise<Response>;
@@ -13,14 +13,12 @@ exports.makeRequest = void 0;
13
13
  const signals_js_1 = require("./signals.js");
14
14
  const makeRequest = (fetchFn, url, method, headers, requestBody, timeoutMs, abortSignal, withCredentials, duplex) => __awaiter(void 0, void 0, void 0, function* () {
15
15
  const signals = [];
16
- // Add timeout signal
17
16
  let timeoutAbortId;
18
17
  if (timeoutMs != null) {
19
18
  const { signal, abortId } = (0, signals_js_1.getTimeoutSignal)(timeoutMs);
20
19
  timeoutAbortId = abortId;
21
20
  signals.push(signal);
22
21
  }
23
- // Add arbitrary signal
24
22
  if (abortSignal != null) {
25
23
  signals.push(abortSignal);
26
24
  }
@@ -15,25 +15,20 @@ const MAX_RETRY_DELAY = 60000; // in milliseconds
15
15
  const DEFAULT_MAX_RETRIES = 2;
16
16
  const JITTER_FACTOR = 0.2; // 20% random jitter
17
17
  function addPositiveJitter(delay) {
18
- // Generate a random value between 0 and +JITTER_FACTOR
19
18
  const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR;
20
19
  return delay * jitterMultiplier;
21
20
  }
22
21
  function addSymmetricJitter(delay) {
23
- // Generate a random value in a JITTER_FACTOR-sized percentage range around delay
24
22
  const jitterMultiplier = 1 + (Math.random() - 0.5) * JITTER_FACTOR;
25
23
  return delay * jitterMultiplier;
26
24
  }
27
25
  function getRetryDelayFromHeaders(response, retryAttempt) {
28
- // Check for Retry-After header first (RFC 7231), with no jitter
29
26
  const retryAfter = response.headers.get("Retry-After");
30
27
  if (retryAfter) {
31
- // Parse as number of seconds...
32
28
  const retryAfterSeconds = parseInt(retryAfter, 10);
33
29
  if (!Number.isNaN(retryAfterSeconds) && retryAfterSeconds > 0) {
34
30
  return Math.min(retryAfterSeconds * 1000, MAX_RETRY_DELAY);
35
31
  }
36
- // ...or as an HTTP date; both are valid
37
32
  const retryAfterDate = new Date(retryAfter);
38
33
  if (!Number.isNaN(retryAfterDate.getTime())) {
39
34
  const delay = retryAfterDate.getTime() - Date.now();
@@ -42,19 +37,16 @@ function getRetryDelayFromHeaders(response, retryAttempt) {
42
37
  }
43
38
  }
44
39
  }
45
- // Then check for industry-standard X-RateLimit-Reset header, with positive jitter
46
40
  const rateLimitReset = response.headers.get("X-RateLimit-Reset");
47
41
  if (rateLimitReset) {
48
42
  const resetTime = parseInt(rateLimitReset, 10);
49
43
  if (!Number.isNaN(resetTime)) {
50
- // Assume Unix timestamp in epoch seconds
51
44
  const delay = resetTime * 1000 - Date.now();
52
45
  if (delay > 0) {
53
46
  return addPositiveJitter(Math.min(delay, MAX_RETRY_DELAY));
54
47
  }
55
48
  }
56
49
  }
57
- // Fall back to exponential backoff, with symmetric jitter
58
50
  return addSymmetricJitter(Math.min(INITIAL_RETRY_DELAY * Math.pow(2, retryAttempt), MAX_RETRY_DELAY));
59
51
  }
60
52
  function requestWithRetries(requestFn_1) {
@@ -62,7 +54,6 @@ function requestWithRetries(requestFn_1) {
62
54
  let response = yield requestFn();
63
55
  for (let i = 0; i < maxRetries; ++i) {
64
56
  if ([408, 429].includes(response.status) || response.status >= 500) {
65
- // Get delay with appropriate jitter applied
66
57
  const delay = getRetryDelayFromHeaders(response, i);
67
58
  yield new Promise((resolve) => setTimeout(resolve, delay));
68
59
  response = yield requestFn();
@@ -1,11 +1,5 @@
1
1
  export declare function getTimeoutSignal(timeoutMs: number): {
2
2
  signal: AbortSignal;
3
- abortId: NodeJS.Timeout;
3
+ abortId: ReturnType<typeof setTimeout>;
4
4
  };
5
- /**
6
- * Returns an abort signal that is getting aborted when
7
- * at least one of the specified abort signals is aborted.
8
- *
9
- * Requires at least node.js 18.
10
- */
11
5
  export declare function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal;
@@ -8,26 +8,14 @@ function getTimeoutSignal(timeoutMs) {
8
8
  const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs);
9
9
  return { signal: controller.signal, abortId };
10
10
  }
11
- /**
12
- * Returns an abort signal that is getting aborted when
13
- * at least one of the specified abort signals is aborted.
14
- *
15
- * Requires at least node.js 18.
16
- */
17
11
  function anySignal(...args) {
18
- // Allowing signals to be passed either as array
19
- // of signals or as multiple arguments.
20
12
  const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args);
21
13
  const controller = new AbortController();
22
14
  for (const signal of signals) {
23
15
  if (signal.aborted) {
24
- // Exiting early if one of the signals
25
- // is already aborted.
26
16
  controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason);
27
17
  break;
28
18
  }
29
- // Listening for signals and removing the listeners
30
- // when at least one symbol is aborted.
31
19
  signal.addEventListener("abort", () => controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason), {
32
20
  signal: controller.signal,
33
21
  });
@@ -1,3 +1,5 @@
1
+ export * from "./auth/index.js";
2
+ export * from "./base64.js";
1
3
  export * from "./fetcher/index.js";
2
4
  export * as file from "./file/index.js";
3
5
  export * from "./form-data-utils/index.js";
@@ -37,6 +37,8 @@ var __importStar = (this && this.__importStar) || (function () {
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.url = exports.logging = exports.file = void 0;
40
+ __exportStar(require("./auth/index.js"), exports);
41
+ __exportStar(require("./base64.js"), exports);
40
42
  __exportStar(require("./fetcher/index.js"), exports);
41
43
  exports.file = __importStar(require("./file/index.js"));
42
44
  __exportStar(require("./form-data-utils/index.js"), exports);
@@ -51,7 +51,7 @@ class Logger {
51
51
  * @returns True if the level should be logged
52
52
  */
53
53
  shouldLog(level) {
54
- return !this.silent && this.level >= logLevelMap[level];
54
+ return !this.silent && this.level <= logLevelMap[level];
55
55
  }
56
56
  /**
57
57
  * Checks if debug logging is enabled.