pecunia-core 0.1.2 → 0.1.4

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.
@@ -1,2 +1,2 @@
1
- import { a as useMiddleware, i as optionsMiddleware, n as createPaymentEndpoint, r as createPecuniaMiddleware, t as PaymentMiddleware } from "../index-r-9XcDEa.mjs";
1
+ import { a as useMiddleware, i as optionsMiddleware, n as createPaymentEndpoint, r as createPecuniaMiddleware, t as PaymentMiddleware } from "../index-CRH0tJ5D.mjs";
2
2
  export { PaymentMiddleware, createPaymentEndpoint, createPecuniaMiddleware, optionsMiddleware, useMiddleware };
@@ -1,2 +1,2 @@
1
- import { At as RequestState, Dt as getCurrentDBAdapterAsyncLocalStorage, Et as getCurrentAdapter, Ft as hasRequestState, It as runWithRequestState, Lt as getCurrentAuthContext, Mt as defineRequestState, Nt as getCurrentRequestState, Ot as runWithAdapter, Pt as getRequestStateAsyncLocalStorage, Rt as getCurrentPaymentContextAsyncLocalStorage, jt as RequestStateWeakMap, kt as runWithTransaction, zt as runWithEndpointContext } from "../index-r-9XcDEa.mjs";
1
+ import { At as RequestState, Dt as getCurrentDBAdapterAsyncLocalStorage, Et as getCurrentAdapter, Ft as hasRequestState, It as runWithRequestState, Lt as getCurrentAuthContext, Mt as defineRequestState, Nt as getCurrentRequestState, Ot as runWithAdapter, Pt as getRequestStateAsyncLocalStorage, Rt as getCurrentPaymentContextAsyncLocalStorage, jt as RequestStateWeakMap, kt as runWithTransaction, zt as runWithEndpointContext } from "../index-CRH0tJ5D.mjs";
2
2
  export { RequestState, RequestStateWeakMap, defineRequestState, getCurrentAdapter, getCurrentAuthContext, getCurrentDBAdapterAsyncLocalStorage, getCurrentPaymentContextAsyncLocalStorage, getCurrentRequestState, getRequestStateAsyncLocalStorage, hasRequestState, runWithAdapter, runWithEndpointContext, runWithRequestState, runWithTransaction };
@@ -1,2 +1,2 @@
1
- import { $t as KyselyDatabaseDialectType, Ct as initGetFieldAttributes, St as initGetFieldName, Tt as initGetDefaultFieldName, _t as discountSchema, at as getPaymentTables, bt as initGetModelName, ct as Subscription, dt as sharedDeletableSchema, ft as Product, gt as Discount, ht as priceSchema, lt as subscriptionSchema, mt as Price, ot as deepmerge, pt as productSchema, st as withApplyDefault, ut as sharedCoreSchema, vt as Customer, wt as initGetDefaultModelName, xt as initGetIdField, yt as customerSchema } from "../index-r-9XcDEa.mjs";
1
+ import { $t as KyselyDatabaseDialectType, Ct as initGetFieldAttributes, St as initGetFieldName, Tt as initGetDefaultFieldName, _t as discountSchema, at as getPaymentTables, bt as initGetModelName, ct as Subscription, dt as sharedDeletableSchema, ft as Product, gt as Discount, ht as priceSchema, lt as subscriptionSchema, mt as Price, ot as deepmerge, pt as productSchema, st as withApplyDefault, ut as sharedCoreSchema, vt as Customer, wt as initGetDefaultModelName, xt as initGetIdField, yt as customerSchema } from "../index-CRH0tJ5D.mjs";
2
2
  export { Customer, Discount, KyselyDatabaseDialectType, Price, Product, Subscription, customerSchema, deepmerge, discountSchema, getPaymentTables, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName, priceSchema, productSchema, sharedCoreSchema, sharedDeletableSchema, subscriptionSchema, withApplyDefault };
