@fonderie/billing 5.3.1 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { IFonderieModule, IFonderieApp, IFonderieContext, Middleware } from '@fonderie/core';
2
2
  import { IStoreAdapter } from '@fonderie/store';
3
- import { I as IBillingConfig, a as IBillingProvider, b as IResolvedPrice, c as IBillingEvent, d as ICounterBackend, e as IBillingPlan } from './index-DjAGcrSi.cjs';
4
- export { B as BillingMessageKey, f as IBillingNotificationsConfig, g as IBillingPlanDefaults, h as IBillingPlanPrice, i as IBillingPricingConfig, M as MESSAGE_KEYS, R as RateLimitBackendConfig, r as requirePlan, w as withBilling } from './index-DjAGcrSi.cjs';
5
- import { SubscriberType, IPolicyStatus, IPlanFeature, IPlan, ISubscription, IUsageRecord } from './types.cjs';
6
- export { BILLING_INTERVAL, BillingInterval, IBillingContext, LimitStatus, PolicyEntry, SubscriptionStatus } from './types.cjs';
3
+ import { I as IBillingConfig, a as IBillingProvider, b as IResolvedPrice, c as IBillingEvent, d as IBillingPlan, e as ICounterBackend } from './index-Ca4pXx07.cjs';
4
+ export { B as BillingMessageKey, f as IBillingCreditPack, g as IBillingNotificationsConfig, h as IBillingPlanDefaults, i as IBillingPlanPrice, j as IBillingPlanWallet, k as IBillingPricingConfig, l as IBillingWalletConfig, m as INormalizedPayment, M as MESSAGE_KEYS, R as RateLimitBackendConfig, r as requirePlan, w as withBilling } from './index-Ca4pXx07.cjs';
5
+ import { SubscriberType, IWalletRate, IWalletLedgerEntry, WalletLedgerType, IWalletBalance, IPolicyStatus, IWalletContext, IPlanFeature, IPlan, ISubscription } from './types.cjs';
6
+ export { BILLING_INTERVAL, BILLING_INTERVALS, BillingInterval, IBillingContext, LimitStatus, PolicyEntry, SubscriptionStatus, WALLET_LEDGER_TYPES, isBillingInterval } from './types.cjs';
7
7
  import { z } from 'zod';
8
8
 
9
9
  declare class BillingModule implements IFonderieModule {
@@ -40,6 +40,20 @@ declare class StripeProvider implements IBillingProvider {
40
40
  }): Promise<{
41
41
  url: string;
42
42
  }>;
43
+ createPaymentCheckoutSession(opts: {
44
+ customerId: string;
45
+ amount: bigint;
46
+ currency: string;
47
+ name: string;
48
+ quantity?: number;
49
+ priceId?: string;
50
+ metadata: Record<string, string>;
51
+ successUrl: string;
52
+ cancelUrl: string;
53
+ }): Promise<{
54
+ url: string;
55
+ sessionId: string;
56
+ }>;
43
57
  resolvePriceById(priceId: string): Promise<IResolvedPrice | null>;
44
58
  resolvePricesByLookupKey(lookupKeys: string[]): Promise<Map<string, IResolvedPrice>>;
45
59
  updateSubscription(opts: {
@@ -63,9 +77,92 @@ declare class StripeProvider implements IBillingProvider {
63
77
  }): Promise<IBillingEvent>;
64
78
  }
65
79
 
