pecunia-core 0.1.3 → 0.1.5

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-CRH0tJ5D.mjs";
1
+ import { a as useMiddleware, i as optionsMiddleware, n as createPaymentEndpoint, r as createPecuniaMiddleware, t as PaymentMiddleware } from "../index-r-9XcDEa.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-CRH0tJ5D.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-r-9XcDEa.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-CRH0tJ5D.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-r-9XcDEa.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-BTtVmaat.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-CSlXJo4B.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-CRH0tJ5D.mjs";
1
+ import { it as createProviderError, nt as PecuniaError, rt as ValidationError, tt as ApiError } from "../index-r-9XcDEa.mjs";
2
2
  export { ApiError, PecuniaError, ValidationError, createProviderError };
@@ -291,22 +291,6 @@ 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
- }],
310
294
  order: 1
311
295
  },
312
296
  idempotency_key: {
@@ -461,7 +445,7 @@ const getPaymentTables = (options) => {
461
445
  references: {
462
446
  model: "customer",
463
447
  field: "id",
464
- onDelete: "cascade"
448
+ onDelete: "restrict"
465
449
  }
466
450
  },
467
451
  metadata: {
@@ -696,7 +680,7 @@ const getPaymentTables = (options) => {
696
680
  references: {
697
681
  model: "products",
698
682
  field: "id",
699
- onDelete: "cascade"
683
+ onDelete: "set null"
700
684
  },
701
685
  validator: {
702
686
  input: z.uuid().optional(),
@@ -902,7 +886,7 @@ const getPaymentTables = (options) => {
902
886
  references: {
903
887
  model: "subscription_item",
904
888
  field: "id",
905
- onDelete: "cascade"
889
+ onDelete: "restrict"
906
890
  },
907
891
  validator: {
908
892
  input: z.uuid().optional(),
@@ -1001,7 +985,7 @@ const getPaymentTables = (options) => {
1001
985
  references: {
1002
986
  model: "customer",
1003
987
  field: "id",
1004
- onDelete: "cascade"
988
+ onDelete: "restrict"
1005
989
  },
1006
990
  validator: {
1007
991
  input: z.uuid(),
@@ -1284,7 +1268,7 @@ const getPaymentTables = (options) => {
1284
1268
  references: {
1285
1269
  model: "subscription",
1286
1270
  field: "id",
1287
- onDelete: "cascade"
1271
+ onDelete: "restrict"
1288
1272
  },
1289
1273
  validator: {
1290
1274
  input: z.uuid(),
@@ -1299,7 +1283,7 @@ const getPaymentTables = (options) => {
1299
1283
  references: {
1300
1284
  model: "prices",
1301
1285
  field: "id",
1302
- onDelete: "cascade"
1286
+ onDelete: "restrict"
1303
1287
  },
1304
1288
  validator: {
1305
1289
  input: z.uuid(),
@@ -1425,7 +1409,7 @@ const getPaymentTables = (options) => {
1425
1409
  references: {
1426
1410
  model: "subscription",
1427
1411
  field: "id",
1428
- onDelete: "cascade"
1412
+ onDelete: "restrict"
1429
1413
  },
1430
1414
  validator: {
1431
1415
  input: z.uuid(),
@@ -1559,7 +1543,7 @@ const getPaymentTables = (options) => {
1559
1543
  references: {
1560
1544
  model: "customer",
1561
1545
  field: "id",
1562
- onDelete: "cascade"
1546
+ onDelete: "restrict"
1563
1547
  },
1564
1548
  validator: {
1565
1549
  input: z.uuid().optional(),
@@ -1574,7 +1558,7 @@ const getPaymentTables = (options) => {
1574
1558
  references: {
1575
1559
  model: "subscription",
1576
1560
  field: "id",
1577
- onDelete: "cascade"
1561
+ onDelete: "set null"
1578
1562
  },
1579
1563
  validator: {
1580
1564
  input: z.uuid().optional(),
@@ -1952,7 +1936,7 @@ const getPaymentTables = (options) => {
1952
1936
  references: {
1953
1937
  model: "invoice",
1954
1938
  field: "id",
1955
- onDelete: "cascade"
1939
+ onDelete: "restrict"
1956
1940
  },
1957
1941
  validator: {
1958
1942
  input: z.uuid(),
@@ -1967,7 +1951,7 @@ const getPaymentTables = (options) => {
1967
1951
  references: {
1968
1952
  model: "prices",
1969
1953
  field: "id",
1970
- onDelete: "cascade"
1954
+ onDelete: "set null"
1971
1955
  },
1972
1956
  validator: {
1973
1957
  input: z.uuid().optional(),
@@ -2264,7 +2248,7 @@ const getPaymentTables = (options) => {
2264
2248
  references: {
2265
2249
  model: "event",
2266
2250
  field: "id",
2267
- onDelete: "cascade"
2251
+ onDelete: "restrict"
2268
2252
  },
2269
2253
  validator: {
2270
2254
  input: z.uuid(),
@@ -2650,7 +2634,7 @@ const getPaymentTables = (options) => {
2650
2634
  references: {
2651
2635
  model: "checkout_session",
2652
2636
  field: "id",
2653
- onDelete: "cascade"
2637
+ onDelete: "restrict"
2654
2638
  },
2655
2639
  validator: {
2656
2640
  input: z.uuid(),
@@ -2665,7 +2649,7 @@ const getPaymentTables = (options) => {
2665
2649
  references: {
2666
2650
  model: "event",
2667
2651
  field: "id",
2668
- onDelete: "cascade"
2652
+ onDelete: "restrict"
2669
2653
  },
2670
2654
  validator: {
2671
2655
  input: z.uuid(),
@@ -2762,7 +2746,7 @@ const getPaymentTables = (options) => {
2762
2746
  references: {
2763
2747
  model: "customer",
2764
2748
  field: "id",
2765
- onDelete: "cascade"
2749
+ onDelete: "restrict"
2766
2750
  },
2767
2751
  validator: {
2768
2752
  input: z.uuid(),
@@ -2787,7 +2771,7 @@ const getPaymentTables = (options) => {
2787
2771
  references: {
2788
2772
  model: "payment_intent",
2789
2773
  field: "id",
2790
- onDelete: "cascade"
2774
+ onDelete: "restrict"
2791
2775
  },
2792
2776
  validator: {
2793
2777
  input: z.uuid(),
@@ -2802,7 +2786,7 @@ const getPaymentTables = (options) => {
2802
2786
  references: {
2803
2787
  model: "subscription",
2804
2788
  field: "id",
2805
- onDelete: "cascade"
2789
+ onDelete: "set null"
2806
2790
  },
2807
2791
  validator: {
2808
2792
  input: z.uuid().optional(),
@@ -2888,23 +2872,7 @@ const getPaymentTables = (options) => {
2888
2872
  model: "subscription",
2889
2873
  foreignKey: "subscriptionId"
2890
2874
  }
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
- }]
2875
+ }
2908
2876
  },
2909
2877
  paymentIntent: {
2910
2878
  modelName: "payment_intent",
@@ -3011,7 +2979,7 @@ const getPaymentTables = (options) => {
3011
2979
  references: {
3012
2980
  model: "customer",
3013
2981
  field: "id",
3014
- onDelete: "cascade"
2982
+ onDelete: "restrict"
3015
2983
  },
3016
2984
  validator: {
3017
2985
  input: z.uuid(),
@@ -3026,7 +2994,7 @@ const getPaymentTables = (options) => {
3026
2994
  references: {
3027
2995
  model: "subscription",
3028
2996
  field: "id",
3029
- onDelete: "cascade"
2997
+ onDelete: "set null"
3030
2998
  },
3031
2999
  validator: {
3032
3000
  input: z.uuid().optional(),
@@ -3041,7 +3009,7 @@ const getPaymentTables = (options) => {
3041
3009
  references: {
3042
3010
  model: "invoice",
3043
3011
  field: "id",
3044
- onDelete: "cascade"
3012
+ onDelete: "restrict"
3045
3013
  },
3046
3014
  validator: {
3047
3015
  input: z.uuid(),
@@ -3230,7 +3198,7 @@ const getPaymentTables = (options) => {
3230
3198
  references: {
3231
3199
  model: "payment_intent",
3232
3200
  field: "id",
3233
- onDelete: "cascade"
3201
+ onDelete: "restrict"
3234
3202
  },
3235
3203
  validator: {
3236
3204
  input: z.uuid(),
@@ -3245,7 +3213,7 @@ const getPaymentTables = (options) => {
3245
3213
  references: {
3246
3214
  model: "customer",
3247
3215
  field: "id",
3248
- onDelete: "cascade"
3216
+ onDelete: "restrict"
3249
3217
  },
3250
3218
  validator: {
3251
3219
  input: z.uuid(),
@@ -3288,6 +3256,11 @@ const getPaymentTables = (options) => {
3288
3256
  type: "string",
3289
3257
  fieldName: "reversed_by_id",
3290
3258
  required: false,
3259
+ references: {
3260
+ model: "transaction",
3261
+ field: "id",
3262
+ onDelete: "set null"
3263
+ },
3291
3264
  validator: {
3292
3265
  input: z.uuid().optional(),
3293
3266
  output: z.uuid().optional()
@@ -3378,23 +3351,7 @@ const getPaymentTables = (options) => {
3378
3351
  model: "transaction",
3379
3352
  foreignKey: "reversedById"
3380
3353
  }
3381
- },
3382
- invariants: [{
3383
- id: "transaction_payment_intent_customer_consistency",
3384
- description: "transaction.customerId must match the customerId of its paymentIntentId: payment_intent.customerId must equal transaction.customerId",
3385
- appliesTo: [
3386
- "postgres",
3387
- "mongo",
3388
- "mysql",
3389
- "sqlite"
3390
- ],
3391
- enforcement: {
3392
- postgres: "trigger",
3393
- mongo: "app",
3394
- mysql: "trigger",
3395
- sqlite: "trigger"
3396
- }
3397
- }]
3354
+ }
3398
3355
  },
3399
3356
  scheduledTask: {
3400
3357
  modelName: "scheduled_task",
@@ -230,22 +230,6 @@ 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
- }>;
249
233
  }>;
250
234
  //#endregion
251
235
  //#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-CRH0tJ5D.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-r-9XcDEa.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-BTtVmaat.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-CSlXJo4B.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-CRH0tJ5D.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-r-9XcDEa.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-BTtVmaat.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-CSlXJo4B.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.3",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.mjs",