@tolt/api 0.6.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BaseClient.js +1 -0
- package/dist/Client.d.ts +3 -3
- package/dist/Client.js +3 -3
- package/dist/api/errors/BadRequestError.d.ts +2 -2
- package/dist/api/errors/ConflictError.d.ts +2 -2
- package/dist/api/errors/ContentTooLargeError.d.ts +7 -0
- package/dist/api/errors/ContentTooLargeError.js +17 -0
- package/dist/api/errors/NotFoundError.d.ts +2 -2
- package/dist/api/errors/TooManyRequestsError.d.ts +2 -2
- package/dist/api/errors/UnauthorizedError.d.ts +2 -2
- package/dist/api/errors/index.d.ts +1 -0
- package/dist/api/errors/index.js +1 -0
- package/dist/api/resources/clicks/client/Client.d.ts +16 -8
- package/dist/api/resources/clicks/client/Client.js +93 -68
- package/dist/api/resources/clicks/client/requests/CreateClickRequest.d.ts +28 -0
- package/dist/api/resources/clicks/client/requests/GetClickRequest.d.ts +9 -0
- package/dist/api/resources/clicks/client/requests/ListClicksRequest.d.ts +10 -5
- package/dist/api/resources/clicks/client/requests/index.d.ts +2 -1
- package/dist/api/resources/clicks/types/{CreateClicksResponse.d.ts → CreateClickResponse.d.ts} +1 -1
- package/dist/api/resources/clicks/types/{GetClicksResponse.d.ts → GetClickResponse.d.ts} +1 -1
- package/dist/api/resources/clicks/types/ListClicksRequestOrder.d.ts +1 -0
- package/dist/api/resources/clicks/types/ListClicksRequestOrder.js +1 -0
- package/dist/api/resources/clicks/types/ListClicksRequestSort.d.ts +1 -1
- package/dist/api/resources/clicks/types/ListClicksRequestSort.js +1 -1
- package/dist/api/resources/clicks/types/index.d.ts +2 -3
- package/dist/api/resources/clicks/types/index.js +2 -3
- package/dist/api/resources/commissions/client/Client.d.ts +48 -22
- package/dist/api/resources/commissions/client/Client.js +142 -84
- package/dist/api/resources/commissions/client/requests/ApproveCommissionRequest.d.ts +9 -0
- package/dist/api/resources/commissions/client/requests/BulkApproveCommissionsRequest.d.ts +2 -2
- package/dist/api/resources/commissions/client/requests/BulkDeclineCommissionsRequest.d.ts +2 -2
- package/dist/api/resources/commissions/client/requests/CreateCommissionRequest.d.ts +40 -0
- package/dist/api/resources/commissions/client/requests/CreateCommissionRequest.js +9 -0
- package/dist/api/resources/commissions/client/requests/DeclineCommissionRequest.d.ts +9 -0
- package/dist/api/resources/commissions/client/requests/DeleteCommissionRequest.d.ts +9 -0
- package/dist/api/resources/commissions/client/requests/GetCommissionRequest.d.ts +9 -0
- package/dist/api/resources/commissions/client/requests/ListCommissionsRequest.d.ts +14 -5
- package/dist/api/resources/commissions/client/requests/UpdateCommissionRequest.d.ts +33 -0
- package/dist/api/resources/commissions/client/requests/UpdateCommissionRequest.js +9 -0
- package/dist/api/resources/commissions/client/requests/index.d.ts +6 -5
- package/dist/api/resources/commissions/client/requests/index.js +2 -1
- package/dist/api/resources/commissions/types/{UpdateCommissionsResponse.d.ts → ApproveCommissionResponse.d.ts} +1 -1
- package/dist/api/resources/commissions/types/{DeleteCommissionsResponse.d.ts → CreateCommissionResponse.d.ts} +1 -1
- package/dist/api/resources/commissions/types/{CreateCommissionsResponse.d.ts → DeclineCommissionResponse.d.ts} +1 -1
- package/dist/api/resources/commissions/types/DeleteCommissionResponse.d.ts +6 -0
- package/dist/api/resources/commissions/types/{GetCommissionsResponse.d.ts → GetCommissionResponse.d.ts} +1 -1
- package/dist/api/resources/commissions/types/ListCommissionsRequestOrder.d.ts +1 -0
- package/dist/api/resources/commissions/types/ListCommissionsRequestOrder.js +1 -0
- package/dist/api/resources/commissions/types/ListCommissionsRequestSort.d.ts +1 -1
- package/dist/api/resources/commissions/types/ListCommissionsRequestSort.js +1 -1
- package/dist/api/resources/commissions/types/UpdateCommissionResponse.d.ts +6 -0
- package/dist/api/resources/commissions/types/index.d.ts +6 -7
- package/dist/api/resources/commissions/types/index.js +6 -7
- package/dist/api/resources/customers/client/Client.d.ts +36 -14
- package/dist/api/resources/customers/client/Client.js +120 -74
- package/dist/api/resources/customers/client/requests/CreateCustomerRequest.d.ts +47 -0
- package/dist/api/resources/customers/client/requests/CreateCustomerRequest.js +12 -0
- package/dist/api/resources/customers/client/requests/DeleteCustomerRequest.d.ts +9 -0
- package/dist/api/resources/customers/client/requests/GetCustomerRequest.d.ts +9 -0
- package/dist/api/resources/customers/client/requests/ListCustomersRequest.d.ts +14 -5
- package/dist/api/resources/customers/client/requests/UpdateCustomerRequest.d.ts +44 -0
- package/dist/api/resources/customers/client/requests/UpdateCustomerRequest.js +12 -0
- package/dist/api/resources/customers/client/requests/index.d.ts +4 -4
- package/dist/api/resources/customers/client/requests/index.js +2 -2
- package/dist/api/resources/customers/types/{DeleteCustomersResponse.d.ts → CreateCustomerResponse.d.ts} +1 -1
- package/dist/api/resources/customers/types/{UpdateCustomersResponse.d.ts → DeleteCustomerResponse.d.ts} +1 -1
- package/dist/api/resources/customers/types/{GetCustomersResponse.d.ts → GetCustomerResponse.d.ts} +1 -1
- package/dist/api/resources/customers/types/ListCustomersRequestOrder.d.ts +1 -0
- package/dist/api/resources/customers/types/ListCustomersRequestOrder.js +1 -0
- package/dist/api/resources/customers/types/ListCustomersRequestSort.d.ts +1 -1
- package/dist/api/resources/customers/types/ListCustomersRequestSort.js +1 -1
- package/dist/api/resources/customers/types/ListCustomersRequestStatus.d.ts +1 -0
- package/dist/api/resources/customers/types/ListCustomersRequestStatus.js +1 -0
- package/dist/api/resources/customers/types/{CreateCustomersResponse.d.ts → UpdateCustomerResponse.d.ts} +1 -1
- package/dist/api/resources/customers/types/index.d.ts +4 -4
- package/dist/api/resources/customers/types/index.js +4 -4
- package/dist/api/resources/{embed → embedTokens}/client/Client.d.ts +10 -9
- package/dist/api/resources/{embed → embedTokens}/client/Client.js +11 -8
- package/dist/api/resources/embedTokens/client/requests/CreateEmbedTokenRequest.d.ts +21 -0
- package/dist/api/resources/embedTokens/client/requests/index.d.ts +1 -0
- package/dist/api/resources/embedTokens/exports.d.ts +2 -0
- package/dist/api/resources/{embed → embedTokens}/exports.js +1 -1
- package/dist/api/resources/{embed/types/CreateTokenEmbedResponse.d.ts → embedTokens/types/CreateEmbedTokenResponse.d.ts} +1 -1
- package/dist/api/resources/embedTokens/types/index.d.ts +1 -0
- package/dist/api/resources/embedTokens/types/index.js +1 -0
- package/dist/api/resources/flows/client/Client.d.ts +10 -5
- package/dist/api/resources/flows/client/Client.js +83 -63
- package/dist/api/resources/flows/client/requests/GetFlowRequest.d.ts +9 -0
- package/dist/api/resources/flows/client/requests/ListFlowsRequest.d.ts +14 -6
- package/dist/api/resources/flows/client/requests/index.d.ts +1 -1
- package/dist/api/resources/flows/types/{GetFlowsResponse.d.ts → GetFlowResponse.d.ts} +1 -1
- package/dist/api/resources/flows/types/ListFlowsRequestOrder.d.ts +1 -0
- package/dist/api/resources/flows/types/ListFlowsRequestOrder.js +1 -0
- package/dist/api/resources/flows/types/ListFlowsRequestSort.d.ts +1 -1
- package/dist/api/resources/flows/types/ListFlowsRequestSort.js +1 -1
- package/dist/api/resources/flows/types/index.d.ts +1 -2
- package/dist/api/resources/flows/types/index.js +1 -2
- package/dist/api/resources/groups/client/Client.d.ts +10 -5
- package/dist/api/resources/groups/client/Client.js +80 -60
- package/dist/api/resources/groups/client/requests/GetGroupRequest.d.ts +9 -0
- package/dist/api/resources/groups/client/requests/ListGroupsRequest.d.ts +11 -6
- package/dist/api/resources/groups/client/requests/index.d.ts +1 -1
- package/dist/api/resources/groups/types/{GetGroupsResponse.d.ts → GetGroupResponse.d.ts} +1 -1
- package/dist/api/resources/groups/types/ListGroupsRequestOrder.d.ts +1 -0
- package/dist/api/resources/groups/types/ListGroupsRequestOrder.js +1 -0
- package/dist/api/resources/groups/types/ListGroupsRequestSort.d.ts +1 -1
- package/dist/api/resources/groups/types/ListGroupsRequestSort.js +1 -1
- package/dist/api/resources/groups/types/index.d.ts +1 -2
- package/dist/api/resources/groups/types/index.js +1 -2
- package/dist/api/resources/index.d.ts +3 -3
- package/dist/api/resources/index.js +3 -3
- package/dist/api/resources/links/client/Client.d.ts +28 -17
- package/dist/api/resources/links/client/Client.js +111 -75
- package/dist/api/resources/links/client/requests/CreateLinkRequest.d.ts +16 -0
- package/dist/api/resources/links/client/requests/DeleteLinkRequest.d.ts +9 -0
- package/dist/api/resources/links/client/requests/{GetByParamValueLinksRequest.d.ts → GetLinkByParamValueRequest.d.ts} +1 -1
- package/dist/api/resources/links/client/requests/GetLinkRequest.d.ts +9 -0
- package/dist/api/resources/links/client/requests/ListLinksRequest.d.ts +12 -5
- package/dist/api/resources/links/client/requests/UpdateLinkRequest.d.ts +15 -0
- package/dist/api/resources/links/client/requests/index.d.ts +5 -5
- package/dist/api/resources/links/types/{DeleteLinksResponse.d.ts → CreateLinkResponse.d.ts} +1 -1
- package/dist/api/resources/links/types/{CreateLinksResponse.d.ts → DeleteLinkResponse.d.ts} +1 -1
- package/dist/api/resources/links/types/GetLinkByParamValueResponse.d.ts +6 -0
- package/dist/api/resources/links/types/{GetLinksResponse.d.ts → GetLinkResponse.d.ts} +1 -1
- package/dist/api/resources/links/types/ListLinksRequestOrder.d.ts +1 -0
- package/dist/api/resources/links/types/ListLinksRequestOrder.js +1 -0
- package/dist/api/resources/links/types/ListLinksRequestSort.d.ts +1 -1
- package/dist/api/resources/links/types/ListLinksRequestSort.js +1 -1
- package/dist/api/resources/links/types/{UpdateLinksResponse.d.ts → UpdateLinkResponse.d.ts} +1 -1
- package/dist/api/resources/links/types/index.d.ts +5 -5
- package/dist/api/resources/links/types/index.js +5 -5
- package/dist/api/resources/partners/client/Client.d.ts +52 -24
- package/dist/api/resources/partners/client/Client.js +140 -85
- package/dist/api/resources/partners/client/requests/ApprovePartnerRequest.d.ts +9 -0
- package/dist/api/resources/partners/client/requests/BulkApprovePartnersRequest.d.ts +2 -2
- package/dist/api/resources/partners/client/requests/BulkRejectPartnersRequest.d.ts +4 -2
- package/dist/api/resources/partners/client/requests/CreatePartnerRequest.d.ts +59 -0
- package/dist/api/resources/partners/client/requests/CreatePartnerRequest.js +9 -0
- package/dist/api/resources/partners/client/requests/GetPartnerRequest.d.ts +9 -0
- package/dist/api/resources/partners/client/requests/ListPartnersRequest.d.ts +11 -5
- package/dist/api/resources/partners/client/requests/RejectPartnerRequest.d.ts +11 -0
- package/dist/api/resources/partners/client/requests/SuspendPartnerRequest.d.ts +11 -0
- package/dist/api/resources/partners/client/requests/UpdatePartnerRequest.d.ts +24 -0
- package/dist/api/resources/partners/client/requests/index.d.ts +6 -6
- package/dist/api/resources/partners/client/requests/index.js +1 -1
- package/dist/api/resources/partners/types/{RejectPartnersResponse.d.ts → ApprovePartnerResponse.d.ts} +1 -1
- package/dist/api/resources/partners/types/{CreatePartnersResponse.d.ts → CreatePartnerResponse.d.ts} +1 -1
- package/dist/api/resources/partners/types/{GetPartnersResponse.d.ts → GetPartnerResponse.d.ts} +1 -1
- package/dist/api/resources/partners/types/ListPartnersRequestOrder.d.ts +1 -0
- package/dist/api/resources/partners/types/ListPartnersRequestOrder.js +1 -0
- package/dist/api/resources/partners/types/ListPartnersRequestSort.d.ts +1 -1
- package/dist/api/resources/partners/types/ListPartnersRequestSort.js +1 -1
- package/dist/api/resources/partners/types/ListPartnersRequestStatus.d.ts +1 -0
- package/dist/api/resources/partners/types/ListPartnersRequestStatus.js +1 -0
- package/dist/api/resources/partners/types/{UpdatePartnersResponse.d.ts → RejectPartnerResponse.d.ts} +1 -1
- package/dist/api/resources/partners/types/{ApprovePartnersResponse.d.ts → SuspendPartnerResponse.d.ts} +1 -1
- package/dist/api/resources/partners/types/{SuspendPartnersResponse.d.ts → UpdatePartnerResponse.d.ts} +1 -1
- package/dist/api/resources/partners/types/index.d.ts +6 -6
- package/dist/api/resources/partners/types/index.js +6 -6
- package/dist/api/resources/programs/client/Client.d.ts +10 -5
- package/dist/api/resources/programs/client/Client.js +78 -58
- package/dist/api/resources/programs/client/requests/GetProgramRequest.d.ts +9 -0
- package/dist/api/resources/programs/client/requests/ListProgramsRequest.d.ts +8 -5
- package/dist/api/resources/programs/client/requests/index.d.ts +1 -1
- package/dist/api/resources/programs/types/{GetProgramsResponse.d.ts → GetProgramResponse.d.ts} +1 -1
- package/dist/api/resources/programs/types/ListProgramsRequestOrder.d.ts +1 -0
- package/dist/api/resources/programs/types/ListProgramsRequestOrder.js +1 -0
- package/dist/api/resources/programs/types/ListProgramsRequestSort.d.ts +1 -1
- package/dist/api/resources/programs/types/ListProgramsRequestSort.js +1 -1
- package/dist/api/resources/programs/types/index.d.ts +1 -1
- package/dist/api/resources/programs/types/index.js +1 -1
- package/dist/api/resources/promotionCodes/client/Client.d.ts +36 -15
- package/dist/api/resources/promotionCodes/client/Client.js +121 -72
- package/dist/api/resources/promotionCodes/client/requests/CreatePromotionCodeRequest.d.ts +27 -0
- package/dist/api/resources/promotionCodes/client/requests/CreatePromotionCodeRequest.js +9 -0
- package/dist/api/resources/promotionCodes/client/requests/DeletePromotionCodeRequest.d.ts +9 -0
- package/dist/api/resources/promotionCodes/client/requests/GetPromotionCodeRequest.d.ts +9 -0
- package/dist/api/resources/promotionCodes/client/requests/ListPromotionCodesRequest.d.ts +11 -5
- package/dist/api/resources/promotionCodes/client/requests/UpdatePromotionCodeRequest.d.ts +26 -0
- package/dist/api/resources/promotionCodes/client/requests/UpdatePromotionCodeRequest.js +9 -0
- package/dist/api/resources/promotionCodes/client/requests/index.d.ts +4 -4
- package/dist/api/resources/promotionCodes/client/requests/index.js +2 -2
- package/dist/api/resources/promotionCodes/types/{CreatePromotionCodesResponse.d.ts → CreatePromotionCodeResponse.d.ts} +1 -1
- package/dist/api/resources/promotionCodes/types/{DeletePromotionCodesResponse.d.ts → DeletePromotionCodeResponse.d.ts} +1 -1
- package/dist/api/resources/promotionCodes/types/{GetPromotionCodesResponse.d.ts → GetPromotionCodeResponse.d.ts} +1 -1
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestOrder.d.ts +1 -0
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestOrder.js +1 -0
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestSort.d.ts +1 -1
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestSort.js +1 -1
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestType.d.ts +1 -0
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestType.js +1 -0
- package/dist/api/resources/promotionCodes/types/{UpdatePromotionCodesResponse.d.ts → UpdatePromotionCodeResponse.d.ts} +1 -1
- package/dist/api/resources/promotionCodes/types/index.d.ts +4 -4
- package/dist/api/resources/promotionCodes/types/index.js +4 -4
- package/dist/api/resources/reports/client/Client.d.ts +27 -14
- package/dist/api/resources/reports/client/Client.js +182 -118
- package/dist/api/resources/reports/client/requests/ReportsCustomersRequest.d.ts +12 -0
- package/dist/api/resources/reports/client/requests/ReportsLinksRequest.d.ts +23 -0
- package/dist/api/resources/reports/client/requests/ReportsOverviewRequest.d.ts +12 -0
- package/dist/api/resources/reports/client/requests/ReportsPartnersRequest.d.ts +23 -0
- package/dist/api/resources/reports/client/requests/ReportsTimeseriesRequest.d.ts +17 -0
- package/dist/api/resources/reports/client/requests/index.d.ts +5 -5
- package/dist/api/resources/reports/types/LinksReportsRequestOrder.d.ts +1 -0
- package/dist/api/resources/reports/types/LinksReportsRequestOrder.js +1 -0
- package/dist/api/resources/reports/types/LinksReportsRequestSort.d.ts +1 -0
- package/dist/api/resources/reports/types/LinksReportsRequestSort.js +1 -0
- package/dist/api/resources/reports/types/PartnersReportsRequestOrder.d.ts +1 -0
- package/dist/api/resources/reports/types/PartnersReportsRequestOrder.js +1 -0
- package/dist/api/resources/reports/types/PartnersReportsRequestSort.d.ts +1 -0
- package/dist/api/resources/reports/types/PartnersReportsRequestSort.js +1 -0
- package/dist/api/resources/reports/types/{CustomerStatsReportsResponse.d.ts → ReportsCustomersResponse.d.ts} +1 -1
- package/dist/api/resources/reports/types/{LinksReportsResponse.d.ts → ReportsLinksResponse.d.ts} +1 -1
- package/dist/api/resources/reports/types/{OverviewReportsResponse.d.ts → ReportsOverviewResponse.d.ts} +1 -1
- package/dist/api/resources/reports/types/{PartnersReportsResponse.d.ts → ReportsPartnersResponse.d.ts} +1 -1
- package/dist/api/resources/reports/types/{TimeseriesReportsResponse.d.ts → ReportsTimeseriesResponse.d.ts} +1 -1
- package/dist/api/resources/reports/types/TimeseriesReportsRequestGranularity.d.ts +1 -0
- package/dist/api/resources/reports/types/TimeseriesReportsRequestGranularity.js +1 -0
- package/dist/api/resources/reports/types/index.d.ts +5 -5
- package/dist/api/resources/reports/types/index.js +5 -5
- package/dist/api/resources/transactions/client/Client.d.ts +43 -21
- package/dist/api/resources/transactions/client/Client.js +132 -80
- package/dist/api/resources/transactions/client/requests/CreateTransactionRequest.d.ts +34 -0
- package/dist/api/resources/transactions/client/requests/DeleteTransactionRequest.d.ts +9 -0
- package/dist/api/resources/transactions/client/requests/GetTransactionRequest.d.ts +9 -0
- package/dist/api/resources/transactions/client/requests/ListTransactionsRequest.d.ts +12 -5
- package/dist/api/resources/transactions/client/requests/RefundTransactionRequest.d.ts +9 -0
- package/dist/api/resources/transactions/client/requests/RerunTransactionFlowsRequest.d.ts +9 -0
- package/dist/api/resources/transactions/client/requests/UpdateTransactionRequest.d.ts +31 -0
- package/dist/api/resources/transactions/client/requests/index.d.ts +6 -6
- package/dist/api/resources/transactions/types/{CreateTransactionsResponse.d.ts → CreateTransactionResponse.d.ts} +1 -1
- package/dist/api/resources/transactions/types/{DeleteTransactionsResponse.d.ts → DeleteTransactionResponse.d.ts} +1 -1
- package/dist/api/resources/transactions/types/{GetTransactionsResponse.d.ts → GetTransactionResponse.d.ts} +1 -1
- package/dist/api/resources/transactions/types/ListTransactionsRequestOrder.d.ts +1 -0
- package/dist/api/resources/transactions/types/ListTransactionsRequestOrder.js +1 -0
- package/dist/api/resources/transactions/types/ListTransactionsRequestSort.d.ts +1 -1
- package/dist/api/resources/transactions/types/ListTransactionsRequestSort.js +1 -1
- package/dist/api/resources/transactions/types/{RefundTransactionsResponse.d.ts → RefundTransactionResponse.d.ts} +1 -1
- package/dist/api/resources/transactions/types/{RerunFlowsTransactionsResponse.d.ts → RerunTransactionFlowsResponse.d.ts} +1 -1
- package/dist/api/resources/transactions/types/UpdateTransactionResponse.d.ts +6 -0
- package/dist/api/resources/transactions/types/index.d.ts +6 -6
- package/dist/api/resources/transactions/types/index.js +6 -6
- package/dist/api/types/Commission.d.ts +1 -1
- package/dist/api/types/Customer.d.ts +2 -2
- package/dist/api/types/{Error_.d.ts → ErrorResponse.d.ts} +5 -4
- package/dist/api/types/{Error_.js → ErrorResponse.js} +5 -4
- package/dist/api/types/index.d.ts +1 -1
- package/dist/api/types/index.js +1 -1
- package/dist/core/exports.d.ts +1 -0
- package/dist/core/exports.js +1 -0
- package/dist/core/fetcher/Fetcher.js +35 -4
- package/dist/core/fetcher/getErrorResponseBody.js +21 -8
- package/dist/core/fetcher/getResponseBody.d.ts +16 -0
- package/dist/core/fetcher/getResponseBody.js +26 -22
- package/dist/core/fetcher/makePassthroughRequest.js +18 -2
- package/dist/core/fetcher/makeRequest.d.ts +6 -1
- package/dist/core/fetcher/makeRequest.js +45 -13
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -1
- package/dist/core/fetcher/requestWithRetries.js +23 -2
- package/dist/core/fetcher/signals.d.ts +1 -0
- package/dist/core/fetcher/signals.js +1 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +2 -0
- package/dist/core/pagination/Page.d.ts +33 -0
- package/dist/core/pagination/Page.js +49 -0
- package/dist/core/pagination/exports.d.ts +1 -0
- package/dist/core/pagination/exports.js +1 -0
- package/dist/core/pagination/index.d.ts +1 -0
- package/dist/core/pagination/index.js +1 -0
- package/dist/core/url/encodePathParam.d.ts +3 -1
- package/dist/core/url/encodePathParam.js +8 -2
- package/dist/core/utils/index.d.ts +1 -0
- package/dist/core/utils/index.js +1 -0
- package/dist/core/utils/setObjectProperty.d.ts +12 -0
- package/dist/core/utils/setObjectProperty.js +45 -0
- package/dist/environments.d.ts +2 -2
- package/dist/environments.js +1 -1
- package/dist/errors/ToltApiError.js +15 -1
- package/package.json +7 -2
- package/dist/api/resources/clicks/client/requests/GetClicksRequest.d.ts +0 -9
- package/dist/api/resources/clicks/types/CreateClicksRequest.d.ts +0 -1
- package/dist/api/resources/commissions/client/requests/ApproveCommissionsRequest.d.ts +0 -9
- package/dist/api/resources/commissions/client/requests/DeclineCommissionsRequest.d.ts +0 -9
- package/dist/api/resources/commissions/client/requests/DeleteCommissionsRequest.d.ts +0 -9
- package/dist/api/resources/commissions/client/requests/GetCommissionsRequest.d.ts +0 -9
- package/dist/api/resources/commissions/client/requests/UpdateCommissionsRequest.d.ts +0 -18
- package/dist/api/resources/commissions/types/ApproveCommissionsResponse.d.ts +0 -6
- package/dist/api/resources/commissions/types/CreateCommissionsRequest.d.ts +0 -1
- package/dist/api/resources/commissions/types/DeclineCommissionsResponse.d.ts +0 -6
- package/dist/api/resources/customers/client/requests/CreateCustomersRequest.d.ts +0 -29
- package/dist/api/resources/customers/client/requests/CreateCustomersRequest.js +0 -11
- package/dist/api/resources/customers/client/requests/DeleteCustomersRequest.d.ts +0 -9
- package/dist/api/resources/customers/client/requests/GetCustomersRequest.d.ts +0 -9
- package/dist/api/resources/customers/client/requests/UpdateCustomersRequest.d.ts +0 -31
- package/dist/api/resources/customers/client/requests/UpdateCustomersRequest.js +0 -11
- package/dist/api/resources/embed/client/requests/CreateTokenEmbedRequest.d.ts +0 -14
- package/dist/api/resources/embed/client/requests/index.d.ts +0 -1
- package/dist/api/resources/embed/exports.d.ts +0 -2
- package/dist/api/resources/embed/types/index.d.ts +0 -1
- package/dist/api/resources/embed/types/index.js +0 -1
- package/dist/api/resources/flows/client/requests/GetFlowsRequest.d.ts +0 -9
- package/dist/api/resources/flows/types/ListFlowsRequestActive.d.ts +0 -5
- package/dist/api/resources/flows/types/ListFlowsRequestActive.js +0 -5
- package/dist/api/resources/groups/client/requests/GetGroupsRequest.d.ts +0 -9
- package/dist/api/resources/groups/types/ListGroupsRequestDefault.d.ts +0 -5
- package/dist/api/resources/groups/types/ListGroupsRequestDefault.js +0 -5
- package/dist/api/resources/links/client/requests/CreateLinksRequest.d.ts +0 -12
- package/dist/api/resources/links/client/requests/DeleteLinksRequest.d.ts +0 -9
- package/dist/api/resources/links/client/requests/GetLinksRequest.d.ts +0 -9
- package/dist/api/resources/links/client/requests/UpdateLinksRequest.d.ts +0 -11
- package/dist/api/resources/links/types/GetByParamValueLinksResponse.d.ts +0 -6
- package/dist/api/resources/partners/client/requests/ApprovePartnersRequest.d.ts +0 -9
- package/dist/api/resources/partners/client/requests/CreatePartnersRequest.d.ts +0 -45
- package/dist/api/resources/partners/client/requests/CreatePartnersRequest.js +0 -8
- package/dist/api/resources/partners/client/requests/GetPartnersRequest.d.ts +0 -9
- package/dist/api/resources/partners/client/requests/RejectPartnersRequest.d.ts +0 -10
- package/dist/api/resources/partners/client/requests/SuspendPartnersRequest.d.ts +0 -10
- package/dist/api/resources/partners/client/requests/UpdatePartnersRequest.d.ts +0 -16
- package/dist/api/resources/programs/client/requests/GetProgramsRequest.d.ts +0 -9
- package/dist/api/resources/promotionCodes/client/requests/CreatePromotionCodesRequest.d.ts +0 -20
- package/dist/api/resources/promotionCodes/client/requests/CreatePromotionCodesRequest.js +0 -8
- package/dist/api/resources/promotionCodes/client/requests/DeletePromotionCodesRequest.d.ts +0 -9
- package/dist/api/resources/promotionCodes/client/requests/GetPromotionCodesRequest.d.ts +0 -9
- package/dist/api/resources/promotionCodes/client/requests/UpdatePromotionCodesRequest.d.ts +0 -19
- package/dist/api/resources/promotionCodes/client/requests/UpdatePromotionCodesRequest.js +0 -8
- package/dist/api/resources/reports/client/requests/CustomerStatsReportsRequest.d.ts +0 -9
- package/dist/api/resources/reports/client/requests/LinksReportsRequest.d.ts +0 -15
- package/dist/api/resources/reports/client/requests/OverviewReportsRequest.d.ts +0 -9
- package/dist/api/resources/reports/client/requests/PartnersReportsRequest.d.ts +0 -15
- package/dist/api/resources/reports/client/requests/TimeseriesReportsRequest.d.ts +0 -12
- package/dist/api/resources/transactions/client/requests/CreateTransactionsRequest.d.ts +0 -20
- package/dist/api/resources/transactions/client/requests/DeleteTransactionsRequest.d.ts +0 -9
- package/dist/api/resources/transactions/client/requests/GetTransactionsRequest.d.ts +0 -9
- package/dist/api/resources/transactions/client/requests/RefundTransactionsRequest.d.ts +0 -9
- package/dist/api/resources/transactions/client/requests/RerunFlowsTransactionsRequest.d.ts +0 -9
- package/dist/api/resources/transactions/client/requests/UpdateTransactionsRequest.d.ts +0 -20
- package/dist/api/resources/transactions/types/RerunFlowsTransactionsResponse.js +0 -2
- package/dist/api/resources/transactions/types/UpdateTransactionsResponse.d.ts +0 -6
- package/dist/api/resources/transactions/types/UpdateTransactionsResponse.js +0 -2
- /package/dist/api/resources/clicks/client/requests/{GetClicksRequest.js → CreateClickRequest.js} +0 -0
- /package/dist/api/resources/clicks/{types/CreateClicksRequest.js → client/requests/GetClickRequest.js} +0 -0
- /package/dist/api/resources/clicks/types/{CreateClicksResponse.js → CreateClickResponse.js} +0 -0
- /package/dist/api/resources/clicks/types/{GetClicksResponse.js → GetClickResponse.js} +0 -0
- /package/dist/api/resources/commissions/client/requests/{ApproveCommissionsRequest.js → ApproveCommissionRequest.js} +0 -0
- /package/dist/api/resources/commissions/client/requests/{DeclineCommissionsRequest.js → DeclineCommissionRequest.js} +0 -0
- /package/dist/api/resources/commissions/client/requests/{DeleteCommissionsRequest.js → DeleteCommissionRequest.js} +0 -0
- /package/dist/api/resources/commissions/client/requests/{GetCommissionsRequest.js → GetCommissionRequest.js} +0 -0
- /package/dist/api/resources/commissions/{client/requests/UpdateCommissionsRequest.js → types/ApproveCommissionResponse.js} +0 -0
- /package/dist/api/resources/commissions/types/{ApproveCommissionsResponse.js → CreateCommissionResponse.js} +0 -0
- /package/dist/api/resources/commissions/types/{CreateCommissionsRequest.js → DeclineCommissionResponse.js} +0 -0
- /package/dist/api/resources/commissions/types/{CreateCommissionsResponse.js → DeleteCommissionResponse.js} +0 -0
- /package/dist/api/resources/commissions/types/{DeclineCommissionsResponse.js → GetCommissionResponse.js} +0 -0
- /package/dist/api/resources/commissions/types/{DeleteCommissionsResponse.js → UpdateCommissionResponse.js} +0 -0
- /package/dist/api/resources/{commissions/types/GetCommissionsResponse.js → customers/client/requests/DeleteCustomerRequest.js} +0 -0
- /package/dist/api/resources/{commissions/types/UpdateCommissionsResponse.js → customers/client/requests/GetCustomerRequest.js} +0 -0
- /package/dist/api/resources/customers/{client/requests/DeleteCustomersRequest.js → types/CreateCustomerResponse.js} +0 -0
- /package/dist/api/resources/customers/{client/requests/GetCustomersRequest.js → types/DeleteCustomerResponse.js} +0 -0
- /package/dist/api/resources/customers/types/{CreateCustomersResponse.js → GetCustomerResponse.js} +0 -0
- /package/dist/api/resources/customers/types/{DeleteCustomersResponse.js → UpdateCustomerResponse.js} +0 -0
- /package/dist/api/resources/{embed → embedTokens}/client/index.d.ts +0 -0
- /package/dist/api/resources/{embed → embedTokens}/client/index.js +0 -0
- /package/dist/api/resources/{customers/types/GetCustomersResponse.js → embedTokens/client/requests/CreateEmbedTokenRequest.js} +0 -0
- /package/dist/api/resources/{embed → embedTokens}/client/requests/index.js +0 -0
- /package/dist/api/resources/{embed → embedTokens}/index.d.ts +0 -0
- /package/dist/api/resources/{embed → embedTokens}/index.js +0 -0
- /package/dist/api/resources/{customers/types/UpdateCustomersResponse.js → embedTokens/types/CreateEmbedTokenResponse.js} +0 -0
- /package/dist/api/resources/{embed/client/requests/CreateTokenEmbedRequest.js → flows/client/requests/GetFlowRequest.js} +0 -0
- /package/dist/api/resources/{embed/types/CreateTokenEmbedResponse.js → flows/types/GetFlowResponse.js} +0 -0
- /package/dist/api/resources/{flows/client/requests/GetFlowsRequest.js → groups/client/requests/GetGroupRequest.js} +0 -0
- /package/dist/api/resources/{flows/types/GetFlowsResponse.js → groups/types/GetGroupResponse.js} +0 -0
- /package/dist/api/resources/{groups/client/requests/GetGroupsRequest.js → links/client/requests/CreateLinkRequest.js} +0 -0
- /package/dist/api/resources/{groups/types/GetGroupsResponse.js → links/client/requests/DeleteLinkRequest.js} +0 -0
- /package/dist/api/resources/links/client/requests/{CreateLinksRequest.js → GetLinkByParamValueRequest.js} +0 -0
- /package/dist/api/resources/links/client/requests/{DeleteLinksRequest.js → GetLinkRequest.js} +0 -0
- /package/dist/api/resources/links/client/requests/{GetByParamValueLinksRequest.js → UpdateLinkRequest.js} +0 -0
- /package/dist/api/resources/links/{client/requests/GetLinksRequest.js → types/CreateLinkResponse.js} +0 -0
- /package/dist/api/resources/links/{client/requests/UpdateLinksRequest.js → types/DeleteLinkResponse.js} +0 -0
- /package/dist/api/resources/links/types/{CreateLinksResponse.js → GetLinkByParamValueResponse.js} +0 -0
- /package/dist/api/resources/links/types/{DeleteLinksResponse.js → GetLinkResponse.js} +0 -0
- /package/dist/api/resources/links/types/{GetByParamValueLinksResponse.js → UpdateLinkResponse.js} +0 -0
- /package/dist/api/resources/{links/types/GetLinksResponse.js → partners/client/requests/ApprovePartnerRequest.js} +0 -0
- /package/dist/api/resources/{links/types/UpdateLinksResponse.js → partners/client/requests/GetPartnerRequest.js} +0 -0
- /package/dist/api/resources/partners/client/requests/{ApprovePartnersRequest.js → RejectPartnerRequest.js} +0 -0
- /package/dist/api/resources/partners/client/requests/{GetPartnersRequest.js → SuspendPartnerRequest.js} +0 -0
- /package/dist/api/resources/partners/client/requests/{RejectPartnersRequest.js → UpdatePartnerRequest.js} +0 -0
- /package/dist/api/resources/partners/{client/requests/SuspendPartnersRequest.js → types/ApprovePartnerResponse.js} +0 -0
- /package/dist/api/resources/partners/{client/requests/UpdatePartnersRequest.js → types/CreatePartnerResponse.js} +0 -0
- /package/dist/api/resources/partners/types/{ApprovePartnersResponse.js → GetPartnerResponse.js} +0 -0
- /package/dist/api/resources/partners/types/{CreatePartnersResponse.js → RejectPartnerResponse.js} +0 -0
- /package/dist/api/resources/partners/types/{GetPartnersResponse.js → SuspendPartnerResponse.js} +0 -0
- /package/dist/api/resources/partners/types/{RejectPartnersResponse.js → UpdatePartnerResponse.js} +0 -0
- /package/dist/api/resources/{partners/types/SuspendPartnersResponse.js → programs/client/requests/GetProgramRequest.js} +0 -0
- /package/dist/api/resources/{partners/types/UpdatePartnersResponse.js → programs/types/GetProgramResponse.js} +0 -0
- /package/dist/api/resources/{programs/client/requests/GetProgramsRequest.js → promotionCodes/client/requests/DeletePromotionCodeRequest.js} +0 -0
- /package/dist/api/resources/{programs/types/GetProgramsResponse.js → promotionCodes/client/requests/GetPromotionCodeRequest.js} +0 -0
- /package/dist/api/resources/promotionCodes/{client/requests/DeletePromotionCodesRequest.js → types/CreatePromotionCodeResponse.js} +0 -0
- /package/dist/api/resources/promotionCodes/{client/requests/GetPromotionCodesRequest.js → types/DeletePromotionCodeResponse.js} +0 -0
- /package/dist/api/resources/promotionCodes/types/{CreatePromotionCodesResponse.js → GetPromotionCodeResponse.js} +0 -0
- /package/dist/api/resources/promotionCodes/types/{DeletePromotionCodesResponse.js → UpdatePromotionCodeResponse.js} +0 -0
- /package/dist/api/resources/{promotionCodes/types/GetPromotionCodesResponse.js → reports/client/requests/ReportsCustomersRequest.js} +0 -0
- /package/dist/api/resources/{promotionCodes/types/UpdatePromotionCodesResponse.js → reports/client/requests/ReportsLinksRequest.js} +0 -0
- /package/dist/api/resources/reports/client/requests/{CustomerStatsReportsRequest.js → ReportsOverviewRequest.js} +0 -0
- /package/dist/api/resources/reports/client/requests/{LinksReportsRequest.js → ReportsPartnersRequest.js} +0 -0
- /package/dist/api/resources/reports/client/requests/{OverviewReportsRequest.js → ReportsTimeseriesRequest.js} +0 -0
- /package/dist/api/resources/reports/{client/requests/PartnersReportsRequest.js → types/ReportsCustomersResponse.js} +0 -0
- /package/dist/api/resources/reports/{client/requests/TimeseriesReportsRequest.js → types/ReportsLinksResponse.js} +0 -0
- /package/dist/api/resources/reports/types/{CustomerStatsReportsResponse.js → ReportsOverviewResponse.js} +0 -0
- /package/dist/api/resources/reports/types/{LinksReportsResponse.js → ReportsPartnersResponse.js} +0 -0
- /package/dist/api/resources/reports/types/{OverviewReportsResponse.js → ReportsTimeseriesResponse.js} +0 -0
- /package/dist/api/resources/{reports/types/PartnersReportsResponse.js → transactions/client/requests/CreateTransactionRequest.js} +0 -0
- /package/dist/api/resources/{reports/types/TimeseriesReportsResponse.js → transactions/client/requests/DeleteTransactionRequest.js} +0 -0
- /package/dist/api/resources/transactions/client/requests/{CreateTransactionsRequest.js → GetTransactionRequest.js} +0 -0
- /package/dist/api/resources/transactions/client/requests/{DeleteTransactionsRequest.js → RefundTransactionRequest.js} +0 -0
- /package/dist/api/resources/transactions/client/requests/{GetTransactionsRequest.js → RerunTransactionFlowsRequest.js} +0 -0
- /package/dist/api/resources/transactions/client/requests/{RefundTransactionsRequest.js → UpdateTransactionRequest.js} +0 -0
- /package/dist/api/resources/transactions/{client/requests/RerunFlowsTransactionsRequest.js → types/CreateTransactionResponse.js} +0 -0
- /package/dist/api/resources/transactions/{client/requests/UpdateTransactionsRequest.js → types/DeleteTransactionResponse.js} +0 -0
- /package/dist/api/resources/transactions/types/{CreateTransactionsResponse.js → GetTransactionResponse.js} +0 -0
- /package/dist/api/resources/transactions/types/{DeleteTransactionsResponse.js → RefundTransactionResponse.js} +0 -0
- /package/dist/api/resources/transactions/types/{GetTransactionsResponse.js → RerunTransactionFlowsResponse.js} +0 -0
- /package/dist/api/resources/transactions/types/{RefundTransactionsResponse.js → UpdateTransactionResponse.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
/**
|
|
2
|
+
/** Timestamp to order and page by: created_at follows creation order, updated_at follows each item's most recent change. */
|
|
3
3
|
export const ListTransactionsRequestSort = {
|
|
4
4
|
CreatedAt: "created_at",
|
|
5
5
|
UpdatedAt: "updated_at",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
1
|
+
export * from "./CreateTransactionResponse.js";
|
|
2
|
+
export * from "./DeleteTransactionResponse.js";
|
|
3
|
+
export * from "./GetTransactionResponse.js";
|
|
4
4
|
export * from "./ListTransactionsRequestOrder.js";
|
|
5
5
|
export * from "./ListTransactionsRequestSort.js";
|
|
6
6
|
export * from "./ListTransactionsResponse.js";
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
7
|
+
export * from "./RefundTransactionResponse.js";
|
|
8
|
+
export * from "./RerunTransactionFlowsResponse.js";
|
|
9
|
+
export * from "./UpdateTransactionResponse.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
1
|
+
export * from "./CreateTransactionResponse.js";
|
|
2
|
+
export * from "./DeleteTransactionResponse.js";
|
|
3
|
+
export * from "./GetTransactionResponse.js";
|
|
4
4
|
export * from "./ListTransactionsRequestOrder.js";
|
|
5
5
|
export * from "./ListTransactionsRequestSort.js";
|
|
6
6
|
export * from "./ListTransactionsResponse.js";
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
7
|
+
export * from "./RefundTransactionResponse.js";
|
|
8
|
+
export * from "./RerunTransactionFlowsResponse.js";
|
|
9
|
+
export * from "./UpdateTransactionResponse.js";
|
|
@@ -18,7 +18,7 @@ export interface Commission {
|
|
|
18
18
|
is_ad_click: boolean | null;
|
|
19
19
|
is_self_referral: boolean | null;
|
|
20
20
|
approval_type: string | null;
|
|
21
|
-
scheduled_approval_date: string;
|
|
21
|
+
scheduled_approval_date: string | null;
|
|
22
22
|
created_at: string;
|
|
23
23
|
updated_at: string;
|
|
24
24
|
}
|
|
@@ -12,8 +12,8 @@ export interface Customer {
|
|
|
12
12
|
link_id: string | null;
|
|
13
13
|
promotion_code_id: string | null;
|
|
14
14
|
click_id: string | null;
|
|
15
|
-
lead_at: string;
|
|
16
|
-
active_at: string;
|
|
15
|
+
lead_at: string | null;
|
|
16
|
+
active_at: string | null;
|
|
17
17
|
created_at: string;
|
|
18
18
|
updated_at: string;
|
|
19
19
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface ErrorResponse {
|
|
2
2
|
success: boolean;
|
|
3
3
|
/** Human-readable explanation. May change; branch on code instead. */
|
|
4
4
|
message: string;
|
|
5
5
|
/** Stable machine-readable error code. */
|
|
6
|
-
code:
|
|
6
|
+
code: ErrorResponse.Code;
|
|
7
7
|
doc_url: string;
|
|
8
8
|
/** One entry per offending field. Present on validation_error and invalid_reference. */
|
|
9
|
-
errors?:
|
|
9
|
+
errors?: ErrorResponse.Errors.Item[] | undefined;
|
|
10
10
|
}
|
|
11
|
-
export declare namespace
|
|
11
|
+
export declare namespace ErrorResponse {
|
|
12
12
|
/** Stable machine-readable error code. */
|
|
13
13
|
const Code: {
|
|
14
14
|
readonly BadRequest: "bad_request";
|
|
@@ -25,6 +25,7 @@ export declare namespace Error_ {
|
|
|
25
25
|
readonly TransactionRefunded: "transaction_refunded";
|
|
26
26
|
readonly CommissionExists: "commission_exists";
|
|
27
27
|
readonly RateLimited: "rate_limited";
|
|
28
|
+
readonly PayloadTooLarge: "payload_too_large";
|
|
28
29
|
readonly InternalError: "internal_error";
|
|
29
30
|
};
|
|
30
31
|
type Code = (typeof Code)[keyof typeof Code];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
export var
|
|
3
|
-
(function (
|
|
2
|
+
export var ErrorResponse;
|
|
3
|
+
(function (ErrorResponse) {
|
|
4
4
|
/** Stable machine-readable error code. */
|
|
5
|
-
|
|
5
|
+
ErrorResponse.Code = {
|
|
6
6
|
BadRequest: "bad_request",
|
|
7
7
|
ValidationError: "validation_error",
|
|
8
8
|
InvalidReference: "invalid_reference",
|
|
@@ -17,6 +17,7 @@ export var Error_;
|
|
|
17
17
|
TransactionRefunded: "transaction_refunded",
|
|
18
18
|
CommissionExists: "commission_exists",
|
|
19
19
|
RateLimited: "rate_limited",
|
|
20
|
+
PayloadTooLarge: "payload_too_large",
|
|
20
21
|
InternalError: "internal_error",
|
|
21
22
|
};
|
|
22
|
-
})(
|
|
23
|
+
})(ErrorResponse || (ErrorResponse = {}));
|
|
@@ -4,7 +4,7 @@ export * from "./Commission.js";
|
|
|
4
4
|
export * from "./CreatedPartner.js";
|
|
5
5
|
export * from "./Customer.js";
|
|
6
6
|
export * from "./EmbedToken.js";
|
|
7
|
-
export * from "./
|
|
7
|
+
export * from "./ErrorResponse.js";
|
|
8
8
|
export * from "./Flow.js";
|
|
9
9
|
export * from "./Group.js";
|
|
10
10
|
export * from "./Link.js";
|
package/dist/api/types/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export * from "./Commission.js";
|
|
|
4
4
|
export * from "./CreatedPartner.js";
|
|
5
5
|
export * from "./Customer.js";
|
|
6
6
|
export * from "./EmbedToken.js";
|
|
7
|
-
export * from "./
|
|
7
|
+
export * from "./ErrorResponse.js";
|
|
8
8
|
export * from "./Flow.js";
|
|
9
9
|
export * from "./Group.js";
|
|
10
10
|
export * from "./Link.js";
|
package/dist/core/exports.d.ts
CHANGED
package/dist/core/exports.js
CHANGED
|
@@ -5,12 +5,13 @@ import { EndpointSupplier } from "./EndpointSupplier.js";
|
|
|
5
5
|
import { getErrorResponseBody } from "./getErrorResponseBody.js";
|
|
6
6
|
import { getFetchFn } from "./getFetchFn.js";
|
|
7
7
|
import { getRequestBody } from "./getRequestBody.js";
|
|
8
|
-
import { getResponseBody } from "./getResponseBody.js";
|
|
8
|
+
import { getResponseBody, isResponseBodyError } from "./getResponseBody.js";
|
|
9
9
|
import { Headers } from "./Headers.js";
|
|
10
|
-
import { makeRequest } from "./makeRequest.js";
|
|
10
|
+
import { clearResponseTimeout, makeRequest } from "./makeRequest.js";
|
|
11
11
|
import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
|
|
12
12
|
import { redactUrl, SENSITIVE_QUERY_PARAMS } from "./redactUrl.js";
|
|
13
13
|
import { requestWithRetries } from "./requestWithRetries.js";
|
|
14
|
+
import { TIMEOUT } from "./signals.js";
|
|
14
15
|
const SENSITIVE_HEADERS = new Set([
|
|
15
16
|
"authorization",
|
|
16
17
|
"www-authenticate",
|
|
@@ -79,6 +80,10 @@ async function getHeaders(args) {
|
|
|
79
80
|
}
|
|
80
81
|
return newHeaders;
|
|
81
82
|
}
|
|
83
|
+
function isJsonContentType(contentType) {
|
|
84
|
+
const mediaType = contentType?.split(";")[0]?.trim().toLowerCase() ?? "";
|
|
85
|
+
return mediaType === "application/json" || mediaType === "text/json" || mediaType.endsWith("+json");
|
|
86
|
+
}
|
|
82
87
|
export async function fetcherImpl(args) {
|
|
83
88
|
let url = args.url;
|
|
84
89
|
if (args.queryString != null && args.queryString.length > 0) {
|
|
@@ -104,8 +109,19 @@ export async function fetcherImpl(args) {
|
|
|
104
109
|
};
|
|
105
110
|
logger.debug("Making HTTP request", metadata);
|
|
106
111
|
}
|
|
112
|
+
// Bodies that are read in full here stay covered by the timeout; streamed bodies are read by the caller.
|
|
113
|
+
const keepTimeoutUntilBodyRead = args.responseType !== "streaming" && args.responseType !== "sse" && args.responseType !== "binary-response";
|
|
114
|
+
const attemptResponses = [];
|
|
107
115
|
try {
|
|
108
|
-
const response = await requestWithRetries(async () =>
|
|
116
|
+
const response = await requestWithRetries(async () => {
|
|
117
|
+
// A retry means the previous attempt is over; stop its timer now rather than at the end.
|
|
118
|
+
for (const previousResponse of attemptResponses) {
|
|
119
|
+
clearResponseTimeout(previousResponse);
|
|
120
|
+
}
|
|
121
|
+
const attemptResponse = await makeRequest(fetchFn, url, args.method, headers, requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex, args.responseType === "streaming" || args.responseType === "sse", keepTimeoutUntilBodyRead);
|
|
122
|
+
attemptResponses.push(attemptResponse);
|
|
123
|
+
return attemptResponse;
|
|
124
|
+
}, args.maxRetries, args.abortSignal);
|
|
109
125
|
if (response.status >= 200 && response.status < 400) {
|
|
110
126
|
if (logger.isDebug()) {
|
|
111
127
|
const metadata = {
|
|
@@ -117,6 +133,16 @@ export async function fetcherImpl(args) {
|
|
|
117
133
|
logger.debug("HTTP request succeeded", metadata);
|
|
118
134
|
}
|
|
119
135
|
const body = await getResponseBody(response, args.responseType);
|
|
136
|
+
// Only a body the server labelled as JSON is an error here; void endpoints may return plain text.
|
|
137
|
+
if (isResponseBodyError(body) &&
|
|
138
|
+
body.error.reason === "non-json" &&
|
|
139
|
+
isJsonContentType(response.headers.get("Content-Type"))) {
|
|
140
|
+
return {
|
|
141
|
+
ok: false,
|
|
142
|
+
error: body.error,
|
|
143
|
+
rawResponse: toRawResponse(response),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
120
146
|
return {
|
|
121
147
|
ok: true,
|
|
122
148
|
body: body,
|
|
@@ -164,7 +190,7 @@ export async function fetcherImpl(args) {
|
|
|
164
190
|
rawResponse: abortRawResponse,
|
|
165
191
|
};
|
|
166
192
|
}
|
|
167
|
-
else if (error instanceof Error && error.name === "AbortError") {
|
|
193
|
+
else if (error === TIMEOUT || (error instanceof Error && error.name === "AbortError")) {
|
|
168
194
|
if (logger.isError()) {
|
|
169
195
|
const metadata = {
|
|
170
196
|
method: args.method,
|
|
@@ -219,5 +245,10 @@ export async function fetcherImpl(args) {
|
|
|
219
245
|
rawResponse: unknownRawResponse,
|
|
220
246
|
};
|
|
221
247
|
}
|
|
248
|
+
finally {
|
|
249
|
+
for (const attemptResponse of attemptResponses) {
|
|
250
|
+
clearResponseTimeout(attemptResponse);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
222
253
|
}
|
|
223
254
|
export const fetcher = fetcherImpl;
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import { fromJson } from "../json.js";
|
|
2
|
-
import { getResponseBody } from "./getResponseBody.js";
|
|
2
|
+
import { getResponseBody, isResponseBodyError } from "./getResponseBody.js";
|
|
3
|
+
/** Parses a JSON error body, falling back to the raw text so the status and body are never lost. */
|
|
4
|
+
function parseJsonErrorBody(text) {
|
|
5
|
+
if (text.length === 0) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
return fromJson(text);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return text;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
3
15
|
export async function getErrorResponseBody(response) {
|
|
4
16
|
let contentType = response.headers.get("Content-Type")?.toLowerCase();
|
|
5
17
|
if (contentType == null || contentType.length === 0) {
|
|
6
|
-
|
|
18
|
+
const body = await getResponseBody(response);
|
|
19
|
+
if (isResponseBodyError(body)) {
|
|
20
|
+
return body.error.reason === "non-json" ? body.error.rawBody : undefined;
|
|
21
|
+
}
|
|
22
|
+
return body;
|
|
7
23
|
}
|
|
8
24
|
if (contentType.indexOf(";") !== -1) {
|
|
9
25
|
contentType = contentType.split(";")[0]?.trim() ?? "";
|
|
@@ -14,14 +30,11 @@ export async function getErrorResponseBody(response) {
|
|
|
14
30
|
case "application/ld+json":
|
|
15
31
|
case "application/problem+json":
|
|
16
32
|
case "application/vnd.api+json":
|
|
17
|
-
case "text/json":
|
|
18
|
-
|
|
19
|
-
return text.length > 0 ? fromJson(text) : undefined;
|
|
20
|
-
}
|
|
33
|
+
case "text/json":
|
|
34
|
+
return parseJsonErrorBody(await response.text());
|
|
21
35
|
default:
|
|
22
36
|
if (contentType.startsWith("application/vnd.") && contentType.endsWith("+json")) {
|
|
23
|
-
|
|
24
|
-
return text.length > 0 ? fromJson(text) : undefined;
|
|
37
|
+
return parseJsonErrorBody(await response.text());
|
|
25
38
|
}
|
|
26
39
|
// Fallback to plain text if content type is not recognized
|
|
27
40
|
// Even if no body is present, the response will be an empty string
|
|
@@ -1 +1,17 @@
|
|
|
1
|
+
export type ResponseBodyError = {
|
|
2
|
+
ok: false;
|
|
3
|
+
error: {
|
|
4
|
+
reason: "non-json";
|
|
5
|
+
statusCode: number;
|
|
6
|
+
rawBody: string;
|
|
7
|
+
} | {
|
|
8
|
+
reason: "body-is-null";
|
|
9
|
+
statusCode: number;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Returns true when `value` is a failure record created by `getResponseBody` (for example malformed JSON),
|
|
14
|
+
* as opposed to a parsed JSON body that happens to have the same shape.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isResponseBodyError(value: unknown): value is ResponseBodyError;
|
|
1
17
|
export declare function getResponseBody(response: Response, responseType?: string): Promise<unknown>;
|
|
@@ -9,6 +9,19 @@ function retainResponse(target, response) {
|
|
|
9
9
|
writable: false,
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
+
const responseBodyErrors = new WeakSet();
|
|
13
|
+
function responseBodyError(error) {
|
|
14
|
+
const record = { ok: false, error };
|
|
15
|
+
responseBodyErrors.add(record);
|
|
16
|
+
return record;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns true when `value` is a failure record created by `getResponseBody` (for example malformed JSON),
|
|
20
|
+
* as opposed to a parsed JSON body that happens to have the same shape.
|
|
21
|
+
*/
|
|
22
|
+
export function isResponseBodyError(value) {
|
|
23
|
+
return typeof value === "object" && value != null && responseBodyErrors.has(value);
|
|
24
|
+
}
|
|
12
25
|
export async function getResponseBody(response, responseType) {
|
|
13
26
|
switch (responseType) {
|
|
14
27
|
case "binary-response":
|
|
@@ -19,25 +32,19 @@ export async function getResponseBody(response, responseType) {
|
|
|
19
32
|
return await response.arrayBuffer();
|
|
20
33
|
case "sse":
|
|
21
34
|
if (response.body == null) {
|
|
22
|
-
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
statusCode: response.status,
|
|
27
|
-
},
|
|
28
|
-
};
|
|
35
|
+
return responseBodyError({
|
|
36
|
+
reason: "body-is-null",
|
|
37
|
+
statusCode: response.status,
|
|
38
|
+
});
|
|
29
39
|
}
|
|
30
40
|
retainResponse(response.body, response);
|
|
31
41
|
return response.body;
|
|
32
42
|
case "streaming":
|
|
33
43
|
if (response.body == null) {
|
|
34
|
-
return {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
statusCode: response.status,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
44
|
+
return responseBodyError({
|
|
45
|
+
reason: "body-is-null",
|
|
46
|
+
statusCode: response.status,
|
|
47
|
+
});
|
|
41
48
|
}
|
|
42
49
|
retainResponse(response.body, response);
|
|
43
50
|
return response.body;
|
|
@@ -52,14 +59,11 @@ export async function getResponseBody(response, responseType) {
|
|
|
52
59
|
return responseBody;
|
|
53
60
|
}
|
|
54
61
|
catch (_err) {
|
|
55
|
-
return {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
rawBody: text,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
62
|
+
return responseBodyError({
|
|
63
|
+
reason: "non-json",
|
|
64
|
+
statusCode: response.status,
|
|
65
|
+
rawBody: text,
|
|
66
|
+
});
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
return undefined;
|
|
@@ -6,6 +6,7 @@ import { makeRequest } from "./makeRequest.js";
|
|
|
6
6
|
import { redactUrl } from "./redactUrl.js";
|
|
7
7
|
import { requestWithRetries } from "./requestWithRetries.js";
|
|
8
8
|
import { Supplier } from "./Supplier.js";
|
|
9
|
+
import { TIMEOUT } from "./signals.js";
|
|
9
10
|
/**
|
|
10
11
|
* Makes a passthrough HTTP request using the SDK's configuration (auth, retry, logging, etc.)
|
|
11
12
|
* while mimicking the standard `fetch` API.
|
|
@@ -109,8 +110,18 @@ export async function makePassthroughRequest(input, init, clientOptions, request
|
|
|
109
110
|
hasBody: body != null,
|
|
110
111
|
});
|
|
111
112
|
}
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
let response;
|
|
114
|
+
try {
|
|
115
|
+
response = await requestWithRetries(async () => makeRequest(fetchFn, fullUrl, method, mergedHeaders, body ?? undefined, timeoutMs, abortSignal, effectiveInit?.credentials === "include", undefined, // duplex
|
|
116
|
+
false), maxRetries, abortSignal);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
// Match `fetch`: a timeout rejects with an Error named "TimeoutError", not the bare abort reason.
|
|
120
|
+
if (error === TIMEOUT) {
|
|
121
|
+
throw createTimeoutError();
|
|
122
|
+
}
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
114
125
|
if (logger.isDebug()) {
|
|
115
126
|
logger.debug("Passthrough HTTP request completed", {
|
|
116
127
|
method,
|
|
@@ -120,6 +131,11 @@ export async function makePassthroughRequest(input, init, clientOptions, request
|
|
|
120
131
|
}
|
|
121
132
|
return response;
|
|
122
133
|
}
|
|
134
|
+
function createTimeoutError() {
|
|
135
|
+
const error = new Error("The request timed out.");
|
|
136
|
+
error.name = "TimeoutError";
|
|
137
|
+
return error;
|
|
138
|
+
}
|
|
123
139
|
/**
|
|
124
140
|
* Returns true when the resolved request URL points at the same origin as the
|
|
125
141
|
* configured base URL. Relative paths are always joined onto the base URL, so
|
|
@@ -3,4 +3,9 @@ export declare function isCacheNoStoreSupported(): boolean;
|
|
|
3
3
|
* Reset the cached result of `isCacheNoStoreSupported`. Exposed for testing only.
|
|
4
4
|
*/
|
|
5
5
|
export declare function resetCacheNoStoreSupported(): void;
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Clears the timeout that `makeRequest` kept running (with `keepTimeoutUntilBodyRead`) so that it also
|
|
8
|
+
* covered reading the response body.
|
|
9
|
+
*/
|
|
10
|
+
export declare function clearResponseTimeout(response: Response): void;
|
|
11
|
+
export declare const makeRequest: (fetchFn: (url: string, init: RequestInit) => Promise<Response>, url: string, method: string, headers: Headers | Record<string, string>, requestBody: BodyInit | undefined, timeoutMs?: number, abortSignal?: AbortSignal, withCredentials?: boolean, duplex?: "half", disableCache?: boolean, keepTimeoutUntilBodyRead?: boolean) => Promise<Response>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { anySignal, getTimeoutSignal } from "./signals.js";
|
|
1
|
+
import { anySignal, getTimeoutSignal, TIMEOUT } from "./signals.js";
|
|
2
2
|
/**
|
|
3
3
|
* Cached result of checking whether the current runtime supports
|
|
4
4
|
* the `cache` option in `Request`. Some runtimes (e.g. Cloudflare Workers)
|
|
@@ -24,30 +24,62 @@ export function isCacheNoStoreSupported() {
|
|
|
24
24
|
export function resetCacheNoStoreSupported() {
|
|
25
25
|
_cacheNoStoreSupported = undefined;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
const responseTimeouts = new WeakMap();
|
|
28
|
+
/**
|
|
29
|
+
* Clears the timeout that `makeRequest` kept running (with `keepTimeoutUntilBodyRead`) so that it also
|
|
30
|
+
* covered reading the response body.
|
|
31
|
+
*/
|
|
32
|
+
export function clearResponseTimeout(response) {
|
|
33
|
+
const timeoutId = responseTimeouts.get(response);
|
|
34
|
+
if (timeoutId != null) {
|
|
35
|
+
clearTimeout(timeoutId);
|
|
36
|
+
responseTimeouts.delete(response);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export const makeRequest = async (fetchFn, url, method, headers, requestBody, timeoutMs, abortSignal, withCredentials, duplex, disableCache, keepTimeoutUntilBodyRead) => {
|
|
28
40
|
const signals = [];
|
|
29
41
|
let timeoutAbortId;
|
|
42
|
+
let timeoutSignal;
|
|
30
43
|
if (timeoutMs != null) {
|
|
31
44
|
const { signal, abortId } = getTimeoutSignal(timeoutMs);
|
|
32
45
|
timeoutAbortId = abortId;
|
|
46
|
+
timeoutSignal = signal;
|
|
33
47
|
signals.push(signal);
|
|
34
48
|
}
|
|
35
49
|
if (abortSignal != null) {
|
|
36
50
|
signals.push(abortSignal);
|
|
37
51
|
}
|
|
38
52
|
const newSignals = anySignal(signals);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
let response;
|
|
54
|
+
try {
|
|
55
|
+
response = await fetchFn(url, {
|
|
56
|
+
method: method,
|
|
57
|
+
headers,
|
|
58
|
+
body: requestBody,
|
|
59
|
+
signal: newSignals,
|
|
60
|
+
credentials: withCredentials ? "include" : undefined,
|
|
61
|
+
// @ts-ignore
|
|
62
|
+
duplex,
|
|
63
|
+
...(disableCache && isCacheNoStoreSupported() ? { cache: "no-store" } : {}),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
if (timeoutAbortId != null) {
|
|
68
|
+
clearTimeout(timeoutAbortId);
|
|
69
|
+
}
|
|
70
|
+
// Some runtimes (e.g. Node 18) reject with their own error instead of the abort reason.
|
|
71
|
+
if (timeoutSignal?.aborted && !abortSignal?.aborted) {
|
|
72
|
+
throw TIMEOUT;
|
|
73
|
+
}
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
49
76
|
if (timeoutAbortId != null) {
|
|
50
|
-
|
|
77
|
+
if (keepTimeoutUntilBodyRead) {
|
|
78
|
+
responseTimeouts.set(response, timeoutAbortId);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
clearTimeout(timeoutAbortId);
|
|
82
|
+
}
|
|
51
83
|
}
|
|
52
84
|
return response;
|
|
53
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function requestWithRetries(requestFn: () => Promise<Response>, maxRetries?: number): Promise<Response>;
|
|
1
|
+
export declare function requestWithRetries(requestFn: () => Promise<Response>, maxRetries?: number, abortSignal?: AbortSignal): Promise<Response>;
|
|
@@ -40,12 +40,33 @@ function getRetryDelayFromHeaders(response, retryAttempt) {
|
|
|
40
40
|
}
|
|
41
41
|
return addSymmetricJitter(Math.min(INITIAL_RETRY_DELAY * 2 ** retryAttempt, MAX_RETRY_DELAY));
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Waits `ms` milliseconds, or rejects as soon as `abortSignal` aborts. The timer and
|
|
45
|
+
* the abort listener are always removed, so a cancelled wait never keeps the process alive.
|
|
46
|
+
*/
|
|
47
|
+
function sleep(ms, abortSignal) {
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
if (abortSignal?.aborted) {
|
|
50
|
+
reject(abortSignal.reason);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const onAbort = () => {
|
|
54
|
+
clearTimeout(timeoutId);
|
|
55
|
+
reject(abortSignal?.reason);
|
|
56
|
+
};
|
|
57
|
+
const timeoutId = setTimeout(() => {
|
|
58
|
+
abortSignal?.removeEventListener("abort", onAbort);
|
|
59
|
+
resolve();
|
|
60
|
+
}, ms);
|
|
61
|
+
abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export async function requestWithRetries(requestFn, maxRetries = DEFAULT_MAX_RETRIES, abortSignal) {
|
|
44
65
|
let response = await requestFn();
|
|
45
66
|
for (let i = 0; i < maxRetries; ++i) {
|
|
46
67
|
if (isRetryableStatusCode(response.status)) {
|
|
47
68
|
const delay = getRetryDelayFromHeaders(response, i);
|
|
48
|
-
await
|
|
69
|
+
await sleep(delay, abortSignal);
|
|
49
70
|
response = await requestFn();
|
|
50
71
|
}
|
|
51
72
|
else {
|
package/dist/core/index.d.ts
CHANGED
|
@@ -2,5 +2,7 @@ export * from "./auth/index.js";
|
|
|
2
2
|
export * from "./base64.js";
|
|
3
3
|
export * from "./fetcher/index.js";
|
|
4
4
|
export * as logging from "./logging/index.js";
|
|
5
|
+
export * from "./pagination/index.js";
|
|
5
6
|
export * from "./runtime/index.js";
|
|
6
7
|
export * as url from "./url/index.js";
|
|
8
|
+
export * from "./utils/index.js";
|
package/dist/core/index.js
CHANGED
|
@@ -2,5 +2,7 @@ export * from "./auth/index.js";
|
|
|
2
2
|
export * from "./base64.js";
|
|
3
3
|
export * from "./fetcher/index.js";
|
|
4
4
|
export * as logging from "./logging/index.js";
|
|
5
|
+
export * from "./pagination/index.js";
|
|
5
6
|
export * from "./runtime/index.js";
|
|
6
7
|
export * as url from "./url/index.js";
|
|
8
|
+
export * from "./utils/index.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { HttpResponsePromise, RawResponse } from "../fetcher/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* A page of results from a paginated API.
|
|
4
|
+
*
|
|
5
|
+
* @template T The type of the items in the page.
|
|
6
|
+
* @template R The type of the API response.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Page<T, R = unknown> implements AsyncIterable<T> {
|
|
9
|
+
data: T[];
|
|
10
|
+
rawResponse: RawResponse;
|
|
11
|
+
response: R;
|
|
12
|
+
private _hasNextPage;
|
|
13
|
+
private getItems;
|
|
14
|
+
private loadNextPage;
|
|
15
|
+
constructor({ response, rawResponse, hasNextPage, getItems, loadPage, }: {
|
|
16
|
+
response: R;
|
|
17
|
+
rawResponse: RawResponse;
|
|
18
|
+
hasNextPage: (response: R) => boolean;
|
|
19
|
+
getItems: (response: R) => T[];
|
|
20
|
+
loadPage: (response: R) => HttpResponsePromise<R>;
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves the next page
|
|
24
|
+
* @returns this
|
|
25
|
+
*/
|
|
26
|
+
getNextPage(): Promise<this>;
|
|
27
|
+
/**
|
|
28
|
+
* @returns whether there is a next page to load
|
|
29
|
+
*/
|
|
30
|
+
hasNextPage(): boolean;
|
|
31
|
+
private iterMessages;
|
|
32
|
+
[Symbol.asyncIterator](): AsyncIterator<T, void, unknown>;
|
|
33
|
+
}
|