80
+ declare class InsufficientFundsError extends Error {
81
+ readonly available: bigint;
82
+ readonly required: bigint;
83
+ readonly currency: string;
84
+ constructor(available: bigint, required: bigint, currency: string);
85
+ }
86
+ declare class DuplicateTransactionError extends Error {
87
+ readonly idempotencyKey: string;
88
+ constructor(idempotencyKey: string);
89
+ }
90
+
91
+ interface IWalletSubscriber {
92
+ subscriberType: SubscriberType;
93
+ subscriberId: string;
94
+ currency: string;
95
+ }
96
+ interface IWalletMutationResult {
97
+ balance: bigint;
98
+ duplicate: boolean;
99
+ }
100
+ declare function creditWallet(opts: IWalletSubscriber & {
101
+ amount: bigint;
102
+ idempotencyKey: string;
103
+ type?: WalletLedgerType;
104
+ description?: string;
105
+ metadata?: Record<string, unknown>;
106
+ providerTxId?: string;
107
+ }, store: IStoreAdapter): Promise<IWalletMutationResult>;
108
+ declare function debitWallet(opts: IWalletSubscriber & {
109
+ amount: bigint;
110
+ idempotencyKey: string;
111
+ type?: WalletLedgerType;
112
+ overdraftLimit?: bigint;
113
+ description?: string;
114
+ metadata?: Record<string, unknown>;
115
+ }, store: IStoreAdapter): Promise<IWalletMutationResult>;
116
+ declare function getWalletBalance(sub: IWalletSubscriber, store: IStoreAdapter): Promise<IWalletBalance>;
117
+ interface IWalletLedgerPage {
118
+ entries: IWalletLedgerEntry[];
119
+ nextCursor: string | null;
120
+ }
121
+ declare function encodeLedgerCursor(createdAt: string, id: string): string;
122
+ declare function decodeLedgerCursor(cursor: string): {
123
+ createdAt: string;
124
+ id: string;
125
+ } | null;
126
+ declare function getWalletLedger(opts: IWalletSubscriber & {
127
+ limit?: number;
128
+ cursor?: {
129
+ createdAt: string;
130
+ id: string;
131
+ };
132
+ }, store: IStoreAdapter): Promise<IWalletLedgerPage>;
133
+ interface IResolvedPlanWallet {
134
+ currency: string;
135
+ precision: number;
136
+ overdraftLimit: bigint;
137
+ grantAmount: bigint | null;
138
+ grantPeriod: 'month' | 'week' | 'day';
139
+ rates: Record<string, IWalletRate>;
140
+ }
141
+ declare function resolvePlanWallet(plan: IBillingPlan, config: IBillingConfig): IResolvedPlanWallet | null;
142
+ declare function currentGrantPeriod(period: 'month' | 'week' | 'day', now?: Date): string;
143
+ interface IGrantResult {
144
+ granted: boolean;
145
+ balance: bigint | null;
146
+ }
147
+ declare function ensurePeriodicGrant(opts: IWalletSubscriber & {
148
+ amount: bigint;
149
+ period: string;
150
+ description?: string;
151
+ }, store: IStoreAdapter): Promise<IGrantResult>;
152
+
66
153
  declare function hasFeature(ctx: IFonderieContext, key: string): boolean;
67
154
  declare function getPlanLimit(ctx: IFonderieContext, key: string): number | null;
68
155
  declare function getLimitStatus(ctx: IFonderieContext, key: string): IPolicyStatus | null;
156
+ declare function getWalletStatus(ctx: IFonderieContext): IWalletContext | null;
157
+ declare function getWalletRate(ctx: IFonderieContext, metric: string): bigint | null;
158
+ declare function requireWalletBalance(metric: string): Middleware;
159
+ declare function debitWalletForMetric(ctx: IFonderieContext, metric: string, opts: {
160
+ idempotencyKey: string;
161
+ quantity?: number;
162
+ description?: string;
163
+ metadata?: Record<string, unknown>;
164
+ }, store: IStoreAdapter): Promise<IWalletMutationResult | null>;
165
+ declare function insufficientCreditsResponse(err: InsufficientFundsError, metric?: string): Response;
69
166
  declare function requireFeature(key: string): Middleware;
70
167
 