package/dist/db/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { A as UsageAggregation, E as SubscriptionStatus, S as ProrationBehavior, b as PricingModel, c as BillingInterval, d as CollectionMethod, f as Currency, p as DiscountType, x as ProductType, y as PriceType } from "../errors-vpD21Iku.mjs";
2
- import { a as initGetFieldAttributes, c as initGetDefaultModelName, i as initGetModelName, n as deepmerge, o as initGetIdField, r as withApplyDefault, s as initGetDefaultFieldName, t as getPaymentTables } from "../get-payment-tables-D4gd0O5X.mjs";
2
+ import { a as initGetFieldAttributes, c as initGetDefaultModelName, i as initGetModelName, n as deepmerge, o as initGetIdField, r as withApplyDefault, s as initGetDefaultFieldName, t as getPaymentTables } from "../get-payment-tables-0kpYs4ZQ.mjs";
3
3
  import "../generate-id-D3ZvbbXn.mjs";
4
4
  import z$1, { z } from "zod";
5
5
 
@@ -1,2 +1,2 @@
1
- import { it as createProviderError, nt as PecuniaError, rt as ValidationError, tt as ApiError } from "../index-r-9XcDEa.mjs";
1
+ import { it as createProviderError, nt as PecuniaError, rt as ValidationError, tt as ApiError } from "../index-CRH0tJ5D.mjs";
2
2
  export { ApiError, PecuniaError, ValidationError, createProviderError };
@@ -291,6 +291,22 @@ const getPaymentTables = (options) => {
291
291
  foreignKey: "paymentMethodId"
292
292
  }
293
293
  },
294
+ invariants: [{
295
+ id: "customer_payment_method_ownership",
296
+ description: "customer.paymentMethodId (default payment method) must belong to the same customer: payment_method.customerId must equal customer.id when paymentMethodId is set",
297
+ appliesTo: [
298
+ "postgres",
299
+ "mongo",
300
+ "mysql",
301
+ "sqlite"
302
+ ],
303
+ enforcement: {
304
+ postgres: "trigger",
305
+ mongo: "app",
306
+ mysql: "trigger",
307
+ sqlite: "trigger"
308
+ }
309
+ }],
294
310
  order: 1
295
311
  },
