@voltro/plugin-billing 0.87.0 → 0.88.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/CHANGELOG.md +169 -6
- package/THIRD-PARTY-NOTICES.md +644 -48
- package/dist/catalog.js +1 -2
- package/dist/checkoutStore.js +1 -2
- package/dist/closeStore.js +1 -2
- package/dist/custodyInventory.js +1 -2
- package/dist/customerStore.js +1 -2
- package/dist/dunning.js +1 -2
- package/dist/economy.js +1 -2
- package/dist/entitlement.js +1 -2
- package/dist/eventDelivery.js +1 -2
- package/dist/flushClaim.js +1 -2
- package/dist/index.js +1 -2
- package/dist/invoiceHistory.js +1 -2
- package/dist/invoiceHistoryJournal.js +1 -2
- package/dist/invoiceHistoryProgress.js +1 -2
- package/dist/invoiceHistoryWork.js +1 -2
- package/dist/invoiceSnapshot.js +1 -2
- package/dist/invoiceStore.js +1 -2
- package/dist/metering.js +1 -2
- package/dist/plans.js +1 -2
- package/dist/providerIdentity.js +1 -2
- package/dist/providers.js +1 -2
- package/dist/provision.js +1 -2
- package/dist/rpc.js +1 -2
- package/dist/service.js +1 -2
- package/dist/stores.js +1 -2
- package/dist/stripeClient.js +1 -2
- package/dist/stripeIdentity.js +1 -2
- package/dist/stripeInvoiceHistory.js +1 -2
- package/dist/stripeInvoiceSnapshot.js +1 -2
- package/dist/stripeProvider.js +1 -2
- package/dist/stripeRest.js +1 -2
- package/dist/stripeVerifiedEvent.js +1 -2
- package/dist/table.js +1 -2
- package/dist/types.js +1 -2
- package/dist/usageEvents.js +1 -2
- package/dist/web/index.js +1 -2
- package/dist/webhook.js +1 -2
- package/package.json +10 -10
package/dist/catalog.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Stripe as e } from "./stripeClient.js";
|
|
2
2
|
import { STRIPE_WEBHOOK_EVENTS as t } from "./stripeProvider.js";
|
|
3
|
-
|
|
3
|
+
// src/catalog.ts
|
|
4
4
|
var n = e.API_VERSION, r = [
|
|
5
5
|
"Checkout → \"Limit customers to one subscription\" (with the customer portal login link enabled) — Stripe's own refusal of a second subscription",
|
|
6
6
|
"Smart Retries + failed-payment emails (Billing → Revenue recovery)",
|
|
@@ -467,5 +467,4 @@ var n = e.API_VERSION, r = [
|
|
|
467
467
|
});
|
|
468
468
|
return t;
|
|
469
469
|
};
|
|
470
|
-
//#endregion
|
|
471
470
|
export { n as STRIPE_API_VERSION, r as STRIPE_DASHBOARD_REMINDERS, d as diffMeter, g as diffPortal, u as diffPrice, s as diffProduct, f as diffTaxSettings, _ as diffWebhook, p as portalParams, v as sellingReadiness };
|
package/dist/checkoutStore.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BillingError as e } from "./types.js";
|
|
2
2
|
import { Effect as t } from "effect";
|
|
3
3
|
import { and as n, eq as r, id as i, integer as a, table as o, text as s, timestamp as c } from "@voltro/database";
|
|
4
|
-
|
|
4
|
+
// src/checkoutStore.ts
|
|
5
5
|
var l = "_voltro_billing_checkout_operations", u = o(l, {
|
|
6
6
|
id: i({ prefix: "bcheckout" }),
|
|
7
7
|
tenantId: s().maxLength(191),
|
|
@@ -161,5 +161,4 @@ var l = "_voltro_billing_checkout_operations", u = o(l, {
|
|
|
161
161
|
skip: void 0,
|
|
162
162
|
projection: void 0
|
|
163
163
|
});
|
|
164
|
-
//#endregion
|
|
165
164
|
export { l as BILLING_CHECKOUT_OPERATIONS_TABLE, u as billingCheckoutOperationsTable, f as dataStoreCheckoutOperationStore, d as memoryCheckoutOperationStore };
|
package/dist/closeStore.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BillingError as e } from "./types.js";
|
|
2
2
|
import { Effect as t } from "effect";
|
|
3
3
|
import { and as n, eq as r, id as i, integer as a, table as o, text as s, timestamp as c } from "@voltro/database";
|
|
4
|
-
|
|
4
|
+
// src/closeStore.ts
|
|
5
5
|
var l = "_voltro_billing_close_operations", u = o(l, {
|
|
6
6
|
id: i({ prefix: "bclose" }),
|
|
7
7
|
tenantId: s().maxLength(191),
|
|
@@ -121,5 +121,4 @@ var l = "_voltro_billing_close_operations", u = o(l, {
|
|
|
121
121
|
}, async (t) => {
|
|
122
122
|
await e.updateMany(l, { usageSealed: 1 }, { where: n(r("id", t.id), r("tenantId", t.tenantId), r("scope", "account"), r("usageSealed", 0)) });
|
|
123
123
|
});
|
|
124
|
-
//#endregion
|
|
125
124
|
export { l as BILLING_CLOSE_OPERATIONS_TABLE, u as billingCloseOperationsTable, _ as dataStoreBillingCloseStore, g as memoryBillingCloseStore };
|
package/dist/custodyInventory.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Effect as n } from "effect";
|
|
|
4
4
|
import { canonicalJson as r } from "@voltro/protocol";
|
|
5
5
|
import { and as i, eq as a, gt as o } from "@voltro/database";
|
|
6
6
|
import { createHash as s } from "node:crypto";
|
|
7
|
-
|
|
7
|
+
// src/custodyInventory.ts
|
|
8
8
|
var c = Object.freeze([
|
|
9
9
|
"_voltro_billing_customer_accounts",
|
|
10
10
|
"_voltro_billing_customer_custody",
|
|
@@ -151,5 +151,4 @@ var c = Object.freeze([
|
|
|
151
151
|
message: t,
|
|
152
152
|
transient: n
|
|
153
153
|
});
|
|
154
|
-
//#endregion
|
|
155
154
|
export { c as BILLING_CUSTODY_INVENTORY_TABLES, l as inspectBillingCustody };
|
package/dist/customerStore.js
CHANGED
|
@@ -3,7 +3,7 @@ import { captureProviderAccount as t, captureProviderCustomer as n, exactProvide
|
|
|
3
3
|
import { BILLING_CUSTODY_INVENTORY_TABLES as a } from "./custodyInventory.js";
|
|
4
4
|
import { Effect as o } from "effect";
|
|
5
5
|
import { and as s, eq as c, generateId as l, gt as u, id as d, integer as f, table as p, text as m, timestamp as h } from "@voltro/database";
|
|
6
|
-
|
|
6
|
+
// src/customerStore.ts
|
|
7
7
|
var g = "_voltro_billing_customer_accounts", _ = "_voltro_billing_customer_custody", v = p(g, {
|
|
8
8
|
id: d({ prefix: "bcacct" }),
|
|
9
9
|
tenantId: m().maxLength(191),
|
|
@@ -255,5 +255,4 @@ var g = "_voltro_billing_customer_accounts", _ = "_voltro_billing_customer_custo
|
|
|
255
255
|
return i === null && await t(r) === null && await a(r), i;
|
|
256
256
|
}
|
|
257
257
|
};
|
|
258
|
-
//#endregion
|
|
259
258
|
export { g as BILLING_CUSTOMER_ACCOUNTS_TABLE, _ as BILLING_CUSTOMER_CUSTODY_TABLE, v as billingCustomerAccountsTable, y as billingCustomerCustodyTable, I as dataStoreCustomerStore };
|
package/dist/dunning.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BillingError as e, DEFAULT_PLAN as t } from "./types.js";
|
|
2
2
|
import { Effect as n } from "effect";
|
|
3
3
|
import { and as r, eq as i, id as a, table as o, text as s, timestamp as c } from "@voltro/database";
|
|
4
|
-
|
|
4
|
+
// src/dunning.ts
|
|
5
5
|
var l = "_voltro_billing_dunning_notices", u = o(l, {
|
|
6
6
|
id: a({ prefix: "bdun" }),
|
|
7
7
|
tenantId: s().maxLength(191),
|
|
@@ -205,5 +205,4 @@ var l = "_voltro_billing_dunning_notices", u = o(l, {
|
|
|
205
205
|
})
|
|
206
206
|
})
|
|
207
207
|
});
|
|
208
|
-
//#endregion
|
|
209
208
|
export { l as BILLING_DUNNING_NOTICES_TABLE, f as DEFAULT_DUNNING_STEPS, p as DEFAULT_GRACE_HOURS, m as DEFAULT_LOCKOUT, d as DUNNING_LOCK_STEP_ID, u as billingDunningNoticesTable, O as dataStoreDunningNoticeStore, C as defaultDunningEmail, b as dueSteps, w as dunningMailNotifier, v as episodeKeyOf, x as evaluateBillingEntitlement, y as graceEndOf, E as memoryDunningNoticeStore, g as resolveDunningConfig };
|
package/dist/economy.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Effect as n } from "effect";
|
|
|
3
3
|
import { createHmac as r, timingSafeEqual as i } from "node:crypto";
|
|
4
4
|
import { EconomyError as a, economyError as o } from "@voltro/plugin-economy/errors";
|
|
5
5
|
import { iapCurrentStatePort as s, iapVerificationPort as c, issueVerifiedIapNotification as l } from "@voltro/plugin-economy/server";
|
|
6
|
-
|
|
6
|
+
// src/economy.ts
|
|
7
7
|
var u = /* @__PURE__ */ new Set([
|
|
8
8
|
"BIF",
|
|
9
9
|
"CLP",
|
|
@@ -262,5 +262,4 @@ var u = /* @__PURE__ */ new Set([
|
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
264
|
};
|
|
265
|
-
//#endregion
|
|
266
265
|
export { b as stripeIapWebProvider, v as stripeRenewalRequestId };
|
package/dist/entitlement.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BillingService as e, EntitlementExceeded as t, SubscriptionLocked as n } from "./types.js";
|
|
2
2
|
import { Effect as r } from "effect";
|
|
3
|
-
|
|
3
|
+
// src/entitlement.ts
|
|
4
4
|
var i = (e, t, n, r) => ({
|
|
5
5
|
allowed: !Number.isFinite(t) || r <= 0 || n + r <= t,
|
|
6
6
|
entitlement: e,
|
|
@@ -37,5 +37,4 @@ var i = (e, t, n, r) => ({
|
|
|
37
37
|
cost: s
|
|
38
38
|
})) : r.flatMap(n.consumeEntitlement(c, o.entitlement, s), () => i);
|
|
39
39
|
};
|
|
40
|
-
//#endregion
|
|
41
40
|
export { c as buildEnforceInterceptor, i as evaluateEntitlement, s as requireEntitled, o as requireEntitlement };
|
package/dist/eventDelivery.js
CHANGED
|
@@ -2,7 +2,7 @@ import { BillingError as e } from "./types.js";
|
|
|
2
2
|
import { captureProviderAccount as t, sameProviderAccount as n } from "./providerIdentity.js";
|
|
3
3
|
import { Effect as r, Schema as i } from "effect";
|
|
4
4
|
import { beginIdempotent as a, failIdempotent as o, finishIdempotent as s, holdIdempotentClaim as c, memoryIdempotencyStore as l, prepareIdempotentInput as u, systemSubject as d } from "@voltro/protocol";
|
|
5
|
-
|
|
5
|
+
// src/eventDelivery.ts
|
|
6
6
|
var f = 864e5, p = (t) => new e({
|
|
7
7
|
source: "billing.delivery",
|
|
8
8
|
message: t,
|
|
@@ -68,5 +68,4 @@ var f = 864e5, p = (t) => new e({
|
|
|
68
68
|
catch: (t) => t instanceof e ? t : p("Provider delivery processing failed and remains retryable.")
|
|
69
69
|
});
|
|
70
70
|
};
|
|
71
|
-
//#endregion
|
|
72
71
|
export { m as makeBillingEventDelivery };
|
package/dist/flushClaim.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { id as e, table as t, text as n, timestamp as r } from "@voltro/database";
|
|
2
|
-
|
|
2
|
+
// src/flushClaim.ts
|
|
3
3
|
var i = "_voltro_billing_flush_claims", a = t(i, {
|
|
4
4
|
id: e({ scheme: "numeric" }),
|
|
5
5
|
windowKey: n(),
|
|
@@ -16,5 +16,4 @@ var i = "_voltro_billing_flush_claims", a = t(i, {
|
|
|
16
16
|
return !0;
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
//#endregion
|
|
20
19
|
export { i as BILLING_FLUSH_CLAIMS_TABLE, a as billingFlushClaimsTable, s as claimFlushWindow, o as flushWindowKey };
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import { composeRpcInterceptors as At, definePlugin as jt, pluginInstanceName as
|
|
|
30
30
|
import { and as Pt, eq as Ft, registerRetention as X, retentionTtlMsFromEnv as Z } from "@voltro/database";
|
|
31
31
|
import { replicaId as It } from "@voltro/protocol/identity";
|
|
32
32
|
import { dataStoreIdempotencyStore as Lt } from "@voltro/runtime";
|
|
33
|
-
|
|
33
|
+
// src/index.ts
|
|
34
34
|
var Q = (e) => e === null ? null : {
|
|
35
35
|
plan: e.plan,
|
|
36
36
|
status: e.status,
|
|
@@ -452,5 +452,4 @@ var Q = (e) => e === null ? null : {
|
|
|
452
452
|
})
|
|
453
453
|
});
|
|
454
454
|
};
|
|
455
|
-
//#endregion
|
|
456
455
|
export { D as BILLING_CHECKOUT_OPERATIONS_TABLE, j as BILLING_CLOSE_OPERATIONS_TABLE, o as BILLING_CUSTODY_INVENTORY_TABLES, _e as BILLING_CUSTOMERS_TABLE, c as BILLING_CUSTOMER_ACCOUNTS_TABLE, l as BILLING_CUSTOMER_CUSTODY_TABLE, le as BILLING_DUNNING_NOTICES_TABLE, Fe as BILLING_FLUSH_CLAIMS_TABLE, ve as BILLING_INVOICES_TABLE, ce as BILLING_INVOICE_HISTORY_DISPATCH_TABLE, p as BILLING_INVOICE_HISTORY_PAGES_TABLE, m as BILLING_INVOICE_HISTORY_REFERENCES_TABLE, x as BILLING_INVOICE_HISTORY_SCAN_ACCOUNTS_TABLE, h as BILLING_INVOICE_HISTORY_WALKS_TABLE, oe as BILLING_INVOICE_HISTORY_WORK_TABLE, re as BILLING_INVOICE_OBSERVATIONS_TABLE, H as BILLING_SUBSCRIPTIONS_TABLE, T as BILLING_USAGE_EVENTS_TABLE, U as BILLING_USAGE_TABLE, st as BILLING_WEBHOOK_ID, q as BILLING_WEBHOOK_PATH, e as BillingError, t as BillingService, F as DEFAULT_DUNNING_STEPS, I as DEFAULT_GRACE_HOURS, L as DEFAULT_LOCKOUT, n as DEFAULT_PLAN, R as DUNNING_LOCK_STEP_ID, r as EntitlementExceeded, ze as STRIPE_API_VERSION, Be as STRIPE_DASHBOARD_REMINDERS, $e as STRIPE_WEBHOOK_EVENTS, Ye as StripeRestError, i as SubscriptionLocked, nt as assertBillingProductionReady, O as billingCheckoutOperationsTable, M as billingCloseOperationsTable, u as billingCustomerAccountsTable, ee as billingCustomerCustodyTable, ye as billingCustomersTable, z as billingDunningNoticesTable, rt as billingEgressOf, Ie as billingFlushClaimsTable, S as billingInvoiceHistoryDispatchTable, g as billingInvoiceHistoryPagesTable, _ as billingInvoiceHistoryReferencesTable, C as billingInvoiceHistoryScanAccountsTable, v as billingInvoiceHistoryWalksTable, se as billingInvoiceHistoryWorkTable, ie as billingInvoiceObservationsTable, be as billingInvoicesTable, zt as billingPlugin, ae as billingRetainedInvoiceObservationsTable, K as billingServiceLayer, xe as billingSubscriptionsTable, W as billingTables, E as billingUsageEventsTable, Se as billingUsageTable, ct as billingWebhookDescriptor, Ee as buildBillingService, te as buildEnforceInterceptor, Ne as buildPlanRegistry, Le as claimFlushWindow, N as dataStoreBillingCloseStore, k as dataStoreCheckoutOperationStore, B as dataStoreDunningNoticeStore, y as dataStoreInvoiceHistoryJournal, w as dataStoreInvoiceHistoryProgressStore, b as dataStoreInvoiceHistoryWorkStore, G as dataStoreStores, ue as defaultDunningEmail, Ve as diffMeter, He as diffPortal, Ue as diffPrice, We as diffProduct, Ge as diffTaxSettings, Ke as diffWebhook, de as dueSteps, fe as dunningMailNotifier, Pe as emptyPlanRegistry, St as envOutRefusal, pe as episodeKeyOf, me as evaluateBillingEntitlement, d as evaluateEntitlement, Re as flushWindowKey, Xe as formEncode, he as graceEndOf, s as inspectBillingCustody, it as isProductionBoot, Ce as isStaleStatusEvent, P as memoryBillingCloseStore, A as memoryCheckoutOperationStore, ge as memoryDunningNoticeStore, we as memoryStores, Ct as mergeEnvFile, at as mockProvider, lt as mountBillingWebhook, et as normalizeStripeEvent, wt as openFindings, Tt as parseProvisionArgs, De as periodKey, qe as portalParams, Et as provisionStripeCatalog, Ze as redactStripeKeys, f as requireEntitled, ne as requireEntitlement, V as resolveDunningConfig, ot as resolveProvider, Dt as resolveProvisionKey, Ot as runStripeProvision, Te as selectCurrentSubscription, Je as sellingReadiness, tt as stripeProvider, Qe as stripeRest };
|
package/dist/invoiceHistory.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BillingError as e } from "./types.js";
|
|
2
2
|
import { captureProviderAccount as t, exactProviderIdentifier as n, sameProviderAccount as r } from "./providerIdentity.js";
|
|
3
|
-
|
|
3
|
+
// src/invoiceHistory.ts
|
|
4
4
|
var i = (e) => n(e) && e.length <= 191 && e.isWellFormed(), a = (e) => {
|
|
5
5
|
let n = t(e.account), a = e.providerCustomerId, o = e.limit ?? 100;
|
|
6
6
|
if (!i(n.providerAccountId) || !i(a) || !Number.isSafeInteger(o) || o < 1 || o > 100) throw u();
|
|
@@ -87,5 +87,4 @@ var i = (e) => n(e) && e.length <= 191 && e.isWellFormed(), a = (e) => {
|
|
|
87
87
|
message: t,
|
|
88
88
|
transient: n
|
|
89
89
|
});
|
|
90
|
-
//#endregion
|
|
91
90
|
export { a as captureInvoiceHistoryInput, o as captureInvoiceHistoryPage, u as historyError, s as invoiceHistoryPreview };
|
|
@@ -4,7 +4,7 @@ import { dataStoreCustomerStore as i } from "./customerStore.js";
|
|
|
4
4
|
import { captureInvoiceHistoryInput as a, captureInvoiceHistoryPage as o, historyError as s } from "./invoiceHistory.js";
|
|
5
5
|
import { Effect as c } from "effect";
|
|
6
6
|
import { and as l, count as u, eq as d, gt as f, id as p, inSet as m, integer as h, lt as g, lte as _, neq as v, or as y, sum as b, table as x, text as S, timestamp as C } from "@voltro/database";
|
|
7
|
-
|
|
7
|
+
// src/invoiceHistoryJournal.ts
|
|
8
8
|
var w = "_voltro_billing_invoice_history_walks", T = "_voltro_billing_invoice_history_pages", E = "_voltro_billing_invoice_history_references", D = () => ({
|
|
9
9
|
tenantId: S().maxLength(191),
|
|
10
10
|
provider: S().maxLength(64),
|
|
@@ -472,5 +472,4 @@ var w = "_voltro_billing_invoice_history_walks", T = "_voltro_billing_invoice_hi
|
|
|
472
472
|
})
|
|
473
473
|
};
|
|
474
474
|
}, J = (e) => q((t) => e.transactional(t)), Y = (e) => q((t) => t(e));
|
|
475
|
-
//#endregion
|
|
476
475
|
export { T as BILLING_INVOICE_HISTORY_PAGES_TABLE, E as BILLING_INVOICE_HISTORY_REFERENCES_TABLE, w as BILLING_INVOICE_HISTORY_WALKS_TABLE, k as billingInvoiceHistoryPagesTable, A as billingInvoiceHistoryReferencesTable, O as billingInvoiceHistoryWalksTable, J as dataStoreInvoiceHistoryJournal, Y as invoiceHistoryJournalInTransaction };
|
|
@@ -5,7 +5,7 @@ import { invoiceHistoryJournalInTransaction as o } from "./invoiceHistoryJournal
|
|
|
5
5
|
import { BILLING_INVOICE_HISTORY_WORK_TABLE as s } from "./invoiceHistoryWork.js";
|
|
6
6
|
import { Effect as c } from "effect";
|
|
7
7
|
import { and as l, eq as u, generateId as d, id as f, integer as p, table as m, text as h, timestamp as g } from "@voltro/database";
|
|
8
|
-
|
|
8
|
+
// src/invoiceHistoryProgress.ts
|
|
9
9
|
var _ = "_voltro_billing_invoice_history_scan_accounts", v = "_voltro_billing_invoice_history_dispatch", y = () => ({
|
|
10
10
|
provider: h().maxLength(64),
|
|
11
11
|
providerAccountId: h().maxLength(191),
|
|
@@ -231,5 +231,4 @@ var _ = "_voltro_billing_invoice_history_scan_accounts", v = "_voltro_billing_in
|
|
|
231
231
|
})
|
|
232
232
|
};
|
|
233
233
|
};
|
|
234
|
-
//#endregion
|
|
235
234
|
export { v as BILLING_INVOICE_HISTORY_DISPATCH_TABLE, _ as BILLING_INVOICE_HISTORY_SCAN_ACCOUNTS_TABLE, x as billingInvoiceHistoryDispatchTable, b as billingInvoiceHistoryScanAccountsTable, F as dataStoreInvoiceHistoryProgressStore };
|
|
@@ -6,7 +6,7 @@ import { Effect as s, Schema as c } from "effect";
|
|
|
6
6
|
import { DEFAULT_IN_FLIGHT_LEASE_MS as l, beginIdempotent as u, finishIdempotent as d, holdIdempotentClaim as f, prepareIdempotentInput as p, systemSubject as m } from "@voltro/protocol";
|
|
7
7
|
import { and as h, eq as g, gt as _, id as v, inSet as y, integer as b, lte as x, notInSubquery as S, table as C, text as w, timestamp as T } from "@voltro/database";
|
|
8
8
|
import { dataStoreIdempotencyStore as E } from "@voltro/runtime";
|
|
9
|
-
|
|
9
|
+
// src/invoiceHistoryWork.ts
|
|
10
10
|
var D = "_voltro_billing_invoice_history_work", O = C(D, {
|
|
11
11
|
id: v({ prefix: "bihwork" }),
|
|
12
12
|
tenantId: w().maxLength(191),
|
|
@@ -359,5 +359,4 @@ var D = "_voltro_billing_invoice_history_work", O = C(D, {
|
|
|
359
359
|
}
|
|
360
360
|
};
|
|
361
361
|
};
|
|
362
|
-
//#endregion
|
|
363
362
|
export { D as BILLING_INVOICE_HISTORY_WORK_TABLE, O as billingInvoiceHistoryWorkTable, q as dataStoreInvoiceHistoryWorkStore };
|
package/dist/invoiceSnapshot.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BillingError as e } from "./types.js";
|
|
2
2
|
import { Schema as t } from "effect";
|
|
3
|
-
|
|
3
|
+
// src/invoiceSnapshot.ts
|
|
4
4
|
var n = (t, n = !1) => new e({
|
|
5
5
|
source: "invoiceSnapshot",
|
|
6
6
|
message: t,
|
|
@@ -62,5 +62,4 @@ var n = (t, n = !1) => new e({
|
|
|
62
62
|
t.add(o.providerLineId);
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
-
//#endregion
|
|
66
65
|
export { d as assertInvoiceSnapshot, u as decodeInvoiceSnapshot, l as encodeInvoiceSnapshot, n as invoiceSnapshotError };
|
package/dist/invoiceStore.js
CHANGED
|
@@ -2,7 +2,7 @@ import { BillingError as e } from "./types.js";
|
|
|
2
2
|
import { decodeInvoiceSnapshot as t, encodeInvoiceSnapshot as n, invoiceSnapshotError as r } from "./invoiceSnapshot.js";
|
|
3
3
|
import { Effect as i } from "effect";
|
|
4
4
|
import { and as a, eq as o, id as s, integer as c, json as l, table as u, text as d, timestamp as f } from "@voltro/database";
|
|
5
|
-
|
|
5
|
+
// src/invoiceStore.ts
|
|
6
6
|
var p = "_voltro_billing_account_invoices", m = u("_voltro_billing_invoice_observations", {
|
|
7
7
|
id: s({ prefix: "binvobs" }),
|
|
8
8
|
tenantId: d(),
|
|
@@ -129,5 +129,4 @@ var p = "_voltro_billing_account_invoices", m = u("_voltro_billing_invoice_obser
|
|
|
129
129
|
})
|
|
130
130
|
};
|
|
131
131
|
};
|
|
132
|
-
//#endregion
|
|
133
132
|
export { p as BILLING_INVOICE_OBSERVATIONS_TABLE, h as billingInvoiceObservationsTable, m as billingRetainedInvoiceObservationsTable, E as dataStoreInvoiceStore };
|
package/dist/metering.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { periodKey as e } from "./service.js";
|
|
2
2
|
import { Effect as t } from "effect";
|
|
3
3
|
import { OccurrenceCounter as n, changeDigest as r, composeChangeKey as i, gte as a, occurrenceWindowMs as o } from "@voltro/database";
|
|
4
|
-
|
|
4
|
+
// src/metering.ts
|
|
5
5
|
var s = "_voltro_ai_usage", c = (e) => {
|
|
6
6
|
for (let [t, n] of Object.entries(e)) {
|
|
7
7
|
if (t.length === 0) throw Error("billing metering: a meter key must be non-empty");
|
|
@@ -70,5 +70,4 @@ var s = "_voltro_ai_usage", c = (e) => {
|
|
|
70
70
|
s > 0 && (yield* n.reportUsage(i, e, s).pipe(t.catch(() => t.void)));
|
|
71
71
|
}
|
|
72
72
|
}), C = (e, n, r, i) => S(e, n, r, i).pipe(t.andThen(e.flushUsage().pipe(t.catch(() => t.void)))), w = (e) => Object.values(e).some((e) => e.from === "cdc");
|
|
73
|
-
//#endregion
|
|
74
73
|
export { v as METERING_CLAIM_SCOPE, b as buildMeteringChangeTap, _ as buildMeteringInterceptor, p as cdcMetersFor, w as hasCdcMeters, S as reconcileAiMeters, f as rpcMetersFor, C as runAutopilotFlush, c as validateMeteringConfig };
|
package/dist/plans.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_PLAN as e } from "./types.js";
|
|
2
|
-
|
|
2
|
+
// src/plans.ts
|
|
3
3
|
var t = (e) => e === void 0 ? 0 : e === "unlimited" ? Infinity : e, n = (e) => {
|
|
4
4
|
let n = /* @__PURE__ */ new Map();
|
|
5
5
|
for (let [t, r] of Object.entries(e)) r.priceId !== void 0 && n.set(r.priceId, t);
|
|
@@ -20,5 +20,4 @@ var t = (e) => e === void 0 ? 0 : e === "unlimited" ? Infinity : e, n = (e) => {
|
|
|
20
20
|
planIds: () => Object.keys(e)
|
|
21
21
|
};
|
|
22
22
|
}, r = () => n({ [e]: { entitlements: {} } });
|
|
23
|
-
//#endregion
|
|
24
23
|
export { n as buildPlanRegistry, r as emptyPlanRegistry };
|
package/dist/providerIdentity.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BillingError as e } from "./types.js";
|
|
2
|
-
|
|
2
|
+
// src/providerIdentity.ts
|
|
3
3
|
var t = () => new e({
|
|
4
4
|
source: "providerIdentity",
|
|
5
5
|
message: "The provider account or customer observation could not be confirmed.",
|
|
@@ -20,5 +20,4 @@ var t = () => new e({
|
|
|
20
20
|
observedAt: new Date(e.observedAt)
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
-
//#endregion
|
|
24
23
|
export { r as captureProviderAccount, a as captureProviderCustomer, n as exactProviderIdentifier, t as providerIdentityError, i as sameProviderAccount };
|
package/dist/providers.js
CHANGED
|
@@ -4,7 +4,7 @@ import { decodeInvoiceSnapshot as a, encodeInvoiceSnapshot as o, invoiceSnapshot
|
|
|
4
4
|
import { captureInvoiceHistoryInput as c, captureInvoiceHistoryPage as l, historyError as u, invoiceHistoryPreview as d } from "./invoiceHistory.js";
|
|
5
5
|
import { STRIPE_WEBHOOK_EVENTS as f, normalizeStripeEvent as p, stripeProvider as m } from "./stripeProvider.js";
|
|
6
6
|
import { Effect as h } from "effect";
|
|
7
|
-
|
|
7
|
+
// src/providers.ts
|
|
8
8
|
var g = (f) => {
|
|
9
9
|
let p = t({
|
|
10
10
|
providerAccountId: f?.accountId ?? "mock_" + globalThis.crypto.randomUUID(),
|
|
@@ -334,5 +334,4 @@ var g = (f) => {
|
|
|
334
334
|
data: ["personal", "metadata"],
|
|
335
335
|
disable: "without STRIPE_SECRET_KEY the mock provider answers, and nothing leaves (production refuses to boot on it)"
|
|
336
336
|
}];
|
|
337
|
-
//#endregion
|
|
338
337
|
export { f as STRIPE_WEBHOOK_EVENTS, y as assertBillingProductionReady, x as billingEgressOf, v as isProductionBoot, g as mockProvider, p as normalizeStripeEvent, b as resolveProvider, m as stripeProvider };
|
package/dist/provision.js
CHANGED
|
@@ -3,7 +3,7 @@ import { redactStripeKeys as s, stripeRest as c } from "./stripeRest.js";
|
|
|
3
3
|
import { execFileSync as l } from "node:child_process";
|
|
4
4
|
import { chmodSync as u, existsSync as d, readFileSync as f, realpathSync as p, writeFileSync as m } from "node:fs";
|
|
5
5
|
import { dirname as h, resolve as g } from "node:path";
|
|
6
|
-
|
|
6
|
+
// src/provision.ts
|
|
7
7
|
var _ = (e) => e.filter((e) => e.applied !== !0 && (e.kind === "create" || e.kind === "update" || e.kind === "adopt" || e.kind === "drift")), v = async (s, c, l) => {
|
|
8
8
|
let u = c.environments[l.env], d = await s.get("/v1/tax/settings"), f = l.env === "live";
|
|
9
9
|
if (d.livemode !== f) throw Error(`the key reaches a ${d.livemode ? "LIVE" : "test"} account, not ${l.env}`);
|
|
@@ -149,5 +149,4 @@ var _ = (e) => e.filter((e) => e.applied !== !0 && (e.kind === "create" || e.kin
|
|
|
149
149
|
let p = _(l.findings), h = l.findings.filter((e) => e.kind === "manual");
|
|
150
150
|
return console.log(` ${p.length} open, ${h.length} manual`), p.length > 0 || a.strict && h.length > 0 ? 1 : 0;
|
|
151
151
|
};
|
|
152
|
-
//#endregion
|
|
153
152
|
export { x as envOutRefusal, y as mergeEnvFile, _ as openFindings, S as parseProvisionArgs, v as provisionStripeCatalog, C as resolveProvisionKey, T as runStripeProvision };
|
package/dist/rpc.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BillingError as e } from "./types.js";
|
|
2
2
|
import { Schema as t } from "effect";
|
|
3
3
|
import { defineAction as n, defineQuery as r } from "@voltro/protocol";
|
|
4
|
-
|
|
4
|
+
// src/rpc.ts
|
|
5
5
|
var i = n({
|
|
6
6
|
name: "billing.startCheckout",
|
|
7
7
|
input: t.Struct({
|
|
@@ -211,5 +211,4 @@ var i = n({
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
];
|
|
214
|
-
//#endregion
|
|
215
214
|
export { v as billingRpcClientImports, h as cancelSubscriptionDescriptor, p as changePlanDescriptor, m as changeSeatsDescriptor, c as entitlementStatusDescriptor, f as invoicesDescriptor, a as portalUrlDescriptor, d as previewChangeDescriptor, l as reportUsageDescriptor, _ as resumeSubscriptionDescriptor, i as startCheckoutDescriptor, s as subscriptionDescriptor, g as syncDescriptor };
|
package/dist/service.js
CHANGED
|
@@ -7,7 +7,7 @@ import { DUNNING_LOCK_STEP_ID as d, defaultDunningEmail as f, dueSteps as p, epi
|
|
|
7
7
|
import { isLive as _, memoryStores as v } from "./stores.js";
|
|
8
8
|
import { Effect as y, Layer as b, Schedule as x } from "effect";
|
|
9
9
|
import { createLogger as S } from "@voltro/logger";
|
|
10
|
-
|
|
10
|
+
// src/service.ts
|
|
11
11
|
var C = S({ scope: "@voltro/plugin-billing" }), w = 3, T = /* @__PURE__ */ new Set([
|
|
12
12
|
"active",
|
|
13
13
|
"trialing",
|
|
@@ -1112,5 +1112,4 @@ var C = S({ scope: "@voltro/plugin-billing" }), w = 3, T = /* @__PURE__ */ new S
|
|
|
1112
1112
|
holder: N
|
|
1113
1113
|
};
|
|
1114
1114
|
}, j = (e) => b.succeed(t, e);
|
|
1115
|
-
//#endregion
|
|
1116
1115
|
export { k as USAGE_KEY, te as USAGE_KEY_RULE, j as billingServiceLayer, A as buildBillingService, ee as makeStoreHolder, D as periodKey };
|
package/dist/stores.js
CHANGED
|
@@ -13,7 +13,7 @@ import { Effect as p } from "effect";
|
|
|
13
13
|
import { _voltroIdempotencyTable as m, and as h, ensureTableRegistered as g, eq as _ } from "@voltro/database";
|
|
14
14
|
import { InMemoryDataStore as v } from "@voltro/runtime";
|
|
15
15
|
import { createLogger as y } from "@voltro/logger";
|
|
16
|
-
|
|
16
|
+
// src/stores.ts
|
|
17
17
|
var b = (e) => `${e}_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`, x = y({ scope: "@voltro/plugin-billing" }), S = (t, n) => p.tryPromise({
|
|
18
18
|
try: t,
|
|
19
19
|
catch: (t) => (x.warn("billing store operation failed", {
|
|
@@ -256,5 +256,4 @@ var b = (e) => `${e}_${Math.random().toString(36).slice(2)}${Date.now().toString
|
|
|
256
256
|
usage: F(e),
|
|
257
257
|
dunningNotices: l(e)
|
|
258
258
|
});
|
|
259
|
-
//#endregion
|
|
260
259
|
export { L as dataStoreStores, M as dataStoreSubscriptionStore, F as dataStoreUsageStore, E as isLive, O as isStaleStatusEvent, w as isTerminal, I as memoryStores, D as selectCurrentSubscription };
|
package/dist/stripeClient.js
CHANGED
|
@@ -3,7 +3,7 @@ import { redactStripeKeys as t } from "./stripeRest.js";
|
|
|
3
3
|
import { Effect as n } from "effect";
|
|
4
4
|
import { createLogger as r } from "@voltro/logger";
|
|
5
5
|
import i from "stripe";
|
|
6
|
-
|
|
6
|
+
// src/stripeClient.ts
|
|
7
7
|
var a = r({ scope: "@voltro/plugin-billing" }), o = 3, s = 2e4, c = (e) => e.client ?? new i(e.apiKey, {
|
|
8
8
|
maxNetworkRetries: o,
|
|
9
9
|
timeout: s,
|
|
@@ -49,5 +49,4 @@ var a = r({ scope: "@voltro/plugin-billing" }), o = 3, s = 2e4, c = (e) => e.cli
|
|
|
49
49
|
let n = t.reduce((e, t) => e + (t.quantity ?? 0), 0);
|
|
50
50
|
return n > 0 ? n : 1;
|
|
51
51
|
};
|
|
52
|
-
//#endregion
|
|
53
52
|
export { i as Stripe, c as makeStripeClient, m as periodOf, g as quantityOf, d as stripeCall, h as unixToDate };
|
package/dist/stripeIdentity.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { captureProviderAccount as e, captureProviderCustomer as t, exactProviderIdentifier as n, providerIdentityError as r, sameProviderAccount as i } from "./providerIdentity.js";
|
|
2
2
|
import { stripeCall as a } from "./stripeClient.js";
|
|
3
3
|
import { Effect as o } from "effect";
|
|
4
|
-
|
|
4
|
+
// src/stripeIdentity.ts
|
|
5
5
|
var s = (e) => o.try({
|
|
6
6
|
try: e,
|
|
7
7
|
catch: () => r()
|
|
@@ -52,5 +52,4 @@ var s = (e) => o.try({
|
|
|
52
52
|
});
|
|
53
53
|
});
|
|
54
54
|
};
|
|
55
|
-
//#endregion
|
|
56
55
|
export { c as stripeAccountIdentity, l as stripeCustomerSnapshot };
|
|
@@ -4,7 +4,7 @@ import { captureInvoiceHistoryInput as n, captureInvoiceHistoryPage as r, histor
|
|
|
4
4
|
import { stripeCall as a } from "./stripeClient.js";
|
|
5
5
|
import { stripeAccountIdentity as o } from "./stripeIdentity.js";
|
|
6
6
|
import { Effect as s } from "effect";
|
|
7
|
-
|
|
7
|
+
// src/stripeInvoiceHistory.ts
|
|
8
8
|
var c = (e, c) => s.gen(function* () {
|
|
9
9
|
let f = yield* d(() => n(c)), p = yield* o(e);
|
|
10
10
|
if (!t(p, f.account)) return yield* s.fail(i("The provider account differs before invoice history access."));
|
|
@@ -63,5 +63,4 @@ var c = (e, c) => s.gen(function* () {
|
|
|
63
63
|
try: t,
|
|
64
64
|
catch: (t) => t instanceof e ? t : i()
|
|
65
65
|
});
|
|
66
|
-
//#endregion
|
|
67
66
|
export { c as stripeInvoiceHistory };
|
|
@@ -2,7 +2,7 @@ import { BillingError as e } from "./types.js";
|
|
|
2
2
|
import { assertInvoiceSnapshot as t, invoiceSnapshotError as n } from "./invoiceSnapshot.js";
|
|
3
3
|
import { stripeCall as r } from "./stripeClient.js";
|
|
4
4
|
import { Effect as i } from "effect";
|
|
5
|
-
|
|
5
|
+
// src/stripeInvoiceSnapshot.ts
|
|
6
6
|
var a = (e) => typeof e == "string" ? e : e?.id ?? null, o = (e) => {
|
|
7
7
|
if (e === null || !Number.isSafeInteger(e) || !Number.isSafeInteger(e * 1e3)) throw n("The invoice observation contains an invalid timestamp.");
|
|
8
8
|
let t = /* @__PURE__ */ new Date(e * 1e3);
|
|
@@ -82,5 +82,4 @@ var a = (e) => typeof e == "string" ? e : e?.id ?? null, o = (e) => {
|
|
|
82
82
|
return yield* s(() => t(_)), _;
|
|
83
83
|
}) : i.fail(n("An exact billing customer and invoice identity are required."));
|
|
84
84
|
};
|
|
85
|
-
//#endregion
|
|
86
85
|
export { u as stripeInvoiceSnapshot };
|
package/dist/stripeProvider.js
CHANGED
|
@@ -6,7 +6,7 @@ import { stripeAccountIdentity as l, stripeCustomerSnapshot as u } from "./strip
|
|
|
6
6
|
import { stripeInvoiceHistory as d } from "./stripeInvoiceHistory.js";
|
|
7
7
|
import { verifyStripeBillingEvent as f } from "./stripeVerifiedEvent.js";
|
|
8
8
|
import { Effect as p } from "effect";
|
|
9
|
-
|
|
9
|
+
// src/stripeProvider.ts
|
|
10
10
|
var m = async (e) => {
|
|
11
11
|
let t = e ?? globalThis.crypto.randomUUID();
|
|
12
12
|
return "voltro-billing-" + [...new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t))).slice(0, 8)].map((e) => String.fromCharCode(97 + e % 26)).join("");
|
|
@@ -475,5 +475,4 @@ var m = async (e) => {
|
|
|
475
475
|
return 0;
|
|
476
476
|
}
|
|
477
477
|
};
|
|
478
|
-
//#endregion
|
|
479
478
|
export { S as STRIPE_WEBHOOK_EVENTS, E as isDuplicateMeterEvent, C as normalizeStripeEvent, T as stripeProvider };
|
package/dist/stripeRest.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { STRIPE_API_VERSION as e } from "./catalog.js";
|
|
2
|
-
|
|
2
|
+
// src/stripeRest.ts
|
|
3
3
|
var t = (e) => {
|
|
4
4
|
let t = [], n = (e, r) => {
|
|
5
5
|
if (r !== void 0) {
|
|
@@ -48,5 +48,4 @@ var t = (e) => {
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
-
//#endregion
|
|
52
51
|
export { r as StripeRestError, t as formEncode, n as redactStripeKeys, i as stripeRest };
|
|
@@ -3,7 +3,7 @@ import { stripeCall as t } from "./stripeClient.js";
|
|
|
3
3
|
import { stripeAccountIdentity as n } from "./stripeIdentity.js";
|
|
4
4
|
import { Effect as r } from "effect";
|
|
5
5
|
import { canonicalJson as i } from "@voltro/protocol";
|
|
6
|
-
|
|
6
|
+
// src/stripeVerifiedEvent.ts
|
|
7
7
|
var a = (a, o) => r.gen(function* () {
|
|
8
8
|
let s = yield* r.try({
|
|
9
9
|
try: () => a.webhooks.constructEvent(Buffer.from(o.rawBody), o.signatureHeader, o.secret),
|
|
@@ -25,5 +25,4 @@ var a = (a, o) => r.gen(function* () {
|
|
|
25
25
|
})
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
-
//#endregion
|
|
29
28
|
export { a as verifyStripeBillingEvent };
|
package/dist/table.js
CHANGED
|
@@ -8,7 +8,7 @@ import { billingCheckoutOperationsTable as f } from "./checkoutStore.js";
|
|
|
8
8
|
import { billingCloseOperationsTable as p } from "./closeStore.js";
|
|
9
9
|
import { billingDunningNoticesTable as m } from "./dunning.js";
|
|
10
10
|
import { id as h, integer as g, table as _, text as v, timestamp as y } from "@voltro/database";
|
|
11
|
-
|
|
11
|
+
// src/table.ts
|
|
12
12
|
var b = "_voltro_billing_customers", x = "_voltro_billing_subscriptions", S = "_voltro_billing_invoices", C = "_voltro_billing_usage", w = _(b, {
|
|
13
13
|
id: h({ prefix: "bcust" }),
|
|
14
14
|
tenantId: v(),
|
|
@@ -73,5 +73,4 @@ var b = "_voltro_billing_customers", x = "_voltro_billing_subscriptions", S = "_
|
|
|
73
73
|
s,
|
|
74
74
|
D
|
|
75
75
|
];
|
|
76
|
-
//#endregion
|
|
77
76
|
export { b as BILLING_CUSTOMERS_TABLE, S as BILLING_INVOICES_TABLE, a as BILLING_INVOICE_OBSERVATIONS_TABLE, x as BILLING_SUBSCRIPTIONS_TABLE, C as BILLING_USAGE_TABLE, w as billingCustomersTable, o as billingInvoiceObservationsTable, E as billingInvoicesTable, s as billingRetainedInvoiceObservationsTable, T as billingSubscriptionsTable, O as billingTables, D as billingUsageTable };
|
package/dist/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context as e, Schema as t } from "effect";
|
|
2
|
-
|
|
2
|
+
// src/types.ts
|
|
3
3
|
var n = class extends t.TaggedError()("BillingError", {
|
|
4
4
|
source: t.String,
|
|
5
5
|
message: t.String,
|
|
@@ -15,5 +15,4 @@ var n = class extends t.TaggedError()("BillingError", {
|
|
|
15
15
|
used: t.Number,
|
|
16
16
|
cost: t.Number
|
|
17
17
|
}) {}, a = "free", o = class extends e.Service()("@voltro/plugin-billing/BillingService") {};
|
|
18
|
-
//#endregion
|
|
19
18
|
export { n as BillingError, o as BillingService, a as DEFAULT_PLAN, i as EntitlementExceeded, r as SubscriptionLocked };
|
package/dist/usageEvents.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BillingError as e } from "./types.js";
|
|
2
2
|
import { Effect as t } from "effect";
|
|
3
3
|
import { and as n, eq as r, id as i, integer as a, table as o, text as s, timestamp as c } from "@voltro/database";
|
|
4
|
-
|
|
4
|
+
// src/usageEvents.ts
|
|
5
5
|
var l = "_voltro_billing_usage_events", u = o(l, {
|
|
6
6
|
id: i({ prefix: "busage" }),
|
|
7
7
|
tenantId: s().maxLength(191),
|
|
@@ -61,5 +61,4 @@ var l = "_voltro_billing_usage_events", u = o(l, {
|
|
|
61
61
|
transient: !0
|
|
62
62
|
})
|
|
63
63
|
});
|
|
64
|
-
//#endregion
|
|
65
64
|
export { l as BILLING_USAGE_EVENTS_TABLE, u as billingUsageEventsTable, m as recordDataStoreUsageEvent };
|
package/dist/web/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback as e, useState as t } from "react";
|
|
2
|
-
|
|
2
|
+
// src/web/index.ts
|
|
3
3
|
var n = () => globalThis.window, r = (r) => {
|
|
4
4
|
let [i, a] = t(!1), [o, s] = t(null);
|
|
5
5
|
return {
|
|
@@ -43,5 +43,4 @@ var n = () => globalThis.window, r = (r) => {
|
|
|
43
43
|
error: s
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
-
//#endregion
|
|
47
46
|
export { r as useStartCheckout, i as useSubscriptionCancel };
|
package/dist/webhook.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Effect as t, Schema as n } from "effect";
|
|
|
3
3
|
import { createLogger as r } from "@voltro/logger";
|
|
4
4
|
import { IdempotencyCache as i, defineIncomingWebhook as a, mountIncomingWebhook as o } from "@voltro/plugin-webhooks";
|
|
5
5
|
import { stripeProvider as s } from "@voltro/plugin-webhooks/providers";
|
|
6
|
-
|
|
6
|
+
// src/webhook.ts
|
|
7
7
|
var c = r({ scope: "@voltro/plugin-billing" }), l = "billing", u = "/billing/webhook", d = 3e5, f = (r) => {
|
|
8
8
|
let i = e(r);
|
|
9
9
|
return a({
|
|
@@ -34,5 +34,4 @@ var c = r({ scope: "@voltro/plugin-billing" }), l = "billing", u = "/billing/web
|
|
|
34
34
|
e.status >= 400 && c.warn("billing webhook rejected", { ...e });
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
//#endregion
|
|
38
37
|
export { l as BILLING_WEBHOOK_ID, u as BILLING_WEBHOOK_PATH, d as REDELIVERY_AGE_MS, f as billingWebhookDescriptor, p as mountBillingWebhook };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/plugin-billing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.0",
|
|
4
4
|
"description": "Billing on the official Stripe SDK — subscriptions, plans, entitlements and usage metering. Proration, failed-payment retries, tax, promotion codes, trials and the checkout seat stepper are Stripe's own; the plugin adds the entitlement engine, the enforce interceptor, typed BillingError/EntitlementExceeded, the /billing/webhook mount with Stripe's signature verification, the BillingService Tag, requireEntitlement(), and a browser-safe useStartCheckout() hook. Money is integer minor units end-to-end.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -53,18 +53,18 @@
|
|
|
53
53
|
"node": ">=24.0.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@voltro/database": "0.
|
|
57
|
-
"@voltro/env": "0.
|
|
58
|
-
"@voltro/logger": "0.
|
|
59
|
-
"@voltro/plugin-webhooks": "0.
|
|
60
|
-
"@voltro/protocol": "0.
|
|
61
|
-
"@voltro/runtime": "0.
|
|
56
|
+
"@voltro/database": "0.88.0",
|
|
57
|
+
"@voltro/env": "0.88.0",
|
|
58
|
+
"@voltro/logger": "0.88.0",
|
|
59
|
+
"@voltro/plugin-webhooks": "0.88.0",
|
|
60
|
+
"@voltro/protocol": "0.88.0",
|
|
61
|
+
"@voltro/runtime": "0.88.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"effect": "4.0
|
|
64
|
+
"effect": "4.1.0",
|
|
65
65
|
"react": "^19.0.0",
|
|
66
|
-
"stripe": "^22.6.1",
|
|
67
|
-
"@voltro/plugin-economy": "0.
|
|
66
|
+
"stripe": "^22.6.1 || ^23.0.1",
|
|
67
|
+
"@voltro/plugin-economy": "0.88.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependenciesMeta": {
|
|
70
70
|
"react": {
|