@metronome/sdk 0.1.0-beta.9 → 0.2.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.
- package/CHANGELOG.md +194 -0
- package/README.md +30 -46
- package/_shims/index.d.ts +2 -0
- package/_shims/index.js +5 -1
- package/_shims/index.mjs +5 -1
- package/core.d.ts +19 -5
- package/core.d.ts.map +1 -1
- package/core.js +23 -14
- package/core.js.map +1 -1
- package/core.mjs +24 -15
- package/core.mjs.map +1 -1
- package/index.d.mts +3 -2
- package/index.d.ts +3 -2
- package/index.d.ts.map +1 -1
- package/index.js +6 -3
- package/index.js.map +1 -1
- package/index.mjs +6 -3
- package/index.mjs.map +1 -1
- package/package.json +1 -5
- package/pagination.d.ts +1 -0
- package/pagination.d.ts.map +1 -1
- package/pagination.js +3 -0
- package/pagination.js.map +1 -1
- package/pagination.mjs +3 -0
- package/pagination.mjs.map +1 -1
- package/resource.d.ts +1 -1
- package/resource.d.ts.map +1 -1
- package/resource.js.map +1 -1
- package/resource.mjs.map +1 -1
- package/resources/shared.d.ts +521 -37
- package/resources/shared.d.ts.map +1 -1
- package/resources/v1/alerts.d.ts +30 -10
- package/resources/v1/alerts.d.ts.map +1 -1
- package/resources/v1/alerts.js +19 -0
- package/resources/v1/alerts.js.map +1 -1
- package/resources/v1/alerts.mjs +19 -0
- package/resources/v1/alerts.mjs.map +1 -1
- package/resources/v1/audit-logs.d.ts +8 -0
- package/resources/v1/audit-logs.d.ts.map +1 -1
- package/resources/v1/audit-logs.js.map +1 -1
- package/resources/v1/audit-logs.mjs.map +1 -1
- package/resources/v1/billable-metrics.d.ts +58 -3
- package/resources/v1/billable-metrics.d.ts.map +1 -1
- package/resources/v1/billable-metrics.js +41 -0
- package/resources/v1/billable-metrics.js.map +1 -1
- package/resources/v1/billable-metrics.mjs +41 -0
- package/resources/v1/billable-metrics.mjs.map +1 -1
- package/resources/v1/contracts/contracts.d.ts +1556 -122
- package/resources/v1/contracts/contracts.d.ts.map +1 -1
- package/resources/v1/contracts/contracts.js +180 -3
- package/resources/v1/contracts/contracts.js.map +1 -1
- package/resources/v1/contracts/contracts.mjs +180 -3
- package/resources/v1/contracts/contracts.mjs.map +1 -1
- package/resources/v1/contracts/index.d.ts +2 -2
- package/resources/v1/contracts/index.d.ts.map +1 -1
- package/resources/v1/contracts/index.js.map +1 -1
- package/resources/v1/contracts/index.mjs.map +1 -1
- package/resources/v1/contracts/named-schedules.d.ts +21 -0
- package/resources/v1/contracts/named-schedules.d.ts.map +1 -1
- package/resources/v1/contracts/named-schedules.js +21 -0
- package/resources/v1/contracts/named-schedules.js.map +1 -1
- package/resources/v1/contracts/named-schedules.mjs +21 -0
- package/resources/v1/contracts/named-schedules.mjs.map +1 -1
- package/resources/v1/contracts/products.d.ts +51 -3
- package/resources/v1/contracts/products.d.ts.map +1 -1
- package/resources/v1/contracts/products.js +33 -0
- package/resources/v1/contracts/products.js.map +1 -1
- package/resources/v1/contracts/products.mjs +33 -0
- package/resources/v1/contracts/products.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/index.d.ts +1 -1
- package/resources/v1/contracts/rate-cards/index.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/index.js.map +1 -1
- package/resources/v1/contracts/rate-cards/index.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/named-schedules.d.ts +25 -0
- package/resources/v1/contracts/rate-cards/named-schedules.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/named-schedules.js +25 -0
- package/resources/v1/contracts/rate-cards/named-schedules.js.map +1 -1
- package/resources/v1/contracts/rate-cards/named-schedules.mjs +25 -0
- package/resources/v1/contracts/rate-cards/named-schedules.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/product-orders.d.ts +30 -0
- package/resources/v1/contracts/rate-cards/product-orders.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/product-orders.js +30 -0
- package/resources/v1/contracts/rate-cards/product-orders.js.map +1 -1
- package/resources/v1/contracts/rate-cards/product-orders.mjs +30 -0
- package/resources/v1/contracts/rate-cards/product-orders.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/rate-cards.d.ts +107 -10
- package/resources/v1/contracts/rate-cards/rate-cards.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/rate-cards.js +71 -0
- package/resources/v1/contracts/rate-cards/rate-cards.js.map +1 -1
- package/resources/v1/contracts/rate-cards/rate-cards.mjs +71 -0
- package/resources/v1/contracts/rate-cards/rate-cards.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/rates.d.ts +102 -14
- package/resources/v1/contracts/rate-cards/rates.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/rates.js +68 -0
- package/resources/v1/contracts/rate-cards/rates.js.map +1 -1
- package/resources/v1/contracts/rate-cards/rates.mjs +68 -0
- package/resources/v1/contracts/rate-cards/rates.mjs.map +1 -1
- package/resources/v1/credit-grants.d.ts +77 -2
- package/resources/v1/credit-grants.d.ts.map +1 -1
- package/resources/v1/credit-grants.js +39 -2
- package/resources/v1/credit-grants.js.map +1 -1
- package/resources/v1/credit-grants.mjs +39 -2
- package/resources/v1/credit-grants.mjs.map +1 -1
- package/resources/v1/custom-fields.d.ts +51 -7
- package/resources/v1/custom-fields.d.ts.map +1 -1
- package/resources/v1/custom-fields.js +35 -0
- package/resources/v1/custom-fields.js.map +1 -1
- package/resources/v1/custom-fields.mjs +35 -0
- package/resources/v1/custom-fields.mjs.map +1 -1
- package/resources/v1/customers/alerts.d.ts +37 -0
- package/resources/v1/customers/alerts.d.ts.map +1 -1
- package/resources/v1/customers/alerts.js +23 -0
- package/resources/v1/customers/alerts.js.map +1 -1
- package/resources/v1/customers/alerts.mjs +23 -0
- package/resources/v1/customers/alerts.mjs.map +1 -1
- package/resources/v1/customers/billing-config.d.ts +31 -0
- package/resources/v1/customers/billing-config.d.ts.map +1 -1
- package/resources/v1/customers/billing-config.js +27 -0
- package/resources/v1/customers/billing-config.js.map +1 -1
- package/resources/v1/customers/billing-config.mjs +27 -0
- package/resources/v1/customers/billing-config.mjs.map +1 -1
- package/resources/v1/customers/commits.d.ts +94 -7
- package/resources/v1/customers/commits.d.ts.map +1 -1
- package/resources/v1/customers/commits.js +56 -1
- package/resources/v1/customers/commits.js.map +1 -1
- package/resources/v1/customers/commits.mjs +56 -1
- package/resources/v1/customers/commits.mjs.map +1 -1
- package/resources/v1/customers/credits.d.ts +73 -3
- package/resources/v1/customers/credits.d.ts.map +1 -1
- package/resources/v1/customers/credits.js +41 -1
- package/resources/v1/customers/credits.js.map +1 -1
- package/resources/v1/customers/credits.mjs +41 -1
- package/resources/v1/customers/credits.mjs.map +1 -1
- package/resources/v1/customers/customers.d.ts +186 -9
- package/resources/v1/customers/customers.d.ts.map +1 -1
- package/resources/v1/customers/customers.js +106 -1
- package/resources/v1/customers/customers.js.map +1 -1
- package/resources/v1/customers/customers.mjs +106 -1
- package/resources/v1/customers/customers.mjs.map +1 -1
- package/resources/v1/customers/index.d.ts +1 -1
- package/resources/v1/customers/index.d.ts.map +1 -1
- package/resources/v1/customers/index.js.map +1 -1
- package/resources/v1/customers/index.mjs.map +1 -1
- package/resources/v1/customers/invoices.d.ts +144 -52
- package/resources/v1/customers/invoices.d.ts.map +1 -1
- package/resources/v1/customers/invoices.js +49 -0
- package/resources/v1/customers/invoices.js.map +1 -1
- package/resources/v1/customers/invoices.mjs +49 -0
- package/resources/v1/customers/invoices.mjs.map +1 -1
- package/resources/v1/customers/named-schedules.d.ts +21 -0
- package/resources/v1/customers/named-schedules.d.ts.map +1 -1
- package/resources/v1/customers/named-schedules.js +21 -0
- package/resources/v1/customers/named-schedules.js.map +1 -1
- package/resources/v1/customers/named-schedules.mjs +21 -0
- package/resources/v1/customers/named-schedules.mjs.map +1 -1
- package/resources/v1/customers/plans.d.ts +46 -1
- package/resources/v1/customers/plans.d.ts.map +1 -1
- package/resources/v1/customers/plans.js +43 -0
- package/resources/v1/customers/plans.js.map +1 -1
- package/resources/v1/customers/plans.mjs +43 -0
- package/resources/v1/customers/plans.mjs.map +1 -1
- package/resources/v1/dashboards.d.ts +31 -3
- package/resources/v1/dashboards.d.ts.map +1 -1
- package/resources/v1/dashboards.js +26 -0
- package/resources/v1/dashboards.js.map +1 -1
- package/resources/v1/dashboards.mjs +26 -0
- package/resources/v1/dashboards.mjs.map +1 -1
- package/resources/v1/index.d.ts +3 -3
- package/resources/v1/index.d.ts.map +1 -1
- package/resources/v1/index.js.map +1 -1
- package/resources/v1/index.mjs.map +1 -1
- package/resources/v1/invoices.d.ts +14 -0
- package/resources/v1/invoices.d.ts.map +1 -1
- package/resources/v1/invoices.js +14 -0
- package/resources/v1/invoices.js.map +1 -1
- package/resources/v1/invoices.mjs +14 -0
- package/resources/v1/invoices.mjs.map +1 -1
- package/resources/v1/plans.d.ts +47 -4
- package/resources/v1/plans.d.ts.map +1 -1
- package/resources/v1/plans.js +27 -0
- package/resources/v1/plans.js.map +1 -1
- package/resources/v1/plans.mjs +27 -0
- package/resources/v1/plans.mjs.map +1 -1
- package/resources/v1/pricing-units.d.ts +8 -0
- package/resources/v1/pricing-units.d.ts.map +1 -1
- package/resources/v1/pricing-units.js.map +1 -1
- package/resources/v1/pricing-units.mjs.map +1 -1
- package/resources/v1/services.d.ts +5 -0
- package/resources/v1/services.d.ts.map +1 -1
- package/resources/v1/services.js +5 -0
- package/resources/v1/services.js.map +1 -1
- package/resources/v1/services.mjs +5 -0
- package/resources/v1/services.mjs.map +1 -1
- package/resources/v1/usage.d.ts +161 -3
- package/resources/v1/usage.d.ts.map +1 -1
- package/resources/v1/usage.js +46 -0
- package/resources/v1/usage.js.map +1 -1
- package/resources/v1/usage.mjs +46 -0
- package/resources/v1/usage.mjs.map +1 -1
- package/resources/v1/v1.d.ts +6 -6
- package/resources/v1/v1.d.ts.map +1 -1
- package/resources/v1/v1.js.map +1 -1
- package/resources/v1/v1.mjs.map +1 -1
- package/resources/v2/contracts.d.ts +3241 -205
- package/resources/v2/contracts.d.ts.map +1 -1
- package/resources/v2/contracts.js +90 -2
- package/resources/v2/contracts.js.map +1 -1
- package/resources/v2/contracts.mjs +90 -2
- package/resources/v2/contracts.mjs.map +1 -1
- package/resources/webhooks.js +5 -5
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs +5 -5
- package/resources/webhooks.mjs.map +1 -1
- package/src/_shims/auto/runtime-bun.ts +1 -1
- package/src/_shims/auto/runtime-node.ts +1 -1
- package/src/_shims/auto/runtime.ts +1 -1
- package/src/_shims/auto/types-node.ts +1 -1
- package/src/_shims/bun-runtime.ts +2 -2
- package/src/_shims/index.d.ts +5 -3
- package/src/_shims/index.js +5 -1
- package/src/_shims/index.mjs +6 -2
- package/src/_shims/node-runtime.ts +3 -3
- package/src/_shims/registry.ts +1 -1
- package/src/_shims/web-runtime.ts +3 -3
- package/src/core.ts +46 -18
- package/src/error.ts +1 -1
- package/src/index.ts +22 -16
- package/src/internal/qs/formats.ts +1 -1
- package/src/internal/qs/index.ts +3 -3
- package/src/internal/qs/stringify.ts +3 -3
- package/src/internal/qs/utils.ts +2 -2
- package/src/pagination.ts +5 -1
- package/src/resource.ts +2 -2
- package/src/resources/index.ts +4 -4
- package/src/resources/shared.ts +605 -40
- package/src/resources/v1/alerts.ts +33 -13
- package/src/resources/v1/audit-logs.ts +12 -4
- package/src/resources/v1/billable-metrics.ts +57 -8
- package/src/resources/v1/contracts/contracts.ts +1723 -135
- package/src/resources/v1/contracts/index.ts +8 -4
- package/src/resources/v1/contracts/named-schedules.ts +23 -2
- package/src/resources/v1/contracts/products.ts +53 -9
- package/src/resources/v1/contracts/rate-cards/index.ts +6 -4
- package/src/resources/v1/contracts/rate-cards/named-schedules.ts +27 -2
- package/src/resources/v1/contracts/rate-cards/product-orders.ts +33 -3
- package/src/resources/v1/contracts/rate-cards/rate-cards.ts +113 -20
- package/src/resources/v1/contracts/rate-cards/rates.ts +86 -18
- package/src/resources/v1/contracts/rate-cards.ts +1 -1
- package/src/resources/v1/contracts.ts +1 -1
- package/src/resources/v1/credit-grants.ts +82 -10
- package/src/resources/v1/custom-fields.ts +57 -9
- package/src/resources/v1/customers/alerts.ts +44 -3
- package/src/resources/v1/customers/billing-config.ts +34 -2
- package/src/resources/v1/customers/commits.ts +97 -10
- package/src/resources/v1/customers/credits.ts +76 -6
- package/src/resources/v1/customers/customers.ts +208 -27
- package/src/resources/v1/customers/index.ts +10 -8
- package/src/resources/v1/customers/invoices.ts +123 -57
- package/src/resources/v1/customers/named-schedules.ts +23 -2
- package/src/resources/v1/customers/plans.ts +48 -5
- package/src/resources/v1/customers.ts +1 -1
- package/src/resources/v1/dashboards.ts +33 -5
- package/src/resources/v1/index.ts +20 -14
- package/src/resources/v1/invoices.ts +16 -2
- package/src/resources/v1/plans.ts +45 -10
- package/src/resources/v1/pricing-units.ts +12 -4
- package/src/resources/v1/services.ts +7 -2
- package/src/resources/v1/usage.ts +187 -6
- package/src/resources/v1/v1.ts +39 -27
- package/src/resources/v1.ts +1 -1
- package/src/resources/v2/contracts.ts +3838 -261
- package/src/resources/v2/index.ts +2 -2
- package/src/resources/v2/v2.ts +3 -3
- package/src/resources/v2.ts +1 -1
- package/src/resources/webhooks.ts +7 -7
- package/src/resources.ts +1 -1
- package/src/shims/node.ts +3 -3
- package/src/shims/web.ts +3 -3
- package/src/uploads.ts +4 -4
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,199 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0 (2025-07-31)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.1.0...v0.2.0](https://github.com/Metronome-Industries/metronome-node/compare/v0.1.0...v0.2.0)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
* **api:** Add support for spend threshold alerts for specific group keys. See [updated alert documentation](https://docs.metronome.com/manage-product-access/create-manage-alerts/#spend-alerts).
|
|
10
|
+
* **api:** Add support for recurring commits linked to subscriptions. See documentation for [hybrid billing models](https://docs.metronome.com/launch-guides/hybrid-business/#implement-a-hybrid-model-for-a-customer).
|
|
11
|
+
* **api:** Add support for new styles in embeddable dashboards.
|
|
12
|
+
* **api:** Add reference to contract on commit objects.
|
|
13
|
+
|
|
14
|
+
### Chores
|
|
15
|
+
|
|
16
|
+
* **docs:** Improved documentation.
|
|
17
|
+
|
|
18
|
+
## 0.1.0 (2025-07-24)
|
|
19
|
+
|
|
20
|
+
Full Changelog: [v0.1.0-beta.12...v0.1.0](https://github.com/Metronome-Industries/metronome-node/compare/v0.1.0-beta.12...v0.1.0)
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* **api:** Allow for Pagination past empty pages ([1b1308b](https://github.com/Metronome-Industries/metronome-node/commit/1b1308b513d14ae4da8c4c2626b31979812ab752))
|
|
25
|
+
* **api:** api update ([b9a103e](https://github.com/Metronome-Industries/metronome-node/commit/b9a103e4cb6df2b6aee6abb86b45b80629f015dd))
|
|
26
|
+
* **api:** api update ([2615251](https://github.com/Metronome-Industries/metronome-node/commit/26152511f0ca5b5fc6c899ad67edbdd27035d9a8))
|
|
27
|
+
* **api:** api update ([2bf2236](https://github.com/Metronome-Industries/metronome-node/commit/2bf22368018398ab1297177ad905d614f708ba94))
|
|
28
|
+
* **api:** api update ([5d3cd18](https://github.com/Metronome-Industries/metronome-node/commit/5d3cd180cb012878780ec99d8469a99d8f2fe5c6))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Chores
|
|
32
|
+
|
|
33
|
+
* **internal:** codegen related update ([a587ca5](https://github.com/Metronome-Industries/metronome-node/commit/a587ca5d5b9e51241afe9b3bf570f47cee3a8916))
|
|
34
|
+
|
|
35
|
+
## 0.1.0-beta.12 (2025-07-18)
|
|
36
|
+
|
|
37
|
+
Full Changelog: [v0.1.0-beta.11...v0.1.0-beta.12](https://github.com/Metronome-Industries/metronome-node/compare/v0.1.0-beta.11...v0.1.0-beta.12)
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
* **api:** Add Event Search API for finding events to match to customers and billable metrics ([1317600](https://github.com/Metronome-Industries/metronome-node/commit/13176003e84098a2ad6cd9f15b4c2cc9a5afc13c))
|
|
42
|
+
* **api:** add previewEvents API for generating draft invoices with provided events ([39bdb26](https://github.com/Metronome-Industries/metronome-node/commit/39bdb26b0dc826a4abfecdbf50e6c6e524bdbb1e))
|
|
43
|
+
* **api:** add support for Anrok and Precalculated tax types in payment gateway configuration ([063282e](https://github.com/Metronome-Industries/metronome-node/commit/063282e256add65b977bc1ed312dcd7d3b8f7447))
|
|
44
|
+
* **api:** add hierarchy configuration to v1 contracts and v2 contracts ([6a2cac4](https://github.com/Metronome-Industries/metronome-node/commit/6a2cac46aa813c57ab797e6060c413f3809f7dee))
|
|
45
|
+
* **api:** add UUID format annotations to credit type IDs ([07bec6a](https://github.com/Metronome-Industries/metronome-node/commit/07bec6a672c803fdf8708ed5fe6502044a7957b4))
|
|
46
|
+
* **api:** add custom credit type support to prepaid balance thresholds ([ad34431](https://github.com/Metronome-Industries/metronome-node/commit/ad344316b76a56cced5c2a6cd2d6b3cd7cf94c5e))
|
|
47
|
+
* **api:** add contract priority field ([1b84492](https://github.com/Metronome-Industries/metronome-node/commit/1b84492f3bc2456447dc0e8e0dd0acb9190a3b7c))
|
|
48
|
+
* **client:** add support for endpoint-specific base URLs ([9f93c51](https://github.com/Metronome-Industries/metronome-node/commit/9f93c51f5aab3e07e19ddacf9db29b87ff1dc0ff))
|
|
49
|
+
* **mcp:** fallback for void-typed methods ([d9dad2b](https://github.com/Metronome-Industries/metronome-node/commit/d9dad2b63eae17db6be436ef66af4d0f621787be))
|
|
50
|
+
* **mcp:** implement support for binary responses ([4cbe51d](https://github.com/Metronome-Industries/metronome-node/commit/4cbe51df7fba1a011a6aa2fb3174ca2a2f69ef11))
|
|
51
|
+
* **mcp:** set X-Stainless-MCP header ([e175ec9](https://github.com/Metronome-Industries/metronome-node/commit/e175ec9b72a2196c0ed9dade64e60d307b3ce9e5))
|
|
52
|
+
* **mcp:** support filtering tool results by a jq expression ([ebc5682](https://github.com/Metronome-Industries/metronome-node/commit/ebc5682662424f1912e40cb26c4409f001195435))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Bug Fixes
|
|
56
|
+
|
|
57
|
+
* **build:** bump node version in CI build to 20 to be compatible with MCP package ([52b0abc](https://github.com/Metronome-Industries/metronome-node/commit/52b0abcac2913de4062e5249e27796647249bd7a))
|
|
58
|
+
* **ci:** release-doctor — report correct token name ([4e1621e](https://github.com/Metronome-Industries/metronome-node/commit/4e1621e8e77f29d18dcc6a3d428c0dde033723de))
|
|
59
|
+
* **client:** don't send `Content-Type` for bodyless methods ([7fd6259](https://github.com/Metronome-Industries/metronome-node/commit/7fd6259678fdf7c3878363732e6a1f2fbd90e595))
|
|
60
|
+
* **mcp:** include required section for top-level properties and support naming transformations ([63bb909](https://github.com/Metronome-Industries/metronome-node/commit/63bb909ae64ac02224a5261283cfcb00c556f7b0))
|
|
61
|
+
* **mcp:** relax input type for asTextContextResult ([672b608](https://github.com/Metronome-Industries/metronome-node/commit/672b6088899b3e56ccef1154061c179c0924eb7e))
|
|
62
|
+
* **mcp:** support jq filtering on cloudflare workers ([e560bbc](https://github.com/Metronome-Industries/metronome-node/commit/e560bbc9b9975e2b6fe4a0609e7bba5faf3ee487))
|
|
63
|
+
* publish script — handle NPM errors correctly ([59bc726](https://github.com/Metronome-Industries/metronome-node/commit/59bc726367965dac5877d900d81bec32b71c395d))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Chores
|
|
67
|
+
|
|
68
|
+
* **ci:** enable for pull requests ([22d2ba8](https://github.com/Metronome-Industries/metronome-node/commit/22d2ba8b4decab21dc501ecd054e1ec92caa0d03))
|
|
69
|
+
* **ci:** only run for pushes and fork pull requests ([55faa25](https://github.com/Metronome-Industries/metronome-node/commit/55faa250be777add47dc8c3e56918184aa66a8be))
|
|
70
|
+
* **docs:** use top-level-await in example snippets ([b3010ef](https://github.com/Metronome-Industries/metronome-node/commit/b3010ef72fb05f33c3382354bc297e8a8fd4a175))
|
|
71
|
+
* **internal:** make base APIResource abstract ([128bf66](https://github.com/Metronome-Industries/metronome-node/commit/128bf662fd0437cdcbd771d006e20b9a0f26f333))
|
|
72
|
+
* make some internal functions async ([4ce7c1b](https://github.com/Metronome-Industries/metronome-node/commit/4ce7c1bdbd26d2144e8cf04d58a80c78bd69931f))
|
|
73
|
+
* **mcp:** formatting ([51ed397](https://github.com/Metronome-Industries/metronome-node/commit/51ed397af653cdc96799a69a7065a66315c1410d))
|
|
74
|
+
* **mcp:** provides high-level initMcpServer function and exports known clients ([7f82ab5](https://github.com/Metronome-Industries/metronome-node/commit/7f82ab5960c2bc474063395fd4c7af6e14964bbf))
|
|
75
|
+
* **mcp:** rework imports in tools ([a1434bc](https://github.com/Metronome-Industries/metronome-node/commit/a1434bc98c123bd605091e1953faf6250022ed81))
|
|
76
|
+
* mention unit type in timeout docs ([74a810d](https://github.com/Metronome-Industries/metronome-node/commit/74a810d4f89fd2840cf0d69cf0c77af4a22a9ffb))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
### Refactors
|
|
80
|
+
|
|
81
|
+
* **types:** replace Record with mapped types ([34e6799](https://github.com/Metronome-Industries/metronome-node/commit/34e6799903417585e94f5db100fbb49bd2f047f0))
|
|
82
|
+
|
|
83
|
+
## 0.1.0-beta.11 (2025-05-30)
|
|
84
|
+
|
|
85
|
+
Full Changelog: [v0.1.0-beta.10...v0.1.0-beta.11](https://github.com/Metronome-Industries/metronome-node/compare/v0.1.0-beta.10...v0.1.0-beta.11)
|
|
86
|
+
|
|
87
|
+
### Features
|
|
88
|
+
|
|
89
|
+
* **api:** add subscription quantity history endpoint ([e9b4bbe](https://github.com/Metronome-Industries/metronome-node/commit/e9b4bbef3d7435fd9d35a9938426b59f91e03ad4))
|
|
90
|
+
* **api:** api update ([d1052dc](https://github.com/Metronome-Industries/metronome-node/commit/d1052dce85e4a5497f457bd2168118f9cbb6dde3))
|
|
91
|
+
* **api:** api update ([9ef4660](https://github.com/Metronome-Industries/metronome-node/commit/9ef4660419a21dfcd3f060c93a372fbe010ea843))
|
|
92
|
+
* **api:** api update ([7a4ca29](https://github.com/Metronome-Industries/metronome-node/commit/7a4ca29be180fd7d06ae0b6d4598e708fa538281))
|
|
93
|
+
* **api:** api update ([1f75a2f](https://github.com/Metronome-Industries/metronome-node/commit/1f75a2fe161f762465ee072de1806bf4a510c2ce))
|
|
94
|
+
* **api:** api update ([81d3f3d](https://github.com/Metronome-Industries/metronome-node/commit/81d3f3d2be3ecfb033a6c9aeac2939b2ba0adf5a))
|
|
95
|
+
* **api:** api update ([18b541e](https://github.com/Metronome-Industries/metronome-node/commit/18b541eb177314ca299572a7053389701cea18a8))
|
|
96
|
+
* **api:** api update ([a9ddbe3](https://github.com/Metronome-Industries/metronome-node/commit/a9ddbe3c8a26df141f5ad41acaf8c2fc28bf1dd8))
|
|
97
|
+
* **api:** api update ([2da7274](https://github.com/Metronome-Industries/metronome-node/commit/2da7274efe1a758fbabf5ca4b54107fd33a3c069))
|
|
98
|
+
* **api:** api update ([31bbcc9](https://github.com/Metronome-Industries/metronome-node/commit/31bbcc96c9ae847939a2877475d14e094d06ecf1))
|
|
99
|
+
* **api:** api update ([7aecbf6](https://github.com/Metronome-Industries/metronome-node/commit/7aecbf620e2bb02afe1d3ee5cf6dbc6b4e6c5988))
|
|
100
|
+
* **api:** api update ([56bf37d](https://github.com/Metronome-Industries/metronome-node/commit/56bf37d8aa13c9f55f6ec75dcaf17adaadf2fb69))
|
|
101
|
+
* **api:** rename get subscription quantity history to retrieve ([e8fba34](https://github.com/Metronome-Industries/metronome-node/commit/e8fba347a4de50f939292a263c75ce8407bc33d2))
|
|
102
|
+
* **mcp:** include http information in tools ([726c5e8](https://github.com/Metronome-Industries/metronome-node/commit/726c5e8f508b4f106e753315f045eff3b66ad33f))
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Bug Fixes
|
|
106
|
+
|
|
107
|
+
* **mcp:** fix cursor schema transformation issue with recursive references ([5f170a7](https://github.com/Metronome-Industries/metronome-node/commit/5f170a7dc19dc1fdfd52f1da2e77bcbe4d421d22))
|
|
108
|
+
* **mcp:** include description in dynamic tool search ([aa45634](https://github.com/Metronome-Industries/metronome-node/commit/aa456341222b425c6c76ca8db767bbbfa6117721))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### Chores
|
|
112
|
+
|
|
113
|
+
* **api:** mark some methods as deprecated ([964f311](https://github.com/Metronome-Industries/metronome-node/commit/964f31117ebd10c9a340ffcda002761871d6c194))
|
|
114
|
+
* configure new SDK language ([f579630](https://github.com/Metronome-Industries/metronome-node/commit/f5796305b442d41d73cbc4bc6a713894f7aae190))
|
|
115
|
+
* configure new SDK language ([9f9be53](https://github.com/Metronome-Industries/metronome-node/commit/9f9be5311ee3cbd15e67ea4fdbfd7d1354cf7437))
|
|
116
|
+
* **docs:** grammar improvements ([a205060](https://github.com/Metronome-Industries/metronome-node/commit/a2050605f798ce57798f61135753ca489c6c99b2))
|
|
117
|
+
* improve docs for MCP servers ([8d769fc](https://github.com/Metronome-Industries/metronome-node/commit/8d769fc5714bddfa2094d8b31c4181c7aacb0661))
|
|
118
|
+
* improve publish-npm script --latest tag logic ([51cf030](https://github.com/Metronome-Industries/metronome-node/commit/51cf030151865adfc17dbf30392d92eaee780819))
|
|
119
|
+
* **mcp:** remove duplicate assignment ([3aee147](https://github.com/Metronome-Industries/metronome-node/commit/3aee1475476e8dc7b0672b3295358b498781bb93))
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### Documentation
|
|
123
|
+
|
|
124
|
+
* **pagination:** improve naming ([3861f31](https://github.com/Metronome-Industries/metronome-node/commit/3861f31fbe55cfd3d976d1a7794f7c7eb82b5fb7))
|
|
125
|
+
|
|
126
|
+
## 0.1.0-beta.10 (2025-05-14)
|
|
127
|
+
|
|
128
|
+
Full Changelog: [v0.1.0-beta.9...v0.1.0-beta.10](https://github.com/Metronome-Industries/metronome-node/compare/v0.1.0-beta.9...v0.1.0-beta.10)
|
|
129
|
+
|
|
130
|
+
### Features
|
|
131
|
+
|
|
132
|
+
* **api:** api update ([7dff441](https://github.com/Metronome-Industries/metronome-node/commit/7dff441268a88ce3a8846b6cdb7e68e2dca046fb))
|
|
133
|
+
* **api:** api update ([f2c27c0](https://github.com/Metronome-Industries/metronome-node/commit/f2c27c08def847f83d9d49fb756b223705d7afa2))
|
|
134
|
+
* **api:** api update ([8d84c75](https://github.com/Metronome-Industries/metronome-node/commit/8d84c75e3f9328f62b708d9594dcc1c087cbb756))
|
|
135
|
+
* **api:** api update ([af88cb0](https://github.com/Metronome-Industries/metronome-node/commit/af88cb055d1b1e3f20466f4dd0d31099c7a8dc43))
|
|
136
|
+
* **api:** api update ([3b80d3e](https://github.com/Metronome-Industries/metronome-node/commit/3b80d3ecfe26bc2a8250a4bb66fb328ac41d3392))
|
|
137
|
+
* **api:** api update ([a5f5e03](https://github.com/Metronome-Industries/metronome-node/commit/a5f5e0333a21847386d5f8be4d6351a2d1f7f452))
|
|
138
|
+
* **api:** api update ([1180b76](https://github.com/Metronome-Industries/metronome-node/commit/1180b76854337d77e1d2a4add70bb72d2dc6141e))
|
|
139
|
+
* **api:** api update ([6613c56](https://github.com/Metronome-Industries/metronome-node/commit/6613c563f56f6335a9f6061a365044bfcccb2e92))
|
|
140
|
+
* **api:** api update ([4cade32](https://github.com/Metronome-Industries/metronome-node/commit/4cade32a3dca201cde909e94ae2996bbf3cc12ac))
|
|
141
|
+
* **api:** api update ([3ba4f8e](https://github.com/Metronome-Industries/metronome-node/commit/3ba4f8e1b677282008728c84da4c3faf5697b7ed))
|
|
142
|
+
* **api:** api update ([60b4143](https://github.com/Metronome-Industries/metronome-node/commit/60b4143a03cc8e006b86c93da5a545e32703cd83))
|
|
143
|
+
* **api:** api update ([516d9c2](https://github.com/Metronome-Industries/metronome-node/commit/516d9c2fc1bf4b697bb4fafe6f628ea8fbccf79a))
|
|
144
|
+
* **api:** api update ([1c3e744](https://github.com/Metronome-Industries/metronome-node/commit/1c3e744c5003d63781cac40c89e1c5eef24b3bbe))
|
|
145
|
+
* **api:** api update ([bdc9761](https://github.com/Metronome-Industries/metronome-node/commit/bdc97612465ee679612a7b6abb4062d497249a68))
|
|
146
|
+
* **api:** api update ([d6f5562](https://github.com/Metronome-Industries/metronome-node/commit/d6f5562f12c16c51d0126efa3fcc0119fb961621))
|
|
147
|
+
* **api:** api update ([0fd2a49](https://github.com/Metronome-Industries/metronome-node/commit/0fd2a490b5b4e0df89433bfdd584dde69f4d4ea1))
|
|
148
|
+
* **api:** api update ([6dfdf86](https://github.com/Metronome-Industries/metronome-node/commit/6dfdf860700fd361f397a8af15f6f2d1c2577d39))
|
|
149
|
+
* **api:** api update ([4eba9b5](https://github.com/Metronome-Industries/metronome-node/commit/4eba9b5fc38511e98b2b75135dbece28c32af3a2))
|
|
150
|
+
* **api:** api update ([35aae7e](https://github.com/Metronome-Industries/metronome-node/commit/35aae7e331c078b459e73f027c7b4dc6f49176bc))
|
|
151
|
+
* **api:** api update ([84e20e7](https://github.com/Metronome-Industries/metronome-node/commit/84e20e7d6440e2fd6f53860a99600e7206d5d24c))
|
|
152
|
+
* **api:** api update ([3d93874](https://github.com/Metronome-Industries/metronome-node/commit/3d938742990b866401d760fe99a13c217d2c5ab3))
|
|
153
|
+
* **api:** api update ([7049bb8](https://github.com/Metronome-Industries/metronome-node/commit/7049bb8ed7f7f99c89b3a3b8a0e21871f4284055))
|
|
154
|
+
* **api:** api update ([e787f9e](https://github.com/Metronome-Industries/metronome-node/commit/e787f9e186c63ce947eae31727e05e74b6147aa3))
|
|
155
|
+
* **api:** api update ([30f0366](https://github.com/Metronome-Industries/metronome-node/commit/30f0366cfb29018ed2481d91b5fd5badb17da445))
|
|
156
|
+
* **api:** api update ([ea39816](https://github.com/Metronome-Industries/metronome-node/commit/ea39816046abc8384c5572af3aa86b77aa91a43e))
|
|
157
|
+
* **api:** api update ([eff527e](https://github.com/Metronome-Industries/metronome-node/commit/eff527efd5cd6ba1b340e63db45ff7e83a02718d))
|
|
158
|
+
* **api:** api update ([4c5558b](https://github.com/Metronome-Industries/metronome-node/commit/4c5558be27dde87e5801917847af58eab5b1115c))
|
|
159
|
+
* **api:** api update ([ae1b4a1](https://github.com/Metronome-Industries/metronome-node/commit/ae1b4a1fa632f1df8c7b57f63060ff54486b84c3))
|
|
160
|
+
* **api:** api update ([#214](https://github.com/Metronome-Industries/metronome-node/issues/214)) ([44fdb08](https://github.com/Metronome-Industries/metronome-node/commit/44fdb088aab81774a76b23332d631c7e524526bb))
|
|
161
|
+
* **api:** api update ([#216](https://github.com/Metronome-Industries/metronome-node/issues/216)) ([835b4ce](https://github.com/Metronome-Industries/metronome-node/commit/835b4ce72456738d7840dac151e53fe42c85e18d))
|
|
162
|
+
* **api:** api update ([#218](https://github.com/Metronome-Industries/metronome-node/issues/218)) ([37545a3](https://github.com/Metronome-Industries/metronome-node/commit/37545a3c3558f8d5ccc6307eb4ac957c43480ef3))
|
|
163
|
+
* **api:** api update ([#220](https://github.com/Metronome-Industries/metronome-node/issues/220)) ([6185553](https://github.com/Metronome-Industries/metronome-node/commit/6185553a7e1fbc048f37d1b4f376873d488e19f9))
|
|
164
|
+
* **api:** api update ([#222](https://github.com/Metronome-Industries/metronome-node/issues/222)) ([a6de865](https://github.com/Metronome-Industries/metronome-node/commit/a6de865062cc996ca2babb990df2483af26b3a81))
|
|
165
|
+
* **api:** api update ([#224](https://github.com/Metronome-Industries/metronome-node/issues/224)) ([ca18ead](https://github.com/Metronome-Industries/metronome-node/commit/ca18eada2acc3fca19509316825cf7d0cdc12053))
|
|
166
|
+
* **api:** api update ([#225](https://github.com/Metronome-Industries/metronome-node/issues/225)) ([e4d9ab0](https://github.com/Metronome-Industries/metronome-node/commit/e4d9ab0f33722af6b7141c2fc69011454ace1e44))
|
|
167
|
+
* **api:** api update ([#227](https://github.com/Metronome-Industries/metronome-node/issues/227)) ([5f15374](https://github.com/Metronome-Industries/metronome-node/commit/5f15374a6dd354723b6e8fe2f8d5a02407c604ce))
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
### Bug Fixes
|
|
171
|
+
|
|
172
|
+
* **api:** improve type resolution when importing as a package ([#223](https://github.com/Metronome-Industries/metronome-node/issues/223)) ([35a28ba](https://github.com/Metronome-Industries/metronome-node/commit/35a28ba8b62e6b9afa5c0f86f13ae59335e01f05))
|
|
173
|
+
* **client:** send `X-Stainless-Timeout` in seconds ([#219](https://github.com/Metronome-Industries/metronome-node/issues/219)) ([f36c73a](https://github.com/Metronome-Industries/metronome-node/commit/f36c73aeadc23b5f641a498efe28e9d9b9cfa6ee))
|
|
174
|
+
* **internal:** work around https://github.com/vercel/next.js/issues/76881 ([#217](https://github.com/Metronome-Industries/metronome-node/issues/217)) ([23ce14d](https://github.com/Metronome-Industries/metronome-node/commit/23ce14d6a34b552c0f6fc8718029dbf12f919696))
|
|
175
|
+
* **mcp:** remove unused tools.ts ([#226](https://github.com/Metronome-Industries/metronome-node/issues/226)) ([43d45f6](https://github.com/Metronome-Industries/metronome-node/commit/43d45f68095bd4cfd04091ba078d85e3e38c1ea9))
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
### Chores
|
|
179
|
+
|
|
180
|
+
* add hash of OpenAPI spec/config inputs to .stats.yml ([f797d09](https://github.com/Metronome-Industries/metronome-node/commit/f797d094fdccd8db75ed5c441580519b91d11f5a))
|
|
181
|
+
* **ci:** add timeout thresholds for CI jobs ([a2dcbf2](https://github.com/Metronome-Industries/metronome-node/commit/a2dcbf26450fe624fc073cd2f82006246b1a0997))
|
|
182
|
+
* **ci:** bump node version for release workflows ([501b76f](https://github.com/Metronome-Industries/metronome-node/commit/501b76f969395ab5bcace5ac9b229eac136e5a16))
|
|
183
|
+
* **ci:** only use depot for staging repos ([ee6b514](https://github.com/Metronome-Industries/metronome-node/commit/ee6b51494f1ab87c9a0d02d59c61d518d108c818))
|
|
184
|
+
* **ci:** run on more branches and use depot runners ([ed00453](https://github.com/Metronome-Industries/metronome-node/commit/ed00453cd92c062247cffe03ab50d055088c1fe5))
|
|
185
|
+
* **client:** minor internal fixes ([04a2029](https://github.com/Metronome-Industries/metronome-node/commit/04a20299b1f439d6bc20110a2043cb73650b8fdb))
|
|
186
|
+
* **internal:** add aliases for Record and Array ([#221](https://github.com/Metronome-Industries/metronome-node/issues/221)) ([3452e8a](https://github.com/Metronome-Industries/metronome-node/commit/3452e8ada01c6f42579e6be5aac0eac294cbafd3))
|
|
187
|
+
* **internal:** reduce CI branch coverage ([ac7f37b](https://github.com/Metronome-Industries/metronome-node/commit/ac7f37b6edee302bd25f2e9ad0d878739f58d2f5))
|
|
188
|
+
* **internal:** upload builds and expand CI branch coverage ([#229](https://github.com/Metronome-Industries/metronome-node/issues/229)) ([1a2c110](https://github.com/Metronome-Industries/metronome-node/commit/1a2c11097f7100c35b0318ad59105ba15bcdc363))
|
|
189
|
+
* **tests:** improve enum examples ([#228](https://github.com/Metronome-Industries/metronome-node/issues/228)) ([3476c1e](https://github.com/Metronome-Industries/metronome-node/commit/3476c1e6be559ad946a7843ec5b4bcc3f6d3670e))
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
### Documentation
|
|
193
|
+
|
|
194
|
+
* add examples to tsdocs ([a2494b9](https://github.com/Metronome-Industries/metronome-node/commit/a2494b955cf88704027b087f429715c6f49ccb52))
|
|
195
|
+
* **readme:** fix typo ([f8da328](https://github.com/Metronome-Industries/metronome-node/commit/f8da3281bbff42cecb7abdf02d89f6ce6643bfd7))
|
|
196
|
+
|
|
3
197
|
## 0.1.0-beta.9 (2025-03-25)
|
|
4
198
|
|
|
5
199
|
Full Changelog: [v0.1.0-beta.8...v0.1.0-beta.9](https://github.com/Metronome-Industries/metronome-node/compare/v0.1.0-beta.8...v0.1.0-beta.9)
|
package/README.md
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
# Metronome Node API Library
|
|
2
2
|
|
|
3
|
-
> [!WARNING]
|
|
4
|
-
> This is prerelease software that is not ready for production use. There may be bugs and
|
|
5
|
-
> there will be breaking changes version to version. Use at your own risk.
|
|
6
|
-
|
|
7
3
|
[](https://npmjs.org/package/@metronome/sdk) 
|
|
8
4
|
|
|
9
5
|
This library provides convenient access to the Metronome REST API from server-side TypeScript or JavaScript.
|
|
@@ -28,19 +24,15 @@ const client = new Metronome({
|
|
|
28
24
|
bearerToken: process.env['METRONOME_BEARER_TOKEN'], // This is the default and can be omitted
|
|
29
25
|
});
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
]);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
main();
|
|
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
|
+
]);
|
|
44
36
|
```
|
|
45
37
|
|
|
46
38
|
### Request & Response types
|
|
@@ -55,15 +47,11 @@ const client = new Metronome({
|
|
|
55
47
|
bearerToken: process.env['METRONOME_BEARER_TOKEN'], // This is the default and can be omitted
|
|
56
48
|
});
|
|
57
49
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const contract: Metronome.V1.ContractCreateResponse = await client.v1.contracts.create(params);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
main();
|
|
50
|
+
const params: Metronome.V1.ContractCreateParams = {
|
|
51
|
+
customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
|
|
52
|
+
starting_at: '2020-01-01T00:00:00.000Z',
|
|
53
|
+
};
|
|
54
|
+
const contract: Metronome.V1.ContractCreateResponse = await client.v1.contracts.create(params);
|
|
67
55
|
```
|
|
68
56
|
|
|
69
57
|
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
|
|
@@ -76,24 +64,20 @@ a subclass of `APIError` will be thrown:
|
|
|
76
64
|
|
|
77
65
|
<!-- prettier-ignore -->
|
|
78
66
|
```ts
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
main();
|
|
67
|
+
const contract = await client.v1.contracts
|
|
68
|
+
.create({ customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d', starting_at: '2020-01-01T00:00:00.000Z' })
|
|
69
|
+
.catch(async (err) => {
|
|
70
|
+
if (err instanceof Metronome.APIError) {
|
|
71
|
+
console.log(err.status); // 400
|
|
72
|
+
console.log(err.name); // BadRequestError
|
|
73
|
+
console.log(err.headers); // {server: 'nginx', ...}
|
|
74
|
+
} else {
|
|
75
|
+
throw err;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
94
78
|
```
|
|
95
79
|
|
|
96
|
-
Error codes are as
|
|
80
|
+
Error codes are as follows:
|
|
97
81
|
|
|
98
82
|
| Status Code | Error Type |
|
|
99
83
|
| ----------- | -------------------------- |
|
|
@@ -154,13 +138,13 @@ List methods in the Metronome API are paginated.
|
|
|
154
138
|
You can use the `for await … of` syntax to iterate through items across all pages:
|
|
155
139
|
|
|
156
140
|
```ts
|
|
157
|
-
async function
|
|
158
|
-
const
|
|
141
|
+
async function fetchAllProductListResponses(params) {
|
|
142
|
+
const allProductListResponses = [];
|
|
159
143
|
// Automatically fetches more pages as needed.
|
|
160
144
|
for await (const productListResponse of client.v1.contracts.products.list()) {
|
|
161
|
-
|
|
145
|
+
allProductListResponses.push(productListResponse);
|
|
162
146
|
}
|
|
163
|
-
return
|
|
147
|
+
return allProductListResponses;
|
|
164
148
|
}
|
|
165
149
|
```
|
|
166
150
|
|
package/_shims/index.d.ts
CHANGED
|
@@ -79,3 +79,5 @@ export function fileFromPath(path: string, options?: FileFromPathOptions): Promi
|
|
|
79
79
|
export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise<File>;
|
|
80
80
|
|
|
81
81
|
export function isFsReadStream(value: any): value is FsReadStream;
|
|
82
|
+
|
|
83
|
+
export const init: () => void;
|
package/_shims/index.js
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const shims = require('./registry');
|
|
5
5
|
const auto = require('@metronome/sdk/_shims/auto/runtime');
|
|
6
|
-
|
|
6
|
+
exports.init = () => {
|
|
7
|
+
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
|
|
8
|
+
};
|
|
7
9
|
for (const property of Object.keys(shims)) {
|
|
8
10
|
Object.defineProperty(exports, property, {
|
|
9
11
|
get() {
|
|
@@ -11,3 +13,5 @@ for (const property of Object.keys(shims)) {
|
|
|
11
13
|
},
|
|
12
14
|
});
|
|
13
15
|
}
|
|
16
|
+
|
|
17
|
+
exports.init();
|
package/_shims/index.mjs
CHANGED
|
@@ -3,5 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as shims from './registry.mjs';
|
|
5
5
|
import * as auto from '@metronome/sdk/_shims/auto/runtime';
|
|
6
|
-
|
|
6
|
+
export const init = () => {
|
|
7
|
+
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
|
|
8
|
+
};
|
|
7
9
|
export * from './registry.mjs';
|
|
10
|
+
|
|
11
|
+
init();
|
package/core.d.ts
CHANGED
|
@@ -6,6 +6,17 @@ export { type Response };
|
|
|
6
6
|
import { BlobLike } from "./uploads.js";
|
|
7
7
|
export { maybeMultipartFormRequestOptions, multipartFormRequestOptions, createForm, type Uploadable, } from "./uploads.js";
|
|
8
8
|
export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
9
|
+
/**
|
|
10
|
+
* An alias to the builtin `Array` type so we can
|
|
11
|
+
* easily alias it in import statements if there are name clashes.
|
|
12
|
+
*/
|
|
13
|
+
type _Array<T> = Array<T>;
|
|
14
|
+
/**
|
|
15
|
+
* An alias to the builtin `Record` type so we can
|
|
16
|
+
* easily alias it in import statements if there are name clashes.
|
|
17
|
+
*/
|
|
18
|
+
type _Record<K extends keyof any, T> = Record<K, T>;
|
|
19
|
+
export type { _Array as Array, _Record as Record };
|
|
9
20
|
type PromiseOrValue<T> = T | Promise<T>;
|
|
10
21
|
type APIResponseProps = {
|
|
11
22
|
response: Response;
|
|
@@ -59,15 +70,17 @@ export declare class APIPromise<T> extends Promise<T> {
|
|
|
59
70
|
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
|
|
60
71
|
}
|
|
61
72
|
export declare abstract class APIClient {
|
|
73
|
+
#private;
|
|
62
74
|
baseURL: string;
|
|
63
75
|
maxRetries: number;
|
|
64
76
|
timeout: number;
|
|
65
77
|
httpAgent: Agent | undefined;
|
|
66
78
|
private fetch;
|
|
67
79
|
protected idempotencyHeader?: string;
|
|
68
|
-
constructor({ baseURL, maxRetries, timeout, // 1 minute
|
|
80
|
+
constructor({ baseURL, baseURLOverridden, maxRetries, timeout, // 1 minute
|
|
69
81
|
httpAgent, fetch: overriddenFetch, }: {
|
|
70
82
|
baseURL: string;
|
|
83
|
+
baseURLOverridden: boolean;
|
|
71
84
|
maxRetries?: number | undefined;
|
|
72
85
|
timeout: number | undefined;
|
|
73
86
|
httpAgent: Agent | undefined;
|
|
@@ -97,13 +110,13 @@ export declare abstract class APIClient {
|
|
|
97
110
|
private methodRequest;
|
|
98
111
|
getAPIList<Item, PageClass extends AbstractPage<Item> = AbstractPage<Item>>(path: string, Page: new (...args: any[]) => PageClass, opts?: RequestOptions<any>): PagePromise<PageClass, Item>;
|
|
99
112
|
private calculateContentLength;
|
|
100
|
-
buildRequest<Req>(
|
|
113
|
+
buildRequest<Req>(inputOptions: FinalRequestOptions<Req>, { retryCount }?: {
|
|
101
114
|
retryCount?: number;
|
|
102
|
-
}): {
|
|
115
|
+
}): Promise<{
|
|
103
116
|
req: RequestInit;
|
|
104
117
|
url: string;
|
|
105
118
|
timeout: number;
|
|
106
|
-
}
|
|
119
|
+
}>;
|
|
107
120
|
private buildHeaders;
|
|
108
121
|
/**
|
|
109
122
|
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
@@ -124,7 +137,7 @@ export declare abstract class APIClient {
|
|
|
124
137
|
request<Req, Rsp>(options: PromiseOrValue<FinalRequestOptions<Req>>, remainingRetries?: number | null): APIPromise<Rsp>;
|
|
125
138
|
private makeRequest;
|
|
126
139
|
requestAPIList<Item = unknown, PageClass extends AbstractPage<Item> = AbstractPage<Item>>(Page: new (...args: ConstructorParameters<typeof AbstractPage>) => PageClass, options: FinalRequestOptions): PagePromise<PageClass, Item>;
|
|
127
|
-
buildURL<Req>(path: string, query: Req | null | undefined): string;
|
|
140
|
+
buildURL<Req>(path: string, query: Req | null | undefined, defaultBaseURL?: string | undefined): string;
|
|
128
141
|
protected stringifyQuery(query: Record<string, unknown>): string;
|
|
129
142
|
fetchWithTimeout(url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController): Promise<Response>;
|
|
130
143
|
private shouldRetry;
|
|
@@ -190,6 +203,7 @@ export type RequestOptions<Req = unknown | Record<string, unknown> | Readable |
|
|
|
190
203
|
query?: Req | undefined;
|
|
191
204
|
body?: Req | null | undefined;
|
|
192
205
|
headers?: Headers | undefined;
|
|
206
|
+
defaultBaseURL?: string | undefined;
|
|
193
207
|
maxRetries?: number;
|
|
194
208
|
stream?: boolean | undefined;
|
|
195
209
|
timeout?: number;
|
package/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["src/core.ts"],"names":[],"mappings":";;AACA,OAAO,EAEL,QAAQ,EAIT,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,KAAK,QAAQ,EAEb,KAAK,KAAK,EAEV,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["src/core.ts"],"names":[],"mappings":";;AACA,OAAO,EAEL,QAAQ,EAIT,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,KAAK,QAAQ,EAEb,KAAK,KAAK,EAEV,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,EAEjB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;AACzB,OAAO,EAAE,QAAQ,EAA+B,MAAM,WAAW,CAAC;AAClE,OAAO,EACL,gCAAgC,EAChC,2BAA2B,EAC3B,UAAU,EACV,KAAK,UAAU,GAChB,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEhF;;;GAGG;AACH,KAAK,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1B;;;GAGG;AACH,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpD,YAAY,EAAE,MAAM,IAAI,KAAK,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC;AAEnD,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAExC,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,QAAQ,CA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AG,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAElE"}
|
package/core.js
CHANGED
|
@@ -10,12 +10,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var _AbstractPage_client;
|
|
13
|
+
var _APIClient_baseURLOverridden, _AbstractPage_client;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.isObj = exports.toBase64 = exports.getHeader = exports.getRequiredHeader = exports.isHeadersProtocol = exports.isRunningInBrowser = exports.debug = exports.hasOwn = exports.isEmptyObj = exports.maybeCoerceBoolean = exports.maybeCoerceFloat = exports.maybeCoerceInteger = exports.coerceBoolean = exports.coerceFloat = exports.coerceInteger = exports.readEnv = exports.ensurePresent = exports.castToError = exports.sleep = exports.safeJSON = exports.isRequestOptions = exports.createResponseHeaders = exports.PagePromise = exports.AbstractPage = exports.APIClient = exports.APIPromise = exports.createForm = exports.multipartFormRequestOptions = exports.maybeMultipartFormRequestOptions = void 0;
|
|
16
16
|
const version_1 = require("./version.js");
|
|
17
17
|
const error_1 = require("./error.js");
|
|
18
18
|
const index_1 = require("./_shims/index.js");
|
|
19
|
+
// try running side effects outside of _shims/index to workaround https://github.com/vercel/next.js/issues/76881
|
|
20
|
+
(0, index_1.init)();
|
|
19
21
|
const uploads_1 = require("./uploads.js");
|
|
20
22
|
var uploads_2 = require("./uploads.js");
|
|
21
23
|
Object.defineProperty(exports, "maybeMultipartFormRequestOptions", { enumerable: true, get: function () { return uploads_2.maybeMultipartFormRequestOptions; } });
|
|
@@ -112,9 +114,11 @@ class APIPromise extends Promise {
|
|
|
112
114
|
}
|
|
113
115
|
exports.APIPromise = APIPromise;
|
|
114
116
|
class APIClient {
|
|
115
|
-
constructor({ baseURL, maxRetries = 2, timeout = 60000, // 1 minute
|
|
117
|
+
constructor({ baseURL, baseURLOverridden, maxRetries = 2, timeout = 60000, // 1 minute
|
|
116
118
|
httpAgent, fetch: overriddenFetch, }) {
|
|
119
|
+
_APIClient_baseURLOverridden.set(this, void 0);
|
|
117
120
|
this.baseURL = baseURL;
|
|
121
|
+
__classPrivateFieldSet(this, _APIClient_baseURLOverridden, baseURLOverridden, "f");
|
|
118
122
|
this.maxRetries = validatePositiveInteger('maxRetries', maxRetries);
|
|
119
123
|
this.timeout = validatePositiveInteger('timeout', timeout);
|
|
120
124
|
this.httpAgent = httpAgent;
|
|
@@ -134,7 +138,7 @@ class APIClient {
|
|
|
134
138
|
defaultHeaders(opts) {
|
|
135
139
|
return {
|
|
136
140
|
Accept: 'application/json',
|
|
137
|
-
'Content-Type': 'application/json',
|
|
141
|
+
...(['head', 'get'].includes(opts.method) ? {} : { 'Content-Type': 'application/json' }),
|
|
138
142
|
'User-Agent': this.getUserAgent(),
|
|
139
143
|
...getPlatformHeaders(),
|
|
140
144
|
...this.authHeaders(opts),
|
|
@@ -191,16 +195,16 @@ class APIClient {
|
|
|
191
195
|
}
|
|
192
196
|
return null;
|
|
193
197
|
}
|
|
194
|
-
buildRequest(
|
|
195
|
-
options = { ...
|
|
196
|
-
const { method, path, query, headers: headers = {} } = options;
|
|
198
|
+
async buildRequest(inputOptions, { retryCount = 0 } = {}) {
|
|
199
|
+
const options = { ...inputOptions };
|
|
200
|
+
const { method, path, query, defaultBaseURL, headers: headers = {} } = options;
|
|
197
201
|
const body = ArrayBuffer.isView(options.body) || (options.__binaryRequest && typeof options.body === 'string') ?
|
|
198
202
|
options.body
|
|
199
203
|
: (0, uploads_1.isMultipartBody)(options.body) ? options.body.body
|
|
200
204
|
: options.body ? JSON.stringify(options.body, null, 2)
|
|
201
205
|
: null;
|
|
202
206
|
const contentLength = this.calculateContentLength(body);
|
|
203
|
-
const url = this.buildURL(path, query);
|
|
207
|
+
const url = this.buildURL(path, query, defaultBaseURL);
|
|
204
208
|
if ('timeout' in options)
|
|
205
209
|
validatePositiveInteger('timeout', options.timeout);
|
|
206
210
|
options.timeout = options.timeout ?? this.timeout;
|
|
@@ -215,9 +219,9 @@ class APIClient {
|
|
|
215
219
|
httpAgent.options.timeout = minAgentTimeout;
|
|
216
220
|
}
|
|
217
221
|
if (this.idempotencyHeader && method !== 'get') {
|
|
218
|
-
if (!
|
|
219
|
-
|
|
220
|
-
headers[this.idempotencyHeader] =
|
|
222
|
+
if (!inputOptions.idempotencyKey)
|
|
223
|
+
inputOptions.idempotencyKey = this.defaultIdempotencyKey();
|
|
224
|
+
headers[this.idempotencyHeader] = inputOptions.idempotencyKey;
|
|
221
225
|
}
|
|
222
226
|
const reqHeaders = this.buildHeaders({ options, headers, contentLength, retryCount });
|
|
223
227
|
const req = {
|
|
@@ -253,7 +257,7 @@ class APIClient {
|
|
|
253
257
|
if ((0, exports.getHeader)(defaultHeaders, 'x-stainless-timeout') === undefined &&
|
|
254
258
|
(0, exports.getHeader)(headers, 'x-stainless-timeout') === undefined &&
|
|
255
259
|
options.timeout) {
|
|
256
|
-
reqHeaders['x-stainless-timeout'] = String(options.timeout);
|
|
260
|
+
reqHeaders['x-stainless-timeout'] = String(Math.trunc(options.timeout / 1000));
|
|
257
261
|
}
|
|
258
262
|
this.validateHeaders(reqHeaders, headers);
|
|
259
263
|
return reqHeaders;
|
|
@@ -288,7 +292,9 @@ class APIClient {
|
|
|
288
292
|
retriesRemaining = maxRetries;
|
|
289
293
|
}
|
|
290
294
|
await this.prepareOptions(options);
|
|
291
|
-
const { req, url, timeout } = this.buildRequest(options, {
|
|
295
|
+
const { req, url, timeout } = await this.buildRequest(options, {
|
|
296
|
+
retryCount: maxRetries - retriesRemaining,
|
|
297
|
+
});
|
|
292
298
|
await this.prepareRequest(req, { url, options });
|
|
293
299
|
debug('request', url, options, req.headers);
|
|
294
300
|
if (options.signal?.aborted) {
|
|
@@ -329,10 +335,11 @@ class APIClient {
|
|
|
329
335
|
const request = this.makeRequest(options, null);
|
|
330
336
|
return new PagePromise(this, request, Page);
|
|
331
337
|
}
|
|
332
|
-
buildURL(path, query) {
|
|
338
|
+
buildURL(path, query, defaultBaseURL) {
|
|
339
|
+
const baseURL = (!__classPrivateFieldGet(this, _APIClient_baseURLOverridden, "f") && defaultBaseURL) || this.baseURL;
|
|
333
340
|
const url = isAbsoluteURL(path) ?
|
|
334
341
|
new URL(path)
|
|
335
|
-
: new URL(
|
|
342
|
+
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
336
343
|
const defaultQuery = this.defaultQuery();
|
|
337
344
|
if (!isEmptyObj(defaultQuery)) {
|
|
338
345
|
query = { ...defaultQuery, ...query };
|
|
@@ -443,6 +450,7 @@ class APIClient {
|
|
|
443
450
|
}
|
|
444
451
|
}
|
|
445
452
|
exports.APIClient = APIClient;
|
|
453
|
+
_APIClient_baseURLOverridden = new WeakMap();
|
|
446
454
|
class AbstractPage {
|
|
447
455
|
constructor(client, response, body, options) {
|
|
448
456
|
_AbstractPage_client.set(this, void 0);
|
|
@@ -542,6 +550,7 @@ const requestOptionsKeys = {
|
|
|
542
550
|
query: true,
|
|
543
551
|
body: true,
|
|
544
552
|
headers: true,
|
|
553
|
+
defaultBaseURL: true,
|
|
545
554
|
maxRetries: true,
|
|
546
555
|
stream: true,
|
|
547
556
|
timeout: true,
|