71
168
  declare class MemoryCounterBackend implements ICounterBackend {
@@ -112,17 +209,26 @@ interface ISubscriptionDTO {
112
209
  trialEndsAt: string | null;
113
210
  createdAt: string;
114
211
  }
115
- interface IUsageRecordDTO {
116
- id: string;
117
- subscriberType: SubscriberType;
118
- subscriberId: string;
119
- metric: string;
120
- quantity: number;
121
- recordedAt: string;
122
- }
123
212
  declare function toPlanDTO(plan: IPlan): IPlanDTO;
124
213
  declare function toSubscriptionDTO(sub: ISubscription): ISubscriptionDTO;
125
- declare function toUsageRecordDTO(record: IUsageRecord): IUsageRecordDTO;
214
+ interface IWalletDTO {
215
+ balance: string;
216
+ currency: string;
217
+ precision: number;
218
+ }
219
+ interface IWalletTransactionDTO {
220
+ id: string;
221
+ type: WalletLedgerType;
222
+ amount: string;
223
+ balanceAfter: string;
224
+ currency: string;
225
+ description: string | null;
226
+ providerTxId: string | null;
227
+ metadata: Record<string, unknown>;
228
+ createdAt: string;
229
+ }
230
+ declare function toWalletDTO(balance: bigint, currency: string, precision: number): IWalletDTO;
231
+ declare function toWalletTransactionDTO(entry: IWalletLedgerEntry): IWalletTransactionDTO;
126
232
 
127
233
  declare function recordUsage(opts: {
128
234
  subscriberType: SubscriberType;
@@ -191,13 +297,29 @@ declare const recordUsageSchema: z.ZodObject<{
191
297
  metric: z.ZodString;
192
298
  quantity: z.ZodOptional<z.ZodNumber>;
193
299
  }, z.core.$strip>;
300
+ declare const walletCheckoutSchema: z.ZodObject<{
301
+ packId: z.ZodString;
302
+ }, z.core.$strip>;
303
+ declare const grantWalletSchema: z.ZodObject<{
304
+ subscriberType: z.ZodEnum<{
305
+ user: "user";
306
+ workspace: "workspace";
307
+ }>;
308
+ subscriberId: z.ZodString;
309
+ amount: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
310
+ currency: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
311
+ description: z.ZodOptional<z.ZodString>;
312
+ idempotencyKey: z.ZodString;
313
+ }, z.core.$strip>;
194
314
 
195
315
  declare const schemas_checkoutSchema: typeof checkoutSchema;
196
316
  declare const schemas_createPlanSchema: typeof createPlanSchema;
317
+ declare const schemas_grantWalletSchema: typeof grantWalletSchema;
197
318
  declare const schemas_recordUsageSchema: typeof recordUsageSchema;
198
319
  declare const schemas_updatePlanSchema: typeof updatePlanSchema;
320
+ declare const schemas_walletCheckoutSchema: typeof walletCheckoutSchema;
199
321
  declare namespace schemas {
200
- export { schemas_checkoutSchema as checkoutSchema, schemas_createPlanSchema as createPlanSchema, schemas_recordUsageSchema as recordUsageSchema, schemas_updatePlanSchema as updatePlanSchema };
322
+ export { schemas_checkoutSchema as checkoutSchema, schemas_createPlanSchema as createPlanSchema, schemas_grantWalletSchema as grantWalletSchema, schemas_recordUsageSchema as recordUsageSchema, schemas_updatePlanSchema as updatePlanSchema, schemas_walletCheckoutSchema as walletCheckoutSchema };
201
323
  }
202
324
 
203
- export { BillingModule, DBCounterBackend, IBillingConfig, IBillingEvent, IBillingPlan, IBillingProvider, ICounterBackend, IPlan, type IPlanDTO, IPolicyStatus, IResolvedPrice, ISubscription, type ISubscriptionDTO, IUsageRecord, type IUsageRecordDTO, MemoryCounterBackend, StripeProvider, createPlan, deletePlan, getDBPlans, getLimitStatus, getPlanById, getPlanByName, getPlanLimit, getPlans, getSubscription, getUsage, hasFeature, recordUsage, requireFeature, schemas, toPlanDTO, toSubscriptionDTO, toUsageRecordDTO, updatePlan };
325
+ export { BillingModule, DBCounterBackend, DuplicateTransactionError, IBillingConfig, IBillingEvent, IBillingPlan, IBillingProvider, ICounterBackend, type IGrantResult, IPlan, type IPlanDTO, IPolicyStatus, type IResolvedPlanWallet, IResolvedPrice, ISubscription, type ISubscriptionDTO, IWalletBalance, IWalletContext, type IWalletDTO, IWalletLedgerEntry, type IWalletLedgerPage, type IWalletMutationResult, IWalletRate, type IWalletSubscriber, type IWalletTransactionDTO, InsufficientFundsError, MemoryCounterBackend, StripeProvider, WalletLedgerType, createPlan, creditWallet, currentGrantPeriod, debitWallet, debitWalletForMetric, decodeLedgerCursor, deletePlan, encodeLedgerCursor, ensurePeriodicGrant, getDBPlans, getLimitStatus, getPlanById, getPlanByName, getPlanLimit, getPlans, getSubscription, getUsage, getWalletBalance, getWalletLedger, getWalletRate, getWalletStatus, hasFeature, insufficientCreditsResponse, recordUsage, requireFeature, requireWalletBalance, resolvePlanWallet, schemas, toPlanDTO, toSubscriptionDTO, toWalletDTO, toWalletTransactionDTO, updatePlan };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { IFonderieModule, IFonderieApp, IFonderieContext, Middleware } from '@fonderie/core';
2
2
  import { IStoreAdapter } from '@fonderie/store';
3
- import { I as IBillingConfig, a as IBillingProvider, b as IResolvedPrice, c as IBillingEvent, d as ICounterBackend, e as IBillingPlan } from './index-Byy5mBE4.js';
4
- export { B as BillingMessageKey, f as IBillingNotificationsConfig, g as IBillingPlanDefaults, h as IBillingPlanPrice, i as IBillingPricingConfig, M as MESSAGE_KEYS, R as RateLimitBackendConfig, r as requirePlan, w as withBilling } from './index-Byy5mBE4.js';
5
- import { SubscriberType, IPolicyStatus, IPlanFeature, IPlan, ISubscription, IUsageRecord } from './types.js';
6
- export { BILLING_INTERVAL, BillingInterval, IBillingContext, LimitStatus, PolicyEntry, SubscriptionStatus } from './types.js';
3
+ import { I as IBillingConfig, a as IBillingProvider, b as IResolvedPrice, c as IBillingEvent, d as IBillingPlan, e as ICounterBackend } from './index-BdNYDuhk.js';
4
+ export { B as BillingMessageKey, f as IBillingCreditPack, g as IBillingNotificationsConfig, h as IBillingPlanDefaults, i as IBillingPlanPrice, j as IBillingPlanWallet, k as IBillingPricingConfig, l as IBillingWalletConfig, m as INormalizedPayment, M as MESSAGE_KEYS, R as RateLimitBackendConfig, r as requirePlan, w as withBilling } from './index-BdNYDuhk.js';
5
+ import { SubscriberType, IWalletRate, IWalletLedgerEntry, WalletLedgerType, IWalletBalance, IPolicyStatus, IWalletContext, IPlanFeature, IPlan, ISubscription } from './types.js';
6
+ export { BILLING_INTERVAL, BILLING_INTERVALS, BillingInterval, IBillingContext, LimitStatus, PolicyEntry, SubscriptionStatus, WALLET_LEDGER_TYPES, isBillingInterval } from './types.js';
7
7
  import { z } from 'zod';
8
8
 
9
9
  declare class BillingModule implements IFonderieModule {
@@ -40,6 +40,20 @@ declare class StripeProvider implements IBillingProvider {
40
40
  }): Promise<{
41
41
  url: string;
42
42
  }>;
43
+ createPaymentCheckoutSession(opts: {
44
+ customerId: string;
45
+ amount: bigint;
46
+ currency: string;
47
+ name: string;
48
+ quantity?: number;
49
+ priceId?: string;
50
+ metadata: Record<string, string>;
51
+ successUrl: string;
52
+ cancelUrl: string;
53
+ }): Promise<{
54
+ url: string;
55
+ sessionId: string;
56
+ }>;
43
57
  resolvePriceById(priceId: string): Promise<IResolvedPrice | null>;
44
58
  resolvePricesByLookupKey(lookupKeys: string[]): Promise<Map<string, IResolvedPrice>>;
45
59
  updateSubscription(opts: {
@@ -63,9 +77,92 @@ declare class StripeProvider implements IBillingProvider {
63
77
  }): Promise<IBillingEvent>;
64
78
  }
65
79
 
80
+ declare class InsufficientFundsError extends Error {
81
+ readonly available: bigint;
82
+ readonly required: bigint;
83
+ readonly currency: string;
84
+ constructor(available: bigint, required: bigint, currency: string);
85
+ }
86
+ declare class DuplicateTransactionError extends Error {
87
+ readonly idempotencyKey: string;
88
+ constructor(idempotencyKey: string);
89
+ }
90
+
91
+ interface IWalletSubscriber {
92
+ subscriberType: SubscriberType;
93
+ subscriberId: string;
94
+ currency: string;
95
+ }
96
+ interface IWalletMutationResult {
97
+ balance: bigint;
98
+ duplicate: boolean;
99
+ }
100
+ declare function creditWallet(opts: IWalletSubscriber & {
101
+ amount: bigint;
102
+ idempotencyKey: string;
103
+ type?: WalletLedgerType;
104
+ description?: string;
105
+ metadata?: Record<string, unknown>;
106
+ providerTxId?: string;
107
+ }, store: IStoreAdapter): Promise<IWalletMutationResult>;
108
+ declare function debitWallet(opts: IWalletSubscriber & {
109
+ amount: bigint;
110
+ idempotencyKey: string;
111
+ type?: WalletLedgerType;
112
+ overdraftLimit?: bigint;
113
+ description?: string;
114
+ metadata?: Record<string, unknown>;
115
+ }, store: IStoreAdapter): Promise<IWalletMutationResult>;
116
+ declare function getWalletBalance(sub: IWalletSubscriber, store: IStoreAdapter): Promise<IWalletBalance>;
117
+ interface IWalletLedgerPage {
118
+ entries: IWalletLedgerEntry[];
119
+ nextCursor: string | null;
120
+ }
121
+ declare function encodeLedgerCursor(createdAt: string, id: string): string;
122
+ declare function decodeLedgerCursor(cursor: string): {
123
+ createdAt: string;
124
+ id: string;
125
+ } | null;
126
+ declare function getWalletLedger(opts: IWalletSubscriber & {
127
+ limit?: number;
128
+ cursor?: {
129
+ createdAt: string;
130
+ id: string;
131
+ };
132
+ }, store: IStoreAdapter): Promise<IWalletLedgerPage>;
133
+ interface IResolvedPlanWallet {
134
+ currency: string;
135
+ precision: number;
136
+ overdraftLimit: bigint;
137
+ grantAmount: bigint | null;
138
+ grantPeriod: 'month' | 'week' | 'day';
139
+ rates: Record<string, IWalletRate>;
140
+ }
141
+ declare function resolvePlanWallet(plan: IBillingPlan, config: IBillingConfig): IResolvedPlanWallet | null;
142
+ declare function currentGrantPeriod(period: 'month' | 'week' | 'day', now?: Date): string;
143
+ interface IGrantResult {
144
+ granted: boolean;
145
+ balance: bigint | null;
146
+ }
147
+ declare function ensurePeriodicGrant(opts: IWalletSubscriber & {
148
+ amount: bigint;
149
+ period: string;
150
+ description?: string;
151
+ }, store: IStoreAdapter): Promise<IGrantResult>;
152
+
66
153
  declare function hasFeature(ctx: IFonderieContext, key: string): boolean;
67
154
  declare function getPlanLimit(ctx: IFonderieContext, key: string): number | null;
68
155
  declare function getLimitStatus(ctx: IFonderieContext, key: string): IPolicyStatus | null;
156
+ declare function getWalletStatus(ctx: IFonderieContext): IWalletContext | null;
157
+ declare function getWalletRate(ctx: IFonderieContext, metric: string): bigint | null;
158
+ declare function requireWalletBalance(metric: string): Middleware;
159
+ declare function debitWalletForMetric(ctx: IFonderieContext, metric: string, opts: {
160
+ idempotencyKey: string;
161
+ quantity?: number;
162
+ description?: string;
163
+ metadata?: Record<string, unknown>;
164
+ }, store: IStoreAdapter): Promise<IWalletMutationResult | null>;
165
+ declare function insufficientCreditsResponse(err: InsufficientFundsError, metric?: string): Response;
69
166
  declare function requireFeature(key: string): Middleware;
70
167
 
71
168
  declare class MemoryCounterBackend implements ICounterBackend {
@@ -112,17 +209,26 @@ interface ISubscriptionDTO {
112
209
  trialEndsAt: string | null;
113
210
  createdAt: string;
114
211
  }
115
- interface IUsageRecordDTO {
116
- id: string;
117
- subscriberType: SubscriberType;
118
- subscriberId: string;
119
- metric: string;
120
- quantity: number;
121
- recordedAt: string;
122
- }
123
212
  declare function toPlanDTO(plan: IPlan): IPlanDTO;
124
213
  declare function toSubscriptionDTO(sub: ISubscription): ISubscriptionDTO;
125
- declare function toUsageRecordDTO(record: IUsageRecord): IUsageRecordDTO;
214
+ interface IWalletDTO {
215
+ balance: string;
216
+ currency: string;
217
+ precision: number;
218
+ }
219
+ interface IWalletTransactionDTO {
220
+ id: string;
221
+ type: WalletLedgerType;
222
+ amount: string;
223
+ balanceAfter: string;
224
+ currency: string;
225
+ description: string | null;
226
+ providerTxId: string | null;
227
+ metadata: Record<string, unknown>;
228
+ createdAt: string;
229
+ }
230
+ declare function toWalletDTO(balance: bigint, currency: string, precision: number): IWalletDTO;
231
+ declare function toWalletTransactionDTO(entry: IWalletLedgerEntry): IWalletTransactionDTO;
126
232
 
127
233
  declare function recordUsage(opts: {
128
234
  subscriberType: SubscriberType;
@@ -191,13 +297,29 @@ declare const recordUsageSchema: z.ZodObject<{
191
297
  metric: z.ZodString;
192
298
  quantity: z.ZodOptional<z.ZodNumber>;
193
299
  }, z.core.$strip>;
300
+ declare const walletCheckoutSchema: z.ZodObject<{
301
+ packId: z.ZodString;
302
+ }, z.core.$strip>;
303
+ declare const grantWalletSchema: z.ZodObject<{
304
+ subscriberType: z.ZodEnum<{
305
+ user: "user";
306
+ workspace: "workspace";
307
+ }>;
308
+ subscriberId: z.ZodString;
309
+ amount: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
310
+ currency: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
311
+ description: z.ZodOptional<z.ZodString>;
312
+ idempotencyKey: z.ZodString;
313
+ }, z.core.$strip>;
194
314
 
195
315
  declare const schemas_checkoutSchema: typeof checkoutSchema;
196
316
  declare const schemas_createPlanSchema: typeof createPlanSchema;
317
+ declare const schemas_grantWalletSchema: typeof grantWalletSchema;
197
318
  declare const schemas_recordUsageSchema: typeof recordUsageSchema;
198
319
  declare const schemas_updatePlanSchema: typeof updatePlanSchema;
320
+ declare const schemas_walletCheckoutSchema: typeof walletCheckoutSchema;
199
321
  declare namespace schemas {
200
- export { schemas_checkoutSchema as checkoutSchema, schemas_createPlanSchema as createPlanSchema, schemas_recordUsageSchema as recordUsageSchema, schemas_updatePlanSchema as updatePlanSchema };
322
+ export { schemas_checkoutSchema as checkoutSchema, schemas_createPlanSchema as createPlanSchema, schemas_grantWalletSchema as grantWalletSchema, schemas_recordUsageSchema as recordUsageSchema, schemas_updatePlanSchema as updatePlanSchema, schemas_walletCheckoutSchema as walletCheckoutSchema };
201
323
  }
202
324
 
203
- export { BillingModule, DBCounterBackend, IBillingConfig, IBillingEvent, IBillingPlan, IBillingProvider, ICounterBackend, IPlan, type IPlanDTO, IPolicyStatus, IResolvedPrice, ISubscription, type ISubscriptionDTO, IUsageRecord, type IUsageRecordDTO, MemoryCounterBackend, StripeProvider, createPlan, deletePlan, getDBPlans, getLimitStatus, getPlanById, getPlanByName, getPlanLimit, getPlans, getSubscription, getUsage, hasFeature, recordUsage, requireFeature, schemas, toPlanDTO, toSubscriptionDTO, toUsageRecordDTO, updatePlan };
325
+ export { BillingModule, DBCounterBackend, DuplicateTransactionError, IBillingConfig, IBillingEvent, IBillingPlan, IBillingProvider, ICounterBackend, type IGrantResult, IPlan, type IPlanDTO, IPolicyStatus, type IResolvedPlanWallet, IResolvedPrice, ISubscription, type ISubscriptionDTO, IWalletBalance, IWalletContext, type IWalletDTO, IWalletLedgerEntry, type IWalletLedgerPage, type IWalletMutationResult, IWalletRate, type IWalletSubscriber, type IWalletTransactionDTO, InsufficientFundsError, MemoryCounterBackend, StripeProvider, WalletLedgerType, createPlan, creditWallet, currentGrantPeriod, debitWallet, debitWalletForMetric, decodeLedgerCursor, deletePlan, encodeLedgerCursor, ensurePeriodicGrant, getDBPlans, getLimitStatus, getPlanById, getPlanByName, getPlanLimit, getPlans, getSubscription, getUsage, getWalletBalance, getWalletLedger, getWalletRate, getWalletStatus, hasFeature, insufficientCreditsResponse, recordUsage, requireFeature, requireWalletBalance, resolvePlanWallet, schemas, toPlanDTO, toSubscriptionDTO, toWalletDTO, toWalletTransactionDTO, updatePlan };