@spritz-finance/api-client 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42717,6 +42717,58 @@ declare class SpritzApiClient {
42717
42717
  }
42718
42718
 
42719
42719
  type APIErrorPayload = Record<string, unknown>;
42720
+ /** One field-level cause inside a problem's `errors` array. */
42721
+ type ProblemFieldError = {
42722
+ field: string;
42723
+ message: string;
42724
+ code?: string;
42725
+ };
42726
+ /**
42727
+ * The values the contract documents for `suggestedAction`, left open so a value
42728
+ * the API adds later still parses instead of being silently dropped.
42729
+ */
42730
+ type ProblemSuggestedAction = 'auto_ramp' | 'wait_for_settlement' | (string & {});
42731
+ /**
42732
+ * The API's RFC 9457 problem response.
42733
+ *
42734
+ * Every field is optional because this is parsed defensively from an untrusted
42735
+ * error payload: the contract marks `title` and `status` required, but a
42736
+ * response that omits them should still surface whatever it did send rather
42737
+ * than collapsing to nothing.
42738
+ *
42739
+ * Some fields only appear on certain problems — `realm`/`scope` on some 401s,
42740
+ * `resourceType`/`resourceId` on 404s — so check before reading them. Anything
42741
+ * the API sends that is not modelled here stays readable on `APIError.error`.
42742
+ */
42743
+ type ProblemDetails = {
42744
+ /** Problem type URI, e.g. `urn:problem-type:idempotency-conflict`. */
42745
+ type?: string;
42746
+ title?: string;
42747
+ status?: number;
42748
+ /** Human-facing explanation. Written for integrators, not end users. */
42749
+ detail?: string;
42750
+ instance?: string;
42751
+ /** Machine-readable cause, present when exactly one thing failed. */
42752
+ code?: string;
42753
+ /** The offending request field, present alongside `code`. */
42754
+ field?: string;
42755
+ /** Field-level causes, present when more than one thing failed. */
42756
+ errors?: ProblemFieldError[];
42757
+ retryable?: boolean;
42758
+ retryAfter?: number;
42759
+ suggestedAction?: ProblemSuggestedAction;
42760
+ clearsAt?: string | null;
42761
+ availableAt?: string | null;
42762
+ permanent?: boolean;
42763
+ /** Authentication realm, on some `401` problems. */
42764
+ realm?: string;
42765
+ /** Scope required for the resource, on some `401` problems. */
42766
+ scope?: string;
42767
+ /** Type of the missing resource. The contract requires it on `404`s. */
42768
+ resourceType?: string;
42769
+ /** Identifier of the missing resource. The contract requires it on `404`s. */
42770
+ resourceId?: string;
42771
+ };
42720
42772
  declare class SpritzApiError extends Error {
42721
42773
  readonly timestamp: string;
42722
42774
  readonly headers: Headers;
@@ -42724,8 +42776,20 @@ declare class SpritzApiError extends Error {
42724
42776
  }
42725
42777
  declare class APIError extends Error {
42726
42778
  readonly status: number | undefined;
42779
+ /**
42780
+ * The parsed response payload exactly as the API sent it.
42781
+ *
42782
+ * Kept untouched for logging and for reading fields `ProblemDetails` does
42783
+ * not model. Prefer `problem` for anything you branch on.
42784
+ */
42727
42785
  readonly error: APIErrorPayload | undefined;
42786
+ /** The response's RFC 9457 problem details, when it sent one. */
42787
+ readonly problem?: ProblemDetails;
42728
42788
  readonly headers: Headers | undefined;
42789
+ /** Correlation id from `x-amzn-requestid`, also present in `headers`. */
42790
+ readonly requestId?: string;
42791
+ /** Trace id from `x-amzn-trace-id`, also present in `headers`. */
42792
+ readonly traceId?: string;
42729
42793
  readonly timestamp: string;
42730
42794
  constructor(status: number | undefined, error: APIErrorPayload | undefined, message: string | undefined, headers: Headers | undefined);
42731
42795
  private static makeMessage;
@@ -42778,6 +42842,27 @@ declare class RateLimitError extends APIError {
42778
42842
  declare class InternalServerError extends APIError {
42779
42843
  readonly name = "InternalServerError";
42780
42844
  }
42845
+ declare function isAPIError(error: unknown): error is APIError;
42846
+ /**
42847
+ * Narrows to an `APIError` whose problem carries exactly `type`.
42848
+ *
42849
+ * ```ts
42850
+ * if (hasProblemType(error, 'urn:problem-type:idempotency-conflict')) {
42851
+ * // error.problem.type is narrowed to that literal
42852
+ * }
42853
+ * ```
42854
+ */
42855
+ declare function hasProblemType<T extends string>(error: unknown, type: T): error is APIError & {
42856
+ problem: ProblemDetails & {
42857
+ type: T;
42858
+ };
42859
+ };
42860
+ /** Narrows to an `APIError` whose problem carries exactly `code`. */
42861
+ declare function hasProblemCode<T extends string>(error: unknown, code: T): error is APIError & {
42862
+ problem: ProblemDetails & {
42863
+ code: T;
42864
+ };
42865
+ };
42781
42866
 
42782
- export { APIConnectionError, APIConnectionTimeoutError, APIError, APIUserAbortError, AmountMode, AuthenticationError, BadRequestError, BankAccountSubType, BankAccountType, BillType, CardFeatureType, ConflictError, DebitCardNetwork, Environment, InternalServerError, NotFoundError, OfframpFeatureType, OnrampFeatureType, PayableAccountType, PaymentDeliveryMethod, PaymentNetwork, DirectPaymentStatus as PaymentRequestStatus, PaymentStatus, PermissionDeniedError, RateLimitError, RequirementType, SpritzApiClient, SpritzApiError, UnprocessableEntityError, VirtualCardType, onrampSupportedTokens };
42783
- export type { AccountPayments, AccountPaymentsVariables, AccountPayments_paymentsForAccount, AccountPayments_paymentsForAccount_transaction, AchDebitReturn, AchDebitReturnListQuery, AchDebitReturnListResponse, BankAccount, BankAccountFragment, BankAccountFragment_bankAccountDetails, BankAccountFragment_bankAccountDetails_CanadianBankAccountDetails, BankAccountFragment_bankAccountDetails_USBankAccountDetails, BankAccountFragment_institution, BankAccountFragment_paymentAddresses, BankAccountInput, BankAccountList, BillFragment, BillFragment_billAccountDetails, BillFragment_dataSync, BillFragment_institution, BillFragment_paymentAddresses, BypassKycRequest, CategoryAccess, ClientOptions, CompleteLinkingRequest, CompleteLinkingResponse, CreateBankAccountInput, CreateBankAccountResponse, CreateDepositOptions, CreateDepositRequest, CreateDepositWithReturnRequest, CreateDepositWithReturnResponse, CreateDirectPaymentInput, CreateOnrampPaymentInput, CreatePaymentRequestInput, CreateVirtualAccountInput, CreateWebhookParams, CurrentUser, CurrentUser_me, CurrentUser_verification, CurrentUser_verification_identity, CurrentUser_verification_identity_verificationMetadata, CurrentUser_verification_identity_verificationMetadata_details, DebitCardFragment, DebitCardInput, DeleteBankAccountResponse, DeleteFundingSourceResponse, Deposit, DepositListQuery, DepositListResponse, FullBridgeUser, FundingSource, FundingSourceDepositLimits, GetSolanaPayParams, GetSolanaPayParamsVariables, GetSolanaPayParams_solanaParams, GetSpritzPayParams, GetSpritzPayParamsVariables, GetSpritzPayParams_spritzPayParams, IntegratorWebhook, KycStatus, LinkTokenResponse, OffRampRefundRequest, OffRampRefundResponse, OnRamp, OnRampDetail, OnRampListQuery, OnRampListResponse, OnrampPaymentFragment, OnrampPaymentFragment_depositInstructions, OnrampPayments, OnrampPayments_onrampPayments, OnrampPayments_onrampPayments_depositInstructions, PathParams, PathQuery, PathRequestBody, PathResponse, PayableAccountFragment, PayableAccountFragment_BankAccount, PayableAccountFragment_BankAccount_bankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_CanadianBankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_USBankAccountDetails, PayableAccountFragment_BankAccount_dataSync, PayableAccountFragment_BankAccount_institution, PayableAccountFragment_Bill, PayableAccountFragment_Bill_billAccountDetails, PayableAccountFragment_Bill_dataSync, PayableAccountFragment_Bill_institution, PayableAccountFragment_DebitCard, PayableAccountFragment_DebitCard_dataSync, PayableAccountFragment_DebitCard_institution, PayableAccountFragment_VirtualCard, PayableAccountFragment_VirtualCard_billingInfo, PayableAccountFragment_VirtualCard_billingInfo_address, PayableAccountFragment_VirtualCard_dataSync, PayableAccountFragment_VirtualCard_institution, PayableAccountInstitutionFragment, Payment, PaymentFragment, PaymentFragment_transaction, PaymentLimits, PaymentLimitsResponse, PaymentLimitsVariables, PaymentLimits_paymentLimits, PaymentRequestFragment, PaymentRequestPayment, PaymentRequestPaymentVariables, PaymentRequestPayment_paymentForPaymentRequest, PaymentRequestPayment_paymentForPaymentRequest_transaction, PaymentVariables, Payment_payment, Payment_payment_transaction, PopularBillInstitutions, PopularBillInstitutionsVariables, PopularBillInstitutions_popularUSBillInstitutions, PrepareDepositRequest, PrepareDepositResponse, Requirement, operations as RestApiOperations, paths as RestApiPaths, SearchUSBillInstitutions, SearchUSBillInstitutionsVariables, SearchUSBillInstitutions_searchUSBillInstitutions, TokenBalanceFragment, UpdateWebhookParams, UpdateWebhookSecretResponse, UserAccess, UserAccessCapabilities, UserAccess_bridgeUser, UserAccess_me, UserAccess_verification, UserAccess_verification_identity, UserAccess_verification_identity_verificationMetadata, UserAccess_verification_identity_verificationMetadata_details, UserBankAccounts, UserBankAccounts_bankAccounts, UserBankAccounts_bankAccounts_bankAccountDetails, UserBankAccounts_bankAccounts_bankAccountDetails_CanadianBankAccountDetails, UserBankAccounts_bankAccounts_bankAccountDetails_USBankAccountDetails, UserBankAccounts_bankAccounts_institution, UserBankAccounts_bankAccounts_paymentAddresses, UserBills, UserBills_bills, UserBills_bills_billAccountDetails, UserBills_bills_dataSync, UserBills_bills_institution, UserBills_bills_paymentAddresses, UserDebitCards, UserDebitCards_debitCards, UserFragment, UserPayableAccounts, UserPayableAccounts_payableAccounts, UserPayableAccounts_payableAccounts_BankAccount, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_CanadianBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_USBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_dataSync, UserPayableAccounts_payableAccounts_BankAccount_institution, UserPayableAccounts_payableAccounts_Bill, UserPayableAccounts_payableAccounts_Bill_billAccountDetails, UserPayableAccounts_payableAccounts_Bill_dataSync, UserPayableAccounts_payableAccounts_Bill_institution, UserPayableAccounts_payableAccounts_DebitCard, UserPayableAccounts_payableAccounts_DebitCard_dataSync, UserPayableAccounts_payableAccounts_DebitCard_institution, UserPayableAccounts_payableAccounts_VirtualCard, UserPayableAccounts_payableAccounts_VirtualCard_billingInfo, UserPayableAccounts_payableAccounts_VirtualCard_billingInfo_address, UserPayableAccounts_payableAccounts_VirtualCard_dataSync, UserPayableAccounts_payableAccounts_VirtualCard_institution, UserProfile, UserVerification, UserVerification_verification, UserVerification_verification_identity, UserVerification_verification_identity_user, UserVerification_verification_identity_verificationMetadata, UserVerification_verification_identity_verificationMetadata_details, UserVirtualDebitCard, UserVirtualDebitCard_virtualDebitCard, UserVirtualDebitCard_virtualDebitCard_billingInfo, UserVirtualDebitCard_virtualDebitCard_billingInfo_address, UserVirtualDebitCard_virtualDebitCard_paymentAddresses, VerificationFragment, VerificationFragment_identity, VerificationFragment_identity_verificationMetadata, VerificationFragment_identity_verificationMetadata_details, VerificationSession, VirtualAccountFragment, VirtualAccountFragment_depositInstructions, VirtualAccounts, VirtualAccounts_virtualAccounts, VirtualAccounts_virtualAccounts_depositInstructions, VirtualDebitCardFragment, VirtualDebitCardFragment_billingInfo, VirtualDebitCardFragment_billingInfo_address, VirtualDebitCardFragment_paymentAddresses, WalletTokenBalances, WalletTokenBalancesVariables, WalletTokenBalances_tokenBalances, WebhookEvent };
42867
+ export { APIConnectionError, APIConnectionTimeoutError, APIError, APIUserAbortError, AmountMode, AuthenticationError, BadRequestError, BankAccountSubType, BankAccountType, BillType, CardFeatureType, ConflictError, DebitCardNetwork, Environment, InternalServerError, NotFoundError, OfframpFeatureType, OnrampFeatureType, PayableAccountType, PaymentDeliveryMethod, PaymentNetwork, DirectPaymentStatus as PaymentRequestStatus, PaymentStatus, PermissionDeniedError, RateLimitError, RequirementType, SpritzApiClient, SpritzApiError, UnprocessableEntityError, VirtualCardType, hasProblemCode, hasProblemType, isAPIError, onrampSupportedTokens };
42868
+ export type { AccountPayments, AccountPaymentsVariables, AccountPayments_paymentsForAccount, AccountPayments_paymentsForAccount_transaction, AchDebitReturn, AchDebitReturnListQuery, AchDebitReturnListResponse, BankAccount, BankAccountFragment, BankAccountFragment_bankAccountDetails, BankAccountFragment_bankAccountDetails_CanadianBankAccountDetails, BankAccountFragment_bankAccountDetails_USBankAccountDetails, BankAccountFragment_institution, BankAccountFragment_paymentAddresses, BankAccountInput, BankAccountList, BillFragment, BillFragment_billAccountDetails, BillFragment_dataSync, BillFragment_institution, BillFragment_paymentAddresses, BypassKycRequest, CategoryAccess, ClientOptions, CompleteLinkingRequest, CompleteLinkingResponse, CreateBankAccountInput, CreateBankAccountResponse, CreateDepositOptions, CreateDepositRequest, CreateDepositWithReturnRequest, CreateDepositWithReturnResponse, CreateDirectPaymentInput, CreateOnrampPaymentInput, CreatePaymentRequestInput, CreateVirtualAccountInput, CreateWebhookParams, CurrentUser, CurrentUser_me, CurrentUser_verification, CurrentUser_verification_identity, CurrentUser_verification_identity_verificationMetadata, CurrentUser_verification_identity_verificationMetadata_details, DebitCardFragment, DebitCardInput, DeleteBankAccountResponse, DeleteFundingSourceResponse, Deposit, DepositListQuery, DepositListResponse, FullBridgeUser, FundingSource, FundingSourceDepositLimits, GetSolanaPayParams, GetSolanaPayParamsVariables, GetSolanaPayParams_solanaParams, GetSpritzPayParams, GetSpritzPayParamsVariables, GetSpritzPayParams_spritzPayParams, IntegratorWebhook, KycStatus, LinkTokenResponse, OffRampRefundRequest, OffRampRefundResponse, OnRamp, OnRampDetail, OnRampListQuery, OnRampListResponse, OnrampPaymentFragment, OnrampPaymentFragment_depositInstructions, OnrampPayments, OnrampPayments_onrampPayments, OnrampPayments_onrampPayments_depositInstructions, PathParams, PathQuery, PathRequestBody, PathResponse, PayableAccountFragment, PayableAccountFragment_BankAccount, PayableAccountFragment_BankAccount_bankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_CanadianBankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_USBankAccountDetails, PayableAccountFragment_BankAccount_dataSync, PayableAccountFragment_BankAccount_institution, PayableAccountFragment_Bill, PayableAccountFragment_Bill_billAccountDetails, PayableAccountFragment_Bill_dataSync, PayableAccountFragment_Bill_institution, PayableAccountFragment_DebitCard, PayableAccountFragment_DebitCard_dataSync, PayableAccountFragment_DebitCard_institution, PayableAccountFragment_VirtualCard, PayableAccountFragment_VirtualCard_billingInfo, PayableAccountFragment_VirtualCard_billingInfo_address, PayableAccountFragment_VirtualCard_dataSync, PayableAccountFragment_VirtualCard_institution, PayableAccountInstitutionFragment, Payment, PaymentFragment, PaymentFragment_transaction, PaymentLimits, PaymentLimitsResponse, PaymentLimitsVariables, PaymentLimits_paymentLimits, PaymentRequestFragment, PaymentRequestPayment, PaymentRequestPaymentVariables, PaymentRequestPayment_paymentForPaymentRequest, PaymentRequestPayment_paymentForPaymentRequest_transaction, PaymentVariables, Payment_payment, Payment_payment_transaction, PopularBillInstitutions, PopularBillInstitutionsVariables, PopularBillInstitutions_popularUSBillInstitutions, PrepareDepositRequest, PrepareDepositResponse, ProblemDetails, ProblemFieldError, ProblemSuggestedAction, Requirement, operations as RestApiOperations, paths as RestApiPaths, SearchUSBillInstitutions, SearchUSBillInstitutionsVariables, SearchUSBillInstitutions_searchUSBillInstitutions, TokenBalanceFragment, UpdateWebhookParams, UpdateWebhookSecretResponse, UserAccess, UserAccessCapabilities, UserAccess_bridgeUser, UserAccess_me, UserAccess_verification, UserAccess_verification_identity, UserAccess_verification_identity_verificationMetadata, UserAccess_verification_identity_verificationMetadata_details, UserBankAccounts, UserBankAccounts_bankAccounts, UserBankAccounts_bankAccounts_bankAccountDetails, UserBankAccounts_bankAccounts_bankAccountDetails_CanadianBankAccountDetails, UserBankAccounts_bankAccounts_bankAccountDetails_USBankAccountDetails, UserBankAccounts_bankAccounts_institution, UserBankAccounts_bankAccounts_paymentAddresses, UserBills, UserBills_bills, UserBills_bills_billAccountDetails, UserBills_bills_dataSync, UserBills_bills_institution, UserBills_bills_paymentAddresses, UserDebitCards, UserDebitCards_debitCards, UserFragment, UserPayableAccounts, UserPayableAccounts_payableAccounts, UserPayableAccounts_payableAccounts_BankAccount, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_CanadianBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_USBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_dataSync, UserPayableAccounts_payableAccounts_BankAccount_institution, UserPayableAccounts_payableAccounts_Bill, UserPayableAccounts_payableAccounts_Bill_billAccountDetails, UserPayableAccounts_payableAccounts_Bill_dataSync, UserPayableAccounts_payableAccounts_Bill_institution, UserPayableAccounts_payableAccounts_DebitCard, UserPayableAccounts_payableAccounts_DebitCard_dataSync, UserPayableAccounts_payableAccounts_DebitCard_institution, UserPayableAccounts_payableAccounts_VirtualCard, UserPayableAccounts_payableAccounts_VirtualCard_billingInfo, UserPayableAccounts_payableAccounts_VirtualCard_billingInfo_address, UserPayableAccounts_payableAccounts_VirtualCard_dataSync, UserPayableAccounts_payableAccounts_VirtualCard_institution, UserProfile, UserVerification, UserVerification_verification, UserVerification_verification_identity, UserVerification_verification_identity_user, UserVerification_verification_identity_verificationMetadata, UserVerification_verification_identity_verificationMetadata_details, UserVirtualDebitCard, UserVirtualDebitCard_virtualDebitCard, UserVirtualDebitCard_virtualDebitCard_billingInfo, UserVirtualDebitCard_virtualDebitCard_billingInfo_address, UserVirtualDebitCard_virtualDebitCard_paymentAddresses, VerificationFragment, VerificationFragment_identity, VerificationFragment_identity_verificationMetadata, VerificationFragment_identity_verificationMetadata_details, VerificationSession, VirtualAccountFragment, VirtualAccountFragment_depositInstructions, VirtualAccounts, VirtualAccounts_virtualAccounts, VirtualAccounts_virtualAccounts_depositInstructions, VirtualDebitCardFragment, VirtualDebitCardFragment_billingInfo, VirtualDebitCardFragment_billingInfo_address, VirtualDebitCardFragment_paymentAddresses, WalletTokenBalances, WalletTokenBalancesVariables, WalletTokenBalances_tokenBalances, WebhookEvent };