@metronome/sdk 0.2.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (808) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +123 -51
  3. package/api-promise.d.mts +2 -0
  4. package/api-promise.d.mts.map +1 -0
  5. package/api-promise.d.ts +2 -0
  6. package/api-promise.d.ts.map +1 -0
  7. package/api-promise.js +6 -0
  8. package/api-promise.js.map +1 -0
  9. package/api-promise.mjs +2 -0
  10. package/api-promise.mjs.map +1 -0
  11. package/bin/cli +53 -0
  12. package/bin/migration-config.json +6 -0
  13. package/client.d.mts +232 -0
  14. package/client.d.mts.map +1 -0
  15. package/client.d.ts +232 -0
  16. package/client.d.ts.map +1 -0
  17. package/client.js +464 -0
  18. package/client.js.map +1 -0
  19. package/client.mjs +460 -0
  20. package/client.mjs.map +1 -0
  21. package/core/api-promise.d.mts +46 -0
  22. package/core/api-promise.d.mts.map +1 -0
  23. package/core/api-promise.d.ts +46 -0
  24. package/core/api-promise.d.ts.map +1 -0
  25. package/core/api-promise.js +74 -0
  26. package/core/api-promise.js.map +1 -0
  27. package/core/api-promise.mjs +70 -0
  28. package/core/api-promise.mjs.map +1 -0
  29. package/core/error.d.mts +46 -0
  30. package/core/error.d.mts.map +1 -0
  31. package/core/error.d.ts +46 -0
  32. package/core/error.d.ts.map +1 -0
  33. package/core/error.js +113 -0
  34. package/core/error.js.map +1 -0
  35. package/core/error.mjs +97 -0
  36. package/core/error.mjs.map +1 -0
  37. package/core/pagination.d.mts +137 -0
  38. package/core/pagination.d.mts.map +1 -0
  39. package/core/pagination.d.ts +137 -0
  40. package/core/pagination.d.ts.map +1 -0
  41. package/core/pagination.js +158 -0
  42. package/core/pagination.js.map +1 -0
  43. package/core/pagination.mjs +150 -0
  44. package/core/pagination.mjs.map +1 -0
  45. package/core/resource.d.mts +6 -0
  46. package/core/resource.d.mts.map +1 -0
  47. package/core/resource.d.ts +6 -0
  48. package/core/resource.d.ts.map +1 -0
  49. package/core/resource.js +11 -0
  50. package/core/resource.js.map +1 -0
  51. package/core/resource.mjs +7 -0
  52. package/core/resource.mjs.map +1 -0
  53. package/core/uploads.d.mts +3 -0
  54. package/core/uploads.d.mts.map +1 -0
  55. package/core/uploads.d.ts +3 -0
  56. package/core/uploads.d.ts.map +1 -0
  57. package/core/uploads.js +6 -0
  58. package/core/uploads.js.map +1 -0
  59. package/core/uploads.mjs +2 -0
  60. package/core/uploads.mjs.map +1 -0
  61. package/error.d.mts +2 -0
  62. package/error.d.mts.map +1 -0
  63. package/error.d.ts +1 -46
  64. package/error.d.ts.map +1 -1
  65. package/error.js +3 -110
  66. package/error.js.map +1 -1
  67. package/error.mjs +1 -96
  68. package/error.mjs.map +1 -1
  69. package/index.d.mts +7 -144
  70. package/index.d.mts.map +1 -0
  71. package/index.d.ts +6 -143
  72. package/index.d.ts.map +1 -1
  73. package/index.js +14 -120
  74. package/index.js.map +1 -1
  75. package/index.mjs +6 -93
  76. package/index.mjs.map +1 -1
  77. package/internal/builtin-types.d.mts +73 -0
  78. package/internal/builtin-types.d.mts.map +1 -0
  79. package/internal/builtin-types.d.ts +73 -0
  80. package/internal/builtin-types.d.ts.map +1 -0
  81. package/internal/builtin-types.js +4 -0
  82. package/internal/builtin-types.js.map +1 -0
  83. package/internal/builtin-types.mjs +3 -0
  84. package/internal/builtin-types.mjs.map +1 -0
  85. package/internal/detect-platform.d.mts +15 -0
  86. package/internal/detect-platform.d.mts.map +1 -0
  87. package/internal/detect-platform.d.ts +15 -0
  88. package/internal/detect-platform.d.ts.map +1 -0
  89. package/internal/detect-platform.js +162 -0
  90. package/internal/detect-platform.js.map +1 -0
  91. package/internal/detect-platform.mjs +157 -0
  92. package/internal/detect-platform.mjs.map +1 -0
  93. package/internal/errors.d.mts +3 -0
  94. package/internal/errors.d.mts.map +1 -0
  95. package/internal/errors.d.ts +3 -0
  96. package/internal/errors.d.ts.map +1 -0
  97. package/internal/errors.js +41 -0
  98. package/internal/errors.js.map +1 -0
  99. package/internal/errors.mjs +36 -0
  100. package/internal/errors.mjs.map +1 -0
  101. package/internal/headers.d.mts +26 -0
  102. package/internal/headers.d.mts.map +1 -0
  103. package/internal/headers.d.ts +26 -0
  104. package/internal/headers.d.ts.map +1 -0
  105. package/internal/headers.js +120 -0
  106. package/internal/headers.js.map +1 -0
  107. package/internal/headers.mjs +112 -0
  108. package/internal/headers.mjs.map +1 -0
  109. package/internal/parse.d.mts +12 -0
  110. package/internal/parse.d.mts.map +1 -0
  111. package/internal/parse.d.ts +12 -0
  112. package/internal/parse.d.ts.map +1 -0
  113. package/internal/parse.js +35 -0
  114. package/internal/parse.js.map +1 -0
  115. package/internal/parse.mjs +32 -0
  116. package/internal/parse.mjs.map +1 -0
  117. package/internal/qs/formats.d.mts +7 -0
  118. package/internal/qs/formats.d.mts.map +1 -0
  119. package/internal/qs/formats.d.ts +1 -0
  120. package/internal/qs/formats.d.ts.map +1 -1
  121. package/internal/qs/formats.js +4 -2
  122. package/internal/qs/formats.js.map +1 -1
  123. package/internal/qs/formats.mjs +2 -1
  124. package/internal/qs/formats.mjs.map +1 -1
  125. package/internal/qs/index.d.mts +10 -0
  126. package/internal/qs/index.d.mts.map +1 -0
  127. package/internal/qs/index.d.ts.map +1 -1
  128. package/internal/qs/stringify.d.mts +3 -0
  129. package/internal/qs/stringify.d.mts.map +1 -0
  130. package/internal/qs/stringify.d.ts.map +1 -1
  131. package/internal/qs/stringify.js +16 -19
  132. package/internal/qs/stringify.js.map +1 -1
  133. package/internal/qs/stringify.mjs +17 -19
  134. package/internal/qs/stringify.mjs.map +1 -1
  135. package/internal/qs/types.d.mts +57 -0
  136. package/internal/qs/types.d.mts.map +1 -0
  137. package/internal/qs/utils.d.mts +15 -0
  138. package/internal/qs/utils.d.mts.map +1 -0
  139. package/internal/qs/utils.d.ts +1 -0
  140. package/internal/qs/utils.d.ts.map +1 -1
  141. package/internal/qs/utils.js +22 -21
  142. package/internal/qs/utils.js.map +1 -1
  143. package/internal/qs/utils.mjs +12 -12
  144. package/internal/qs/utils.mjs.map +1 -1
  145. package/internal/request-options.d.mts +75 -0
  146. package/internal/request-options.d.mts.map +1 -0
  147. package/internal/request-options.d.ts +75 -0
  148. package/internal/request-options.d.ts.map +1 -0
  149. package/internal/request-options.js +14 -0
  150. package/internal/request-options.js.map +1 -0
  151. package/internal/request-options.mjs +10 -0
  152. package/internal/request-options.mjs.map +1 -0
  153. package/internal/shim-types.d.mts +17 -0
  154. package/internal/shim-types.d.mts.map +1 -0
  155. package/internal/shim-types.d.ts +17 -0
  156. package/internal/shim-types.d.ts.map +1 -0
  157. package/internal/shim-types.js +4 -0
  158. package/internal/shim-types.js.map +1 -0
  159. package/internal/shim-types.mjs +3 -0
  160. package/internal/shim-types.mjs.map +1 -0
  161. package/internal/shims.d.mts +20 -0
  162. package/internal/shims.d.mts.map +1 -0
  163. package/internal/shims.d.ts +20 -0
  164. package/internal/shims.d.ts.map +1 -0
  165. package/internal/shims.js +92 -0
  166. package/internal/shims.js.map +1 -0
  167. package/internal/shims.mjs +85 -0
  168. package/internal/shims.mjs.map +1 -0
  169. package/internal/to-file.d.mts +45 -0
  170. package/internal/to-file.d.mts.map +1 -0
  171. package/internal/to-file.d.ts +45 -0
  172. package/internal/to-file.d.ts.map +1 -0
  173. package/internal/to-file.js +91 -0
  174. package/internal/to-file.js.map +1 -0
  175. package/internal/to-file.mjs +88 -0
  176. package/internal/to-file.mjs.map +1 -0
  177. package/internal/tslib.js +81 -0
  178. package/internal/tslib.mjs +17 -0
  179. package/internal/types.d.mts +69 -0
  180. package/internal/types.d.mts.map +1 -0
  181. package/internal/types.d.ts +69 -0
  182. package/internal/types.d.ts.map +1 -0
  183. package/internal/types.js +4 -0
  184. package/internal/types.js.map +1 -0
  185. package/internal/types.mjs +3 -0
  186. package/internal/types.mjs.map +1 -0
  187. package/internal/uploads.d.mts +42 -0
  188. package/internal/uploads.d.mts.map +1 -0
  189. package/internal/uploads.d.ts +42 -0
  190. package/internal/uploads.d.ts.map +1 -0
  191. package/internal/uploads.js +141 -0
  192. package/internal/uploads.js.map +1 -0
  193. package/internal/uploads.mjs +131 -0
  194. package/internal/uploads.mjs.map +1 -0
  195. package/internal/utils/base64.d.mts +3 -0
  196. package/internal/utils/base64.d.mts.map +1 -0
  197. package/internal/utils/base64.d.ts +3 -0
  198. package/internal/utils/base64.d.ts.map +1 -0
  199. package/internal/utils/base64.js +38 -0
  200. package/internal/utils/base64.js.map +1 -0
  201. package/internal/utils/base64.mjs +33 -0
  202. package/internal/utils/base64.mjs.map +1 -0
  203. package/internal/utils/bytes.d.mts +4 -0
  204. package/internal/utils/bytes.d.mts.map +1 -0
  205. package/internal/utils/bytes.d.ts +4 -0
  206. package/internal/utils/bytes.d.ts.map +1 -0
  207. package/internal/utils/bytes.js +31 -0
  208. package/internal/utils/bytes.js.map +1 -0
  209. package/internal/utils/bytes.mjs +26 -0
  210. package/internal/utils/bytes.mjs.map +1 -0
  211. package/internal/utils/env.d.mts +9 -0
  212. package/internal/utils/env.d.mts.map +1 -0
  213. package/internal/utils/env.d.ts +9 -0
  214. package/internal/utils/env.d.ts.map +1 -0
  215. package/internal/utils/env.js +22 -0
  216. package/internal/utils/env.js.map +1 -0
  217. package/internal/utils/env.mjs +18 -0
  218. package/internal/utils/env.mjs.map +1 -0
  219. package/internal/utils/log.d.mts +37 -0
  220. package/internal/utils/log.d.mts.map +1 -0
  221. package/internal/utils/log.d.ts +37 -0
  222. package/internal/utils/log.d.ts.map +1 -0
  223. package/internal/utils/log.js +85 -0
  224. package/internal/utils/log.js.map +1 -0
  225. package/internal/utils/log.mjs +79 -0
  226. package/internal/utils/log.mjs.map +1 -0
  227. package/internal/utils/path.d.mts +15 -0
  228. package/internal/utils/path.d.mts.map +1 -0
  229. package/internal/utils/path.d.ts +15 -0
  230. package/internal/utils/path.d.ts.map +1 -0
  231. package/internal/utils/path.js +79 -0
  232. package/internal/utils/path.js.map +1 -0
  233. package/internal/utils/path.mjs +74 -0
  234. package/internal/utils/path.mjs.map +1 -0
  235. package/internal/utils/sleep.d.mts +2 -0
  236. package/internal/utils/sleep.d.mts.map +1 -0
  237. package/internal/utils/sleep.d.ts +2 -0
  238. package/internal/utils/sleep.d.ts.map +1 -0
  239. package/internal/utils/sleep.js +7 -0
  240. package/internal/utils/sleep.js.map +1 -0
  241. package/internal/utils/sleep.mjs +3 -0
  242. package/internal/utils/sleep.mjs.map +1 -0
  243. package/internal/utils/uuid.d.mts +5 -0
  244. package/internal/utils/uuid.d.mts.map +1 -0
  245. package/internal/utils/uuid.d.ts +5 -0
  246. package/internal/utils/uuid.d.ts.map +1 -0
  247. package/internal/utils/uuid.js +19 -0
  248. package/internal/utils/uuid.js.map +1 -0
  249. package/internal/utils/uuid.mjs +15 -0
  250. package/internal/utils/uuid.mjs.map +1 -0
  251. package/internal/utils/values.d.mts +18 -0
  252. package/internal/utils/values.d.mts.map +1 -0
  253. package/internal/utils/values.d.ts +18 -0
  254. package/internal/utils/values.d.ts.map +1 -0
  255. package/internal/utils/values.js +112 -0
  256. package/internal/utils/values.js.map +1 -0
  257. package/internal/utils/values.mjs +94 -0
  258. package/internal/utils/values.mjs.map +1 -0
  259. package/internal/utils.d.mts +7 -0
  260. package/internal/utils.d.mts.map +1 -0
  261. package/internal/utils.d.ts +7 -0
  262. package/internal/utils.d.ts.map +1 -0
  263. package/internal/utils.js +11 -0
  264. package/internal/utils.js.map +1 -0
  265. package/internal/utils.mjs +8 -0
  266. package/internal/utils.mjs.map +1 -0
  267. package/package.json +116 -64
  268. package/pagination.d.mts +2 -0
  269. package/pagination.d.mts.map +1 -0
  270. package/pagination.d.ts +1 -36
  271. package/pagination.d.ts.map +1 -1
  272. package/pagination.js +3 -40
  273. package/pagination.js.map +1 -1
  274. package/pagination.mjs +1 -38
  275. package/pagination.mjs.map +1 -1
  276. package/resource.d.mts +2 -0
  277. package/resource.d.mts.map +1 -0
  278. package/resource.d.ts +1 -5
  279. package/resource.d.ts.map +1 -1
  280. package/resource.js +3 -8
  281. package/resource.js.map +1 -1
  282. package/resource.mjs +1 -6
  283. package/resource.mjs.map +1 -1
  284. package/resources/index.d.mts +5 -0
  285. package/resources/index.d.mts.map +1 -0
  286. package/resources/index.d.ts.map +1 -1
  287. package/resources/index.js +2 -15
  288. package/resources/index.js.map +1 -1
  289. package/resources/shared.d.mts +2239 -0
  290. package/resources/shared.d.mts.map +1 -0
  291. package/resources/shared.d.ts +1409 -523
  292. package/resources/shared.d.ts.map +1 -1
  293. package/resources/v1/alerts.d.mts +203 -0
  294. package/resources/v1/alerts.d.mts.map +1 -0
  295. package/resources/v1/alerts.d.ts +78 -7
  296. package/resources/v1/alerts.d.ts.map +1 -1
  297. package/resources/v1/alerts.js +73 -3
  298. package/resources/v1/alerts.js.map +1 -1
  299. package/resources/v1/alerts.mjs +73 -3
  300. package/resources/v1/alerts.mjs.map +1 -1
  301. package/resources/v1/audit-logs.d.mts +108 -0
  302. package/resources/v1/audit-logs.d.mts.map +1 -0
  303. package/resources/v1/audit-logs.d.ts +45 -12
  304. package/resources/v1/audit-logs.d.ts.map +1 -1
  305. package/resources/v1/audit-logs.js +53 -12
  306. package/resources/v1/audit-logs.js.map +1 -1
  307. package/resources/v1/audit-logs.mjs +52 -10
  308. package/resources/v1/audit-logs.mjs.map +1 -1
  309. package/resources/v1/billable-metrics.d.mts +293 -0
  310. package/resources/v1/billable-metrics.d.mts.map +1 -0
  311. package/resources/v1/billable-metrics.d.ts +70 -15
  312. package/resources/v1/billable-metrics.d.ts.map +1 -1
  313. package/resources/v1/billable-metrics.js +70 -16
  314. package/resources/v1/billable-metrics.js.map +1 -1
  315. package/resources/v1/billable-metrics.mjs +69 -14
  316. package/resources/v1/billable-metrics.mjs.map +1 -1
  317. package/resources/v1/contracts/contracts.d.mts +2984 -0
  318. package/resources/v1/contracts/contracts.d.mts.map +1 -0
  319. package/resources/v1/contracts/contracts.d.ts +450 -1285
  320. package/resources/v1/contracts/contracts.d.ts.map +1 -1
  321. package/resources/v1/contracts/contracts.js +268 -50
  322. package/resources/v1/contracts/contracts.js.map +1 -1
  323. package/resources/v1/contracts/contracts.mjs +266 -26
  324. package/resources/v1/contracts/contracts.mjs.map +1 -1
  325. package/resources/v1/contracts/index.d.mts +5 -0
  326. package/resources/v1/contracts/index.d.mts.map +1 -0
  327. package/resources/v1/contracts/index.d.ts +3 -3
  328. package/resources/v1/contracts/index.d.ts.map +1 -1
  329. package/resources/v1/contracts/index.js +1 -3
  330. package/resources/v1/contracts/index.js.map +1 -1
  331. package/resources/v1/contracts/index.mjs +2 -2
  332. package/resources/v1/contracts/index.mjs.map +1 -1
  333. package/resources/v1/contracts/named-schedules.d.mts +82 -0
  334. package/resources/v1/contracts/named-schedules.d.mts.map +1 -0
  335. package/resources/v1/contracts/named-schedules.d.ts +5 -4
  336. package/resources/v1/contracts/named-schedules.d.ts.map +1 -1
  337. package/resources/v1/contracts/named-schedules.js +3 -2
  338. package/resources/v1/contracts/named-schedules.js.map +1 -1
  339. package/resources/v1/contracts/named-schedules.mjs +3 -2
  340. package/resources/v1/contracts/named-schedules.mjs.map +1 -1
  341. package/resources/v1/contracts/products.d.mts +502 -0
  342. package/resources/v1/contracts/products.d.mts.map +1 -0
  343. package/resources/v1/contracts/products.d.ts +47 -17
  344. package/resources/v1/contracts/products.d.ts.map +1 -1
  345. package/resources/v1/contracts/products.js +41 -17
  346. package/resources/v1/contracts/products.js.map +1 -1
  347. package/resources/v1/contracts/products.mjs +40 -15
  348. package/resources/v1/contracts/products.mjs.map +1 -1
  349. package/resources/v1/contracts/rate-cards/index.d.mts +5 -0
  350. package/resources/v1/contracts/rate-cards/index.d.mts.map +1 -0
  351. package/resources/v1/contracts/rate-cards/index.d.ts +2 -2
  352. package/resources/v1/contracts/rate-cards/index.d.ts.map +1 -1
  353. package/resources/v1/contracts/rate-cards/index.js +1 -3
  354. package/resources/v1/contracts/rate-cards/index.js.map +1 -1
  355. package/resources/v1/contracts/rate-cards/index.mjs +2 -2
  356. package/resources/v1/contracts/rate-cards/index.mjs.map +1 -1
  357. package/resources/v1/contracts/rate-cards/named-schedules.d.mts +94 -0
  358. package/resources/v1/contracts/rate-cards/named-schedules.d.mts.map +1 -0
  359. package/resources/v1/contracts/rate-cards/named-schedules.d.ts +5 -4
  360. package/resources/v1/contracts/rate-cards/named-schedules.d.ts.map +1 -1
  361. package/resources/v1/contracts/rate-cards/named-schedules.js +3 -2
  362. package/resources/v1/contracts/rate-cards/named-schedules.js.map +1 -1
  363. package/resources/v1/contracts/rate-cards/named-schedules.mjs +3 -2
  364. package/resources/v1/contracts/rate-cards/named-schedules.mjs.map +1 -1
  365. package/resources/v1/contracts/rate-cards/product-orders.d.mts +85 -0
  366. package/resources/v1/contracts/rate-cards/product-orders.d.mts.map +1 -0
  367. package/resources/v1/contracts/rate-cards/product-orders.d.ts +12 -6
  368. package/resources/v1/contracts/rate-cards/product-orders.d.ts.map +1 -1
  369. package/resources/v1/contracts/rate-cards/product-orders.js +8 -3
  370. package/resources/v1/contracts/rate-cards/product-orders.js.map +1 -1
  371. package/resources/v1/contracts/rate-cards/product-orders.mjs +8 -3
  372. package/resources/v1/contracts/rate-cards/product-orders.mjs.map +1 -1
  373. package/resources/v1/contracts/rate-cards/rate-cards.d.mts +452 -0
  374. package/resources/v1/contracts/rate-cards/rate-cards.d.mts.map +1 -0
  375. package/resources/v1/contracts/rate-cards/rate-cards.d.ts +134 -41
  376. package/resources/v1/contracts/rate-cards/rate-cards.d.ts.map +1 -1
  377. package/resources/v1/contracts/rate-cards/rate-cards.js +127 -47
  378. package/resources/v1/contracts/rate-cards/rate-cards.js.map +1 -1
  379. package/resources/v1/contracts/rate-cards/rate-cards.mjs +123 -20
  380. package/resources/v1/contracts/rate-cards/rate-cards.mjs.map +1 -1
  381. package/resources/v1/contracts/rate-cards/rates.d.mts +382 -0
  382. package/resources/v1/contracts/rate-cards/rates.d.mts.map +1 -0
  383. package/resources/v1/contracts/rate-cards/rates.d.ts +25 -82
  384. package/resources/v1/contracts/rate-cards/rates.d.ts.map +1 -1
  385. package/resources/v1/contracts/rate-cards/rates.js +13 -9
  386. package/resources/v1/contracts/rate-cards/rates.js.map +1 -1
  387. package/resources/v1/contracts/rate-cards/rates.mjs +12 -7
  388. package/resources/v1/contracts/rate-cards/rates.mjs.map +1 -1
  389. package/resources/v1/contracts/rate-cards.d.mts +2 -0
  390. package/resources/v1/contracts/rate-cards.d.mts.map +1 -0
  391. package/resources/v1/contracts/rate-cards.d.ts.map +1 -1
  392. package/resources/v1/contracts/rate-cards.js +2 -15
  393. package/resources/v1/contracts/rate-cards.js.map +1 -1
  394. package/resources/v1/contracts.d.mts +2 -0
  395. package/resources/v1/contracts.d.mts.map +1 -0
  396. package/resources/v1/contracts.d.ts.map +1 -1
  397. package/resources/v1/contracts.js +2 -15
  398. package/resources/v1/contracts.js.map +1 -1
  399. package/resources/v1/credit-grants.d.mts +505 -0
  400. package/resources/v1/credit-grants.d.mts.map +1 -0
  401. package/resources/v1/credit-grants.d.ts +73 -74
  402. package/resources/v1/credit-grants.d.ts.map +1 -1
  403. package/resources/v1/credit-grants.js +52 -18
  404. package/resources/v1/credit-grants.js.map +1 -1
  405. package/resources/v1/credit-grants.mjs +51 -16
  406. package/resources/v1/credit-grants.mjs.map +1 -1
  407. package/resources/v1/custom-fields.d.mts +151 -0
  408. package/resources/v1/custom-fields.d.mts.map +1 -0
  409. package/resources/v1/custom-fields.d.ts +69 -38
  410. package/resources/v1/custom-fields.d.ts.map +1 -1
  411. package/resources/v1/custom-fields.js +66 -22
  412. package/resources/v1/custom-fields.js.map +1 -1
  413. package/resources/v1/custom-fields.mjs +66 -22
  414. package/resources/v1/custom-fields.mjs.map +1 -1
  415. package/resources/v1/customers/alerts.d.mts +288 -0
  416. package/resources/v1/customers/alerts.d.mts.map +1 -0
  417. package/resources/v1/customers/alerts.d.ts +128 -23
  418. package/resources/v1/customers/alerts.d.ts.map +1 -1
  419. package/resources/v1/customers/alerts.js +112 -10
  420. package/resources/v1/customers/alerts.js.map +1 -1
  421. package/resources/v1/customers/alerts.mjs +112 -10
  422. package/resources/v1/customers/alerts.mjs.map +1 -1
  423. package/resources/v1/customers/billing-config.d.mts +125 -0
  424. package/resources/v1/customers/billing-config.d.mts.map +1 -0
  425. package/resources/v1/customers/billing-config.d.ts +8 -7
  426. package/resources/v1/customers/billing-config.d.ts.map +1 -1
  427. package/resources/v1/customers/billing-config.js +8 -6
  428. package/resources/v1/customers/billing-config.js.map +1 -1
  429. package/resources/v1/customers/billing-config.mjs +8 -6
  430. package/resources/v1/customers/billing-config.mjs.map +1 -1
  431. package/resources/v1/customers/commits.d.mts +456 -0
  432. package/resources/v1/customers/commits.d.mts.map +1 -0
  433. package/resources/v1/customers/commits.d.ts +145 -47
  434. package/resources/v1/customers/commits.d.ts.map +1 -1
  435. package/resources/v1/customers/commits.js +132 -12
  436. package/resources/v1/customers/commits.js.map +1 -1
  437. package/resources/v1/customers/commits.mjs +132 -12
  438. package/resources/v1/customers/commits.mjs.map +1 -1
  439. package/resources/v1/customers/credits.d.mts +310 -0
  440. package/resources/v1/customers/credits.d.mts.map +1 -0
  441. package/resources/v1/customers/credits.d.ts +124 -46
  442. package/resources/v1/customers/credits.d.ts.map +1 -1
  443. package/resources/v1/customers/credits.js +116 -11
  444. package/resources/v1/customers/credits.js.map +1 -1
  445. package/resources/v1/customers/credits.mjs +116 -11
  446. package/resources/v1/customers/credits.mjs.map +1 -1
  447. package/resources/v1/customers/customers.d.mts +818 -0
  448. package/resources/v1/customers/customers.d.mts.map +1 -0
  449. package/resources/v1/customers/customers.d.ts +304 -41
  450. package/resources/v1/customers/customers.d.ts.map +1 -1
  451. package/resources/v1/customers/customers.js +214 -73
  452. package/resources/v1/customers/customers.js.map +1 -1
  453. package/resources/v1/customers/customers.mjs +207 -41
  454. package/resources/v1/customers/customers.mjs.map +1 -1
  455. package/resources/v1/customers/index.d.mts +9 -0
  456. package/resources/v1/customers/index.d.mts.map +1 -0
  457. package/resources/v1/customers/index.d.ts +6 -6
  458. package/resources/v1/customers/index.d.ts.map +1 -1
  459. package/resources/v1/customers/index.js +1 -8
  460. package/resources/v1/customers/index.js.map +1 -1
  461. package/resources/v1/customers/index.mjs +3 -3
  462. package/resources/v1/customers/index.mjs.map +1 -1
  463. package/resources/v1/customers/invoices.d.mts +710 -0
  464. package/resources/v1/customers/invoices.d.mts.map +1 -0
  465. package/resources/v1/customers/invoices.d.ts +196 -19
  466. package/resources/v1/customers/invoices.d.ts.map +1 -1
  467. package/resources/v1/customers/invoices.js +131 -22
  468. package/resources/v1/customers/invoices.js.map +1 -1
  469. package/resources/v1/customers/invoices.mjs +130 -19
  470. package/resources/v1/customers/invoices.mjs.map +1 -1
  471. package/resources/v1/customers/named-schedules.d.mts +82 -0
  472. package/resources/v1/customers/named-schedules.d.mts.map +1 -0
  473. package/resources/v1/customers/named-schedules.d.ts +5 -4
  474. package/resources/v1/customers/named-schedules.d.ts.map +1 -1
  475. package/resources/v1/customers/named-schedules.js +3 -2
  476. package/resources/v1/customers/named-schedules.js.map +1 -1
  477. package/resources/v1/customers/named-schedules.mjs +3 -2
  478. package/resources/v1/customers/named-schedules.mjs.map +1 -1
  479. package/resources/v1/customers/plans.d.mts +281 -0
  480. package/resources/v1/customers/plans.d.mts.map +1 -0
  481. package/resources/v1/customers/plans.d.ts +14 -12
  482. package/resources/v1/customers/plans.d.ts.map +1 -1
  483. package/resources/v1/customers/plans.js +8 -15
  484. package/resources/v1/customers/plans.js.map +1 -1
  485. package/resources/v1/customers/plans.mjs +7 -12
  486. package/resources/v1/customers/plans.mjs.map +1 -1
  487. package/resources/v1/customers.d.mts +2 -0
  488. package/resources/v1/customers.d.mts.map +1 -0
  489. package/resources/v1/customers.d.ts.map +1 -1
  490. package/resources/v1/customers.js +2 -15
  491. package/resources/v1/customers.js.map +1 -1
  492. package/resources/v1/dashboards.d.mts +133 -0
  493. package/resources/v1/dashboards.d.mts.map +1 -0
  494. package/resources/v1/dashboards.d.ts +33 -6
  495. package/resources/v1/dashboards.d.ts.map +1 -1
  496. package/resources/v1/dashboards.js +30 -4
  497. package/resources/v1/dashboards.js.map +1 -1
  498. package/resources/v1/dashboards.mjs +30 -4
  499. package/resources/v1/dashboards.mjs.map +1 -1
  500. package/resources/v1/index.d.mts +15 -0
  501. package/resources/v1/index.d.mts.map +1 -0
  502. package/resources/v1/index.d.ts +9 -9
  503. package/resources/v1/index.d.ts.map +1 -1
  504. package/resources/v1/index.js +1 -12
  505. package/resources/v1/index.js.map +1 -1
  506. package/resources/v1/index.mjs +7 -7
  507. package/resources/v1/index.mjs.map +1 -1
  508. package/resources/v1/invoices.d.mts +83 -0
  509. package/resources/v1/invoices.d.mts.map +1 -0
  510. package/resources/v1/invoices.d.ts +28 -6
  511. package/resources/v1/invoices.d.ts.map +1 -1
  512. package/resources/v1/invoices.js +24 -3
  513. package/resources/v1/invoices.js.map +1 -1
  514. package/resources/v1/invoices.mjs +24 -3
  515. package/resources/v1/invoices.mjs.map +1 -1
  516. package/resources/v1/plans.d.mts +240 -0
  517. package/resources/v1/plans.d.mts.map +1 -0
  518. package/resources/v1/plans.d.ts +24 -15
  519. package/resources/v1/plans.d.ts.map +1 -1
  520. package/resources/v1/plans.js +19 -26
  521. package/resources/v1/plans.js.map +1 -1
  522. package/resources/v1/plans.mjs +18 -22
  523. package/resources/v1/plans.mjs.map +1 -1
  524. package/resources/v1/pricing-units.d.mts +34 -0
  525. package/resources/v1/pricing-units.d.mts.map +1 -0
  526. package/resources/v1/pricing-units.d.ts +12 -9
  527. package/resources/v1/pricing-units.d.ts.map +1 -1
  528. package/resources/v1/pricing-units.js +20 -12
  529. package/resources/v1/pricing-units.js.map +1 -1
  530. package/resources/v1/pricing-units.mjs +19 -10
  531. package/resources/v1/pricing-units.mjs.map +1 -1
  532. package/resources/v1/services.d.mts +33 -0
  533. package/resources/v1/services.d.mts.map +1 -0
  534. package/resources/v1/services.d.ts +10 -7
  535. package/resources/v1/services.d.ts.map +1 -1
  536. package/resources/v1/services.js +7 -5
  537. package/resources/v1/services.js.map +1 -1
  538. package/resources/v1/services.mjs +7 -5
  539. package/resources/v1/services.mjs.map +1 -1
  540. package/resources/v1/usage.d.mts +488 -0
  541. package/resources/v1/usage.d.mts.map +1 -0
  542. package/resources/v1/usage.d.ts +220 -57
  543. package/resources/v1/usage.d.ts.map +1 -1
  544. package/resources/v1/usage.js +212 -26
  545. package/resources/v1/usage.js.map +1 -1
  546. package/resources/v1/usage.mjs +211 -24
  547. package/resources/v1/usage.mjs.map +1 -1
  548. package/resources/v1/v1.d.mts +58 -0
  549. package/resources/v1/v1.d.mts.map +1 -0
  550. package/resources/v1/v1.d.ts +15 -15
  551. package/resources/v1/v1.d.ts.map +1 -1
  552. package/resources/v1/v1.js +15 -48
  553. package/resources/v1/v1.js.map +1 -1
  554. package/resources/v1/v1.mjs +8 -19
  555. package/resources/v1/v1.mjs.map +1 -1
  556. package/resources/v1.d.mts +2 -0
  557. package/resources/v1.d.mts.map +1 -0
  558. package/resources/v1.d.ts.map +1 -1
  559. package/resources/v1.js +2 -15
  560. package/resources/v1.js.map +1 -1
  561. package/resources/v2/contracts.d.mts +2794 -0
  562. package/resources/v2/contracts.d.mts.map +1 -0
  563. package/resources/v2/contracts.d.ts +381 -3862
  564. package/resources/v2/contracts.d.ts.map +1 -1
  565. package/resources/v2/contracts.js +102 -12
  566. package/resources/v2/contracts.js.map +1 -1
  567. package/resources/v2/contracts.mjs +102 -12
  568. package/resources/v2/contracts.mjs.map +1 -1
  569. package/resources/v2/index.d.mts +3 -0
  570. package/resources/v2/index.d.mts.map +1 -0
  571. package/resources/v2/index.d.ts.map +1 -1
  572. package/resources/v2/v2.d.mts +10 -0
  573. package/resources/v2/v2.d.mts.map +1 -0
  574. package/resources/v2/v2.d.ts +1 -1
  575. package/resources/v2/v2.d.ts.map +1 -1
  576. package/resources/v2/v2.js +3 -25
  577. package/resources/v2/v2.js.map +1 -1
  578. package/resources/v2/v2.mjs +1 -1
  579. package/resources/v2.d.mts +2 -0
  580. package/resources/v2.d.mts.map +1 -0
  581. package/resources/v2.d.ts.map +1 -1
  582. package/resources/v2.js +2 -15
  583. package/resources/v2.js.map +1 -1
  584. package/resources/webhooks.d.mts +22 -0
  585. package/resources/webhooks.d.mts.map +1 -0
  586. package/resources/webhooks.d.ts +1 -1
  587. package/resources/webhooks.d.ts.map +1 -1
  588. package/resources/webhooks.js +3 -3
  589. package/resources/webhooks.js.map +1 -1
  590. package/resources/webhooks.mjs +1 -1
  591. package/resources/webhooks.mjs.map +1 -1
  592. package/resources.d.mts +2 -0
  593. package/resources.d.mts.map +1 -0
  594. package/resources.d.ts.map +1 -1
  595. package/resources.js +2 -15
  596. package/resources.js.map +1 -1
  597. package/src/api-promise.ts +2 -0
  598. package/src/client.ts +809 -0
  599. package/src/core/README.md +3 -0
  600. package/src/core/api-promise.ts +92 -0
  601. package/src/core/error.ts +130 -0
  602. package/src/core/pagination.ts +319 -0
  603. package/src/core/resource.ts +11 -0
  604. package/src/core/uploads.ts +2 -0
  605. package/src/error.ts +2 -130
  606. package/src/index.ts +6 -220
  607. package/src/internal/README.md +3 -0
  608. package/src/internal/builtin-types.ts +93 -0
  609. package/src/internal/detect-platform.ts +196 -0
  610. package/src/internal/errors.ts +33 -0
  611. package/src/internal/headers.ts +144 -0
  612. package/src/internal/parse.ts +50 -0
  613. package/src/internal/qs/formats.ts +3 -2
  614. package/src/internal/qs/index.ts +3 -3
  615. package/src/internal/qs/stringify.ts +18 -21
  616. package/src/internal/qs/utils.ts +16 -16
  617. package/src/internal/request-options.ts +91 -0
  618. package/src/internal/shim-types.ts +26 -0
  619. package/src/internal/shims.ts +107 -0
  620. package/src/internal/to-file.ts +154 -0
  621. package/src/internal/types.ts +95 -0
  622. package/src/internal/uploads.ts +187 -0
  623. package/src/internal/utils/base64.ts +40 -0
  624. package/src/internal/utils/bytes.ts +32 -0
  625. package/src/internal/utils/env.ts +18 -0
  626. package/src/internal/utils/log.ts +126 -0
  627. package/src/internal/utils/path.ts +88 -0
  628. package/src/internal/utils/sleep.ts +3 -0
  629. package/src/internal/utils/uuid.ts +17 -0
  630. package/src/internal/utils/values.ts +105 -0
  631. package/src/internal/utils.ts +8 -0
  632. package/src/pagination.ts +2 -82
  633. package/src/resource.ts +2 -11
  634. package/src/resources/index.ts +4 -4
  635. package/src/resources/shared.ts +1786 -520
  636. package/src/resources/v1/alerts.ts +79 -8
  637. package/src/resources/v1/audit-logs.ts +48 -26
  638. package/src/resources/v1/billable-metrics.ts +79 -34
  639. package/src/resources/v1/contracts/contracts.ts +518 -1622
  640. package/src/resources/v1/contracts/index.ts +7 -6
  641. package/src/resources/v1/contracts/named-schedules.ts +8 -6
  642. package/src/resources/v1/contracts/products.ts +52 -38
  643. package/src/resources/v1/contracts/rate-cards/index.ts +6 -6
  644. package/src/resources/v1/contracts/rate-cards/named-schedules.ts +8 -6
  645. package/src/resources/v1/contracts/rate-cards/product-orders.ts +13 -10
  646. package/src/resources/v1/contracts/rate-cards/rate-cards.ts +145 -72
  647. package/src/resources/v1/contracts/rate-cards/rates.ts +28 -98
  648. package/src/resources/v1/contracts/rate-cards.ts +1 -1
  649. package/src/resources/v1/contracts.ts +1 -1
  650. package/src/resources/v1/credit-grants.ts +100 -112
  651. package/src/resources/v1/custom-fields.ts +106 -74
  652. package/src/resources/v1/customers/alerts.ts +147 -28
  653. package/src/resources/v1/customers/billing-config.ts +27 -13
  654. package/src/resources/v1/customers/commits.ts +153 -54
  655. package/src/resources/v1/customers/credits.ts +131 -53
  656. package/src/resources/v1/customers/customers.ts +390 -101
  657. package/src/resources/v1/customers/index.ts +19 -18
  658. package/src/resources/v1/customers/invoices.ts +206 -37
  659. package/src/resources/v1/customers/named-schedules.ts +8 -6
  660. package/src/resources/v1/customers/plans.ts +24 -22
  661. package/src/resources/v1/customers.ts +1 -1
  662. package/src/resources/v1/dashboards.ts +34 -7
  663. package/src/resources/v1/index.ts +32 -25
  664. package/src/resources/v1/invoices.ts +28 -9
  665. package/src/resources/v1/plans.ts +42 -43
  666. package/src/resources/v1/pricing-units.ts +15 -23
  667. package/src/resources/v1/services.ts +10 -7
  668. package/src/resources/v1/usage.ts +244 -72
  669. package/src/resources/v1/v1.ts +52 -49
  670. package/src/resources/v1.ts +1 -1
  671. package/src/resources/v2/contracts.ts +431 -4967
  672. package/src/resources/v2/index.ts +2 -2
  673. package/src/resources/v2/v2.ts +3 -3
  674. package/src/resources/v2.ts +1 -1
  675. package/src/resources/webhooks.ts +2 -2
  676. package/src/resources.ts +1 -1
  677. package/src/tsconfig.json +2 -2
  678. package/src/uploads.ts +2 -255
  679. package/src/version.ts +1 -1
  680. package/uploads.d.mts +2 -0
  681. package/uploads.d.mts.map +1 -0
  682. package/uploads.d.ts +1 -74
  683. package/uploads.d.ts.map +1 -1
  684. package/uploads.js +3 -168
  685. package/uploads.js.map +1 -1
  686. package/uploads.mjs +1 -157
  687. package/uploads.mjs.map +1 -1
  688. package/version.d.mts +2 -0
  689. package/version.d.mts.map +1 -0
  690. package/version.d.ts +1 -1
  691. package/version.js +1 -1
  692. package/version.mjs +1 -1
  693. package/_shims/MultipartBody.d.ts +0 -9
  694. package/_shims/MultipartBody.d.ts.map +0 -1
  695. package/_shims/MultipartBody.js +0 -16
  696. package/_shims/MultipartBody.js.map +0 -1
  697. package/_shims/MultipartBody.mjs +0 -12
  698. package/_shims/MultipartBody.mjs.map +0 -1
  699. package/_shims/README.md +0 -46
  700. package/_shims/auto/runtime-bun.d.ts +0 -5
  701. package/_shims/auto/runtime-bun.d.ts.map +0 -1
  702. package/_shims/auto/runtime-bun.js +0 -21
  703. package/_shims/auto/runtime-bun.js.map +0 -1
  704. package/_shims/auto/runtime-bun.mjs +0 -2
  705. package/_shims/auto/runtime-bun.mjs.map +0 -1
  706. package/_shims/auto/runtime-node.d.ts +0 -5
  707. package/_shims/auto/runtime-node.d.ts.map +0 -1
  708. package/_shims/auto/runtime-node.js +0 -21
  709. package/_shims/auto/runtime-node.js.map +0 -1
  710. package/_shims/auto/runtime-node.mjs +0 -2
  711. package/_shims/auto/runtime-node.mjs.map +0 -1
  712. package/_shims/auto/runtime.d.ts +0 -5
  713. package/_shims/auto/runtime.d.ts.map +0 -1
  714. package/_shims/auto/runtime.js +0 -21
  715. package/_shims/auto/runtime.js.map +0 -1
  716. package/_shims/auto/runtime.mjs +0 -2
  717. package/_shims/auto/runtime.mjs.map +0 -1
  718. package/_shims/auto/types-node.d.ts +0 -5
  719. package/_shims/auto/types-node.d.ts.map +0 -1
  720. package/_shims/auto/types-node.js +0 -21
  721. package/_shims/auto/types-node.js.map +0 -1
  722. package/_shims/auto/types-node.mjs +0 -2
  723. package/_shims/auto/types-node.mjs.map +0 -1
  724. package/_shims/auto/types.d.ts +0 -101
  725. package/_shims/auto/types.js +0 -3
  726. package/_shims/auto/types.mjs +0 -3
  727. package/_shims/bun-runtime.d.ts +0 -6
  728. package/_shims/bun-runtime.d.ts.map +0 -1
  729. package/_shims/bun-runtime.js +0 -14
  730. package/_shims/bun-runtime.js.map +0 -1
  731. package/_shims/bun-runtime.mjs +0 -10
  732. package/_shims/bun-runtime.mjs.map +0 -1
  733. package/_shims/index.d.ts +0 -83
  734. package/_shims/index.js +0 -17
  735. package/_shims/index.mjs +0 -11
  736. package/_shims/manual-types.d.ts +0 -12
  737. package/_shims/manual-types.js +0 -3
  738. package/_shims/manual-types.mjs +0 -3
  739. package/_shims/node-runtime.d.ts +0 -3
  740. package/_shims/node-runtime.d.ts.map +0 -1
  741. package/_shims/node-runtime.js +0 -89
  742. package/_shims/node-runtime.js.map +0 -1
  743. package/_shims/node-runtime.mjs +0 -56
  744. package/_shims/node-runtime.mjs.map +0 -1
  745. package/_shims/node-types.d.ts +0 -42
  746. package/_shims/node-types.js +0 -3
  747. package/_shims/node-types.mjs +0 -3
  748. package/_shims/registry.d.ts +0 -37
  749. package/_shims/registry.d.ts.map +0 -1
  750. package/_shims/registry.js +0 -41
  751. package/_shims/registry.js.map +0 -1
  752. package/_shims/registry.mjs +0 -37
  753. package/_shims/registry.mjs.map +0 -1
  754. package/_shims/web-runtime.d.ts +0 -5
  755. package/_shims/web-runtime.d.ts.map +0 -1
  756. package/_shims/web-runtime.js +0 -78
  757. package/_shims/web-runtime.js.map +0 -1
  758. package/_shims/web-runtime.mjs +0 -71
  759. package/_shims/web-runtime.mjs.map +0 -1
  760. package/_shims/web-types.d.ts +0 -83
  761. package/_shims/web-types.js +0 -3
  762. package/_shims/web-types.mjs +0 -3
  763. package/core.d.ts +0 -255
  764. package/core.d.ts.map +0 -1
  765. package/core.js +0 -924
  766. package/core.js.map +0 -1
  767. package/core.mjs +0 -892
  768. package/core.mjs.map +0 -1
  769. package/shims/node.d.ts +0 -30
  770. package/shims/node.d.ts.map +0 -1
  771. package/shims/node.js +0 -31
  772. package/shims/node.js.map +0 -1
  773. package/shims/node.mjs +0 -5
  774. package/shims/node.mjs.map +0 -1
  775. package/shims/web.d.ts +0 -26
  776. package/shims/web.d.ts.map +0 -1
  777. package/shims/web.js +0 -31
  778. package/shims/web.js.map +0 -1
  779. package/shims/web.mjs +0 -5
  780. package/shims/web.mjs.map +0 -1
  781. package/src/_shims/MultipartBody.ts +0 -9
  782. package/src/_shims/README.md +0 -46
  783. package/src/_shims/auto/runtime-bun.ts +0 -4
  784. package/src/_shims/auto/runtime-node.ts +0 -4
  785. package/src/_shims/auto/runtime.ts +0 -4
  786. package/src/_shims/auto/types-node.ts +0 -4
  787. package/src/_shims/auto/types.d.ts +0 -101
  788. package/src/_shims/auto/types.js +0 -3
  789. package/src/_shims/auto/types.mjs +0 -3
  790. package/src/_shims/bun-runtime.ts +0 -14
  791. package/src/_shims/index.d.ts +0 -83
  792. package/src/_shims/index.js +0 -17
  793. package/src/_shims/index.mjs +0 -11
  794. package/src/_shims/manual-types.d.ts +0 -12
  795. package/src/_shims/manual-types.js +0 -3
  796. package/src/_shims/manual-types.mjs +0 -3
  797. package/src/_shims/node-runtime.ts +0 -81
  798. package/src/_shims/node-types.d.ts +0 -42
  799. package/src/_shims/node-types.js +0 -3
  800. package/src/_shims/node-types.mjs +0 -3
  801. package/src/_shims/registry.ts +0 -67
  802. package/src/_shims/web-runtime.ts +0 -103
  803. package/src/_shims/web-types.d.ts +0 -83
  804. package/src/_shims/web-types.js +0 -3
  805. package/src/_shims/web-types.mjs +0 -3
  806. package/src/core.ts +0 -1236
  807. package/src/shims/node.ts +0 -50
  808. package/src/shims/web.ts +0 -50
