@happyvertical/smrt-subscriptions 0.51.21 → 0.51.23
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 +29 -1
- package/README.md +126 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1067 -94
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +1758 -13
- package/dist/models/commercial.d.ts +61 -1
- package/dist/models/commercial.d.ts.map +1 -1
- package/dist/models/index.d.ts +3 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/reseller.d.ts +107 -0
- package/dist/models/reseller.d.ts.map +1 -0
- package/dist/services/commercial.d.ts +147 -6
- package/dist/services/commercial.d.ts.map +1 -1
- package/dist/services/index.d.ts +3 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/reseller-errors.d.ts +7 -0
- package/dist/services/reseller-errors.d.ts.map +1 -0
- package/dist/services/reseller.d.ts +154 -0
- package/dist/services/reseller.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +962 -183
- package/dist/utils.d.ts +2 -0
- package/dist/utils.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.51.
|
|
5
|
+
"packageVersion": "0.51.23",
|
|
6
6
|
"objects": {
|
|
7
7
|
"@happyvertical/smrt-subscriptions:SubscriptionPlanCollection": {
|
|
8
8
|
"name": "subscriptionplancollection",
|
|
@@ -1734,6 +1734,11 @@
|
|
|
1734
1734
|
"type": "boolean",
|
|
1735
1735
|
"required": false,
|
|
1736
1736
|
"default": true
|
|
1737
|
+
},
|
|
1738
|
+
"priceBookId": {
|
|
1739
|
+
"type": "foreignKey",
|
|
1740
|
+
"required": false,
|
|
1741
|
+
"related": "PriceBook"
|
|
1737
1742
|
}
|
|
1738
1743
|
},
|
|
1739
1744
|
"methods": {
|
|
@@ -1780,7 +1785,7 @@
|
|
|
1780
1785
|
"validationRules": [],
|
|
1781
1786
|
"schema": {
|
|
1782
1787
|
"tableName": "_smrt_pricing_rules",
|
|
1783
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_pricing_rules\" (\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 \"rule_key\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"service_key\" TEXT DEFAULT '',\n \"strategy\" TEXT DEFAULT 'fixed_unit',\n \"currency\" TEXT DEFAULT 'USD',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"priority\" INTEGER DEFAULT 0,\n \"terms\" TEXT DEFAULT '{}',\n \"active\" BOOLEAN DEFAULT TRUE\n);",
|
|
1788
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_pricing_rules\" (\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 \"rule_key\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"service_key\" TEXT DEFAULT '',\n \"strategy\" TEXT DEFAULT 'fixed_unit',\n \"currency\" TEXT DEFAULT 'USD',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"priority\" INTEGER DEFAULT 0,\n \"terms\" TEXT DEFAULT '{}',\n \"active\" BOOLEAN DEFAULT TRUE,\n \"price_book_id\" UUID\n);",
|
|
1784
1789
|
"columns": {
|
|
1785
1790
|
"id": {
|
|
1786
1791
|
"type": "UUID",
|
|
@@ -1870,6 +1875,18 @@
|
|
|
1870
1875
|
"notNull": false,
|
|
1871
1876
|
"unique": false,
|
|
1872
1877
|
"default": true
|
|
1878
|
+
},
|
|
1879
|
+
"price_book_id": {
|
|
1880
|
+
"type": "UUID",
|
|
1881
|
+
"referenceKind": "foreignKey",
|
|
1882
|
+
"notNull": false,
|
|
1883
|
+
"unique": false,
|
|
1884
|
+
"foreignKey": {
|
|
1885
|
+
"table": "_smrt_price_books",
|
|
1886
|
+
"column": "id",
|
|
1887
|
+
"onDelete": "NO ACTION",
|
|
1888
|
+
"onUpdate": "CASCADE"
|
|
1889
|
+
}
|
|
1873
1890
|
}
|
|
1874
1891
|
},
|
|
1875
1892
|
"indexes": [
|
|
@@ -1888,9 +1905,15 @@
|
|
|
1888
1905
|
"tenant_id",
|
|
1889
1906
|
"created_at"
|
|
1890
1907
|
]
|
|
1908
|
+
},
|
|
1909
|
+
{
|
|
1910
|
+
"name": "_smrt_pricing_rules_price_book_id_idx",
|
|
1911
|
+
"columns": [
|
|
1912
|
+
"price_book_id"
|
|
1913
|
+
]
|
|
1891
1914
|
}
|
|
1892
1915
|
],
|
|
1893
|
-
"version": "
|
|
1916
|
+
"version": "65ce9b3f"
|
|
1894
1917
|
},
|
|
1895
1918
|
"importPath": "@happyvertical/smrt-subscriptions"
|
|
1896
1919
|
},
|
|
@@ -1924,6 +1947,11 @@
|
|
|
1924
1947
|
"required": false,
|
|
1925
1948
|
"related": "TenantUsageMetric"
|
|
1926
1949
|
},
|
|
1950
|
+
"usageTenantId": {
|
|
1951
|
+
"type": "crossPackageRef",
|
|
1952
|
+
"required": false,
|
|
1953
|
+
"related": "@happyvertical/smrt-users:Tenant"
|
|
1954
|
+
},
|
|
1927
1955
|
"subscriberKind": {
|
|
1928
1956
|
"type": "text",
|
|
1929
1957
|
"required": false,
|
|
@@ -1984,6 +2012,11 @@
|
|
|
1984
2012
|
"required": false,
|
|
1985
2013
|
"related": "PricingRule"
|
|
1986
2014
|
},
|
|
2015
|
+
"priceBookId": {
|
|
2016
|
+
"type": "foreignKey",
|
|
2017
|
+
"required": false,
|
|
2018
|
+
"related": "PriceBook"
|
|
2019
|
+
},
|
|
1987
2020
|
"pricingSnapshot": {
|
|
1988
2021
|
"type": "text",
|
|
1989
2022
|
"required": false,
|
|
@@ -2042,7 +2075,7 @@
|
|
|
2042
2075
|
"validationRules": [],
|
|
2043
2076
|
"schema": {
|
|
2044
2077
|
"tableName": "_smrt_client_charges",
|
|
2045
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_client_charges\" (\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 \"usage_event_id\" UUID,\n \"subscriber_kind\" TEXT DEFAULT 'tenant',\n \"subscriber_external_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 \"service_key\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"quantity\" REAL DEFAULT 0,\n \"amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"pricing_rule_id\" UUID,\n \"pricing_snapshot\" TEXT DEFAULT '{}',\n \"status\" TEXT DEFAULT 'draft',\n \"approved_at\" TIMESTAMP\n);",
|
|
2078
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_client_charges\" (\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 \"usage_event_id\" UUID,\n \"usage_tenant_id\" UUID,\n \"subscriber_kind\" TEXT DEFAULT 'tenant',\n \"subscriber_external_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 \"service_key\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"quantity\" REAL DEFAULT 0,\n \"amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"pricing_rule_id\" UUID,\n \"price_book_id\" UUID,\n \"pricing_snapshot\" TEXT DEFAULT '{}',\n \"status\" TEXT DEFAULT 'draft',\n \"approved_at\" TIMESTAMP\n);",
|
|
2046
2079
|
"columns": {
|
|
2047
2080
|
"id": {
|
|
2048
2081
|
"type": "UUID",
|
|
@@ -2087,6 +2120,12 @@
|
|
|
2087
2120
|
"onUpdate": "CASCADE"
|
|
2088
2121
|
}
|
|
2089
2122
|
},
|
|
2123
|
+
"usage_tenant_id": {
|
|
2124
|
+
"type": "UUID",
|
|
2125
|
+
"referenceKind": "crossPackageRef",
|
|
2126
|
+
"notNull": false,
|
|
2127
|
+
"unique": false
|
|
2128
|
+
},
|
|
2090
2129
|
"subscriber_kind": {
|
|
2091
2130
|
"type": "TEXT",
|
|
2092
2131
|
"notNull": false,
|
|
@@ -2165,6 +2204,18 @@
|
|
|
2165
2204
|
"onUpdate": "CASCADE"
|
|
2166
2205
|
}
|
|
2167
2206
|
},
|
|
2207
|
+
"price_book_id": {
|
|
2208
|
+
"type": "UUID",
|
|
2209
|
+
"referenceKind": "foreignKey",
|
|
2210
|
+
"notNull": false,
|
|
2211
|
+
"unique": false,
|
|
2212
|
+
"foreignKey": {
|
|
2213
|
+
"table": "_smrt_price_books",
|
|
2214
|
+
"column": "id",
|
|
2215
|
+
"onDelete": "NO ACTION",
|
|
2216
|
+
"onUpdate": "CASCADE"
|
|
2217
|
+
}
|
|
2218
|
+
},
|
|
2168
2219
|
"pricing_snapshot": {
|
|
2169
2220
|
"type": "TEXT",
|
|
2170
2221
|
"notNull": false,
|
|
@@ -2206,14 +2257,26 @@
|
|
|
2206
2257
|
"created_at"
|
|
2207
2258
|
]
|
|
2208
2259
|
},
|
|
2260
|
+
{
|
|
2261
|
+
"name": "_smrt_client_charges_usage_tenant_id_idx",
|
|
2262
|
+
"columns": [
|
|
2263
|
+
"usage_tenant_id"
|
|
2264
|
+
]
|
|
2265
|
+
},
|
|
2209
2266
|
{
|
|
2210
2267
|
"name": "_smrt_client_charges_pricing_rule_id_idx",
|
|
2211
2268
|
"columns": [
|
|
2212
2269
|
"pricing_rule_id"
|
|
2213
2270
|
]
|
|
2271
|
+
},
|
|
2272
|
+
{
|
|
2273
|
+
"name": "_smrt_client_charges_price_book_id_idx",
|
|
2274
|
+
"columns": [
|
|
2275
|
+
"price_book_id"
|
|
2276
|
+
]
|
|
2214
2277
|
}
|
|
2215
2278
|
],
|
|
2216
|
-
"version": "
|
|
2279
|
+
"version": "e542be95"
|
|
2217
2280
|
},
|
|
2218
2281
|
"importPath": "@happyvertical/smrt-subscriptions"
|
|
2219
2282
|
},
|
|
@@ -2513,6 +2576,20 @@
|
|
|
2513
2576
|
"type": "boolean",
|
|
2514
2577
|
"required": false,
|
|
2515
2578
|
"default": true
|
|
2579
|
+
},
|
|
2580
|
+
"basis": {
|
|
2581
|
+
"type": "text",
|
|
2582
|
+
"required": false,
|
|
2583
|
+
"default": "billed"
|
|
2584
|
+
},
|
|
2585
|
+
"setByTenantId": {
|
|
2586
|
+
"type": "crossPackageRef",
|
|
2587
|
+
"required": false,
|
|
2588
|
+
"related": "@happyvertical/smrt-users:Tenant"
|
|
2589
|
+
},
|
|
2590
|
+
"balanceFrom": {
|
|
2591
|
+
"type": "datetime",
|
|
2592
|
+
"required": false
|
|
2516
2593
|
}
|
|
2517
2594
|
},
|
|
2518
2595
|
"methods": {},
|
|
@@ -2531,6 +2608,9 @@
|
|
|
2531
2608
|
"api": true,
|
|
2532
2609
|
"cli": true,
|
|
2533
2610
|
"mcp": true,
|
|
2611
|
+
"hooks": {
|
|
2612
|
+
"beforeDelete": "assertDelegationAuthority"
|
|
2613
|
+
},
|
|
2534
2614
|
"tenantScoped": {
|
|
2535
2615
|
"mode": "required"
|
|
2536
2616
|
}
|
|
@@ -2541,7 +2621,7 @@
|
|
|
2541
2621
|
"validationRules": [],
|
|
2542
2622
|
"schema": {
|
|
2543
2623
|
"tableName": "_smrt_spending_policies",
|
|
2544
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_spending_policies\" (\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 \"name\" TEXT DEFAULT '',\n \"subscriber_kind\" TEXT DEFAULT '',\n \"subscriber_external_id\" TEXT DEFAULT '',\n \"project_id\" TEXT DEFAULT '',\n \"service_key\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"period\" TEXT DEFAULT 'month',\n \"rolling_seconds\" INTEGER DEFAULT 0,\n \"limit_amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"behavior\" TEXT DEFAULT 'observe',\n \"priority\" INTEGER DEFAULT 0,\n \"active\" BOOLEAN DEFAULT TRUE\n);",
|
|
2624
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_spending_policies\" (\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 \"name\" TEXT DEFAULT '',\n \"subscriber_kind\" TEXT DEFAULT '',\n \"subscriber_external_id\" TEXT DEFAULT '',\n \"project_id\" TEXT DEFAULT '',\n \"service_key\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"period\" TEXT DEFAULT 'month',\n \"rolling_seconds\" INTEGER DEFAULT 0,\n \"limit_amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"behavior\" TEXT DEFAULT 'observe',\n \"priority\" INTEGER DEFAULT 0,\n \"active\" BOOLEAN DEFAULT TRUE,\n \"basis\" TEXT DEFAULT 'billed',\n \"set_by_tenant_id\" UUID,\n \"balance_from\" TIMESTAMP\n);",
|
|
2545
2625
|
"columns": {
|
|
2546
2626
|
"id": {
|
|
2547
2627
|
"type": "UUID",
|
|
@@ -2651,6 +2731,23 @@
|
|
|
2651
2731
|
"notNull": false,
|
|
2652
2732
|
"unique": false,
|
|
2653
2733
|
"default": true
|
|
2734
|
+
},
|
|
2735
|
+
"basis": {
|
|
2736
|
+
"type": "TEXT",
|
|
2737
|
+
"notNull": false,
|
|
2738
|
+
"unique": false,
|
|
2739
|
+
"default": "billed"
|
|
2740
|
+
},
|
|
2741
|
+
"set_by_tenant_id": {
|
|
2742
|
+
"type": "UUID",
|
|
2743
|
+
"referenceKind": "crossPackageRef",
|
|
2744
|
+
"notNull": false,
|
|
2745
|
+
"unique": false
|
|
2746
|
+
},
|
|
2747
|
+
"balance_from": {
|
|
2748
|
+
"type": "TIMESTAMP",
|
|
2749
|
+
"notNull": false,
|
|
2750
|
+
"unique": false
|
|
2654
2751
|
}
|
|
2655
2752
|
},
|
|
2656
2753
|
"indexes": [
|
|
@@ -2682,9 +2779,15 @@
|
|
|
2682
2779
|
"tenant_id",
|
|
2683
2780
|
"created_at"
|
|
2684
2781
|
]
|
|
2782
|
+
},
|
|
2783
|
+
{
|
|
2784
|
+
"name": "_smrt_spending_policies_set_by_tenant_id_idx",
|
|
2785
|
+
"columns": [
|
|
2786
|
+
"set_by_tenant_id"
|
|
2787
|
+
]
|
|
2685
2788
|
}
|
|
2686
2789
|
],
|
|
2687
|
-
"version": "
|
|
2790
|
+
"version": "c4ac2f49"
|
|
2688
2791
|
},
|
|
2689
2792
|
"importPath": "@happyvertical/smrt-subscriptions"
|
|
2690
2793
|
},
|
|
@@ -2706,7 +2809,7 @@
|
|
|
2706
2809
|
"collectionExportName": "PricingRuleCollectionCollection",
|
|
2707
2810
|
"schema": {
|
|
2708
2811
|
"tableName": "_smrt_pricing_rules",
|
|
2709
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_pricing_rules\" (\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 \"rule_key\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"service_key\" TEXT DEFAULT '',\n \"strategy\" TEXT DEFAULT 'fixed_unit',\n \"currency\" TEXT DEFAULT 'USD',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"priority\" INTEGER DEFAULT 0,\n \"terms\" TEXT DEFAULT '{}',\n \"active\" BOOLEAN DEFAULT TRUE\n);",
|
|
2812
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_pricing_rules\" (\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 \"rule_key\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"service_key\" TEXT DEFAULT '',\n \"strategy\" TEXT DEFAULT 'fixed_unit',\n \"currency\" TEXT DEFAULT 'USD',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"priority\" INTEGER DEFAULT 0,\n \"terms\" TEXT DEFAULT '{}',\n \"active\" BOOLEAN DEFAULT TRUE,\n \"price_book_id\" UUID\n);",
|
|
2710
2813
|
"columns": {
|
|
2711
2814
|
"id": {
|
|
2712
2815
|
"type": "UUID",
|
|
@@ -2796,6 +2899,18 @@
|
|
|
2796
2899
|
"notNull": false,
|
|
2797
2900
|
"unique": false,
|
|
2798
2901
|
"default": true
|
|
2902
|
+
},
|
|
2903
|
+
"price_book_id": {
|
|
2904
|
+
"type": "UUID",
|
|
2905
|
+
"referenceKind": "foreignKey",
|
|
2906
|
+
"notNull": false,
|
|
2907
|
+
"unique": false,
|
|
2908
|
+
"foreignKey": {
|
|
2909
|
+
"table": "_smrt_price_books",
|
|
2910
|
+
"column": "id",
|
|
2911
|
+
"onDelete": "NO ACTION",
|
|
2912
|
+
"onUpdate": "CASCADE"
|
|
2913
|
+
}
|
|
2799
2914
|
}
|
|
2800
2915
|
},
|
|
2801
2916
|
"indexes": [
|
|
@@ -2814,9 +2929,15 @@
|
|
|
2814
2929
|
"tenant_id",
|
|
2815
2930
|
"created_at"
|
|
2816
2931
|
]
|
|
2932
|
+
},
|
|
2933
|
+
{
|
|
2934
|
+
"name": "_smrt_pricing_rules_price_book_id_idx",
|
|
2935
|
+
"columns": [
|
|
2936
|
+
"price_book_id"
|
|
2937
|
+
]
|
|
2817
2938
|
}
|
|
2818
2939
|
],
|
|
2819
|
-
"version": "
|
|
2940
|
+
"version": "65ce9b3f"
|
|
2820
2941
|
},
|
|
2821
2942
|
"importPath": "@happyvertical/smrt-subscriptions"
|
|
2822
2943
|
},
|
|
@@ -2838,7 +2959,7 @@
|
|
|
2838
2959
|
"collectionExportName": "ClientChargeCollectionCollection",
|
|
2839
2960
|
"schema": {
|
|
2840
2961
|
"tableName": "_smrt_client_charges",
|
|
2841
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_client_charges\" (\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 \"usage_event_id\" UUID,\n \"subscriber_kind\" TEXT DEFAULT 'tenant',\n \"subscriber_external_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 \"service_key\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"quantity\" REAL DEFAULT 0,\n \"amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"pricing_rule_id\" UUID,\n \"pricing_snapshot\" TEXT DEFAULT '{}',\n \"status\" TEXT DEFAULT 'draft',\n \"approved_at\" TIMESTAMP\n);",
|
|
2962
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_client_charges\" (\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 \"usage_event_id\" UUID,\n \"usage_tenant_id\" UUID,\n \"subscriber_kind\" TEXT DEFAULT 'tenant',\n \"subscriber_external_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 \"service_key\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"quantity\" REAL DEFAULT 0,\n \"amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"pricing_rule_id\" UUID,\n \"price_book_id\" UUID,\n \"pricing_snapshot\" TEXT DEFAULT '{}',\n \"status\" TEXT DEFAULT 'draft',\n \"approved_at\" TIMESTAMP\n);",
|
|
2842
2963
|
"columns": {
|
|
2843
2964
|
"id": {
|
|
2844
2965
|
"type": "UUID",
|
|
@@ -2883,6 +3004,12 @@
|
|
|
2883
3004
|
"onUpdate": "CASCADE"
|
|
2884
3005
|
}
|
|
2885
3006
|
},
|
|
3007
|
+
"usage_tenant_id": {
|
|
3008
|
+
"type": "UUID",
|
|
3009
|
+
"referenceKind": "crossPackageRef",
|
|
3010
|
+
"notNull": false,
|
|
3011
|
+
"unique": false
|
|
3012
|
+
},
|
|
2886
3013
|
"subscriber_kind": {
|
|
2887
3014
|
"type": "TEXT",
|
|
2888
3015
|
"notNull": false,
|
|
@@ -2961,6 +3088,18 @@
|
|
|
2961
3088
|
"onUpdate": "CASCADE"
|
|
2962
3089
|
}
|
|
2963
3090
|
},
|
|
3091
|
+
"price_book_id": {
|
|
3092
|
+
"type": "UUID",
|
|
3093
|
+
"referenceKind": "foreignKey",
|
|
3094
|
+
"notNull": false,
|
|
3095
|
+
"unique": false,
|
|
3096
|
+
"foreignKey": {
|
|
3097
|
+
"table": "_smrt_price_books",
|
|
3098
|
+
"column": "id",
|
|
3099
|
+
"onDelete": "NO ACTION",
|
|
3100
|
+
"onUpdate": "CASCADE"
|
|
3101
|
+
}
|
|
3102
|
+
},
|
|
2964
3103
|
"pricing_snapshot": {
|
|
2965
3104
|
"type": "TEXT",
|
|
2966
3105
|
"notNull": false,
|
|
@@ -3002,14 +3141,26 @@
|
|
|
3002
3141
|
"created_at"
|
|
3003
3142
|
]
|
|
3004
3143
|
},
|
|
3144
|
+
{
|
|
3145
|
+
"name": "_smrt_client_charges_usage_tenant_id_idx",
|
|
3146
|
+
"columns": [
|
|
3147
|
+
"usage_tenant_id"
|
|
3148
|
+
]
|
|
3149
|
+
},
|
|
3005
3150
|
{
|
|
3006
3151
|
"name": "_smrt_client_charges_pricing_rule_id_idx",
|
|
3007
3152
|
"columns": [
|
|
3008
3153
|
"pricing_rule_id"
|
|
3009
3154
|
]
|
|
3155
|
+
},
|
|
3156
|
+
{
|
|
3157
|
+
"name": "_smrt_client_charges_price_book_id_idx",
|
|
3158
|
+
"columns": [
|
|
3159
|
+
"price_book_id"
|
|
3160
|
+
]
|
|
3010
3161
|
}
|
|
3011
3162
|
],
|
|
3012
|
-
"version": "
|
|
3163
|
+
"version": "e542be95"
|
|
3013
3164
|
},
|
|
3014
3165
|
"importPath": "@happyvertical/smrt-subscriptions"
|
|
3015
3166
|
},
|
|
@@ -3159,7 +3310,7 @@
|
|
|
3159
3310
|
"collectionExportName": "SpendingPolicyCollectionCollection",
|
|
3160
3311
|
"schema": {
|
|
3161
3312
|
"tableName": "_smrt_spending_policies",
|
|
3162
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_spending_policies\" (\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 \"name\" TEXT DEFAULT '',\n \"subscriber_kind\" TEXT DEFAULT '',\n \"subscriber_external_id\" TEXT DEFAULT '',\n \"project_id\" TEXT DEFAULT '',\n \"service_key\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"period\" TEXT DEFAULT 'month',\n \"rolling_seconds\" INTEGER DEFAULT 0,\n \"limit_amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"behavior\" TEXT DEFAULT 'observe',\n \"priority\" INTEGER DEFAULT 0,\n \"active\" BOOLEAN DEFAULT TRUE\n);",
|
|
3313
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_spending_policies\" (\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 \"name\" TEXT DEFAULT '',\n \"subscriber_kind\" TEXT DEFAULT '',\n \"subscriber_external_id\" TEXT DEFAULT '',\n \"project_id\" TEXT DEFAULT '',\n \"service_key\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"period\" TEXT DEFAULT 'month',\n \"rolling_seconds\" INTEGER DEFAULT 0,\n \"limit_amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"behavior\" TEXT DEFAULT 'observe',\n \"priority\" INTEGER DEFAULT 0,\n \"active\" BOOLEAN DEFAULT TRUE,\n \"basis\" TEXT DEFAULT 'billed',\n \"set_by_tenant_id\" UUID,\n \"balance_from\" TIMESTAMP\n);",
|
|
3163
3314
|
"columns": {
|
|
3164
3315
|
"id": {
|
|
3165
3316
|
"type": "UUID",
|
|
@@ -3269,6 +3420,23 @@
|
|
|
3269
3420
|
"notNull": false,
|
|
3270
3421
|
"unique": false,
|
|
3271
3422
|
"default": true
|
|
3423
|
+
},
|
|
3424
|
+
"basis": {
|
|
3425
|
+
"type": "TEXT",
|
|
3426
|
+
"notNull": false,
|
|
3427
|
+
"unique": false,
|
|
3428
|
+
"default": "billed"
|
|
3429
|
+
},
|
|
3430
|
+
"set_by_tenant_id": {
|
|
3431
|
+
"type": "UUID",
|
|
3432
|
+
"referenceKind": "crossPackageRef",
|
|
3433
|
+
"notNull": false,
|
|
3434
|
+
"unique": false
|
|
3435
|
+
},
|
|
3436
|
+
"balance_from": {
|
|
3437
|
+
"type": "TIMESTAMP",
|
|
3438
|
+
"notNull": false,
|
|
3439
|
+
"unique": false
|
|
3272
3440
|
}
|
|
3273
3441
|
},
|
|
3274
3442
|
"indexes": [
|
|
@@ -3300,9 +3468,1586 @@
|
|
|
3300
3468
|
"tenant_id",
|
|
3301
3469
|
"created_at"
|
|
3302
3470
|
]
|
|
3471
|
+
},
|
|
3472
|
+
{
|
|
3473
|
+
"name": "_smrt_spending_policies_set_by_tenant_id_idx",
|
|
3474
|
+
"columns": [
|
|
3475
|
+
"set_by_tenant_id"
|
|
3476
|
+
]
|
|
3477
|
+
}
|
|
3478
|
+
],
|
|
3479
|
+
"version": "c4ac2f49"
|
|
3480
|
+
},
|
|
3481
|
+
"importPath": "@happyvertical/smrt-subscriptions"
|
|
3482
|
+
},
|
|
3483
|
+
"@happyvertical/smrt-subscriptions:PriceBook": {
|
|
3484
|
+
"name": "pricebook",
|
|
3485
|
+
"className": "PriceBook",
|
|
3486
|
+
"qualifiedName": "@happyvertical/smrt-subscriptions:PriceBook",
|
|
3487
|
+
"collection": "pricebooks",
|
|
3488
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts",
|
|
3489
|
+
"packageName": "@happyvertical/smrt-subscriptions",
|
|
3490
|
+
"fields": {
|
|
3491
|
+
"tenantId": {
|
|
3492
|
+
"type": "text",
|
|
3493
|
+
"required": true,
|
|
3494
|
+
"_meta": {
|
|
3495
|
+
"sqlType": "UUID",
|
|
3496
|
+
"__tenancy": {
|
|
3497
|
+
"isTenantIdField": true,
|
|
3498
|
+
"autoFilter": true,
|
|
3499
|
+
"required": true,
|
|
3500
|
+
"autoPopulate": true,
|
|
3501
|
+
"nullable": false,
|
|
3502
|
+
"mode": "required",
|
|
3503
|
+
"field": "tenantId",
|
|
3504
|
+
"allowSuperAdminBypass": false
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3507
|
+
},
|
|
3508
|
+
"bookKey": {
|
|
3509
|
+
"type": "text",
|
|
3510
|
+
"required": false,
|
|
3511
|
+
"default": ""
|
|
3512
|
+
},
|
|
3513
|
+
"name": {
|
|
3514
|
+
"type": "text",
|
|
3515
|
+
"required": false,
|
|
3516
|
+
"default": ""
|
|
3517
|
+
},
|
|
3518
|
+
"kind": {
|
|
3519
|
+
"type": "text",
|
|
3520
|
+
"required": false,
|
|
3521
|
+
"default": "retail"
|
|
3522
|
+
},
|
|
3523
|
+
"active": {
|
|
3524
|
+
"type": "boolean",
|
|
3525
|
+
"required": false,
|
|
3526
|
+
"default": true
|
|
3527
|
+
}
|
|
3528
|
+
},
|
|
3529
|
+
"methods": {},
|
|
3530
|
+
"decoratorConfig": {
|
|
3531
|
+
"tableName": "_smrt_price_books",
|
|
3532
|
+
"conflictColumns": [
|
|
3533
|
+
"tenant_id",
|
|
3534
|
+
"book_key"
|
|
3535
|
+
],
|
|
3536
|
+
"api": false,
|
|
3537
|
+
"cli": false,
|
|
3538
|
+
"mcp": false,
|
|
3539
|
+
"tenantScoped": {
|
|
3540
|
+
"mode": "required"
|
|
3541
|
+
}
|
|
3542
|
+
},
|
|
3543
|
+
"extends": "SmrtObject",
|
|
3544
|
+
"exportName": "PriceBook",
|
|
3545
|
+
"collectionExportName": "PriceBookCollection",
|
|
3546
|
+
"validationRules": [],
|
|
3547
|
+
"schema": {
|
|
3548
|
+
"tableName": "_smrt_price_books",
|
|
3549
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_price_books\" (\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 \"book_key\" TEXT DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"kind\" TEXT DEFAULT 'retail',\n \"active\" BOOLEAN DEFAULT TRUE\n);",
|
|
3550
|
+
"columns": {
|
|
3551
|
+
"id": {
|
|
3552
|
+
"type": "UUID",
|
|
3553
|
+
"primaryKey": true,
|
|
3554
|
+
"referenceKind": "id",
|
|
3555
|
+
"notNull": true
|
|
3556
|
+
},
|
|
3557
|
+
"slug": {
|
|
3558
|
+
"type": "TEXT",
|
|
3559
|
+
"notNull": true
|
|
3560
|
+
},
|
|
3561
|
+
"context": {
|
|
3562
|
+
"type": "TEXT",
|
|
3563
|
+
"notNull": true,
|
|
3564
|
+
"default": ""
|
|
3565
|
+
},
|
|
3566
|
+
"created_at": {
|
|
3567
|
+
"type": "TIMESTAMP",
|
|
3568
|
+
"notNull": true,
|
|
3569
|
+
"default": "current_timestamp"
|
|
3570
|
+
},
|
|
3571
|
+
"updated_at": {
|
|
3572
|
+
"type": "TIMESTAMP",
|
|
3573
|
+
"notNull": true,
|
|
3574
|
+
"default": "current_timestamp"
|
|
3575
|
+
},
|
|
3576
|
+
"tenant_id": {
|
|
3577
|
+
"type": "UUID",
|
|
3578
|
+
"referenceKind": "tenantId",
|
|
3579
|
+
"notNull": true,
|
|
3580
|
+
"unique": false
|
|
3581
|
+
},
|
|
3582
|
+
"book_key": {
|
|
3583
|
+
"type": "TEXT",
|
|
3584
|
+
"notNull": false,
|
|
3585
|
+
"unique": false,
|
|
3586
|
+
"default": ""
|
|
3587
|
+
},
|
|
3588
|
+
"name": {
|
|
3589
|
+
"type": "TEXT",
|
|
3590
|
+
"notNull": false,
|
|
3591
|
+
"unique": false,
|
|
3592
|
+
"default": ""
|
|
3593
|
+
},
|
|
3594
|
+
"kind": {
|
|
3595
|
+
"type": "TEXT",
|
|
3596
|
+
"notNull": false,
|
|
3597
|
+
"unique": false,
|
|
3598
|
+
"default": "retail"
|
|
3599
|
+
},
|
|
3600
|
+
"active": {
|
|
3601
|
+
"type": "BOOLEAN",
|
|
3602
|
+
"notNull": false,
|
|
3603
|
+
"unique": false,
|
|
3604
|
+
"default": true
|
|
3605
|
+
}
|
|
3606
|
+
},
|
|
3607
|
+
"indexes": [
|
|
3608
|
+
{
|
|
3609
|
+
"name": "_smrt_price_books_tenant_id_book_key_idx",
|
|
3610
|
+
"columns": [
|
|
3611
|
+
"tenant_id",
|
|
3612
|
+
"book_key"
|
|
3613
|
+
],
|
|
3614
|
+
"unique": true,
|
|
3615
|
+
"nullsNotDistinct": true
|
|
3616
|
+
},
|
|
3617
|
+
{
|
|
3618
|
+
"name": "_smrt_price_books_slug_context_idx",
|
|
3619
|
+
"columns": [
|
|
3620
|
+
"slug",
|
|
3621
|
+
"context"
|
|
3622
|
+
]
|
|
3623
|
+
},
|
|
3624
|
+
{
|
|
3625
|
+
"name": "_smrt_price_books_tenant_id_created_at_idx",
|
|
3626
|
+
"columns": [
|
|
3627
|
+
"tenant_id",
|
|
3628
|
+
"created_at"
|
|
3629
|
+
]
|
|
3630
|
+
}
|
|
3631
|
+
],
|
|
3632
|
+
"version": "c7e5f5e0"
|
|
3633
|
+
},
|
|
3634
|
+
"importPath": "@happyvertical/smrt-subscriptions"
|
|
3635
|
+
},
|
|
3636
|
+
"@happyvertical/smrt-subscriptions:PriceBookAssignment": {
|
|
3637
|
+
"name": "pricebookassignment",
|
|
3638
|
+
"className": "PriceBookAssignment",
|
|
3639
|
+
"qualifiedName": "@happyvertical/smrt-subscriptions:PriceBookAssignment",
|
|
3640
|
+
"collection": "pricebookassignments",
|
|
3641
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts",
|
|
3642
|
+
"packageName": "@happyvertical/smrt-subscriptions",
|
|
3643
|
+
"fields": {
|
|
3644
|
+
"childTenantId": {
|
|
3645
|
+
"type": "crossPackageRef",
|
|
3646
|
+
"required": true,
|
|
3647
|
+
"related": "@happyvertical/smrt-users:Tenant",
|
|
3648
|
+
"_meta": {
|
|
3649
|
+
"required": true
|
|
3650
|
+
}
|
|
3651
|
+
},
|
|
3652
|
+
"resellerTenantId": {
|
|
3653
|
+
"type": "crossPackageRef",
|
|
3654
|
+
"required": true,
|
|
3655
|
+
"related": "@happyvertical/smrt-users:Tenant",
|
|
3656
|
+
"_meta": {
|
|
3657
|
+
"required": true
|
|
3658
|
+
}
|
|
3659
|
+
},
|
|
3660
|
+
"wholesalePriceBookId": {
|
|
3661
|
+
"type": "foreignKey",
|
|
3662
|
+
"required": false,
|
|
3663
|
+
"related": "PriceBook"
|
|
3664
|
+
},
|
|
3665
|
+
"wholesaleCurrency": {
|
|
3666
|
+
"type": "text",
|
|
3667
|
+
"required": false,
|
|
3668
|
+
"default": ""
|
|
3669
|
+
},
|
|
3670
|
+
"retailPriceBookId": {
|
|
3671
|
+
"type": "foreignKey",
|
|
3672
|
+
"required": false,
|
|
3673
|
+
"related": "PriceBook"
|
|
3674
|
+
},
|
|
3675
|
+
"retailCurrency": {
|
|
3676
|
+
"type": "text",
|
|
3677
|
+
"required": false,
|
|
3678
|
+
"default": ""
|
|
3679
|
+
}
|
|
3680
|
+
},
|
|
3681
|
+
"methods": {},
|
|
3682
|
+
"decoratorConfig": {
|
|
3683
|
+
"tableName": "_smrt_price_book_assignments",
|
|
3684
|
+
"conflictColumns": [
|
|
3685
|
+
"child_tenant_id"
|
|
3686
|
+
],
|
|
3687
|
+
"api": false,
|
|
3688
|
+
"cli": false,
|
|
3689
|
+
"mcp": false
|
|
3690
|
+
},
|
|
3691
|
+
"extends": "SmrtObject",
|
|
3692
|
+
"exportName": "PriceBookAssignment",
|
|
3693
|
+
"collectionExportName": "PriceBookAssignmentCollection",
|
|
3694
|
+
"validationRules": [
|
|
3695
|
+
{
|
|
3696
|
+
"field": "childTenantId",
|
|
3697
|
+
"rule": "required",
|
|
3698
|
+
"fieldType": "crossPackageRef"
|
|
3699
|
+
},
|
|
3700
|
+
{
|
|
3701
|
+
"field": "resellerTenantId",
|
|
3702
|
+
"rule": "required",
|
|
3703
|
+
"fieldType": "crossPackageRef"
|
|
3704
|
+
}
|
|
3705
|
+
],
|
|
3706
|
+
"schema": {
|
|
3707
|
+
"tableName": "_smrt_price_book_assignments",
|
|
3708
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_price_book_assignments\" (\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 \"child_tenant_id\" UUID NOT NULL,\n \"reseller_tenant_id\" UUID NOT NULL,\n \"wholesale_price_book_id\" UUID,\n \"wholesale_currency\" TEXT DEFAULT '',\n \"retail_price_book_id\" UUID,\n \"retail_currency\" TEXT DEFAULT ''\n);",
|
|
3709
|
+
"columns": {
|
|
3710
|
+
"id": {
|
|
3711
|
+
"type": "UUID",
|
|
3712
|
+
"primaryKey": true,
|
|
3713
|
+
"referenceKind": "id",
|
|
3714
|
+
"notNull": true
|
|
3715
|
+
},
|
|
3716
|
+
"slug": {
|
|
3717
|
+
"type": "TEXT",
|
|
3718
|
+
"notNull": true
|
|
3719
|
+
},
|
|
3720
|
+
"context": {
|
|
3721
|
+
"type": "TEXT",
|
|
3722
|
+
"notNull": true,
|
|
3723
|
+
"default": ""
|
|
3724
|
+
},
|
|
3725
|
+
"created_at": {
|
|
3726
|
+
"type": "TIMESTAMP",
|
|
3727
|
+
"notNull": true,
|
|
3728
|
+
"default": "current_timestamp"
|
|
3729
|
+
},
|
|
3730
|
+
"updated_at": {
|
|
3731
|
+
"type": "TIMESTAMP",
|
|
3732
|
+
"notNull": true,
|
|
3733
|
+
"default": "current_timestamp"
|
|
3734
|
+
},
|
|
3735
|
+
"child_tenant_id": {
|
|
3736
|
+
"type": "UUID",
|
|
3737
|
+
"referenceKind": "crossPackageRef",
|
|
3738
|
+
"notNull": true,
|
|
3739
|
+
"unique": false
|
|
3740
|
+
},
|
|
3741
|
+
"reseller_tenant_id": {
|
|
3742
|
+
"type": "UUID",
|
|
3743
|
+
"referenceKind": "crossPackageRef",
|
|
3744
|
+
"notNull": true,
|
|
3745
|
+
"unique": false
|
|
3746
|
+
},
|
|
3747
|
+
"wholesale_price_book_id": {
|
|
3748
|
+
"type": "UUID",
|
|
3749
|
+
"referenceKind": "foreignKey",
|
|
3750
|
+
"notNull": false,
|
|
3751
|
+
"unique": false,
|
|
3752
|
+
"foreignKey": {
|
|
3753
|
+
"table": "_smrt_price_books",
|
|
3754
|
+
"column": "id",
|
|
3755
|
+
"onDelete": "NO ACTION",
|
|
3756
|
+
"onUpdate": "CASCADE"
|
|
3757
|
+
}
|
|
3758
|
+
},
|
|
3759
|
+
"wholesale_currency": {
|
|
3760
|
+
"type": "TEXT",
|
|
3761
|
+
"notNull": false,
|
|
3762
|
+
"unique": false,
|
|
3763
|
+
"default": ""
|
|
3764
|
+
},
|
|
3765
|
+
"retail_price_book_id": {
|
|
3766
|
+
"type": "UUID",
|
|
3767
|
+
"referenceKind": "foreignKey",
|
|
3768
|
+
"notNull": false,
|
|
3769
|
+
"unique": false,
|
|
3770
|
+
"foreignKey": {
|
|
3771
|
+
"table": "_smrt_price_books",
|
|
3772
|
+
"column": "id",
|
|
3773
|
+
"onDelete": "NO ACTION",
|
|
3774
|
+
"onUpdate": "CASCADE"
|
|
3775
|
+
}
|
|
3776
|
+
},
|
|
3777
|
+
"retail_currency": {
|
|
3778
|
+
"type": "TEXT",
|
|
3779
|
+
"notNull": false,
|
|
3780
|
+
"unique": false,
|
|
3781
|
+
"default": ""
|
|
3782
|
+
}
|
|
3783
|
+
},
|
|
3784
|
+
"indexes": [
|
|
3785
|
+
{
|
|
3786
|
+
"name": "_smrt_price_book_assignments_child_tenant_id_idx",
|
|
3787
|
+
"columns": [
|
|
3788
|
+
"child_tenant_id"
|
|
3789
|
+
],
|
|
3790
|
+
"unique": true
|
|
3791
|
+
},
|
|
3792
|
+
{
|
|
3793
|
+
"name": "_smrt_price_book_assignments_slug_context_idx",
|
|
3794
|
+
"columns": [
|
|
3795
|
+
"slug",
|
|
3796
|
+
"context"
|
|
3797
|
+
]
|
|
3798
|
+
},
|
|
3799
|
+
{
|
|
3800
|
+
"name": "_smrt_price_book_assignments_created_at_idx",
|
|
3801
|
+
"columns": [
|
|
3802
|
+
"created_at"
|
|
3803
|
+
]
|
|
3804
|
+
},
|
|
3805
|
+
{
|
|
3806
|
+
"name": "_smrt_price_book_assignments_reseller_tenant_id_idx",
|
|
3807
|
+
"columns": [
|
|
3808
|
+
"reseller_tenant_id"
|
|
3809
|
+
]
|
|
3810
|
+
},
|
|
3811
|
+
{
|
|
3812
|
+
"name": "_smrt_price_book_assignments_wholesale_price_book_id_idx",
|
|
3813
|
+
"columns": [
|
|
3814
|
+
"wholesale_price_book_id"
|
|
3815
|
+
]
|
|
3816
|
+
},
|
|
3817
|
+
{
|
|
3818
|
+
"name": "_smrt_price_book_assignments_retail_price_book_id_idx",
|
|
3819
|
+
"columns": [
|
|
3820
|
+
"retail_price_book_id"
|
|
3821
|
+
]
|
|
3822
|
+
}
|
|
3823
|
+
],
|
|
3824
|
+
"version": "f24f020e"
|
|
3825
|
+
},
|
|
3826
|
+
"importPath": "@happyvertical/smrt-subscriptions"
|
|
3827
|
+
},
|
|
3828
|
+
"@happyvertical/smrt-subscriptions:RetailCharge": {
|
|
3829
|
+
"name": "retailcharge",
|
|
3830
|
+
"className": "RetailCharge",
|
|
3831
|
+
"qualifiedName": "@happyvertical/smrt-subscriptions:RetailCharge",
|
|
3832
|
+
"collection": "retailcharges",
|
|
3833
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts",
|
|
3834
|
+
"packageName": "@happyvertical/smrt-subscriptions",
|
|
3835
|
+
"fields": {
|
|
3836
|
+
"tenantId": {
|
|
3837
|
+
"type": "text",
|
|
3838
|
+
"required": true,
|
|
3839
|
+
"_meta": {
|
|
3840
|
+
"sqlType": "UUID",
|
|
3841
|
+
"__tenancy": {
|
|
3842
|
+
"isTenantIdField": true,
|
|
3843
|
+
"autoFilter": true,
|
|
3844
|
+
"required": true,
|
|
3845
|
+
"autoPopulate": true,
|
|
3846
|
+
"nullable": false,
|
|
3847
|
+
"mode": "required",
|
|
3848
|
+
"field": "tenantId",
|
|
3849
|
+
"allowSuperAdminBypass": false
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
},
|
|
3853
|
+
"resellerTenantId": {
|
|
3854
|
+
"type": "crossPackageRef",
|
|
3855
|
+
"required": false,
|
|
3856
|
+
"related": "@happyvertical/smrt-users:Tenant"
|
|
3857
|
+
},
|
|
3858
|
+
"usageEventId": {
|
|
3859
|
+
"type": "foreignKey",
|
|
3860
|
+
"required": false,
|
|
3861
|
+
"related": "TenantUsageMetric"
|
|
3862
|
+
},
|
|
3863
|
+
"clientChargeId": {
|
|
3864
|
+
"type": "foreignKey",
|
|
3865
|
+
"required": false,
|
|
3866
|
+
"related": "ClientCharge"
|
|
3867
|
+
},
|
|
3868
|
+
"subscriberKind": {
|
|
3869
|
+
"type": "text",
|
|
3870
|
+
"required": false,
|
|
3871
|
+
"default": "tenant"
|
|
3872
|
+
},
|
|
3873
|
+
"subscriberExternalId": {
|
|
3874
|
+
"type": "text",
|
|
3875
|
+
"required": false,
|
|
3876
|
+
"default": ""
|
|
3877
|
+
},
|
|
3878
|
+
"projectId": {
|
|
3879
|
+
"type": "text",
|
|
3880
|
+
"required": false,
|
|
3881
|
+
"default": ""
|
|
3882
|
+
},
|
|
3883
|
+
"workRefType": {
|
|
3884
|
+
"type": "text",
|
|
3885
|
+
"required": false,
|
|
3886
|
+
"default": ""
|
|
3887
|
+
},
|
|
3888
|
+
"workRefId": {
|
|
3889
|
+
"type": "text",
|
|
3890
|
+
"required": false,
|
|
3891
|
+
"default": ""
|
|
3892
|
+
},
|
|
3893
|
+
"provider": {
|
|
3894
|
+
"type": "text",
|
|
3895
|
+
"required": false,
|
|
3896
|
+
"default": ""
|
|
3897
|
+
},
|
|
3898
|
+
"serviceKey": {
|
|
3899
|
+
"type": "text",
|
|
3900
|
+
"required": false,
|
|
3901
|
+
"default": ""
|
|
3902
|
+
},
|
|
3903
|
+
"metricKey": {
|
|
3904
|
+
"type": "text",
|
|
3905
|
+
"required": false,
|
|
3906
|
+
"default": ""
|
|
3907
|
+
},
|
|
3908
|
+
"quantity": {
|
|
3909
|
+
"type": "decimal",
|
|
3910
|
+
"required": false,
|
|
3911
|
+
"default": 0
|
|
3912
|
+
},
|
|
3913
|
+
"amount": {
|
|
3914
|
+
"type": "integer",
|
|
3915
|
+
"required": false,
|
|
3916
|
+
"default": 0
|
|
3917
|
+
},
|
|
3918
|
+
"currency": {
|
|
3919
|
+
"type": "text",
|
|
3920
|
+
"required": false,
|
|
3921
|
+
"default": "USD"
|
|
3922
|
+
},
|
|
3923
|
+
"priceBookId": {
|
|
3924
|
+
"type": "foreignKey",
|
|
3925
|
+
"required": false,
|
|
3926
|
+
"related": "PriceBook"
|
|
3927
|
+
},
|
|
3928
|
+
"pricingRuleId": {
|
|
3929
|
+
"type": "foreignKey",
|
|
3930
|
+
"required": false,
|
|
3931
|
+
"related": "PricingRule"
|
|
3932
|
+
},
|
|
3933
|
+
"pricingSnapshot": {
|
|
3934
|
+
"type": "text",
|
|
3935
|
+
"required": false,
|
|
3936
|
+
"default": "{}"
|
|
3937
|
+
},
|
|
3938
|
+
"status": {
|
|
3939
|
+
"type": "text",
|
|
3940
|
+
"required": false,
|
|
3941
|
+
"default": "draft"
|
|
3942
|
+
},
|
|
3943
|
+
"approvedAt": {
|
|
3944
|
+
"type": "datetime",
|
|
3945
|
+
"required": false
|
|
3946
|
+
}
|
|
3947
|
+
},
|
|
3948
|
+
"methods": {
|
|
3949
|
+
"getPricingSnapshot": {
|
|
3950
|
+
"name": "getPricingSnapshot",
|
|
3951
|
+
"async": false,
|
|
3952
|
+
"parameters": [],
|
|
3953
|
+
"returnType": "Record<string, unknown>",
|
|
3954
|
+
"isStatic": false,
|
|
3955
|
+
"isPublic": true
|
|
3956
|
+
}
|
|
3957
|
+
},
|
|
3958
|
+
"decoratorConfig": {
|
|
3959
|
+
"tableName": "_smrt_retail_charges",
|
|
3960
|
+
"api": {
|
|
3961
|
+
"include": [
|
|
3962
|
+
"list",
|
|
3963
|
+
"get"
|
|
3964
|
+
]
|
|
3965
|
+
},
|
|
3966
|
+
"cli": {
|
|
3967
|
+
"include": [
|
|
3968
|
+
"list",
|
|
3969
|
+
"get"
|
|
3970
|
+
]
|
|
3971
|
+
},
|
|
3972
|
+
"mcp": {
|
|
3973
|
+
"include": [
|
|
3974
|
+
"list",
|
|
3975
|
+
"get"
|
|
3976
|
+
]
|
|
3977
|
+
},
|
|
3978
|
+
"conflictColumns": [
|
|
3979
|
+
"usage_event_id"
|
|
3980
|
+
],
|
|
3981
|
+
"tenantScoped": {
|
|
3982
|
+
"mode": "required"
|
|
3983
|
+
}
|
|
3984
|
+
},
|
|
3985
|
+
"extends": "SmrtObject",
|
|
3986
|
+
"exportName": "RetailCharge",
|
|
3987
|
+
"collectionExportName": "RetailChargeCollection",
|
|
3988
|
+
"validationRules": [],
|
|
3989
|
+
"schema": {
|
|
3990
|
+
"tableName": "_smrt_retail_charges",
|
|
3991
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_retail_charges\" (\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 \"reseller_tenant_id\" UUID,\n \"usage_event_id\" UUID,\n \"client_charge_id\" UUID,\n \"subscriber_kind\" TEXT DEFAULT 'tenant',\n \"subscriber_external_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 \"service_key\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"quantity\" REAL DEFAULT 0,\n \"amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"price_book_id\" UUID,\n \"pricing_rule_id\" UUID,\n \"pricing_snapshot\" TEXT DEFAULT '{}',\n \"status\" TEXT DEFAULT 'draft',\n \"approved_at\" TIMESTAMP\n);",
|
|
3992
|
+
"columns": {
|
|
3993
|
+
"id": {
|
|
3994
|
+
"type": "UUID",
|
|
3995
|
+
"primaryKey": true,
|
|
3996
|
+
"referenceKind": "id",
|
|
3997
|
+
"notNull": true
|
|
3998
|
+
},
|
|
3999
|
+
"slug": {
|
|
4000
|
+
"type": "TEXT",
|
|
4001
|
+
"notNull": true
|
|
4002
|
+
},
|
|
4003
|
+
"context": {
|
|
4004
|
+
"type": "TEXT",
|
|
4005
|
+
"notNull": true,
|
|
4006
|
+
"default": ""
|
|
4007
|
+
},
|
|
4008
|
+
"created_at": {
|
|
4009
|
+
"type": "TIMESTAMP",
|
|
4010
|
+
"notNull": true,
|
|
4011
|
+
"default": "current_timestamp"
|
|
4012
|
+
},
|
|
4013
|
+
"updated_at": {
|
|
4014
|
+
"type": "TIMESTAMP",
|
|
4015
|
+
"notNull": true,
|
|
4016
|
+
"default": "current_timestamp"
|
|
4017
|
+
},
|
|
4018
|
+
"tenant_id": {
|
|
4019
|
+
"type": "UUID",
|
|
4020
|
+
"referenceKind": "tenantId",
|
|
4021
|
+
"notNull": true,
|
|
4022
|
+
"unique": false
|
|
4023
|
+
},
|
|
4024
|
+
"reseller_tenant_id": {
|
|
4025
|
+
"type": "UUID",
|
|
4026
|
+
"referenceKind": "crossPackageRef",
|
|
4027
|
+
"notNull": false,
|
|
4028
|
+
"unique": false
|
|
4029
|
+
},
|
|
4030
|
+
"usage_event_id": {
|
|
4031
|
+
"type": "UUID",
|
|
4032
|
+
"referenceKind": "foreignKey",
|
|
4033
|
+
"notNull": false,
|
|
4034
|
+
"unique": false,
|
|
4035
|
+
"foreignKey": {
|
|
4036
|
+
"table": "_smrt_tenant_usage_metrics",
|
|
4037
|
+
"column": "id",
|
|
4038
|
+
"onDelete": "CASCADE",
|
|
4039
|
+
"onUpdate": "CASCADE"
|
|
4040
|
+
}
|
|
4041
|
+
},
|
|
4042
|
+
"client_charge_id": {
|
|
4043
|
+
"type": "UUID",
|
|
4044
|
+
"referenceKind": "foreignKey",
|
|
4045
|
+
"notNull": false,
|
|
4046
|
+
"unique": false,
|
|
4047
|
+
"foreignKey": {
|
|
4048
|
+
"table": "_smrt_client_charges",
|
|
4049
|
+
"column": "id",
|
|
4050
|
+
"onDelete": "NO ACTION",
|
|
4051
|
+
"onUpdate": "CASCADE"
|
|
4052
|
+
}
|
|
4053
|
+
},
|
|
4054
|
+
"subscriber_kind": {
|
|
4055
|
+
"type": "TEXT",
|
|
4056
|
+
"notNull": false,
|
|
4057
|
+
"unique": false,
|
|
4058
|
+
"default": "tenant"
|
|
4059
|
+
},
|
|
4060
|
+
"subscriber_external_id": {
|
|
4061
|
+
"type": "TEXT",
|
|
4062
|
+
"notNull": false,
|
|
4063
|
+
"unique": false,
|
|
4064
|
+
"default": ""
|
|
4065
|
+
},
|
|
4066
|
+
"project_id": {
|
|
4067
|
+
"type": "TEXT",
|
|
4068
|
+
"notNull": false,
|
|
4069
|
+
"unique": false,
|
|
4070
|
+
"default": ""
|
|
4071
|
+
},
|
|
4072
|
+
"work_ref_type": {
|
|
4073
|
+
"type": "TEXT",
|
|
4074
|
+
"notNull": false,
|
|
4075
|
+
"unique": false,
|
|
4076
|
+
"default": ""
|
|
4077
|
+
},
|
|
4078
|
+
"work_ref_id": {
|
|
4079
|
+
"type": "TEXT",
|
|
4080
|
+
"notNull": false,
|
|
4081
|
+
"unique": false,
|
|
4082
|
+
"default": ""
|
|
4083
|
+
},
|
|
4084
|
+
"provider": {
|
|
4085
|
+
"type": "TEXT",
|
|
4086
|
+
"notNull": false,
|
|
4087
|
+
"unique": false,
|
|
4088
|
+
"default": ""
|
|
4089
|
+
},
|
|
4090
|
+
"service_key": {
|
|
4091
|
+
"type": "TEXT",
|
|
4092
|
+
"notNull": false,
|
|
4093
|
+
"unique": false,
|
|
4094
|
+
"default": ""
|
|
4095
|
+
},
|
|
4096
|
+
"metric_key": {
|
|
4097
|
+
"type": "TEXT",
|
|
4098
|
+
"notNull": false,
|
|
4099
|
+
"unique": false,
|
|
4100
|
+
"default": ""
|
|
4101
|
+
},
|
|
4102
|
+
"quantity": {
|
|
4103
|
+
"type": "REAL",
|
|
4104
|
+
"notNull": false,
|
|
4105
|
+
"unique": false,
|
|
4106
|
+
"default": 0
|
|
4107
|
+
},
|
|
4108
|
+
"amount": {
|
|
4109
|
+
"type": "INTEGER",
|
|
4110
|
+
"notNull": false,
|
|
4111
|
+
"unique": false,
|
|
4112
|
+
"default": 0
|
|
4113
|
+
},
|
|
4114
|
+
"currency": {
|
|
4115
|
+
"type": "TEXT",
|
|
4116
|
+
"notNull": false,
|
|
4117
|
+
"unique": false,
|
|
4118
|
+
"default": "USD"
|
|
4119
|
+
},
|
|
4120
|
+
"price_book_id": {
|
|
4121
|
+
"type": "UUID",
|
|
4122
|
+
"referenceKind": "foreignKey",
|
|
4123
|
+
"notNull": false,
|
|
4124
|
+
"unique": false,
|
|
4125
|
+
"foreignKey": {
|
|
4126
|
+
"table": "_smrt_price_books",
|
|
4127
|
+
"column": "id",
|
|
4128
|
+
"onDelete": "NO ACTION",
|
|
4129
|
+
"onUpdate": "CASCADE"
|
|
4130
|
+
}
|
|
4131
|
+
},
|
|
4132
|
+
"pricing_rule_id": {
|
|
4133
|
+
"type": "UUID",
|
|
4134
|
+
"referenceKind": "foreignKey",
|
|
4135
|
+
"notNull": false,
|
|
4136
|
+
"unique": false,
|
|
4137
|
+
"foreignKey": {
|
|
4138
|
+
"table": "_smrt_pricing_rules",
|
|
4139
|
+
"column": "id",
|
|
4140
|
+
"onDelete": "NO ACTION",
|
|
4141
|
+
"onUpdate": "CASCADE"
|
|
4142
|
+
}
|
|
4143
|
+
},
|
|
4144
|
+
"pricing_snapshot": {
|
|
4145
|
+
"type": "TEXT",
|
|
4146
|
+
"notNull": false,
|
|
4147
|
+
"unique": false,
|
|
4148
|
+
"default": "{}"
|
|
4149
|
+
},
|
|
4150
|
+
"status": {
|
|
4151
|
+
"type": "TEXT",
|
|
4152
|
+
"notNull": false,
|
|
4153
|
+
"unique": false,
|
|
4154
|
+
"default": "draft"
|
|
4155
|
+
},
|
|
4156
|
+
"approved_at": {
|
|
4157
|
+
"type": "TIMESTAMP",
|
|
4158
|
+
"notNull": false,
|
|
4159
|
+
"unique": false
|
|
4160
|
+
}
|
|
4161
|
+
},
|
|
4162
|
+
"indexes": [
|
|
4163
|
+
{
|
|
4164
|
+
"name": "_smrt_retail_charges_usage_event_id_idx",
|
|
4165
|
+
"columns": [
|
|
4166
|
+
"usage_event_id"
|
|
4167
|
+
],
|
|
4168
|
+
"unique": true,
|
|
4169
|
+
"nullsNotDistinct": true
|
|
4170
|
+
},
|
|
4171
|
+
{
|
|
4172
|
+
"name": "_smrt_retail_charges_slug_context_idx",
|
|
4173
|
+
"columns": [
|
|
4174
|
+
"slug",
|
|
4175
|
+
"context"
|
|
4176
|
+
]
|
|
4177
|
+
},
|
|
4178
|
+
{
|
|
4179
|
+
"name": "_smrt_retail_charges_tenant_id_created_at_idx",
|
|
4180
|
+
"columns": [
|
|
4181
|
+
"tenant_id",
|
|
4182
|
+
"created_at"
|
|
4183
|
+
]
|
|
4184
|
+
},
|
|
4185
|
+
{
|
|
4186
|
+
"name": "_smrt_retail_charges_reseller_tenant_id_idx",
|
|
4187
|
+
"columns": [
|
|
4188
|
+
"reseller_tenant_id"
|
|
4189
|
+
]
|
|
4190
|
+
},
|
|
4191
|
+
{
|
|
4192
|
+
"name": "_smrt_retail_charges_client_charge_id_idx",
|
|
4193
|
+
"columns": [
|
|
4194
|
+
"client_charge_id"
|
|
4195
|
+
]
|
|
4196
|
+
},
|
|
4197
|
+
{
|
|
4198
|
+
"name": "_smrt_retail_charges_price_book_id_idx",
|
|
4199
|
+
"columns": [
|
|
4200
|
+
"price_book_id"
|
|
4201
|
+
]
|
|
4202
|
+
},
|
|
4203
|
+
{
|
|
4204
|
+
"name": "_smrt_retail_charges_pricing_rule_id_idx",
|
|
4205
|
+
"columns": [
|
|
4206
|
+
"pricing_rule_id"
|
|
4207
|
+
]
|
|
4208
|
+
}
|
|
4209
|
+
],
|
|
4210
|
+
"version": "1c1ae3c8"
|
|
4211
|
+
},
|
|
4212
|
+
"importPath": "@happyvertical/smrt-subscriptions"
|
|
4213
|
+
},
|
|
4214
|
+
"@happyvertical/smrt-subscriptions:CreditGrant": {
|
|
4215
|
+
"name": "creditgrant",
|
|
4216
|
+
"className": "CreditGrant",
|
|
4217
|
+
"qualifiedName": "@happyvertical/smrt-subscriptions:CreditGrant",
|
|
4218
|
+
"collection": "creditgrants",
|
|
4219
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts",
|
|
4220
|
+
"packageName": "@happyvertical/smrt-subscriptions",
|
|
4221
|
+
"fields": {
|
|
4222
|
+
"tenantId": {
|
|
4223
|
+
"type": "text",
|
|
4224
|
+
"required": true,
|
|
4225
|
+
"_meta": {
|
|
4226
|
+
"sqlType": "UUID",
|
|
4227
|
+
"__tenancy": {
|
|
4228
|
+
"isTenantIdField": true,
|
|
4229
|
+
"autoFilter": true,
|
|
4230
|
+
"required": true,
|
|
4231
|
+
"autoPopulate": true,
|
|
4232
|
+
"nullable": false,
|
|
4233
|
+
"mode": "required",
|
|
4234
|
+
"field": "tenantId",
|
|
4235
|
+
"allowSuperAdminBypass": false
|
|
4236
|
+
}
|
|
4237
|
+
}
|
|
4238
|
+
},
|
|
4239
|
+
"spendingPolicyId": {
|
|
4240
|
+
"type": "foreignKey",
|
|
4241
|
+
"required": false,
|
|
4242
|
+
"related": "SpendingPolicy"
|
|
4243
|
+
},
|
|
4244
|
+
"amount": {
|
|
4245
|
+
"type": "integer",
|
|
4246
|
+
"required": false,
|
|
4247
|
+
"default": 0
|
|
4248
|
+
},
|
|
4249
|
+
"currency": {
|
|
4250
|
+
"type": "text",
|
|
4251
|
+
"required": false,
|
|
4252
|
+
"default": "USD"
|
|
4253
|
+
},
|
|
4254
|
+
"reason": {
|
|
4255
|
+
"type": "text",
|
|
4256
|
+
"required": false,
|
|
4257
|
+
"default": ""
|
|
4258
|
+
},
|
|
4259
|
+
"source": {
|
|
4260
|
+
"type": "text",
|
|
4261
|
+
"required": false,
|
|
4262
|
+
"default": ""
|
|
4263
|
+
},
|
|
4264
|
+
"sourceId": {
|
|
4265
|
+
"type": "text",
|
|
4266
|
+
"required": false,
|
|
4267
|
+
"default": ""
|
|
4268
|
+
},
|
|
4269
|
+
"grantedByTenantId": {
|
|
4270
|
+
"type": "crossPackageRef",
|
|
4271
|
+
"required": false,
|
|
4272
|
+
"related": "@happyvertical/smrt-users:Tenant"
|
|
4273
|
+
}
|
|
4274
|
+
},
|
|
4275
|
+
"methods": {},
|
|
4276
|
+
"decoratorConfig": {
|
|
4277
|
+
"tableName": "_smrt_credit_grants",
|
|
4278
|
+
"api": {
|
|
4279
|
+
"include": [
|
|
4280
|
+
"list",
|
|
4281
|
+
"get"
|
|
4282
|
+
]
|
|
4283
|
+
},
|
|
4284
|
+
"cli": {
|
|
4285
|
+
"include": [
|
|
4286
|
+
"list",
|
|
4287
|
+
"get"
|
|
4288
|
+
]
|
|
4289
|
+
},
|
|
4290
|
+
"mcp": {
|
|
4291
|
+
"include": [
|
|
4292
|
+
"list",
|
|
4293
|
+
"get"
|
|
4294
|
+
]
|
|
4295
|
+
},
|
|
4296
|
+
"hooks": {
|
|
4297
|
+
"beforeDelete": "refuseDelete"
|
|
4298
|
+
},
|
|
4299
|
+
"tenantScoped": {
|
|
4300
|
+
"mode": "required"
|
|
4301
|
+
},
|
|
4302
|
+
"conflictColumns": [
|
|
4303
|
+
"tenant_id",
|
|
4304
|
+
"slug",
|
|
4305
|
+
"context"
|
|
4306
|
+
]
|
|
4307
|
+
},
|
|
4308
|
+
"extends": "SmrtObject",
|
|
4309
|
+
"exportName": "CreditGrant",
|
|
4310
|
+
"collectionExportName": "CreditGrantCollection",
|
|
4311
|
+
"validationRules": [],
|
|
4312
|
+
"schema": {
|
|
4313
|
+
"tableName": "_smrt_credit_grants",
|
|
4314
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_credit_grants\" (\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 \"spending_policy_id\" UUID,\n \"amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"reason\" TEXT DEFAULT '',\n \"source\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"granted_by_tenant_id\" UUID\n);",
|
|
4315
|
+
"columns": {
|
|
4316
|
+
"id": {
|
|
4317
|
+
"type": "UUID",
|
|
4318
|
+
"primaryKey": true,
|
|
4319
|
+
"referenceKind": "id",
|
|
4320
|
+
"notNull": true
|
|
4321
|
+
},
|
|
4322
|
+
"slug": {
|
|
4323
|
+
"type": "TEXT",
|
|
4324
|
+
"notNull": true
|
|
4325
|
+
},
|
|
4326
|
+
"context": {
|
|
4327
|
+
"type": "TEXT",
|
|
4328
|
+
"notNull": true,
|
|
4329
|
+
"default": ""
|
|
4330
|
+
},
|
|
4331
|
+
"created_at": {
|
|
4332
|
+
"type": "TIMESTAMP",
|
|
4333
|
+
"notNull": true,
|
|
4334
|
+
"default": "current_timestamp"
|
|
4335
|
+
},
|
|
4336
|
+
"updated_at": {
|
|
4337
|
+
"type": "TIMESTAMP",
|
|
4338
|
+
"notNull": true,
|
|
4339
|
+
"default": "current_timestamp"
|
|
4340
|
+
},
|
|
4341
|
+
"tenant_id": {
|
|
4342
|
+
"type": "UUID",
|
|
4343
|
+
"referenceKind": "tenantId",
|
|
4344
|
+
"notNull": true,
|
|
4345
|
+
"unique": false
|
|
4346
|
+
},
|
|
4347
|
+
"spending_policy_id": {
|
|
4348
|
+
"type": "UUID",
|
|
4349
|
+
"referenceKind": "foreignKey",
|
|
4350
|
+
"notNull": false,
|
|
4351
|
+
"unique": false,
|
|
4352
|
+
"foreignKey": {
|
|
4353
|
+
"table": "_smrt_spending_policies",
|
|
4354
|
+
"column": "id",
|
|
4355
|
+
"onDelete": "NO ACTION",
|
|
4356
|
+
"onUpdate": "CASCADE"
|
|
4357
|
+
}
|
|
4358
|
+
},
|
|
4359
|
+
"amount": {
|
|
4360
|
+
"type": "INTEGER",
|
|
4361
|
+
"notNull": false,
|
|
4362
|
+
"unique": false,
|
|
4363
|
+
"default": 0
|
|
4364
|
+
},
|
|
4365
|
+
"currency": {
|
|
4366
|
+
"type": "TEXT",
|
|
4367
|
+
"notNull": false,
|
|
4368
|
+
"unique": false,
|
|
4369
|
+
"default": "USD"
|
|
4370
|
+
},
|
|
4371
|
+
"reason": {
|
|
4372
|
+
"type": "TEXT",
|
|
4373
|
+
"notNull": false,
|
|
4374
|
+
"unique": false,
|
|
4375
|
+
"default": ""
|
|
4376
|
+
},
|
|
4377
|
+
"source": {
|
|
4378
|
+
"type": "TEXT",
|
|
4379
|
+
"notNull": false,
|
|
4380
|
+
"unique": false,
|
|
4381
|
+
"default": ""
|
|
4382
|
+
},
|
|
4383
|
+
"source_id": {
|
|
4384
|
+
"type": "TEXT",
|
|
4385
|
+
"notNull": false,
|
|
4386
|
+
"unique": false,
|
|
4387
|
+
"default": ""
|
|
4388
|
+
},
|
|
4389
|
+
"granted_by_tenant_id": {
|
|
4390
|
+
"type": "UUID",
|
|
4391
|
+
"referenceKind": "crossPackageRef",
|
|
4392
|
+
"notNull": false,
|
|
4393
|
+
"unique": false
|
|
4394
|
+
}
|
|
4395
|
+
},
|
|
4396
|
+
"indexes": [
|
|
4397
|
+
{
|
|
4398
|
+
"name": "_smrt_credit_grants_slug_context_idx",
|
|
4399
|
+
"columns": [
|
|
4400
|
+
"tenant_id",
|
|
4401
|
+
"slug",
|
|
4402
|
+
"context"
|
|
4403
|
+
],
|
|
4404
|
+
"unique": true
|
|
4405
|
+
},
|
|
4406
|
+
{
|
|
4407
|
+
"name": "_smrt_credit_grants_tenant_id_created_at_idx",
|
|
4408
|
+
"columns": [
|
|
4409
|
+
"tenant_id",
|
|
4410
|
+
"created_at"
|
|
4411
|
+
]
|
|
4412
|
+
},
|
|
4413
|
+
{
|
|
4414
|
+
"name": "_smrt_credit_grants_spending_policy_id_idx",
|
|
4415
|
+
"columns": [
|
|
4416
|
+
"spending_policy_id"
|
|
4417
|
+
]
|
|
4418
|
+
},
|
|
4419
|
+
{
|
|
4420
|
+
"name": "_smrt_credit_grants_granted_by_tenant_id_idx",
|
|
4421
|
+
"columns": [
|
|
4422
|
+
"granted_by_tenant_id"
|
|
4423
|
+
]
|
|
4424
|
+
}
|
|
4425
|
+
],
|
|
4426
|
+
"version": "602c4e02"
|
|
4427
|
+
},
|
|
4428
|
+
"importPath": "@happyvertical/smrt-subscriptions"
|
|
4429
|
+
},
|
|
4430
|
+
"@happyvertical/smrt-subscriptions:PriceBookCollection": {
|
|
4431
|
+
"name": "pricebookcollection",
|
|
4432
|
+
"className": "PriceBookCollection",
|
|
4433
|
+
"qualifiedName": "@happyvertical/smrt-subscriptions:PriceBookCollection",
|
|
4434
|
+
"collection": "pricebooks",
|
|
4435
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts",
|
|
4436
|
+
"packageName": "@happyvertical/smrt-subscriptions",
|
|
4437
|
+
"fields": {},
|
|
4438
|
+
"methods": {},
|
|
4439
|
+
"decoratorConfig": {
|
|
4440
|
+
"tableName": "_smrt_price_books",
|
|
4441
|
+
"api": false,
|
|
4442
|
+
"mcp": false,
|
|
4443
|
+
"cli": false
|
|
4444
|
+
},
|
|
4445
|
+
"extends": "SmrtCollection",
|
|
4446
|
+
"extendsTypeArg": "PriceBook",
|
|
4447
|
+
"exportName": "PriceBookCollection",
|
|
4448
|
+
"collectionExportName": "PriceBookCollectionCollection",
|
|
4449
|
+
"schema": {
|
|
4450
|
+
"tableName": "_smrt_price_books",
|
|
4451
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_price_books\" (\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 \"book_key\" TEXT DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"kind\" TEXT DEFAULT 'retail',\n \"active\" BOOLEAN DEFAULT TRUE\n);",
|
|
4452
|
+
"columns": {
|
|
4453
|
+
"id": {
|
|
4454
|
+
"type": "UUID",
|
|
4455
|
+
"primaryKey": true,
|
|
4456
|
+
"referenceKind": "id",
|
|
4457
|
+
"notNull": true
|
|
4458
|
+
},
|
|
4459
|
+
"slug": {
|
|
4460
|
+
"type": "TEXT",
|
|
4461
|
+
"notNull": true
|
|
4462
|
+
},
|
|
4463
|
+
"context": {
|
|
4464
|
+
"type": "TEXT",
|
|
4465
|
+
"notNull": true,
|
|
4466
|
+
"default": ""
|
|
4467
|
+
},
|
|
4468
|
+
"created_at": {
|
|
4469
|
+
"type": "TIMESTAMP",
|
|
4470
|
+
"notNull": true,
|
|
4471
|
+
"default": "current_timestamp"
|
|
4472
|
+
},
|
|
4473
|
+
"updated_at": {
|
|
4474
|
+
"type": "TIMESTAMP",
|
|
4475
|
+
"notNull": true,
|
|
4476
|
+
"default": "current_timestamp"
|
|
4477
|
+
},
|
|
4478
|
+
"tenant_id": {
|
|
4479
|
+
"type": "UUID",
|
|
4480
|
+
"referenceKind": "tenantId",
|
|
4481
|
+
"notNull": true,
|
|
4482
|
+
"unique": false
|
|
4483
|
+
},
|
|
4484
|
+
"book_key": {
|
|
4485
|
+
"type": "TEXT",
|
|
4486
|
+
"notNull": false,
|
|
4487
|
+
"unique": false,
|
|
4488
|
+
"default": ""
|
|
4489
|
+
},
|
|
4490
|
+
"name": {
|
|
4491
|
+
"type": "TEXT",
|
|
4492
|
+
"notNull": false,
|
|
4493
|
+
"unique": false,
|
|
4494
|
+
"default": ""
|
|
4495
|
+
},
|
|
4496
|
+
"kind": {
|
|
4497
|
+
"type": "TEXT",
|
|
4498
|
+
"notNull": false,
|
|
4499
|
+
"unique": false,
|
|
4500
|
+
"default": "retail"
|
|
4501
|
+
},
|
|
4502
|
+
"active": {
|
|
4503
|
+
"type": "BOOLEAN",
|
|
4504
|
+
"notNull": false,
|
|
4505
|
+
"unique": false,
|
|
4506
|
+
"default": true
|
|
4507
|
+
}
|
|
4508
|
+
},
|
|
4509
|
+
"indexes": [
|
|
4510
|
+
{
|
|
4511
|
+
"name": "_smrt_price_books_tenant_id_book_key_idx",
|
|
4512
|
+
"columns": [
|
|
4513
|
+
"tenant_id",
|
|
4514
|
+
"book_key"
|
|
4515
|
+
],
|
|
4516
|
+
"unique": true,
|
|
4517
|
+
"nullsNotDistinct": true
|
|
4518
|
+
},
|
|
4519
|
+
{
|
|
4520
|
+
"name": "_smrt_price_books_slug_context_idx",
|
|
4521
|
+
"columns": [
|
|
4522
|
+
"slug",
|
|
4523
|
+
"context"
|
|
4524
|
+
]
|
|
4525
|
+
},
|
|
4526
|
+
{
|
|
4527
|
+
"name": "_smrt_price_books_tenant_id_created_at_idx",
|
|
4528
|
+
"columns": [
|
|
4529
|
+
"tenant_id",
|
|
4530
|
+
"created_at"
|
|
4531
|
+
]
|
|
4532
|
+
}
|
|
4533
|
+
],
|
|
4534
|
+
"version": "c7e5f5e0"
|
|
4535
|
+
},
|
|
4536
|
+
"importPath": "@happyvertical/smrt-subscriptions"
|
|
4537
|
+
},
|
|
4538
|
+
"@happyvertical/smrt-subscriptions:PriceBookAssignmentCollection": {
|
|
4539
|
+
"name": "pricebookassignmentcollection",
|
|
4540
|
+
"className": "PriceBookAssignmentCollection",
|
|
4541
|
+
"qualifiedName": "@happyvertical/smrt-subscriptions:PriceBookAssignmentCollection",
|
|
4542
|
+
"collection": "pricebookassignments",
|
|
4543
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts",
|
|
4544
|
+
"packageName": "@happyvertical/smrt-subscriptions",
|
|
4545
|
+
"fields": {},
|
|
4546
|
+
"methods": {},
|
|
4547
|
+
"decoratorConfig": {
|
|
4548
|
+
"tableName": "_smrt_price_book_assignments",
|
|
4549
|
+
"api": false,
|
|
4550
|
+
"mcp": false,
|
|
4551
|
+
"cli": false
|
|
4552
|
+
},
|
|
4553
|
+
"extends": "SmrtCollection",
|
|
4554
|
+
"extendsTypeArg": "PriceBookAssignment",
|
|
4555
|
+
"exportName": "PriceBookAssignmentCollection",
|
|
4556
|
+
"collectionExportName": "PriceBookAssignmentCollectionCollection",
|
|
4557
|
+
"schema": {
|
|
4558
|
+
"tableName": "_smrt_price_book_assignments",
|
|
4559
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_price_book_assignments\" (\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 \"child_tenant_id\" UUID NOT NULL,\n \"reseller_tenant_id\" UUID NOT NULL,\n \"wholesale_price_book_id\" UUID,\n \"wholesale_currency\" TEXT DEFAULT '',\n \"retail_price_book_id\" UUID,\n \"retail_currency\" TEXT DEFAULT ''\n);",
|
|
4560
|
+
"columns": {
|
|
4561
|
+
"id": {
|
|
4562
|
+
"type": "UUID",
|
|
4563
|
+
"primaryKey": true,
|
|
4564
|
+
"referenceKind": "id",
|
|
4565
|
+
"notNull": true
|
|
4566
|
+
},
|
|
4567
|
+
"slug": {
|
|
4568
|
+
"type": "TEXT",
|
|
4569
|
+
"notNull": true
|
|
4570
|
+
},
|
|
4571
|
+
"context": {
|
|
4572
|
+
"type": "TEXT",
|
|
4573
|
+
"notNull": true,
|
|
4574
|
+
"default": ""
|
|
4575
|
+
},
|
|
4576
|
+
"created_at": {
|
|
4577
|
+
"type": "TIMESTAMP",
|
|
4578
|
+
"notNull": true,
|
|
4579
|
+
"default": "current_timestamp"
|
|
4580
|
+
},
|
|
4581
|
+
"updated_at": {
|
|
4582
|
+
"type": "TIMESTAMP",
|
|
4583
|
+
"notNull": true,
|
|
4584
|
+
"default": "current_timestamp"
|
|
4585
|
+
},
|
|
4586
|
+
"child_tenant_id": {
|
|
4587
|
+
"type": "UUID",
|
|
4588
|
+
"referenceKind": "crossPackageRef",
|
|
4589
|
+
"notNull": true,
|
|
4590
|
+
"unique": false
|
|
4591
|
+
},
|
|
4592
|
+
"reseller_tenant_id": {
|
|
4593
|
+
"type": "UUID",
|
|
4594
|
+
"referenceKind": "crossPackageRef",
|
|
4595
|
+
"notNull": true,
|
|
4596
|
+
"unique": false
|
|
4597
|
+
},
|
|
4598
|
+
"wholesale_price_book_id": {
|
|
4599
|
+
"type": "UUID",
|
|
4600
|
+
"referenceKind": "foreignKey",
|
|
4601
|
+
"notNull": false,
|
|
4602
|
+
"unique": false,
|
|
4603
|
+
"foreignKey": {
|
|
4604
|
+
"table": "_smrt_price_books",
|
|
4605
|
+
"column": "id",
|
|
4606
|
+
"onDelete": "NO ACTION",
|
|
4607
|
+
"onUpdate": "CASCADE"
|
|
4608
|
+
}
|
|
4609
|
+
},
|
|
4610
|
+
"wholesale_currency": {
|
|
4611
|
+
"type": "TEXT",
|
|
4612
|
+
"notNull": false,
|
|
4613
|
+
"unique": false,
|
|
4614
|
+
"default": ""
|
|
4615
|
+
},
|
|
4616
|
+
"retail_price_book_id": {
|
|
4617
|
+
"type": "UUID",
|
|
4618
|
+
"referenceKind": "foreignKey",
|
|
4619
|
+
"notNull": false,
|
|
4620
|
+
"unique": false,
|
|
4621
|
+
"foreignKey": {
|
|
4622
|
+
"table": "_smrt_price_books",
|
|
4623
|
+
"column": "id",
|
|
4624
|
+
"onDelete": "NO ACTION",
|
|
4625
|
+
"onUpdate": "CASCADE"
|
|
4626
|
+
}
|
|
4627
|
+
},
|
|
4628
|
+
"retail_currency": {
|
|
4629
|
+
"type": "TEXT",
|
|
4630
|
+
"notNull": false,
|
|
4631
|
+
"unique": false,
|
|
4632
|
+
"default": ""
|
|
4633
|
+
}
|
|
4634
|
+
},
|
|
4635
|
+
"indexes": [
|
|
4636
|
+
{
|
|
4637
|
+
"name": "_smrt_price_book_assignments_child_tenant_id_idx",
|
|
4638
|
+
"columns": [
|
|
4639
|
+
"child_tenant_id"
|
|
4640
|
+
],
|
|
4641
|
+
"unique": true
|
|
4642
|
+
},
|
|
4643
|
+
{
|
|
4644
|
+
"name": "_smrt_price_book_assignments_slug_context_idx",
|
|
4645
|
+
"columns": [
|
|
4646
|
+
"slug",
|
|
4647
|
+
"context"
|
|
4648
|
+
]
|
|
4649
|
+
},
|
|
4650
|
+
{
|
|
4651
|
+
"name": "_smrt_price_book_assignments_created_at_idx",
|
|
4652
|
+
"columns": [
|
|
4653
|
+
"created_at"
|
|
4654
|
+
]
|
|
4655
|
+
},
|
|
4656
|
+
{
|
|
4657
|
+
"name": "_smrt_price_book_assignments_reseller_tenant_id_idx",
|
|
4658
|
+
"columns": [
|
|
4659
|
+
"reseller_tenant_id"
|
|
4660
|
+
]
|
|
4661
|
+
},
|
|
4662
|
+
{
|
|
4663
|
+
"name": "_smrt_price_book_assignments_wholesale_price_book_id_idx",
|
|
4664
|
+
"columns": [
|
|
4665
|
+
"wholesale_price_book_id"
|
|
4666
|
+
]
|
|
4667
|
+
},
|
|
4668
|
+
{
|
|
4669
|
+
"name": "_smrt_price_book_assignments_retail_price_book_id_idx",
|
|
4670
|
+
"columns": [
|
|
4671
|
+
"retail_price_book_id"
|
|
4672
|
+
]
|
|
4673
|
+
}
|
|
4674
|
+
],
|
|
4675
|
+
"version": "f24f020e"
|
|
4676
|
+
},
|
|
4677
|
+
"importPath": "@happyvertical/smrt-subscriptions"
|
|
4678
|
+
},
|
|
4679
|
+
"@happyvertical/smrt-subscriptions:RetailChargeCollection": {
|
|
4680
|
+
"name": "retailchargecollection",
|
|
4681
|
+
"className": "RetailChargeCollection",
|
|
4682
|
+
"qualifiedName": "@happyvertical/smrt-subscriptions:RetailChargeCollection",
|
|
4683
|
+
"collection": "retailcharges",
|
|
4684
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts",
|
|
4685
|
+
"packageName": "@happyvertical/smrt-subscriptions",
|
|
4686
|
+
"fields": {},
|
|
4687
|
+
"methods": {},
|
|
4688
|
+
"decoratorConfig": {
|
|
4689
|
+
"tableName": "_smrt_retail_charges"
|
|
4690
|
+
},
|
|
4691
|
+
"extends": "SmrtCollection",
|
|
4692
|
+
"extendsTypeArg": "RetailCharge",
|
|
4693
|
+
"exportName": "RetailChargeCollection",
|
|
4694
|
+
"collectionExportName": "RetailChargeCollectionCollection",
|
|
4695
|
+
"schema": {
|
|
4696
|
+
"tableName": "_smrt_retail_charges",
|
|
4697
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_retail_charges\" (\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 \"reseller_tenant_id\" UUID,\n \"usage_event_id\" UUID,\n \"client_charge_id\" UUID,\n \"subscriber_kind\" TEXT DEFAULT 'tenant',\n \"subscriber_external_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 \"service_key\" TEXT DEFAULT '',\n \"metric_key\" TEXT DEFAULT '',\n \"quantity\" REAL DEFAULT 0,\n \"amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"price_book_id\" UUID,\n \"pricing_rule_id\" UUID,\n \"pricing_snapshot\" TEXT DEFAULT '{}',\n \"status\" TEXT DEFAULT 'draft',\n \"approved_at\" TIMESTAMP\n);",
|
|
4698
|
+
"columns": {
|
|
4699
|
+
"id": {
|
|
4700
|
+
"type": "UUID",
|
|
4701
|
+
"primaryKey": true,
|
|
4702
|
+
"referenceKind": "id",
|
|
4703
|
+
"notNull": true
|
|
4704
|
+
},
|
|
4705
|
+
"slug": {
|
|
4706
|
+
"type": "TEXT",
|
|
4707
|
+
"notNull": true
|
|
4708
|
+
},
|
|
4709
|
+
"context": {
|
|
4710
|
+
"type": "TEXT",
|
|
4711
|
+
"notNull": true,
|
|
4712
|
+
"default": ""
|
|
4713
|
+
},
|
|
4714
|
+
"created_at": {
|
|
4715
|
+
"type": "TIMESTAMP",
|
|
4716
|
+
"notNull": true,
|
|
4717
|
+
"default": "current_timestamp"
|
|
4718
|
+
},
|
|
4719
|
+
"updated_at": {
|
|
4720
|
+
"type": "TIMESTAMP",
|
|
4721
|
+
"notNull": true,
|
|
4722
|
+
"default": "current_timestamp"
|
|
4723
|
+
},
|
|
4724
|
+
"tenant_id": {
|
|
4725
|
+
"type": "UUID",
|
|
4726
|
+
"referenceKind": "tenantId",
|
|
4727
|
+
"notNull": true,
|
|
4728
|
+
"unique": false
|
|
4729
|
+
},
|
|
4730
|
+
"reseller_tenant_id": {
|
|
4731
|
+
"type": "UUID",
|
|
4732
|
+
"referenceKind": "crossPackageRef",
|
|
4733
|
+
"notNull": false,
|
|
4734
|
+
"unique": false
|
|
4735
|
+
},
|
|
4736
|
+
"usage_event_id": {
|
|
4737
|
+
"type": "UUID",
|
|
4738
|
+
"referenceKind": "foreignKey",
|
|
4739
|
+
"notNull": false,
|
|
4740
|
+
"unique": false,
|
|
4741
|
+
"foreignKey": {
|
|
4742
|
+
"table": "_smrt_tenant_usage_metrics",
|
|
4743
|
+
"column": "id",
|
|
4744
|
+
"onDelete": "CASCADE",
|
|
4745
|
+
"onUpdate": "CASCADE"
|
|
4746
|
+
}
|
|
4747
|
+
},
|
|
4748
|
+
"client_charge_id": {
|
|
4749
|
+
"type": "UUID",
|
|
4750
|
+
"referenceKind": "foreignKey",
|
|
4751
|
+
"notNull": false,
|
|
4752
|
+
"unique": false,
|
|
4753
|
+
"foreignKey": {
|
|
4754
|
+
"table": "_smrt_client_charges",
|
|
4755
|
+
"column": "id",
|
|
4756
|
+
"onDelete": "NO ACTION",
|
|
4757
|
+
"onUpdate": "CASCADE"
|
|
4758
|
+
}
|
|
4759
|
+
},
|
|
4760
|
+
"subscriber_kind": {
|
|
4761
|
+
"type": "TEXT",
|
|
4762
|
+
"notNull": false,
|
|
4763
|
+
"unique": false,
|
|
4764
|
+
"default": "tenant"
|
|
4765
|
+
},
|
|
4766
|
+
"subscriber_external_id": {
|
|
4767
|
+
"type": "TEXT",
|
|
4768
|
+
"notNull": false,
|
|
4769
|
+
"unique": false,
|
|
4770
|
+
"default": ""
|
|
4771
|
+
},
|
|
4772
|
+
"project_id": {
|
|
4773
|
+
"type": "TEXT",
|
|
4774
|
+
"notNull": false,
|
|
4775
|
+
"unique": false,
|
|
4776
|
+
"default": ""
|
|
4777
|
+
},
|
|
4778
|
+
"work_ref_type": {
|
|
4779
|
+
"type": "TEXT",
|
|
4780
|
+
"notNull": false,
|
|
4781
|
+
"unique": false,
|
|
4782
|
+
"default": ""
|
|
4783
|
+
},
|
|
4784
|
+
"work_ref_id": {
|
|
4785
|
+
"type": "TEXT",
|
|
4786
|
+
"notNull": false,
|
|
4787
|
+
"unique": false,
|
|
4788
|
+
"default": ""
|
|
4789
|
+
},
|
|
4790
|
+
"provider": {
|
|
4791
|
+
"type": "TEXT",
|
|
4792
|
+
"notNull": false,
|
|
4793
|
+
"unique": false,
|
|
4794
|
+
"default": ""
|
|
4795
|
+
},
|
|
4796
|
+
"service_key": {
|
|
4797
|
+
"type": "TEXT",
|
|
4798
|
+
"notNull": false,
|
|
4799
|
+
"unique": false,
|
|
4800
|
+
"default": ""
|
|
4801
|
+
},
|
|
4802
|
+
"metric_key": {
|
|
4803
|
+
"type": "TEXT",
|
|
4804
|
+
"notNull": false,
|
|
4805
|
+
"unique": false,
|
|
4806
|
+
"default": ""
|
|
4807
|
+
},
|
|
4808
|
+
"quantity": {
|
|
4809
|
+
"type": "REAL",
|
|
4810
|
+
"notNull": false,
|
|
4811
|
+
"unique": false,
|
|
4812
|
+
"default": 0
|
|
4813
|
+
},
|
|
4814
|
+
"amount": {
|
|
4815
|
+
"type": "INTEGER",
|
|
4816
|
+
"notNull": false,
|
|
4817
|
+
"unique": false,
|
|
4818
|
+
"default": 0
|
|
4819
|
+
},
|
|
4820
|
+
"currency": {
|
|
4821
|
+
"type": "TEXT",
|
|
4822
|
+
"notNull": false,
|
|
4823
|
+
"unique": false,
|
|
4824
|
+
"default": "USD"
|
|
4825
|
+
},
|
|
4826
|
+
"price_book_id": {
|
|
4827
|
+
"type": "UUID",
|
|
4828
|
+
"referenceKind": "foreignKey",
|
|
4829
|
+
"notNull": false,
|
|
4830
|
+
"unique": false,
|
|
4831
|
+
"foreignKey": {
|
|
4832
|
+
"table": "_smrt_price_books",
|
|
4833
|
+
"column": "id",
|
|
4834
|
+
"onDelete": "NO ACTION",
|
|
4835
|
+
"onUpdate": "CASCADE"
|
|
4836
|
+
}
|
|
4837
|
+
},
|
|
4838
|
+
"pricing_rule_id": {
|
|
4839
|
+
"type": "UUID",
|
|
4840
|
+
"referenceKind": "foreignKey",
|
|
4841
|
+
"notNull": false,
|
|
4842
|
+
"unique": false,
|
|
4843
|
+
"foreignKey": {
|
|
4844
|
+
"table": "_smrt_pricing_rules",
|
|
4845
|
+
"column": "id",
|
|
4846
|
+
"onDelete": "NO ACTION",
|
|
4847
|
+
"onUpdate": "CASCADE"
|
|
4848
|
+
}
|
|
4849
|
+
},
|
|
4850
|
+
"pricing_snapshot": {
|
|
4851
|
+
"type": "TEXT",
|
|
4852
|
+
"notNull": false,
|
|
4853
|
+
"unique": false,
|
|
4854
|
+
"default": "{}"
|
|
4855
|
+
},
|
|
4856
|
+
"status": {
|
|
4857
|
+
"type": "TEXT",
|
|
4858
|
+
"notNull": false,
|
|
4859
|
+
"unique": false,
|
|
4860
|
+
"default": "draft"
|
|
4861
|
+
},
|
|
4862
|
+
"approved_at": {
|
|
4863
|
+
"type": "TIMESTAMP",
|
|
4864
|
+
"notNull": false,
|
|
4865
|
+
"unique": false
|
|
4866
|
+
}
|
|
4867
|
+
},
|
|
4868
|
+
"indexes": [
|
|
4869
|
+
{
|
|
4870
|
+
"name": "_smrt_retail_charges_usage_event_id_idx",
|
|
4871
|
+
"columns": [
|
|
4872
|
+
"usage_event_id"
|
|
4873
|
+
],
|
|
4874
|
+
"unique": true,
|
|
4875
|
+
"nullsNotDistinct": true
|
|
4876
|
+
},
|
|
4877
|
+
{
|
|
4878
|
+
"name": "_smrt_retail_charges_slug_context_idx",
|
|
4879
|
+
"columns": [
|
|
4880
|
+
"slug",
|
|
4881
|
+
"context"
|
|
4882
|
+
]
|
|
4883
|
+
},
|
|
4884
|
+
{
|
|
4885
|
+
"name": "_smrt_retail_charges_tenant_id_created_at_idx",
|
|
4886
|
+
"columns": [
|
|
4887
|
+
"tenant_id",
|
|
4888
|
+
"created_at"
|
|
4889
|
+
]
|
|
4890
|
+
},
|
|
4891
|
+
{
|
|
4892
|
+
"name": "_smrt_retail_charges_reseller_tenant_id_idx",
|
|
4893
|
+
"columns": [
|
|
4894
|
+
"reseller_tenant_id"
|
|
4895
|
+
]
|
|
4896
|
+
},
|
|
4897
|
+
{
|
|
4898
|
+
"name": "_smrt_retail_charges_client_charge_id_idx",
|
|
4899
|
+
"columns": [
|
|
4900
|
+
"client_charge_id"
|
|
4901
|
+
]
|
|
4902
|
+
},
|
|
4903
|
+
{
|
|
4904
|
+
"name": "_smrt_retail_charges_price_book_id_idx",
|
|
4905
|
+
"columns": [
|
|
4906
|
+
"price_book_id"
|
|
4907
|
+
]
|
|
4908
|
+
},
|
|
4909
|
+
{
|
|
4910
|
+
"name": "_smrt_retail_charges_pricing_rule_id_idx",
|
|
4911
|
+
"columns": [
|
|
4912
|
+
"pricing_rule_id"
|
|
4913
|
+
]
|
|
4914
|
+
}
|
|
4915
|
+
],
|
|
4916
|
+
"version": "1c1ae3c8"
|
|
4917
|
+
},
|
|
4918
|
+
"importPath": "@happyvertical/smrt-subscriptions"
|
|
4919
|
+
},
|
|
4920
|
+
"@happyvertical/smrt-subscriptions:CreditGrantCollection": {
|
|
4921
|
+
"name": "creditgrantcollection",
|
|
4922
|
+
"className": "CreditGrantCollection",
|
|
4923
|
+
"qualifiedName": "@happyvertical/smrt-subscriptions:CreditGrantCollection",
|
|
4924
|
+
"collection": "creditgrants",
|
|
4925
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/reseller.ts",
|
|
4926
|
+
"packageName": "@happyvertical/smrt-subscriptions",
|
|
4927
|
+
"fields": {},
|
|
4928
|
+
"methods": {},
|
|
4929
|
+
"decoratorConfig": {
|
|
4930
|
+
"tableName": "_smrt_credit_grants"
|
|
4931
|
+
},
|
|
4932
|
+
"extends": "SmrtCollection",
|
|
4933
|
+
"extendsTypeArg": "CreditGrant",
|
|
4934
|
+
"exportName": "CreditGrantCollection",
|
|
4935
|
+
"collectionExportName": "CreditGrantCollectionCollection",
|
|
4936
|
+
"schema": {
|
|
4937
|
+
"tableName": "_smrt_credit_grants",
|
|
4938
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_credit_grants\" (\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 \"spending_policy_id\" UUID,\n \"amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"reason\" TEXT DEFAULT '',\n \"source\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"granted_by_tenant_id\" UUID\n);",
|
|
4939
|
+
"columns": {
|
|
4940
|
+
"id": {
|
|
4941
|
+
"type": "UUID",
|
|
4942
|
+
"primaryKey": true,
|
|
4943
|
+
"referenceKind": "id",
|
|
4944
|
+
"notNull": true
|
|
4945
|
+
},
|
|
4946
|
+
"slug": {
|
|
4947
|
+
"type": "TEXT",
|
|
4948
|
+
"notNull": true
|
|
4949
|
+
},
|
|
4950
|
+
"context": {
|
|
4951
|
+
"type": "TEXT",
|
|
4952
|
+
"notNull": true,
|
|
4953
|
+
"default": ""
|
|
4954
|
+
},
|
|
4955
|
+
"created_at": {
|
|
4956
|
+
"type": "TIMESTAMP",
|
|
4957
|
+
"notNull": true,
|
|
4958
|
+
"default": "current_timestamp"
|
|
4959
|
+
},
|
|
4960
|
+
"updated_at": {
|
|
4961
|
+
"type": "TIMESTAMP",
|
|
4962
|
+
"notNull": true,
|
|
4963
|
+
"default": "current_timestamp"
|
|
4964
|
+
},
|
|
4965
|
+
"tenant_id": {
|
|
4966
|
+
"type": "UUID",
|
|
4967
|
+
"referenceKind": "tenantId",
|
|
4968
|
+
"notNull": true,
|
|
4969
|
+
"unique": false
|
|
4970
|
+
},
|
|
4971
|
+
"spending_policy_id": {
|
|
4972
|
+
"type": "UUID",
|
|
4973
|
+
"referenceKind": "foreignKey",
|
|
4974
|
+
"notNull": false,
|
|
4975
|
+
"unique": false,
|
|
4976
|
+
"foreignKey": {
|
|
4977
|
+
"table": "_smrt_spending_policies",
|
|
4978
|
+
"column": "id",
|
|
4979
|
+
"onDelete": "NO ACTION",
|
|
4980
|
+
"onUpdate": "CASCADE"
|
|
4981
|
+
}
|
|
4982
|
+
},
|
|
4983
|
+
"amount": {
|
|
4984
|
+
"type": "INTEGER",
|
|
4985
|
+
"notNull": false,
|
|
4986
|
+
"unique": false,
|
|
4987
|
+
"default": 0
|
|
4988
|
+
},
|
|
4989
|
+
"currency": {
|
|
4990
|
+
"type": "TEXT",
|
|
4991
|
+
"notNull": false,
|
|
4992
|
+
"unique": false,
|
|
4993
|
+
"default": "USD"
|
|
4994
|
+
},
|
|
4995
|
+
"reason": {
|
|
4996
|
+
"type": "TEXT",
|
|
4997
|
+
"notNull": false,
|
|
4998
|
+
"unique": false,
|
|
4999
|
+
"default": ""
|
|
5000
|
+
},
|
|
5001
|
+
"source": {
|
|
5002
|
+
"type": "TEXT",
|
|
5003
|
+
"notNull": false,
|
|
5004
|
+
"unique": false,
|
|
5005
|
+
"default": ""
|
|
5006
|
+
},
|
|
5007
|
+
"source_id": {
|
|
5008
|
+
"type": "TEXT",
|
|
5009
|
+
"notNull": false,
|
|
5010
|
+
"unique": false,
|
|
5011
|
+
"default": ""
|
|
5012
|
+
},
|
|
5013
|
+
"granted_by_tenant_id": {
|
|
5014
|
+
"type": "UUID",
|
|
5015
|
+
"referenceKind": "crossPackageRef",
|
|
5016
|
+
"notNull": false,
|
|
5017
|
+
"unique": false
|
|
5018
|
+
}
|
|
5019
|
+
},
|
|
5020
|
+
"indexes": [
|
|
5021
|
+
{
|
|
5022
|
+
"name": "_smrt_credit_grants_slug_context_idx",
|
|
5023
|
+
"columns": [
|
|
5024
|
+
"tenant_id",
|
|
5025
|
+
"slug",
|
|
5026
|
+
"context"
|
|
5027
|
+
],
|
|
5028
|
+
"unique": true
|
|
5029
|
+
},
|
|
5030
|
+
{
|
|
5031
|
+
"name": "_smrt_credit_grants_tenant_id_created_at_idx",
|
|
5032
|
+
"columns": [
|
|
5033
|
+
"tenant_id",
|
|
5034
|
+
"created_at"
|
|
5035
|
+
]
|
|
5036
|
+
},
|
|
5037
|
+
{
|
|
5038
|
+
"name": "_smrt_credit_grants_spending_policy_id_idx",
|
|
5039
|
+
"columns": [
|
|
5040
|
+
"spending_policy_id"
|
|
5041
|
+
]
|
|
5042
|
+
},
|
|
5043
|
+
{
|
|
5044
|
+
"name": "_smrt_credit_grants_granted_by_tenant_id_idx",
|
|
5045
|
+
"columns": [
|
|
5046
|
+
"granted_by_tenant_id"
|
|
5047
|
+
]
|
|
3303
5048
|
}
|
|
3304
5049
|
],
|
|
3305
|
-
"version": "
|
|
5050
|
+
"version": "602c4e02"
|
|
3306
5051
|
},
|
|
3307
5052
|
"importPath": "@happyvertical/smrt-subscriptions"
|
|
3308
5053
|
}
|