pkg-sdk-test 0.0.14
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/dist/cjs/BaseClient.d.ts +41 -0
- package/dist/cjs/BaseClient.js +77 -0
- package/dist/cjs/Client.d.ts +29 -0
- package/dist/cjs/Client.js +88 -0
- package/dist/cjs/api/errors/BadRequestError.d.ts +6 -0
- package/dist/cjs/api/errors/BadRequestError.js +54 -0
- package/dist/cjs/api/errors/InternalServerError.d.ts +6 -0
- package/dist/cjs/api/errors/InternalServerError.js +54 -0
- package/dist/cjs/api/errors/NotFoundError.d.ts +6 -0
- package/dist/cjs/api/errors/NotFoundError.js +54 -0
- package/dist/cjs/api/errors/UnauthorizedError.d.ts +6 -0
- package/dist/cjs/api/errors/UnauthorizedError.js +54 -0
- package/dist/cjs/api/errors/index.d.ts +4 -0
- package/dist/cjs/api/errors/index.js +20 -0
- package/dist/cjs/api/index.d.ts +3 -0
- package/dist/cjs/api/index.js +19 -0
- package/dist/cjs/api/resources/index.d.ts +5 -0
- package/dist/cjs/api/resources/index.js +44 -0
- package/dist/cjs/api/resources/payments/client/Client.d.ts +92 -0
- package/dist/cjs/api/resources/payments/client/Client.js +362 -0
- package/dist/cjs/api/resources/payments/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/payments/client/index.js +17 -0
- package/dist/cjs/api/resources/payments/client/requests/CryptopayCreatePaymentRequest.d.ts +17 -0
- package/dist/cjs/api/resources/payments/client/requests/CryptopayCreatePaymentRequest.js +3 -0
- package/dist/cjs/api/resources/payments/client/requests/CryptopaySimulatePaymentRequest.d.ts +13 -0
- package/dist/cjs/api/resources/payments/client/requests/CryptopaySimulatePaymentRequest.js +3 -0
- package/dist/cjs/api/resources/payments/client/requests/GetV1PaymentsPaymentIdRequest.d.ts +10 -0
- package/dist/cjs/api/resources/payments/client/requests/GetV1PaymentsPaymentIdRequest.js +3 -0
- package/dist/cjs/api/resources/payments/client/requests/GetV1PaymentsRequest.d.ts +12 -0
- package/dist/cjs/api/resources/payments/client/requests/GetV1PaymentsRequest.js +3 -0
- package/dist/cjs/api/resources/payments/client/requests/PostV1PaymentsPaymentIdCancelRequest.d.ts +10 -0
- package/dist/cjs/api/resources/payments/client/requests/PostV1PaymentsPaymentIdCancelRequest.js +3 -0
- package/dist/cjs/api/resources/payments/client/requests/index.d.ts +5 -0
- package/dist/cjs/api/resources/payments/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/payments/exports.d.ts +2 -0
- package/dist/cjs/api/resources/payments/exports.js +21 -0
- package/dist/cjs/api/resources/payments/index.d.ts +2 -0
- package/dist/cjs/api/resources/payments/index.js +18 -0
- package/dist/cjs/api/resources/payments/types/GetV1PaymentsPaymentIdResponse.d.ts +2 -0
- package/dist/cjs/api/resources/payments/types/GetV1PaymentsPaymentIdResponse.js +3 -0
- package/dist/cjs/api/resources/payments/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/payments/types/index.js +17 -0
- package/dist/cjs/api/resources/staticWallets/client/Client.d.ts +105 -0
- package/dist/cjs/api/resources/staticWallets/client/Client.js +442 -0
- package/dist/cjs/api/resources/staticWallets/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/staticWallets/client/index.js +17 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/CryptopayCreateStaticWalletRequest.d.ts +11 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/CryptopayCreateStaticWalletRequest.js +3 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/CryptopaySimulateStaticDepositRequest.d.ts +15 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/CryptopaySimulateStaticDepositRequest.js +3 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/CryptopayUpdateStaticWalletRequest.d.ts +13 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/CryptopayUpdateStaticWalletRequest.js +3 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/DeleteV1StaticWalletsStaticWalletIdRequest.d.ts +10 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/DeleteV1StaticWalletsStaticWalletIdRequest.js +3 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdDepositsRequest.d.ts +10 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdDepositsRequest.js +3 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdRequest.d.ts +10 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdRequest.js +3 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/index.d.ts +6 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/staticWallets/exports.d.ts +2 -0
- package/dist/cjs/api/resources/staticWallets/exports.js +21 -0
- package/dist/cjs/api/resources/staticWallets/index.d.ts +1 -0
- package/dist/cjs/api/resources/staticWallets/index.js +17 -0
- package/dist/cjs/api/types/ControllerErrorResponse.d.ts +5 -0
- package/dist/cjs/api/types/ControllerErrorResponse.js +3 -0
- package/dist/cjs/api/types/CryptopayListPaymentsResponse.d.ts +6 -0
- package/dist/cjs/api/types/CryptopayListPaymentsResponse.js +3 -0
- package/dist/cjs/api/types/CryptopayListStaticDepositsResponse.d.ts +6 -0
- package/dist/cjs/api/types/CryptopayListStaticDepositsResponse.js +3 -0
- package/dist/cjs/api/types/CryptopayListStaticWalletsResponse.d.ts +6 -0
- package/dist/cjs/api/types/CryptopayListStaticWalletsResponse.js +3 -0
- package/dist/cjs/api/types/CryptopayPaymentResponse.d.ts +28 -0
- package/dist/cjs/api/types/CryptopayPaymentResponse.js +3 -0
- package/dist/cjs/api/types/CryptopayPaymentStatusEnum.d.ts +7 -0
- package/dist/cjs/api/types/CryptopayPaymentStatusEnum.js +10 -0
- package/dist/cjs/api/types/CryptopayPaymentSubStatusEnum.d.ts +16 -0
- package/dist/cjs/api/types/CryptopayPaymentSubStatusEnum.js +19 -0
- package/dist/cjs/api/types/CryptopayPublicPaymentResponse.d.ts +18 -0
- package/dist/cjs/api/types/CryptopayPublicPaymentResponse.js +3 -0
- package/dist/cjs/api/types/CryptopayPublicRedirect.d.ts +4 -0
- package/dist/cjs/api/types/CryptopayPublicRedirect.js +3 -0
- package/dist/cjs/api/types/CryptopayRedirectConfigDto.d.ts +5 -0
- package/dist/cjs/api/types/CryptopayRedirectConfigDto.js +3 -0
- package/dist/cjs/api/types/CryptopayStaticDepositResponse.d.ts +20 -0
- package/dist/cjs/api/types/CryptopayStaticDepositResponse.js +3 -0
- package/dist/cjs/api/types/CryptopayStaticWalletResponse.d.ts +12 -0
- package/dist/cjs/api/types/CryptopayStaticWalletResponse.js +3 -0
- package/dist/cjs/api/types/CryptopayTransactionResponse.d.ts +6 -0
- package/dist/cjs/api/types/CryptopayTransactionResponse.js +3 -0
- package/dist/cjs/api/types/index.d.ts +13 -0
- package/dist/cjs/api/types/index.js +29 -0
- package/dist/cjs/auth/HeaderAuthProvider.d.ts +20 -0
- package/dist/cjs/auth/HeaderAuthProvider.js +80 -0
- package/dist/cjs/auth/index.d.ts +1 -0
- package/dist/cjs/auth/index.js +5 -0
- package/dist/cjs/core/auth/AuthProvider.d.ts +8 -0
- package/dist/cjs/core/auth/AuthProvider.js +9 -0
- package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
- package/dist/cjs/core/auth/AuthRequest.js +2 -0
- package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
- package/dist/cjs/core/auth/BasicAuth.js +33 -0
- package/dist/cjs/core/auth/BearerToken.d.ts +7 -0
- package/dist/cjs/core/auth/BearerToken.js +16 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
- package/dist/cjs/core/auth/index.d.ts +5 -0
- package/dist/cjs/core/auth/index.js +11 -0
- package/dist/cjs/core/base64.d.ts +2 -0
- package/dist/cjs/core/base64.js +26 -0
- package/dist/cjs/core/exports.d.ts +1 -0
- package/dist/cjs/core/exports.js +17 -0
- package/dist/cjs/core/fetcher/APIResponse.d.ts +20 -0
- package/dist/cjs/core/fetcher/APIResponse.js +2 -0
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +19 -0
- package/dist/cjs/core/fetcher/BinaryResponse.js +17 -0
- package/dist/cjs/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/cjs/core/fetcher/EndpointMetadata.js +2 -0
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/cjs/core/fetcher/EndpointSupplier.js +22 -0
- package/dist/cjs/core/fetcher/Fetcher.d.ts +56 -0
- package/dist/cjs/core/fetcher/Fetcher.js +327 -0
- package/dist/cjs/core/fetcher/Headers.d.ts +2 -0
- package/dist/cjs/core/fetcher/Headers.js +84 -0
- package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/cjs/core/fetcher/HttpResponsePromise.js +103 -0
- package/dist/cjs/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/cjs/core/fetcher/RawResponse.js +44 -0
- package/dist/cjs/core/fetcher/Supplier.d.ts +4 -0
- package/dist/cjs/core/fetcher/Supplier.js +22 -0
- package/dist/cjs/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/cjs/core/fetcher/createRequestUrl.js +8 -0
- package/dist/cjs/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/cjs/core/fetcher/getErrorResponseBody.js +45 -0
- package/dist/cjs/core/fetcher/getFetchFn.d.ts +1 -0
- package/dist/cjs/core/fetcher/getFetchFn.js +17 -0
- package/dist/cjs/core/fetcher/getHeader.d.ts +1 -0
- package/dist/cjs/core/fetcher/getHeader.js +11 -0
- package/dist/cjs/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/cjs/core/fetcher/getRequestBody.js +27 -0
- package/dist/cjs/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/cjs/core/fetcher/getResponseBody.js +80 -0
- package/dist/cjs/core/fetcher/index.d.ts +13 -0
- package/dist/cjs/core/fetcher/index.js +19 -0
- package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +49 -0
- package/dist/cjs/core/fetcher/makePassthroughRequest.js +135 -0
- package/dist/cjs/core/fetcher/makeRequest.d.ts +6 -0
- package/dist/cjs/core/fetcher/makeRequest.js +61 -0
- package/dist/cjs/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/cjs/core/fetcher/requestWithRetries.js +70 -0
- package/dist/cjs/core/fetcher/signals.d.ts +5 -0
- package/dist/cjs/core/fetcher/signals.js +32 -0
- package/dist/cjs/core/headers.d.ts +2 -0
- package/dist/cjs/core/headers.js +31 -0
- package/dist/cjs/core/index.d.ts +6 -0
- package/dist/cjs/core/index.js +45 -0
- package/dist/cjs/core/json.d.ts +15 -0
- package/dist/cjs/core/json.js +24 -0
- package/dist/cjs/core/logging/exports.d.ts +18 -0
- package/dist/cjs/core/logging/exports.js +45 -0
- package/dist/cjs/core/logging/index.d.ts +1 -0
- package/dist/cjs/core/logging/index.js +17 -0
- package/dist/cjs/core/logging/logger.d.ts +126 -0
- package/dist/cjs/core/logging/logger.js +144 -0
- package/dist/cjs/core/runtime/index.d.ts +1 -0
- package/dist/cjs/core/runtime/index.js +5 -0
- package/dist/cjs/core/runtime/runtime.d.ts +9 -0
- package/dist/cjs/core/runtime/runtime.js +104 -0
- package/dist/cjs/core/url/QueryStringBuilder.d.ts +47 -0
- package/dist/cjs/core/url/QueryStringBuilder.js +83 -0
- package/dist/cjs/core/url/encodePathParam.d.ts +1 -0
- package/dist/cjs/core/url/encodePathParam.js +21 -0
- package/dist/cjs/core/url/index.d.ts +4 -0
- package/dist/cjs/core/url/index.js +11 -0
- package/dist/cjs/core/url/join.d.ts +1 -0
- package/dist/cjs/core/url/join.js +68 -0
- package/dist/cjs/core/url/qs.d.ts +7 -0
- package/dist/cjs/core/url/qs.js +76 -0
- package/dist/cjs/errors/SuwardApiError.d.ts +14 -0
- package/dist/cjs/errors/SuwardApiError.js +35 -0
- package/dist/cjs/errors/SuwardApiTimeoutError.d.ts +6 -0
- package/dist/cjs/errors/SuwardApiTimeoutError.js +18 -0
- package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
- package/dist/cjs/errors/handleNonStatusCodeError.js +68 -0
- package/dist/cjs/errors/index.d.ts +2 -0
- package/dist/cjs/errors/index.js +7 -0
- package/dist/cjs/exports.d.ts +1 -0
- package/dist/cjs/exports.js +17 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +46 -0
- package/dist/cjs/version.d.ts +1 -0
- package/dist/cjs/version.js +4 -0
- package/dist/esm/BaseClient.d.mts +41 -0
- package/dist/esm/BaseClient.mjs +40 -0
- package/dist/esm/Client.d.mts +29 -0
- package/dist/esm/Client.mjs +51 -0
- package/dist/esm/api/errors/BadRequestError.d.mts +6 -0
- package/dist/esm/api/errors/BadRequestError.mjs +17 -0
- package/dist/esm/api/errors/InternalServerError.d.mts +6 -0
- package/dist/esm/api/errors/InternalServerError.mjs +17 -0
- package/dist/esm/api/errors/NotFoundError.d.mts +6 -0
- package/dist/esm/api/errors/NotFoundError.mjs +17 -0
- package/dist/esm/api/errors/UnauthorizedError.d.mts +6 -0
- package/dist/esm/api/errors/UnauthorizedError.mjs +17 -0
- package/dist/esm/api/errors/index.d.mts +4 -0
- package/dist/esm/api/errors/index.mjs +4 -0
- package/dist/esm/api/index.d.mts +3 -0
- package/dist/esm/api/index.mjs +3 -0
- package/dist/esm/api/resources/index.d.mts +5 -0
- package/dist/esm/api/resources/index.mjs +5 -0
- package/dist/esm/api/resources/payments/client/Client.d.mts +92 -0
- package/dist/esm/api/resources/payments/client/Client.mjs +325 -0
- package/dist/esm/api/resources/payments/client/index.d.mts +1 -0
- package/dist/esm/api/resources/payments/client/index.mjs +1 -0
- package/dist/esm/api/resources/payments/client/requests/CryptopayCreatePaymentRequest.d.mts +17 -0
- package/dist/esm/api/resources/payments/client/requests/CryptopayCreatePaymentRequest.mjs +2 -0
- package/dist/esm/api/resources/payments/client/requests/CryptopaySimulatePaymentRequest.d.mts +13 -0
- package/dist/esm/api/resources/payments/client/requests/CryptopaySimulatePaymentRequest.mjs +2 -0
- package/dist/esm/api/resources/payments/client/requests/GetV1PaymentsPaymentIdRequest.d.mts +10 -0
- package/dist/esm/api/resources/payments/client/requests/GetV1PaymentsPaymentIdRequest.mjs +2 -0
- package/dist/esm/api/resources/payments/client/requests/GetV1PaymentsRequest.d.mts +12 -0
- package/dist/esm/api/resources/payments/client/requests/GetV1PaymentsRequest.mjs +2 -0
- package/dist/esm/api/resources/payments/client/requests/PostV1PaymentsPaymentIdCancelRequest.d.mts +10 -0
- package/dist/esm/api/resources/payments/client/requests/PostV1PaymentsPaymentIdCancelRequest.mjs +2 -0
- package/dist/esm/api/resources/payments/client/requests/index.d.mts +5 -0
- package/dist/esm/api/resources/payments/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/payments/exports.d.mts +2 -0
- package/dist/esm/api/resources/payments/exports.mjs +3 -0
- package/dist/esm/api/resources/payments/index.d.mts +2 -0
- package/dist/esm/api/resources/payments/index.mjs +2 -0
- package/dist/esm/api/resources/payments/types/GetV1PaymentsPaymentIdResponse.d.mts +2 -0
- package/dist/esm/api/resources/payments/types/GetV1PaymentsPaymentIdResponse.mjs +2 -0
- package/dist/esm/api/resources/payments/types/index.d.mts +1 -0
- package/dist/esm/api/resources/payments/types/index.mjs +1 -0
- package/dist/esm/api/resources/staticWallets/client/Client.d.mts +105 -0
- package/dist/esm/api/resources/staticWallets/client/Client.mjs +405 -0
- package/dist/esm/api/resources/staticWallets/client/index.d.mts +1 -0
- package/dist/esm/api/resources/staticWallets/client/index.mjs +1 -0
- package/dist/esm/api/resources/staticWallets/client/requests/CryptopayCreateStaticWalletRequest.d.mts +11 -0
- package/dist/esm/api/resources/staticWallets/client/requests/CryptopayCreateStaticWalletRequest.mjs +2 -0
- package/dist/esm/api/resources/staticWallets/client/requests/CryptopaySimulateStaticDepositRequest.d.mts +15 -0
- package/dist/esm/api/resources/staticWallets/client/requests/CryptopaySimulateStaticDepositRequest.mjs +2 -0
- package/dist/esm/api/resources/staticWallets/client/requests/CryptopayUpdateStaticWalletRequest.d.mts +13 -0
- package/dist/esm/api/resources/staticWallets/client/requests/CryptopayUpdateStaticWalletRequest.mjs +2 -0
- package/dist/esm/api/resources/staticWallets/client/requests/DeleteV1StaticWalletsStaticWalletIdRequest.d.mts +10 -0
- package/dist/esm/api/resources/staticWallets/client/requests/DeleteV1StaticWalletsStaticWalletIdRequest.mjs +2 -0
- package/dist/esm/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdDepositsRequest.d.mts +10 -0
- package/dist/esm/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdDepositsRequest.mjs +2 -0
- package/dist/esm/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdRequest.d.mts +10 -0
- package/dist/esm/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdRequest.mjs +2 -0
- package/dist/esm/api/resources/staticWallets/client/requests/index.d.mts +6 -0
- package/dist/esm/api/resources/staticWallets/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/staticWallets/exports.d.mts +2 -0
- package/dist/esm/api/resources/staticWallets/exports.mjs +3 -0
- package/dist/esm/api/resources/staticWallets/index.d.mts +1 -0
- package/dist/esm/api/resources/staticWallets/index.mjs +1 -0
- package/dist/esm/api/types/ControllerErrorResponse.d.mts +5 -0
- package/dist/esm/api/types/ControllerErrorResponse.mjs +2 -0
- package/dist/esm/api/types/CryptopayListPaymentsResponse.d.mts +6 -0
- package/dist/esm/api/types/CryptopayListPaymentsResponse.mjs +2 -0
- package/dist/esm/api/types/CryptopayListStaticDepositsResponse.d.mts +6 -0
- package/dist/esm/api/types/CryptopayListStaticDepositsResponse.mjs +2 -0
- package/dist/esm/api/types/CryptopayListStaticWalletsResponse.d.mts +6 -0
- package/dist/esm/api/types/CryptopayListStaticWalletsResponse.mjs +2 -0
- package/dist/esm/api/types/CryptopayPaymentResponse.d.mts +28 -0
- package/dist/esm/api/types/CryptopayPaymentResponse.mjs +2 -0
- package/dist/esm/api/types/CryptopayPaymentStatusEnum.d.mts +7 -0
- package/dist/esm/api/types/CryptopayPaymentStatusEnum.mjs +7 -0
- package/dist/esm/api/types/CryptopayPaymentSubStatusEnum.d.mts +16 -0
- package/dist/esm/api/types/CryptopayPaymentSubStatusEnum.mjs +16 -0
- package/dist/esm/api/types/CryptopayPublicPaymentResponse.d.mts +18 -0
- package/dist/esm/api/types/CryptopayPublicPaymentResponse.mjs +2 -0
- package/dist/esm/api/types/CryptopayPublicRedirect.d.mts +4 -0
- package/dist/esm/api/types/CryptopayPublicRedirect.mjs +2 -0
- package/dist/esm/api/types/CryptopayRedirectConfigDto.d.mts +5 -0
- package/dist/esm/api/types/CryptopayRedirectConfigDto.mjs +2 -0
- package/dist/esm/api/types/CryptopayStaticDepositResponse.d.mts +20 -0
- package/dist/esm/api/types/CryptopayStaticDepositResponse.mjs +2 -0
- package/dist/esm/api/types/CryptopayStaticWalletResponse.d.mts +12 -0
- package/dist/esm/api/types/CryptopayStaticWalletResponse.mjs +2 -0
- package/dist/esm/api/types/CryptopayTransactionResponse.d.mts +6 -0
- package/dist/esm/api/types/CryptopayTransactionResponse.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +13 -0
- package/dist/esm/api/types/index.mjs +13 -0
- package/dist/esm/auth/HeaderAuthProvider.d.mts +20 -0
- package/dist/esm/auth/HeaderAuthProvider.mjs +43 -0
- package/dist/esm/auth/index.d.mts +1 -0
- package/dist/esm/auth/index.mjs +1 -0
- package/dist/esm/core/auth/AuthProvider.d.mts +8 -0
- package/dist/esm/core/auth/AuthProvider.mjs +6 -0
- package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
- package/dist/esm/core/auth/AuthRequest.mjs +1 -0
- package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
- package/dist/esm/core/auth/BasicAuth.mjs +30 -0
- package/dist/esm/core/auth/BearerToken.d.mts +7 -0
- package/dist/esm/core/auth/BearerToken.mjs +13 -0
- package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
- package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
- package/dist/esm/core/auth/index.d.mts +5 -0
- package/dist/esm/core/auth/index.mjs +4 -0
- package/dist/esm/core/base64.d.mts +2 -0
- package/dist/esm/core/base64.mjs +22 -0
- package/dist/esm/core/exports.d.mts +1 -0
- package/dist/esm/core/exports.mjs +1 -0
- package/dist/esm/core/fetcher/APIResponse.d.mts +20 -0
- package/dist/esm/core/fetcher/APIResponse.mjs +1 -0
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +19 -0
- package/dist/esm/core/fetcher/BinaryResponse.mjs +14 -0
- package/dist/esm/core/fetcher/EndpointMetadata.d.mts +13 -0
- package/dist/esm/core/fetcher/EndpointMetadata.mjs +1 -0
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +12 -0
- package/dist/esm/core/fetcher/EndpointSupplier.mjs +19 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +56 -0
- package/dist/esm/core/fetcher/Fetcher.mjs +323 -0
- package/dist/esm/core/fetcher/Headers.d.mts +2 -0
- package/dist/esm/core/fetcher/Headers.mjs +82 -0
- package/dist/esm/core/fetcher/HttpResponsePromise.d.mts +58 -0
- package/dist/esm/core/fetcher/HttpResponsePromise.mjs +99 -0
- package/dist/esm/core/fetcher/RawResponse.d.mts +29 -0
- package/dist/esm/core/fetcher/RawResponse.mjs +40 -0
- package/dist/esm/core/fetcher/Supplier.d.mts +4 -0
- package/dist/esm/core/fetcher/Supplier.mjs +19 -0
- package/dist/esm/core/fetcher/createRequestUrl.d.mts +1 -0
- package/dist/esm/core/fetcher/createRequestUrl.mjs +5 -0
- package/dist/esm/core/fetcher/getErrorResponseBody.d.mts +1 -0
- package/dist/esm/core/fetcher/getErrorResponseBody.mjs +42 -0
- package/dist/esm/core/fetcher/getFetchFn.d.mts +1 -0
- package/dist/esm/core/fetcher/getFetchFn.mjs +14 -0
- package/dist/esm/core/fetcher/getHeader.d.mts +1 -0
- package/dist/esm/core/fetcher/getHeader.mjs +8 -0
- package/dist/esm/core/fetcher/getRequestBody.d.mts +7 -0
- package/dist/esm/core/fetcher/getRequestBody.mjs +24 -0
- package/dist/esm/core/fetcher/getResponseBody.d.mts +1 -0
- package/dist/esm/core/fetcher/getResponseBody.mjs +77 -0
- package/dist/esm/core/fetcher/index.d.mts +13 -0
- package/dist/esm/core/fetcher/index.mjs +7 -0
- package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +49 -0
- package/dist/esm/core/fetcher/makePassthroughRequest.mjs +132 -0
- package/dist/esm/core/fetcher/makeRequest.d.mts +6 -0
- package/dist/esm/core/fetcher/makeRequest.mjs +55 -0
- package/dist/esm/core/fetcher/requestWithRetries.d.mts +1 -0
- package/dist/esm/core/fetcher/requestWithRetries.mjs +67 -0
- package/dist/esm/core/fetcher/signals.d.mts +5 -0
- package/dist/esm/core/fetcher/signals.mjs +28 -0
- package/dist/esm/core/headers.d.mts +2 -0
- package/dist/esm/core/headers.mjs +27 -0
- package/dist/esm/core/index.d.mts +6 -0
- package/dist/esm/core/index.mjs +6 -0
- package/dist/esm/core/json.d.mts +15 -0
- package/dist/esm/core/json.mjs +19 -0
- package/dist/esm/core/logging/exports.d.mts +18 -0
- package/dist/esm/core/logging/exports.mjs +9 -0
- package/dist/esm/core/logging/index.d.mts +1 -0
- package/dist/esm/core/logging/index.mjs +1 -0
- package/dist/esm/core/logging/logger.d.mts +126 -0
- package/dist/esm/core/logging/logger.mjs +138 -0
- package/dist/esm/core/runtime/index.d.mts +1 -0
- package/dist/esm/core/runtime/index.mjs +1 -0
- package/dist/esm/core/runtime/runtime.d.mts +9 -0
- package/dist/esm/core/runtime/runtime.mjs +101 -0
- package/dist/esm/core/url/QueryStringBuilder.d.mts +47 -0
- package/dist/esm/core/url/QueryStringBuilder.mjs +80 -0
- package/dist/esm/core/url/encodePathParam.d.mts +1 -0
- package/dist/esm/core/url/encodePathParam.mjs +18 -0
- package/dist/esm/core/url/index.d.mts +4 -0
- package/dist/esm/core/url/index.mjs +4 -0
- package/dist/esm/core/url/join.d.mts +1 -0
- package/dist/esm/core/url/join.mjs +65 -0
- package/dist/esm/core/url/qs.d.mts +7 -0
- package/dist/esm/core/url/qs.mjs +73 -0
- package/dist/esm/errors/SuwardApiError.d.mts +14 -0
- package/dist/esm/errors/SuwardApiError.mjs +31 -0
- package/dist/esm/errors/SuwardApiTimeoutError.d.mts +6 -0
- package/dist/esm/errors/SuwardApiTimeoutError.mjs +14 -0
- package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
- package/dist/esm/errors/handleNonStatusCodeError.mjs +32 -0
- package/dist/esm/errors/index.d.mts +2 -0
- package/dist/esm/errors/index.mjs +2 -0
- package/dist/esm/exports.d.mts +1 -0
- package/dist/esm/exports.mjs +1 -0
- package/dist/esm/index.d.mts +5 -0
- package/dist/esm/index.mjs +4 -0
- package/dist/esm/version.d.mts +1 -0
- package/dist/esm/version.mjs +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Logger = exports.ConsoleLogger = exports.LogLevel = void 0;
|
|
4
|
+
exports.createLogger = createLogger;
|
|
5
|
+
exports.LogLevel = {
|
|
6
|
+
Debug: "debug",
|
|
7
|
+
Info: "info",
|
|
8
|
+
Warn: "warn",
|
|
9
|
+
Error: "error",
|
|
10
|
+
};
|
|
11
|
+
const logLevelMap = {
|
|
12
|
+
[exports.LogLevel.Debug]: 1,
|
|
13
|
+
[exports.LogLevel.Info]: 2,
|
|
14
|
+
[exports.LogLevel.Warn]: 3,
|
|
15
|
+
[exports.LogLevel.Error]: 4,
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Default console-based logger implementation.
|
|
19
|
+
*/
|
|
20
|
+
class ConsoleLogger {
|
|
21
|
+
debug(message, ...args) {
|
|
22
|
+
console.debug(message, ...args);
|
|
23
|
+
}
|
|
24
|
+
info(message, ...args) {
|
|
25
|
+
console.info(message, ...args);
|
|
26
|
+
}
|
|
27
|
+
warn(message, ...args) {
|
|
28
|
+
console.warn(message, ...args);
|
|
29
|
+
}
|
|
30
|
+
error(message, ...args) {
|
|
31
|
+
console.error(message, ...args);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ConsoleLogger = ConsoleLogger;
|
|
35
|
+
/**
|
|
36
|
+
* Logger class that provides level-based logging functionality.
|
|
37
|
+
*/
|
|
38
|
+
class Logger {
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new logger instance.
|
|
41
|
+
* @param config - Logger configuration
|
|
42
|
+
*/
|
|
43
|
+
constructor(config) {
|
|
44
|
+
this.level = logLevelMap[config.level];
|
|
45
|
+
this.logger = config.logger;
|
|
46
|
+
this.silent = config.silent;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Checks if a log level should be output based on configuration.
|
|
50
|
+
* @param level - The log level to check
|
|
51
|
+
* @returns True if the level should be logged
|
|
52
|
+
*/
|
|
53
|
+
shouldLog(level) {
|
|
54
|
+
return !this.silent && this.level <= logLevelMap[level];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Checks if debug logging is enabled.
|
|
58
|
+
* @returns True if debug logs should be output
|
|
59
|
+
*/
|
|
60
|
+
isDebug() {
|
|
61
|
+
return this.shouldLog(exports.LogLevel.Debug);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Logs a debug message if debug logging is enabled.
|
|
65
|
+
* @param message - The message to log
|
|
66
|
+
* @param args - Additional arguments to log
|
|
67
|
+
*/
|
|
68
|
+
debug(message, ...args) {
|
|
69
|
+
if (this.isDebug()) {
|
|
70
|
+
this.logger.debug(message, ...args);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Checks if info logging is enabled.
|
|
75
|
+
* @returns True if info logs should be output
|
|
76
|
+
*/
|
|
77
|
+
isInfo() {
|
|
78
|
+
return this.shouldLog(exports.LogLevel.Info);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Logs an info message if info logging is enabled.
|
|
82
|
+
* @param message - The message to log
|
|
83
|
+
* @param args - Additional arguments to log
|
|
84
|
+
*/
|
|
85
|
+
info(message, ...args) {
|
|
86
|
+
if (this.isInfo()) {
|
|
87
|
+
this.logger.info(message, ...args);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Checks if warning logging is enabled.
|
|
92
|
+
* @returns True if warning logs should be output
|
|
93
|
+
*/
|
|
94
|
+
isWarn() {
|
|
95
|
+
return this.shouldLog(exports.LogLevel.Warn);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Logs a warning message if warning logging is enabled.
|
|
99
|
+
* @param message - The message to log
|
|
100
|
+
* @param args - Additional arguments to log
|
|
101
|
+
*/
|
|
102
|
+
warn(message, ...args) {
|
|
103
|
+
if (this.isWarn()) {
|
|
104
|
+
this.logger.warn(message, ...args);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Checks if error logging is enabled.
|
|
109
|
+
* @returns True if error logs should be output
|
|
110
|
+
*/
|
|
111
|
+
isError() {
|
|
112
|
+
return this.shouldLog(exports.LogLevel.Error);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Logs an error message if error logging is enabled.
|
|
116
|
+
* @param message - The message to log
|
|
117
|
+
* @param args - Additional arguments to log
|
|
118
|
+
*/
|
|
119
|
+
error(message, ...args) {
|
|
120
|
+
if (this.isError()) {
|
|
121
|
+
this.logger.error(message, ...args);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
exports.Logger = Logger;
|
|
126
|
+
function createLogger(config) {
|
|
127
|
+
var _a, _b, _c;
|
|
128
|
+
if (config == null) {
|
|
129
|
+
return defaultLogger;
|
|
130
|
+
}
|
|
131
|
+
if (config instanceof Logger) {
|
|
132
|
+
return config;
|
|
133
|
+
}
|
|
134
|
+
config = config !== null && config !== void 0 ? config : {};
|
|
135
|
+
(_a = config.level) !== null && _a !== void 0 ? _a : (config.level = exports.LogLevel.Info);
|
|
136
|
+
(_b = config.logger) !== null && _b !== void 0 ? _b : (config.logger = new ConsoleLogger());
|
|
137
|
+
(_c = config.silent) !== null && _c !== void 0 ? _c : (config.silent = true);
|
|
138
|
+
return new Logger(config);
|
|
139
|
+
}
|
|
140
|
+
const defaultLogger = new Logger({
|
|
141
|
+
level: exports.LogLevel.Info,
|
|
142
|
+
logger: new ConsoleLogger(),
|
|
143
|
+
silent: true,
|
|
144
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RUNTIME } from "./runtime.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A constant that indicates which environment and version the SDK is running in.
|
|
3
|
+
*/
|
|
4
|
+
export declare const RUNTIME: Runtime;
|
|
5
|
+
export interface Runtime {
|
|
6
|
+
type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime";
|
|
7
|
+
version?: string;
|
|
8
|
+
parsedVersion?: number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RUNTIME = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A constant that indicates which environment and version the SDK is running in.
|
|
6
|
+
*/
|
|
7
|
+
exports.RUNTIME = evaluateRuntime();
|
|
8
|
+
function evaluateRuntime() {
|
|
9
|
+
var _a, _b, _c, _d, _e;
|
|
10
|
+
/**
|
|
11
|
+
* A constant that indicates whether the environment the code is running is a Web Browser.
|
|
12
|
+
*/
|
|
13
|
+
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
14
|
+
if (isBrowser) {
|
|
15
|
+
return {
|
|
16
|
+
type: "browser",
|
|
17
|
+
version: window.navigator.userAgent,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A constant that indicates whether the environment the code is running is Cloudflare.
|
|
22
|
+
* https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent
|
|
23
|
+
*/
|
|
24
|
+
const isCloudflare = typeof globalThis !== "undefined" && ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === "Cloudflare-Workers";
|
|
25
|
+
if (isCloudflare) {
|
|
26
|
+
return {
|
|
27
|
+
type: "workerd",
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A constant that indicates whether the environment the code is running is Edge Runtime.
|
|
32
|
+
* https://vercel.com/docs/functions/runtimes/edge-runtime#check-if-you're-running-on-the-edge-runtime
|
|
33
|
+
*/
|
|
34
|
+
const isEdgeRuntime = typeof EdgeRuntime === "string";
|
|
35
|
+
if (isEdgeRuntime) {
|
|
36
|
+
return {
|
|
37
|
+
type: "edge-runtime",
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A constant that indicates whether the environment the code is running is a Web Worker.
|
|
42
|
+
*/
|
|
43
|
+
const isWebWorker = typeof self === "object" &&
|
|
44
|
+
typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" &&
|
|
45
|
+
(((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "DedicatedWorkerGlobalScope" ||
|
|
46
|
+
((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "ServiceWorkerGlobalScope" ||
|
|
47
|
+
((_d = self.constructor) === null || _d === void 0 ? void 0 : _d.name) === "SharedWorkerGlobalScope");
|
|
48
|
+
if (isWebWorker) {
|
|
49
|
+
return {
|
|
50
|
+
type: "web-worker",
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A constant that indicates whether the environment the code is running is Deno.
|
|
55
|
+
* FYI Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions
|
|
56
|
+
*/
|
|
57
|
+
const isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined";
|
|
58
|
+
if (isDeno) {
|
|
59
|
+
return {
|
|
60
|
+
type: "deno",
|
|
61
|
+
version: Deno.version.deno,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A constant that indicates whether the environment the code is running is Bun.sh.
|
|
66
|
+
*/
|
|
67
|
+
const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
|
|
68
|
+
if (isBun) {
|
|
69
|
+
return {
|
|
70
|
+
type: "bun",
|
|
71
|
+
version: Bun.version,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A constant that indicates whether the environment the code is running is in React-Native.
|
|
76
|
+
* This check should come before Node.js detection since React Native may have a process polyfill.
|
|
77
|
+
* https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js
|
|
78
|
+
*/
|
|
79
|
+
const isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === void 0 ? void 0 : navigator.product) === "ReactNative";
|
|
80
|
+
if (isReactNative) {
|
|
81
|
+
return {
|
|
82
|
+
type: "react-native",
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A constant that indicates whether the environment the code is running is Node.JS.
|
|
87
|
+
*
|
|
88
|
+
* We assign `process` to a local variable first to avoid being flagged by
|
|
89
|
+
* bundlers that perform static analysis on `process.versions` (e.g. Next.js
|
|
90
|
+
* Edge Runtime warns about Node.js APIs even when they are guarded).
|
|
91
|
+
*/
|
|
92
|
+
const _process = typeof process !== "undefined" ? process : undefined;
|
|
93
|
+
const isNode = typeof _process !== "undefined" && typeof ((_e = _process.versions) === null || _e === void 0 ? void 0 : _e.node) === "string";
|
|
94
|
+
if (isNode) {
|
|
95
|
+
return {
|
|
96
|
+
type: "node",
|
|
97
|
+
version: _process.versions.node,
|
|
98
|
+
parsedVersion: Number(_process.versions.node.split(".")[0]),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
type: "unknown",
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a fluent builder for constructing URL query strings.
|
|
3
|
+
*
|
|
4
|
+
* Each `.add()` call serializes its value immediately (like C#'s builder),
|
|
5
|
+
* so no format tracking is needed — the style is applied at add-time.
|
|
6
|
+
*
|
|
7
|
+
* Usage (generated code):
|
|
8
|
+
*
|
|
9
|
+
* const qs = core.url.queryBuilder()
|
|
10
|
+
* .add("limit", limit)
|
|
11
|
+
* .add("tags", tags, { style: "comma" }) // explode: false
|
|
12
|
+
* .mergeAdditional(requestOptions?.queryParams)
|
|
13
|
+
* .build();
|
|
14
|
+
*/
|
|
15
|
+
export declare function queryBuilder(): QueryStringBuilder;
|
|
16
|
+
declare class QueryStringBuilder {
|
|
17
|
+
private parts;
|
|
18
|
+
/**
|
|
19
|
+
* Adds a query parameter, serializing it immediately.
|
|
20
|
+
*
|
|
21
|
+
* By default arrays use "repeat" format (`key=a&key=b`).
|
|
22
|
+
* Pass `{ style: "comma" }` for OpenAPI `explode: false` parameters
|
|
23
|
+
* to get comma-separated values (`key=a,b,c`).
|
|
24
|
+
*
|
|
25
|
+
* Null / undefined values are silently skipped.
|
|
26
|
+
*/
|
|
27
|
+
add(key: string, value: unknown, options?: {
|
|
28
|
+
style?: "comma";
|
|
29
|
+
}): this;
|
|
30
|
+
/**
|
|
31
|
+
* Adds multiple query parameters at once from a record.
|
|
32
|
+
* All parameters use the default "repeat" array format.
|
|
33
|
+
* Null / undefined values are silently skipped.
|
|
34
|
+
*/
|
|
35
|
+
addMany(params: Record<string, unknown>): this;
|
|
36
|
+
/**
|
|
37
|
+
* Merges additional query parameters supplied at call-time via
|
|
38
|
+
* `requestOptions.queryParams`. Overrides existing keys (last-write-wins).
|
|
39
|
+
*/
|
|
40
|
+
mergeAdditional(additionalParams?: Record<string, unknown>): this;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the assembled query string (without the leading `?`).
|
|
43
|
+
* Returns an empty string when no parameters were added.
|
|
44
|
+
*/
|
|
45
|
+
build(): string;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryBuilder = queryBuilder;
|
|
4
|
+
const qs_js_1 = require("./qs.js");
|
|
5
|
+
/**
|
|
6
|
+
* Creates a fluent builder for constructing URL query strings.
|
|
7
|
+
*
|
|
8
|
+
* Each `.add()` call serializes its value immediately (like C#'s builder),
|
|
9
|
+
* so no format tracking is needed — the style is applied at add-time.
|
|
10
|
+
*
|
|
11
|
+
* Usage (generated code):
|
|
12
|
+
*
|
|
13
|
+
* const qs = core.url.queryBuilder()
|
|
14
|
+
* .add("limit", limit)
|
|
15
|
+
* .add("tags", tags, { style: "comma" }) // explode: false
|
|
16
|
+
* .mergeAdditional(requestOptions?.queryParams)
|
|
17
|
+
* .build();
|
|
18
|
+
*/
|
|
19
|
+
function queryBuilder() {
|
|
20
|
+
return new QueryStringBuilder();
|
|
21
|
+
}
|
|
22
|
+
class QueryStringBuilder {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.parts = new Map();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Adds a query parameter, serializing it immediately.
|
|
28
|
+
*
|
|
29
|
+
* By default arrays use "repeat" format (`key=a&key=b`).
|
|
30
|
+
* Pass `{ style: "comma" }` for OpenAPI `explode: false` parameters
|
|
31
|
+
* to get comma-separated values (`key=a,b,c`).
|
|
32
|
+
*
|
|
33
|
+
* Null / undefined values are silently skipped.
|
|
34
|
+
*/
|
|
35
|
+
add(key, value, options) {
|
|
36
|
+
if (value === undefined || value === null) {
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
const serialized = (0, qs_js_1.toQueryString)({ [key]: value }, { arrayFormat: (options === null || options === void 0 ? void 0 : options.style) === "comma" ? "comma" : "repeat" });
|
|
40
|
+
if (serialized.length > 0) {
|
|
41
|
+
this.parts.set(key, serialized);
|
|
42
|
+
}
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Adds multiple query parameters at once from a record.
|
|
47
|
+
* All parameters use the default "repeat" array format.
|
|
48
|
+
* Null / undefined values are silently skipped.
|
|
49
|
+
*/
|
|
50
|
+
addMany(params) {
|
|
51
|
+
if (params != null) {
|
|
52
|
+
for (const [key, value] of Object.entries(params)) {
|
|
53
|
+
this.add(key, value);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Merges additional query parameters supplied at call-time via
|
|
60
|
+
* `requestOptions.queryParams`. Overrides existing keys (last-write-wins).
|
|
61
|
+
*/
|
|
62
|
+
mergeAdditional(additionalParams) {
|
|
63
|
+
if (additionalParams != null) {
|
|
64
|
+
for (const [key, value] of Object.entries(additionalParams)) {
|
|
65
|
+
if (value === undefined || value === null) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const serialized = (0, qs_js_1.toQueryString)({ [key]: value }, { arrayFormat: "repeat" });
|
|
69
|
+
if (serialized.length > 0) {
|
|
70
|
+
this.parts.set(key, serialized);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Returns the assembled query string (without the leading `?`).
|
|
78
|
+
* Returns an empty string when no parameters were added.
|
|
79
|
+
*/
|
|
80
|
+
build() {
|
|
81
|
+
return [...this.parts.values()].join("&");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function encodePathParam(param: unknown): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encodePathParam = encodePathParam;
|
|
4
|
+
function encodePathParam(param) {
|
|
5
|
+
if (param === null) {
|
|
6
|
+
return "null";
|
|
7
|
+
}
|
|
8
|
+
const typeofParam = typeof param;
|
|
9
|
+
switch (typeofParam) {
|
|
10
|
+
case "undefined":
|
|
11
|
+
return "undefined";
|
|
12
|
+
case "string":
|
|
13
|
+
case "number":
|
|
14
|
+
case "boolean":
|
|
15
|
+
break;
|
|
16
|
+
default:
|
|
17
|
+
param = String(param);
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
return encodeURIComponent(param);
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toQueryString = exports.queryBuilder = exports.join = exports.encodePathParam = void 0;
|
|
4
|
+
var encodePathParam_js_1 = require("./encodePathParam.js");
|
|
5
|
+
Object.defineProperty(exports, "encodePathParam", { enumerable: true, get: function () { return encodePathParam_js_1.encodePathParam; } });
|
|
6
|
+
var join_js_1 = require("./join.js");
|
|
7
|
+
Object.defineProperty(exports, "join", { enumerable: true, get: function () { return join_js_1.join; } });
|
|
8
|
+
var QueryStringBuilder_js_1 = require("./QueryStringBuilder.js");
|
|
9
|
+
Object.defineProperty(exports, "queryBuilder", { enumerable: true, get: function () { return QueryStringBuilder_js_1.queryBuilder; } });
|
|
10
|
+
var qs_js_1 = require("./qs.js");
|
|
11
|
+
Object.defineProperty(exports, "toQueryString", { enumerable: true, get: function () { return qs_js_1.toQueryString; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function join(base: string, ...segments: string[]): string;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.join = join;
|
|
4
|
+
function join(base, ...segments) {
|
|
5
|
+
if (!base) {
|
|
6
|
+
return "";
|
|
7
|
+
}
|
|
8
|
+
if (segments.length === 0) {
|
|
9
|
+
return base;
|
|
10
|
+
}
|
|
11
|
+
if (base.includes("://")) {
|
|
12
|
+
let url;
|
|
13
|
+
try {
|
|
14
|
+
url = new URL(base);
|
|
15
|
+
}
|
|
16
|
+
catch (_a) {
|
|
17
|
+
return joinPath(base, ...segments);
|
|
18
|
+
}
|
|
19
|
+
const lastSegment = segments[segments.length - 1];
|
|
20
|
+
const shouldPreserveTrailingSlash = lastSegment === null || lastSegment === void 0 ? void 0 : lastSegment.endsWith("/");
|
|
21
|
+
for (const segment of segments) {
|
|
22
|
+
const cleanSegment = trimSlashes(segment);
|
|
23
|
+
if (cleanSegment) {
|
|
24
|
+
url.pathname = joinPathSegments(url.pathname, cleanSegment);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (shouldPreserveTrailingSlash && !url.pathname.endsWith("/")) {
|
|
28
|
+
url.pathname += "/";
|
|
29
|
+
}
|
|
30
|
+
return url.toString();
|
|
31
|
+
}
|
|
32
|
+
return joinPath(base, ...segments);
|
|
33
|
+
}
|
|
34
|
+
function joinPath(base, ...segments) {
|
|
35
|
+
if (segments.length === 0) {
|
|
36
|
+
return base;
|
|
37
|
+
}
|
|
38
|
+
let result = base;
|
|
39
|
+
const lastSegment = segments[segments.length - 1];
|
|
40
|
+
const shouldPreserveTrailingSlash = lastSegment === null || lastSegment === void 0 ? void 0 : lastSegment.endsWith("/");
|
|
41
|
+
for (const segment of segments) {
|
|
42
|
+
const cleanSegment = trimSlashes(segment);
|
|
43
|
+
if (cleanSegment) {
|
|
44
|
+
result = joinPathSegments(result, cleanSegment);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (shouldPreserveTrailingSlash && !result.endsWith("/")) {
|
|
48
|
+
result += "/";
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
function joinPathSegments(left, right) {
|
|
53
|
+
if (left.endsWith("/")) {
|
|
54
|
+
return left + right;
|
|
55
|
+
}
|
|
56
|
+
return `${left}/${right}`;
|
|
57
|
+
}
|
|
58
|
+
function trimSlashes(str) {
|
|
59
|
+
if (!str)
|
|
60
|
+
return str;
|
|
61
|
+
let start = 0;
|
|
62
|
+
let end = str.length;
|
|
63
|
+
if (str.startsWith("/"))
|
|
64
|
+
start = 1;
|
|
65
|
+
if (str.endsWith("/"))
|
|
66
|
+
end = str.length - 1;
|
|
67
|
+
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
68
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toQueryString = toQueryString;
|
|
4
|
+
const defaultQsOptions = {
|
|
5
|
+
arrayFormat: "indices",
|
|
6
|
+
encode: true,
|
|
7
|
+
};
|
|
8
|
+
function encodeValue(value, shouldEncode) {
|
|
9
|
+
if (value === undefined) {
|
|
10
|
+
return "";
|
|
11
|
+
}
|
|
12
|
+
if (value === null) {
|
|
13
|
+
return "";
|
|
14
|
+
}
|
|
15
|
+
const stringValue = String(value);
|
|
16
|
+
return shouldEncode ? encodeURIComponent(stringValue) : stringValue;
|
|
17
|
+
}
|
|
18
|
+
function stringifyObject(obj, prefix = "", options) {
|
|
19
|
+
const parts = [];
|
|
20
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
21
|
+
const fullKey = prefix ? `${prefix}[${key}]` : key;
|
|
22
|
+
if (value === undefined) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (Array.isArray(value)) {
|
|
26
|
+
if (value.length === 0) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const effectiveFormat = options.arrayFormat;
|
|
30
|
+
if (effectiveFormat === "comma") {
|
|
31
|
+
const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
|
|
32
|
+
const encodedValues = value
|
|
33
|
+
.filter((item) => item !== undefined && item !== null)
|
|
34
|
+
.map((item) => encodeValue(item, options.encode));
|
|
35
|
+
if (encodedValues.length > 0) {
|
|
36
|
+
parts.push(`${encodedKey}=${encodedValues.join(",")}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
for (let i = 0; i < value.length; i++) {
|
|
41
|
+
const item = value[i];
|
|
42
|
+
if (item === undefined) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (typeof item === "object" && !Array.isArray(item) && item !== null) {
|
|
46
|
+
const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
|
|
47
|
+
parts.push(...stringifyObject(item, arrayKey, options));
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
|
|
51
|
+
const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
|
|
52
|
+
parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else if (typeof value === "object" && value !== null) {
|
|
58
|
+
if (Object.keys(value).length === 0) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
parts.push(...stringifyObject(value, fullKey, options));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
|
|
65
|
+
parts.push(`${encodedKey}=${encodeValue(value, options.encode)}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return parts;
|
|
69
|
+
}
|
|
70
|
+
function toQueryString(obj, options) {
|
|
71
|
+
if (obj == null || typeof obj !== "object") {
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
const parts = stringifyObject(obj, "", Object.assign(Object.assign({}, defaultQsOptions), options));
|
|
75
|
+
return parts.join("&");
|
|
76
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as core from "../core/index.js";
|
|
2
|
+
export declare class SuwardApiError extends Error {
|
|
3
|
+
readonly statusCode?: number;
|
|
4
|
+
readonly body?: unknown;
|
|
5
|
+
readonly rawResponse?: core.RawResponse;
|
|
6
|
+
readonly cause?: unknown;
|
|
7
|
+
constructor({ message, statusCode, body, rawResponse, cause, }: {
|
|
8
|
+
message?: string;
|
|
9
|
+
statusCode?: number;
|
|
10
|
+
body?: unknown;
|
|
11
|
+
rawResponse?: core.RawResponse;
|
|
12
|
+
cause?: unknown;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SuwardApiError = void 0;
|
|
5
|
+
const json_js_1 = require("../core/json.js");
|
|
6
|
+
class SuwardApiError extends Error {
|
|
7
|
+
constructor({ message, statusCode, body, rawResponse, cause, }) {
|
|
8
|
+
super(buildMessage({ message, statusCode, body }));
|
|
9
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
10
|
+
if (Error.captureStackTrace) {
|
|
11
|
+
Error.captureStackTrace(this, this.constructor);
|
|
12
|
+
}
|
|
13
|
+
this.name = "SuwardApiError";
|
|
14
|
+
this.statusCode = statusCode;
|
|
15
|
+
this.body = body;
|
|
16
|
+
this.rawResponse = rawResponse;
|
|
17
|
+
if (cause != null) {
|
|
18
|
+
this.cause = cause;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.SuwardApiError = SuwardApiError;
|
|
23
|
+
function buildMessage({ message, statusCode, body, }) {
|
|
24
|
+
const lines = [];
|
|
25
|
+
if (message != null) {
|
|
26
|
+
lines.push(message);
|
|
27
|
+
}
|
|
28
|
+
if (statusCode != null) {
|
|
29
|
+
lines.push(`Status code: ${statusCode.toString()}`);
|
|
30
|
+
}
|
|
31
|
+
if (body != null) {
|
|
32
|
+
lines.push(`Body: ${(0, json_js_1.toJson)(body, undefined, 2)}`);
|
|
33
|
+
}
|
|
34
|
+
return lines.join("\n");
|
|
35
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SuwardApiTimeoutError = void 0;
|
|
5
|
+
class SuwardApiTimeoutError extends Error {
|
|
6
|
+
constructor(message, opts) {
|
|
7
|
+
super(message);
|
|
8
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
9
|
+
if (Error.captureStackTrace) {
|
|
10
|
+
Error.captureStackTrace(this, this.constructor);
|
|
11
|
+
}
|
|
12
|
+
this.name = "SuwardApiTimeoutError";
|
|
13
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.cause) != null) {
|
|
14
|
+
this.cause = opts.cause;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.SuwardApiTimeoutError = SuwardApiTimeoutError;
|