@naturalpay/sdk 0.2.0 → 0.2.1
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 +119 -0
- package/LICENSE +7 -0
- package/README.md +340 -26
- package/api-promise.d.mts +2 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +2 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +255 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +255 -0
- package/client.d.ts.map +1 -0
- package/client.js +548 -0
- package/client.js.map +1 -0
- package/client.mjs +544 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +46 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +46 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +74 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +70 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +46 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +46 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +113 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +97 -0
- package/core/error.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +2 -0
- package/error.d.ts.map +1 -0
- package/error.js +6 -0
- package/error.js.map +1 -0
- package/error.mjs +2 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +6 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -0
- package/index.js +30 -0
- package/index.js.map +1 -0
- package/index.mjs +7 -0
- package/index.mjs.map +1 -0
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +20 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +20 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +79 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +74 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +12 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +12 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +40 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +37 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/internal/request-options.d.mts +75 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +75 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.mjs.map +1 -0
- package/internal/shims.d.mts +20 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +20 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +92 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/to-file.d.mts +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +91 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +88 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +141 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +131 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +87 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +81 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/query.d.mts +2 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +2 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +10 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +6 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +18 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +18 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +112 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +94 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +8 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +8 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +12 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +9 -0
- package/internal/utils.mjs.map +1 -0
- package/lib/envelope.d.mts +4 -0
- package/lib/envelope.d.mts.map +1 -0
- package/lib/envelope.d.ts +4 -0
- package/lib/envelope.d.ts.map +1 -0
- package/lib/envelope.js +43 -0
- package/lib/envelope.js.map +1 -0
- package/lib/envelope.mjs +39 -0
- package/lib/envelope.mjs.map +1 -0
- package/package.json +142 -76
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +2 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +6 -0
- package/resource.js.map +1 -0
- package/resource.mjs +2 -0
- package/resource.mjs.map +1 -0
- package/resources/agents.d.mts +1392 -0
- package/resources/agents.d.mts.map +1 -0
- package/resources/agents.d.ts +1392 -0
- package/resources/agents.d.ts.map +1 -0
- package/resources/agents.js +192 -0
- package/resources/agents.js.map +1 -0
- package/resources/agents.mjs +188 -0
- package/resources/agents.mjs.map +1 -0
- package/resources/api-keys.d.mts +539 -0
- package/resources/api-keys.d.mts.map +1 -0
- package/resources/api-keys.d.ts +539 -0
- package/resources/api-keys.d.ts.map +1 -0
- package/resources/api-keys.js +100 -0
- package/resources/api-keys.js.map +1 -0
- package/resources/api-keys.mjs +96 -0
- package/resources/api-keys.mjs.map +1 -0
- package/resources/counterparties.d.mts +139 -0
- package/resources/counterparties.d.mts.map +1 -0
- package/resources/counterparties.d.ts +139 -0
- package/resources/counterparties.d.ts.map +1 -0
- package/resources/counterparties.js +32 -0
- package/resources/counterparties.js.map +1 -0
- package/resources/counterparties.mjs +28 -0
- package/resources/counterparties.mjs.map +1 -0
- package/resources/customers.d.mts +272 -0
- package/resources/customers.d.mts.map +1 -0
- package/resources/customers.d.ts +272 -0
- package/resources/customers.d.ts.map +1 -0
- package/resources/customers.js +48 -0
- package/resources/customers.js.map +1 -0
- package/resources/customers.mjs +44 -0
- package/resources/customers.mjs.map +1 -0
- package/resources/delegations.d.mts +458 -0
- package/resources/delegations.d.mts.map +1 -0
- package/resources/delegations.d.ts +458 -0
- package/resources/delegations.d.ts.map +1 -0
- package/resources/delegations.js +47 -0
- package/resources/delegations.js.map +1 -0
- package/resources/delegations.mjs +43 -0
- package/resources/delegations.mjs.map +1 -0
- package/resources/index.d.mts +12 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +12 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +27 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +13 -0
- package/resources/index.mjs.map +1 -0
- package/resources/invitations.d.mts +304 -0
- package/resources/invitations.d.mts.map +1 -0
- package/resources/invitations.d.ts +304 -0
- package/resources/invitations.d.ts.map +1 -0
- package/resources/invitations.js +85 -0
- package/resources/invitations.js.map +1 -0
- package/resources/invitations.mjs +81 -0
- package/resources/invitations.mjs.map +1 -0
- package/resources/parties.d.mts +364 -0
- package/resources/parties.d.mts.map +1 -0
- package/resources/parties.d.ts +364 -0
- package/resources/parties.d.ts.map +1 -0
- package/resources/parties.js +78 -0
- package/resources/parties.js.map +1 -0
- package/resources/parties.mjs +74 -0
- package/resources/parties.mjs.map +1 -0
- package/resources/payment-requests.d.mts +442 -0
- package/resources/payment-requests.d.mts.map +1 -0
- package/resources/payment-requests.d.ts +442 -0
- package/resources/payment-requests.d.ts.map +1 -0
- package/resources/payment-requests.js +87 -0
- package/resources/payment-requests.js.map +1 -0
- package/resources/payment-requests.mjs +83 -0
- package/resources/payment-requests.mjs.map +1 -0
- package/resources/payments.d.mts +174 -0
- package/resources/payments.d.mts.map +1 -0
- package/resources/payments.d.ts +174 -0
- package/resources/payments.d.ts.map +1 -0
- package/resources/payments.js +40 -0
- package/resources/payments.js.map +1 -0
- package/resources/payments.mjs +36 -0
- package/resources/payments.mjs.map +1 -0
- package/resources/transactions.d.mts +478 -0
- package/resources/transactions.d.mts.map +1 -0
- package/resources/transactions.d.ts +478 -0
- package/resources/transactions.d.ts.map +1 -0
- package/resources/transactions.js +48 -0
- package/resources/transactions.js.map +1 -0
- package/resources/transactions.mjs +44 -0
- package/resources/transactions.mjs.map +1 -0
- package/resources/wallet.d.mts +628 -0
- package/resources/wallet.d.mts.map +1 -0
- package/resources/wallet.d.ts +628 -0
- package/resources/wallet.d.ts.map +1 -0
- package/resources/wallet.js +161 -0
- package/resources/wallet.js.map +1 -0
- package/resources/wallet.mjs +157 -0
- package/resources/wallet.mjs.map +1 -0
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +5 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/api-promise.ts +2 -0
- package/src/client.ts +1020 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +92 -0
- package/src/core/error.ts +130 -0
- package/src/core/resource.ts +11 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -0
- package/src/index.ts +22 -0
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +97 -0
- package/src/internal/parse.ts +56 -0
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/internal/request-options.ts +91 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +154 -0
- package/src/internal/types.ts +93 -0
- package/src/internal/uploads.ts +187 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +128 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/query.ts +7 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +105 -0
- package/src/internal/utils.ts +9 -0
- package/src/lib/.keep +4 -0
- package/src/lib/envelope.ts +32 -0
- package/src/resource.ts +2 -0
- package/src/resources/agents.ts +1785 -0
- package/src/resources/api-keys.ts +743 -0
- package/src/resources/counterparties.ts +187 -0
- package/src/resources/customers.ts +365 -0
- package/src/resources/delegations.ts +580 -0
- package/src/resources/index.ts +95 -0
- package/src/resources/invitations.ts +414 -0
- package/src/resources/parties.ts +493 -0
- package/src/resources/payment-requests.ts +601 -0
- package/src/resources/payments.ts +228 -0
- package/src/resources/transactions.ts +610 -0
- package/src/resources/wallet.ts +864 -0
- package/src/resources.ts +1 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +2 -0
- package/src/version.ts +1 -0
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +2 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +6 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +2 -0
- package/uploads.mjs.map +1 -0
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
- package/dist/index.cjs +0 -1737
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -929
- package/dist/index.d.ts +0 -929
- package/dist/index.js +0 -1705
- package/dist/index.js.map +0 -1
- package/dist/mcp/cli.cjs +0 -166
- package/dist/mcp/cli.cjs.map +0 -1
- package/dist/mcp/cli.d.cts +0 -1
- package/dist/mcp/cli.d.ts +0 -1
- package/dist/mcp/cli.js +0 -164
- package/dist/mcp/cli.js.map +0 -1
- package/dist/mcp/index.cjs +0 -8
- package/dist/mcp/index.cjs.map +0 -1
- package/dist/mcp/index.d.cts +0 -9
- package/dist/mcp/index.d.ts +0 -9
- package/dist/mcp/index.js +0 -6
- package/dist/mcp/index.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.1 (2026-05-16)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.0.1...v0.2.1](https://github.com/naturalpay/naturalpay-ts/compare/v0.0.1...v0.2.1)
|
|
6
|
+
|
|
7
|
+
### ⚠ BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
* **sdk:** align implemented endpoints with public OpenAPI ([#45](https://github.com/naturalpay/naturalpay-ts/issues/45))
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add context param and fill instanceId gaps across all methods ([#11](https://github.com/naturalpay/naturalpay-ts/issues/11)) ([8aee6b5](https://github.com/naturalpay/naturalpay-ts/commit/8aee6b5c8565719d245c1d02ac7e6c77de1ac797))
|
|
14
|
+
* add instanceId for agent observability ([#10](https://github.com/naturalpay/naturalpay-ts/issues/10)) ([63c9a32](https://github.com/naturalpay/naturalpay-ts/commit/63c9a328f4ce7062a4c20e9d164812938a230ddc))
|
|
15
|
+
* add ModelContext and ModelUsage for observability ([#25](https://github.com/naturalpay/naturalpay-ts/issues/25)) ([fc50eb0](https://github.com/naturalpay/naturalpay-ts/commit/fc50eb0eedc1c1afe9d49a51f8f1af49fc136dab))
|
|
16
|
+
* add structured logging with Datadog support ([c34e43f](https://github.com/naturalpay/naturalpay-ts/commit/c34e43fbb7b43ea61d424497718e7326f1a40575))
|
|
17
|
+
* add traceId parameter for distributed tracing ([#32](https://github.com/naturalpay/naturalpay-ts/issues/32)) ([2165263](https://github.com/naturalpay/naturalpay-ts/commit/21652635622d40b02bfc8c81857459c32f9c2cb3))
|
|
18
|
+
* add type filter to transactions, remove wallet.transfers() ([c9c7559](https://github.com/naturalpay/naturalpay-ts/commit/c9c75599a1bdc7d5811aa063778e6a2ae9b277a2))
|
|
19
|
+
* align SDK endpoints with public API ([#12](https://github.com/naturalpay/naturalpay-ts/issues/12)) ([c942396](https://github.com/naturalpay/naturalpay-ts/commit/c942396d1f7daf794ce8eb51205cd0c942218284))
|
|
20
|
+
* **api:** api update ([c0b355c](https://github.com/naturalpay/naturalpay-ts/commit/c0b355cda288b6adaede8165f65c407c07fdee11))
|
|
21
|
+
* **api:** api update ([40cf543](https://github.com/naturalpay/naturalpay-ts/commit/40cf543332c3cc7297f1815aa68ca13c56635c02))
|
|
22
|
+
* **api:** api update ([e609cb8](https://github.com/naturalpay/naturalpay-ts/commit/e609cb831ad29e0abcc594a1e69d51afb010a25e))
|
|
23
|
+
* **api:** api update ([07ca3a8](https://github.com/naturalpay/naturalpay-ts/commit/07ca3a891b7974c86a2369b02774c99af04be26d))
|
|
24
|
+
* **api:** api update ([4103315](https://github.com/naturalpay/naturalpay-ts/commit/41033156995bd42332842f5077e6a53a7e289eb5))
|
|
25
|
+
* **api:** api update ([9e01255](https://github.com/naturalpay/naturalpay-ts/commit/9e012559a0e89a7c9817536b8ba7889d567507bb))
|
|
26
|
+
* **api:** api update ([5276f7c](https://github.com/naturalpay/naturalpay-ts/commit/5276f7c56bd6ea6d21fbb8b91c6d2115d788d776))
|
|
27
|
+
* **api:** api update ([75d0d85](https://github.com/naturalpay/naturalpay-ts/commit/75d0d851c517fece28e0e61aa1370fd2d86ae0db))
|
|
28
|
+
* **api:** api update ([e88ad5d](https://github.com/naturalpay/naturalpay-ts/commit/e88ad5d6e4be8ea95c6fcac3b510693d03912872))
|
|
29
|
+
* **api:** api update ([f5565eb](https://github.com/naturalpay/naturalpay-ts/commit/f5565eb1488ee8048c25b989c3cc02afeb09bd79))
|
|
30
|
+
* **api:** api update ([54140dd](https://github.com/naturalpay/naturalpay-ts/commit/54140dde4a811c84a1ecf5819770259472d06400))
|
|
31
|
+
* **api:** api update ([ff8b849](https://github.com/naturalpay/naturalpay-ts/commit/ff8b8493c918551a4d754763aff74de964a10c90))
|
|
32
|
+
* **api:** api update ([ee5f3c1](https://github.com/naturalpay/naturalpay-ts/commit/ee5f3c1f3619d7f544be8f8afe04ffb6d82417f2))
|
|
33
|
+
* **api:** api update ([148ff21](https://github.com/naturalpay/naturalpay-ts/commit/148ff21f969415e8a0c4f51ae7b5e670e2b7df55))
|
|
34
|
+
* **api:** api update ([06f3637](https://github.com/naturalpay/naturalpay-ts/commit/06f36375dc16aa98dea0f15ac0c1796a1305ed2e))
|
|
35
|
+
* **api:** api update ([7610ef6](https://github.com/naturalpay/naturalpay-ts/commit/7610ef6677957dd3d05239d773962f113ca08a8a))
|
|
36
|
+
* **api:** api update ([d8f7b3f](https://github.com/naturalpay/naturalpay-ts/commit/d8f7b3f183058347b28f03dba72144e58ebd0ba1))
|
|
37
|
+
* **api:** api update ([45b409f](https://github.com/naturalpay/naturalpay-ts/commit/45b409f149c6b1a14ed0a1eab7373092f5e8607c))
|
|
38
|
+
* **api:** api update ([195e031](https://github.com/naturalpay/naturalpay-ts/commit/195e0310f4b73a372adb6d1184f17d9e9844c510))
|
|
39
|
+
* **api:** api update ([56ee513](https://github.com/naturalpay/naturalpay-ts/commit/56ee513159a8c6a26694d02445e90f95e5908e40))
|
|
40
|
+
* **api:** api update ([0d1ca15](https://github.com/naturalpay/naturalpay-ts/commit/0d1ca1505b28f925e6c8170467cfef8cdd7fb8d4))
|
|
41
|
+
* **api:** api update ([4581b56](https://github.com/naturalpay/naturalpay-ts/commit/4581b56f2b3e8139bde75fa2a3f56b5f66dad894))
|
|
42
|
+
* **api:** api update ([65babd2](https://github.com/naturalpay/naturalpay-ts/commit/65babd2717e40697f12770422bc503070fade7e2))
|
|
43
|
+
* **api:** Require Instance ID when Agent ID Present ([#27](https://github.com/naturalpay/naturalpay-ts/issues/27)) ([0e9524d](https://github.com/naturalpay/naturalpay-ts/commit/0e9524d69491f75132d30f23ec24e410b7dcdc3b))
|
|
44
|
+
* improve create_payment MCP tool ([#4](https://github.com/naturalpay/naturalpay-ts/issues/4)) ([7cb463f](https://github.com/naturalpay/naturalpay-ts/commit/7cb463f3d6d6995c47a66d28182a8bc9029b7995))
|
|
45
|
+
* make customerPartyId optional in payments SDK ([#34](https://github.com/naturalpay/naturalpay-ts/issues/34)) ([070d81d](https://github.com/naturalpay/naturalpay-ts/commit/070d81d2e0701759a701ef6e494046965a08b065))
|
|
46
|
+
* **mcp:** Move to Proxy ([#26](https://github.com/naturalpay/naturalpay-ts/issues/26)) ([2584e15](https://github.com/naturalpay/naturalpay-ts/commit/2584e151771a2fa8b3d274e1779be6894579d644))
|
|
47
|
+
* payments.create() returns Transaction, remove Payment interface ([#16](https://github.com/naturalpay/naturalpay-ts/issues/16)) ([1007b10](https://github.com/naturalpay/naturalpay-ts/commit/1007b1035f30de4c4f7f1c6a0ce114f47a0d2dcf))
|
|
48
|
+
* per-agent invitation SDK (0.2.0) ([#43](https://github.com/naturalpay/naturalpay-ts/issues/43)) ([46625dc](https://github.com/naturalpay/naturalpay-ts/commit/46625dc03e0b1ee412abb696cfe5c172e4b1ccbc))
|
|
49
|
+
* rename counterparties to customers in TypeScript SDK ([#15](https://github.com/naturalpay/naturalpay-ts/issues/15)) ([4fcd683](https://github.com/naturalpay/naturalpay-ts/commit/4fcd68368820582b7133cae2e7705adb4dd4a56a))
|
|
50
|
+
* **sdk:** Achieve SDK Parity ([#30](https://github.com/naturalpay/naturalpay-ts/issues/30)) ([548beba](https://github.com/naturalpay/naturalpay-ts/commit/548beba167438b1eb4128b5e66c7b1090f972a56))
|
|
51
|
+
* **sdk:** Allow Txn Queryable by Party ([#29](https://github.com/naturalpay/naturalpay-ts/issues/29)) ([edfa0a9](https://github.com/naturalpay/naturalpay-ts/commit/edfa0a9d50737ac4093a5a70790dd55c9af9077a))
|
|
52
|
+
* **sdk:** enforce canonical Natural tool names via typed enum ([#36](https://github.com/naturalpay/naturalpay-ts/issues/36)) ([df2cff2](https://github.com/naturalpay/naturalpay-ts/commit/df2cff2299b243a0959c80822f5c8cab06032fed))
|
|
53
|
+
* **sdk:** Retry and Webhook Signatures ([#33](https://github.com/naturalpay/naturalpay-ts/issues/33)) ([1e3056b](https://github.com/naturalpay/naturalpay-ts/commit/1e3056b77dc78db54ee7dcc6fce03466bb309281))
|
|
54
|
+
* update SDK to match camelCase API shapes ([#24](https://github.com/naturalpay/naturalpay-ts/issues/24)) ([e5cfe83](https://github.com/naturalpay/naturalpay-ts/commit/e5cfe83d0a226f02434dacc39724080c9ec2f06f))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Bug Fixes
|
|
58
|
+
|
|
59
|
+
* address codex review feedback ([5fa9b61](https://github.com/naturalpay/naturalpay-ts/commit/5fa9b618d3fcb3e07bce06a0b657b426f7c46f5a))
|
|
60
|
+
* address review feedback ([12b335c](https://github.com/naturalpay/naturalpay-ts/commit/12b335c4b8cb805b4af4d215590d043c8d16fb02))
|
|
61
|
+
* address review feedback for e2e testing ([4049706](https://github.com/naturalpay/naturalpay-ts/commit/4049706bef7ea65600cac463a5a62175aa0ae269))
|
|
62
|
+
* **api:** Conform to new API Shape ([545b860](https://github.com/naturalpay/naturalpay-ts/commit/545b860995536e2d8637dff2f3e76a906048ae3d))
|
|
63
|
+
* **api:** Unify Remaining Resources ([#8](https://github.com/naturalpay/naturalpay-ts/issues/8)) ([8b558e2](https://github.com/naturalpay/naturalpay-ts/commit/8b558e2526bdf7efbdc80ef63ee7ce2fc792ddef))
|
|
64
|
+
* **CI:** Fix Release Workflow ([7ce6b24](https://github.com/naturalpay/naturalpay-ts/commit/7ce6b243e494e47543015dca1b683b8b0603e221))
|
|
65
|
+
* **CI:** Remove Provenance ([749f1fb](https://github.com/naturalpay/naturalpay-ts/commit/749f1fbcdfad4c45cea419d7952c9ee420eb7af6))
|
|
66
|
+
* **CI:** Update Node for Trusted Publisher ([8f327b7](https://github.com/naturalpay/naturalpay-ts/commit/8f327b7d532247fd779a480ad5cd7712e02f17db))
|
|
67
|
+
* format transactions types ([71623c9](https://github.com/naturalpay/naturalpay-ts/commit/71623c9dfda7906fa1a0b275a0f1a5d66541b5e6))
|
|
68
|
+
* only run release-drafter on push to main ([7a31510](https://github.com/naturalpay/naturalpay-ts/commit/7a31510a7df4e5d12d42368fd88cc82380a7f1c5))
|
|
69
|
+
* prettier formatting and update Dockerfile to Node 22 ([eee3d29](https://github.com/naturalpay/naturalpay-ts/commit/eee3d29ff93c34dc3529488bbdbdda0f5cc85b36))
|
|
70
|
+
* remove /v1 prefix from wallet API paths ([97aa86c](https://github.com/naturalpay/naturalpay-ts/commit/97aa86ccc1952206afa80cf6d677b09cb7824010))
|
|
71
|
+
* restore agentId to payments.create(), pass as X-Agent-ID header ([#9](https://github.com/naturalpay/naturalpay-ts/issues/9)) ([b71b9c0](https://github.com/naturalpay/naturalpay-ts/commit/b71b9c0c6982c6bc9a6af180d664de350c8373ce))
|
|
72
|
+
* **routes:** Unify SDK ([#18](https://github.com/naturalpay/naturalpay-ts/issues/18)) ([57245f2](https://github.com/naturalpay/naturalpay-ts/commit/57245f205d6c6005bad5110e8e0bf4724725cdad))
|
|
73
|
+
* **sdk:** align implemented endpoints with public OpenAPI ([#45](https://github.com/naturalpay/naturalpay-ts/issues/45)) ([6e99127](https://github.com/naturalpay/naturalpay-ts/commit/6e991270a4e0bb8428fef87bfca3d1c255ebb5da))
|
|
74
|
+
* update README - remove stale wallet methods, add type filter docs ([b064a7a](https://github.com/naturalpay/naturalpay-ts/commit/b064a7a944231b169dc4bba50f3098a908df50e3))
|
|
75
|
+
* use /auth/api/token for JWT exchange ([#23](https://github.com/naturalpay/naturalpay-ts/issues/23)) ([30a0b33](https://github.com/naturalpay/naturalpay-ts/commit/30a0b33157bc36fe49e09e81087dc9af738b4bc8))
|
|
76
|
+
* use correct customer party ID from seed_test_data.py ([878871d](https://github.com/naturalpay/naturalpay-ts/commit/878871dd9d3e14cc6d4fe856d2dc4bb25e079e38))
|
|
77
|
+
* use getContext() in formatters for AsyncLocalStorage support ([228664d](https://github.com/naturalpay/naturalpay-ts/commit/228664d1a2d5cfe7ae5f1c845fe348e1ee336f44))
|
|
78
|
+
* use integer minor units for amounts ([#22](https://github.com/naturalpay/naturalpay-ts/issues/22)) ([6750522](https://github.com/naturalpay/naturalpay-ts/commit/67505221c2d8551793799415651f693bc1e94141))
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Chores
|
|
82
|
+
|
|
83
|
+
* add package-lock.json to gitignore (repo uses pnpm) ([b2b4d31](https://github.com/naturalpay/naturalpay-ts/commit/b2b4d31dd90a255365fc5aeb23f1bd17c6ff28c0))
|
|
84
|
+
* baseline main to Stainless next ([22f68df](https://github.com/naturalpay/naturalpay-ts/commit/22f68dfe9fbb4c5b8874dc6d6eb1d2717d522e93))
|
|
85
|
+
* Bump Version ([58d890d](https://github.com/naturalpay/naturalpay-ts/commit/58d890d3630aa9171c03e90d81f6308ea0ee1aec))
|
|
86
|
+
* **CI:** Fix Naming ([db60961](https://github.com/naturalpay/naturalpay-ts/commit/db6096110c95531190e3c76b2d911070154c9d35))
|
|
87
|
+
* **CI:** Move Towards Trusted Publisher ([1564541](https://github.com/naturalpay/naturalpay-ts/commit/15645412fd98b848f565b20a34425d1c5629956b))
|
|
88
|
+
* **deps:** update dependency @modelcontextprotocol/sdk to v1.26.0 [security] ([#49](https://github.com/naturalpay/naturalpay-ts/issues/49)) ([a8ec77d](https://github.com/naturalpay/naturalpay-ts/commit/a8ec77d6c3b7fe8afd246cf103bc9d923a467c8e))
|
|
89
|
+
* **docs:** Fix README ([91893d7](https://github.com/naturalpay/naturalpay-ts/commit/91893d7fe25fac8df7ced3abe18f05fdf381af40))
|
|
90
|
+
* **docs:** Update README ([319efe0](https://github.com/naturalpay/naturalpay-ts/commit/319efe02ef8d2216732c18e59157a1e03e5a9d7b))
|
|
91
|
+
* rename BFF → server-ts in SDK docstrings ([#44](https://github.com/naturalpay/naturalpay-ts/issues/44)) ([a1fd526](https://github.com/naturalpay/naturalpay-ts/commit/a1fd526a0a37c6130ac7f1f88026e340875a6460))
|
|
92
|
+
* **sdk:** Bump Patch Version ([ca3f58d](https://github.com/naturalpay/naturalpay-ts/commit/ca3f58dc6d6801da72f5f4047eb904dad17dff91))
|
|
93
|
+
* **sdk:** Reset Version to 0.1.0 ([32c2117](https://github.com/naturalpay/naturalpay-ts/commit/32c2117a0bec17844502e0d4fda6d8f52b105e48))
|
|
94
|
+
* sync repo ([b45d508](https://github.com/naturalpay/naturalpay-ts/commit/b45d508cef8057fd504c489be87be3ae0b52b39b))
|
|
95
|
+
* **tests:** remove client-coupled envelope canary ([14aabfd](https://github.com/naturalpay/naturalpay-ts/commit/14aabfd42154ba3a2e2c7d78a39a7e4fbcaea55b))
|
|
96
|
+
* update SDK settings ([8ad2341](https://github.com/naturalpay/naturalpay-ts/commit/8ad2341538beeaa2b50d304a8e6ccca620e362d3))
|
|
97
|
+
* update SDK settings ([0cd65a9](https://github.com/naturalpay/naturalpay-ts/commit/0cd65a9f77acb5f15cf60978c33ad54a967d10be))
|
|
98
|
+
* update SDK settings ([ebf5496](https://github.com/naturalpay/naturalpay-ts/commit/ebf5496369cf9b0c48b16a8e0d1b506f7c86eeee))
|
|
99
|
+
* update SDK settings ([331a82b](https://github.com/naturalpay/naturalpay-ts/commit/331a82b186b351bc4704ae9c801bbec6e90f66f3))
|
|
100
|
+
* update SDK settings ([9cc741a](https://github.com/naturalpay/naturalpay-ts/commit/9cc741a4b276016a2cae8543f9fc3556c8a7efba))
|
|
101
|
+
* **version:** Bump Version ([2e126fc](https://github.com/naturalpay/naturalpay-ts/commit/2e126fc8f35e67b78a825b00262217ad7e37bbc6))
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### Documentation
|
|
105
|
+
|
|
106
|
+
* **README:** Pare Down Readme ([#31](https://github.com/naturalpay/naturalpay-ts/issues/31)) ([0f34778](https://github.com/naturalpay/naturalpay-ts/commit/0f347784b96359ce9ab4d5be2c4b273c3b4ba932))
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
### Styles
|
|
110
|
+
|
|
111
|
+
* fix formatting with prettier ([d97479e](https://github.com/naturalpay/naturalpay-ts/commit/d97479e0d807eed7e77cf6484985e0b716194a4e))
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
### Refactors
|
|
115
|
+
|
|
116
|
+
* **models:** consolidate wallet balance to breakdown + available ([#17](https://github.com/naturalpay/naturalpay-ts/issues/17)) ([da08731](https://github.com/naturalpay/naturalpay-ts/commit/da08731fece1e004ad23fe2989fec272b8c0a1ba))
|
|
117
|
+
* remove X-On-Behalf-Of header, use body/query params ([#14](https://github.com/naturalpay/naturalpay-ts/issues/14)) ([87853e2](https://github.com/naturalpay/naturalpay-ts/commit/87853e2aef03df11153b2440b53b9cbf3a724d2f))
|
|
118
|
+
* **sdk:** drop developer_context — header-only v2 ([#38](https://github.com/naturalpay/naturalpay-ts/issues/38)) ([98d3fef](https://github.com/naturalpay/naturalpay-ts/commit/98d3fef32a28183bf0648ff823f3f64d05e50d90))
|
|
119
|
+
* standardize ID prefixes to 3-letter format ([#13](https://github.com/naturalpay/naturalpay-ts/issues/13)) ([8a5a7c0](https://github.com/naturalpay/naturalpay-ts/commit/8a5a7c074813b379e2aa04615ae9727453027dae))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2026 naturalpay
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Naturalpay TypeScript API Library
|
|
2
2
|
|
|
3
|
-
[](https://npmjs.org/package/@naturalpay/sdk)
|
|
3
|
+
[>)](https://npmjs.org/package/@naturalpay/sdk) 
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This library provides convenient access to the Naturalpay REST API from server-side TypeScript or JavaScript.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The REST API documentation can be found on [docs.natural.co](https://docs.natural.co). The full API of this library can be found in [api.md](api.md).
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
It is generated with [Stainless](https://www.stainless.com/).
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -14,40 +14,354 @@ Full documentation, guides, and API reference are available at **[docs.natural.c
|
|
|
14
14
|
npm install @naturalpay/sdk
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Usage
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
import { NaturalClient } from '@naturalpay/sdk';
|
|
19
|
+
The full API of this library can be found in [api.md](api.md).
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
<!-- prettier-ignore -->
|
|
22
|
+
```js
|
|
23
|
+
import Natural from '@naturalpay/sdk';
|
|
23
24
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
memo: 'Payment for consulting',
|
|
28
|
-
agentId: 'agt_019cd1798d637a4da75dce386343931d',
|
|
29
|
-
instanceId: 'session-abc123',
|
|
30
|
-
customerPartyId: 'pty_019cd34e27c179bfbbe6870486b11b67',
|
|
31
|
-
idempotencyKey: 'pay_unique_key',
|
|
25
|
+
const client = new Natural({
|
|
26
|
+
apiKey: process.env['NATURALPAY_API_KEY'], // This is the default and can be omitted
|
|
27
|
+
environment: 'dev', // defaults to 'production'
|
|
32
28
|
});
|
|
33
29
|
|
|
34
|
-
|
|
30
|
+
const agent = await client.agents.create({ name: 'x', 'Idempotency-Key': 'Idempotency-Key' });
|
|
31
|
+
|
|
32
|
+
console.log(agent.data);
|
|
35
33
|
```
|
|
36
34
|
|
|
37
|
-
|
|
35
|
+
### Request & Response types
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
<!-- prettier-ignore -->
|
|
40
|
+
```ts
|
|
41
|
+
import Natural from '@naturalpay/sdk';
|
|
42
|
+
|
|
43
|
+
const client = new Natural({
|
|
44
|
+
apiKey: process.env['NATURALPAY_API_KEY'], // This is the default and can be omitted
|
|
45
|
+
environment: 'dev', // defaults to 'production'
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const params: Natural.AgentCreateParams = { name: 'x', 'Idempotency-Key': 'Idempotency-Key' };
|
|
49
|
+
const agent: Natural.AgentCreateResponse = await client.agents.create(params);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
|
|
53
|
+
|
|
54
|
+
## Handling errors
|
|
55
|
+
|
|
56
|
+
When the library is unable to connect to the API,
|
|
57
|
+
or if the API returns a non-success status code (i.e., 4xx or 5xx response),
|
|
58
|
+
a subclass of `APIError` will be thrown:
|
|
59
|
+
|
|
60
|
+
<!-- prettier-ignore -->
|
|
61
|
+
```ts
|
|
62
|
+
const agent = await client.agents
|
|
63
|
+
.create({ name: 'x', 'Idempotency-Key': 'Idempotency-Key' })
|
|
64
|
+
.catch(async (err) => {
|
|
65
|
+
if (err instanceof Natural.APIError) {
|
|
66
|
+
console.log(err.status); // 400
|
|
67
|
+
console.log(err.name); // BadRequestError
|
|
68
|
+
console.log(err.headers); // {server: 'nginx', ...}
|
|
69
|
+
} else {
|
|
70
|
+
throw err;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Error codes are as follows:
|
|
76
|
+
|
|
77
|
+
| Status Code | Error Type |
|
|
78
|
+
| ----------- | -------------------------- |
|
|
79
|
+
| 400 | `BadRequestError` |
|
|
80
|
+
| 401 | `AuthenticationError` |
|
|
81
|
+
| 403 | `PermissionDeniedError` |
|
|
82
|
+
| 404 | `NotFoundError` |
|
|
83
|
+
| 422 | `UnprocessableEntityError` |
|
|
84
|
+
| 429 | `RateLimitError` |
|
|
85
|
+
| >=500 | `InternalServerError` |
|
|
86
|
+
| N/A | `APIConnectionError` |
|
|
87
|
+
|
|
88
|
+
### Retries
|
|
89
|
+
|
|
90
|
+
Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
|
|
91
|
+
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
|
|
92
|
+
429 Rate Limit, and >=500 Internal errors will all be retried by default.
|
|
93
|
+
|
|
94
|
+
You can use the `maxRetries` option to configure or disable this:
|
|
95
|
+
|
|
96
|
+
<!-- prettier-ignore -->
|
|
97
|
+
```js
|
|
98
|
+
// Configure the default for all requests:
|
|
99
|
+
const client = new Natural({
|
|
100
|
+
maxRetries: 0, // default is 2
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// Or, configure per-request:
|
|
104
|
+
await client.agents.create({ name: 'x', 'Idempotency-Key': 'Idempotency-Key' }, {
|
|
105
|
+
maxRetries: 5,
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Timeouts
|
|
110
|
+
|
|
111
|
+
Requests time out after 1 minute by default. You can configure this with a `timeout` option:
|
|
112
|
+
|
|
113
|
+
<!-- prettier-ignore -->
|
|
114
|
+
```ts
|
|
115
|
+
// Configure the default for all requests:
|
|
116
|
+
const client = new Natural({
|
|
117
|
+
timeout: 20 * 1000, // 20 seconds (default is 1 minute)
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Override per-request:
|
|
121
|
+
await client.agents.create({ name: 'x', 'Idempotency-Key': 'Idempotency-Key' }, {
|
|
122
|
+
timeout: 5 * 1000,
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
On timeout, an `APIConnectionTimeoutError` is thrown.
|
|
127
|
+
|
|
128
|
+
Note that requests which time out will be [retried twice by default](#retries).
|
|
129
|
+
|
|
130
|
+
## Advanced Usage
|
|
131
|
+
|
|
132
|
+
### Accessing raw Response data (e.g., headers)
|
|
133
|
+
|
|
134
|
+
The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
|
|
135
|
+
This method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.
|
|
136
|
+
|
|
137
|
+
You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
|
|
138
|
+
Unlike `.asResponse()` this method consumes the body, returning once it is parsed.
|
|
139
|
+
|
|
140
|
+
<!-- prettier-ignore -->
|
|
141
|
+
```ts
|
|
142
|
+
const client = new Natural();
|
|
143
|
+
|
|
144
|
+
const response = await client.agents
|
|
145
|
+
.create({ name: 'x', 'Idempotency-Key': 'Idempotency-Key' })
|
|
146
|
+
.asResponse();
|
|
147
|
+
console.log(response.headers.get('X-My-Header'));
|
|
148
|
+
console.log(response.statusText); // access the underlying Response object
|
|
149
|
+
|
|
150
|
+
const { data: agent, response: raw } = await client.agents
|
|
151
|
+
.create({ name: 'x', 'Idempotency-Key': 'Idempotency-Key' })
|
|
152
|
+
.withResponse();
|
|
153
|
+
console.log(raw.headers.get('X-My-Header'));
|
|
154
|
+
console.log(agent.data);
|
|
43
155
|
```
|
|
44
156
|
|
|
45
|
-
|
|
157
|
+
### Logging
|
|
158
|
+
|
|
159
|
+
> [!IMPORTANT]
|
|
160
|
+
> All log messages are intended for debugging only. The format and content of log messages
|
|
161
|
+
> may change between releases.
|
|
162
|
+
|
|
163
|
+
#### Log levels
|
|
164
|
+
|
|
165
|
+
The log level can be configured in two ways:
|
|
166
|
+
|
|
167
|
+
1. Via the `NATURALPAY_LOG` environment variable
|
|
168
|
+
2. Using the `logLevel` client option (overrides the environment variable if set)
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
import Natural from '@naturalpay/sdk';
|
|
172
|
+
|
|
173
|
+
const client = new Natural({
|
|
174
|
+
logLevel: 'debug', // Show all log messages
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Available log levels, from most to least verbose:
|
|
179
|
+
|
|
180
|
+
- `'debug'` - Show debug messages, info, warnings, and errors
|
|
181
|
+
- `'info'` - Show info messages, warnings, and errors
|
|
182
|
+
- `'warn'` - Show warnings and errors (default)
|
|
183
|
+
- `'error'` - Show only errors
|
|
184
|
+
- `'off'` - Disable all logging
|
|
185
|
+
|
|
186
|
+
At the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.
|
|
187
|
+
Some authentication-related headers are redacted, but sensitive data in request and response bodies
|
|
188
|
+
may still be visible.
|
|
189
|
+
|
|
190
|
+
#### Custom logger
|
|
191
|
+
|
|
192
|
+
By default, this library logs to `globalThis.console`. You can also provide a custom logger.
|
|
193
|
+
Most logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.
|
|
194
|
+
|
|
195
|
+
When providing a custom logger, the `logLevel` option still controls which messages are emitted, messages
|
|
196
|
+
below the configured level will not be sent to your logger.
|
|
197
|
+
|
|
198
|
+
```ts
|
|
199
|
+
import Natural from '@naturalpay/sdk';
|
|
200
|
+
import pino from 'pino';
|
|
201
|
+
|
|
202
|
+
const logger = pino();
|
|
203
|
+
|
|
204
|
+
const client = new Natural({
|
|
205
|
+
logger: logger.child({ name: 'Natural' }),
|
|
206
|
+
logLevel: 'debug', // Send all messages to pino, allowing it to filter
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Making custom/undocumented requests
|
|
211
|
+
|
|
212
|
+
This library is typed for convenient access to the documented API. If you need to access undocumented
|
|
213
|
+
endpoints, params, or response properties, the library can still be used.
|
|
214
|
+
|
|
215
|
+
#### Undocumented endpoints
|
|
216
|
+
|
|
217
|
+
To make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.
|
|
218
|
+
Options on the client, such as retries, will be respected when making these requests.
|
|
219
|
+
|
|
220
|
+
```ts
|
|
221
|
+
await client.post('/some/path', {
|
|
222
|
+
body: { some_prop: 'foo' },
|
|
223
|
+
query: { some_query_arg: 'bar' },
|
|
224
|
+
});
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
#### Undocumented request params
|
|
228
|
+
|
|
229
|
+
To make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented
|
|
230
|
+
parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you
|
|
231
|
+
send will be sent as-is.
|
|
232
|
+
|
|
233
|
+
```ts
|
|
234
|
+
client.agents.create({
|
|
235
|
+
// ...
|
|
236
|
+
// @ts-expect-error baz is not yet public
|
|
237
|
+
baz: 'undocumented option',
|
|
238
|
+
});
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
For requests with the `GET` verb, any extra params will be in the query, all other requests will send the
|
|
242
|
+
extra param in the body.
|
|
243
|
+
|
|
244
|
+
If you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request
|
|
245
|
+
options.
|
|
246
|
+
|
|
247
|
+
#### Undocumented response properties
|
|
248
|
+
|
|
249
|
+
To access undocumented response properties, you may access the response object with `// @ts-expect-error` on
|
|
250
|
+
the response object, or cast the response object to the requisite type. Like the request params, we do not
|
|
251
|
+
validate or strip extra properties from the response from the API.
|
|
252
|
+
|
|
253
|
+
### Customizing the fetch client
|
|
254
|
+
|
|
255
|
+
By default, this library expects a global `fetch` function is defined.
|
|
256
|
+
|
|
257
|
+
If you want to use a different `fetch` function, you can either polyfill the global:
|
|
258
|
+
|
|
259
|
+
```ts
|
|
260
|
+
import fetch from 'my-fetch';
|
|
261
|
+
|
|
262
|
+
globalThis.fetch = fetch;
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Or pass it to the client:
|
|
266
|
+
|
|
267
|
+
```ts
|
|
268
|
+
import Natural from '@naturalpay/sdk';
|
|
269
|
+
import fetch from 'my-fetch';
|
|
270
|
+
|
|
271
|
+
const client = new Natural({ fetch });
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Fetch options
|
|
275
|
+
|
|
276
|
+
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
|
|
277
|
+
|
|
278
|
+
```ts
|
|
279
|
+
import Natural from '@naturalpay/sdk';
|
|
280
|
+
|
|
281
|
+
const client = new Natural({
|
|
282
|
+
fetchOptions: {
|
|
283
|
+
// `RequestInit` options
|
|
284
|
+
},
|
|
285
|
+
});
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
#### Configuring proxies
|
|
289
|
+
|
|
290
|
+
To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy
|
|
291
|
+
options to requests:
|
|
292
|
+
|
|
293
|
+
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
|
|
294
|
+
|
|
295
|
+
```ts
|
|
296
|
+
import Natural from '@naturalpay/sdk';
|
|
297
|
+
import * as undici from 'undici';
|
|
298
|
+
|
|
299
|
+
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
|
|
300
|
+
const client = new Natural({
|
|
301
|
+
fetchOptions: {
|
|
302
|
+
dispatcher: proxyAgent,
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
import Natural from '@naturalpay/sdk';
|
|
311
|
+
|
|
312
|
+
const client = new Natural({
|
|
313
|
+
fetchOptions: {
|
|
314
|
+
proxy: 'http://localhost:8888',
|
|
315
|
+
},
|
|
316
|
+
});
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
|
|
320
|
+
|
|
321
|
+
```ts
|
|
322
|
+
import Natural from 'npm:@naturalpay/sdk';
|
|
323
|
+
|
|
324
|
+
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
|
|
325
|
+
const client = new Natural({
|
|
326
|
+
fetchOptions: {
|
|
327
|
+
client: httpClient,
|
|
328
|
+
},
|
|
329
|
+
});
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Frequently Asked Questions
|
|
333
|
+
|
|
334
|
+
## Semantic versioning
|
|
335
|
+
|
|
336
|
+
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
|
|
337
|
+
|
|
338
|
+
1. Changes that only affect static types, without breaking runtime behavior.
|
|
339
|
+
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
|
|
340
|
+
3. Changes that we do not expect to impact the vast majority of users in practice.
|
|
341
|
+
|
|
342
|
+
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
|
|
343
|
+
|
|
344
|
+
We are keen for your feedback; please open an [issue](https://www.github.com/naturalpay/naturalpay-ts/issues) with questions, bugs, or suggestions.
|
|
46
345
|
|
|
47
346
|
## Requirements
|
|
48
347
|
|
|
49
|
-
|
|
348
|
+
TypeScript >= 4.9 is supported.
|
|
349
|
+
|
|
350
|
+
The following runtimes are supported:
|
|
351
|
+
|
|
352
|
+
- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
|
|
353
|
+
- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
|
|
354
|
+
- Deno v1.28.0 or higher.
|
|
355
|
+
- Bun 1.0 or later.
|
|
356
|
+
- Cloudflare Workers.
|
|
357
|
+
- Vercel Edge Runtime.
|
|
358
|
+
- Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
|
|
359
|
+
- Nitro v2.6 or greater.
|
|
360
|
+
|
|
361
|
+
Note that React Native is not supported at this time.
|
|
362
|
+
|
|
363
|
+
If you are interested in other runtime environments, please open or upvote an issue on GitHub.
|
|
50
364
|
|
|
51
|
-
##
|
|
365
|
+
## Contributing
|
|
52
366
|
|
|
53
|
-
|
|
367
|
+
See [the contributing documentation](./CONTRIBUTING.md).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-promise.d.mts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
|
package/api-promise.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-promise.d.ts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
|
package/api-promise.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("./internal/tslib.js");
|
|
4
|
+
/** @deprecated Import from ./core/api-promise instead */
|
|
5
|
+
tslib_1.__exportStar(require("./core/api-promise.js"), exports);
|
|
6
|
+
//# sourceMappingURL=api-promise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-promise.js","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,gEAAmC"}
|
package/api-promise.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-promise.mjs","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
|