@happyvertical/smrt-subscriptions 0.43.10 → 0.44.1

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,383 +2,8 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-subscriptions",
5
- "packageVersion": "0.43.10",
5
+ "packageVersion": "0.44.1",
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
- },
382
7
  "@happyvertical/smrt-subscriptions:SubscriptionPlan": {
383
8
  "name": "subscriptionplan",
384
9
  "className": "SubscriptionPlan",
@@ -2450,15 +2075,247 @@
2450
2075
  "fields": {},
2451
2076
  "methods": {},
2452
2077
  "decoratorConfig": {
2453
- "tableName": "_smrt_client_charges"
2078
+ "tableName": "_smrt_client_charges"
2079
+ },
2080
+ "extends": "SmrtCollection",
2081
+ "extendsTypeArg": "ClientCharge",
2082
+ "exportName": "ClientChargeCollection",
2083
+ "collectionExportName": "ClientChargeCollectionCollection",
2084
+ "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);",
2087
+ "columns": {
2088
+ "id": {
2089
+ "type": "UUID",
2090
+ "primaryKey": true,
2091
+ "referenceKind": "id",
2092
+ "notNull": true
2093
+ },
2094
+ "slug": {
2095
+ "type": "TEXT",
2096
+ "notNull": true
2097
+ },
2098
+ "context": {
2099
+ "type": "TEXT",
2100
+ "notNull": true,
2101
+ "default": ""
2102
+ },
2103
+ "created_at": {
2104
+ "type": "TIMESTAMP",
2105
+ "notNull": true,
2106
+ "default": "current_timestamp"
2107
+ },
2108
+ "updated_at": {
2109
+ "type": "TIMESTAMP",
2110
+ "notNull": true,
2111
+ "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
+ },
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": {
2154
+ "type": "UUID",
2155
+ "primaryKey": true,
2156
+ "referenceKind": "id",
2157
+ "notNull": true
2158
+ },
2159
+ "slug": {
2160
+ "type": "TEXT",
2161
+ "notNull": true
2162
+ },
2163
+ "context": {
2164
+ "type": "TEXT",
2165
+ "notNull": true,
2166
+ "default": ""
2167
+ },
2168
+ "created_at": {
2169
+ "type": "TIMESTAMP",
2170
+ "notNull": true,
2171
+ "default": "current_timestamp"
2172
+ },
2173
+ "updated_at": {
2174
+ "type": "TIMESTAMP",
2175
+ "notNull": true,
2176
+ "default": "current_timestamp"
2177
+ }
2178
+ },
2179
+ "indexes": [
2180
+ {
2181
+ "name": "_smrt_billing_adjustments_slug_context_idx",
2182
+ "columns": [
2183
+ "slug",
2184
+ "context"
2185
+ ],
2186
+ "unique": true
2187
+ },
2188
+ {
2189
+ "name": "_smrt_billing_adjustments_created_at_idx",
2190
+ "columns": [
2191
+ "created_at"
2192
+ ]
2193
+ }
2194
+ ],
2195
+ "version": "5ca89c74"
2196
+ }
2197
+ },
2198
+ "@happyvertical/smrt-subscriptions:SpendingPolicyCollection": {
2199
+ "name": "spendingpolicycollection",
2200
+ "className": "SpendingPolicyCollection",
2201
+ "qualifiedName": "@happyvertical/smrt-subscriptions:SpendingPolicyCollection",
2202
+ "collection": "spendingpolicies",
2203
+ "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
2204
+ "packageName": "@happyvertical/smrt-subscriptions",
2205
+ "fields": {},
2206
+ "methods": {},
2207
+ "decoratorConfig": {
2208
+ "tableName": "_smrt_spending_policies"
2209
+ },
2210
+ "extends": "SmrtCollection",
2211
+ "extendsTypeArg": "SpendingPolicy",
2212
+ "exportName": "SpendingPolicyCollection",
2213
+ "collectionExportName": "SpendingPolicyCollectionCollection",
2214
+ "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);",
2217
+ "columns": {
2218
+ "id": {
2219
+ "type": "UUID",
2220
+ "primaryKey": true,
2221
+ "referenceKind": "id",
2222
+ "notNull": true
2223
+ },
2224
+ "slug": {
2225
+ "type": "TEXT",
2226
+ "notNull": true
2227
+ },
2228
+ "context": {
2229
+ "type": "TEXT",
2230
+ "notNull": true,
2231
+ "default": ""
2232
+ },
2233
+ "created_at": {
2234
+ "type": "TIMESTAMP",
2235
+ "notNull": true,
2236
+ "default": "current_timestamp"
2237
+ },
2238
+ "updated_at": {
2239
+ "type": "TIMESTAMP",
2240
+ "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
+ },
2309
+ "decoratorConfig": {
2310
+ "tableName": "_smrt_subscription_plans"
2454
2311
  },
2455
2312
  "extends": "SmrtCollection",
2456
- "extendsTypeArg": "ClientCharge",
2457
- "exportName": "ClientChargeCollection",
2458
- "collectionExportName": "ClientChargeCollectionCollection",
2313
+ "extendsTypeArg": "SubscriptionPlan",
2314
+ "exportName": "SubscriptionPlanCollection",
2315
+ "collectionExportName": "SubscriptionPlanCollectionCollection",
2459
2316
  "schema": {
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);",
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);",
2462
2319
  "columns": {
2463
2320
  "id": {
2464
2321
  "type": "UUID",
@@ -2488,7 +2345,7 @@
2488
2345
  },
2489
2346
  "indexes": [
2490
2347
  {
2491
- "name": "_smrt_client_charges_slug_context_idx",
2348
+ "name": "_smrt_subscription_plans_slug_context_idx",
2492
2349
  "columns": [
2493
2350
  "slug",
2494
2351
  "context"
@@ -2496,34 +2353,101 @@
2496
2353
  "unique": true
2497
2354
  },
2498
2355
  {
2499
- "name": "_smrt_client_charges_created_at_idx",
2356
+ "name": "_smrt_subscription_plans_created_at_idx",
2500
2357
  "columns": [
2501
2358
  "created_at"
2502
2359
  ]
2503
2360
  }
2504
2361
  ],
2505
- "version": "96756a5d"
2362
+ "version": "e693208d"
2506
2363
  }
2507
2364
  },
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",
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",
2514
2371
  "packageName": "@happyvertical/smrt-subscriptions",
2515
2372
  "fields": {},
2516
- "methods": {},
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
+ },
2517
2441
  "decoratorConfig": {
2518
- "tableName": "_smrt_billing_adjustments"
2442
+ "tableName": "_smrt_tenant_subscriptions"
2519
2443
  },
