@distilled.cloud/stripe 1.0.0-rc.15 → 1.0.0-rc.17

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.
Files changed (55) hide show
  1. package/lib/.lazy.json +1 -0
  2. package/lib/_bundle/lazy.js +4 -0
  3. package/lib/_bundle/sdk.js +2 -0
  4. package/lib/_bundle/sdk.js.map +1 -0
  5. package/lib/credentials.d.ts +1 -1
  6. package/lib/credentials.d.ts.map +1 -1
  7. package/lib/credentials.js +1 -31
  8. package/lib/errors.d.ts +83 -83
  9. package/lib/errors.d.ts.map +1 -1
  10. package/lib/errors.js +1 -130
  11. package/lib/index.d.ts +1 -1
  12. package/lib/index.js +1 -14
  13. package/lib/index.lazy.js +8 -0
  14. package/lib/pagination.d.ts +3 -3
  15. package/lib/pagination.js +1 -28
  16. package/lib/protocol.d.ts +12 -12
  17. package/lib/protocol.d.ts.map +1 -1
  18. package/lib/protocol.js +1 -399
  19. package/lib/retry.d.ts +1 -1
  20. package/lib/retry.d.ts.map +1 -1
  21. package/lib/retry.js +1 -32
  22. package/lib/services/index.js +0 -2
  23. package/lib/services/stripe.d.ts +507 -14141
  24. package/lib/services/stripe.d.ts.map +1 -1
  25. package/lib/services/stripe.js +918 -53147
  26. package/lib/services/stripe.js.map +1 -1
  27. package/lib/services.lazy/index.js +3 -0
  28. package/lib/services.lazy/stripe.js +4 -0
  29. package/lib/traits.d.ts +2 -2
  30. package/lib/traits.js +1 -16
  31. package/lib/webhooks.js +1 -160
  32. package/lib/webhooks.js.map +1 -1
  33. package/package.json +9 -7
  34. package/src/credentials.ts +12 -11
  35. package/src/errors.ts +89 -88
  36. package/src/index.ts +1 -1
  37. package/src/pagination.ts +3 -3
  38. package/src/protocol.ts +278 -162
  39. package/src/retry.ts +6 -4
  40. package/src/services/stripe.ts +37296 -85780
  41. package/src/traits.ts +2 -2
  42. package/src/webhooks.ts +2 -2
  43. package/lib/credentials.js.map +0 -1
  44. package/lib/errors.js.map +0 -1
  45. package/lib/pagination.js.map +0 -1
  46. package/lib/protocol.js.map +0 -1
  47. package/lib/protocol.test.d.ts +0 -2
  48. package/lib/protocol.test.d.ts.map +0 -1
  49. package/lib/protocol.test.js +0 -353
  50. package/lib/protocol.test.js.map +0 -1
  51. package/lib/retry.js.map +0 -1
  52. package/lib/services/index.js.map +0 -1
  53. package/lib/traits.js.map +0 -1
  54. package/src/protocol.test.ts +0 -519
  55. /package/lib/{index.js.map → index.lazy.js.map} +0 -0
