pecunia-core 0.0.6 → 0.0.8

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-CAAnHVns.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-B_sQzTUV.mjs";
3
3
  import "../generate-id-D3ZvbbXn.mjs";
4
4
  import z$1, { z } from "zod";
5
5
 
@@ -194,7 +194,6 @@ const getPaymentTables = (options) => {
194
194
  type: "string",
195
195
  required: true,
196
196
  fieldName: "id",
197
- unique: true,
198
197
  sortable: true
199
198
  },
200
199
  phoneNumber: {
@@ -223,7 +222,7 @@ const getPaymentTables = (options) => {
223
222
  unique: true
224
223
  },
225
224
  paymentMethodId: {
226
- type: "uuid",
225
+ type: "string",
227
226
  required: false,
228
227
  fieldName: "paymentMethodId",
229
228
  references: {
@@ -304,7 +303,6 @@ const getPaymentTables = (options) => {
304
303
  required: true,
305
304
  input: false,
306
305
  returned: true,
307
- unique: true,
308
306
  validator: { output: z.uuid() }
309
307
  },
310
308
  key: {
@@ -397,12 +395,11 @@ const getPaymentTables = (options) => {
397
395
  order: 2,
398
396
  fields: {
399
397
  id: {
400
- type: "uuid",
398
+ type: "string",
401
399
  fieldName: "id",
402
400
  required: true,
403
401
  input: false,
404
402
  returned: true,
405
- unique: true,
406
403
  validator: { output: z.uuid() }
407
404
  },
408
405
  phone: {
@@ -437,7 +434,7 @@ const getPaymentTables = (options) => {
437
434
  }
438
435
  },
439
436
  customerId: {
440
- type: "uuid",
437
+ type: "string",
441
438
  fieldName: "customer_id",
442
439
  required: true,
443
440
  index: true,
@@ -512,12 +509,11 @@ const getPaymentTables = (options) => {
512
509
  order: 1,
513
510
  fields: {
514
511
  id: {
515
- type: "uuid",
512
+ type: "string",
516
513
  fieldName: "id",
517
514
  required: true,
518
515
  input: false,
519
516
  returned: true,
520
- unique: true,
521
517
  validator: { output: z.uuid() }
522
518
  },
523
519
  type: {
@@ -552,7 +548,7 @@ const getPaymentTables = (options) => {
552
548
  }
553
549
  },
554
550
  defaultPriceId: {
555
- type: "uuid",
551
+ type: "string",
556
552
  fieldName: "default_price_id",
557
553
  required: false,
558
554
  references: {
@@ -670,16 +666,15 @@ const getPaymentTables = (options) => {
670
666
  order: 1,
671
667
  fields: {
672
668
  id: {
673
- type: "uuid",
669
+ type: "string",
674
670
  fieldName: "id",
675
671
  required: true,
676
672
  input: false,
677
673
  returned: true,
678
- unique: true,
679
674
  validator: { output: z.uuid() }
680
675
  },
681
676
  productId: {
682
- type: "uuid",
677
+ type: "string",
683
678
  fieldName: "product_id",
684
679
  required: false,
685
680
  references: {
@@ -877,16 +872,15 @@ const getPaymentTables = (options) => {
877
872
  order: 1,
878
873
  fields: {
879
874
  id: {
880
- type: "uuid",
875
+ type: "string",
881
876
  fieldName: "id",
882
877
  required: true,
883
878
  input: false,
884
879
  returned: true,
885
- unique: true,
886
880
  validator: { output: z.uuid() }
887
881
  },
888
882
  subscriptionItemId: {
889
- type: "uuid",
883
+ type: "string",
890
884
  fieldName: "subscription_item_id",
891
885
  required: false,
892
886
  references: {
@@ -977,16 +971,15 @@ const getPaymentTables = (options) => {
977
971
  order: 1,
978
972
  fields: {
979
973
  id: {
980
- type: "uuid",
974
+ type: "string",
981
975
  fieldName: "id",
982
976
  required: true,
983
977
  input: false,
984
978
  returned: true,
985
- unique: true,
986
979
  validator: { output: z.uuid() }
987
980
  },
988
981
  customerId: {
989
- type: "uuid",
982
+ type: "string",
990
983
  fieldName: "customer_id",
991
984
  required: true,
992
985
  references: {
@@ -1001,7 +994,7 @@ const getPaymentTables = (options) => {
1001
994
  index: true
1002
995
  },
1003
996
  paymentMethodId: {
1004
- type: "uuid",
997
+ type: "string",
1005
998
  fieldName: "payment_method_id",
1006
999
  required: false,
1007
1000
  references: {
@@ -1261,16 +1254,15 @@ const getPaymentTables = (options) => {
1261
1254
  order: 1,
1262
1255
  fields: {
1263
1256
  id: {
1264
- type: "uuid",
1257
+ type: "string",
1265
1258
  fieldName: "id",
1266
1259
  required: true,
1267
1260
  input: false,
1268
1261
  returned: true,
1269
- unique: true,
1270
1262
  validator: { output: z.uuid() }
1271
1263
  },
1272
1264
  subscriptionId: {
1273
- type: "uuid",
1265
+ type: "string",
1274
1266
  fieldName: "subscription_id",
1275
1267
  required: false,
1276
1268
  references: {
@@ -1285,7 +1277,7 @@ const getPaymentTables = (options) => {
1285
1277
  index: true
1286
1278
  },
1287
1279
  priceId: {
1288
- type: "uuid",
1280
+ type: "string",
1289
1281
  fieldName: "price_id",
1290
1282
  required: true,
1291
1283
  references: {
@@ -1403,16 +1395,15 @@ const getPaymentTables = (options) => {
1403
1395
  order: 1,
1404
1396
  fields: {
1405
1397
  id: {
1406
- type: "uuid",
1398
+ type: "string",
1407
1399
  fieldName: "id",
1408
1400
  required: true,
1409
1401
  input: false,
1410
1402
  returned: true,
1411
- unique: true,
1412
1403
  validator: { output: z.uuid() }
1413
1404
  },
1414
1405
  subscriptionId: {
1415
- type: "uuid",
1406
+ type: "string",
1416
1407
  fieldName: "subscription_id",
1417
1408
  required: true,
1418
1409
  references: {
@@ -1538,16 +1529,15 @@ const getPaymentTables = (options) => {
1538
1529
  order: 1,
1539
1530
  fields: {
1540
1531
  id: {
1541
- type: "uuid",
1532
+ type: "string",
1542
1533
  fieldName: "id",
1543
1534
  required: true,
1544
1535
  input: false,
1545
1536
  returned: true,
1546
- unique: true,
1547
1537
  validator: { output: z.uuid() }
1548
1538
  },
1549
1539
  customerId: {
1550
- type: "uuid",
1540
+ type: "string",
1551
1541
  fieldName: "customer_id",
1552
1542
  required: false,
1553
1543
  references: {
@@ -1562,7 +1552,7 @@ const getPaymentTables = (options) => {
1562
1552
  index: true
1563
1553
  },
1564
1554
  subscriptionId: {
1565
- type: "uuid",
1555
+ type: "string",
1566
1556
  fieldName: "subscription_id",
1567
1557
  required: false,
1568
1558
  references: {
@@ -1932,16 +1922,15 @@ const getPaymentTables = (options) => {
1932
1922
  order: 1,
1933
1923
  fields: {
1934
1924
  id: {
1935
- type: "uuid",
1925
+ type: "string",
1936
1926
  fieldName: "id",
1937
1927
  required: true,
1938
1928
  input: false,
1939
1929
  returned: true,
1940
- unique: true,
1941
1930
  validator: { output: z.uuid() }
1942
1931
  },
1943
1932
  invoiceId: {
1944
- type: "uuid",
1933
+ type: "string",
1945
1934
  fieldName: "invoice_id",
1946
1935
  required: true,
1947
1936
  references: {
@@ -1956,7 +1945,7 @@ const getPaymentTables = (options) => {
1956
1945
  index: true
1957
1946
  },
1958
1947
  priceId: {
1959
- type: "uuid",
1948
+ type: "string",
1960
1949
  fieldName: "price_id",
1961
1950
  required: false,
1962
1951
  references: {
@@ -2108,12 +2097,11 @@ const getPaymentTables = (options) => {
2108
2097
  order: 1,
2109
2098
  fields: {
2110
2099
  id: {
2111
- type: "uuid",
2100
+ type: "string",
2112
2101
  fieldName: "id",
2113
2102
  required: true,
2114
2103
  input: false,
2115
2104
  returned: true,
2116
- unique: true,
2117
2105
  validator: { output: z.uuid() }
2118
2106
  },
2119
2107
  url: {
@@ -2231,16 +2219,15 @@ const getPaymentTables = (options) => {
2231
2219
  order: 1,
2232
2220
  fields: {
2233
2221
  id: {
2234
- type: "uuid",
2222
+ type: "string",
2235
2223
  fieldName: "id",
2236
2224
  required: true,
2237
2225
  input: false,
2238
2226
  returned: true,
2239
- unique: true,
2240
2227
  validator: { output: z.uuid() }
2241
2228
  },
2242
2229
  endpointId: {
2243
- type: "uuid",
2230
+ type: "string",
2244
2231
  fieldName: "endpoint_id",
2245
2232
  required: true,
2246
2233
  references: {
@@ -2255,7 +2242,7 @@ const getPaymentTables = (options) => {
2255
2242
  index: true
2256
2243
  },
2257
2244
  eventId: {
2258
- type: "uuid",
2245
+ type: "string",
2259
2246
  fieldName: "event_id",
2260
2247
  required: true,
2261
2248
  references: {
@@ -2438,12 +2425,11 @@ const getPaymentTables = (options) => {
2438
2425
  order: 1,
2439
2426
  fields: {
2440
2427
  id: {
2441
- type: "uuid",
2428
+ type: "string",
2442
2429
  fieldName: "id",
2443
2430
  required: true,
2444
2431
  input: false,
2445
2432
  returned: true,
2446
- unique: true,
2447
2433
  validator: { output: z.uuid() }
2448
2434
  },
2449
2435
  type: {
@@ -2634,16 +2620,15 @@ const getPaymentTables = (options) => {
2634
2620
  order: 1,
2635
2621
  fields: {
2636
2622
  id: {
2637
- type: "uuid",
2623
+ type: "string",
2638
2624
  fieldName: "id",
2639
2625
  required: true,
2640
2626
  input: false,
2641
2627
  returned: true,
2642
- unique: true,
2643
2628
  validator: { output: z.uuid() }
2644
2629
  },
2645
2630
  sessionId: {
2646
- type: "uuid",
2631
+ type: "string",
2647
2632
  fieldName: "session_id",
2648
2633
  required: true,
2649
2634
  references: {
@@ -2658,7 +2643,7 @@ const getPaymentTables = (options) => {
2658
2643
  index: true
2659
2644
  },
2660
2645
  eventId: {
2661
- type: "uuid",
2646
+ type: "string",
2662
2647
  fieldName: "event_id",
2663
2648
  required: true,
2664
2649
  references: {
@@ -2708,12 +2693,11 @@ const getPaymentTables = (options) => {
2708
2693
  order: 1,
2709
2694
  fields: {
2710
2695
  id: {
2711
- type: "uuid",
2696
+ type: "string",
2712
2697
  fieldName: "id",
2713
2698
  required: true,
2714
2699
  input: false,
2715
2700
  returned: true,
2716
- unique: true,
2717
2701
  validator: { output: z.uuid() }
2718
2702
  },
2719
2703
  expiresAt: {
@@ -2756,7 +2740,7 @@ const getPaymentTables = (options) => {
2756
2740
  }
2757
2741
  },
2758
2742
  customerId: {
2759
- type: "uuid",
2743
+ type: "string",
2760
2744
  fieldName: "customer_id",
2761
2745
  required: true,
2762
2746
  references: {
@@ -2781,7 +2765,7 @@ const getPaymentTables = (options) => {
2781
2765
  }
2782
2766
  },
2783
2767
  paymentIntentId: {
2784
- type: "uuid",
2768
+ type: "string",
2785
2769
  fieldName: "payment_intent_id",
2786
2770
  required: true,
2787
2771
  references: {
@@ -2796,7 +2780,7 @@ const getPaymentTables = (options) => {
2796
2780
  index: true
2797
2781
  },
2798
2782
  subscriptionId: {
2799
- type: "uuid",
2783
+ type: "string",
2800
2784
  fieldName: "subscription_id",
2801
2785
  required: true,
2802
2786
  references: {
@@ -2895,12 +2879,11 @@ const getPaymentTables = (options) => {
2895
2879
  order: 1,
2896
2880
  fields: {
2897
2881
  id: {
2898
- type: "uuid",
2882
+ type: "string",
2899
2883
  fieldName: "id",
2900
2884
  required: true,
2901
2885
  input: false,
2902
2886
  returned: true,
2903
- unique: true,
2904
2887
  validator: { output: z.uuid() }
2905
2888
  },
2906
2889
  amount: {
@@ -2958,7 +2941,7 @@ const getPaymentTables = (options) => {
2958
2941
  index: true
2959
2942
  },
2960
2943
  idempotencyKey: {
2961
- type: "uuid",
2944
+ type: "string",
2962
2945
  fieldName: "idempotency_key",
2963
2946
  required: true,
2964
2947
  unique: true,
@@ -2990,7 +2973,7 @@ const getPaymentTables = (options) => {
2990
2973
  }
2991
2974
  },
2992
2975
  customerId: {
2993
- type: "uuid",
2976
+ type: "string",
2994
2977
  fieldName: "customer_id",
2995
2978
  required: true,
2996
2979
  references: {
@@ -3005,7 +2988,7 @@ const getPaymentTables = (options) => {
3005
2988
  index: true
3006
2989
  },
3007
2990
  subscriptionId: {
3008
- type: "uuid",
2991
+ type: "string",
3009
2992
  fieldName: "subscription_id",
3010
2993
  required: true,
3011
2994
  references: {
@@ -3020,7 +3003,7 @@ const getPaymentTables = (options) => {
3020
3003
  index: true
3021
3004
  },
3022
3005
  invoiceId: {
3023
- type: "uuid",
3006
+ type: "string",
3024
3007
  fieldName: "invoice_id",
3025
3008
  required: true,
3026
3009
  references: {
@@ -3156,12 +3139,11 @@ const getPaymentTables = (options) => {
3156
3139
  order: 1,
3157
3140
  fields: {
3158
3141
  id: {
3159
- type: "uuid",
3142
+ type: "string",
3160
3143
  fieldName: "id",
3161
3144
  required: true,
3162
3145
  input: false,
3163
3146
  returned: true,
3164
- unique: true,
3165
3147
  validator: { output: z.uuid() }
3166
3148
  },
3167
3149
  amount: {
@@ -3210,7 +3192,7 @@ const getPaymentTables = (options) => {
3210
3192
  index: true
3211
3193
  },
3212
3194
  paymentIntentId: {
3213
- type: "uuid",
3195
+ type: "string",
3214
3196
  fieldName: "payment_intent_id",
3215
3197
  required: true,
3216
3198
  references: {
@@ -3225,7 +3207,7 @@ const getPaymentTables = (options) => {
3225
3207
  index: true
3226
3208
  },
3227
3209
  customerId: {
3228
- type: "uuid",
3210
+ type: "string",
3229
3211
  fieldName: "customer_id",
3230
3212
  required: true,
3231
3213
  references: {
@@ -3271,7 +3253,7 @@ const getPaymentTables = (options) => {
3271
3253
  }
3272
3254
  },
3273
3255
  reversedById: {
3274
- type: "uuid",
3256
+ type: "string",
3275
3257
  fieldName: "reversed_by_id",
3276
3258
  required: false,
3277
3259
  validator: {
@@ -3371,12 +3353,11 @@ const getPaymentTables = (options) => {
3371
3353
  order: 1,
3372
3354
  fields: {
3373
3355
  id: {
3374
- type: "uuid",
3356
+ type: "string",
3375
3357
  fieldName: "id",
3376
3358
  required: true,
3377
3359
  input: false,
3378
3360
  returned: true,
3379
- unique: true,
3380
3361
  validator: { output: z.uuid() }
3381
3362
  },
3382
3363
  taskType: {
@@ -3549,12 +3530,11 @@ const getPaymentTables = (options) => {
3549
3530
  order: 1,
3550
3531
  fields: {
3551
3532
  id: {
3552
- type: "uuid",
3533
+ type: "string",
3553
3534
  fieldName: "id",
3554
3535
  required: true,
3555
3536
  input: false,
3556
3537
  returned: true,
3557
- unique: true,
3558
3538
  validator: { output: z.uuid() }
3559
3539
  },
3560
3540
  action: {
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-CAAnHVns.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-B_sQzTUV.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-CAAnHVns.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-B_sQzTUV.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.0.6",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.mjs",