@happyvertical/smrt-subscriptions 0.44.1 → 0.45.0

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.
@@ -2,8 +2,383 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-subscriptions",
5
- "packageVersion": "0.44.1",
5
+ "packageVersion": "0.45.0",
6
6
  "objects": {
7
+ "@happyvertical/smrt-subscriptions:SubscriptionPlanCollection": {
8
+ "name": "subscriptionplancollection",
9
+ "className": "SubscriptionPlanCollection",
10
+ "qualifiedName": "@happyvertical/smrt-subscriptions:SubscriptionPlanCollection",
11
+ "collection": "subscriptionplans",
12
+ "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/SubscriptionPlanCollection.ts",
13
+ "packageName": "@happyvertical/smrt-subscriptions",
14
+ "fields": {},
15
+ "methods": {
16
+ "findByPlanKey": {
17
+ "name": "findByPlanKey",
18
+ "async": true,
19
+ "parameters": [
20
+ {
21
+ "name": "planKey",
22
+ "type": "string",
23
+ "optional": false
24
+ }
25
+ ],
26
+ "returnType": "Promise<SubscriptionPlan | null>",
27
+ "isStatic": false,
28
+ "isPublic": true
29
+ },
30
+ "findActive": {
31
+ "name": "findActive",
32
+ "async": true,
33
+ "parameters": [],
34
+ "returnType": "Promise<SubscriptionPlan[]>",
35
+ "isStatic": false,
36
+ "isPublic": true
37
+ },
38
+ "findByStripePriceId": {
39
+ "name": "findByStripePriceId",
40
+ "async": true,
41
+ "parameters": [
42
+ {
43
+ "name": "stripePriceId",
44
+ "type": "string",
45
+ "optional": false
46
+ }
47
+ ],
48
+ "returnType": "Promise<SubscriptionPlan | null>",
49
+ "isStatic": false,
50
+ "isPublic": true
51
+ }
52
+ },
53
+ "decoratorConfig": {
54
+ "tableName": "_smrt_subscription_plans"
55
+ },
56
+ "extends": "SmrtCollection",
57
+ "extendsTypeArg": "SubscriptionPlan",
58
+ "exportName": "SubscriptionPlanCollection",
59
+ "collectionExportName": "SubscriptionPlanCollectionCollection",
60
+ "schema": {
61
+ "tableName": "_smrt_subscription_plans",
62
+ "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);",
63
+ "columns": {
64
+ "id": {
65
+ "type": "UUID",
66
+ "primaryKey": true,
67
+ "referenceKind": "id",
68
+ "notNull": true
69
+ },
70
+ "slug": {
71
+ "type": "TEXT",
72
+ "notNull": true
73
+ },
74
+ "context": {
75
+ "type": "TEXT",
76
+ "notNull": true,
77
+ "default": ""
78
+ },
79
+ "created_at": {
80
+ "type": "TIMESTAMP",
81
+ "notNull": true,
82
+ "default": "current_timestamp"
83
+ },
84
+ "updated_at": {
85
+ "type": "TIMESTAMP",
86
+ "notNull": true,
87
+ "default": "current_timestamp"
88
+ }
89
+ },
90
+ "indexes": [
91
+ {
92
+ "name": "_smrt_subscription_plans_slug_context_idx",
93
+ "columns": [
94
+ "slug",
95
+ "context"
96
+ ],
97
+ "unique": true
98
+ },
99
+ {
100
+ "name": "_smrt_subscription_plans_created_at_idx",
101
+ "columns": [
102
+ "created_at"
103
+ ]
104
+ }
105
+ ],
106
+ "version": "e693208d"
107
+ }
108
+ },
109
+ "@happyvertical/smrt-subscriptions:TenantSubscriptionCollection": {
110
+ "name": "tenantsubscriptioncollection",
111
+ "className": "TenantSubscriptionCollection",
112
+ "qualifiedName": "@happyvertical/smrt-subscriptions:TenantSubscriptionCollection",
113
+ "collection": "tenantsubscriptions",
114
+ "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/TenantSubscriptionCollection.ts",
115
+ "packageName": "@happyvertical/smrt-subscriptions",
116
+ "fields": {},
117
+ "methods": {
118
+ "findByTenant": {
119
+ "name": "findByTenant",
120
+ "async": true,
121
+ "parameters": [
122
+ {
123
+ "name": "tenantId",
124
+ "type": "string",
125
+ "optional": false
126
+ }
127
+ ],
128
+ "returnType": "Promise<TenantSubscription[]>",
129
+ "isStatic": false,
130
+ "isPublic": true
131
+ },
132
+ "findCurrentForTenant": {
133
+ "name": "findCurrentForTenant",
134
+ "async": true,
135
+ "parameters": [
136
+ {
137
+ "name": "tenantId",
138
+ "type": "string",
139
+ "optional": false
140
+ },
141
+ {
142
+ "name": "now",
143
+ "type": "any",
144
+ "optional": true
145
+ }
146
+ ],
147
+ "returnType": "Promise<TenantSubscription | null>",
148
+ "isStatic": false,
149
+ "isPublic": true
150
+ },
151
+ "findCurrentForSubscriber": {
152
+ "name": "findCurrentForSubscriber",
153
+ "async": true,
154
+ "parameters": [
155
+ {
156
+ "name": "subscriber",
157
+ "type": "Subscriber",
158
+ "optional": false
159
+ },
160
+ {
161
+ "name": "now",
162
+ "type": "any",
163
+ "optional": true
164
+ }
165
+ ],
166
+ "returnType": "Promise<TenantSubscription | null>",
167
+ "isStatic": false,
168
+ "isPublic": true
169
+ },
170
+ "findByStripeSubscriptionId": {
171
+ "name": "findByStripeSubscriptionId",
172
+ "async": true,
173
+ "parameters": [
174
+ {
175
+ "name": "stripeSubscriptionId",
176
+ "type": "string",
177
+ "optional": false
178
+ }
179
+ ],
180
+ "returnType": "Promise<TenantSubscription | null>",
181
+ "isStatic": false,
182
+ "isPublic": true
183
+ }
184
+ },
185
+ "decoratorConfig": {
186
+ "tableName": "_smrt_tenant_subscriptions"
187
+ },
188
+ "extends": "SmrtCollection",
189
+ "extendsTypeArg": "TenantSubscription",
190
+ "exportName": "TenantSubscriptionCollection",
191
+ "collectionExportName": "TenantSubscriptionCollectionCollection",
192
+ "schema": {
193
+ "tableName": "_smrt_tenant_subscriptions",
194
+ "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);",
195
+ "columns": {
196
+ "id": {
197
+ "type": "UUID",
198
+ "primaryKey": true,
199
+ "referenceKind": "id",
200
+ "notNull": true
201
+ },
202
+ "slug": {
203
+ "type": "TEXT",
204
+ "notNull": true
205
+ },
206
+ "context": {
207
+ "type": "TEXT",
208
+ "notNull": true,
209
+ "default": ""
210
+ },
211
+ "created_at": {
212
+ "type": "TIMESTAMP",
213
+ "notNull": true,
214
+ "default": "current_timestamp"
215
+ },
216
+ "updated_at": {
217
+ "type": "TIMESTAMP",
218
+ "notNull": true,
219
+ "default": "current_timestamp"
220
+ }
221
+ },
222
+ "indexes": [
223
+ {
224
+ "name": "_smrt_tenant_subscriptions_slug_context_idx",
225
+ "columns": [
226
+ "slug",
227
+ "context"
228
+ ],
229
+ "unique": true
230
+ },
231
+ {
232
+ "name": "_smrt_tenant_subscriptions_created_at_idx",
233
+ "columns": [
234
+ "created_at"
235
+ ]
236
+ }
237
+ ],
238
+ "version": "1d17f963"
239
+ }
240
+ },
241
+ "@happyvertical/smrt-subscriptions:TenantUsageMetricCollection": {
242
+ "name": "tenantusagemetriccollection",
243
+ "className": "TenantUsageMetricCollection",
244
+ "qualifiedName": "@happyvertical/smrt-subscriptions:TenantUsageMetricCollection",
245
+ "collection": "tenantusagemetrics",
246
+ "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/TenantUsageMetricCollection.ts",
247
+ "packageName": "@happyvertical/smrt-subscriptions",
248
+ "fields": {},
249
+ "methods": {
250
+ "recordUsage": {
251
+ "name": "recordUsage",
252
+ "async": true,
253
+ "parameters": [
254
+ {
255
+ "name": "options",
256
+ "type": "RecordUsageOptions",
257
+ "optional": false
258
+ }
259
+ ],
260
+ "returnType": "Promise<TenantUsageMetric>",
261
+ "isStatic": false,
262
+ "isPublic": true
263
+ },
264
+ "findByTenantAndMetric": {
265
+ "name": "findByTenantAndMetric",
266
+ "async": true,
267
+ "parameters": [
268
+ {
269
+ "name": "tenantId",
270
+ "type": "string",
271
+ "optional": false
272
+ },
273
+ {
274
+ "name": "metricKey",
275
+ "type": "string",
276
+ "optional": false
277
+ }
278
+ ],
279
+ "returnType": "Promise<TenantUsageMetric[]>",
280
+ "isStatic": false,
281
+ "isPublic": true
282
+ },
283
+ "summarizeUsage": {
284
+ "name": "summarizeUsage",
285
+ "async": true,
286
+ "parameters": [
287
+ {
288
+ "name": "options",
289
+ "type": "SummarizeUsageOptions",
290
+ "optional": false
291
+ }
292
+ ],
293
+ "returnType": "Promise<UsageSummary>",
294
+ "isStatic": false,
295
+ "isPublic": true
296
+ },
297
+ "summarizeUsageBatch": {
298
+ "name": "summarizeUsageBatch",
299
+ "async": true,
300
+ "parameters": [
301
+ {
302
+ "name": "options",
303
+ "type": "SummarizeUsageBatchOptions",
304
+ "optional": false
305
+ }
306
+ ],
307
+ "returnType": "Promise<UsageSummary[]>",
308
+ "isStatic": false,
309
+ "isPublic": true
310
+ },
311
+ "summarizeTenantAiUsage": {
312
+ "name": "summarizeTenantAiUsage",
313
+ "async": true,
314
+ "parameters": [
315
+ {
316
+ "name": "options",
317
+ "type": "SummarizeAiUsageOptions",
318
+ "optional": false
319
+ }
320
+ ],
321
+ "returnType": "Promise<AiUsageSummary>",
322
+ "isStatic": false,
323
+ "isPublic": true
324
+ }
325
+ },
326
+ "decoratorConfig": {
327
+ "tableName": "_smrt_tenant_usage_metrics"
328
+ },
329
+ "extends": "SmrtCollection",
330
+ "extendsTypeArg": "TenantUsageMetric",
331
+ "exportName": "TenantUsageMetricCollection",
332
+ "collectionExportName": "TenantUsageMetricCollectionCollection",
333
+ "schema": {
334
+ "tableName": "_smrt_tenant_usage_metrics",
335
+ "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);",
336
+ "columns": {
337
+ "id": {
338
+ "type": "UUID",
339
+ "primaryKey": true,
340
+ "referenceKind": "id",
341
+ "notNull": true
342
+ },
343
+ "slug": {
344
+ "type": "TEXT",
345
+ "notNull": true
346
+ },
347
+ "context": {
348
+ "type": "TEXT",
349
+ "notNull": true,
350
+ "default": ""
351
+ },
352
+ "created_at": {
353
+ "type": "TIMESTAMP",
354
+ "notNull": true,
355
+ "default": "current_timestamp"
356
+ },
357
+ "updated_at": {
358
+ "type": "TIMESTAMP",
359
+ "notNull": true,
360
+ "default": "current_timestamp"
361
+ }
362
+ },
363
+ "indexes": [
364
+ {
365
+ "name": "_smrt_tenant_usage_metrics_slug_context_idx",
366
+ "columns": [
367
+ "slug",
368
+ "context"
369
+ ],
370
+ "unique": true
371
+ },
372
+ {
373
+ "name": "_smrt_tenant_usage_metrics_created_at_idx",
374
+ "columns": [
375
+ "created_at"
376
+ ]
377
+ }
378
+ ],
379
+ "version": "8617d4ac"
380
+ }
381
+ },
7
382
  "@happyvertical/smrt-subscriptions:SubscriptionPlan": {
8
383
  "name": "subscriptionplan",
9
384
  "className": "SubscriptionPlan",
@@ -1846,244 +2221,16 @@
1846
2221
  "cli": true,
1847
2222
  "mcp": true,
1848
2223
  "tenantScoped": {
1849
- "mode": "required"
1850
- }
1851
- },
1852
- "extends": "SmrtObject",
1853
- "exportName": "SpendingPolicy",
1854
- "collectionExportName": "SpendingPolicyCollection",
1855
- "validationRules": [],
1856
- "schema": {
1857
- "tableName": "_smrt_spending_policies",
1858
- "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);",
1859
- "columns": {
1860
- "id": {
1861
- "type": "UUID",
1862
- "primaryKey": true,
1863
- "referenceKind": "id",
1864
- "notNull": true
1865
- },
1866
- "slug": {
1867
- "type": "TEXT",
1868
- "notNull": true
1869
- },
1870
- "context": {
1871
- "type": "TEXT",
1872
- "notNull": true,
1873
- "default": ""
1874
- },
1875
- "created_at": {
1876
- "type": "TIMESTAMP",
1877
- "notNull": true,
1878
- "default": "current_timestamp"
1879
- },
1880
- "updated_at": {
1881
- "type": "TIMESTAMP",
1882
- "notNull": true,
1883
- "default": "current_timestamp"
1884
- },
1885
- "tenant_id": {
1886
- "type": "UUID",
1887
- "referenceKind": "tenantId",
1888
- "notNull": true,
1889
- "unique": false
1890
- },
1891
- "name": {
1892
- "type": "TEXT",
1893
- "notNull": false,
1894
- "unique": false,
1895
- "default": ""
1896
- },
1897
- "subscriber_kind": {
1898
- "type": "TEXT",
1899
- "notNull": false,
1900
- "unique": false,
1901
- "default": ""
1902
- },
1903
- "subscriber_external_id": {
1904
- "type": "TEXT",
1905
- "notNull": false,
1906
- "unique": false,
1907
- "default": ""
1908
- },
1909
- "project_id": {
1910
- "type": "TEXT",
1911
- "notNull": false,
1912
- "unique": false,
1913
- "default": ""
1914
- },
1915
- "service_key": {
1916
- "type": "TEXT",
1917
- "notNull": false,
1918
- "unique": false,
1919
- "default": ""
1920
- },
1921
- "metric_key": {
1922
- "type": "TEXT",
1923
- "notNull": false,
1924
- "unique": false,
1925
- "default": ""
1926
- },
1927
- "period": {
1928
- "type": "TEXT",
1929
- "notNull": false,
1930
- "unique": false,
1931
- "default": "month"
1932
- },
1933
- "rolling_seconds": {
1934
- "type": "INTEGER",
1935
- "notNull": false,
1936
- "unique": false,
1937
- "default": 0
1938
- },
1939
- "limit_amount": {
1940
- "type": "INTEGER",
1941
- "notNull": false,
1942
- "unique": false,
1943
- "default": 0
1944
- },
1945
- "currency": {
1946
- "type": "TEXT",
1947
- "notNull": false,
1948
- "unique": false,
1949
- "default": "USD"
1950
- },
1951
- "behavior": {
1952
- "type": "TEXT",
1953
- "notNull": false,
1954
- "unique": false,
1955
- "default": "observe"
1956
- },
1957
- "priority": {
1958
- "type": "INTEGER",
1959
- "notNull": false,
1960
- "unique": false,
1961
- "default": 0
1962
- },
1963
- "active": {
1964
- "type": "BOOLEAN",
1965
- "notNull": false,
1966
- "unique": false,
1967
- "default": true
1968
- }
1969
- },
1970
- "indexes": [
1971
- {
1972
- "name": "_smrt_spending_policies_tenant_id_subscriber_kind_idx",
1973
- "columns": [
1974
- "tenant_id",
1975
- "subscriber_kind",
1976
- "subscriber_external_id",
1977
- "project_id",
1978
- "service_key",
1979
- "metric_key",
1980
- "period",
1981
- "name"
1982
- ],
1983
- "unique": true
1984
- },
1985
- {
1986
- "name": "_smrt_spending_policies_slug_context_idx",
1987
- "columns": [
1988
- "slug",
1989
- "context"
1990
- ]
1991
- },
1992
- {
1993
- "name": "_smrt_spending_policies_tenant_id_created_at_idx",
1994
- "columns": [
1995
- "tenant_id",
1996
- "created_at"
1997
- ]
1998
- }
1999
- ],
2000
- "version": "6a413cf4"
2001
- }
2002
- },
2003
- "@happyvertical/smrt-subscriptions:PricingRuleCollection": {
2004
- "name": "pricingrulecollection",
2005
- "className": "PricingRuleCollection",
2006
- "qualifiedName": "@happyvertical/smrt-subscriptions:PricingRuleCollection",
2007
- "collection": "pricingrules",
2008
- "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
2009
- "packageName": "@happyvertical/smrt-subscriptions",
2010
- "fields": {},
2011
- "methods": {},
2012
- "decoratorConfig": {
2013
- "tableName": "_smrt_pricing_rules"
2014
- },
2015
- "extends": "SmrtCollection",
2016
- "extendsTypeArg": "PricingRule",
2017
- "exportName": "PricingRuleCollection",
2018
- "collectionExportName": "PricingRuleCollectionCollection",
2019
- "schema": {
2020
- "tableName": "_smrt_pricing_rules",
2021
- "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);",
2022
- "columns": {
2023
- "id": {
2024
- "type": "UUID",
2025
- "primaryKey": true,
2026
- "referenceKind": "id",
2027
- "notNull": true
2028
- },
2029
- "slug": {
2030
- "type": "TEXT",
2031
- "notNull": true
2032
- },
2033
- "context": {
2034
- "type": "TEXT",
2035
- "notNull": true,
2036
- "default": ""
2037
- },
2038
- "created_at": {
2039
- "type": "TIMESTAMP",
2040
- "notNull": true,
2041
- "default": "current_timestamp"
2042
- },
2043
- "updated_at": {
2044
- "type": "TIMESTAMP",
2045
- "notNull": true,
2046
- "default": "current_timestamp"
2047
- }
2048
- },
2049
- "indexes": [
2050
- {
2051
- "name": "_smrt_pricing_rules_slug_context_idx",
2052
- "columns": [
2053
- "slug",
2054
- "context"
2055
- ],
2056
- "unique": true
2057
- },
2058
- {
2059
- "name": "_smrt_pricing_rules_created_at_idx",
2060
- "columns": [
2061
- "created_at"
2062
- ]
2063
- }
2064
- ],
2065
- "version": "3fb55a6a"
2066
- }
2067
- },
2068
- "@happyvertical/smrt-subscriptions:ClientChargeCollection": {
2069
- "name": "clientchargecollection",
2070
- "className": "ClientChargeCollection",
2071
- "qualifiedName": "@happyvertical/smrt-subscriptions:ClientChargeCollection",
2072
- "collection": "clientcharges",
2073
- "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
2074
- "packageName": "@happyvertical/smrt-subscriptions",
2075
- "fields": {},
2076
- "methods": {},
2077
- "decoratorConfig": {
2078
- "tableName": "_smrt_client_charges"
2079
- },
2080
- "extends": "SmrtCollection",
2081
- "extendsTypeArg": "ClientCharge",
2082
- "exportName": "ClientChargeCollection",
2083
- "collectionExportName": "ClientChargeCollectionCollection",
2224
+ "mode": "required"
2225
+ }
2226
+ },
2227
+ "extends": "SmrtObject",
2228
+ "exportName": "SpendingPolicy",
2229
+ "collectionExportName": "SpendingPolicyCollection",
2230
+ "validationRules": [],
2084
2231
  "schema": {
2085
- "tableName": "_smrt_client_charges",
2086
- "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);",
2232
+ "tableName": "_smrt_spending_policies",
2233
+ "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);",
2087
2234
  "columns": {
2088
2235
  "id": {
2089
2236
  "type": "UUID",
@@ -2109,111 +2256,144 @@
2109
2256
  "type": "TIMESTAMP",
2110
2257
  "notNull": true,
2111
2258
  "default": "current_timestamp"
2112
- }
2113
- },
2114
- "indexes": [
2115
- {
2116
- "name": "_smrt_client_charges_slug_context_idx",
2117
- "columns": [
2118
- "slug",
2119
- "context"
2120
- ],
2121
- "unique": true
2122
2259
  },
2123
- {
2124
- "name": "_smrt_client_charges_created_at_idx",
2125
- "columns": [
2126
- "created_at"
2127
- ]
2128
- }
2129
- ],
2130
- "version": "96756a5d"
2131
- }
2132
- },
2133
- "@happyvertical/smrt-subscriptions:BillingAdjustmentCollection": {
2134
- "name": "billingadjustmentcollection",
2135
- "className": "BillingAdjustmentCollection",
2136
- "qualifiedName": "@happyvertical/smrt-subscriptions:BillingAdjustmentCollection",
2137
- "collection": "billingadjustments",
2138
- "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
2139
- "packageName": "@happyvertical/smrt-subscriptions",
2140
- "fields": {},
2141
- "methods": {},
2142
- "decoratorConfig": {
2143
- "tableName": "_smrt_billing_adjustments"
2144
- },
2145
- "extends": "SmrtCollection",
2146
- "extendsTypeArg": "BillingAdjustment",
2147
- "exportName": "BillingAdjustmentCollection",
2148
- "collectionExportName": "BillingAdjustmentCollectionCollection",
2149
- "schema": {
2150
- "tableName": "_smrt_billing_adjustments",
2151
- "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_billing_adjustments\" (\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);",
2152
- "columns": {
2153
- "id": {
2260
+ "tenant_id": {
2154
2261
  "type": "UUID",
2155
- "primaryKey": true,
2156
- "referenceKind": "id",
2157
- "notNull": true
2262
+ "referenceKind": "tenantId",
2263
+ "notNull": true,
2264
+ "unique": false
2158
2265
  },
2159
- "slug": {
2266
+ "name": {
2160
2267
  "type": "TEXT",
2161
- "notNull": true
2268
+ "notNull": false,
2269
+ "unique": false,
2270
+ "default": ""
2162
2271
  },
2163
- "context": {
2272
+ "subscriber_kind": {
2164
2273
  "type": "TEXT",
2165
- "notNull": true,
2274
+ "notNull": false,
2275
+ "unique": false,
2166
2276
  "default": ""
2167
2277
  },
2168
- "created_at": {
2169
- "type": "TIMESTAMP",
2170
- "notNull": true,
2171
- "default": "current_timestamp"
2278
+ "subscriber_external_id": {
2279
+ "type": "TEXT",
2280
+ "notNull": false,
2281
+ "unique": false,
2282
+ "default": ""
2172
2283
  },
2173
- "updated_at": {
2174
- "type": "TIMESTAMP",
2175
- "notNull": true,
2176
- "default": "current_timestamp"
2284
+ "project_id": {
2285
+ "type": "TEXT",
2286
+ "notNull": false,
2287
+ "unique": false,
2288
+ "default": ""
2289
+ },
2290
+ "service_key": {
2291
+ "type": "TEXT",
2292
+ "notNull": false,
2293
+ "unique": false,
2294
+ "default": ""
2295
+ },
2296
+ "metric_key": {
2297
+ "type": "TEXT",
2298
+ "notNull": false,
2299
+ "unique": false,
2300
+ "default": ""
2301
+ },
2302
+ "period": {
2303
+ "type": "TEXT",
2304
+ "notNull": false,
2305
+ "unique": false,
2306
+ "default": "month"
2307
+ },
2308
+ "rolling_seconds": {
2309
+ "type": "INTEGER",
2310
+ "notNull": false,
2311
+ "unique": false,
2312
+ "default": 0
2313
+ },
2314
+ "limit_amount": {
2315
+ "type": "INTEGER",
2316
+ "notNull": false,
2317
+ "unique": false,
2318
+ "default": 0
2319
+ },
2320
+ "currency": {
2321
+ "type": "TEXT",
2322
+ "notNull": false,
2323
+ "unique": false,
2324
+ "default": "USD"
2325
+ },
2326
+ "behavior": {
2327
+ "type": "TEXT",
2328
+ "notNull": false,
2329
+ "unique": false,
2330
+ "default": "observe"
2331
+ },
2332
+ "priority": {
2333
+ "type": "INTEGER",
2334
+ "notNull": false,
2335
+ "unique": false,
2336
+ "default": 0
2337
+ },
2338
+ "active": {
2339
+ "type": "BOOLEAN",
2340
+ "notNull": false,
2341
+ "unique": false,
2342
+ "default": true
2177
2343
  }
2178
2344
  },
2179
2345
  "indexes": [
2180
2346
  {
2181
- "name": "_smrt_billing_adjustments_slug_context_idx",
2347
+ "name": "_smrt_spending_policies_tenant_id_subscriber_kind_idx",
2182
2348
  "columns": [
2183
- "slug",
2184
- "context"
2349
+ "tenant_id",
2350
+ "subscriber_kind",
2351
+ "subscriber_external_id",
2352
+ "project_id",
2353
+ "service_key",
2354
+ "metric_key",
2355
+ "period",
2356
+ "name"
2185
2357
  ],
2186
2358
  "unique": true
2187
2359
  },
2188
2360
  {
2189
- "name": "_smrt_billing_adjustments_created_at_idx",
2361
+ "name": "_smrt_spending_policies_slug_context_idx",
2362
+ "columns": [
2363
+ "slug",
2364
+ "context"
2365
+ ]
2366
+ },
2367
+ {
2368
+ "name": "_smrt_spending_policies_tenant_id_created_at_idx",
2190
2369
  "columns": [
2370
+ "tenant_id",
2191
2371
  "created_at"
2192
2372
  ]
2193
2373
  }
2194
2374
  ],
2195
- "version": "5ca89c74"
2375
+ "version": "6a413cf4"
2196
2376
  }
2197
2377
  },
2198
- "@happyvertical/smrt-subscriptions:SpendingPolicyCollection": {
2199
- "name": "spendingpolicycollection",
2200
- "className": "SpendingPolicyCollection",
2201
- "qualifiedName": "@happyvertical/smrt-subscriptions:SpendingPolicyCollection",
2202
- "collection": "spendingpolicies",
2378
+ "@happyvertical/smrt-subscriptions:PricingRuleCollection": {
2379
+ "name": "pricingrulecollection",
2380
+ "className": "PricingRuleCollection",
2381
+ "qualifiedName": "@happyvertical/smrt-subscriptions:PricingRuleCollection",
2382
+ "collection": "pricingrules",
2203
2383
  "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
2204
2384
  "packageName": "@happyvertical/smrt-subscriptions",
2205
2385
  "fields": {},
2206
2386
  "methods": {},
2207
2387
  "decoratorConfig": {
2208
- "tableName": "_smrt_spending_policies"
2388
+ "tableName": "_smrt_pricing_rules"
2209
2389
  },
2210
2390
  "extends": "SmrtCollection",
2211
- "extendsTypeArg": "SpendingPolicy",
2212
- "exportName": "SpendingPolicyCollection",
2213
- "collectionExportName": "SpendingPolicyCollectionCollection",
2391
+ "extendsTypeArg": "PricingRule",
2392
+ "exportName": "PricingRuleCollection",
2393
+ "collectionExportName": "PricingRuleCollectionCollection",
2214
2394
  "schema": {
2215
- "tableName": "_smrt_spending_policies",
2216
- "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);",
2395
+ "tableName": "_smrt_pricing_rules",
2396
+ "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);",
2217
2397
  "columns": {
2218
2398
  "id": {
2219
2399
  "type": "UUID",
@@ -2238,84 +2418,47 @@
2238
2418
  "updated_at": {
2239
2419
  "type": "TIMESTAMP",
2240
2420
  "notNull": true,
2241
- "default": "current_timestamp"
2242
- }
2243
- },
2244
- "indexes": [
2245
- {
2246
- "name": "_smrt_spending_policies_slug_context_idx",
2247
- "columns": [
2248
- "slug",
2249
- "context"
2250
- ],
2251
- "unique": true
2252
- },
2253
- {
2254
- "name": "_smrt_spending_policies_created_at_idx",
2255
- "columns": [
2256
- "created_at"
2257
- ]
2258
- }
2259
- ],
2260
- "version": "4f25df0f"
2261
- }
2262
- },
2263
- "@happyvertical/smrt-subscriptions:SubscriptionPlanCollection": {
2264
- "name": "subscriptionplancollection",
2265
- "className": "SubscriptionPlanCollection",
2266
- "qualifiedName": "@happyvertical/smrt-subscriptions:SubscriptionPlanCollection",
2267
- "collection": "subscriptionplans",
2268
- "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/SubscriptionPlanCollection.ts",
2269
- "packageName": "@happyvertical/smrt-subscriptions",
2270
- "fields": {},
2271
- "methods": {
2272
- "findByPlanKey": {
2273
- "name": "findByPlanKey",
2274
- "async": true,
2275
- "parameters": [
2276
- {
2277
- "name": "planKey",
2278
- "type": "string",
2279
- "optional": false
2280
- }
2281
- ],
2282
- "returnType": "Promise<SubscriptionPlan | null>",
2283
- "isStatic": false,
2284
- "isPublic": true
2285
- },
2286
- "findActive": {
2287
- "name": "findActive",
2288
- "async": true,
2289
- "parameters": [],
2290
- "returnType": "Promise<SubscriptionPlan[]>",
2291
- "isStatic": false,
2292
- "isPublic": true
2293
- },
2294
- "findByStripePriceId": {
2295
- "name": "findByStripePriceId",
2296
- "async": true,
2297
- "parameters": [
2298
- {
2299
- "name": "stripePriceId",
2300
- "type": "string",
2301
- "optional": false
2302
- }
2303
- ],
2304
- "returnType": "Promise<SubscriptionPlan | null>",
2305
- "isStatic": false,
2306
- "isPublic": true
2307
- }
2308
- },
2421
+ "default": "current_timestamp"
2422
+ }
2423
+ },
2424
+ "indexes": [
2425
+ {
2426
+ "name": "_smrt_pricing_rules_slug_context_idx",
2427
+ "columns": [
2428
+ "slug",
2429
+ "context"
2430
+ ],
2431
+ "unique": true
2432
+ },
2433
+ {
2434
+ "name": "_smrt_pricing_rules_created_at_idx",
2435
+ "columns": [
2436
+ "created_at"
2437
+ ]
2438
+ }
2439
+ ],
2440
+ "version": "3fb55a6a"
2441
+ }
2442
+ },
2443
+ "@happyvertical/smrt-subscriptions:ClientChargeCollection": {
2444
+ "name": "clientchargecollection",
2445
+ "className": "ClientChargeCollection",
2446
+ "qualifiedName": "@happyvertical/smrt-subscriptions:ClientChargeCollection",
2447
+ "collection": "clientcharges",
2448
+ "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
2449
+ "packageName": "@happyvertical/smrt-subscriptions",
2450
+ "fields": {},
2451
+ "methods": {},
2309
2452
  "decoratorConfig": {
2310
- "tableName": "_smrt_subscription_plans"
2453
+ "tableName": "_smrt_client_charges"
2311
2454
  },
2312
2455
  "extends": "SmrtCollection",
2313
- "extendsTypeArg": "SubscriptionPlan",
2314
- "exportName": "SubscriptionPlanCollection",
2315
- "collectionExportName": "SubscriptionPlanCollectionCollection",
2456
+ "extendsTypeArg": "ClientCharge",
2457
+ "exportName": "ClientChargeCollection",
2458
+ "collectionExportName": "ClientChargeCollectionCollection",
2316
2459
  "schema": {
2317
- "tableName": "_smrt_subscription_plans",
2318
- "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);",
2460
+ "tableName": "_smrt_client_charges",
2461
+ "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);",
2319
2462
  "columns": {
2320
2463
  "id": {
2321
2464
  "type": "UUID",
@@ -2345,7 +2488,7 @@
2345
2488
  },
2346
2489
  "indexes": [
2347
2490
  {
2348
- "name": "_smrt_subscription_plans_slug_context_idx",
2491
+ "name": "_smrt_client_charges_slug_context_idx",
2349
2492
  "columns": [
2350
2493
  "slug",
2351
2494
  "context"
@@ -2353,101 +2496,34 @@
2353
2496
  "unique": true
2354
2497
  },
2355
2498
  {
2356
- "name": "_smrt_subscription_plans_created_at_idx",
2499
+ "name": "_smrt_client_charges_created_at_idx",
2357
2500
  "columns": [
2358
2501
  "created_at"
2359
2502
  ]
2360
2503
  }
2361
2504
  ],
2362
- "version": "e693208d"
2505
+ "version": "96756a5d"
2363
2506
  }
2364
2507
  },
2365
- "@happyvertical/smrt-subscriptions:TenantSubscriptionCollection": {
2366
- "name": "tenantsubscriptioncollection",
2367
- "className": "TenantSubscriptionCollection",
2368
- "qualifiedName": "@happyvertical/smrt-subscriptions:TenantSubscriptionCollection",
2369
- "collection": "tenantsubscriptions",
2370
- "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/TenantSubscriptionCollection.ts",
2508
+ "@happyvertical/smrt-subscriptions:BillingAdjustmentCollection": {
2509
+ "name": "billingadjustmentcollection",
2510
+ "className": "BillingAdjustmentCollection",
2511
+ "qualifiedName": "@happyvertical/smrt-subscriptions:BillingAdjustmentCollection",
2512
+ "collection": "billingadjustments",
2513
+ "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
2371
2514
  "packageName": "@happyvertical/smrt-subscriptions",
2372
2515
  "fields": {},
2373
- "methods": {
2374
- "findByTenant": {
2375
- "name": "findByTenant",
2376
- "async": true,
2377
- "parameters": [
2378
- {
2379
- "name": "tenantId",
2380
- "type": "string",
2381
- "optional": false
2382
- }
2383
- ],
2384
- "returnType": "Promise<TenantSubscription[]>",
2385
- "isStatic": false,
2386
- "isPublic": true
2387
- },
2388
- "findCurrentForTenant": {
2389
- "name": "findCurrentForTenant",
2390
- "async": true,
2391
- "parameters": [
2392
- {
2393
- "name": "tenantId",
2394
- "type": "string",
2395
- "optional": false
2396
- },
2397
- {
2398
- "name": "now",
2399
- "type": "any",
2400
- "optional": true
2401
- }
2402
- ],
2403
- "returnType": "Promise<TenantSubscription | null>",
2404
- "isStatic": false,
2405
- "isPublic": true
2406
- },
2407
- "findCurrentForSubscriber": {
2408
- "name": "findCurrentForSubscriber",
2409
- "async": true,
2410
- "parameters": [
2411
- {
2412
- "name": "subscriber",
2413
- "type": "Subscriber",
2414
- "optional": false
2415
- },
2416
- {
2417
- "name": "now",
2418
- "type": "any",
2419
- "optional": true
2420
- }
2421
- ],
2422
- "returnType": "Promise<TenantSubscription | null>",
2423
- "isStatic": false,
2424
- "isPublic": true
2425
- },
2426
- "findByStripeSubscriptionId": {
2427
- "name": "findByStripeSubscriptionId",
2428
- "async": true,
2429
- "parameters": [
2430
- {
2431
- "name": "stripeSubscriptionId",
2432
- "type": "string",
2433
- "optional": false
2434
- }
2435
- ],
2436
- "returnType": "Promise<TenantSubscription | null>",
2437
- "isStatic": false,
2438
- "isPublic": true
2439
- }
2440
- },
2516
+ "methods": {},
2441
2517
  "decoratorConfig": {
2442
- "tableName": "_smrt_tenant_subscriptions"
2518
+ "tableName": "_smrt_billing_adjustments"
2443
2519
  },
2444
2520
  "extends": "SmrtCollection",
2445
- "extendsTypeArg": "TenantSubscription",
2446
- "exportName": "TenantSubscriptionCollection",
2447
- "collectionExportName": "TenantSubscriptionCollectionCollection",
2521
+ "extendsTypeArg": "BillingAdjustment",
2522
+ "exportName": "BillingAdjustmentCollection",
2523
+ "collectionExportName": "BillingAdjustmentCollectionCollection",
2448
2524
  "schema": {
2449
- "tableName": "_smrt_tenant_subscriptions",
2450
- "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);",
2525
+ "tableName": "_smrt_billing_adjustments",
2526
+ "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_billing_adjustments\" (\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);",
2451
2527
  "columns": {
2452
2528
  "id": {
2453
2529
  "type": "UUID",
@@ -2477,7 +2553,7 @@
2477
2553
  },
2478
2554
  "indexes": [
2479
2555
  {
2480
- "name": "_smrt_tenant_subscriptions_slug_context_idx",
2556
+ "name": "_smrt_billing_adjustments_slug_context_idx",
2481
2557
  "columns": [
2482
2558
  "slug",
2483
2559
  "context"
@@ -2485,110 +2561,34 @@
2485
2561
  "unique": true
2486
2562
  },
2487
2563
  {
2488
- "name": "_smrt_tenant_subscriptions_created_at_idx",
2564
+ "name": "_smrt_billing_adjustments_created_at_idx",
2489
2565
  "columns": [
2490
2566
  "created_at"
2491
2567
  ]
2492
2568
  }
2493
2569
  ],
2494
- "version": "1d17f963"
2570
+ "version": "5ca89c74"
2495
2571
  }
2496
2572
  },
2497
- "@happyvertical/smrt-subscriptions:TenantUsageMetricCollection": {
2498
- "name": "tenantusagemetriccollection",
2499
- "className": "TenantUsageMetricCollection",
2500
- "qualifiedName": "@happyvertical/smrt-subscriptions:TenantUsageMetricCollection",
2501
- "collection": "tenantusagemetrics",
2502
- "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/TenantUsageMetricCollection.ts",
2573
+ "@happyvertical/smrt-subscriptions:SpendingPolicyCollection": {
2574
+ "name": "spendingpolicycollection",
2575
+ "className": "SpendingPolicyCollection",
2576
+ "qualifiedName": "@happyvertical/smrt-subscriptions:SpendingPolicyCollection",
2577
+ "collection": "spendingpolicies",
2578
+ "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
2503
2579
  "packageName": "@happyvertical/smrt-subscriptions",
2504
2580
  "fields": {},
2505
- "methods": {
2506
- "recordUsage": {
2507
- "name": "recordUsage",
2508
- "async": true,
2509
- "parameters": [
2510
- {
2511
- "name": "options",
2512
- "type": "RecordUsageOptions",
2513
- "optional": false
2514
- }
2515
- ],
2516
- "returnType": "Promise<TenantUsageMetric>",
2517
- "isStatic": false,
2518
- "isPublic": true
2519
- },
2520
- "findByTenantAndMetric": {
2521
- "name": "findByTenantAndMetric",
2522
- "async": true,
2523
- "parameters": [
2524
- {
2525
- "name": "tenantId",
2526
- "type": "string",
2527
- "optional": false
2528
- },
2529
- {
2530
- "name": "metricKey",
2531
- "type": "string",
2532
- "optional": false
2533
- }
2534
- ],
2535
- "returnType": "Promise<TenantUsageMetric[]>",
2536
- "isStatic": false,
2537
- "isPublic": true
2538
- },
2539
- "summarizeUsage": {
2540
- "name": "summarizeUsage",
2541
- "async": true,
2542
- "parameters": [
2543
- {
2544
- "name": "options",
2545
- "type": "SummarizeUsageOptions",
2546
- "optional": false
2547
- }
2548
- ],
2549
- "returnType": "Promise<UsageSummary>",
2550
- "isStatic": false,
2551
- "isPublic": true
2552
- },
2553
- "summarizeUsageBatch": {
2554
- "name": "summarizeUsageBatch",
2555
- "async": true,
2556
- "parameters": [
2557
- {
2558
- "name": "options",
2559
- "type": "SummarizeUsageBatchOptions",
2560
- "optional": false
2561
- }
2562
- ],
2563
- "returnType": "Promise<UsageSummary[]>",
2564
- "isStatic": false,
2565
- "isPublic": true
2566
- },
2567
- "summarizeTenantAiUsage": {
2568
- "name": "summarizeTenantAiUsage",
2569
- "async": true,
2570
- "parameters": [
2571
- {
2572
- "name": "options",
2573
- "type": "SummarizeAiUsageOptions",
2574
- "optional": false
2575
- }
2576
- ],
2577
- "returnType": "Promise<AiUsageSummary>",
2578
- "isStatic": false,
2579
- "isPublic": true
2580
- }
2581
- },
2581
+ "methods": {},
2582
2582
  "decoratorConfig": {
2583
- "tableName": "_smrt_tenant_usage_metrics"
2583
+ "tableName": "_smrt_spending_policies"
2584
2584
  },
2585
2585
  "extends": "SmrtCollection",
2586
- "extendsTypeArg": "TenantUsageMetric",
2587
- "exportName": "TenantUsageMetricCollection",
2588
- "collectionExportName": "TenantUsageMetricCollectionCollection",
2586
+ "extendsTypeArg": "SpendingPolicy",
2587
+ "exportName": "SpendingPolicyCollection",
2588
+ "collectionExportName": "SpendingPolicyCollectionCollection",
2589
2589
  "schema": {
2590
- "tableName": "_smrt_tenant_usage_metrics",
2591
- "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);",
2590
+ "tableName": "_smrt_spending_policies",
2591
+ "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);",
2592
2592
  "columns": {
2593
2593
  "id": {
2594
2594
  "type": "UUID",
@@ -2618,7 +2618,7 @@
2618
2618
  },
2619
2619
  "indexes": [
2620
2620
  {
2621
- "name": "_smrt_tenant_usage_metrics_slug_context_idx",
2621
+ "name": "_smrt_spending_policies_slug_context_idx",
2622
2622
  "columns": [
2623
2623
  "slug",
2624
2624
  "context"
@@ -2626,13 +2626,13 @@
2626
2626
  "unique": true
2627
2627
  },
2628
2628
  {
2629
- "name": "_smrt_tenant_usage_metrics_created_at_idx",
2629
+ "name": "_smrt_spending_policies_created_at_idx",
2630
2630
  "columns": [
2631
2631
  "created_at"
2632
2632
  ]
2633
2633
  }
2634
2634
  ],
2635
- "version": "8617d4ac"
2635
+ "version": "4f25df0f"
2636
2636
  }
2637
2637
  }
2638
2638
  },