increase 0.2.0 → 0.4.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/.prettierignore +1 -0
- package/.release-please-manifest.json +3 -0
- package/.stats.yml +1 -1
- package/CHANGELOG.md +130 -0
- package/README.md +19 -5
- package/api.md +99 -0
- package/bin/check-release-environment +25 -0
- package/bin/publish-npm +6 -0
- package/check-version.ts +4 -1
- package/core.ts +32 -126
- package/dist/cjs/check-version.d.ts +1 -0
- package/dist/cjs/check-version.d.ts.map +1 -0
- package/dist/cjs/check-version.js +3 -1
- package/dist/cjs/check-version.js.map +1 -1
- package/dist/cjs/core.d.ts +25 -55
- package/dist/cjs/core.d.ts.map +1 -0
- package/dist/cjs/core.js +43 -168
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/error.d.ts +208 -0
- package/dist/cjs/error.d.ts.map +1 -0
- package/dist/cjs/error.js +326 -0
- package/dist/cjs/error.js.map +1 -0
- package/dist/cjs/examples/api-error.d.ts +3 -0
- package/dist/cjs/examples/api-error.d.ts.map +1 -0
- package/dist/cjs/examples/api-error.js +92 -0
- package/dist/cjs/examples/api-error.js.map +1 -0
- package/dist/cjs/fetch-polyfill.d.ts +1 -0
- package/dist/cjs/fetch-polyfill.d.ts.map +1 -0
- package/dist/cjs/fetch-polyfill.js +2 -2
- package/dist/cjs/fetch-polyfill.js.map +1 -1
- package/dist/cjs/index.d.ts +81 -22
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +80 -26
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/pagination.d.ts +4 -0
- package/dist/cjs/pagination.d.ts.map +1 -0
- package/dist/cjs/pagination.js.map +1 -1
- package/dist/cjs/resource.d.ts +1 -0
- package/dist/cjs/resource.d.ts.map +1 -0
- package/dist/cjs/resources/account-numbers.d.ts +26 -0
- package/dist/cjs/resources/account-numbers.d.ts.map +1 -0
- package/dist/cjs/resources/account-numbers.js.map +1 -1
- package/dist/cjs/resources/account-statements.d.ts +1 -0
- package/dist/cjs/resources/account-statements.d.ts.map +1 -0
- package/dist/cjs/resources/account-statements.js.map +1 -1
- package/dist/cjs/resources/account-transfers.d.ts +20 -11
- package/dist/cjs/resources/account-transfers.d.ts.map +1 -0
- package/dist/cjs/resources/account-transfers.js.map +1 -1
- package/dist/cjs/resources/accounts.d.ts +41 -19
- package/dist/cjs/resources/accounts.d.ts.map +1 -0
- package/dist/cjs/resources/accounts.js.map +1 -1
- package/dist/cjs/resources/ach-prenotifications.d.ts +4 -0
- package/dist/cjs/resources/ach-prenotifications.d.ts.map +1 -0
- package/dist/cjs/resources/ach-prenotifications.js.map +1 -1
- package/dist/cjs/resources/ach-transfers.d.ts +89 -9
- package/dist/cjs/resources/ach-transfers.d.ts.map +1 -0
- package/dist/cjs/resources/ach-transfers.js.map +1 -1
- package/dist/cjs/resources/balance-lookups.d.ts +47 -0
- package/dist/cjs/resources/balance-lookups.d.ts.map +1 -0
- package/dist/cjs/resources/balance-lookups.js +15 -0
- package/dist/cjs/resources/balance-lookups.js.map +1 -0
- package/dist/cjs/resources/bookkeeping-accounts.d.ts +71 -0
- package/dist/cjs/resources/bookkeeping-accounts.d.ts.map +1 -0
- package/dist/cjs/resources/bookkeeping-accounts.js +29 -0
- package/dist/cjs/resources/bookkeeping-accounts.js.map +1 -0
- package/dist/cjs/resources/bookkeeping-entries.d.ts +43 -0
- package/dist/cjs/resources/bookkeeping-entries.d.ts.map +1 -0
- package/dist/cjs/resources/bookkeeping-entries.js +19 -0
- package/dist/cjs/resources/bookkeeping-entries.js.map +1 -0
- package/dist/cjs/resources/bookkeeping-entry-sets.d.ts +83 -0
- package/dist/cjs/resources/bookkeeping-entry-sets.d.ts.map +1 -0
- package/dist/cjs/resources/bookkeeping-entry-sets.js +15 -0
- package/dist/cjs/resources/bookkeeping-entry-sets.js.map +1 -0
- package/dist/cjs/resources/card-disputes.d.ts +13 -3
- package/dist/cjs/resources/card-disputes.d.ts.map +1 -0
- package/dist/cjs/resources/card-disputes.js.map +1 -1
- package/dist/cjs/resources/card-profiles.d.ts +18 -2
- package/dist/cjs/resources/card-profiles.d.ts.map +1 -0
- package/dist/cjs/resources/card-profiles.js.map +1 -1
- package/dist/cjs/resources/cards.d.ts +31 -2
- package/dist/cjs/resources/cards.d.ts.map +1 -0
- package/dist/cjs/resources/cards.js.map +1 -1
- package/dist/cjs/resources/check-deposits.d.ts +16 -1
- package/dist/cjs/resources/check-deposits.d.ts.map +1 -0
- package/dist/cjs/resources/check-deposits.js.map +1 -1
- package/dist/cjs/resources/check-transfers.d.ts +104 -5
- package/dist/cjs/resources/check-transfers.d.ts.map +1 -0
- package/dist/cjs/resources/check-transfers.js.map +1 -1
- package/dist/cjs/resources/declined-transactions.d.ts +85 -23
- package/dist/cjs/resources/declined-transactions.d.ts.map +1 -0
- package/dist/cjs/resources/declined-transactions.js.map +1 -1
- package/dist/cjs/resources/digital-wallet-tokens.d.ts +1 -0
- package/dist/cjs/resources/digital-wallet-tokens.d.ts.map +1 -0
- package/dist/cjs/resources/digital-wallet-tokens.js.map +1 -1
- package/dist/cjs/resources/documents.d.ts +105 -4
- package/dist/cjs/resources/documents.d.ts.map +1 -0
- package/dist/cjs/resources/documents.js.map +1 -1
- package/dist/cjs/resources/entities/entities.d.ts +363 -136
- package/dist/cjs/resources/entities/entities.d.ts.map +1 -0
- package/dist/cjs/resources/entities/entities.js +1 -1
- package/dist/cjs/resources/entities/entities.js.map +1 -1
- package/dist/cjs/resources/entities/index.d.ts +7 -1
- package/dist/cjs/resources/entities/index.d.ts.map +1 -0
- package/dist/cjs/resources/entities/index.js +8 -1
- package/dist/cjs/resources/entities/index.js.map +1 -1
- package/dist/cjs/resources/entities/supplemental-documents.d.ts +36 -0
- package/dist/cjs/resources/entities/supplemental-documents.d.ts.map +1 -0
- package/dist/cjs/resources/entities/supplemental-documents.js +14 -1
- package/dist/cjs/resources/entities/supplemental-documents.js.map +1 -1
- package/dist/cjs/resources/event-subscriptions.d.ts +5 -0
- package/dist/cjs/resources/event-subscriptions.d.ts.map +1 -0
- package/dist/cjs/resources/event-subscriptions.js.map +1 -1
- package/dist/cjs/resources/events.d.ts +30 -24
- package/dist/cjs/resources/events.d.ts.map +1 -0
- package/dist/cjs/resources/events.js.map +1 -1
- package/dist/cjs/resources/exports.d.ts +162 -0
- package/dist/cjs/resources/exports.d.ts.map +1 -0
- package/dist/cjs/resources/exports.js +31 -0
- package/dist/cjs/resources/exports.js.map +1 -0
- package/dist/cjs/resources/external-accounts.d.ts +4 -2
- package/dist/cjs/resources/external-accounts.d.ts.map +1 -0
- package/dist/cjs/resources/external-accounts.js.map +1 -1
- package/dist/cjs/resources/files.d.ts +10 -4
- package/dist/cjs/resources/files.d.ts.map +1 -0
- package/dist/cjs/resources/files.js.map +1 -1
- package/dist/cjs/resources/groups.d.ts +1 -0
- package/dist/cjs/resources/groups.d.ts.map +1 -0
- package/dist/cjs/resources/inbound-ach-transfer-returns.d.ts +4 -0
- package/dist/cjs/resources/inbound-ach-transfer-returns.d.ts.map +1 -0
- package/dist/cjs/resources/inbound-ach-transfer-returns.js.map +1 -1
- package/dist/cjs/resources/inbound-wire-drawdown-requests.d.ts +1 -0
- package/dist/cjs/resources/inbound-wire-drawdown-requests.d.ts.map +1 -0
- package/dist/cjs/resources/inbound-wire-drawdown-requests.js.map +1 -1
- package/dist/cjs/resources/index.d.ts +29 -0
- package/dist/cjs/resources/index.d.ts.map +1 -0
- package/dist/cjs/resources/index.js +100 -9
- package/dist/cjs/resources/index.js.map +1 -1
- package/dist/cjs/resources/limits.d.ts +1 -0
- package/dist/cjs/resources/limits.d.ts.map +1 -0
- package/dist/cjs/resources/limits.js.map +1 -1
- package/dist/cjs/resources/oauth-connections.d.ts +1 -0
- package/dist/cjs/resources/oauth-connections.d.ts.map +1 -0
- package/dist/cjs/resources/oauth-connections.js.map +1 -1
- package/dist/cjs/resources/pending-transactions.d.ts +115 -36
- package/dist/cjs/resources/pending-transactions.d.ts.map +1 -0
- package/dist/cjs/resources/pending-transactions.js.map +1 -1
- package/dist/cjs/resources/programs.d.ts +48 -0
- package/dist/cjs/resources/programs.d.ts.map +1 -0
- package/dist/cjs/resources/programs.js +25 -0
- package/dist/cjs/resources/programs.js.map +1 -0
- package/dist/cjs/resources/real-time-decisions.d.ts +43 -7
- package/dist/cjs/resources/real-time-decisions.d.ts.map +1 -0
- package/dist/cjs/resources/real-time-payments-transfers.d.ts +287 -0
- package/dist/cjs/resources/real-time-payments-transfers.d.ts.map +1 -0
- package/dist/cjs/resources/real-time-payments-transfers.js +35 -0
- package/dist/cjs/resources/real-time-payments-transfers.js.map +1 -0
- package/dist/cjs/resources/routing-numbers.d.ts +1 -0
- package/dist/cjs/resources/routing-numbers.d.ts.map +1 -0
- package/dist/cjs/resources/shared.d.ts +1 -0
- package/dist/cjs/resources/shared.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/account-statements.d.ts +1 -0
- package/dist/cjs/resources/simulations/account-statements.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/account-transfers.d.ts +1 -0
- package/dist/cjs/resources/simulations/account-transfers.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/ach-transfers.d.ts +470 -157
- package/dist/cjs/resources/simulations/ach-transfers.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/card-disputes.d.ts +1 -0
- package/dist/cjs/resources/simulations/card-disputes.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/card-refunds.d.ts +1 -0
- package/dist/cjs/resources/simulations/card-refunds.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/cards.d.ts +188 -56
- package/dist/cjs/resources/simulations/cards.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/check-deposits.d.ts +1 -0
- package/dist/cjs/resources/simulations/check-deposits.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/check-transfers.d.ts +16 -0
- package/dist/cjs/resources/simulations/check-transfers.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/check-transfers.js +10 -0
- package/dist/cjs/resources/simulations/check-transfers.js.map +1 -1
- package/dist/cjs/resources/simulations/digital-wallet-token-requests.d.ts +1 -0
- package/dist/cjs/resources/simulations/digital-wallet-token-requests.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/documents.d.ts +1 -0
- package/dist/cjs/resources/simulations/documents.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/inbound-wire-drawdown-requests.d.ts +1 -0
- package/dist/cjs/resources/simulations/inbound-wire-drawdown-requests.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/index.d.ts +5 -0
- package/dist/cjs/resources/simulations/index.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/interest-payments.d.ts +1237 -0
- package/dist/cjs/resources/simulations/interest-payments.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/interest-payments.js +16 -0
- package/dist/cjs/resources/simulations/interest-payments.js.map +1 -0
- package/dist/cjs/resources/simulations/programs.d.ts +21 -0
- package/dist/cjs/resources/simulations/programs.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/programs.js +17 -0
- package/dist/cjs/resources/simulations/programs.js.map +1 -0
- package/dist/cjs/resources/simulations/real-time-payments-transfers.d.ts +470 -155
- package/dist/cjs/resources/simulations/real-time-payments-transfers.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/real-time-payments-transfers.js +11 -0
- package/dist/cjs/resources/simulations/real-time-payments-transfers.js.map +1 -1
- package/dist/cjs/resources/simulations/simulations.d.ts +5 -0
- package/dist/cjs/resources/simulations/simulations.d.ts.map +1 -0
- package/dist/cjs/resources/simulations/simulations.js +4 -0
- package/dist/cjs/resources/simulations/simulations.js.map +1 -1
- package/dist/cjs/resources/simulations/wire-transfers.d.ts +332 -133
- package/dist/cjs/resources/simulations/wire-transfers.d.ts.map +1 -0
- package/dist/cjs/resources/transactions.d.ts +353 -165
- package/dist/cjs/resources/transactions.d.ts.map +1 -0
- package/dist/cjs/resources/transactions.js.map +1 -1
- package/dist/cjs/resources/wire-drawdown-requests.d.ts +5 -0
- package/dist/cjs/resources/wire-drawdown-requests.d.ts.map +1 -0
- package/dist/cjs/resources/wire-drawdown-requests.js.map +1 -1
- package/dist/cjs/resources/wire-transfers.d.ts +39 -4
- package/dist/cjs/resources/wire-transfers.d.ts.map +1 -0
- package/dist/cjs/resources/wire-transfers.js.map +1 -1
- package/dist/cjs/streaming.d.ts +13 -0
- package/dist/cjs/streaming.d.ts.map +1 -0
- package/dist/cjs/streaming.js +282 -0
- package/dist/cjs/streaming.js.map +1 -0
- package/dist/cjs/tests/api-resources/account-numbers.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/account-numbers.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/account-numbers.test.js +25 -28
- package/dist/cjs/tests/api-resources/account-numbers.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/account-statements.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/account-statements.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/account-statements.test.js +7 -20
- package/dist/cjs/tests/api-resources/account-statements.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/account-transfers.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/account-transfers.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/account-transfers.test.js +16 -29
- package/dist/cjs/tests/api-resources/account-transfers.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/accounts.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/accounts.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/accounts.test.js +22 -23
- package/dist/cjs/tests/api-resources/accounts.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/ach-prenotifications.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/ach-prenotifications.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/ach-prenotifications.test.js +12 -24
- package/dist/cjs/tests/api-resources/ach-prenotifications.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/ach-transfers.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/ach-transfers.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/ach-transfers.test.js +17 -31
- package/dist/cjs/tests/api-resources/ach-transfers.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/balance-lookups.test.d.ts +2 -0
- package/dist/cjs/tests/api-resources/balance-lookups.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/balance-lookups.test.js +55 -0
- package/dist/cjs/tests/api-resources/balance-lookups.test.js.map +1 -0
- package/dist/cjs/tests/api-resources/bookkeeping-accounts.test.d.ts +2 -0
- package/dist/cjs/tests/api-resources/bookkeeping-accounts.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/bookkeeping-accounts.test.js +78 -0
- package/dist/cjs/tests/api-resources/bookkeeping-accounts.test.js.map +1 -0
- package/dist/cjs/tests/api-resources/bookkeeping-entries.test.d.ts +2 -0
- package/dist/cjs/tests/api-resources/bookkeeping-entries.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/bookkeeping-entries.test.js +65 -0
- package/dist/cjs/tests/api-resources/bookkeeping-entries.test.js.map +1 -0
- package/dist/cjs/tests/api-resources/bookkeeping-entry-sets.test.d.ts +2 -0
- package/dist/cjs/tests/api-resources/bookkeeping-entry-sets.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/bookkeeping-entry-sets.test.js +66 -0
- package/dist/cjs/tests/api-resources/bookkeeping-entry-sets.test.js.map +1 -0
- package/dist/cjs/tests/api-resources/card-disputes.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/card-disputes.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/card-disputes.test.js +18 -24
- package/dist/cjs/tests/api-resources/card-disputes.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/card-profiles.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/card-profiles.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/card-profiles.test.js +28 -19
- package/dist/cjs/tests/api-resources/card-profiles.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/cards.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/cards.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/cards.test.js +13 -35
- package/dist/cjs/tests/api-resources/cards.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/check-deposits.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/check-deposits.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/check-deposits.test.js +24 -27
- package/dist/cjs/tests/api-resources/check-deposits.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/check-transfers.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/check-transfers.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/check-transfers.test.js +27 -40
- package/dist/cjs/tests/api-resources/check-transfers.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/declined-transactions.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/declined-transactions.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/declined-transactions.test.js +9 -23
- package/dist/cjs/tests/api-resources/declined-transactions.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/digital-wallet-tokens.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/digital-wallet-tokens.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/digital-wallet-tokens.test.js +8 -21
- package/dist/cjs/tests/api-resources/digital-wallet-tokens.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/documents.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/documents.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/documents.test.js +15 -23
- package/dist/cjs/tests/api-resources/documents.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/entities/entities.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/entities/entities.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/entities/entities.test.js +40 -31
- package/dist/cjs/tests/api-resources/entities/entities.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/entities/supplemental-documents.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/entities/supplemental-documents.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/entities/supplemental-documents.test.js +25 -6
- package/dist/cjs/tests/api-resources/entities/supplemental-documents.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/event-subscriptions.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/event-subscriptions.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/event-subscriptions.test.js +10 -20
- package/dist/cjs/tests/api-resources/event-subscriptions.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/events.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/events.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/events.test.js +8 -22
- package/dist/cjs/tests/api-resources/events.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/exports.test.d.ts +2 -0
- package/dist/cjs/tests/api-resources/exports.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/exports.test.js +101 -0
- package/dist/cjs/tests/api-resources/exports.test.js.map +1 -0
- package/dist/cjs/tests/api-resources/external-accounts.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/external-accounts.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/external-accounts.test.js +13 -27
- package/dist/cjs/tests/api-resources/external-accounts.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/files.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/files.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/files.test.js +8 -21
- package/dist/cjs/tests/api-resources/files.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/groups.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/groups.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/groups.test.js +6 -5
- package/dist/cjs/tests/api-resources/groups.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/inbound-ach-transfer-returns.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/inbound-ach-transfer-returns.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/inbound-ach-transfer-returns.test.js +16 -12
- package/dist/cjs/tests/api-resources/inbound-ach-transfer-returns.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/inbound-wire-drawdown-requests.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/inbound-wire-drawdown-requests.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/inbound-wire-drawdown-requests.test.js +6 -9
- package/dist/cjs/tests/api-resources/inbound-wire-drawdown-requests.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/limits.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/limits.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/limits.test.js +14 -17
- package/dist/cjs/tests/api-resources/limits.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/oauth-connections.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/oauth-connections.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/oauth-connections.test.js +6 -9
- package/dist/cjs/tests/api-resources/oauth-connections.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/pending-transactions.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/pending-transactions.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/pending-transactions.test.js +13 -17
- package/dist/cjs/tests/api-resources/pending-transactions.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/programs.test.d.ts +2 -0
- package/dist/cjs/tests/api-resources/programs.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/programs.test.js +73 -0
- package/dist/cjs/tests/api-resources/programs.test.js.map +1 -0
- package/dist/cjs/tests/api-resources/real-time-decisions.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/real-time-decisions.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/real-time-decisions.test.js +6 -16
- package/dist/cjs/tests/api-resources/real-time-decisions.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/real-time-payments-transfers.test.d.ts +2 -0
- package/dist/cjs/tests/api-resources/real-time-payments-transfers.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/real-time-payments-transfers.test.js +113 -0
- package/dist/cjs/tests/api-resources/real-time-payments-transfers.test.js.map +1 -0
- package/dist/cjs/tests/api-resources/routing-numbers.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/routing-numbers.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/routing-numbers.test.js +6 -5
- package/dist/cjs/tests/api-resources/routing-numbers.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/simulations/account-statements.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/simulations/account-statements.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/account-statements.test.js +11 -8
- package/dist/cjs/tests/api-resources/simulations/account-statements.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/simulations/account-transfers.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/simulations/account-transfers.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/account-transfers.test.js +5 -4
- package/dist/cjs/tests/api-resources/simulations/account-transfers.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/simulations/ach-transfers.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/simulations/ach-transfers.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/ach-transfers.test.js +13 -19
- package/dist/cjs/tests/api-resources/simulations/ach-transfers.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/simulations/card-disputes.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/simulations/card-disputes.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/card-disputes.test.js +8 -7
- package/dist/cjs/tests/api-resources/simulations/card-disputes.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/simulations/card-refunds.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/simulations/card-refunds.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/card-refunds.test.js +11 -8
- package/dist/cjs/tests/api-resources/simulations/card-refunds.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/simulations/cards.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/simulations/cards.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/cards.test.js +12 -10
- package/dist/cjs/tests/api-resources/simulations/cards.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/simulations/check-deposits.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/simulations/check-deposits.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/check-deposits.test.js +5 -4
- package/dist/cjs/tests/api-resources/simulations/check-deposits.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/simulations/check-transfers.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/simulations/check-transfers.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/check-transfers.test.js +23 -4
- package/dist/cjs/tests/api-resources/simulations/check-transfers.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/simulations/digital-wallet-token-requests.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/simulations/digital-wallet-token-requests.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/digital-wallet-token-requests.test.js +11 -8
- package/dist/cjs/tests/api-resources/simulations/digital-wallet-token-requests.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/simulations/documents.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/simulations/documents.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/documents.test.js +10 -7
- package/dist/cjs/tests/api-resources/simulations/documents.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/simulations/inbound-wire-drawdown-requests.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/simulations/inbound-wire-drawdown-requests.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/inbound-wire-drawdown-requests.test.js +29 -28
- package/dist/cjs/tests/api-resources/simulations/inbound-wire-drawdown-requests.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/simulations/interest-payments.test.d.ts +2 -0
- package/dist/cjs/tests/api-resources/simulations/interest-payments.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/interest-payments.test.js +58 -0
- package/dist/cjs/tests/api-resources/simulations/interest-payments.test.js.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/programs.test.d.ts +2 -0
- package/dist/cjs/tests/api-resources/simulations/programs.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/programs.test.js +52 -0
- package/dist/cjs/tests/api-resources/simulations/programs.test.js.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/real-time-payments-transfers.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/simulations/real-time-payments-transfers.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/real-time-payments-transfers.test.js +20 -12
- package/dist/cjs/tests/api-resources/simulations/real-time-payments-transfers.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/simulations/wire-transfers.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/simulations/wire-transfers.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/simulations/wire-transfers.test.js +11 -10
- package/dist/cjs/tests/api-resources/simulations/wire-transfers.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/transactions.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/transactions.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/transactions.test.js +11 -28
- package/dist/cjs/tests/api-resources/transactions.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/wire-drawdown-requests.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/wire-drawdown-requests.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/wire-drawdown-requests.test.js +20 -23
- package/dist/cjs/tests/api-resources/wire-drawdown-requests.test.js.map +1 -1
- package/dist/cjs/tests/api-resources/wire-transfers.test.d.ts +1 -0
- package/dist/cjs/tests/api-resources/wire-transfers.test.d.ts.map +1 -0
- package/dist/cjs/tests/api-resources/wire-transfers.test.js +22 -36
- package/dist/cjs/tests/api-resources/wire-transfers.test.js.map +1 -1
- package/dist/cjs/tests/form.test.d.ts +1 -0
- package/dist/cjs/tests/form.test.d.ts.map +1 -0
- package/dist/cjs/tests/form.test.js +4 -3
- package/dist/cjs/tests/index.test.d.ts +1 -0
- package/dist/cjs/tests/index.test.d.ts.map +1 -0
- package/dist/cjs/tests/index.test.js +36 -4
- package/dist/cjs/tests/index.test.js.map +1 -1
- package/dist/cjs/tests/responses.test.d.ts +1 -0
- package/dist/cjs/tests/responses.test.d.ts.map +1 -0
- package/dist/cjs/tests/responses.test.js +4 -3
- package/dist/cjs/version.d.ts +2 -1
- package/dist/cjs/version.d.ts.map +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/error.ts +505 -0
- package/examples/api-error.ts +21 -0
- package/fetch-polyfill.ts +2 -2
- package/index.ts +90 -20
- package/package.json +2 -2
- package/pagination.ts +3 -0
- package/release-please-config.json +61 -0
- package/resources/account-numbers.ts +30 -1
- package/resources/account-statements.ts +0 -1
- package/resources/account-transfers.ts +21 -13
- package/resources/accounts.ts +48 -23
- package/resources/ach-prenotifications.ts +3 -1
- package/resources/ach-transfers.ts +92 -11
- package/resources/balance-lookups.ts +57 -0
- package/resources/bookkeeping-accounts.ts +98 -0
- package/resources/bookkeeping-entries.ts +62 -0
- package/resources/bookkeeping-entry-sets.ts +100 -0
- package/resources/card-disputes.ts +12 -4
- package/resources/card-profiles.ts +17 -3
- package/resources/cards.ts +30 -3
- package/resources/check-deposits.ts +15 -2
- package/resources/check-transfers.ts +117 -7
- package/resources/declined-transactions.ts +96 -27
- package/resources/digital-wallet-tokens.ts +0 -1
- package/resources/documents.ts +104 -5
- package/resources/entities/entities.ts +443 -212
- package/resources/entities/index.ts +6 -1
- package/resources/entities/supplemental-documents.ts +46 -0
- package/resources/event-subscriptions.ts +4 -1
- package/resources/events.ts +33 -29
- package/resources/exports.ts +204 -0
- package/resources/external-accounts.ts +3 -3
- package/resources/files.ts +9 -5
- package/resources/inbound-ach-transfer-returns.ts +3 -1
- package/resources/inbound-wire-drawdown-requests.ts +0 -1
- package/resources/index.ts +28 -0
- package/resources/limits.ts +0 -1
- package/resources/oauth-connections.ts +0 -1
- package/resources/pending-transactions.ts +126 -48
- package/resources/programs.ts +70 -0
- package/resources/real-time-decisions.ts +43 -8
- package/resources/real-time-payments-transfers.ts +351 -0
- package/resources/simulations/ach-transfers.ts +504 -192
- package/resources/simulations/cards.ts +206 -69
- package/resources/simulations/check-transfers.ts +19 -0
- package/resources/simulations/index.ts +4 -0
- package/resources/simulations/interest-payments.ts +1501 -0
- package/resources/simulations/programs.ts +26 -0
- package/resources/simulations/real-time-payments-transfers.ts +512 -190
- package/resources/simulations/simulations.ts +4 -0
- package/resources/simulations/wire-transfers.ts +354 -165
- package/resources/transactions.ts +379 -202
- package/resources/wire-drawdown-requests.ts +4 -1
- package/resources/wire-transfers.ts +43 -6
- package/streaming.ts +199 -0
- package/tests/api-resources/account-numbers.test.ts +22 -25
- package/tests/api-resources/account-statements.test.ts +4 -17
- package/tests/api-resources/account-transfers.test.ts +13 -26
- package/tests/api-resources/accounts.test.ts +19 -20
- package/tests/api-resources/ach-prenotifications.test.ts +9 -21
- package/tests/api-resources/ach-transfers.test.ts +14 -28
- package/tests/api-resources/balance-lookups.test.ts +18 -0
- package/tests/api-resources/bookkeeping-accounts.test.ts +38 -0
- package/tests/api-resources/bookkeeping-entries.test.ts +25 -0
- package/tests/api-resources/bookkeeping-entry-sets.test.ts +29 -0
- package/tests/api-resources/card-disputes.test.ts +15 -21
- package/tests/api-resources/card-profiles.test.ts +25 -16
- package/tests/api-resources/cards.test.ts +10 -32
- package/tests/api-resources/check-deposits.test.ts +21 -24
- package/tests/api-resources/check-transfers.test.ts +24 -37
- package/tests/api-resources/declined-transactions.test.ts +6 -20
- package/tests/api-resources/digital-wallet-tokens.test.ts +5 -18
- package/tests/api-resources/documents.test.ts +8 -20
- package/tests/api-resources/entities/entities.test.ts +37 -31
- package/tests/api-resources/entities/supplemental-documents.test.ts +22 -3
- package/tests/api-resources/event-subscriptions.test.ts +7 -17
- package/tests/api-resources/events.test.ts +5 -19
- package/tests/api-resources/exports.test.ts +64 -0
- package/tests/api-resources/external-accounts.test.ts +10 -24
- package/tests/api-resources/files.test.ts +5 -19
- package/tests/api-resources/groups.test.ts +3 -2
- package/tests/api-resources/inbound-ach-transfer-returns.test.ts +13 -9
- package/tests/api-resources/inbound-wire-drawdown-requests.test.ts +3 -6
- package/tests/api-resources/limits.test.ts +11 -14
- package/tests/api-resources/oauth-connections.test.ts +3 -6
- package/tests/api-resources/pending-transactions.test.ts +10 -14
- package/tests/api-resources/programs.test.ts +36 -0
- package/tests/api-resources/real-time-decisions.test.ts +3 -13
- package/tests/api-resources/real-time-payments-transfers.test.ts +76 -0
- package/tests/api-resources/routing-numbers.test.ts +3 -2
- package/tests/api-resources/simulations/account-statements.test.ts +8 -5
- package/tests/api-resources/simulations/account-transfers.test.ts +2 -1
- package/tests/api-resources/simulations/ach-transfers.test.ts +10 -16
- package/tests/api-resources/simulations/card-disputes.test.ts +5 -4
- package/tests/api-resources/simulations/card-refunds.test.ts +8 -5
- package/tests/api-resources/simulations/cards.test.ts +9 -7
- package/tests/api-resources/simulations/check-deposits.test.ts +2 -1
- package/tests/api-resources/simulations/check-transfers.test.ts +14 -1
- package/tests/api-resources/simulations/digital-wallet-token-requests.test.ts +8 -5
- package/tests/api-resources/simulations/documents.test.ts +7 -4
- package/tests/api-resources/simulations/inbound-wire-drawdown-requests.test.ts +26 -25
- package/tests/api-resources/simulations/interest-payments.test.ts +15 -0
- package/tests/api-resources/simulations/programs.test.ts +15 -0
- package/tests/api-resources/simulations/real-time-payments-transfers.test.ts +17 -9
- package/tests/api-resources/simulations/wire-transfers.test.ts +8 -7
- package/tests/api-resources/transactions.test.ts +8 -25
- package/tests/api-resources/wire-drawdown-requests.test.ts +17 -20
- package/tests/api-resources/wire-transfers.test.ts +19 -33
- package/tests/index.test.ts +30 -1
- package/tsconfig.json +2 -0
- package/version.ts +1 -1
package/error.ts
ADDED
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless.
|
|
2
|
+
|
|
3
|
+
import { castToError, Headers } from '~/core';
|
|
4
|
+
|
|
5
|
+
export class APIError extends Error {
|
|
6
|
+
readonly status: number | undefined;
|
|
7
|
+
readonly headers: Headers | undefined;
|
|
8
|
+
readonly error: Object | undefined;
|
|
9
|
+
|
|
10
|
+
constructor(
|
|
11
|
+
status: number | undefined,
|
|
12
|
+
error: Object | undefined,
|
|
13
|
+
message: string | undefined,
|
|
14
|
+
headers: Headers | undefined,
|
|
15
|
+
) {
|
|
16
|
+
super(message || (error as any)?.message || 'Unknown error occurred.');
|
|
17
|
+
this.status = status;
|
|
18
|
+
this.headers = headers;
|
|
19
|
+
this.error = error;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static generate(
|
|
23
|
+
status: number | undefined,
|
|
24
|
+
errorResponse: Object | undefined,
|
|
25
|
+
message: string | undefined,
|
|
26
|
+
headers: Headers | undefined,
|
|
27
|
+
) {
|
|
28
|
+
if (!status) {
|
|
29
|
+
return new APIConnectionError({ cause: castToError(errorResponse) });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const error = errorResponse as Record<string, any>;
|
|
33
|
+
|
|
34
|
+
const type = error?.['type'];
|
|
35
|
+
|
|
36
|
+
if (type === 'invalid_parameters_error') {
|
|
37
|
+
return new InvalidParametersError(status, error, message, headers);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (type === 'malformed_request_error') {
|
|
41
|
+
return new MalformedRequestError(status, error, message, headers);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (type === 'invalid_api_key_error') {
|
|
45
|
+
return new InvalidAPIKeyError(status, error, message, headers);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (type === 'environment_mismatch_error') {
|
|
49
|
+
return new EnvironmentMismatchError(status, error, message, headers);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (type === 'insufficient_permissions_error') {
|
|
53
|
+
return new InsufficientPermissionsError(status, error, message, headers);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (type === 'private_feature_error') {
|
|
57
|
+
return new PrivateFeatureError(status, error, message, headers);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (type === 'api_method_not_found_error') {
|
|
61
|
+
return new APIMethodNotFoundError(status, error, message, headers);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (type === 'object_not_found_error') {
|
|
65
|
+
return new ObjectNotFoundError(status, error, message, headers);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (type === 'idempotency_conflict_error') {
|
|
69
|
+
return new IdempotencyConflictError(status, error, message, headers);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (type === 'invalid_operation_error') {
|
|
73
|
+
return new InvalidOperationError(status, error, message, headers);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (type === 'idempotency_unprocessable_error') {
|
|
77
|
+
return new IdempotencyUnprocessableError(status, error, message, headers);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (type === 'rate_limited_error') {
|
|
81
|
+
return new RateLimitedError(status, error, message, headers);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (type === 'internal_server_error') {
|
|
85
|
+
return new InternalServerError(status, error, message, headers);
|
|
86
|
+
}
|
|
87
|
+
if (status === 500) {
|
|
88
|
+
return new InternalServerError(
|
|
89
|
+
status,
|
|
90
|
+
{ type: 'internal_server_error', title: '', detail: null, status: 500 },
|
|
91
|
+
message,
|
|
92
|
+
headers,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (status === 400) {
|
|
97
|
+
return new BadRequestError(status, error, message, headers);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (status === 401) {
|
|
101
|
+
return new AuthenticationError(status, error, message, headers);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (status === 403) {
|
|
105
|
+
return new PermissionDeniedError(status, error, message, headers);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (status === 404) {
|
|
109
|
+
return new NotFoundError(status, error, message, headers);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (status === 409) {
|
|
113
|
+
return new ConflictError(status, error, message, headers);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (status === 422) {
|
|
117
|
+
return new UnprocessableEntityError(status, error, message, headers);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (status === 429) {
|
|
121
|
+
return new RateLimitError(status, error, message, headers);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return new APIError(status, error, message, headers);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export class APIConnectionError extends APIError {
|
|
129
|
+
override readonly status: undefined = undefined;
|
|
130
|
+
|
|
131
|
+
constructor({ message, cause }: { message?: string; cause?: Error | undefined }) {
|
|
132
|
+
super(undefined, undefined, message || 'Connection error.', undefined);
|
|
133
|
+
// in some environments the 'cause' property is already declared
|
|
134
|
+
// @ts-ignore
|
|
135
|
+
if (cause) this.cause = cause;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export class APIConnectionTimeoutError extends APIConnectionError {
|
|
140
|
+
constructor() {
|
|
141
|
+
super({ message: 'Request timed out.' });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export class BadRequestError extends APIError {
|
|
146
|
+
override readonly status: 400 = 400;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export class AuthenticationError extends APIError {
|
|
150
|
+
override readonly status: 401 = 401;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export class PermissionDeniedError extends APIError {
|
|
154
|
+
override readonly status: 403 = 403;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export class NotFoundError extends APIError {
|
|
158
|
+
override readonly status: 404 = 404;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export class ConflictError extends APIError {
|
|
162
|
+
override readonly status: 409 = 409;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export class UnprocessableEntityError extends APIError {
|
|
166
|
+
override readonly status: 422 = 422;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export class RateLimitError extends APIError {
|
|
170
|
+
override readonly status: 429 = 429;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export class InvalidParametersError extends BadRequestError {
|
|
174
|
+
detail: string | null;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* All errors related to parsing the request parameters.
|
|
178
|
+
*/
|
|
179
|
+
errors: Array<unknown>;
|
|
180
|
+
|
|
181
|
+
override status: 400;
|
|
182
|
+
|
|
183
|
+
title: string;
|
|
184
|
+
|
|
185
|
+
type: 'invalid_parameters_error';
|
|
186
|
+
|
|
187
|
+
constructor(
|
|
188
|
+
status: number | undefined,
|
|
189
|
+
error: Object | undefined,
|
|
190
|
+
message: string | undefined,
|
|
191
|
+
headers: Headers | undefined,
|
|
192
|
+
) {
|
|
193
|
+
const data = error as Record<string, any>;
|
|
194
|
+
super(status, error, data?.['title'] || message, headers);
|
|
195
|
+
|
|
196
|
+
this.type = data?.['type'];
|
|
197
|
+
this.title = data?.['title'];
|
|
198
|
+
this.detail = data?.['detail'];
|
|
199
|
+
this.status = data?.['status'];
|
|
200
|
+
this.errors = data?.['errors'];
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export class MalformedRequestError extends BadRequestError {
|
|
205
|
+
detail: string | null;
|
|
206
|
+
|
|
207
|
+
override status: 400;
|
|
208
|
+
|
|
209
|
+
title: string;
|
|
210
|
+
|
|
211
|
+
type: 'malformed_request_error';
|
|
212
|
+
|
|
213
|
+
constructor(
|
|
214
|
+
status: number | undefined,
|
|
215
|
+
error: Object | undefined,
|
|
216
|
+
message: string | undefined,
|
|
217
|
+
headers: Headers | undefined,
|
|
218
|
+
) {
|
|
219
|
+
const data = error as Record<string, any>;
|
|
220
|
+
super(status, error, data?.['title'] || message, headers);
|
|
221
|
+
|
|
222
|
+
this.type = data?.['type'];
|
|
223
|
+
this.title = data?.['title'];
|
|
224
|
+
this.detail = data?.['detail'];
|
|
225
|
+
this.status = data?.['status'];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export class InvalidAPIKeyError extends AuthenticationError {
|
|
230
|
+
detail: string | null;
|
|
231
|
+
|
|
232
|
+
override status: 401;
|
|
233
|
+
|
|
234
|
+
title: string;
|
|
235
|
+
|
|
236
|
+
type: 'invalid_api_key_error';
|
|
237
|
+
|
|
238
|
+
constructor(
|
|
239
|
+
status: number | undefined,
|
|
240
|
+
error: Object | undefined,
|
|
241
|
+
message: string | undefined,
|
|
242
|
+
headers: Headers | undefined,
|
|
243
|
+
) {
|
|
244
|
+
const data = error as Record<string, any>;
|
|
245
|
+
super(status, error, data?.['title'] || message, headers);
|
|
246
|
+
|
|
247
|
+
this.type = data?.['type'];
|
|
248
|
+
this.title = data?.['title'];
|
|
249
|
+
this.detail = data?.['detail'];
|
|
250
|
+
this.status = data?.['status'];
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export class EnvironmentMismatchError extends PermissionDeniedError {
|
|
255
|
+
detail: string | null;
|
|
256
|
+
|
|
257
|
+
override status: 403;
|
|
258
|
+
|
|
259
|
+
title: string;
|
|
260
|
+
|
|
261
|
+
type: 'environment_mismatch_error';
|
|
262
|
+
|
|
263
|
+
constructor(
|
|
264
|
+
status: number | undefined,
|
|
265
|
+
error: Object | undefined,
|
|
266
|
+
message: string | undefined,
|
|
267
|
+
headers: Headers | undefined,
|
|
268
|
+
) {
|
|
269
|
+
const data = error as Record<string, any>;
|
|
270
|
+
super(status, error, data?.['title'] || message, headers);
|
|
271
|
+
|
|
272
|
+
this.type = data?.['type'];
|
|
273
|
+
this.title = data?.['title'];
|
|
274
|
+
this.detail = data?.['detail'];
|
|
275
|
+
this.status = data?.['status'];
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export class InsufficientPermissionsError extends PermissionDeniedError {
|
|
280
|
+
detail: string | null;
|
|
281
|
+
|
|
282
|
+
override status: 403;
|
|
283
|
+
|
|
284
|
+
title: string;
|
|
285
|
+
|
|
286
|
+
type: 'insufficient_permissions_error';
|
|
287
|
+
|
|
288
|
+
constructor(
|
|
289
|
+
status: number | undefined,
|
|
290
|
+
error: Object | undefined,
|
|
291
|
+
message: string | undefined,
|
|
292
|
+
headers: Headers | undefined,
|
|
293
|
+
) {
|
|
294
|
+
const data = error as Record<string, any>;
|
|
295
|
+
super(status, error, data?.['title'] || message, headers);
|
|
296
|
+
|
|
297
|
+
this.type = data?.['type'];
|
|
298
|
+
this.title = data?.['title'];
|
|
299
|
+
this.detail = data?.['detail'];
|
|
300
|
+
this.status = data?.['status'];
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export class PrivateFeatureError extends PermissionDeniedError {
|
|
305
|
+
detail: string | null;
|
|
306
|
+
|
|
307
|
+
override status: 403;
|
|
308
|
+
|
|
309
|
+
title: string;
|
|
310
|
+
|
|
311
|
+
type: 'private_feature_error';
|
|
312
|
+
|
|
313
|
+
constructor(
|
|
314
|
+
status: number | undefined,
|
|
315
|
+
error: Object | undefined,
|
|
316
|
+
message: string | undefined,
|
|
317
|
+
headers: Headers | undefined,
|
|
318
|
+
) {
|
|
319
|
+
const data = error as Record<string, any>;
|
|
320
|
+
super(status, error, data?.['title'] || message, headers);
|
|
321
|
+
|
|
322
|
+
this.type = data?.['type'];
|
|
323
|
+
this.title = data?.['title'];
|
|
324
|
+
this.detail = data?.['detail'];
|
|
325
|
+
this.status = data?.['status'];
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export class APIMethodNotFoundError extends NotFoundError {
|
|
330
|
+
detail: string | null;
|
|
331
|
+
|
|
332
|
+
override status: 404;
|
|
333
|
+
|
|
334
|
+
title: string;
|
|
335
|
+
|
|
336
|
+
type: 'api_method_not_found_error';
|
|
337
|
+
|
|
338
|
+
constructor(
|
|
339
|
+
status: number | undefined,
|
|
340
|
+
error: Object | undefined,
|
|
341
|
+
message: string | undefined,
|
|
342
|
+
headers: Headers | undefined,
|
|
343
|
+
) {
|
|
344
|
+
const data = error as Record<string, any>;
|
|
345
|
+
super(status, error, data?.['title'] || message, headers);
|
|
346
|
+
|
|
347
|
+
this.type = data?.['type'];
|
|
348
|
+
this.title = data?.['title'];
|
|
349
|
+
this.detail = data?.['detail'];
|
|
350
|
+
this.status = data?.['status'];
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export class ObjectNotFoundError extends NotFoundError {
|
|
355
|
+
detail: string | null;
|
|
356
|
+
|
|
357
|
+
override status: 404;
|
|
358
|
+
|
|
359
|
+
title: string;
|
|
360
|
+
|
|
361
|
+
type: 'object_not_found_error';
|
|
362
|
+
|
|
363
|
+
constructor(
|
|
364
|
+
status: number | undefined,
|
|
365
|
+
error: Object | undefined,
|
|
366
|
+
message: string | undefined,
|
|
367
|
+
headers: Headers | undefined,
|
|
368
|
+
) {
|
|
369
|
+
const data = error as Record<string, any>;
|
|
370
|
+
super(status, error, data?.['title'] || message, headers);
|
|
371
|
+
|
|
372
|
+
this.type = data?.['type'];
|
|
373
|
+
this.title = data?.['title'];
|
|
374
|
+
this.detail = data?.['detail'];
|
|
375
|
+
this.status = data?.['status'];
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export class IdempotencyConflictError extends ConflictError {
|
|
380
|
+
detail: string | null;
|
|
381
|
+
|
|
382
|
+
override status: 409;
|
|
383
|
+
|
|
384
|
+
title: string;
|
|
385
|
+
|
|
386
|
+
type: 'idempotency_conflict_error';
|
|
387
|
+
|
|
388
|
+
constructor(
|
|
389
|
+
status: number | undefined,
|
|
390
|
+
error: Object | undefined,
|
|
391
|
+
message: string | undefined,
|
|
392
|
+
headers: Headers | undefined,
|
|
393
|
+
) {
|
|
394
|
+
const data = error as Record<string, any>;
|
|
395
|
+
super(status, error, data?.['title'] || message, headers);
|
|
396
|
+
|
|
397
|
+
this.type = data?.['type'];
|
|
398
|
+
this.title = data?.['title'];
|
|
399
|
+
this.detail = data?.['detail'];
|
|
400
|
+
this.status = data?.['status'];
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export class InvalidOperationError extends ConflictError {
|
|
405
|
+
detail: string | null;
|
|
406
|
+
|
|
407
|
+
override status: 409;
|
|
408
|
+
|
|
409
|
+
title: string;
|
|
410
|
+
|
|
411
|
+
type: 'invalid_operation_error';
|
|
412
|
+
|
|
413
|
+
constructor(
|
|
414
|
+
status: number | undefined,
|
|
415
|
+
error: Object | undefined,
|
|
416
|
+
message: string | undefined,
|
|
417
|
+
headers: Headers | undefined,
|
|
418
|
+
) {
|
|
419
|
+
const data = error as Record<string, any>;
|
|
420
|
+
super(status, error, data?.['title'] || message, headers);
|
|
421
|
+
|
|
422
|
+
this.type = data?.['type'];
|
|
423
|
+
this.title = data?.['title'];
|
|
424
|
+
this.detail = data?.['detail'];
|
|
425
|
+
this.status = data?.['status'];
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
export class IdempotencyUnprocessableError extends UnprocessableEntityError {
|
|
430
|
+
detail: string | null;
|
|
431
|
+
|
|
432
|
+
override status: 422;
|
|
433
|
+
|
|
434
|
+
title: string;
|
|
435
|
+
|
|
436
|
+
type: 'idempotency_unprocessable_error';
|
|
437
|
+
|
|
438
|
+
constructor(
|
|
439
|
+
status: number | undefined,
|
|
440
|
+
error: Object | undefined,
|
|
441
|
+
message: string | undefined,
|
|
442
|
+
headers: Headers | undefined,
|
|
443
|
+
) {
|
|
444
|
+
const data = error as Record<string, any>;
|
|
445
|
+
super(status, error, data?.['title'] || message, headers);
|
|
446
|
+
|
|
447
|
+
this.type = data?.['type'];
|
|
448
|
+
this.title = data?.['title'];
|
|
449
|
+
this.detail = data?.['detail'];
|
|
450
|
+
this.status = data?.['status'];
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export class RateLimitedError extends RateLimitError {
|
|
455
|
+
detail: string | null;
|
|
456
|
+
|
|
457
|
+
override status: 429;
|
|
458
|
+
|
|
459
|
+
title: string;
|
|
460
|
+
|
|
461
|
+
type: 'rate_limited_error';
|
|
462
|
+
|
|
463
|
+
retry_after?: number | null;
|
|
464
|
+
|
|
465
|
+
constructor(
|
|
466
|
+
status: number | undefined,
|
|
467
|
+
error: Object | undefined,
|
|
468
|
+
message: string | undefined,
|
|
469
|
+
headers: Headers | undefined,
|
|
470
|
+
) {
|
|
471
|
+
const data = error as Record<string, any>;
|
|
472
|
+
super(status, error, data?.['title'] || message, headers);
|
|
473
|
+
|
|
474
|
+
this.type = data?.['type'];
|
|
475
|
+
this.title = data?.['title'];
|
|
476
|
+
this.detail = data?.['detail'];
|
|
477
|
+
this.status = data?.['status'];
|
|
478
|
+
this.retry_after = data?.['retry_after'];
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export class InternalServerError extends APIError {
|
|
483
|
+
detail: string | null;
|
|
484
|
+
|
|
485
|
+
override status: 500;
|
|
486
|
+
|
|
487
|
+
title: string;
|
|
488
|
+
|
|
489
|
+
type: 'internal_server_error';
|
|
490
|
+
|
|
491
|
+
constructor(
|
|
492
|
+
status: number | undefined,
|
|
493
|
+
error: Object | undefined,
|
|
494
|
+
message: string | undefined,
|
|
495
|
+
headers: Headers | undefined,
|
|
496
|
+
) {
|
|
497
|
+
const data = error as Record<string, any>;
|
|
498
|
+
super(status, error, data?.['title'] || message, headers);
|
|
499
|
+
|
|
500
|
+
this.type = data?.['type'];
|
|
501
|
+
this.title = data?.['title'];
|
|
502
|
+
this.detail = data?.['detail'];
|
|
503
|
+
this.status = data?.['status'];
|
|
504
|
+
}
|
|
505
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env yarn tsn -T
|
|
2
|
+
|
|
3
|
+
import Increase, { InvalidAPIKeyError } from 'increase';
|
|
4
|
+
|
|
5
|
+
const client = new Increase({ apiKey: 'invalid API key' });
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
try {
|
|
9
|
+
await client.accounts.retrieve('<account id>');
|
|
10
|
+
} catch (err) {
|
|
11
|
+
if (err instanceof InvalidAPIKeyError) {
|
|
12
|
+
console.log(`Caught InvalidAPIKeyError`);
|
|
13
|
+
} else {
|
|
14
|
+
console.log(`Caught unknown error`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
console.log(err);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
main().catch(console.error);
|
package/fetch-polyfill.ts
CHANGED
|
@@ -25,8 +25,8 @@ if (isProbablyNode) {
|
|
|
25
25
|
const KeepAliveHttpAgent: typeof KeepAliveAgent = require('agentkeepalive');
|
|
26
26
|
/* eslint-enable @typescript-eslint/no-var-requires */
|
|
27
27
|
|
|
28
|
-
defaultHttpAgent = new KeepAliveHttpAgent({ keepAlive: true });
|
|
29
|
-
defaultHttpsAgent = new KeepAliveHttpAgent.HttpsAgent({ keepAlive: true });
|
|
28
|
+
defaultHttpAgent = new KeepAliveHttpAgent({ keepAlive: true, timeout: 5 * 60 * 1000 });
|
|
29
|
+
defaultHttpsAgent = new KeepAliveHttpAgent.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1000 });
|
|
30
30
|
} catch (e) {
|
|
31
31
|
// We can fall back to a built-in "fetch".
|
|
32
32
|
nodeFetchImportError = e;
|