296
312
  idempotency_key: {
@@ -360,13 +376,13 @@ const getPaymentTables = (options) => {
360
376
  validator: { input: z.string().max(255).optional() }
361
377
  },
362
378
  expiresAt: {
363
- type: "string",
379
+ type: "date",
364
380
  fieldName: "expires_at",
365
381
  required: false,
366
382
  validator: { input: z.date().optional() }
367
383
  },
368
384
  createdAt: {
369
- type: "string",
385
+ type: "date",
370
386
  fieldName: "created_at",
371
387
  required: true,
372
388
  input: false,
@@ -445,7 +461,7 @@ const getPaymentTables = (options) => {
445
461
  references: {
446
462
  model: "customer",
447
463
  field: "id",
448
- onDelete: "cascade"
464
+ onDelete: "restrict"
449
465
  }
450
466
  },
451
467
  metadata: {
@@ -680,7 +696,7 @@ const getPaymentTables = (options) => {
680
696
  references: {
681
697
  model: "products",
682
698
  field: "id",
683
- onDelete: "cascade"
699
+ onDelete: "set null"
684
700
  },
685
701
  validator: {
686
702
  input: z.uuid().optional(),
@@ -886,7 +902,7 @@ const getPaymentTables = (options) => {
886
902
  references: {
887
903
  model: "subscription_item",
888
904
  field: "id",
889
- onDelete: "cascade"
905
+ onDelete: "restrict"
890
906
  },
891
907
  validator: {
892
908
  input: z.uuid().optional(),
@@ -985,7 +1001,7 @@ const getPaymentTables = (options) => {
985
1001
  references: {
986
1002
  model: "customer",
987
1003
  field: "id",
988
- onDelete: "cascade"
1004
+ onDelete: "restrict"
989
1005
  },
990
1006
  validator: {
991
1007
  input: z.uuid(),
@@ -1235,7 +1251,7 @@ const getPaymentTables = (options) => {
1235
1251
  checkoutSession: {
1236
1252
  kind: "one",
1237
1253
  model: "checkout_session",
1238
- foreignKey: "id"
1254
+ foreignKey: "subscriptionId"
1239
1255
  },
1240
1256
  customer: {
1241
1257
  kind: "one",
@@ -1268,7 +1284,7 @@ const getPaymentTables = (options) => {
1268
1284
  references: {
1269
1285
  model: "subscription",
1270
1286
  field: "id",
1271
- onDelete: "cascade"
1287
+ onDelete: "restrict"
1272
1288
  },
1273
1289
  validator: {
1274
1290
  input: z.uuid(),
@@ -1283,7 +1299,7 @@ const getPaymentTables = (options) => {
1283
1299
  references: {
1284
1300
  model: "prices",
1285
1301
  field: "id",
1286
- onDelete: "cascade"
1302
+ onDelete: "restrict"
1287
1303
  },
1288
1304
  validator: {
1289
1305
  input: z.uuid(),
@@ -1409,7 +1425,7 @@ const getPaymentTables = (options) => {
1409
1425
  references: {
1410
1426
  model: "subscription",
1411
1427
  field: "id",
1412
- onDelete: "cascade"
1428
+ onDelete: "restrict"
1413
1429
  },
1414
1430
  validator: {
1415
1431
  input: z.uuid(),
@@ -1543,7 +1559,7 @@ const getPaymentTables = (options) => {
1543
1559
  references: {
1544
1560
  model: "customer",
1545
1561
  field: "id",
1546
- onDelete: "cascade"
1562
+ onDelete: "restrict"
1547
1563
  },
1548
1564
  validator: {
1549
1565
  input: z.uuid().optional(),
@@ -1558,7 +1574,7 @@ const getPaymentTables = (options) => {
1558
1574
  references: {
1559
1575
  model: "subscription",
1560
1576
  field: "id",
1561
- onDelete: "cascade"
1577
+ onDelete: "set null"
1562
1578
  },
1563
1579
  validator: {
1564
1580
  input: z.uuid().optional(),
@@ -1936,7 +1952,7 @@ const getPaymentTables = (options) => {
1936
1952
  references: {
1937
1953
  model: "invoice",
1938
1954
  field: "id",
1939
- onDelete: "cascade"
1955
+ onDelete: "restrict"
1940
1956
  },
1941
1957
  validator: {
1942
1958
  input: z.uuid(),
@@ -1951,7 +1967,7 @@ const getPaymentTables = (options) => {
1951
1967
  references: {
1952
1968
  model: "prices",
1953
1969
  field: "id",
1954
- onDelete: "cascade"
1970
+ onDelete: "set null"
1955
1971
  },
1956
1972
  validator: {
1957
1973
  input: z.uuid().optional(),
@@ -2248,7 +2264,7 @@ const getPaymentTables = (options) => {
2248
2264
  references: {
2249
2265
  model: "event",
2250
2266
  field: "id",
2251
- onDelete: "cascade"
2267
+ onDelete: "restrict"
2252
2268
  },
2253
2269
  validator: {
2254
2270
  input: z.uuid(),
@@ -2634,7 +2650,7 @@ const getPaymentTables = (options) => {
2634
2650
  references: {
2635
2651
  model: "checkout_session",
2636
2652
  field: "id",
2637
- onDelete: "cascade"
2653
+ onDelete: "restrict"
2638
2654
  },
2639
2655
  validator: {
2640
2656
  input: z.uuid(),
@@ -2649,7 +2665,7 @@ const getPaymentTables = (options) => {
2649
2665
  references: {
2650
2666
  model: "event",
2651
2667
  field: "id",
2652
- onDelete: "cascade"
2668
+ onDelete: "restrict"
2653
2669
  },
2654
2670
  validator: {
2655
2671
  input: z.uuid(),
@@ -2746,7 +2762,7 @@ const getPaymentTables = (options) => {
2746
2762
  references: {
2747
2763
  model: "customer",
2748
2764
  field: "id",
2749
- onDelete: "cascade"
2765
+ onDelete: "restrict"
2750
2766
  },
2751
2767
  validator: {
2752
2768
  input: z.uuid(),
@@ -2771,7 +2787,7 @@ const getPaymentTables = (options) => {
2771
2787
  references: {
2772
2788
  model: "payment_intent",
2773
2789
  field: "id",
2774
- onDelete: "cascade"
2790
+ onDelete: "restrict"
2775
2791
  },
2776
2792
  validator: {
2777
2793
  input: z.uuid(),
@@ -2782,15 +2798,15 @@ const getPaymentTables = (options) => {
2782
2798
  subscriptionId: {
2783
2799
  type: "string",
2784
2800
  fieldName: "subscription_id",
2785
- required: true,
2801
+ required: false,
2786
2802
  references: {
2787
2803
  model: "subscription",
2788
2804
  field: "id",
2789
- onDelete: "cascade"
2805
+ onDelete: "set null"
2790
2806
  },
2791
2807
  validator: {
2792
- input: z.uuid(),
2793
- output: z.uuid()
2808
+ input: z.uuid().optional(),
2809
+ output: z.uuid().optional()
2794
2810
  },
2795
2811
  index: true
2796
2812
  },
@@ -2872,7 +2888,23 @@ const getPaymentTables = (options) => {
2872
2888
  model: "subscription",
2873
2889
  foreignKey: "subscriptionId"
2874
2890
  }
2875
- }
2891
+ },
2892
+ invariants: [{
2893
+ id: "checkout_session_mode_subscription_id_consistency",
2894
+ description: "checkout_session.mode determines subscriptionId presence: PAYMENT => subscriptionId must be null/absent, SUBSCRIPTION => subscriptionId must be present",
2895
+ appliesTo: [
2896
+ "postgres",
2897
+ "mongo",
2898
+ "mysql",
2899
+ "sqlite"
2900
+ ],
2901
+ enforcement: {
2902
+ postgres: "check",
2903
+ mongo: "validator",
2904
+ mysql: "check",
2905
+ sqlite: "check"
2906
+ }
2907
+ }]
2876
2908
  },
2877
2909
  paymentIntent: {
2878
2910
  modelName: "payment_intent",
@@ -2979,7 +3011,7 @@ const getPaymentTables = (options) => {
2979
3011
  references: {
2980
3012
  model: "customer",
2981
3013
  field: "id",
2982
- onDelete: "cascade"
3014
+ onDelete: "restrict"
2983
3015
  },
2984
3016
  validator: {
2985
3017
  input: z.uuid(),
@@ -2994,7 +3026,7 @@ const getPaymentTables = (options) => {
2994
3026
  references: {
2995
3027
  model: "subscription",
2996
3028
  field: "id",
2997
- onDelete: "cascade"
3029
+ onDelete: "set null"
2998
3030
  },
2999
3031
  validator: {
3000
3032
  input: z.uuid().optional(),
@@ -3009,7 +3041,7 @@ const getPaymentTables = (options) => {
3009
3041
  references: {
3010
3042
  model: "invoice",
3011
3043
  field: "id",
3012
- onDelete: "cascade"
3044
+ onDelete: "restrict"
3013
3045
  },
3014
3046
  validator: {
3015
3047
  input: z.uuid(),
@@ -3125,12 +3157,12 @@ const getPaymentTables = (options) => {
3125
3157
  checkoutSession: {
3126
3158
  kind: "one",
3127
3159
  model: "checkout_session",
3128
- foreignKey: "id"
3160
+ foreignKey: "paymentIntentId"
3129
3161
  },
3130
3162
  transaction: {
3131
3163
  kind: "one",
3132
3164
  model: "transaction",
3133
- foreignKey: "id"
3165
+ foreignKey: "paymentIntentId"
3134
3166
  }
3135
3167
  }
3136
3168
  },
@@ -3198,7 +3230,7 @@ const getPaymentTables = (options) => {
3198
3230
  references: {
3199
3231
  model: "payment_intent",
3200
3232
  field: "id",
3201
- onDelete: "cascade"
3233
+ onDelete: "restrict"
3202
3234
  },
3203
3235
  validator: {
3204
3236
  input: z.uuid(),
@@ -3213,7 +3245,7 @@ const getPaymentTables = (options) => {
3213
3245
  references: {
3214
3246
  model: "customer",
3215
3247
  field: "id",
3216
- onDelete: "cascade"
3248
+ onDelete: "restrict"
3217
3249
  },
3218
3250
  validator: {
3219
3251
  input: z.uuid(),
@@ -3256,6 +3288,11 @@ const getPaymentTables = (options) => {
3256
3288
  type: "string",
3257
3289
  fieldName: "reversed_by_id",
3258
3290
  required: false,
3291
+ references: {
3292
+ model: "transaction",
3293
+ field: "id",
3294
+ onDelete: "set null"
3295
+ },
3259
3296
  validator: {
3260
3297
  input: z.uuid().optional(),
3261
3298
  output: z.uuid().optional()
@@ -3346,7 +3383,23 @@ const getPaymentTables = (options) => {
3346
3383
  model: "transaction",
3347
3384
  foreignKey: "reversedById"
3348
3385
  }
3349
- }
3386
+ },
3387
+ invariants: [{
3388
+ id: "transaction_payment_intent_customer_consistency",
3389
+ description: "transaction.customerId must match the customerId of its paymentIntentId: payment_intent.customerId must equal transaction.customerId",
3390
+ appliesTo: [
3391
+ "postgres",
3392
+ "mongo",
3393
+ "mysql",
3394
+ "sqlite"
3395
+ ],
3396
+ enforcement: {
3397
+ postgres: "trigger",
3398
+ mongo: "app",
3399
+ mysql: "trigger",
3400
+ sqlite: "trigger"
3401
+ }
3402
+ }]
3350
3403
  },
3351
3404
  scheduledTask: {
3352
3405
  modelName: "scheduled_task",
@@ -230,6 +230,22 @@ type PecuniaDBSchema = Record<string, {
230
230
  foreignKey: string;
231
231
  };
232
232
  };
233
+ /**
234
+ * Declarative invariants that must be enforced at the application level.
235
+ * These are cross-table or conditional rules that cannot be fully expressed
236
+ * in portable schema constraints (especially for MongoDB).
237
+ */
238
+ invariants?: Array<{
239
+ id: string;
240
+ description: string;
241
+ appliesTo: Array<"postgres" | "mongo" | "mysql" | "sqlite">;
242
+ enforcement?: {
243
+ postgres?: "check" | "trigger";
244
+ mongo?: "validator" | "app";
245
+ mysql?: "check" | "trigger";
246
+ sqlite?: "check" | "trigger";
247
+ };
248
+ }>;
233
249
  }>;
234
250
  //#endregion
235
251
  //#region src/db/constant/index.d.ts
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as WebHookEventStatus, $t as KyselyDatabaseDialectType, A as CheckoutSessionStatus, At as RequestState, B as PricingModel, Bt as ErrorDefinition, C as AdapterFactoryOptions, Ct as initGetFieldAttributes, D as AuditAction, Dt as getCurrentDBAdapterAsyncLocalStorage, E as Actor, Et as getCurrentAdapter, F as InvoiceStatus, Ft as hasRequestState, G as ScheduledTaskStatus, Gt as IndexableRegistry, H as ProrationBehavior, Ht as ErrorMap, I as LedgerEntryType, It as runWithRequestState, J as TransactionStatus, Jt as HookEndpointContext, K as ScheduledTaskType, Kt as ProviderErrorCode, L as PaymentIntentStatus, Lt as getCurrentAuthContext, M as Currency, Mt as defineRequestState, N as DiscountType, Nt as getCurrentRequestState, O as BillingInterval, Ot as runWithAdapter, P as ERROR_REGISTRY, Pt as getRequestStateAsyncLocalStorage, Q as WebHookDeliveryTrigger, Qt as createPecuniaEndpoint, R as PaymentProviders, Rt as getCurrentPaymentContextAsyncLocalStorage, S as AdapterFactoryCreator, St as initGetFieldName, T as AccountType, Tt as initGetDefaultFieldName, U as ProviderId, Ut as ErrorResponse, V as ProductType, Vt as ErrorDefinitionResponse, W as ScheduleStatus, Wt as ErrorType, X as UsageAction, Xt as PecuniaEndpoint, Y as TransactionType, Yt as PecuniaPlugin, Z as UsageAggregation, Zt as PecuniaMiddleware, _ as ProviderAdapter, _t as discountSchema, a as useMiddleware, an as DBPrimitive, at as getPaymentTables, b as AdapterFactory, bt as initGetModelName, c as SenlyContext, cn as ModelNames, ct as Subscription, d as DBAdapterDebugLogOption, dn as Primitive, dt as sharedDeletableSchema, en as Awaitable, et as statusCodes, f as DBAdapterFactoryConfig, fn as StandardSchemaV1, ft as Product, g as InternalAdapter, gt as Discount, h as DBTransactionAdapter, ht as priceSchema, i as optionsMiddleware, in as DBFieldType, it as createProviderError, j as CollectionMethod, jt as RequestStateWeakMap, k as CheckoutSessionMode, kt as runWithTransaction, l as CustomAdapter, ln as PecuniaDBSchema, lt as subscriptionSchema, m as DBAdapterSchemaCreation, mt as Price, n as createPaymentEndpoint, nn as DBFieldAttribute, nt as PecuniaError, o as GenericEndpointContext, on as LiteralString, ot as deepmerge, p as DBAdapterInstance, pt as productSchema, q as SubscriptionStatus, qt as PecuniaOptions, r as createPecuniaMiddleware, rn as DBFieldAttributeConfig, rt as ValidationError, s as PecuniaContext, sn as LiteralUnion, st as withApplyDefault, t as PaymentMiddleware, tn as BaseModelNames, tt as ApiError, u as DBAdapter, un as Prettify, ut as sharedCoreSchema, v as RequiredWhere, vt as Customer, w as createAdapterFactory, wt as initGetDefaultModelName, x as AdapterFactoryConfig, xt as initGetIdField, y as Where, yt as customerSchema, z as PriceType, zt as runWithEndpointContext } from "./index-r-9XcDEa.mjs";
1
+ import { $ as WebHookEventStatus, $t as KyselyDatabaseDialectType, A as CheckoutSessionStatus, At as RequestState, B as PricingModel, Bt as ErrorDefinition, C as AdapterFactoryOptions, Ct as initGetFieldAttributes, D as AuditAction, Dt as getCurrentDBAdapterAsyncLocalStorage, E as Actor, Et as getCurrentAdapter, F as InvoiceStatus, Ft as hasRequestState, G as ScheduledTaskStatus, Gt as IndexableRegistry, H as ProrationBehavior, Ht as ErrorMap, I as LedgerEntryType, It as runWithRequestState, J as TransactionStatus, Jt as HookEndpointContext, K as ScheduledTaskType, Kt as ProviderErrorCode, L as PaymentIntentStatus, Lt as getCurrentAuthContext, M as Currency, Mt as defineRequestState, N as DiscountType, Nt as getCurrentRequestState, O as BillingInterval, Ot as runWithAdapter, P as ERROR_REGISTRY, Pt as getRequestStateAsyncLocalStorage, Q as WebHookDeliveryTrigger, Qt as createPecuniaEndpoint, R as PaymentProviders, Rt as getCurrentPaymentContextAsyncLocalStorage, S as AdapterFactoryCreator, St as initGetFieldName, T as AccountType, Tt as initGetDefaultFieldName, U as ProviderId, Ut as ErrorResponse, V as ProductType, Vt as ErrorDefinitionResponse, W as ScheduleStatus, Wt as ErrorType, X as UsageAction, Xt as PecuniaEndpoint, Y as TransactionType, Yt as PecuniaPlugin, Z as UsageAggregation, Zt as PecuniaMiddleware, _ as ProviderAdapter, _t as discountSchema, a as useMiddleware, an as DBPrimitive, at as getPaymentTables, b as AdapterFactory, bt as initGetModelName, c as SenlyContext, cn as ModelNames, ct as Subscription, d as DBAdapterDebugLogOption, dn as Primitive, dt as sharedDeletableSchema, en as Awaitable, et as statusCodes, f as DBAdapterFactoryConfig, fn as StandardSchemaV1, ft as Product, g as InternalAdapter, gt as Discount, h as DBTransactionAdapter, ht as priceSchema, i as optionsMiddleware, in as DBFieldType, it as createProviderError, j as CollectionMethod, jt as RequestStateWeakMap, k as CheckoutSessionMode, kt as runWithTransaction, l as CustomAdapter, ln as PecuniaDBSchema, lt as subscriptionSchema, m as DBAdapterSchemaCreation, mt as Price, n as createPaymentEndpoint, nn as DBFieldAttribute, nt as PecuniaError, o as GenericEndpointContext, on as LiteralString, ot as deepmerge, p as DBAdapterInstance, pt as productSchema, q as SubscriptionStatus, qt as PecuniaOptions, r as createPecuniaMiddleware, rn as DBFieldAttributeConfig, rt as ValidationError, s as PecuniaContext, sn as LiteralUnion, st as withApplyDefault, t as PaymentMiddleware, tn as BaseModelNames, tt as ApiError, u as DBAdapter, un as Prettify, ut as sharedCoreSchema, v as RequiredWhere, vt as Customer, w as createAdapterFactory, wt as initGetDefaultModelName, x as AdapterFactoryConfig, xt as initGetIdField, y as Where, yt as customerSchema, z as PriceType, zt as runWithEndpointContext } from "./index-CRH0tJ5D.mjs";
2
2
  import { n as getAsyncLocalStorage, t as AsyncLocalStorage } from "./index-BmnRSwr6.mjs";
3
3
  import { _ as isTest, a as TTY_COLORS, c as logger, d as EnvObject, f as env, g as isProduction, h as isDevelopment, i as Logger, l as shouldPublishLog, m as getEnvVar, n as LogHandlerParams, o as createLogger, p as getBooleanEnvVar, r as LogLevel, s as levels, t as InternalLogger, u as ENV, v as nodeENV, y as getColorDepth } from "./index-uCXA11o-.mjs";
4
4
  import { n as safeJSONParse, r as generateId, t as capitalizeFirstLetter } from "./index-DYRZgwpi.mjs";
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { a as defineRequestState, c as hasRequestState, d as getCurrentPaymentCo
2
2
  import { t as getAsyncLocalStorage } from "./async_hooks-D8vqDJIk.mjs";
3
3
  import { i as useMiddleware, n as createPecuniaMiddleware, r as optionsMiddleware, t as createPaymentEndpoint } from "./api-BlJV5ZQo.mjs";
4
4
  import { A as UsageAggregation, C as ScheduleStatus, D as TransactionStatus, E as SubscriptionStatus, M as WebHookEventStatus, N as statusCodes, O as TransactionType, P as ErrorType, S as ProrationBehavior, T as ScheduledTaskType, _ as PaymentIntentStatus, a as AccountType, b as PricingModel, c as BillingInterval, d as CollectionMethod, f as Currency, g as LedgerEntryType, h as InvoiceStatus, i as createProviderError, j as WebHookDeliveryTrigger, k as UsageAction, l as CheckoutSessionMode, m as ERROR_REGISTRY, n as PecuniaError, o as Actor, p as DiscountType, r as ValidationError, s as AuditAction, t as ApiError, u as CheckoutSessionStatus, v as PaymentProviders, w as ScheduledTaskStatus, x as ProductType, y as PriceType } from "./errors-vpD21Iku.mjs";
5
- import { a as initGetFieldAttributes, c as initGetDefaultModelName, i as initGetModelName, n as deepmerge, o as initGetIdField, r as withApplyDefault, s as initGetDefaultFieldName, t as getPaymentTables } from "./get-payment-tables-D4gd0O5X.mjs";
5
+ import { a as initGetFieldAttributes, c as initGetDefaultModelName, i as initGetModelName, n as deepmerge, o as initGetIdField, r as withApplyDefault, s as initGetDefaultFieldName, t as getPaymentTables } from "./get-payment-tables-0kpYs4ZQ.mjs";
6
6
  import { t as generateId } from "./generate-id-D3ZvbbXn.mjs";
7
7
  import { customerSchema, discountSchema, initGetFieldName, priceSchema, productSchema, sharedCoreSchema, sharedDeletableSchema, subscriptionSchema } from "./db/index.mjs";
8
8
  import { a as shouldPublishLog, c as env, d as isDevelopment, f as isProduction, i as logger, l as getBooleanEnvVar, m as nodeENV, n as createLogger, o as getColorDepth, p as isTest, r as levels, s as ENV, t as TTY_COLORS, u as getEnvVar } from "./env-ChlcfGdT.mjs";
@@ -1,2 +1,2 @@
1
- import { Bt as ErrorDefinition, C as AdapterFactoryOptions, Gt as IndexableRegistry, Ht as ErrorMap, Jt as HookEndpointContext, Kt as ProviderErrorCode, Qt as createPecuniaEndpoint, S as AdapterFactoryCreator, Ut as ErrorResponse, Vt as ErrorDefinitionResponse, Wt as ErrorType, Xt as PecuniaEndpoint, Yt as PecuniaPlugin, Zt as PecuniaMiddleware, _ as ProviderAdapter, an as DBPrimitive, b as AdapterFactory, c as SenlyContext, cn as ModelNames, d as DBAdapterDebugLogOption, dn as Primitive, en as Awaitable, f as DBAdapterFactoryConfig, fn as StandardSchemaV1, g as InternalAdapter, h as DBTransactionAdapter, in as DBFieldType, l as CustomAdapter, ln as PecuniaDBSchema, m as DBAdapterSchemaCreation, nn as DBFieldAttribute, o as GenericEndpointContext, on as LiteralString, p as DBAdapterInstance, qt as PecuniaOptions, rn as DBFieldAttributeConfig, s as PecuniaContext, sn as LiteralUnion, tn as BaseModelNames, u as DBAdapter, un as Prettify, v as RequiredWhere, w as createAdapterFactory, x as AdapterFactoryConfig, y as Where } from "../index-r-9XcDEa.mjs";
1
+ import { Bt as ErrorDefinition, C as AdapterFactoryOptions, Gt as IndexableRegistry, Ht as ErrorMap, Jt as HookEndpointContext, Kt as ProviderErrorCode, Qt as createPecuniaEndpoint, S as AdapterFactoryCreator, Ut as ErrorResponse, Vt as ErrorDefinitionResponse, Wt as ErrorType, Xt as PecuniaEndpoint, Yt as PecuniaPlugin, Zt as PecuniaMiddleware, _ as ProviderAdapter, an as DBPrimitive, b as AdapterFactory, c as SenlyContext, cn as ModelNames, d as DBAdapterDebugLogOption, dn as Primitive, en as Awaitable, f as DBAdapterFactoryConfig, fn as StandardSchemaV1, g as InternalAdapter, h as DBTransactionAdapter, in as DBFieldType, l as CustomAdapter, ln as PecuniaDBSchema, m as DBAdapterSchemaCreation, nn as DBFieldAttribute, o as GenericEndpointContext, on as LiteralString, p as DBAdapterInstance, qt as PecuniaOptions, rn as DBFieldAttributeConfig, s as PecuniaContext, sn as LiteralUnion, tn as BaseModelNames, u as DBAdapter, un as Prettify, v as RequiredWhere, w as createAdapterFactory, x as AdapterFactoryConfig, y as Where } from "../index-CRH0tJ5D.mjs";
2
2
  export { AdapterFactory, AdapterFactoryConfig, AdapterFactoryCreator, AdapterFactoryOptions, Awaitable, BaseModelNames, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, DBTransactionAdapter, ErrorDefinition, ErrorDefinitionResponse, ErrorMap, ErrorResponse, ErrorType, GenericEndpointContext, HookEndpointContext, IndexableRegistry, InternalAdapter, LiteralString, LiteralUnion, ModelNames, PecuniaContext, PecuniaDBSchema, PecuniaEndpoint, PecuniaMiddleware, PecuniaOptions, PecuniaPlugin, Prettify, Primitive, ProviderAdapter, ProviderErrorCode, RequiredWhere, SenlyContext, StandardSchemaV1, Where, createAdapterFactory, createPecuniaEndpoint };
@@ -2,7 +2,7 @@ import { f as runWithEndpointContext } from "../context-COLduJme.mjs";
2
2
  import "../async_hooks-D8vqDJIk.mjs";
3
3
  import { i as useMiddleware } from "../api-BlJV5ZQo.mjs";
4
4
  import { P as ErrorType, n as PecuniaError } from "../errors-vpD21Iku.mjs";
5
- import { a as initGetFieldAttributes, c as initGetDefaultModelName, i as initGetModelName, o as initGetIdField, r as withApplyDefault, s as initGetDefaultFieldName, t as getPaymentTables } from "../get-payment-tables-D4gd0O5X.mjs";
5
+ import { a as initGetFieldAttributes, c as initGetDefaultModelName, i as initGetModelName, o as initGetIdField, r as withApplyDefault, s as initGetDefaultFieldName, t as getPaymentTables } from "../get-payment-tables-0kpYs4ZQ.mjs";
6
6
  import "../generate-id-D3ZvbbXn.mjs";
7
7
  import "../env-ChlcfGdT.mjs";
8
8
  import { n as safeJSONParse } from "../utils-BtfYqMRX.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pecunia-core",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.mjs",