@happyvertical/smrt-analytics 0.40.69 → 0.41.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,461 +2,660 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-analytics",
5
- "packageVersion": "0.40.69",
5
+ "packageVersion": "0.41.0",
6
6
  "objects": {
7
- "@happyvertical/smrt-analytics:AnalyticsDataStreamCollection": {
8
- "name": "analyticsdatastreamcollection",
9
- "className": "AnalyticsDataStreamCollection",
10
- "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsDataStreamCollection",
7
+ "@happyvertical/smrt-analytics:AnalyticsDataStream": {
8
+ "name": "analyticsdatastream",
9
+ "className": "AnalyticsDataStream",
10
+ "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsDataStream",
11
11
  "collection": "analyticsdatastreams",
12
- "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/collections/AnalyticsDataStreamCollection.ts",
12
+ "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/models/AnalyticsDataStream.ts",
13
13
  "packageName": "@happyvertical/smrt-analytics",
14
- "fields": {},
14
+ "fields": {
15
+ "created_at": {
16
+ "type": "datetime",
17
+ "required": false
18
+ },
19
+ "updated_at": {
20
+ "type": "datetime",
21
+ "required": false
22
+ },
23
+ "tenantId": {
24
+ "type": "text",
25
+ "required": false,
26
+ "_meta": {
27
+ "sqlType": "UUID",
28
+ "nullable": true,
29
+ "__tenancy": {
30
+ "isTenantIdField": true,
31
+ "autoFilter": true,
32
+ "required": false,
33
+ "autoPopulate": true,
34
+ "nullable": true,
35
+ "mode": "optional",
36
+ "field": "tenantId",
37
+ "allowSuperAdminBypass": false
38
+ }
39
+ }
40
+ },
41
+ "propertyId": {
42
+ "type": "foreignKey",
43
+ "required": false,
44
+ "related": "AnalyticsProperty"
45
+ },
46
+ "displayName": {
47
+ "type": "text",
48
+ "required": false,
49
+ "default": ""
50
+ },
51
+ "streamType": {
52
+ "type": "text",
53
+ "required": false
54
+ },
55
+ "externalId": {
56
+ "type": "text",
57
+ "required": false,
58
+ "default": ""
59
+ },
60
+ "measurementId": {
61
+ "type": "text",
62
+ "required": false,
63
+ "default": ""
64
+ },
65
+ "firebaseAppId": {
66
+ "type": "text",
67
+ "required": false,
68
+ "default": ""
69
+ },
70
+ "defaultUri": {
71
+ "type": "text",
72
+ "required": false,
73
+ "default": ""
74
+ },
75
+ "bundleId": {
76
+ "type": "text",
77
+ "required": false,
78
+ "default": ""
79
+ },
80
+ "packageName": {
81
+ "type": "text",
82
+ "required": false,
83
+ "default": ""
84
+ },
85
+ "status": {
86
+ "type": "text",
87
+ "required": false
88
+ },
89
+ "enhancedMeasurement": {
90
+ "type": "boolean",
91
+ "required": false,
92
+ "default": true
93
+ }
94
+ },
15
95
  "methods": {
16
- "findByProperty": {
17
- "name": "findByProperty",
96
+ "getAiUsageSnapshot": {
97
+ "name": "getAiUsageSnapshot",
98
+ "async": false,
99
+ "parameters": [],
100
+ "returnType": "AiUsageSnapshot | undefined",
101
+ "isStatic": false,
102
+ "isPublic": true
103
+ },
104
+ "resetAiUsage": {
105
+ "name": "resetAiUsage",
106
+ "async": false,
107
+ "parameters": [],
108
+ "returnType": "void",
109
+ "isStatic": false,
110
+ "isPublic": true
111
+ },
112
+ "listAiUsage": {
113
+ "name": "listAiUsage",
18
114
  "async": true,
19
115
  "parameters": [
20
116
  {
21
- "name": "propertyId",
22
- "type": "string",
23
- "optional": false
117
+ "name": "options",
118
+ "type": "AiUsageListOptions",
119
+ "optional": true
24
120
  }
25
121
  ],
26
- "returnType": "Promise<AnalyticsDataStream[]>",
122
+ "returnType": "Promise<SmrtAiUsageRecord[]>",
27
123
  "isStatic": false,
28
124
  "isPublic": true
29
125
  },
30
- "findByExternalId": {
31
- "name": "findByExternalId",
126
+ "summarizeAiUsage": {
127
+ "name": "summarizeAiUsage",
32
128
  "async": true,
33
129
  "parameters": [
34
130
  {
35
- "name": "externalId",
36
- "type": "string",
37
- "optional": false
131
+ "name": "options",
132
+ "type": "AiUsageSummaryOptions",
133
+ "optional": true
38
134
  }
39
135
  ],
40
- "returnType": "Promise<AnalyticsDataStream | null>",
136
+ "returnType": "Promise<Record<string, AiUsageStats>>",
41
137
  "isStatic": false,
42
138
  "isPublic": true
43
139
  },
44
- "findByMeasurementId": {
45
- "name": "findByMeasurementId",
140
+ "destroy": {
141
+ "name": "destroy",
142
+ "async": false,
143
+ "parameters": [],
144
+ "returnType": "void",
145
+ "isStatic": false,
146
+ "isPublic": true
147
+ },
148
+ "markAsPersisted": {
149
+ "name": "markAsPersisted",
150
+ "async": false,
151
+ "parameters": [],
152
+ "returnType": "void",
153
+ "isStatic": false,
154
+ "isPublic": true
155
+ },
156
+ "requireInsertOnSave": {
157
+ "name": "requireInsertOnSave",
158
+ "async": false,
159
+ "parameters": [],
160
+ "returnType": "void",
161
+ "isStatic": false,
162
+ "isPublic": true
163
+ },
164
+ "initialize": {
165
+ "name": "initialize",
166
+ "async": true,
167
+ "parameters": [],
168
+ "returnType": "Promise",
169
+ "isStatic": false,
170
+ "isPublic": true
171
+ },
172
+ "loadDataFromDb": {
173
+ "name": "loadDataFromDb",
46
174
  "async": true,
47
175
  "parameters": [
48
176
  {
49
- "name": "measurementId",
50
- "type": "string",
177
+ "name": "data",
178
+ "type": "Record<string>",
51
179
  "optional": false
52
180
  }
53
181
  ],
54
- "returnType": "Promise<AnalyticsDataStream | null>",
182
+ "returnType": "any",
55
183
  "isStatic": false,
56
184
  "isPublic": true
57
185
  },
58
- "findByType": {
59
- "name": "findByType",
186
+ "getFields": {
187
+ "name": "getFields",
60
188
  "async": true,
189
+ "parameters": [],
190
+ "returnType": "Promise<any>",
191
+ "isStatic": false,
192
+ "isPublic": true
193
+ },
194
+ "toJSON": {
195
+ "name": "toJSON",
196
+ "async": false,
197
+ "parameters": [],
198
+ "returnType": "any",
199
+ "isStatic": false,
200
+ "isPublic": true
201
+ },
202
+ "toPlainObject": {
203
+ "name": "toPlainObject",
204
+ "async": false,
205
+ "parameters": [],
206
+ "returnType": "Record<string>",
207
+ "isStatic": false,
208
+ "isPublic": true
209
+ },
210
+ "toPublicJSON": {
211
+ "name": "toPublicJSON",
212
+ "async": false,
61
213
  "parameters": [
62
214
  {
63
- "name": "streamType",
64
- "type": "DataStreamType",
65
- "optional": false
215
+ "name": "options",
216
+ "type": "PublicJsonOptions",
217
+ "optional": true
66
218
  }
67
219
  ],
68
- "returnType": "Promise<AnalyticsDataStream[]>",
220
+ "returnType": "Record<string>",
69
221
  "isStatic": false,
70
222
  "isPublic": true
71
223
  },
72
- "findWebStreams": {
73
- "name": "findWebStreams",
224
+ "getId": {
225
+ "name": "getId",
74
226
  "async": true,
75
227
  "parameters": [],
76
- "returnType": "Promise<AnalyticsDataStream[]>",
228
+ "returnType": "any",
77
229
  "isStatic": false,
78
230
  "isPublic": true
79
231
  },
80
- "findIOSStreams": {
81
- "name": "findIOSStreams",
232
+ "getSlug": {
233
+ "name": "getSlug",
82
234
  "async": true,
83
235
  "parameters": [],
84
- "returnType": "Promise<AnalyticsDataStream[]>",
236
+ "returnType": "any",
85
237
  "isStatic": false,
86
238
  "isPublic": true
87
239
  },
88
- "findAndroidStreams": {
89
- "name": "findAndroidStreams",
240
+ "getSavedId": {
241
+ "name": "getSavedId",
90
242
  "async": true,
91
243
  "parameters": [],
92
- "returnType": "Promise<AnalyticsDataStream[]>",
244
+ "returnType": "any",
93
245
  "isStatic": false,
94
246
  "isPublic": true
95
247
  },
96
- "findMobileStreams": {
97
- "name": "findMobileStreams",
248
+ "isSaved": {
249
+ "name": "isSaved",
98
250
  "async": true,
99
251
  "parameters": [],
100
- "returnType": "Promise<AnalyticsDataStream[]>",
252
+ "returnType": "any",
101
253
  "isStatic": false,
102
254
  "isPublic": true
103
255
  },
104
- "findByStatus": {
105
- "name": "findByStatus",
256
+ "save": {
257
+ "name": "save",
106
258
  "async": true,
259
+ "parameters": [],
260
+ "returnType": "any",
261
+ "isStatic": false,
262
+ "isPublic": true
263
+ },
264
+ "classifyConstraintError": {
265
+ "name": "classifyConstraintError",
266
+ "async": false,
107
267
  "parameters": [
108
268
  {
109
- "name": "status",
110
- "type": "DataStreamStatus",
269
+ "name": "message",
270
+ "type": "string",
111
271
  "optional": false
112
272
  }
113
273
  ],
114
- "returnType": "Promise<AnalyticsDataStream[]>",
115
- "isStatic": false,
274
+ "returnType": "'unique' | 'not_null' | null",
275
+ "isStatic": true,
116
276
  "isPublic": true
117
277
  },
118
- "findActive": {
119
- "name": "findActive",
278
+ "loadFromId": {
279
+ "name": "loadFromId",
120
280
  "async": true,
121
281
  "parameters": [],
122
- "returnType": "Promise<AnalyticsDataStream[]>",
282
+ "returnType": "any",
123
283
  "isStatic": false,
124
284
  "isPublic": true
125
285
  },
126
- "findActiveByProperty": {
127
- "name": "findActiveByProperty",
286
+ "loadFromSlug": {
287
+ "name": "loadFromSlug",
288
+ "async": true,
289
+ "parameters": [],
290
+ "returnType": "any",
291
+ "isStatic": false,
292
+ "isPublic": true
293
+ },
294
+ "is": {
295
+ "name": "is",
128
296
  "async": true,
129
297
  "parameters": [
130
298
  {
131
- "name": "propertyId",
299
+ "name": "criteria",
132
300
  "type": "string",
133
301
  "optional": false
302
+ },
303
+ {
304
+ "name": "options",
305
+ "type": "AiOperationOptions",
306
+ "optional": true
134
307
  }
135
308
  ],
136
- "returnType": "Promise<AnalyticsDataStream[]>",
309
+ "returnType": "any",
137
310
  "isStatic": false,
138
311
  "isPublic": true
139
- }
140
- },
141
- "decoratorConfig": {},
142
- "extends": "SmrtCollection",
143
- "extendsTypeArg": "AnalyticsDataStream",
144
- "exportName": "AnalyticsDataStreamCollection",
145
- "collectionExportName": "AnalyticsDataStreamCollectionCollection",
146
- "schema": {
147
- "tableName": "analytics_data_stream_collections",
148
- "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_data_stream_collections\" (\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);",
149
- "columns": {
150
- "id": {
151
- "type": "UUID",
152
- "primaryKey": true,
153
- "referenceKind": "id",
154
- "notNull": true
155
- },
156
- "slug": {
157
- "type": "TEXT",
158
- "notNull": true
159
- },
160
- "context": {
161
- "type": "TEXT",
162
- "notNull": true,
163
- "default": ""
164
- },
165
- "created_at": {
166
- "type": "TIMESTAMP",
167
- "notNull": true,
168
- "default": "current_timestamp"
169
- },
170
- "updated_at": {
171
- "type": "TIMESTAMP",
172
- "notNull": true,
173
- "default": "current_timestamp"
174
- }
175
312
  },
176
- "indexes": [
177
- {
178
- "name": "analytics_data_stream_collections_id_idx",
179
- "columns": [
180
- "id"
181
- ]
182
- },
183
- {
184
- "name": "analytics_data_stream_collections_slug_context_idx",
185
- "columns": [
186
- "slug",
187
- "context"
188
- ],
189
- "unique": true
190
- }
191
- ],
192
- "version": "12ef5a9a"
193
- }
194
- },
195
- "@happyvertical/smrt-analytics:AnalyticsEventCollection": {
196
- "name": "analyticseventcollection",
197
- "className": "AnalyticsEventCollection",
198
- "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsEventCollection",
199
- "collection": "analyticsevents",
200
- "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/collections/AnalyticsEventCollection.ts",
201
- "packageName": "@happyvertical/smrt-analytics",
202
- "fields": {},
203
- "methods": {
204
- "findByProperty": {
205
- "name": "findByProperty",
313
+ "do": {
314
+ "name": "do",
206
315
  "async": true,
207
316
  "parameters": [
208
317
  {
209
- "name": "propertyId",
318
+ "name": "instructions",
210
319
  "type": "string",
211
320
  "optional": false
321
+ },
322
+ {
323
+ "name": "options",
324
+ "type": "AiOperationOptions",
325
+ "optional": true
212
326
  }
213
327
  ],
214
- "returnType": "Promise<AnalyticsEvent[]>",
328
+ "returnType": "any",
215
329
  "isStatic": false,
216
330
  "isPublic": true
217
331
  },
218
- "findByEventName": {
219
- "name": "findByEventName",
332
+ "describe": {
333
+ "name": "describe",
220
334
  "async": true,
221
335
  "parameters": [
222
336
  {
223
- "name": "eventName",
224
- "type": "string",
225
- "optional": false
337
+ "name": "options",
338
+ "type": "AiOperationOptions",
339
+ "optional": true
226
340
  }
227
341
  ],
228
- "returnType": "Promise<AnalyticsEvent[]>",
342
+ "returnType": "any",
229
343
  "isStatic": false,
230
344
  "isPublic": true
231
345
  },
232
- "findByClientId": {
233
- "name": "findByClientId",
346
+ "delete": {
347
+ "name": "delete",
234
348
  "async": true,
349
+ "parameters": [],
350
+ "returnType": "Promise<void>",
351
+ "isStatic": false,
352
+ "isPublic": true
353
+ },
354
+ "isRelatedLoaded": {
355
+ "name": "isRelatedLoaded",
356
+ "async": false,
235
357
  "parameters": [
236
358
  {
237
- "name": "clientId",
359
+ "name": "fieldName",
238
360
  "type": "string",
239
361
  "optional": false
240
362
  }
241
363
  ],
242
- "returnType": "Promise<AnalyticsEvent[]>",
364
+ "returnType": "boolean",
243
365
  "isStatic": false,
244
366
  "isPublic": true
245
367
  },
246
- "findByUserId": {
247
- "name": "findByUserId",
248
- "async": true,
368
+ "_setLoadedRelationship": {
369
+ "name": "_setLoadedRelationship",
370
+ "async": false,
249
371
  "parameters": [
250
372
  {
251
- "name": "userId",
373
+ "name": "fieldName",
252
374
  "type": "string",
253
375
  "optional": false
376
+ },
377
+ {
378
+ "name": "value",
379
+ "type": "any",
380
+ "optional": false
254
381
  }
255
382
  ],
256
- "returnType": "Promise<AnalyticsEvent[]>",
383
+ "returnType": "void",
257
384
  "isStatic": false,
258
385
  "isPublic": true
259
386
  },
260
- "findByStatus": {
261
- "name": "findByStatus",
387
+ "loadRelated": {
388
+ "name": "loadRelated",
262
389
  "async": true,
263
390
  "parameters": [
264
391
  {
265
- "name": "status",
266
- "type": "TrackingEventStatus",
392
+ "name": "fieldName",
393
+ "type": "string",
267
394
  "optional": false
395
+ },
396
+ {
397
+ "name": "opts",
398
+ "type": "LoadRelatedOptions",
399
+ "optional": true
268
400
  }
269
401
  ],
270
- "returnType": "Promise<AnalyticsEvent[]>",
402
+ "returnType": "Promise<any>",
271
403
  "isStatic": false,
272
404
  "isPublic": true
273
405
  },
274
- "findPending": {
275
- "name": "findPending",
406
+ "loadRelatedMany": {
407
+ "name": "loadRelatedMany",
276
408
  "async": true,
277
- "parameters": [],
278
- "returnType": "Promise<AnalyticsEvent[]>",
409
+ "parameters": [
410
+ {
411
+ "name": "fieldName",
412
+ "type": "string",
413
+ "optional": false
414
+ },
415
+ {
416
+ "name": "opts",
417
+ "type": "LoadRelatedOptions",
418
+ "optional": true
419
+ }
420
+ ],
421
+ "returnType": "Promise<any[]>",
279
422
  "isStatic": false,
280
423
  "isPublic": true
281
424
  },
282
- "findSent": {
283
- "name": "findSent",
425
+ "getRelated": {
426
+ "name": "getRelated",
284
427
  "async": true,
285
- "parameters": [],
286
- "returnType": "Promise<AnalyticsEvent[]>",
428
+ "parameters": [
429
+ {
430
+ "name": "fieldName",
431
+ "type": "string",
432
+ "optional": false
433
+ },
434
+ {
435
+ "name": "opts",
436
+ "type": "LoadRelatedOptions",
437
+ "optional": true
438
+ }
439
+ ],
440
+ "returnType": "Promise<any>",
287
441
  "isStatic": false,
288
442
  "isPublic": true
289
443
  },
290
- "findFailed": {
291
- "name": "findFailed",
292
- "async": true,
444
+ "getAvailableTools": {
445
+ "name": "getAvailableTools",
446
+ "async": false,
293
447
  "parameters": [],
294
- "returnType": "Promise<AnalyticsEvent[]>",
448
+ "returnType": "AITool[]",
295
449
  "isStatic": false,
296
450
  "isPublic": true
297
451
  },
298
- "findForRetry": {
299
- "name": "findForRetry",
452
+ "executeToolCall": {
453
+ "name": "executeToolCall",
300
454
  "async": true,
301
455
  "parameters": [
302
456
  {
303
- "name": "maxRetries",
304
- "type": "number",
305
- "optional": true
457
+ "name": "toolCall",
458
+ "type": "ToolCall",
459
+ "optional": false
306
460
  }
307
461
  ],
308
- "returnType": "Promise<AnalyticsEvent[]>",
462
+ "returnType": "Promise<ToolCallResult>",
309
463
  "isStatic": false,
310
464
  "isPublic": true
311
465
  },
312
- "findPendingByProperty": {
313
- "name": "findPendingByProperty",
466
+ "remember": {
467
+ "name": "remember",
314
468
  "async": true,
315
469
  "parameters": [
316
470
  {
317
- "name": "propertyId",
318
- "type": "string",
471
+ "name": "options",
472
+ "type": "object",
319
473
  "optional": false
320
474
  }
321
475
  ],
322
- "returnType": "Promise<AnalyticsEvent[]>",
476
+ "returnType": "Promise<void>",
323
477
  "isStatic": false,
324
478
  "isPublic": true
325
479
  },
326
- "findByDateRange": {
327
- "name": "findByDateRange",
480
+ "recall": {
481
+ "name": "recall",
328
482
  "async": true,
329
483
  "parameters": [
330
484
  {
331
- "name": "startDate",
332
- "type": "Date",
333
- "optional": false
334
- },
335
- {
336
- "name": "endDate",
337
- "type": "Date",
485
+ "name": "options",
486
+ "type": "object",
338
487
  "optional": false
339
488
  }
340
489
  ],
341
- "returnType": "Promise<AnalyticsEvent[]>",
490
+ "returnType": "Promise",
342
491
  "isStatic": false,
343
492
  "isPublic": true
344
493
  },
345
- "findConversions": {
346
- "name": "findConversions",
494
+ "recallAll": {
495
+ "name": "recallAll",
347
496
  "async": true,
348
497
  "parameters": [
349
498
  {
350
- "name": "propertyId",
351
- "type": "string",
499
+ "name": "options",
500
+ "type": "object",
352
501
  "optional": true
353
502
  }
354
503
  ],
355
- "returnType": "Promise<AnalyticsEvent[]>",
504
+ "returnType": "Promise<Map<string>>",
356
505
  "isStatic": false,
357
506
  "isPublic": true
358
507
  },
359
- "findPageviews": {
360
- "name": "findPageviews",
508
+ "forget": {
509
+ "name": "forget",
361
510
  "async": true,
362
511
  "parameters": [
363
512
  {
364
- "name": "propertyId",
365
- "type": "string",
366
- "optional": true
513
+ "name": "options",
514
+ "type": "object",
515
+ "optional": false
367
516
  }
368
517
  ],
369
- "returnType": "Promise<AnalyticsEvent[]>",
518
+ "returnType": "Promise<void>",
370
519
  "isStatic": false,
371
520
  "isPublic": true
372
521
  },
373
- "countByEventName": {
374
- "name": "countByEventName",
522
+ "forgetScope": {
523
+ "name": "forgetScope",
375
524
  "async": true,
376
525
  "parameters": [
377
526
  {
378
- "name": "propertyId",
379
- "type": "string",
527
+ "name": "options",
528
+ "type": "object",
380
529
  "optional": false
381
530
  }
382
531
  ],
383
- "returnType": "Promise<Map<string, number>>",
532
+ "returnType": "Promise<number>",
384
533
  "isStatic": false,
385
534
  "isPublic": true
386
535
  },
387
- "getPropertyStats": {
388
- "name": "getPropertyStats",
536
+ "generateEmbeddings": {
537
+ "name": "generateEmbeddings",
389
538
  "async": true,
390
539
  "parameters": [
391
540
  {
392
- "name": "propertyId",
393
- "type": "string",
394
- "optional": false
541
+ "name": "options",
542
+ "type": "GenerateEmbeddingsOptions",
543
+ "optional": true
395
544
  }
396
545
  ],
397
- "returnType": "Promise<object>",
546
+ "returnType": "Promise<void>",
398
547
  "isStatic": false,
399
548
  "isPublic": true
400
549
  },
401
- "getPropertyStatsWithTrend": {
402
- "name": "getPropertyStatsWithTrend",
550
+ "getEmbedding": {
551
+ "name": "getEmbedding",
403
552
  "async": true,
404
553
  "parameters": [
405
554
  {
406
- "name": "propertyId",
555
+ "name": "fieldName",
407
556
  "type": "string",
408
557
  "optional": false
409
558
  },
410
559
  {
411
- "name": "now",
412
- "type": "Date",
413
- "optional": true
414
- },
415
- {
416
- "name": "timeZone",
560
+ "name": "model",
417
561
  "type": "string",
418
- "optional": true,
419
- "default": "UTC"
562
+ "optional": true
420
563
  }
421
564
  ],
422
- "returnType": "Promise<PropertyStatsWithTrend>",
565
+ "returnType": "Promise<number[] | null>",
423
566
  "isStatic": false,
424
567
  "isPublic": true
425
568
  },
426
- "getBatchPropertyStats": {
427
- "name": "getBatchPropertyStats",
569
+ "hasStaleEmbeddings": {
570
+ "name": "hasStaleEmbeddings",
428
571
  "async": true,
429
- "parameters": [
430
- {
431
- "name": "propertyIds",
432
- "type": "string[]",
433
- "optional": false
434
- },
435
- {
436
- "name": "now",
437
- "type": "Date",
438
- "optional": true
439
- },
440
- {
441
- "name": "timeZone",
442
- "type": "string",
443
- "optional": true,
444
- "default": "UTC"
445
- }
446
- ],
447
- "returnType": "Promise<Map<string, PropertyStatsWithTrend>>",
572
+ "parameters": [],
573
+ "returnType": "Promise<boolean>",
574
+ "isStatic": false,
575
+ "isPublic": true
576
+ },
577
+ "clearEmbeddings": {
578
+ "name": "clearEmbeddings",
579
+ "async": true,
580
+ "parameters": [],
581
+ "returnType": "Promise<void>",
582
+ "isStatic": false,
583
+ "isPublic": true
584
+ },
585
+ "isWeb": {
586
+ "name": "isWeb",
587
+ "async": false,
588
+ "parameters": [],
589
+ "returnType": "boolean",
590
+ "isStatic": false,
591
+ "isPublic": true
592
+ },
593
+ "isIOS": {
594
+ "name": "isIOS",
595
+ "async": false,
596
+ "parameters": [],
597
+ "returnType": "boolean",
598
+ "isStatic": false,
599
+ "isPublic": true
600
+ },
601
+ "isAndroid": {
602
+ "name": "isAndroid",
603
+ "async": false,
604
+ "parameters": [],
605
+ "returnType": "boolean",
606
+ "isStatic": false,
607
+ "isPublic": true
608
+ },
609
+ "isMobileApp": {
610
+ "name": "isMobileApp",
611
+ "async": false,
612
+ "parameters": [],
613
+ "returnType": "boolean",
614
+ "isStatic": false,
615
+ "isPublic": true
616
+ },
617
+ "getPlatformId": {
618
+ "name": "getPlatformId",
619
+ "async": false,
620
+ "parameters": [],
621
+ "returnType": "string",
448
622
  "isStatic": false,
449
623
  "isPublic": true
450
624
  }
451
625
  },
452
- "decoratorConfig": {},
453
- "extends": "SmrtCollection",
454
- "extendsTypeArg": "AnalyticsEvent",
455
- "exportName": "AnalyticsEventCollection",
456
- "collectionExportName": "AnalyticsEventCollectionCollection",
626
+ "decoratorConfig": {
627
+ "tableStrategy": "sti",
628
+ "api": {
629
+ "include": [
630
+ "list",
631
+ "get",
632
+ "create",
633
+ "update"
634
+ ]
635
+ },
636
+ "mcp": {
637
+ "include": [
638
+ "list",
639
+ "get"
640
+ ]
641
+ },
642
+ "cli": true,
643
+ "tenantScoped": {
644
+ "mode": "optional"
645
+ },
646
+ "conflictColumns": [
647
+ "tenant_id",
648
+ "slug",
649
+ "context",
650
+ "_meta_type"
651
+ ]
652
+ },
653
+ "extends": "SmrtObject",
654
+ "exportName": "AnalyticsDataStream",
655
+ "collectionExportName": "AnalyticsDataStreamCollection",
457
656
  "schema": {
458
- "tableName": "analytics_event_collections",
459
- "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_event_collections\" (\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);",
657
+ "tableName": "analytics_data_streams",
658
+ "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_data_streams\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"property_id\" UUID,\n \"display_name\" TEXT DEFAULT '',\n \"stream_type\" TEXT,\n \"external_id\" TEXT DEFAULT '',\n \"measurement_id\" TEXT DEFAULT '',\n \"firebase_app_id\" TEXT DEFAULT '',\n \"default_uri\" TEXT DEFAULT '',\n \"bundle_id\" TEXT DEFAULT '',\n \"package_name\" TEXT DEFAULT '',\n \"status\" TEXT,\n \"enhanced_measurement\" BOOLEAN DEFAULT TRUE\n);",
460
659
  "columns": {
461
660
  "id": {
462
661
  "type": "UUID",
@@ -473,6 +672,14 @@
473
672
  "notNull": true,
474
673
  "default": ""
475
674
  },
675
+ "_meta_type": {
676
+ "type": "TEXT",
677
+ "notNull": true
678
+ },
679
+ "_meta_data": {
680
+ "type": "JSON",
681
+ "notNull": false
682
+ },
476
683
  "created_at": {
477
684
  "type": "TIMESTAMP",
478
685
  "notNull": true,
@@ -482,405 +689,106 @@
482
689
  "type": "TIMESTAMP",
483
690
  "notNull": true,
484
691
  "default": "current_timestamp"
692
+ },
693
+ "tenant_id": {
694
+ "type": "UUID",
695
+ "referenceKind": "tenantId",
696
+ "notNull": false
697
+ },
698
+ "property_id": {
699
+ "type": "UUID",
700
+ "referenceKind": "foreignKey",
701
+ "notNull": false
702
+ },
703
+ "display_name": {
704
+ "type": "TEXT",
705
+ "notNull": false,
706
+ "default": ""
707
+ },
708
+ "stream_type": {
709
+ "type": "TEXT",
710
+ "notNull": false
711
+ },
712
+ "external_id": {
713
+ "type": "TEXT",
714
+ "notNull": false,
715
+ "default": ""
716
+ },
717
+ "measurement_id": {
718
+ "type": "TEXT",
719
+ "notNull": false,
720
+ "default": ""
721
+ },
722
+ "firebase_app_id": {
723
+ "type": "TEXT",
724
+ "notNull": false,
725
+ "default": ""
726
+ },
727
+ "default_uri": {
728
+ "type": "TEXT",
729
+ "notNull": false,
730
+ "default": ""
731
+ },
732
+ "bundle_id": {
733
+ "type": "TEXT",
734
+ "notNull": false,
735
+ "default": ""
736
+ },
737
+ "package_name": {
738
+ "type": "TEXT",
739
+ "notNull": false,
740
+ "default": ""
741
+ },
742
+ "status": {
743
+ "type": "TEXT",
744
+ "notNull": false
745
+ },
746
+ "enhanced_measurement": {
747
+ "type": "BOOLEAN",
748
+ "notNull": false,
749
+ "default": true
485
750
  }
486
751
  },
487
752
  "indexes": [
488
753
  {
489
- "name": "analytics_event_collections_id_idx",
754
+ "name": "analytics_data_streams_slug_context_meta_type_idx",
755
+ "columns": [
756
+ "tenant_id",
757
+ "slug",
758
+ "context",
759
+ "_meta_type"
760
+ ],
761
+ "unique": true
762
+ },
763
+ {
764
+ "name": "analytics_data_streams_meta_type_idx",
490
765
  "columns": [
491
- "id"
766
+ "_meta_type"
492
767
  ]
493
768
  },
494
769
  {
495
- "name": "analytics_event_collections_slug_context_idx",
770
+ "name": "analytics_data_streams_tenant_id_created_at_idx",
496
771
  "columns": [
497
- "slug",
498
- "context"
499
- ],
500
- "unique": true
772
+ "tenant_id",
773
+ "created_at"
774
+ ]
775
+ },
776
+ {
777
+ "name": "analytics_data_streams_property_id_idx",
778
+ "columns": [
779
+ "property_id"
780
+ ]
501
781
  }
502
782
  ],
503
- "version": "13d03b2a"
783
+ "version": "e1ae416d"
504
784
  }
505
785
  },
506
- "@happyvertical/smrt-analytics:AnalyticsPropertyCollection": {
507
- "name": "analyticspropertycollection",
508
- "className": "AnalyticsPropertyCollection",
509
- "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsPropertyCollection",
510
- "collection": "analyticsproperties",
511
- "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/collections/AnalyticsPropertyCollection.ts",
512
- "packageName": "@happyvertical/smrt-analytics",
513
- "fields": {},
514
- "methods": {
515
- "findByExternalId": {
516
- "name": "findByExternalId",
517
- "async": true,
518
- "parameters": [
519
- {
520
- "name": "externalId",
521
- "type": "string",
522
- "optional": false
523
- }
524
- ],
525
- "returnType": "Promise<AnalyticsProperty | null>",
526
- "isStatic": false,
527
- "isPublic": true
528
- },
529
- "findByMeasurementId": {
530
- "name": "findByMeasurementId",
531
- "async": true,
532
- "parameters": [
533
- {
534
- "name": "measurementId",
535
- "type": "string",
536
- "optional": false
537
- }
538
- ],
539
- "returnType": "Promise<AnalyticsProperty | null>",
540
- "isStatic": false,
541
- "isPublic": true
542
- },
543
- "findBySiteDomain": {
544
- "name": "findBySiteDomain",
545
- "async": true,
546
- "parameters": [
547
- {
548
- "name": "siteDomain",
549
- "type": "string",
550
- "optional": false
551
- },
552
- {
553
- "name": "provider",
554
- "type": "AnalyticsProvider",
555
- "optional": true
556
- }
557
- ],
558
- "returnType": "Promise<AnalyticsProperty | null>",
559
- "isStatic": false,
560
- "isPublic": true
561
- },
562
- "findByProvider": {
563
- "name": "findByProvider",
564
- "async": true,
565
- "parameters": [
566
- {
567
- "name": "provider",
568
- "type": "AnalyticsProvider",
569
- "optional": false
570
- }
571
- ],
572
- "returnType": "Promise<AnalyticsProperty[]>",
573
- "isStatic": false,
574
- "isPublic": true
575
- },
576
- "findGA4Properties": {
577
- "name": "findGA4Properties",
578
- "async": true,
579
- "parameters": [],
580
- "returnType": "Promise<AnalyticsProperty[]>",
581
- "isStatic": false,
582
- "isPublic": true
583
- },
584
- "findPlausibleSites": {
585
- "name": "findPlausibleSites",
586
- "async": true,
587
- "parameters": [],
588
- "returnType": "Promise<AnalyticsProperty[]>",
589
- "isStatic": false,
590
- "isPublic": true
591
- },
592
- "findMatomoSites": {
593
- "name": "findMatomoSites",
594
- "async": true,
595
- "parameters": [],
596
- "returnType": "Promise<AnalyticsProperty[]>",
597
- "isStatic": false,
598
- "isPublic": true
599
- },
600
- "findByStatus": {
601
- "name": "findByStatus",
602
- "async": true,
603
- "parameters": [
604
- {
605
- "name": "status",
606
- "type": "AnalyticsPropertyStatus",
607
- "optional": false
608
- }
609
- ],
610
- "returnType": "Promise<AnalyticsProperty[]>",
611
- "isStatic": false,
612
- "isPublic": true
613
- },
614
- "findActive": {
615
- "name": "findActive",
616
- "async": true,
617
- "parameters": [],
618
- "returnType": "Promise<AnalyticsProperty[]>",
619
- "isStatic": false,
620
- "isPublic": true
621
- },
622
- "findNeedingSync": {
623
- "name": "findNeedingSync",
624
- "async": true,
625
- "parameters": [
626
- {
627
- "name": "hoursAgo",
628
- "type": "number",
629
- "optional": true
630
- }
631
- ],
632
- "returnType": "Promise<AnalyticsProperty[]>",
633
- "isStatic": false,
634
- "isPublic": true
635
- }
636
- },
637
- "decoratorConfig": {},
638
- "extends": "SmrtCollection",
639
- "extendsTypeArg": "AnalyticsProperty",
640
- "exportName": "AnalyticsPropertyCollection",
641
- "collectionExportName": "AnalyticsPropertyCollectionCollection",
642
- "schema": {
643
- "tableName": "analytics_property_collections",
644
- "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_property_collections\" (\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);",
645
- "columns": {
646
- "id": {
647
- "type": "UUID",
648
- "primaryKey": true,
649
- "referenceKind": "id",
650
- "notNull": true
651
- },
652
- "slug": {
653
- "type": "TEXT",
654
- "notNull": true
655
- },
656
- "context": {
657
- "type": "TEXT",
658
- "notNull": true,
659
- "default": ""
660
- },
661
- "created_at": {
662
- "type": "TIMESTAMP",
663
- "notNull": true,
664
- "default": "current_timestamp"
665
- },
666
- "updated_at": {
667
- "type": "TIMESTAMP",
668
- "notNull": true,
669
- "default": "current_timestamp"
670
- }
671
- },
672
- "indexes": [
673
- {
674
- "name": "analytics_property_collections_id_idx",
675
- "columns": [
676
- "id"
677
- ]
678
- },
679
- {
680
- "name": "analytics_property_collections_slug_context_idx",
681
- "columns": [
682
- "slug",
683
- "context"
684
- ],
685
- "unique": true
686
- }
687
- ],
688
- "version": "a1c264b1"
689
- }
690
- },
691
- "@happyvertical/smrt-analytics:AnalyticsReportCollection": {
692
- "name": "analyticsreportcollection",
693
- "className": "AnalyticsReportCollection",
694
- "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsReportCollection",
695
- "collection": "analyticsreports",
696
- "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/collections/AnalyticsReportCollection.ts",
697
- "packageName": "@happyvertical/smrt-analytics",
698
- "fields": {},
699
- "methods": {
700
- "findByProperty": {
701
- "name": "findByProperty",
702
- "async": true,
703
- "parameters": [
704
- {
705
- "name": "propertyId",
706
- "type": "string",
707
- "optional": false
708
- }
709
- ],
710
- "returnType": "Promise<AnalyticsReport[]>",
711
- "isStatic": false,
712
- "isPublic": true
713
- },
714
- "findByStatus": {
715
- "name": "findByStatus",
716
- "async": true,
717
- "parameters": [
718
- {
719
- "name": "status",
720
- "type": "ReportStatus",
721
- "optional": false
722
- }
723
- ],
724
- "returnType": "Promise<AnalyticsReport[]>",
725
- "isStatic": false,
726
- "isPublic": true
727
- },
728
- "findDrafts": {
729
- "name": "findDrafts",
730
- "async": true,
731
- "parameters": [],
732
- "returnType": "Promise<AnalyticsReport[]>",
733
- "isStatic": false,
734
- "isPublic": true
735
- },
736
- "findScheduled": {
737
- "name": "findScheduled",
738
- "async": true,
739
- "parameters": [],
740
- "returnType": "Promise<AnalyticsReport[]>",
741
- "isStatic": false,
742
- "isPublic": true
743
- },
744
- "findCompleted": {
745
- "name": "findCompleted",
746
- "async": true,
747
- "parameters": [],
748
- "returnType": "Promise<AnalyticsReport[]>",
749
- "isStatic": false,
750
- "isPublic": true
751
- },
752
- "findFailed": {
753
- "name": "findFailed",
754
- "async": true,
755
- "parameters": [],
756
- "returnType": "Promise<AnalyticsReport[]>",
757
- "isStatic": false,
758
- "isPublic": true
759
- },
760
- "findByFrequency": {
761
- "name": "findByFrequency",
762
- "async": true,
763
- "parameters": [
764
- {
765
- "name": "frequency",
766
- "type": "ReportFrequency",
767
- "optional": false
768
- }
769
- ],
770
- "returnType": "Promise<AnalyticsReport[]>",
771
- "isStatic": false,
772
- "isPublic": true
773
- },
774
- "findRecurring": {
775
- "name": "findRecurring",
776
- "async": true,
777
- "parameters": [],
778
- "returnType": "Promise<AnalyticsReport[]>",
779
- "isStatic": false,
780
- "isPublic": true
781
- },
782
- "findDue": {
783
- "name": "findDue",
784
- "async": true,
785
- "parameters": [],
786
- "returnType": "Promise<AnalyticsReport[]>",
787
- "isStatic": false,
788
- "isPublic": true
789
- },
790
- "findByPropertyAndStatus": {
791
- "name": "findByPropertyAndStatus",
792
- "async": true,
793
- "parameters": [
794
- {
795
- "name": "propertyId",
796
- "type": "string",
797
- "optional": false
798
- },
799
- {
800
- "name": "status",
801
- "type": "ReportStatus",
802
- "optional": false
803
- }
804
- ],
805
- "returnType": "Promise<AnalyticsReport[]>",
806
- "isStatic": false,
807
- "isPublic": true
808
- },
809
- "findRecentlyRun": {
810
- "name": "findRecentlyRun",
811
- "async": true,
812
- "parameters": [
813
- {
814
- "name": "hoursAgo",
815
- "type": "number",
816
- "optional": true
817
- }
818
- ],
819
- "returnType": "Promise<AnalyticsReport[]>",
820
- "isStatic": false,
821
- "isPublic": true
822
- }
823
- },
824
- "decoratorConfig": {},
825
- "extends": "SmrtCollection",
826
- "extendsTypeArg": "AnalyticsReport",
827
- "exportName": "AnalyticsReportCollection",
828
- "collectionExportName": "AnalyticsReportCollectionCollection",
829
- "schema": {
830
- "tableName": "analytics_report_collections",
831
- "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_report_collections\" (\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);",
832
- "columns": {
833
- "id": {
834
- "type": "UUID",
835
- "primaryKey": true,
836
- "referenceKind": "id",
837
- "notNull": true
838
- },
839
- "slug": {
840
- "type": "TEXT",
841
- "notNull": true
842
- },
843
- "context": {
844
- "type": "TEXT",
845
- "notNull": true,
846
- "default": ""
847
- },
848
- "created_at": {
849
- "type": "TIMESTAMP",
850
- "notNull": true,
851
- "default": "current_timestamp"
852
- },
853
- "updated_at": {
854
- "type": "TIMESTAMP",
855
- "notNull": true,
856
- "default": "current_timestamp"
857
- }
858
- },
859
- "indexes": [
860
- {
861
- "name": "analytics_report_collections_id_idx",
862
- "columns": [
863
- "id"
864
- ]
865
- },
866
- {
867
- "name": "analytics_report_collections_slug_context_idx",
868
- "columns": [
869
- "slug",
870
- "context"
871
- ],
872
- "unique": true
873
- }
874
- ],
875
- "version": "74445ee1"
876
- }
877
- },
878
- "@happyvertical/smrt-analytics:AnalyticsDataStream": {
879
- "name": "analyticsdatastream",
880
- "className": "AnalyticsDataStream",
881
- "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsDataStream",
882
- "collection": "analyticsdatastreams",
883
- "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/models/AnalyticsDataStream.ts",
786
+ "@happyvertical/smrt-analytics:AnalyticsEvent": {
787
+ "name": "analyticsevent",
788
+ "className": "AnalyticsEvent",
789
+ "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsEvent",
790
+ "collection": "analyticsevents",
791
+ "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/models/AnalyticsEvent.ts",
884
792
  "packageName": "@happyvertical/smrt-analytics",
885
793
  "fields": {
886
794
  "created_at": {
@@ -914,53 +822,77 @@
914
822
  "required": false,
915
823
  "related": "AnalyticsProperty"
916
824
  },
917
- "displayName": {
825
+ "eventName": {
918
826
  "type": "text",
919
827
  "required": false,
920
828
  "default": ""
921
829
  },
922
- "streamType": {
830
+ "clientId": {
923
831
  "type": "text",
924
- "required": false
832
+ "required": false,
833
+ "default": ""
925
834
  },
926
- "externalId": {
835
+ "userId": {
927
836
  "type": "text",
928
837
  "required": false,
929
838
  "default": ""
930
839
  },
931
- "measurementId": {
840
+ "params": {
932
841
  "type": "text",
933
842
  "required": false,
934
- "default": ""
843
+ "default": "{}"
935
844
  },
936
- "firebaseAppId": {
845
+ "eventTimestamp": {
846
+ "type": "datetime",
847
+ "required": false
848
+ },
849
+ "status": {
850
+ "type": "text",
851
+ "required": false
852
+ },
853
+ "sentAt": {
854
+ "type": "datetime",
855
+ "required": false
856
+ },
857
+ "errorMessage": {
937
858
  "type": "text",
938
859
  "required": false,
939
860
  "default": ""
940
861
  },
941
- "defaultUri": {
862
+ "retryCount": {
863
+ "type": "integer",
864
+ "required": false,
865
+ "default": 0
866
+ },
867
+ "nonPersonalizedAds": {
868
+ "type": "boolean",
869
+ "required": false,
870
+ "default": false
871
+ },
872
+ "sessionId": {
942
873
  "type": "text",
943
874
  "required": false,
944
875
  "default": ""
945
876
  },
946
- "bundleId": {
877
+ "pagePath": {
947
878
  "type": "text",
948
879
  "required": false,
949
880
  "default": ""
950
881
  },
951
- "packageName": {
882
+ "pageTitle": {
952
883
  "type": "text",
953
884
  "required": false,
954
885
  "default": ""
955
886
  },
956
- "status": {
887
+ "userAgent": {
957
888
  "type": "text",
958
- "required": false
889
+ "required": false,
890
+ "default": ""
959
891
  },
960
- "enhancedMeasurement": {
961
- "type": "boolean",
892
+ "ipAddress": {
893
+ "type": "text",
962
894
  "required": false,
963
- "default": true
895
+ "default": ""
964
896
  }
965
897
  },
966
898
  "methods": {
@@ -1453,43 +1385,112 @@
1453
1385
  "isStatic": false,
1454
1386
  "isPublic": true
1455
1387
  },
1456
- "isWeb": {
1457
- "name": "isWeb",
1388
+ "getParams": {
1389
+ "name": "getParams",
1458
1390
  "async": false,
1459
1391
  "parameters": [],
1460
- "returnType": "boolean",
1392
+ "returnType": "Record<string, string | number | boolean>",
1461
1393
  "isStatic": false,
1462
1394
  "isPublic": true
1463
1395
  },
1464
- "isIOS": {
1465
- "name": "isIOS",
1396
+ "setParams": {
1397
+ "name": "setParams",
1398
+ "async": false,
1399
+ "parameters": [
1400
+ {
1401
+ "name": "params",
1402
+ "type": "Record<string, string | number | boolean>",
1403
+ "optional": false
1404
+ }
1405
+ ],
1406
+ "returnType": "void",
1407
+ "isStatic": false,
1408
+ "isPublic": true
1409
+ },
1410
+ "addParam": {
1411
+ "name": "addParam",
1412
+ "async": false,
1413
+ "parameters": [
1414
+ {
1415
+ "name": "key",
1416
+ "type": "string",
1417
+ "optional": false
1418
+ },
1419
+ {
1420
+ "name": "value",
1421
+ "type": "string | number | boolean",
1422
+ "optional": false
1423
+ }
1424
+ ],
1425
+ "returnType": "void",
1426
+ "isStatic": false,
1427
+ "isPublic": true
1428
+ },
1429
+ "isPageview": {
1430
+ "name": "isPageview",
1466
1431
  "async": false,
1467
1432
  "parameters": [],
1468
1433
  "returnType": "boolean",
1469
1434
  "isStatic": false,
1470
1435
  "isPublic": true
1471
1436
  },
1472
- "isAndroid": {
1473
- "name": "isAndroid",
1437
+ "isConversion": {
1438
+ "name": "isConversion",
1474
1439
  "async": false,
1475
1440
  "parameters": [],
1476
1441
  "returnType": "boolean",
1477
1442
  "isStatic": false,
1478
1443
  "isPublic": true
1479
1444
  },
1480
- "isMobileApp": {
1481
- "name": "isMobileApp",
1445
+ "markSent": {
1446
+ "name": "markSent",
1447
+ "async": false,
1448
+ "parameters": [],
1449
+ "returnType": "void",
1450
+ "isStatic": false,
1451
+ "isPublic": true
1452
+ },
1453
+ "markFailed": {
1454
+ "name": "markFailed",
1455
+ "async": false,
1456
+ "parameters": [
1457
+ {
1458
+ "name": "error",
1459
+ "type": "string",
1460
+ "optional": false
1461
+ }
1462
+ ],
1463
+ "returnType": "void",
1464
+ "isStatic": false,
1465
+ "isPublic": true
1466
+ },
1467
+ "resetForRetry": {
1468
+ "name": "resetForRetry",
1482
1469
  "async": false,
1483
1470
  "parameters": [],
1471
+ "returnType": "void",
1472
+ "isStatic": false,
1473
+ "isPublic": true
1474
+ },
1475
+ "shouldRetry": {
1476
+ "name": "shouldRetry",
1477
+ "async": false,
1478
+ "parameters": [
1479
+ {
1480
+ "name": "maxRetries",
1481
+ "type": "number",
1482
+ "optional": true
1483
+ }
1484
+ ],
1484
1485
  "returnType": "boolean",
1485
1486
  "isStatic": false,
1486
1487
  "isPublic": true
1487
1488
  },
1488
- "getPlatformId": {
1489
- "name": "getPlatformId",
1489
+ "toTrackEvent": {
1490
+ "name": "toTrackEvent",
1490
1491
  "async": false,
1491
1492
  "parameters": [],
1492
- "returnType": "string",
1493
+ "returnType": "object",
1493
1494
  "isStatic": false,
1494
1495
  "isPublic": true
1495
1496
  }
@@ -1500,27 +1501,33 @@
1500
1501
  "include": [
1501
1502
  "list",
1502
1503
  "get",
1503
- "create",
1504
- "update"
1504
+ "create"
1505
1505
  ]
1506
1506
  },
1507
1507
  "mcp": {
1508
1508
  "include": [
1509
1509
  "list",
1510
- "get"
1510
+ "get",
1511
+ "track"
1511
1512
  ]
1512
1513
  },
1513
1514
  "cli": true,
1514
1515
  "tenantScoped": {
1515
1516
  "mode": "optional"
1516
- }
1517
+ },
1518
+ "conflictColumns": [
1519
+ "tenant_id",
1520
+ "slug",
1521
+ "context",
1522
+ "_meta_type"
1523
+ ]
1517
1524
  },
1518
1525
  "extends": "SmrtObject",
1519
- "exportName": "AnalyticsDataStream",
1520
- "collectionExportName": "AnalyticsDataStreamCollection",
1526
+ "exportName": "AnalyticsEvent",
1527
+ "collectionExportName": "AnalyticsEventCollection",
1521
1528
  "schema": {
1522
- "tableName": "analytics_data_streams",
1523
- "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_data_streams\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"property_id\" UUID,\n \"display_name\" TEXT DEFAULT '',\n \"stream_type\" TEXT,\n \"external_id\" TEXT DEFAULT '',\n \"measurement_id\" TEXT DEFAULT '',\n \"firebase_app_id\" TEXT DEFAULT '',\n \"default_uri\" TEXT DEFAULT '',\n \"bundle_id\" TEXT DEFAULT '',\n \"package_name\" TEXT DEFAULT '',\n \"status\" TEXT,\n \"enhanced_measurement\" BOOLEAN DEFAULT TRUE\n);",
1529
+ "tableName": "analytics_events",
1530
+ "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_events\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"property_id\" UUID,\n \"event_name\" TEXT DEFAULT '',\n \"client_id\" TEXT DEFAULT '',\n \"user_id\" TEXT DEFAULT '',\n \"params\" TEXT DEFAULT '{}',\n \"event_timestamp\" TIMESTAMP,\n \"status\" TEXT,\n \"sent_at\" TIMESTAMP,\n \"error_message\" TEXT DEFAULT '',\n \"retry_count\" INTEGER DEFAULT 0,\n \"non_personalized_ads\" BOOLEAN DEFAULT FALSE,\n \"session_id\" TEXT DEFAULT '',\n \"page_path\" TEXT DEFAULT '',\n \"page_title\" TEXT DEFAULT '',\n \"user_agent\" TEXT DEFAULT '',\n \"ip_address\" TEXT DEFAULT ''\n);",
1524
1531
  "columns": {
1525
1532
  "id": {
1526
1533
  "type": "UUID",
@@ -1565,65 +1572,84 @@
1565
1572
  "referenceKind": "foreignKey",
1566
1573
  "notNull": false
1567
1574
  },
1568
- "display_name": {
1575
+ "event_name": {
1569
1576
  "type": "TEXT",
1570
1577
  "notNull": false,
1571
1578
  "default": ""
1572
1579
  },
1573
- "stream_type": {
1580
+ "client_id": {
1574
1581
  "type": "TEXT",
1575
- "notNull": false
1582
+ "notNull": false,
1583
+ "default": ""
1576
1584
  },
1577
- "external_id": {
1585
+ "user_id": {
1578
1586
  "type": "TEXT",
1579
1587
  "notNull": false,
1580
1588
  "default": ""
1581
1589
  },
1582
- "measurement_id": {
1590
+ "params": {
1583
1591
  "type": "TEXT",
1584
1592
  "notNull": false,
1585
- "default": ""
1593
+ "default": "{}"
1586
1594
  },
1587
- "firebase_app_id": {
1595
+ "event_timestamp": {
1596
+ "type": "TIMESTAMP",
1597
+ "notNull": false
1598
+ },
1599
+ "status": {
1600
+ "type": "TEXT",
1601
+ "notNull": false
1602
+ },
1603
+ "sent_at": {
1604
+ "type": "TIMESTAMP",
1605
+ "notNull": false
1606
+ },
1607
+ "error_message": {
1588
1608
  "type": "TEXT",
1589
1609
  "notNull": false,
1590
1610
  "default": ""
1591
1611
  },
1592
- "default_uri": {
1612
+ "retry_count": {
1613
+ "type": "INTEGER",
1614
+ "notNull": false,
1615
+ "default": 0
1616
+ },
1617
+ "non_personalized_ads": {
1618
+ "type": "BOOLEAN",
1619
+ "notNull": false,
1620
+ "default": false
1621
+ },
1622
+ "session_id": {
1593
1623
  "type": "TEXT",
1594
1624
  "notNull": false,
1595
1625
  "default": ""
1596
1626
  },
1597
- "bundle_id": {
1627
+ "page_path": {
1598
1628
  "type": "TEXT",
1599
1629
  "notNull": false,
1600
1630
  "default": ""
1601
1631
  },
1602
- "package_name": {
1632
+ "page_title": {
1603
1633
  "type": "TEXT",
1604
1634
  "notNull": false,
1605
1635
  "default": ""
1606
1636
  },
1607
- "status": {
1637
+ "user_agent": {
1608
1638
  "type": "TEXT",
1609
- "notNull": false
1639
+ "notNull": false,
1640
+ "default": ""
1610
1641
  },
1611
- "enhanced_measurement": {
1612
- "type": "BOOLEAN",
1642
+ "ip_address": {
1643
+ "type": "TEXT",
1613
1644
  "notNull": false,
1614
- "default": true
1645
+ "default": ""
1615
1646
  }
1616
1647
  },
1617
1648
  "indexes": [
1618
1649
  {
1619
- "name": "analytics_data_streams_id_idx",
1620
- "columns": [
1621
- "id"
1622
- ]
1623
- },
1624
- {
1625
- "name": "analytics_data_streams_slug_context_meta_type_idx",
1650
+ "name": "analytics_events_slug_context_meta_type_idx",
1626
1651
  "columns": [
1652
+ "tenant_id",
1627
1653
  "slug",
1628
1654
  "context",
1629
1655
  "_meta_type"
@@ -1631,21 +1657,34 @@
1631
1657
  "unique": true
1632
1658
  },
1633
1659
  {
1634
- "name": "analytics_data_streams_meta_type_idx",
1660
+ "name": "analytics_events_meta_type_idx",
1635
1661
  "columns": [
1636
1662
  "_meta_type"
1637
1663
  ]
1664
+ },
1665
+ {
1666
+ "name": "analytics_events_tenant_id_created_at_idx",
1667
+ "columns": [
1668
+ "tenant_id",
1669
+ "created_at"
1670
+ ]
1671
+ },
1672
+ {
1673
+ "name": "analytics_events_property_id_idx",
1674
+ "columns": [
1675
+ "property_id"
1676
+ ]
1638
1677
  }
1639
1678
  ],
1640
- "version": "e1ae416d"
1679
+ "version": "8c2447ff"
1641
1680
  }
1642
1681
  },
1643
- "@happyvertical/smrt-analytics:AnalyticsEvent": {
1644
- "name": "analyticsevent",
1645
- "className": "AnalyticsEvent",
1646
- "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsEvent",
1647
- "collection": "analyticsevents",
1648
- "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/models/AnalyticsEvent.ts",
1682
+ "@happyvertical/smrt-analytics:AnalyticsProperty": {
1683
+ "name": "analyticsproperty",
1684
+ "className": "AnalyticsProperty",
1685
+ "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsProperty",
1686
+ "collection": "analyticsproperties",
1687
+ "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/models/AnalyticsProperty.ts",
1649
1688
  "packageName": "@happyvertical/smrt-analytics",
1650
1689
  "fields": {
1651
1690
  "created_at": {
@@ -1674,82 +1713,80 @@
1674
1713
  }
1675
1714
  }
1676
1715
  },
1677
- "propertyId": {
1678
- "type": "foreignKey",
1679
- "required": false,
1680
- "related": "AnalyticsProperty"
1681
- },
1682
- "eventName": {
1716
+ "name": {
1683
1717
  "type": "text",
1684
1718
  "required": false,
1685
1719
  "default": ""
1686
1720
  },
1687
- "clientId": {
1721
+ "displayName": {
1688
1722
  "type": "text",
1689
1723
  "required": false,
1690
1724
  "default": ""
1691
1725
  },
1692
- "userId": {
1726
+ "provider": {
1727
+ "type": "text",
1728
+ "required": false
1729
+ },
1730
+ "externalId": {
1693
1731
  "type": "text",
1694
1732
  "required": false,
1695
1733
  "default": ""
1696
1734
  },
1697
- "params": {
1735
+ "measurementId": {
1698
1736
  "type": "text",
1699
1737
  "required": false,
1700
- "default": "{}"
1701
- },
1702
- "eventTimestamp": {
1703
- "type": "datetime",
1704
- "required": false
1738
+ "default": ""
1705
1739
  },
1706
- "status": {
1740
+ "apiSecret": {
1707
1741
  "type": "text",
1708
- "required": false
1709
- },
1710
- "sentAt": {
1711
- "type": "datetime",
1712
- "required": false
1742
+ "required": false,
1743
+ "default": "",
1744
+ "_meta": {
1745
+ "sensitive": true
1746
+ },
1747
+ "sensitive": true
1713
1748
  },
1714
- "errorMessage": {
1749
+ "siteDomain": {
1715
1750
  "type": "text",
1716
1751
  "required": false,
1717
1752
  "default": ""
1718
1753
  },
1719
- "retryCount": {
1720
- "type": "integer",
1721
- "required": false,
1722
- "default": 0
1723
- },
1724
- "nonPersonalizedAds": {
1725
- "type": "boolean",
1754
+ "timeZone": {
1755
+ "type": "text",
1726
1756
  "required": false,
1727
- "default": false
1757
+ "default": "America/Los_Angeles"
1728
1758
  },
1729
- "sessionId": {
1759
+ "currencyCode": {
1730
1760
  "type": "text",
1731
1761
  "required": false,
1732
- "default": ""
1762
+ "default": "USD"
1733
1763
  },
1734
- "pagePath": {
1764
+ "industryCategory": {
1735
1765
  "type": "text",
1736
1766
  "required": false,
1737
1767
  "default": ""
1738
1768
  },
1739
- "pageTitle": {
1769
+ "serviceLevel": {
1740
1770
  "type": "text",
1741
1771
  "required": false,
1742
- "default": ""
1772
+ "default": "STANDARD"
1743
1773
  },
1744
- "userAgent": {
1774
+ "status": {
1745
1775
  "type": "text",
1746
- "required": false,
1747
- "default": ""
1776
+ "required": false
1748
1777
  },
1749
- "ipAddress": {
1778
+ "lastSyncAt": {
1779
+ "type": "datetime",
1780
+ "required": false
1781
+ },
1782
+ "providerMetadata": {
1750
1783
  "type": "text",
1751
1784
  "required": false,
1752
- "default": ""
1785
+ "default": "{}",
1786
+ "_meta": {
1787
+ "sensitive": true
1788
+ },
1789
+ "sensitive": true
1753
1790
  }
1754
1791
  },
1755
1792
  "methods": {
@@ -2242,78 +2279,45 @@
2242
2279
  "isStatic": false,
2243
2280
  "isPublic": true
2244
2281
  },
2245
- "getParams": {
2246
- "name": "getParams",
2282
+ "isGA4": {
2283
+ "name": "isGA4",
2247
2284
  "async": false,
2248
2285
  "parameters": [],
2249
- "returnType": "Record<string, string | number | boolean>",
2250
- "isStatic": false,
2251
- "isPublic": true
2252
- },
2253
- "setParams": {
2254
- "name": "setParams",
2255
- "async": false,
2256
- "parameters": [
2257
- {
2258
- "name": "params",
2259
- "type": "Record<string, string | number | boolean>",
2260
- "optional": false
2261
- }
2262
- ],
2263
- "returnType": "void",
2264
- "isStatic": false,
2265
- "isPublic": true
2266
- },
2267
- "addParam": {
2268
- "name": "addParam",
2269
- "async": false,
2270
- "parameters": [
2271
- {
2272
- "name": "key",
2273
- "type": "string",
2274
- "optional": false
2275
- },
2276
- {
2277
- "name": "value",
2278
- "type": "string | number | boolean",
2279
- "optional": false
2280
- }
2281
- ],
2282
- "returnType": "void",
2286
+ "returnType": "boolean",
2283
2287
  "isStatic": false,
2284
2288
  "isPublic": true
2285
2289
  },
2286
- "isPageview": {
2287
- "name": "isPageview",
2290
+ "isPlausible": {
2291
+ "name": "isPlausible",
2288
2292
  "async": false,
2289
2293
  "parameters": [],
2290
2294
  "returnType": "boolean",
2291
2295
  "isStatic": false,
2292
2296
  "isPublic": true
2293
2297
  },
2294
- "isConversion": {
2295
- "name": "isConversion",
2298
+ "isMatomo": {
2299
+ "name": "isMatomo",
2296
2300
  "async": false,
2297
2301
  "parameters": [],
2298
2302
  "returnType": "boolean",
2299
2303
  "isStatic": false,
2300
2304
  "isPublic": true
2301
2305
  },
2302
- "markSent": {
2303
- "name": "markSent",
2306
+ "getProviderMetadata": {
2307
+ "name": "getProviderMetadata",
2304
2308
  "async": false,
2305
2309
  "parameters": [],
2306
- "returnType": "void",
2310
+ "returnType": "Record<string>",
2307
2311
  "isStatic": false,
2308
2312
  "isPublic": true
2309
2313
  },
2310
- "markFailed": {
2311
- "name": "markFailed",
2314
+ "setProviderMetadata": {
2315
+ "name": "setProviderMetadata",
2312
2316
  "async": false,
2313
2317
  "parameters": [
2314
2318
  {
2315
- "name": "error",
2316
- "type": "string",
2319
+ "name": "metadata",
2320
+ "type": "Record<string>",
2317
2321
  "optional": false
2318
2322
  }
2319
2323
  ],
@@ -2321,33 +2325,33 @@
2321
2325
  "isStatic": false,
2322
2326
  "isPublic": true
2323
2327
  },
2324
- "resetForRetry": {
2325
- "name": "resetForRetry",
2328
+ "markSynced": {
2329
+ "name": "markSynced",
2326
2330
  "async": false,
2327
2331
  "parameters": [],
2328
2332
  "returnType": "void",
2329
2333
  "isStatic": false,
2330
2334
  "isPublic": true
2331
2335
  },
2332
- "shouldRetry": {
2333
- "name": "shouldRetry",
2334
- "async": false,
2336
+ "analyzePerformance": {
2337
+ "name": "analyzePerformance",
2338
+ "async": true,
2335
2339
  "parameters": [
2336
2340
  {
2337
- "name": "maxRetries",
2338
- "type": "number",
2341
+ "name": "options",
2342
+ "type": "object",
2339
2343
  "optional": true
2340
2344
  }
2341
2345
  ],
2342
- "returnType": "boolean",
2346
+ "returnType": "Promise<object>",
2343
2347
  "isStatic": false,
2344
2348
  "isPublic": true
2345
2349
  },
2346
- "toTrackEvent": {
2347
- "name": "toTrackEvent",
2348
- "async": false,
2350
+ "isPerformingWell": {
2351
+ "name": "isPerformingWell",
2352
+ "async": true,
2349
2353
  "parameters": [],
2350
- "returnType": "object",
2354
+ "returnType": "Promise<boolean>",
2351
2355
  "isStatic": false,
2352
2356
  "isPublic": true
2353
2357
  }
@@ -2358,27 +2362,35 @@
2358
2362
  "include": [
2359
2363
  "list",
2360
2364
  "get",
2361
- "create"
2365
+ "create",
2366
+ "update"
2362
2367
  ]
2363
2368
  },
2364
2369
  "mcp": {
2365
2370
  "include": [
2366
2371
  "list",
2367
2372
  "get",
2368
- "track"
2373
+ "sync",
2374
+ "runReport"
2369
2375
  ]
2370
2376
  },
2371
2377
  "cli": true,
2372
2378
  "tenantScoped": {
2373
2379
  "mode": "optional"
2374
- }
2380
+ },
2381
+ "conflictColumns": [
2382
+ "tenant_id",
2383
+ "slug",
2384
+ "context",
2385
+ "_meta_type"
2386
+ ]
2375
2387
  },
2376
2388
  "extends": "SmrtObject",
2377
- "exportName": "AnalyticsEvent",
2378
- "collectionExportName": "AnalyticsEventCollection",
2389
+ "exportName": "AnalyticsProperty",
2390
+ "collectionExportName": "AnalyticsPropertyCollection",
2379
2391
  "schema": {
2380
- "tableName": "analytics_events",
2381
- "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_events\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"property_id\" UUID,\n \"event_name\" TEXT DEFAULT '',\n \"client_id\" TEXT DEFAULT '',\n \"user_id\" TEXT DEFAULT '',\n \"params\" TEXT DEFAULT '{}',\n \"event_timestamp\" TIMESTAMP,\n \"status\" TEXT,\n \"sent_at\" TIMESTAMP,\n \"error_message\" TEXT DEFAULT '',\n \"retry_count\" INTEGER DEFAULT 0,\n \"non_personalized_ads\" BOOLEAN DEFAULT FALSE,\n \"session_id\" TEXT DEFAULT '',\n \"page_path\" TEXT DEFAULT '',\n \"page_title\" TEXT DEFAULT '',\n \"user_agent\" TEXT DEFAULT '',\n \"ip_address\" TEXT DEFAULT ''\n);",
2392
+ "tableName": "analytics_properties",
2393
+ "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_properties\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"display_name\" TEXT DEFAULT '',\n \"provider\" TEXT,\n \"external_id\" TEXT DEFAULT '',\n \"measurement_id\" TEXT DEFAULT '',\n \"api_secret\" TEXT DEFAULT '',\n \"site_domain\" TEXT DEFAULT '',\n \"time_zone\" TEXT DEFAULT 'America/Los_Angeles',\n \"currency_code\" TEXT DEFAULT 'USD',\n \"industry_category\" TEXT DEFAULT '',\n \"service_level\" TEXT DEFAULT 'STANDARD',\n \"status\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"provider_metadata\" TEXT DEFAULT '{}'\n);",
2382
2394
  "columns": {
2383
2395
  "id": {
2384
2396
  "type": "UUID",
@@ -2418,94 +2430,79 @@
2418
2430
  "referenceKind": "tenantId",
2419
2431
  "notNull": false
2420
2432
  },
2421
- "property_id": {
2422
- "type": "UUID",
2423
- "referenceKind": "foreignKey",
2424
- "notNull": false
2425
- },
2426
- "event_name": {
2433
+ "name": {
2427
2434
  "type": "TEXT",
2428
2435
  "notNull": false,
2429
2436
  "default": ""
2430
2437
  },
2431
- "client_id": {
2438
+ "display_name": {
2432
2439
  "type": "TEXT",
2433
2440
  "notNull": false,
2434
2441
  "default": ""
2435
2442
  },
2436
- "user_id": {
2443
+ "provider": {
2437
2444
  "type": "TEXT",
2438
- "notNull": false,
2439
- "default": ""
2445
+ "notNull": false
2440
2446
  },
2441
- "params": {
2447
+ "external_id": {
2442
2448
  "type": "TEXT",
2443
2449
  "notNull": false,
2444
- "default": "{}"
2445
- },
2446
- "event_timestamp": {
2447
- "type": "TIMESTAMP",
2448
- "notNull": false
2450
+ "default": ""
2449
2451
  },
2450
- "status": {
2452
+ "measurement_id": {
2451
2453
  "type": "TEXT",
2452
- "notNull": false
2453
- },
2454
- "sent_at": {
2455
- "type": "TIMESTAMP",
2456
- "notNull": false
2454
+ "notNull": false,
2455
+ "default": ""
2457
2456
  },
2458
- "error_message": {
2457
+ "api_secret": {
2459
2458
  "type": "TEXT",
2460
2459
  "notNull": false,
2461
2460
  "default": ""
2462
2461
  },
2463
- "retry_count": {
2464
- "type": "INTEGER",
2462
+ "site_domain": {
2463
+ "type": "TEXT",
2465
2464
  "notNull": false,
2466
- "default": 0
2465
+ "default": ""
2467
2466
  },
2468
- "non_personalized_ads": {
2469
- "type": "BOOLEAN",
2467
+ "time_zone": {
2468
+ "type": "TEXT",
2470
2469
  "notNull": false,
2471
- "default": false
2470
+ "default": "America/Los_Angeles"
2472
2471
  },
2473
- "session_id": {
2472
+ "currency_code": {
2474
2473
  "type": "TEXT",
2475
2474
  "notNull": false,
2476
- "default": ""
2475
+ "default": "USD"
2477
2476
  },
2478
- "page_path": {
2477
+ "industry_category": {
2479
2478
  "type": "TEXT",
2480
2479
  "notNull": false,
2481
2480
  "default": ""
2482
2481
  },
2483
- "page_title": {
2482
+ "service_level": {
2484
2483
  "type": "TEXT",
2485
2484
  "notNull": false,
2486
- "default": ""
2485
+ "default": "STANDARD"
2487
2486
  },
2488
- "user_agent": {
2487
+ "status": {
2489
2488
  "type": "TEXT",
2490
- "notNull": false,
2491
- "default": ""
2489
+ "notNull": false
2492
2490
  },
2493
- "ip_address": {
2491
+ "last_sync_at": {
2492
+ "type": "TIMESTAMP",
2493
+ "notNull": false
2494
+ },
2495
+ "provider_metadata": {
2494
2496
  "type": "TEXT",
2495
2497
  "notNull": false,
2496
- "default": ""
2498
+ "default": "{}"
2497
2499
  }
2498
2500
  },
2499
2501
  "indexes": [
2500
2502
  {
2501
- "name": "analytics_events_id_idx",
2502
- "columns": [
2503
- "id"
2504
- ]
2505
- },
2506
- {
2507
- "name": "analytics_events_slug_context_meta_type_idx",
2503
+ "name": "analytics_properties_slug_context_meta_type_idx",
2508
2504
  "columns": [
2505
+ "tenant_id",
2509
2506
  "slug",
2510
2507
  "context",
2511
2508
  "_meta_type"
@@ -2513,21 +2510,28 @@
2513
2510
  "unique": true
2514
2511
  },
2515
2512
  {
2516
- "name": "analytics_events_meta_type_idx",
2513
+ "name": "analytics_properties_meta_type_idx",
2517
2514
  "columns": [
2518
2515
  "_meta_type"
2519
2516
  ]
2517
+ },
2518
+ {
2519
+ "name": "analytics_properties_tenant_id_created_at_idx",
2520
+ "columns": [
2521
+ "tenant_id",
2522
+ "created_at"
2523
+ ]
2520
2524
  }
2521
2525
  ],
2522
- "version": "8c2447ff"
2526
+ "version": "f38a20b9"
2523
2527
  }
2524
2528
  },
2525
- "@happyvertical/smrt-analytics:AnalyticsProperty": {
2526
- "name": "analyticsproperty",
2527
- "className": "AnalyticsProperty",
2528
- "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsProperty",
2529
- "collection": "analyticsproperties",
2530
- "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/models/AnalyticsProperty.ts",
2529
+ "@happyvertical/smrt-analytics:AnalyticsReport": {
2530
+ "name": "analyticsreport",
2531
+ "className": "AnalyticsReport",
2532
+ "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsReport",
2533
+ "collection": "analyticsreports",
2534
+ "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/models/AnalyticsReport.ts",
2531
2535
  "packageName": "@happyvertical/smrt-analytics",
2532
2536
  "fields": {
2533
2537
  "created_at": {
@@ -2556,80 +2560,91 @@
2556
2560
  }
2557
2561
  }
2558
2562
  },
2563
+ "propertyId": {
2564
+ "type": "foreignKey",
2565
+ "required": false,
2566
+ "related": "AnalyticsProperty"
2567
+ },
2559
2568
  "name": {
2560
2569
  "type": "text",
2561
2570
  "required": false,
2562
2571
  "default": ""
2563
2572
  },
2564
- "displayName": {
2573
+ "description": {
2565
2574
  "type": "text",
2566
2575
  "required": false,
2567
2576
  "default": ""
2568
2577
  },
2569
- "provider": {
2578
+ "dimensions": {
2570
2579
  "type": "text",
2571
- "required": false
2580
+ "required": false,
2581
+ "default": "[]"
2572
2582
  },
2573
- "externalId": {
2583
+ "metrics": {
2574
2584
  "type": "text",
2575
2585
  "required": false,
2576
- "default": ""
2586
+ "default": "[]"
2577
2587
  },
2578
- "measurementId": {
2588
+ "dateRangeStart": {
2579
2589
  "type": "text",
2580
2590
  "required": false,
2581
- "default": ""
2591
+ "default": "7daysAgo"
2582
2592
  },
2583
- "apiSecret": {
2593
+ "dateRangeEnd": {
2584
2594
  "type": "text",
2585
2595
  "required": false,
2586
- "default": "",
2587
- "_meta": {
2588
- "sensitive": true
2589
- },
2590
- "sensitive": true
2596
+ "default": "today"
2591
2597
  },
2592
- "siteDomain": {
2598
+ "dimensionFilter": {
2593
2599
  "type": "text",
2594
2600
  "required": false,
2595
2601
  "default": ""
2596
2602
  },
2597
- "timeZone": {
2603
+ "metricFilter": {
2598
2604
  "type": "text",
2599
2605
  "required": false,
2600
- "default": "America/Los_Angeles"
2606
+ "default": ""
2601
2607
  },
2602
- "currencyCode": {
2608
+ "orderBy": {
2603
2609
  "type": "text",
2604
2610
  "required": false,
2605
- "default": "USD"
2611
+ "default": "[]"
2606
2612
  },
2607
- "industryCategory": {
2608
- "type": "text",
2613
+ "maxResults": {
2614
+ "type": "integer",
2609
2615
  "required": false,
2610
- "default": ""
2616
+ "default": 0
2611
2617
  },
2612
- "serviceLevel": {
2618
+ "status": {
2613
2619
  "type": "text",
2614
- "required": false,
2615
- "default": "STANDARD"
2620
+ "required": false
2616
2621
  },
2617
- "status": {
2622
+ "frequency": {
2618
2623
  "type": "text",
2619
2624
  "required": false
2620
2625
  },
2621
- "lastSyncAt": {
2626
+ "lastRunAt": {
2622
2627
  "type": "datetime",
2623
2628
  "required": false
2624
2629
  },
2625
- "providerMetadata": {
2630
+ "nextRunAt": {
2631
+ "type": "datetime",
2632
+ "required": false
2633
+ },
2634
+ "resultData": {
2626
2635
  "type": "text",
2627
2636
  "required": false,
2628
- "default": "{}",
2629
- "_meta": {
2630
- "sensitive": true
2631
- },
2632
- "sensitive": true
2637
+ "default": ""
2638
+ },
2639
+ "rowCount": {
2640
+ "type": "integer",
2641
+ "required": false,
2642
+ "default": 0
2643
+ },
2644
+ "lastError": {
2645
+ "type": "text",
2646
+ "required": false,
2647
+ "default": ""
2633
2648
  }
2634
2649
  },
2635
2650
  "methods": {
@@ -3122,45 +3137,101 @@
3122
3137
  "isStatic": false,
3123
3138
  "isPublic": true
3124
3139
  },
3125
- "isGA4": {
3126
- "name": "isGA4",
3140
+ "getDimensions": {
3141
+ "name": "getDimensions",
3127
3142
  "async": false,
3128
3143
  "parameters": [],
3129
- "returnType": "boolean",
3144
+ "returnType": "Array<object>",
3130
3145
  "isStatic": false,
3131
3146
  "isPublic": true
3132
3147
  },
3133
- "isPlausible": {
3134
- "name": "isPlausible",
3148
+ "setDimensions": {
3149
+ "name": "setDimensions",
3150
+ "async": false,
3151
+ "parameters": [
3152
+ {
3153
+ "name": "dimensions",
3154
+ "type": "Array<object>",
3155
+ "optional": false
3156
+ }
3157
+ ],
3158
+ "returnType": "void",
3159
+ "isStatic": false,
3160
+ "isPublic": true
3161
+ },
3162
+ "getMetrics": {
3163
+ "name": "getMetrics",
3135
3164
  "async": false,
3136
3165
  "parameters": [],
3137
- "returnType": "boolean",
3166
+ "returnType": "Array<object>",
3138
3167
  "isStatic": false,
3139
3168
  "isPublic": true
3140
3169
  },
3141
- "isMatomo": {
3142
- "name": "isMatomo",
3170
+ "setMetrics": {
3171
+ "name": "setMetrics",
3172
+ "async": false,
3173
+ "parameters": [
3174
+ {
3175
+ "name": "metrics",
3176
+ "type": "Array<object>",
3177
+ "optional": false
3178
+ }
3179
+ ],
3180
+ "returnType": "void",
3181
+ "isStatic": false,
3182
+ "isPublic": true
3183
+ },
3184
+ "getResultData": {
3185
+ "name": "getResultData",
3143
3186
  "async": false,
3144
3187
  "parameters": [],
3145
- "returnType": "boolean",
3188
+ "returnType": "Record<string> | null",
3146
3189
  "isStatic": false,
3147
3190
  "isPublic": true
3148
3191
  },
3149
- "getProviderMetadata": {
3150
- "name": "getProviderMetadata",
3192
+ "setResultData": {
3193
+ "name": "setResultData",
3194
+ "async": false,
3195
+ "parameters": [
3196
+ {
3197
+ "name": "data",
3198
+ "type": "Record<string>",
3199
+ "optional": false
3200
+ }
3201
+ ],
3202
+ "returnType": "void",
3203
+ "isStatic": false,
3204
+ "isPublic": true
3205
+ },
3206
+ "markRunning": {
3207
+ "name": "markRunning",
3151
3208
  "async": false,
3152
3209
  "parameters": [],
3153
- "returnType": "Record<string>",
3210
+ "returnType": "void",
3211
+ "isStatic": false,
3212
+ "isPublic": true
3213
+ },
3214
+ "markCompleted": {
3215
+ "name": "markCompleted",
3216
+ "async": false,
3217
+ "parameters": [
3218
+ {
3219
+ "name": "rowCount",
3220
+ "type": "number",
3221
+ "optional": false
3222
+ }
3223
+ ],
3224
+ "returnType": "void",
3154
3225
  "isStatic": false,
3155
3226
  "isPublic": true
3156
3227
  },
3157
- "setProviderMetadata": {
3158
- "name": "setProviderMetadata",
3228
+ "markFailed": {
3229
+ "name": "markFailed",
3159
3230
  "async": false,
3160
3231
  "parameters": [
3161
3232
  {
3162
- "name": "metadata",
3163
- "type": "Record<string>",
3233
+ "name": "error",
3234
+ "type": "string",
3164
3235
  "optional": false
3165
3236
  }
3166
3237
  ],
@@ -3168,21 +3239,29 @@
3168
3239
  "isStatic": false,
3169
3240
  "isPublic": true
3170
3241
  },
3171
- "markSynced": {
3172
- "name": "markSynced",
3242
+ "calculateNextRun": {
3243
+ "name": "calculateNextRun",
3173
3244
  "async": false,
3174
3245
  "parameters": [],
3175
3246
  "returnType": "void",
3176
3247
  "isStatic": false,
3177
3248
  "isPublic": true
3178
3249
  },
3179
- "analyzePerformance": {
3180
- "name": "analyzePerformance",
3250
+ "isDue": {
3251
+ "name": "isDue",
3252
+ "async": false,
3253
+ "parameters": [],
3254
+ "returnType": "boolean",
3255
+ "isStatic": false,
3256
+ "isPublic": true
3257
+ },
3258
+ "analyzeResults": {
3259
+ "name": "analyzeResults",
3181
3260
  "async": true,
3182
3261
  "parameters": [
3183
3262
  {
3184
- "name": "options",
3185
- "type": "object",
3263
+ "name": "_options",
3264
+ "type": "Record<string>",
3186
3265
  "optional": true
3187
3266
  }
3188
3267
  ],
@@ -3190,8 +3269,8 @@
3190
3269
  "isStatic": false,
3191
3270
  "isPublic": true
3192
3271
  },
3193
- "isPerformingWell": {
3194
- "name": "isPerformingWell",
3272
+ "hasPositiveTrends": {
3273
+ "name": "hasPositiveTrends",
3195
3274
  "async": true,
3196
3275
  "parameters": [],
3197
3276
  "returnType": "Promise<boolean>",
@@ -3206,28 +3285,35 @@
3206
3285
  "list",
3207
3286
  "get",
3208
3287
  "create",
3209
- "update"
3288
+ "update",
3289
+ "run"
3210
3290
  ]
3211
3291
  },
3212
3292
  "mcp": {
3213
3293
  "include": [
3214
3294
  "list",
3215
3295
  "get",
3216
- "sync",
3217
- "runReport"
3296
+ "run",
3297
+ "analyze"
3218
3298
  ]
3219
3299
  },
3220
3300
  "cli": true,
3221
3301
  "tenantScoped": {
3222
3302
  "mode": "optional"
3223
- }
3303
+ },
3304
+ "conflictColumns": [
3305
+ "tenant_id",
3306
+ "slug",
3307
+ "context",
3308
+ "_meta_type"
3309
+ ]
3224
3310
  },
3225
3311
  "extends": "SmrtObject",
3226
- "exportName": "AnalyticsProperty",
3227
- "collectionExportName": "AnalyticsPropertyCollection",
3312
+ "exportName": "AnalyticsReport",
3313
+ "collectionExportName": "AnalyticsReportCollection",
3228
3314
  "schema": {
3229
- "tableName": "analytics_properties",
3230
- "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_properties\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"display_name\" TEXT DEFAULT '',\n \"provider\" TEXT,\n \"external_id\" TEXT DEFAULT '',\n \"measurement_id\" TEXT DEFAULT '',\n \"api_secret\" TEXT DEFAULT '',\n \"site_domain\" TEXT DEFAULT '',\n \"time_zone\" TEXT DEFAULT 'America/Los_Angeles',\n \"currency_code\" TEXT DEFAULT 'USD',\n \"industry_category\" TEXT DEFAULT '',\n \"service_level\" TEXT DEFAULT 'STANDARD',\n \"status\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"provider_metadata\" TEXT DEFAULT '{}'\n);",
3315
+ "tableName": "analytics_reports",
3316
+ "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_reports\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"property_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT DEFAULT '',\n \"dimensions\" TEXT DEFAULT '[]',\n \"metrics\" TEXT DEFAULT '[]',\n \"date_range_start\" TEXT DEFAULT '7daysAgo',\n \"date_range_end\" TEXT DEFAULT 'today',\n \"dimension_filter\" TEXT DEFAULT '',\n \"metric_filter\" TEXT DEFAULT '',\n \"order_by\" TEXT DEFAULT '[]',\n \"max_results\" INTEGER DEFAULT 0,\n \"status\" TEXT,\n \"frequency\" TEXT,\n \"last_run_at\" TIMESTAMP,\n \"next_run_at\" TIMESTAMP,\n \"result_data\" TEXT DEFAULT '',\n \"row_count\" INTEGER DEFAULT 0,\n \"last_error\" TEXT DEFAULT ''\n);",
3231
3317
  "columns": {
3232
3318
  "id": {
3233
3319
  "type": "UUID",
@@ -3267,882 +3353,952 @@
3267
3353
  "referenceKind": "tenantId",
3268
3354
  "notNull": false
3269
3355
  },
3356
+ "property_id": {
3357
+ "type": "UUID",
3358
+ "referenceKind": "foreignKey",
3359
+ "notNull": false
3360
+ },
3270
3361
  "name": {
3271
3362
  "type": "TEXT",
3272
3363
  "notNull": false,
3273
3364
  "default": ""
3274
3365
  },
3275
- "display_name": {
3366
+ "description": {
3276
3367
  "type": "TEXT",
3277
3368
  "notNull": false,
3278
3369
  "default": ""
3279
3370
  },
3280
- "provider": {
3371
+ "dimensions": {
3281
3372
  "type": "TEXT",
3282
- "notNull": false
3373
+ "notNull": false,
3374
+ "default": "[]"
3283
3375
  },
3284
- "external_id": {
3376
+ "metrics": {
3285
3377
  "type": "TEXT",
3286
3378
  "notNull": false,
3287
- "default": ""
3379
+ "default": "[]"
3288
3380
  },
3289
- "measurement_id": {
3381
+ "date_range_start": {
3290
3382
  "type": "TEXT",
3291
3383
  "notNull": false,
3292
- "default": ""
3384
+ "default": "7daysAgo"
3293
3385
  },
3294
- "api_secret": {
3386
+ "date_range_end": {
3295
3387
  "type": "TEXT",
3296
3388
  "notNull": false,
3297
- "default": ""
3389
+ "default": "today"
3298
3390
  },
3299
- "site_domain": {
3391
+ "dimension_filter": {
3300
3392
  "type": "TEXT",
3301
3393
  "notNull": false,
3302
3394
  "default": ""
3303
3395
  },
3304
- "time_zone": {
3396
+ "metric_filter": {
3305
3397
  "type": "TEXT",
3306
3398
  "notNull": false,
3307
- "default": "America/Los_Angeles"
3399
+ "default": ""
3308
3400
  },
3309
- "currency_code": {
3401
+ "order_by": {
3310
3402
  "type": "TEXT",
3311
3403
  "notNull": false,
3312
- "default": "USD"
3404
+ "default": "[]"
3313
3405
  },
3314
- "industry_category": {
3315
- "type": "TEXT",
3406
+ "max_results": {
3407
+ "type": "INTEGER",
3316
3408
  "notNull": false,
3317
- "default": ""
3409
+ "default": 0
3318
3410
  },
3319
- "service_level": {
3411
+ "status": {
3320
3412
  "type": "TEXT",
3321
- "notNull": false,
3322
- "default": "STANDARD"
3413
+ "notNull": false
3323
3414
  },
3324
- "status": {
3415
+ "frequency": {
3325
3416
  "type": "TEXT",
3326
3417
  "notNull": false
3327
3418
  },
3328
- "last_sync_at": {
3419
+ "last_run_at": {
3329
3420
  "type": "TIMESTAMP",
3330
3421
  "notNull": false
3331
3422
  },
3332
- "provider_metadata": {
3423
+ "next_run_at": {
3424
+ "type": "TIMESTAMP",
3425
+ "notNull": false
3426
+ },
3427
+ "result_data": {
3333
3428
  "type": "TEXT",
3334
3429
  "notNull": false,
3335
- "default": "{}"
3430
+ "default": ""
3431
+ },
3432
+ "row_count": {
3433
+ "type": "INTEGER",
3434
+ "notNull": false,
3435
+ "default": 0
3436
+ },
3437
+ "last_error": {
3438
+ "type": "TEXT",
3439
+ "notNull": false,
3440
+ "default": ""
3336
3441
  }
3337
3442
  },
3338
3443
  "indexes": [
3339
3444
  {
3340
- "name": "analytics_properties_id_idx",
3341
- "columns": [
3342
- "id"
3343
- ]
3344
- },
3345
- {
3346
- "name": "analytics_properties_slug_context_meta_type_idx",
3445
+ "name": "analytics_reports_slug_context_meta_type_idx",
3347
3446
  "columns": [
3447
+ "tenant_id",
3348
3448
  "slug",
3349
3449
  "context",
3350
3450
  "_meta_type"
3351
3451
  ],
3352
3452
  "unique": true
3353
3453
  },
3354
- {
3355
- "name": "analytics_properties_meta_type_idx",
3356
- "columns": [
3357
- "_meta_type"
3358
- ]
3359
- }
3360
- ],
3361
- "version": "f38a20b9"
3362
- }
3363
- },
3364
- "@happyvertical/smrt-analytics:AnalyticsReport": {
3365
- "name": "analyticsreport",
3366
- "className": "AnalyticsReport",
3367
- "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsReport",
3368
- "collection": "analyticsreports",
3369
- "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/models/AnalyticsReport.ts",
3370
- "packageName": "@happyvertical/smrt-analytics",
3371
- "fields": {
3372
- "created_at": {
3373
- "type": "datetime",
3374
- "required": false
3375
- },
3376
- "updated_at": {
3377
- "type": "datetime",
3378
- "required": false
3379
- },
3380
- "tenantId": {
3381
- "type": "text",
3382
- "required": false,
3383
- "_meta": {
3384
- "sqlType": "UUID",
3385
- "nullable": true,
3386
- "__tenancy": {
3387
- "isTenantIdField": true,
3388
- "autoFilter": true,
3389
- "required": false,
3390
- "autoPopulate": true,
3391
- "nullable": true,
3392
- "mode": "optional",
3393
- "field": "tenantId",
3394
- "allowSuperAdminBypass": false
3395
- }
3396
- }
3397
- },
3398
- "propertyId": {
3399
- "type": "foreignKey",
3400
- "required": false,
3401
- "related": "AnalyticsProperty"
3402
- },
3403
- "name": {
3404
- "type": "text",
3405
- "required": false,
3406
- "default": ""
3407
- },
3408
- "description": {
3409
- "type": "text",
3410
- "required": false,
3411
- "default": ""
3412
- },
3413
- "dimensions": {
3414
- "type": "text",
3415
- "required": false,
3416
- "default": "[]"
3417
- },
3418
- "metrics": {
3419
- "type": "text",
3420
- "required": false,
3421
- "default": "[]"
3422
- },
3423
- "dateRangeStart": {
3424
- "type": "text",
3425
- "required": false,
3426
- "default": "7daysAgo"
3427
- },
3428
- "dateRangeEnd": {
3429
- "type": "text",
3430
- "required": false,
3431
- "default": "today"
3432
- },
3433
- "dimensionFilter": {
3434
- "type": "text",
3435
- "required": false,
3436
- "default": ""
3437
- },
3438
- "metricFilter": {
3439
- "type": "text",
3440
- "required": false,
3441
- "default": ""
3442
- },
3443
- "orderBy": {
3444
- "type": "text",
3445
- "required": false,
3446
- "default": "[]"
3447
- },
3448
- "maxResults": {
3449
- "type": "integer",
3450
- "required": false,
3451
- "default": 0
3452
- },
3453
- "status": {
3454
- "type": "text",
3455
- "required": false
3456
- },
3457
- "frequency": {
3458
- "type": "text",
3459
- "required": false
3460
- },
3461
- "lastRunAt": {
3462
- "type": "datetime",
3463
- "required": false
3464
- },
3465
- "nextRunAt": {
3466
- "type": "datetime",
3467
- "required": false
3468
- },
3469
- "resultData": {
3470
- "type": "text",
3471
- "required": false,
3472
- "default": ""
3473
- },
3474
- "rowCount": {
3475
- "type": "integer",
3476
- "required": false,
3477
- "default": 0
3478
- },
3479
- "lastError": {
3480
- "type": "text",
3481
- "required": false,
3482
- "default": ""
3483
- }
3484
- },
3454
+ {
3455
+ "name": "analytics_reports_meta_type_idx",
3456
+ "columns": [
3457
+ "_meta_type"
3458
+ ]
3459
+ },
3460
+ {
3461
+ "name": "analytics_reports_tenant_id_created_at_idx",
3462
+ "columns": [
3463
+ "tenant_id",
3464
+ "created_at"
3465
+ ]
3466
+ },
3467
+ {
3468
+ "name": "analytics_reports_property_id_idx",
3469
+ "columns": [
3470
+ "property_id"
3471
+ ]
3472
+ }
3473
+ ],
3474
+ "version": "cecde8c6"
3475
+ }
3476
+ },
3477
+ "@happyvertical/smrt-analytics:AnalyticsDataStreamCollection": {
3478
+ "name": "analyticsdatastreamcollection",
3479
+ "className": "AnalyticsDataStreamCollection",
3480
+ "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsDataStreamCollection",
3481
+ "collection": "analyticsdatastreams",
3482
+ "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/collections/AnalyticsDataStreamCollection.ts",
3483
+ "packageName": "@happyvertical/smrt-analytics",
3484
+ "fields": {},
3485
3485
  "methods": {
3486
- "getAiUsageSnapshot": {
3487
- "name": "getAiUsageSnapshot",
3488
- "async": false,
3489
- "parameters": [],
3490
- "returnType": "AiUsageSnapshot | undefined",
3486
+ "findByProperty": {
3487
+ "name": "findByProperty",
3488
+ "async": true,
3489
+ "parameters": [
3490
+ {
3491
+ "name": "propertyId",
3492
+ "type": "string",
3493
+ "optional": false
3494
+ }
3495
+ ],
3496
+ "returnType": "Promise<AnalyticsDataStream[]>",
3491
3497
  "isStatic": false,
3492
3498
  "isPublic": true
3493
3499
  },
3494
- "resetAiUsage": {
3495
- "name": "resetAiUsage",
3496
- "async": false,
3497
- "parameters": [],
3498
- "returnType": "void",
3500
+ "findByExternalId": {
3501
+ "name": "findByExternalId",
3502
+ "async": true,
3503
+ "parameters": [
3504
+ {
3505
+ "name": "externalId",
3506
+ "type": "string",
3507
+ "optional": false
3508
+ }
3509
+ ],
3510
+ "returnType": "Promise<AnalyticsDataStream | null>",
3499
3511
  "isStatic": false,
3500
3512
  "isPublic": true
3501
3513
  },
3502
- "listAiUsage": {
3503
- "name": "listAiUsage",
3514
+ "findByMeasurementId": {
3515
+ "name": "findByMeasurementId",
3504
3516
  "async": true,
3505
3517
  "parameters": [
3506
3518
  {
3507
- "name": "options",
3508
- "type": "AiUsageListOptions",
3509
- "optional": true
3519
+ "name": "measurementId",
3520
+ "type": "string",
3521
+ "optional": false
3510
3522
  }
3511
3523
  ],
3512
- "returnType": "Promise<SmrtAiUsageRecord[]>",
3524
+ "returnType": "Promise<AnalyticsDataStream | null>",
3513
3525
  "isStatic": false,
3514
3526
  "isPublic": true
3515
3527
  },
3516
- "summarizeAiUsage": {
3517
- "name": "summarizeAiUsage",
3528
+ "findByType": {
3529
+ "name": "findByType",
3518
3530
  "async": true,
3519
3531
  "parameters": [
3520
3532
  {
3521
- "name": "options",
3522
- "type": "AiUsageSummaryOptions",
3523
- "optional": true
3533
+ "name": "streamType",
3534
+ "type": "DataStreamType",
3535
+ "optional": false
3524
3536
  }
3525
3537
  ],
3526
- "returnType": "Promise<Record<string, AiUsageStats>>",
3538
+ "returnType": "Promise<AnalyticsDataStream[]>",
3527
3539
  "isStatic": false,
3528
3540
  "isPublic": true
3529
3541
  },
3530
- "destroy": {
3531
- "name": "destroy",
3532
- "async": false,
3542
+ "findWebStreams": {
3543
+ "name": "findWebStreams",
3544
+ "async": true,
3533
3545
  "parameters": [],
3534
- "returnType": "void",
3546
+ "returnType": "Promise<AnalyticsDataStream[]>",
3535
3547
  "isStatic": false,
3536
3548
  "isPublic": true
3537
3549
  },
3538
- "markAsPersisted": {
3539
- "name": "markAsPersisted",
3540
- "async": false,
3550
+ "findIOSStreams": {
3551
+ "name": "findIOSStreams",
3552
+ "async": true,
3541
3553
  "parameters": [],
3542
- "returnType": "void",
3554
+ "returnType": "Promise<AnalyticsDataStream[]>",
3543
3555
  "isStatic": false,
3544
3556
  "isPublic": true
3545
3557
  },
3546
- "requireInsertOnSave": {
3547
- "name": "requireInsertOnSave",
3548
- "async": false,
3558
+ "findAndroidStreams": {
3559
+ "name": "findAndroidStreams",
3560
+ "async": true,
3549
3561
  "parameters": [],
3550
- "returnType": "void",
3562
+ "returnType": "Promise<AnalyticsDataStream[]>",
3551
3563
  "isStatic": false,
3552
3564
  "isPublic": true
3553
3565
  },
3554
- "initialize": {
3555
- "name": "initialize",
3566
+ "findMobileStreams": {
3567
+ "name": "findMobileStreams",
3556
3568
  "async": true,
3557
3569
  "parameters": [],
3558
- "returnType": "Promise",
3570
+ "returnType": "Promise<AnalyticsDataStream[]>",
3559
3571
  "isStatic": false,
3560
3572
  "isPublic": true
3561
3573
  },
3562
- "loadDataFromDb": {
3563
- "name": "loadDataFromDb",
3574
+ "findByStatus": {
3575
+ "name": "findByStatus",
3564
3576
  "async": true,
3565
3577
  "parameters": [
3566
3578
  {
3567
- "name": "data",
3568
- "type": "Record<string>",
3579
+ "name": "status",
3580
+ "type": "DataStreamStatus",
3569
3581
  "optional": false
3570
3582
  }
3571
3583
  ],
3572
- "returnType": "any",
3584
+ "returnType": "Promise<AnalyticsDataStream[]>",
3573
3585
  "isStatic": false,
3574
3586
  "isPublic": true
3575
3587
  },
3576
- "getFields": {
3577
- "name": "getFields",
3588
+ "findActive": {
3589
+ "name": "findActive",
3578
3590
  "async": true,
3579
3591
  "parameters": [],
3580
- "returnType": "Promise<any>",
3592
+ "returnType": "Promise<AnalyticsDataStream[]>",
3581
3593
  "isStatic": false,
3582
3594
  "isPublic": true
3583
3595
  },
3584
- "toJSON": {
3585
- "name": "toJSON",
3586
- "async": false,
3587
- "parameters": [],
3588
- "returnType": "any",
3596
+ "findActiveByProperty": {
3597
+ "name": "findActiveByProperty",
3598
+ "async": true,
3599
+ "parameters": [
3600
+ {
3601
+ "name": "propertyId",
3602
+ "type": "string",
3603
+ "optional": false
3604
+ }
3605
+ ],
3606
+ "returnType": "Promise<AnalyticsDataStream[]>",
3589
3607
  "isStatic": false,
3590
3608
  "isPublic": true
3609
+ }
3610
+ },
3611
+ "decoratorConfig": {},
3612
+ "extends": "SmrtCollection",
3613
+ "extendsTypeArg": "AnalyticsDataStream",
3614
+ "exportName": "AnalyticsDataStreamCollection",
3615
+ "collectionExportName": "AnalyticsDataStreamCollectionCollection",
3616
+ "schema": {
3617
+ "tableName": "analytics_data_stream_collections",
3618
+ "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_data_stream_collections\" (\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);",
3619
+ "columns": {
3620
+ "id": {
3621
+ "type": "UUID",
3622
+ "primaryKey": true,
3623
+ "referenceKind": "id",
3624
+ "notNull": true
3625
+ },
3626
+ "slug": {
3627
+ "type": "TEXT",
3628
+ "notNull": true
3629
+ },
3630
+ "context": {
3631
+ "type": "TEXT",
3632
+ "notNull": true,
3633
+ "default": ""
3634
+ },
3635
+ "created_at": {
3636
+ "type": "TIMESTAMP",
3637
+ "notNull": true,
3638
+ "default": "current_timestamp"
3639
+ },
3640
+ "updated_at": {
3641
+ "type": "TIMESTAMP",
3642
+ "notNull": true,
3643
+ "default": "current_timestamp"
3644
+ }
3591
3645
  },
3592
- "toPlainObject": {
3593
- "name": "toPlainObject",
3594
- "async": false,
3595
- "parameters": [],
3596
- "returnType": "Record<string>",
3646
+ "indexes": [
3647
+ {
3648
+ "name": "analytics_data_stream_collections_slug_context_idx",
3649
+ "columns": [
3650
+ "slug",
3651
+ "context"
3652
+ ],
3653
+ "unique": true
3654
+ },
3655
+ {
3656
+ "name": "analytics_data_stream_collections_created_at_idx",
3657
+ "columns": [
3658
+ "created_at"
3659
+ ]
3660
+ }
3661
+ ],
3662
+ "version": "12ef5a9a"
3663
+ }
3664
+ },
3665
+ "@happyvertical/smrt-analytics:AnalyticsEventCollection": {
3666
+ "name": "analyticseventcollection",
3667
+ "className": "AnalyticsEventCollection",
3668
+ "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsEventCollection",
3669
+ "collection": "analyticsevents",
3670
+ "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/collections/AnalyticsEventCollection.ts",
3671
+ "packageName": "@happyvertical/smrt-analytics",
3672
+ "fields": {},
3673
+ "methods": {
3674
+ "findByProperty": {
3675
+ "name": "findByProperty",
3676
+ "async": true,
3677
+ "parameters": [
3678
+ {
3679
+ "name": "propertyId",
3680
+ "type": "string",
3681
+ "optional": false
3682
+ }
3683
+ ],
3684
+ "returnType": "Promise<AnalyticsEvent[]>",
3597
3685
  "isStatic": false,
3598
3686
  "isPublic": true
3599
3687
  },
3600
- "toPublicJSON": {
3601
- "name": "toPublicJSON",
3602
- "async": false,
3688
+ "findByEventName": {
3689
+ "name": "findByEventName",
3690
+ "async": true,
3691
+ "parameters": [
3692
+ {
3693
+ "name": "eventName",
3694
+ "type": "string",
3695
+ "optional": false
3696
+ }
3697
+ ],
3698
+ "returnType": "Promise<AnalyticsEvent[]>",
3699
+ "isStatic": false,
3700
+ "isPublic": true
3701
+ },
3702
+ "findByClientId": {
3703
+ "name": "findByClientId",
3704
+ "async": true,
3705
+ "parameters": [
3706
+ {
3707
+ "name": "clientId",
3708
+ "type": "string",
3709
+ "optional": false
3710
+ }
3711
+ ],
3712
+ "returnType": "Promise<AnalyticsEvent[]>",
3713
+ "isStatic": false,
3714
+ "isPublic": true
3715
+ },
3716
+ "findByUserId": {
3717
+ "name": "findByUserId",
3718
+ "async": true,
3603
3719
  "parameters": [
3604
3720
  {
3605
- "name": "options",
3606
- "type": "PublicJsonOptions",
3607
- "optional": true
3721
+ "name": "userId",
3722
+ "type": "string",
3723
+ "optional": false
3608
3724
  }
3609
3725
  ],
3610
- "returnType": "Record<string>",
3726
+ "returnType": "Promise<AnalyticsEvent[]>",
3611
3727
  "isStatic": false,
3612
3728
  "isPublic": true
3613
3729
  },
3614
- "getId": {
3615
- "name": "getId",
3730
+ "findByStatus": {
3731
+ "name": "findByStatus",
3616
3732
  "async": true,
3617
- "parameters": [],
3618
- "returnType": "any",
3733
+ "parameters": [
3734
+ {
3735
+ "name": "status",
3736
+ "type": "TrackingEventStatus",
3737
+ "optional": false
3738
+ }
3739
+ ],
3740
+ "returnType": "Promise<AnalyticsEvent[]>",
3619
3741
  "isStatic": false,
3620
3742
  "isPublic": true
3621
3743
  },
3622
- "getSlug": {
3623
- "name": "getSlug",
3744
+ "findPending": {
3745
+ "name": "findPending",
3624
3746
  "async": true,
3625
3747
  "parameters": [],
3626
- "returnType": "any",
3748
+ "returnType": "Promise<AnalyticsEvent[]>",
3627
3749
  "isStatic": false,
3628
3750
  "isPublic": true
3629
3751
  },
3630
- "getSavedId": {
3631
- "name": "getSavedId",
3752
+ "findSent": {
3753
+ "name": "findSent",
3632
3754
  "async": true,
3633
3755
  "parameters": [],
3634
- "returnType": "any",
3756
+ "returnType": "Promise<AnalyticsEvent[]>",
3635
3757
  "isStatic": false,
3636
3758
  "isPublic": true
3637
3759
  },
3638
- "isSaved": {
3639
- "name": "isSaved",
3760
+ "findFailed": {
3761
+ "name": "findFailed",
3640
3762
  "async": true,
3641
3763
  "parameters": [],
3642
- "returnType": "any",
3764
+ "returnType": "Promise<AnalyticsEvent[]>",
3643
3765
  "isStatic": false,
3644
3766
  "isPublic": true
3645
3767
  },
3646
- "save": {
3647
- "name": "save",
3768
+ "findForRetry": {
3769
+ "name": "findForRetry",
3648
3770
  "async": true,
3649
- "parameters": [],
3650
- "returnType": "any",
3771
+ "parameters": [
3772
+ {
3773
+ "name": "maxRetries",
3774
+ "type": "number",
3775
+ "optional": true
3776
+ }
3777
+ ],
3778
+ "returnType": "Promise<AnalyticsEvent[]>",
3651
3779
  "isStatic": false,
3652
3780
  "isPublic": true
3653
3781
  },
3654
- "classifyConstraintError": {
3655
- "name": "classifyConstraintError",
3656
- "async": false,
3782
+ "findPendingByProperty": {
3783
+ "name": "findPendingByProperty",
3784
+ "async": true,
3657
3785
  "parameters": [
3658
3786
  {
3659
- "name": "message",
3787
+ "name": "propertyId",
3660
3788
  "type": "string",
3661
3789
  "optional": false
3662
3790
  }
3663
3791
  ],
3664
- "returnType": "'unique' | 'not_null' | null",
3665
- "isStatic": true,
3666
- "isPublic": true
3667
- },
3668
- "loadFromId": {
3669
- "name": "loadFromId",
3670
- "async": true,
3671
- "parameters": [],
3672
- "returnType": "any",
3673
- "isStatic": false,
3674
- "isPublic": true
3675
- },
3676
- "loadFromSlug": {
3677
- "name": "loadFromSlug",
3678
- "async": true,
3679
- "parameters": [],
3680
- "returnType": "any",
3792
+ "returnType": "Promise<AnalyticsEvent[]>",
3681
3793
  "isStatic": false,
3682
3794
  "isPublic": true
3683
3795
  },
3684
- "is": {
3685
- "name": "is",
3796
+ "findByDateRange": {
3797
+ "name": "findByDateRange",
3686
3798
  "async": true,
3687
3799
  "parameters": [
3688
3800
  {
3689
- "name": "criteria",
3690
- "type": "string",
3801
+ "name": "startDate",
3802
+ "type": "Date",
3691
3803
  "optional": false
3692
3804
  },
3693
3805
  {
3694
- "name": "options",
3695
- "type": "AiOperationOptions",
3696
- "optional": true
3806
+ "name": "endDate",
3807
+ "type": "Date",
3808
+ "optional": false
3697
3809
  }
3698
3810
  ],
3699
- "returnType": "any",
3811
+ "returnType": "Promise<AnalyticsEvent[]>",
3700
3812
  "isStatic": false,
3701
3813
  "isPublic": true
3702
3814
  },
3703
- "do": {
3704
- "name": "do",
3815
+ "findConversions": {
3816
+ "name": "findConversions",
3705
3817
  "async": true,
3706
3818
  "parameters": [
3707
3819
  {
3708
- "name": "instructions",
3820
+ "name": "propertyId",
3709
3821
  "type": "string",
3710
- "optional": false
3711
- },
3712
- {
3713
- "name": "options",
3714
- "type": "AiOperationOptions",
3715
3822
  "optional": true
3716
3823
  }
3717
3824
  ],
3718
- "returnType": "any",
3825
+ "returnType": "Promise<AnalyticsEvent[]>",
3719
3826
  "isStatic": false,
3720
3827
  "isPublic": true
3721
3828
  },
3722
- "describe": {
3723
- "name": "describe",
3829
+ "findPageviews": {
3830
+ "name": "findPageviews",
3724
3831
  "async": true,
3725
3832
  "parameters": [
3726
3833
  {
3727
- "name": "options",
3728
- "type": "AiOperationOptions",
3834
+ "name": "propertyId",
3835
+ "type": "string",
3729
3836
  "optional": true
3730
3837
  }
3731
3838
  ],
3732
- "returnType": "any",
3839
+ "returnType": "Promise<AnalyticsEvent[]>",
3733
3840
  "isStatic": false,
3734
3841
  "isPublic": true
3735
3842
  },
3736
- "delete": {
3737
- "name": "delete",
3843
+ "countByEventName": {
3844
+ "name": "countByEventName",
3738
3845
  "async": true,
3739
- "parameters": [],
3740
- "returnType": "Promise<void>",
3846
+ "parameters": [
3847
+ {
3848
+ "name": "propertyId",
3849
+ "type": "string",
3850
+ "optional": false
3851
+ }
3852
+ ],
3853
+ "returnType": "Promise<Map<string, number>>",
3741
3854
  "isStatic": false,
3742
3855
  "isPublic": true
3743
3856
  },
3744
- "isRelatedLoaded": {
3745
- "name": "isRelatedLoaded",
3746
- "async": false,
3857
+ "getPropertyStats": {
3858
+ "name": "getPropertyStats",
3859
+ "async": true,
3747
3860
  "parameters": [
3748
3861
  {
3749
- "name": "fieldName",
3862
+ "name": "propertyId",
3750
3863
  "type": "string",
3751
3864
  "optional": false
3752
3865
  }
3753
3866
  ],
3754
- "returnType": "boolean",
3867
+ "returnType": "Promise<object>",
3755
3868
  "isStatic": false,
3756
3869
  "isPublic": true
3757
3870
  },
3758
- "_setLoadedRelationship": {
3759
- "name": "_setLoadedRelationship",
3760
- "async": false,
3871
+ "getPropertyStatsWithTrend": {
3872
+ "name": "getPropertyStatsWithTrend",
3873
+ "async": true,
3761
3874
  "parameters": [
3762
3875
  {
3763
- "name": "fieldName",
3876
+ "name": "propertyId",
3764
3877
  "type": "string",
3765
3878
  "optional": false
3766
3879
  },
3767
3880
  {
3768
- "name": "value",
3769
- "type": "any",
3881
+ "name": "now",
3882
+ "type": "Date",
3883
+ "optional": true
3884
+ },
3885
+ {
3886
+ "name": "timeZone",
3887
+ "type": "string",
3888
+ "optional": true,
3889
+ "default": "UTC"
3890
+ }
3891
+ ],
3892
+ "returnType": "Promise<PropertyStatsWithTrend>",
3893
+ "isStatic": false,
3894
+ "isPublic": true
3895
+ },
3896
+ "getBatchPropertyStats": {
3897
+ "name": "getBatchPropertyStats",
3898
+ "async": true,
3899
+ "parameters": [
3900
+ {
3901
+ "name": "propertyIds",
3902
+ "type": "string[]",
3770
3903
  "optional": false
3904
+ },
3905
+ {
3906
+ "name": "now",
3907
+ "type": "Date",
3908
+ "optional": true
3909
+ },
3910
+ {
3911
+ "name": "timeZone",
3912
+ "type": "string",
3913
+ "optional": true,
3914
+ "default": "UTC"
3771
3915
  }
3772
3916
  ],
3773
- "returnType": "void",
3917
+ "returnType": "Promise<Map<string, PropertyStatsWithTrend>>",
3774
3918
  "isStatic": false,
3775
3919
  "isPublic": true
3920
+ }
3921
+ },
3922
+ "decoratorConfig": {},
3923
+ "extends": "SmrtCollection",
3924
+ "extendsTypeArg": "AnalyticsEvent",
3925
+ "exportName": "AnalyticsEventCollection",
3926
+ "collectionExportName": "AnalyticsEventCollectionCollection",
3927
+ "schema": {
3928
+ "tableName": "analytics_event_collections",
3929
+ "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_event_collections\" (\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);",
3930
+ "columns": {
3931
+ "id": {
3932
+ "type": "UUID",
3933
+ "primaryKey": true,
3934
+ "referenceKind": "id",
3935
+ "notNull": true
3936
+ },
3937
+ "slug": {
3938
+ "type": "TEXT",
3939
+ "notNull": true
3940
+ },
3941
+ "context": {
3942
+ "type": "TEXT",
3943
+ "notNull": true,
3944
+ "default": ""
3945
+ },
3946
+ "created_at": {
3947
+ "type": "TIMESTAMP",
3948
+ "notNull": true,
3949
+ "default": "current_timestamp"
3950
+ },
3951
+ "updated_at": {
3952
+ "type": "TIMESTAMP",
3953
+ "notNull": true,
3954
+ "default": "current_timestamp"
3955
+ }
3776
3956
  },
3777
- "loadRelated": {
3778
- "name": "loadRelated",
3957
+ "indexes": [
3958
+ {
3959
+ "name": "analytics_event_collections_slug_context_idx",
3960
+ "columns": [
3961
+ "slug",
3962
+ "context"
3963
+ ],
3964
+ "unique": true
3965
+ },
3966
+ {
3967
+ "name": "analytics_event_collections_created_at_idx",
3968
+ "columns": [
3969
+ "created_at"
3970
+ ]
3971
+ }
3972
+ ],
3973
+ "version": "13d03b2a"
3974
+ }
3975
+ },
3976
+ "@happyvertical/smrt-analytics:AnalyticsPropertyCollection": {
3977
+ "name": "analyticspropertycollection",
3978
+ "className": "AnalyticsPropertyCollection",
3979
+ "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsPropertyCollection",
3980
+ "collection": "analyticsproperties",
3981
+ "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/collections/AnalyticsPropertyCollection.ts",
3982
+ "packageName": "@happyvertical/smrt-analytics",
3983
+ "fields": {},
3984
+ "methods": {
3985
+ "findByExternalId": {
3986
+ "name": "findByExternalId",
3779
3987
  "async": true,
3780
3988
  "parameters": [
3781
3989
  {
3782
- "name": "fieldName",
3990
+ "name": "externalId",
3783
3991
  "type": "string",
3784
3992
  "optional": false
3785
- },
3786
- {
3787
- "name": "opts",
3788
- "type": "LoadRelatedOptions",
3789
- "optional": true
3790
3993
  }
3791
3994
  ],
3792
- "returnType": "Promise<any>",
3995
+ "returnType": "Promise<AnalyticsProperty | null>",
3793
3996
  "isStatic": false,
3794
3997
  "isPublic": true
3795
3998
  },
3796
- "loadRelatedMany": {
3797
- "name": "loadRelatedMany",
3999
+ "findByMeasurementId": {
4000
+ "name": "findByMeasurementId",
3798
4001
  "async": true,
3799
4002
  "parameters": [
3800
4003
  {
3801
- "name": "fieldName",
4004
+ "name": "measurementId",
3802
4005
  "type": "string",
3803
4006
  "optional": false
3804
- },
3805
- {
3806
- "name": "opts",
3807
- "type": "LoadRelatedOptions",
3808
- "optional": true
3809
4007
  }
3810
4008
  ],
3811
- "returnType": "Promise<any[]>",
4009
+ "returnType": "Promise<AnalyticsProperty | null>",
3812
4010
  "isStatic": false,
3813
4011
  "isPublic": true
3814
4012
  },
3815
- "getRelated": {
3816
- "name": "getRelated",
4013
+ "findBySiteDomain": {
4014
+ "name": "findBySiteDomain",
3817
4015
  "async": true,
3818
4016
  "parameters": [
3819
4017
  {
3820
- "name": "fieldName",
4018
+ "name": "siteDomain",
3821
4019
  "type": "string",
3822
4020
  "optional": false
3823
4021
  },
3824
4022
  {
3825
- "name": "opts",
3826
- "type": "LoadRelatedOptions",
4023
+ "name": "provider",
4024
+ "type": "AnalyticsProvider",
3827
4025
  "optional": true
3828
4026
  }
3829
4027
  ],
3830
- "returnType": "Promise<any>",
3831
- "isStatic": false,
3832
- "isPublic": true
3833
- },
3834
- "getAvailableTools": {
3835
- "name": "getAvailableTools",
3836
- "async": false,
3837
- "parameters": [],
3838
- "returnType": "AITool[]",
4028
+ "returnType": "Promise<AnalyticsProperty | null>",
3839
4029
  "isStatic": false,
3840
4030
  "isPublic": true
3841
4031
  },
3842
- "executeToolCall": {
3843
- "name": "executeToolCall",
4032
+ "findByProvider": {
4033
+ "name": "findByProvider",
3844
4034
  "async": true,
3845
4035
  "parameters": [
3846
4036
  {
3847
- "name": "toolCall",
3848
- "type": "ToolCall",
4037
+ "name": "provider",
4038
+ "type": "AnalyticsProvider",
3849
4039
  "optional": false
3850
4040
  }
3851
4041
  ],
3852
- "returnType": "Promise<ToolCallResult>",
4042
+ "returnType": "Promise<AnalyticsProperty[]>",
3853
4043
  "isStatic": false,
3854
4044
  "isPublic": true
3855
4045
  },
3856
- "remember": {
3857
- "name": "remember",
4046
+ "findGA4Properties": {
4047
+ "name": "findGA4Properties",
3858
4048
  "async": true,
3859
- "parameters": [
3860
- {
3861
- "name": "options",
3862
- "type": "object",
3863
- "optional": false
3864
- }
3865
- ],
3866
- "returnType": "Promise<void>",
4049
+ "parameters": [],
4050
+ "returnType": "Promise<AnalyticsProperty[]>",
3867
4051
  "isStatic": false,
3868
4052
  "isPublic": true
3869
4053
  },
3870
- "recall": {
3871
- "name": "recall",
4054
+ "findPlausibleSites": {
4055
+ "name": "findPlausibleSites",
3872
4056
  "async": true,
3873
- "parameters": [
3874
- {
3875
- "name": "options",
3876
- "type": "object",
3877
- "optional": false
3878
- }
3879
- ],
3880
- "returnType": "Promise",
4057
+ "parameters": [],
4058
+ "returnType": "Promise<AnalyticsProperty[]>",
3881
4059
  "isStatic": false,
3882
4060
  "isPublic": true
3883
4061
  },
3884
- "recallAll": {
3885
- "name": "recallAll",
4062
+ "findMatomoSites": {
4063
+ "name": "findMatomoSites",
3886
4064
  "async": true,
3887
- "parameters": [
3888
- {
3889
- "name": "options",
3890
- "type": "object",
3891
- "optional": true
3892
- }
3893
- ],
3894
- "returnType": "Promise<Map<string>>",
4065
+ "parameters": [],
4066
+ "returnType": "Promise<AnalyticsProperty[]>",
3895
4067
  "isStatic": false,
3896
4068
  "isPublic": true
3897
4069
  },
3898
- "forget": {
3899
- "name": "forget",
4070
+ "findByStatus": {
4071
+ "name": "findByStatus",
3900
4072
  "async": true,
3901
4073
  "parameters": [
3902
4074
  {
3903
- "name": "options",
3904
- "type": "object",
4075
+ "name": "status",
4076
+ "type": "AnalyticsPropertyStatus",
3905
4077
  "optional": false
3906
4078
  }
3907
4079
  ],
3908
- "returnType": "Promise<void>",
4080
+ "returnType": "Promise<AnalyticsProperty[]>",
3909
4081
  "isStatic": false,
3910
4082
  "isPublic": true
3911
4083
  },
3912
- "forgetScope": {
3913
- "name": "forgetScope",
4084
+ "findActive": {
4085
+ "name": "findActive",
3914
4086
  "async": true,
3915
- "parameters": [
3916
- {
3917
- "name": "options",
3918
- "type": "object",
3919
- "optional": false
3920
- }
3921
- ],
3922
- "returnType": "Promise<number>",
4087
+ "parameters": [],
4088
+ "returnType": "Promise<AnalyticsProperty[]>",
3923
4089
  "isStatic": false,
3924
4090
  "isPublic": true
3925
4091
  },
3926
- "generateEmbeddings": {
3927
- "name": "generateEmbeddings",
4092
+ "findNeedingSync": {
4093
+ "name": "findNeedingSync",
3928
4094
  "async": true,
3929
4095
  "parameters": [
3930
4096
  {
3931
- "name": "options",
3932
- "type": "GenerateEmbeddingsOptions",
4097
+ "name": "hoursAgo",
4098
+ "type": "number",
3933
4099
  "optional": true
3934
4100
  }
3935
4101
  ],
3936
- "returnType": "Promise<void>",
4102
+ "returnType": "Promise<AnalyticsProperty[]>",
3937
4103
  "isStatic": false,
3938
4104
  "isPublic": true
4105
+ }
4106
+ },
4107
+ "decoratorConfig": {},
4108
+ "extends": "SmrtCollection",
4109
+ "extendsTypeArg": "AnalyticsProperty",
4110
+ "exportName": "AnalyticsPropertyCollection",
4111
+ "collectionExportName": "AnalyticsPropertyCollectionCollection",
4112
+ "schema": {
4113
+ "tableName": "analytics_property_collections",
4114
+ "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_property_collections\" (\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);",
4115
+ "columns": {
4116
+ "id": {
4117
+ "type": "UUID",
4118
+ "primaryKey": true,
4119
+ "referenceKind": "id",
4120
+ "notNull": true
4121
+ },
4122
+ "slug": {
4123
+ "type": "TEXT",
4124
+ "notNull": true
4125
+ },
4126
+ "context": {
4127
+ "type": "TEXT",
4128
+ "notNull": true,
4129
+ "default": ""
4130
+ },
4131
+ "created_at": {
4132
+ "type": "TIMESTAMP",
4133
+ "notNull": true,
4134
+ "default": "current_timestamp"
4135
+ },
4136
+ "updated_at": {
4137
+ "type": "TIMESTAMP",
4138
+ "notNull": true,
4139
+ "default": "current_timestamp"
4140
+ }
3939
4141
  },
3940
- "getEmbedding": {
3941
- "name": "getEmbedding",
4142
+ "indexes": [
4143
+ {
4144
+ "name": "analytics_property_collections_slug_context_idx",
4145
+ "columns": [
4146
+ "slug",
4147
+ "context"
4148
+ ],
4149
+ "unique": true
4150
+ },
4151
+ {
4152
+ "name": "analytics_property_collections_created_at_idx",
4153
+ "columns": [
4154
+ "created_at"
4155
+ ]
4156
+ }
4157
+ ],
4158
+ "version": "a1c264b1"
4159
+ }
4160
+ },
4161
+ "@happyvertical/smrt-analytics:AnalyticsReportCollection": {
4162
+ "name": "analyticsreportcollection",
4163
+ "className": "AnalyticsReportCollection",
4164
+ "qualifiedName": "@happyvertical/smrt-analytics:AnalyticsReportCollection",
4165
+ "collection": "analyticsreports",
4166
+ "filePath": "/home/runner/_work/smrt/smrt/packages/analytics/src/collections/AnalyticsReportCollection.ts",
4167
+ "packageName": "@happyvertical/smrt-analytics",
4168
+ "fields": {},
4169
+ "methods": {
4170
+ "findByProperty": {
4171
+ "name": "findByProperty",
3942
4172
  "async": true,
3943
4173
  "parameters": [
3944
4174
  {
3945
- "name": "fieldName",
4175
+ "name": "propertyId",
3946
4176
  "type": "string",
3947
4177
  "optional": false
3948
- },
3949
- {
3950
- "name": "model",
3951
- "type": "string",
3952
- "optional": true
3953
4178
  }
3954
4179
  ],
3955
- "returnType": "Promise<number[] | null>",
3956
- "isStatic": false,
3957
- "isPublic": true
3958
- },
3959
- "hasStaleEmbeddings": {
3960
- "name": "hasStaleEmbeddings",
3961
- "async": true,
3962
- "parameters": [],
3963
- "returnType": "Promise<boolean>",
4180
+ "returnType": "Promise<AnalyticsReport[]>",
3964
4181
  "isStatic": false,
3965
4182
  "isPublic": true
3966
4183
  },
3967
- "clearEmbeddings": {
3968
- "name": "clearEmbeddings",
4184
+ "findByStatus": {
4185
+ "name": "findByStatus",
3969
4186
  "async": true,
3970
- "parameters": [],
3971
- "returnType": "Promise<void>",
3972
- "isStatic": false,
3973
- "isPublic": true
3974
- },
3975
- "getDimensions": {
3976
- "name": "getDimensions",
3977
- "async": false,
3978
- "parameters": [],
3979
- "returnType": "Array<object>",
3980
- "isStatic": false,
3981
- "isPublic": true
3982
- },
3983
- "setDimensions": {
3984
- "name": "setDimensions",
3985
- "async": false,
3986
- "parameters": [
3987
- {
3988
- "name": "dimensions",
3989
- "type": "Array<object>",
3990
- "optional": false
3991
- }
3992
- ],
3993
- "returnType": "void",
3994
- "isStatic": false,
3995
- "isPublic": true
3996
- },
3997
- "getMetrics": {
3998
- "name": "getMetrics",
3999
- "async": false,
4000
- "parameters": [],
4001
- "returnType": "Array<object>",
4002
- "isStatic": false,
4003
- "isPublic": true
4004
- },
4005
- "setMetrics": {
4006
- "name": "setMetrics",
4007
- "async": false,
4008
4187
  "parameters": [
4009
4188
  {
4010
- "name": "metrics",
4011
- "type": "Array<object>",
4189
+ "name": "status",
4190
+ "type": "ReportStatus",
4012
4191
  "optional": false
4013
4192
  }
4014
4193
  ],
4015
- "returnType": "void",
4194
+ "returnType": "Promise<AnalyticsReport[]>",
4016
4195
  "isStatic": false,
4017
4196
  "isPublic": true
4018
4197
  },
4019
- "getResultData": {
4020
- "name": "getResultData",
4021
- "async": false,
4198
+ "findDrafts": {
4199
+ "name": "findDrafts",
4200
+ "async": true,
4022
4201
  "parameters": [],
4023
- "returnType": "Record<string> | null",
4202
+ "returnType": "Promise<AnalyticsReport[]>",
4024
4203
  "isStatic": false,
4025
4204
  "isPublic": true
4026
4205
  },
4027
- "setResultData": {
4028
- "name": "setResultData",
4029
- "async": false,
4030
- "parameters": [
4031
- {
4032
- "name": "data",
4033
- "type": "Record<string>",
4034
- "optional": false
4035
- }
4036
- ],
4037
- "returnType": "void",
4206
+ "findScheduled": {
4207
+ "name": "findScheduled",
4208
+ "async": true,
4209
+ "parameters": [],
4210
+ "returnType": "Promise<AnalyticsReport[]>",
4038
4211
  "isStatic": false,
4039
4212
  "isPublic": true
4040
4213
  },
4041
- "markRunning": {
4042
- "name": "markRunning",
4043
- "async": false,
4214
+ "findCompleted": {
4215
+ "name": "findCompleted",
4216
+ "async": true,
4044
4217
  "parameters": [],
4045
- "returnType": "void",
4218
+ "returnType": "Promise<AnalyticsReport[]>",
4046
4219
  "isStatic": false,
4047
4220
  "isPublic": true
4048
4221
  },
4049
- "markCompleted": {
4050
- "name": "markCompleted",
4051
- "async": false,
4052
- "parameters": [
4053
- {
4054
- "name": "rowCount",
4055
- "type": "number",
4056
- "optional": false
4057
- }
4058
- ],
4059
- "returnType": "void",
4222
+ "findFailed": {
4223
+ "name": "findFailed",
4224
+ "async": true,
4225
+ "parameters": [],
4226
+ "returnType": "Promise<AnalyticsReport[]>",
4060
4227
  "isStatic": false,
4061
4228
  "isPublic": true
4062
4229
  },
4063
- "markFailed": {
4064
- "name": "markFailed",
4065
- "async": false,
4230
+ "findByFrequency": {
4231
+ "name": "findByFrequency",
4232
+ "async": true,
4066
4233
  "parameters": [
4067
4234
  {
4068
- "name": "error",
4069
- "type": "string",
4235
+ "name": "frequency",
4236
+ "type": "ReportFrequency",
4070
4237
  "optional": false
4071
4238
  }
4072
4239
  ],
4073
- "returnType": "void",
4240
+ "returnType": "Promise<AnalyticsReport[]>",
4074
4241
  "isStatic": false,
4075
4242
  "isPublic": true
4076
4243
  },
4077
- "calculateNextRun": {
4078
- "name": "calculateNextRun",
4079
- "async": false,
4244
+ "findRecurring": {
4245
+ "name": "findRecurring",
4246
+ "async": true,
4080
4247
  "parameters": [],
4081
- "returnType": "void",
4248
+ "returnType": "Promise<AnalyticsReport[]>",
4082
4249
  "isStatic": false,
4083
4250
  "isPublic": true
4084
4251
  },
4085
- "isDue": {
4086
- "name": "isDue",
4087
- "async": false,
4252
+ "findDue": {
4253
+ "name": "findDue",
4254
+ "async": true,
4088
4255
  "parameters": [],
4089
- "returnType": "boolean",
4256
+ "returnType": "Promise<AnalyticsReport[]>",
4090
4257
  "isStatic": false,
4091
4258
  "isPublic": true
4092
4259
  },
4093
- "analyzeResults": {
4094
- "name": "analyzeResults",
4260
+ "findByPropertyAndStatus": {
4261
+ "name": "findByPropertyAndStatus",
4095
4262
  "async": true,
4096
4263
  "parameters": [
4097
4264
  {
4098
- "name": "_options",
4099
- "type": "Record<string>",
4100
- "optional": true
4265
+ "name": "propertyId",
4266
+ "type": "string",
4267
+ "optional": false
4268
+ },
4269
+ {
4270
+ "name": "status",
4271
+ "type": "ReportStatus",
4272
+ "optional": false
4101
4273
  }
4102
4274
  ],
4103
- "returnType": "Promise<object>",
4275
+ "returnType": "Promise<AnalyticsReport[]>",
4104
4276
  "isStatic": false,
4105
4277
  "isPublic": true
4106
4278
  },
4107
- "hasPositiveTrends": {
4108
- "name": "hasPositiveTrends",
4279
+ "findRecentlyRun": {
4280
+ "name": "findRecentlyRun",
4109
4281
  "async": true,
4110
- "parameters": [],
4111
- "returnType": "Promise<boolean>",
4282
+ "parameters": [
4283
+ {
4284
+ "name": "hoursAgo",
4285
+ "type": "number",
4286
+ "optional": true
4287
+ }
4288
+ ],
4289
+ "returnType": "Promise<AnalyticsReport[]>",
4112
4290
  "isStatic": false,
4113
4291
  "isPublic": true
4114
4292
  }
4115
4293
  },
4116
- "decoratorConfig": {
4117
- "tableStrategy": "sti",
4118
- "api": {
4119
- "include": [
4120
- "list",
4121
- "get",
4122
- "create",
4123
- "update",
4124
- "run"
4125
- ]
4126
- },
4127
- "mcp": {
4128
- "include": [
4129
- "list",
4130
- "get",
4131
- "run",
4132
- "analyze"
4133
- ]
4134
- },
4135
- "cli": true,
4136
- "tenantScoped": {
4137
- "mode": "optional"
4138
- }
4139
- },
4140
- "extends": "SmrtObject",
4141
- "exportName": "AnalyticsReport",
4142
- "collectionExportName": "AnalyticsReportCollection",
4294
+ "decoratorConfig": {},
4295
+ "extends": "SmrtCollection",
4296
+ "extendsTypeArg": "AnalyticsReport",
4297
+ "exportName": "AnalyticsReportCollection",
4298
+ "collectionExportName": "AnalyticsReportCollectionCollection",
4143
4299
  "schema": {
4144
- "tableName": "analytics_reports",
4145
- "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_reports\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"property_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT DEFAULT '',\n \"dimensions\" TEXT DEFAULT '[]',\n \"metrics\" TEXT DEFAULT '[]',\n \"date_range_start\" TEXT DEFAULT '7daysAgo',\n \"date_range_end\" TEXT DEFAULT 'today',\n \"dimension_filter\" TEXT DEFAULT '',\n \"metric_filter\" TEXT DEFAULT '',\n \"order_by\" TEXT DEFAULT '[]',\n \"max_results\" INTEGER DEFAULT 0,\n \"status\" TEXT,\n \"frequency\" TEXT,\n \"last_run_at\" TIMESTAMP,\n \"next_run_at\" TIMESTAMP,\n \"result_data\" TEXT DEFAULT '',\n \"row_count\" INTEGER DEFAULT 0,\n \"last_error\" TEXT DEFAULT ''\n);",
4300
+ "tableName": "analytics_report_collections",
4301
+ "ddl": "CREATE TABLE IF NOT EXISTS \"analytics_report_collections\" (\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);",
4146
4302
  "columns": {
4147
4303
  "id": {
4148
4304
  "type": "UUID",
@@ -4159,14 +4315,6 @@
4159
4315
  "notNull": true,
4160
4316
  "default": ""
4161
4317
  },
4162
- "_meta_type": {
4163
- "type": "TEXT",
4164
- "notNull": true
4165
- },
4166
- "_meta_data": {
4167
- "type": "JSON",
4168
- "notNull": false
4169
- },
4170
4318
  "created_at": {
4171
4319
  "type": "TIMESTAMP",
4172
4320
  "notNull": true,
@@ -4176,123 +4324,25 @@
4176
4324
  "type": "TIMESTAMP",
4177
4325
  "notNull": true,
4178
4326
  "default": "current_timestamp"
4179
- },
4180
- "tenant_id": {
4181
- "type": "UUID",
4182
- "referenceKind": "tenantId",
4183
- "notNull": false
4184
- },
4185
- "property_id": {
4186
- "type": "UUID",
4187
- "referenceKind": "foreignKey",
4188
- "notNull": false
4189
- },
4190
- "name": {
4191
- "type": "TEXT",
4192
- "notNull": false,
4193
- "default": ""
4194
- },
4195
- "description": {
4196
- "type": "TEXT",
4197
- "notNull": false,
4198
- "default": ""
4199
- },
4200
- "dimensions": {
4201
- "type": "TEXT",
4202
- "notNull": false,
4203
- "default": "[]"
4204
- },
4205
- "metrics": {
4206
- "type": "TEXT",
4207
- "notNull": false,
4208
- "default": "[]"
4209
- },
4210
- "date_range_start": {
4211
- "type": "TEXT",
4212
- "notNull": false,
4213
- "default": "7daysAgo"
4214
- },
4215
- "date_range_end": {
4216
- "type": "TEXT",
4217
- "notNull": false,
4218
- "default": "today"
4219
- },
4220
- "dimension_filter": {
4221
- "type": "TEXT",
4222
- "notNull": false,
4223
- "default": ""
4224
- },
4225
- "metric_filter": {
4226
- "type": "TEXT",
4227
- "notNull": false,
4228
- "default": ""
4229
- },
4230
- "order_by": {
4231
- "type": "TEXT",
4232
- "notNull": false,
4233
- "default": "[]"
4234
- },
4235
- "max_results": {
4236
- "type": "INTEGER",
4237
- "notNull": false,
4238
- "default": 0
4239
- },
4240
- "status": {
4241
- "type": "TEXT",
4242
- "notNull": false
4243
- },
4244
- "frequency": {
4245
- "type": "TEXT",
4246
- "notNull": false
4247
- },
4248
- "last_run_at": {
4249
- "type": "TIMESTAMP",
4250
- "notNull": false
4251
- },
4252
- "next_run_at": {
4253
- "type": "TIMESTAMP",
4254
- "notNull": false
4255
- },
4256
- "result_data": {
4257
- "type": "TEXT",
4258
- "notNull": false,
4259
- "default": ""
4260
- },
4261
- "row_count": {
4262
- "type": "INTEGER",
4263
- "notNull": false,
4264
- "default": 0
4265
- },
4266
- "last_error": {
4267
- "type": "TEXT",
4268
- "notNull": false,
4269
- "default": ""
4270
4327
  }
4271
4328
  },
4272
4329
  "indexes": [
4273
4330
  {
4274
- "name": "analytics_reports_id_idx",
4275
- "columns": [
4276
- "id"
4277
- ]
4278
- },
4279
- {
4280
- "name": "analytics_reports_slug_context_meta_type_idx",
4331
+ "name": "analytics_report_collections_slug_context_idx",
4281
4332
  "columns": [
4282
4333
  "slug",
4283
- "context",
4284
- "_meta_type"
4334
+ "context"
4285
4335
  ],
4286
4336
  "unique": true
4287
4337
  },
4288
4338
  {
4289
- "name": "analytics_reports_meta_type_idx",
4339
+ "name": "analytics_report_collections_created_at_idx",
4290
4340
  "columns": [
4291
- "_meta_type"
4341
+ "created_at"
4292
4342
  ]
4293
4343
  }
4294
4344
  ],
4295
- "version": "cecde8c6"
4345
+ "version": "74445ee1"
4296
4346
  }
4297
4347
  }
4298
4348
  },