paykitjs 0.1.0-alpha.2

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.
Files changed (70) hide show
  1. package/LICENSE +21 -0
  2. package/dist/_virtual/_rolldown/runtime.js +13 -0
  3. package/dist/api/define-route.d.ts +94 -0
  4. package/dist/api/define-route.js +153 -0
  5. package/dist/api/methods.d.ts +422 -0
  6. package/dist/api/methods.js +67 -0
  7. package/dist/cli/commands/check.js +92 -0
  8. package/dist/cli/commands/init.js +264 -0
  9. package/dist/cli/commands/push.js +73 -0
  10. package/dist/cli/commands/telemetry.js +16 -0
  11. package/dist/cli/index.d.ts +1 -0
  12. package/dist/cli/index.js +21 -0
  13. package/dist/cli/templates/index.js +64 -0
  14. package/dist/cli/utils/detect.js +67 -0
  15. package/dist/cli/utils/format.js +58 -0
  16. package/dist/cli/utils/get-config.js +117 -0
  17. package/dist/cli/utils/telemetry.js +103 -0
  18. package/dist/client/index.d.ts +25 -0
  19. package/dist/client/index.js +27 -0
  20. package/dist/core/context.d.ts +17 -0
  21. package/dist/core/context.js +23 -0
  22. package/dist/core/create-paykit.d.ts +7 -0
  23. package/dist/core/create-paykit.js +52 -0
  24. package/dist/core/error-codes.d.ts +12 -0
  25. package/dist/core/error-codes.js +10 -0
  26. package/dist/core/errors.d.ts +41 -0
  27. package/dist/core/errors.js +47 -0
  28. package/dist/core/logger.d.ts +11 -0
  29. package/dist/core/logger.js +51 -0
  30. package/dist/core/utils.js +21 -0
  31. package/dist/customer/customer.api.js +47 -0
  32. package/dist/customer/customer.service.js +342 -0
  33. package/dist/customer/customer.types.d.ts +31 -0
  34. package/dist/database/index.d.ts +8 -0
  35. package/dist/database/index.js +32 -0
  36. package/dist/database/migrations/0000_init.sql +157 -0
  37. package/dist/database/migrations/meta/0000_snapshot.json +1222 -0
  38. package/dist/database/migrations/meta/_journal.json +13 -0
  39. package/dist/database/schema.d.ts +1767 -0
  40. package/dist/database/schema.js +150 -0
  41. package/dist/entitlement/entitlement.api.js +33 -0
  42. package/dist/entitlement/entitlement.service.d.ts +17 -0
  43. package/dist/entitlement/entitlement.service.js +123 -0
  44. package/dist/handlers/next.d.ts +9 -0
  45. package/dist/handlers/next.js +9 -0
  46. package/dist/index.d.ts +14 -0
  47. package/dist/index.js +6 -0
  48. package/dist/invoice/invoice.service.js +54 -0
  49. package/dist/payment/payment.service.js +49 -0
  50. package/dist/payment-method/payment-method.service.js +78 -0
  51. package/dist/product/product-sync.service.js +111 -0
  52. package/dist/product/product.service.js +127 -0
  53. package/dist/providers/provider.d.ts +159 -0
  54. package/dist/providers/stripe.js +547 -0
  55. package/dist/subscription/subscription.api.js +24 -0
  56. package/dist/subscription/subscription.service.js +896 -0
  57. package/dist/subscription/subscription.types.d.ts +18 -0
  58. package/dist/subscription/subscription.types.js +11 -0
  59. package/dist/testing/testing.api.js +29 -0
  60. package/dist/testing/testing.service.js +49 -0
  61. package/dist/types/events.d.ts +181 -0
  62. package/dist/types/instance.d.ts +88 -0
  63. package/dist/types/models.d.ts +11 -0
  64. package/dist/types/options.d.ts +32 -0
  65. package/dist/types/plugin.d.ts +11 -0
  66. package/dist/types/schema.d.ts +99 -0
  67. package/dist/types/schema.js +192 -0
  68. package/dist/webhook/webhook.api.js +29 -0
  69. package/dist/webhook/webhook.service.js +143 -0
  70. package/package.json +72 -0
