@delopay/sdk 0.451.0 → 0.456.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/airwallexCard.cjs.map +1 -1
- package/dist/branding.cjs.map +1 -1
- package/dist/branding.d.cts +1 -0
- package/dist/branding.d.ts +1 -0
- package/dist/cardFormStyles.cjs.map +1 -1
- package/dist/checkoutSession.cjs +2 -2
- package/dist/checkoutSession.cjs.map +1 -1
- package/dist/checkoutSession.d.cts +1 -0
- package/dist/checkoutSession.d.ts +1 -0
- package/dist/checkoutSession.js +1 -1
- package/dist/{chunk-WYR27JGG.js → chunk-222YMG36.js} +31 -2
- package/dist/chunk-222YMG36.js.map +1 -0
- package/dist/chunk-244VZFFO.cjs.map +1 -1
- package/dist/chunk-2IJRBJXW.cjs.map +1 -1
- package/dist/chunk-34PC72O7.cjs.map +1 -1
- package/dist/{chunk-EBA6DJKI.js → chunk-3CR7RX65.js} +2 -2
- package/dist/chunk-3GBWQWTP.cjs.map +1 -1
- package/dist/chunk-3YBBJT3Y.cjs.map +1 -1
- package/dist/chunk-44QBWVRS.cjs.map +1 -1
- package/dist/chunk-4EKAWNYI.cjs.map +1 -1
- package/dist/chunk-4LN4BR2T.cjs.map +1 -1
- package/dist/chunk-4T4XHPYN.cjs.map +1 -1
- package/dist/{chunk-BY3BENXH.js → chunk-57S5IX5S.js} +17 -1
- package/dist/chunk-57S5IX5S.js.map +1 -0
- package/dist/chunk-5CITBN33.cjs.map +1 -1
- package/dist/chunk-5HCKC4HF.cjs.map +1 -1
- package/dist/chunk-5O2JSQYA.cjs.map +1 -1
- package/dist/chunk-6EBY2KKL.cjs.map +1 -1
- package/dist/chunk-6LFOM6HV.cjs.map +1 -1
- package/dist/chunk-6LOWE2YI.cjs.map +1 -1
- package/dist/chunk-6LSG5Z4T.cjs.map +1 -1
- package/dist/chunk-6SU2MTN2.cjs.map +1 -1
- package/dist/chunk-6YCDLSIU.cjs.map +1 -1
- package/dist/chunk-75E5WNJG.cjs.map +1 -1
- package/dist/{chunk-OKFOU6F7.cjs → chunk-7JBRZUZX.cjs} +5 -5
- package/dist/chunk-7JBRZUZX.cjs.map +1 -0
- package/dist/chunk-7JV6VVO7.cjs.map +1 -1
- package/dist/{chunk-KT2WXUWG.cjs → chunk-7QYHQL3L.cjs} +17 -1
- package/dist/chunk-7QYHQL3L.cjs.map +1 -0
- package/dist/chunk-7QZCUXWB.cjs.map +1 -1
- package/dist/chunk-7VXF5D67.cjs.map +1 -1
- package/dist/chunk-ABWAYMN5.cjs.map +1 -1
- package/dist/chunk-ACZ2R47X.cjs.map +1 -1
- package/dist/chunk-AVR2GPXU.cjs.map +1 -1
- package/dist/chunk-AYUYJO3I.cjs.map +1 -1
- package/dist/{chunk-OOC7ZT4T.js → chunk-BA6BTB56.js} +3 -3
- package/dist/chunk-BCA3TCGS.cjs.map +1 -1
- package/dist/chunk-BP6KDQ6I.cjs.map +1 -1
- package/dist/chunk-BRY3W7N3.cjs.map +1 -1
- package/dist/chunk-CAMALM35.cjs.map +1 -1
- package/dist/chunk-CCN44NZJ.cjs.map +1 -1
- package/dist/chunk-CKKNFFKP.cjs.map +1 -1
- package/dist/chunk-CR3JBTP3.cjs.map +1 -1
- package/dist/chunk-DJASVBOJ.cjs.map +1 -1
- package/dist/chunk-EEB2HDYL.cjs.map +1 -1
- package/dist/chunk-ENPSUWTS.cjs.map +1 -1
- package/dist/chunk-EQ6P6ZND.cjs.map +1 -1
- package/dist/chunk-EXPWQBI3.cjs.map +1 -1
- package/dist/chunk-F3I5DOWV.cjs.map +1 -1
- package/dist/chunk-F46K5H3U.cjs.map +1 -1
- package/dist/chunk-F6S3WCCB.cjs.map +1 -1
- package/dist/chunk-FG7YBXJQ.cjs.map +1 -1
- package/dist/chunk-FQRC4NJG.cjs.map +1 -1
- package/dist/chunk-FYISDU2Y.cjs.map +1 -1
- package/dist/chunk-GG52SAHA.cjs.map +1 -1
- package/dist/chunk-GK5FWN4H.cjs.map +1 -1
- package/dist/chunk-GSQN5EOO.cjs.map +1 -1
- package/dist/chunk-GW7IHYXR.cjs.map +1 -1
- package/dist/chunk-HLHML5ES.cjs.map +1 -1
- package/dist/chunk-HLKFUOAQ.cjs.map +1 -1
- package/dist/chunk-HLYGHP6F.cjs.map +1 -1
- package/dist/chunk-HSJABE7X.cjs.map +1 -1
- package/dist/chunk-I2W7AO4B.cjs.map +1 -1
- package/dist/chunk-I2XGNALG.cjs.map +1 -1
- package/dist/chunk-IKXGA2Z5.cjs.map +1 -1
- package/dist/chunk-IR2LFKKA.cjs.map +1 -1
- package/dist/chunk-J4ZB7MU4.cjs.map +1 -1
- package/dist/chunk-JPRSNCYP.cjs.map +1 -1
- package/dist/chunk-K5Q2H3VD.cjs.map +1 -1
- package/dist/chunk-KD5Y2YWK.cjs.map +1 -1
- package/dist/chunk-KJDMNF2T.cjs.map +1 -1
- package/dist/chunk-KLONGJCL.cjs.map +1 -1
- package/dist/chunk-KOB6MOAV.cjs.map +1 -1
- package/dist/chunk-KSJ7JLR3.cjs.map +1 -1
- package/dist/chunk-LJ2EG6JK.cjs.map +1 -1
- package/dist/chunk-LLYY4TCZ.cjs.map +1 -1
- package/dist/chunk-LYIBTVK6.cjs.map +1 -1
- package/dist/chunk-M3HWE7KT.cjs.map +1 -1
- package/dist/chunk-M3SJHFT4.cjs.map +1 -1
- package/dist/chunk-MCNDMK7F.cjs.map +1 -1
- package/dist/chunk-MLG6NXI6.cjs.map +1 -1
- package/dist/chunk-NFB3S2E6.cjs.map +1 -1
- package/dist/chunk-NKDUQ2BI.cjs.map +1 -1
- package/dist/chunk-NYL3BNHR.cjs.map +1 -1
- package/dist/chunk-O4AYHLQX.cjs.map +1 -1
- package/dist/chunk-OAEKP665.cjs.map +1 -1
- package/dist/chunk-ODPNVNYE.cjs.map +1 -1
- package/dist/chunk-OG2KJAYD.cjs.map +1 -1
- package/dist/chunk-OWP7XBY2.cjs.map +1 -1
- package/dist/chunk-OYZP6NF6.cjs.map +1 -1
- package/dist/{chunk-WCAIY7DR.cjs → chunk-P4UILJVU.cjs} +12 -1
- package/dist/chunk-P4UILJVU.cjs.map +1 -0
- package/dist/chunk-P6JLNQ6L.cjs.map +1 -1
- package/dist/chunk-P7DYLUUI.cjs.map +1 -1
- package/dist/chunk-PKAE6AQT.cjs.map +1 -1
- package/dist/chunk-Q7M7DO7M.cjs.map +1 -1
- package/dist/chunk-QKUWFMZP.cjs.map +1 -1
- package/dist/chunk-QRSA72B3.cjs.map +1 -1
- package/dist/{chunk-R46A6AGY.cjs → chunk-QTS4QGW4.cjs} +3 -3
- package/dist/chunk-QTS4QGW4.cjs.map +1 -0
- package/dist/chunk-QYNRNDIY.cjs.map +1 -1
- package/dist/chunk-R4FE6K43.cjs.map +1 -1
- package/dist/chunk-R4GA6BVP.cjs.map +1 -1
- package/dist/chunk-R5VYSZ3Q.cjs.map +1 -1
- package/dist/chunk-RHFUXHQN.cjs.map +1 -1
- package/dist/chunk-RI42IDRR.cjs.map +1 -1
- package/dist/chunk-RSVLVW4L.cjs.map +1 -1
- package/dist/chunk-S77LQWYC.cjs.map +1 -1
- package/dist/chunk-S7SBNOGS.cjs.map +1 -1
- package/dist/{chunk-Z5MEER63.js → chunk-T6INFOU2.js} +12 -1
- package/dist/chunk-T6INFOU2.js.map +1 -0
- package/dist/chunk-TMAJE5P2.cjs.map +1 -1
- package/dist/chunk-TNIJ6OSH.cjs.map +1 -1
- package/dist/chunk-U3JK7NBG.cjs.map +1 -1
- package/dist/chunk-UGSM7RJ2.cjs.map +1 -1
- package/dist/chunk-UKLZAOLW.cjs.map +1 -1
- package/dist/chunk-V47G7P6L.cjs.map +1 -1
- package/dist/chunk-VH5A6SMU.cjs.map +1 -1
- package/dist/chunk-VHMH4QMY.cjs.map +1 -1
- package/dist/chunk-VYC7WUM5.cjs.map +1 -1
- package/dist/{chunk-KZHLKMVX.cjs → chunk-W3MSASG4.cjs} +32 -3
- package/dist/chunk-W3MSASG4.cjs.map +1 -0
- package/dist/chunk-W457XUA6.cjs.map +1 -1
- package/dist/chunk-WHDI3TMP.cjs.map +1 -1
- package/dist/chunk-WITCPKNL.cjs.map +1 -1
- package/dist/chunk-WX6NP7UU.cjs.map +1 -1
- package/dist/chunk-XQLRIBVR.cjs.map +1 -1
- package/dist/chunk-Y7LSSRNJ.cjs.map +1 -1
- package/dist/chunk-YK3P5QNZ.cjs.map +1 -1
- package/dist/chunk-ZKPVUCQV.cjs.map +1 -1
- package/dist/chunk-ZUULK36E.cjs.map +1 -1
- package/dist/client.cjs +2 -2
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +1 -0
- package/dist/core.d.ts +1 -0
- package/dist/currencies.cjs.map +1 -1
- package/dist/enigmaCardForm.cjs.map +1 -1
- package/dist/error.cjs.map +1 -1
- package/dist/eventStream.cjs.map +1 -1
- package/dist/exportDownload.cjs.map +1 -1
- package/dist/exportDownload.d.cts +1 -0
- package/dist/exportDownload.d.ts +1 -0
- package/dist/feeProgram.cjs.map +1 -1
- package/dist/feeProgram.d.cts +1 -0
- package/dist/feeProgram.d.ts +1 -0
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/internal/resources/admin.cjs.map +1 -1
- package/dist/internal/resources/admin.d.cts +1 -0
- package/dist/internal/resources/admin.d.ts +1 -0
- package/dist/internal/resources/adminBranding.cjs.map +1 -1
- package/dist/internal/resources/adminBranding.d.cts +1 -0
- package/dist/internal/resources/adminBranding.d.ts +1 -0
- package/dist/internal/resources/adminCheckoutDomains.cjs.map +1 -1
- package/dist/internal/resources/adminCheckoutDomains.d.cts +1 -0
- package/dist/internal/resources/adminCheckoutDomains.d.ts +1 -0
- package/dist/internal/resources/adminFeePlans.cjs.map +1 -1
- package/dist/internal/resources/adminFeePlans.d.cts +1 -0
- package/dist/internal/resources/adminFeePlans.d.ts +1 -0
- package/dist/internal/resources/adminFileScans.cjs.map +1 -1
- package/dist/internal/resources/adminFileScans.d.cts +1 -0
- package/dist/internal/resources/adminFileScans.d.ts +1 -0
- package/dist/internal/resources/adminIndustries.cjs.map +1 -1
- package/dist/internal/resources/adminIndustries.d.cts +1 -0
- package/dist/internal/resources/adminIndustries.d.ts +1 -0
- package/dist/internal/resources/adminLive.cjs.map +1 -1
- package/dist/internal/resources/adminLive.d.cts +1 -0
- package/dist/internal/resources/adminLive.d.ts +1 -0
- package/dist/internal/resources/adminNotices.cjs.map +1 -1
- package/dist/internal/resources/adminNotices.d.cts +1 -0
- package/dist/internal/resources/adminNotices.d.ts +1 -0
- package/dist/internal/resources/adminPortal.cjs +2 -2
- package/dist/internal/resources/adminPortal.cjs.map +1 -1
- package/dist/internal/resources/adminPortal.d.cts +19 -1
- package/dist/internal/resources/adminPortal.d.ts +19 -1
- package/dist/internal/resources/adminPortal.js +1 -1
- package/dist/internal/resources/adminSupport.cjs.map +1 -1
- package/dist/internal/resources/adminSupport.d.cts +1 -0
- package/dist/internal/resources/adminSupport.d.ts +1 -0
- package/dist/internal/resources/auditLogs.cjs.map +1 -1
- package/dist/internal/resources/auditLogs.d.cts +1 -0
- package/dist/internal/resources/auditLogs.d.ts +1 -0
- package/dist/internal/resources/cache.cjs.map +1 -1
- package/dist/internal/resources/cache.d.cts +1 -0
- package/dist/internal/resources/cache.d.ts +1 -0
- package/dist/internal/resources/cardIssuers.cjs.map +1 -1
- package/dist/internal/resources/cardIssuers.d.cts +1 -0
- package/dist/internal/resources/cardIssuers.d.ts +1 -0
- package/dist/internal/resources/configs.cjs.map +1 -1
- package/dist/internal/resources/configs.d.cts +1 -0
- package/dist/internal/resources/configs.d.ts +1 -0
- package/dist/internal/resources/connectorRestrictionRules.cjs.map +1 -1
- package/dist/internal/resources/connectorRestrictionRules.d.cts +1 -0
- package/dist/internal/resources/connectorRestrictionRules.d.ts +1 -0
- package/dist/internal/resources/connectorRestrictions.cjs.map +1 -1
- package/dist/internal/resources/connectorRestrictions.d.cts +1 -0
- package/dist/internal/resources/connectorRestrictions.d.ts +1 -0
- package/dist/internal/resources/diagnostic.cjs.map +1 -1
- package/dist/internal/resources/diagnostic.d.cts +1 -0
- package/dist/internal/resources/diagnostic.d.ts +1 -0
- package/dist/internal/resources/gsm.cjs.map +1 -1
- package/dist/internal/resources/gsm.d.cts +1 -0
- package/dist/internal/resources/gsm.d.ts +1 -0
- package/dist/internal/resources/nativeRenewals.cjs.map +1 -1
- package/dist/internal/resources/nativeRenewals.d.cts +1 -0
- package/dist/internal/resources/nativeRenewals.d.ts +1 -0
- package/dist/internal/resources/platformBilling.cjs.map +1 -1
- package/dist/internal/resources/platformBilling.d.cts +1 -0
- package/dist/internal/resources/platformBilling.d.ts +1 -0
- package/dist/internal/resources/platformFees.cjs.map +1 -1
- package/dist/internal/resources/platformFees.d.cts +1 -0
- package/dist/internal/resources/platformFees.d.ts +1 -0
- package/dist/internal/resources/platformMessageTemplates.cjs.map +1 -1
- package/dist/internal/resources/platformMessageTemplates.d.cts +1 -0
- package/dist/internal/resources/platformMessageTemplates.d.ts +1 -0
- package/dist/internal/resources/platformSettings.cjs.map +1 -1
- package/dist/internal/resources/platformSettings.d.cts +1 -0
- package/dist/internal/resources/platformSettings.d.ts +1 -0
- package/dist/internal.cjs +8 -8
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +5 -5
- package/dist/listQuery.cjs.map +1 -1
- package/dist/listQuery.d.cts +1 -0
- package/dist/listQuery.d.ts +1 -0
- package/dist/panes.cjs.map +1 -1
- package/dist/panes.d.cts +1 -0
- package/dist/panes.d.ts +1 -0
- package/dist/paymentPresentation.cjs.map +1 -1
- package/dist/paymentPresentation.d.cts +1 -0
- package/dist/paymentPresentation.d.ts +1 -0
- package/dist/recordCounter.cjs.map +1 -1
- package/dist/resources/aiTools.cjs.map +1 -1
- package/dist/resources/aiTools.d.cts +1 -0
- package/dist/resources/aiTools.d.ts +1 -0
- package/dist/resources/analytics.cjs.map +1 -1
- package/dist/resources/analytics.d.cts +1 -0
- package/dist/resources/analytics.d.ts +1 -0
- package/dist/resources/analyticsDashboard.cjs.map +1 -1
- package/dist/resources/analyticsDashboard.d.cts +1 -0
- package/dist/resources/analyticsDashboard.d.ts +1 -0
- package/dist/resources/apiKeys.cjs.map +1 -1
- package/dist/resources/apiKeys.d.cts +1 -0
- package/dist/resources/apiKeys.d.ts +1 -0
- package/dist/resources/audit.cjs.map +1 -1
- package/dist/resources/audit.d.cts +1 -0
- package/dist/resources/audit.d.ts +1 -0
- package/dist/resources/authentication.cjs.map +1 -1
- package/dist/resources/authentication.d.cts +1 -0
- package/dist/resources/authentication.d.ts +1 -0
- package/dist/resources/availabilityOverrides.cjs.map +1 -1
- package/dist/resources/availabilityOverrides.d.cts +1 -0
- package/dist/resources/availabilityOverrides.d.ts +1 -0
- package/dist/resources/billing.cjs.map +1 -1
- package/dist/resources/billing.d.cts +1 -0
- package/dist/resources/billing.d.ts +1 -0
- package/dist/resources/buyerAccount.cjs.map +1 -1
- package/dist/resources/buyerAccount.d.cts +1 -0
- package/dist/resources/buyerAccount.d.ts +1 -0
- package/dist/resources/buyerBlocklist.cjs.map +1 -1
- package/dist/resources/buyerBlocklist.d.cts +1 -0
- package/dist/resources/buyerBlocklist.d.ts +1 -0
- package/dist/resources/buyerConversations.cjs.map +1 -1
- package/dist/resources/buyerConversations.d.cts +1 -0
- package/dist/resources/buyerConversations.d.ts +1 -0
- package/dist/resources/buyerEvidenceReviews.cjs.map +1 -1
- package/dist/resources/buyerEvidenceReviews.d.cts +1 -0
- package/dist/resources/buyerEvidenceReviews.d.ts +1 -0
- package/dist/resources/buyerPortal.cjs.map +1 -1
- package/dist/resources/buyerPortal.d.cts +1 -0
- package/dist/resources/buyerPortal.d.ts +1 -0
- package/dist/resources/cards.cjs.map +1 -1
- package/dist/resources/cards.d.cts +1 -0
- package/dist/resources/cards.d.ts +1 -0
- package/dist/resources/chargebackPrevention.cjs.map +1 -1
- package/dist/resources/chargebackPrevention.d.cts +1 -0
- package/dist/resources/chargebackPrevention.d.ts +1 -0
- package/dist/resources/checkoutDomains.cjs.map +1 -1
- package/dist/resources/checkoutDomains.d.cts +1 -0
- package/dist/resources/checkoutDomains.d.ts +1 -0
- package/dist/resources/checkoutMethods.cjs.map +1 -1
- package/dist/resources/checkoutMethods.d.cts +1 -0
- package/dist/resources/checkoutMethods.d.ts +1 -0
- package/dist/resources/checkoutRecovery.cjs.map +1 -1
- package/dist/resources/checkoutRecovery.d.cts +1 -0
- package/dist/resources/checkoutRecovery.d.ts +1 -0
- package/dist/resources/checkoutTemplates.cjs.map +1 -1
- package/dist/resources/checkoutTemplates.d.cts +1 -0
- package/dist/resources/checkoutTemplates.d.ts +1 -0
- package/dist/resources/connectors.cjs.map +1 -1
- package/dist/resources/connectors.d.cts +1 -0
- package/dist/resources/connectors.d.ts +1 -0
- package/dist/resources/contentEncryption.cjs.map +1 -1
- package/dist/resources/contentEncryption.d.cts +1 -0
- package/dist/resources/contentEncryption.d.ts +1 -0
- package/dist/resources/costRules.cjs.map +1 -1
- package/dist/resources/costRules.d.cts +1 -0
- package/dist/resources/costRules.d.ts +1 -0
- package/dist/resources/customers.cjs.map +1 -1
- package/dist/resources/customers.d.cts +1 -0
- package/dist/resources/customers.d.ts +1 -0
- package/dist/resources/deploymentBranding.cjs.map +1 -1
- package/dist/resources/deploymentBranding.d.cts +1 -0
- package/dist/resources/deploymentBranding.d.ts +1 -0
- package/dist/resources/disputes.cjs.map +1 -1
- package/dist/resources/disputes.d.cts +1 -0
- package/dist/resources/disputes.d.ts +1 -0
- package/dist/resources/ephemeralKeys.cjs.map +1 -1
- package/dist/resources/ephemeralKeys.d.cts +1 -0
- package/dist/resources/ephemeralKeys.d.ts +1 -0
- package/dist/resources/events.cjs.map +1 -1
- package/dist/resources/events.d.cts +1 -0
- package/dist/resources/events.d.ts +1 -0
- package/dist/resources/export.cjs.map +1 -1
- package/dist/resources/export.d.cts +1 -0
- package/dist/resources/export.d.ts +1 -0
- package/dist/resources/externalRecords.cjs.map +1 -1
- package/dist/resources/externalRecords.d.cts +1 -0
- package/dist/resources/externalRecords.d.ts +1 -0
- package/dist/resources/featureMatrix.cjs.map +1 -1
- package/dist/resources/featureMatrix.d.cts +1 -0
- package/dist/resources/featureMatrix.d.ts +1 -0
- package/dist/resources/fees.cjs.map +1 -1
- package/dist/resources/fees.d.cts +1 -0
- package/dist/resources/fees.d.ts +1 -0
- package/dist/resources/files.cjs.map +1 -1
- package/dist/resources/files.d.cts +1 -0
- package/dist/resources/files.d.ts +1 -0
- package/dist/resources/forex.cjs.map +1 -1
- package/dist/resources/forex.d.cts +1 -0
- package/dist/resources/forex.d.ts +1 -0
- package/dist/resources/identityVerifications.cjs.map +1 -1
- package/dist/resources/identityVerifications.d.cts +1 -0
- package/dist/resources/identityVerifications.d.ts +1 -0
- package/dist/resources/industries.cjs.map +1 -1
- package/dist/resources/industries.d.cts +1 -0
- package/dist/resources/industries.d.ts +1 -0
- package/dist/resources/invoiceSettings.cjs.map +1 -1
- package/dist/resources/invoiceSettings.d.cts +1 -0
- package/dist/resources/invoiceSettings.d.ts +1 -0
- package/dist/resources/invoices.cjs.map +1 -1
- package/dist/resources/invoices.d.cts +1 -0
- package/dist/resources/invoices.d.ts +1 -0
- package/dist/resources/live.cjs.map +1 -1
- package/dist/resources/live.d.cts +1 -0
- package/dist/resources/live.d.ts +1 -0
- package/dist/resources/mandates.cjs.map +1 -1
- package/dist/resources/mandates.d.cts +1 -0
- package/dist/resources/mandates.d.ts +1 -0
- package/dist/resources/merchantAccounts.cjs.map +1 -1
- package/dist/resources/merchantAccounts.d.cts +1 -0
- package/dist/resources/merchantAccounts.d.ts +1 -0
- package/dist/resources/messageTemplates.cjs.map +1 -1
- package/dist/resources/messageTemplates.d.cts +1 -0
- package/dist/resources/messageTemplates.d.ts +1 -0
- package/dist/resources/notices.cjs.map +1 -1
- package/dist/resources/notices.d.cts +1 -0
- package/dist/resources/notices.d.ts +1 -0
- package/dist/resources/operationLimits.cjs.map +1 -1
- package/dist/resources/operationLimits.d.cts +1 -0
- package/dist/resources/operationLimits.d.ts +1 -0
- package/dist/resources/paymentLinks.cjs.map +1 -1
- package/dist/resources/paymentLinks.d.cts +1 -0
- package/dist/resources/paymentLinks.d.ts +1 -0
- package/dist/resources/paymentMethods.cjs.map +1 -1
- package/dist/resources/paymentMethods.d.cts +1 -0
- package/dist/resources/paymentMethods.d.ts +1 -0
- package/dist/resources/payments.cjs.map +1 -1
- package/dist/resources/payments.d.cts +1 -0
- package/dist/resources/payments.d.ts +1 -0
- package/dist/resources/payoutDestinations.cjs +2 -2
- package/dist/resources/payoutDestinations.cjs.map +1 -1
- package/dist/resources/payoutDestinations.d.cts +9 -1
- package/dist/resources/payoutDestinations.d.ts +9 -1
- package/dist/resources/payoutDestinations.js +1 -1
- package/dist/resources/payouts.cjs.map +1 -1
- package/dist/resources/payouts.d.cts +1 -0
- package/dist/resources/payouts.d.ts +1 -0
- package/dist/resources/paypalDisputes.cjs.map +1 -1
- package/dist/resources/paypalDisputes.d.cts +1 -0
- package/dist/resources/paypalDisputes.d.ts +1 -0
- package/dist/resources/persons.cjs.map +1 -1
- package/dist/resources/persons.d.cts +1 -0
- package/dist/resources/persons.d.ts +1 -0
- package/dist/resources/poll.cjs.map +1 -1
- package/dist/resources/poll.d.cts +1 -0
- package/dist/resources/poll.d.ts +1 -0
- package/dist/resources/processorCosts.cjs.map +1 -1
- package/dist/resources/processorCosts.d.cts +1 -0
- package/dist/resources/processorCosts.d.ts +1 -0
- package/dist/resources/processorImports.cjs.map +1 -1
- package/dist/resources/processorImports.d.cts +1 -0
- package/dist/resources/processorImports.d.ts +1 -0
- package/dist/resources/products.cjs.map +1 -1
- package/dist/resources/products.d.cts +1 -0
- package/dist/resources/products.d.ts +1 -0
- package/dist/resources/profileAcquirers.cjs.map +1 -1
- package/dist/resources/profileAcquirers.d.cts +1 -0
- package/dist/resources/profileAcquirers.d.ts +1 -0
- package/dist/resources/profiles.cjs.map +1 -1
- package/dist/resources/profiles.d.cts +1 -0
- package/dist/resources/profiles.d.ts +1 -0
- package/dist/resources/projects.cjs.map +1 -1
- package/dist/resources/projects.d.cts +1 -0
- package/dist/resources/projects.d.ts +1 -0
- package/dist/resources/refunds.cjs.map +1 -1
- package/dist/resources/refunds.d.cts +1 -0
- package/dist/resources/refunds.d.ts +1 -0
- package/dist/resources/regions.cjs.map +1 -1
- package/dist/resources/regions.d.cts +1 -0
- package/dist/resources/regions.d.ts +1 -0
- package/dist/resources/relay.cjs.map +1 -1
- package/dist/resources/relay.d.cts +1 -0
- package/dist/resources/relay.d.ts +1 -0
- package/dist/resources/risk.cjs.map +1 -1
- package/dist/resources/risk.d.cts +1 -0
- package/dist/resources/risk.d.ts +1 -0
- package/dist/resources/routing.cjs.map +1 -1
- package/dist/resources/routing.d.cts +1 -0
- package/dist/resources/routing.d.ts +1 -0
- package/dist/resources/search.cjs.map +1 -1
- package/dist/resources/search.d.cts +1 -0
- package/dist/resources/search.d.ts +1 -0
- package/dist/resources/sellToRestrictions.cjs.map +1 -1
- package/dist/resources/sellToRestrictions.d.cts +1 -0
- package/dist/resources/sellToRestrictions.d.ts +1 -0
- package/dist/resources/settings.cjs.map +1 -1
- package/dist/resources/settings.d.cts +1 -0
- package/dist/resources/settings.d.ts +1 -0
- package/dist/resources/settlement.cjs +2 -2
- package/dist/resources/settlement.cjs.map +1 -1
- package/dist/resources/settlement.d.cts +13 -1
- package/dist/resources/settlement.d.ts +13 -1
- package/dist/resources/settlement.js +1 -1
- package/dist/resources/shopLabels.cjs.map +1 -1
- package/dist/resources/shopLabels.d.cts +1 -0
- package/dist/resources/shopLabels.d.ts +1 -0
- package/dist/resources/shops.cjs.map +1 -1
- package/dist/resources/shops.d.cts +1 -0
- package/dist/resources/shops.d.ts +1 -0
- package/dist/resources/stripeConnect.cjs.map +1 -1
- package/dist/resources/stripeConnect.d.cts +1 -0
- package/dist/resources/stripeConnect.d.ts +1 -0
- package/dist/resources/subscriptions.cjs.map +1 -1
- package/dist/resources/subscriptions.d.cts +1 -0
- package/dist/resources/subscriptions.d.ts +1 -0
- package/dist/resources/support.cjs.map +1 -1
- package/dist/resources/support.d.cts +1 -0
- package/dist/resources/support.d.ts +1 -0
- package/dist/resources/threeDsRules.cjs.map +1 -1
- package/dist/resources/threeDsRules.d.cts +1 -0
- package/dist/resources/threeDsRules.d.ts +1 -0
- package/dist/resources/users.cjs.map +1 -1
- package/dist/resources/users.d.cts +1 -0
- package/dist/resources/users.d.ts +1 -0
- package/dist/resources/vatRates.cjs.map +1 -1
- package/dist/resources/vatRates.d.cts +1 -0
- package/dist/resources/vatRates.d.ts +1 -0
- package/dist/resources/verification.cjs.map +1 -1
- package/dist/resources/verification.d.cts +1 -0
- package/dist/resources/verification.d.ts +1 -0
- package/dist/resources/webhooks.cjs.map +1 -1
- package/dist/resources/webhooks.d.cts +1 -0
- package/dist/resources/webhooks.d.ts +1 -0
- package/dist/resources/whopResolutionCases.cjs.map +1 -1
- package/dist/resources/whopResolutionCases.d.cts +1 -0
- package/dist/resources/whopResolutionCases.d.ts +1 -0
- package/dist/trustedOrigins.cjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +92 -3
- package/dist/types.d.ts +92 -3
- package/package.json +19 -17
- package/dist/chunk-BY3BENXH.js.map +0 -1
- package/dist/chunk-KT2WXUWG.cjs.map +0 -1
- package/dist/chunk-KZHLKMVX.cjs.map +0 -1
- package/dist/chunk-OKFOU6F7.cjs.map +0 -1
- package/dist/chunk-R46A6AGY.cjs.map +0 -1
- package/dist/chunk-WCAIY7DR.cjs.map +0 -1
- package/dist/chunk-WYR27JGG.js.map +0 -1
- package/dist/chunk-Z5MEER63.js.map +0 -1
- /package/dist/{chunk-EBA6DJKI.js.map → chunk-3CR7RX65.js.map} +0 -0
-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unk-HSJABE7X.cjs","sourcesContent":[null,"import { DelopayError, DelopayAuthenticationError } from './error';\nimport { EventStreamParser } from './eventStream';\nimport type { EventStreamDispatch } from './eventStream';\nimport type { TokenResponse } from './types';\n\nexport { DelopayError, DelopayAuthenticationError } from './error';\n\nconst PRODUCTION_URL = 'https://api.delopay.net';\nconst SANDBOX_URL = 'https://sandbox.delopay.net/api';\n\nconst MAX_RAW_BODY_BYTES = 2048;\nconst MAX_RETRY_AFTER_MS = 30_000;\n\nfunction parseRetryAfter(header: string | null): number | null {\n if (!header) return null;\n const trimmed = header.trim();\n const seconds = Number(trimmed);\n if (Number.isFinite(seconds) && seconds >= 0) {\n return Math.min(seconds * 1000, MAX_RETRY_AFTER_MS);\n }\n const date = Date.parse(trimmed);\n if (Number.isFinite(date)) {\n const delta = date - Date.now();\n return delta > 0 ? Math.min(delta, MAX_RETRY_AFTER_MS) : 0;\n }\n return null;\n}\n\nfunction truncateRawBody(raw: string): string | undefined {\n if (!raw) return undefined;\n return raw.length > MAX_RAW_BODY_BYTES ? raw.slice(0, MAX_RAW_BODY_BYTES) + '…' : raw;\n}\n\n/**\n * The error a non-2xx response stands for, read off its body.\n *\n * The API wraps errors as `{ error: { message, code, type, data? } }`; a body\n * that is not JSON (an HTML 502 from a proxy) is kept, truncated, as\n * `rawBody`. A 401 is a {@link DelopayAuthenticationError} unless it is a\n * connector's passthrough.\n */\nasync function errorFromResponse(\n response: Response,\n requestId: string | undefined,\n): Promise<DelopayError> {\n const rawBody = await response.text().catch(() => '');\n let parsed: Record<string, unknown> = {};\n if (rawBody) {\n try {\n parsed = JSON.parse(rawBody) as Record<string, unknown>;\n } catch {\n // non-JSON error body (HTML from a proxy, truncated stream, etc.) — keep raw\n }\n }\n // API wraps errors as { error: { message, code, type, data? } } — unwrap if present\n const err = (parsed.error as Record<string, unknown>) ?? parsed;\n const message = (err.message as string) ?? `Request failed with status ${response.status}`;\n const code = (err.code as string) ?? '';\n const type = (err.error_type as string) ?? (err.type as string) ?? '';\n const data =\n err.data && typeof err.data === 'object' && !Array.isArray(err.data)\n ? (err.data as Record<string, unknown>)\n : undefined;\n const truncatedRaw = truncateRawBody(rawBody);\n\n // A 401 usually means OUR credential (API key / JWT) was rejected —\n // but connector-passthrough errors (`CE_*` / type \"connector\", e.g.\n // a PSP rejecting the merchant's stored Stripe key) propagate the\n // upstream status and are NOT a Delopay authentication failure, so\n // they stay a plain DelopayError instead of triggering the\n // \"re-authenticate\" handling dashboards attach to auth errors.\n const isConnectorPassthrough = type === 'connector' || code.startsWith('CE_');\n if (response.status === 401 && !isConnectorPassthrough) {\n return new DelopayAuthenticationError(message, {\n code,\n type,\n requestId,\n rawBody: truncatedRaw,\n data,\n });\n }\n\n return new DelopayError(message, {\n status: response.status,\n code,\n type,\n requestId,\n rawBody: truncatedRaw,\n data,\n });\n}\n\nfunction findIdempotencyKey(headers: Record<string, string>): string | undefined {\n for (const [k, v] of Object.entries(headers)) {\n if (k.toLowerCase() === 'idempotency-key') return v;\n }\n return undefined;\n}\n\ninterface CombinedSignal {\n signal: AbortSignal;\n dispose: () => void;\n}\n\nfunction noop(): void {\n // Intentionally empty: no listeners registered, nothing to clean up.\n}\n\n/**\n * A `onDownloadProgress` listener threw. Carried out of the transport as-is so\n * the retry logic never mistakes the caller's own failure — a `TypeError` in a\n * progress bar, say — for a network error and downloads the body again.\n */\nclass ListenerFailure {\n constructor(readonly cause: unknown) {}\n}\n\n/**\n * The body stream failed after the headers arrived: the connection dropped, or\n * the server aborted it because it could not finish the body it had started.\n * Surfaced as the transport's ordinary network error, so it is retried on\n * exactly the same terms as a failure before the first byte.\n */\nclass BodyStreamFailure {\n constructor(readonly cause: unknown) {}\n}\n\nfunction abortError(): Error {\n const error = new Error('The operation was aborted');\n error.name = 'AbortError';\n return error;\n}\n\n/** `Content-Length` as a byte count, or `null` when absent or unreadable. */\nfunction parseContentLength(header: string | null): number | null {\n if (header === null || !/^\\s*\\d+\\s*$/.test(header)) return null;\n const value = Number(header);\n return Number.isSafeInteger(value) ? value : null;\n}\n\n/**\n * One `reader.read()`, raced against the request's signal.\n *\n * A conforming `fetch` errors the body stream itself when its signal aborts,\n * but not every stream a runtime or a polyfill hands back does, and a read\n * that never settles would hold a timed-out or cancelled download open for\n * good. The race makes the abort reach the reader either way.\n */\nfunction readChunk(\n reader: ReadableStreamDefaultReader<Uint8Array>,\n signal: AbortSignal,\n): Promise<ReadableStreamReadResult<Uint8Array>> {\n if (signal.aborted) return Promise.reject(abortError());\n return new Promise((resolve, reject) => {\n const onAbort = () => reject(abortError());\n signal.addEventListener('abort', onAbort, { once: true });\n reader.read().then(\n (result) => {\n signal.removeEventListener('abort', onAbort);\n resolve(result);\n },\n (cause: unknown) => {\n signal.removeEventListener('abort', onAbort);\n reject(signal.aborted ? abortError() : new BodyStreamFailure(cause));\n },\n );\n });\n}\n\n/** The chunks as one buffer of exactly `length` bytes. */\nfunction concatChunks(chunks: Uint8Array[], length: number): ArrayBuffer {\n const out = new Uint8Array(length);\n let offset = 0;\n for (const chunk of chunks) {\n out.set(chunk, offset);\n offset += chunk.byteLength;\n }\n return out.buffer;\n}\n\n/**\n * Read a 2xx body chunk by chunk, reporting each one, and decode it as\n * `responseType` asks — the `onDownloadProgress` path of `request()`.\n *\n * `onActivity` is called when the headers arrive and on every chunk; the\n * caller uses it to restart its idle timer.\n */\nasync function receiveWithProgress(\n response: Response,\n responseType: RequestOptions['responseType'],\n listener: (event: DownloadProgressEvent) => void,\n attempt: number,\n signal: AbortSignal,\n onActivity: () => void,\n): Promise<unknown> {\n const headers = response.headers ?? new Headers();\n const total = parseContentLength(headers.get('content-length'));\n let loaded = 0;\n const notify = (chunk: Uint8Array) => {\n try {\n // A copy: the request resolves to the bytes it read, whatever a\n // listener does with the ones it was shown.\n listener({ loaded, total, chunk: chunk.slice(), headers, attempt });\n } catch (cause) {\n throw new ListenerFailure(cause);\n }\n };\n\n onActivity();\n notify(new Uint8Array(0));\n\n const body = response.body;\n if (!body || typeof body.getReader !== 'function') {\n // No readable stream: a null-body status, or a runtime whose `fetch` does\n // not expose one. The body is read whole, and reported as one chunk.\n if (responseType === 'blob') {\n const blob = await response.blob();\n const bytes = new Uint8Array(await blob.arrayBuffer());\n loaded = bytes.byteLength;\n if (loaded > 0) notify(bytes);\n return blob;\n }\n if (responseType === 'arraybuffer') {\n const buffer = await response.arrayBuffer();\n loaded = buffer.byteLength;\n if (loaded > 0) notify(new Uint8Array(buffer));\n return buffer;\n }\n const text = await response.text();\n const bytes = new TextEncoder().encode(text);\n loaded = bytes.byteLength;\n if (loaded > 0) notify(bytes);\n return text ? JSON.parse(text) : undefined;\n }\n\n const reader = body.getReader();\n const chunks: Uint8Array[] = [];\n try {\n for (;;) {\n const { done, value } = await readChunk(reader, signal);\n if (done) break;\n if (!value || value.byteLength === 0) continue;\n chunks.push(value);\n loaded += value.byteLength;\n onActivity();\n notify(value);\n }\n } catch (err) {\n // Release the connection rather than leave a half-read body behind it.\n reader.cancel().catch(noop);\n throw err;\n }\n\n const bytes = concatChunks(chunks, loaded);\n if (responseType === 'blob') {\n return new Blob([bytes], { type: headers.get('content-type') ?? '' });\n }\n if (responseType === 'arraybuffer') {\n return bytes;\n }\n const text = new TextDecoder().decode(bytes);\n return text ? JSON.parse(text) : undefined;\n}\n\nfunction combineSignals(signals: AbortSignal[]): CombinedSignal {\n const controller = new AbortController();\n const listeners: { signal: AbortSignal; handler: () => void }[] = [];\n const dispose = () => {\n for (const { signal, handler } of listeners) {\n signal.removeEventListener('abort', handler);\n }\n listeners.length = 0;\n };\n for (const signal of signals) {\n if (signal.aborted) {\n controller.abort(signal.reason);\n dispose();\n return { signal: controller.signal, dispose: noop };\n }\n const handler = () => {\n controller.abort(signal.reason);\n dispose();\n };\n signal.addEventListener('abort', handler, { once: true });\n listeners.push({ signal, handler });\n }\n return { signal: controller.signal, dispose };\n}\n\n/**\n * Events emitted by the debug logger.\n * - `request` — about to send a request (`method`, `url`, `path`)\n * - `response` — response received (`status`, `method`, `path`, `requestId?`)\n * - `retry` — about to retry after a transient failure (`attempt`, `maxRetries`, `method`, `path`)\n */\nexport type DelopayLogger = (\n event: 'request' | 'response' | 'retry',\n data: Record<string, unknown>,\n) => void;\n\n/**\n * Configuration options for the Delopay client.\n */\nexport interface DelopayOptions {\n /**\n * Use the sandbox environment (`https://sandbox.delopay.net/api`). Defaults\n * to `false` (production). Request paths are appended to that address, so a\n * payment is created at `https://sandbox.delopay.net/api/payments`.\n */\n sandbox?: boolean;\n /** Override the base URL entirely. Takes precedence over `sandbox`. */\n baseUrl?: string;\n /** Request timeout in milliseconds. Defaults to `30000` (30 seconds). */\n timeout?: number;\n /**\n * Maximum number of automatic retries for transient failures (5xx, timeout, network errors).\n * Retries use exponential backoff. Set to `0` to disable. Defaults to `2`.\n * Only idempotent-safe requests (GET, DELETE, and requests with an `Idempotency-Key` header) are retried.\n */\n maxRetries?: number;\n /** Enable debug logging of requests and responses. Defaults to `false`. */\n debug?: boolean;\n /**\n * Custom logger for debug events (`request`, `response`, `retry`). When omitted,\n * debug output is written to `console.log`. Has no effect unless `debug` is `true`.\n * Useful for routing SDK logs through pino, winston, or similar structured loggers.\n */\n logger?: DelopayLogger;\n /**\n * The shop (business profile) every request acts on, sent as `X-Profile-Id`.\n * An API key bound to several shops must name one of them on every request;\n * create one client per shop. A header a call sets itself takes precedence.\n */\n profileId?: string;\n}\n\nconst SENSITIVE_QUERY_KEYS = new Set([\n 'client_secret',\n 'ephemeral_key',\n 'api_key',\n 'publishable_key',\n]);\n\n/**\n * Return a copy of `url` with the values of known-sensitive query parameters\n * replaced by `REDACTED`, leaving the rest of the query string intact.\n * Used only to sanitize URLs before they hit debug logs.\n */\nfunction redactUrlForLogging(url: string): string {\n const qIdx = url.indexOf('?');\n if (qIdx === -1) return url;\n const base = url.slice(0, qIdx);\n const query = url.slice(qIdx + 1);\n const parts = query.split('&').map((pair) => {\n const eqIdx = pair.indexOf('=');\n if (eqIdx === -1) return pair;\n const key = pair.slice(0, eqIdx);\n if (SENSITIVE_QUERY_KEYS.has(decodeURIComponent(key).toLowerCase())) {\n return `${key}=REDACTED`;\n }\n return pair;\n });\n return `${base}?${parts.join('&')}`;\n}\n\n/**\n * One step of a response body's download, reported to\n * {@link RequestOptions.onDownloadProgress}.\n */\nexport interface DownloadProgressEvent {\n /** Body bytes received so far on this attempt, `chunk` included. */\n loaded: number;\n /**\n * `Content-Length`, when the response carried one — a buffered body such as\n * a PDF. `null` for a streamed (chunked) body, whose size is not known\n * until it ends. With a compressed transfer it is the compressed size, so\n * `loaded` can pass it.\n */\n total: number | null;\n /**\n * The bytes this event reports. Empty on the first event of an attempt,\n * which fires as soon as the headers arrive, before any of the body.\n * A copy: changing it cannot change the value the request resolves to.\n */\n chunk: Uint8Array;\n /** The response headers, available from the first event on. */\n headers: Headers;\n /**\n * Which attempt this is, from `0`. A retried request reports its body\n * again from the start under the next number, so a listener that\n * accumulates state resets it when this changes.\n */\n attempt: number;\n}\n\n/**\n * Low-level options forwarded to a single HTTP request.\n */\nexport interface RequestOptions {\n /** Request body, serialised as JSON. */\n body?: unknown;\n /**\n * @internal Resource assertion that this operation deduplicates by the JSON\n * body's idempotency_key. Null means that optional key is absent, so the write\n * must not be retried. The transport checks the assertion against the body;\n * it does not send this option or copy a JSON key into an HTTP header.\n */\n bodyIdempotencyKey?: string | null;\n /**\n * Query-string parameters. `undefined` and `null` values are omitted.\n * Array values are emitted as repeated keys (`?tag=a&tag=b`) — not comma-joined.\n */\n query?: Record<\n string,\n string | number | boolean | null | undefined | (string | number | boolean)[]\n >;\n /** Additional HTTP headers merged with the default `api-key` header. */\n headers?: Record<string, string>;\n /**\n * Override the client-level timeout for this request, in milliseconds.\n *\n * Covers the whole request, body included — unless `onDownloadProgress` is\n * set, in which case it is an **idle** timeout: it restarts when the\n * headers arrive and on every chunk of the body, so a long download that\n * keeps making progress is never cut off, and one that stalls still is.\n */\n timeout?: number;\n /**\n * Caller-provided `AbortSignal`. Aborting it cancels the in-flight request and rejects\n * with a `DelopayError` carrying code `'ABORTED'`. Combined with the per-request timeout.\n */\n signal?: AbortSignal;\n /**\n * How to decode a 2xx response body. `'json'` (the default) parses JSON;\n * `'blob'` / `'arraybuffer'` return the raw bytes for binary endpoints\n * such as PDF exports. Error responses are always decoded as JSON and\n * thrown as `DelopayError` regardless of this setting.\n */\n responseType?: 'json' | 'blob' | 'arraybuffer';\n /**\n * Pass `keepalive: true` to let the request outlive its page — e.g.\n * telemetry sent while the document is navigating away. Browsers cap\n * keepalive request bodies at ~64 KiB and reject larger ones.\n */\n keepalive?: boolean;\n /**\n * Report a 2xx response body as it downloads. Called once as soon as the\n * headers arrive (with an empty `chunk` and `loaded: 0`), then once per\n * chunk of the body; the value the request resolves to is decoded from\n * those same bytes, per `responseType`. Error responses are not reported.\n *\n * Setting it turns `timeout` into an idle timeout (see there). A body that\n * fails part-way rejects with the ordinary `NETWORK` error and is retried\n * on the usual terms, starting again under the next `attempt`. A listener\n * that throws rejects the request with that error, unretried.\n */\n onDownloadProgress?: (event: DownloadProgressEvent) => void;\n}\n\nexport type RequestFn = <T>(method: string, path: string, options?: RequestOptions) => Promise<T>;\n\n/**\n * Per-call options that resource methods accept as an optional final argument:\n * extra HTTP headers (e.g. `Idempotency-Key`), a per-request timeout override,\n * an `AbortSignal` for cancellation, and a download-progress listener — the\n * last is what a file download (a statement PDF, a report CSV) reports its\n * bytes through.\n */\nexport type RequestExtras = Pick<\n RequestOptions,\n 'headers' | 'timeout' | 'signal' | 'onDownloadProgress'\n>;\n\n/** How long an event stream may stay silent before it is given up. */\nconst DEFAULT_STREAM_IDLE_TIMEOUT_MS = 45_000;\n\n/** Options of one `text/event-stream` request. */\nexport interface EventStreamRequestOptions {\n /** Query-string parameters, as {@link RequestOptions.query}. */\n query?: RequestOptions['query'];\n /** Additional HTTP headers, merged over the auth header. */\n headers?: Record<string, string>;\n /**\n * Aborting it before the response arrives rejects with code `ABORTED`;\n * aborting it later ends the dispatches without an error.\n */\n signal?: AbortSignal;\n /**\n * How long the stream may stay silent, response headers included, before\n * it fails with code `TIMEOUT`. Paused while the consumer holds a dispatch.\n * Defaults to 45 seconds.\n */\n idleTimeoutMs?: number;\n /** Sent as `Last-Event-ID`, and the id the stream starts from. */\n lastEventId?: string | null;\n}\n\n/**\n * An open event stream. Its body is read as it is iterated and never kept:\n * only the line and the event in progress are held.\n */\nexport interface EventStreamConnection {\n /**\n * The stream's dispatches, in order. Ends when the server closes the\n * stream or the caller aborts or closes it; throws a `DelopayError` with\n * code `TIMEOUT` when the stream is silent too long, and `NETWORK` when\n * the connection fails. Iterate it once.\n */\n readonly dispatches: AsyncIterable<EventStreamDispatch>;\n /** Close the stream: the iteration ends and the connection is released. */\n close(): void;\n}\n\n/** Opens a `GET` event stream; what resources that stream receive. */\nexport type EventStreamFn = (\n path: string,\n options?: EventStreamRequestOptions,\n) => Promise<EventStreamConnection>;\n\n/**\n * What a resource class is built from: the client's request and event-stream\n * functions. Every resource takes the request function first; the few that\n * stream (`Live`, `ProcessorImports`) also take the stream opener.\n */\nexport interface DelopayTransport {\n /** Send one request with the client's credentials, retries and timeout. */\n readonly request: RequestFn;\n /** Open one `text/event-stream` request with the client's credentials. */\n readonly openStream: EventStreamFn;\n /** The resolved base URL every request goes to. */\n readonly baseUrl: string;\n}\n\n/** A resource class that {@link DelopayCore.use} can build. */\nexport type ResourceConstructor<T> = new (request: RequestFn, openStream: EventStreamFn) => T;\n\n/**\n * The Delopay client without its resources: credentials, configuration,\n * transport, sessions and pagination.\n *\n * {@link Delopay} extends it with every resource as a property, which puts\n * every resource in the application's bundle. An application that wants only\n * the resources it calls builds them from this class instead, importing each\n * one from its own module, so a bundler leaves the rest out and can load each\n * one with the code that uses it:\n *\n * @example\n * ```typescript\n * import { DelopayCore } from '@delopay/sdk/core';\n * import { Refunds } from '@delopay/sdk/resources/refunds';\n *\n * const client = new DelopayCore('snd_...', { sandbox: true });\n * const refunds = client.use(Refunds);\n * const refund = await refunds.create({ payment_id: 'pay_abc123' });\n * ```\n *\n * A resource built this way shares the client's credentials: a token set with\n * {@link DelopayCore.setJwtToken} applies to it at once.\n */\nexport class DelopayCore {\n /** The resolved base URL used for all API requests. */\n readonly baseUrl: string;\n private readonly apiKey: string;\n private readonly timeout: number;\n private readonly maxRetries: number;\n private readonly debug: boolean;\n private readonly logger?: DelopayLogger;\n private readonly profileId?: string;\n private jwtToken?: string;\n\n /** The functions every resource is built from; see {@link DelopayCore.use}. */\n readonly transport: DelopayTransport;\n\n private readonly resources = new Map<ResourceConstructor<unknown>, unknown>();\n\n /**\n * Create a new client.\n *\n * @param apiKey - Your Delopay API key (e.g. `prd_...` or `snd_...`).\n * Pass an empty string or omit for JWT-only usage (e.g. dashboard apps).\n * @param options - Optional configuration (sandbox mode, base URL override, timeout).\n */\n constructor(apiKey?: string, options?: DelopayOptions) {\n this.apiKey = apiKey ?? '';\n this.timeout = options?.timeout ?? 30_000;\n this.maxRetries = options?.maxRetries ?? 2;\n this.debug = options?.debug ?? false;\n if (options?.logger !== undefined) this.logger = options.logger;\n if (options?.profileId !== undefined && options.profileId !== '') {\n this.profileId = options.profileId;\n }\n\n if (options?.baseUrl !== undefined) {\n this.baseUrl = options.baseUrl;\n } else if (options?.sandbox) {\n this.baseUrl = SANDBOX_URL;\n } else {\n this.baseUrl = PRODUCTION_URL;\n }\n\n this.transport = {\n request: this.request.bind(this) as RequestFn,\n openStream: this.openEventStream.bind(this),\n baseUrl: this.baseUrl,\n };\n }\n\n /**\n * The client's instance of a resource class, built on first use from this\n * client's transport. Later calls with the same class return the same\n * instance.\n *\n * A resource whose constructor takes something else besides the transport\n * (`Branding` takes the base URL) is built directly instead:\n * `new Branding(client.transport.request, client.baseUrl)`.\n *\n * @param Resource - The resource class, imported from its own module.\n * @returns The resource, bound to this client.\n */\n use<T>(Resource: ResourceConstructor<T>): T {\n let resource = this.resources.get(Resource) as T | undefined;\n if (resource === undefined) {\n resource = new Resource(this.transport.request, this.transport.openStream);\n this.resources.set(Resource, resource);\n }\n return resource;\n }\n\n /**\n * Set a JWT token for subsequent requests.\n * When set, requests use `Authorization: Bearer <token>` instead of `api-key`.\n * Useful after `users.signIn()` returns a JWT for dashboard operations.\n */\n setJwtToken(token: string): void {\n this.jwtToken = token;\n }\n\n /**\n * Clear the JWT token, reverting to API key authentication.\n */\n clearJwtToken(): void {\n this.jwtToken = undefined;\n }\n\n /**\n * End the current login session on the server (`POST /user/signout`), the\n * same request as {@link Users.signOut}. The token stays set on this\n * client: clear it with {@link DelopayCore.clearJwtToken} afterwards. The\n * request's `Authorization` header is built when this is called, so\n * clearing the token straight after still signs out the session it held.\n */\n async signOut(): Promise<Record<string, unknown>> {\n return this.request('POST', '/user/signout');\n }\n\n /**\n * Refresh the current login JWT (see {@link Users.refreshToken}) and\n * apply the fresh token to this client, so subsequent requests use it.\n * Returns the fresh token for the caller to persist (e.g. session\n * storage) — the backend has already re-set the `login_token` cookie.\n *\n * If the client's auth state changes while the refresh is pending —\n * `clearJwtToken()` on sign-out, or `setJwtToken()` switching to another\n * session — the stale completion is discarded and this rejects with a\n * `session_changed` `DelopayError` (status 0), so the explicit change\n * wins and the caller never persists a token for a session that is gone.\n *\n * Otherwise throws like any other request; in particular a 401 means the\n * session is dead (expired/blacklisted/revoked), a 429 means a refresh\n * was already minted for this session within the last minute, and a 400\n * means this token has no revocable session to slide (no `jti` — team\n * impersonation is the case in practice) and can never be refreshed,\n * though it stays valid for ordinary calls.\n */\n async refreshSession(): Promise<TokenResponse> {\n const originatingToken = this.jwtToken;\n const response = await this.request<TokenResponse>('POST', '/user/token/refresh');\n if (this.jwtToken !== originatingToken) {\n throw new DelopayError(\n 'Auth state changed while the refresh was pending; refreshed token discarded',\n {\n status: 0,\n code: 'session_changed',\n type: 'session_changed',\n },\n );\n }\n this.setJwtToken(response.token);\n return response;\n }\n\n /** `path` on the base URL, with the query string `query` makes. */\n private buildUrl(path: string, query?: RequestOptions['query']): string {\n let url = `${this.baseUrl}${path}`;\n if (query) {\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === undefined || value === null) continue;\n if (Array.isArray(value)) {\n for (const v of value) {\n if (v !== undefined && v !== null) params.append(key, String(v));\n }\n } else {\n params.set(key, String(value));\n }\n }\n const qs = params.toString();\n if (qs) {\n url += `?${qs}`;\n }\n }\n return url;\n }\n\n /** The credential header: the JWT when one is set, else the API key. */\n /**\n * The client's `X-Profile-Id`, unless the call names one itself (in any\n * letter case: two spellings would be sent as one joined value).\n */\n private profileHeaders(callHeaders?: Record<string, string>): Record<string, string> {\n if (this.profileId === undefined) return {};\n const named = Object.keys(callHeaders ?? {}).some(\n (name) => name.toLowerCase() === 'x-profile-id',\n );\n return named ? {} : { 'X-Profile-Id': this.profileId };\n }\n\n private authHeaders(): Record<string, string> {\n if (this.jwtToken) return { Authorization: `Bearer ${this.jwtToken}` };\n if (this.apiKey) return { 'api-key': this.apiKey };\n return {};\n }\n\n /** One debug event, when `debug` is on. */\n private log(event: 'request' | 'response' | 'retry', data: Record<string, unknown>): void {\n if (!this.debug) return;\n if (this.logger) {\n this.logger(event, data);\n return;\n }\n if (event === 'request')\n console.log(`[delopay] ${data.method as string} ${data.url as string}`);\n else if (event === 'response')\n console.log(\n `[delopay] ${data.status as number} ${data.method as string} ${data.path as string}`,\n );\n else\n console.log(\n `[delopay] retry ${data.attempt as number}/${data.maxRetries as number} ${data.method as string} ${data.path as string}`,\n );\n }\n\n /**\n * Open a `GET` `text/event-stream` and read it as it arrives.\n *\n * `request()` keeps every chunk of a body until the body ends, which a\n * stream that stays open for half an hour must not do; this reads the body\n * chunk by chunk through {@link EventStreamParser} and keeps nothing it has\n * dispatched. Credentials, the base URL, debug logging and the mapping of a\n * non-2xx answer to `DelopayError` / `DelopayAuthenticationError` are the\n * ones `request()` uses.\n *\n * Never retried, and never reconnected: the caller owns reconnection.\n * Resolves once the response headers arrive; rejects on a non-2xx answer,\n * on a 2xx that is not `text/event-stream` (code `NOT_EVENT_STREAM`), and\n * with `TIMEOUT`, `NETWORK` or `ABORTED` like `request()`.\n */\n protected async openEventStream(\n path: string,\n options: EventStreamRequestOptions = {},\n ): Promise<EventStreamConnection> {\n const url = this.buildUrl(path, options.query);\n const lastEventId = options.lastEventId ?? '';\n const headers: Record<string, string> = {\n ...this.authHeaders(),\n ...this.profileHeaders(options.headers),\n Accept: 'text/event-stream',\n ...(lastEventId ? { 'Last-Event-ID': lastEventId } : {}),\n ...options.headers,\n };\n const idleMs = options.idleTimeoutMs ?? DEFAULT_STREAM_IDLE_TIMEOUT_MS;\n const callerSignal = options.signal;\n const aborted = () =>\n new DelopayError('Request aborted', { status: 0, code: 'ABORTED', type: 'abort_error' });\n if (callerSignal?.aborted) throw aborted();\n\n const idleCtrl = new AbortController();\n const closeCtrl = new AbortController();\n let timer: ReturnType<typeof setTimeout> | undefined;\n const stopIdleTimer = () => {\n if (timer !== undefined) clearTimeout(timer);\n timer = undefined;\n };\n const startIdleTimer = () => {\n stopIdleTimer();\n if (!idleCtrl.signal.aborted) timer = setTimeout(() => idleCtrl.abort(), idleMs);\n };\n const combined = combineSignals(\n callerSignal\n ? [idleCtrl.signal, closeCtrl.signal, callerSignal]\n : [idleCtrl.signal, closeCtrl.signal],\n );\n const release = () => {\n stopIdleTimer();\n combined.dispose();\n };\n const timedOut = () =>\n new DelopayError(`Event stream silent for ${idleMs} ms`, {\n status: 0,\n code: 'TIMEOUT',\n type: 'timeout_error',\n });\n const network = (cause: unknown) =>\n new DelopayError(\n `Network error: ${cause instanceof Error ? cause.message : String(cause ?? 'stream failed')}`,\n { status: 0, code: 'NETWORK', type: 'network_error' },\n );\n\n this.log('request', { method: 'GET', url: redactUrlForLogging(url), path });\n startIdleTimer();\n let response: Response;\n try {\n response = await fetch(url, { method: 'GET', headers, signal: combined.signal });\n } catch (err) {\n release();\n if (callerSignal?.aborted) throw aborted();\n if (idleCtrl.signal.aborted) throw timedOut();\n throw network(err);\n }\n\n const requestId =\n response.headers?.get('x-request-id') ?? response.headers?.get('x-trace-id') ?? undefined;\n this.log('response', { status: response.status, method: 'GET', path, requestId });\n\n if (!response.ok) {\n // Read under the idle timer: a body that never ends gives up as empty.\n const error = await errorFromResponse(response, requestId);\n release();\n throw error;\n }\n\n const body = response.body;\n const contentType = response.headers?.get('content-type') ?? '';\n const mediaType = (contentType.split(';')[0] ?? '').trim().toLowerCase();\n if (mediaType !== 'text/event-stream' || !body || typeof body.getReader !== 'function') {\n release();\n body?.cancel().catch(noop);\n throw new DelopayError(\n mediaType === 'text/event-stream'\n ? 'The event stream has no readable body'\n : `Expected a text/event-stream response, got ${contentType ? `\"${contentType}\"` : 'no content type'}`,\n {\n status: response.status,\n code: 'NOT_EVENT_STREAM',\n type: 'invalid_response',\n requestId,\n },\n );\n }\n\n // The idle timer runs only while a read is pending: a consumer busy with\n // an event, or one that has not started iterating, is not silence.\n stopIdleTimer();\n const reader = body.getReader();\n const parser = new EventStreamParser(lastEventId);\n const decoder = new TextDecoder();\n const stopped = () => Boolean(callerSignal?.aborted) || closeCtrl.signal.aborted;\n let finished = false;\n const finish = () => {\n if (finished) return;\n finished = true;\n release();\n reader.cancel().catch(noop);\n };\n\n async function* dispatches(): AsyncGenerator<EventStreamDispatch, void, undefined> {\n try {\n for (;;) {\n let result: ReadableStreamReadResult<Uint8Array>;\n startIdleTimer();\n try {\n result = await readChunk(reader, combined.signal);\n } catch (err) {\n if (callerSignal?.aborted || closeCtrl.signal.aborted) return;\n if (idleCtrl.signal.aborted) throw timedOut();\n throw network(err instanceof BodyStreamFailure ? err.cause : err);\n } finally {\n stopIdleTimer();\n }\n if (result.done) {\n // An event the stream did not finish with a blank line is\n // discarded, as the standard has it; only completed ones count.\n for (const dispatch of parser.push(decoder.decode())) {\n if (stopped()) return;\n yield dispatch;\n }\n return;\n }\n if (!result.value || result.value.byteLength === 0) continue;\n for (const dispatch of parser.push(decoder.decode(result.value, { stream: true }))) {\n // Aborted or closed while the consumer held the previous one.\n if (stopped()) return;\n yield dispatch;\n }\n }\n } finally {\n finish();\n }\n }\n\n return {\n dispatches: dispatches(),\n close: () => {\n closeCtrl.abort();\n finish();\n },\n };\n }\n\n /**\n * Make a raw HTTP request to the Delopay API.\n *\n * You rarely need to call this directly — prefer the typed resource methods.\n * Use it only for endpoints not yet covered by a resource class.\n *\n * @param method - HTTP method (`GET`, `POST`, `PUT`, `PATCH`, `DELETE`).\n * @param path - API path starting with `/` (e.g. `/payments`).\n * @param options - Optional body, query parameters, and headers.\n * @returns Parsed JSON response body typed as `T`.\n * @throws {DelopayAuthenticationError} On 401 responses.\n * @throws {DelopayError} On all other non-2xx responses, timeouts, and network errors.\n */\n async request<T>(method: string, path: string, options?: RequestOptions): Promise<T> {\n const url = this.buildUrl(path, options?.query);\n\n let headers: Record<string, string> = {\n ...this.authHeaders(),\n ...this.profileHeaders(options?.headers),\n ...options?.headers,\n };\n\n // FormData / Blob / ArrayBuffer / URLSearchParams pass through unchanged so callers\n // can send multipart uploads. The runtime (browser or Node 18+ fetch) sets the\n // appropriate Content-Type including the multipart boundary, so we don't touch it.\n const isRawBody =\n options?.body !== undefined &&\n options?.body !== null &&\n (options.body instanceof FormData ||\n options.body instanceof Blob ||\n options.body instanceof ArrayBuffer ||\n options.body instanceof URLSearchParams);\n\n if (options?.body && !isRawBody) {\n headers['Content-Type'] = 'application/json';\n }\n\n // Serialize body once so circular-reference errors surface immediately and big payloads\n // aren't re-stringified on every retry attempt. Raw bodies pass through untouched.\n let serializedBody: BodyInit | undefined;\n if (isRawBody) {\n serializedBody = options?.body as BodyInit;\n } else if (options?.body) {\n serializedBody = JSON.stringify(options.body);\n }\n\n let idempotencyKey = findIdempotencyKey(headers)?.trim();\n if (options && Object.prototype.hasOwnProperty.call(options, 'bodyIdempotencyKey')) {\n const bodyKey = options?.bodyIdempotencyKey;\n const serialized: unknown =\n !isRawBody && typeof serializedBody === 'string' ? JSON.parse(serializedBody) : null;\n const actualKey =\n serialized && typeof serialized === 'object' && !Array.isArray(serialized)\n ? ((serialized as Record<string, unknown>).idempotency_key ?? null)\n : null;\n const suppliedHeaders = Object.keys(headers).filter(\n (name) => name.toLowerCase() === 'idempotency-key',\n );\n if (\n (bodyKey !== null && typeof bodyKey !== 'string') ||\n actualKey !== bodyKey ||\n suppliedHeaders.some(\n (name) => headers[name] !== bodyKey || headers[name]?.trim() !== headers[name],\n )\n ) {\n throw new DelopayError('Request retry keys must match the JSON body key', {\n status: 0,\n code: 'IDEMPOTENCY_KEY_MISMATCH',\n type: 'invalid_request',\n });\n }\n idempotencyKey = bodyKey?.trim();\n // Collapse differently cased copies so fetch cannot combine them into a\n // different header value. Other caller headers remain untouched.\n if (suppliedHeaders.length > 0) {\n headers = {\n ...Object.fromEntries(\n Object.entries(headers).filter(([name]) => name.toLowerCase() !== 'idempotency-key'),\n ),\n 'Idempotency-Key': idempotencyKey ?? '',\n };\n }\n }\n const isRetryable =\n method === 'GET' ||\n method === 'DELETE' ||\n (idempotencyKey !== undefined && idempotencyKey !== '');\n\n const callerSignal = options?.signal;\n if (callerSignal?.aborted) {\n throw new DelopayError('Request aborted', {\n status: 0,\n code: 'ABORTED',\n type: 'abort_error',\n });\n }\n\n const timeoutMs = options?.timeout ?? this.timeout;\n\n let lastError: unknown;\n let retryAfterOverrideMs: number | null = null;\n\n const safeUrl = () => redactUrlForLogging(url);\n const emit = (event: 'request' | 'response' | 'retry', data: Record<string, unknown>) =>\n this.log(event, data);\n\n for (let attempt = 0; attempt <= this.maxRetries; attempt++) {\n if (attempt > 0) {\n const base = Math.min(500 * 2 ** (attempt - 1), 5000);\n // Full jitter: pick uniformly in [0, base) to avoid synchronized retry storms.\n const jittered = Math.random() * base;\n const delay = Math.max(retryAfterOverrideMs ?? 0, jittered);\n retryAfterOverrideMs = null;\n await new Promise((resolve) => setTimeout(resolve, delay));\n emit('retry', { attempt, maxRetries: this.maxRetries, method, path });\n }\n\n const timeoutCtrl = new AbortController();\n let timeoutId = setTimeout(() => timeoutCtrl.abort(), timeoutMs);\n // With a progress listener the timeout measures silence, not the whole\n // download: each sign of life restarts it.\n const restartIdleTimer = () => {\n if (timeoutCtrl.signal.aborted) return;\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => timeoutCtrl.abort(), timeoutMs);\n };\n const combined = combineSignals(\n callerSignal ? [timeoutCtrl.signal, callerSignal] : [timeoutCtrl.signal],\n );\n\n try {\n emit('request', { method, url: safeUrl(), path });\n\n const response = await fetch(url, {\n method,\n headers,\n body: serializedBody,\n signal: combined.signal,\n ...(options?.keepalive !== undefined ? { keepalive: options.keepalive } : {}),\n });\n\n const requestId =\n response.headers?.get('x-request-id') ?? response.headers?.get('x-trace-id') ?? undefined;\n\n emit('response', { status: response.status, method, path, requestId });\n\n if (!response.ok) {\n // A 401 that is our credential's comes back as a\n // DelopayAuthenticationError; its status is never transient, so it\n // is thrown below without a retry.\n const error = await errorFromResponse(response, requestId);\n\n // Retry on 5xx and 429 (rate limit). 4xx other than 429 are not transient.\n const isTransientStatus = response.status >= 500 || response.status === 429;\n if (isTransientStatus && isRetryable && attempt < this.maxRetries) {\n if (response.status === 429) {\n retryAfterOverrideMs = parseRetryAfter(response.headers?.get('retry-after') ?? null);\n }\n lastError = error;\n continue;\n }\n\n throw error;\n }\n\n if (options?.onDownloadProgress) {\n return (await receiveWithProgress(\n response,\n options.responseType,\n options.onDownloadProgress,\n attempt,\n combined.signal,\n restartIdleTimer,\n )) as T;\n }\n if (options?.responseType === 'blob') {\n return (await response.blob()) as T;\n }\n if (options?.responseType === 'arraybuffer') {\n return (await response.arrayBuffer()) as T;\n }\n const text = await response.text();\n return (text ? JSON.parse(text) : undefined) as T;\n } catch (err) {\n if (err instanceof DelopayError || err instanceof DelopayAuthenticationError) {\n throw err;\n }\n if (err instanceof ListenerFailure) {\n throw err.cause;\n }\n if (err instanceof BodyStreamFailure) {\n const cause = err.cause;\n const detail =\n cause instanceof Error ? cause.message : String(cause ?? 'body stream failed');\n lastError = new DelopayError(`Network error: ${detail}`, {\n status: 0,\n code: 'NETWORK',\n type: 'network_error',\n });\n if (isRetryable && attempt < this.maxRetries) continue;\n throw lastError;\n }\n if (err instanceof Error && err.name === 'AbortError') {\n if (callerSignal?.aborted) {\n throw new DelopayError('Request aborted', {\n status: 0,\n code: 'ABORTED',\n type: 'abort_error',\n });\n }\n lastError = new DelopayError('Request timed out', {\n status: 0,\n code: 'TIMEOUT',\n type: 'timeout_error',\n });\n if (isRetryable && attempt < this.maxRetries) continue;\n throw lastError;\n }\n if (err instanceof TypeError) {\n lastError = new DelopayError(`Network error: ${err.message}`, {\n status: 0,\n code: 'NETWORK',\n type: 'network_error',\n });\n if (isRetryable && attempt < this.maxRetries) continue;\n throw lastError;\n }\n throw err;\n } finally {\n clearTimeout(timeoutId);\n combined.dispose();\n }\n }\n\n throw lastError;\n }\n\n /**\n * Auto-paginate a list endpoint. Yields items one by one, fetching\n * the next page automatically when the current one is exhausted.\n *\n * Delopay list endpoints use one of two pagination styles, so this helper\n * supports both:\n * - **Offset** (default) — for endpoints like `customers.list` that accept\n * `offset`/`limit`. Each page advances `offset` by the number of items returned.\n * - **Cursor** — for endpoints like `payments.list` and `payouts.list` that page\n * with `starting_after`/`limit` (they ignore `offset`). Pass a `cursor` extractor\n * that returns the id of an item; the next page is requested with\n * `starting_after` set to the last item's id.\n *\n * @param listFn - A function that takes the paging params and returns `{ data: T[] }` or `T[]`.\n * @param params - Additional parameters to pass to every page request.\n * @param options - Page size (number) for offset mode, or `{ pageSize?, cursor? }`.\n * Provide `cursor` to switch to cursor pagination.\n *\n * @example\n * ```typescript\n * // Offset endpoint (customers):\n * for await (const c of delopay.paginate((p) => delopay.customers.list(p))) {\n * console.log(c.customer_id);\n * }\n *\n * // Cursor endpoint (payments): extract the id used as the next cursor.\n * for await (const payment of delopay.paginate(\n * (p) => delopay.payments.list(p),\n * undefined,\n * { cursor: (p) => p.payment_id },\n * )) {\n * console.log(payment.payment_id);\n * }\n * ```\n */\n async *paginate<T, P extends Record<string, unknown>>(\n listFn: (\n params: P & { limit: number; offset?: number; starting_after?: string },\n ) => Promise<{ data: T[] } | T[]>,\n params?: P,\n options?: number | { pageSize?: number; cursor?: (item: T) => string | undefined },\n ): AsyncGenerator<T> {\n const pageSize = typeof options === 'number' ? options : (options?.pageSize ?? 50);\n const cursorOf = typeof options === 'object' ? options.cursor : undefined;\n let offset = 0;\n let after: string | undefined;\n while (true) {\n const page = { ...((params ?? {}) as P), limit: pageSize } as P & {\n limit: number;\n offset?: number;\n starting_after?: string;\n };\n if (cursorOf) {\n if (after !== undefined) page.starting_after = after;\n } else {\n page.offset = offset;\n }\n const result = await listFn(page);\n const items = Array.isArray(result) ? result : result.data;\n if (items.length === 0) break;\n for (const item of items) {\n yield item;\n }\n if (items.length < pageSize) break;\n if (cursorOf) {\n const last = items[items.length - 1];\n if (last === undefined) break;\n after = cursorOf(last);\n if (after === undefined) break;\n } else {\n offset += items.length;\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/anes/delo-payment/sdk-publish-w2/dist/chunk-HSJABE7X.cjs","../src/core.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACDA,IAAM,eAAA,EAAiB,yBAAA;AACvB,IAAM,YAAA,EAAc,iCAAA;AAEpB,IAAM,mBAAA,EAAqB,IAAA;AAC3B,IAAM,mBAAA,EAAqB,GAAA;AAE3B,SAAS,eAAA,CAAgB,MAAA,EAAsC;AAC7D,EAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,OAAO,IAAA;AACpB,EAAA,MAAM,QAAA,EAAU,MAAA,CAAO,IAAA,CAAK,CAAA;AAC5B,EAAA,MAAM,QAAA,EAAU,MAAA,CAAO,OAAO,CAAA;AAC9B,EAAA,GAAA,CAAI,MAAA,CAAO,QAAA,CAAS,OAAO,EAAA,GAAK,QAAA,GAAW,CAAA,EAAG;AAC5C,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,QAAA,EAAU,GAAA,EAAM,kBAAkB,CAAA;AAAA,EACpD;AACA,EAAA,MAAM,KAAA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AAAA;AA2CqB,EAAA;AACgD,IAAA;AACH,IAAA;AACnD,IAAA;AACT,IAAA;AACS,IAAA;AAC8C,MAAA;AAK3C,MAAA;AACmC,QAAA;AAC1C,MAAA;AACS,QAAA;AAChB,MAAA;AACgC,MAAA;AACsB,MAAA;AAC9B,MAAA;AACE,MAAA;AAClB,QAAA;AACR,MAAA;AAC6B,MAAA;AACf,MAAA;AACuB,QAAA;AACX,QAAA;AACH,QAAA;AACI,QAAA;AACpB,MAAA;AACW,QAAA;AAClB,MAAA;AACF,IAAA;AACF,EAAA;AACF;ADjc+E;AACA;AACA;AACA","file":"/home/anes/delo-payment/sdk-publish-w2/dist/chunk-HSJABE7X.cjs","sourcesContent":[null,"import { DelopayError, DelopayAuthenticationError } from './error';\nimport { EventStreamParser } from './eventStream';\nimport type { EventStreamDispatch } from './eventStream';\nimport type { TokenResponse } from './types';\n\nexport { DelopayError, DelopayAuthenticationError } from './error';\n\nconst PRODUCTION_URL = 'https://api.delopay.net';\nconst SANDBOX_URL = 'https://sandbox.delopay.net/api';\n\nconst MAX_RAW_BODY_BYTES = 2048;\nconst MAX_RETRY_AFTER_MS = 30_000;\n\nfunction parseRetryAfter(header: string | null): number | null {\n if (!header) return null;\n const trimmed = header.trim();\n const seconds = Number(trimmed);\n if (Number.isFinite(seconds) && seconds >= 0) {\n return Math.min(seconds * 1000, MAX_RETRY_AFTER_MS);\n }\n const date = Date.parse(trimmed);\n if (Number.isFinite(date)) {\n const delta = date - Date.now();\n return delta > 0 ? Math.min(delta, MAX_RETRY_AFTER_MS) : 0;\n }\n return null;\n}\n\nfunction truncateRawBody(raw: string): string | undefined {\n if (!raw) return undefined;\n return raw.length > MAX_RAW_BODY_BYTES ? raw.slice(0, MAX_RAW_BODY_BYTES) + '…' : raw;\n}\n\n/**\n * The error a non-2xx response stands for, read off its body.\n *\n * The API wraps errors as `{ error: { message, code, type, data? } }`; a body\n * that is not JSON (an HTML 502 from a proxy) is kept, truncated, as\n * `rawBody`. A 401 is a {@link DelopayAuthenticationError} unless it is a\n * connector's passthrough.\n */\nasync function errorFromResponse(\n response: Response,\n requestId: string | undefined,\n): Promise<DelopayError> {\n const rawBody = await response.text().catch(() => '');\n let parsed: Record<string, unknown> = {};\n if (rawBody) {\n try {\n parsed = JSON.parse(rawBody) as Record<string, unknown>;\n } catch {\n // non-JSON error body (HTML from a proxy, truncated stream, etc.) — keep raw\n }\n }\n // API wraps errors as { error: { message, code, type, data? } } — unwrap if present\n const err = (parsed.error as Record<string, unknown>) ?? parsed;\n const message = (err.message as string) ?? `Request failed with status ${response.status}`;\n const code = (err.code as string) ?? '';\n const type = (err.error_type as string) ?? (err.type as string) ?? '';\n const data =\n err.data && typeof err.data === 'object' && !Array.isArray(err.data)\n ? (err.data as Record<string, unknown>)\n : undefined;\n const truncatedRaw = truncateRawBody(rawBody);\n\n // A 401 usually means OUR credential (API key / JWT) was rejected —\n // but connector-passthrough errors (`CE_*` / type \"connector\", e.g.\n // a PSP rejecting the merchant's stored Stripe key) propagate the\n // upstream status and are NOT a Delopay authentication failure, so\n // they stay a plain DelopayError instead of triggering the\n // \"re-authenticate\" handling dashboards attach to auth errors.\n const isConnectorPassthrough = type === 'connector' || code.startsWith('CE_');\n if (response.status === 401 && !isConnectorPassthrough) {\n return new DelopayAuthenticationError(message, {\n code,\n type,\n requestId,\n rawBody: truncatedRaw,\n data,\n });\n }\n\n return new DelopayError(message, {\n status: response.status,\n code,\n type,\n requestId,\n rawBody: truncatedRaw,\n data,\n });\n}\n\nfunction findIdempotencyKey(headers: Record<string, string>): string | undefined {\n for (const [k, v] of Object.entries(headers)) {\n if (k.toLowerCase() === 'idempotency-key') return v;\n }\n return undefined;\n}\n\ninterface CombinedSignal {\n signal: AbortSignal;\n dispose: () => void;\n}\n\nfunction noop(): void {\n // Intentionally empty: no listeners registered, nothing to clean up.\n}\n\n/**\n * A `onDownloadProgress` listener threw. Carried out of the transport as-is so\n * the retry logic never mistakes the caller's own failure — a `TypeError` in a\n * progress bar, say — for a network error and downloads the body again.\n */\nclass ListenerFailure {\n constructor(readonly cause: unknown) {}\n}\n\n/**\n * The body stream failed after the headers arrived: the connection dropped, or\n * the server aborted it because it could not finish the body it had started.\n * Surfaced as the transport's ordinary network error, so it is retried on\n * exactly the same terms as a failure before the first byte.\n */\nclass BodyStreamFailure {\n constructor(readonly cause: unknown) {}\n}\n\nfunction abortError(): Error {\n const error = new Error('The operation was aborted');\n error.name = 'AbortError';\n return error;\n}\n\n/** `Content-Length` as a byte count, or `null` when absent or unreadable. */\nfunction parseContentLength(header: string | null): number | null {\n if (header === null || !/^\\s*\\d+\\s*$/.test(header)) return null;\n const value = Number(header);\n return Number.isSafeInteger(value) ? value : null;\n}\n\n/**\n * One `reader.read()`, raced against the request's signal.\n *\n * A conforming `fetch` errors the body stream itself when its signal aborts,\n * but not every stream a runtime or a polyfill hands back does, and a read\n * that never settles would hold a timed-out or cancelled download open for\n * good. The race makes the abort reach the reader either way.\n */\nfunction readChunk(\n reader: ReadableStreamDefaultReader<Uint8Array>,\n signal: AbortSignal,\n): Promise<ReadableStreamReadResult<Uint8Array>> {\n if (signal.aborted) return Promise.reject(abortError());\n return new Promise((resolve, reject) => {\n const onAbort = () => reject(abortError());\n signal.addEventListener('abort', onAbort, { once: true });\n reader.read().then(\n (result) => {\n signal.removeEventListener('abort', onAbort);\n resolve(result);\n },\n (cause: unknown) => {\n signal.removeEventListener('abort', onAbort);\n reject(signal.aborted ? abortError() : new BodyStreamFailure(cause));\n },\n );\n });\n}\n\n/** The chunks as one buffer of exactly `length` bytes. */\nfunction concatChunks(chunks: Uint8Array[], length: number): ArrayBuffer {\n const out = new Uint8Array(length);\n let offset = 0;\n for (const chunk of chunks) {\n out.set(chunk, offset);\n offset += chunk.byteLength;\n }\n return out.buffer;\n}\n\n/**\n * Read a 2xx body chunk by chunk, reporting each one, and decode it as\n * `responseType` asks — the `onDownloadProgress` path of `request()`.\n *\n * `onActivity` is called when the headers arrive and on every chunk; the\n * caller uses it to restart its idle timer.\n */\nasync function receiveWithProgress(\n response: Response,\n responseType: RequestOptions['responseType'],\n listener: (event: DownloadProgressEvent) => void,\n attempt: number,\n signal: AbortSignal,\n onActivity: () => void,\n): Promise<unknown> {\n const headers = response.headers ?? new Headers();\n const total = parseContentLength(headers.get('content-length'));\n let loaded = 0;\n const notify = (chunk: Uint8Array) => {\n try {\n // A copy: the request resolves to the bytes it read, whatever a\n // listener does with the ones it was shown.\n listener({ loaded, total, chunk: chunk.slice(), headers, attempt });\n } catch (cause) {\n throw new ListenerFailure(cause);\n }\n };\n\n onActivity();\n notify(new Uint8Array(0));\n\n const body = response.body;\n if (!body || typeof body.getReader !== 'function') {\n // No readable stream: a null-body status, or a runtime whose `fetch` does\n // not expose one. The body is read whole, and reported as one chunk.\n if (responseType === 'blob') {\n const blob = await response.blob();\n const bytes = new Uint8Array(await blob.arrayBuffer());\n loaded = bytes.byteLength;\n if (loaded > 0) notify(bytes);\n return blob;\n }\n if (responseType === 'arraybuffer') {\n const buffer = await response.arrayBuffer();\n loaded = buffer.byteLength;\n if (loaded > 0) notify(new Uint8Array(buffer));\n return buffer;\n }\n const text = await response.text();\n const bytes = new TextEncoder().encode(text);\n loaded = bytes.byteLength;\n if (loaded > 0) notify(bytes);\n return text ? JSON.parse(text) : undefined;\n }\n\n const reader = body.getReader();\n const chunks: Uint8Array[] = [];\n try {\n for (;;) {\n const { done, value } = await readChunk(reader, signal);\n if (done) break;\n if (!value || value.byteLength === 0) continue;\n chunks.push(value);\n loaded += value.byteLength;\n onActivity();\n notify(value);\n }\n } catch (err) {\n // Release the connection rather than leave a half-read body behind it.\n reader.cancel().catch(noop);\n throw err;\n }\n\n const bytes = concatChunks(chunks, loaded);\n if (responseType === 'blob') {\n return new Blob([bytes], { type: headers.get('content-type') ?? '' });\n }\n if (responseType === 'arraybuffer') {\n return bytes;\n }\n const text = new TextDecoder().decode(bytes);\n return text ? JSON.parse(text) : undefined;\n}\n\nfunction combineSignals(signals: AbortSignal[]): CombinedSignal {\n const controller = new AbortController();\n const listeners: { signal: AbortSignal; handler: () => void }[] = [];\n const dispose = () => {\n for (const { signal, handler } of listeners) {\n signal.removeEventListener('abort', handler);\n }\n listeners.length = 0;\n };\n for (const signal of signals) {\n if (signal.aborted) {\n controller.abort(signal.reason);\n dispose();\n return { signal: controller.signal, dispose: noop };\n }\n const handler = () => {\n controller.abort(signal.reason);\n dispose();\n };\n signal.addEventListener('abort', handler, { once: true });\n listeners.push({ signal, handler });\n }\n return { signal: controller.signal, dispose };\n}\n\n/**\n * Events emitted by the debug logger.\n * - `request` — about to send a request (`method`, `url`, `path`)\n * - `response` — response received (`status`, `method`, `path`, `requestId?`)\n * - `retry` — about to retry after a transient failure (`attempt`, `maxRetries`, `method`, `path`)\n */\nexport type DelopayLogger = (\n event: 'request' | 'response' | 'retry',\n data: Record<string, unknown>,\n) => void;\n\n/**\n * Configuration options for the Delopay client.\n */\nexport interface DelopayOptions {\n /**\n * Use the sandbox environment (`https://sandbox.delopay.net/api`). Defaults\n * to `false` (production). Request paths are appended to that address, so a\n * payment is created at `https://sandbox.delopay.net/api/payments`.\n */\n sandbox?: boolean;\n /** Override the base URL entirely. Takes precedence over `sandbox`. */\n baseUrl?: string;\n /** Request timeout in milliseconds. Defaults to `30000` (30 seconds). */\n timeout?: number;\n /**\n * Maximum number of automatic retries for transient failures (5xx, timeout, network errors).\n * Retries use exponential backoff. Set to `0` to disable. Defaults to `2`.\n * Only idempotent-safe requests (GET, DELETE, and requests with an `Idempotency-Key` header) are retried.\n */\n maxRetries?: number;\n /** Enable debug logging of requests and responses. Defaults to `false`. */\n debug?: boolean;\n /**\n * Custom logger for debug events (`request`, `response`, `retry`). When omitted,\n * debug output is written to `console.log`. Has no effect unless `debug` is `true`.\n * Useful for routing SDK logs through pino, winston, or similar structured loggers.\n */\n logger?: DelopayLogger;\n /**\n * The shop (business profile) every request acts on, sent as `X-Profile-Id`.\n * An API key bound to several shops must name one of them on every request;\n * create one client per shop. A header a call sets itself takes precedence.\n */\n profileId?: string;\n}\n\nconst SENSITIVE_QUERY_KEYS = new Set([\n 'client_secret',\n 'ephemeral_key',\n 'api_key',\n 'publishable_key',\n]);\n\n/**\n * Return a copy of `url` with the values of known-sensitive query parameters\n * replaced by `REDACTED`, leaving the rest of the query string intact.\n * Used only to sanitize URLs before they hit debug logs.\n */\nfunction redactUrlForLogging(url: string): string {\n const qIdx = url.indexOf('?');\n if (qIdx === -1) return url;\n const base = url.slice(0, qIdx);\n const query = url.slice(qIdx + 1);\n const parts = query.split('&').map((pair) => {\n const eqIdx = pair.indexOf('=');\n if (eqIdx === -1) return pair;\n const key = pair.slice(0, eqIdx);\n if (SENSITIVE_QUERY_KEYS.has(decodeURIComponent(key).toLowerCase())) {\n return `${key}=REDACTED`;\n }\n return pair;\n });\n return `${base}?${parts.join('&')}`;\n}\n\n/**\n * One step of a response body's download, reported to\n * {@link RequestOptions.onDownloadProgress}.\n */\nexport interface DownloadProgressEvent {\n /** Body bytes received so far on this attempt, `chunk` included. */\n loaded: number;\n /**\n * `Content-Length`, when the response carried one — a buffered body such as\n * a PDF. `null` for a streamed (chunked) body, whose size is not known\n * until it ends. With a compressed transfer it is the compressed size, so\n * `loaded` can pass it.\n */\n total: number | null;\n /**\n * The bytes this event reports. Empty on the first event of an attempt,\n * which fires as soon as the headers arrive, before any of the body.\n * A copy: changing it cannot change the value the request resolves to.\n */\n chunk: Uint8Array;\n /** The response headers, available from the first event on. */\n headers: Headers;\n /**\n * Which attempt this is, from `0`. A retried request reports its body\n * again from the start under the next number, so a listener that\n * accumulates state resets it when this changes.\n */\n attempt: number;\n}\n\n/**\n * Low-level options forwarded to a single HTTP request.\n */\nexport interface RequestOptions {\n /** Request body, serialised as JSON. */\n body?: unknown;\n /**\n * @internal Resource assertion that this operation deduplicates by the JSON\n * body's idempotency_key. Null means that optional key is absent, so the write\n * must not be retried. The transport checks the assertion against the body;\n * it does not send this option or copy a JSON key into an HTTP header.\n */\n bodyIdempotencyKey?: string | null;\n /**\n * Query-string parameters. `undefined` and `null` values are omitted.\n * Array values are emitted as repeated keys (`?tag=a&tag=b`) — not comma-joined.\n */\n query?: Record<\n string,\n string | number | boolean | null | undefined | (string | number | boolean)[]\n >;\n /** Additional HTTP headers merged with the default `api-key` header. */\n headers?: Record<string, string>;\n /**\n * Override the client-level timeout for this request, in milliseconds.\n *\n * Covers the whole request, body included — unless `onDownloadProgress` is\n * set, in which case it is an **idle** timeout: it restarts when the\n * headers arrive and on every chunk of the body, so a long download that\n * keeps making progress is never cut off, and one that stalls still is.\n */\n timeout?: number;\n /**\n * Caller-provided `AbortSignal`. Aborting it cancels the in-flight request and rejects\n * with a `DelopayError` carrying code `'ABORTED'`. Combined with the per-request timeout.\n */\n signal?: AbortSignal;\n /**\n * How to decode a 2xx response body. `'json'` (the default) parses JSON;\n * `'blob'` / `'arraybuffer'` return the raw bytes for binary endpoints\n * such as PDF exports. Error responses are always decoded as JSON and\n * thrown as `DelopayError` regardless of this setting.\n */\n responseType?: 'json' | 'blob' | 'arraybuffer';\n /**\n * Pass `keepalive: true` to let the request outlive its page — e.g.\n * telemetry sent while the document is navigating away. Browsers cap\n * keepalive request bodies at ~64 KiB and reject larger ones.\n */\n keepalive?: boolean;\n /**\n * Report a 2xx response body as it downloads. Called once as soon as the\n * headers arrive (with an empty `chunk` and `loaded: 0`), then once per\n * chunk of the body; the value the request resolves to is decoded from\n * those same bytes, per `responseType`. Error responses are not reported.\n *\n * Setting it turns `timeout` into an idle timeout (see there). A body that\n * fails part-way rejects with the ordinary `NETWORK` error and is retried\n * on the usual terms, starting again under the next `attempt`. A listener\n * that throws rejects the request with that error, unretried.\n */\n onDownloadProgress?: (event: DownloadProgressEvent) => void;\n}\n\nexport type RequestFn = <T>(method: string, path: string, options?: RequestOptions) => Promise<T>;\n\n/**\n * Per-call options that resource methods accept as an optional final argument:\n * extra HTTP headers (e.g. `Idempotency-Key`), a per-request timeout override,\n * an `AbortSignal` for cancellation, and a download-progress listener — the\n * last is what a file download (a statement PDF, a report CSV) reports its\n * bytes through.\n */\nexport type RequestExtras = Pick<\n RequestOptions,\n 'headers' | 'timeout' | 'signal' | 'onDownloadProgress'\n>;\n\n/** How long an event stream may stay silent before it is given up. */\nconst DEFAULT_STREAM_IDLE_TIMEOUT_MS = 45_000;\n\n/** Options of one `text/event-stream` request. */\nexport interface EventStreamRequestOptions {\n /** Query-string parameters, as {@link RequestOptions.query}. */\n query?: RequestOptions['query'];\n /** Additional HTTP headers, merged over the auth header. */\n headers?: Record<string, string>;\n /**\n * Aborting it before the response arrives rejects with code `ABORTED`;\n * aborting it later ends the dispatches without an error.\n */\n signal?: AbortSignal;\n /**\n * How long the stream may stay silent, response headers included, before\n * it fails with code `TIMEOUT`. Paused while the consumer holds a dispatch.\n * Defaults to 45 seconds.\n */\n idleTimeoutMs?: number;\n /** Sent as `Last-Event-ID`, and the id the stream starts from. */\n lastEventId?: string | null;\n}\n\n/**\n * An open event stream. Its body is read as it is iterated and never kept:\n * only the line and the event in progress are held.\n */\nexport interface EventStreamConnection {\n /**\n * The stream's dispatches, in order. Ends when the server closes the\n * stream or the caller aborts or closes it; throws a `DelopayError` with\n * code `TIMEOUT` when the stream is silent too long, and `NETWORK` when\n * the connection fails. Iterate it once.\n */\n readonly dispatches: AsyncIterable<EventStreamDispatch>;\n /** Close the stream: the iteration ends and the connection is released. */\n close(): void;\n}\n\n/** Opens a `GET` event stream; what resources that stream receive. */\nexport type EventStreamFn = (\n path: string,\n options?: EventStreamRequestOptions,\n) => Promise<EventStreamConnection>;\n\n/**\n * What a resource class is built from: the client's request and event-stream\n * functions. Every resource takes the request function first; the few that\n * stream (`Live`, `ProcessorImports`) also take the stream opener.\n */\nexport interface DelopayTransport {\n /** Send one request with the client's credentials, retries and timeout. */\n readonly request: RequestFn;\n /** Open one `text/event-stream` request with the client's credentials. */\n readonly openStream: EventStreamFn;\n /** The resolved base URL every request goes to. */\n readonly baseUrl: string;\n}\n\n/** A resource class that {@link DelopayCore.use} can build. */\nexport type ResourceConstructor<T> = new (request: RequestFn, openStream: EventStreamFn) => T;\n\n/**\n * The Delopay client without its resources: credentials, configuration,\n * transport, sessions and pagination.\n *\n * {@link Delopay} extends it with every resource as a property, which puts\n * every resource in the application's bundle. An application that wants only\n * the resources it calls builds them from this class instead, importing each\n * one from its own module, so a bundler leaves the rest out and can load each\n * one with the code that uses it:\n *\n * @example\n * ```typescript\n * import { DelopayCore } from '@delopay/sdk/core';\n * import { Refunds } from '@delopay/sdk/resources/refunds';\n *\n * const client = new DelopayCore('snd_...', { sandbox: true });\n * const refunds = client.use(Refunds);\n * const refund = await refunds.create({ payment_id: 'pay_abc123' });\n * ```\n *\n * A resource built this way shares the client's credentials: a token set with\n * {@link DelopayCore.setJwtToken} applies to it at once.\n */\nexport class DelopayCore {\n /** The resolved base URL used for all API requests. */\n readonly baseUrl: string;\n private readonly apiKey: string;\n private readonly timeout: number;\n private readonly maxRetries: number;\n private readonly debug: boolean;\n private readonly logger?: DelopayLogger;\n private readonly profileId?: string;\n private jwtToken?: string;\n\n /** The functions every resource is built from; see {@link DelopayCore.use}. */\n readonly transport: DelopayTransport;\n\n private readonly resources = new Map<ResourceConstructor<unknown>, unknown>();\n\n /**\n * Create a new client.\n *\n * @param apiKey - Your Delopay API key (e.g. `prd_...` or `snd_...`).\n * Pass an empty string or omit for JWT-only usage (e.g. dashboard apps).\n * @param options - Optional configuration (sandbox mode, base URL override, timeout).\n */\n constructor(apiKey?: string, options?: DelopayOptions) {\n this.apiKey = apiKey ?? '';\n this.timeout = options?.timeout ?? 30_000;\n this.maxRetries = options?.maxRetries ?? 2;\n this.debug = options?.debug ?? false;\n if (options?.logger !== undefined) this.logger = options.logger;\n if (options?.profileId !== undefined && options.profileId !== '') {\n this.profileId = options.profileId;\n }\n\n if (options?.baseUrl !== undefined) {\n this.baseUrl = options.baseUrl;\n } else if (options?.sandbox) {\n this.baseUrl = SANDBOX_URL;\n } else {\n this.baseUrl = PRODUCTION_URL;\n }\n\n this.transport = {\n request: this.request.bind(this) as RequestFn,\n openStream: this.openEventStream.bind(this),\n baseUrl: this.baseUrl,\n };\n }\n\n /**\n * The client's instance of a resource class, built on first use from this\n * client's transport. Later calls with the same class return the same\n * instance.\n *\n * A resource whose constructor takes something else besides the transport\n * (`Branding` takes the base URL) is built directly instead:\n * `new Branding(client.transport.request, client.baseUrl)`.\n *\n * @param Resource - The resource class, imported from its own module.\n * @returns The resource, bound to this client.\n */\n use<T>(Resource: ResourceConstructor<T>): T {\n let resource = this.resources.get(Resource) as T | undefined;\n if (resource === undefined) {\n resource = new Resource(this.transport.request, this.transport.openStream);\n this.resources.set(Resource, resource);\n }\n return resource;\n }\n\n /**\n * Set a JWT token for subsequent requests.\n * When set, requests use `Authorization: Bearer <token>` instead of `api-key`.\n * Useful after `users.signIn()` returns a JWT for dashboard operations.\n */\n setJwtToken(token: string): void {\n this.jwtToken = token;\n }\n\n /**\n * Clear the JWT token, reverting to API key authentication.\n */\n clearJwtToken(): void {\n this.jwtToken = undefined;\n }\n\n /**\n * End the current login session on the server (`POST /user/signout`), the\n * same request as {@link Users.signOut}. The token stays set on this\n * client: clear it with {@link DelopayCore.clearJwtToken} afterwards. The\n * request's `Authorization` header is built when this is called, so\n * clearing the token straight after still signs out the session it held.\n */\n async signOut(): Promise<Record<string, unknown>> {\n return this.request('POST', '/user/signout');\n }\n\n /**\n * Refresh the current login JWT (see {@link Users.refreshToken}) and\n * apply the fresh token to this client, so subsequent requests use it.\n * Returns the fresh token for the caller to persist (e.g. session\n * storage) — the backend has already re-set the `login_token` cookie.\n *\n * If the client's auth state changes while the refresh is pending —\n * `clearJwtToken()` on sign-out, or `setJwtToken()` switching to another\n * session — the stale completion is discarded and this rejects with a\n * `session_changed` `DelopayError` (status 0), so the explicit change\n * wins and the caller never persists a token for a session that is gone.\n *\n * Otherwise throws like any other request; in particular a 401 means the\n * session is dead (expired/blacklisted/revoked), a 429 means a refresh\n * was already minted for this session within the last minute, and a 400\n * means this token has no revocable session to slide (no `jti` — team\n * impersonation is the case in practice) and can never be refreshed,\n * though it stays valid for ordinary calls.\n */\n async refreshSession(): Promise<TokenResponse> {\n const originatingToken = this.jwtToken;\n const response = await this.request<TokenResponse>('POST', '/user/token/refresh');\n if (this.jwtToken !== originatingToken) {\n throw new DelopayError(\n 'Auth state changed while the refresh was pending; refreshed token discarded',\n {\n status: 0,\n code: 'session_changed',\n type: 'session_changed',\n },\n );\n }\n this.setJwtToken(response.token);\n return response;\n }\n\n /** `path` on the base URL, with the query string `query` makes. */\n private buildUrl(path: string, query?: RequestOptions['query']): string {\n let url = `${this.baseUrl}${path}`;\n if (query) {\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === undefined || value === null) continue;\n if (Array.isArray(value)) {\n for (const v of value) {\n if (v !== undefined && v !== null) params.append(key, String(v));\n }\n } else {\n params.set(key, String(value));\n }\n }\n const qs = params.toString();\n if (qs) {\n url += `?${qs}`;\n }\n }\n return url;\n }\n\n /** The credential header: the JWT when one is set, else the API key. */\n /**\n * The client's `X-Profile-Id`, unless the call names one itself (in any\n * letter case: two spellings would be sent as one joined value).\n */\n private profileHeaders(callHeaders?: Record<string, string>): Record<string, string> {\n if (this.profileId === undefined) return {};\n const named = Object.keys(callHeaders ?? {}).some(\n (name) => name.toLowerCase() === 'x-profile-id',\n );\n return named ? {} : { 'X-Profile-Id': this.profileId };\n }\n\n private authHeaders(): Record<string, string> {\n if (this.jwtToken) return { Authorization: `Bearer ${this.jwtToken}` };\n if (this.apiKey) return { 'api-key': this.apiKey };\n return {};\n }\n\n /** One debug event, when `debug` is on. */\n private log(event: 'request' | 'response' | 'retry', data: Record<string, unknown>): void {\n if (!this.debug) return;\n if (this.logger) {\n this.logger(event, data);\n return;\n }\n if (event === 'request')\n console.log(`[delopay] ${data.method as string} ${data.url as string}`);\n else if (event === 'response')\n console.log(\n `[delopay] ${data.status as number} ${data.method as string} ${data.path as string}`,\n );\n else\n console.log(\n `[delopay] retry ${data.attempt as number}/${data.maxRetries as number} ${data.method as string} ${data.path as string}`,\n );\n }\n\n /**\n * Open a `GET` `text/event-stream` and read it as it arrives.\n *\n * `request()` keeps every chunk of a body until the body ends, which a\n * stream that stays open for half an hour must not do; this reads the body\n * chunk by chunk through {@link EventStreamParser} and keeps nothing it has\n * dispatched. Credentials, the base URL, debug logging and the mapping of a\n * non-2xx answer to `DelopayError` / `DelopayAuthenticationError` are the\n * ones `request()` uses.\n *\n * Never retried, and never reconnected: the caller owns reconnection.\n * Resolves once the response headers arrive; rejects on a non-2xx answer,\n * on a 2xx that is not `text/event-stream` (code `NOT_EVENT_STREAM`), and\n * with `TIMEOUT`, `NETWORK` or `ABORTED` like `request()`.\n */\n protected async openEventStream(\n path: string,\n options: EventStreamRequestOptions = {},\n ): Promise<EventStreamConnection> {\n const url = this.buildUrl(path, options.query);\n const lastEventId = options.lastEventId ?? '';\n const headers: Record<string, string> = {\n ...this.authHeaders(),\n ...this.profileHeaders(options.headers),\n Accept: 'text/event-stream',\n ...(lastEventId ? { 'Last-Event-ID': lastEventId } : {}),\n ...options.headers,\n };\n const idleMs = options.idleTimeoutMs ?? DEFAULT_STREAM_IDLE_TIMEOUT_MS;\n const callerSignal = options.signal;\n const aborted = () =>\n new DelopayError('Request aborted', { status: 0, code: 'ABORTED', type: 'abort_error' });\n if (callerSignal?.aborted) throw aborted();\n\n const idleCtrl = new AbortController();\n const closeCtrl = new AbortController();\n let timer: ReturnType<typeof setTimeout> | undefined;\n const stopIdleTimer = () => {\n if (timer !== undefined) clearTimeout(timer);\n timer = undefined;\n };\n const startIdleTimer = () => {\n stopIdleTimer();\n if (!idleCtrl.signal.aborted) timer = setTimeout(() => idleCtrl.abort(), idleMs);\n };\n const combined = combineSignals(\n callerSignal\n ? [idleCtrl.signal, closeCtrl.signal, callerSignal]\n : [idleCtrl.signal, closeCtrl.signal],\n );\n const release = () => {\n stopIdleTimer();\n combined.dispose();\n };\n const timedOut = () =>\n new DelopayError(`Event stream silent for ${idleMs} ms`, {\n status: 0,\n code: 'TIMEOUT',\n type: 'timeout_error',\n });\n const network = (cause: unknown) =>\n new DelopayError(\n `Network error: ${cause instanceof Error ? cause.message : String(cause ?? 'stream failed')}`,\n { status: 0, code: 'NETWORK', type: 'network_error' },\n );\n\n this.log('request', { method: 'GET', url: redactUrlForLogging(url), path });\n startIdleTimer();\n let response: Response;\n try {\n response = await fetch(url, { method: 'GET', headers, signal: combined.signal });\n } catch (err) {\n release();\n if (callerSignal?.aborted) throw aborted();\n if (idleCtrl.signal.aborted) throw timedOut();\n throw network(err);\n }\n\n const requestId =\n response.headers?.get('x-request-id') ?? response.headers?.get('x-trace-id') ?? undefined;\n this.log('response', { status: response.status, method: 'GET', path, requestId });\n\n if (!response.ok) {\n // Read under the idle timer: a body that never ends gives up as empty.\n const error = await errorFromResponse(response, requestId);\n release();\n throw error;\n }\n\n const body = response.body;\n const contentType = response.headers?.get('content-type') ?? '';\n const mediaType = (contentType.split(';')[0] ?? '').trim().toLowerCase();\n if (mediaType !== 'text/event-stream' || !body || typeof body.getReader !== 'function') {\n release();\n body?.cancel().catch(noop);\n throw new DelopayError(\n mediaType === 'text/event-stream'\n ? 'The event stream has no readable body'\n : `Expected a text/event-stream response, got ${contentType ? `\"${contentType}\"` : 'no content type'}`,\n {\n status: response.status,\n code: 'NOT_EVENT_STREAM',\n type: 'invalid_response',\n requestId,\n },\n );\n }\n\n // The idle timer runs only while a read is pending: a consumer busy with\n // an event, or one that has not started iterating, is not silence.\n stopIdleTimer();\n const reader = body.getReader();\n const parser = new EventStreamParser(lastEventId);\n const decoder = new TextDecoder();\n const stopped = () => Boolean(callerSignal?.aborted) || closeCtrl.signal.aborted;\n let finished = false;\n const finish = () => {\n if (finished) return;\n finished = true;\n release();\n reader.cancel().catch(noop);\n };\n\n async function* dispatches(): AsyncGenerator<EventStreamDispatch, void, undefined> {\n try {\n for (;;) {\n let result: ReadableStreamReadResult<Uint8Array>;\n startIdleTimer();\n try {\n result = await readChunk(reader, combined.signal);\n } catch (err) {\n if (callerSignal?.aborted || closeCtrl.signal.aborted) return;\n if (idleCtrl.signal.aborted) throw timedOut();\n throw network(err instanceof BodyStreamFailure ? err.cause : err);\n } finally {\n stopIdleTimer();\n }\n if (result.done) {\n // An event the stream did not finish with a blank line is\n // discarded, as the standard has it; only completed ones count.\n for (const dispatch of parser.push(decoder.decode())) {\n if (stopped()) return;\n yield dispatch;\n }\n return;\n }\n if (!result.value || result.value.byteLength === 0) continue;\n for (const dispatch of parser.push(decoder.decode(result.value, { stream: true }))) {\n // Aborted or closed while the consumer held the previous one.\n if (stopped()) return;\n yield dispatch;\n }\n }\n } finally {\n finish();\n }\n }\n\n return {\n dispatches: dispatches(),\n close: () => {\n closeCtrl.abort();\n finish();\n },\n };\n }\n\n /**\n * Make a raw HTTP request to the Delopay API.\n *\n * You rarely need to call this directly — prefer the typed resource methods.\n * Use it only for endpoints not yet covered by a resource class.\n *\n * @param method - HTTP method (`GET`, `POST`, `PUT`, `PATCH`, `DELETE`).\n * @param path - API path starting with `/` (e.g. `/payments`).\n * @param options - Optional body, query parameters, and headers.\n * @returns Parsed JSON response body typed as `T`.\n * @throws {DelopayAuthenticationError} On 401 responses.\n * @throws {DelopayError} On all other non-2xx responses, timeouts, and network errors.\n */\n async request<T>(method: string, path: string, options?: RequestOptions): Promise<T> {\n const url = this.buildUrl(path, options?.query);\n\n let headers: Record<string, string> = {\n ...this.authHeaders(),\n ...this.profileHeaders(options?.headers),\n ...options?.headers,\n };\n\n // FormData / Blob / ArrayBuffer / URLSearchParams pass through unchanged so callers\n // can send multipart uploads. The runtime (browser or Node 18+ fetch) sets the\n // appropriate Content-Type including the multipart boundary, so we don't touch it.\n const isRawBody =\n options?.body !== undefined &&\n options?.body !== null &&\n (options.body instanceof FormData ||\n options.body instanceof Blob ||\n options.body instanceof ArrayBuffer ||\n options.body instanceof URLSearchParams);\n\n if (options?.body && !isRawBody) {\n headers['Content-Type'] = 'application/json';\n }\n\n // Serialize body once so circular-reference errors surface immediately and big payloads\n // aren't re-stringified on every retry attempt. Raw bodies pass through untouched.\n let serializedBody: BodyInit | undefined;\n if (isRawBody) {\n serializedBody = options?.body as BodyInit;\n } else if (options?.body) {\n serializedBody = JSON.stringify(options.body);\n }\n\n let idempotencyKey = findIdempotencyKey(headers)?.trim();\n if (options && Object.prototype.hasOwnProperty.call(options, 'bodyIdempotencyKey')) {\n const bodyKey = options?.bodyIdempotencyKey;\n const serialized: unknown =\n !isRawBody && typeof serializedBody === 'string' ? JSON.parse(serializedBody) : null;\n const actualKey =\n serialized && typeof serialized === 'object' && !Array.isArray(serialized)\n ? ((serialized as Record<string, unknown>).idempotency_key ?? null)\n : null;\n const suppliedHeaders = Object.keys(headers).filter(\n (name) => name.toLowerCase() === 'idempotency-key',\n );\n if (\n (bodyKey !== null && typeof bodyKey !== 'string') ||\n actualKey !== bodyKey ||\n suppliedHeaders.some(\n (name) => headers[name] !== bodyKey || headers[name]?.trim() !== headers[name],\n )\n ) {\n throw new DelopayError('Request retry keys must match the JSON body key', {\n status: 0,\n code: 'IDEMPOTENCY_KEY_MISMATCH',\n type: 'invalid_request',\n });\n }\n idempotencyKey = bodyKey?.trim();\n // Collapse differently cased copies so fetch cannot combine them into a\n // different header value. Other caller headers remain untouched.\n if (suppliedHeaders.length > 0) {\n headers = {\n ...Object.fromEntries(\n Object.entries(headers).filter(([name]) => name.toLowerCase() !== 'idempotency-key'),\n ),\n 'Idempotency-Key': idempotencyKey ?? '',\n };\n }\n }\n const isRetryable =\n method === 'GET' ||\n method === 'DELETE' ||\n (idempotencyKey !== undefined && idempotencyKey !== '');\n\n const callerSignal = options?.signal;\n if (callerSignal?.aborted) {\n throw new DelopayError('Request aborted', {\n status: 0,\n code: 'ABORTED',\n type: 'abort_error',\n });\n }\n\n const timeoutMs = options?.timeout ?? this.timeout;\n\n let lastError: unknown;\n let retryAfterOverrideMs: number | null = null;\n\n const safeUrl = () => redactUrlForLogging(url);\n const emit = (event: 'request' | 'response' | 'retry', data: Record<string, unknown>) =>\n this.log(event, data);\n\n for (let attempt = 0; attempt <= this.maxRetries; attempt++) {\n if (attempt > 0) {\n const base = Math.min(500 * 2 ** (attempt - 1), 5000);\n // Full jitter: pick uniformly in [0, base) to avoid synchronized retry storms.\n const jittered = Math.random() * base;\n const delay = Math.max(retryAfterOverrideMs ?? 0, jittered);\n retryAfterOverrideMs = null;\n await new Promise((resolve) => setTimeout(resolve, delay));\n emit('retry', { attempt, maxRetries: this.maxRetries, method, path });\n }\n\n const timeoutCtrl = new AbortController();\n let timeoutId = setTimeout(() => timeoutCtrl.abort(), timeoutMs);\n // With a progress listener the timeout measures silence, not the whole\n // download: each sign of life restarts it.\n const restartIdleTimer = () => {\n if (timeoutCtrl.signal.aborted) return;\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => timeoutCtrl.abort(), timeoutMs);\n };\n const combined = combineSignals(\n callerSignal ? [timeoutCtrl.signal, callerSignal] : [timeoutCtrl.signal],\n );\n\n try {\n emit('request', { method, url: safeUrl(), path });\n\n const response = await fetch(url, {\n method,\n headers,\n body: serializedBody,\n signal: combined.signal,\n ...(options?.keepalive !== undefined ? { keepalive: options.keepalive } : {}),\n });\n\n const requestId =\n response.headers?.get('x-request-id') ?? response.headers?.get('x-trace-id') ?? undefined;\n\n emit('response', { status: response.status, method, path, requestId });\n\n if (!response.ok) {\n // A 401 that is our credential's comes back as a\n // DelopayAuthenticationError; its status is never transient, so it\n // is thrown below without a retry.\n const error = await errorFromResponse(response, requestId);\n\n // Retry on 5xx and 429 (rate limit). 4xx other than 429 are not transient.\n const isTransientStatus = response.status >= 500 || response.status === 429;\n if (isTransientStatus && isRetryable && attempt < this.maxRetries) {\n if (response.status === 429) {\n retryAfterOverrideMs = parseRetryAfter(response.headers?.get('retry-after') ?? null);\n }\n lastError = error;\n continue;\n }\n\n throw error;\n }\n\n if (options?.onDownloadProgress) {\n return (await receiveWithProgress(\n response,\n options.responseType,\n options.onDownloadProgress,\n attempt,\n combined.signal,\n restartIdleTimer,\n )) as T;\n }\n if (options?.responseType === 'blob') {\n return (await response.blob()) as T;\n }\n if (options?.responseType === 'arraybuffer') {\n return (await response.arrayBuffer()) as T;\n }\n const text = await response.text();\n return (text ? JSON.parse(text) : undefined) as T;\n } catch (err) {\n if (err instanceof DelopayError || err instanceof DelopayAuthenticationError) {\n throw err;\n }\n if (err instanceof ListenerFailure) {\n throw err.cause;\n }\n if (err instanceof BodyStreamFailure) {\n const cause = err.cause;\n const detail =\n cause instanceof Error ? cause.message : String(cause ?? 'body stream failed');\n lastError = new DelopayError(`Network error: ${detail}`, {\n status: 0,\n code: 'NETWORK',\n type: 'network_error',\n });\n if (isRetryable && attempt < this.maxRetries) continue;\n throw lastError;\n }\n if (err instanceof Error && err.name === 'AbortError') {\n if (callerSignal?.aborted) {\n throw new DelopayError('Request aborted', {\n status: 0,\n code: 'ABORTED',\n type: 'abort_error',\n });\n }\n lastError = new DelopayError('Request timed out', {\n status: 0,\n code: 'TIMEOUT',\n type: 'timeout_error',\n });\n if (isRetryable && attempt < this.maxRetries) continue;\n throw lastError;\n }\n if (err instanceof TypeError) {\n lastError = new DelopayError(`Network error: ${err.message}`, {\n status: 0,\n code: 'NETWORK',\n type: 'network_error',\n });\n if (isRetryable && attempt < this.maxRetries) continue;\n throw lastError;\n }\n throw err;\n } finally {\n clearTimeout(timeoutId);\n combined.dispose();\n }\n }\n\n throw lastError;\n }\n\n /**\n * Auto-paginate a list endpoint. Yields items one by one, fetching\n * the next page automatically when the current one is exhausted.\n *\n * Delopay list endpoints use one of two pagination styles, so this helper\n * supports both:\n * - **Offset** (default) — for endpoints like `customers.list` that accept\n * `offset`/`limit`. Each page advances `offset` by the number of items returned.\n * - **Cursor** — for endpoints like `payments.list` and `payouts.list` that page\n * with `starting_after`/`limit` (they ignore `offset`). Pass a `cursor` extractor\n * that returns the id of an item; the next page is requested with\n * `starting_after` set to the last item's id.\n *\n * @param listFn - A function that takes the paging params and returns `{ data: T[] }` or `T[]`.\n * @param params - Additional parameters to pass to every page request.\n * @param options - Page size (number) for offset mode, or `{ pageSize?, cursor? }`.\n * Provide `cursor` to switch to cursor pagination.\n *\n * @example\n * ```typescript\n * // Offset endpoint (customers):\n * for await (const c of delopay.paginate((p) => delopay.customers.list(p))) {\n * console.log(c.customer_id);\n * }\n *\n * // Cursor endpoint (payments): extract the id used as the next cursor.\n * for await (const payment of delopay.paginate(\n * (p) => delopay.payments.list(p),\n * undefined,\n * { cursor: (p) => p.payment_id },\n * )) {\n * console.log(payment.payment_id);\n * }\n * ```\n */\n async *paginate<T, P extends Record<string, unknown>>(\n listFn: (\n params: P & { limit: number; offset?: number; starting_after?: string },\n ) => Promise<{ data: T[] } | T[]>,\n params?: P,\n options?: number | { pageSize?: number; cursor?: (item: T) => string | undefined },\n ): AsyncGenerator<T> {\n const pageSize = typeof options === 'number' ? options : (options?.pageSize ?? 50);\n const cursorOf = typeof options === 'object' ? options.cursor : undefined;\n let offset = 0;\n let after: string | undefined;\n while (true) {\n const page = { ...((params ?? {}) as P), limit: pageSize } as P & {\n limit: number;\n offset?: number;\n starting_after?: string;\n };\n if (cursorOf) {\n if (after !== undefined) page.starting_after = after;\n } else {\n page.offset = offset;\n }\n const result = await listFn(page);\n const items = Array.isArray(result) ? result : result.data;\n if (items.length === 0) break;\n for (const item of items) {\n yield item;\n }\n if (items.length < pageSize) break;\n if (cursorOf) {\n const last = items[items.length - 1];\n if (last === undefined) break;\n after = cursorOf(last);\n if (after === undefined) break;\n } else {\n offset += items.length;\n }\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/
|
|
1
|
+
{"version":3,"sources":["/home/anes/delo-payment/sdk-publish-w2/dist/chunk-I2W7AO4B.cjs","../src/error.ts"],"names":[],"mappings":"AAAA;ACeO,IAAM,aAAA,EAAN,MAAA,QAA2B,MAAM;AAAA,EAsBtC,WAAA,CACE,OAAA,EACA,OAAA,EAQA;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,MAAA,CAA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ADhEA;AACA;AACE;AACA;AACF,qGAAC","file":"/home/anes/delo-payment/sdk-publish-w2/dist/chunk-I2W7AO4B.cjs","sourcesContent":[null,"/**\n * Error thrown when the Delopay API returns a non-2xx response, or when a\n * timeout or network error occurs.\n *\n * @example\n * ```typescript\n * try {\n * await delopay.payments.create({ amount: 5000, currency: 'EUR' });\n * } catch (e) {\n * if (e instanceof DelopayError) {\n * console.error(e.status, e.code, e.requestId, e.message);\n * }\n * }\n * ```\n */\nexport class DelopayError extends Error {\n /** HTTP status code returned by the API, or `0` for timeout/network errors. */\n readonly status: number;\n /** Machine-readable error code returned by the API (e.g. `'HE_00'`). */\n readonly code: string;\n /** Error category (e.g. `'invalid_request'`, `'timeout_error'`). */\n readonly type: string;\n /** Value of the `x-request-id` response header, when present. Include this when contacting support. */\n readonly requestId?: string;\n /**\n * Raw response body (truncated to ~2 KB). Populated when the server returns a\n * non-JSON error body (e.g. an HTML 502 from an upstream proxy) so debugging\n * still has something to go on.\n */\n readonly rawBody?: string;\n /**\n * Structured error context the API attaches under `error.data` for select\n * codes — e.g. `{ retry_after_secs: 248 }` on rate-limit / max-attempt\n * lockouts. Schema is per-code; consult the API reference for the shape.\n */\n readonly data?: Record<string, unknown>;\n\n constructor(\n message: string,\n options: {\n status: number;\n code: string;\n type: string;\n requestId?: string;\n rawBody?: string;\n data?: Record<string, unknown>;\n },\n ) {\n super(message);\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = 'DelopayError';\n this.status = options.status;\n this.code = options.code;\n this.type = options.type;\n if (options.requestId !== undefined) this.requestId = options.requestId;\n if (options.rawBody !== undefined) this.rawBody = options.rawBody;\n if (options.data !== undefined) this.data = options.data;\n }\n}\n\n/**\n * Thrown when the API key is missing, invalid, or revoked (HTTP 401).\n *\n * @example\n * ```typescript\n * if (e instanceof DelopayAuthenticationError) {\n * // Prompt user to re-enter their API key.\n * }\n * ```\n */\nexport class DelopayAuthenticationError extends DelopayError {\n constructor(\n message = 'Invalid API key',\n options?: {\n code?: string;\n type?: string;\n requestId?: string;\n rawBody?: string;\n data?: Record<string, unknown>;\n },\n ) {\n super(message, {\n status: 401,\n // Default to the generic \"invalid API key\" code, but let callers pass\n // through the server-reported code (e.g. `UR_05` for unverified-email\n // 401s) so they can differentiate between auth failure reasons.\n code: options?.code || 'AUTH_01',\n type: options?.type || 'authentication_error',\n requestId: options?.requestId,\n rawBody: options?.rawBody,\n data: options?.data,\n });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = 'DelopayAuthenticationError';\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/
|
|
1
|
+
{"version":3,"sources":["/home/anes/delo-payment/sdk-publish-w2/dist/chunk-I2XGNALG.cjs","../src/resources/forex.ts"],"names":[],"mappings":"AAAA;ACEO,IAAM,MAAA,EAAN,MAAY;AAAA,EACjB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA,EAGlD,MAAM,QAAA,CACJ,MAAA,EACkC;AAClC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,cAAA,EAAgB,EAAE,KAAA,EAAO,OAAO,CAAC,CAAA;AAAA,EAC9D;AAAA;AAAA,EAGA,MAAM,gBAAA,CACJ,MAAA,EACkC;AAClC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,2BAAA,EAA6B,EAAE,KAAA,EAAO,OAAO,CAAC,CAAA;AAAA,EAC3E;AACF,CAAA;ADJA;AACA;AACE;AACF,sBAAC","file":"/home/anes/delo-payment/sdk-publish-w2/dist/chunk-I2XGNALG.cjs","sourcesContent":[null,"import type { RequestFn } from '../client';\n\nexport class Forex {\n constructor(private readonly request: RequestFn) {}\n\n /** Retrieve forex rates. `GET /forex/rates` */\n async getRates(\n params?: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/forex/rates', { query: params });\n }\n\n /** Convert from minor currency. `GET /forex/convert-from-minor` */\n async convertFromMinor(\n params: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/forex/convert-from-minor', { query: params });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/
|
|
1
|
+
{"version":3,"sources":["/home/anes/delo-payment/sdk-publish-w2/dist/chunk-IKXGA2Z5.cjs","../src/resources/featureMatrix.ts"],"names":[],"mappings":"AAAA;ACOO,IAAM,cAAA,EAAN,MAAoB;AAAA,EACzB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA,EAGlD,MAAM,QAAA,CAAA,EAA2C;AAC/C,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,iBAAiB,CAAA;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,mBAAA,CAAoB,UAAA,EAAoD;AAC5E,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,gBAAA,EAAmB,kBAAA,CAAmB,UAAU,CAAC,CAAA,CAAA;AAC9E,EAAA;AACF;ADLiF;AACA;AACA;AACA","file":"/home/anes/delo-payment/sdk-publish-w2/dist/chunk-IKXGA2Z5.cjs","sourcesContent":[null,"import type { FeatureMatrixResponse } from '../types';\nimport type { RequestFn } from '../client';\n\n/**\n * What each connector can do: payment methods, capture methods, webhook\n * flows, and whether an unverified webhook is acted on.\n */\nexport class FeatureMatrix {\n constructor(private readonly request: RequestFn) {}\n\n /** Retrieve the feature matrix. `GET /feature-matrix` */\n async retrieve(): Promise<FeatureMatrixResponse> {\n return this.request('GET', '/feature-matrix');\n }\n\n /**\n * Retrieve the feature matrix scoped to a merchant. Beta connectors\n * are filtered against the merchant's allowlist so the dashboard only\n * surfaces connectors the merchant can actually attach.\n * `GET /feature-matrix/{merchantId}`\n */\n async retrieveForMerchant(merchantId: string): Promise<FeatureMatrixResponse> {\n return this.request('GET', `/feature-matrix/${encodeURIComponent(merchantId)}`);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/
|
|
1
|
+
{"version":3,"sources":["/home/anes/delo-payment/sdk-publish-w2/dist/chunk-IR2LFKKA.cjs","../src/internal/resources/admin.ts"],"names":[],"mappings":"AAAA;ACaO,IAAM,MAAA,EAAN,MAAY;AAAA,EACjB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA,EAElD,MAAM,MAAA,CAAO,MAAA,EAAmD;AAC9D,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,eAAA,EAAiB,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EAC/D;AAAA,EAEA,MAAM,kBAAA,CAAmB,MAAA,EAA+D;AACtF,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,wBAAA,EAA0B,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EACxE;AAAA,EAEA,MAAM,YAAA,CAAa,MAAA,EAA6D;AAC9E,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,sBAAA,EAAwB,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EACtE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,oBAAA,CAAqB,MAAA,EAAiE;AAC1F,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,gCAAA,EAAkC,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EAChF;AAAA;AAAA,EAGA,MAAM,iBAAA,CAAkB,MAAA,EAA4D;AAClF,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,wBAAA,EAA0B,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EACxE;AAAA;AAAA,EAGA,MAAM,iBAAA,CAAA,EAAmD;AACvD,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,wBAAwB,CAAA;AAAA,EACrD;AAAA;AAAA,EAGA,MAAM,eAAA,CAAgB,MAAA,EAAkE;AACtF,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,yBAAA,EAA2B,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EACzE;AACF,CAAA;ADhBA;AACA;AACE;AACF,sBAAC","file":"/home/anes/delo-payment/sdk-publish-w2/dist/chunk-IR2LFKKA.cjs","sourcesContent":[null,"import type { AuthResponse, SignUpWithMerchantIdRequest } from '../../types';\nimport type {\n AdminSignInRequest,\n AuthorizeResponse,\n CreateInternalUserRequest,\n CreateTenantUserRequest,\n OnboardMerchantRequest,\n OnboardMerchantResponse,\n SignupToggleRequest,\n SignupToggleResponse,\n} from '../types';\nimport type { RequestFn } from '../../client';\n\nexport class Admin {\n constructor(private readonly request: RequestFn) {}\n\n async signIn(params: AdminSignInRequest): Promise<AuthResponse> {\n return this.request('POST', '/admin/signin', { body: params });\n }\n\n async createInternalUser(params: CreateInternalUserRequest): Promise<AuthorizeResponse> {\n return this.request('POST', '/admin/internal-signup', { body: params });\n }\n\n async createTenant(params: CreateTenantUserRequest): Promise<AuthorizeResponse> {\n return this.request('POST', '/admin/tenant-signup', { body: params });\n }\n\n /**\n * Create a new merchant admin user and merchant account atomically.\n *\n * This is the correct endpoint for bootstrapping the first admin user in a\n * fresh deployment — `internal-signup`/`tenant-signup` both require\n * pre-existing merchant records that don't exist on a clean database.\n *\n * `POST /admin/signup-with-merchant-id`\n */\n async signupWithMerchantId(params: SignUpWithMerchantIdRequest): Promise<AuthorizeResponse> {\n return this.request('POST', '/admin/signup-with-merchant-id', { body: params });\n }\n\n /** Toggle public signup on/off. `POST /admin/settings/signup` */\n async setSignupSettings(params: SignupToggleRequest): Promise<SignupToggleResponse> {\n return this.request('POST', '/admin/settings/signup', { body: params });\n }\n\n /** Read current public-signup status. `GET /admin/settings/signup` */\n async getSignupSettings(): Promise<SignupToggleResponse> {\n return this.request('GET', '/admin/settings/signup');\n }\n\n /** Full merchant bootstrap — user + merchant + project + profile + keys. `POST /admin/onboard-merchant` */\n async onboardMerchant(params: OnboardMerchantRequest): Promise<OnboardMerchantResponse> {\n return this.request('POST', '/admin/onboard-merchant', { body: params });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/
|
|
1
|
+
{"version":3,"sources":["/home/anes/delo-payment/sdk-publish-w2/dist/chunk-J4ZB7MU4.cjs","../src/internal/resources/adminIndustries.ts"],"names":[],"mappings":"AAAA;ACeA,IAAM,KAAA,EAAO,CAAC,EAAA,EAAA,GAAuB,CAAA,yBAAA,EAA4B,kBAAA,CAAmB,EAAE,CAAC,CAAA,CAAA;AAmB1D;AACsB,EAAA;AAApB,IAAA;AAAqB,EAAA;AAAA;AAGX,EAAA;AACgB,IAAA;AACvD,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOqE,EAAA;AACH,IAAA;AAClE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOyF,EAAA;AAChC,IAAA;AACzD,EAAA;AAAA;AAAA;AAAA;AAAA;AAM6D,EAAA;AACF,IAAA;AAC3D,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO6D,EAAA;AACF,IAAA;AAC3D,EAAA;AAAA;AAAA;AAAA;AAAA;AAMiG,EAAA;AAC9B,IAAA;AACnE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOqE,EAAA;AACF,IAAA;AACnE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUwC,EAAA;AACX,IAAA;AACP,MAAA;AACnB,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAU0F,EAAA;AACzB,IAAA;AACjE,EAAA;AACF;ADxCsE;AACA;AACA;AACA","file":"/home/anes/delo-payment/sdk-publish-w2/dist/chunk-J4ZB7MU4.cjs","sourcesContent":[null,"import type { RequestFn } from '../../client';\nimport type {\n IndustryAvailability,\n IndustryCatalog,\n IndustryCategory,\n IndustryCreateRequest,\n IndustryMapRequest,\n IndustryPreview,\n IndustryPreviewQuery,\n IndustryRenameRequest,\n MerchantDefinedIndustry,\n MerchantDefinedIndustryList,\n MerchantDefinedIndustryQuery,\n} from '../types';\n\nconst path = (id: string): string => `/admin-portal/industries/${encodeURIComponent(id)}`;\n\n/**\n * The industry catalog: industries, their sub-industries, and where each one\n * can be selected. Reads take any internal role; changes need the account\n * management permission. Every change is recorded in the audit log\n * (`entity_type: 'industry'`), and a change that changes nothing records\n * nothing.\n *\n * An entry is selectable at a merchant, project or shop when it is active,\n * (for a sub-industry) its industry is selectable there too, and its own\n * availability is `all` or one of its scopes reaches the target.\n *\n * Errors: `IR_06` (422) an invalid name, scope or availability, a parent that\n * is a sub-industry, or a preview naming both a project and a shop; `IR_37`\n * (404) an unknown entry, parent, merchant, project or shop; `IR_38` (400) an\n * active sibling already has the name; `IR_16` (400) the parent industry is\n * archived.\n */\nexport class AdminIndustries {\n constructor(private readonly request: RequestFn) {}\n\n /** The whole catalog, archived entries included. `GET /admin-portal/industries` */\n async list(): Promise<IndustryCatalog> {\n return this.request('GET', '/admin-portal/industries');\n }\n\n /**\n * Create an industry, or a sub-industry under `parent_id`. Without\n * `availability` it can be selected nowhere until availability is set.\n * `POST /admin-portal/industries`\n */\n async create(body: IndustryCreateRequest): Promise<IndustryCategory> {\n return this.request('POST', '/admin-portal/industries', { body });\n }\n\n /**\n * Rename an entry. With `apply_to` `all` (the default) its id stays; with\n * `from` or `today` the answer is the new entry that carries the new name\n * (see `IndustryRenameRequest`). `PATCH /admin-portal/industries/{industry_id}`\n */\n async rename(industryId: string, body: IndustryRenameRequest): Promise<IndustryCategory> {\n return this.request('PATCH', path(industryId), { body });\n }\n\n /**\n * Stop offering an entry, and for an industry its sub-industries, for new\n * selections. Existing selections keep it. `POST /admin-portal/industries/{industry_id}/archive`\n */\n async archive(industryId: string): Promise<IndustryCategory> {\n return this.request('POST', `${path(industryId)}/archive`);\n }\n\n /**\n * Offer an archived entry again. Refused while an active sibling holds its\n * name, or for a sub-industry while its industry is archived.\n * `POST /admin-portal/industries/{industry_id}/restore`\n */\n async restore(industryId: string): Promise<IndustryCategory> {\n return this.request('POST', `${path(industryId)}/restore`);\n }\n\n /**\n * Replace where an entry can be selected.\n * `PUT /admin-portal/industries/{industry_id}/availability`\n */\n async setAvailability(industryId: string, body: IndustryAvailability): Promise<IndustryCategory> {\n return this.request('PUT', `${path(industryId)}/availability`, { body });\n }\n\n /**\n * Every entry as seen from one merchant, or one of its projects or shops:\n * whether it can be selected there, why, and which scope grants it.\n * `GET /admin-portal/industries/preview`\n */\n async preview(query: IndustryPreviewQuery): Promise<IndustryPreview> {\n return this.request('GET', '/admin-portal/industries/preview', { query: { ...query } });\n }\n\n /**\n * The industries merchants defined for themselves, each with its merchant,\n * the selections naming it, the closest of DeloPay's entries selectable at\n * that merchant, and its mapping. An employee limited to some merchants sees\n * theirs only. `GET /admin-portal/industries/merchant-defined`\n */\n async listMerchantDefined(\n query: MerchantDefinedIndustryQuery = {},\n ): Promise<MerchantDefinedIndustryList> {\n return this.request('GET', '/admin-portal/industries/merchant-defined', {\n query: { ...query },\n });\n }\n\n /**\n * Move every selection of a merchant-defined industry, and every payment\n * counted in it, to one of DeloPay's active entries selectable at that\n * merchant, and archive it as `mapped`. The merchant is shown a notice for\n * 90 days. Needs the account-management group. An entry already archived or\n * mapped answers 422 (`IR_06`); an id that is not merchant-defined, 404\n * (`IR_37`). `POST /admin-portal/industries/{industry_id}/map`\n */\n async map(industryId: string, body: IndustryMapRequest): Promise<MerchantDefinedIndustry> {\n return this.request('POST', `${path(industryId)}/map`, { body });\n }\n}\n"]}
|