@boelabs/billete-sdk 0.3.1 → 0.3.2
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/client.d.ts +1 -2
- package/dist/client.js +1 -3
- package/dist/errors-oT7VMFhd.d.ts +1 -2
- package/dist/events-BJuSt_4W.d.ts +1 -2
- package/dist/{http-CG9YDQ6-.js → http-kkjWt1D4.js} +1 -3
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -3
- package/dist/webhooks.d.ts +1 -2
- package/dist/webhooks.js +0 -2
- package/package.json +1 -1
- package/dist/client.js.map +0 -1
- package/dist/http-CG9YDQ6-.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/webhooks.js.map +0 -1
package/dist/client.d.ts
CHANGED
|
@@ -50,5 +50,4 @@ export declare function createClient(options?: ClientOptions): {
|
|
|
50
50
|
};
|
|
51
51
|
type BilleteClient = ReturnType<typeof createClient>;
|
|
52
52
|
//#endregion
|
|
53
|
-
export { type API_ERROR_TYPES, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type BILLING_MONTHS, type Balance, type BalanceAmount, type BilleteClient, BilleteError, type BillingMonths, type CHECKOUT_PURPOSES, type CURRENCIES, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPaymentMethod, type CheckoutPurpose, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientLinkCheckout, type ClientOptions, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerSession, type CustomerSessionCreate, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type Feature, type FeatureCreate, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type GRACE_PERIOD_DAYS, type GracePeriodDays, type KEY_PATTERN, type List, type ListQuery, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanUpdate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicPaymentLink, type QuantityInput, type QuantitySettings, type RESET_FREQUENCIES, type RISK_LEVELS, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RetireInput, type Retirement, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SubmitLabel, type Subscription, type SubscriptionCancel, type SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, type SubscriptionUpdate, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type USAGE_FEATURE_TYPES, type VariantInput, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointUpdate, type WebhookEvent, type Weekday, type isLandlinePhone, type isMobilePhone, type nationalPhone, type tokenEnvironment, type tokenPrefix };
|
|
54
|
-
//# sourceMappingURL=client.d.ts.map
|
|
53
|
+
export { type API_ERROR_TYPES, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type BILLING_MONTHS, type Balance, type BalanceAmount, type BilleteClient, BilleteError, type BillingMonths, type CHECKOUT_PURPOSES, type CURRENCIES, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPaymentMethod, type CheckoutPurpose, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientLinkCheckout, type ClientOptions, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerSession, type CustomerSessionCreate, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type Feature, type FeatureCreate, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type GRACE_PERIOD_DAYS, type GracePeriodDays, type KEY_PATTERN, type List, type ListQuery, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanUpdate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicPaymentLink, type QuantityInput, type QuantitySettings, type RESET_FREQUENCIES, type RISK_LEVELS, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RetireInput, type Retirement, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SubmitLabel, type Subscription, type SubscriptionCancel, type SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, type SubscriptionUpdate, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type USAGE_FEATURE_TYPES, type VariantInput, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointUpdate, type WebhookEvent, type Weekday, type isLandlinePhone, type isMobilePhone, type nationalPhone, type tokenEnvironment, type tokenPrefix };
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as segment, r as BilleteError, t as createTransport } from "./http-
|
|
1
|
+
import { n as segment, r as BilleteError, t as createTransport } from "./http-kkjWt1D4.js";
|
|
2
2
|
//#region src/create-client.ts
|
|
3
3
|
/**
|
|
4
4
|
* Browser client. It never holds a secret key: checkouts are addressed by their unguessable ID
|
|
@@ -98,5 +98,3 @@ list: (options) => http.request({
|
|
|
98
98
|
}
|
|
99
99
|
//#endregion
|
|
100
100
|
export { BilleteError, createClient };
|
|
101
|
-
|
|
102
|
-
//# sourceMappingURL=client.js.map
|
|
@@ -446,5 +446,4 @@ declare class BilleteError extends Error {
|
|
|
446
446
|
}, status: number);
|
|
447
447
|
}
|
|
448
448
|
//#endregion
|
|
449
|
-
export { ProductCheckoutCreate as A, VariantInput as B, PaymentLinkUpdate as C, PlanLinkCreate as D, PlanFeaturesInput as E, RefundCreate as F, PaymentMethodField as G, WebhookEndpointUpdate as H, RetireInput as I, PublicPaymentLink as J, PaymentTestScenario as K, SubscriptionCancel as L, ProductLinkCreate as M, ProductUpdate as N, PlanPriceInput as O, QuantityInput as P, SubscriptionCreate as R, PaymentLinkCreate as S, PlanCreate as T, CheckoutPaymentMethod as U, WebhookEndpointCreate as V, PaymentInstructions as W, CustomerUpdate as _, CheckoutCreate as a, FeatureUpdate as b, ClientCheckoutUpdate as c, CouponCreate as d, CouponUpdate as f, CustomerSessionCreate as g, CustomerInput as h, AfterCompletionInput as i, ProductCreate as j, PlanUpdate as k, ClientLinkCheckout as l, CustomerCreate as m, RequestOptions as n, CheckoutItemInput as o, CustomFieldInput as p, PublicCheckout as q, TransportOptions as r, ClientCheckoutPay as s, BilleteError as t, CollectInput as u, EventSelector as v, PlanCheckoutCreate as w, KEY_PATTERN as x, FeatureCreate as y, SubscriptionUpdate as z };
|
|
450
|
-
//# sourceMappingURL=errors-oT7VMFhd.d.ts.map
|
|
449
|
+
export { ProductCheckoutCreate as A, VariantInput as B, PaymentLinkUpdate as C, PlanLinkCreate as D, PlanFeaturesInput as E, RefundCreate as F, PaymentMethodField as G, WebhookEndpointUpdate as H, RetireInput as I, PublicPaymentLink as J, PaymentTestScenario as K, SubscriptionCancel as L, ProductLinkCreate as M, ProductUpdate as N, PlanPriceInput as O, QuantityInput as P, SubscriptionCreate as R, PaymentLinkCreate as S, PlanCreate as T, CheckoutPaymentMethod as U, WebhookEndpointCreate as V, PaymentInstructions as W, CustomerUpdate as _, CheckoutCreate as a, FeatureUpdate as b, ClientCheckoutUpdate as c, CouponCreate as d, CouponUpdate as f, CustomerSessionCreate as g, CustomerInput as h, AfterCompletionInput as i, ProductCreate as j, PlanUpdate as k, ClientLinkCheckout as l, CustomerCreate as m, RequestOptions as n, CheckoutItemInput as o, CustomFieldInput as p, PublicCheckout as q, TransportOptions as r, ClientCheckoutPay as s, BilleteError as t, CollectInput as u, EventSelector as v, PlanCheckoutCreate as w, KEY_PATTERN as x, FeatureCreate as y, SubscriptionUpdate as z };
|
|
@@ -564,5 +564,4 @@ type WebhookEvent = { [TType in EventType]: {
|
|
|
564
564
|
data: EventDataMap[TType];
|
|
565
565
|
}; }[EventType];
|
|
566
566
|
//#endregion
|
|
567
|
-
export { Subscription as $, Payment as A, ENVIRONMENTS as At, Product as B, FEATURE_TYPES as C, MobilePrefix as Ct, FeatureUsageResult as D, isLandlinePhone as Dt, FeatureType as E, Timestamp as Et, PaymentStatus as F, RISK_LEVELS as G, ProductVariant as H, Payout as I, Retirement as J, Refund as K, Plan as L, PaymentFailure as M, TokenKind as Mt, PaymentLink as N, tokenEnvironment as Nt, PAYMENT_STATUSES as O, isMobilePhone as Ot, PaymentSettlement as P, tokenPrefix as Pt, SubmitLabel as Q, PlanFeatureValues as R, ExchangeRate as S, Metadata as St, FeatureReset as T, TaxBehavior as Tt, QuantitySettings as U, ProductCategory as V, RESET_FREQUENCIES as W, SUBMIT_LABELS as X, RiskLevel as Y, SUBSCRIPTION_STATUSES as Z, Customer as _, GRACE_PERIOD_DAYS as _t, Actor as a, API_ERROR_TYPES as at, CustomerSession as b, ListQuery as bt, BalanceAmount as c, ApiErrorType as ct, CheckoutItem as d, Address as dt, SubscriptionRenewal as et, CheckoutPurpose as f, AddressInput as ft, CustomField as g, Currency as gt, CurrencyAvailability as h, CURRENCIES as ht, WebhookEvent as i, Weekday as it, PaymentAttempt as j, Environment as jt, PRODUCT_CATEGORIES as k, nationalPhone as kt, CHECKOUT_PURPOSES as l, PAYMENT_FAILURE_CODES as lt, Coupon as m, BillingMonths as mt, EventDataMap as n, USAGE_FEATURE_TYPES as nt, AfterCompletion as o, ApiErrorBody as ot, CollectSettings as p, BILLING_MONTHS as pt, ResetFrequency as q, EventType as r, WebhookEndpoint as rt, Balance as s, ApiErrorEnvelope as st, EVENT_TYPES as t, SubscriptionStatus as tt, Checkout as u, PaymentFailureCode as ut, CustomerDetails as v, GracePeriodDays as vt, Feature as w, TAX_BEHAVIORS as wt, Event as x, MOBILE_PREFIXES as xt, CustomerFeature as y, List as yt, PlanPrice as z };
|
|
568
|
-
//# sourceMappingURL=events-BJuSt_4W.d.ts.map
|
|
567
|
+
export { Subscription as $, Payment as A, ENVIRONMENTS as At, Product as B, FEATURE_TYPES as C, MobilePrefix as Ct, FeatureUsageResult as D, isLandlinePhone as Dt, FeatureType as E, Timestamp as Et, PaymentStatus as F, RISK_LEVELS as G, ProductVariant as H, Payout as I, Retirement as J, Refund as K, Plan as L, PaymentFailure as M, TokenKind as Mt, PaymentLink as N, tokenEnvironment as Nt, PAYMENT_STATUSES as O, isMobilePhone as Ot, PaymentSettlement as P, tokenPrefix as Pt, SubmitLabel as Q, PlanFeatureValues as R, ExchangeRate as S, Metadata as St, FeatureReset as T, TaxBehavior as Tt, QuantitySettings as U, ProductCategory as V, RESET_FREQUENCIES as W, SUBMIT_LABELS as X, RiskLevel as Y, SUBSCRIPTION_STATUSES as Z, Customer as _, GRACE_PERIOD_DAYS as _t, Actor as a, API_ERROR_TYPES as at, CustomerSession as b, ListQuery as bt, BalanceAmount as c, ApiErrorType as ct, CheckoutItem as d, Address as dt, SubscriptionRenewal as et, CheckoutPurpose as f, AddressInput as ft, CustomField as g, Currency as gt, CurrencyAvailability as h, CURRENCIES as ht, WebhookEvent as i, Weekday as it, PaymentAttempt as j, Environment as jt, PRODUCT_CATEGORIES as k, nationalPhone as kt, CHECKOUT_PURPOSES as l, PAYMENT_FAILURE_CODES as lt, Coupon as m, BillingMonths as mt, EventDataMap as n, USAGE_FEATURE_TYPES as nt, AfterCompletion as o, ApiErrorBody as ot, CollectSettings as p, BILLING_MONTHS as pt, ResetFrequency as q, EventType as r, WebhookEndpoint as rt, Balance as s, ApiErrorEnvelope as st, EVENT_TYPES as t, SubscriptionStatus as tt, Checkout as u, PaymentFailureCode as ut, CustomerDetails as v, GracePeriodDays as vt, Feature as w, TAX_BEHAVIORS as wt, Event as x, MOBILE_PREFIXES as xt, CustomerFeature as y, List as yt, PlanPrice as z };
|
|
@@ -18,7 +18,7 @@ var BilleteError = class extends Error {
|
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/http.ts
|
|
21
|
-
const SDK_VERSION = "0.3.
|
|
21
|
+
const SDK_VERSION = "0.3.2";
|
|
22
22
|
const DEFAULT_BASE_URL = "https://api.billete.run";
|
|
23
23
|
const RETRYABLE_STATUS = /* @__PURE__ */ new Set([
|
|
24
24
|
429,
|
|
@@ -120,5 +120,3 @@ function segment(value) {
|
|
|
120
120
|
}
|
|
121
121
|
//#endregion
|
|
122
122
|
export { segment as n, BilleteError as r, createTransport as t };
|
|
123
|
-
|
|
124
|
-
//# sourceMappingURL=http-CG9YDQ6-.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -194,5 +194,4 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
194
194
|
/** The server client: what `createBillete` returns. */
|
|
195
195
|
type Billete = ReturnType<typeof createBillete>;
|
|
196
196
|
//#endregion
|
|
197
|
-
export { type API_ERROR_TYPES, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type BILLING_MONTHS, type Balance, type BalanceAmount, type Billete, BilleteError, type BilleteOptions, type BillingMonths, type CHECKOUT_PURPOSES, type CURRENCIES, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPaymentMethod, type CheckoutPurpose, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientLinkCheckout, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerSession, type CustomerSessionCreate, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type Feature, type FeatureCreate, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type GRACE_PERIOD_DAYS, type GracePeriodDays, type KEY_PATTERN, type List, type ListQuery, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanUpdate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicPaymentLink, type QuantityInput, type QuantitySettings, type RESET_FREQUENCIES, type RISK_LEVELS, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RetireInput, type Retirement, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SubmitLabel, type Subscription, type SubscriptionCancel, type SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, type SubscriptionUpdate, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type TransportOptions, type USAGE_FEATURE_TYPES, type VariantInput, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointUpdate, type WebhookEvent, WebhookVerificationError, type Weekday, type isLandlinePhone, type isMobilePhone, type nationalPhone, type tokenEnvironment, type tokenPrefix, verifyWebhook };
|
|
198
|
-
//# sourceMappingURL=index.d.ts.map
|
|
197
|
+
export { type API_ERROR_TYPES, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type BILLING_MONTHS, type Balance, type BalanceAmount, type Billete, BilleteError, type BilleteOptions, type BillingMonths, type CHECKOUT_PURPOSES, type CURRENCIES, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPaymentMethod, type CheckoutPurpose, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientLinkCheckout, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerSession, type CustomerSessionCreate, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type Feature, type FeatureCreate, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type GRACE_PERIOD_DAYS, type GracePeriodDays, type KEY_PATTERN, type List, type ListQuery, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanUpdate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicPaymentLink, type QuantityInput, type QuantitySettings, type RESET_FREQUENCIES, type RISK_LEVELS, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RetireInput, type Retirement, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SubmitLabel, type Subscription, type SubscriptionCancel, type SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, type SubscriptionUpdate, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type TransportOptions, type USAGE_FEATURE_TYPES, type VariantInput, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointUpdate, type WebhookEvent, WebhookVerificationError, type Weekday, type isLandlinePhone, type isMobilePhone, type nationalPhone, type tokenEnvironment, type tokenPrefix, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as segment, r as BilleteError, t as createTransport } from "./http-
|
|
1
|
+
import { n as segment, r as BilleteError, t as createTransport } from "./http-kkjWt1D4.js";
|
|
2
2
|
import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
|
|
3
3
|
//#region ../contracts/src/environment.ts
|
|
4
4
|
/**
|
|
@@ -269,5 +269,3 @@ verify: (payload, headers, secret) => verifyWebhook({
|
|
|
269
269
|
}
|
|
270
270
|
//#endregion
|
|
271
271
|
export { BilleteError, WebhookVerificationError, createBillete, verifyWebhook };
|
|
272
|
-
|
|
273
|
-
//# sourceMappingURL=index.js.map
|
package/dist/webhooks.d.ts
CHANGED
package/dist/webhooks.js
CHANGED
package/package.json
CHANGED
package/dist/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":[],"sources":["../src/create-client.ts"],"sourcesContent":["import type {\n CheckoutPaymentMethod,\n ClientCheckoutPay,\n ClientCheckoutUpdate,\n ClientLinkCheckout,\n CurrencyAvailability,\n Customer,\n CustomerFeature,\n ExchangeRate,\n List,\n PublicCheckout,\n PublicPaymentLink,\n Subscription,\n} from \"@boelabs/billete-contracts/public\";\n\nimport { createTransport, segment } from \"./http\";\nimport type { RequestOptions, TransportOptions } from \"./http\";\n\nexport interface ClientOptions extends TransportOptions {\n /**\n * Token from `billete.customerSessions.create()` on your server. Needed only for the\n * `customer` methods; paying checkouts works without it.\n */\n customerSession?: string | (() => string | undefined);\n}\n\n/**\n * Browser client. It never holds a secret key: checkouts are addressed by their unguessable ID\n * and customer data requires a short-lived customer session minted by your server.\n *\n * ```ts\n * const billete = createClient({ customerSession: token });\n * const [subscription] = (await billete.customer.subscriptions()).data;\n * if (subscription?.renewal?.status === \"overdue\") showBanner(subscription.renewal);\n * ```\n */\nexport function createClient(options: ClientOptions = {}) {\n const session = options.customerSession;\n const http = createTransport({\n ...options,\n token: typeof session === \"function\" ? session : () => session,\n });\n const checkoutPath = (id: string) => `/v1/client/checkouts/${segment(id)}`;\n\n return {\n checkouts: {\n retrieve: (id: string, options?: RequestOptions) =>\n http.request<PublicCheckout>({ method: \"GET\", path: checkoutPath(id), options }),\n /** Changes quantity, variant, billing cycle or coupon on a payment link checkout. */\n update: (id: string, changes: ClientCheckoutUpdate, options?: RequestOptions) =>\n http.request<PublicCheckout>({\n method: \"PATCH\",\n path: checkoutPath(id),\n body: changes,\n options,\n }),\n /** Methods that can pay this checkout, with the converted amount and transfer details. */\n paymentMethods: (id: string, options?: RequestOptions) =>\n http.request<List<CheckoutPaymentMethod>>({\n method: \"GET\",\n path: `${checkoutPath(id)}/payment-methods`,\n options,\n }),\n /** Submits the payment; the returned checkout carries the payment status and any failure. */\n pay: (id: string, input: ClientCheckoutPay, options?: RequestOptions) =>\n http.request<PublicCheckout>({\n method: \"POST\",\n path: `${checkoutPath(id)}/pay`,\n body: input,\n options,\n }),\n },\n paymentLinks: {\n retrieve: (id: string, options?: RequestOptions) =>\n http.request<PublicPaymentLink>({\n method: \"GET\",\n path: `/v1/client/links/${segment(id)}`,\n options,\n }),\n createCheckout: (id: string, selection: ClientLinkCheckout = {}, options?: RequestOptions) =>\n http.request<PublicCheckout>({\n method: \"POST\",\n path: `/v1/client/links/${segment(id)}/checkouts`,\n body: selection,\n options,\n }),\n },\n exchangeRates: {\n /** Current official BCV rates, to show prices in bolívares. */\n list: (options?: RequestOptions) =>\n http.request<List<ExchangeRate>>({\n method: \"GET\",\n path: \"/v1/client/exchange-rates\",\n options,\n }),\n },\n currencies: {\n list: (options?: RequestOptions) =>\n http.request<List<CurrencyAvailability>>({\n method: \"GET\",\n path: \"/v1/client/currencies\",\n options,\n }),\n },\n /** The customer behind the session token. */\n customer: {\n retrieve: (options?: RequestOptions) =>\n http.request<Customer>({ method: \"GET\", path: \"/v1/client/customer\", options }),\n /** Subscriptions with their `renewal` block: due date, grace period and payment link. */\n subscriptions: (options?: RequestOptions) =>\n http.request<List<Subscription>>({\n method: \"GET\",\n path: \"/v1/client/customer/subscriptions\",\n options,\n }),\n features: (options?: RequestOptions) =>\n http.request<List<CustomerFeature>>({\n method: \"GET\",\n path: \"/v1/client/customer/features\",\n options,\n }),\n feature: (key: string, options?: RequestOptions) =>\n http.request<CustomerFeature>({\n method: \"GET\",\n path: `/v1/client/customer/features/${segment(key)}`,\n options,\n }),\n },\n };\n}\n\nexport type BilleteClient = ReturnType<typeof createClient>;\n"],"mappings":";;;;;;;;;;;;AAoCA,SAAgB,aAAa,UAAyB,CAAC,GAAG;CACxD,MAAM,UAAU,QAAQ;CACxB,MAA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MAAM;IACN;GACF,CAAC;GACH,UAAU,KAAa,YACrB,KAAK,QAAyB;IAC5B,QAAQ;IACR,MAAM,gCAAgC,QAAQ,GAAG;IACjD;GACF,CAAC;EACL;CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-CG9YDQ6-.js","names":[],"sources":["../src/errors.ts","../src/http.ts"],"sourcesContent":["import type { ApiErrorBody, ApiErrorType } from \"@boelabs/billete-contracts/public\";\n\n/** Any failed Billete request. `type`/`code` are stable and safe to branch on. */\nexport class BilleteError extends Error {\n readonly type: ApiErrorType | \"network\";\n readonly code: string;\n readonly status: number;\n readonly param?: string;\n readonly requestId?: string;\n\n constructor(\n body: Omit<ApiErrorBody, \"type\"> & { type: ApiErrorType | \"network\" },\n status: number,\n ) {\n super(body.message);\n this.name = \"BilleteError\";\n this.type = body.type;\n this.code = body.code;\n this.status = status;\n this.param = body.param;\n this.requestId = body.requestId;\n }\n}\n","import type { ApiErrorEnvelope, List } from \"@boelabs/billete-contracts/public\";\n\nimport { BilleteError } from \"./errors\";\n\n/** Replaced at build time with the package version; the source (tests, workspace) reads \"dev\". */\ndeclare const PACKAGE_VERSION: string | undefined;\nexport const SDK_VERSION = typeof PACKAGE_VERSION === \"string\" ? PACKAGE_VERSION : \"dev\";\nconst DEFAULT_BASE_URL = \"https://api.billete.run\";\nconst RETRYABLE_STATUS = new Set([429, 500, 502, 503, 504]);\n\nexport interface TransportOptions {\n /** Defaults to `BILLETE_BASE_URL` on the server, then `https://api.billete.run`. Use\n * `http://localhost:9999` in development. */\n baseUrl?: string;\n /** Custom fetch (tests, proxies). Defaults to the global fetch. */\n fetch?: typeof globalThis.fetch;\n timeoutMs?: number;\n /** Retries for network errors, 429, 5xx and in-progress duplicates. Mutations retry safely. */\n maxRetries?: number;\n}\n\nexport interface RequestOptions {\n /** Reuse to make a mutation safe to retry; generated automatically when omitted. */\n idempotencyKey?: string;\n signal?: AbortSignal;\n}\n\n/** Query parameters; `undefined` values are omitted. */\ntype Query = object;\n\ninterface Request {\n method: \"GET\" | \"POST\" | \"PATCH\" | \"PUT\" | \"DELETE\";\n path: string;\n query?: Query;\n body?: unknown;\n options?: RequestOptions;\n}\n\nfunction backoff(attempt: number, retryAfter: string | null) {\n const seconds = retryAfter ? Number(retryAfter) : Number.NaN;\n return Number.isFinite(seconds) ? seconds * 1_000 : Math.min(500 * 2 ** attempt, 8_000);\n}\n\nfunction pause(ms: number, signal?: AbortSignal) {\n return new Promise<void>((resolve, reject) => {\n const timer = setTimeout(resolve, ms);\n signal?.addEventListener(\n \"abort\",\n () => {\n clearTimeout(timer);\n reject(signal.reason);\n },\n { once: true },\n );\n });\n}\n\nfunction buildUrl(baseUrl: string, path: string, query?: Query) {\n const url = new URL(path, baseUrl);\n Object.entries(query ?? {})\n .filter(([, value]) => value !== undefined)\n .forEach(([key, value]) => url.searchParams.set(key, String(value)));\n return url;\n}\n\n/** A concurrent request with the same idempotency key is still running: worth retrying. */\nasync function inProgress(response: Response) {\n const body = (await response\n .clone()\n .json()\n .catch(() => null)) as ApiErrorEnvelope | null;\n return body?.error.code === \"idempotency_request_in_progress\";\n}\n\nasync function toError(response: Response): Promise<BilleteError> {\n const body = (await response.json().catch(() => null)) as ApiErrorEnvelope | null;\n return new BilleteError(\n body?.error ?? {\n type: \"internal\",\n code: \"invalid_response\",\n message: `Unexpected HTTP ${response.status} from Billete`,\n requestId: response.headers.get(\"X-Request-Id\") ?? undefined,\n },\n response.status,\n );\n}\n\nexport type Transport = ReturnType<typeof createTransport>;\n\nexport function createTransport(options: TransportOptions & { token?: () => string | undefined }) {\n const baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n const fetchImpl =\n options.fetch ?? ((...args: Parameters<typeof fetch>) => globalThis.fetch(...args));\n const timeoutMs = options.timeoutMs ?? 30_000;\n const maxRetries = options.maxRetries ?? 2;\n\n async function send<T>(\n request: Request,\n idempotencyKey: string | undefined,\n attempt: number,\n ): Promise<T> {\n const token = options.token?.();\n const headers: Record<string, string> = {\n Accept: \"application/json\",\n \"X-Billete-Client\": `billete-js/${SDK_VERSION}`,\n ...(token ? { Authorization: `Bearer ${token}` } : {}),\n ...(request.body === undefined ? {} : { \"Content-Type\": \"application/json\" }),\n ...(idempotencyKey ? { \"Idempotency-Key\": idempotencyKey } : {}),\n };\n const signals = [AbortSignal.timeout(timeoutMs), request.options?.signal].filter(\n (signal): signal is AbortSignal => signal !== undefined,\n );\n const response = await fetchImpl(buildUrl(baseUrl, request.path, request.query), {\n method: request.method,\n headers,\n body: request.body === undefined ? undefined : JSON.stringify(request.body),\n signal: AbortSignal.any(signals),\n }).catch((error: unknown) => {\n if (request.options?.signal?.aborted) throw error;\n return error instanceof Error ? error : new Error(String(error));\n });\n\n const retryable =\n response instanceof Error ||\n RETRYABLE_STATUS.has(response.status) ||\n (response.status === 409 && (await inProgress(response)));\n if (retryable && attempt < maxRetries) {\n await pause(\n backoff(attempt, response instanceof Error ? null : response.headers.get(\"Retry-After\")),\n request.options?.signal,\n );\n return send(request, idempotencyKey, attempt + 1);\n }\n if (response instanceof Error) {\n throw new BilleteError(\n {\n type: \"network\",\n code: \"network_error\",\n message: `Could not reach Billete: ${response.message}`,\n },\n 0,\n );\n }\n if (!response.ok) throw await toError(response);\n return (response.status === 204 ? undefined : await response.json()) as T;\n }\n\n function request<T>(request: Request): Promise<T> {\n const idempotencyKey =\n request.method === \"GET\"\n ? undefined\n : (request.options?.idempotencyKey ?? globalThis.crypto.randomUUID());\n return send<T>(request, idempotencyKey, 0);\n }\n\n /** Walks every page of a list endpoint. */\n async function* paginate<T>(path: string, query: Query = {}): AsyncGenerator<T> {\n const page = await request<List<T>>({ method: \"GET\", path, query });\n yield* page.data;\n if (page.nextCursor) yield* paginate<T>(path, { ...query, cursor: page.nextCursor });\n }\n\n return { request, paginate };\n}\n\n/** Encodes a path segment (customer references may be merchant-defined external IDs). */\nexport function segment(value: string) {\n return encodeURIComponent(value);\n}\n"],"mappings":";;AAGA,IAAa,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U,YAAY;GACrC,MAAM,MACJ,QAAQ,SAAS,oBAAoB,QAAQ,OAAO,SAAS,QAAQ,IAAI,aAAa,CAAC,GACvF,QAAQ,SAAS,MACnB;GACA,OAAO,KAAK,SAAS,gBAAgB,UAAU,CAAC;EAClD;EACA,IAAI,oBAAoB,OACtB,MAAM,IAAI,aACR;GACE,MAAM;GACN,MAAM;GACN,SAAS,4BAA4B,SAAS;EAChD,GACA,CACF;EAEF,IAAI,CAAC,SAAS,IAAI,MAAM,MAAM,QAAQ,QAAQ;EAC9C,OAAQ,SAAS,WAAW,MAAM,KAAA,IAAY,MAAM,SAAS,KAAK;CACpE;CAEA,SAAS,QAAW,SAA8B;EAKhD,OAAO,KAAQ,SAHb,QAAQ,WAAW,QACf,KAAA,IACC,QAAQ,SAAS,kBAAkB,WAAW,OAAO,WAAW,GAC/B,CAAC;CAC3C;;CAGA,gBAAgB,SAAY,MAAc,QAAe,CAAC,GAAsB;EAC9E,MAAM,OAAO,MAAM,QAAiB;GAAE,QAAQ;GAAO;GAAM;EAAM,CAAC;EAClE,OAAO,KAAK;EACZ,IAAI,KAAK,YAAY,OAAO,SAAY,MAAM;GAAE,GAAG;GAAO,QAAQ,KAAK;EAAW,CAAC;CACrF;CAEA,OAAO;EAAE;EAAS;CAAS;AAC7B;;AAGA,SAAgB,QAAQ,OAAe;CACrC,OAAO,mBAAmB,KAAK;AACjC"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["runtime"],"sources":["../../contracts/src/environment.ts","../src/server.ts"],"sourcesContent":["/**\n * Environments and the credentials that name them. Kept free of runtime dependencies: the public\n * SDK bundles this module to check API keys.\n */\n\n/**\n * Where an account operates. `test` is always available and moves no money; `production`\n * charges for real. Every resource carries it, and secret keys name it: `sk_test_`, `sk_prod_`.\n */\nexport const ENVIRONMENTS = [\"test\", \"production\"] as const;\nexport type Environment = (typeof ENVIRONMENTS)[number];\n\n/** How tokens spell each environment: `sk_test_…`, `sk_prod_…`. */\nconst TOKEN_ENVIRONMENT_CODES = { test: \"test\", production: \"prod\" } as const satisfies Record<\n Environment,\n string\n>;\n\n/** Credentials that name their environment: secret keys and customer session tokens. */\nexport type TokenKind = \"sk\" | \"cst\";\n\n/** The prefix of a token for an environment, e.g. `sk_prod_`. */\nexport function tokenPrefix(kind: TokenKind, environment: Environment) {\n return `${kind}_${TOKEN_ENVIRONMENT_CODES[environment]}_`;\n}\n\n/**\n * The environment a token belongs to by its prefix, or `null` when it is not that kind of token.\n */\nexport function tokenEnvironment(kind: TokenKind, token: string): Environment | null {\n return (\n ENVIRONMENTS.find((environment) => token.startsWith(tokenPrefix(kind, environment))) ?? null\n );\n}\n","import { tokenEnvironment } from \"@boelabs/billete-contracts/environment\";\nimport type {\n Balance,\n Checkout,\n CheckoutCreate,\n Coupon,\n CouponCreate,\n CouponUpdate,\n CurrencyAvailability,\n Customer,\n CustomerCreate,\n CustomerFeature,\n CustomerSession,\n CustomerSessionCreate,\n CustomerUpdate,\n Environment,\n Event,\n EventType,\n ExchangeRate,\n Feature,\n FeatureCreate,\n FeatureUpdate,\n FeatureUsageResult,\n List,\n ListQuery,\n Payment,\n PaymentLink,\n PaymentLinkCreate,\n PaymentLinkUpdate,\n PaymentStatus,\n Payout,\n Plan,\n PlanCreate,\n PlanUpdate,\n Product,\n ProductCreate,\n ProductUpdate,\n RetireInput,\n Refund,\n RefundCreate,\n Subscription,\n SubscriptionCancel,\n SubscriptionCreate,\n SubscriptionStatus,\n SubscriptionUpdate,\n WebhookEndpoint,\n WebhookEndpointCreate,\n WebhookEndpointUpdate,\n WebhookEvent,\n} from \"@boelabs/billete-contracts/public\";\n\nimport { createTransport, segment } from \"./http\";\nimport type { RequestOptions, TransportOptions } from \"./http\";\nimport { verifyWebhook } from \"./webhooks\";\n\ntype Transport = ReturnType<typeof createTransport>;\ntype Filters<T> = ListQuery & T;\n\nfunction collection<TResource, TCreate, TUpdate, TFilters = object>(http: Transport, path: string) {\n return {\n create: (input: TCreate, options?: RequestOptions) =>\n http.request<TResource>({ method: \"POST\", path, body: input, options }),\n retrieve: (id: string, options?: RequestOptions) =>\n http.request<TResource>({ method: \"GET\", path: `${path}/${segment(id)}`, options }),\n update: (id: string, input: TUpdate, options?: RequestOptions) =>\n http.request<TResource>({\n method: \"PATCH\",\n path: `${path}/${segment(id)}`,\n body: input,\n options,\n }),\n list: (query: Filters<TFilters> = {} as Filters<TFilters>, options?: RequestOptions) =>\n http.request<List<TResource>>({ method: \"GET\", path, query, options }),\n /** Iterates every item across pages: `for await (const item of iterate())`. */\n iterate: (query: Filters<TFilters> = {} as Filters<TFilters>) =>\n http.paginate<TResource>(path, { ...query }),\n };\n}\n\nexport interface BilleteOptions extends TransportOptions {\n /**\n * Where this client operates: `test` or `production`. Required, and it must match the API key\n * (`sk_test_…` / `sk_prod_…`), so a key never runs in an environment it was not meant for.\n */\n environment: Environment;\n /** Defaults to the `BILLETE_API_KEY` environment variable. Never ship it to a browser. */\n apiKey?: string;\n /** API keys must never reach a browser. Set only for trusted desktop/server-like runtimes. */\n dangerouslyAllowBrowser?: boolean;\n}\n\nfunction fromEnv(name: string): string | undefined {\n const runtime = globalThis as { process?: { env?: Record<string, string | undefined> } };\n return runtime.process?.env?.[name];\n}\n\n/**\n * Server-side Billete client. Works in any runtime with `fetch` (Node, Bun, Deno, edge).\n *\n * ```ts\n * const billete = createBillete({ environment: \"test\" }); // reads BILLETE_API_KEY\n * const { allowed } = await billete.features.consume(\"user_123\", \"tokens\", 850);\n * ```\n */\nexport function createBillete(options: BilleteOptions) {\n const apiKey = options.apiKey ?? fromEnv(\"BILLETE_API_KEY\");\n if (!apiKey) {\n throw new TypeError(\"Billete needs an API key: pass apiKey or set BILLETE_API_KEY\");\n }\n const keyEnvironment = tokenEnvironment(\"sk\", apiKey);\n if (!keyEnvironment) {\n throw new TypeError(\"Billete expects an API key (sk_test_… or sk_prod_…)\");\n }\n if (keyEnvironment !== options.environment) {\n throw new TypeError(\n `This API key belongs to the ${keyEnvironment} environment, but environment is \"${options.environment}\"`,\n );\n }\n if (typeof window !== \"undefined\" && !options.dangerouslyAllowBrowser) {\n throw new Error(\n \"Never use an API key in the browser. Use createClient from @boelabs/billete-sdk/client instead.\",\n );\n }\n const http = createTransport({\n ...options,\n baseUrl: options.baseUrl ?? fromEnv(\"BILLETE_BASE_URL\"),\n token: () => apiKey,\n });\n\n const customers = collection<Customer, CustomerCreate, CustomerUpdate, { email?: string }>(\n http,\n \"/v1/customers\",\n );\n\n const customerSessions = {\n /** Short-lived token for the client SDK to read one customer's billing state. */\n create: (input: CustomerSessionCreate, options?: RequestOptions) =>\n http.request<CustomerSession>({\n method: \"POST\",\n path: \"/v1/customer-sessions\",\n body: input,\n options,\n }),\n };\n\n const products = {\n ...collection<Product, ProductCreate, ProductUpdate, { active?: boolean; retired?: boolean }>(\n http,\n \"/v1/products\",\n ),\n retire: (id: string, input: RetireInput = {}, options?: RequestOptions) =>\n http.request<Product>({\n method: \"POST\",\n path: `/v1/products/${segment(id)}/retire`,\n body: input,\n options,\n }),\n retireVariant: (\n product: string,\n variant: string,\n input: RetireInput = {},\n options?: RequestOptions,\n ) =>\n http.request<Product>({\n method: \"POST\",\n path: `/v1/products/${segment(product)}/variants/${segment(variant)}/retire`,\n body: input,\n options,\n }),\n };\n const plans = collection<Plan, PlanCreate, PlanUpdate, { active?: boolean }>(http, \"/v1/plans\");\n const coupons = collection<Coupon, CouponCreate, CouponUpdate>(http, \"/v1/coupons\");\n const paymentLinks = {\n ...collection<PaymentLink, PaymentLinkCreate, PaymentLinkUpdate, { retired?: boolean }>(\n http,\n \"/v1/payment-links\",\n ),\n retire: (id: string, input: RetireInput = {}, options?: RequestOptions) =>\n http.request<PaymentLink>({\n method: \"POST\",\n path: `/v1/payment-links/${segment(id)}/retire`,\n body: input,\n options,\n }),\n };\n\n const customerFeature = (customer: string, key: string) =>\n `/v1/customers/${segment(customer)}/features/${segment(key)}`;\n const featureCrud = collection<Feature, FeatureCreate, FeatureUpdate>(http, \"/v1/features\");\n const features = {\n ...featureCrud,\n /** Current access to one feature. `customer` is a `cus_…` ID or your own `externalId`. */\n check: (customer: string, key: string, options?: RequestOptions) =>\n http.request<CustomerFeature>({\n method: \"GET\",\n path: customerFeature(customer, key),\n options,\n }),\n /** `true` when the customer can use a boolean feature (or has a limit feature). */\n isEnabled: async (customer: string, key: string, options?: RequestOptions) =>\n (\n await http.request<CustomerFeature>({\n method: \"GET\",\n path: customerFeature(customer, key),\n options,\n })\n ).enabled,\n /** Every feature and its usage for one customer. */\n listForCustomer: (customer: string, options?: RequestOptions) =>\n http.request<List<CustomerFeature>>({\n method: \"GET\",\n path: `/v1/customers/${segment(customer)}/features`,\n options,\n }),\n /**\n * Atomically consumes `amount` units. When the limit would be exceeded nothing is consumed\n * and `allowed` is false, so it is safe to call right before doing the work.\n */\n consume: (customer: string, key: string, amount = 1, options?: RequestOptions) =>\n http.request<FeatureUsageResult>({\n method: \"POST\",\n path: `${customerFeature(customer, key)}/usage`,\n body: { delta: amount },\n options,\n }),\n /** Gives back `amount` units (e.g. a folder was deleted). Usage never drops below zero. */\n release: (customer: string, key: string, amount = 1, options?: RequestOptions) =>\n http.request<FeatureUsageResult>({\n method: \"POST\",\n path: `${customerFeature(customer, key)}/usage`,\n body: { delta: -amount },\n options,\n }),\n /** Reports the absolute current usage (e.g. the customer now has 7 folders). */\n set: (customer: string, key: string, value: number, options?: RequestOptions) =>\n http.request<CustomerFeature>({\n method: \"PUT\",\n path: `${customerFeature(customer, key)}/usage`,\n body: { value },\n options,\n }),\n };\n\n const checkoutCrud = collection<Checkout, CheckoutCreate, never>(http, \"/v1/checkouts\");\n const checkouts = {\n create: checkoutCrud.create,\n retrieve: checkoutCrud.retrieve,\n list: checkoutCrud.list,\n iterate: checkoutCrud.iterate,\n expire: (id: string, options?: RequestOptions) =>\n http.request<Checkout>({\n method: \"POST\",\n path: `/v1/checkouts/${segment(id)}/expire`,\n options,\n }),\n };\n\n const subscriptionCrud = collection<\n Subscription,\n SubscriptionCreate,\n SubscriptionUpdate,\n { customer?: string; plan?: string; status?: SubscriptionStatus }\n >(http, \"/v1/subscriptions\");\n const subscriptions = {\n ...subscriptionCrud,\n /** Cancels at period end by default; pass `{ atPeriodEnd: false }` to end it now. */\n cancel: (id: string, input: SubscriptionCancel = {}, options?: RequestOptions) =>\n http.request<Subscription>({\n method: \"POST\",\n path: `/v1/subscriptions/${segment(id)}/cancel`,\n body: input,\n options,\n }),\n resume: (id: string, options?: RequestOptions) =>\n http.request<Subscription>({\n method: \"POST\",\n path: `/v1/subscriptions/${segment(id)}/resume`,\n options,\n }),\n };\n\n const paymentCrud = collection<\n Payment,\n never,\n never,\n { customer?: string; status?: PaymentStatus }\n >(http, \"/v1/payments\");\n const payments = {\n retrieve: paymentCrud.retrieve,\n list: paymentCrud.list,\n iterate: paymentCrud.iterate,\n refund: (id: string, input: RefundCreate = {}, options?: RequestOptions) =>\n http.request<Refund>({\n method: \"POST\",\n path: `/v1/payments/${segment(id)}/refunds`,\n body: input,\n options,\n }),\n listRefunds: (id: string, options?: RequestOptions) =>\n http.request<List<Refund>>({\n method: \"GET\",\n path: `/v1/payments/${segment(id)}/refunds`,\n options,\n }),\n };\n\n const balance = {\n retrieve: (options?: RequestOptions) =>\n http.request<Balance>({ method: \"GET\", path: \"/v1/balance\", options }),\n };\n\n const payoutCrud = collection<Payout, never, never>(http, \"/v1/payouts\");\n const payouts = {\n retrieve: payoutCrud.retrieve,\n list: payoutCrud.list,\n iterate: payoutCrud.iterate,\n };\n\n const endpoints = collection<WebhookEndpoint, WebhookEndpointCreate, WebhookEndpointUpdate>(\n http,\n \"/v1/webhook-endpoints\",\n );\n const webhookEndpoints = {\n ...endpoints,\n delete: (id: string, options?: RequestOptions) =>\n http.request<void>({\n method: \"DELETE\",\n path: `/v1/webhook-endpoints/${segment(id)}`,\n options,\n }),\n };\n\n const eventCrud = collection<Event, never, never, { type?: EventType }>(http, \"/v1/events\");\n const events = { retrieve: eventCrud.retrieve, list: eventCrud.list, iterate: eventCrud.iterate };\n\n const exchangeRates = {\n /** Current official BCV rates (USD/VES, EUR/VES). */\n list: (options?: RequestOptions) =>\n http.request<List<ExchangeRate>>({ method: \"GET\", path: \"/v1/exchange-rates\", options }),\n };\n const currencies = {\n list: (options?: RequestOptions) =>\n http.request<List<CurrencyAvailability>>({\n method: \"GET\",\n path: \"/v1/currencies\",\n options,\n }),\n };\n\n const webhooks = {\n /**\n * Verifies a webhook (Standard Webhooks signature) and returns the typed event.\n * Pass the raw request body exactly as received.\n */\n verify: (\n payload: string,\n headers: Headers | Record<string, string | string[] | undefined>,\n secret: string,\n ): Promise<WebhookEvent> => verifyWebhook({ payload, headers, secret }),\n };\n\n return {\n customers,\n customerSessions,\n products,\n plans,\n features,\n coupons,\n checkouts,\n paymentLinks,\n subscriptions,\n payments,\n balance,\n payouts,\n webhookEndpoints,\n events,\n exchangeRates,\n currencies,\n webhooks,\n };\n}\n\n/** The server client: what `createBillete` returns. */\nexport type Billete = ReturnType<typeof createBillete>;\n"],"mappings":";;;;;;;;;;;AASA,MAAa,eAAe,CAAC,QAAQ,YAAY;;AAIjD,MAAM,0BAA0B;CAAE,MAAM;CAAQ,YAAY;AAAO;;AASnE,SAAgB,YAAY,MAAiB,aAA0B;CACrE,OAAO,GAAG,KAAK,GAAG,wBAAwB,aAAa;AACzD;;;;AAKA,SAAgB,iBAAiB,MAAiB,OAAmC;CACnF,OACE,aAAa,MAAM,gBAAgB,MAAM,WAAW,YAAY,MAAM,WAAW,CAAC,CAAC,KAAK;AAE5F;;;ACyBA,SAAS,WAA2D,MAAiB,MAAc;CACjG,OAAO;EACL,SAAS,OAAgB,YACvB,KAAK,QAAmB;GAAE,QAAQ;GAAQ;GAAM,MAAM;GAAO;EAAQ,CAAC;EACxE,WAAW,IAAY,YACrB,KAAK,QAAmB;GAAE,QAAQ;GAAO,MAAM,GAAG,KAAK,GAAG,QAAQ,EAAE;GAAK;EAAQ,CAAC;EACpF,S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AAS,WAAW;CACtB;CAMA,MAAM,mBAAmB;EACvB,GALgB,WAChB,MACA,uBAGW;EACX,SAAS,IAAY,YACnB,KAAK,QAAc;GACjB,QAAQ;GACR,MAAM,yBAAyB,QAAQ,EAAE;GACzC;EACF,CAAC;CACL;CAEA,MAAM,YAAY,WAAsD,MAAM,YAAY;CA6B1F,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAA;GA1Ce,UAAU,UAAU;GAAU,MAAM,UAAU;GAAM,SAAS,UAAU;EA0CjF;EACL,eAAA;;AAvCA,OAAO,YACL,KAAK,QAA4B;GAAE,QAAQ;GAAO,MAAM;GAAsB;EAAQ,CAAC,EAsC7E;EACZ,YAAA,EApCA,OAAO,YACL,KAAK,QAAoC;GACvC,QAAQ;GACR,MAAM;GACN;EACF,CAAC,EA+BM;EACT,UAAA;;;;;AAxBA,SACE,SACA,SACA,WAC0B,cAAc;GAAE;GAAS;GAAS;EAAO,CAAC,EAoB/D;CACT;AACF"}
|
package/dist/webhooks.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.js","names":[],"sources":["../src/webhooks.ts"],"sourcesContent":["import type { WebhookEvent } from \"@boelabs/billete-contracts/public\";\n\nexport class WebhookVerificationError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"WebhookVerificationError\";\n }\n}\n\ntype HeaderSource = Headers | Record<string, string | string[] | undefined>;\n\nfunction header(headers: HeaderSource, name: string): string | undefined {\n if (headers instanceof Headers) return headers.get(name) ?? undefined;\n const entry = Object.entries(headers).find(([key]) => key.toLowerCase() === name)?.[1];\n return Array.isArray(entry) ? entry[0] : entry;\n}\n\nfunction fromBase64(value: string): Uint8Array<ArrayBuffer> {\n return Uint8Array.from(atob(value), (char) => char.charCodeAt(0));\n}\n\nfunction toBase64(bytes: ArrayBuffer): string {\n return btoa(String.fromCharCode(...new Uint8Array(bytes)));\n}\n\nfunction constantTimeEqual(left: string, right: string): boolean {\n const length = Math.max(left.length, right.length);\n const mismatch = Array.from(\n { length },\n (_, index) => left.charCodeAt(index) ^ right.charCodeAt(index),\n ).reduce((accumulator, value) => accumulator | value, left.length ^ right.length);\n return mismatch === 0;\n}\n\n/**\n * Verifies a Billete webhook using the Standard Webhooks scheme with Web Crypto, so it runs in\n * Node, Bun, Deno, Cloudflare Workers and other edge runtimes.\n */\nexport async function verifyWebhook(input: {\n payload: string;\n headers: HeaderSource;\n secret: string;\n toleranceSeconds?: number;\n now?: Date;\n}): Promise<WebhookEvent> {\n const id = header(input.headers, \"webhook-id\");\n const timestamp = header(input.headers, \"webhook-timestamp\");\n const signatures = header(input.headers, \"webhook-signature\");\n if (!id || !timestamp || !signatures) {\n throw new WebhookVerificationError(\"Missing webhook headers\");\n }\n\n const nowSeconds = Math.floor((input.now ?? new Date()).getTime() / 1_000);\n const tolerance = input.toleranceSeconds ?? 300;\n if (!/^\\d+$/.test(timestamp) || Math.abs(nowSeconds - Number(timestamp)) > tolerance) {\n throw new WebhookVerificationError(\"Webhook timestamp is outside the tolerance window\");\n }\n\n const key = await globalThis.crypto.subtle.importKey(\n \"raw\",\n fromBase64(input.secret.replace(/^whsec_/, \"\")),\n { name: \"HMAC\", hash: \"SHA-256\" },\n false,\n [\"sign\"],\n );\n const expected = toBase64(\n await globalThis.crypto.subtle.sign(\n \"HMAC\",\n key,\n new TextEncoder().encode(`${id}.${timestamp}.${input.payload}`),\n ),\n );\n const valid = signatures\n .split(\" \")\n .some(\n (candidate) => candidate.startsWith(\"v1,\") && constantTimeEqual(candidate.slice(3), expected),\n );\n if (!valid) throw new WebhookVerificationError(\"Invalid webhook signature\");\n return JSON.parse(input.payload) as WebhookEvent;\n}\n"],"mappings":";AAEA,IAAa,2BAAb,cAA8C,MAAM;CAClD,YAAY,SAAiB;EAC3B,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF;AAIA,SAAS,OAAO,SAAuB,MAAkC;CACvE,IAAI,mBAA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