package/CHANGELOG.md CHANGED
@@ -1,5 +1,67 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.0 (2025-09-15)
4
+
5
+ Full Changelog: [v0.3.0...v1.0.0](https://github.com/Metronome-Industries/metronome-node/compare/v0.3.0...v1.0.0)
6
+
7
+ ### ⚠ BREAKING CHANGES
8
+
9
+ * **api:** add pagination support to multiple endpoints - Added pagination to CustomerList, AlertList, InvoiceList, CommitList, CreditList, CreditGrantList, CustomerAlerts, UsageList, CustomFields list, and ContractListBalances endpoints.
10
+ * **api:** enhance subscriptions and commits/credits - Added Individual enum to SubscriptionConfig and rate_type enums to UpdateCredit/UpdateCommit.
11
+ * **typescript-sdk:** migrate to latest SDK version - Migrated TypeScript SDK with improved type safety, enhanced error handling, updated method signatures, and restructured package exports. Existing TypeScript SDK integrations will require updates to import paths, method calls, and configuration options. See our Migration Guide for detailed step-by-step instructions.
12
+ * **api:** add comprehensive shared types to SDK - Added 34 new shared types including BaseThresholdCommit, BaseUsageFilter, Commit, CommitHierarchyConfiguration, CommitRate, CommitSpecifier, CommitSpecifierInput, Contract, ContractV2, ContractWithoutAmendments, Credit, CreditTypeData, Discount, EventTypeFilter, HierarchyConfiguration, ID, Override, OverrideTier, OverwriteRate, PaymentGateConfig, PaymentGateConfigV2, PrepaidBalanceThresholdConfiguration, PrepaidBalanceThresholdConfigurationV2, PropertyFilter, ProService, Rate, RecurringCommitSubscriptionConfig, ScheduledCharge, ScheduleDuration, SchedulePointInTime, SpendThresholdConfiguration, SpendThresholdConfigurationV2, Subscription, Tier, and UpdateBaseThresholdCommit.
13
+
14
+ ### Features
15
+
16
+ * **api:** add archived_at field to CustomerBillingConfiguration ([70c82e0](https://github.com/Metronome-Industries/metronome-node/commit/70c82e0b5b0df3a3031f6a4264c0d00e063bf868))
17
+ * **api:** add comprehensive shared types to SDK - Added 34 new shared types including BaseThresholdCommit, BaseUsageFilter, Commit, CommitHierarchyConfiguration, CommitRate, CommitSpecifier, CommitSpecifierInput, Contract, ContractV2, ContractWithoutAmendments, Credit, CreditTypeData, Discount, EventTypeFilter, HierarchyConfiguration, ID, Override, OverrideTier, OverwriteRate, PaymentGateConfig, PaymentGateConfigV2, PrepaidBalanceThresholdConfiguration, PrepaidBalanceThresholdConfigurationV2, PropertyFilter, ProService, Rate, RecurringCommitSubscriptionConfig, ScheduledCharge, ScheduleDuration, SchedulePointInTime, SpendThresholdConfiguration, SpendThresholdConfigurationV2, Subscription, Tier, and UpdateBaseThresholdCommit. ([70c82e0](https://github.com/Metronome-Industries/metronome-node/commit/70c82e0b5b0df3a3031f6a4264c0d00e063bf868))
18
+ * **api:** add created_at field to Commit ([70c82e0](https://github.com/Metronome-Industries/metronome-node/commit/70c82e0b5b0df3a3031f6a4264c0d00e063bf868))
19
+ * **api:** add customer billing configuration endpoints - Added set and retrieve endpoints for customer billing configurations. ([70c82e0](https://github.com/Metronome-Industries/metronome-node/commit/70c82e0b5b0df3a3031f6a4264c0d00e063bf868))
20
+ * **api:** add pagination support to multiple endpoints - Added pagination to CustomerList, AlertList, InvoiceList, CommitList, CreditList, CreditGrantList, CustomerAlerts, UsageList, CustomFields list, and ContractListBalances endpoints. ([70c82e0](https://github.com/Metronome-Industries/metronome-node/commit/70c82e0b5b0df3a3031f6a4264c0d00e063bf868))
21
+ * **api:** Add support for granular spend threshold alerts with group key filters. ([70c82e0](https://github.com/Metronome-Industries/metronome-node/commit/70c82e0b5b0df3a3031f6a4264c0d00e063bf868))
22
+ * **api:** enhance subscriptions and commits/credits - Added Individual enum to SubscriptionConfig and rate_type enums to UpdateCredit/UpdateCommit. ([70c82e0](https://github.com/Metronome-Industries/metronome-node/commit/70c82e0b5b0df3a3031f6a4264c0d00e063bf868))
23
+ * **typescript-sdk:** migrate to latest SDK version - Migrated TypeScript SDK with improved type safety, enhanced error handling, updated method signatures, and restructured package exports. Existing TypeScript SDK integrations will require updates to import paths, method calls, and configuration options. See our Migration Guide for detailed step-by-step instructions. ([70c82e0](https://github.com/Metronome-Industries/metronome-node/commit/70c82e0b5b0df3a3031f6a4264c0d00e063bf868))
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * **mcp:** fix query options parsing ([70c82e0](https://github.com/Metronome-Industries/metronome-node/commit/70c82e0b5b0df3a3031f6a4264c0d00e063bf868))
29
+ * **mcp:** fix uploading dxt release assets ([70c82e0](https://github.com/Metronome-Industries/metronome-node/commit/70c82e0b5b0df3a3031f6a4264c0d00e063bf868))
30
+
31
+
32
+ ### Chores
33
+
34
+ * coerce nullable values to undefined ([70c82e0](https://github.com/Metronome-Industries/metronome-node/commit/70c82e0b5b0df3a3031f6a4264c0d00e063bf868))
35
+
36
+
37
+ ### Documentation
38
+
39
+ * enhance API documentation - Added more detailed descriptions and styling improvements, and enhanced usage filter documentation with additional context. ([70c82e0](https://github.com/Metronome-Industries/metronome-node/commit/70c82e0b5b0df3a3031f6a4264c0d00e063bf868))
40
+
41
+ ## 0.3.0 (2025-09-15)
42
+
43
+ Full Changelog: [v0.2.0...v0.3.0](https://github.com/Metronome-Industries/metronome-node/compare/v0.2.0...v0.3.0)
44
+
45
+ ### Features
46
+
47
+ * **api:** api update ([6053d58](https://github.com/Metronome-Industries/metronome-node/commit/6053d586c4fc67e770fad2f9bc9de1706ec363a7))
48
+ * **api:** api update ([1be7b2d](https://github.com/Metronome-Industries/metronome-node/commit/1be7b2d4cc78f10f17cd4021287410c4996900ac))
49
+ * **api:** api update ([fcc3172](https://github.com/Metronome-Industries/metronome-node/commit/fcc3172129d07d7da715b4982acbfb96664f7518))
50
+
51
+
52
+ ### Bug Fixes
53
+
54
+ * coerce nullable values to undefined ([db26826](https://github.com/Metronome-Industries/metronome-node/commit/db268263220cb5cacfd6a55ff04de39d2477b323))
55
+ * **mcp:** fix query options parsing ([a680969](https://github.com/Metronome-Industries/metronome-node/commit/a68096999d241b3a6dff06115a76e9c1bacb2fbe))
56
+ * **mcp:** fix uploading dxt release assets ([d2bd1f5](https://github.com/Metronome-Industries/metronome-node/commit/d2bd1f5b6640c9bebf047089347401a2786046d4))
57
+
58
+
59
+ ### Chores
60
+
61
+ * **internal:** codegen related update ([191878f](https://github.com/Metronome-Industries/metronome-node/commit/191878f4c0c324365353e04f32dcdb12db6d5308))
62
+ * **mcp:** upload dxt as release asset ([870849d](https://github.com/Metronome-Industries/metronome-node/commit/870849d07517ee4e94c9d5f6afc05c46d1a71958))
63
+ * sync repo ([86f91c5](https://github.com/Metronome-Industries/metronome-node/commit/86f91c5d57c205949c945d058c931353b64147fa))
64
+
3
65
  ## 0.2.0 (2025-07-31)
4
66
 
5
67
  Full Changelog: [v0.1.0...v0.2.0](https://github.com/Metronome-Industries/metronome-node/compare/v0.1.0...v0.2.0)
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Metronome Node API Library
1
+ # Metronome TypeScript API Library
2
2
 
3
- [![NPM version](https://img.shields.io/npm/v/@metronome/sdk.svg)](https://npmjs.org/package/@metronome/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@metronome/sdk)
3
+ [![NPM version](<https://img.shields.io/npm/v/@metronome/sdk.svg?label=npm%20(stable)>)](https://npmjs.org/package/@metronome/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@metronome/sdk)
4
4
 
5
5
  This library provides convenient access to the Metronome REST API from server-side TypeScript or JavaScript.
6
6
 
@@ -24,15 +24,17 @@ const client = new Metronome({
24
24
  bearerToken: process.env['METRONOME_BEARER_TOKEN'], // This is the default and can be omitted
25
25
  });
26
26
 
27
- await client.v1.usage.ingest([
28
- {
29
- transaction_id: '90e9401f-0f8c-4cd3-9a9f-d6beb56d8d72',
30
- customer_id: 'team@example.com',
31
- event_type: 'heartbeat',
32
- timestamp: '2024-01-01T00:00:00Z',
33
- properties: { cluster_id: '42', cpu_seconds: 60, region: 'Europe' },
34
- },
35
- ]);
27
+ await client.v1.usage.ingest({
28
+ usage: [
29
+ {
30
+ transaction_id: '90e9401f-0f8c-4cd3-9a9f-d6beb56d8d72',
31
+ customer_id: 'team@example.com',
32
+ event_type: 'heartbeat',
33
+ timestamp: '2024-01-01T00:00:00Z',
34
+ properties: { cluster_id: '42', cpu_seconds: 60, region: 'Europe' },
35
+ },
36
+ ],
37
+ });
36
38
  ```
37
39
 
38
40
  ### Request & Response types
@@ -168,8 +170,10 @@ while (page.hasNextPage()) {
168
170
  ### Accessing raw Response data (e.g., headers)
169
171
 
170
172
  The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
173
+ This method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.
171
174
 
172
175
  You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
176
+ Unlike `.asResponse()` this method consumes the body, returning once it is parsed.
173
177
 
174
178
  <!-- prettier-ignore -->
175
179
  ```ts
@@ -188,6 +192,59 @@ console.log(raw.headers.get('X-My-Header'));
188
192
  console.log(contract.data);
189
193
  ```
190
194
 
195
+ ### Logging
196
+
197
+ > [!IMPORTANT]
198
+ > All log messages are intended for debugging only. The format and content of log messages
199
+ > may change between releases.
200
+
201
+ #### Log levels
202
+
203
+ The log level can be configured in two ways:
204
+
205
+ 1. Via the `METRONOME_LOG` environment variable
206
+ 2. Using the `logLevel` client option (overrides the environment variable if set)
207
+
208
+ ```ts
209
+ import Metronome from '@metronome/sdk';
210
+
211
+ const client = new Metronome({
212
+ logLevel: 'debug', // Show all log messages
213
+ });
214
+ ```
215
+
216
+ Available log levels, from most to least verbose:
217
+
218
+ - `'debug'` - Show debug messages, info, warnings, and errors
219
+ - `'info'` - Show info messages, warnings, and errors
220
+ - `'warn'` - Show warnings and errors (default)
221
+ - `'error'` - Show only errors
222
+ - `'off'` - Disable all logging
223
+
224
+ At the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.
225
+ Some authentication-related headers are redacted, but sensitive data in request and response bodies
226
+ may still be visible.
227
+
228
+ #### Custom logger
229
+
230
+ By default, this library logs to `globalThis.console`. You can also provide a custom logger.
231
+ Most logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.
232
+
233
+ When providing a custom logger, the `logLevel` option still controls which messages are emitted, messages
234
+ below the configured level will not be sent to your logger.
235
+
236
+ ```ts
237
+ import Metronome from '@metronome/sdk';
238
+ import pino from 'pino';
239
+
240
+ const logger = pino();
241
+
242
+ const client = new Metronome({
243
+ logger: logger.child({ name: 'Metronome' }),
244
+ logLevel: 'debug', // Send all messages to pino, allowing it to filter
245
+ });
246
+ ```
247
+
191
248
  ### Making custom/undocumented requests
192
249
 
193
250
  This library is typed for convenient access to the documented API. If you need to access undocumented
@@ -212,9 +269,8 @@ parameter. This library doesn't validate at runtime that the request matches the
212
269
  send will be sent as-is.
213
270
 
214
271
  ```ts
215
- client.foo.create({
216
- foo: 'my_param',
217
- bar: 12,
272
+ client.v1.usage.ingest({
273
+ // ...
218
274
  // @ts-expect-error baz is not yet public
219
275
  baz: 'undocumented option',
220
276
  });
@@ -234,69 +290,85 @@ validate or strip extra properties from the response from the API.
234
290
 
235
291
  ### Customizing the fetch client
236
292
 
237
- By default, this library uses `node-fetch` in Node, and expects a global `fetch` function in other environments.
293
+ By default, this library expects a global `fetch` function is defined.
238
294
 
239
- If you would prefer to use a global, web-standards-compliant `fetch` function even in a Node environment,
240
- (for example, if you are running Node with `--experimental-fetch` or using NextJS which polyfills with `undici`),
241
- add the following import before your first import `from "Metronome"`:
295
+ If you want to use a different `fetch` function, you can either polyfill the global:
242
296
 
243
297
  ```ts
244
- // Tell TypeScript and the package to use the global web fetch instead of node-fetch.
245
- // Note, despite the name, this does not add any polyfills, but expects them to be provided if needed.
246
- import '@metronome/sdk/shims/web';
247
- import Metronome from '@metronome/sdk';
298
+ import fetch from 'my-fetch';
299
+
300
+ globalThis.fetch = fetch;
248
301
  ```
249
302
 
250
- To do the inverse, add `import "@metronome/sdk/shims/node"` (which does import polyfills).
251
- This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/Metronome-Industries/metronome-node/tree/main/src/_shims#readme)).
303
+ Or pass it to the client:
304
+
305
+ ```ts
306
+ import Metronome from '@metronome/sdk';
307
+ import fetch from 'my-fetch';
308
+
309
+ const client = new Metronome({ fetch });
310
+ ```
252
311
 
253
- ### Logging and middleware
312
+ ### Fetch options
254
313
 
255
- You may also provide a custom `fetch` function when instantiating the client,
256
- which can be used to inspect or alter the `Request` or `Response` before/after each request:
314
+ If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
257
315
 
258
316
  ```ts
259
- import { fetch } from 'undici'; // as one example
260
317
  import Metronome from '@metronome/sdk';
261
318
 
262
319
  const client = new Metronome({
263
- fetch: async (url: RequestInfo, init?: RequestInit): Promise<Response> => {
264
- console.log('About to make a request', url, init);
265
- const response = await fetch(url, init);
266
- console.log('Got response', response);
267
- return response;
320
+ fetchOptions: {
321
+ // `RequestInit` options
268
322
  },
269
323
  });
270
324
  ```
271
325
 
272
- Note that if given a `DEBUG=true` environment variable, this library will log all requests and responses automatically.
273
- This is intended for debugging purposes only and may change in the future without notice.
326
+ #### Configuring proxies
274
327
 
275
- ### Configuring an HTTP(S) Agent (e.g., for proxies)
328
+ To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy
329
+ options to requests:
276
330
 
277
- 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.
331
+ <img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
278
332
 
279
- If you would like to disable or customize this behavior, for example to use the API behind a proxy, you can pass an `httpAgent` which is used for all requests (be they http or https), for example:
333
+ ```ts
334
+ import Metronome from '@metronome/sdk';
335
+ import * as undici from 'undici';
336
+
337
+ const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
338
+ const client = new Metronome({
339
+ fetchOptions: {
340
+ dispatcher: proxyAgent,
341
+ },
342
+ });
343
+ ```
344
+
345
+ <img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
280
346
 
281
- <!-- prettier-ignore -->
282
347
  ```ts
283
- import http from 'http';
284
- import { HttpsProxyAgent } from 'https-proxy-agent';
348
+ import Metronome from '@metronome/sdk';
285
349
 
286
- // Configure the default for all requests:
287
350
  const client = new Metronome({
288
- httpAgent: new HttpsProxyAgent(process.env.PROXY_URL),
351
+ fetchOptions: {
352
+ proxy: 'http://localhost:8888',
353
+ },
289
354
  });
355
+ ```
290
356
 
291
- // Override per-request:
292
- await client.v1.contracts.create(
293
- { customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d', starting_at: '2020-01-01T00:00:00.000Z' },
294
- {
295
- httpAgent: new http.Agent({ keepAlive: false }),
357
+ <img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
358
+
359
+ ```ts
360
+ import Metronome from 'npm:@metronome/sdk';
361
+
362
+ const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
363
+ const client = new Metronome({
364
+ fetchOptions: {
365
+ client: httpClient,
296
366
  },
297
- );
367
+ });
298
368
  ```
299
369
 
370
+ ## Frequently Asked Questions
371
+
300
372
  ## Semantic versioning
301
373
 
302
374
  This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
@@ -311,12 +383,12 @@ We are keen for your feedback; please open an [issue](https://www.github.com/Met
311
383
 
312
384
  ## Requirements
313
385
 
314
- TypeScript >= 4.5 is supported.
386
+ TypeScript >= 4.9 is supported.
315
387
 
316
388
  The following runtimes are supported:
317
389
 
318
390
  - Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
319
- - Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
391
+ - Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
320
392
  - Deno v1.28.0 or higher.
321
393
  - Bun 1.0 or later.
322
394
  - Cloudflare Workers.
@@ -0,0 +1,2 @@
1
+ export * from "./core/api-promise.mjs";
2
+ //# sourceMappingURL=api-promise.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.d.mts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./core/api-promise.js";
2
+ //# sourceMappingURL=api-promise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.d.ts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
package/api-promise.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("./internal/tslib.js");
4
+ /** @deprecated Import from ./core/api-promise instead */
5
+ tslib_1.__exportStar(require("./core/api-promise.js"), exports);
6
+ //# sourceMappingURL=api-promise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.js","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,gEAAmC"}
@@ -0,0 +1,2 @@
1
+ export * from "./core/api-promise.mjs";
2
+ //# sourceMappingURL=api-promise.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.mjs","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
package/bin/cli ADDED
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require('child_process');
4
+
5
+ const commands = {
6
+ migrate: {
7
+ description:
8
+ 'Run migrations to update your code using @metronome/sdk@0.3.0 to be compatible with @metronome/sdk@1.0.0',
9
+ fn: () => {
10
+ const result = spawnSync(
11
+ 'npx',
12
+ [
13
+ '-y',
14
+ 'https://github.com/stainless-api/migrate-ts/releases/download/0.0.2/stainless-api-migrate-0.0.2-6.tgz',
15
+ '--migrationConfig',
16
+ require.resolve('./migration-config.json'),
17
+ ...process.argv.slice(3),
18
+ ],
19
+ { stdio: 'inherit' },
20
+ );
21
+ if (result.status !== 0) {
22
+ process.exit(result.status);
23
+ }
24
+ },
25
+ },
26
+ };
27
+
28
+ function exitWithHelp() {
29
+ console.log(`Usage: metronome-sdk <subcommand>`);
30
+ console.log();
31
+ console.log('Subcommands:');
32
+
33
+ for (const [name, info] of Object.entries(commands)) {
34
+ console.log(` ${name} ${info.description}`);
35
+ }
36
+
37
+ console.log();
38
+ process.exit(1);
39
+ }
40
+
41
+ if (process.argv.length < 3) {
42
+ exitWithHelp();
43
+ }
44
+
45
+ const commandName = process.argv[2];
46
+
47
+ const command = commands[commandName];
48
+ if (!command) {
49
+ console.log(`Unknown subcommand ${commandName}.`);
50
+ exitWithHelp();
51
+ }
52
+
53
+ command.fn();
@@ -0,0 +1,6 @@
1
+ {
2
+ "pkg": "@metronome/sdk",
3
+ "githubRepo": "https://github.com/Metronome-Industries/metronome-node",
4
+ "clientClass": "Metronome",
5
+ "methods": []
6
+ }
package/client.d.mts ADDED
@@ -0,0 +1,232 @@
1
+ import type { RequestInit, RequestInfo } from "./internal/builtin-types.mjs";
2
+ import type { PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from "./internal/types.mjs";
3
+ export type { Logger, LogLevel } from "./internal/utils/log.mjs";
4
+ import * as Opts from "./internal/request-options.mjs";
5
+ import * as Errors from "./core/error.mjs";
6
+ import * as Pagination from "./core/pagination.mjs";
7
+ import { type BodyCursorPageParams, BodyCursorPageResponse, type CursorPageParams, CursorPageResponse, type CursorPageWithoutLimitParams, CursorPageWithoutLimitResponse } from "./core/pagination.mjs";
8
+ import * as Uploads from "./core/uploads.mjs";
9
+ import * as API from "./resources/index.mjs";
10
+ import { APIPromise } from "./core/api-promise.mjs";
11
+ import { V1 } from "./resources/v1/v1.mjs";
12
+ import { V2 } from "./resources/v2/v2.mjs";
13
+ import { type Fetch } from "./internal/builtin-types.mjs";
14
+ import { HeadersLike, NullableHeaders } from "./internal/headers.mjs";
15
+ import { FinalRequestOptions, RequestOptions } from "./internal/request-options.mjs";
16
+ import { type LogLevel, type Logger } from "./internal/utils/log.mjs";
17
+ export interface ClientOptions {
18
+ /**
19
+ * Defaults to process.env['METRONOME_BEARER_TOKEN'].
20
+ */
21
+ bearerToken?: string | undefined;
22
+ /**
23
+ * Defaults to process.env['METRONOME_WEBHOOK_SECRET'].
24
+ */
25
+ webhookSecret?: string | null | undefined;
26
+ /**
27
+ * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
28
+ *
29
+ * Defaults to process.env['METRONOME_BASE_URL'].
30
+ */
31
+ baseURL?: string | null | undefined;
32
+ /**
33
+ * The maximum amount of time (in milliseconds) that the client should wait for a response
34
+ * from the server before timing out a single request.
35
+ *
36
+ * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
37
+ * much longer than this timeout before the promise succeeds or fails.
38
+ *
39
+ * @unit milliseconds
40
+ */
41
+ timeout?: number | undefined;
42
+ /**
43
+ * Additional `RequestInit` options to be passed to `fetch` calls.
44
+ * Properties will be overridden by per-request `fetchOptions`.
45
+ */
46
+ fetchOptions?: MergedRequestInit | undefined;
47
+ /**
48
+ * Specify a custom `fetch` function implementation.
49
+ *
50
+ * If not provided, we expect that `fetch` is defined globally.
51
+ */
52
+ fetch?: Fetch | undefined;
53
+ /**
54
+ * The maximum number of times that the client will retry a request in case of a
55
+ * temporary failure, like a network error or a 5XX error from the server.
56
+ *
57
+ * @default 2
58
+ */
59
+ maxRetries?: number | undefined;
60
+ /**
61
+ * Default headers to include with every request to the API.
62
+ *
63
+ * These can be removed in individual requests by explicitly setting the
64
+ * header to `null` in request options.
65
+ */
66
+ defaultHeaders?: HeadersLike | undefined;
67
+ /**
68
+ * Default query parameters to include with every request to the API.
69
+ *
70
+ * These can be removed in individual requests by explicitly setting the
71
+ * param to `undefined` in request options.
72
+ */
73
+ defaultQuery?: Record<string, string | undefined> | undefined;
74
+ /**
75
+ * Set the log level.
76
+ *
77
+ * Defaults to process.env['METRONOME_LOG'] or 'warn' if it isn't set.
78
+ */
79
+ logLevel?: LogLevel | undefined;
80
+ /**
81
+ * Set the logger.
82
+ *
83
+ * Defaults to globalThis.console.
84
+ */
85
+ logger?: Logger | undefined;
86
+ }
87
+ /**
88
+ * API Client for interfacing with the Metronome API.
89
+ */
90
+ export declare class Metronome {
91
+ #private;
92
+ bearerToken: string;
93
+ webhookSecret: string | null;
94
+ baseURL: string;
95
+ maxRetries: number;
96
+ timeout: number;
97
+ logger: Logger | undefined;
98
+ logLevel: LogLevel | undefined;
99
+ fetchOptions: MergedRequestInit | undefined;
100
+ private fetch;
101
+ protected idempotencyHeader?: string;
102
+ private _options;
103
+ /**
104
+ * API Client for interfacing with the Metronome API.
105
+ *
106
+ * @param {string | undefined} [opts.bearerToken=process.env['METRONOME_BEARER_TOKEN'] ?? undefined]
107
+ * @param {string | null | undefined} [opts.webhookSecret=process.env['METRONOME_WEBHOOK_SECRET'] ?? null]
108
+ * @param {string} [opts.baseURL=process.env['METRONOME_BASE_URL'] ?? https://api.metronome.com] - Override the default base URL for the API.
109
+ * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
110
+ * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
111
+ * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
112
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
113
+ * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
114
+ * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
115
+ */
116
+ constructor({ baseURL, bearerToken, webhookSecret, ...opts }?: ClientOptions);
117
+ /**
118
+ * Create a new client instance re-using the same options given to the current client with optional overriding.
119
+ */
120
+ withOptions(options: Partial<ClientOptions>): this;
121
+ protected defaultQuery(): Record<string, string | undefined> | undefined;
122
+ protected validateHeaders({ values, nulls }: NullableHeaders): void;
123
+ protected authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
124
+ protected stringifyQuery(query: Record<string, unknown>): string;
125
+ private getUserAgent;
126
+ protected defaultIdempotencyKey(): string;
127
+ protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError;
128
+ buildURL(path: string, query: Record<string, unknown> | null | undefined, defaultBaseURL?: string | undefined): string;
129
+ /**
130
+ * Used as a callback for mutating the given `FinalRequestOptions` object.
131
+ */
132
+ protected prepareOptions(options: FinalRequestOptions): Promise<void>;
133
+ /**
134
+ * Used as a callback for mutating the given `RequestInit` object.
135
+ *
136
+ * This is useful for cases where you want to add certain headers based off of
137
+ * the request properties, e.g. `method` or `url`.
138
+ */
139
+ protected prepareRequest(request: RequestInit, { url, options }: {
140
+ url: string;
141
+ options: FinalRequestOptions;
142
+ }): Promise<void>;
143
+ get<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
144
+ post<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
145
+ patch<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
146
+ put<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
147
+ delete<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
148
+ private methodRequest;
149
+ request<Rsp>(options: PromiseOrValue<FinalRequestOptions>, remainingRetries?: number | null): APIPromise<Rsp>;
150
+ private makeRequest;
151
+ getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(path: string, Page: new (...args: any[]) => PageClass, opts?: RequestOptions): Pagination.PagePromise<PageClass, Item>;
152
+ requestAPIList<Item = unknown, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass, options: FinalRequestOptions): Pagination.PagePromise<PageClass, Item>;
153
+ fetchWithTimeout(url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController): Promise<Response>;
154
+ private shouldRetry;
155
+ private retryRequest;
156
+ private calculateDefaultRetryTimeoutMillis;
157
+ buildRequest(inputOptions: FinalRequestOptions, { retryCount }?: {
158
+ retryCount?: number;
159
+ }): Promise<{
160
+ req: FinalizedRequestInit;
161
+ url: string;
162
+ timeout: number;
163
+ }>;
164
+ private buildHeaders;
165
+ private buildBody;
166
+ static Metronome: typeof Metronome;
167
+ static DEFAULT_TIMEOUT: number;
168
+ static MetronomeError: typeof Errors.MetronomeError;
169
+ static APIError: typeof Errors.APIError;
170
+ static APIConnectionError: typeof Errors.APIConnectionError;
171
+ static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
172
+ static APIUserAbortError: typeof Errors.APIUserAbortError;
173
+ static NotFoundError: typeof Errors.NotFoundError;
174
+ static ConflictError: typeof Errors.ConflictError;
175
+ static RateLimitError: typeof Errors.RateLimitError;
176
+ static BadRequestError: typeof Errors.BadRequestError;
177
+ static AuthenticationError: typeof Errors.AuthenticationError;
178
+ static InternalServerError: typeof Errors.InternalServerError;
179
+ static PermissionDeniedError: typeof Errors.PermissionDeniedError;
180
+ static UnprocessableEntityError: typeof Errors.UnprocessableEntityError;
181
+ static toFile: typeof Uploads.toFile;
182
+ webhooks: API.Webhooks;
183
+ v2: API.V2;
184
+ v1: API.V1;
185
+ }
186
+ export declare namespace Metronome {
187
+ export type RequestOptions = Opts.RequestOptions;
188
+ export import CursorPage = Pagination.CursorPage;
189
+ export { type CursorPageParams as CursorPageParams, type CursorPageResponse as CursorPageResponse };
190
+ export import BodyCursorPage = Pagination.BodyCursorPage;
191
+ export { type BodyCursorPageParams as BodyCursorPageParams, type BodyCursorPageResponse as BodyCursorPageResponse, };
192
+ export import CursorPageWithoutLimit = Pagination.CursorPageWithoutLimit;
193
+ export { type CursorPageWithoutLimitParams as CursorPageWithoutLimitParams, type CursorPageWithoutLimitResponse as CursorPageWithoutLimitResponse, };
194
+ export { V2 as V2 };
195
+ export { V1 as V1 };
196
+ export type BaseThresholdCommit = API.BaseThresholdCommit;
197
+ export type BaseUsageFilter = API.BaseUsageFilter;
198
+ export type Commit = API.Commit;
199
+ export type CommitHierarchyConfiguration = API.CommitHierarchyConfiguration;
200
+ export type CommitRate = API.CommitRate;
201
+ export type CommitSpecifier = API.CommitSpecifier;
202
+ export type CommitSpecifierInput = API.CommitSpecifierInput;
203
+ export type Contract = API.Contract;
204
+ export type ContractV2 = API.ContractV2;
205
+ export type ContractWithoutAmendments = API.ContractWithoutAmendments;
206
+ export type Credit = API.Credit;
207
+ export type CreditTypeData = API.CreditTypeData;
208
+ export type Discount = API.Discount;
209
+ export type EventTypeFilter = API.EventTypeFilter;
210
+ export type HierarchyConfiguration = API.HierarchyConfiguration;
211
+ export type ID = API.ID;
212
+ export type Override = API.Override;
213
+ export type OverrideTier = API.OverrideTier;
214
+ export type OverwriteRate = API.OverwriteRate;
215
+ export type PaymentGateConfig = API.PaymentGateConfig;
216
+ export type PaymentGateConfigV2 = API.PaymentGateConfigV2;
217
+ export type PrepaidBalanceThresholdConfiguration = API.PrepaidBalanceThresholdConfiguration;
218
+ export type PrepaidBalanceThresholdConfigurationV2 = API.PrepaidBalanceThresholdConfigurationV2;
219
+ export type PropertyFilter = API.PropertyFilter;
220
+ export type ProService = API.ProService;
221
+ export type Rate = API.Rate;
222
+ export type RecurringCommitSubscriptionConfig = API.RecurringCommitSubscriptionConfig;
223
+ export type ScheduledCharge = API.ScheduledCharge;
224
+ export type ScheduleDuration = API.ScheduleDuration;
225
+ export type SchedulePointInTime = API.SchedulePointInTime;
226
+ export type SpendThresholdConfiguration = API.SpendThresholdConfiguration;
227
+ export type SpendThresholdConfigurationV2 = API.SpendThresholdConfigurationV2;
228
+ export type Subscription = API.Subscription;
229
+ export type Tier = API.Tier;
230
+ export type UpdateBaseThresholdCommit = API.UpdateBaseThresholdCommit;
231
+ }
232
+ //# sourceMappingURL=client.d.mts.map