@@ -0,0 +1,3 @@
1
+ import{api$lazyNamespace as $N}from"@distilled.cloud/core/_bundle/base";
2
+ const $u=import.meta.url,stripe=$N($u,"./stripe.js");
3
+ export{stripe};
@@ -0,0 +1,4 @@
1
+ import{$L}from"../_bundle/lazy.js";
2
+ const{o:$o,e:$e,E:$E}=/*@__PURE__*/$L("../services/stripe.js","ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooopoooooooooooooooooooooooooooooooooooooooooopooooooooooooooooooooooooooooooooooooopoooooooooooooooooooooopooooooooooooooooopoooooopoooooooooooooooooooooooooooooooooooopooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",581521,58092);
3
+ export const{ProductHasPrices}=$E;
4
+ export const CreateAccount=$o(),CreateAccountExternalAccount=$o(),CreateAccountLink=$o(),CreateAccountLoginLink=$o(),CreateAccountPerson=$o(),CreateAccountReject=$o(),CreateAccountSession=$o(),CreateAccountUnreject=$o(),CreateApplePayDomain=$o(),CreateApplicationFeeRefund=$o(),CreateAppsInstall=$o(),CreateAppsInstallUninstall=$o(),CreateAppsSecret=$o(),CreateAppsSecretsDelete=$o(),CreateBalanceSettings=$o(),CreateBillingAlert=$o(),CreateBillingAlertActivate=$o(),CreateBillingAlertArchive=$o(),CreateBillingAlertDeactivate=$o(),CreateBillingCreditGrant=$o(),CreateBillingCreditGrantExpire=$o(),CreateBillingCreditGrantVoid=$o(),CreateBillingFeedbackOption=$o(),CreateBillingFeedbackOptionDeactivate=$o(),CreateBillingMeter=$o(),CreateBillingMeterDeactivate=$o(),CreateBillingMeterEvent=$o(),CreateBillingMeterEvent2=$o(),CreateBillingMeterEventAdjustment=$o(),CreateBillingMeterEventAdjustment2=$o(),CreateBillingMeterEventSession=$o(),CreateBillingMeterEventStream=$o(),CreateBillingMeterReactivate=$o(),CreateBillingPortalConfiguration=$o(),CreateBillingPortalSession=$o(),CreateCharge=$o(),CreateChargeCapture=$o(),CreateCheckoutSession=$o(),CreateCheckoutSessionExpire=$o(),CreateClimateOrder=$o(),CreateClimateOrderCancel=$o(),CreateCommerceProductCatalogImport=$o(),CreateCoreAccount=$o(),CreateCoreAccountClose=$o(),CreateCoreAccountLink=$o(),CreateCoreAccountPerson=$o(),CreateCoreAccountPersonToken=$o(),CreateCoreAccountToken=$o(),CreateCoreEventDestination=$o(),CreateCoreEventDestinationDisable=$o(),CreateCoreEventDestinationEnable=$o(),CreateCoreEventDestinationPing=$o(),CreateCoupon=$o(),CreateCreditNote=$o(),CreateCreditNoteVoid=$o(),CreateCustomer=$o(),CreateCustomerBalanceTransaction=$o(),CreateCustomerCashBalance=$o(),CreateCustomerFundingInstruction=$o(),CreateCustomerSession=$o(),CreateCustomerSource=$o(),CreateCustomerSourceVerify=$o(),CreateCustomerTaxIds=$o(),CreateDisputeClose=$o(),CreateEntitlementsFeature=$o(),CreateEphemeralKey=$o(),CreateFile=$o(),CreateFileLink=$o(),CreateFinancialConnectionsAccountDisconnect=$o(),CreateFinancialConnectionsAccountRefresh=$o(),CreateFinancialConnectionsAccountSubscribe=$o(),CreateFinancialConnectionsAccountUnsubscribe=$o(),CreateFinancialConnectionsSession=$o(),CreateForwardingRequest=$o(),CreateIdentityVerificationSession=$o(),CreateIdentityVerificationSessionCancel=$o(),CreateIdentityVerificationSessionRedact=$o(),CreateInvoice=$o(),CreateInvoiceAddLine=$o(),CreateInvoiceAttachPayment=$o(),CreateInvoiceFinalize=$o(),CreateInvoiceitem=$o(),CreateInvoiceMarkUncollectible=$o(),CreateInvoicePay=$o(),CreateInvoiceRemoveLine=$o(),CreateInvoiceRenderingTemplateArchive=$o(),CreateInvoiceRenderingTemplateUnarchive=$o(),CreateInvoicesCreatePreview=$o(),CreateInvoiceSend=$o(),CreateInvoiceUpdateLine=$o(),CreateInvoiceVoid=$o(),CreateIssuingCard=$o(),CreateIssuingCardholder=$o(),CreateIssuingDispute=$o(),CreateIssuingDisputeSubmit=$o(),CreateIssuingPersonalizationDesign=$o(),CreatePaymentIntent=$o(),CreatePaymentIntentApplyCustomerBalance=$o(),CreatePaymentIntentCancel=$o(),CreatePaymentIntentCapture=$o(),CreatePaymentIntentConfirm=$o(),CreatePaymentIntentIncrementAuthorization=$o(),CreatePaymentIntentVerifyMicrodeposit=$o(),CreatePaymentLink=$o(),CreatePaymentMethod=$o(),CreatePaymentMethodAttach=$o(),CreatePaymentMethodConfiguration=$o(),CreatePaymentMethodDetach=$o(),CreatePaymentMethodDomain=$o(),CreatePaymentMethodDomainValidate=$o(),CreatePaymentRecordReportPaymentAttempt=$o(),CreatePaymentRecordReportPaymentAttemptCanceled=$o(),CreatePaymentRecordReportPaymentAttemptFailed=$o(),CreatePaymentRecordReportPaymentAttemptGuaranteed=$o(),CreatePaymentRecordReportPaymentAttemptInformational=$o(),CreatePaymentRecordReportRefund=$o(),CreatePaymentRecordsReportPayment=$o(),CreatePayout=$o(),CreatePayoutCancel=$o(),CreatePayoutReverse=$o(),CreatePlan=$o(),CreatePrice=$o(),CreateProduct=$o(),CreateProductCatalogTrialOffer=$o(),CreateProductFeature=$o(),CreatePromotionCode=$o(),CreateQuote=$o(),CreateQuoteAccept=$o(),CreateQuoteCancel=$o(),CreateQuoteFinalize=$o(),CreateRadarPaymentEvaluation=$o(),CreateRadarValueList=$o(),CreateRadarValueListItem=$o(),CreateRefund=$o(),CreateRefundCancel=$o(),CreateReportingReportRun=$o(),CreateReviewApprove=$o(),CreateSetupIntent=$o(),CreateSetupIntentCancel=$o(),CreateSetupIntentConfirm=$o(),CreateSetupIntentVerifyMicrodeposit=$o(),CreateShippingRate=$o(),CreateSource=$o(),CreateSourceVerify=$o(),CreateSubscription=$o(),CreateSubscriptionItem=$o(),CreateSubscriptionMigrate=$o(),CreateSubscriptionPause=$o(),CreateSubscriptionResume=$o(),CreateSubscriptionSchedule=$o(),CreateSubscriptionScheduleCancel=$o(),CreateSubscriptionScheduleRelease=$o(),CreateTaxCalculation=$o(),CreateTaxIds=$o(),CreateTaxLocation=$o(),CreateTaxRate=$o(),CreateTaxRegistration=$o(),CreateTaxSettings=$o(),CreateTaxTransactionsCreateFromCalculation=$o(),CreateTaxTransactionsCreateReversal=$o(),CreateTerminalConfiguration=$o(),CreateTerminalConnectionToken=$o(),CreateTerminalLocation=$o(),CreateTerminalOnboardingLink=$o(),CreateTerminalReader=$o(),CreateTerminalReaderCancelAction=$o(),CreateTerminalReaderCollectInput=$o(),CreateTerminalReaderCollectPaymentMethod=$o(),CreateTerminalReaderConfirmPaymentIntent=$o(),CreateTerminalReaderProcessPaymentIntent=$o(),CreateTerminalReaderProcessSetupIntent=$o(),CreateTerminalReaderRefundPayment=$o(),CreateTerminalReaderSetReaderDisplay=$o(),CreateTestHelpersConfirmationToken=$o(),CreateTestHelpersCustomerFundCashBalance=$o(),CreateTestHelpersIssuingAuthorization=$o(),CreateTestHelpersIssuingAuthorizationCapture=$o(),CreateTestHelpersIssuingAuthorizationExpire=$o(),CreateTestHelpersIssuingAuthorizationFinalizeAmount=$o(),CreateTestHelpersIssuingAuthorizationFraudChallengesRespond=$o(),CreateTestHelpersIssuingAuthorizationIncrement=$o(),CreateTestHelpersIssuingAuthorizationReverse=$o(),CreateTestHelpersIssuingCardShippingDeliver=$o(),CreateTestHelpersIssuingCardShippingFail=$o(),CreateTestHelpersIssuingCardShippingReturn=$o(),CreateTestHelpersIssuingCardShippingShip=$o(),CreateTestHelpersIssuingCardShippingSubmit=$o(),CreateTestHelpersIssuingPersonalizationDesignActivate=$o(),CreateTestHelpersIssuingPersonalizationDesignDeactivate=$o(),CreateTestHelpersIssuingPersonalizationDesignReject=$o(),CreateTestHelpersIssuingTransactionRefund=$o(),CreateTestHelpersIssuingTransactionsCreateForceCapture=$o(),CreateTestHelpersIssuingTransactionsCreateUnlinkedRefund=$o(),CreateTestHelpersRefundExpire=$o(),CreateTestHelpersTerminalReaderPresentPaymentMethod=$o(),CreateTestHelpersTerminalReaderSucceedInputCollection=$o(),CreateTestHelpersTerminalReaderTimeoutInputCollection=$o(),CreateTestHelpersTestClock=$o(),CreateTestHelpersTestClockAdvance=$o(),CreateTestHelpersTreasuryInboundTransferFail=$o(),CreateTestHelpersTreasuryInboundTransferReturn=$o(),CreateTestHelpersTreasuryInboundTransferSucceed=$o(),CreateTestHelpersTreasuryOutboundPaymentFail=$o(),CreateTestHelpersTreasuryOutboundPaymentPost=$o(),CreateTestHelpersTreasuryOutboundPaymentReturn=$o(),CreateTestHelpersTreasuryOutboundTransferFail=$o(),CreateTestHelpersTreasuryOutboundTransferPost=$o(),CreateTestHelpersTreasuryOutboundTransferReturn=$o(),CreateTestHelpersTreasuryReceivedCredit=$o(),CreateTestHelpersTreasuryReceivedDebit=$o(),CreateThreeDSecureAuthentication=$o(),CreateThreeDSecureAuthenticationCancel=$o(),CreateThreeDSecureAuthenticationSubmit=$o(),CreateToken=$o(),CreateTopup=$o(),CreateTopupCancel=$o(),CreateTransfer=$o(),CreateTransferReversal=$o(),CreateTreasuryCreditReversal=$o(),CreateTreasuryDebitReversal=$o(),CreateTreasuryFinancialAccount=$o(),CreateTreasuryFinancialAccountClose=$o(),CreateTreasuryFinancialAccountFeature=$o(),CreateTreasuryInboundTransfer=$o(),CreateTreasuryInboundTransferCancel=$o(),CreateTreasuryOutboundPayment=$o(),CreateTreasuryOutboundPaymentCancel=$o(),CreateTreasuryOutboundTransfer=$o(),CreateTreasuryOutboundTransferCancel=$o(),CreateWebhookEndpoint=$o(),DeleteAccount=$o(),DeleteAccountExternalAccount=$o(),DeleteAccountPerson=$o(),DeleteApplePayDomain=$o(),DeleteCoreAccountPerson=$o(),DeleteCoreEventDestination=$o(),DeleteCoupon=$o(),DeleteCustomer=$o(),DeleteCustomerDiscount=$o(),DeleteCustomerSource=$o(),DeleteCustomerTaxIds=$o(),DeleteEphemeralKey=$o(),DeleteInvoice=$o(),DeleteInvoiceitem=$o(),DeletePlan=$o(),DeleteProduct=$o(),DeleteProductFeature=$o(),DeleteRadarValueList=$o(),DeleteRadarValueListItem=$o(),DeleteSubscription=$o(),DeleteSubscriptionDiscount=$o(),DeleteSubscriptionItem=$o(),DeleteTaxIds=$o(),DeleteTerminalConfiguration=$o(),DeleteTerminalLocation=$o(),DeleteTerminalReader=$o(),DeleteTestHelpersTestClock=$o(),DeleteWebhookEndpoint=$o(),GetAccount=$o(),GetAccountByAccount=$o(),GetAccountCapabilities=$o(),GetAccountCapability=$o(),GetAccountExternalAccount=$o(),GetAccountExternalAccounts=$o(),GetAccountPerson=$o(),GetAccountPersons=$o(),GetAccounts=$o(),GetApplePayDomain=$o(),GetApplePayDomains=$o(),GetApplicationFee=$o(),GetApplicationFeeRefund=$o(),GetApplicationFeeRefunds=$o(),GetApplicationFees=$o(),GetAppsInstall=$o(),GetAppsInstalls=$o(),GetAppsSecrets=$o(),GetAppsSecretsFind=$o(),GetBalance=$o(),GetBalanceSettings=$o(),GetBalanceTransaction=$o(),GetBalanceTransactions=$o(),GetBillingAlert=$o(),GetBillingAlerts=$o(),GetBillingCreditBalanceSummary=$o(),GetBillingCreditBalanceTransaction=$o(),GetBillingCreditBalanceTransactions=$o(),GetBillingCreditGrant=$o(),GetBillingCreditGrants=$o(),GetBillingFeedbackOption=$o(),GetBillingFeedbackOptions=$o(),GetBillingMeter=$o(),GetBillingMeterEventSummaries=$o(),GetBillingMeters=$o(),GetBillingPortalConfiguration=$o(),GetBillingPortalConfigurations=$o(),GetCharge=$o(),GetChargeRefund=$o(),GetChargeRefunds=$o(),GetCharges=$o(),GetChargesSearch=$o(),GetCheckoutSession=$o(),GetCheckoutSessionLineItems=$o(),GetCheckoutSessions=$o(),GetClimateOrder=$o(),GetClimateOrders=$o(),GetClimateProduct=$o(),GetClimateProducts=$o(),GetClimateSupplier=$o(),GetClimateSuppliers=$o(),GetCommerceProductCatalogImport=$o(),GetCommerceProductCatalogImports=$o(),GetConfirmationToken=$o(),GetCoreAccount=$o(),GetCoreAccountPerson=$o(),GetCoreAccountPersons=$o(),GetCoreAccountPersonToken=$o(),GetCoreAccounts=$o(),GetCoreAccountToken=$o(),GetCoreEvent=$o(),GetCoreEventDestination=$o(),GetCoreEventDestinations=$o(),GetCoreEvents=$o(),GetCountrySpecs=$o(),GetCountrySpecsCountry=$o(),GetCoupon=$o(),GetCoupons=$o(),GetCreditNote=$o(),GetCreditNoteLines=$o(),GetCreditNotes=$o(),GetCreditNotesPreview=$o(),GetCreditNotesPreviewLines=$o(),GetCustomer=$o(),GetCustomerBalanceTransaction=$o(),GetCustomerBalanceTransactions=$o(),GetCustomerCashBalance=$o(),GetCustomerCashBalanceTransaction=$o(),GetCustomerCashBalanceTransactions=$o(),GetCustomerPaymentMethod=$o(),GetCustomerPaymentMethods=$o(),GetCustomers=$o(),GetCustomerSource=$o(),GetCustomerSources=$o(),GetCustomersSearch=$o(),GetCustomerTaxIds=$o(),GetCustomerTaxIdsById=$o(),GetDispute=$o(),GetDisputes=$o(),GetEntitlementsActiveEntitlement=$o(),GetEntitlementsActiveEntitlements=$o(),GetEntitlementsFeature=$o(),GetEntitlementsFeatures=$o(),GetEvent=$o(),GetEvents=$o(),GetExchangeRate=$o(),GetExchangeRates=$o(),GetFile=$o(),GetFileLink=$o(),GetFileLinks=$o(),GetFiles=$o(),GetFinancialConnectionsAccount=$o(),GetFinancialConnectionsAccountOwners=$o(),GetFinancialConnectionsAccounts=$o(),GetFinancialConnectionsSession=$o(),GetFinancialConnectionsTransaction=$o(),GetFinancialConnectionsTransactions=$o(),GetForwardingRequest=$o(),GetForwardingRequests=$o(),GetIdentityVerificationReport=$o(),GetIdentityVerificationReports=$o(),GetIdentityVerificationSession=$o(),GetIdentityVerificationSessions=$o(),GetInvoice=$o(),GetInvoiceitem=$o(),GetInvoiceitems=$o(),GetInvoiceLines=$o(),GetInvoicePayment=$o(),GetInvoicePayments=$o(),GetInvoiceRenderingTemplate=$o(),GetInvoiceRenderingTemplates=$o(),GetInvoices=$o(),GetInvoicesSearch=$o(),GetIssuingAuthorization=$o(),GetIssuingAuthorizations=$o(),GetIssuingCard=$o(),GetIssuingCardholder=$o(),GetIssuingCardholders=$o(),GetIssuingCards=$o(),GetIssuingDispute=$o(),GetIssuingDisputes=$o(),GetIssuingPersonalizationDesign=$o(),GetIssuingPersonalizationDesigns=$o(),GetIssuingPhysicalBundle=$o(),GetIssuingPhysicalBundles=$o(),GetIssuingToken=$o(),GetIssuingTokens=$o(),GetIssuingTransaction=$o(),GetIssuingTransactions=$o(),GetMandate=$o(),GetPaymentAttemptRecord=$o(),GetPaymentAttemptRecords=$o(),GetPaymentIntent=$o(),GetPaymentIntentAmountDetailsLineItems=$o(),GetPaymentIntents=$o(),GetPaymentIntentsSearch=$o(),GetPaymentLink=$o(),GetPaymentLinkLineItems=$o(),GetPaymentLinks=$o(),GetPaymentMethod=$o(),GetPaymentMethodConfiguration=$o(),GetPaymentMethodConfigurations=$o(),GetPaymentMethodDomain=$o(),GetPaymentMethodDomains=$o(),GetPaymentMethods=$o(),GetPaymentRecord=$o(),GetPaymentRecords=$o(),GetPayout=$o(),GetPayouts=$o(),GetPlan=$o(),GetPlans=$o(),GetPrice=$o(),GetPrices=$o(),GetPricesSearch=$o(),GetProduct=$o(),GetProductCatalogTrialOffer=$o(),GetProductCatalogTrialOffers=$o(),GetProductFeature=$o(),GetProductFeatures=$o(),GetProducts=$o(),GetProductsSearch=$o(),GetPromotionCode=$o(),GetPromotionCodes=$o(),GetQuote=$o(),GetQuoteComputedUpfrontLineItems=$o(),GetQuoteLineItems=$o(),GetQuotePdf=$o(),GetQuotes=$o(),GetRadarEarlyFraudWarning=$o(),GetRadarEarlyFraudWarnings=$o(),GetRadarValueList=$o(),GetRadarValueListItem=$o(),GetRadarValueListItems=$o(),GetRadarValueLists=$o(),GetRefund=$o(),GetRefunds=$o(),GetReportingReportRun=$o(),GetReportingReportRuns=$o(),GetReportingReportType=$o(),GetReportingReportTypes=$o(),GetReview=$o(),GetReviews=$o(),GetSetupAttempts=$o(),GetSetupIntent=$o(),GetSetupIntents=$o(),GetShippingRate=$o(),GetShippingRates=$o(),GetSigmaScheduledQueryRun=$o(),GetSigmaScheduledQueryRuns=$o(),GetSource=$o(),GetSourceTransactions=$o(),GetSubscription=$o(),GetSubscriptionItem=$o(),GetSubscriptionItems=$o(),GetSubscriptions=$o(),GetSubscriptionSchedule=$o(),GetSubscriptionSchedules=$o(),GetSubscriptionsSearch=$o(),GetTaxAssociationsFind=$o(),GetTaxCalculation=$o(),GetTaxCalculationLineItems=$o(),GetTaxCode=$o(),GetTaxCodes=$o(),GetTaxIds=$o(),GetTaxIdsById=$o(),GetTaxLocation=$o(),GetTaxLocations=$o(),GetTaxRate=$o(),GetTaxRates=$o(),GetTaxRegistration=$o(),GetTaxRegistrations=$o(),GetTaxSettings=$o(),GetTaxTransaction=$o(),GetTaxTransactionLineItems=$o(),GetTerminalConfiguration=$o(),GetTerminalConfigurations=$o(),GetTerminalLocation=$o(),GetTerminalLocations=$o(),GetTerminalReader=$o(),GetTerminalReaders=$o(),GetTestHelpersTestClock=$o(),GetTestHelpersTestClocks=$o(),GetThreeDSecureAuthentication=$o(),GetThreeDSecureAuthentications=$o(),GetToken=$o(),GetTopup=$o(),GetTopups=$o(),GetTransfer=$o(),GetTransferReversal=$o(),GetTransferReversals=$o(),GetTransfers=$o(),GetTreasuryCreditReversal=$o(),GetTreasuryCreditReversals=$o(),GetTreasuryDebitReversal=$o(),GetTreasuryDebitReversals=$o(),GetTreasuryFinancialAccount=$o(),GetTreasuryFinancialAccountFeatures=$o(),GetTreasuryFinancialAccounts=$o(),GetTreasuryInboundTransfer=$o(),GetTreasuryInboundTransfers=$o(),GetTreasuryOutboundPayment=$o(),GetTreasuryOutboundPayments=$o(),GetTreasuryOutboundTransfer=$o(),GetTreasuryOutboundTransfers=$o(),GetTreasuryReceivedCredit=$o(),GetTreasuryReceivedCredits=$o(),GetTreasuryReceivedDebit=$o(),GetTreasuryReceivedDebits=$o(),GetTreasuryTransaction=$o(),GetTreasuryTransactionEntries=$o(),GetTreasuryTransactionEntry=$o(),GetTreasuryTransactions=$o(),GetWebhookEndpoint=$o(),GetWebhookEndpoints=$o(),UpdateAccount=$o(),UpdateAccountCapability=$o(),UpdateAccountExternalAccount=$o(),UpdateAccountPerson=$o(),UpdateApplicationFeeRefund=$o(),UpdateAppsInstall=$o(),UpdateBillingCreditGrant=$o(),UpdateBillingFeedbackOption=$o(),UpdateBillingMeter=$o(),UpdateBillingPortalConfiguration=$o(),UpdateCharge=$o(),UpdateCheckoutSession=$o(),UpdateClimateOrder=$o(),UpdateCoreAccount=$o(),UpdateCoreAccountPerson=$o(),UpdateCoreEventDestination=$o(),UpdateCoupon=$o(),UpdateCreditNote=$o(),UpdateCustomer=$o(),UpdateCustomerBalanceTransaction=$o(),UpdateCustomerSource=$o(),UpdateDispute=$o(),UpdateEntitlementsFeature=$o(),UpdateFileLink=$o(),UpdateIdentityVerificationSession=$o(),UpdateInvoice=$o(),UpdateInvoiceitem=$o(),UpdateInvoiceLine=$o(),UpdateIssuingAuthorization=$o(),UpdateIssuingCard=$o(),UpdateIssuingCardholder=$o(),UpdateIssuingDispute=$o(),UpdateIssuingPersonalizationDesign=$o(),UpdateIssuingToken=$o(),UpdateIssuingTransaction=$o(),UpdatePaymentIntent=$o(),UpdatePaymentLink=$o(),UpdatePaymentMethod=$o(),UpdatePaymentMethodConfiguration=$o(),UpdatePaymentMethodDomain=$o(),UpdatePayout=$o(),UpdatePlan=$o(),UpdatePrice=$o(),UpdateProduct=$o(),UpdateProductCatalogTrialOffer=$o(),UpdatePromotionCode=$o(),UpdateQuote=$o(),UpdateRadarValueList=$o(),UpdateRefund=$o(),UpdateSetupIntent=$o(),UpdateShippingRate=$o(),UpdateSource=$o(),UpdateSubscription=$o(),UpdateSubscriptionItem=$o(),UpdateSubscriptionSchedule=$o(),UpdateTaxRate=$o(),UpdateTaxRegistration=$o(),UpdateTerminalConfiguration=$o(),UpdateTerminalLocation=$o(),UpdateTerminalReader=$o(),UpdateTestHelpersTreasuryOutboundPayment=$o(),UpdateTestHelpersTreasuryOutboundTransfer=$o(),UpdateTopup=$o(),UpdateTransfer=$o(),UpdateTransferReversal=$o(),UpdateTreasuryFinancialAccount=$o(),UpdateWebhookEndpoint=$o();
package/lib/traits.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * Stripe SDK trait surface — hand-written.
2
+ * Stripe SDK trait surface -- hand-written.
3
3
  *
