@happyvertical/smrt-subscriptions 0.57.9 → 0.57.10
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/AGENTS.md +21 -0
- package/README.md +112 -3
- package/dist/chunks/SubscriptionPlanCollection-CqlYYtPg.js +229 -0
- package/dist/chunks/SubscriptionPlanCollection-CqlYYtPg.js.map +1 -0
- package/dist/chunks/SubscriptionPlanVersionCollection-CV0QPmp0.js +193 -0
- package/dist/chunks/SubscriptionPlanVersionCollection-CV0QPmp0.js.map +1 -0
- package/dist/chunks/plan-terms-BoeXvDhs.js +219 -0
- package/dist/chunks/plan-terms-BoeXvDhs.js.map +1 -0
- package/dist/chunks/plan-versioning-Bp0NqTJf.js +142 -0
- package/dist/chunks/plan-versioning-Bp0NqTJf.js.map +1 -0
- package/dist/chunks/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/collections/SubscriptionPlanVersionCollection.d.ts +33 -0
- package/dist/collections/SubscriptionPlanVersionCollection.d.ts.map +1 -0
- package/dist/collections/index.d.ts +1 -0
- package/dist/collections/index.d.ts.map +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +181 -349
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +1114 -328
- package/dist/migrations/planVersions.d.ts +16 -0
- package/dist/migrations/planVersions.d.ts.map +1 -0
- package/dist/models/SubscriptionPlan.d.ts +39 -3
- package/dist/models/SubscriptionPlan.d.ts.map +1 -1
- package/dist/models/SubscriptionPlanVersion.d.ts +51 -0
- package/dist/models/SubscriptionPlanVersion.d.ts.map +1 -0
- package/dist/models/TenantSubscription.d.ts +49 -1
- package/dist/models/TenantSubscription.d.ts.map +1 -1
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.d.ts.map +1 -1
- package/dist/plan-terms.d.ts +26 -0
- package/dist/plan-terms.d.ts.map +1 -0
- package/dist/plan-versioning.d.ts +45 -0
- package/dist/plan-versioning.d.ts.map +1 -0
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/subscription-resolver.d.ts +26 -0
- package/dist/services/subscription-resolver.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +547 -7
- package/dist/types.d.ts +72 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": "1.0.0",
|
|
3
3
|
"timestamp": 0,
|
|
4
4
|
"packageName": "@happyvertical/smrt-subscriptions",
|
|
5
|
-
"packageVersion": "0.57.
|
|
5
|
+
"packageVersion": "0.57.10",
|
|
6
6
|
"objects": {
|
|
7
7
|
"@happyvertical/smrt-subscriptions:SubscriptionPlanCollection": {
|
|
8
8
|
"name": "subscriptionplancollection",
|
|
@@ -272,90 +272,97 @@
|
|
|
272
272
|
},
|
|
273
273
|
"importPath": "@happyvertical/smrt-subscriptions"
|
|
274
274
|
},
|
|
275
|
-
"@happyvertical/smrt-subscriptions:
|
|
276
|
-
"name": "
|
|
277
|
-
"className": "
|
|
278
|
-
"qualifiedName": "@happyvertical/smrt-subscriptions:
|
|
279
|
-
"collection": "
|
|
280
|
-
"
|
|
275
|
+
"@happyvertical/smrt-subscriptions:SubscriptionPlanVersionCollection": {
|
|
276
|
+
"name": "subscriptionplanversioncollection",
|
|
277
|
+
"className": "SubscriptionPlanVersionCollection",
|
|
278
|
+
"qualifiedName": "@happyvertical/smrt-subscriptions:SubscriptionPlanVersionCollection",
|
|
279
|
+
"collection": "subscriptionplanversions",
|
|
280
|
+
"description": "Effective-dated plan versions (#4032).",
|
|
281
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/SubscriptionPlanVersionCollection.ts",
|
|
281
282
|
"packageName": "@happyvertical/smrt-subscriptions",
|
|
282
283
|
"fields": {},
|
|
283
284
|
"methods": {
|
|
284
|
-
"
|
|
285
|
-
"name": "
|
|
285
|
+
"findVisibleById": {
|
|
286
|
+
"name": "findVisibleById",
|
|
286
287
|
"async": true,
|
|
287
288
|
"parameters": [
|
|
288
289
|
{
|
|
289
|
-
"name": "
|
|
290
|
+
"name": "id",
|
|
290
291
|
"type": "string",
|
|
291
292
|
"optional": false
|
|
292
293
|
}
|
|
293
294
|
],
|
|
294
|
-
"returnType": "Promise<
|
|
295
|
+
"returnType": "Promise<SubscriptionPlanVersion | null>",
|
|
295
296
|
"isStatic": false,
|
|
296
297
|
"isPublic": true
|
|
297
298
|
},
|
|
298
|
-
"
|
|
299
|
-
"name": "
|
|
299
|
+
"listForPlan": {
|
|
300
|
+
"name": "listForPlan",
|
|
300
301
|
"async": true,
|
|
301
302
|
"parameters": [
|
|
302
303
|
{
|
|
303
|
-
"name": "
|
|
304
|
+
"name": "planId",
|
|
304
305
|
"type": "string",
|
|
305
306
|
"optional": false
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
"name": "now",
|
|
309
|
-
"type": "any",
|
|
310
|
-
"optional": true
|
|
311
307
|
}
|
|
312
308
|
],
|
|
313
|
-
"returnType": "Promise<
|
|
309
|
+
"returnType": "Promise<SubscriptionPlanVersion[]>",
|
|
314
310
|
"isStatic": false,
|
|
315
311
|
"isPublic": true
|
|
316
312
|
},
|
|
317
|
-
"
|
|
318
|
-
"name": "
|
|
313
|
+
"findLatest": {
|
|
314
|
+
"name": "findLatest",
|
|
319
315
|
"async": true,
|
|
320
316
|
"parameters": [
|
|
321
317
|
{
|
|
322
|
-
"name": "
|
|
323
|
-
"type": "
|
|
318
|
+
"name": "planId",
|
|
319
|
+
"type": "string",
|
|
324
320
|
"optional": false
|
|
325
321
|
},
|
|
326
322
|
{
|
|
327
|
-
"name": "
|
|
328
|
-
"type": "
|
|
329
|
-
"optional": true
|
|
323
|
+
"name": "tenantId",
|
|
324
|
+
"type": "string | null",
|
|
325
|
+
"optional": true,
|
|
326
|
+
"unionBranches": [
|
|
327
|
+
{
|
|
328
|
+
"type": "string"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"type": "null"
|
|
332
|
+
}
|
|
333
|
+
]
|
|
330
334
|
}
|
|
331
335
|
],
|
|
332
|
-
"returnType": "Promise<
|
|
336
|
+
"returnType": "Promise<SubscriptionPlanVersion | null>",
|
|
333
337
|
"isStatic": false,
|
|
334
338
|
"isPublic": true
|
|
335
339
|
},
|
|
336
|
-
"
|
|
337
|
-
"name": "
|
|
340
|
+
"findInForce": {
|
|
341
|
+
"name": "findInForce",
|
|
338
342
|
"async": true,
|
|
339
343
|
"parameters": [
|
|
340
344
|
{
|
|
341
|
-
"name": "
|
|
345
|
+
"name": "planId",
|
|
342
346
|
"type": "string",
|
|
343
347
|
"optional": false
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"name": "at",
|
|
351
|
+
"type": "Date",
|
|
352
|
+
"optional": false
|
|
344
353
|
}
|
|
345
354
|
],
|
|
346
|
-
"returnType": "Promise<
|
|
355
|
+
"returnType": "Promise<SubscriptionPlanVersion | null>",
|
|
347
356
|
"isStatic": false,
|
|
348
357
|
"isPublic": true
|
|
349
358
|
}
|
|
350
359
|
},
|
|
351
360
|
"decoratorConfig": {
|
|
352
|
-
"tableName": "
|
|
361
|
+
"tableName": "_smrt_subscription_plan_versions",
|
|
353
362
|
"api": {
|
|
354
363
|
"include": [
|
|
355
364
|
"list",
|
|
356
|
-
"get"
|
|
357
|
-
"create",
|
|
358
|
-
"update"
|
|
365
|
+
"get"
|
|
359
366
|
]
|
|
360
367
|
},
|
|
361
368
|
"mcp": {
|
|
@@ -363,15 +370,21 @@
|
|
|
363
370
|
"list",
|
|
364
371
|
"get"
|
|
365
372
|
]
|
|
373
|
+
},
|
|
374
|
+
"cli": {
|
|
375
|
+
"include": [
|
|
376
|
+
"list",
|
|
377
|
+
"get"
|
|
378
|
+
]
|
|
366
379
|
}
|
|
367
380
|
},
|
|
368
381
|
"extends": "SmrtCollection",
|
|
369
|
-
"extendsTypeArg": "
|
|
370
|
-
"exportName": "
|
|
371
|
-
"collectionExportName": "
|
|
382
|
+
"extendsTypeArg": "SubscriptionPlanVersion",
|
|
383
|
+
"exportName": "SubscriptionPlanVersionCollection",
|
|
384
|
+
"collectionExportName": "SubscriptionPlanVersionCollectionCollection",
|
|
372
385
|
"schema": {
|
|
373
|
-
"tableName": "
|
|
374
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"
|
|
386
|
+
"tableName": "_smrt_subscription_plan_versions",
|
|
387
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_subscription_plan_versions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"plan_id\" UUID,\n \"plan_key\" TEXT DEFAULT '',\n \"version\" INTEGER DEFAULT 0,\n \"effective_from\" TIMESTAMP,\n \"name\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"price_amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"billing_interval\" TEXT DEFAULT 'month',\n \"pricing_mode\" TEXT DEFAULT 'fixed',\n \"minimum_amount\" INTEGER DEFAULT 0,\n \"suggested_amount\" INTEGER DEFAULT 0,\n \"features\" TEXT DEFAULT '[]',\n \"thresholds\" TEXT DEFAULT '[]'\n);",
|
|
375
388
|
"columns": {
|
|
376
389
|
"id": {
|
|
377
390
|
"type": "UUID",
|
|
@@ -401,20 +414,8 @@
|
|
|
401
414
|
"tenant_id": {
|
|
402
415
|
"type": "UUID",
|
|
403
416
|
"referenceKind": "tenantId",
|
|
404
|
-
"notNull": true,
|
|
405
|
-
"unique": false
|
|
406
|
-
},
|
|
407
|
-
"subscriber_kind": {
|
|
408
|
-
"type": "TEXT",
|
|
409
|
-
"notNull": false,
|
|
410
|
-
"unique": false,
|
|
411
|
-
"default": "tenant"
|
|
412
|
-
},
|
|
413
|
-
"subscriber_external_id": {
|
|
414
|
-
"type": "TEXT",
|
|
415
417
|
"notNull": false,
|
|
416
|
-
"unique": false
|
|
417
|
-
"default": ""
|
|
418
|
+
"unique": false
|
|
418
419
|
},
|
|
419
420
|
"plan_id": {
|
|
420
421
|
"type": "UUID",
|
|
@@ -424,143 +425,142 @@
|
|
|
424
425
|
"foreignKey": {
|
|
425
426
|
"table": "_smrt_subscription_plans",
|
|
426
427
|
"column": "id",
|
|
427
|
-
"onDelete": "
|
|
428
|
+
"onDelete": "CASCADE",
|
|
428
429
|
"onUpdate": "CASCADE"
|
|
429
430
|
}
|
|
430
431
|
},
|
|
431
|
-
"
|
|
432
|
+
"plan_key": {
|
|
432
433
|
"type": "TEXT",
|
|
433
434
|
"notNull": false,
|
|
434
435
|
"unique": false,
|
|
435
|
-
"default": "
|
|
436
|
+
"default": ""
|
|
436
437
|
},
|
|
437
|
-
"
|
|
438
|
-
"type": "
|
|
438
|
+
"version": {
|
|
439
|
+
"type": "INTEGER",
|
|
439
440
|
"notNull": false,
|
|
440
|
-
"unique": false
|
|
441
|
+
"unique": false,
|
|
442
|
+
"default": 0
|
|
441
443
|
},
|
|
442
|
-
"
|
|
444
|
+
"effective_from": {
|
|
443
445
|
"type": "TIMESTAMP",
|
|
444
446
|
"notNull": false,
|
|
445
447
|
"unique": false
|
|
446
448
|
},
|
|
447
|
-
"
|
|
448
|
-
"type": "
|
|
449
|
+
"name": {
|
|
450
|
+
"type": "TEXT",
|
|
449
451
|
"notNull": false,
|
|
450
|
-
"unique": false
|
|
452
|
+
"unique": false,
|
|
453
|
+
"default": ""
|
|
451
454
|
},
|
|
452
|
-
"
|
|
453
|
-
"type": "
|
|
455
|
+
"status": {
|
|
456
|
+
"type": "TEXT",
|
|
454
457
|
"notNull": false,
|
|
455
|
-
"unique": false
|
|
458
|
+
"unique": false,
|
|
459
|
+
"default": "active"
|
|
456
460
|
},
|
|
457
|
-
"
|
|
458
|
-
"type": "
|
|
461
|
+
"price_amount": {
|
|
462
|
+
"type": "INTEGER",
|
|
459
463
|
"notNull": false,
|
|
460
464
|
"unique": false,
|
|
461
|
-
"default":
|
|
465
|
+
"default": 0
|
|
462
466
|
},
|
|
463
|
-
"
|
|
464
|
-
"type": "
|
|
467
|
+
"currency": {
|
|
468
|
+
"type": "TEXT",
|
|
465
469
|
"notNull": false,
|
|
466
|
-
"unique": false
|
|
470
|
+
"unique": false,
|
|
471
|
+
"default": "USD"
|
|
467
472
|
},
|
|
468
|
-
"
|
|
469
|
-
"type": "
|
|
473
|
+
"billing_interval": {
|
|
474
|
+
"type": "TEXT",
|
|
470
475
|
"notNull": false,
|
|
471
|
-
"unique": false
|
|
476
|
+
"unique": false,
|
|
477
|
+
"default": "month"
|
|
472
478
|
},
|
|
473
|
-
"
|
|
479
|
+
"pricing_mode": {
|
|
474
480
|
"type": "TEXT",
|
|
475
481
|
"notNull": false,
|
|
476
|
-
"unique": false
|
|
482
|
+
"unique": false,
|
|
483
|
+
"default": "fixed"
|
|
477
484
|
},
|
|
478
|
-
"
|
|
479
|
-
"type": "
|
|
485
|
+
"minimum_amount": {
|
|
486
|
+
"type": "INTEGER",
|
|
480
487
|
"notNull": false,
|
|
481
488
|
"unique": false,
|
|
482
|
-
"default":
|
|
489
|
+
"default": 0
|
|
483
490
|
},
|
|
484
|
-
"
|
|
485
|
-
"type": "
|
|
491
|
+
"suggested_amount": {
|
|
492
|
+
"type": "INTEGER",
|
|
486
493
|
"notNull": false,
|
|
487
494
|
"unique": false,
|
|
488
|
-
"default":
|
|
495
|
+
"default": 0
|
|
489
496
|
},
|
|
490
|
-
"
|
|
497
|
+
"features": {
|
|
491
498
|
"type": "TEXT",
|
|
492
499
|
"notNull": false,
|
|
493
500
|
"unique": false,
|
|
494
|
-
"default": ""
|
|
501
|
+
"default": "[]"
|
|
495
502
|
},
|
|
496
|
-
"
|
|
503
|
+
"thresholds": {
|
|
497
504
|
"type": "TEXT",
|
|
498
505
|
"notNull": false,
|
|
499
506
|
"unique": false,
|
|
500
|
-
"default": "
|
|
507
|
+
"default": "[]"
|
|
501
508
|
}
|
|
502
509
|
},
|
|
503
510
|
"indexes": [
|
|
504
511
|
{
|
|
505
|
-
"name": "
|
|
512
|
+
"name": "_smrt_subscription_plan_versions_plan_id_version_idx",
|
|
506
513
|
"columns": [
|
|
507
|
-
"
|
|
508
|
-
"
|
|
509
|
-
"subscriber_external_id"
|
|
514
|
+
"plan_id",
|
|
515
|
+
"version"
|
|
510
516
|
],
|
|
511
517
|
"unique": true,
|
|
512
518
|
"nullsNotDistinct": true
|
|
513
519
|
},
|
|
514
520
|
{
|
|
515
|
-
"name": "
|
|
521
|
+
"name": "_smrt_subscription_plan_versions_slug_context_idx",
|
|
516
522
|
"columns": [
|
|
517
523
|
"slug",
|
|
518
524
|
"context"
|
|
519
525
|
]
|
|
520
526
|
},
|
|
521
527
|
{
|
|
522
|
-
"name": "
|
|
528
|
+
"name": "_smrt_subscription_plan_versions_tenant_id_created_at_idx",
|
|
523
529
|
"columns": [
|
|
524
530
|
"tenant_id",
|
|
525
531
|
"created_at"
|
|
526
532
|
]
|
|
527
|
-
},
|
|
528
|
-
{
|
|
529
|
-
"name": "_smrt_tenant_subscriptions_plan_id_idx",
|
|
530
|
-
"columns": [
|
|
531
|
-
"plan_id"
|
|
532
|
-
]
|
|
533
533
|
}
|
|
534
534
|
],
|
|
535
|
-
"version": "
|
|
535
|
+
"version": "f610e477"
|
|
536
536
|
},
|
|
537
537
|
"importPath": "@happyvertical/smrt-subscriptions"
|
|
538
538
|
},
|
|
539
|
-
"@happyvertical/smrt-subscriptions:
|
|
540
|
-
"name": "
|
|
541
|
-
"className": "
|
|
542
|
-
"qualifiedName": "@happyvertical/smrt-subscriptions:
|
|
543
|
-
"collection": "
|
|
544
|
-
"filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/
|
|
539
|
+
"@happyvertical/smrt-subscriptions:TenantSubscriptionCollection": {
|
|
540
|
+
"name": "tenantsubscriptioncollection",
|
|
541
|
+
"className": "TenantSubscriptionCollection",
|
|
542
|
+
"qualifiedName": "@happyvertical/smrt-subscriptions:TenantSubscriptionCollection",
|
|
543
|
+
"collection": "tenantsubscriptions",
|
|
544
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/TenantSubscriptionCollection.ts",
|
|
545
545
|
"packageName": "@happyvertical/smrt-subscriptions",
|
|
546
546
|
"fields": {},
|
|
547
547
|
"methods": {
|
|
548
|
-
"
|
|
549
|
-
"name": "
|
|
548
|
+
"findByTenant": {
|
|
549
|
+
"name": "findByTenant",
|
|
550
550
|
"async": true,
|
|
551
551
|
"parameters": [
|
|
552
552
|
{
|
|
553
|
-
"name": "
|
|
554
|
-
"type": "
|
|
553
|
+
"name": "tenantId",
|
|
554
|
+
"type": "string",
|
|
555
555
|
"optional": false
|
|
556
556
|
}
|
|
557
557
|
],
|
|
558
|
-
"returnType": "Promise<
|
|
558
|
+
"returnType": "Promise<TenantSubscription[]>",
|
|
559
559
|
"isStatic": false,
|
|
560
560
|
"isPublic": true
|
|
561
561
|
},
|
|
562
|
-
"
|
|
563
|
-
"name": "
|
|
562
|
+
"findCurrentForTenant": {
|
|
563
|
+
"name": "findCurrentForTenant",
|
|
564
564
|
"async": true,
|
|
565
565
|
"parameters": [
|
|
566
566
|
{
|
|
@@ -569,65 +569,57 @@
|
|
|
569
569
|
"optional": false
|
|
570
570
|
},
|
|
571
571
|
{
|
|
572
|
-
"name": "
|
|
573
|
-
"type": "
|
|
574
|
-
"optional":
|
|
572
|
+
"name": "now",
|
|
573
|
+
"type": "any",
|
|
574
|
+
"optional": true
|
|
575
575
|
}
|
|
576
576
|
],
|
|
577
|
-
"returnType": "Promise<
|
|
577
|
+
"returnType": "Promise<TenantSubscription | null>",
|
|
578
578
|
"isStatic": false,
|
|
579
579
|
"isPublic": true
|
|
580
580
|
},
|
|
581
|
-
"
|
|
582
|
-
"name": "
|
|
581
|
+
"findCurrentForSubscriber": {
|
|
582
|
+
"name": "findCurrentForSubscriber",
|
|
583
583
|
"async": true,
|
|
584
584
|
"parameters": [
|
|
585
585
|
{
|
|
586
|
-
"name": "
|
|
587
|
-
"type": "
|
|
586
|
+
"name": "subscriber",
|
|
587
|
+
"type": "Subscriber",
|
|
588
588
|
"optional": false
|
|
589
|
-
}
|
|
590
|
-
],
|
|
591
|
-
"returnType": "Promise<UsageSummary>",
|
|
592
|
-
"isStatic": false,
|
|
593
|
-
"isPublic": true
|
|
594
|
-
},
|
|
595
|
-
"summarizeUsageBatch": {
|
|
596
|
-
"name": "summarizeUsageBatch",
|
|
597
|
-
"async": true,
|
|
598
|
-
"parameters": [
|
|
589
|
+
},
|
|
599
590
|
{
|
|
600
|
-
"name": "
|
|
601
|
-
"type": "
|
|
602
|
-
"optional":
|
|
591
|
+
"name": "now",
|
|
592
|
+
"type": "any",
|
|
593
|
+
"optional": true
|
|
603
594
|
}
|
|
604
595
|
],
|
|
605
|
-
"returnType": "Promise<
|
|
596
|
+
"returnType": "Promise<TenantSubscription | null>",
|
|
606
597
|
"isStatic": false,
|
|
607
598
|
"isPublic": true
|
|
608
599
|
},
|
|
609
|
-
"
|
|
610
|
-
"name": "
|
|
600
|
+
"findByStripeSubscriptionId": {
|
|
601
|
+
"name": "findByStripeSubscriptionId",
|
|
611
602
|
"async": true,
|
|
612
603
|
"parameters": [
|
|
613
604
|
{
|
|
614
|
-
"name": "
|
|
615
|
-
"type": "
|
|
605
|
+
"name": "stripeSubscriptionId",
|
|
606
|
+
"type": "string",
|
|
616
607
|
"optional": false
|
|
617
608
|
}
|
|
618
609
|
],
|
|
619
|
-
"returnType": "Promise<
|
|
610
|
+
"returnType": "Promise<TenantSubscription | null>",
|
|
620
611
|
"isStatic": false,
|
|
621
612
|
"isPublic": true
|
|
622
613
|
}
|
|
623
614
|
},
|
|
624
615
|
"decoratorConfig": {
|
|
625
|
-
"tableName": "
|
|
616
|
+
"tableName": "_smrt_tenant_subscriptions",
|
|
626
617
|
"api": {
|
|
627
618
|
"include": [
|
|
628
619
|
"list",
|
|
629
620
|
"get",
|
|
630
|
-
"create"
|
|
621
|
+
"create",
|
|
622
|
+
"update"
|
|
631
623
|
]
|
|
632
624
|
},
|
|
633
625
|
"mcp": {
|
|
@@ -635,22 +627,15 @@
|
|
|
635
627
|
"list",
|
|
636
628
|
"get"
|
|
637
629
|
]
|
|
638
|
-
},
|
|
639
|
-
"cli": {
|
|
640
|
-
"include": [
|
|
641
|
-
"list",
|
|
642
|
-
"get",
|
|
643
|
-
"create"
|
|
644
|
-
]
|
|
645
630
|
}
|
|
646
631
|
},
|
|
647
632
|
"extends": "SmrtCollection",
|
|
648
|
-
"extendsTypeArg": "
|
|
649
|
-
"exportName": "
|
|
650
|
-
"collectionExportName": "
|
|
633
|
+
"extendsTypeArg": "TenantSubscription",
|
|
634
|
+
"exportName": "TenantSubscriptionCollection",
|
|
635
|
+
"collectionExportName": "TenantSubscriptionCollectionCollection",
|
|
651
636
|
"schema": {
|
|
652
|
-
"tableName": "
|
|
653
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"
|
|
637
|
+
"tableName": "_smrt_tenant_subscriptions",
|
|
638
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_tenant_subscriptions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"subscriber_kind\" TEXT DEFAULT 'tenant',\n \"subscriber_external_id\" TEXT DEFAULT '',\n \"plan_id\" UUID,\n \"status\" TEXT DEFAULT 'incomplete',\n \"started_at\" TIMESTAMP,\n \"current_period_start\" TIMESTAMP,\n \"current_period_end\" TIMESTAMP,\n \"trial_ends_at\" TIMESTAMP,\n \"cancel_at_period_end\" BOOLEAN DEFAULT FALSE,\n \"canceled_at\" TIMESTAMP,\n \"agreed_amount\" INTEGER,\n \"plan_version_id\" UUID,\n \"plan_version_pinned_at\" TIMESTAMP,\n \"plan_version_pin_reason\" TEXT,\n \"plan_version_pin_note\" TEXT DEFAULT '',\n \"retains_paid_period\" BOOLEAN DEFAULT FALSE,\n \"external_provider\" TEXT,\n \"stripe_customer_id\" TEXT DEFAULT '',\n \"stripe_subscription_id\" TEXT DEFAULT '',\n \"stripe_checkout_session_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
|
|
654
639
|
"columns": {
|
|
655
640
|
"id": {
|
|
656
641
|
"type": "UUID",
|
|
@@ -695,65 +680,118 @@
|
|
|
695
680
|
"unique": false,
|
|
696
681
|
"default": ""
|
|
697
682
|
},
|
|
698
|
-
"
|
|
699
|
-
"type": "
|
|
683
|
+
"plan_id": {
|
|
684
|
+
"type": "UUID",
|
|
685
|
+
"referenceKind": "foreignKey",
|
|
700
686
|
"notNull": false,
|
|
701
687
|
"unique": false,
|
|
702
|
-
"
|
|
688
|
+
"foreignKey": {
|
|
689
|
+
"table": "_smrt_subscription_plans",
|
|
690
|
+
"column": "id",
|
|
691
|
+
"onDelete": "NO ACTION",
|
|
692
|
+
"onUpdate": "CASCADE"
|
|
693
|
+
}
|
|
703
694
|
},
|
|
704
|
-
"
|
|
705
|
-
"type": "
|
|
695
|
+
"status": {
|
|
696
|
+
"type": "TEXT",
|
|
706
697
|
"notNull": false,
|
|
707
698
|
"unique": false,
|
|
708
|
-
"default":
|
|
699
|
+
"default": "incomplete"
|
|
709
700
|
},
|
|
710
|
-
"
|
|
701
|
+
"started_at": {
|
|
711
702
|
"type": "TIMESTAMP",
|
|
712
703
|
"notNull": false,
|
|
713
704
|
"unique": false
|
|
714
705
|
},
|
|
715
|
-
"
|
|
706
|
+
"current_period_start": {
|
|
716
707
|
"type": "TIMESTAMP",
|
|
717
708
|
"notNull": false,
|
|
718
709
|
"unique": false
|
|
719
710
|
},
|
|
720
|
-
"
|
|
721
|
-
"type": "
|
|
711
|
+
"current_period_end": {
|
|
712
|
+
"type": "TIMESTAMP",
|
|
713
|
+
"notNull": false,
|
|
714
|
+
"unique": false
|
|
715
|
+
},
|
|
716
|
+
"trial_ends_at": {
|
|
717
|
+
"type": "TIMESTAMP",
|
|
718
|
+
"notNull": false,
|
|
719
|
+
"unique": false
|
|
720
|
+
},
|
|
721
|
+
"cancel_at_period_end": {
|
|
722
|
+
"type": "BOOLEAN",
|
|
722
723
|
"notNull": false,
|
|
723
724
|
"unique": false,
|
|
724
|
-
"default":
|
|
725
|
+
"default": false
|
|
725
726
|
},
|
|
726
|
-
"
|
|
727
|
-
"type": "
|
|
727
|
+
"canceled_at": {
|
|
728
|
+
"type": "TIMESTAMP",
|
|
729
|
+
"notNull": false,
|
|
730
|
+
"unique": false
|
|
731
|
+
},
|
|
732
|
+
"agreed_amount": {
|
|
733
|
+
"type": "INTEGER",
|
|
734
|
+
"notNull": false,
|
|
735
|
+
"unique": false
|
|
736
|
+
},
|
|
737
|
+
"plan_version_id": {
|
|
738
|
+
"type": "UUID",
|
|
739
|
+
"referenceKind": "foreignKey",
|
|
728
740
|
"notNull": false,
|
|
729
741
|
"unique": false,
|
|
730
|
-
"
|
|
742
|
+
"foreignKey": {
|
|
743
|
+
"table": "_smrt_subscription_plan_versions",
|
|
744
|
+
"column": "id",
|
|
745
|
+
"onDelete": "NO ACTION",
|
|
746
|
+
"onUpdate": "CASCADE"
|
|
747
|
+
}
|
|
731
748
|
},
|
|
732
|
-
"
|
|
749
|
+
"plan_version_pinned_at": {
|
|
750
|
+
"type": "TIMESTAMP",
|
|
751
|
+
"notNull": false,
|
|
752
|
+
"unique": false
|
|
753
|
+
},
|
|
754
|
+
"plan_version_pin_reason": {
|
|
755
|
+
"type": "TEXT",
|
|
756
|
+
"notNull": false,
|
|
757
|
+
"unique": false
|
|
758
|
+
},
|
|
759
|
+
"plan_version_pin_note": {
|
|
733
760
|
"type": "TEXT",
|
|
734
761
|
"notNull": false,
|
|
735
762
|
"unique": false,
|
|
736
763
|
"default": ""
|
|
737
764
|
},
|
|
738
|
-
"
|
|
765
|
+
"retains_paid_period": {
|
|
766
|
+
"type": "BOOLEAN",
|
|
767
|
+
"notNull": false,
|
|
768
|
+
"unique": false,
|
|
769
|
+
"default": false
|
|
770
|
+
},
|
|
771
|
+
"external_provider": {
|
|
772
|
+
"type": "TEXT",
|
|
773
|
+
"notNull": false,
|
|
774
|
+
"unique": false
|
|
775
|
+
},
|
|
776
|
+
"stripe_customer_id": {
|
|
739
777
|
"type": "TEXT",
|
|
740
778
|
"notNull": false,
|
|
741
779
|
"unique": false,
|
|
742
780
|
"default": ""
|
|
743
781
|
},
|
|
744
|
-
"
|
|
782
|
+
"stripe_subscription_id": {
|
|
745
783
|
"type": "TEXT",
|
|
746
784
|
"notNull": false,
|
|
747
785
|
"unique": false,
|
|
748
786
|
"default": ""
|
|
749
787
|
},
|
|
750
|
-
"
|
|
788
|
+
"stripe_checkout_session_id": {
|
|
751
789
|
"type": "TEXT",
|
|
752
790
|
"notNull": false,
|
|
753
791
|
"unique": false,
|
|
754
792
|
"default": ""
|
|
755
793
|
},
|
|
756
|
-
"
|
|
794
|
+
"metadata": {
|
|
757
795
|
"type": "TEXT",
|
|
758
796
|
"notNull": false,
|
|
759
797
|
"unique": false,
|
|
@@ -762,32 +800,774 @@
|
|
|
762
800
|
},
|
|
763
801
|
"indexes": [
|
|
764
802
|
{
|
|
765
|
-
"name": "
|
|
803
|
+
"name": "_smrt_tenant_subscriptions_tenant_id_subscriber_kind_idx",
|
|
766
804
|
"columns": [
|
|
767
805
|
"tenant_id",
|
|
806
|
+
"subscriber_kind",
|
|
807
|
+
"subscriber_external_id"
|
|
808
|
+
],
|
|
809
|
+
"unique": true,
|
|
810
|
+
"nullsNotDistinct": true
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
"name": "_smrt_tenant_subscriptions_slug_context_idx",
|
|
814
|
+
"columns": [
|
|
768
815
|
"slug",
|
|
769
816
|
"context"
|
|
770
|
-
]
|
|
771
|
-
"unique": true
|
|
817
|
+
]
|
|
772
818
|
},
|
|
773
819
|
{
|
|
774
|
-
"name": "
|
|
820
|
+
"name": "_smrt_tenant_subscriptions_tenant_id_created_at_idx",
|
|
775
821
|
"columns": [
|
|
776
822
|
"tenant_id",
|
|
777
823
|
"created_at"
|
|
778
824
|
]
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
"name": "_smrt_tenant_subscriptions_plan_id_idx",
|
|
828
|
+
"columns": [
|
|
829
|
+
"plan_id"
|
|
830
|
+
]
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
"name": "_smrt_tenant_subscriptions_plan_version_id_idx",
|
|
834
|
+
"columns": [
|
|
835
|
+
"plan_version_id"
|
|
836
|
+
]
|
|
779
837
|
}
|
|
780
838
|
],
|
|
781
|
-
"version": "
|
|
839
|
+
"version": "328e412c"
|
|
840
|
+
},
|
|
841
|
+
"importPath": "@happyvertical/smrt-subscriptions"
|
|
842
|
+
},
|
|
843
|
+
"@happyvertical/smrt-subscriptions:TenantUsageMetricCollection": {
|
|
844
|
+
"name": "tenantusagemetriccollection",
|
|
845
|
+
"className": "TenantUsageMetricCollection",
|
|
846
|
+
"qualifiedName": "@happyvertical/smrt-subscriptions:TenantUsageMetricCollection",
|
|
847
|
+
"collection": "tenantusagemetrics",
|
|
848
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/TenantUsageMetricCollection.ts",
|
|
849
|
+
"packageName": "@happyvertical/smrt-subscriptions",
|
|
850
|
+
"fields": {},
|
|
851
|
+
"methods": {
|
|
852
|
+
"recordUsage": {
|
|
853
|
+
"name": "recordUsage",
|
|
854
|
+
"async": true,
|
|
855
|
+
"parameters": [
|
|
856
|
+
{
|
|
857
|
+
"name": "options",
|
|
858
|
+
"type": "RecordUsageOptions",
|
|
859
|
+
"optional": false
|
|
860
|
+
}
|
|
861
|
+
],
|
|
862
|
+
"returnType": "Promise<TenantUsageMetric>",
|
|
863
|
+
"isStatic": false,
|
|
864
|
+
"isPublic": true
|
|
865
|
+
},
|
|
866
|
+
"findByTenantAndMetric": {
|
|
867
|
+
"name": "findByTenantAndMetric",
|
|
868
|
+
"async": true,
|
|
869
|
+
"parameters": [
|
|
870
|
+
{
|
|
871
|
+
"name": "tenantId",
|
|
872
|
+
"type": "string",
|
|
873
|
+
"optional": false
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
"name": "metricKey",
|
|
877
|
+
"type": "string",
|
|
878
|
+
"optional": false
|
|
879
|
+
}
|
|
880
|
+
],
|
|
881
|
+
"returnType": "Promise<TenantUsageMetric[]>",
|
|
882
|
+
"isStatic": false,
|
|
883
|
+
"isPublic": true
|
|
884
|
+
},
|
|
885
|
+
"summarizeUsage": {
|
|
886
|
+
"name": "summarizeUsage",
|
|
887
|
+
"async": true,
|
|
888
|
+
"parameters": [
|
|
889
|
+
{
|
|
890
|
+
"name": "options",
|
|
891
|
+
"type": "SummarizeUsageOptions",
|
|
892
|
+
"optional": false
|
|
893
|
+
}
|
|
894
|
+
],
|
|
895
|
+
"returnType": "Promise<UsageSummary>",
|
|
896
|
+
"isStatic": false,
|
|
897
|
+
"isPublic": true
|
|
898
|
+
},
|
|
899
|
+
"summarizeUsageBatch": {
|
|
900
|
+
"name": "summarizeUsageBatch",
|
|
901
|
+
"async": true,
|
|
902
|
+
"parameters": [
|
|
903
|
+
{
|
|
904
|
+
"name": "options",
|
|
905
|
+
"type": "SummarizeUsageBatchOptions",
|
|
906
|
+
"optional": false
|
|
907
|
+
}
|
|
908
|
+
],
|
|
909
|
+
"returnType": "Promise<UsageSummary[]>",
|
|
910
|
+
"isStatic": false,
|
|
911
|
+
"isPublic": true
|
|
912
|
+
},
|
|
913
|
+
"summarizeTenantAiUsage": {
|
|
914
|
+
"name": "summarizeTenantAiUsage",
|
|
915
|
+
"async": true,
|
|
916
|
+
"parameters": [
|
|
917
|
+
{
|
|
918
|
+
"name": "options",
|
|
919
|
+
"type": "SummarizeAiUsageOptions",
|
|
920
|
+
"optional": false
|
|
921
|
+
}
|
|
922
|
+
],
|
|
923
|
+
"returnType": "Promise<AiUsageSummary>",
|
|
924
|
+
"isStatic": false,
|
|
925
|
+
"isPublic": true
|
|
926
|
+
}
|
|
927
|
+
},
|
|
928
|
+
"decoratorConfig": {
|
|
929
|
+
"tableName": "_smrt_tenant_usage_metrics",
|
|
930
|
+
"api": {
|
|
931
|
+
"include": [
|
|
932
|
+
"list",
|
|
933
|
+
"get",
|
|
934
|
+
"create"
|
|
935
|
+
]
|
|
936
|
+
},
|
|
937
|
+
"mcp": {
|
|
938
|
+
"include": [
|
|
939
|
+
"list",
|
|
940
|
+
"get"
|
|
941
|
+
]
|
|
942
|
+
},
|
|
943
|
+
"cli": {
|
|
944
|
+
"include": [
|
|
945
|
+
"list",
|
|
946
|
+
"get",
|
|
947
|
+
"create"
|
|
948
|
+
]
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
"extends": "SmrtCollection",
|
|
952
|
+
"extendsTypeArg": "TenantUsageMetric",
|
|
953
|
+
"exportName": "TenantUsageMetricCollection",
|
|
954
|
+
"collectionExportName": "TenantUsageMetricCollectionCollection",
|
|
955
|
+
"schema": {
|
|
956
|
+
"tableName": "_smrt_tenant_usage_metrics",
|
|
957
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_tenant_usage_metrics\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"subscriber_kind\" TEXT DEFAULT 'tenant',\n \"subscriber_external_id\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"quantity\" REAL DEFAULT 0,\n \"window_start\" TIMESTAMP,\n \"window_end\" TIMESTAMP,\n \"source\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"project_id\" TEXT DEFAULT '',\n \"work_ref_type\" TEXT DEFAULT '',\n \"work_ref_id\" TEXT DEFAULT '',\n \"provider\" TEXT DEFAULT '',\n \"dimensions\" TEXT DEFAULT '{}'\n);",
|
|
958
|
+
"columns": {
|
|
959
|
+
"id": {
|
|
960
|
+
"type": "UUID",
|
|
961
|
+
"primaryKey": true,
|
|
962
|
+
"referenceKind": "id",
|
|
963
|
+
"notNull": true
|
|
964
|
+
},
|
|
965
|
+
"slug": {
|
|
966
|
+
"type": "TEXT",
|
|
967
|
+
"notNull": true
|
|
968
|
+
},
|
|
969
|
+
"context": {
|
|
970
|
+
"type": "TEXT",
|
|
971
|
+
"notNull": true,
|
|
972
|
+
"default": ""
|
|
973
|
+
},
|
|
974
|
+
"created_at": {
|
|
975
|
+
"type": "TIMESTAMP",
|
|
976
|
+
"notNull": true,
|
|
977
|
+
"default": "current_timestamp"
|
|
978
|
+
},
|
|
979
|
+
"updated_at": {
|
|
980
|
+
"type": "TIMESTAMP",
|
|
981
|
+
"notNull": true,
|
|
982
|
+
"default": "current_timestamp"
|
|
983
|
+
},
|
|
984
|
+
"tenant_id": {
|
|
985
|
+
"type": "UUID",
|
|
986
|
+
"referenceKind": "tenantId",
|
|
987
|
+
"notNull": true,
|
|
988
|
+
"unique": false
|
|
989
|
+
},
|
|
990
|
+
"subscriber_kind": {
|
|
991
|
+
"type": "TEXT",
|
|
992
|
+
"notNull": false,
|
|
993
|
+
"unique": false,
|
|
994
|
+
"default": "tenant"
|
|
995
|
+
},
|
|
996
|
+
"subscriber_external_id": {
|
|
997
|
+
"type": "TEXT",
|
|
998
|
+
"notNull": false,
|
|
999
|
+
"unique": false,
|
|
1000
|
+
"default": ""
|
|
1001
|
+
},
|
|
1002
|
+
"metric_key": {
|
|
1003
|
+
"type": "TEXT",
|
|
1004
|
+
"notNull": false,
|
|
1005
|
+
"unique": false,
|
|
1006
|
+
"default": ""
|
|
1007
|
+
},
|
|
1008
|
+
"quantity": {
|
|
1009
|
+
"type": "REAL",
|
|
1010
|
+
"notNull": false,
|
|
1011
|
+
"unique": false,
|
|
1012
|
+
"default": 0
|
|
1013
|
+
},
|
|
1014
|
+
"window_start": {
|
|
1015
|
+
"type": "TIMESTAMP",
|
|
1016
|
+
"notNull": false,
|
|
1017
|
+
"unique": false
|
|
1018
|
+
},
|
|
1019
|
+
"window_end": {
|
|
1020
|
+
"type": "TIMESTAMP",
|
|
1021
|
+
"notNull": false,
|
|
1022
|
+
"unique": false
|
|
1023
|
+
},
|
|
1024
|
+
"source": {
|
|
1025
|
+
"type": "TEXT",
|
|
1026
|
+
"notNull": false,
|
|
1027
|
+
"unique": false,
|
|
1028
|
+
"default": ""
|
|
1029
|
+
},
|
|
1030
|
+
"source_id": {
|
|
1031
|
+
"type": "TEXT",
|
|
1032
|
+
"notNull": false,
|
|
1033
|
+
"unique": false,
|
|
1034
|
+
"default": ""
|
|
1035
|
+
},
|
|
1036
|
+
"project_id": {
|
|
1037
|
+
"type": "TEXT",
|
|
1038
|
+
"notNull": false,
|
|
1039
|
+
"unique": false,
|
|
1040
|
+
"default": ""
|
|
1041
|
+
},
|
|
1042
|
+
"work_ref_type": {
|
|
1043
|
+
"type": "TEXT",
|
|
1044
|
+
"notNull": false,
|
|
1045
|
+
"unique": false,
|
|
1046
|
+
"default": ""
|
|
1047
|
+
},
|
|
1048
|
+
"work_ref_id": {
|
|
1049
|
+
"type": "TEXT",
|
|
1050
|
+
"notNull": false,
|
|
1051
|
+
"unique": false,
|
|
1052
|
+
"default": ""
|
|
1053
|
+
},
|
|
1054
|
+
"provider": {
|
|
1055
|
+
"type": "TEXT",
|
|
1056
|
+
"notNull": false,
|
|
1057
|
+
"unique": false,
|
|
1058
|
+
"default": ""
|
|
1059
|
+
},
|
|
1060
|
+
"dimensions": {
|
|
1061
|
+
"type": "TEXT",
|
|
1062
|
+
"notNull": false,
|
|
1063
|
+
"unique": false,
|
|
1064
|
+
"default": "{}"
|
|
1065
|
+
}
|
|
1066
|
+
},
|
|
1067
|
+
"indexes": [
|
|
1068
|
+
{
|
|
1069
|
+
"name": "_smrt_tenant_usage_metrics_slug_context_idx",
|
|
1070
|
+
"columns": [
|
|
1071
|
+
"tenant_id",
|
|
1072
|
+
"slug",
|
|
1073
|
+
"context"
|
|
1074
|
+
],
|
|
1075
|
+
"unique": true
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
"name": "_smrt_tenant_usage_metrics_tenant_id_created_at_idx",
|
|
1079
|
+
"columns": [
|
|
1080
|
+
"tenant_id",
|
|
1081
|
+
"created_at"
|
|
1082
|
+
]
|
|
1083
|
+
}
|
|
1084
|
+
],
|
|
1085
|
+
"version": "b799c746"
|
|
1086
|
+
},
|
|
1087
|
+
"importPath": "@happyvertical/smrt-subscriptions"
|
|
1088
|
+
},
|
|
1089
|
+
"@happyvertical/smrt-subscriptions:SubscriptionPlan": {
|
|
1090
|
+
"name": "subscriptionplan",
|
|
1091
|
+
"className": "SubscriptionPlan",
|
|
1092
|
+
"qualifiedName": "@happyvertical/smrt-subscriptions:SubscriptionPlan",
|
|
1093
|
+
"collection": "subscriptionplans",
|
|
1094
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/SubscriptionPlan.ts",
|
|
1095
|
+
"packageName": "@happyvertical/smrt-subscriptions",
|
|
1096
|
+
"fields": {
|
|
1097
|
+
"tenantId": {
|
|
1098
|
+
"type": "text",
|
|
1099
|
+
"required": false,
|
|
1100
|
+
"_meta": {
|
|
1101
|
+
"sqlType": "UUID",
|
|
1102
|
+
"nullable": true,
|
|
1103
|
+
"__tenancy": {
|
|
1104
|
+
"isTenantIdField": true,
|
|
1105
|
+
"autoFilter": true,
|
|
1106
|
+
"required": false,
|
|
1107
|
+
"autoPopulate": true,
|
|
1108
|
+
"nullable": true,
|
|
1109
|
+
"mode": "optional",
|
|
1110
|
+
"field": "tenantId",
|
|
1111
|
+
"allowSuperAdminBypass": false
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
},
|
|
1115
|
+
"planKey": {
|
|
1116
|
+
"type": "text",
|
|
1117
|
+
"required": false,
|
|
1118
|
+
"default": ""
|
|
1119
|
+
},
|
|
1120
|
+
"name": {
|
|
1121
|
+
"type": "text",
|
|
1122
|
+
"required": false,
|
|
1123
|
+
"default": ""
|
|
1124
|
+
},
|
|
1125
|
+
"description": {
|
|
1126
|
+
"type": "text",
|
|
1127
|
+
"required": false,
|
|
1128
|
+
"default": ""
|
|
1129
|
+
},
|
|
1130
|
+
"status": {
|
|
1131
|
+
"type": "text",
|
|
1132
|
+
"required": false,
|
|
1133
|
+
"default": "active",
|
|
1134
|
+
"enum": [
|
|
1135
|
+
"active",
|
|
1136
|
+
"archived",
|
|
1137
|
+
"draft"
|
|
1138
|
+
]
|
|
1139
|
+
},
|
|
1140
|
+
"sortOrder": {
|
|
1141
|
+
"type": "integer",
|
|
1142
|
+
"required": false,
|
|
1143
|
+
"default": 0
|
|
1144
|
+
},
|
|
1145
|
+
"priceAmount": {
|
|
1146
|
+
"type": "integer",
|
|
1147
|
+
"required": false,
|
|
1148
|
+
"default": 0
|
|
1149
|
+
},
|
|
1150
|
+
"currency": {
|
|
1151
|
+
"type": "text",
|
|
1152
|
+
"required": false,
|
|
1153
|
+
"default": "USD"
|
|
1154
|
+
},
|
|
1155
|
+
"billingInterval": {
|
|
1156
|
+
"type": "text",
|
|
1157
|
+
"required": false,
|
|
1158
|
+
"default": "month",
|
|
1159
|
+
"enum": [
|
|
1160
|
+
"day",
|
|
1161
|
+
"week",
|
|
1162
|
+
"month",
|
|
1163
|
+
"year"
|
|
1164
|
+
]
|
|
1165
|
+
},
|
|
1166
|
+
"pricingMode": {
|
|
1167
|
+
"type": "text",
|
|
1168
|
+
"required": false,
|
|
1169
|
+
"default": "fixed",
|
|
1170
|
+
"enum": [
|
|
1171
|
+
"free",
|
|
1172
|
+
"fixed",
|
|
1173
|
+
"pay_what_you_can"
|
|
1174
|
+
]
|
|
1175
|
+
},
|
|
1176
|
+
"minimumAmount": {
|
|
1177
|
+
"type": "integer",
|
|
1178
|
+
"required": false,
|
|
1179
|
+
"default": 0
|
|
1180
|
+
},
|
|
1181
|
+
"suggestedAmount": {
|
|
1182
|
+
"type": "integer",
|
|
1183
|
+
"required": false,
|
|
1184
|
+
"default": 0
|
|
1185
|
+
},
|
|
1186
|
+
"externalProvider": {
|
|
1187
|
+
"type": "text",
|
|
1188
|
+
"required": false
|
|
1189
|
+
},
|
|
1190
|
+
"providerProductId": {
|
|
1191
|
+
"type": "text",
|
|
1192
|
+
"required": false
|
|
1193
|
+
},
|
|
1194
|
+
"providerPriceId": {
|
|
1195
|
+
"type": "text",
|
|
1196
|
+
"required": false
|
|
1197
|
+
},
|
|
1198
|
+
"stripeProductId": {
|
|
1199
|
+
"type": "text",
|
|
1200
|
+
"required": false
|
|
1201
|
+
},
|
|
1202
|
+
"stripePriceId": {
|
|
1203
|
+
"type": "text",
|
|
1204
|
+
"required": false
|
|
1205
|
+
},
|
|
1206
|
+
"features": {
|
|
1207
|
+
"type": "text",
|
|
1208
|
+
"required": false,
|
|
1209
|
+
"default": "[]"
|
|
1210
|
+
},
|
|
1211
|
+
"thresholds": {
|
|
1212
|
+
"type": "text",
|
|
1213
|
+
"required": false,
|
|
1214
|
+
"default": "[]"
|
|
1215
|
+
},
|
|
1216
|
+
"metadata": {
|
|
1217
|
+
"type": "text",
|
|
1218
|
+
"required": false,
|
|
1219
|
+
"default": "{}"
|
|
1220
|
+
}
|
|
1221
|
+
},
|
|
1222
|
+
"methods": {
|
|
1223
|
+
"isActive": {
|
|
1224
|
+
"name": "isActive",
|
|
1225
|
+
"async": false,
|
|
1226
|
+
"parameters": [],
|
|
1227
|
+
"returnType": "boolean",
|
|
1228
|
+
"isStatic": false,
|
|
1229
|
+
"isPublic": true
|
|
1230
|
+
},
|
|
1231
|
+
"getTerms": {
|
|
1232
|
+
"name": "getTerms",
|
|
1233
|
+
"async": false,
|
|
1234
|
+
"parameters": [],
|
|
1235
|
+
"returnType": "PlanTerms",
|
|
1236
|
+
"isStatic": false,
|
|
1237
|
+
"isPublic": true
|
|
1238
|
+
},
|
|
1239
|
+
"save": {
|
|
1240
|
+
"name": "save",
|
|
1241
|
+
"async": true,
|
|
1242
|
+
"parameters": [
|
|
1243
|
+
{
|
|
1244
|
+
"name": "options",
|
|
1245
|
+
"type": "SmrtSaveOptions",
|
|
1246
|
+
"optional": true
|
|
1247
|
+
}
|
|
1248
|
+
],
|
|
1249
|
+
"returnType": "Promise<this>",
|
|
1250
|
+
"isStatic": false,
|
|
1251
|
+
"isPublic": true
|
|
1252
|
+
},
|
|
1253
|
+
"publishTerms": {
|
|
1254
|
+
"name": "publishTerms",
|
|
1255
|
+
"async": true,
|
|
1256
|
+
"parameters": [
|
|
1257
|
+
{
|
|
1258
|
+
"name": "options",
|
|
1259
|
+
"type": "object",
|
|
1260
|
+
"optional": true,
|
|
1261
|
+
"memberTypes": [
|
|
1262
|
+
"Date"
|
|
1263
|
+
]
|
|
1264
|
+
}
|
|
1265
|
+
],
|
|
1266
|
+
"returnType": "Promise<SubscriptionPlanVersion>",
|
|
1267
|
+
"isStatic": false,
|
|
1268
|
+
"isPublic": true
|
|
1269
|
+
},
|
|
1270
|
+
"getVersionInForce": {
|
|
1271
|
+
"name": "getVersionInForce",
|
|
1272
|
+
"async": true,
|
|
1273
|
+
"parameters": [
|
|
1274
|
+
{
|
|
1275
|
+
"name": "at",
|
|
1276
|
+
"type": "any",
|
|
1277
|
+
"optional": true
|
|
1278
|
+
}
|
|
1279
|
+
],
|
|
1280
|
+
"returnType": "Promise<SubscriptionPlanVersion | null>",
|
|
1281
|
+
"isStatic": false,
|
|
1282
|
+
"isPublic": true
|
|
1283
|
+
},
|
|
1284
|
+
"getFeatureGrants": {
|
|
1285
|
+
"name": "getFeatureGrants",
|
|
1286
|
+
"async": false,
|
|
1287
|
+
"parameters": [],
|
|
1288
|
+
"returnType": "PlanFeatureGrant[]",
|
|
1289
|
+
"isStatic": false,
|
|
1290
|
+
"isPublic": true
|
|
1291
|
+
},
|
|
1292
|
+
"setFeatureGrants": {
|
|
1293
|
+
"name": "setFeatureGrants",
|
|
1294
|
+
"async": false,
|
|
1295
|
+
"parameters": [
|
|
1296
|
+
{
|
|
1297
|
+
"name": "grants",
|
|
1298
|
+
"type": "Array<string | PlanFeatureGrant>",
|
|
1299
|
+
"optional": false
|
|
1300
|
+
}
|
|
1301
|
+
],
|
|
1302
|
+
"returnType": "void",
|
|
1303
|
+
"isStatic": false,
|
|
1304
|
+
"isPublic": true
|
|
1305
|
+
},
|
|
1306
|
+
"getFeatureKeys": {
|
|
1307
|
+
"name": "getFeatureKeys",
|
|
1308
|
+
"async": false,
|
|
1309
|
+
"parameters": [],
|
|
1310
|
+
"returnType": "string[]",
|
|
1311
|
+
"isStatic": false,
|
|
1312
|
+
"isPublic": true
|
|
1313
|
+
},
|
|
1314
|
+
"getThresholds": {
|
|
1315
|
+
"name": "getThresholds",
|
|
1316
|
+
"async": false,
|
|
1317
|
+
"parameters": [],
|
|
1318
|
+
"returnType": "PlanThreshold[]",
|
|
1319
|
+
"isStatic": false,
|
|
1320
|
+
"isPublic": true
|
|
1321
|
+
},
|
|
1322
|
+
"setThresholds": {
|
|
1323
|
+
"name": "setThresholds",
|
|
1324
|
+
"async": false,
|
|
1325
|
+
"parameters": [
|
|
1326
|
+
{
|
|
1327
|
+
"name": "thresholds",
|
|
1328
|
+
"type": "PlanThreshold[]",
|
|
1329
|
+
"optional": false
|
|
1330
|
+
}
|
|
1331
|
+
],
|
|
1332
|
+
"returnType": "void",
|
|
1333
|
+
"isStatic": false,
|
|
1334
|
+
"isPublic": true
|
|
1335
|
+
},
|
|
1336
|
+
"getMetadata": {
|
|
1337
|
+
"name": "getMetadata",
|
|
1338
|
+
"async": false,
|
|
1339
|
+
"parameters": [],
|
|
1340
|
+
"returnType": "JsonObject",
|
|
1341
|
+
"isStatic": false,
|
|
1342
|
+
"isPublic": true
|
|
1343
|
+
},
|
|
1344
|
+
"setMetadata": {
|
|
1345
|
+
"name": "setMetadata",
|
|
1346
|
+
"async": false,
|
|
1347
|
+
"parameters": [
|
|
1348
|
+
{
|
|
1349
|
+
"name": "metadata",
|
|
1350
|
+
"type": "JsonObject",
|
|
1351
|
+
"optional": false
|
|
1352
|
+
}
|
|
1353
|
+
],
|
|
1354
|
+
"returnType": "void",
|
|
1355
|
+
"isStatic": false,
|
|
1356
|
+
"isPublic": true
|
|
1357
|
+
}
|
|
1358
|
+
},
|
|
1359
|
+
"decoratorConfig": {
|
|
1360
|
+
"tableName": "_smrt_subscription_plans",
|
|
1361
|
+
"api": {
|
|
1362
|
+
"include": [
|
|
1363
|
+
"list",
|
|
1364
|
+
"get",
|
|
1365
|
+
"create",
|
|
1366
|
+
"update"
|
|
1367
|
+
]
|
|
1368
|
+
},
|
|
1369
|
+
"cli": {
|
|
1370
|
+
"skipApiCheck": true
|
|
1371
|
+
},
|
|
1372
|
+
"mcp": {
|
|
1373
|
+
"include": [
|
|
1374
|
+
"list",
|
|
1375
|
+
"get"
|
|
1376
|
+
]
|
|
1377
|
+
},
|
|
1378
|
+
"conflictColumns": [
|
|
1379
|
+
"tenant_id",
|
|
1380
|
+
"plan_key"
|
|
1381
|
+
],
|
|
1382
|
+
"tenantScoped": {
|
|
1383
|
+
"mode": "optional"
|
|
1384
|
+
}
|
|
1385
|
+
},
|
|
1386
|
+
"extends": "SmrtObject",
|
|
1387
|
+
"exportName": "SubscriptionPlan",
|
|
1388
|
+
"collectionExportName": "SubscriptionPlanCollection",
|
|
1389
|
+
"displayLabelField": "name",
|
|
1390
|
+
"schema": {
|
|
1391
|
+
"tableName": "_smrt_subscription_plans",
|
|
1392
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_subscription_plans\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"plan_key\" TEXT DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"sort_order\" INTEGER DEFAULT 0,\n \"price_amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"billing_interval\" TEXT DEFAULT 'month',\n \"pricing_mode\" TEXT DEFAULT 'fixed',\n \"minimum_amount\" INTEGER DEFAULT 0,\n \"suggested_amount\" INTEGER DEFAULT 0,\n \"external_provider\" TEXT,\n \"provider_product_id\" TEXT,\n \"provider_price_id\" TEXT,\n \"stripe_product_id\" TEXT,\n \"stripe_price_id\" TEXT,\n \"features\" TEXT DEFAULT '[]',\n \"thresholds\" TEXT DEFAULT '[]',\n \"metadata\" TEXT DEFAULT '{}'\n);",
|
|
1393
|
+
"columns": {
|
|
1394
|
+
"id": {
|
|
1395
|
+
"type": "UUID",
|
|
1396
|
+
"primaryKey": true,
|
|
1397
|
+
"referenceKind": "id",
|
|
1398
|
+
"notNull": true
|
|
1399
|
+
},
|
|
1400
|
+
"slug": {
|
|
1401
|
+
"type": "TEXT",
|
|
1402
|
+
"notNull": true
|
|
1403
|
+
},
|
|
1404
|
+
"context": {
|
|
1405
|
+
"type": "TEXT",
|
|
1406
|
+
"notNull": true,
|
|
1407
|
+
"default": ""
|
|
1408
|
+
},
|
|
1409
|
+
"created_at": {
|
|
1410
|
+
"type": "TIMESTAMP",
|
|
1411
|
+
"notNull": true,
|
|
1412
|
+
"default": "current_timestamp"
|
|
1413
|
+
},
|
|
1414
|
+
"updated_at": {
|
|
1415
|
+
"type": "TIMESTAMP",
|
|
1416
|
+
"notNull": true,
|
|
1417
|
+
"default": "current_timestamp"
|
|
1418
|
+
},
|
|
1419
|
+
"tenant_id": {
|
|
1420
|
+
"type": "UUID",
|
|
1421
|
+
"referenceKind": "tenantId",
|
|
1422
|
+
"notNull": false,
|
|
1423
|
+
"unique": false
|
|
1424
|
+
},
|
|
1425
|
+
"plan_key": {
|
|
1426
|
+
"type": "TEXT",
|
|
1427
|
+
"notNull": false,
|
|
1428
|
+
"unique": false,
|
|
1429
|
+
"default": ""
|
|
1430
|
+
},
|
|
1431
|
+
"name": {
|
|
1432
|
+
"type": "TEXT",
|
|
1433
|
+
"notNull": false,
|
|
1434
|
+
"unique": false,
|
|
1435
|
+
"default": ""
|
|
1436
|
+
},
|
|
1437
|
+
"description": {
|
|
1438
|
+
"type": "TEXT",
|
|
1439
|
+
"notNull": false,
|
|
1440
|
+
"unique": false,
|
|
1441
|
+
"default": ""
|
|
1442
|
+
},
|
|
1443
|
+
"status": {
|
|
1444
|
+
"type": "TEXT",
|
|
1445
|
+
"notNull": false,
|
|
1446
|
+
"unique": false,
|
|
1447
|
+
"default": "active"
|
|
1448
|
+
},
|
|
1449
|
+
"sort_order": {
|
|
1450
|
+
"type": "INTEGER",
|
|
1451
|
+
"notNull": false,
|
|
1452
|
+
"unique": false,
|
|
1453
|
+
"default": 0
|
|
1454
|
+
},
|
|
1455
|
+
"price_amount": {
|
|
1456
|
+
"type": "INTEGER",
|
|
1457
|
+
"notNull": false,
|
|
1458
|
+
"unique": false,
|
|
1459
|
+
"default": 0
|
|
1460
|
+
},
|
|
1461
|
+
"currency": {
|
|
1462
|
+
"type": "TEXT",
|
|
1463
|
+
"notNull": false,
|
|
1464
|
+
"unique": false,
|
|
1465
|
+
"default": "USD"
|
|
1466
|
+
},
|
|
1467
|
+
"billing_interval": {
|
|
1468
|
+
"type": "TEXT",
|
|
1469
|
+
"notNull": false,
|
|
1470
|
+
"unique": false,
|
|
1471
|
+
"default": "month"
|
|
1472
|
+
},
|
|
1473
|
+
"pricing_mode": {
|
|
1474
|
+
"type": "TEXT",
|
|
1475
|
+
"notNull": false,
|
|
1476
|
+
"unique": false,
|
|
1477
|
+
"default": "fixed"
|
|
1478
|
+
},
|
|
1479
|
+
"minimum_amount": {
|
|
1480
|
+
"type": "INTEGER",
|
|
1481
|
+
"notNull": false,
|
|
1482
|
+
"unique": false,
|
|
1483
|
+
"default": 0
|
|
1484
|
+
},
|
|
1485
|
+
"suggested_amount": {
|
|
1486
|
+
"type": "INTEGER",
|
|
1487
|
+
"notNull": false,
|
|
1488
|
+
"unique": false,
|
|
1489
|
+
"default": 0
|
|
1490
|
+
},
|
|
1491
|
+
"external_provider": {
|
|
1492
|
+
"type": "TEXT",
|
|
1493
|
+
"notNull": false,
|
|
1494
|
+
"unique": false
|
|
1495
|
+
},
|
|
1496
|
+
"provider_product_id": {
|
|
1497
|
+
"type": "TEXT",
|
|
1498
|
+
"notNull": false,
|
|
1499
|
+
"unique": false
|
|
1500
|
+
},
|
|
1501
|
+
"provider_price_id": {
|
|
1502
|
+
"type": "TEXT",
|
|
1503
|
+
"notNull": false,
|
|
1504
|
+
"unique": false
|
|
1505
|
+
},
|
|
1506
|
+
"stripe_product_id": {
|
|
1507
|
+
"type": "TEXT",
|
|
1508
|
+
"notNull": false,
|
|
1509
|
+
"unique": false
|
|
1510
|
+
},
|
|
1511
|
+
"stripe_price_id": {
|
|
1512
|
+
"type": "TEXT",
|
|
1513
|
+
"notNull": false,
|
|
1514
|
+
"unique": false
|
|
1515
|
+
},
|
|
1516
|
+
"features": {
|
|
1517
|
+
"type": "TEXT",
|
|
1518
|
+
"notNull": false,
|
|
1519
|
+
"unique": false,
|
|
1520
|
+
"default": "[]"
|
|
1521
|
+
},
|
|
1522
|
+
"thresholds": {
|
|
1523
|
+
"type": "TEXT",
|
|
1524
|
+
"notNull": false,
|
|
1525
|
+
"unique": false,
|
|
1526
|
+
"default": "[]"
|
|
1527
|
+
},
|
|
1528
|
+
"metadata": {
|
|
1529
|
+
"type": "TEXT",
|
|
1530
|
+
"notNull": false,
|
|
1531
|
+
"unique": false,
|
|
1532
|
+
"default": "{}"
|
|
1533
|
+
}
|
|
1534
|
+
},
|
|
1535
|
+
"indexes": [
|
|
1536
|
+
{
|
|
1537
|
+
"name": "_smrt_subscription_plans_tenant_id_plan_key_idx",
|
|
1538
|
+
"columns": [
|
|
1539
|
+
"tenant_id",
|
|
1540
|
+
"plan_key"
|
|
1541
|
+
],
|
|
1542
|
+
"unique": true,
|
|
1543
|
+
"nullsNotDistinct": true
|
|
1544
|
+
},
|
|
1545
|
+
{
|
|
1546
|
+
"name": "_smrt_subscription_plans_slug_context_idx",
|
|
1547
|
+
"columns": [
|
|
1548
|
+
"slug",
|
|
1549
|
+
"context"
|
|
1550
|
+
]
|
|
1551
|
+
},
|
|
1552
|
+
{
|
|
1553
|
+
"name": "_smrt_subscription_plans_tenant_id_created_at_idx",
|
|
1554
|
+
"columns": [
|
|
1555
|
+
"tenant_id",
|
|
1556
|
+
"created_at"
|
|
1557
|
+
]
|
|
1558
|
+
}
|
|
1559
|
+
],
|
|
1560
|
+
"version": "02602c74"
|
|
782
1561
|
},
|
|
783
1562
|
"importPath": "@happyvertical/smrt-subscriptions"
|
|
784
1563
|
},
|
|
785
|
-
"@happyvertical/smrt-subscriptions:
|
|
786
|
-
"name": "
|
|
787
|
-
"className": "
|
|
788
|
-
"qualifiedName": "@happyvertical/smrt-subscriptions:
|
|
789
|
-
"collection": "
|
|
790
|
-
"
|
|
1564
|
+
"@happyvertical/smrt-subscriptions:SubscriptionPlanVersion": {
|
|
1565
|
+
"name": "subscriptionplanversion",
|
|
1566
|
+
"className": "SubscriptionPlanVersion",
|
|
1567
|
+
"qualifiedName": "@happyvertical/smrt-subscriptions:SubscriptionPlanVersion",
|
|
1568
|
+
"collection": "subscriptionplanversions",
|
|
1569
|
+
"description": "An immutable, effective-dated snapshot of a plan's terms (#4032).",
|
|
1570
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/SubscriptionPlanVersion.ts",
|
|
791
1571
|
"packageName": "@happyvertical/smrt-subscriptions",
|
|
792
1572
|
"fields": {
|
|
793
1573
|
"tenantId": {
|
|
@@ -808,17 +1588,26 @@
|
|
|
808
1588
|
}
|
|
809
1589
|
}
|
|
810
1590
|
},
|
|
1591
|
+
"planId": {
|
|
1592
|
+
"type": "foreignKey",
|
|
1593
|
+
"required": false,
|
|
1594
|
+
"related": "SubscriptionPlan"
|
|
1595
|
+
},
|
|
811
1596
|
"planKey": {
|
|
812
1597
|
"type": "text",
|
|
813
1598
|
"required": false,
|
|
814
1599
|
"default": ""
|
|
815
1600
|
},
|
|
816
|
-
"
|
|
817
|
-
"type": "
|
|
1601
|
+
"version": {
|
|
1602
|
+
"type": "integer",
|
|
818
1603
|
"required": false,
|
|
819
|
-
"default":
|
|
1604
|
+
"default": 0
|
|
820
1605
|
},
|
|
821
|
-
"
|
|
1606
|
+
"effectiveFrom": {
|
|
1607
|
+
"type": "datetime",
|
|
1608
|
+
"required": false
|
|
1609
|
+
},
|
|
1610
|
+
"name": {
|
|
822
1611
|
"type": "text",
|
|
823
1612
|
"required": false,
|
|
824
1613
|
"default": ""
|
|
@@ -833,11 +1622,6 @@
|
|
|
833
1622
|
"draft"
|
|
834
1623
|
]
|
|
835
1624
|
},
|
|
836
|
-
"sortOrder": {
|
|
837
|
-
"type": "integer",
|
|
838
|
-
"required": false,
|
|
839
|
-
"default": 0
|
|
840
|
-
},
|
|
841
1625
|
"priceAmount": {
|
|
842
1626
|
"type": "integer",
|
|
843
1627
|
"required": false,
|
|
@@ -879,26 +1663,6 @@
|
|
|
879
1663
|
"required": false,
|
|
880
1664
|
"default": 0
|
|
881
1665
|
},
|
|
882
|
-
"externalProvider": {
|
|
883
|
-
"type": "text",
|
|
884
|
-
"required": false
|
|
885
|
-
},
|
|
886
|
-
"providerProductId": {
|
|
887
|
-
"type": "text",
|
|
888
|
-
"required": false
|
|
889
|
-
},
|
|
890
|
-
"providerPriceId": {
|
|
891
|
-
"type": "text",
|
|
892
|
-
"required": false
|
|
893
|
-
},
|
|
894
|
-
"stripeProductId": {
|
|
895
|
-
"type": "text",
|
|
896
|
-
"required": false
|
|
897
|
-
},
|
|
898
|
-
"stripePriceId": {
|
|
899
|
-
"type": "text",
|
|
900
|
-
"required": false
|
|
901
|
-
},
|
|
902
1666
|
"features": {
|
|
903
1667
|
"type": "text",
|
|
904
1668
|
"required": false,
|
|
@@ -908,11 +1672,6 @@
|
|
|
908
1672
|
"type": "text",
|
|
909
1673
|
"required": false,
|
|
910
1674
|
"default": "[]"
|
|
911
|
-
},
|
|
912
|
-
"metadata": {
|
|
913
|
-
"type": "text",
|
|
914
|
-
"required": false,
|
|
915
|
-
"default": "{}"
|
|
916
1675
|
}
|
|
917
1676
|
},
|
|
918
1677
|
"methods": {
|
|
@@ -924,25 +1683,19 @@
|
|
|
924
1683
|
"isStatic": false,
|
|
925
1684
|
"isPublic": true
|
|
926
1685
|
},
|
|
927
|
-
"
|
|
928
|
-
"name": "
|
|
1686
|
+
"getTerms": {
|
|
1687
|
+
"name": "getTerms",
|
|
929
1688
|
"async": false,
|
|
930
1689
|
"parameters": [],
|
|
931
|
-
"returnType": "
|
|
1690
|
+
"returnType": "PlanTerms",
|
|
932
1691
|
"isStatic": false,
|
|
933
1692
|
"isPublic": true
|
|
934
1693
|
},
|
|
935
|
-
"
|
|
936
|
-
"name": "
|
|
1694
|
+
"getFeatureGrants": {
|
|
1695
|
+
"name": "getFeatureGrants",
|
|
937
1696
|
"async": false,
|
|
938
|
-
"parameters": [
|
|
939
|
-
|
|
940
|
-
"name": "grants",
|
|
941
|
-
"type": "Array<string | PlanFeatureGrant>",
|
|
942
|
-
"optional": false
|
|
943
|
-
}
|
|
944
|
-
],
|
|
945
|
-
"returnType": "void",
|
|
1697
|
+
"parameters": [],
|
|
1698
|
+
"returnType": "PlanFeatureGrant[]",
|
|
946
1699
|
"isStatic": false,
|
|
947
1700
|
"isPublic": true
|
|
948
1701
|
},
|
|
@@ -961,56 +1714,21 @@
|
|
|
961
1714
|
"returnType": "PlanThreshold[]",
|
|
962
1715
|
"isStatic": false,
|
|
963
1716
|
"isPublic": true
|
|
964
|
-
},
|
|
965
|
-
"setThresholds": {
|
|
966
|
-
"name": "setThresholds",
|
|
967
|
-
"async": false,
|
|
968
|
-
"parameters": [
|
|
969
|
-
{
|
|
970
|
-
"name": "thresholds",
|
|
971
|
-
"type": "PlanThreshold[]",
|
|
972
|
-
"optional": false
|
|
973
|
-
}
|
|
974
|
-
],
|
|
975
|
-
"returnType": "void",
|
|
976
|
-
"isStatic": false,
|
|
977
|
-
"isPublic": true
|
|
978
|
-
},
|
|
979
|
-
"getMetadata": {
|
|
980
|
-
"name": "getMetadata",
|
|
981
|
-
"async": false,
|
|
982
|
-
"parameters": [],
|
|
983
|
-
"returnType": "JsonObject",
|
|
984
|
-
"isStatic": false,
|
|
985
|
-
"isPublic": true
|
|
986
|
-
},
|
|
987
|
-
"setMetadata": {
|
|
988
|
-
"name": "setMetadata",
|
|
989
|
-
"async": false,
|
|
990
|
-
"parameters": [
|
|
991
|
-
{
|
|
992
|
-
"name": "metadata",
|
|
993
|
-
"type": "JsonObject",
|
|
994
|
-
"optional": false
|
|
995
|
-
}
|
|
996
|
-
],
|
|
997
|
-
"returnType": "void",
|
|
998
|
-
"isStatic": false,
|
|
999
|
-
"isPublic": true
|
|
1000
1717
|
}
|
|
1001
1718
|
},
|
|
1002
1719
|
"decoratorConfig": {
|
|
1003
|
-
"tableName": "
|
|
1720
|
+
"tableName": "_smrt_subscription_plan_versions",
|
|
1004
1721
|
"api": {
|
|
1005
1722
|
"include": [
|
|
1006
1723
|
"list",
|
|
1007
|
-
"get"
|
|
1008
|
-
"create",
|
|
1009
|
-
"update"
|
|
1724
|
+
"get"
|
|
1010
1725
|
]
|
|
1011
1726
|
},
|
|
1012
1727
|
"cli": {
|
|
1013
|
-
"
|
|
1728
|
+
"include": [
|
|
1729
|
+
"list",
|
|
1730
|
+
"get"
|
|
1731
|
+
]
|
|
1014
1732
|
},
|
|
1015
1733
|
"mcp": {
|
|
1016
1734
|
"include": [
|
|
@@ -1019,20 +1737,23 @@
|
|
|
1019
1737
|
]
|
|
1020
1738
|
},
|
|
1021
1739
|
"conflictColumns": [
|
|
1022
|
-
"
|
|
1023
|
-
"
|
|
1740
|
+
"plan_id",
|
|
1741
|
+
"version"
|
|
1024
1742
|
],
|
|
1743
|
+
"hooks": {
|
|
1744
|
+
"beforeDelete": "refuseDelete"
|
|
1745
|
+
},
|
|
1025
1746
|
"tenantScoped": {
|
|
1026
1747
|
"mode": "optional"
|
|
1027
1748
|
}
|
|
1028
1749
|
},
|
|
1029
1750
|
"extends": "SmrtObject",
|
|
1030
|
-
"exportName": "
|
|
1031
|
-
"collectionExportName": "
|
|
1751
|
+
"exportName": "SubscriptionPlanVersion",
|
|
1752
|
+
"collectionExportName": "SubscriptionPlanVersionCollection",
|
|
1032
1753
|
"displayLabelField": "name",
|
|
1033
1754
|
"schema": {
|
|
1034
|
-
"tableName": "
|
|
1035
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"
|
|
1755
|
+
"tableName": "_smrt_subscription_plan_versions",
|
|
1756
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_subscription_plan_versions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"plan_id\" UUID,\n \"plan_key\" TEXT DEFAULT '',\n \"version\" INTEGER DEFAULT 0,\n \"effective_from\" TIMESTAMP,\n \"name\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"price_amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"billing_interval\" TEXT DEFAULT 'month',\n \"pricing_mode\" TEXT DEFAULT 'fixed',\n \"minimum_amount\" INTEGER DEFAULT 0,\n \"suggested_amount\" INTEGER DEFAULT 0,\n \"features\" TEXT DEFAULT '[]',\n \"thresholds\" TEXT DEFAULT '[]'\n);",
|
|
1036
1757
|
"columns": {
|
|
1037
1758
|
"id": {
|
|
1038
1759
|
"type": "UUID",
|
|
@@ -1065,19 +1786,36 @@
|
|
|
1065
1786
|
"notNull": false,
|
|
1066
1787
|
"unique": false
|
|
1067
1788
|
},
|
|
1789
|
+
"plan_id": {
|
|
1790
|
+
"type": "UUID",
|
|
1791
|
+
"referenceKind": "foreignKey",
|
|
1792
|
+
"notNull": false,
|
|
1793
|
+
"unique": false,
|
|
1794
|
+
"foreignKey": {
|
|
1795
|
+
"table": "_smrt_subscription_plans",
|
|
1796
|
+
"column": "id",
|
|
1797
|
+
"onDelete": "CASCADE",
|
|
1798
|
+
"onUpdate": "CASCADE"
|
|
1799
|
+
}
|
|
1800
|
+
},
|
|
1068
1801
|
"plan_key": {
|
|
1069
1802
|
"type": "TEXT",
|
|
1070
1803
|
"notNull": false,
|
|
1071
1804
|
"unique": false,
|
|
1072
1805
|
"default": ""
|
|
1073
1806
|
},
|
|
1074
|
-
"
|
|
1075
|
-
"type": "
|
|
1807
|
+
"version": {
|
|
1808
|
+
"type": "INTEGER",
|
|
1076
1809
|
"notNull": false,
|
|
1077
1810
|
"unique": false,
|
|
1078
|
-
"default":
|
|
1811
|
+
"default": 0
|
|
1079
1812
|
},
|
|
1080
|
-
"
|
|
1813
|
+
"effective_from": {
|
|
1814
|
+
"type": "TIMESTAMP",
|
|
1815
|
+
"notNull": false,
|
|
1816
|
+
"unique": false
|
|
1817
|
+
},
|
|
1818
|
+
"name": {
|
|
1081
1819
|
"type": "TEXT",
|
|
1082
1820
|
"notNull": false,
|
|
1083
1821
|
"unique": false,
|
|
@@ -1089,12 +1827,6 @@
|
|
|
1089
1827
|
"unique": false,
|
|
1090
1828
|
"default": "active"
|
|
1091
1829
|
},
|
|
1092
|
-
"sort_order": {
|
|
1093
|
-
"type": "INTEGER",
|
|
1094
|
-
"notNull": false,
|
|
1095
|
-
"unique": false,
|
|
1096
|
-
"default": 0
|
|
1097
|
-
},
|
|
1098
1830
|
"price_amount": {
|
|
1099
1831
|
"type": "INTEGER",
|
|
1100
1832
|
"notNull": false,
|
|
@@ -1131,31 +1863,6 @@
|
|
|
1131
1863
|
"unique": false,
|
|
1132
1864
|
"default": 0
|
|
1133
1865
|
},
|
|
1134
|
-
"external_provider": {
|
|
1135
|
-
"type": "TEXT",
|
|
1136
|
-
"notNull": false,
|
|
1137
|
-
"unique": false
|
|
1138
|
-
},
|
|
1139
|
-
"provider_product_id": {
|
|
1140
|
-
"type": "TEXT",
|
|
1141
|
-
"notNull": false,
|
|
1142
|
-
"unique": false
|
|
1143
|
-
},
|
|
1144
|
-
"provider_price_id": {
|
|
1145
|
-
"type": "TEXT",
|
|
1146
|
-
"notNull": false,
|
|
1147
|
-
"unique": false
|
|
1148
|
-
},
|
|
1149
|
-
"stripe_product_id": {
|
|
1150
|
-
"type": "TEXT",
|
|
1151
|
-
"notNull": false,
|
|
1152
|
-
"unique": false
|
|
1153
|
-
},
|
|
1154
|
-
"stripe_price_id": {
|
|
1155
|
-
"type": "TEXT",
|
|
1156
|
-
"notNull": false,
|
|
1157
|
-
"unique": false
|
|
1158
|
-
},
|
|
1159
1866
|
"features": {
|
|
1160
1867
|
"type": "TEXT",
|
|
1161
1868
|
"notNull": false,
|
|
@@ -1167,40 +1874,34 @@
|
|
|
1167
1874
|
"notNull": false,
|
|
1168
1875
|
"unique": false,
|
|
1169
1876
|
"default": "[]"
|
|
1170
|
-
},
|
|
1171
|
-
"metadata": {
|
|
1172
|
-
"type": "TEXT",
|
|
1173
|
-
"notNull": false,
|
|
1174
|
-
"unique": false,
|
|
1175
|
-
"default": "{}"
|
|
1176
1877
|
}
|
|
1177
1878
|
},
|
|
1178
1879
|
"indexes": [
|
|
1179
1880
|
{
|
|
1180
|
-
"name": "
|
|
1881
|
+
"name": "_smrt_subscription_plan_versions_plan_id_version_idx",
|
|
1181
1882
|
"columns": [
|
|
1182
|
-
"
|
|
1183
|
-
"
|
|
1883
|
+
"plan_id",
|
|
1884
|
+
"version"
|
|
1184
1885
|
],
|
|
1185
1886
|
"unique": true,
|
|
1186
1887
|
"nullsNotDistinct": true
|
|
1187
1888
|
},
|
|
1188
1889
|
{
|
|
1189
|
-
"name": "
|
|
1890
|
+
"name": "_smrt_subscription_plan_versions_slug_context_idx",
|
|
1190
1891
|
"columns": [
|
|
1191
1892
|
"slug",
|
|
1192
1893
|
"context"
|
|
1193
1894
|
]
|
|
1194
1895
|
},
|
|
1195
1896
|
{
|
|
1196
|
-
"name": "
|
|
1897
|
+
"name": "_smrt_subscription_plan_versions_tenant_id_created_at_idx",
|
|
1197
1898
|
"columns": [
|
|
1198
1899
|
"tenant_id",
|
|
1199
1900
|
"created_at"
|
|
1200
1901
|
]
|
|
1201
1902
|
}
|
|
1202
1903
|
],
|
|
1203
|
-
"version": "
|
|
1904
|
+
"version": "f610e477"
|
|
1204
1905
|
},
|
|
1205
1906
|
"importPath": "@happyvertical/smrt-subscriptions"
|
|
1206
1907
|
},
|
|
@@ -1290,6 +1991,36 @@
|
|
|
1290
1991
|
"type": "integer",
|
|
1291
1992
|
"required": false
|
|
1292
1993
|
},
|
|
1994
|
+
"planVersionId": {
|
|
1995
|
+
"type": "foreignKey",
|
|
1996
|
+
"required": false,
|
|
1997
|
+
"related": "SubscriptionPlanVersion"
|
|
1998
|
+
},
|
|
1999
|
+
"planVersionPinnedAt": {
|
|
2000
|
+
"type": "datetime",
|
|
2001
|
+
"required": false
|
|
2002
|
+
},
|
|
2003
|
+
"planVersionPinReason": {
|
|
2004
|
+
"type": "text",
|
|
2005
|
+
"required": false,
|
|
2006
|
+
"enum": [
|
|
2007
|
+
"period_start",
|
|
2008
|
+
"renewal",
|
|
2009
|
+
"upgrade",
|
|
2010
|
+
"authorized",
|
|
2011
|
+
"migration"
|
|
2012
|
+
]
|
|
2013
|
+
},
|
|
2014
|
+
"planVersionPinNote": {
|
|
2015
|
+
"type": "text",
|
|
2016
|
+
"required": false,
|
|
2017
|
+
"default": ""
|
|
2018
|
+
},
|
|
2019
|
+
"retainsPaidPeriod": {
|
|
2020
|
+
"type": "boolean",
|
|
2021
|
+
"required": false,
|
|
2022
|
+
"default": false
|
|
2023
|
+
},
|
|
1293
2024
|
"externalProvider": {
|
|
1294
2025
|
"type": "text",
|
|
1295
2026
|
"required": false
|
|
@@ -1316,6 +2047,21 @@
|
|
|
1316
2047
|
}
|
|
1317
2048
|
},
|
|
1318
2049
|
"methods": {
|
|
2050
|
+
"replacePlanVersion": {
|
|
2051
|
+
"name": "replacePlanVersion",
|
|
2052
|
+
"async": true,
|
|
2053
|
+
"parameters": [
|
|
2054
|
+
{
|
|
2055
|
+
"name": "options",
|
|
2056
|
+
"type": "any",
|
|
2057
|
+
"optional": false,
|
|
2058
|
+
"typeUnresolved": true
|
|
2059
|
+
}
|
|
2060
|
+
],
|
|
2061
|
+
"returnType": "Promise<this>",
|
|
2062
|
+
"isStatic": false,
|
|
2063
|
+
"isPublic": true
|
|
2064
|
+
},
|
|
1319
2065
|
"isEntitled": {
|
|
1320
2066
|
"name": "isEntitled",
|
|
1321
2067
|
"async": false,
|
|
@@ -1395,7 +2141,7 @@
|
|
|
1395
2141
|
"validationRules": [],
|
|
1396
2142
|
"schema": {
|
|
1397
2143
|
"tableName": "_smrt_tenant_subscriptions",
|
|
1398
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_tenant_subscriptions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"subscriber_kind\" TEXT DEFAULT 'tenant',\n \"subscriber_external_id\" TEXT DEFAULT '',\n \"plan_id\" UUID,\n \"status\" TEXT DEFAULT 'incomplete',\n \"started_at\" TIMESTAMP,\n \"current_period_start\" TIMESTAMP,\n \"current_period_end\" TIMESTAMP,\n \"trial_ends_at\" TIMESTAMP,\n \"cancel_at_period_end\" BOOLEAN DEFAULT FALSE,\n \"canceled_at\" TIMESTAMP,\n \"agreed_amount\" INTEGER,\n \"external_provider\" TEXT,\n \"stripe_customer_id\" TEXT DEFAULT '',\n \"stripe_subscription_id\" TEXT DEFAULT '',\n \"stripe_checkout_session_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
|
|
2144
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_tenant_subscriptions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"subscriber_kind\" TEXT DEFAULT 'tenant',\n \"subscriber_external_id\" TEXT DEFAULT '',\n \"plan_id\" UUID,\n \"status\" TEXT DEFAULT 'incomplete',\n \"started_at\" TIMESTAMP,\n \"current_period_start\" TIMESTAMP,\n \"current_period_end\" TIMESTAMP,\n \"trial_ends_at\" TIMESTAMP,\n \"cancel_at_period_end\" BOOLEAN DEFAULT FALSE,\n \"canceled_at\" TIMESTAMP,\n \"agreed_amount\" INTEGER,\n \"plan_version_id\" UUID,\n \"plan_version_pinned_at\" TIMESTAMP,\n \"plan_version_pin_reason\" TEXT,\n \"plan_version_pin_note\" TEXT DEFAULT '',\n \"retains_paid_period\" BOOLEAN DEFAULT FALSE,\n \"external_provider\" TEXT,\n \"stripe_customer_id\" TEXT DEFAULT '',\n \"stripe_subscription_id\" TEXT DEFAULT '',\n \"stripe_checkout_session_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
|
|
1399
2145
|
"columns": {
|
|
1400
2146
|
"id": {
|
|
1401
2147
|
"type": "UUID",
|
|
@@ -1494,6 +2240,40 @@
|
|
|
1494
2240
|
"notNull": false,
|
|
1495
2241
|
"unique": false
|
|
1496
2242
|
},
|
|
2243
|
+
"plan_version_id": {
|
|
2244
|
+
"type": "UUID",
|
|
2245
|
+
"referenceKind": "foreignKey",
|
|
2246
|
+
"notNull": false,
|
|
2247
|
+
"unique": false,
|
|
2248
|
+
"foreignKey": {
|
|
2249
|
+
"table": "_smrt_subscription_plan_versions",
|
|
2250
|
+
"column": "id",
|
|
2251
|
+
"onDelete": "NO ACTION",
|
|
2252
|
+
"onUpdate": "CASCADE"
|
|
2253
|
+
}
|
|
2254
|
+
},
|
|
2255
|
+
"plan_version_pinned_at": {
|
|
2256
|
+
"type": "TIMESTAMP",
|
|
2257
|
+
"notNull": false,
|
|
2258
|
+
"unique": false
|
|
2259
|
+
},
|
|
2260
|
+
"plan_version_pin_reason": {
|
|
2261
|
+
"type": "TEXT",
|
|
2262
|
+
"notNull": false,
|
|
2263
|
+
"unique": false
|
|
2264
|
+
},
|
|
2265
|
+
"plan_version_pin_note": {
|
|
2266
|
+
"type": "TEXT",
|
|
2267
|
+
"notNull": false,
|
|
2268
|
+
"unique": false,
|
|
2269
|
+
"default": ""
|
|
2270
|
+
},
|
|
2271
|
+
"retains_paid_period": {
|
|
2272
|
+
"type": "BOOLEAN",
|
|
2273
|
+
"notNull": false,
|
|
2274
|
+
"unique": false,
|
|
2275
|
+
"default": false
|
|
2276
|
+
},
|
|
1497
2277
|
"external_provider": {
|
|
1498
2278
|
"type": "TEXT",
|
|
1499
2279
|
"notNull": false,
|
|
@@ -1554,9 +2334,15 @@
|
|
|
1554
2334
|
"columns": [
|
|
1555
2335
|
"plan_id"
|
|
1556
2336
|
]
|
|
2337
|
+
},
|
|
2338
|
+
{
|
|
2339
|
+
"name": "_smrt_tenant_subscriptions_plan_version_id_idx",
|
|
2340
|
+
"columns": [
|
|
2341
|
+
"plan_version_id"
|
|
2342
|
+
]
|
|
1557
2343
|
}
|
|
1558
2344
|
],
|
|
1559
|
-
"version": "
|
|
2345
|
+
"version": "328e412c"
|
|
1560
2346
|
},
|
|
1561
2347
|
"importPath": "@happyvertical/smrt-subscriptions"
|
|
1562
2348
|
},
|