2520
2444
  "extends": "SmrtCollection",
2521
- "extendsTypeArg": "BillingAdjustment",
2522
- "exportName": "BillingAdjustmentCollection",
2523
- "collectionExportName": "BillingAdjustmentCollectionCollection",
2445
+ "extendsTypeArg": "TenantSubscription",
2446
+ "exportName": "TenantSubscriptionCollection",
2447
+ "collectionExportName": "TenantSubscriptionCollectionCollection",
2524
2448
  "schema": {
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);",
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);",
2527
2451
  "columns": {
2528
2452
  "id": {
2529
2453
  "type": "UUID",
@@ -2553,7 +2477,7 @@
2553
2477
  },
2554
2478
  "indexes": [
2555
2479
  {
2556
- "name": "_smrt_billing_adjustments_slug_context_idx",
2480
+ "name": "_smrt_tenant_subscriptions_slug_context_idx",
2557
2481
  "columns": [
2558
2482
  "slug",
2559
2483
  "context"
@@ -2561,34 +2485,110 @@
2561
2485
  "unique": true
2562
2486
  },
2563
2487
  {
2564
- "name": "_smrt_billing_adjustments_created_at_idx",
2488
+ "name": "_smrt_tenant_subscriptions_created_at_idx",
2565
2489
  "columns": [
2566
2490
  "created_at"
2567
2491
  ]
2568
2492
  }
2569
2493
  ],
2570
- "version": "5ca89c74"
2494
+ "version": "1d17f963"
2571
2495
  }
2572
2496
  },
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",
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",
2579
2503
  "packageName": "@happyvertical/smrt-subscriptions",
2580
2504
  "fields": {},
2581
- "methods": {},
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
+ },
2582
2582
  "decoratorConfig": {
2583
- "tableName": "_smrt_spending_policies"
2583
+ "tableName": "_smrt_tenant_usage_metrics"
2584
2584
  },
2585
2585
  "extends": "SmrtCollection",
2586
- "extendsTypeArg": "SpendingPolicy",
2587
- "exportName": "SpendingPolicyCollection",
2588
- "collectionExportName": "SpendingPolicyCollectionCollection",
2586
+ "extendsTypeArg": "TenantUsageMetric",
2587
+ "exportName": "TenantUsageMetricCollection",
2588
+ "collectionExportName": "TenantUsageMetricCollectionCollection",
2589
2589
  "schema": {
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);",
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);",
2592
2592
  "columns": {
2593
2593
  "id": {
2594
2594
  "type": "UUID",
@@ -2618,7 +2618,7 @@
2618
2618
  },
2619
2619
  "indexes": [
2620
2620
  {
2621
- "name": "_smrt_spending_policies_slug_context_idx",
2621
+ "name": "_smrt_tenant_usage_metrics_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_spending_policies_created_at_idx",
2629
+ "name": "_smrt_tenant_usage_metrics_created_at_idx",
2630
2630
  "columns": [
2631
2631
  "created_at"
2632
2632
  ]
2633
2633
  }
2634
2634
  ],
2635
- "version": "4f25df0f"
2635
+ "version": "8617d4ac"
2636
2636
  }
2637
2637
  }
2638
2638
  },