4
4
  * Re-exports the generic protocol traits from core (so generated operations
5
5
  * import everything from one place). The only Stripe-specific piece is the
6
6
  * widened `Http` trait: nearly every Stripe operation's request body is
7
7
  * `application/x-www-form-urlencoded` (with Stripe's deep bracket
8
- * expansion), which core's `HttpTrait` doesn't model — the Stripe protocol
8
+ * expansion), which core's `HttpTrait` doesn't model -- the Stripe protocol
9
9
  * keys its body encoding on `contentType: "form-urlencoded"`.
10
10
  */
11
11
  import { type HttpTrait as CoreHttpTrait } from "@distilled.cloud/core/trait";
package/lib/traits.js CHANGED
@@ -1,16 +1 @@
1
- /**
2
- * Stripe SDK trait surface — hand-written.
3
- *
4
- * Re-exports the generic protocol traits from core (so generated operations
5
- * import everything from one place). The only Stripe-specific piece is the
6
- * widened `Http` trait: nearly every Stripe operation's request body is
7
- * `application/x-www-form-urlencoded` (with Stripe's deep bracket
8
- * expansion), which core's `HttpTrait` doesn't model — the Stripe protocol
9
- * keys its body encoding on `contentType: "form-urlencoded"`.
10
- */
11
- import { Http as CoreHttp } from "@distilled.cloud/core/trait";
12
- export { Body, Header, Query, Label, ResponseCode, HttpBody, FormDataFile, KeyDictionary, UnionCases, applyErrorMatchers, getErrorMatchers, bodySymbol, headerSymbol, querySymbol, labelSymbol, httpSymbol, responseCodeSymbol, httpBodySymbol, formDataFileSymbol, keyDictionarySymbol, unionCasesSymbol, } from "@distilled.cloud/core/trait";
13
- export { RawResponse, RawResponseRoot, SensitiveValue, rawResponseSymbol, rawResponseRootSymbol, sensitiveValueSymbol, } from "@distilled.cloud/core/protocol-rest";
14
- /** Operation-level HTTP binding (see {@link HttpTrait}). */
15
- export const Http = (trait) => CoreHttp(trait);
16
- //# sourceMappingURL=traits.js.map
1
+ export { traits$Body as Body, traits$FormDataFile as FormDataFile, traits$Header as Header, traits$Http as Http, traits$HttpBody as HttpBody, traits$KeyDictionary as KeyDictionary, traits$Label as Label, traits$Query as Query, traits$RawResponse as RawResponse, traits$RawResponseRoot as RawResponseRoot, traits$ResponseCode as ResponseCode, traits$SensitiveValue as SensitiveValue, traits$UnionCases as UnionCases, traits$applyErrorMatchers as applyErrorMatchers, traits$bodySymbol as bodySymbol, traits$formDataFileSymbol as formDataFileSymbol, traits$getErrorMatchers as getErrorMatchers, traits$headerSymbol as headerSymbol, traits$httpBodySymbol as httpBodySymbol, traits$httpSymbol as httpSymbol, traits$keyDictionarySymbol as keyDictionarySymbol, traits$labelSymbol as labelSymbol, traits$querySymbol as querySymbol, traits$rawResponseRootSymbol as rawResponseRootSymbol, traits$rawResponseSymbol as rawResponseSymbol, traits$responseCodeSymbol as responseCodeSymbol, traits$sensitiveValueSymbol as sensitiveValueSymbol, traits$unionCasesSymbol as unionCasesSymbol } from "./_bundle/sdk.js";
package/lib/webhooks.js CHANGED
@@ -1,161 +1,2 @@
1
- import * as Effect from "effect/Effect";
2
- import * as Redacted from "effect/Redacted";
3
- import { StripeWebhookPayloadParseError, StripeWebhookSignatureError } from "./errors.js";
4
- export const DEFAULT_WEBHOOK_TOLERANCE_SECONDS = 300;
5
- const textEncoder = new TextEncoder();
6
- const textDecoder = new TextDecoder("utf-8", { fatal: true });
7
- const payloadToBytes = (payload) => {
8
- if (typeof payload === "string") {
9
- return textEncoder.encode(payload);
10
- }
11
- if (payload instanceof ArrayBuffer) {
12
- return new Uint8Array(payload);
13
- }
14
- return payload;
15
- };
16
- const payloadToString = (payload) => {
17
- if (typeof payload === "string") {
18
- return payload;
19
- }
20
- return textDecoder.decode(payloadToBytes(payload));
21
- };
22
- const redactSecret = (secret) => Redacted.isRedacted(secret) ? secret : Redacted.make(secret);
23
- const parseSignatureHeader = (signature) => {
24
- if (signature == null || signature.trim() === "") {
25
- return new StripeWebhookSignatureError({
26
- message: "Stripe-Signature header is required",
27
- });
28
- }
29
- let timestamp;
30
- const signatures = [];
31
- for (const part of signature.split(",")) {
32
- const separatorIndex = part.indexOf("=");
33
- if (separatorIndex === -1) {
34
- continue;
35
- }
36
- const key = part.slice(0, separatorIndex).trim();
37
- const value = part.slice(separatorIndex + 1).trim();
38
- if (key === "t" && timestamp === undefined) {
39
- timestamp = value;
40
- }
41
- else if (key === "v1") {
42
- signatures.push(value);
43
- }
44
- }
45
- if (timestamp === undefined || timestamp === "") {
46
- return new StripeWebhookSignatureError({
47
- message: "Stripe-Signature header is missing a timestamp",
48
- });
49
- }
50
- const timestampSeconds = Number(timestamp);
51
- if (!Number.isSafeInteger(timestampSeconds) ||
52
- timestampSeconds < 0 ||
53
- String(timestampSeconds) !== timestamp) {
54
- return new StripeWebhookSignatureError({
55
- message: "Stripe-Signature header timestamp is invalid",
56
- });
57
- }
58
- if (signatures.length === 0) {
59
- return new StripeWebhookSignatureError({
60
- message: "Stripe-Signature header is missing a v1 signature",
61
- });
62
- }
63
- return { timestamp, timestampSeconds, signatures };
64
- };
65
- const signedPayloadBytes = (timestamp, payload) => {
66
- const timestampBytes = textEncoder.encode(`${timestamp}.`);
67
- const bodyBytes = payloadToBytes(payload);
68
- const signedPayload = new Uint8Array(timestampBytes.byteLength + bodyBytes.byteLength);
69
- signedPayload.set(timestampBytes, 0);
70
- signedPayload.set(bodyBytes, timestampBytes.byteLength);
71
- return signedPayload.buffer;
72
- };
73
- const hmacSha256 = (secret, timestamp, payload) => Effect.tryPromise({
74
- try: async () => {
75
- const key = await crypto.subtle.importKey("raw", textEncoder.encode(Redacted.value(secret)), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
76
- const signature = await crypto.subtle.sign("HMAC", key, signedPayloadBytes(timestamp, payload));
77
- return new Uint8Array(signature);
78
- },
79
- catch: (cause) => new StripeWebhookSignatureError({
80
- message: "Unable to compute Stripe webhook signature",
81
- cause,
82
- }),
83
- });
84
- const hexToBytes = (hex) => {
85
- if (hex.length % 2 !== 0 || !/^[0-9a-fA-F]+$/.test(hex)) {
86
- return undefined;
87
- }
88
- const bytes = new Uint8Array(hex.length / 2);
89
- for (let index = 0; index < bytes.length; index += 1) {
90
- bytes[index] = Number.parseInt(hex.slice(index * 2, index * 2 + 2), 16);
91
- }
92
- return bytes;
93
- };
94
- const constantTimeEqual = (expected, candidate) => {
95
- // JavaScript cannot guarantee CPU-level constant time, but length mismatches
96
- // are folded into the accumulator so a matching prefix can never succeed.
97
- let difference = expected.byteLength ^ candidate.byteLength;
98
- const byteLength = Math.max(expected.byteLength, candidate.byteLength);
99
- for (let index = 0; index < byteLength; index += 1) {
100
- const expectedByte = index < expected.byteLength ? expected[index] : 0;
101
- const candidateByte = index < candidate.byteLength ? candidate[index] : 0;
102
- difference |= expectedByte ^ candidateByte;
103
- }
104
- return difference === 0;
105
- };
106
- const hasMatchingSignature = (expectedSignature, signatures) => {
107
- let matched = false;
108
- for (const signature of signatures) {
109
- const candidate = hexToBytes(signature) ?? new Uint8Array(0);
110
- matched = constantTimeEqual(expectedSignature, candidate) || matched;
111
- }
112
- return matched;
113
- };
114
- const validateTolerance = (timestampSeconds, toleranceSeconds) => {
115
- if (!Number.isFinite(toleranceSeconds) || toleranceSeconds < 0) {
116
- return new StripeWebhookSignatureError({
117
- message: "Stripe webhook tolerance must be a non-negative number",
118
- });
119
- }
120
- if (toleranceSeconds === 0) {
121
- return undefined;
122
- }
123
- const ageSeconds = Math.abs(Math.floor(Date.now() / 1000) - timestampSeconds);
124
- if (ageSeconds > toleranceSeconds) {
125
- return new StripeWebhookSignatureError({
126
- message: `Stripe webhook timestamp is outside the tolerance window of ${toleranceSeconds} seconds`,
127
- });
128
- }
129
- return undefined;
130
- };
131
- export const verifySignature = ({ payload, signature, secret, toleranceSeconds = DEFAULT_WEBHOOK_TOLERANCE_SECONDS, }) => Effect.gen(function* () {
132
- const parsed = parseSignatureHeader(signature);
133
- if (parsed instanceof StripeWebhookSignatureError) {
134
- return yield* Effect.fail(parsed);
135
- }
136
- const expectedSignature = yield* hmacSha256(redactSecret(secret), parsed.timestamp, payload);
137
- if (!hasMatchingSignature(expectedSignature, parsed.signatures)) {
138
- return yield* Effect.fail(new StripeWebhookSignatureError({
139
- message: "No v1 signature matches the expected Stripe webhook signature",
140
- }));
141
- }
142
- const toleranceError = validateTolerance(parsed.timestampSeconds, toleranceSeconds);
143
- if (toleranceError !== undefined) {
144
- return yield* Effect.fail(toleranceError);
145
- }
146
- });
147
- const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
148
- export const constructEvent = ({ payload, signature, secret, toleranceSeconds, }) => verifySignature({ payload, signature, secret, toleranceSeconds }).pipe(Effect.flatMap(() => Effect.try({
149
- try: () => {
150
- const parsed = JSON.parse(payloadToString(payload));
151
- if (!isRecord(parsed)) {
152
- throw new Error("Stripe webhook payload must be a JSON object");
153
- }
154
- return parsed;
155
- },
156
- catch: (cause) => new StripeWebhookPayloadParseError({
157
- message: "Unable to parse Stripe webhook payload as JSON",
158
- cause,
159
- }),
160
- })));
1
+ import{errors$StripeWebhookPayloadParseError as e,errors$StripeWebhookSignatureError as t}from"./_bundle/sdk.js";import*as n from"effect/Effect";import*as r from"effect/Redacted";const i=300;const a=/*@__PURE__*/ new TextEncoder;const o=/*@__PURE__*/ new TextDecoder(`utf-8`,{fatal:true});const payloadToBytes=e=>{if(typeof e===`string`)return a.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);return e};const payloadToString=e=>{if(typeof e===`string`)return e;return o.decode(payloadToBytes(e))};const redactSecret=e=>r.isRedacted(e)?e:r.make(e);const parseSignatureHeader=e=>{if(e==null||e.trim()===``)return new t({message:`Stripe-Signature header is required`});let n;const r=[];for(const t of e.split(`,`)){const e=t.indexOf(`=`);if(e===-1)continue;const i=t.slice(0,e).trim();const a=t.slice(e+1).trim();if(i===`t`&&n===void 0)n=a;else if(i===`v1`)r.push(a)}if(n===void 0||n===``)return new t({message:`Stripe-Signature header is missing a timestamp`});const i=Number(n);if(!Number.isSafeInteger(i)||i<0||String(i)!==n)return new t({message:`Stripe-Signature header timestamp is invalid`});if(r.length===0)return new t({message:`Stripe-Signature header is missing a v1 signature`});return{timestamp:n,timestampSeconds:i,signatures:r}};const signedPayloadBytes=(e,t)=>{const n=a.encode(`${e}.`);const r=payloadToBytes(t);const i=new Uint8Array(n.byteLength+r.byteLength);i.set(n,0);i.set(r,n.byteLength);return i.buffer};const hmacSha256=(e,i,o)=>n.tryPromise({try:async()=>{const t=await crypto.subtle.importKey(`raw`,a.encode(r.value(e)),{name:`HMAC`,hash:`SHA-256`},false,[`sign`]);const n=await crypto.subtle.sign(`HMAC`,t,signedPayloadBytes(i,o));return new Uint8Array(n)},catch:e=>new t({message:`Unable to compute Stripe webhook signature`,cause:e})});const hexToBytes=e=>{if(e.length%2!==0||!/^[0-9a-fA-F]+$/.test(e))return;const t=new Uint8Array(e.length/2);for(let n=0;n<t.length;n+=1)t[n]=Number.parseInt(e.slice(n*2,n*2+2),16);return t};const constantTimeEqual=(e,t)=>{let n=e.byteLength^t.byteLength;const r=Math.max(e.byteLength,t.byteLength);for(let i=0;i<r;i+=1){const r=i<e.byteLength?e[i]:0;const a=i<t.byteLength?t[i]:0;n|=r^a}return n===0};const hasMatchingSignature=(e,t)=>{let n=false;for(const r of t){const t=hexToBytes(r)??/* @__PURE__ */ new Uint8Array(0);n=constantTimeEqual(e,t)||n}return n};const validateTolerance=(e,n)=>{if(!Number.isFinite(n)||n<0)return new t({message:`Stripe webhook tolerance must be a non-negative number`});if(n===0)return;if(Math.abs(Math.floor(Date.now()/1e3)-e)>n)return new t({message:`Stripe webhook timestamp is outside the tolerance window of ${n} seconds`})};const verifySignature=({payload:e,signature:r,secret:i,toleranceSeconds:a=300})=>n.gen(function*(){const o=parseSignatureHeader(r);if(o instanceof t)return yield*n.fail(o);const s=yield*hmacSha256(redactSecret(i),o.timestamp,e);if(!hasMatchingSignature(s,o.signatures))return yield*n.fail(new t({message:`No v1 signature matches the expected Stripe webhook signature`}));const c=validateTolerance(o.timestampSeconds,a);if(c!==void 0)return yield*n.fail(c)});const isRecord=e=>typeof e===`object`&&e!==null&&!Array.isArray(e);const constructEvent=({payload:t,signature:r,secret:i,toleranceSeconds:a})=>verifySignature({payload:t,signature:r,secret:i,toleranceSeconds:a}).pipe(n.flatMap(()=>n.try({try:()=>{const e=JSON.parse(payloadToString(t));if(!isRecord(e))throw new Error(`Stripe webhook payload must be a JSON object`);return e},catch:t=>new e({message:`Unable to parse Stripe webhook payload as JSON`,cause:t})})));export{i as DEFAULT_WEBHOOK_TOLERANCE_SECONDS,constructEvent,verifySignature};
161
2
  //# sourceMappingURL=webhooks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,8BAA8B,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAE1F,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,CAAC;AAyCrD,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE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EAAE;QACR,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,CAAY,CAAC;QAC/D,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CACf,IAAI,8BAA8B,CAAC;QACjC,OAAO,EAAE,gDAAgD;QACzD,KAAK;KACN,CAAC;CACL,CAAC,CACH,CACF,CAAC"}
