@happyvertical/smrt-ads 0.57.39 → 0.57.41

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,86 +2,68 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-ads",
5
- "packageVersion": "0.57.39",
5
+ "packageVersion": "0.57.41",
6
6
  "objects": {
7
- "@happyvertical/smrt-ads:AdDeliveryTier": {
8
- "name": "addeliverytier",
9
- "className": "AdDeliveryTier",
10
- "qualifiedName": "@happyvertical/smrt-ads:AdDeliveryTier",
7
+ "@happyvertical/smrt-ads:AdDeliveryTierCollection": {
8
+ "name": "addeliverytiercollection",
9
+ "className": "AdDeliveryTierCollection",
10
+ "qualifiedName": "@happyvertical/smrt-ads:AdDeliveryTierCollection",
11
11
  "collection": "addeliverytiers",
12
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdDeliveryTier.ts",
12
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdDeliveryTierCollection.ts",
13
13
  "packageName": "@happyvertical/smrt-ads",
14
- "fields": {
15
- "name": {
16
- "type": "text",
17
- "required": false,
18
- "default": "",
19
- "description": "What the tier is called, for example Sponsorship, Standard or House.",
20
- "_meta": {
21
- "description": "What the tier is called, for example Sponsorship, Standard or House."
22
- }
23
- },
24
- "priority": {
25
- "type": "integer",
26
- "required": false,
27
- "default": 0,
28
- "description": "The order tiers are tried in: 1 is tried first, then 2, and so on.",
29
- "_meta": {
30
- "description": "The order tiers are tried in: 1 is tried first, then 2, and so on."
31
- }
32
- },
33
- "pricingModel": {
34
- "type": "text",
35
- "required": false,
36
- "description": "How ads in this tier are charged: a fixed price, per thousand showings, per click, or per sale.",
37
- "_meta": {
38
- "description": "How ads in this tier are charged: a fixed price, per thousand showings, per click, or per sale."
39
- },
40
- "enum": [
41
- "fixed",
42
- "cpm",
43
- "cpc",
44
- "cpa"
45
- ]
46
- },
47
- "description": {
48
- "type": "text",
49
- "required": false,
50
- "default": "",
51
- "description": "A note about what this tier is for.",
52
- "_meta": {
53
- "description": "A note about what this tier is for."
54
- }
55
- }
56
- },
14
+ "fields": {},
57
15
  "methods": {
58
- "isHigherPriorityThan": {
59
- "name": "isHigherPriorityThan",
60
- "async": false,
16
+ "findByPriority": {
17
+ "name": "findByPriority",
18
+ "async": true,
19
+ "parameters": [],
20
+ "returnType": "Promise<AdDeliveryTier[]>",
21
+ "isStatic": false,
22
+ "isPublic": true
23
+ },
24
+ "findByPricingModel": {
25
+ "name": "findByPricingModel",
26
+ "async": true,
61
27
  "parameters": [
62
28
  {
63
- "name": "other",
64
- "type": "AdDeliveryTier",
29
+ "name": "pricingModel",
30
+ "type": "PricingModel",
65
31
  "optional": false
66
32
  }
67
33
  ],
68
- "returnType": "boolean",
34
+ "returnType": "Promise<AdDeliveryTier[]>",
69
35
  "isStatic": false,
70
36
  "isPublic": true
71
37
  },
72
- "isFixedPricing": {
73
- "name": "isFixedPricing",
74
- "async": false,
38
+ "getHighestPriority": {
39
+ "name": "getHighestPriority",
40
+ "async": true,
75
41
  "parameters": [],
76
- "returnType": "boolean",
42
+ "returnType": "Promise<AdDeliveryTier | null>",
77
43
  "isStatic": false,
78
44
  "isPublic": true
79
45
  },
80
- "isPerformanceBased": {
81
- "name": "isPerformanceBased",
82
- "async": false,
46
+ "findFixedPricing": {
47
+ "name": "findFixedPricing",
48
+ "async": true,
83
49
  "parameters": [],
84
- "returnType": "boolean",
50
+ "returnType": "Promise<AdDeliveryTier[]>",
51
+ "isStatic": false,
52
+ "isPublic": true
53
+ },
54
+ "findCPM": {
55
+ "name": "findCPM",
56
+ "async": true,
57
+ "parameters": [],
58
+ "returnType": "Promise<AdDeliveryTier[]>",
59
+ "isStatic": false,
60
+ "isPublic": true
61
+ },
62
+ "findPerformanceBased": {
63
+ "name": "findPerformanceBased",
64
+ "async": true,
65
+ "parameters": [],
66
+ "returnType": "Promise<AdDeliveryTier[]>",
85
67
  "isStatic": false,
86
68
  "isPublic": true
87
69
  }
@@ -100,15 +82,12 @@
100
82
  "list",
101
83
  "get"
102
84
  ]
103
- },
104
- "cli": {
105
- "skipApiCheck": true
106
85
  }
107
86
  },
108
- "extends": "SmrtObject",
109
- "exportName": "AdDeliveryTier",
110
- "collectionExportName": "AdDeliveryTierCollection",
111
- "displayLabelField": "name",
87
+ "extends": "SmrtCollection",
88
+ "extendsTypeArg": "AdDeliveryTier",
89
+ "exportName": "AdDeliveryTierCollection",
90
+ "collectionExportName": "AdDeliveryTierCollectionCollection",
112
91
  "schema": {
113
92
  "tableName": "ad_delivery_tiers",
114
93
  "ddl": "CREATE TABLE IF NOT EXISTS \"ad_delivery_tiers\" (\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 \"name\" TEXT DEFAULT '',\n \"priority\" INTEGER DEFAULT 0,\n \"pricing_model\" TEXT,\n \"description\" TEXT DEFAULT ''\n);",
@@ -182,125 +161,227 @@
182
161
  },
183
162
  "importPath": "@happyvertical/smrt-ads"
184
163
  },
185
- "@happyvertical/smrt-ads:AdEvent": {
186
- "name": "adevent",
187
- "className": "AdEvent",
188
- "qualifiedName": "@happyvertical/smrt-ads:AdEvent",
164
+ "@happyvertical/smrt-ads:AdEventCollection": {
165
+ "name": "adeventcollection",
166
+ "className": "AdEventCollection",
167
+ "qualifiedName": "@happyvertical/smrt-ads:AdEventCollection",
189
168
  "collection": "adevents",
190
- "description": "AdEvent tracks ad impressions, clicks, and conversions. Events are immutable (append-only, no update/delete).",
191
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdEvent.ts",
169
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdEventCollection.ts",
192
170
  "packageName": "@happyvertical/smrt-ads",
193
- "fields": {
194
- "created_at": {
195
- "type": "datetime",
196
- "required": false
197
- },
198
- "updated_at": {
199
- "type": "datetime",
200
- "required": false
201
- },
202
- "tenantId": {
203
- "type": "text",
204
- "required": false,
205
- "_meta": {
206
- "sqlType": "UUID",
207
- "nullable": true,
208
- "__tenancy": {
209
- "isTenantIdField": true,
210
- "autoFilter": true,
211
- "required": false,
212
- "autoPopulate": true,
213
- "nullable": true,
214
- "mode": "optional",
215
- "field": "tenantId",
216
- "allowSuperAdminBypass": false
217
- }
218
- }
219
- },
220
- "variationId": {
221
- "type": "foreignKey",
222
- "required": false,
223
- "related": "AdVariation"
224
- },
225
- "zoneId": {
226
- "type": "crossPackageRef",
227
- "required": false,
228
- "related": "@happyvertical/smrt-properties:Zone"
229
- },
230
- "siteId": {
231
- "type": "text",
232
- "required": false,
233
- "default": ""
234
- },
235
- "eventType": {
236
- "type": "text",
237
- "required": false,
238
- "enum": [
239
- "impression",
240
- "click",
241
- "conversion"
242
- ]
243
- },
244
- "timestamp": {
245
- "type": "datetime",
246
- "required": false
247
- },
248
- "metadata": {
249
- "type": "text",
250
- "required": false,
251
- "default": ""
252
- }
253
- },
171
+ "fields": {},
254
172
  "methods": {
255
- "getMetadata": {
256
- "name": "getMetadata",
257
- "async": false,
258
- "parameters": [],
259
- "returnType": "Record<string, unknown>",
173
+ "findByVariation": {
174
+ "name": "findByVariation",
175
+ "async": true,
176
+ "parameters": [
177
+ {
178
+ "name": "variationId",
179
+ "type": "string",
180
+ "optional": false
181
+ }
182
+ ],
183
+ "returnType": "Promise<AdEvent[]>",
260
184
  "isStatic": false,
261
185
  "isPublic": true
262
186
  },
263
- "setMetadata": {
264
- "name": "setMetadata",
265
- "async": false,
187
+ "findByZone": {
188
+ "name": "findByZone",
189
+ "async": true,
266
190
  "parameters": [
267
191
  {
268
- "name": "data",
269
- "type": "Record<string, unknown>",
192
+ "name": "zoneId",
193
+ "type": "string",
270
194
  "optional": false
271
195
  }
272
196
  ],
273
- "returnType": "void",
197
+ "returnType": "Promise<AdEvent[]>",
274
198
  "isStatic": false,
275
199
  "isPublic": true
276
200
  },
277
- "isImpression": {
278
- "name": "isImpression",
279
- "async": false,
280
- "parameters": [],
281
- "returnType": "boolean",
201
+ "findBySite": {
202
+ "name": "findBySite",
203
+ "async": true,
204
+ "parameters": [
205
+ {
206
+ "name": "siteId",
207
+ "type": "string",
208
+ "optional": false
209
+ }
210
+ ],
211
+ "returnType": "Promise<AdEvent[]>",
282
212
  "isStatic": false,
283
213
  "isPublic": true
284
214
  },
285
- "isClick": {
286
- "name": "isClick",
287
- "async": false,
288
- "parameters": [],
289
- "returnType": "boolean",
215
+ "findByDateRange": {
216
+ "name": "findByDateRange",
217
+ "async": true,
218
+ "parameters": [
219
+ {
220
+ "name": "start",
221
+ "type": "Date",
222
+ "optional": false
223
+ },
224
+ {
225
+ "name": "end",
226
+ "type": "Date",
227
+ "optional": false
228
+ }
229
+ ],
230
+ "returnType": "Promise<AdEvent[]>",
290
231
  "isStatic": false,
291
232
  "isPublic": true
292
233
  },
293
- "isConversion": {
294
- "name": "isConversion",
295
- "async": false,
234
+ "findByType": {
235
+ "name": "findByType",
236
+ "async": true,
237
+ "parameters": [
238
+ {
239
+ "name": "eventType",
240
+ "type": "AdEventType",
241
+ "optional": false
242
+ }
243
+ ],
244
+ "returnType": "Promise<AdEvent[]>",
245
+ "isStatic": false,
246
+ "isPublic": true
247
+ },
248
+ "countByType": {
249
+ "name": "countByType",
250
+ "async": true,
251
+ "parameters": [
252
+ {
253
+ "name": "variationId",
254
+ "type": "string",
255
+ "optional": false
256
+ },
257
+ {
258
+ "name": "eventType",
259
+ "type": "AdEventType",
260
+ "optional": false
261
+ }
262
+ ],
263
+ "returnType": "Promise<number>",
264
+ "isStatic": false,
265
+ "isPublic": true
266
+ },
267
+ "countImpressions": {
268
+ "name": "countImpressions",
269
+ "async": true,
270
+ "parameters": [
271
+ {
272
+ "name": "variationId",
273
+ "type": "string",
274
+ "optional": false
275
+ }
276
+ ],
277
+ "returnType": "Promise<number>",
278
+ "isStatic": false,
279
+ "isPublic": true
280
+ },
281
+ "countClicks": {
282
+ "name": "countClicks",
283
+ "async": true,
284
+ "parameters": [
285
+ {
286
+ "name": "variationId",
287
+ "type": "string",
288
+ "optional": false
289
+ }
290
+ ],
291
+ "returnType": "Promise<number>",
292
+ "isStatic": false,
293
+ "isPublic": true
294
+ },
295
+ "countConversions": {
296
+ "name": "countConversions",
297
+ "async": true,
298
+ "parameters": [
299
+ {
300
+ "name": "variationId",
301
+ "type": "string",
302
+ "optional": false
303
+ }
304
+ ],
305
+ "returnType": "Promise<number>",
306
+ "isStatic": false,
307
+ "isPublic": true
308
+ },
309
+ "findImpressions": {
310
+ "name": "findImpressions",
311
+ "async": true,
296
312
  "parameters": [],
297
- "returnType": "boolean",
313
+ "returnType": "Promise<AdEvent[]>",
314
+ "isStatic": false,
315
+ "isPublic": true
316
+ },
317
+ "findClicks": {
318
+ "name": "findClicks",
319
+ "async": true,
320
+ "parameters": [],
321
+ "returnType": "Promise<AdEvent[]>",
322
+ "isStatic": false,
323
+ "isPublic": true
324
+ },
325
+ "findConversions": {
326
+ "name": "findConversions",
327
+ "async": true,
328
+ "parameters": [],
329
+ "returnType": "Promise<AdEvent[]>",
330
+ "isStatic": false,
331
+ "isPublic": true
332
+ },
333
+ "getVariationStats": {
334
+ "name": "getVariationStats",
335
+ "async": true,
336
+ "parameters": [
337
+ {
338
+ "name": "variationId",
339
+ "type": "string",
340
+ "optional": false
341
+ }
342
+ ],
343
+ "returnType": "Promise<object>",
344
+ "isStatic": false,
345
+ "isPublic": true
346
+ },
347
+ "findByTenant": {
348
+ "name": "findByTenant",
349
+ "async": true,
350
+ "parameters": [
351
+ {
352
+ "name": "tenantId",
353
+ "type": "string",
354
+ "optional": false
355
+ }
356
+ ],
357
+ "returnType": "Promise<AdEvent[]>",
358
+ "isStatic": false,
359
+ "isPublic": true
360
+ },
361
+ "findGlobal": {
362
+ "name": "findGlobal",
363
+ "async": true,
364
+ "parameters": [],
365
+ "returnType": "Promise<AdEvent[]>",
366
+ "isStatic": false,
367
+ "isPublic": true
368
+ },
369
+ "findWithGlobals": {
370
+ "name": "findWithGlobals",
371
+ "async": true,
372
+ "parameters": [
373
+ {
374
+ "name": "tenantId",
375
+ "type": "string",
376
+ "optional": false
377
+ }
378
+ ],
379
+ "returnType": "Promise<AdEvent[]>",
298
380
  "isStatic": false,
299
381
  "isPublic": true
300
382
  }
301
383
  },
302
384
  "decoratorConfig": {
303
- "tableStrategy": "sti",
304
385
  "api": {
305
386
  "include": [
306
387
  "create",
@@ -312,20 +393,12 @@
312
393
  "create"
313
394
  ]
314
395
  },
315
- "cli": false,
316
- "tenantScoped": {
317
- "mode": "optional"
318
- },
319
- "conflictColumns": [
320
- "tenant_id",
321
- "slug",
322
- "context",
323
- "_meta_type"
324
- ]
396
+ "cli": false
325
397
  },
326
- "extends": "SmrtObject",
327
- "exportName": "AdEvent",
328
- "collectionExportName": "AdEventCollection",
398
+ "extends": "SmrtCollection",
399
+ "extendsTypeArg": "AdEvent",
400
+ "exportName": "AdEventCollection",
401
+ "collectionExportName": "AdEventCollectionCollection",
329
402
  "schema": {
330
403
  "tableName": "ad_events",
331
404
  "ddl": "CREATE TABLE IF NOT EXISTS \"ad_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 \"variation_id\" UUID,\n \"zone_id\" UUID,\n \"site_id\" TEXT DEFAULT '',\n \"event_type\" TEXT,\n \"timestamp\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT ''\n);",
@@ -445,76 +518,18 @@
445
518
  },
446
519
  "importPath": "@happyvertical/smrt-ads"
447
520
  },
448
- "@happyvertical/smrt-ads:AdFormat": {
449
- "name": "adformat",
450
- "className": "AdFormat",
451
- "qualifiedName": "@happyvertical/smrt-ads:AdFormat",
521
+ "@happyvertical/smrt-ads:AdFormatCollection": {
522
+ "name": "adformatcollection",
523
+ "className": "AdFormatCollection",
524
+ "qualifiedName": "@happyvertical/smrt-ads:AdFormatCollection",
452
525
  "collection": "adformats",
453
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdFormat.ts",
526
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdFormatCollection.ts",
454
527
  "packageName": "@happyvertical/smrt-ads",
455
- "fields": {
456
- "name": {
457
- "type": "text",
458
- "required": false,
459
- "default": "",
460
- "description": "What the size is called, for example Leaderboard.",
461
- "_meta": {
462
- "description": "What the size is called, for example Leaderboard."
463
- }
464
- },
465
- "width": {
466
- "type": "integer",
467
- "required": false,
468
- "default": 0,
469
- "description": "How wide the ad is, in pixels.",
470
- "_meta": {
471
- "description": "How wide the ad is, in pixels."
472
- }
473
- },
474
- "height": {
475
- "type": "integer",
476
- "required": false,
477
- "default": 0,
478
- "description": "How tall the ad is, in pixels.",
479
- "_meta": {
480
- "description": "How tall the ad is, in pixels."
481
- }
482
- },
483
- "formatType": {
484
- "type": "text",
485
- "required": false,
486
- "description": "What kind of ad fits this size: a picture, a piece written to look like your own content, or a video.",
487
- "_meta": {
488
- "description": "What kind of ad fits this size: a picture, a piece written to look like your own content, or a video."
489
- },
490
- "enum": [
491
- "banner",
492
- "native",
493
- "video"
494
- ]
495
- },
496
- "description": {
497
- "type": "text",
498
- "required": false,
499
- "default": "",
500
- "description": "A note about where this size is usually used.",
501
- "_meta": {
502
- "description": "A note about where this size is usually used."
503
- }
504
- }
505
- },
528
+ "fields": {},
506
529
  "methods": {
507
- "getDimensions": {
508
- "name": "getDimensions",
509
- "async": false,
510
- "parameters": [],
511
- "returnType": "string",
512
- "isStatic": false,
513
- "isPublic": true
514
- },
515
- "matchesDimensions": {
516
- "name": "matchesDimensions",
517
- "async": false,
530
+ "findByDimensions": {
531
+ "name": "findByDimensions",
532
+ "async": true,
518
533
  "parameters": [
519
534
  {
520
535
  "name": "width",
@@ -527,34 +542,69 @@
527
542
  "optional": false
528
543
  }
529
544
  ],
530
- "returnType": "boolean",
545
+ "returnType": "Promise<AdFormat | null>",
531
546
  "isStatic": false,
532
547
  "isPublic": true
533
- }
534
- },
535
- "decoratorConfig": {
536
- "api": {
537
- "include": [
538
- "list",
539
- "get",
540
- "create",
541
- "update"
542
- ]
543
548
  },
544
- "mcp": {
549
+ "findByType": {
550
+ "name": "findByType",
551
+ "async": true,
552
+ "parameters": [
553
+ {
554
+ "name": "formatType",
555
+ "type": "AdFormatType",
556
+ "optional": false
557
+ }
558
+ ],
559
+ "returnType": "Promise<AdFormat[]>",
560
+ "isStatic": false,
561
+ "isPublic": true
562
+ },
563
+ "findBanners": {
564
+ "name": "findBanners",
565
+ "async": true,
566
+ "parameters": [],
567
+ "returnType": "Promise<AdFormat[]>",
568
+ "isStatic": false,
569
+ "isPublic": true
570
+ },
571
+ "findNative": {
572
+ "name": "findNative",
573
+ "async": true,
574
+ "parameters": [],
575
+ "returnType": "Promise<AdFormat[]>",
576
+ "isStatic": false,
577
+ "isPublic": true
578
+ },
579
+ "findVideo": {
580
+ "name": "findVideo",
581
+ "async": true,
582
+ "parameters": [],
583
+ "returnType": "Promise<AdFormat[]>",
584
+ "isStatic": false,
585
+ "isPublic": true
586
+ }
587
+ },
588
+ "decoratorConfig": {
589
+ "api": {
545
590
  "include": [
546
591
  "list",
547
- "get"
592
+ "get",
593
+ "create",
594
+ "update"
548
595
  ]
549
596
  },
550
- "cli": {
551
- "skipApiCheck": true
597
+ "mcp": {
598
+ "include": [
599
+ "list",
600
+ "get"
601
+ ]
552
602
  }
553
603
  },
554
- "extends": "SmrtObject",
555
- "exportName": "AdFormat",
556
- "collectionExportName": "AdFormatCollection",
557
- "displayLabelField": "name",
604
+ "extends": "SmrtCollection",
605
+ "extendsTypeArg": "AdFormat",
606
+ "exportName": "AdFormatCollection",
607
+ "collectionExportName": "AdFormatCollectionCollection",
558
608
  "schema": {
559
609
  "tableName": "ad_formats",
560
610
  "ddl": "CREATE TABLE IF NOT EXISTS \"ad_formats\" (\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 \"name\" TEXT DEFAULT '',\n \"width\" INTEGER DEFAULT 0,\n \"height\" INTEGER DEFAULT 0,\n \"format_type\" TEXT,\n \"description\" TEXT DEFAULT ''\n);",
@@ -634,275 +684,169 @@
634
684
  },
635
685
  "importPath": "@happyvertical/smrt-ads"
636
686
  },
637
- "@happyvertical/smrt-ads:AdGroup": {
638
- "name": "adgroup",
639
- "className": "AdGroup",
640
- "qualifiedName": "@happyvertical/smrt-ads:AdGroup",
687
+ "@happyvertical/smrt-ads:AdGroupCollection": {
688
+ "name": "adgroupcollection",
689
+ "className": "AdGroupCollection",
690
+ "qualifiedName": "@happyvertical/smrt-ads:AdGroupCollection",
641
691
  "collection": "adgroups",
642
- "description": "AdGroup organizes ad creatives with targeting and budget controls.",
643
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdGroup.ts",
692
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdGroupCollection.ts",
644
693
  "packageName": "@happyvertical/smrt-ads",
645
- "fields": {
646
- "created_at": {
647
- "type": "datetime",
648
- "required": false
649
- },
650
- "updated_at": {
651
- "type": "datetime",
652
- "required": false
653
- },
654
- "tenantId": {
655
- "type": "text",
656
- "required": false,
657
- "_meta": {
658
- "sqlType": "UUID",
659
- "nullable": true,
660
- "__tenancy": {
661
- "isTenantIdField": true,
662
- "autoFilter": true,
663
- "required": false,
664
- "autoPopulate": true,
665
- "nullable": true,
666
- "mode": "optional",
667
- "field": "tenantId",
668
- "allowSuperAdminBypass": false
669
- }
670
- }
671
- },
672
- "contractId": {
673
- "type": "crossPackageRef",
674
- "required": false,
675
- "related": "@happyvertical/smrt-commerce:SalesContract",
676
- "description": "The sales contract this campaign is sold under, if there is one.",
677
- "_meta": {
678
- "description": "The sales contract this campaign is sold under, if there is one.",
679
- "validateSubtype": true
680
- }
681
- },
682
- "tierId": {
683
- "type": "foreignKey",
684
- "required": false,
685
- "related": "AdDeliveryTier",
686
- "description": "The priority tier the campaign runs in. Tiers are tried in order when more than one campaign could show.",
687
- "_meta": {
688
- "description": "The priority tier the campaign runs in. Tiers are tried in order when more than one campaign could show."
689
- }
690
- },
691
- "name": {
692
- "type": "text",
693
- "required": false,
694
- "default": "",
695
- "description": "What you call the campaign, for example Summer sale.",
696
- "_meta": {
697
- "description": "What you call the campaign, for example Summer sale."
698
- }
699
- },
700
- "verticalSlug": {
701
- "type": "text",
702
- "required": false,
703
- "default": "",
704
- "description": "The category the campaign belongs to, such as retail.",
705
- "_meta": {
706
- "description": "The category the campaign belongs to, such as retail."
707
- }
708
- },
709
- "targeting": {
710
- "type": "text",
711
- "required": false,
712
- "default": ""
713
- },
714
- "zoneIds": {
715
- "type": "text",
716
- "required": false,
717
- "default": ""
718
- },
719
- "startDate": {
720
- "type": "datetime",
721
- "required": false,
722
- "description": "The first day the campaign can show.",
723
- "_meta": {
724
- "description": "The first day the campaign can show."
725
- }
726
- },
727
- "endDate": {
728
- "type": "datetime",
729
- "required": false,
730
- "description": "The last day the campaign can show.",
731
- "_meta": {
732
- "description": "The last day the campaign can show."
733
- }
734
- },
735
- "dailyBudget": {
736
- "type": "decimal",
737
- "required": false,
738
- "default": 0,
739
- "description": "The most to spend in one day. The app shows this but does not stop the campaign by itself.",
740
- "_meta": {
741
- "description": "The most to spend in one day. The app shows this but does not stop the campaign by itself."
742
- }
743
- },
744
- "totalBudget": {
745
- "type": "decimal",
746
- "required": false,
747
- "default": 0,
748
- "description": "The most to spend over the whole campaign.",
749
- "_meta": {
750
- "description": "The most to spend over the whole campaign."
751
- }
752
- },
753
- "status": {
754
- "type": "text",
755
- "required": false,
756
- "description": "Where the campaign stands: draft, active, paused or completed. Only active campaigns show ads.",
757
- "_meta": {
758
- "description": "Where the campaign stands: draft, active, paused or completed. Only active campaigns show ads."
759
- },
760
- "enum": [
761
- "draft",
762
- "active",
763
- "paused",
764
- "completed"
765
- ]
766
- }
767
- },
694
+ "fields": {},
768
695
  "methods": {
769
- "getZoneIds": {
770
- "name": "getZoneIds",
771
- "async": false,
772
- "parameters": [],
773
- "returnType": "string[]",
774
- "isStatic": false,
775
- "isPublic": true
776
- },
777
- "setZoneIds": {
778
- "name": "setZoneIds",
779
- "async": false,
696
+ "findByContract": {
697
+ "name": "findByContract",
698
+ "async": true,
780
699
  "parameters": [
781
700
  {
782
- "name": "ids",
783
- "type": "string[]",
701
+ "name": "contractId",
702
+ "type": "string",
784
703
  "optional": false
785
704
  }
786
705
  ],
787
- "returnType": "void",
706
+ "returnType": "Promise<AdGroup[]>",
788
707
  "isStatic": false,
789
708
  "isPublic": true
790
709
  },
791
- "addZoneId": {
792
- "name": "addZoneId",
793
- "async": false,
710
+ "findByTier": {
711
+ "name": "findByTier",
712
+ "async": true,
794
713
  "parameters": [
795
714
  {
796
- "name": "zoneId",
715
+ "name": "tierId",
797
716
  "type": "string",
798
717
  "optional": false
799
718
  }
800
719
  ],
801
- "returnType": "void",
720
+ "returnType": "Promise<AdGroup[]>",
802
721
  "isStatic": false,
803
722
  "isPublic": true
804
723
  },
805
- "removeZoneId": {
806
- "name": "removeZoneId",
807
- "async": false,
724
+ "findByStatus": {
725
+ "name": "findByStatus",
726
+ "async": true,
808
727
  "parameters": [
809
728
  {
810
- "name": "zoneId",
811
- "type": "string",
729
+ "name": "status",
730
+ "type": "AdGroupStatus",
812
731
  "optional": false
813
732
  }
814
733
  ],
815
- "returnType": "void",
734
+ "returnType": "Promise<AdGroup[]>",
816
735
  "isStatic": false,
817
736
  "isPublic": true
818
737
  },
819
- "hasZoneId": {
820
- "name": "hasZoneId",
821
- "async": false,
738
+ "findActive": {
739
+ "name": "findActive",
740
+ "async": true,
741
+ "parameters": [],
742
+ "returnType": "Promise<AdGroup[]>",
743
+ "isStatic": false,
744
+ "isPublic": true
745
+ },
746
+ "findByVertical": {
747
+ "name": "findByVertical",
748
+ "async": true,
822
749
  "parameters": [
823
750
  {
824
- "name": "zoneId",
751
+ "name": "verticalSlug",
825
752
  "type": "string",
826
753
  "optional": false
827
754
  }
828
755
  ],
829
- "returnType": "boolean",
756
+ "returnType": "Promise<AdGroup[]>",
830
757
  "isStatic": false,
831
758
  "isPublic": true
832
759
  },
833
- "getTargeting": {
834
- "name": "getTargeting",
835
- "async": false,
836
- "parameters": [],
837
- "returnType": "Record<string, unknown>",
760
+ "findByZone": {
761
+ "name": "findByZone",
762
+ "async": true,
763
+ "parameters": [
764
+ {
765
+ "name": "zoneId",
766
+ "type": "string",
767
+ "optional": false
768
+ }
769
+ ],
770
+ "returnType": "Promise<AdGroup[]>",
838
771
  "isStatic": false,
839
772
  "isPublic": true
840
773
  },
841
- "setTargeting": {
842
- "name": "setTargeting",
843
- "async": false,
774
+ "findEligibleForZone": {
775
+ "name": "findEligibleForZone",
776
+ "async": true,
844
777
  "parameters": [
845
778
  {
846
- "name": "rules",
847
- "type": "Record<string, unknown>",
779
+ "name": "zoneId",
780
+ "type": "string",
848
781
  "optional": false
849
782
  }
850
783
  ],
851
- "returnType": "void",
784
+ "returnType": "Promise<AdGroup[]>",
852
785
  "isStatic": false,
853
786
  "isPublic": true
854
787
  },
855
- "isActive": {
856
- "name": "isActive",
857
- "async": false,
788
+ "findDrafts": {
789
+ "name": "findDrafts",
790
+ "async": true,
858
791
  "parameters": [],
859
- "returnType": "boolean",
792
+ "returnType": "Promise<AdGroup[]>",
860
793
  "isStatic": false,
861
794
  "isPublic": true
862
795
  },
863
- "isDraft": {
864
- "name": "isDraft",
865
- "async": false,
796
+ "findPaused": {
797
+ "name": "findPaused",
798
+ "async": true,
866
799
  "parameters": [],
867
- "returnType": "boolean",
800
+ "returnType": "Promise<AdGroup[]>",
868
801
  "isStatic": false,
869
802
  "isPublic": true
870
803
  },
871
- "isPaused": {
872
- "name": "isPaused",
873
- "async": false,
804
+ "findCompleted": {
805
+ "name": "findCompleted",
806
+ "async": true,
874
807
  "parameters": [],
875
- "returnType": "boolean",
808
+ "returnType": "Promise<AdGroup[]>",
876
809
  "isStatic": false,
877
810
  "isPublic": true
878
811
  },
879
- "isCompleted": {
880
- "name": "isCompleted",
881
- "async": false,
882
- "parameters": [],
883
- "returnType": "boolean",
812
+ "findByTenant": {
813
+ "name": "findByTenant",
814
+ "async": true,
815
+ "parameters": [
816
+ {
817
+ "name": "tenantId",
818
+ "type": "string",
819
+ "optional": false
820
+ }
821
+ ],
822
+ "returnType": "Promise<AdGroup[]>",
884
823
  "isStatic": false,
885
824
  "isPublic": true
886
825
  },
887
- "hasEnded": {
888
- "name": "hasEnded",
889
- "async": false,
826
+ "findGlobal": {
827
+ "name": "findGlobal",
828
+ "async": true,
890
829
  "parameters": [],
891
- "returnType": "boolean",
830
+ "returnType": "Promise<AdGroup[]>",
892
831
  "isStatic": false,
893
832
  "isPublic": true
894
833
  },
895
- "hasStarted": {
896
- "name": "hasStarted",
897
- "async": false,
898
- "parameters": [],
899
- "returnType": "boolean",
834
+ "findWithGlobals": {
835
+ "name": "findWithGlobals",
836
+ "async": true,
837
+ "parameters": [
838
+ {
839
+ "name": "tenantId",
840
+ "type": "string",
841
+ "optional": false
842
+ }
843
+ ],
844
+ "returnType": "Promise<AdGroup[]>",
900
845
  "isStatic": false,
901
846
  "isPublic": true
902
847
  }
903
848
  },
904
849
  "decoratorConfig": {
905
- "tableStrategy": "sti",
906
850
  "api": {
907
851
  "include": [
908
852
  "list",
@@ -917,24 +861,12 @@
917
861
  "get",
918
862
  "create"
919
863
  ]
920
- },
921
- "cli": {
922
- "skipApiCheck": true
923
- },
924
- "tenantScoped": {
925
- "mode": "optional"
926
- },
927
- "conflictColumns": [
928
- "tenant_id",
929
- "slug",
930
- "context",
931
- "_meta_type"
932
- ]
864
+ }
933
865
  },
934
- "extends": "SmrtObject",
935
- "exportName": "AdGroup",
936
- "collectionExportName": "AdGroupCollection",
937
- "displayLabelField": "name",
866
+ "extends": "SmrtCollection",
867
+ "extendsTypeArg": "AdGroup",
868
+ "exportName": "AdGroupCollection",
869
+ "collectionExportName": "AdGroupCollectionCollection",
938
870
  "schema": {
939
871
  "tableName": "ad_groups",
940
872
  "ddl": "CREATE TABLE IF NOT EXISTS \"ad_groups\" (\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 \"contract_id\" UUID,\n \"tier_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"vertical_slug\" TEXT DEFAULT '',\n \"targeting\" TEXT DEFAULT '',\n \"zone_ids\" TEXT DEFAULT '',\n \"start_date\" TIMESTAMP,\n \"end_date\" TIMESTAMP,\n \"daily_budget\" REAL DEFAULT 0,\n \"total_budget\" REAL DEFAULT 0,\n \"status\" TEXT\n);",
@@ -1078,188 +1010,161 @@
1078
1010
  },
1079
1011
  "importPath": "@happyvertical/smrt-ads"
1080
1012
  },
1081
- "@happyvertical/smrt-ads:AdVariation": {
1082
- "name": "advariation",
1083
- "className": "AdVariation",
1084
- "qualifiedName": "@happyvertical/smrt-ads:AdVariation",
1013
+ "@happyvertical/smrt-ads:AdVariationCollection": {
1014
+ "name": "advariationcollection",
1015
+ "className": "AdVariationCollection",
1016
+ "qualifiedName": "@happyvertical/smrt-ads:AdVariationCollection",
1085
1017
  "collection": "advariations",
1086
- "description": "AdVariation represents a creative asset within an ad group. Supports A/B testing via weighted selection.",
1087
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdVariation.ts",
1018
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdVariationCollection.ts",
1088
1019
  "packageName": "@happyvertical/smrt-ads",
1089
- "fields": {
1090
- "created_at": {
1091
- "type": "datetime",
1092
- "required": false
1093
- },
1094
- "updated_at": {
1095
- "type": "datetime",
1096
- "required": false
1020
+ "fields": {},
1021
+ "methods": {
1022
+ "findByGroup": {
1023
+ "name": "findByGroup",
1024
+ "async": true,
1025
+ "parameters": [
1026
+ {
1027
+ "name": "groupId",
1028
+ "type": "string",
1029
+ "optional": false
1030
+ }
1031
+ ],
1032
+ "returnType": "Promise<AdVariation[]>",
1033
+ "isStatic": false,
1034
+ "isPublic": true
1097
1035
  },
1098
- "tenantId": {
1099
- "type": "text",
1100
- "required": false,
1101
- "_meta": {
1102
- "sqlType": "UUID",
1103
- "nullable": true,
1104
- "__tenancy": {
1105
- "isTenantIdField": true,
1106
- "autoFilter": true,
1107
- "required": false,
1108
- "autoPopulate": true,
1109
- "nullable": true,
1110
- "mode": "optional",
1111
- "field": "tenantId",
1112
- "allowSuperAdminBypass": false
1036
+ "findByFormat": {
1037
+ "name": "findByFormat",
1038
+ "async": true,
1039
+ "parameters": [
1040
+ {
1041
+ "name": "formatId",
1042
+ "type": "string",
1043
+ "optional": false
1113
1044
  }
1114
- }
1045
+ ],
1046
+ "returnType": "Promise<AdVariation[]>",
1047
+ "isStatic": false,
1048
+ "isPublic": true
1115
1049
  },
1116
- "groupId": {
1117
- "type": "foreignKey",
1118
- "required": false,
1119
- "related": "AdGroup",
1120
- "description": "The campaign this ad belongs to.",
1121
- "_meta": {
1122
- "description": "The campaign this ad belongs to."
1123
- }
1050
+ "findActiveByGroup": {
1051
+ "name": "findActiveByGroup",
1052
+ "async": true,
1053
+ "parameters": [
1054
+ {
1055
+ "name": "groupId",
1056
+ "type": "string",
1057
+ "optional": false
1058
+ }
1059
+ ],
1060
+ "returnType": "Promise<AdVariation[]>",
1061
+ "isStatic": false,
1062
+ "isPublic": true
1124
1063
  },
1125
- "formatId": {
1126
- "type": "foreignKey",
1127
- "required": false,
1128
- "related": "AdFormat",
1129
- "description": "The ad size this ad is made for.",
1130
- "_meta": {
1131
- "description": "The ad size this ad is made for."
1132
- }
1064
+ "selectByWeight": {
1065
+ "name": "selectByWeight",
1066
+ "async": true,
1067
+ "parameters": [
1068
+ {
1069
+ "name": "groupId",
1070
+ "type": "string",
1071
+ "optional": false
1072
+ }
1073
+ ],
1074
+ "returnType": "Promise<AdVariation | null>",
1075
+ "isStatic": false,
1076
+ "isPublic": true
1133
1077
  },
1134
- "assetId": {
1135
- "type": "crossPackageRef",
1136
- "required": false,
1137
- "related": "@happyvertical/smrt-assets:Asset",
1138
- "description": "The picture people see.",
1139
- "_meta": {
1140
- "description": "The picture people see."
1141
- }
1078
+ "findByStatus": {
1079
+ "name": "findByStatus",
1080
+ "async": true,
1081
+ "parameters": [
1082
+ {
1083
+ "name": "status",
1084
+ "type": "AdVariationStatus",
1085
+ "optional": false
1086
+ }
1087
+ ],
1088
+ "returnType": "Promise<AdVariation[]>",
1089
+ "isStatic": false,
1090
+ "isPublic": true
1142
1091
  },
1143
- "name": {
1144
- "type": "text",
1145
- "required": false,
1146
- "default": "",
1147
- "description": "What you call this ad, for example Version A, blue button.",
1148
- "_meta": {
1149
- "description": "What you call this ad, for example Version A, blue button."
1150
- }
1092
+ "findActive": {
1093
+ "name": "findActive",
1094
+ "async": true,
1095
+ "parameters": [],
1096
+ "returnType": "Promise<AdVariation[]>",
1097
+ "isStatic": false,
1098
+ "isPublic": true
1151
1099
  },
1152
- "clickUrl": {
1153
- "type": "text",
1154
- "required": false,
1155
- "default": "",
1156
- "description": "The web address people go to when they tap the ad.",
1157
- "_meta": {
1158
- "description": "The web address people go to when they tap the ad."
1159
- }
1160
- },
1161
- "altText": {
1162
- "type": "text",
1163
- "required": false,
1164
- "default": "",
1165
- "description": "A few words that describe the picture for people who cannot see it.",
1166
- "_meta": {
1167
- "description": "A few words that describe the picture for people who cannot see it."
1168
- }
1169
- },
1170
- "weight": {
1171
- "type": "integer",
1172
- "required": false,
1173
- "default": 1,
1174
- "description": "How often this ad shows compared with the others in its campaign: an ad with weight 2 shows twice as often as one with weight 1.",
1175
- "_meta": {
1176
- "description": "How often this ad shows compared with the others in its campaign: an ad with weight 2 shows twice as often as one with weight 1."
1177
- }
1178
- },
1179
- "status": {
1180
- "type": "text",
1181
- "required": false,
1182
- "description": "Where the ad stands: draft, active or paused. Only active ads show.",
1183
- "_meta": {
1184
- "description": "Where the ad stands: draft, active or paused. Only active ads show."
1185
- },
1186
- "enum": [
1187
- "draft",
1188
- "active",
1189
- "paused"
1190
- ]
1191
- },
1192
- "impressions": {
1193
- "type": "integer",
1194
- "required": false,
1195
- "default": 0,
1196
- "description": "How many times the ad has been shown. The app counts this as it serves ads and refreshes it a little later.",
1197
- "_meta": {
1198
- "description": "How many times the ad has been shown. The app counts this as it serves ads and refreshes it a little later."
1199
- }
1200
- },
1201
- "clicks": {
1202
- "type": "integer",
1203
- "required": false,
1204
- "default": 0,
1205
- "description": "How many times the ad has been tapped. The app counts this as it serves ads and refreshes it a little later.",
1206
- "_meta": {
1207
- "description": "How many times the ad has been tapped. The app counts this as it serves ads and refreshes it a little later."
1208
- }
1209
- }
1210
- },
1211
- "methods": {
1212
- "isActive": {
1213
- "name": "isActive",
1214
- "async": false,
1100
+ "findDrafts": {
1101
+ "name": "findDrafts",
1102
+ "async": true,
1215
1103
  "parameters": [],
1216
- "returnType": "boolean",
1104
+ "returnType": "Promise<AdVariation[]>",
1217
1105
  "isStatic": false,
1218
1106
  "isPublic": true
1219
1107
  },
1220
- "isDraft": {
1221
- "name": "isDraft",
1222
- "async": false,
1108
+ "findPaused": {
1109
+ "name": "findPaused",
1110
+ "async": true,
1223
1111
  "parameters": [],
1224
- "returnType": "boolean",
1112
+ "returnType": "Promise<AdVariation[]>",
1225
1113
  "isStatic": false,
1226
1114
  "isPublic": true
1227
1115
  },
1228
- "isPaused": {
1229
- "name": "isPaused",
1230
- "async": false,
1231
- "parameters": [],
1232
- "returnType": "boolean",
1116
+ "findTopPerformers": {
1117
+ "name": "findTopPerformers",
1118
+ "async": true,
1119
+ "parameters": [
1120
+ {
1121
+ "name": "limit",
1122
+ "type": "number",
1123
+ "optional": true
1124
+ }
1125
+ ],
1126
+ "returnType": "Promise<AdVariation[]>",
1233
1127
  "isStatic": false,
1234
1128
  "isPublic": true
1235
1129
  },
1236
- "getCTR": {
1237
- "name": "getCTR",
1238
- "async": false,
1239
- "parameters": [],
1240
- "returnType": "number",
1130
+ "findByTenant": {
1131
+ "name": "findByTenant",
1132
+ "async": true,
1133
+ "parameters": [
1134
+ {
1135
+ "name": "tenantId",
1136
+ "type": "string",
1137
+ "optional": false
1138
+ }
1139
+ ],
1140
+ "returnType": "Promise<AdVariation[]>",
1241
1141
  "isStatic": false,
1242
1142
  "isPublic": true
1243
1143
  },
1244
- "recordImpression": {
1245
- "name": "recordImpression",
1246
- "async": false,
1144
+ "findGlobal": {
1145
+ "name": "findGlobal",
1146
+ "async": true,
1247
1147
  "parameters": [],
1248
- "returnType": "void",
1148
+ "returnType": "Promise<AdVariation[]>",
1249
1149
  "isStatic": false,
1250
1150
  "isPublic": true
1251
1151
  },
1252
- "recordClick": {
1253
- "name": "recordClick",
1254
- "async": false,
1255
- "parameters": [],
1256
- "returnType": "void",
1152
+ "findWithGlobals": {
1153
+ "name": "findWithGlobals",
1154
+ "async": true,
1155
+ "parameters": [
1156
+ {
1157
+ "name": "tenantId",
1158
+ "type": "string",
1159
+ "optional": false
1160
+ }
1161
+ ],
1162
+ "returnType": "Promise<AdVariation[]>",
1257
1163
  "isStatic": false,
1258
1164
  "isPublic": true
1259
1165
  }
1260
1166
  },
1261
1167
  "decoratorConfig": {
1262
- "tableStrategy": "sti",
1263
1168
  "api": {
1264
1169
  "include": [
1265
1170
  "list",
@@ -1274,24 +1179,12 @@
1274
1179
  "get",
1275
1180
  "create"
1276
1181
  ]
1277
- },
1278
- "cli": {
1279
- "skipApiCheck": true
1280
- },
1281
- "tenantScoped": {
1282
- "mode": "optional"
1283
- },
1284
- "conflictColumns": [
1285
- "tenant_id",
1286
- "slug",
1287
- "context",
1288
- "_meta_type"
1289
- ]
1182
+ }
1290
1183
  },
1291
- "extends": "SmrtObject",
1292
- "exportName": "AdVariation",
1293
- "collectionExportName": "AdVariationCollection",
1294
- "displayLabelField": "name",
1184
+ "extends": "SmrtCollection",
1185
+ "extendsTypeArg": "AdVariation",
1186
+ "exportName": "AdVariationCollection",
1187
+ "collectionExportName": "AdVariationCollectionCollection",
1295
1188
  "schema": {
1296
1189
  "tableName": "ad_variations",
1297
1190
  "ddl": "CREATE TABLE IF NOT EXISTS \"ad_variations\" (\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 \"group_id\" UUID,\n \"format_id\" UUID,\n \"asset_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"click_url\" TEXT DEFAULT '',\n \"alt_text\" TEXT DEFAULT '',\n \"weight\" INTEGER DEFAULT 1,\n \"status\" TEXT,\n \"impressions\" INTEGER DEFAULT 0,\n \"clicks\" INTEGER DEFAULT 0\n);",
@@ -1444,90 +1337,111 @@
1444
1337
  },
1445
1338
  "importPath": "@happyvertical/smrt-ads"
1446
1339
  },
1447
- "@happyvertical/smrt-ads:AdDeliveryTierCollection": {
1448
- "name": "addeliverytiercollection",
1449
- "className": "AdDeliveryTierCollection",
1450
- "qualifiedName": "@happyvertical/smrt-ads:AdDeliveryTierCollection",
1340
+ "@happyvertical/smrt-ads:AdDeliveryTier": {
1341
+ "name": "addeliverytier",
1342
+ "className": "AdDeliveryTier",
1343
+ "qualifiedName": "@happyvertical/smrt-ads:AdDeliveryTier",
1451
1344
  "collection": "addeliverytiers",
1452
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdDeliveryTierCollection.ts",
1345
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdDeliveryTier.ts",
1453
1346
  "packageName": "@happyvertical/smrt-ads",
1454
- "fields": {},
1455
- "methods": {
1456
- "findByPriority": {
1457
- "name": "findByPriority",
1458
- "async": true,
1459
- "parameters": [],
1460
- "returnType": "Promise<AdDeliveryTier[]>",
1461
- "isStatic": false,
1462
- "isPublic": true
1347
+ "fields": {
1348
+ "name": {
1349
+ "type": "text",
1350
+ "required": false,
1351
+ "default": "",
1352
+ "description": "What the tier is called, for example Sponsorship, Standard or House.",
1353
+ "_meta": {
1354
+ "description": "What the tier is called, for example Sponsorship, Standard or House."
1355
+ }
1463
1356
  },
1464
- "findByPricingModel": {
1465
- "name": "findByPricingModel",
1466
- "async": true,
1357
+ "priority": {
1358
+ "type": "integer",
1359
+ "required": false,
1360
+ "default": 0,
1361
+ "description": "The order tiers are tried in: 1 is tried first, then 2, and so on.",
1362
+ "_meta": {
1363
+ "description": "The order tiers are tried in: 1 is tried first, then 2, and so on."
1364
+ }
1365
+ },
1366
+ "pricingModel": {
1367
+ "type": "text",
1368
+ "required": false,
1369
+ "description": "How ads in this tier are charged: a fixed price, per thousand showings, per click, or per sale.",
1370
+ "_meta": {
1371
+ "description": "How ads in this tier are charged: a fixed price, per thousand showings, per click, or per sale."
1372
+ },
1373
+ "enum": [
1374
+ "fixed",
1375
+ "cpm",
1376
+ "cpc",
1377
+ "cpa"
1378
+ ]
1379
+ },
1380
+ "description": {
1381
+ "type": "text",
1382
+ "required": false,
1383
+ "default": "",
1384
+ "description": "A note about what this tier is for.",
1385
+ "_meta": {
1386
+ "description": "A note about what this tier is for."
1387
+ }
1388
+ }
1389
+ },
1390
+ "methods": {
1391
+ "isHigherPriorityThan": {
1392
+ "name": "isHigherPriorityThan",
1393
+ "async": false,
1467
1394
  "parameters": [
1468
1395
  {
1469
- "name": "pricingModel",
1470
- "type": "PricingModel",
1396
+ "name": "other",
1397
+ "type": "AdDeliveryTier",
1471
1398
  "optional": false
1472
1399
  }
1473
1400
  ],
1474
- "returnType": "Promise<AdDeliveryTier[]>",
1401
+ "returnType": "boolean",
1475
1402
  "isStatic": false,
1476
1403
  "isPublic": true
1477
1404
  },
1478
- "getHighestPriority": {
1479
- "name": "getHighestPriority",
1480
- "async": true,
1405
+ "isFixedPricing": {
1406
+ "name": "isFixedPricing",
1407
+ "async": false,
1481
1408
  "parameters": [],
1482
- "returnType": "Promise<AdDeliveryTier | null>",
1409
+ "returnType": "boolean",
1483
1410
  "isStatic": false,
1484
1411
  "isPublic": true
1485
1412
  },
1486
- "findFixedPricing": {
1487
- "name": "findFixedPricing",
1488
- "async": true,
1413
+ "isPerformanceBased": {
1414
+ "name": "isPerformanceBased",
1415
+ "async": false,
1489
1416
  "parameters": [],
1490
- "returnType": "Promise<AdDeliveryTier[]>",
1417
+ "returnType": "boolean",
1491
1418
  "isStatic": false,
1492
1419
  "isPublic": true
1493
- },
1494
- "findCPM": {
1495
- "name": "findCPM",
1496
- "async": true,
1497
- "parameters": [],
1498
- "returnType": "Promise<AdDeliveryTier[]>",
1499
- "isStatic": false,
1500
- "isPublic": true
1501
- },
1502
- "findPerformanceBased": {
1503
- "name": "findPerformanceBased",
1504
- "async": true,
1505
- "parameters": [],
1506
- "returnType": "Promise<AdDeliveryTier[]>",
1507
- "isStatic": false,
1508
- "isPublic": true
1509
- }
1510
- },
1511
- "decoratorConfig": {
1512
- "api": {
1513
- "include": [
1514
- "list",
1515
- "get",
1516
- "create",
1517
- "update"
1518
- ]
1420
+ }
1421
+ },
1422
+ "decoratorConfig": {
1423
+ "api": {
1424
+ "include": [
1425
+ "list",
1426
+ "get",
1427
+ "create",
1428
+ "update"
1429
+ ]
1519
1430
  },
1520
1431
  "mcp": {
1521
1432
  "include": [
1522
1433
  "list",
1523
1434
  "get"
1524
1435
  ]
1436
+ },
1437
+ "cli": {
1438
+ "skipApiCheck": true
1525
1439
  }
1526
1440
  },
1527
- "extends": "SmrtCollection",
1528
- "extendsTypeArg": "AdDeliveryTier",
1529
- "exportName": "AdDeliveryTierCollection",
1530
- "collectionExportName": "AdDeliveryTierCollectionCollection",
1441
+ "extends": "SmrtObject",
1442
+ "exportName": "AdDeliveryTier",
1443
+ "collectionExportName": "AdDeliveryTierCollection",
1444
+ "displayLabelField": "name",
1531
1445
  "schema": {
1532
1446
  "tableName": "ad_delivery_tiers",
1533
1447
  "ddl": "CREATE TABLE IF NOT EXISTS \"ad_delivery_tiers\" (\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 \"name\" TEXT DEFAULT '',\n \"priority\" INTEGER DEFAULT 0,\n \"pricing_model\" TEXT,\n \"description\" TEXT DEFAULT ''\n);",
@@ -1601,227 +1515,125 @@
1601
1515
  },
1602
1516
  "importPath": "@happyvertical/smrt-ads"
1603
1517
  },
1604
- "@happyvertical/smrt-ads:AdEventCollection": {
1605
- "name": "adeventcollection",
1606
- "className": "AdEventCollection",
1607
- "qualifiedName": "@happyvertical/smrt-ads:AdEventCollection",
1518
+ "@happyvertical/smrt-ads:AdEvent": {
1519
+ "name": "adevent",
1520
+ "className": "AdEvent",
1521
+ "qualifiedName": "@happyvertical/smrt-ads:AdEvent",
1608
1522
  "collection": "adevents",
1609
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdEventCollection.ts",
1523
+ "description": "AdEvent tracks ad impressions, clicks, and conversions. Events are immutable (append-only, no update/delete).",
1524
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdEvent.ts",
1610
1525
  "packageName": "@happyvertical/smrt-ads",
1611
- "fields": {},
1612
- "methods": {
1613
- "findByVariation": {
1614
- "name": "findByVariation",
1615
- "async": true,
1616
- "parameters": [
1617
- {
1618
- "name": "variationId",
1619
- "type": "string",
1620
- "optional": false
1621
- }
1622
- ],
1623
- "returnType": "Promise<AdEvent[]>",
1624
- "isStatic": false,
1625
- "isPublic": true
1526
+ "fields": {
1527
+ "created_at": {
1528
+ "type": "datetime",
1529
+ "required": false
1626
1530
  },
1627
- "findByZone": {
1628
- "name": "findByZone",
1629
- "async": true,
1630
- "parameters": [
1631
- {
1632
- "name": "zoneId",
1633
- "type": "string",
1634
- "optional": false
1635
- }
1636
- ],
1637
- "returnType": "Promise<AdEvent[]>",
1638
- "isStatic": false,
1639
- "isPublic": true
1531
+ "updated_at": {
1532
+ "type": "datetime",
1533
+ "required": false
1640
1534
  },
1641
- "findBySite": {
1642
- "name": "findBySite",
1643
- "async": true,
1644
- "parameters": [
1645
- {
1646
- "name": "siteId",
1647
- "type": "string",
1648
- "optional": false
1535
+ "tenantId": {
1536
+ "type": "text",
1537
+ "required": false,
1538
+ "_meta": {
1539
+ "sqlType": "UUID",
1540
+ "nullable": true,
1541
+ "__tenancy": {
1542
+ "isTenantIdField": true,
1543
+ "autoFilter": true,
1544
+ "required": false,
1545
+ "autoPopulate": true,
1546
+ "nullable": true,
1547
+ "mode": "optional",
1548
+ "field": "tenantId",
1549
+ "allowSuperAdminBypass": false
1649
1550
  }
1650
- ],
1651
- "returnType": "Promise<AdEvent[]>",
1652
- "isStatic": false,
1653
- "isPublic": true
1551
+ }
1654
1552
  },
1655
- "findByDateRange": {
1656
- "name": "findByDateRange",
1657
- "async": true,
1658
- "parameters": [
1659
- {
1660
- "name": "start",
1661
- "type": "Date",
1662
- "optional": false
1663
- },
1664
- {
1665
- "name": "end",
1666
- "type": "Date",
1667
- "optional": false
1668
- }
1669
- ],
1670
- "returnType": "Promise<AdEvent[]>",
1671
- "isStatic": false,
1672
- "isPublic": true
1553
+ "variationId": {
1554
+ "type": "foreignKey",
1555
+ "required": false,
1556
+ "related": "AdVariation"
1673
1557
  },
1674
- "findByType": {
1675
- "name": "findByType",
1676
- "async": true,
1677
- "parameters": [
1678
- {
1679
- "name": "eventType",
1680
- "type": "AdEventType",
1681
- "optional": false
1682
- }
1683
- ],
1684
- "returnType": "Promise<AdEvent[]>",
1685
- "isStatic": false,
1686
- "isPublic": true
1558
+ "zoneId": {
1559
+ "type": "crossPackageRef",
1560
+ "required": false,
1561
+ "related": "@happyvertical/smrt-properties:Zone"
1687
1562
  },
1688
- "countByType": {
1689
- "name": "countByType",
1690
- "async": true,
1691
- "parameters": [
1692
- {
1693
- "name": "variationId",
1694
- "type": "string",
1695
- "optional": false
1696
- },
1697
- {
1698
- "name": "eventType",
1699
- "type": "AdEventType",
1700
- "optional": false
1701
- }
1702
- ],
1703
- "returnType": "Promise<number>",
1704
- "isStatic": false,
1705
- "isPublic": true
1563
+ "siteId": {
1564
+ "type": "text",
1565
+ "required": false,
1566
+ "default": ""
1706
1567
  },
1707
- "countImpressions": {
1708
- "name": "countImpressions",
1709
- "async": true,
1710
- "parameters": [
1711
- {
1712
- "name": "variationId",
1713
- "type": "string",
1714
- "optional": false
1715
- }
1716
- ],
1717
- "returnType": "Promise<number>",
1718
- "isStatic": false,
1719
- "isPublic": true
1568
+ "eventType": {
1569
+ "type": "text",
1570
+ "required": false,
1571
+ "enum": [
1572
+ "impression",
1573
+ "click",
1574
+ "conversion"
1575
+ ]
1720
1576
  },
1721
- "countClicks": {
1722
- "name": "countClicks",
1723
- "async": true,
1724
- "parameters": [
1725
- {
1726
- "name": "variationId",
1727
- "type": "string",
1728
- "optional": false
1729
- }
1730
- ],
1731
- "returnType": "Promise<number>",
1577
+ "timestamp": {
1578
+ "type": "datetime",
1579
+ "required": false
1580
+ },
1581
+ "metadata": {
1582
+ "type": "text",
1583
+ "required": false,
1584
+ "default": ""
1585
+ }
1586
+ },
1587
+ "methods": {
1588
+ "getMetadata": {
1589
+ "name": "getMetadata",
1590
+ "async": false,
1591
+ "parameters": [],
1592
+ "returnType": "Record<string, unknown>",
1732
1593
  "isStatic": false,
1733
1594
  "isPublic": true
1734
1595
  },
1735
- "countConversions": {
1736
- "name": "countConversions",
1737
- "async": true,
1596
+ "setMetadata": {
1597
+ "name": "setMetadata",
1598
+ "async": false,
1738
1599
  "parameters": [
1739
1600
  {
1740
- "name": "variationId",
1741
- "type": "string",
1601
+ "name": "data",
1602
+ "type": "Record<string, unknown>",
1742
1603
  "optional": false
1743
1604
  }
1744
1605
  ],
1745
- "returnType": "Promise<number>",
1606
+ "returnType": "void",
1746
1607
  "isStatic": false,
1747
1608
  "isPublic": true
1748
1609
  },
1749
- "findImpressions": {
1750
- "name": "findImpressions",
1751
- "async": true,
1610
+ "isImpression": {
1611
+ "name": "isImpression",
1612
+ "async": false,
1752
1613
  "parameters": [],
1753
- "returnType": "Promise<AdEvent[]>",
1614
+ "returnType": "boolean",
1754
1615
  "isStatic": false,
1755
1616
  "isPublic": true
1756
1617
  },
1757
- "findClicks": {
1758
- "name": "findClicks",
1759
- "async": true,
1618
+ "isClick": {
1619
+ "name": "isClick",
1620
+ "async": false,
1760
1621
  "parameters": [],
1761
- "returnType": "Promise<AdEvent[]>",
1622
+ "returnType": "boolean",
1762
1623
  "isStatic": false,
1763
1624
  "isPublic": true
1764
1625
  },
1765
- "findConversions": {
1766
- "name": "findConversions",
1767
- "async": true,
1626
+ "isConversion": {
1627
+ "name": "isConversion",
1628
+ "async": false,
1768
1629
  "parameters": [],
1769
- "returnType": "Promise<AdEvent[]>",
1770
- "isStatic": false,
1771
- "isPublic": true
1772
- },
1773
- "getVariationStats": {
1774
- "name": "getVariationStats",
1775
- "async": true,
1776
- "parameters": [
1777
- {
1778
- "name": "variationId",
1779
- "type": "string",
1780
- "optional": false
1781
- }
1782
- ],
1783
- "returnType": "Promise<object>",
1784
- "isStatic": false,
1785
- "isPublic": true
1786
- },
1787
- "findByTenant": {
1788
- "name": "findByTenant",
1789
- "async": true,
1790
- "parameters": [
1791
- {
1792
- "name": "tenantId",
1793
- "type": "string",
1794
- "optional": false
1795
- }
1796
- ],
1797
- "returnType": "Promise<AdEvent[]>",
1798
- "isStatic": false,
1799
- "isPublic": true
1800
- },
1801
- "findGlobal": {
1802
- "name": "findGlobal",
1803
- "async": true,
1804
- "parameters": [],
1805
- "returnType": "Promise<AdEvent[]>",
1806
- "isStatic": false,
1807
- "isPublic": true
1808
- },
1809
- "findWithGlobals": {
1810
- "name": "findWithGlobals",
1811
- "async": true,
1812
- "parameters": [
1813
- {
1814
- "name": "tenantId",
1815
- "type": "string",
1816
- "optional": false
1817
- }
1818
- ],
1819
- "returnType": "Promise<AdEvent[]>",
1630
+ "returnType": "boolean",
1820
1631
  "isStatic": false,
1821
1632
  "isPublic": true
1822
1633
  }
1823
1634
  },
1824
1635
  "decoratorConfig": {
1636
+ "tableStrategy": "sti",
1825
1637
  "api": {
1826
1638
  "include": [
1827
1639
  "create",
@@ -1833,12 +1645,20 @@
1833
1645
  "create"
1834
1646
  ]
1835
1647
  },
1836
- "cli": false
1648
+ "cli": false,
1649
+ "tenantScoped": {
1650
+ "mode": "optional"
1651
+ },
1652
+ "conflictColumns": [
1653
+ "tenant_id",
1654
+ "slug",
1655
+ "context",
1656
+ "_meta_type"
1657
+ ]
1837
1658
  },
1838
- "extends": "SmrtCollection",
1839
- "extendsTypeArg": "AdEvent",
1840
- "exportName": "AdEventCollection",
1841
- "collectionExportName": "AdEventCollectionCollection",
1659
+ "extends": "SmrtObject",
1660
+ "exportName": "AdEvent",
1661
+ "collectionExportName": "AdEventCollection",
1842
1662
  "schema": {
1843
1663
  "tableName": "ad_events",
1844
1664
  "ddl": "CREATE TABLE IF NOT EXISTS \"ad_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 \"variation_id\" UUID,\n \"zone_id\" UUID,\n \"site_id\" TEXT DEFAULT '',\n \"event_type\" TEXT,\n \"timestamp\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT ''\n);",
@@ -1958,18 +1778,76 @@
1958
1778
  },
1959
1779
  "importPath": "@happyvertical/smrt-ads"
1960
1780
  },
1961
- "@happyvertical/smrt-ads:AdFormatCollection": {
1962
- "name": "adformatcollection",
1963
- "className": "AdFormatCollection",
1964
- "qualifiedName": "@happyvertical/smrt-ads:AdFormatCollection",
1781
+ "@happyvertical/smrt-ads:AdFormat": {
1782
+ "name": "adformat",
1783
+ "className": "AdFormat",
1784
+ "qualifiedName": "@happyvertical/smrt-ads:AdFormat",
1965
1785
  "collection": "adformats",
1966
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdFormatCollection.ts",
1786
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdFormat.ts",
1967
1787
  "packageName": "@happyvertical/smrt-ads",
1968
- "fields": {},
1788
+ "fields": {
1789
+ "name": {
1790
+ "type": "text",
1791
+ "required": false,
1792
+ "default": "",
1793
+ "description": "What the size is called, for example Leaderboard.",
1794
+ "_meta": {
1795
+ "description": "What the size is called, for example Leaderboard."
1796
+ }
1797
+ },
1798
+ "width": {
1799
+ "type": "integer",
1800
+ "required": false,
1801
+ "default": 0,
1802
+ "description": "How wide the ad is, in pixels.",
1803
+ "_meta": {
1804
+ "description": "How wide the ad is, in pixels."
1805
+ }
1806
+ },
1807
+ "height": {
1808
+ "type": "integer",
1809
+ "required": false,
1810
+ "default": 0,
1811
+ "description": "How tall the ad is, in pixels.",
1812
+ "_meta": {
1813
+ "description": "How tall the ad is, in pixels."
1814
+ }
1815
+ },
1816
+ "formatType": {
1817
+ "type": "text",
1818
+ "required": false,
1819
+ "description": "What kind of ad fits this size: a picture, a piece written to look like your own content, or a video.",
1820
+ "_meta": {
1821
+ "description": "What kind of ad fits this size: a picture, a piece written to look like your own content, or a video."
1822
+ },
1823
+ "enum": [
1824
+ "banner",
1825
+ "native",
1826
+ "video"
1827
+ ]
1828
+ },
1829
+ "description": {
1830
+ "type": "text",
1831
+ "required": false,
1832
+ "default": "",
1833
+ "description": "A note about where this size is usually used.",
1834
+ "_meta": {
1835
+ "description": "A note about where this size is usually used."
1836
+ }
1837
+ }
1838
+ },
1969
1839
  "methods": {
1970
- "findByDimensions": {
1971
- "name": "findByDimensions",
1972
- "async": true,
1840
+ "getDimensions": {
1841
+ "name": "getDimensions",
1842
+ "async": false,
1843
+ "parameters": [],
1844
+ "returnType": "string",
1845
+ "isStatic": false,
1846
+ "isPublic": true
1847
+ },
1848
+ "matchesDimensions": {
1849
+ "name": "matchesDimensions",
1850
+ "async": false,
1973
1851
  "parameters": [
1974
1852
  {
1975
1853
  "name": "width",
@@ -1982,45 +1860,7 @@
1982
1860
  "optional": false
1983
1861
  }
1984
1862
  ],
1985
- "returnType": "Promise<AdFormat | null>",
1986
- "isStatic": false,
1987
- "isPublic": true
1988
- },
1989
- "findByType": {
1990
- "name": "findByType",
1991
- "async": true,
1992
- "parameters": [
1993
- {
1994
- "name": "formatType",
1995
- "type": "AdFormatType",
1996
- "optional": false
1997
- }
1998
- ],
1999
- "returnType": "Promise<AdFormat[]>",
2000
- "isStatic": false,
2001
- "isPublic": true
2002
- },
2003
- "findBanners": {
2004
- "name": "findBanners",
2005
- "async": true,
2006
- "parameters": [],
2007
- "returnType": "Promise<AdFormat[]>",
2008
- "isStatic": false,
2009
- "isPublic": true
2010
- },
2011
- "findNative": {
2012
- "name": "findNative",
2013
- "async": true,
2014
- "parameters": [],
2015
- "returnType": "Promise<AdFormat[]>",
2016
- "isStatic": false,
2017
- "isPublic": true
2018
- },
2019
- "findVideo": {
2020
- "name": "findVideo",
2021
- "async": true,
2022
- "parameters": [],
2023
- "returnType": "Promise<AdFormat[]>",
1863
+ "returnType": "boolean",
2024
1864
  "isStatic": false,
2025
1865
  "isPublic": true
2026
1866
  }
@@ -2039,12 +1879,15 @@
2039
1879
  "list",
2040
1880
  "get"
2041
1881
  ]
1882
+ },
1883
+ "cli": {
1884
+ "skipApiCheck": true
2042
1885
  }
2043
1886
  },
2044
- "extends": "SmrtCollection",
2045
- "extendsTypeArg": "AdFormat",
2046
- "exportName": "AdFormatCollection",
2047
- "collectionExportName": "AdFormatCollectionCollection",
1887
+ "extends": "SmrtObject",
1888
+ "exportName": "AdFormat",
1889
+ "collectionExportName": "AdFormatCollection",
1890
+ "displayLabelField": "name",
2048
1891
  "schema": {
2049
1892
  "tableName": "ad_formats",
2050
1893
  "ddl": "CREATE TABLE IF NOT EXISTS \"ad_formats\" (\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 \"name\" TEXT DEFAULT '',\n \"width\" INTEGER DEFAULT 0,\n \"height\" INTEGER DEFAULT 0,\n \"format_type\" TEXT,\n \"description\" TEXT DEFAULT ''\n);",
@@ -2124,82 +1967,191 @@
2124
1967
  },
2125
1968
  "importPath": "@happyvertical/smrt-ads"
2126
1969
  },
2127
- "@happyvertical/smrt-ads:AdGroupCollection": {
2128
- "name": "adgroupcollection",
2129
- "className": "AdGroupCollection",
2130
- "qualifiedName": "@happyvertical/smrt-ads:AdGroupCollection",
1970
+ "@happyvertical/smrt-ads:AdGroup": {
1971
+ "name": "adgroup",
1972
+ "className": "AdGroup",
1973
+ "qualifiedName": "@happyvertical/smrt-ads:AdGroup",
2131
1974
  "collection": "adgroups",
2132
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdGroupCollection.ts",
1975
+ "description": "AdGroup organizes ad creatives with targeting and budget controls.",
1976
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdGroup.ts",
2133
1977
  "packageName": "@happyvertical/smrt-ads",
2134
- "fields": {},
2135
- "methods": {
2136
- "findByContract": {
2137
- "name": "findByContract",
2138
- "async": true,
2139
- "parameters": [
2140
- {
2141
- "name": "contractId",
2142
- "type": "string",
2143
- "optional": false
2144
- }
2145
- ],
2146
- "returnType": "Promise<AdGroup[]>",
2147
- "isStatic": false,
2148
- "isPublic": true
1978
+ "fields": {
1979
+ "created_at": {
1980
+ "type": "datetime",
1981
+ "required": false
2149
1982
  },
2150
- "findByTier": {
2151
- "name": "findByTier",
2152
- "async": true,
2153
- "parameters": [
2154
- {
2155
- "name": "tierId",
2156
- "type": "string",
2157
- "optional": false
1983
+ "updated_at": {
1984
+ "type": "datetime",
1985
+ "required": false
1986
+ },
1987
+ "tenantId": {
1988
+ "type": "text",
1989
+ "required": false,
1990
+ "_meta": {
1991
+ "sqlType": "UUID",
1992
+ "nullable": true,
1993
+ "__tenancy": {
1994
+ "isTenantIdField": true,
1995
+ "autoFilter": true,
1996
+ "required": false,
1997
+ "autoPopulate": true,
1998
+ "nullable": true,
1999
+ "mode": "optional",
2000
+ "field": "tenantId",
2001
+ "allowSuperAdminBypass": false
2158
2002
  }
2159
- ],
2160
- "returnType": "Promise<AdGroup[]>",
2161
- "isStatic": false,
2162
- "isPublic": true
2003
+ }
2163
2004
  },
2164
- "findByStatus": {
2165
- "name": "findByStatus",
2166
- "async": true,
2005
+ "contractId": {
2006
+ "type": "crossPackageRef",
2007
+ "required": false,
2008
+ "related": "@happyvertical/smrt-commerce:SalesContract",
2009
+ "description": "The sales contract this campaign is sold under, if there is one.",
2010
+ "_meta": {
2011
+ "description": "The sales contract this campaign is sold under, if there is one.",
2012
+ "validateSubtype": true
2013
+ }
2014
+ },
2015
+ "tierId": {
2016
+ "type": "foreignKey",
2017
+ "required": false,
2018
+ "related": "AdDeliveryTier",
2019
+ "description": "The priority tier the campaign runs in. Tiers are tried in order when more than one campaign could show.",
2020
+ "_meta": {
2021
+ "description": "The priority tier the campaign runs in. Tiers are tried in order when more than one campaign could show."
2022
+ }
2023
+ },
2024
+ "name": {
2025
+ "type": "text",
2026
+ "required": false,
2027
+ "default": "",
2028
+ "description": "What you call the campaign, for example Summer sale.",
2029
+ "_meta": {
2030
+ "description": "What you call the campaign, for example Summer sale."
2031
+ }
2032
+ },
2033
+ "verticalSlug": {
2034
+ "type": "text",
2035
+ "required": false,
2036
+ "default": "",
2037
+ "description": "The category the campaign belongs to, such as retail.",
2038
+ "_meta": {
2039
+ "description": "The category the campaign belongs to, such as retail."
2040
+ }
2041
+ },
2042
+ "targeting": {
2043
+ "type": "text",
2044
+ "required": false,
2045
+ "default": ""
2046
+ },
2047
+ "zoneIds": {
2048
+ "type": "text",
2049
+ "required": false,
2050
+ "default": ""
2051
+ },
2052
+ "startDate": {
2053
+ "type": "datetime",
2054
+ "required": false,
2055
+ "description": "The first day the campaign can show.",
2056
+ "_meta": {
2057
+ "description": "The first day the campaign can show."
2058
+ }
2059
+ },
2060
+ "endDate": {
2061
+ "type": "datetime",
2062
+ "required": false,
2063
+ "description": "The last day the campaign can show.",
2064
+ "_meta": {
2065
+ "description": "The last day the campaign can show."
2066
+ }
2067
+ },
2068
+ "dailyBudget": {
2069
+ "type": "decimal",
2070
+ "required": false,
2071
+ "default": 0,
2072
+ "description": "The most to spend in one day. The app shows this but does not stop the campaign by itself.",
2073
+ "_meta": {
2074
+ "description": "The most to spend in one day. The app shows this but does not stop the campaign by itself."
2075
+ }
2076
+ },
2077
+ "totalBudget": {
2078
+ "type": "decimal",
2079
+ "required": false,
2080
+ "default": 0,
2081
+ "description": "The most to spend over the whole campaign.",
2082
+ "_meta": {
2083
+ "description": "The most to spend over the whole campaign."
2084
+ }
2085
+ },
2086
+ "status": {
2087
+ "type": "text",
2088
+ "required": false,
2089
+ "description": "Where the campaign stands: draft, active, paused or completed. Only active campaigns show ads.",
2090
+ "_meta": {
2091
+ "description": "Where the campaign stands: draft, active, paused or completed. Only active campaigns show ads."
2092
+ },
2093
+ "enum": [
2094
+ "draft",
2095
+ "active",
2096
+ "paused",
2097
+ "completed"
2098
+ ]
2099
+ }
2100
+ },
2101
+ "methods": {
2102
+ "getZoneIds": {
2103
+ "name": "getZoneIds",
2104
+ "async": false,
2105
+ "parameters": [],
2106
+ "returnType": "string[]",
2107
+ "isStatic": false,
2108
+ "isPublic": true
2109
+ },
2110
+ "setZoneIds": {
2111
+ "name": "setZoneIds",
2112
+ "async": false,
2167
2113
  "parameters": [
2168
2114
  {
2169
- "name": "status",
2170
- "type": "AdGroupStatus",
2115
+ "name": "ids",
2116
+ "type": "string[]",
2171
2117
  "optional": false
2172
2118
  }
2173
2119
  ],
2174
- "returnType": "Promise<AdGroup[]>",
2120
+ "returnType": "void",
2175
2121
  "isStatic": false,
2176
2122
  "isPublic": true
2177
2123
  },
2178
- "findActive": {
2179
- "name": "findActive",
2180
- "async": true,
2181
- "parameters": [],
2182
- "returnType": "Promise<AdGroup[]>",
2124
+ "addZoneId": {
2125
+ "name": "addZoneId",
2126
+ "async": false,
2127
+ "parameters": [
2128
+ {
2129
+ "name": "zoneId",
2130
+ "type": "string",
2131
+ "optional": false
2132
+ }
2133
+ ],
2134
+ "returnType": "void",
2183
2135
  "isStatic": false,
2184
2136
  "isPublic": true
2185
2137
  },
2186
- "findByVertical": {
2187
- "name": "findByVertical",
2188
- "async": true,
2138
+ "removeZoneId": {
2139
+ "name": "removeZoneId",
2140
+ "async": false,
2189
2141
  "parameters": [
2190
2142
  {
2191
- "name": "verticalSlug",
2143
+ "name": "zoneId",
2192
2144
  "type": "string",
2193
2145
  "optional": false
2194
2146
  }
2195
2147
  ],
2196
- "returnType": "Promise<AdGroup[]>",
2148
+ "returnType": "void",
2197
2149
  "isStatic": false,
2198
2150
  "isPublic": true
2199
2151
  },
2200
- "findByZone": {
2201
- "name": "findByZone",
2202
- "async": true,
2152
+ "hasZoneId": {
2153
+ "name": "hasZoneId",
2154
+ "async": false,
2203
2155
  "parameters": [
2204
2156
  {
2205
2157
  "name": "zoneId",
@@ -2207,86 +2159,83 @@
2207
2159
  "optional": false
2208
2160
  }
2209
2161
  ],
2210
- "returnType": "Promise<AdGroup[]>",
2162
+ "returnType": "boolean",
2211
2163
  "isStatic": false,
2212
2164
  "isPublic": true
2213
2165
  },
2214
- "findEligibleForZone": {
2215
- "name": "findEligibleForZone",
2216
- "async": true,
2166
+ "getTargeting": {
2167
+ "name": "getTargeting",
2168
+ "async": false,
2169
+ "parameters": [],
2170
+ "returnType": "Record<string, unknown>",
2171
+ "isStatic": false,
2172
+ "isPublic": true
2173
+ },
2174
+ "setTargeting": {
2175
+ "name": "setTargeting",
2176
+ "async": false,
2217
2177
  "parameters": [
2218
2178
  {
2219
- "name": "zoneId",
2220
- "type": "string",
2179
+ "name": "rules",
2180
+ "type": "Record<string, unknown>",
2221
2181
  "optional": false
2222
2182
  }
2223
2183
  ],
2224
- "returnType": "Promise<AdGroup[]>",
2184
+ "returnType": "void",
2225
2185
  "isStatic": false,
2226
2186
  "isPublic": true
2227
2187
  },
2228
- "findDrafts": {
2229
- "name": "findDrafts",
2230
- "async": true,
2188
+ "isActive": {
2189
+ "name": "isActive",
2190
+ "async": false,
2231
2191
  "parameters": [],
2232
- "returnType": "Promise<AdGroup[]>",
2192
+ "returnType": "boolean",
2233
2193
  "isStatic": false,
2234
2194
  "isPublic": true
2235
2195
  },
2236
- "findPaused": {
2237
- "name": "findPaused",
2238
- "async": true,
2196
+ "isDraft": {
2197
+ "name": "isDraft",
2198
+ "async": false,
2239
2199
  "parameters": [],
2240
- "returnType": "Promise<AdGroup[]>",
2200
+ "returnType": "boolean",
2241
2201
  "isStatic": false,
2242
2202
  "isPublic": true
2243
2203
  },
2244
- "findCompleted": {
2245
- "name": "findCompleted",
2246
- "async": true,
2204
+ "isPaused": {
2205
+ "name": "isPaused",
2206
+ "async": false,
2247
2207
  "parameters": [],
2248
- "returnType": "Promise<AdGroup[]>",
2208
+ "returnType": "boolean",
2249
2209
  "isStatic": false,
2250
2210
  "isPublic": true
2251
2211
  },
2252
- "findByTenant": {
2253
- "name": "findByTenant",
2254
- "async": true,
2255
- "parameters": [
2256
- {
2257
- "name": "tenantId",
2258
- "type": "string",
2259
- "optional": false
2260
- }
2261
- ],
2262
- "returnType": "Promise<AdGroup[]>",
2212
+ "isCompleted": {
2213
+ "name": "isCompleted",
2214
+ "async": false,
2215
+ "parameters": [],
2216
+ "returnType": "boolean",
2263
2217
  "isStatic": false,
2264
2218
  "isPublic": true
2265
2219
  },
2266
- "findGlobal": {
2267
- "name": "findGlobal",
2268
- "async": true,
2220
+ "hasEnded": {
2221
+ "name": "hasEnded",
2222
+ "async": false,
2269
2223
  "parameters": [],
2270
- "returnType": "Promise<AdGroup[]>",
2224
+ "returnType": "boolean",
2271
2225
  "isStatic": false,
2272
2226
  "isPublic": true
2273
2227
  },
2274
- "findWithGlobals": {
2275
- "name": "findWithGlobals",
2276
- "async": true,
2277
- "parameters": [
2278
- {
2279
- "name": "tenantId",
2280
- "type": "string",
2281
- "optional": false
2282
- }
2283
- ],
2284
- "returnType": "Promise<AdGroup[]>",
2228
+ "hasStarted": {
2229
+ "name": "hasStarted",
2230
+ "async": false,
2231
+ "parameters": [],
2232
+ "returnType": "boolean",
2285
2233
  "isStatic": false,
2286
2234
  "isPublic": true
2287
2235
  }
2288
2236
  },
2289
2237
  "decoratorConfig": {
2238
+ "tableStrategy": "sti",
2290
2239
  "api": {
2291
2240
  "include": [
2292
2241
  "list",
@@ -2301,15 +2250,27 @@
2301
2250
  "get",
2302
2251
  "create"
2303
2252
  ]
2304
- }
2253
+ },
2254
+ "cli": {
2255
+ "skipApiCheck": true
2256
+ },
2257
+ "tenantScoped": {
2258
+ "mode": "optional"
2259
+ },
2260
+ "conflictColumns": [
2261
+ "tenant_id",
2262
+ "slug",
2263
+ "context",
2264
+ "_meta_type"
2265
+ ]
2305
2266
  },
2306
- "extends": "SmrtCollection",
2307
- "extendsTypeArg": "AdGroup",
2308
- "exportName": "AdGroupCollection",
2309
- "collectionExportName": "AdGroupCollectionCollection",
2310
- "schema": {
2311
- "tableName": "ad_groups",
2312
- "ddl": "CREATE TABLE IF NOT EXISTS \"ad_groups\" (\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 \"contract_id\" UUID,\n \"tier_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"vertical_slug\" TEXT DEFAULT '',\n \"targeting\" TEXT DEFAULT '',\n \"zone_ids\" TEXT DEFAULT '',\n \"start_date\" TIMESTAMP,\n \"end_date\" TIMESTAMP,\n \"daily_budget\" REAL DEFAULT 0,\n \"total_budget\" REAL DEFAULT 0,\n \"status\" TEXT\n);",
2267
+ "extends": "SmrtObject",
2268
+ "exportName": "AdGroup",
2269
+ "collectionExportName": "AdGroupCollection",
2270
+ "displayLabelField": "name",
2271
+ "schema": {
2272
+ "tableName": "ad_groups",
2273
+ "ddl": "CREATE TABLE IF NOT EXISTS \"ad_groups\" (\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 \"contract_id\" UUID,\n \"tier_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"vertical_slug\" TEXT DEFAULT '',\n \"targeting\" TEXT DEFAULT '',\n \"zone_ids\" TEXT DEFAULT '',\n \"start_date\" TIMESTAMP,\n \"end_date\" TIMESTAMP,\n \"daily_budget\" REAL DEFAULT 0,\n \"total_budget\" REAL DEFAULT 0,\n \"status\" TEXT\n);",
2313
2274
  "columns": {
2314
2275
  "id": {
2315
2276
  "type": "UUID",
@@ -2450,161 +2411,188 @@
2450
2411
  },
2451
2412
  "importPath": "@happyvertical/smrt-ads"
2452
2413
  },
2453
- "@happyvertical/smrt-ads:AdVariationCollection": {
2454
- "name": "advariationcollection",
2455
- "className": "AdVariationCollection",
2456
- "qualifiedName": "@happyvertical/smrt-ads:AdVariationCollection",
2414
+ "@happyvertical/smrt-ads:AdVariation": {
2415
+ "name": "advariation",
2416
+ "className": "AdVariation",
2417
+ "qualifiedName": "@happyvertical/smrt-ads:AdVariation",
2457
2418
  "collection": "advariations",
2458
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdVariationCollection.ts",
2419
+ "description": "AdVariation represents a creative asset within an ad group. Supports A/B testing via weighted selection.",
2420
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdVariation.ts",
2459
2421
  "packageName": "@happyvertical/smrt-ads",
2460
- "fields": {},
2461
- "methods": {
2462
- "findByGroup": {
2463
- "name": "findByGroup",
2464
- "async": true,
2465
- "parameters": [
2466
- {
2467
- "name": "groupId",
2468
- "type": "string",
2469
- "optional": false
2470
- }
2471
- ],
2472
- "returnType": "Promise<AdVariation[]>",
2473
- "isStatic": false,
2474
- "isPublic": true
2422
+ "fields": {
2423
+ "created_at": {
2424
+ "type": "datetime",
2425
+ "required": false
2475
2426
  },
2476
- "findByFormat": {
2477
- "name": "findByFormat",
2478
- "async": true,
2479
- "parameters": [
2480
- {
2481
- "name": "formatId",
2482
- "type": "string",
2483
- "optional": false
2484
- }
2485
- ],
2486
- "returnType": "Promise<AdVariation[]>",
2487
- "isStatic": false,
2488
- "isPublic": true
2427
+ "updated_at": {
2428
+ "type": "datetime",
2429
+ "required": false
2489
2430
  },
2490
- "findActiveByGroup": {
2491
- "name": "findActiveByGroup",
2492
- "async": true,
2493
- "parameters": [
2494
- {
2495
- "name": "groupId",
2496
- "type": "string",
2497
- "optional": false
2431
+ "tenantId": {
2432
+ "type": "text",
2433
+ "required": false,
2434
+ "_meta": {
2435
+ "sqlType": "UUID",
2436
+ "nullable": true,
2437
+ "__tenancy": {
2438
+ "isTenantIdField": true,
2439
+ "autoFilter": true,
2440
+ "required": false,
2441
+ "autoPopulate": true,
2442
+ "nullable": true,
2443
+ "mode": "optional",
2444
+ "field": "tenantId",
2445
+ "allowSuperAdminBypass": false
2498
2446
  }
2499
- ],
2500
- "returnType": "Promise<AdVariation[]>",
2501
- "isStatic": false,
2502
- "isPublic": true
2447
+ }
2503
2448
  },
2504
- "selectByWeight": {
2505
- "name": "selectByWeight",
2506
- "async": true,
2507
- "parameters": [
2508
- {
2509
- "name": "groupId",
2510
- "type": "string",
2511
- "optional": false
2512
- }
2513
- ],
2514
- "returnType": "Promise<AdVariation | null>",
2515
- "isStatic": false,
2516
- "isPublic": true
2449
+ "groupId": {
2450
+ "type": "foreignKey",
2451
+ "required": false,
2452
+ "related": "AdGroup",
2453
+ "description": "The campaign this ad belongs to.",
2454
+ "_meta": {
2455
+ "description": "The campaign this ad belongs to."
2456
+ }
2517
2457
  },
2518
- "findByStatus": {
2519
- "name": "findByStatus",
2520
- "async": true,
2521
- "parameters": [
2522
- {
2523
- "name": "status",
2524
- "type": "AdVariationStatus",
2525
- "optional": false
2526
- }
2527
- ],
2528
- "returnType": "Promise<AdVariation[]>",
2529
- "isStatic": false,
2530
- "isPublic": true
2458
+ "formatId": {
2459
+ "type": "foreignKey",
2460
+ "required": false,
2461
+ "related": "AdFormat",
2462
+ "description": "The ad size this ad is made for.",
2463
+ "_meta": {
2464
+ "description": "The ad size this ad is made for."
2465
+ }
2531
2466
  },
2532
- "findActive": {
2533
- "name": "findActive",
2534
- "async": true,
2535
- "parameters": [],
2536
- "returnType": "Promise<AdVariation[]>",
2537
- "isStatic": false,
2538
- "isPublic": true
2467
+ "assetId": {
2468
+ "type": "crossPackageRef",
2469
+ "required": false,
2470
+ "related": "@happyvertical/smrt-assets:Asset",
2471
+ "description": "The picture people see.",
2472
+ "_meta": {
2473
+ "description": "The picture people see."
2474
+ }
2539
2475
  },
2540
- "findDrafts": {
2541
- "name": "findDrafts",
2542
- "async": true,
2476
+ "name": {
2477
+ "type": "text",
2478
+ "required": false,
2479
+ "default": "",
2480
+ "description": "What you call this ad, for example Version A, blue button.",
2481
+ "_meta": {
2482
+ "description": "What you call this ad, for example Version A, blue button."
2483
+ }
2484
+ },
2485
+ "clickUrl": {
2486
+ "type": "text",
2487
+ "required": false,
2488
+ "default": "",
2489
+ "description": "The web address people go to when they tap the ad.",
2490
+ "_meta": {
2491
+ "description": "The web address people go to when they tap the ad."
2492
+ }
2493
+ },
2494
+ "altText": {
2495
+ "type": "text",
2496
+ "required": false,
2497
+ "default": "",
2498
+ "description": "A few words that describe the picture for people who cannot see it.",
2499
+ "_meta": {
2500
+ "description": "A few words that describe the picture for people who cannot see it."
2501
+ }
2502
+ },
2503
+ "weight": {
2504
+ "type": "integer",
2505
+ "required": false,
2506
+ "default": 1,
2507
+ "description": "How often this ad shows compared with the others in its campaign: an ad with weight 2 shows twice as often as one with weight 1.",
2508
+ "_meta": {
2509
+ "description": "How often this ad shows compared with the others in its campaign: an ad with weight 2 shows twice as often as one with weight 1."
2510
+ }
2511
+ },
2512
+ "status": {
2513
+ "type": "text",
2514
+ "required": false,
2515
+ "description": "Where the ad stands: draft, active or paused. Only active ads show.",
2516
+ "_meta": {
2517
+ "description": "Where the ad stands: draft, active or paused. Only active ads show."
2518
+ },
2519
+ "enum": [
2520
+ "draft",
2521
+ "active",
2522
+ "paused"
2523
+ ]
2524
+ },
2525
+ "impressions": {
2526
+ "type": "integer",
2527
+ "required": false,
2528
+ "default": 0,
2529
+ "description": "How many times the ad has been shown. The app counts this as it serves ads and refreshes it a little later.",
2530
+ "_meta": {
2531
+ "description": "How many times the ad has been shown. The app counts this as it serves ads and refreshes it a little later."
2532
+ }
2533
+ },
2534
+ "clicks": {
2535
+ "type": "integer",
2536
+ "required": false,
2537
+ "default": 0,
2538
+ "description": "How many times the ad has been tapped. The app counts this as it serves ads and refreshes it a little later.",
2539
+ "_meta": {
2540
+ "description": "How many times the ad has been tapped. The app counts this as it serves ads and refreshes it a little later."
2541
+ }
2542
+ }
2543
+ },
2544
+ "methods": {
2545
+ "isActive": {
2546
+ "name": "isActive",
2547
+ "async": false,
2543
2548
  "parameters": [],
2544
- "returnType": "Promise<AdVariation[]>",
2549
+ "returnType": "boolean",
2545
2550
  "isStatic": false,
2546
2551
  "isPublic": true
2547
2552
  },
2548
- "findPaused": {
2549
- "name": "findPaused",
2550
- "async": true,
2553
+ "isDraft": {
2554
+ "name": "isDraft",
2555
+ "async": false,
2551
2556
  "parameters": [],
2552
- "returnType": "Promise<AdVariation[]>",
2557
+ "returnType": "boolean",
2553
2558
  "isStatic": false,
2554
2559
  "isPublic": true
2555
2560
  },
2556
- "findTopPerformers": {
2557
- "name": "findTopPerformers",
2558
- "async": true,
2559
- "parameters": [
2560
- {
2561
- "name": "limit",
2562
- "type": "number",
2563
- "optional": true
2564
- }
2565
- ],
2566
- "returnType": "Promise<AdVariation[]>",
2561
+ "isPaused": {
2562
+ "name": "isPaused",
2563
+ "async": false,
2564
+ "parameters": [],
2565
+ "returnType": "boolean",
2567
2566
  "isStatic": false,
2568
2567
  "isPublic": true
2569
2568
  },
2570
- "findByTenant": {
2571
- "name": "findByTenant",
2572
- "async": true,
2573
- "parameters": [
2574
- {
2575
- "name": "tenantId",
2576
- "type": "string",
2577
- "optional": false
2578
- }
2579
- ],
2580
- "returnType": "Promise<AdVariation[]>",
2569
+ "getCTR": {
2570
+ "name": "getCTR",
2571
+ "async": false,
2572
+ "parameters": [],
2573
+ "returnType": "number",
2581
2574
  "isStatic": false,
2582
2575
  "isPublic": true
2583
2576
  },
2584
- "findGlobal": {
2585
- "name": "findGlobal",
2586
- "async": true,
2577
+ "recordImpression": {
2578
+ "name": "recordImpression",
2579
+ "async": false,
2587
2580
  "parameters": [],
2588
- "returnType": "Promise<AdVariation[]>",
2581
+ "returnType": "void",
2589
2582
  "isStatic": false,
2590
2583
  "isPublic": true
2591
2584
  },
2592
- "findWithGlobals": {
2593
- "name": "findWithGlobals",
2594
- "async": true,
2595
- "parameters": [
2596
- {
2597
- "name": "tenantId",
2598
- "type": "string",
2599
- "optional": false
2600
- }
2601
- ],
2602
- "returnType": "Promise<AdVariation[]>",
2585
+ "recordClick": {
2586
+ "name": "recordClick",
2587
+ "async": false,
2588
+ "parameters": [],
2589
+ "returnType": "void",
2603
2590
  "isStatic": false,
2604
2591
  "isPublic": true
2605
2592
  }
2606
2593
  },
2607
2594
  "decoratorConfig": {
2595
+ "tableStrategy": "sti",
2608
2596
  "api": {
2609
2597
  "include": [
2610
2598
  "list",
@@ -2619,12 +2607,24 @@
2619
2607
  "get",
2620
2608
  "create"
2621
2609
  ]
2622
- }
2610
+ },
2611
+ "cli": {
2612
+ "skipApiCheck": true
2613
+ },
2614
+ "tenantScoped": {
2615
+ "mode": "optional"
2616
+ },
2617
+ "conflictColumns": [
2618
+ "tenant_id",
2619
+ "slug",
2620
+ "context",
2621
+ "_meta_type"
2622
+ ]
2623
2623
  },
2624
- "extends": "SmrtCollection",
2625
- "extendsTypeArg": "AdVariation",
2626
- "exportName": "AdVariationCollection",
2627
- "collectionExportName": "AdVariationCollectionCollection",
2624
+ "extends": "SmrtObject",
2625
+ "exportName": "AdVariation",
2626
+ "collectionExportName": "AdVariationCollection",
2627
+ "displayLabelField": "name",
2628
2628
  "schema": {
2629
2629
  "tableName": "ad_variations",
2630
2630
  "ddl": "CREATE TABLE IF NOT EXISTS \"ad_variations\" (\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 \"group_id\" UUID,\n \"format_id\" UUID,\n \"asset_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"click_url\" TEXT DEFAULT '',\n \"alt_text\" TEXT DEFAULT '',\n \"weight\" INTEGER DEFAULT 1,\n \"status\" TEXT,\n \"impressions\" INTEGER DEFAULT 0,\n \"clicks\" INTEGER DEFAULT 0\n);",