pecunia-core 0.1.3 → 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.
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-0kpYs4ZQ.mjs";
3
3
  import "../generate-id-D3ZvbbXn.mjs";
4
4
  import z$1, { z } from "zod";
5
5
 
@@ -461,7 +461,7 @@ const getPaymentTables = (options) => {
461
461
  references: {
462
462
  model: "customer",
463
463
  field: "id",
464
- onDelete: "cascade"
464
+ onDelete: "restrict"
465
465
  }
466
466
  },
467
467
  metadata: {
@@ -696,7 +696,7 @@ const getPaymentTables = (options) => {
696
696
  references: {
697
697
  model: "products",
698
698
  field: "id",
699
- onDelete: "cascade"
699
+ onDelete: "set null"
700
700
  },
701
701
  validator: {
702
702
  input: z.uuid().optional(),
@@ -902,7 +902,7 @@ const getPaymentTables = (options) => {
902
902
  references: {
903
903
  model: "subscription_item",
904
904
  field: "id",
905
- onDelete: "cascade"
905
+ onDelete: "restrict"
906
906
  },
907
907
  validator: {
908
908
  input: z.uuid().optional(),
@@ -1001,7 +1001,7 @@ const getPaymentTables = (options) => {
1001
1001
  references: {
1002
1002
  model: "customer",
1003
1003
  field: "id",
1004
- onDelete: "cascade"
1004
+ onDelete: "restrict"
1005
1005
  },
1006
1006
  validator: {
1007
1007
  input: z.uuid(),
@@ -1284,7 +1284,7 @@ const getPaymentTables = (options) => {
1284
1284
  references: {
1285
1285
  model: "subscription",
1286
1286
  field: "id",
1287
- onDelete: "cascade"
1287
+ onDelete: "restrict"
1288
1288
  },
1289
1289
  validator: {
1290
1290
  input: z.uuid(),
@@ -1299,7 +1299,7 @@ const getPaymentTables = (options) => {
1299
1299
  references: {
1300
1300
  model: "prices",
1301
1301
  field: "id",
1302
- onDelete: "cascade"
1302
+ onDelete: "restrict"
1303
1303
  },
1304
1304
  validator: {
1305
1305
  input: z.uuid(),
@@ -1425,7 +1425,7 @@ const getPaymentTables = (options) => {
1425
1425
  references: {
1426
1426
  model: "subscription",
1427
1427
  field: "id",
1428
- onDelete: "cascade"
1428
+ onDelete: "restrict"
1429
1429
  },
1430
1430
  validator: {
1431
1431
  input: z.uuid(),
@@ -1559,7 +1559,7 @@ const getPaymentTables = (options) => {
1559
1559
  references: {
1560
1560
  model: "customer",
1561
1561
  field: "id",
1562
- onDelete: "cascade"
1562
+ onDelete: "restrict"
1563
1563
  },
1564
1564
  validator: {
1565
1565
  input: z.uuid().optional(),
@@ -1574,7 +1574,7 @@ const getPaymentTables = (options) => {
1574
1574
  references: {
1575
1575
  model: "subscription",
1576
1576
  field: "id",
1577
- onDelete: "cascade"
1577
+ onDelete: "set null"
1578
1578
  },
1579
1579
  validator: {
1580
1580
  input: z.uuid().optional(),
@@ -1952,7 +1952,7 @@ const getPaymentTables = (options) => {
1952
1952
  references: {
1953
1953
  model: "invoice",
1954
1954
  field: "id",
1955
- onDelete: "cascade"
1955
+ onDelete: "restrict"
1956
1956
  },
1957
1957
  validator: {
1958
1958
  input: z.uuid(),
@@ -1967,7 +1967,7 @@ const getPaymentTables = (options) => {
1967
1967
  references: {
1968
1968
  model: "prices",
1969
1969
  field: "id",
1970
- onDelete: "cascade"
1970
+ onDelete: "set null"
1971
1971
  },
1972
1972
  validator: {
1973
1973
  input: z.uuid().optional(),
@@ -2264,7 +2264,7 @@ const getPaymentTables = (options) => {
2264
2264
  references: {
2265
2265
  model: "event",
2266
2266
  field: "id",
2267
- onDelete: "cascade"
2267
+ onDelete: "restrict"
2268
2268
  },
2269
2269
  validator: {
2270
2270
  input: z.uuid(),
@@ -2650,7 +2650,7 @@ const getPaymentTables = (options) => {
2650
2650
  references: {
2651
2651
  model: "checkout_session",
2652
2652
  field: "id",
2653
- onDelete: "cascade"
2653
+ onDelete: "restrict"
2654
2654
  },
2655
2655
  validator: {
2656
2656
  input: z.uuid(),
@@ -2665,7 +2665,7 @@ const getPaymentTables = (options) => {
2665
2665
  references: {
2666
2666
  model: "event",
2667
2667
  field: "id",
2668
- onDelete: "cascade"
2668
+ onDelete: "restrict"
2669
2669
  },
2670
2670
  validator: {
2671
2671
  input: z.uuid(),
@@ -2762,7 +2762,7 @@ const getPaymentTables = (options) => {
2762
2762
  references: {
2763
2763
  model: "customer",
2764
2764
  field: "id",
2765
- onDelete: "cascade"
2765
+ onDelete: "restrict"
2766
2766
  },
2767
2767
  validator: {
2768
2768
  input: z.uuid(),
@@ -2787,7 +2787,7 @@ const getPaymentTables = (options) => {
2787
2787
  references: {
2788
2788
  model: "payment_intent",
2789
2789
  field: "id",
2790
- onDelete: "cascade"
2790
+ onDelete: "restrict"
2791
2791
  },
2792
2792
  validator: {
2793
2793
  input: z.uuid(),
@@ -2802,7 +2802,7 @@ const getPaymentTables = (options) => {
2802
2802
  references: {
2803
2803
  model: "subscription",
2804
2804
  field: "id",
2805
- onDelete: "cascade"
2805
+ onDelete: "set null"
2806
2806
  },
2807
2807
  validator: {
2808
2808
  input: z.uuid().optional(),
@@ -3011,7 +3011,7 @@ const getPaymentTables = (options) => {
3011
3011
  references: {
3012
3012
  model: "customer",
3013
3013
  field: "id",
3014
- onDelete: "cascade"
3014
+ onDelete: "restrict"
3015
3015
  },
3016
3016
  validator: {
3017
3017
  input: z.uuid(),
@@ -3026,7 +3026,7 @@ const getPaymentTables = (options) => {
3026
3026
  references: {
3027
3027
  model: "subscription",
3028
3028
  field: "id",
3029
- onDelete: "cascade"
3029
+ onDelete: "set null"
3030
3030
  },
3031
3031
  validator: {
3032
3032
  input: z.uuid().optional(),
@@ -3041,7 +3041,7 @@ const getPaymentTables = (options) => {
3041
3041
  references: {
3042
3042
  model: "invoice",
3043
3043
  field: "id",
3044
- onDelete: "cascade"
3044
+ onDelete: "restrict"
3045
3045
  },
3046
3046
  validator: {
3047
3047
  input: z.uuid(),
@@ -3230,7 +3230,7 @@ const getPaymentTables = (options) => {
3230
3230
  references: {
3231
3231
  model: "payment_intent",
3232
3232
  field: "id",
3233
- onDelete: "cascade"
3233
+ onDelete: "restrict"
3234
3234
  },
3235
3235
  validator: {
3236
3236
  input: z.uuid(),
@@ -3245,7 +3245,7 @@ const getPaymentTables = (options) => {
3245
3245
  references: {
3246
3246
  model: "customer",
3247
3247
  field: "id",
3248
- onDelete: "cascade"
3248
+ onDelete: "restrict"
3249
3249
  },
3250
3250
  validator: {
3251
3251
  input: z.uuid(),
@@ -3288,6 +3288,11 @@ const getPaymentTables = (options) => {
3288
3288
  type: "string",
3289
3289
  fieldName: "reversed_by_id",
3290
3290
  required: false,
3291
+ references: {
3292
+ model: "transaction",
3293
+ field: "id",
3294
+ onDelete: "set null"
3295
+ },
3291
3296
  validator: {
3292
3297
  input: z.uuid().optional(),
3293
3298
  output: z.uuid().optional()
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-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";
@@ -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-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.3",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.mjs",