@@ -0,0 +1,1222 @@
1
+ {
2
+ "id": "476e3c1e-e8b7-4c5b-9d43-f10c4173b9ee",
3
+ "prevId": "00000000-0000-0000-0000-000000000000",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.paykit_customer": {
8
+ "name": "paykit_customer",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "email": {
18
+ "name": "email",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": false
22
+ },
23
+ "name": {
24
+ "name": "name",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": false
28
+ },
29
+ "metadata": {
30
+ "name": "metadata",
31
+ "type": "jsonb",
32
+ "primaryKey": false,
33
+ "notNull": false
34
+ },
35
+ "provider": {
36
+ "name": "provider",
37
+ "type": "jsonb",
38
+ "primaryKey": false,
39
+ "notNull": true,
40
+ "default": "'{}'::jsonb"
41
+ },
42
+ "deleted_at": {
43
+ "name": "deleted_at",
44
+ "type": "timestamp",
45
+ "primaryKey": false,
46
+ "notNull": false
47
+ },
48
+ "created_at": {
49
+ "name": "created_at",
50
+ "type": "timestamp",
51
+ "primaryKey": false,
52
+ "notNull": true
53
+ },
54
+ "updated_at": {
55
+ "name": "updated_at",
56
+ "type": "timestamp",
57
+ "primaryKey": false,
58
+ "notNull": true
59
+ }
60
+ },
61
+ "indexes": {
62
+ "paykit_customer_deleted_at_idx": {
63
+ "name": "paykit_customer_deleted_at_idx",
64
+ "columns": [
65
+ {
66
+ "expression": "deleted_at",
67
+ "isExpression": false,
68
+ "asc": true,
69
+ "nulls": "last"
70
+ }
71
+ ],
72
+ "isUnique": false,
73
+ "concurrently": false,
74
+ "method": "btree",
75
+ "with": {}
76
+ }
77
+ },
78
+ "foreignKeys": {},
79
+ "compositePrimaryKeys": {},
80
+ "uniqueConstraints": {},
81
+ "policies": {},
82
+ "checkConstraints": {},
83
+ "isRLSEnabled": false
84
+ },
85
+ "public.paykit_entitlement": {
86
+ "name": "paykit_entitlement",
87
+ "schema": "",
88
+ "columns": {
89
+ "id": {
90
+ "name": "id",
91
+ "type": "text",
92
+ "primaryKey": true,
93
+ "notNull": true
94
+ },
95
+ "subscription_id": {
96
+ "name": "subscription_id",
97
+ "type": "text",
98
+ "primaryKey": false,
99
+ "notNull": false
100
+ },
101
+ "customer_id": {
102
+ "name": "customer_id",
103
+ "type": "text",
104
+ "primaryKey": false,
105
+ "notNull": true
106
+ },
107
+ "feature_id": {
108
+ "name": "feature_id",
109
+ "type": "text",
110
+ "primaryKey": false,
111
+ "notNull": true
112
+ },
113
+ "limit": {
114
+ "name": "limit",
115
+ "type": "integer",
116
+ "primaryKey": false,
117
+ "notNull": false
118
+ },
119
+ "balance": {
120
+ "name": "balance",
121
+ "type": "integer",
122
+ "primaryKey": false,
123
+ "notNull": false
124
+ },
125
+ "next_reset_at": {
126
+ "name": "next_reset_at",
127
+ "type": "timestamp",
128
+ "primaryKey": false,
129
+ "notNull": false
130
+ },
131
+ "created_at": {
132
+ "name": "created_at",
133
+ "type": "timestamp",
134
+ "primaryKey": false,
135
+ "notNull": true
136
+ },
137
+ "updated_at": {
138
+ "name": "updated_at",
139
+ "type": "timestamp",
140
+ "primaryKey": false,
141
+ "notNull": true
142
+ }
143
+ },
144
+ "indexes": {
145
+ "paykit_entitlement_subscription_idx": {
146
+ "name": "paykit_entitlement_subscription_idx",
147
+ "columns": [
148
+ {
149
+ "expression": "subscription_id",
150
+ "isExpression": false,
151
+ "asc": true,
152
+ "nulls": "last"
153
+ }
154
+ ],
155
+ "isUnique": false,
156
+ "concurrently": false,
157
+ "method": "btree",
158
+ "with": {}
159
+ },
160
+ "paykit_entitlement_customer_feature_idx": {
161
+ "name": "paykit_entitlement_customer_feature_idx",
162
+ "columns": [
163
+ {
164
+ "expression": "customer_id",
165
+ "isExpression": false,
166
+ "asc": true,
167
+ "nulls": "last"
168
+ },
169
+ {
170
+ "expression": "feature_id",
171
+ "isExpression": false,
172
+ "asc": true,
173
+ "nulls": "last"
174
+ }
175
+ ],
176
+ "isUnique": false,
177
+ "concurrently": false,
178
+ "method": "btree",
179
+ "with": {}
180
+ },
181
+ "paykit_entitlement_next_reset_idx": {
182
+ "name": "paykit_entitlement_next_reset_idx",
183
+ "columns": [
184
+ {
185
+ "expression": "next_reset_at",
186
+ "isExpression": false,
187
+ "asc": true,
188
+ "nulls": "last"
189
+ }
190
+ ],
191
+ "isUnique": false,
192
+ "concurrently": false,
193
+ "method": "btree",
194
+ "with": {}
195
+ }
196
+ },
197
+ "foreignKeys": {
198
+ "paykit_entitlement_subscription_id_paykit_subscription_id_fk": {
199
+ "name": "paykit_entitlement_subscription_id_paykit_subscription_id_fk",
200
+ "tableFrom": "paykit_entitlement",
201
+ "tableTo": "paykit_subscription",
202
+ "columnsFrom": [
203
+ "subscription_id"
204
+ ],
205
+ "columnsTo": [
206
+ "id"
207
+ ],
208
+ "onDelete": "no action",
209
+ "onUpdate": "no action"
210
+ },
211
+ "paykit_entitlement_customer_id_paykit_customer_id_fk": {
212
+ "name": "paykit_entitlement_customer_id_paykit_customer_id_fk",
213
+ "tableFrom": "paykit_entitlement",
214
+ "tableTo": "paykit_customer",
215
+ "columnsFrom": [
216
+ "customer_id"
217
+ ],
218
+ "columnsTo": [
219
+ "id"
220
+ ],
221
+ "onDelete": "no action",
222
+ "onUpdate": "no action"
223
+ },
224
+ "paykit_entitlement_feature_id_paykit_feature_id_fk": {
225
+ "name": "paykit_entitlement_feature_id_paykit_feature_id_fk",
226
+ "tableFrom": "paykit_entitlement",
227
+ "tableTo": "paykit_feature",
228
+ "columnsFrom": [
229
+ "feature_id"
230
+ ],
231
+ "columnsTo": [
232
+ "id"
233
+ ],
234
+ "onDelete": "no action",
235
+ "onUpdate": "no action"
236
+ }
237
+ },
238
+ "compositePrimaryKeys": {},
239
+ "uniqueConstraints": {},
240
+ "policies": {},
241
+ "checkConstraints": {},
242
+ "isRLSEnabled": false
243
+ },
244
+ "public.paykit_feature": {
245
+ "name": "paykit_feature",
246
+ "schema": "",
247
+ "columns": {
248
+ "id": {
249
+ "name": "id",
250
+ "type": "text",
251
+ "primaryKey": true,
252
+ "notNull": true
253
+ },
254
+ "type": {
255
+ "name": "type",
256
+ "type": "text",
257
+ "primaryKey": false,
258
+ "notNull": true
259
+ },
260
+ "created_at": {
261
+ "name": "created_at",
262
+ "type": "timestamp",
263
+ "primaryKey": false,
264
+ "notNull": true
265
+ },
266
+ "updated_at": {
267
+ "name": "updated_at",
268
+ "type": "timestamp",
269
+ "primaryKey": false,
270
+ "notNull": true
271
+ }
272
+ },
273
+ "indexes": {},
274
+ "foreignKeys": {},
275
+ "compositePrimaryKeys": {},
276
+ "uniqueConstraints": {},
277
+ "policies": {},
278
+ "checkConstraints": {},
279
+ "isRLSEnabled": false
280
+ },
281
+ "public.paykit_invoice": {
282
+ "name": "paykit_invoice",
283
+ "schema": "",
284
+ "columns": {
285
+ "id": {
286
+ "name": "id",
287
+ "type": "text",
288
+ "primaryKey": true,
289
+ "notNull": true
290
+ },
291
+ "customer_id": {
292
+ "name": "customer_id",
293
+ "type": "text",
294
+ "primaryKey": false,
295
+ "notNull": true
296
+ },
297
+ "subscription_id": {
298
+ "name": "subscription_id",
299
+ "type": "text",
300
+ "primaryKey": false,
301
+ "notNull": false
302
+ },
303
+ "type": {
304
+ "name": "type",
305
+ "type": "text",
306
+ "primaryKey": false,
307
+ "notNull": true
308
+ },
309
+ "status": {
310
+ "name": "status",
311
+ "type": "text",
312
+ "primaryKey": false,
313
+ "notNull": true
314
+ },
315
+ "amount": {
316
+ "name": "amount",
317
+ "type": "integer",
318
+ "primaryKey": false,
319
+ "notNull": true
320
+ },
321
+ "currency": {
322
+ "name": "currency",
323
+ "type": "text",
324
+ "primaryKey": false,
325
+ "notNull": true
326
+ },
327
+ "description": {
328
+ "name": "description",
329
+ "type": "text",
330
+ "primaryKey": false,
331
+ "notNull": false
332
+ },
333
+ "hosted_url": {
334
+ "name": "hosted_url",
335
+ "type": "text",
336
+ "primaryKey": false,
337
+ "notNull": false
338
+ },
339
+ "provider_id": {
340
+ "name": "provider_id",
341
+ "type": "text",
342
+ "primaryKey": false,
343
+ "notNull": true
344
+ },
345
+ "provider_data": {
346
+ "name": "provider_data",
347
+ "type": "jsonb",
348
+ "primaryKey": false,
349
+ "notNull": true
350
+ },
351
+ "period_start_at": {
352
+ "name": "period_start_at",
353
+ "type": "timestamp",
354
+ "primaryKey": false,
355
+ "notNull": false
356
+ },
357
+ "period_end_at": {
358
+ "name": "period_end_at",
359
+ "type": "timestamp",
360
+ "primaryKey": false,
361
+ "notNull": false
362
+ },
363
+ "created_at": {
364
+ "name": "created_at",
365
+ "type": "timestamp",
366
+ "primaryKey": false,
367
+ "notNull": true
368
+ },
369
+ "updated_at": {
370
+ "name": "updated_at",
371
+ "type": "timestamp",
372
+ "primaryKey": false,
373
+ "notNull": true
374
+ }
375
+ },
376
+ "indexes": {
377
+ "paykit_invoice_customer_idx": {
378
+ "name": "paykit_invoice_customer_idx",
379
+ "columns": [
380
+ {
381
+ "expression": "customer_id",
382
+ "isExpression": false,
383
+ "asc": true,
384
+ "nulls": "last"
385
+ },
386
+ {
387
+ "expression": "created_at",
388
+ "isExpression": false,
389
+ "asc": true,
390
+ "nulls": "last"
391
+ }
392
+ ],
393
+ "isUnique": false,
394
+ "concurrently": false,
395
+ "method": "btree",
396
+ "with": {}
397
+ },
398
+ "paykit_invoice_subscription_idx": {
399
+ "name": "paykit_invoice_subscription_idx",
400
+ "columns": [
401
+ {
402
+ "expression": "subscription_id",
403
+ "isExpression": false,
404
+ "asc": true,
405
+ "nulls": "last"
406
+ }
407
+ ],
408
+ "isUnique": false,
409
+ "concurrently": false,
410
+ "method": "btree",
411
+ "with": {}
412
+ },
413
+ "paykit_invoice_provider_idx": {
414
+ "name": "paykit_invoice_provider_idx",
415
+ "columns": [
416
+ {
417
+ "expression": "provider_id",
418
+ "isExpression": false,
419
+ "asc": true,
420
+ "nulls": "last"
421
+ }
422
+ ],
423
+ "isUnique": false,
424
+ "concurrently": false,
425
+ "method": "btree",
426
+ "with": {}
427
+ }
428
+ },
429
+ "foreignKeys": {
430
+ "paykit_invoice_customer_id_paykit_customer_id_fk": {
431
+ "name": "paykit_invoice_customer_id_paykit_customer_id_fk",
432
+ "tableFrom": "paykit_invoice",
433
+ "tableTo": "paykit_customer",
434
+ "columnsFrom": [
435
+ "customer_id"
436
+ ],
437
+ "columnsTo": [
438
+ "id"
439
+ ],
440
+ "onDelete": "no action",
441
+ "onUpdate": "no action"
442
+ },
443
+ "paykit_invoice_subscription_id_paykit_subscription_id_fk": {
444
+ "name": "paykit_invoice_subscription_id_paykit_subscription_id_fk",
445
+ "tableFrom": "paykit_invoice",
446
+ "tableTo": "paykit_subscription",
447
+ "columnsFrom": [
448
+ "subscription_id"
449
+ ],
450
+ "columnsTo": [
451
+ "id"
452
+ ],
453
+ "onDelete": "no action",
454
+ "onUpdate": "no action"
455
+ }
456
+ },
457
+ "compositePrimaryKeys": {},
458
+ "uniqueConstraints": {},
459
+ "policies": {},
460
+ "checkConstraints": {},
461
+ "isRLSEnabled": false
462
+ },
463
+ "public.paykit_metadata": {
464
+ "name": "paykit_metadata",
465
+ "schema": "",
466
+ "columns": {
467
+ "id": {
468
+ "name": "id",
469
+ "type": "text",
470
+ "primaryKey": true,
471
+ "notNull": true
472
+ },
473
+ "provider_id": {
474
+ "name": "provider_id",
475
+ "type": "text",
476
+ "primaryKey": false,
477
+ "notNull": true
478
+ },
479
+ "type": {
480
+ "name": "type",
481
+ "type": "text",
482
+ "primaryKey": false,
483
+ "notNull": true
484
+ },
485
+ "data": {
486
+ "name": "data",
487
+ "type": "jsonb",
488
+ "primaryKey": false,
489
+ "notNull": true
490
+ },
491
+ "provider_checkout_session_id": {
492
+ "name": "provider_checkout_session_id",
493
+ "type": "text",
494
+ "primaryKey": false,
495
+ "notNull": false
496
+ },
497
+ "expires_at": {
498
+ "name": "expires_at",
499
+ "type": "timestamp",
500
+ "primaryKey": false,
501
+ "notNull": false
502
+ },
503
+ "created_at": {
504
+ "name": "created_at",
505
+ "type": "timestamp",
506
+ "primaryKey": false,
507
+ "notNull": true
508
+ }
509
+ },
510
+ "indexes": {
511
+ "paykit_metadata_checkout_session_unique": {
512
+ "name": "paykit_metadata_checkout_session_unique",
513
+ "columns": [
514
+ {
515
+ "expression": "provider_id",
516
+ "isExpression": false,
517
+ "asc": true,
518
+ "nulls": "last"
519
+ },
520
+ {
521
+ "expression": "provider_checkout_session_id",
522
+ "isExpression": false,
523
+ "asc": true,
524
+ "nulls": "last"
525
+ }
526
+ ],
527
+ "isUnique": true,
528
+ "concurrently": false,
529
+ "method": "btree",
530
+ "with": {}
531
+ }
532
+ },
533
+ "foreignKeys": {},
534
+ "compositePrimaryKeys": {},
535
+ "uniqueConstraints": {},
536
+ "policies": {},
537
+ "checkConstraints": {},
538
+ "isRLSEnabled": false
539
+ },
540
+ "public.paykit_payment_method": {
541
+ "name": "paykit_payment_method",
542
+ "schema": "",
543
+ "columns": {
544
+ "id": {
545
+ "name": "id",
546
+ "type": "text",
547
+ "primaryKey": true,
548
+ "notNull": true
549
+ },
550
+ "customer_id": {
551
+ "name": "customer_id",
552
+ "type": "text",
553
+ "primaryKey": false,
554
+ "notNull": true
555
+ },
556
+ "provider_id": {
557
+ "name": "provider_id",
558
+ "type": "text",
559
+ "primaryKey": false,
560
+ "notNull": true
561
+ },
562
+ "provider_data": {
563
+ "name": "provider_data",
564
+ "type": "jsonb",
565
+ "primaryKey": false,
566
+ "notNull": true
567
+ },
568
+ "is_default": {
569
+ "name": "is_default",
570
+ "type": "boolean",
571
+ "primaryKey": false,
572
+ "notNull": true,
573
+ "default": false
574
+ },
575
+ "deleted_at": {
576
+ "name": "deleted_at",
577
+ "type": "timestamp",
578
+ "primaryKey": false,
579
+ "notNull": false
580
+ },
581
+ "created_at": {
582
+ "name": "created_at",
583
+ "type": "timestamp",
584
+ "primaryKey": false,
585
+ "notNull": true
586
+ },
587
+ "updated_at": {
588
+ "name": "updated_at",
589
+ "type": "timestamp",
590
+ "primaryKey": false,
591
+ "notNull": true
592
+ }
593
+ },
594
+ "indexes": {
595
+ "paykit_payment_method_customer_idx": {
596
+ "name": "paykit_payment_method_customer_idx",
597
+ "columns": [
598
+ {
599
+ "expression": "customer_id",
600
+ "isExpression": false,
601
+ "asc": true,
602
+ "nulls": "last"
603
+ },
604
+ {
605
+ "expression": "deleted_at",
606
+ "isExpression": false,
607
+ "asc": true,
608
+ "nulls": "last"
609
+ }
610
+ ],
611
+ "isUnique": false,
612
+ "concurrently": false,
613
+ "method": "btree",
614
+ "with": {}
615
+ },
616
+ "paykit_payment_method_provider_idx": {
617
+ "name": "paykit_payment_method_provider_idx",
618
+ "columns": [
619
+ {
620
+ "expression": "provider_id",
621
+ "isExpression": false,
622
+ "asc": true,
623
+ "nulls": "last"
624
+ }
625
+ ],
626
+ "isUnique": false,
627
+ "concurrently": false,
628
+ "method": "btree",
629
+ "with": {}
630
+ }
631
+ },
632
+ "foreignKeys": {
633
+ "paykit_payment_method_customer_id_paykit_customer_id_fk": {
634
+ "name": "paykit_payment_method_customer_id_paykit_customer_id_fk",
635
+ "tableFrom": "paykit_payment_method",
636
+ "tableTo": "paykit_customer",
637
+ "columnsFrom": [
638
+ "customer_id"
639
+ ],
640
+ "columnsTo": [
641
+ "id"
642
+ ],
643
+ "onDelete": "no action",
644
+ "onUpdate": "no action"
645
+ }
646
+ },
647
+ "compositePrimaryKeys": {},
648
+ "uniqueConstraints": {},
649
+ "policies": {},
650
+ "checkConstraints": {},
651
+ "isRLSEnabled": false
652
+ },
653
+ "public.paykit_product": {
654
+ "name": "paykit_product",
655
+ "schema": "",
656
+ "columns": {
657
+ "internal_id": {
658
+ "name": "internal_id",
659
+ "type": "text",
660
+ "primaryKey": true,
661
+ "notNull": true
662
+ },
663
+ "id": {
664
+ "name": "id",
665
+ "type": "text",
666
+ "primaryKey": false,
667
+ "notNull": true
668
+ },
669
+ "version": {
670
+ "name": "version",
671
+ "type": "integer",
672
+ "primaryKey": false,
673
+ "notNull": true,
674
+ "default": 1
675
+ },
676
+ "name": {
677
+ "name": "name",
678
+ "type": "text",
679
+ "primaryKey": false,
680
+ "notNull": true
681
+ },
682
+ "group": {
683
+ "name": "group",
684
+ "type": "text",
685
+ "primaryKey": false,
686
+ "notNull": true,
687
+ "default": "''"
688
+ },
689
+ "is_default": {
690
+ "name": "is_default",
691
+ "type": "boolean",
692
+ "primaryKey": false,
693
+ "notNull": true,
694
+ "default": false
695
+ },
696
+ "price_amount": {
697
+ "name": "price_amount",
698
+ "type": "integer",
699
+ "primaryKey": false,
700
+ "notNull": false
701
+ },
702
+ "price_interval": {
703
+ "name": "price_interval",
704
+ "type": "text",
705
+ "primaryKey": false,
706
+ "notNull": false
707
+ },
708
+ "hash": {
709
+ "name": "hash",
710
+ "type": "text",
711
+ "primaryKey": false,
712
+ "notNull": false
713
+ },
714
+ "provider": {
715
+ "name": "provider",
716
+ "type": "jsonb",
717
+ "primaryKey": false,
718
+ "notNull": true,
719
+ "default": "'{}'::jsonb"
720
+ },
721
+ "created_at": {
722
+ "name": "created_at",
723
+ "type": "timestamp",
724
+ "primaryKey": false,
725
+ "notNull": true
726
+ },
727
+ "updated_at": {
728
+ "name": "updated_at",
729
+ "type": "timestamp",
730
+ "primaryKey": false,
731
+ "notNull": true
732
+ }
733
+ },
734
+ "indexes": {
735
+ "paykit_product_id_version_unique": {
736
+ "name": "paykit_product_id_version_unique",
737
+ "columns": [
738
+ {
739
+ "expression": "id",
740
+ "isExpression": false,
741
+ "asc": true,
742
+ "nulls": "last"
743
+ },
744
+ {
745
+ "expression": "version",
746
+ "isExpression": false,
747
+ "asc": true,
748
+ "nulls": "last"
749
+ }
750
+ ],
751
+ "isUnique": true,
752
+ "concurrently": false,
753
+ "method": "btree",
754
+ "with": {}
755
+ },
756
+ "paykit_product_default_idx": {
757
+ "name": "paykit_product_default_idx",
758
+ "columns": [
759
+ {
760
+ "expression": "is_default",
761
+ "isExpression": false,
762
+ "asc": true,
763
+ "nulls": "last"
764
+ }
765
+ ],
766
+ "isUnique": false,
767
+ "concurrently": false,
768
+ "method": "btree",
769
+ "with": {}
770
+ }
771
+ },
772
+ "foreignKeys": {},
773
+ "compositePrimaryKeys": {},
774
+ "uniqueConstraints": {},
775
+ "policies": {},
776
+ "checkConstraints": {},
777
+ "isRLSEnabled": false
778
+ },
779
+ "public.paykit_product_feature": {
780
+ "name": "paykit_product_feature",
781
+ "schema": "",
782
+ "columns": {
783
+ "product_internal_id": {
784
+ "name": "product_internal_id",
785
+ "type": "text",
786
+ "primaryKey": false,
787
+ "notNull": true
788
+ },
789
+ "feature_id": {
790
+ "name": "feature_id",
791
+ "type": "text",
792
+ "primaryKey": false,
793
+ "notNull": true
794
+ },
795
+ "limit": {
796
+ "name": "limit",
797
+ "type": "integer",
798
+ "primaryKey": false,
799
+ "notNull": false
800
+ },
801
+ "reset_interval": {
802
+ "name": "reset_interval",
803
+ "type": "text",
804
+ "primaryKey": false,
805
+ "notNull": false
806
+ },
807
+ "config": {
808
+ "name": "config",
809
+ "type": "jsonb",
810
+ "primaryKey": false,
811
+ "notNull": false
812
+ },
813
+ "created_at": {
814
+ "name": "created_at",
815
+ "type": "timestamp",
816
+ "primaryKey": false,
817
+ "notNull": true
818
+ },
819
+ "updated_at": {
820
+ "name": "updated_at",
821
+ "type": "timestamp",
822
+ "primaryKey": false,
823
+ "notNull": true
824
+ }
825
+ },
826
+ "indexes": {
827
+ "paykit_product_feature_feature_idx": {
828
+ "name": "paykit_product_feature_feature_idx",
829
+ "columns": [
830
+ {
831
+ "expression": "feature_id",
832
+ "isExpression": false,
833
+ "asc": true,
834
+ "nulls": "last"
835
+ }
836
+ ],
837
+ "isUnique": false,
838
+ "concurrently": false,
839
+ "method": "btree",
840
+ "with": {}
841
+ }
842
+ },
843
+ "foreignKeys": {
844
+ "paykit_product_feature_product_internal_id_paykit_product_internal_id_fk": {
845
+ "name": "paykit_product_feature_product_internal_id_paykit_product_internal_id_fk",
846
+ "tableFrom": "paykit_product_feature",
847
+ "tableTo": "paykit_product",
848
+ "columnsFrom": [
849
+ "product_internal_id"
850
+ ],
851
+ "columnsTo": [
852
+ "internal_id"
853
+ ],
854
+ "onDelete": "no action",
855
+ "onUpdate": "no action"
856
+ },
857
+ "paykit_product_feature_feature_id_paykit_feature_id_fk": {
858
+ "name": "paykit_product_feature_feature_id_paykit_feature_id_fk",
859
+ "tableFrom": "paykit_product_feature",
860
+ "tableTo": "paykit_feature",
861
+ "columnsFrom": [
862
+ "feature_id"
863
+ ],
864
+ "columnsTo": [
865
+ "id"
866
+ ],
867
+ "onDelete": "no action",
868
+ "onUpdate": "no action"
869
+ }
870
+ },
871
+ "compositePrimaryKeys": {
872
+ "paykit_product_feature_product_internal_id_feature_id_pk": {
873
+ "name": "paykit_product_feature_product_internal_id_feature_id_pk",
874
+ "columns": [
875
+ "product_internal_id",
876
+ "feature_id"
877
+ ]
878
+ }
879
+ },
880
+ "uniqueConstraints": {},
881
+ "policies": {},
882
+ "checkConstraints": {},
883
+ "isRLSEnabled": false
884
+ },
885
+ "public.paykit_subscription": {
886
+ "name": "paykit_subscription",
887
+ "schema": "",
888
+ "columns": {
889
+ "id": {
890
+ "name": "id",
891
+ "type": "text",
892
+ "primaryKey": true,
893
+ "notNull": true
894
+ },
895
+ "customer_id": {
896
+ "name": "customer_id",
897
+ "type": "text",
898
+ "primaryKey": false,
899
+ "notNull": true
900
+ },
901
+ "product_internal_id": {
902
+ "name": "product_internal_id",
903
+ "type": "text",
904
+ "primaryKey": false,
905
+ "notNull": true
906
+ },
907
+ "provider_id": {
908
+ "name": "provider_id",
909
+ "type": "text",
910
+ "primaryKey": false,
911
+ "notNull": false
912
+ },
913
+ "provider_data": {
914
+ "name": "provider_data",
915
+ "type": "jsonb",
916
+ "primaryKey": false,
917
+ "notNull": false
918
+ },
919
+ "status": {
920
+ "name": "status",
921
+ "type": "text",
922
+ "primaryKey": false,
923
+ "notNull": true
924
+ },
925
+ "canceled": {
926
+ "name": "canceled",
927
+ "type": "boolean",
928
+ "primaryKey": false,
929
+ "notNull": true,
930
+ "default": false
931
+ },
932
+ "cancel_at_period_end": {
933
+ "name": "cancel_at_period_end",
934
+ "type": "boolean",
935
+ "primaryKey": false,
936
+ "notNull": true,
937
+ "default": false
938
+ },
939
+ "started_at": {
940
+ "name": "started_at",
941
+ "type": "timestamp",
942
+ "primaryKey": false,
943
+ "notNull": false
944
+ },
945
+ "trial_ends_at": {
946
+ "name": "trial_ends_at",
947
+ "type": "timestamp",
948
+ "primaryKey": false,
949
+ "notNull": false
950
+ },
951
+ "current_period_start_at": {
952
+ "name": "current_period_start_at",
953
+ "type": "timestamp",
954
+ "primaryKey": false,
955
+ "notNull": false
956
+ },
957
+ "current_period_end_at": {
958
+ "name": "current_period_end_at",
959
+ "type": "timestamp",
960
+ "primaryKey": false,
961
+ "notNull": false
962
+ },
963
+ "canceled_at": {
964
+ "name": "canceled_at",
965
+ "type": "timestamp",
966
+ "primaryKey": false,
967
+ "notNull": false
968
+ },
969
+ "ended_at": {
970
+ "name": "ended_at",
971
+ "type": "timestamp",
972
+ "primaryKey": false,
973
+ "notNull": false
974
+ },
975
+ "scheduled_product_id": {
976
+ "name": "scheduled_product_id",
977
+ "type": "text",
978
+ "primaryKey": false,
979
+ "notNull": false
980
+ },
981
+ "quantity": {
982
+ "name": "quantity",
983
+ "type": "integer",
984
+ "primaryKey": false,
985
+ "notNull": true,
986
+ "default": 1
987
+ },
988
+ "created_at": {
989
+ "name": "created_at",
990
+ "type": "timestamp",
991
+ "primaryKey": false,
992
+ "notNull": true
993
+ },
994
+ "updated_at": {
995
+ "name": "updated_at",
996
+ "type": "timestamp",
997
+ "primaryKey": false,
998
+ "notNull": true
999
+ }
1000
+ },
1001
+ "indexes": {
1002
+ "paykit_subscription_customer_status_idx": {
1003
+ "name": "paykit_subscription_customer_status_idx",
1004
+ "columns": [
1005
+ {
1006
+ "expression": "customer_id",
1007
+ "isExpression": false,
1008
+ "asc": true,
1009
+ "nulls": "last"
1010
+ },
1011
+ {
1012
+ "expression": "status",
1013
+ "isExpression": false,
1014
+ "asc": true,
1015
+ "nulls": "last"
1016
+ },
1017
+ {
1018
+ "expression": "ended_at",
1019
+ "isExpression": false,
1020
+ "asc": true,
1021
+ "nulls": "last"
1022
+ }
1023
+ ],
1024
+ "isUnique": false,
1025
+ "concurrently": false,
1026
+ "method": "btree",
1027
+ "with": {}
1028
+ },
1029
+ "paykit_subscription_product_idx": {
1030
+ "name": "paykit_subscription_product_idx",
1031
+ "columns": [
1032
+ {
1033
+ "expression": "product_internal_id",
1034
+ "isExpression": false,
1035
+ "asc": true,
1036
+ "nulls": "last"
1037
+ }
1038
+ ],
1039
+ "isUnique": false,
1040
+ "concurrently": false,
1041
+ "method": "btree",
1042
+ "with": {}
1043
+ },
1044
+ "paykit_subscription_provider_idx": {
1045
+ "name": "paykit_subscription_provider_idx",
1046
+ "columns": [
1047
+ {
1048
+ "expression": "provider_id",
1049
+ "isExpression": false,
1050
+ "asc": true,
1051
+ "nulls": "last"
1052
+ }
1053
+ ],
1054
+ "isUnique": false,
1055
+ "concurrently": false,
1056
+ "method": "btree",
1057
+ "with": {}
1058
+ }
1059
+ },
1060
+ "foreignKeys": {
1061
+ "paykit_subscription_customer_id_paykit_customer_id_fk": {
1062
+ "name": "paykit_subscription_customer_id_paykit_customer_id_fk",
1063
+ "tableFrom": "paykit_subscription",
1064
+ "tableTo": "paykit_customer",
1065
+ "columnsFrom": [
1066
+ "customer_id"
1067
+ ],
1068
+ "columnsTo": [
1069
+ "id"
1070
+ ],
1071
+ "onDelete": "no action",
1072
+ "onUpdate": "no action"
1073
+ },
1074
+ "paykit_subscription_product_internal_id_paykit_product_internal_id_fk": {
1075
+ "name": "paykit_subscription_product_internal_id_paykit_product_internal_id_fk",
1076
+ "tableFrom": "paykit_subscription",
1077
+ "tableTo": "paykit_product",
1078
+ "columnsFrom": [
1079
+ "product_internal_id"
1080
+ ],
1081
+ "columnsTo": [
1082
+ "internal_id"
1083
+ ],
1084
+ "onDelete": "no action",
1085
+ "onUpdate": "no action"
1086
+ }
1087
+ },
1088
+ "compositePrimaryKeys": {},
1089
+ "uniqueConstraints": {},
1090
+ "policies": {},
1091
+ "checkConstraints": {},
1092
+ "isRLSEnabled": false
1093
+ },
1094
+ "public.paykit_webhook_event": {
1095
+ "name": "paykit_webhook_event",
1096
+ "schema": "",
1097
+ "columns": {
1098
+ "id": {
1099
+ "name": "id",
1100
+ "type": "text",
1101
+ "primaryKey": true,
1102
+ "notNull": true
1103
+ },
1104
+ "provider_id": {
1105
+ "name": "provider_id",
1106
+ "type": "text",
1107
+ "primaryKey": false,
1108
+ "notNull": true
1109
+ },
1110
+ "provider_event_id": {
1111
+ "name": "provider_event_id",
1112
+ "type": "text",
1113
+ "primaryKey": false,
1114
+ "notNull": true
1115
+ },
1116
+ "type": {
1117
+ "name": "type",
1118
+ "type": "text",
1119
+ "primaryKey": false,
1120
+ "notNull": true
1121
+ },
1122
+ "payload": {
1123
+ "name": "payload",
1124
+ "type": "jsonb",
1125
+ "primaryKey": false,
1126
+ "notNull": true
1127
+ },
1128
+ "status": {
1129
+ "name": "status",
1130
+ "type": "text",
1131
+ "primaryKey": false,
1132
+ "notNull": true
1133
+ },
1134
+ "error": {
1135
+ "name": "error",
1136
+ "type": "text",
1137
+ "primaryKey": false,
1138
+ "notNull": false
1139
+ },
1140
+ "trace_id": {
1141
+ "name": "trace_id",
1142
+ "type": "text",
1143
+ "primaryKey": false,
1144
+ "notNull": false
1145
+ },
1146
+ "received_at": {
1147
+ "name": "received_at",
1148
+ "type": "timestamp",
1149
+ "primaryKey": false,
1150
+ "notNull": true
1151
+ },
1152
+ "processed_at": {
1153
+ "name": "processed_at",
1154
+ "type": "timestamp",
1155
+ "primaryKey": false,
1156
+ "notNull": false
1157
+ }
1158
+ },
1159
+ "indexes": {
1160
+ "paykit_webhook_event_provider_unique": {
1161
+ "name": "paykit_webhook_event_provider_unique",
1162
+ "columns": [
1163
+ {
1164
+ "expression": "provider_id",
1165
+ "isExpression": false,
1166
+ "asc": true,
1167
+ "nulls": "last"
1168
+ },
1169
+ {
1170
+ "expression": "provider_event_id",
1171
+ "isExpression": false,
1172
+ "asc": true,
1173
+ "nulls": "last"
1174
+ }
1175
+ ],
1176
+ "isUnique": true,
1177
+ "concurrently": false,
1178
+ "method": "btree",
1179
+ "with": {}
1180
+ },
1181
+ "paykit_webhook_event_status_idx": {
1182
+ "name": "paykit_webhook_event_status_idx",
1183
+ "columns": [
1184
+ {
1185
+ "expression": "provider_id",
1186
+ "isExpression": false,
1187
+ "asc": true,
1188
+ "nulls": "last"
1189
+ },
1190
+ {
1191
+ "expression": "status",
1192
+ "isExpression": false,
1193
+ "asc": true,
1194
+ "nulls": "last"
1195
+ }
1196
+ ],
1197
+ "isUnique": false,
1198
+ "concurrently": false,
1199
+ "method": "btree",
1200
+ "with": {}
1201
+ }
1202
+ },
1203
+ "foreignKeys": {},
1204
+ "compositePrimaryKeys": {},
1205
+ "uniqueConstraints": {},
1206
+ "policies": {},
1207
+ "checkConstraints": {},
1208
+ "isRLSEnabled": false
1209
+ }
1210
+ },
1211
+ "enums": {},
1212
+ "schemas": {},
1213
+ "sequences": {},
1214
+ "roles": {},
1215
+ "policies": {},
1216
+ "views": {},
1217
+ "_meta": {
1218
+ "columns": {},
1219
+ "schemas": {},
1220
+ "tables": {}
1221
+ }
1222
+ }