modern-treasury 2.7.2 → 2.9.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 +57 -0
- package/README.md +5 -8
- package/_shims/auto/types.d.ts +3 -1
- package/_shims/index.d.ts +2 -0
- package/_shims/node-runtime.d.ts.map +1 -1
- package/_shims/node-runtime.js +3 -0
- package/_shims/node-runtime.js.map +1 -1
- package/_shims/node-runtime.mjs +2 -0
- package/_shims/node-runtime.mjs.map +1 -1
- package/_shims/node-types.d.ts +1 -1
- package/_shims/registry.d.ts +2 -0
- package/_shims/registry.d.ts.map +1 -1
- package/_shims/registry.js +3 -1
- package/_shims/registry.js.map +1 -1
- package/_shims/registry.mjs +2 -0
- package/_shims/registry.mjs.map +1 -1
- package/_shims/web-runtime.d.ts.map +1 -1
- package/_shims/web-runtime.js +8 -0
- package/_shims/web-runtime.js.map +1 -1
- package/_shims/web-runtime.mjs +8 -0
- package/_shims/web-runtime.mjs.map +1 -1
- package/_shims/web-types.d.ts +2 -1
- package/core.d.ts +1 -1
- package/core.d.ts.map +1 -1
- package/core.js +38 -23
- package/core.js.map +1 -1
- package/core.mjs +36 -21
- package/core.mjs.map +1 -1
- package/error.d.ts.map +1 -1
- package/error.js +14 -4
- package/error.js.map +1 -1
- package/error.mjs +14 -4
- package/error.mjs.map +1 -1
- package/index.d.mts +20 -14
- package/index.d.ts +20 -14
- package/index.d.ts.map +1 -1
- package/index.js +6 -6
- package/index.js.map +1 -1
- package/index.mjs +6 -6
- package/index.mjs.map +1 -1
- package/package.json +3 -2
- package/resources/account-collection-flows.d.ts +9 -11
- package/resources/account-collection-flows.d.ts.map +1 -1
- package/resources/account-collection-flows.js +25 -0
- package/resources/account-collection-flows.js.map +1 -1
- package/resources/account-collection-flows.mjs +2 -0
- package/resources/account-collection-flows.mjs.map +1 -1
- package/resources/account-details.d.ts +6 -8
- package/resources/account-details.d.ts.map +1 -1
- package/resources/account-details.js +25 -0
- package/resources/account-details.js.map +1 -1
- package/resources/account-details.mjs +2 -0
- package/resources/account-details.mjs.map +1 -1
- package/resources/connections.d.ts +5 -7
- package/resources/connections.d.ts.map +1 -1
- package/resources/connections.js +25 -0
- package/resources/connections.js.map +1 -1
- package/resources/connections.mjs +2 -0
- package/resources/connections.mjs.map +1 -1
- package/resources/counterparties.d.ts +22 -23
- package/resources/counterparties.d.ts.map +1 -1
- package/resources/counterparties.js +25 -0
- package/resources/counterparties.js.map +1 -1
- package/resources/counterparties.mjs +2 -0
- package/resources/counterparties.mjs.map +1 -1
- package/resources/documents.d.ts +9 -11
- package/resources/documents.d.ts.map +1 -1
- package/resources/documents.js +25 -0
- package/resources/documents.js.map +1 -1
- package/resources/documents.mjs +2 -0
- package/resources/documents.mjs.map +1 -1
- package/resources/events.d.ts +5 -7
- package/resources/events.d.ts.map +1 -1
- package/resources/events.js +25 -0
- package/resources/events.js.map +1 -1
- package/resources/events.mjs +2 -0
- package/resources/events.mjs.map +1 -1
- package/resources/expected-payments.d.ts +26 -16
- package/resources/expected-payments.d.ts.map +1 -1
- package/resources/expected-payments.js +25 -0
- package/resources/expected-payments.js.map +1 -1
- package/resources/expected-payments.mjs +2 -0
- package/resources/expected-payments.mjs.map +1 -1
- package/resources/external-accounts.d.ts +18 -20
- package/resources/external-accounts.d.ts.map +1 -1
- package/resources/external-accounts.js +25 -0
- package/resources/external-accounts.js.map +1 -1
- package/resources/external-accounts.mjs +2 -0
- package/resources/external-accounts.mjs.map +1 -1
- package/resources/incoming-payment-details.d.ts +12 -14
- package/resources/incoming-payment-details.d.ts.map +1 -1
- package/resources/incoming-payment-details.js +25 -0
- package/resources/incoming-payment-details.js.map +1 -1
- package/resources/incoming-payment-details.mjs +2 -0
- package/resources/incoming-payment-details.mjs.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +2 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/internal-accounts/balance-reports.d.ts +5 -7
- package/resources/internal-accounts/balance-reports.d.ts.map +1 -1
- package/resources/internal-accounts/balance-reports.js +25 -0
- package/resources/internal-accounts/balance-reports.js.map +1 -1
- package/resources/internal-accounts/balance-reports.mjs +2 -0
- package/resources/internal-accounts/balance-reports.mjs.map +1 -1
- package/resources/internal-accounts/internal-accounts.d.ts +25 -23
- package/resources/internal-accounts/internal-accounts.d.ts.map +1 -1
- package/resources/internal-accounts/internal-accounts.js +6 -5
- package/resources/internal-accounts/internal-accounts.js.map +1 -1
- package/resources/internal-accounts/internal-accounts.mjs +6 -5
- package/resources/internal-accounts/internal-accounts.mjs.map +1 -1
- package/resources/invoices/invoices.d.ts +39 -26
- package/resources/invoices/invoices.d.ts.map +1 -1
- package/resources/invoices/invoices.js +6 -5
- package/resources/invoices/invoices.js.map +1 -1
- package/resources/invoices/invoices.mjs +6 -5
- package/resources/invoices/invoices.mjs.map +1 -1
- package/resources/invoices/line-items.d.ts +7 -9
- package/resources/invoices/line-items.d.ts.map +1 -1
- package/resources/invoices/line-items.js +25 -0
- package/resources/invoices/line-items.js.map +1 -1
- package/resources/invoices/line-items.mjs +2 -0
- package/resources/invoices/line-items.mjs.map +1 -1
- package/resources/ledger-account-balance-monitors.d.ts +7 -9
- package/resources/ledger-account-balance-monitors.d.ts.map +1 -1
- package/resources/ledger-account-balance-monitors.js +25 -0
- package/resources/ledger-account-balance-monitors.js.map +1 -1
- package/resources/ledger-account-balance-monitors.mjs +2 -0
- package/resources/ledger-account-balance-monitors.mjs.map +1 -1
- package/resources/ledger-account-categories.d.ts +11 -12
- package/resources/ledger-account-categories.d.ts.map +1 -1
- package/resources/ledger-account-categories.js +25 -0
- package/resources/ledger-account-categories.js.map +1 -1
- package/resources/ledger-account-categories.mjs +2 -0
- package/resources/ledger-account-categories.mjs.map +1 -1
- package/resources/ledger-account-payouts.d.ts +17 -9
- package/resources/ledger-account-payouts.d.ts.map +1 -1
- package/resources/ledger-account-payouts.js +25 -0
- package/resources/ledger-account-payouts.js.map +1 -1
- package/resources/ledger-account-payouts.mjs +2 -0
- package/resources/ledger-account-payouts.mjs.map +1 -1
- package/resources/ledger-account-statements.d.ts +7 -6
- package/resources/ledger-account-statements.d.ts.map +1 -1
- package/resources/ledger-account-statements.js.map +1 -1
- package/resources/ledger-account-statements.mjs.map +1 -1
- package/resources/ledger-accounts.d.ts +11 -12
- package/resources/ledger-accounts.d.ts.map +1 -1
- package/resources/ledger-accounts.js +25 -0
- package/resources/ledger-accounts.js.map +1 -1
- package/resources/ledger-accounts.mjs +2 -0
- package/resources/ledger-accounts.mjs.map +1 -1
- package/resources/ledger-entries.d.ts +9 -10
- package/resources/ledger-entries.d.ts.map +1 -1
- package/resources/ledger-entries.js +25 -0
- package/resources/ledger-entries.js.map +1 -1
- package/resources/ledger-entries.mjs +2 -0
- package/resources/ledger-entries.mjs.map +1 -1
- package/resources/ledger-event-handlers.d.ts +47 -270
- package/resources/ledger-event-handlers.d.ts.map +1 -1
- package/resources/ledger-event-handlers.js +29 -7
- package/resources/ledger-event-handlers.js.map +1 -1
- package/resources/ledger-event-handlers.mjs +4 -5
- package/resources/ledger-event-handlers.mjs.map +1 -1
- package/resources/ledger-transactions/ledger-transactions.d.ts +19 -20
- package/resources/ledger-transactions/ledger-transactions.d.ts.map +1 -1
- package/resources/ledger-transactions/ledger-transactions.js +6 -5
- package/resources/ledger-transactions/ledger-transactions.js.map +1 -1
- package/resources/ledger-transactions/ledger-transactions.mjs +6 -5
- package/resources/ledger-transactions/ledger-transactions.mjs.map +1 -1
- package/resources/ledger-transactions/versions.d.ts +7 -8
- package/resources/ledger-transactions/versions.d.ts.map +1 -1
- package/resources/ledger-transactions/versions.js +25 -0
- package/resources/ledger-transactions/versions.js.map +1 -1
- package/resources/ledger-transactions/versions.mjs +2 -0
- package/resources/ledger-transactions/versions.mjs.map +1 -1
- package/resources/ledgerable-events.d.ts +4 -41
- package/resources/ledgerable-events.d.ts.map +1 -1
- package/resources/ledgerable-events.js +1 -2
- package/resources/ledgerable-events.js.map +1 -1
- package/resources/ledgerable-events.mjs +1 -2
- package/resources/ledgerable-events.mjs.map +1 -1
- package/resources/ledgers.d.ts +7 -9
- package/resources/ledgers.d.ts.map +1 -1
- package/resources/ledgers.js +25 -0
- package/resources/ledgers.js.map +1 -1
- package/resources/ledgers.mjs +2 -0
- package/resources/ledgers.mjs.map +1 -1
- package/resources/line-items.d.ts +6 -8
- package/resources/line-items.d.ts.map +1 -1
- package/resources/line-items.js +25 -0
- package/resources/line-items.js.map +1 -1
- package/resources/line-items.mjs +2 -0
- package/resources/line-items.mjs.map +1 -1
- package/resources/paper-items.d.ts +5 -7
- package/resources/paper-items.d.ts.map +1 -1
- package/resources/paper-items.js +25 -0
- package/resources/paper-items.js.map +1 -1
- package/resources/paper-items.mjs +2 -0
- package/resources/paper-items.mjs.map +1 -1
- package/resources/payment-flows.d.ts +7 -9
- package/resources/payment-flows.d.ts.map +1 -1
- package/resources/payment-flows.js +25 -0
- package/resources/payment-flows.js.map +1 -1
- package/resources/payment-flows.mjs +2 -0
- package/resources/payment-flows.mjs.map +1 -1
- package/resources/payment-orders/payment-orders.d.ts +75 -50
- package/resources/payment-orders/payment-orders.d.ts.map +1 -1
- package/resources/payment-orders/payment-orders.js +6 -5
- package/resources/payment-orders/payment-orders.js.map +1 -1
- package/resources/payment-orders/payment-orders.mjs +6 -5
- package/resources/payment-orders/payment-orders.mjs.map +1 -1
- package/resources/payment-orders/reversals.d.ts +8 -9
- package/resources/payment-orders/reversals.d.ts.map +1 -1
- package/resources/payment-orders/reversals.js +25 -0
- package/resources/payment-orders/reversals.js.map +1 -1
- package/resources/payment-orders/reversals.mjs +2 -0
- package/resources/payment-orders/reversals.mjs.map +1 -1
- package/resources/payment-references.d.ts +5 -7
- package/resources/payment-references.d.ts.map +1 -1
- package/resources/payment-references.js +25 -0
- package/resources/payment-references.js.map +1 -1
- package/resources/payment-references.mjs +2 -0
- package/resources/payment-references.mjs.map +1 -1
- package/resources/returns.d.ts +11 -13
- package/resources/returns.d.ts.map +1 -1
- package/resources/returns.js +25 -0
- package/resources/returns.js.map +1 -1
- package/resources/returns.mjs +2 -0
- package/resources/returns.mjs.map +1 -1
- package/resources/routing-details.d.ts +16 -14
- package/resources/routing-details.d.ts.map +1 -1
- package/resources/routing-details.js +25 -0
- package/resources/routing-details.js.map +1 -1
- package/resources/routing-details.mjs +2 -0
- package/resources/routing-details.mjs.map +1 -1
- package/resources/shared.d.ts +1 -0
- package/resources/shared.d.ts.map +1 -1
- package/resources/top-level.d.ts +2 -2
- package/resources/top-level.d.ts.map +1 -1
- package/resources/transactions/line-items.d.ts +10 -7
- package/resources/transactions/line-items.d.ts.map +1 -1
- package/resources/transactions/line-items.js +25 -0
- package/resources/transactions/line-items.js.map +1 -1
- package/resources/transactions/line-items.mjs +2 -0
- package/resources/transactions/line-items.mjs.map +1 -1
- package/resources/transactions/transactions.d.ts +28 -30
- package/resources/transactions/transactions.d.ts.map +1 -1
- package/resources/transactions/transactions.js +6 -5
- package/resources/transactions/transactions.js.map +1 -1
- package/resources/transactions/transactions.mjs +6 -5
- package/resources/transactions/transactions.mjs.map +1 -1
- package/resources/validations.d.ts +14 -14
- package/resources/validations.d.ts.map +1 -1
- package/resources/validations.js.map +1 -1
- package/resources/validations.mjs.map +1 -1
- package/resources/virtual-accounts.d.ts +16 -16
- package/resources/virtual-accounts.d.ts.map +1 -1
- package/resources/virtual-accounts.js +25 -0
- package/resources/virtual-accounts.js.map +1 -1
- package/resources/virtual-accounts.mjs +2 -0
- package/resources/virtual-accounts.mjs.map +1 -1
- package/resources/webhooks.d.ts.map +1 -1
- package/resources/webhooks.js +2 -2
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs +3 -3
- package/resources/webhooks.mjs.map +1 -1
- package/shims/node.d.ts +1 -1
- package/shims/node.d.ts.map +1 -1
- package/shims/web.d.ts +1 -1
- package/shims/web.d.ts.map +1 -1
- package/src/_shims/auto/types.d.ts +3 -1
- package/src/_shims/index.d.ts +3 -1
- package/src/_shims/index.mjs +1 -1
- package/src/_shims/node-runtime.ts +4 -0
- package/src/_shims/node-types.d.ts +1 -1
- package/src/_shims/registry.ts +3 -0
- package/src/_shims/web-runtime.ts +12 -0
- package/src/_shims/web-types.d.ts +2 -1
- package/src/core.ts +39 -21
- package/src/error.ts +15 -5
- package/src/index.ts +23 -17
- package/src/resources/account-collection-flows.ts +12 -12
- package/src/resources/account-details.ts +10 -12
- package/src/resources/connections.ts +8 -10
- package/src/resources/counterparties.ts +32 -26
- package/src/resources/documents.ts +13 -12
- package/src/resources/events.ts +8 -10
- package/src/resources/expected-payments.ts +37 -18
- package/src/resources/external-accounts.ts +30 -24
- package/src/resources/incoming-payment-details.ts +17 -17
- package/src/resources/index.ts +3 -5
- package/src/resources/internal-accounts/balance-reports.ts +9 -11
- package/src/resources/internal-accounts/internal-accounts.ts +32 -27
- package/src/resources/invoices/invoices.ts +56 -35
- package/src/resources/invoices/line-items.ts +10 -12
- package/src/resources/ledger-account-balance-monitors.ts +10 -12
- package/src/resources/ledger-account-categories.ts +14 -15
- package/src/resources/ledger-account-payouts.ts +23 -12
- package/src/resources/ledger-account-statements.ts +9 -8
- package/src/resources/ledger-accounts.ts +14 -15
- package/src/resources/ledger-entries.ts +12 -13
- package/src/resources/ledger-event-handlers.ts +53 -336
- package/src/resources/ledger-transactions/ledger-transactions.ts +22 -24
- package/src/resources/ledger-transactions/versions.ts +10 -11
- package/src/resources/ledgerable-events.ts +6 -51
- package/src/resources/ledgers.ts +10 -12
- package/src/resources/line-items.ts +9 -11
- package/src/resources/paper-items.ts +9 -11
- package/src/resources/payment-flows.ts +10 -12
- package/src/resources/payment-orders/payment-orders.ts +110 -56
- package/src/resources/payment-orders/reversals.ts +11 -12
- package/src/resources/payment-references.ts +8 -10
- package/src/resources/returns.ts +16 -18
- package/src/resources/routing-details.ts +26 -14
- package/src/resources/shared.ts +2 -0
- package/src/resources/top-level.ts +2 -2
- package/src/resources/transactions/line-items.ts +14 -10
- package/src/resources/transactions/transactions.ts +35 -35
- package/src/resources/validations.ts +19 -13
- package/src/resources/virtual-accounts.ts +22 -17
- package/src/resources/webhooks.ts +6 -5
- package/src/shims/node.ts +1 -1
- package/src/shims/web.ts +1 -1
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validations.d.ts","sourceRoot":"","sources":["../src/resources/validations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"validations.d.ts","sourceRoot":"","sources":["../src/resources/validations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,cAAc,MAAM,uCAAuC,CAAC;AAExE,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;OAGG;IACH,qBAAqB,CACnB,KAAK,EAAE,qCAAqC,EAC5C,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,0BAA0B,CAAC;CAG/C;AAED,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,YAAY,CAAC,EAAE,0BAA0B,CAAC,WAAW,CAAC;IAEtD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,mBAAmB,CAAC,EAChB,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,cAAc,GACd,SAAS,GACT,2BAA2B,GAC3B,2BAA2B,GAC3B,OAAO,CAAC;IAEZ;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAA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@@
|
|
|
1
|
-
{"version":3,"file":"validations.js","sourceRoot":"","sources":["../src/resources/validations.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,uDAAuD;AAGvD,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;;OAGG;IACH,qBAAqB,CACnB,KAA4C,EAC5C,OAA6B;QAE7B,OAAO,IAAI,CAAC,GAAG,CAAC,kCAAkC,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;CACF;AAXD,kCAWC;
|
|
1
|
+
{"version":3,"file":"validations.js","sourceRoot":"","sources":["../src/resources/validations.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,uDAAuD;AAGvD,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;;OAGG;IACH,qBAAqB,CACnB,KAA4C,EAC5C,OAA6B;QAE7B,OAAO,IAAI,CAAC,GAAG,CAAC,kCAAkC,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;CACF;AAXD,kCAWC;AAqID,WAAiB,WAAW;AAG5B,CAAC,EAHgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAG3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validations.mjs","sourceRoot":"","sources":["../src/resources/validations.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,0BAA0B;AAGtD,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;;OAGG;IACH,qBAAqB,CACnB,KAA4C,EAC5C,OAA6B;QAE7B,OAAO,IAAI,CAAC,GAAG,CAAC,kCAAkC,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"validations.mjs","sourceRoot":"","sources":["../src/resources/validations.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,0BAA0B;AAGtD,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;;OAGG;IACH,qBAAqB,CACnB,KAA4C,EAC5C,OAA6B;QAE7B,OAAO,IAAI,CAAC,GAAG,CAAC,kCAAkC,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;CACF;AAqID,WAAiB,WAAW;AAG5B,CAAC,EAHgB,WAAW,KAAX,WAAW,QAG3B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as Core from 'modern-treasury/core';
|
|
2
2
|
import { APIResource } from 'modern-treasury/resource';
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
6
|
-
import { Page, PageParams } from 'modern-treasury/pagination';
|
|
3
|
+
import * as VirtualAccountsAPI from 'modern-treasury/resources/virtual-accounts';
|
|
4
|
+
import * as AccountDetailsAPI from 'modern-treasury/resources/account-details';
|
|
5
|
+
import * as RoutingDetailsAPI from 'modern-treasury/resources/routing-details';
|
|
6
|
+
import { Page, type PageParams } from 'modern-treasury/pagination';
|
|
7
7
|
export declare class VirtualAccounts extends APIResource {
|
|
8
8
|
/**
|
|
9
9
|
* create virtual_account
|
|
@@ -30,13 +30,12 @@ export declare class VirtualAccounts extends APIResource {
|
|
|
30
30
|
}
|
|
31
31
|
export declare class VirtualAccountsPage extends Page<VirtualAccount> {
|
|
32
32
|
}
|
|
33
|
-
type _VirtualAccountsPage = VirtualAccountsPage;
|
|
34
33
|
export interface VirtualAccount {
|
|
35
34
|
id: string;
|
|
36
35
|
/**
|
|
37
36
|
* An array of account detail objects.
|
|
38
37
|
*/
|
|
39
|
-
account_details: Array<
|
|
38
|
+
account_details: Array<AccountDetailsAPI.AccountDetail>;
|
|
40
39
|
/**
|
|
41
40
|
* The ID of a counterparty that the virtual account belongs to. Optional.
|
|
42
41
|
*/
|
|
@@ -82,7 +81,7 @@ export interface VirtualAccount {
|
|
|
82
81
|
* An array of routing detail objects. These will be the routing details of the
|
|
83
82
|
* internal account.
|
|
84
83
|
*/
|
|
85
|
-
routing_details: Array<
|
|
84
|
+
routing_details: Array<RoutingDetailsAPI.RoutingDetail>;
|
|
86
85
|
updated_at: string;
|
|
87
86
|
}
|
|
88
87
|
export interface VirtualAccountCreateParams {
|
|
@@ -146,14 +145,16 @@ export declare namespace VirtualAccountCreateParams {
|
|
|
146
145
|
*/
|
|
147
146
|
routing_number: string;
|
|
148
147
|
/**
|
|
149
|
-
*
|
|
148
|
+
* The type of routing number. See
|
|
149
|
+
* https://docs.moderntreasury.com/platform/reference/routing-detail-object for
|
|
150
|
+
* more details.
|
|
150
151
|
*/
|
|
151
|
-
routing_number_type: 'aba' | 'au_bsb' | 'br_codigo' | 'ca_cpa' | 'chips' | 'cnaps' | 'gb_sort_code' | 'in_ifsc' | 'jp_zengin_code' | 'my_branch_code' | 'se_bankgiro_clearing_code' | 'swift';
|
|
152
|
+
routing_number_type: 'aba' | 'au_bsb' | 'br_codigo' | 'ca_cpa' | 'chips' | 'cnaps' | 'gb_sort_code' | 'hk_interbank_clearing_code' | 'in_ifsc' | 'jp_zengin_code' | 'my_branch_code' | 'nz_national_clearing_code' | 'se_bankgiro_clearing_code' | 'swift';
|
|
152
153
|
/**
|
|
153
154
|
* If the routing detail is to be used for a specific payment type this field will
|
|
154
155
|
* be populated, otherwise null.
|
|
155
156
|
*/
|
|
156
|
-
payment_type?: 'ach' | 'au_becs' | 'bacs' | 'book' | 'card' | 'check' | 'cross_border' | 'eft' | 'interac' | 'masav' | 'neft' | 'nics' | 'provxchange' | 'rtp' | 'se_bankgirot' | 'sen' | 'sepa' | 'sic' | 'signet' | 'wire' | 'zengin' | null;
|
|
157
|
+
payment_type?: 'ach' | 'au_becs' | 'bacs' | 'book' | 'card' | 'chats' | 'check' | 'cross_border' | 'eft' | 'interac' | 'masav' | 'neft' | 'nics' | 'nz_becs' | 'provxchange' | 'rtp' | 'se_bankgirot' | 'sen' | 'sepa' | 'sg_giro' | 'sic' | 'signet' | 'wire' | 'zengin' | null;
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
export interface VirtualAccountUpdateParams {
|
|
@@ -172,11 +173,10 @@ export interface VirtualAccountListParams extends PageParams {
|
|
|
172
173
|
metadata?: Record<string, string>;
|
|
173
174
|
}
|
|
174
175
|
export declare namespace VirtualAccounts {
|
|
175
|
-
export import VirtualAccount =
|
|
176
|
-
|
|
177
|
-
export import VirtualAccountCreateParams =
|
|
178
|
-
export import VirtualAccountUpdateParams =
|
|
179
|
-
export import VirtualAccountListParams =
|
|
176
|
+
export import VirtualAccount = VirtualAccountsAPI.VirtualAccount;
|
|
177
|
+
export import VirtualAccountsPage = VirtualAccountsAPI.VirtualAccountsPage;
|
|
178
|
+
export import VirtualAccountCreateParams = VirtualAccountsAPI.VirtualAccountCreateParams;
|
|
179
|
+
export import VirtualAccountUpdateParams = VirtualAccountsAPI.VirtualAccountUpdateParams;
|
|
180
|
+
export import VirtualAccountListParams = VirtualAccountsAPI.VirtualAccountListParams;
|
|
180
181
|
}
|
|
181
|
-
export {};
|
|
182
182
|
//# sourceMappingURL=virtual-accounts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-accounts.d.ts","sourceRoot":"","sources":["../src/resources/virtual-accounts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"virtual-accounts.d.ts","sourceRoot":"","sources":["../src/resources/virtual-accounts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,KAAK,kBAAkB,MAAM,4CAA4C,CAAC;AACjF,OAAO,KAAK,iBAAiB,MAAM,2CAA2C,CAAC;AAC/E,O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;CACnC;AAED,yBAAiB,eAAe,CAAC;IAC/B,MAAM,QAAQ,cAAc,GAAG,kBAAkB,CAAC,cAAc,CAAC;IACjE,MAAM,QAAQ,mBAAmB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC;IAC3E,MAAM,QAAQ,0BAA0B,GAAG,kBAAkB,CAAC,0BAA0B,CAAC;IACzF,MAAM,QAAQ,0BAA0B,GAAG,kBAAkB,CAAC,0BAA0B,CAAC;IACzF,MAAM,QAAQ,wBAAwB,GAAG,kBAAkB,CAAC,wBAAwB,CAAC;CACtF"}
|
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
3
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
27
|
exports.VirtualAccountsPage = exports.VirtualAccounts = void 0;
|
|
5
28
|
const resource_1 = require("modern-treasury/resource");
|
|
6
29
|
const core_1 = require("modern-treasury/core");
|
|
30
|
+
const VirtualAccountsAPI = __importStar(require("modern-treasury/resources/virtual-accounts"));
|
|
7
31
|
const pagination_1 = require("modern-treasury/pagination");
|
|
8
32
|
class VirtualAccounts extends resource_1.APIResource {
|
|
9
33
|
/**
|
|
@@ -51,5 +75,6 @@ class VirtualAccountsPage extends pagination_1.Page {
|
|
|
51
75
|
}
|
|
52
76
|
exports.VirtualAccountsPage = VirtualAccountsPage;
|
|
53
77
|
(function (VirtualAccounts) {
|
|
78
|
+
VirtualAccounts.VirtualAccountsPage = VirtualAccountsAPI.VirtualAccountsPage;
|
|
54
79
|
})(VirtualAccounts = exports.VirtualAccounts || (exports.VirtualAccounts = {}));
|
|
55
80
|
//# sourceMappingURL=virtual-accounts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-accounts.js","sourceRoot":"","sources":["../src/resources/virtual-accounts.ts"],"names":[],"mappings":";AAAA,qDAAqD
|
|
1
|
+
{"version":3,"file":"virtual-accounts.js","sourceRoot":"","sources":["../src/resources/virtual-accounts.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;;;;;;;;;;;;;;;;;;;;;;;;AAGrD,uDAAuD;AACvD,+CAAwD;AACxD,+FAAiF;AAGjF,2DAAmE;AAEnE,MAAa,eAAgB,SAAQ,sBAAW;IAC9C;;OAEG;IACH,MAAM,CAAC,MAAkC,EAAE,OAA6B;QACtE,qGAAqG;QACrG,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC9D,IAAI,cAAc,EAAE;YAClB,OAAO,CAAC,IAAI,CACV,sGAAsG,CACvG,CAAC;SACH;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,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AAe,KAAf,uBAAe,QAM/B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
import { APIResource } from 'modern-treasury/resource';
|
|
3
3
|
import { isRequestOptions } from 'modern-treasury/core';
|
|
4
|
+
import * as VirtualAccountsAPI from 'modern-treasury/resources/virtual-accounts';
|
|
4
5
|
import { Page } from 'modern-treasury/pagination';
|
|
5
6
|
export class VirtualAccounts extends APIResource {
|
|
6
7
|
/**
|
|
@@ -46,5 +47,6 @@ export class VirtualAccounts extends APIResource {
|
|
|
46
47
|
export class VirtualAccountsPage extends Page {
|
|
47
48
|
}
|
|
48
49
|
(function (VirtualAccounts) {
|
|
50
|
+
VirtualAccounts.VirtualAccountsPage = VirtualAccountsAPI.VirtualAccountsPage;
|
|
49
51
|
})(VirtualAccounts || (VirtualAccounts = {}));
|
|
50
52
|
//# sourceMappingURL=virtual-accounts.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-accounts.mjs","sourceRoot":"","sources":["../src/resources/virtual-accounts.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,0BAA0B;OAC/C,EAAE,gBAAgB,EAAE,MAAM,sBAAsB;
|
|
1
|
+
{"version":3,"file":"virtual-accounts.mjs","sourceRoot":"","sources":["../src/resources/virtual-accounts.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,0BAA0B;OAC/C,EAAE,gBAAgB,EAAE,MAAM,sBAAsB;OAChD,KAAK,kBAAkB,MAAM,4CAA4C;OAGzE,EAAE,IAAI,EAAmB,MAAM,4BAA4B;AAElE,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAC9C;;OAEG;IACH,MAAM,CAAC,MAAkC,EAAE,OAA6B;QACtE,qGAAqG;QACrG,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,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AEhB,mCAAmB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC;AAI7E,CAAC,EANgB,eAAe,KAAf,eAAe,QAM/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;OAUG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;KAAE,GAAG,MAAM;IAcjF;;OAEG;IACH,iBAAiB,CACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,WAAW,EAC7B,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;KAAE,GACzC,OAAO;
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;OAUG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;KAAE,GAAG,MAAM;IAcjF;;OAEG;IACH,iBAAiB,CACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,WAAW,EAC7B,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;KAAE,GACzC,OAAO;CAOX"}
|
package/resources/webhooks.js
CHANGED
|
@@ -32,9 +32,9 @@ class Webhooks extends resource_1.APIResource {
|
|
|
32
32
|
*/
|
|
33
33
|
validateSignature(payload, headers, opts) {
|
|
34
34
|
const signature = this.getSignature(payload, opts);
|
|
35
|
-
const expectedSignature = typeof headers === 'string' ? headers : (0, core_1.
|
|
35
|
+
const expectedSignature = typeof headers === 'string' ? headers : (0, core_1.getRequiredHeader)(headers, 'X-Signature');
|
|
36
36
|
if (!expectedSignature)
|
|
37
|
-
throw new Error('Could not find
|
|
37
|
+
throw new Error('Could not find X-Signature header');
|
|
38
38
|
return signature === expectedSignature;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAErD,uDAAuD;AACvD,mCAAoC;AAEpC,+
|
|
1
|
+
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAErD,uDAAuD;AACvD,mCAAoC;AAEpC,+CAAyD;AAEzD,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;;;OAUG;IACH,YAAY,CAAC,OAAe,EAAE,IAA0C;QACtE,MAAM,GAAG,GAAG,IAAI,EAAE,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;QAChD,IAAI,GAAG,IAAI,IAAI,EAAE;YACf,MAAM,IAAI,KAAK,CACb,8KAA8K,CAC/K,CAAC;SACH;QACD,IAAI,CAAC,GAAG,EAAE;YACR,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACpE;QAED,OAAO,IAAA,mBAAU,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzE,CAAC;IAED;;OAEG;IACH,iBAAiB,CACf,OAAe,EACf,OAA6B,EAC7B,IAA0C;QAE1C,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACnD,MAAM,iBAAiB,GACrB,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,wBAAiB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QACpF,IAAI,CAAC,iBAAiB;YAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QAC7E,OAAO,SAAS,KAAK,iBAAiB,CAAC;IACzC,CAAC;CACF;AAxCD,4BAwCC"}
|
package/resources/webhooks.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
import { APIResource } from 'modern-treasury/resource';
|
|
3
3
|
import { createHmac } from 'crypto';
|
|
4
|
-
import {
|
|
4
|
+
import { getRequiredHeader } from 'modern-treasury/core';
|
|
5
5
|
export class Webhooks extends APIResource {
|
|
6
6
|
/**
|
|
7
7
|
* To verify that a webhook was actually sent by Modern Treasury, every payload is
|
|
@@ -29,9 +29,9 @@ export class Webhooks extends APIResource {
|
|
|
29
29
|
*/
|
|
30
30
|
validateSignature(payload, headers, opts) {
|
|
31
31
|
const signature = this.getSignature(payload, opts);
|
|
32
|
-
const expectedSignature = typeof headers === 'string' ? headers :
|
|
32
|
+
const expectedSignature = typeof headers === 'string' ? headers : getRequiredHeader(headers, 'X-Signature');
|
|
33
33
|
if (!expectedSignature)
|
|
34
|
-
throw new Error('Could not find
|
|
34
|
+
throw new Error('Could not find X-Signature header');
|
|
35
35
|
return signature === expectedSignature;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.mjs","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"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CACF"}
|
package/shims/node.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare module '../_shims/manual-types' {
|
|
|
23
23
|
export import Blob = types.Blob;
|
|
24
24
|
type Readable = types.Readable;
|
|
25
25
|
type FsReadStream = types.FsReadStream;
|
|
26
|
-
|
|
26
|
+
export import ReadableStream = types.ReadableStream;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
//# sourceMappingURL=node.d.ts.map
|
package/shims/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/shims/node.ts"],"names":[],"mappings":";;;AACA,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAK9C,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAiB,MAAM,CAAC;QAEtB,KAAY,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAEhC,MAAM,QAAQ,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAElC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QAE5D,MAAM,QAAQ,QAA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G,KAAK,CAAC,IAAI,CAAC;QAEhC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,MAAM,QAAQ,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;KACrD;CACF"}
|
package/shims/web.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ declare module '../_shims/manual-types' {
|
|
|
20
20
|
export import Blob = types.Blob;
|
|
21
21
|
type Readable = types.Readable;
|
|
22
22
|
type FsReadStream = types.FsReadStream;
|
|
23
|
-
|
|
23
|
+
export import ReadableStream = types.ReadableStream;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
//# sourceMappingURL=web.d.ts.map
|
package/shims/web.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/shims/web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAK7C,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAiB,MAAM,CAAC;QAEtB,KAAY,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAEhC,MAAM,QAAQ,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAElC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,OAAO,GAAG,KAAK,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;QAE5C,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QAE5D,MAAM,QAAQ,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAExC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,MAAM,QAAQ,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;KACrD;CACF"}
|
|
@@ -96,4 +96,6 @@ export declare class FsReadStream extends Readable {
|
|
|
96
96
|
|
|
97
97
|
// @ts-ignore
|
|
98
98
|
type _ReadableStream<R = any> = ReadableStream<R>;
|
|
99
|
-
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
declare const _ReadableStream: typeof ReadableStream;
|
|
101
|
+
export { _ReadableStream as ReadableStream };
|
package/src/_shims/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
|
3
3
|
*/
|
|
4
4
|
import { manual } from './manual-types';
|
|
5
|
-
import * as auto from "
|
|
5
|
+
import * as auto from "./auto/types";
|
|
6
6
|
import { type RequestOptions } from '../core';
|
|
7
7
|
|
|
8
8
|
type SelectType<Manual, Auto> = unknown extends Manual ? Auto : Manual;
|
|
@@ -62,6 +62,8 @@ export type Readable = SelectType<manual.Readable, auto.Readable>;
|
|
|
62
62
|
export type FsReadStream = SelectType<manual.FsReadStream, auto.FsReadStream>;
|
|
63
63
|
// @ts-ignore
|
|
64
64
|
export type ReadableStream = SelectType<manual.ReadableStream, auto.ReadableStream>;
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
export const ReadableStream: SelectType<typeof manual.ReadableStream, typeof auto.ReadableStream>;
|
|
65
67
|
|
|
66
68
|
export function getMultipartRequestOptions<T extends {} = Record<string, unknown>>(
|
|
67
69
|
form: FormData,
|
package/src/_shims/index.mjs
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
|
3
3
|
*/
|
|
4
4
|
import * as shims from './registry.mjs';
|
|
5
|
-
import * as auto from "
|
|
5
|
+
import * as auto from "./auto/runtime";
|
|
6
6
|
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
|
|
7
7
|
export * from './registry.mjs';
|
|
@@ -14,6 +14,9 @@ import { type RequestOptions } from '../core';
|
|
|
14
14
|
import { MultipartBody } from './MultipartBody';
|
|
15
15
|
import { type Shims } from './registry';
|
|
16
16
|
|
|
17
|
+
// @ts-ignore (this package does not have proper export maps for this export)
|
|
18
|
+
import { ReadableStream } from 'web-streams-polyfill/dist/ponyfill.es2018.js';
|
|
19
|
+
|
|
17
20
|
type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
|
|
18
21
|
|
|
19
22
|
let fileFromPathWarned = false;
|
|
@@ -71,6 +74,7 @@ export function getRuntime(): Shims {
|
|
|
71
74
|
FormData: fd.FormData,
|
|
72
75
|
Blob: fd.Blob,
|
|
73
76
|
File: fd.File,
|
|
77
|
+
ReadableStream,
|
|
74
78
|
getMultipartRequestOptions,
|
|
75
79
|
getDefaultAgent: (url: string): Agent => (url.startsWith('https') ? defaultHttpsAgent : defaultHttpAgent),
|
|
76
80
|
fileFromPath,
|
|
@@ -7,7 +7,7 @@ import * as fd from 'formdata-node';
|
|
|
7
7
|
export { type Agent } from 'node:http';
|
|
8
8
|
export { type Readable } from 'node:stream';
|
|
9
9
|
export { type ReadStream as FsReadStream } from 'node:fs';
|
|
10
|
-
export {
|
|
10
|
+
export { ReadableStream } from 'web-streams-polyfill';
|
|
11
11
|
|
|
12
12
|
export const fetch: typeof nf.default;
|
|
13
13
|
|
package/src/_shims/registry.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface Shims {
|
|
|
12
12
|
FormData: any;
|
|
13
13
|
Blob: any;
|
|
14
14
|
File: any;
|
|
15
|
+
ReadableStream: any;
|
|
15
16
|
getMultipartRequestOptions: <T extends {} = Record<string, unknown>>(
|
|
16
17
|
form: Shims['FormData'],
|
|
17
18
|
opts: RequestOptions<T>,
|
|
@@ -32,6 +33,7 @@ export let Headers: Shims['Headers'] | undefined = undefined;
|
|
|
32
33
|
export let FormData: Shims['FormData'] | undefined = undefined;
|
|
33
34
|
export let Blob: Shims['Blob'] | undefined = undefined;
|
|
34
35
|
export let File: Shims['File'] | undefined = undefined;
|
|
36
|
+
export let ReadableStream: Shims['ReadableStream'] | undefined = undefined;
|
|
35
37
|
export let getMultipartRequestOptions: Shims['getMultipartRequestOptions'] | undefined = undefined;
|
|
36
38
|
export let getDefaultAgent: Shims['getDefaultAgent'] | undefined = undefined;
|
|
37
39
|
export let fileFromPath: Shims['fileFromPath'] | undefined = undefined;
|
|
@@ -57,6 +59,7 @@ export function setShims(shims: Shims, options: { auto: boolean } = { auto: fals
|
|
|
57
59
|
FormData = shims.FormData;
|
|
58
60
|
Blob = shims.Blob;
|
|
59
61
|
File = shims.File;
|
|
62
|
+
ReadableStream = shims.ReadableStream;
|
|
60
63
|
getMultipartRequestOptions = shims.getMultipartRequestOptions;
|
|
61
64
|
getDefaultAgent = shims.getDefaultAgent;
|
|
62
65
|
fileFromPath = shims.fileFromPath;
|
|
@@ -72,6 +72,18 @@ export function getRuntime({ manuallyImported }: { manuallyImported?: boolean }
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
+
ReadableStream:
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
typeof ReadableStream !== 'undefined' ? ReadableStream : (
|
|
78
|
+
class ReadableStream {
|
|
79
|
+
// @ts-ignore
|
|
80
|
+
constructor() {
|
|
81
|
+
throw new Error(
|
|
82
|
+
`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${recommendation}`,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
),
|
|
75
87
|
getMultipartRequestOptions: async <T extends {} = Record<string, unknown>>(
|
|
76
88
|
// @ts-ignore
|
|
77
89
|
form: FormData,
|
|
@@ -79,4 +79,5 @@ export declare class FsReadStream extends Readable {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
type _ReadableStream<R = any> = ReadableStream<R>;
|
|
82
|
-
|
|
82
|
+
declare const _ReadableStream: typeof ReadableStream;
|
|
83
|
+
export { _ReadableStream as ReadableStream };
|
package/src/core.ts
CHANGED
|
@@ -26,8 +26,6 @@ export {
|
|
|
26
26
|
type Uploadable,
|
|
27
27
|
} from './uploads';
|
|
28
28
|
|
|
29
|
-
const MAX_RETRIES = 2;
|
|
30
|
-
|
|
31
29
|
export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
32
30
|
|
|
33
31
|
type PromiseOrValue<T> = T | Promise<T>;
|
|
@@ -40,6 +38,11 @@ type APIResponseProps = {
|
|
|
40
38
|
|
|
41
39
|
async function defaultParseResponse<T>(props: APIResponseProps): Promise<T> {
|
|
42
40
|
const { response } = props;
|
|
41
|
+
// fetch refuses to read the body when the status code is 204.
|
|
42
|
+
if (response.status === 204) {
|
|
43
|
+
return null as T;
|
|
44
|
+
}
|
|
45
|
+
|
|
43
46
|
const contentType = response.headers.get('content-type');
|
|
44
47
|
if (contentType?.includes('application/json')) {
|
|
45
48
|
const json = await response.json();
|
|
@@ -148,7 +151,7 @@ export abstract class APIClient {
|
|
|
148
151
|
|
|
149
152
|
constructor({
|
|
150
153
|
baseURL,
|
|
151
|
-
maxRetries,
|
|
154
|
+
maxRetries = 2,
|
|
152
155
|
timeout = 60000, // 1 minute
|
|
153
156
|
httpAgent,
|
|
154
157
|
fetch: overridenFetch,
|
|
@@ -160,7 +163,7 @@ export abstract class APIClient {
|
|
|
160
163
|
fetch: Fetch | undefined;
|
|
161
164
|
}) {
|
|
162
165
|
this.baseURL = baseURL;
|
|
163
|
-
this.maxRetries = validatePositiveInteger('maxRetries', maxRetries
|
|
166
|
+
this.maxRetries = validatePositiveInteger('maxRetries', maxRetries);
|
|
164
167
|
this.timeout = validatePositiveInteger('timeout', timeout);
|
|
165
168
|
this.httpAgent = httpAgent;
|
|
166
169
|
|
|
@@ -499,8 +502,6 @@ export abstract class APIClient {
|
|
|
499
502
|
retriesRemaining: number,
|
|
500
503
|
responseHeaders?: Headers | undefined,
|
|
501
504
|
): Promise<APIResponseProps> {
|
|
502
|
-
retriesRemaining -= 1;
|
|
503
|
-
|
|
504
505
|
// About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
505
506
|
let timeoutMillis: number | undefined;
|
|
506
507
|
const retryAfterHeader = responseHeaders?.['retry-after'];
|
|
@@ -526,22 +527,22 @@ export abstract class APIClient {
|
|
|
526
527
|
}
|
|
527
528
|
await sleep(timeoutMillis);
|
|
528
529
|
|
|
529
|
-
return this.makeRequest(options, retriesRemaining);
|
|
530
|
+
return this.makeRequest(options, retriesRemaining - 1);
|
|
530
531
|
}
|
|
531
532
|
|
|
532
533
|
private calculateDefaultRetryTimeoutMillis(retriesRemaining: number, maxRetries: number): number {
|
|
533
534
|
const initialRetryDelay = 0.5;
|
|
534
|
-
const maxRetryDelay =
|
|
535
|
+
const maxRetryDelay = 8.0;
|
|
535
536
|
|
|
536
537
|
const numRetries = maxRetries - retriesRemaining;
|
|
537
538
|
|
|
538
539
|
// Apply exponential backoff, but not more than the max.
|
|
539
|
-
const sleepSeconds = Math.min(initialRetryDelay * Math.pow(
|
|
540
|
+
const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay);
|
|
540
541
|
|
|
541
|
-
// Apply some jitter,
|
|
542
|
-
const jitter = Math.random()
|
|
542
|
+
// Apply some jitter, take up to at most 25 percent of the retry time.
|
|
543
|
+
const jitter = 1 - Math.random() * 0.25;
|
|
543
544
|
|
|
544
|
-
return
|
|
545
|
+
return sleepSeconds * jitter * 1000;
|
|
545
546
|
}
|
|
546
547
|
|
|
547
548
|
private getUserAgent(): string {
|
|
@@ -1053,16 +1054,33 @@ export const isHeadersProtocol = (headers: any): headers is HeadersProtocol => {
|
|
|
1053
1054
|
return typeof headers?.get === 'function';
|
|
1054
1055
|
};
|
|
1055
1056
|
|
|
1056
|
-
export const
|
|
1057
|
-
const
|
|
1058
|
-
if (isHeadersProtocol(headers))
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1057
|
+
export const getRequiredHeader = (headers: HeadersLike, header: string): string => {
|
|
1058
|
+
const lowerCasedHeader = header.toLowerCase();
|
|
1059
|
+
if (isHeadersProtocol(headers)) {
|
|
1060
|
+
// to deal with the case where the header looks like Stainless-Event-Id
|
|
1061
|
+
const intercapsHeader =
|
|
1062
|
+
header[0]?.toUpperCase() +
|
|
1063
|
+
header.substring(1).replace(/([^\w])(\w)/g, (_m, g1, g2) => g1 + g2.toUpperCase());
|
|
1064
|
+
for (const key of [header, lowerCasedHeader, header.toUpperCase(), intercapsHeader]) {
|
|
1065
|
+
const value = headers.get(key);
|
|
1066
|
+
if (value) {
|
|
1067
|
+
return value;
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
1073
|
+
if (key.toLowerCase() === lowerCasedHeader) {
|
|
1074
|
+
if (Array.isArray(value)) {
|
|
1075
|
+
if (value.length <= 1) return value[0];
|
|
1076
|
+
console.warn(`Received ${value.length} entries for the ${header} header, using the first entry.`);
|
|
1077
|
+
return value[0];
|
|
1078
|
+
}
|
|
1079
|
+
return value;
|
|
1080
|
+
}
|
|
1064
1081
|
}
|
|
1065
|
-
|
|
1082
|
+
|
|
1083
|
+
throw new Error(`Could not find ${header} header`);
|
|
1066
1084
|
};
|
|
1067
1085
|
|
|
1068
1086
|
/**
|
package/src/error.ts
CHANGED
|
@@ -15,20 +15,30 @@ export class APIError extends ModernTreasuryError {
|
|
|
15
15
|
message: string | undefined,
|
|
16
16
|
headers: Headers | undefined,
|
|
17
17
|
) {
|
|
18
|
-
super(`${
|
|
18
|
+
super(`${APIError.makeMessage(status, error, message)}`);
|
|
19
19
|
this.status = status;
|
|
20
20
|
this.headers = headers;
|
|
21
21
|
this.error = error;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
private static makeMessage(error: any, message: string | undefined) {
|
|
25
|
-
|
|
24
|
+
private static makeMessage(status: number | undefined, error: any, message: string | undefined) {
|
|
25
|
+
const msg =
|
|
26
26
|
error?.message ?
|
|
27
27
|
typeof error.message === 'string' ? error.message
|
|
28
28
|
: JSON.stringify(error.message)
|
|
29
29
|
: error ? JSON.stringify(error)
|
|
30
|
-
: message
|
|
31
|
-
|
|
30
|
+
: message;
|
|
31
|
+
|
|
32
|
+
if (status && msg) {
|
|
33
|
+
return `${status} ${msg}`;
|
|
34
|
+
}
|
|
35
|
+
if (status) {
|
|
36
|
+
return `${status} status code (no body)`;
|
|
37
|
+
}
|
|
38
|
+
if (msg) {
|
|
39
|
+
return msg;
|
|
40
|
+
}
|
|
41
|
+
return '(no status code or body)';
|
|
32
42
|
}
|
|
33
43
|
|
|
34
44
|
static generate(
|