1
+ {"version":3,"file":"webhooks.js","names":["StripeWebhookPayloadParseError","StripeWebhookSignatureError","Effect","Redacted","DEFAULT_WEBHOOK_TOLERANCE_SECONDS","textEncoder","textDecoder","payload","secret","signature","timestamp","signatures","part","separatorIndex","key","value","timestampSeconds","timestampBytes","bodyBytes","signedPayload","hex","bytes","index","difference","expected","candidate","byteLength","expectedByte","candidateByte","matched","expectedSignature","toleranceSeconds","parsed","toleranceError"],"sources":["../src/webhooks.ts"],"mappings":"mLAIA,MAAaI,EAAoC,IAyCjD,MAAMC,gBAA4B,IAAI,YACtC,MAAMC,gBAA4B,IAAI,YAAY,QAAS,CAAE,MAAO,IAAK,CAAC,EAE1E,MAAM,eAAkB,GAAwC,CAC9D,GAAI,OAAOC,IAAY,SACrB,OAAOF,EAAY,OAAOE,CAAO,EAGnC,GAAIA,aAAmB,YACrB,OAAO,IAAI,WAAWA,CAAO,EAG/B,OAAOA,CACT,EAEA,MAAM,gBAAmB,GAAoC,CAC3D,GAAI,OAAOA,IAAY,SACrB,OAAOA,EAGT,OAAOD,EAAY,OAAO,eAAeC,CAAO,CAAC,CACnD,EAEA,MAAM,aAAgB,GACpBJ,EAAS,WAAWK,CAAM,EAAIA,EAASL,EAAS,KAAKK,CAAM,EAE7D,MAAM,qBACJ,GACwD,CACxD,GAAIC,GAAa,MAAQA,EAAU,KAAK,IAAM,G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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@distilled.cloud/stripe",
3
- "version": "1.0.0-rc.15",
3
+ "version": "1.0.0-rc.17",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,6 +18,7 @@
18
18
  "types": "./lib/index.d.ts",
19
19
  "bun": "./src/index.ts",
20
20
  "worker": "./src/index.ts",
21
+ "distilled-lazy": "./lib/index.lazy.js",
21
22
  "default": "./lib/index.js"
22
23
  },
