@happyvertical/smrt-ads 0.57.37 → 0.57.39

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,68 +2,86 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-ads",
5
- "packageVersion": "0.57.37",
5
+ "packageVersion": "0.57.39",
6
6
  "objects": {
7
- "@happyvertical/smrt-ads:AdDeliveryTierCollection": {
8
- "name": "addeliverytiercollection",
9
- "className": "AdDeliveryTierCollection",
10
- "qualifiedName": "@happyvertical/smrt-ads:AdDeliveryTierCollection",
7
+ "@happyvertical/smrt-ads:AdDeliveryTier": {
8
+ "name": "addeliverytier",
9
+ "className": "AdDeliveryTier",
10
+ "qualifiedName": "@happyvertical/smrt-ads:AdDeliveryTier",
11
11
  "collection": "addeliverytiers",
12
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdDeliveryTierCollection.ts",
12
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdDeliveryTier.ts",
13
13
  "packageName": "@happyvertical/smrt-ads",
14
- "fields": {},
15
- "methods": {
16
- "findByPriority": {
17
- "name": "findByPriority",
18
- "async": true,
19
- "parameters": [],
20
- "returnType": "Promise<AdDeliveryTier[]>",
21
- "isStatic": false,
22
- "isPublic": true
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
23
  },
24
- "findByPricingModel": {
25
- "name": "findByPricingModel",
26
- "async": true,
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
+ },
57
+ "methods": {
58
+ "isHigherPriorityThan": {
59
+ "name": "isHigherPriorityThan",
60
+ "async": false,
27
61
  "parameters": [
28
62
  {
29
- "name": "pricingModel",
30
- "type": "PricingModel",
63
+ "name": "other",
64
+ "type": "AdDeliveryTier",
31
65
  "optional": false
32
66
  }
33
67
  ],
34
- "returnType": "Promise<AdDeliveryTier[]>",
35
- "isStatic": false,
36
- "isPublic": true
37
- },
38
- "getHighestPriority": {
39
- "name": "getHighestPriority",
40
- "async": true,
41
- "parameters": [],
42
- "returnType": "Promise<AdDeliveryTier | null>",
43
- "isStatic": false,
44
- "isPublic": true
45
- },
46
- "findFixedPricing": {
47
- "name": "findFixedPricing",
48
- "async": true,
49
- "parameters": [],
50
- "returnType": "Promise<AdDeliveryTier[]>",
68
+ "returnType": "boolean",
51
69
  "isStatic": false,
52
70
  "isPublic": true
53
71
  },
54
- "findCPM": {
55
- "name": "findCPM",
56
- "async": true,
72
+ "isFixedPricing": {
73
+ "name": "isFixedPricing",
74
+ "async": false,
57
75
  "parameters": [],
58
- "returnType": "Promise<AdDeliveryTier[]>",
76
+ "returnType": "boolean",
59
77
  "isStatic": false,
60
78
  "isPublic": true
61
79
  },
62
- "findPerformanceBased": {
63
- "name": "findPerformanceBased",
64
- "async": true,
80
+ "isPerformanceBased": {
81
+ "name": "isPerformanceBased",
82
+ "async": false,
65
83
  "parameters": [],
66
- "returnType": "Promise<AdDeliveryTier[]>",
84
+ "returnType": "boolean",
67
85
  "isStatic": false,
68
86
  "isPublic": true
69
87
  }
@@ -82,12 +100,15 @@
82
100
  "list",
83
101
  "get"
84
102
  ]
103
+ },
104
+ "cli": {
105
+ "skipApiCheck": true
85
106
  }
86
107
  },
87
- "extends": "SmrtCollection",
88
- "extendsTypeArg": "AdDeliveryTier",
89
- "exportName": "AdDeliveryTierCollection",
90
- "collectionExportName": "AdDeliveryTierCollectionCollection",
108
+ "extends": "SmrtObject",
109
+ "exportName": "AdDeliveryTier",
110
+ "collectionExportName": "AdDeliveryTierCollection",
111
+ "displayLabelField": "name",
91
112
  "schema": {
92
113
  "tableName": "ad_delivery_tiers",
93
114
  "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);",
@@ -161,227 +182,125 @@
161
182
  },
162
183
  "importPath": "@happyvertical/smrt-ads"
163
184
  },
164
- "@happyvertical/smrt-ads:AdEventCollection": {
165
- "name": "adeventcollection",
166
- "className": "AdEventCollection",
167
- "qualifiedName": "@happyvertical/smrt-ads:AdEventCollection",
185
+ "@happyvertical/smrt-ads:AdEvent": {
186
+ "name": "adevent",
187
+ "className": "AdEvent",
188
+ "qualifiedName": "@happyvertical/smrt-ads:AdEvent",
168
189
  "collection": "adevents",
169
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdEventCollection.ts",
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",
170
192
  "packageName": "@happyvertical/smrt-ads",
171
- "fields": {},
172
- "methods": {
173
- "findByVariation": {
174
- "name": "findByVariation",
175
- "async": true,
176
- "parameters": [
177
- {
178
- "name": "variationId",
179
- "type": "string",
180
- "optional": false
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
181
217
  }
182
- ],
183
- "returnType": "Promise<AdEvent[]>",
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
+ },
254
+ "methods": {
255
+ "getMetadata": {
256
+ "name": "getMetadata",
257
+ "async": false,
258
+ "parameters": [],
259
+ "returnType": "Record<string, unknown>",
184
260
  "isStatic": false,
185
261
  "isPublic": true
186
262
  },
187
- "findByZone": {
188
- "name": "findByZone",
189
- "async": true,
263
+ "setMetadata": {
264
+ "name": "setMetadata",
265
+ "async": false,
190
266
  "parameters": [
191
267
  {
192
- "name": "zoneId",
193
- "type": "string",
268
+ "name": "data",
269
+ "type": "Record<string, unknown>",
194
270
  "optional": false
195
271
  }
196
272
  ],
197
- "returnType": "Promise<AdEvent[]>",
273
+ "returnType": "void",
198
274
  "isStatic": false,
199
275
  "isPublic": true
200
276
  },
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[]>",
277
+ "isImpression": {
278
+ "name": "isImpression",
279
+ "async": false,
280
+ "parameters": [],
281
+ "returnType": "boolean",
212
282
  "isStatic": false,
213
283
  "isPublic": true
214
284
  },
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[]>",
285
+ "isClick": {
286
+ "name": "isClick",
287
+ "async": false,
288
+ "parameters": [],
289
+ "returnType": "boolean",
231
290
  "isStatic": false,
232
291
  "isPublic": true
233
292
  },
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,
312
- "parameters": [],
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,
293
+ "isConversion": {
294
+ "name": "isConversion",
295
+ "async": false,
364
296
  "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[]>",
297
+ "returnType": "boolean",
380
298
  "isStatic": false,
381
299
  "isPublic": true
382
300
  }
383
301
  },
384
302
  "decoratorConfig": {
303
+ "tableStrategy": "sti",
385
304
  "api": {
386
305
  "include": [
387
306
  "create",
@@ -393,12 +312,20 @@
393
312
  "create"
394
313
  ]
395
314
  },
396
- "cli": false
315
+ "cli": false,
316
+ "tenantScoped": {
317
+ "mode": "optional"
318
+ },
319
+ "conflictColumns": [
320
+ "tenant_id",
321
+ "slug",
322
+ "context",
323
+ "_meta_type"
324
+ ]
397
325
  },
398
- "extends": "SmrtCollection",
399
- "extendsTypeArg": "AdEvent",
400
- "exportName": "AdEventCollection",
401
- "collectionExportName": "AdEventCollectionCollection",
326
+ "extends": "SmrtObject",
327
+ "exportName": "AdEvent",
328
+ "collectionExportName": "AdEventCollection",
402
329
  "schema": {
403
330
  "tableName": "ad_events",
404
331
  "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);",
@@ -518,18 +445,76 @@
518
445
  },
519
446
  "importPath": "@happyvertical/smrt-ads"
520
447
  },
521
- "@happyvertical/smrt-ads:AdFormatCollection": {
522
- "name": "adformatcollection",
523
- "className": "AdFormatCollection",
524
- "qualifiedName": "@happyvertical/smrt-ads:AdFormatCollection",
448
+ "@happyvertical/smrt-ads:AdFormat": {
449
+ "name": "adformat",
450
+ "className": "AdFormat",
451
+ "qualifiedName": "@happyvertical/smrt-ads:AdFormat",
525
452
  "collection": "adformats",
526
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdFormatCollection.ts",
453
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdFormat.ts",
527
454
  "packageName": "@happyvertical/smrt-ads",
528
- "fields": {},
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
+ },
529
506
  "methods": {
530
- "findByDimensions": {
531
- "name": "findByDimensions",
532
- "async": true,
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,
533
518
  "parameters": [
534
519
  {
535
520
  "name": "width",
@@ -542,69 +527,34 @@
542
527
  "optional": false
543
528
  }
544
529
  ],
545
- "returnType": "Promise<AdFormat | null>",
530
+ "returnType": "boolean",
546
531
  "isStatic": false,
547
532
  "isPublic": true
548
- },
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": {
590
- "include": [
591
- "list",
592
- "get",
593
- "create",
594
- "update"
595
- ]
533
+ }
534
+ },
535
+ "decoratorConfig": {
536
+ "api": {
537
+ "include": [
538
+ "list",
539
+ "get",
540
+ "create",
541
+ "update"
542
+ ]
596
543
  },
597
544
  "mcp": {
598
545
  "include": [
599
546
  "list",
600
547
  "get"
601
548
  ]
549
+ },
550
+ "cli": {
551
+ "skipApiCheck": true
602
552
  }
603
553
  },
604
- "extends": "SmrtCollection",
605
- "extendsTypeArg": "AdFormat",
606
- "exportName": "AdFormatCollection",
607
- "collectionExportName": "AdFormatCollectionCollection",
554
+ "extends": "SmrtObject",
555
+ "exportName": "AdFormat",
556
+ "collectionExportName": "AdFormatCollection",
557
+ "displayLabelField": "name",
608
558
  "schema": {
609
559
  "tableName": "ad_formats",
610
560
  "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);",
@@ -684,169 +634,275 @@
684
634
  },
685
635
  "importPath": "@happyvertical/smrt-ads"
686
636
  },
687
- "@happyvertical/smrt-ads:AdGroupCollection": {
688
- "name": "adgroupcollection",
689
- "className": "AdGroupCollection",
690
- "qualifiedName": "@happyvertical/smrt-ads:AdGroupCollection",
637
+ "@happyvertical/smrt-ads:AdGroup": {
638
+ "name": "adgroup",
639
+ "className": "AdGroup",
640
+ "qualifiedName": "@happyvertical/smrt-ads:AdGroup",
691
641
  "collection": "adgroups",
692
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdGroupCollection.ts",
642
+ "description": "AdGroup organizes ad creatives with targeting and budget controls.",
643
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdGroup.ts",
693
644
  "packageName": "@happyvertical/smrt-ads",
694
- "fields": {},
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
+ },
695
768
  "methods": {
696
- "findByContract": {
697
- "name": "findByContract",
698
- "async": true,
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,
699
780
  "parameters": [
700
781
  {
701
- "name": "contractId",
702
- "type": "string",
782
+ "name": "ids",
783
+ "type": "string[]",
703
784
  "optional": false
704
785
  }
705
786
  ],
706
- "returnType": "Promise<AdGroup[]>",
787
+ "returnType": "void",
707
788
  "isStatic": false,
708
789
  "isPublic": true
709
790
  },
710
- "findByTier": {
711
- "name": "findByTier",
712
- "async": true,
791
+ "addZoneId": {
792
+ "name": "addZoneId",
793
+ "async": false,
713
794
  "parameters": [
714
795
  {
715
- "name": "tierId",
796
+ "name": "zoneId",
716
797
  "type": "string",
717
798
  "optional": false
718
799
  }
719
800
  ],
720
- "returnType": "Promise<AdGroup[]>",
801
+ "returnType": "void",
721
802
  "isStatic": false,
722
803
  "isPublic": true
723
804
  },
724
- "findByStatus": {
725
- "name": "findByStatus",
726
- "async": true,
805
+ "removeZoneId": {
806
+ "name": "removeZoneId",
807
+ "async": false,
727
808
  "parameters": [
728
809
  {
729
- "name": "status",
730
- "type": "AdGroupStatus",
810
+ "name": "zoneId",
811
+ "type": "string",
731
812
  "optional": false
732
813
  }
733
814
  ],
734
- "returnType": "Promise<AdGroup[]>",
735
- "isStatic": false,
736
- "isPublic": true
737
- },
738
- "findActive": {
739
- "name": "findActive",
740
- "async": true,
741
- "parameters": [],
742
- "returnType": "Promise<AdGroup[]>",
815
+ "returnType": "void",
743
816
  "isStatic": false,
744
817
  "isPublic": true
745
818
  },
746
- "findByVertical": {
747
- "name": "findByVertical",
748
- "async": true,
819
+ "hasZoneId": {
820
+ "name": "hasZoneId",
821
+ "async": false,
749
822
  "parameters": [
750
823
  {
751
- "name": "verticalSlug",
824
+ "name": "zoneId",
752
825
  "type": "string",
753
826
  "optional": false
754
827
  }
755
828
  ],
756
- "returnType": "Promise<AdGroup[]>",
829
+ "returnType": "boolean",
757
830
  "isStatic": false,
758
831
  "isPublic": true
759
832
  },
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[]>",
833
+ "getTargeting": {
834
+ "name": "getTargeting",
835
+ "async": false,
836
+ "parameters": [],
837
+ "returnType": "Record<string, unknown>",
771
838
  "isStatic": false,
772
839
  "isPublic": true
773
840
  },
774
- "findEligibleForZone": {
775
- "name": "findEligibleForZone",
776
- "async": true,
841
+ "setTargeting": {
842
+ "name": "setTargeting",
843
+ "async": false,
777
844
  "parameters": [
778
845
  {
779
- "name": "zoneId",
780
- "type": "string",
846
+ "name": "rules",
847
+ "type": "Record<string, unknown>",
781
848
  "optional": false
782
849
  }
783
850
  ],
784
- "returnType": "Promise<AdGroup[]>",
851
+ "returnType": "void",
785
852
  "isStatic": false,
786
853
  "isPublic": true
787
854
  },
788
- "findDrafts": {
789
- "name": "findDrafts",
790
- "async": true,
855
+ "isActive": {
856
+ "name": "isActive",
857
+ "async": false,
791
858
  "parameters": [],
792
- "returnType": "Promise<AdGroup[]>",
859
+ "returnType": "boolean",
793
860
  "isStatic": false,
794
861
  "isPublic": true
795
862
  },
796
- "findPaused": {
797
- "name": "findPaused",
798
- "async": true,
863
+ "isDraft": {
864
+ "name": "isDraft",
865
+ "async": false,
799
866
  "parameters": [],
800
- "returnType": "Promise<AdGroup[]>",
867
+ "returnType": "boolean",
801
868
  "isStatic": false,
802
869
  "isPublic": true
803
870
  },
804
- "findCompleted": {
805
- "name": "findCompleted",
806
- "async": true,
871
+ "isPaused": {
872
+ "name": "isPaused",
873
+ "async": false,
807
874
  "parameters": [],
808
- "returnType": "Promise<AdGroup[]>",
875
+ "returnType": "boolean",
809
876
  "isStatic": false,
810
877
  "isPublic": true
811
878
  },
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[]>",
879
+ "isCompleted": {
880
+ "name": "isCompleted",
881
+ "async": false,
882
+ "parameters": [],
883
+ "returnType": "boolean",
823
884
  "isStatic": false,
824
885
  "isPublic": true
825
886
  },
826
- "findGlobal": {
827
- "name": "findGlobal",
828
- "async": true,
887
+ "hasEnded": {
888
+ "name": "hasEnded",
889
+ "async": false,
829
890
  "parameters": [],
830
- "returnType": "Promise<AdGroup[]>",
891
+ "returnType": "boolean",
831
892
  "isStatic": false,
832
893
  "isPublic": true
833
894
  },
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[]>",
895
+ "hasStarted": {
896
+ "name": "hasStarted",
897
+ "async": false,
898
+ "parameters": [],
899
+ "returnType": "boolean",
845
900
  "isStatic": false,
846
901
  "isPublic": true
847
902
  }
848
903
  },
849
904
  "decoratorConfig": {
905
+ "tableStrategy": "sti",
850
906
  "api": {
851
907
  "include": [
852
908
  "list",
@@ -861,12 +917,24 @@
861
917
  "get",
862
918
  "create"
863
919
  ]
864
- }
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
+ ]
865
933
  },
866
- "extends": "SmrtCollection",
867
- "extendsTypeArg": "AdGroup",
868
- "exportName": "AdGroupCollection",
869
- "collectionExportName": "AdGroupCollectionCollection",
934
+ "extends": "SmrtObject",
935
+ "exportName": "AdGroup",
936
+ "collectionExportName": "AdGroupCollection",
937
+ "displayLabelField": "name",
870
938
  "schema": {
871
939
  "tableName": "ad_groups",
872
940
  "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);",
@@ -1010,161 +1078,188 @@
1010
1078
  },
1011
1079
  "importPath": "@happyvertical/smrt-ads"
1012
1080
  },
1013
- "@happyvertical/smrt-ads:AdVariationCollection": {
1014
- "name": "advariationcollection",
1015
- "className": "AdVariationCollection",
1016
- "qualifiedName": "@happyvertical/smrt-ads:AdVariationCollection",
1081
+ "@happyvertical/smrt-ads:AdVariation": {
1082
+ "name": "advariation",
1083
+ "className": "AdVariation",
1084
+ "qualifiedName": "@happyvertical/smrt-ads:AdVariation",
1017
1085
  "collection": "advariations",
1018
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdVariationCollection.ts",
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",
1019
1088
  "packageName": "@happyvertical/smrt-ads",
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
1035
- },
1036
- "findByFormat": {
1037
- "name": "findByFormat",
1038
- "async": true,
1039
- "parameters": [
1040
- {
1041
- "name": "formatId",
1042
- "type": "string",
1043
- "optional": false
1044
- }
1045
- ],
1046
- "returnType": "Promise<AdVariation[]>",
1047
- "isStatic": false,
1048
- "isPublic": true
1089
+ "fields": {
1090
+ "created_at": {
1091
+ "type": "datetime",
1092
+ "required": false
1049
1093
  },
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
1094
+ "updated_at": {
1095
+ "type": "datetime",
1096
+ "required": false
1063
1097
  },
1064
- "selectByWeight": {
1065
- "name": "selectByWeight",
1066
- "async": true,
1067
- "parameters": [
1068
- {
1069
- "name": "groupId",
1070
- "type": "string",
1071
- "optional": false
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
1072
1113
  }
1073
- ],
1074
- "returnType": "Promise<AdVariation | null>",
1075
- "isStatic": false,
1076
- "isPublic": true
1114
+ }
1077
1115
  },
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
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
+ }
1091
1124
  },
1092
- "findActive": {
1093
- "name": "findActive",
1094
- "async": true,
1095
- "parameters": [],
1096
- "returnType": "Promise<AdVariation[]>",
1097
- "isStatic": false,
1098
- "isPublic": true
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
+ }
1099
1133
  },
1100
- "findDrafts": {
1101
- "name": "findDrafts",
1102
- "async": true,
1103
- "parameters": [],
1104
- "returnType": "Promise<AdVariation[]>",
1105
- "isStatic": false,
1106
- "isPublic": true
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
+ }
1107
1142
  },
1108
- "findPaused": {
1109
- "name": "findPaused",
1110
- "async": true,
1111
- "parameters": [],
1112
- "returnType": "Promise<AdVariation[]>",
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
+ }
1151
+ },
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,
1215
+ "parameters": [],
1216
+ "returnType": "boolean",
1113
1217
  "isStatic": false,
1114
1218
  "isPublic": true
1115
1219
  },
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[]>",
1220
+ "isDraft": {
1221
+ "name": "isDraft",
1222
+ "async": false,
1223
+ "parameters": [],
1224
+ "returnType": "boolean",
1127
1225
  "isStatic": false,
1128
1226
  "isPublic": true
1129
1227
  },
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[]>",
1228
+ "isPaused": {
1229
+ "name": "isPaused",
1230
+ "async": false,
1231
+ "parameters": [],
1232
+ "returnType": "boolean",
1141
1233
  "isStatic": false,
1142
1234
  "isPublic": true
1143
1235
  },
1144
- "findGlobal": {
1145
- "name": "findGlobal",
1146
- "async": true,
1236
+ "getCTR": {
1237
+ "name": "getCTR",
1238
+ "async": false,
1147
1239
  "parameters": [],
1148
- "returnType": "Promise<AdVariation[]>",
1240
+ "returnType": "number",
1149
1241
  "isStatic": false,
1150
1242
  "isPublic": true
1151
1243
  },
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[]>",
1244
+ "recordImpression": {
1245
+ "name": "recordImpression",
1246
+ "async": false,
1247
+ "parameters": [],
1248
+ "returnType": "void",
1249
+ "isStatic": false,
1250
+ "isPublic": true
1251
+ },
1252
+ "recordClick": {
1253
+ "name": "recordClick",
1254
+ "async": false,
1255
+ "parameters": [],
1256
+ "returnType": "void",
1163
1257
  "isStatic": false,
1164
1258
  "isPublic": true
1165
1259
  }
1166
1260
  },
1167
1261
  "decoratorConfig": {
1262
+ "tableStrategy": "sti",
1168
1263
  "api": {
1169
1264
  "include": [
1170
1265
  "list",
@@ -1179,12 +1274,24 @@
1179
1274
  "get",
1180
1275
  "create"
1181
1276
  ]
1182
- }
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
+ ]
1183
1290
  },
1184
- "extends": "SmrtCollection",
1185
- "extendsTypeArg": "AdVariation",
1186
- "exportName": "AdVariationCollection",
1187
- "collectionExportName": "AdVariationCollectionCollection",
1291
+ "extends": "SmrtObject",
1292
+ "exportName": "AdVariation",
1293
+ "collectionExportName": "AdVariationCollection",
1294
+ "displayLabelField": "name",
1188
1295
  "schema": {
1189
1296
  "tableName": "ad_variations",
1190
1297
  "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);",
@@ -1337,91 +1444,73 @@
1337
1444
  },
1338
1445
  "importPath": "@happyvertical/smrt-ads"
1339
1446
  },
1340
- "@happyvertical/smrt-ads:AdDeliveryTier": {
1341
- "name": "addeliverytier",
1342
- "className": "AdDeliveryTier",
1343
- "qualifiedName": "@happyvertical/smrt-ads:AdDeliveryTier",
1447
+ "@happyvertical/smrt-ads:AdDeliveryTierCollection": {
1448
+ "name": "addeliverytiercollection",
1449
+ "className": "AdDeliveryTierCollection",
1450
+ "qualifiedName": "@happyvertical/smrt-ads:AdDeliveryTierCollection",
1344
1451
  "collection": "addeliverytiers",
1345
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdDeliveryTier.ts",
1452
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdDeliveryTierCollection.ts",
1346
1453
  "packageName": "@happyvertical/smrt-ads",
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
- }
1356
- },
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
- },
1454
+ "fields": {},
1390
1455
  "methods": {
1391
- "isHigherPriorityThan": {
1392
- "name": "isHigherPriorityThan",
1393
- "async": false,
1456
+ "findByPriority": {
1457
+ "name": "findByPriority",
1458
+ "async": true,
1459
+ "parameters": [],
1460
+ "returnType": "Promise<AdDeliveryTier[]>",
1461
+ "isStatic": false,
1462
+ "isPublic": true
1463
+ },
1464
+ "findByPricingModel": {
1465
+ "name": "findByPricingModel",
1466
+ "async": true,
1394
1467
  "parameters": [
1395
1468
  {
1396
- "name": "other",
1397
- "type": "AdDeliveryTier",
1469
+ "name": "pricingModel",
1470
+ "type": "PricingModel",
1398
1471
  "optional": false
1399
1472
  }
1400
1473
  ],
1401
- "returnType": "boolean",
1474
+ "returnType": "Promise<AdDeliveryTier[]>",
1402
1475
  "isStatic": false,
1403
1476
  "isPublic": true
1404
1477
  },
1405
- "isFixedPricing": {
1406
- "name": "isFixedPricing",
1407
- "async": false,
1478
+ "getHighestPriority": {
1479
+ "name": "getHighestPriority",
1480
+ "async": true,
1408
1481
  "parameters": [],
1409
- "returnType": "boolean",
1482
+ "returnType": "Promise<AdDeliveryTier | null>",
1410
1483
  "isStatic": false,
1411
1484
  "isPublic": true
1412
1485
  },
1413
- "isPerformanceBased": {
1414
- "name": "isPerformanceBased",
1415
- "async": false,
1486
+ "findFixedPricing": {
1487
+ "name": "findFixedPricing",
1488
+ "async": true,
1416
1489
  "parameters": [],
1417
- "returnType": "boolean",
1490
+ "returnType": "Promise<AdDeliveryTier[]>",
1418
1491
  "isStatic": false,
1419
1492
  "isPublic": true
1420
- }
1421
- },
1422
- "decoratorConfig": {
1423
- "api": {
1424
- "include": [
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": [
1425
1514
  "list",
1426
1515
  "get",
1427
1516
  "create",
@@ -1433,15 +1522,12 @@
1433
1522
  "list",
1434
1523
  "get"
1435
1524
  ]
1436
- },
1437
- "cli": {
1438
- "skipApiCheck": true
1439
1525
  }
1440
1526
  },
1441
- "extends": "SmrtObject",
1442
- "exportName": "AdDeliveryTier",
1443
- "collectionExportName": "AdDeliveryTierCollection",
1444
- "displayLabelField": "name",
1527
+ "extends": "SmrtCollection",
1528
+ "extendsTypeArg": "AdDeliveryTier",
1529
+ "exportName": "AdDeliveryTierCollection",
1530
+ "collectionExportName": "AdDeliveryTierCollectionCollection",
1445
1531
  "schema": {
1446
1532
  "tableName": "ad_delivery_tiers",
1447
1533
  "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);",
@@ -1515,126 +1601,228 @@
1515
1601
  },
1516
1602
  "importPath": "@happyvertical/smrt-ads"
1517
1603
  },
1518
- "@happyvertical/smrt-ads:AdEvent": {
1519
- "name": "adevent",
1520
- "className": "AdEvent",
1521
- "qualifiedName": "@happyvertical/smrt-ads:AdEvent",
1604
+ "@happyvertical/smrt-ads:AdEventCollection": {
1605
+ "name": "adeventcollection",
1606
+ "className": "AdEventCollection",
1607
+ "qualifiedName": "@happyvertical/smrt-ads:AdEventCollection",
1522
1608
  "collection": "adevents",
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",
1609
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdEventCollection.ts",
1525
1610
  "packageName": "@happyvertical/smrt-ads",
1526
- "fields": {
1527
- "created_at": {
1528
- "type": "datetime",
1529
- "required": false
1530
- },
1531
- "updated_at": {
1532
- "type": "datetime",
1533
- "required": false
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
1534
1626
  },
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
1627
+ "findByZone": {
1628
+ "name": "findByZone",
1629
+ "async": true,
1630
+ "parameters": [
1631
+ {
1632
+ "name": "zoneId",
1633
+ "type": "string",
1634
+ "optional": false
1550
1635
  }
1551
- }
1636
+ ],
1637
+ "returnType": "Promise<AdEvent[]>",
1638
+ "isStatic": false,
1639
+ "isPublic": true
1552
1640
  },
1553
- "variationId": {
1554
- "type": "foreignKey",
1555
- "required": false,
1556
- "related": "AdVariation"
1641
+ "findBySite": {
1642
+ "name": "findBySite",
1643
+ "async": true,
1644
+ "parameters": [
1645
+ {
1646
+ "name": "siteId",
1647
+ "type": "string",
1648
+ "optional": false
1649
+ }
1650
+ ],
1651
+ "returnType": "Promise<AdEvent[]>",
1652
+ "isStatic": false,
1653
+ "isPublic": true
1557
1654
  },
1558
- "zoneId": {
1559
- "type": "crossPackageRef",
1560
- "required": false,
1561
- "related": "@happyvertical/smrt-properties:Zone"
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
1562
1673
  },
1563
- "siteId": {
1564
- "type": "text",
1565
- "required": false,
1566
- "default": ""
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
1567
1687
  },
1568
- "eventType": {
1569
- "type": "text",
1570
- "required": false,
1571
- "enum": [
1572
- "impression",
1573
- "click",
1574
- "conversion"
1575
- ]
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
1576
1706
  },
1577
- "timestamp": {
1578
- "type": "datetime",
1579
- "required": false
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
1580
1720
  },
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>",
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>",
1593
1732
  "isStatic": false,
1594
1733
  "isPublic": true
1595
1734
  },
1596
- "setMetadata": {
1597
- "name": "setMetadata",
1598
- "async": false,
1735
+ "countConversions": {
1736
+ "name": "countConversions",
1737
+ "async": true,
1599
1738
  "parameters": [
1600
1739
  {
1601
- "name": "data",
1602
- "type": "Record<string, unknown>",
1740
+ "name": "variationId",
1741
+ "type": "string",
1603
1742
  "optional": false
1604
1743
  }
1605
1744
  ],
1606
- "returnType": "void",
1745
+ "returnType": "Promise<number>",
1607
1746
  "isStatic": false,
1608
1747
  "isPublic": true
1609
1748
  },
1610
- "isImpression": {
1611
- "name": "isImpression",
1612
- "async": false,
1749
+ "findImpressions": {
1750
+ "name": "findImpressions",
1751
+ "async": true,
1613
1752
  "parameters": [],
1614
- "returnType": "boolean",
1753
+ "returnType": "Promise<AdEvent[]>",
1615
1754
  "isStatic": false,
1616
1755
  "isPublic": true
1617
1756
  },
1618
- "isClick": {
1619
- "name": "isClick",
1620
- "async": false,
1757
+ "findClicks": {
1758
+ "name": "findClicks",
1759
+ "async": true,
1621
1760
  "parameters": [],
1622
- "returnType": "boolean",
1761
+ "returnType": "Promise<AdEvent[]>",
1623
1762
  "isStatic": false,
1624
1763
  "isPublic": true
1625
1764
  },
1626
- "isConversion": {
1627
- "name": "isConversion",
1628
- "async": false,
1765
+ "findConversions": {
1766
+ "name": "findConversions",
1767
+ "async": true,
1629
1768
  "parameters": [],
1630
- "returnType": "boolean",
1769
+ "returnType": "Promise<AdEvent[]>",
1631
1770
  "isStatic": false,
1632
1771
  "isPublic": true
1633
- }
1634
- },
1635
- "decoratorConfig": {
1636
- "tableStrategy": "sti",
1637
- "api": {
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[]>",
1820
+ "isStatic": false,
1821
+ "isPublic": true
1822
+ }
1823
+ },
1824
+ "decoratorConfig": {
1825
+ "api": {
1638
1826
  "include": [
1639
1827
  "create",
1640
1828
  "list"
@@ -1645,20 +1833,12 @@
1645
1833
  "create"
1646
1834
  ]
1647
1835
  },
1648
- "cli": false,
1649
- "tenantScoped": {
1650
- "mode": "optional"
1651
- },
1652
- "conflictColumns": [
1653
- "tenant_id",
1654
- "slug",
1655
- "context",
1656
- "_meta_type"
1657
- ]
1836
+ "cli": false
1658
1837
  },
1659
- "extends": "SmrtObject",
1660
- "exportName": "AdEvent",
1661
- "collectionExportName": "AdEventCollection",
1838
+ "extends": "SmrtCollection",
1839
+ "extendsTypeArg": "AdEvent",
1840
+ "exportName": "AdEventCollection",
1841
+ "collectionExportName": "AdEventCollectionCollection",
1662
1842
  "schema": {
1663
1843
  "tableName": "ad_events",
1664
1844
  "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);",
@@ -1778,76 +1958,18 @@
1778
1958
  },
1779
1959
  "importPath": "@happyvertical/smrt-ads"
1780
1960
  },
1781
- "@happyvertical/smrt-ads:AdFormat": {
1782
- "name": "adformat",
1783
- "className": "AdFormat",
1784
- "qualifiedName": "@happyvertical/smrt-ads:AdFormat",
1961
+ "@happyvertical/smrt-ads:AdFormatCollection": {
1962
+ "name": "adformatcollection",
1963
+ "className": "AdFormatCollection",
1964
+ "qualifiedName": "@happyvertical/smrt-ads:AdFormatCollection",
1785
1965
  "collection": "adformats",
1786
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdFormat.ts",
1966
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdFormatCollection.ts",
1787
1967
  "packageName": "@happyvertical/smrt-ads",
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
- },
1968
+ "fields": {},
1839
1969
  "methods": {
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,
1970
+ "findByDimensions": {
1971
+ "name": "findByDimensions",
1972
+ "async": true,
1851
1973
  "parameters": [
1852
1974
  {
1853
1975
  "name": "width",
@@ -1860,7 +1982,45 @@
1860
1982
  "optional": false
1861
1983
  }
1862
1984
  ],
1863
- "returnType": "boolean",
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[]>",
1864
2024
  "isStatic": false,
1865
2025
  "isPublic": true
1866
2026
  }
@@ -1879,15 +2039,12 @@
1879
2039
  "list",
1880
2040
  "get"
1881
2041
  ]
1882
- },
1883
- "cli": {
1884
- "skipApiCheck": true
1885
2042
  }
1886
2043
  },
1887
- "extends": "SmrtObject",
1888
- "exportName": "AdFormat",
1889
- "collectionExportName": "AdFormatCollection",
1890
- "displayLabelField": "name",
2044
+ "extends": "SmrtCollection",
2045
+ "extendsTypeArg": "AdFormat",
2046
+ "exportName": "AdFormatCollection",
2047
+ "collectionExportName": "AdFormatCollectionCollection",
1891
2048
  "schema": {
1892
2049
  "tableName": "ad_formats",
1893
2050
  "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);",
@@ -1967,191 +2124,82 @@
1967
2124
  },
1968
2125
  "importPath": "@happyvertical/smrt-ads"
1969
2126
  },
1970
- "@happyvertical/smrt-ads:AdGroup": {
1971
- "name": "adgroup",
1972
- "className": "AdGroup",
1973
- "qualifiedName": "@happyvertical/smrt-ads:AdGroup",
2127
+ "@happyvertical/smrt-ads:AdGroupCollection": {
2128
+ "name": "adgroupcollection",
2129
+ "className": "AdGroupCollection",
2130
+ "qualifiedName": "@happyvertical/smrt-ads:AdGroupCollection",
1974
2131
  "collection": "adgroups",
1975
- "description": "AdGroup organizes ad creatives with targeting and budget controls.",
1976
- "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/models/AdGroup.ts",
2132
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdGroupCollection.ts",
1977
2133
  "packageName": "@happyvertical/smrt-ads",
1978
- "fields": {
1979
- "created_at": {
1980
- "type": "datetime",
1981
- "required": false
1982
- },
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
2134
+ "fields": {},
2135
+ "methods": {
2136
+ "findByContract": {
2137
+ "name": "findByContract",
2138
+ "async": true,
2139
+ "parameters": [
2140
+ {
2141
+ "name": "contractId",
2142
+ "type": "string",
2143
+ "optional": false
2002
2144
  }
2003
- }
2145
+ ],
2146
+ "returnType": "Promise<AdGroup[]>",
2147
+ "isStatic": false,
2148
+ "isPublic": true
2004
2149
  },
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,
2150
+ "findByTier": {
2151
+ "name": "findByTier",
2152
+ "async": true,
2113
2153
  "parameters": [
2114
2154
  {
2115
- "name": "ids",
2116
- "type": "string[]",
2155
+ "name": "tierId",
2156
+ "type": "string",
2117
2157
  "optional": false
2118
2158
  }
2119
2159
  ],
2120
- "returnType": "void",
2160
+ "returnType": "Promise<AdGroup[]>",
2121
2161
  "isStatic": false,
2122
2162
  "isPublic": true
2123
2163
  },
2124
- "addZoneId": {
2125
- "name": "addZoneId",
2126
- "async": false,
2164
+ "findByStatus": {
2165
+ "name": "findByStatus",
2166
+ "async": true,
2127
2167
  "parameters": [
2128
2168
  {
2129
- "name": "zoneId",
2130
- "type": "string",
2169
+ "name": "status",
2170
+ "type": "AdGroupStatus",
2131
2171
  "optional": false
2132
2172
  }
2133
2173
  ],
2134
- "returnType": "void",
2174
+ "returnType": "Promise<AdGroup[]>",
2135
2175
  "isStatic": false,
2136
2176
  "isPublic": true
2137
2177
  },
2138
- "removeZoneId": {
2139
- "name": "removeZoneId",
2140
- "async": false,
2178
+ "findActive": {
2179
+ "name": "findActive",
2180
+ "async": true,
2181
+ "parameters": [],
2182
+ "returnType": "Promise<AdGroup[]>",
2183
+ "isStatic": false,
2184
+ "isPublic": true
2185
+ },
2186
+ "findByVertical": {
2187
+ "name": "findByVertical",
2188
+ "async": true,
2141
2189
  "parameters": [
2142
2190
  {
2143
- "name": "zoneId",
2191
+ "name": "verticalSlug",
2144
2192
  "type": "string",
2145
2193
  "optional": false
2146
2194
  }
2147
2195
  ],
2148
- "returnType": "void",
2196
+ "returnType": "Promise<AdGroup[]>",
2149
2197
  "isStatic": false,
2150
2198
  "isPublic": true
2151
2199
  },
2152
- "hasZoneId": {
2153
- "name": "hasZoneId",
2154
- "async": false,
2200
+ "findByZone": {
2201
+ "name": "findByZone",
2202
+ "async": true,
2155
2203
  "parameters": [
2156
2204
  {
2157
2205
  "name": "zoneId",
@@ -2159,83 +2207,86 @@
2159
2207
  "optional": false
2160
2208
  }
2161
2209
  ],
2162
- "returnType": "boolean",
2163
- "isStatic": false,
2164
- "isPublic": true
2165
- },
2166
- "getTargeting": {
2167
- "name": "getTargeting",
2168
- "async": false,
2169
- "parameters": [],
2170
- "returnType": "Record<string, unknown>",
2210
+ "returnType": "Promise<AdGroup[]>",
2171
2211
  "isStatic": false,
2172
2212
  "isPublic": true
2173
2213
  },
2174
- "setTargeting": {
2175
- "name": "setTargeting",
2176
- "async": false,
2214
+ "findEligibleForZone": {
2215
+ "name": "findEligibleForZone",
2216
+ "async": true,
2177
2217
  "parameters": [
2178
2218
  {
2179
- "name": "rules",
2180
- "type": "Record<string, unknown>",
2219
+ "name": "zoneId",
2220
+ "type": "string",
2181
2221
  "optional": false
2182
2222
  }
2183
2223
  ],
2184
- "returnType": "void",
2224
+ "returnType": "Promise<AdGroup[]>",
2185
2225
  "isStatic": false,
2186
2226
  "isPublic": true
2187
2227
  },
2188
- "isActive": {
2189
- "name": "isActive",
2190
- "async": false,
2228
+ "findDrafts": {
2229
+ "name": "findDrafts",
2230
+ "async": true,
2191
2231
  "parameters": [],
2192
- "returnType": "boolean",
2232
+ "returnType": "Promise<AdGroup[]>",
2193
2233
  "isStatic": false,
2194
2234
  "isPublic": true
2195
2235
  },
2196
- "isDraft": {
2197
- "name": "isDraft",
2198
- "async": false,
2236
+ "findPaused": {
2237
+ "name": "findPaused",
2238
+ "async": true,
2199
2239
  "parameters": [],
2200
- "returnType": "boolean",
2240
+ "returnType": "Promise<AdGroup[]>",
2201
2241
  "isStatic": false,
2202
2242
  "isPublic": true
2203
2243
  },
2204
- "isPaused": {
2205
- "name": "isPaused",
2206
- "async": false,
2244
+ "findCompleted": {
2245
+ "name": "findCompleted",
2246
+ "async": true,
2207
2247
  "parameters": [],
2208
- "returnType": "boolean",
2248
+ "returnType": "Promise<AdGroup[]>",
2209
2249
  "isStatic": false,
2210
2250
  "isPublic": true
2211
2251
  },
2212
- "isCompleted": {
2213
- "name": "isCompleted",
2214
- "async": false,
2215
- "parameters": [],
2216
- "returnType": "boolean",
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[]>",
2217
2263
  "isStatic": false,
2218
2264
  "isPublic": true
2219
2265
  },
2220
- "hasEnded": {
2221
- "name": "hasEnded",
2222
- "async": false,
2266
+ "findGlobal": {
2267
+ "name": "findGlobal",
2268
+ "async": true,
2223
2269
  "parameters": [],
2224
- "returnType": "boolean",
2270
+ "returnType": "Promise<AdGroup[]>",
2225
2271
  "isStatic": false,
2226
2272
  "isPublic": true
2227
2273
  },
2228
- "hasStarted": {
2229
- "name": "hasStarted",
2230
- "async": false,
2231
- "parameters": [],
2232
- "returnType": "boolean",
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[]>",
2233
2285
  "isStatic": false,
2234
2286
  "isPublic": true
2235
2287
  }
2236
2288
  },
2237
2289
  "decoratorConfig": {
2238
- "tableStrategy": "sti",
2239
2290
  "api": {
2240
2291
  "include": [
2241
2292
  "list",
@@ -2250,24 +2301,12 @@
2250
2301
  "get",
2251
2302
  "create"
2252
2303
  ]
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
- ]
2304
+ }
2266
2305
  },
2267
- "extends": "SmrtObject",
2268
- "exportName": "AdGroup",
2269
- "collectionExportName": "AdGroupCollection",
2270
- "displayLabelField": "name",
2306
+ "extends": "SmrtCollection",
2307
+ "extendsTypeArg": "AdGroup",
2308
+ "exportName": "AdGroupCollection",
2309
+ "collectionExportName": "AdGroupCollectionCollection",
2271
2310
  "schema": {
2272
2311
  "tableName": "ad_groups",
2273
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);",
@@ -2411,188 +2450,161 @@
2411
2450
  },
2412
2451
  "importPath": "@happyvertical/smrt-ads"
2413
2452
  },
2414
- "@happyvertical/smrt-ads:AdVariation": {
2415
- "name": "advariation",
2416
- "className": "AdVariation",
2417
- "qualifiedName": "@happyvertical/smrt-ads:AdVariation",
2453
+ "@happyvertical/smrt-ads:AdVariationCollection": {
2454
+ "name": "advariationcollection",
2455
+ "className": "AdVariationCollection",
2456
+ "qualifiedName": "@happyvertical/smrt-ads:AdVariationCollection",
2418
2457
  "collection": "advariations",
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",
2458
+ "filePath": "/home/runner/work/smrt/smrt/packages/ads/src/collections/AdVariationCollection.ts",
2421
2459
  "packageName": "@happyvertical/smrt-ads",
2422
- "fields": {
2423
- "created_at": {
2424
- "type": "datetime",
2425
- "required": false
2426
- },
2427
- "updated_at": {
2428
- "type": "datetime",
2429
- "required": false
2430
- },
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
2460
+ "fields": {},
2461
+ "methods": {
2462
+ "findByGroup": {
2463
+ "name": "findByGroup",
2464
+ "async": true,
2465
+ "parameters": [
2466
+ {
2467
+ "name": "groupId",
2468
+ "type": "string",
2469
+ "optional": false
2446
2470
  }
2447
- }
2448
- },
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
- }
2457
- },
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
- }
2466
- },
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
- }
2475
- },
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
- }
2471
+ ],
2472
+ "returnType": "Promise<AdVariation[]>",
2473
+ "isStatic": false,
2474
+ "isPublic": true
2493
2475
  },
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
- }
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
2502
2489
  },
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
- }
2490
+ "findActiveByGroup": {
2491
+ "name": "findActiveByGroup",
2492
+ "async": true,
2493
+ "parameters": [
2494
+ {
2495
+ "name": "groupId",
2496
+ "type": "string",
2497
+ "optional": false
2498
+ }
2499
+ ],
2500
+ "returnType": "Promise<AdVariation[]>",
2501
+ "isStatic": false,
2502
+ "isPublic": true
2511
2503
  },
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
- ]
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
2524
2517
  },
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
- }
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
2533
2531
  },
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,
2532
+ "findActive": {
2533
+ "name": "findActive",
2534
+ "async": true,
2548
2535
  "parameters": [],
2549
- "returnType": "boolean",
2536
+ "returnType": "Promise<AdVariation[]>",
2550
2537
  "isStatic": false,
2551
2538
  "isPublic": true
2552
2539
  },
2553
- "isDraft": {
2554
- "name": "isDraft",
2555
- "async": false,
2540
+ "findDrafts": {
2541
+ "name": "findDrafts",
2542
+ "async": true,
2556
2543
  "parameters": [],
2557
- "returnType": "boolean",
2544
+ "returnType": "Promise<AdVariation[]>",
2558
2545
  "isStatic": false,
2559
2546
  "isPublic": true
2560
2547
  },
2561
- "isPaused": {
2562
- "name": "isPaused",
2563
- "async": false,
2548
+ "findPaused": {
2549
+ "name": "findPaused",
2550
+ "async": true,
2564
2551
  "parameters": [],
2565
- "returnType": "boolean",
2552
+ "returnType": "Promise<AdVariation[]>",
2566
2553
  "isStatic": false,
2567
2554
  "isPublic": true
2568
2555
  },
2569
- "getCTR": {
2570
- "name": "getCTR",
2571
- "async": false,
2572
- "parameters": [],
2573
- "returnType": "number",
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[]>",
2574
2567
  "isStatic": false,
2575
2568
  "isPublic": true
2576
2569
  },
2577
- "recordImpression": {
2578
- "name": "recordImpression",
2579
- "async": false,
2580
- "parameters": [],
2581
- "returnType": "void",
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[]>",
2582
2581
  "isStatic": false,
2583
2582
  "isPublic": true
2584
2583
  },
2585
- "recordClick": {
2586
- "name": "recordClick",
2587
- "async": false,
2584
+ "findGlobal": {
2585
+ "name": "findGlobal",
2586
+ "async": true,
2588
2587
  "parameters": [],
2589
- "returnType": "void",
2588
+ "returnType": "Promise<AdVariation[]>",
2589
+ "isStatic": false,
2590
+ "isPublic": true
2591
+ },
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[]>",
2590
2603
  "isStatic": false,
2591
2604
  "isPublic": true
2592
2605
  }
2593
2606
  },
2594
2607
  "decoratorConfig": {
2595
- "tableStrategy": "sti",
2596
2608
  "api": {
2597
2609
  "include": [
2598
2610
  "list",
@@ -2607,24 +2619,12 @@
2607
2619
  "get",
2608
2620
  "create"
2609
2621
  ]
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
- ]
2622
+ }
2623
2623
  },
2624
- "extends": "SmrtObject",
2625
- "exportName": "AdVariation",
2626
- "collectionExportName": "AdVariationCollection",
2627
- "displayLabelField": "name",
2624
+ "extends": "SmrtCollection",
2625
+ "extendsTypeArg": "AdVariation",
2626
+ "exportName": "AdVariationCollection",
2627
+ "collectionExportName": "AdVariationCollectionCollection",
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);",