@happyvertical/smrt-affiliates 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,997 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "generatedAt": "2026-06-23T01:11:11.024Z",
4
+ "packageName": "@happyvertical/smrt-affiliates",
5
+ "packageVersion": "0.30.0",
6
+ "sourceManifestPath": "dist/manifest.json",
7
+ "agentDocPath": "AGENTS.md",
8
+ "sourceHashes": {
9
+ "manifest": "d1e05244f12ec7721f94e80d0193f0f464e697390edc2eb837741f9c46e10fb9",
10
+ "packageJson": "c447c9ea0cab58d0b2a58a37ef7b8eb81481bd738d9004427fbfe4b9ad4f0eba",
11
+ "agents": "402004f8c7cbaed180ca4f81673883002b64aab2700648ae31cfa372ee9ca1b6"
12
+ },
13
+ "exports": [
14
+ ".",
15
+ "./manifest",
16
+ "./manifest.json"
17
+ ],
18
+ "dependencies": {
19
+ "@happyvertical/smrt-core": "workspace:*",
20
+ "@happyvertical/smrt-vitest": "workspace:*",
21
+ "@happyvertical/sql": "catalog:",
22
+ "@types/node": "25.0.9",
23
+ "fast-glob": "3.3.3",
24
+ "typescript": "^5.9.3",
25
+ "vite": "^7.3.1",
26
+ "vitest": "^4.0.17"
27
+ },
28
+ "smrtDependencies": [
29
+ "@happyvertical/smrt-core",
30
+ "@happyvertical/smrt-vitest"
31
+ ],
32
+ "sdkDependencies": [
33
+ "@happyvertical/sql"
34
+ ],
35
+ "tags": [],
36
+ "risks": [],
37
+ "objects": [
38
+ {
39
+ "name": "CommissionCollection",
40
+ "qualifiedName": "@happyvertical/smrt-affiliates:CommissionCollection",
41
+ "collection": "commissions",
42
+ "tableName": "commission_collections",
43
+ "packageName": "@happyvertical/smrt-affiliates",
44
+ "extends": "SmrtCollection",
45
+ "fields": [],
46
+ "relationships": [],
47
+ "methods": [
48
+ "findByDateRange",
49
+ "findByEvent",
50
+ "findByNetwork",
51
+ "findByNetworkAndType",
52
+ "findByPartner",
53
+ "findByPartnerAndDateRange",
54
+ "findByPayout",
55
+ "findByStatus",
56
+ "findByType",
57
+ "findPending",
58
+ "findPendingByNetwork",
59
+ "findPendingByPartner",
60
+ "getEarningsBreakdown",
61
+ "getPendingBreakdown",
62
+ "getPendingPayoutsByNetwork",
63
+ "getSummaryByNetwork",
64
+ "sumByPartnerAndType",
65
+ "sumPendingByPartner"
66
+ ],
67
+ "surfaces": [],
68
+ "relationshipFeatures": [
69
+ "uuidColumns"
70
+ ],
71
+ "tags": [],
72
+ "risks": []
73
+ },
74
+ {
75
+ "name": "PartnerCollection",
76
+ "qualifiedName": "@happyvertical/smrt-affiliates:PartnerCollection",
77
+ "collection": "partners",
78
+ "tableName": "partner_collections",
79
+ "packageName": "@happyvertical/smrt-affiliates",
80
+ "extends": "SmrtCollection",
81
+ "fields": [],
82
+ "relationships": [],
83
+ "methods": [
84
+ "findActive",
85
+ "findActiveByProperty",
86
+ "findActivePublishers",
87
+ "findByParent",
88
+ "findByProfile",
89
+ "findByProperty",
90
+ "findByReferrer",
91
+ "findByStatus",
92
+ "findByType",
93
+ "findEligibleForPayout",
94
+ "findPending",
95
+ "findPublishers",
96
+ "findReferrers",
97
+ "findSalespeople",
98
+ "findSuspended"
99
+ ],
100
+ "surfaces": [],
101
+ "relationshipFeatures": [
102
+ "uuidColumns"
103
+ ],
104
+ "tags": [],
105
+ "risks": []
106
+ },
107
+ {
108
+ "name": "PayoutCollection",
109
+ "qualifiedName": "@happyvertical/smrt-affiliates:PayoutCollection",
110
+ "collection": "payouts",
111
+ "tableName": "payout_collections",
112
+ "packageName": "@happyvertical/smrt-affiliates",
113
+ "extends": "SmrtCollection",
114
+ "fields": [],
115
+ "relationships": [],
116
+ "methods": [
117
+ "findApproved",
118
+ "findByInvoice",
119
+ "findByPartner",
120
+ "findByPartnerAndStatus",
121
+ "findByPeriod",
122
+ "findByStatus",
123
+ "findCompleted",
124
+ "findCompletedByPartner",
125
+ "findFailed",
126
+ "findLatestByPartner",
127
+ "findPending",
128
+ "findPendingByPartner",
129
+ "findProcessing",
130
+ "getStats",
131
+ "sumPaidByPartner",
132
+ "sumPendingByPartner"
133
+ ],
134
+ "surfaces": [],
135
+ "relationshipFeatures": [
136
+ "uuidColumns"
137
+ ],
138
+ "tags": [],
139
+ "risks": []
140
+ },
141
+ {
142
+ "name": "Commission",
143
+ "qualifiedName": "@happyvertical/smrt-affiliates:Commission",
144
+ "collection": "commissions",
145
+ "tableName": "commissions",
146
+ "packageName": "@happyvertical/smrt-affiliates",
147
+ "extends": "SmrtObject",
148
+ "fields": [
149
+ {
150
+ "name": "eventId",
151
+ "type": "crossPackageRef",
152
+ "required": false,
153
+ "related": "@happyvertical/smrt-ads:AdEvent",
154
+ "columnType": "UUID"
155
+ },
156
+ {
157
+ "name": "partnerId",
158
+ "type": "foreignKey",
159
+ "required": false,
160
+ "related": "Partner",
161
+ "columnType": "UUID"
162
+ },
163
+ {
164
+ "name": "commissionType",
165
+ "type": "text",
166
+ "required": false,
167
+ "columnType": "TEXT"
168
+ },
169
+ {
170
+ "name": "grossRevenue",
171
+ "type": "integer",
172
+ "required": false,
173
+ "columnType": "INTEGER"
174
+ },
175
+ {
176
+ "name": "commissionRate",
177
+ "type": "integer",
178
+ "required": false,
179
+ "columnType": "INTEGER"
180
+ },
181
+ {
182
+ "name": "commissionAmount",
183
+ "type": "integer",
184
+ "required": false,
185
+ "columnType": "INTEGER"
186
+ },
187
+ {
188
+ "name": "currency",
189
+ "type": "text",
190
+ "required": false,
191
+ "columnType": "TEXT"
192
+ },
193
+ {
194
+ "name": "payoutId",
195
+ "type": "foreignKey",
196
+ "required": false,
197
+ "related": "Payout",
198
+ "columnType": "UUID"
199
+ },
200
+ {
201
+ "name": "status",
202
+ "type": "text",
203
+ "required": false,
204
+ "columnType": "TEXT"
205
+ },
206
+ {
207
+ "name": "eventTimestamp",
208
+ "type": "datetime",
209
+ "required": false,
210
+ "columnType": "TIMESTAMP"
211
+ },
212
+ {
213
+ "name": "networkId",
214
+ "type": "text",
215
+ "required": false,
216
+ "columnType": "TEXT"
217
+ },
218
+ {
219
+ "name": "siteId",
220
+ "type": "text",
221
+ "required": false,
222
+ "columnType": "TEXT"
223
+ },
224
+ {
225
+ "name": "campaignId",
226
+ "type": "text",
227
+ "required": false,
228
+ "columnType": "TEXT"
229
+ },
230
+ {
231
+ "name": "metadata",
232
+ "type": "text",
233
+ "required": false,
234
+ "columnType": "TEXT"
235
+ }
236
+ ],
237
+ "relationships": [
238
+ {
239
+ "name": "eventId",
240
+ "type": "crossPackageRef",
241
+ "required": false,
242
+ "related": "@happyvertical/smrt-ads:AdEvent",
243
+ "columnType": "UUID"
244
+ },
245
+ {
246
+ "name": "partnerId",
247
+ "type": "foreignKey",
248
+ "required": false,
249
+ "related": "Partner",
250
+ "columnType": "UUID"
251
+ },
252
+ {
253
+ "name": "payoutId",
254
+ "type": "foreignKey",
255
+ "required": false,
256
+ "related": "Payout",
257
+ "columnType": "UUID"
258
+ }
259
+ ],
260
+ "methods": [
261
+ "calculateAmount",
262
+ "getAmountInDollars",
263
+ "getGrossRevenueInDollars",
264
+ "getMetadata",
265
+ "isDisplay",
266
+ "isIncluded",
267
+ "isOverhead",
268
+ "isPaid",
269
+ "isParent",
270
+ "isPending",
271
+ "isReferral",
272
+ "isSales",
273
+ "setMetadata"
274
+ ],
275
+ "surfaces": [
276
+ {
277
+ "kind": "api",
278
+ "name": "commissions.create",
279
+ "operation": "create",
280
+ "objectName": "@happyvertical/smrt-affiliates:Commission",
281
+ "path": "/commissions",
282
+ "method": "POST"
283
+ },
284
+ {
285
+ "kind": "api",
286
+ "name": "commissions.list",
287
+ "operation": "list",
288
+ "objectName": "@happyvertical/smrt-affiliates:Commission",
289
+ "path": "/commissions",
290
+ "method": "GET"
291
+ },
292
+ {
293
+ "kind": "api",
294
+ "name": "commissions.get",
295
+ "operation": "get",
296
+ "objectName": "@happyvertical/smrt-affiliates:Commission",
297
+ "path": "/commissions/[id]",
298
+ "method": "GET"
299
+ },
300
+ {
301
+ "kind": "mcp",
302
+ "name": "commission_create",
303
+ "operation": "create",
304
+ "objectName": "@happyvertical/smrt-affiliates:Commission"
305
+ },
306
+ {
307
+ "kind": "mcp",
308
+ "name": "commission_list",
309
+ "operation": "list",
310
+ "objectName": "@happyvertical/smrt-affiliates:Commission"
311
+ }
312
+ ],
313
+ "relationshipFeatures": [
314
+ "crossPackageRef",
315
+ "foreignKey",
316
+ "uuidColumns"
317
+ ],
318
+ "tags": [],
319
+ "risks": []
320
+ },
321
+ {
322
+ "name": "Partner",
323
+ "qualifiedName": "@happyvertical/smrt-affiliates:Partner",
324
+ "collection": "partners",
325
+ "tableName": "partners",
326
+ "packageName": "@happyvertical/smrt-affiliates",
327
+ "extends": "SmrtObject",
328
+ "fields": [
329
+ {
330
+ "name": "profileId",
331
+ "type": "crossPackageRef",
332
+ "required": false,
333
+ "related": "@happyvertical/smrt-profiles:Profile",
334
+ "columnType": "UUID"
335
+ },
336
+ {
337
+ "name": "propertyId",
338
+ "type": "crossPackageRef",
339
+ "required": false,
340
+ "related": "@happyvertical/smrt-properties:Property",
341
+ "columnType": "UUID"
342
+ },
343
+ {
344
+ "name": "partnerTypes",
345
+ "type": "text",
346
+ "required": false,
347
+ "columnType": "TEXT"
348
+ },
349
+ {
350
+ "name": "parentPartnerId",
351
+ "type": "foreignKey",
352
+ "required": false,
353
+ "related": "Partner",
354
+ "columnType": "UUID"
355
+ },
356
+ {
357
+ "name": "referredById",
358
+ "type": "foreignKey",
359
+ "required": false,
360
+ "related": "Partner",
361
+ "columnType": "UUID"
362
+ },
363
+ {
364
+ "name": "parentCommissionShare",
365
+ "type": "integer",
366
+ "required": false,
367
+ "columnType": "INTEGER"
368
+ },
369
+ {
370
+ "name": "displayCommissionRate",
371
+ "type": "decimal",
372
+ "required": false,
373
+ "columnType": "REAL"
374
+ },
375
+ {
376
+ "name": "referralCommissionRate",
377
+ "type": "decimal",
378
+ "required": false,
379
+ "columnType": "REAL"
380
+ },
381
+ {
382
+ "name": "salesCommissionRate",
383
+ "type": "decimal",
384
+ "required": false,
385
+ "columnType": "REAL"
386
+ },
387
+ {
388
+ "name": "payoutThreshold",
389
+ "type": "integer",
390
+ "required": false,
391
+ "columnType": "INTEGER"
392
+ },
393
+ {
394
+ "name": "payoutMethod",
395
+ "type": "text",
396
+ "required": false,
397
+ "columnType": "TEXT"
398
+ },
399
+ {
400
+ "name": "currency",
401
+ "type": "text",
402
+ "required": false,
403
+ "columnType": "TEXT"
404
+ },
405
+ {
406
+ "name": "status",
407
+ "type": "text",
408
+ "required": false,
409
+ "columnType": "TEXT"
410
+ },
411
+ {
412
+ "name": "metadata",
413
+ "type": "text",
414
+ "required": false,
415
+ "columnType": "TEXT"
416
+ }
417
+ ],
418
+ "relationships": [
419
+ {
420
+ "name": "profileId",
421
+ "type": "crossPackageRef",
422
+ "required": false,
423
+ "related": "@happyvertical/smrt-profiles:Profile",
424
+ "columnType": "UUID"
425
+ },
426
+ {
427
+ "name": "propertyId",
428
+ "type": "crossPackageRef",
429
+ "required": false,
430
+ "related": "@happyvertical/smrt-properties:Property",
431
+ "columnType": "UUID"
432
+ },
433
+ {
434
+ "name": "parentPartnerId",
435
+ "type": "foreignKey",
436
+ "required": false,
437
+ "related": "Partner",
438
+ "columnType": "UUID"
439
+ },
440
+ {
441
+ "name": "referredById",
442
+ "type": "foreignKey",
443
+ "required": false,
444
+ "related": "Partner",
445
+ "columnType": "UUID"
446
+ }
447
+ ],
448
+ "methods": [
449
+ "getEffectiveSalesRate",
450
+ "getMetadata",
451
+ "getPartnerTypes",
452
+ "hasParent",
453
+ "hasType",
454
+ "isActive",
455
+ "isPending",
456
+ "isPublisher",
457
+ "isReferrer",
458
+ "isSalesperson",
459
+ "isSuspended",
460
+ "setMetadata",
461
+ "setPartnerTypes",
462
+ "wasReferred"
463
+ ],
464
+ "surfaces": [
465
+ {
466
+ "kind": "api",
467
+ "name": "partners.list",
468
+ "operation": "list",
469
+ "objectName": "@happyvertical/smrt-affiliates:Partner",
470
+ "path": "/partners",
471
+ "method": "GET"
472
+ },
473
+ {
474
+ "kind": "api",
475
+ "name": "partners.get",
476
+ "operation": "get",
477
+ "objectName": "@happyvertical/smrt-affiliates:Partner",
478
+ "path": "/partners/[id]",
479
+ "method": "GET"
480
+ },
481
+ {
482
+ "kind": "api",
483
+ "name": "partners.create",
484
+ "operation": "create",
485
+ "objectName": "@happyvertical/smrt-affiliates:Partner",
486
+ "path": "/partners",
487
+ "method": "POST"
488
+ },
489
+ {
490
+ "kind": "api",
491
+ "name": "partners.update",
492
+ "operation": "update",
493
+ "objectName": "@happyvertical/smrt-affiliates:Partner",
494
+ "path": "/partners/[id]",
495
+ "method": "PATCH"
496
+ },
497
+ {
498
+ "kind": "cli",
499
+ "name": "partner_list",
500
+ "operation": "list",
501
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
502
+ },
503
+ {
504
+ "kind": "cli",
505
+ "name": "partner_get",
506
+ "operation": "get",
507
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
508
+ },
509
+ {
510
+ "kind": "cli",
511
+ "name": "partner_create",
512
+ "operation": "create",
513
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
514
+ },
515
+ {
516
+ "kind": "cli",
517
+ "name": "partner_update",
518
+ "operation": "update",
519
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
520
+ },
521
+ {
522
+ "kind": "cli",
523
+ "name": "partner_delete",
524
+ "operation": "delete",
525
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
526
+ },
527
+ {
528
+ "kind": "mcp",
529
+ "name": "partner_list",
530
+ "operation": "list",
531
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
532
+ },
533
+ {
534
+ "kind": "mcp",
535
+ "name": "partner_get",
536
+ "operation": "get",
537
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
538
+ },
539
+ {
540
+ "kind": "mcp",
541
+ "name": "partner_create",
542
+ "operation": "create",
543
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
544
+ }
545
+ ],
546
+ "relationshipFeatures": [
547
+ "crossPackageRef",
548
+ "foreignKey",
549
+ "uuidColumns"
550
+ ],
551
+ "tags": [],
552
+ "risks": []
553
+ },
554
+ {
555
+ "name": "Payout",
556
+ "qualifiedName": "@happyvertical/smrt-affiliates:Payout",
557
+ "collection": "payouts",
558
+ "tableName": "payouts",
559
+ "packageName": "@happyvertical/smrt-affiliates",
560
+ "extends": "SmrtObject",
561
+ "fields": [
562
+ {
563
+ "name": "partnerId",
564
+ "type": "foreignKey",
565
+ "required": false,
566
+ "related": "Partner",
567
+ "columnType": "UUID"
568
+ },
569
+ {
570
+ "name": "periodStart",
571
+ "type": "datetime",
572
+ "required": false,
573
+ "columnType": "TIMESTAMP"
574
+ },
575
+ {
576
+ "name": "periodEnd",
577
+ "type": "datetime",
578
+ "required": false,
579
+ "columnType": "TIMESTAMP"
580
+ },
581
+ {
582
+ "name": "displayEarnings",
583
+ "type": "integer",
584
+ "required": false,
585
+ "columnType": "INTEGER"
586
+ },
587
+ {
588
+ "name": "referralEarnings",
589
+ "type": "integer",
590
+ "required": false,
591
+ "columnType": "INTEGER"
592
+ },
593
+ {
594
+ "name": "salesEarnings",
595
+ "type": "integer",
596
+ "required": false,
597
+ "columnType": "INTEGER"
598
+ },
599
+ {
600
+ "name": "parentEarnings",
601
+ "type": "integer",
602
+ "required": false,
603
+ "columnType": "INTEGER"
604
+ },
605
+ {
606
+ "name": "overheadEarnings",
607
+ "type": "integer",
608
+ "required": false,
609
+ "columnType": "INTEGER"
610
+ },
611
+ {
612
+ "name": "totalAmount",
613
+ "type": "integer",
614
+ "required": false,
615
+ "columnType": "INTEGER"
616
+ },
617
+ {
618
+ "name": "currency",
619
+ "type": "text",
620
+ "required": false,
621
+ "columnType": "TEXT"
622
+ },
623
+ {
624
+ "name": "invoiceId",
625
+ "type": "crossPackageRef",
626
+ "required": false,
627
+ "related": "@happyvertical/smrt-commerce:Invoice",
628
+ "columnType": "UUID"
629
+ },
630
+ {
631
+ "name": "status",
632
+ "type": "text",
633
+ "required": false,
634
+ "columnType": "TEXT"
635
+ },
636
+ {
637
+ "name": "paymentReference",
638
+ "type": "text",
639
+ "required": false,
640
+ "columnType": "TEXT"
641
+ },
642
+ {
643
+ "name": "paidAt",
644
+ "type": "datetime",
645
+ "required": false,
646
+ "columnType": "TIMESTAMP"
647
+ },
648
+ {
649
+ "name": "notes",
650
+ "type": "text",
651
+ "required": false,
652
+ "columnType": "TEXT"
653
+ },
654
+ {
655
+ "name": "metadata",
656
+ "type": "text",
657
+ "required": false,
658
+ "columnType": "TEXT"
659
+ }
660
+ ],
661
+ "relationships": [
662
+ {
663
+ "name": "partnerId",
664
+ "type": "foreignKey",
665
+ "required": false,
666
+ "related": "Partner",
667
+ "columnType": "UUID"
668
+ },
669
+ {
670
+ "name": "invoiceId",
671
+ "type": "crossPackageRef",
672
+ "required": false,
673
+ "related": "@happyvertical/smrt-commerce:Invoice",
674
+ "columnType": "UUID"
675
+ }
676
+ ],
677
+ "methods": [
678
+ "approve",
679
+ "calculateTotal",
680
+ "complete",
681
+ "fail",
682
+ "getDisplayEarningsInDollars",
683
+ "getMetadata",
684
+ "getOverheadEarningsInDollars",
685
+ "getParentEarningsInDollars",
686
+ "getPeriodString",
687
+ "getReferralEarningsInDollars",
688
+ "getSalesEarningsInDollars",
689
+ "getTotalInDollars",
690
+ "isApproved",
691
+ "isCompleted",
692
+ "isFailed",
693
+ "isPending",
694
+ "isProcessing",
695
+ "markProcessing",
696
+ "setMetadata"
697
+ ],
698
+ "surfaces": [
699
+ {
700
+ "kind": "api",
701
+ "name": "payouts.list",
702
+ "operation": "list",
703
+ "objectName": "@happyvertical/smrt-affiliates:Payout",
704
+ "path": "/payouts",
705
+ "method": "GET"
706
+ },
707
+ {
708
+ "kind": "api",
709
+ "name": "payouts.get",
710
+ "operation": "get",
711
+ "objectName": "@happyvertical/smrt-affiliates:Payout",
712
+ "path": "/payouts/[id]",
713
+ "method": "GET"
714
+ },
715
+ {
716
+ "kind": "api",
717
+ "name": "payouts.create",
718
+ "operation": "create",
719
+ "objectName": "@happyvertical/smrt-affiliates:Payout",
720
+ "path": "/payouts",
721
+ "method": "POST"
722
+ },
723
+ {
724
+ "kind": "api",
725
+ "name": "payouts.update",
726
+ "operation": "update",
727
+ "objectName": "@happyvertical/smrt-affiliates:Payout",
728
+ "path": "/payouts/[id]",
729
+ "method": "PATCH"
730
+ },
731
+ {
732
+ "kind": "cli",
733
+ "name": "payout_list",
734
+ "operation": "list",
735
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
736
+ },
737
+ {
738
+ "kind": "cli",
739
+ "name": "payout_get",
740
+ "operation": "get",
741
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
742
+ },
743
+ {
744
+ "kind": "cli",
745
+ "name": "payout_create",
746
+ "operation": "create",
747
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
748
+ },
749
+ {
750
+ "kind": "cli",
751
+ "name": "payout_update",
752
+ "operation": "update",
753
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
754
+ },
755
+ {
756
+ "kind": "cli",
757
+ "name": "payout_delete",
758
+ "operation": "delete",
759
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
760
+ },
761
+ {
762
+ "kind": "mcp",
763
+ "name": "payout_list",
764
+ "operation": "list",
765
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
766
+ },
767
+ {
768
+ "kind": "mcp",
769
+ "name": "payout_get",
770
+ "operation": "get",
771
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
772
+ },
773
+ {
774
+ "kind": "mcp",
775
+ "name": "payout_create",
776
+ "operation": "create",
777
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
778
+ }
779
+ ],
780
+ "relationshipFeatures": [
781
+ "crossPackageRef",
782
+ "foreignKey",
783
+ "uuidColumns"
784
+ ],
785
+ "tags": [],
786
+ "risks": []
787
+ }
788
+ ],
789
+ "surfaces": [
790
+ {
791
+ "kind": "api",
792
+ "name": "commissions.create",
793
+ "operation": "create",
794
+ "objectName": "@happyvertical/smrt-affiliates:Commission",
795
+ "path": "/commissions",
796
+ "method": "POST"
797
+ },
798
+ {
799
+ "kind": "api",
800
+ "name": "commissions.list",
801
+ "operation": "list",
802
+ "objectName": "@happyvertical/smrt-affiliates:Commission",
803
+ "path": "/commissions",
804
+ "method": "GET"
805
+ },
806
+ {
807
+ "kind": "api",
808
+ "name": "commissions.get",
809
+ "operation": "get",
810
+ "objectName": "@happyvertical/smrt-affiliates:Commission",
811
+ "path": "/commissions/[id]",
812
+ "method": "GET"
813
+ },
814
+ {
815
+ "kind": "mcp",
816
+ "name": "commission_create",
817
+ "operation": "create",
818
+ "objectName": "@happyvertical/smrt-affiliates:Commission"
819
+ },
820
+ {
821
+ "kind": "mcp",
822
+ "name": "commission_list",
823
+ "operation": "list",
824
+ "objectName": "@happyvertical/smrt-affiliates:Commission"
825
+ },
826
+ {
827
+ "kind": "api",
828
+ "name": "partners.list",
829
+ "operation": "list",
830
+ "objectName": "@happyvertical/smrt-affiliates:Partner",
831
+ "path": "/partners",
832
+ "method": "GET"
833
+ },
834
+ {
835
+ "kind": "api",
836
+ "name": "partners.get",
837
+ "operation": "get",
838
+ "objectName": "@happyvertical/smrt-affiliates:Partner",
839
+ "path": "/partners/[id]",
840
+ "method": "GET"
841
+ },
842
+ {
843
+ "kind": "api",
844
+ "name": "partners.create",
845
+ "operation": "create",
846
+ "objectName": "@happyvertical/smrt-affiliates:Partner",
847
+ "path": "/partners",
848
+ "method": "POST"
849
+ },
850
+ {
851
+ "kind": "api",
852
+ "name": "partners.update",
853
+ "operation": "update",
854
+ "objectName": "@happyvertical/smrt-affiliates:Partner",
855
+ "path": "/partners/[id]",
856
+ "method": "PATCH"
857
+ },
858
+ {
859
+ "kind": "cli",
860
+ "name": "partner_list",
861
+ "operation": "list",
862
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
863
+ },
864
+ {
865
+ "kind": "cli",
866
+ "name": "partner_get",
867
+ "operation": "get",
868
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
869
+ },
870
+ {
871
+ "kind": "cli",
872
+ "name": "partner_create",
873
+ "operation": "create",
874
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
875
+ },
876
+ {
877
+ "kind": "cli",
878
+ "name": "partner_update",
879
+ "operation": "update",
880
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
881
+ },
882
+ {
883
+ "kind": "cli",
884
+ "name": "partner_delete",
885
+ "operation": "delete",
886
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
887
+ },
888
+ {
889
+ "kind": "mcp",
890
+ "name": "partner_list",
891
+ "operation": "list",
892
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
893
+ },
894
+ {
895
+ "kind": "mcp",
896
+ "name": "partner_get",
897
+ "operation": "get",
898
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
899
+ },
900
+ {
901
+ "kind": "mcp",
902
+ "name": "partner_create",
903
+ "operation": "create",
904
+ "objectName": "@happyvertical/smrt-affiliates:Partner"
905
+ },
906
+ {
907
+ "kind": "api",
908
+ "name": "payouts.list",
909
+ "operation": "list",
910
+ "objectName": "@happyvertical/smrt-affiliates:Payout",
911
+ "path": "/payouts",
912
+ "method": "GET"
913
+ },
914
+ {
915
+ "kind": "api",
916
+ "name": "payouts.get",
917
+ "operation": "get",
918
+ "objectName": "@happyvertical/smrt-affiliates:Payout",
919
+ "path": "/payouts/[id]",
920
+ "method": "GET"
921
+ },
922
+ {
923
+ "kind": "api",
924
+ "name": "payouts.create",
925
+ "operation": "create",
926
+ "objectName": "@happyvertical/smrt-affiliates:Payout",
927
+ "path": "/payouts",
928
+ "method": "POST"
929
+ },
930
+ {
931
+ "kind": "api",
932
+ "name": "payouts.update",
933
+ "operation": "update",
934
+ "objectName": "@happyvertical/smrt-affiliates:Payout",
935
+ "path": "/payouts/[id]",
936
+ "method": "PATCH"
937
+ },
938
+ {
939
+ "kind": "cli",
940
+ "name": "payout_list",
941
+ "operation": "list",
942
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
943
+ },
944
+ {
945
+ "kind": "cli",
946
+ "name": "payout_get",
947
+ "operation": "get",
948
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
949
+ },
950
+ {
951
+ "kind": "cli",
952
+ "name": "payout_create",
953
+ "operation": "create",
954
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
955
+ },
956
+ {
957
+ "kind": "cli",
958
+ "name": "payout_update",
959
+ "operation": "update",
960
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
961
+ },
962
+ {
963
+ "kind": "cli",
964
+ "name": "payout_delete",
965
+ "operation": "delete",
966
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
967
+ },
968
+ {
969
+ "kind": "mcp",
970
+ "name": "payout_list",
971
+ "operation": "list",
972
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
973
+ },
974
+ {
975
+ "kind": "mcp",
976
+ "name": "payout_get",
977
+ "operation": "get",
978
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
979
+ },
980
+ {
981
+ "kind": "mcp",
982
+ "name": "payout_create",
983
+ "operation": "create",
984
+ "objectName": "@happyvertical/smrt-affiliates:Payout"
985
+ }
986
+ ],
987
+ "prompts": [],
988
+ "relationshipsV2": {
989
+ "foreignKeyFields": 5,
990
+ "crossPackageRefFields": 4,
991
+ "junctionCollections": 0,
992
+ "hierarchicalObjects": 0,
993
+ "polymorphicAssociations": 0,
994
+ "uuidColumns": 15
995
+ },
996
+ "agentDoc": "# @happyvertical/smrt-affiliates\n\nPartner revenue sharing with multi-type partners, multi-tier commissions, and payout processing.\n\n## Models\n\n- **Partner**: `partnerTypes` JSON array (publisher/salesperson/referrer — multi-role). `parentPartnerId` for site-attached salespeople. `referredById` for referral attribution. `commissionRate`, `parentCommissionShare`.\n- **Commission**: 4 types per ad event — Display (publisher), Referral (referrer), Sales (salesperson), Parent (parent publisher's share). **Immutable** — no update/delete API.\n- **Payout**: batch aggregation. Status: `PENDING → APPROVED → PROCESSING → COMPLETED` (or FAILED).\n\n## Currency\n\n**All monetary fields are integer cents.** Helpers: `getTotalInDollars()`, `getAmountInDollars()`. `Commission.calculateAmount(grossRevenue, rate)` uses `Math.round()`.\n\n## Parent Commission Share\n\n```\nSalesperson.parentCommissionShare = 0.20 (20% to parent publisher)\nEffective sales rate = salesRate × (1 - parentCommissionShare)\n```\n\n## Cross-Package References (plain strings)\n\n`profileId` → smrt-profiles, `propertyId` → smrt-properties, `eventId` → smrt-ads, `invoiceId` → smrt-commerce\n\n## Tenancy\n\nPer `docs/content/standards.md §7`, tenant-aware models normally apply\n`@TenantScoped({ mode: 'optional' })` from `@happyvertical/smrt-tenancy`. The\nthree models in this package deviate intentionally; each `@smrt(...)` block\ncarries an inline comment pointing back to this section.\n\n`Partner`, `Commission`, and `Payout` are deliberately **NOT** tenant-scoped.\nThe affiliate network is a cross-tenant graph by design:\n\n- A single `Partner` (e.g. a publisher operating multiple sites across\n different tenants) needs a stable identity for revenue aggregation,\n payout thresholds, and tax reporting. Slicing partner identity per\n tenant would either duplicate the row or hide payouts owed across\n tenants.\n- `Commission` rows attribute revenue to a partner across whichever tenant\n generated the ad event; the cross-tenant attribution is the point of the\n network.\n- `Payout` aggregates commissions for a partner regardless of which tenant\n the underlying revenue came from. A tenant-scoped query would produce\n systematically incorrect totals.\n\nThis is the same reasoning that keeps `TenantKey` in `packages/secrets`\nout of the tenancy interceptor: rows that must be queried across tenants\nto fulfil their purpose should not be silently filtered.\n\nOperators that need tenant-attributed reporting should aggregate by\njoining `Commission` rows back to `eventId` (smrt-ads) and the originating\nad's tenant — not by adding `@TenantScoped` here.\n\n## Gotchas\n\n- **No tenancy** (intentional): cross-tenant network visibility for affiliate tracking — see Tenancy section above for rationale\n- **partnerTypes is JSON string**: must parse with `getPartnerTypes()` helper\n- **Commission rate copied at event time**: immutable record, not a live reference to Partner.commissionRate\n- **Payout amounts in cents**: divide by 100 for display\n- **No ledger integration**: Payout → Invoice mapping is external\n"
997
+ }