23
24
  "./Credentials": {
@@ -66,27 +67,28 @@
66
67
  "types": "./lib/services/*.d.ts",
67
68
  "bun": "./src/services/*.ts",
68
69
  "worker": "./src/services/*.ts",
70
+ "distilled-lazy": "./lib/services.lazy/*.js",
69
71
  "default": "./lib/services/*.js"
70
72
  }
71
73
  },
72
74
  "dependencies": {
73
- "@distilled.cloud/core": "1.0.0-rc.15"
75
+ "@distilled.cloud/core": "1.0.0-rc.17"
74
76
  },
75
77
  "devDependencies": {
76
- "@types/node": "26.2.0"
78
+ "@types/node": "26.6.5"
77
79
  },
78
80
  "peerDependencies": {
79
- "effect": "^4.0.0"
81
+ "effect": "^4.0.5"
80
82
  },
81
83
  "distilled": {
82
- "generatedAt": "2026-10-06",
84
+ "generatedAt": "2026-10-09",
83
85
  "specUpdatedAt": "2026-09-30"
84
86
  },
85
87
  "scripts": {
86
- "build": "tsc -b",
88
+ "build": "tsrs -b",
87
89
  "convert": "node --conditions=bun scripts/convert.ts",
88
90
  "generate": "node --conditions=bun scripts/convert.ts && node --conditions=bun scripts/generate.ts",
89
- "typecheck": "tsc -p tsconfig.json",
91
+ "typecheck": "tsrs -p tsconfig.json",
90
92
  "specs:fetch": "git submodule update --force --init --depth=1 specs/spec-mirror-stripe",
91
93
  "specs:update": "git submodule update --remote --force --depth=1 specs/spec-mirror-stripe"
92
94
  }
@@ -1,12 +1,12 @@
1
+ import * as EffectConfig from "@distilled.cloud/core/config";
1
2
  /**
2
- * Stripe credentials — hand-written.
3
+ * Stripe credentials -- hand-written.
3
4
  *
4
5
  * API-compatible port of the distilled v0 stripe credentials module: the
5
6
  * `Credentials` service holds an *effect* that resolves the current
6
7
  * credentials on every request. `CredentialsFromEnv` reads `STRIPE_API_KEY`.
7
8
  */
8
9
  import { ConfigError } from "@distilled.cloud/core/errors";
9
- import * as EffectConfig from "effect/Config";
10
10
  import * as Context from "effect/Context";
11
11
  import * as Effect from "effect/Effect";
12
12
  import * as Layer from "effect/Layer";
@@ -19,24 +19,25 @@ export interface Config {
19
19
  readonly apiBaseUrl: string;
20
20
  }
21
21
 
22
- export class Credentials extends Context.Service<Credentials, Effect.Effect<Config>>()(
23
- "StripeCredentials",
24
- ) {}
22
+ export class Credentials
23
+ extends /*@__PURE__*/ Context.Service<Credentials, Effect.Effect<Config>>()(
24
+ "StripeCredentials",
25
+ ) {}
25
26
 
26
- const envConfig = EffectConfig.all({
27
- apiKey: EffectConfig.String("STRIPE_API_KEY"),
27
+ const envConfig = /*@__PURE__*/ EffectConfig.all({
28
+ apiKey: /*@__PURE__*/ EffectConfig.String("STRIPE_API_KEY"),
28
29
  });
29
30
 
30
- export const CredentialsFromEnv = Layer.succeed(
31
+ export const CredentialsFromEnv = /*@__PURE__*/ Layer.succeed(
31
32
  Credentials,
32
- envConfig.pipe(
33
- Effect.mapError(
33
+ /*@__PURE__*/ envConfig.pipe(
34
+ /*@__PURE__*/ Effect.mapError(
34
35
  () =>
35
36
  new ConfigError({
36
37
  message: "STRIPE_API_KEY environment variable is required",
37
38
  }),
38
39
  ),
39
- Effect.map(({ apiKey }) => ({
40
+ /*@__PURE__*/ Effect.map(({ apiKey }) => ({
40
41
  apiKey: Redacted.make(apiKey),
41
42
  apiBaseUrl: DEFAULT_API_BASE_URL,
42
43
  })),