@happyvertical/smrt-products 0.56.0 → 0.56.2

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.
Files changed (26) hide show
  1. package/dist/lib/chunks/{ProductAssetCollection-pTm67_Vn.js → ProductAssetCollection-BuvXAMhk.js} +3 -3
  2. package/dist/lib/chunks/{ProductAssetCollection-pTm67_Vn.js.map → ProductAssetCollection-BuvXAMhk.js.map} +1 -1
  3. package/dist/lib/chunks/{ProductCollection-BJXVIE6A.js → ProductCollection-DG_vHXBB.js} +2 -2
  4. package/dist/lib/chunks/{ProductCollection-BJXVIE6A.js.map → ProductCollection-DG_vHXBB.js.map} +1 -1
  5. package/dist/lib/chunks/{Sku-CdhhTtjd.js → Sku-DOFW6Izt.js} +10 -2
  6. package/dist/lib/chunks/Sku-DOFW6Izt.js.map +1 -0
  7. package/dist/lib/chunks/__smrt-register__-CJ2Uym6T.js +6 -0
  8. package/dist/lib/chunks/__smrt-register__-CJ2Uym6T.js.map +1 -0
  9. package/dist/lib/chunks/{collections-BSkv0c_w.js → collections-DD9nJecp.js} +5 -5
  10. package/dist/lib/chunks/{collections-BSkv0c_w.js.map → collections-DD9nJecp.js.map} +1 -1
  11. package/dist/lib/chunks/{generated-Bc7lfF_t.js → generated-DH3DyJcQ.js} +2 -2
  12. package/dist/lib/chunks/{generated-Bc7lfF_t.js.map → generated-DH3DyJcQ.js.map} +1 -1
  13. package/dist/lib/chunks/models-BR8_apA1.js +2 -0
  14. package/dist/lib/collections.js +3 -3
  15. package/dist/lib/generated.js +1 -1
  16. package/dist/lib/index.js +7 -7
  17. package/dist/lib/lib/models/Product.d.ts +6 -0
  18. package/dist/lib/lib/models/Product.d.ts.map +1 -1
  19. package/dist/lib/manifest.json +206 -14
  20. package/dist/lib/models.js +2 -2
  21. package/dist/lib/smrt-knowledge.json +158 -483
  22. package/package.json +15 -15
  23. package/dist/lib/chunks/Sku-CdhhTtjd.js.map +0 -1
  24. package/dist/lib/chunks/__smrt-register__-CxtOiAsr.js +0 -6
  25. package/dist/lib/chunks/__smrt-register__-CxtOiAsr.js.map +0 -1
  26. package/dist/lib/chunks/models-C2Ytgu_O.js +0 -2
@@ -3,12 +3,12 @@
3
3
  "sensitiveFieldsExcluded": true,
4
4
  "generatedAt": "1970-01-01T00:00:00.000Z",
5
5
  "packageName": "@happyvertical/smrt-products",
6
- "packageVersion": "0.56.0",
6
+ "packageVersion": "0.56.2",
7
7
  "sourceManifestPath": "dist/lib/manifest.json",
8
8
  "agentDocPath": "AGENTS.md",
9
9
  "sourceHashes": {
10
- "manifest": "e0ef42e5fedb51f787d68f6e8d1c1a8b229ffa066964c56f0049723d19591369",
11
- "packageJson": "3d13af659c15147e5ac26936107ef5b9f7af77d26bc4bd6a5b7b8572fdd35b12",
10
+ "manifest": "eb59c8541103b0779e6a31738c6bf432f3a4e3c45ad33c4d508e9e6b7bbd31b2",
11
+ "packageJson": "c6eb9b4d9ed2fe6ac7cfd7865bb575551af14f8beedb003c9626f56dee837534",
12
12
  "agents": "b5aa86a9c02bb81be5621ae3397ff2dedcef972a520c2ba2f56ee7abf5613b8c"
13
13
  },
14
14
  "exports": [
@@ -79,7 +79,7 @@
79
79
  "typescript"
80
80
  ],
81
81
  "risks": [
82
- "cross-package-refs:1",
82
+ "cross-package-refs:5",
83
83
  "sensitive-fields-excluded",
84
84
  "sti-inheritance"
85
85
  ],
@@ -104,24 +104,19 @@
104
104
  }
105
105
  ],
106
106
  "surfaces": [
107
- {
108
- "kind": "api",
109
- "name": "categories.getRootCategories",
110
- "operation": "getRootCategories",
111
- "objectName": "@happyvertical/smrt-products:CategoryCollection",
112
- "path": "/categories/getRootCategories",
113
- "method": "POST"
114
- },
115
107
  {
116
108
  "kind": "cli",
117
109
  "name": "categorycollection_getRootCategories",
118
110
  "operation": "getRootCategories",
119
111
  "objectName": "@happyvertical/smrt-products:CategoryCollection"
120
- },
112
+ }
113
+ ],
114
+ "withheldSurfaces": [
121
115
  {
122
- "kind": "mcp",
123
- "name": "categorycollection_getrootcategories",
116
+ "kind": "api",
124
117
  "operation": "getRootCategories",
118
+ "code": "not-included",
119
+ "reason": "not listed in api.include",
125
120
  "objectName": "@happyvertical/smrt-products:CategoryCollection"
126
121
  }
127
122
  ],
@@ -202,54 +197,6 @@
202
197
  }
203
198
  ],
204
199
  "surfaces": [
205
- {
206
- "kind": "api",
207
- "name": "products.findByManufacturer",
208
- "operation": "findByManufacturer",
209
- "objectName": "@happyvertical/smrt-products:MaterialCollection",
210
- "path": "/products/findByManufacturer",
211
- "method": "POST"
212
- },
213
- {
214
- "kind": "api",
215
- "name": "products.findInStock",
216
- "operation": "findInStock",
217
- "objectName": "@happyvertical/smrt-products:MaterialCollection",
218
- "path": "/products/findInStock",
219
- "method": "POST"
220
- },
221
- {
222
- "kind": "api",
223
- "name": "products.getAssets",
224
- "operation": "getAssets",
225
- "objectName": "@happyvertical/smrt-products:MaterialCollection",
226
- "path": "/products/getAssets",
227
- "method": "POST"
228
- },
229
- {
230
- "kind": "api",
231
- "name": "products.addAsset",
232
- "operation": "addAsset",
233
- "objectName": "@happyvertical/smrt-products:MaterialCollection",
234
- "path": "/products/addAsset",
235
- "method": "POST"
236
- },
237
- {
238
- "kind": "api",
239
- "name": "products.removeAsset",
240
- "operation": "removeAsset",
241
- "objectName": "@happyvertical/smrt-products:MaterialCollection",
242
- "path": "/products/removeAsset",
243
- "method": "POST"
244
- },
245
- {
246
- "kind": "api",
247
- "name": "products.findByKind",
248
- "operation": "findByKind",
249
- "objectName": "@happyvertical/smrt-products:MaterialCollection",
250
- "path": "/products/findByKind",
251
- "method": "POST"
252
- },
253
200
  {
254
201
  "kind": "cli",
255
202
  "name": "materialcollection_findByManufacturer",
@@ -285,41 +232,49 @@
285
232
  "name": "materialcollection_findByKind",
286
233
  "operation": "findByKind",
287
234
  "objectName": "@happyvertical/smrt-products:MaterialCollection"
288
- },
235
+ }
236
+ ],
237
+ "withheldSurfaces": [
289
238
  {
290
- "kind": "mcp",
291
- "name": "materialcollection_findbymanufacturer",
292
- "operation": "findByManufacturer",
239
+ "kind": "api",
240
+ "operation": "addAsset",
241
+ "code": "not-included",
242
+ "reason": "not listed in api.include",
293
243
  "objectName": "@happyvertical/smrt-products:MaterialCollection"
294
244
  },
295
245
  {
296
- "kind": "mcp",
297
- "name": "materialcollection_findinstock",
298
- "operation": "findInStock",
246
+ "kind": "api",
247
+ "operation": "findByKind",
248
+ "code": "not-included",
249
+ "reason": "not listed in api.include",
299
250
  "objectName": "@happyvertical/smrt-products:MaterialCollection"
300
251
  },
301
252
  {
302
- "kind": "mcp",
303
- "name": "materialcollection_getassets",
304
- "operation": "getAssets",
253
+ "kind": "api",
254
+ "operation": "findByManufacturer",
255
+ "code": "not-included",
256
+ "reason": "not listed in api.include",
305
257
  "objectName": "@happyvertical/smrt-products:MaterialCollection"
306
258
  },
307
259
  {
308
- "kind": "mcp",
309
- "name": "materialcollection_addasset",
310
- "operation": "addAsset",
260
+ "kind": "api",
261
+ "operation": "findInStock",
262
+ "code": "not-included",
263
+ "reason": "not listed in api.include",
311
264
  "objectName": "@happyvertical/smrt-products:MaterialCollection"
312
265
  },
313
266
  {
314
- "kind": "mcp",
315
- "name": "materialcollection_removeasset",
316
- "operation": "removeAsset",
267
+ "kind": "api",
268
+ "operation": "getAssets",
269
+ "code": "not-included",
270
+ "reason": "not listed in api.include",
317
271
  "objectName": "@happyvertical/smrt-products:MaterialCollection"
318
272
  },
319
273
  {
320
- "kind": "mcp",
321
- "name": "materialcollection_findbykind",
322
- "operation": "findByKind",
274
+ "kind": "api",
275
+ "operation": "removeAsset",
276
+ "code": "not-included",
277
+ "reason": "not listed in api.include",
323
278
  "objectName": "@happyvertical/smrt-products:MaterialCollection"
324
279
  }
325
280
  ],
@@ -556,46 +511,6 @@
556
511
  }
557
512
  ],
558
513
  "surfaces": [
559
- {
560
- "kind": "api",
561
- "name": "products.findByManufacturer",
562
- "operation": "findByManufacturer",
563
- "objectName": "@happyvertical/smrt-products:ProductCollection",
564
- "path": "/products/findByManufacturer",
565
- "method": "POST"
566
- },
567
- {
568
- "kind": "api",
569
- "name": "products.findInStock",
570
- "operation": "findInStock",
571
- "objectName": "@happyvertical/smrt-products:ProductCollection",
572
- "path": "/products/findInStock",
573
- "method": "POST"
574
- },
575
- {
576
- "kind": "api",
577
- "name": "products.getAssets",
578
- "operation": "getAssets",
579
- "objectName": "@happyvertical/smrt-products:ProductCollection",
580
- "path": "/products/getAssets",
581
- "method": "POST"
582
- },
583
- {
584
- "kind": "api",
585
- "name": "products.addAsset",
586
- "operation": "addAsset",
587
- "objectName": "@happyvertical/smrt-products:ProductCollection",
588
- "path": "/products/addAsset",
589
- "method": "POST"
590
- },
591
- {
592
- "kind": "api",
593
- "name": "products.removeAsset",
594
- "operation": "removeAsset",
595
- "objectName": "@happyvertical/smrt-products:ProductCollection",
596
- "path": "/products/removeAsset",
597
- "method": "POST"
598
- },
599
514
  {
600
515
  "kind": "cli",
601
516
  "name": "productcollection_findByManufacturer",
@@ -625,35 +540,42 @@
625
540
  "name": "productcollection_removeAsset",
626
541
  "operation": "removeAsset",
627
542
  "objectName": "@happyvertical/smrt-products:ProductCollection"
543
+ }
544
+ ],
545
+ "withheldSurfaces": [
546
+ {
547
+ "kind": "api",
548
+ "operation": "addAsset",
549
+ "code": "not-included",
550
+ "reason": "not listed in api.include",
551
+ "objectName": "@happyvertical/smrt-products:ProductCollection"
628
552
  },
629
553
  {
630
- "kind": "mcp",
631
- "name": "productcollection_findbymanufacturer",
554
+ "kind": "api",
632
555
  "operation": "findByManufacturer",
556
+ "code": "not-included",
557
+ "reason": "not listed in api.include",
633
558
  "objectName": "@happyvertical/smrt-products:ProductCollection"
634
559
  },
635
560
  {
636
- "kind": "mcp",
637
- "name": "productcollection_findinstock",
561
+ "kind": "api",
638
562
  "operation": "findInStock",
563
+ "code": "not-included",
564
+ "reason": "not listed in api.include",
639
565
  "objectName": "@happyvertical/smrt-products:ProductCollection"
640
566
  },
641
567
  {
642
- "kind": "mcp",
643
- "name": "productcollection_getassets",
568
+ "kind": "api",
644
569
  "operation": "getAssets",
570
+ "code": "not-included",
571
+ "reason": "not listed in api.include",
645
572
  "objectName": "@happyvertical/smrt-products:ProductCollection"
646
573
  },
647
574
  {
648
- "kind": "mcp",
649
- "name": "productcollection_addasset",
650
- "operation": "addAsset",
651
- "objectName": "@happyvertical/smrt-products:ProductCollection"
652
- },
653
- {
654
- "kind": "mcp",
655
- "name": "productcollection_removeasset",
575
+ "kind": "api",
656
576
  "operation": "removeAsset",
577
+ "code": "not-included",
578
+ "reason": "not listed in api.include",
657
579
  "objectName": "@happyvertical/smrt-products:ProductCollection"
658
580
  }
659
581
  ],
@@ -696,22 +618,6 @@
696
618
  }
697
619
  ],
698
620
  "surfaces": [
699
- {
700
- "kind": "api",
701
- "name": "productvariants.findForProduct",
702
- "operation": "findForProduct",
703
- "objectName": "@happyvertical/smrt-products:ProductVariantCollection",
704
- "path": "/productvariants/findForProduct",
705
- "method": "POST"
706
- },
707
- {
708
- "kind": "api",
709
- "name": "productvariants.findAxis",
710
- "operation": "findAxis",
711
- "objectName": "@happyvertical/smrt-products:ProductVariantCollection",
712
- "path": "/productvariants/findAxis",
713
- "method": "POST"
714
- },
715
621
  {
716
622
  "kind": "cli",
717
623
  "name": "productvariantcollection_findForProduct",
@@ -723,17 +629,21 @@
723
629
  "name": "productvariantcollection_findAxis",
724
630
  "operation": "findAxis",
725
631
  "objectName": "@happyvertical/smrt-products:ProductVariantCollection"
726
- },
632
+ }
633
+ ],
634
+ "withheldSurfaces": [
727
635
  {
728
- "kind": "mcp",
729
- "name": "productvariantcollection_findforproduct",
730
- "operation": "findForProduct",
636
+ "kind": "api",
637
+ "operation": "findAxis",
638
+ "code": "not-included",
639
+ "reason": "not listed in api.include",
731
640
  "objectName": "@happyvertical/smrt-products:ProductVariantCollection"
732
641
  },
733
642
  {
734
- "kind": "mcp",
735
- "name": "productvariantcollection_findaxis",
736
- "operation": "findAxis",
643
+ "kind": "api",
644
+ "operation": "findForProduct",
645
+ "code": "not-included",
646
+ "reason": "not listed in api.include",
737
647
  "objectName": "@happyvertical/smrt-products:ProductVariantCollection"
738
648
  }
739
649
  ],
@@ -802,46 +712,6 @@
802
712
  }
803
713
  ],
804
714
  "surfaces": [
805
- {
806
- "kind": "api",
807
- "name": "skus.findByCode",
808
- "operation": "findByCode",
809
- "objectName": "@happyvertical/smrt-products:SkuCollection",
810
- "path": "/skus/findByCode",
811
- "method": "POST"
812
- },
813
- {
814
- "kind": "api",
815
- "name": "skus.findByBarcode",
816
- "operation": "findByBarcode",
817
- "objectName": "@happyvertical/smrt-products:SkuCollection",
818
- "path": "/skus/findByBarcode",
819
- "method": "POST"
820
- },
821
- {
822
- "kind": "api",
823
- "name": "skus.findByProduct",
824
- "operation": "findByProduct",
825
- "objectName": "@happyvertical/smrt-products:SkuCollection",
826
- "path": "/skus/findByProduct",
827
- "method": "POST"
828
- },
829
- {
830
- "kind": "api",
831
- "name": "skus.findByParent",
832
- "operation": "findByParent",
833
- "objectName": "@happyvertical/smrt-products:SkuCollection",
834
- "path": "/skus/findByParent",
835
- "method": "POST"
836
- },
837
- {
838
- "kind": "api",
839
- "name": "skus.findActive",
840
- "operation": "findActive",
841
- "objectName": "@happyvertical/smrt-products:SkuCollection",
842
- "path": "/skus/findActive",
843
- "method": "POST"
844
- },
845
715
  {
846
716
  "kind": "cli",
847
717
  "name": "skucollection_findByCode",
@@ -871,35 +741,42 @@
871
741
  "name": "skucollection_findActive",
872
742
  "operation": "findActive",
873
743
  "objectName": "@happyvertical/smrt-products:SkuCollection"
874
- },
744
+ }
745
+ ],
746
+ "withheldSurfaces": [
875
747
  {
876
- "kind": "mcp",
877
- "name": "skucollection_findbycode",
878
- "operation": "findByCode",
748
+ "kind": "api",
749
+ "operation": "findActive",
750
+ "code": "not-included",
751
+ "reason": "not listed in api.include",
879
752
  "objectName": "@happyvertical/smrt-products:SkuCollection"
880
753
  },
881
754
  {
882
- "kind": "mcp",
883
- "name": "skucollection_findbybarcode",
755
+ "kind": "api",
884
756
  "operation": "findByBarcode",
757
+ "code": "not-included",
758
+ "reason": "not listed in api.include",
885
759
  "objectName": "@happyvertical/smrt-products:SkuCollection"
886
760
  },
887
761
  {
888
- "kind": "mcp",
889
- "name": "skucollection_findbyproduct",
890
- "operation": "findByProduct",
762
+ "kind": "api",
763
+ "operation": "findByCode",
764
+ "code": "not-included",
765
+ "reason": "not listed in api.include",
891
766
  "objectName": "@happyvertical/smrt-products:SkuCollection"
892
767
  },
893
768
  {
894
- "kind": "mcp",
895
- "name": "skucollection_findbyparent",
769
+ "kind": "api",
896
770
  "operation": "findByParent",
771
+ "code": "not-included",
772
+ "reason": "not listed in api.include",
897
773
  "objectName": "@happyvertical/smrt-products:SkuCollection"
898
774
  },
899
775
  {
900
- "kind": "mcp",
901
- "name": "skucollection_findactive",
902
- "operation": "findActive",
776
+ "kind": "api",
777
+ "operation": "findByProduct",
778
+ "code": "not-included",
779
+ "reason": "not listed in api.include",
903
780
  "objectName": "@happyvertical/smrt-products:SkuCollection"
904
781
  }
905
782
  ],
@@ -1156,6 +1033,22 @@
1156
1033
  "default": 0,
1157
1034
  "description": "The price in minor units (cents), for example 1999 for 19.99."
1158
1035
  },
1036
+ {
1037
+ "name": "defaultSalesTaxCodeId",
1038
+ "type": "crossPackageRef",
1039
+ "required": false,
1040
+ "related": "@happyvertical/smrt-commerce:TaxCode",
1041
+ "columnType": "UUID",
1042
+ "description": "The tax code normally used when this product is sold."
1043
+ },
1044
+ {
1045
+ "name": "defaultPurchaseTaxCodeId",
1046
+ "type": "crossPackageRef",
1047
+ "required": false,
1048
+ "related": "@happyvertical/smrt-commerce:TaxCode",
1049
+ "columnType": "UUID",
1050
+ "description": "The tax code normally used when this product is purchased."
1051
+ },
1159
1052
  {
1160
1053
  "name": "inStock",
1161
1054
  "type": "boolean",
@@ -1196,7 +1089,22 @@
1196
1089
  "default": 0
1197
1090
  }
1198
1091
  ],
1199
- "relationships": [],
1092
+ "relationships": [
1093
+ {
1094
+ "name": "defaultSalesTaxCodeId",
1095
+ "type": "crossPackageRef",
1096
+ "required": false,
1097
+ "related": "@happyvertical/smrt-commerce:TaxCode",
1098
+ "columnType": "UUID"
1099
+ },
1100
+ {
1101
+ "name": "defaultPurchaseTaxCodeId",
1102
+ "type": "crossPackageRef",
1103
+ "required": false,
1104
+ "related": "@happyvertical/smrt-commerce:TaxCode",
1105
+ "columnType": "UUID"
1106
+ }
1107
+ ],
1200
1108
  "methods": [
1201
1109
  "addAsset",
1202
1110
  "getAssets",
@@ -1400,6 +1308,7 @@
1400
1308
  }
1401
1309
  ],
1402
1310
  "relationshipFeatures": [
1311
+ "crossPackageRef",
1403
1312
  "uuidColumns"
1404
1313
  ],
1405
1314
  "tags": [],
@@ -1479,6 +1388,22 @@
1479
1388
  "default": 0,
1480
1389
  "description": "The price in minor units (cents), for example 1999 for 19.99."
1481
1390
  },
1391
+ {
1392
+ "name": "defaultSalesTaxCodeId",
1393
+ "type": "crossPackageRef",
1394
+ "required": false,
1395
+ "related": "@happyvertical/smrt-commerce:TaxCode",
1396
+ "columnType": "UUID",
1397
+ "description": "The tax code normally used when this product is sold."
1398
+ },
1399
+ {
1400
+ "name": "defaultPurchaseTaxCodeId",
1401
+ "type": "crossPackageRef",
1402
+ "required": false,
1403
+ "related": "@happyvertical/smrt-commerce:TaxCode",
1404
+ "columnType": "UUID",
1405
+ "description": "The tax code normally used when this product is purchased."
1406
+ },
1482
1407
  {
1483
1408
  "name": "inStock",
1484
1409
  "type": "boolean",
@@ -1501,7 +1426,22 @@
1501
1426
  "default": []
1502
1427
  }
1503
1428
  ],
1504
- "relationships": [],
1429
+ "relationships": [
1430
+ {
1431
+ "name": "defaultSalesTaxCodeId",
1432
+ "type": "crossPackageRef",
1433
+ "required": false,
1434
+ "related": "@happyvertical/smrt-commerce:TaxCode",
1435
+ "columnType": "UUID"
1436
+ },
1437
+ {
1438
+ "name": "defaultPurchaseTaxCodeId",
1439
+ "type": "crossPackageRef",
1440
+ "required": false,
1441
+ "related": "@happyvertical/smrt-commerce:TaxCode",
1442
+ "columnType": "UUID"
1443
+ }
1444
+ ],
1505
1445
  "methods": [
1506
1446
  "addAsset",
1507
1447
  "getAssets",
@@ -1711,6 +1651,7 @@
1711
1651
  }
1712
1652
  ],
1713
1653
  "relationshipFeatures": [
1654
+ "crossPackageRef",
1714
1655
  "uuidColumns"
1715
1656
  ],
1716
1657
  "tags": [],
@@ -2200,74 +2141,12 @@
2200
2141
  }
2201
2142
  ],
2202
2143
  "surfaces": [
2203
- {
2204
- "kind": "api",
2205
- "name": "categories.getRootCategories",
2206
- "operation": "getRootCategories",
2207
- "objectName": "@happyvertical/smrt-products:CategoryCollection",
2208
- "path": "/categories/getRootCategories",
2209
- "method": "POST"
2210
- },
2211
2144
  {
2212
2145
  "kind": "cli",
2213
2146
  "name": "categorycollection_getRootCategories",
2214
2147
  "operation": "getRootCategories",
2215
2148
  "objectName": "@happyvertical/smrt-products:CategoryCollection"
2216
2149
  },
2217
- {
2218
- "kind": "mcp",
2219
- "name": "categorycollection_getrootcategories",
2220
- "operation": "getRootCategories",
2221
- "objectName": "@happyvertical/smrt-products:CategoryCollection"
2222
- },
2223
- {
2224
- "kind": "api",
2225
- "name": "products.findByManufacturer",
2226
- "operation": "findByManufacturer",
2227
- "objectName": "@happyvertical/smrt-products:MaterialCollection",
2228
- "path": "/products/findByManufacturer",
2229
- "method": "POST"
2230
- },
2231
- {
2232
- "kind": "api",
2233
- "name": "products.findInStock",
2234
- "operation": "findInStock",
2235
- "objectName": "@happyvertical/smrt-products:MaterialCollection",
2236
- "path": "/products/findInStock",
2237
- "method": "POST"
2238
- },
2239
- {
2240
- "kind": "api",
2241
- "name": "products.getAssets",
2242
- "operation": "getAssets",
2243
- "objectName": "@happyvertical/smrt-products:MaterialCollection",
2244
- "path": "/products/getAssets",
2245
- "method": "POST"
2246
- },
2247
- {
2248
- "kind": "api",
2249
- "name": "products.addAsset",
2250
- "operation": "addAsset",
2251
- "objectName": "@happyvertical/smrt-products:MaterialCollection",
2252
- "path": "/products/addAsset",
2253
- "method": "POST"
2254
- },
2255
- {
2256
- "kind": "api",
2257
- "name": "products.removeAsset",
2258
- "operation": "removeAsset",
2259
- "objectName": "@happyvertical/smrt-products:MaterialCollection",
2260
- "path": "/products/removeAsset",
2261
- "method": "POST"
2262
- },
2263
- {
2264
- "kind": "api",
2265
- "name": "products.findByKind",
2266
- "operation": "findByKind",
2267
- "objectName": "@happyvertical/smrt-products:MaterialCollection",
2268
- "path": "/products/findByKind",
2269
- "method": "POST"
2270
- },
2271
2150
  {
2272
2151
  "kind": "cli",
2273
2152
  "name": "materialcollection_findByManufacturer",
@@ -2304,82 +2183,6 @@
2304
2183
  "operation": "findByKind",
2305
2184
  "objectName": "@happyvertical/smrt-products:MaterialCollection"
2306
2185
  },
2307
- {
2308
- "kind": "mcp",
2309
- "name": "materialcollection_findbymanufacturer",
2310
- "operation": "findByManufacturer",
2311
- "objectName": "@happyvertical/smrt-products:MaterialCollection"
2312
- },
2313
- {
2314
- "kind": "mcp",
2315
- "name": "materialcollection_findinstock",
2316
- "operation": "findInStock",
2317
- "objectName": "@happyvertical/smrt-products:MaterialCollection"
2318
- },
2319
- {
2320
- "kind": "mcp",
2321
- "name": "materialcollection_getassets",
2322
- "operation": "getAssets",
2323
- "objectName": "@happyvertical/smrt-products:MaterialCollection"
2324
- },
2325
- {
2326
- "kind": "mcp",
2327
- "name": "materialcollection_addasset",
2328
- "operation": "addAsset",
2329
- "objectName": "@happyvertical/smrt-products:MaterialCollection"
2330
- },
2331
- {
2332
- "kind": "mcp",
2333
- "name": "materialcollection_removeasset",
2334
- "operation": "removeAsset",
2335
- "objectName": "@happyvertical/smrt-products:MaterialCollection"
2336
- },
2337
- {
2338
- "kind": "mcp",
2339
- "name": "materialcollection_findbykind",
2340
- "operation": "findByKind",
2341
- "objectName": "@happyvertical/smrt-products:MaterialCollection"
2342
- },
2343
- {
2344
- "kind": "api",
2345
- "name": "products.findByManufacturer",
2346
- "operation": "findByManufacturer",
2347
- "objectName": "@happyvertical/smrt-products:ProductCollection",
2348
- "path": "/products/findByManufacturer",
2349
- "method": "POST"
2350
- },
2351
- {
2352
- "kind": "api",
2353
- "name": "products.findInStock",
2354
- "operation": "findInStock",
2355
- "objectName": "@happyvertical/smrt-products:ProductCollection",
2356
- "path": "/products/findInStock",
2357
- "method": "POST"
2358
- },
2359
- {
2360
- "kind": "api",
2361
- "name": "products.getAssets",
2362
- "operation": "getAssets",
2363
- "objectName": "@happyvertical/smrt-products:ProductCollection",
2364
- "path": "/products/getAssets",
2365
- "method": "POST"
2366
- },
2367
- {
2368
- "kind": "api",
2369
- "name": "products.addAsset",
2370
- "operation": "addAsset",
2371
- "objectName": "@happyvertical/smrt-products:ProductCollection",
2372
- "path": "/products/addAsset",
2373
- "method": "POST"
2374
- },
2375
- {
2376
- "kind": "api",
2377
- "name": "products.removeAsset",
2378
- "operation": "removeAsset",
2379
- "objectName": "@happyvertical/smrt-products:ProductCollection",
2380
- "path": "/products/removeAsset",
2381
- "method": "POST"
2382
- },
2383
2186
  {
2384
2187
  "kind": "cli",
2385
2188
  "name": "productcollection_findByManufacturer",
@@ -2410,52 +2213,6 @@
2410
2213
  "operation": "removeAsset",
2411
2214
  "objectName": "@happyvertical/smrt-products:ProductCollection"
2412
2215
  },
2413
- {
2414
- "kind": "mcp",
2415
- "name": "productcollection_findbymanufacturer",
2416
- "operation": "findByManufacturer",
2417
- "objectName": "@happyvertical/smrt-products:ProductCollection"
2418
- },
2419
- {
2420
- "kind": "mcp",
2421
- "name": "productcollection_findinstock",
2422
- "operation": "findInStock",
2423
- "objectName": "@happyvertical/smrt-products:ProductCollection"
2424
- },
2425
- {
2426
- "kind": "mcp",
2427
- "name": "productcollection_getassets",
2428
- "operation": "getAssets",
2429
- "objectName": "@happyvertical/smrt-products:ProductCollection"
2430
- },
2431
- {
2432
- "kind": "mcp",
2433
- "name": "productcollection_addasset",
2434
- "operation": "addAsset",
2435
- "objectName": "@happyvertical/smrt-products:ProductCollection"
2436
- },
2437
- {
2438
- "kind": "mcp",
2439
- "name": "productcollection_removeasset",
2440
- "operation": "removeAsset",
2441
- "objectName": "@happyvertical/smrt-products:ProductCollection"
2442
- },
2443
- {
2444
- "kind": "api",
2445
- "name": "productvariants.findForProduct",
2446
- "operation": "findForProduct",
2447
- "objectName": "@happyvertical/smrt-products:ProductVariantCollection",
2448
- "path": "/productvariants/findForProduct",
2449
- "method": "POST"
2450
- },
2451
- {
2452
- "kind": "api",
2453
- "name": "productvariants.findAxis",
2454
- "operation": "findAxis",
2455
- "objectName": "@happyvertical/smrt-products:ProductVariantCollection",
2456
- "path": "/productvariants/findAxis",
2457
- "method": "POST"
2458
- },
2459
2216
  {
2460
2217
  "kind": "cli",
2461
2218
  "name": "productvariantcollection_findForProduct",
@@ -2468,58 +2225,6 @@
2468
2225
  "operation": "findAxis",
2469
2226
  "objectName": "@happyvertical/smrt-products:ProductVariantCollection"
2470
2227
  },
2471
- {
2472
- "kind": "mcp",
2473
- "name": "productvariantcollection_findforproduct",
2474
- "operation": "findForProduct",
2475
- "objectName": "@happyvertical/smrt-products:ProductVariantCollection"
2476
- },
2477
- {
2478
- "kind": "mcp",
2479
- "name": "productvariantcollection_findaxis",
2480
- "operation": "findAxis",
2481
- "objectName": "@happyvertical/smrt-products:ProductVariantCollection"
2482
- },
2483
- {
2484
- "kind": "api",
2485
- "name": "skus.findByCode",
2486
- "operation": "findByCode",
2487
- "objectName": "@happyvertical/smrt-products:SkuCollection",
2488
- "path": "/skus/findByCode",
2489
- "method": "POST"
2490
- },
2491
- {
2492
- "kind": "api",
2493
- "name": "skus.findByBarcode",
2494
- "operation": "findByBarcode",
2495
- "objectName": "@happyvertical/smrt-products:SkuCollection",
2496
- "path": "/skus/findByBarcode",
2497
- "method": "POST"
2498
- },
2499
- {
2500
- "kind": "api",
2501
- "name": "skus.findByProduct",
2502
- "operation": "findByProduct",
2503
- "objectName": "@happyvertical/smrt-products:SkuCollection",
2504
- "path": "/skus/findByProduct",
2505
- "method": "POST"
2506
- },
2507
- {
2508
- "kind": "api",
2509
- "name": "skus.findByParent",
2510
- "operation": "findByParent",
2511
- "objectName": "@happyvertical/smrt-products:SkuCollection",
2512
- "path": "/skus/findByParent",
2513
- "method": "POST"
2514
- },
2515
- {
2516
- "kind": "api",
2517
- "name": "skus.findActive",
2518
- "operation": "findActive",
2519
- "objectName": "@happyvertical/smrt-products:SkuCollection",
2520
- "path": "/skus/findActive",
2521
- "method": "POST"
2522
- },
2523
2228
  {
2524
2229
  "kind": "cli",
2525
2230
  "name": "skucollection_findByCode",
@@ -2550,36 +2255,6 @@
2550
2255
  "operation": "findActive",
2551
2256
  "objectName": "@happyvertical/smrt-products:SkuCollection"
2552
2257
  },
2553
- {
2554
- "kind": "mcp",
2555
- "name": "skucollection_findbycode",
2556
- "operation": "findByCode",
2557
- "objectName": "@happyvertical/smrt-products:SkuCollection"
2558
- },
2559
- {
2560
- "kind": "mcp",
2561
- "name": "skucollection_findbybarcode",
2562
- "operation": "findByBarcode",
2563
- "objectName": "@happyvertical/smrt-products:SkuCollection"
2564
- },
2565
- {
2566
- "kind": "mcp",
2567
- "name": "skucollection_findbyproduct",
2568
- "operation": "findByProduct",
2569
- "objectName": "@happyvertical/smrt-products:SkuCollection"
2570
- },
2571
- {
2572
- "kind": "mcp",
2573
- "name": "skucollection_findbyparent",
2574
- "operation": "findByParent",
2575
- "objectName": "@happyvertical/smrt-products:SkuCollection"
2576
- },
2577
- {
2578
- "kind": "mcp",
2579
- "name": "skucollection_findactive",
2580
- "operation": "findActive",
2581
- "objectName": "@happyvertical/smrt-products:SkuCollection"
2582
- },
2583
2258
  {
2584
2259
  "kind": "api",
2585
2260
  "name": "categories.list",
@@ -3038,11 +2713,11 @@
3038
2713
  "prompts": [],
3039
2714
  "relationshipsV2": {
3040
2715
  "foreignKeyFields": 2,
3041
- "crossPackageRefFields": 1,
2716
+ "crossPackageRefFields": 5,
3042
2717
  "junctionCollections": 1,
3043
2718
  "hierarchicalObjects": 0,
3044
2719
  "polymorphicAssociations": 0,
3045
- "uuidColumns": 30
2720
+ "uuidColumns": 38
3046
2721
  },
3047
2722
  "agentDoc": "# @happyvertical/smrt-products\n\nProduct catalog — reference template for triple-consumption: npm package library, module federation, and standalone REST API server.\n\n## Models\n\n- **Product**: STI base. Tenant-scoped (`@TenantScoped({ mode: 'optional' })`, nullable `tenantId`). Knowledge base product with specs, tags, and the `productType` discriminator. Consumers subclass this with vertical-specific subtypes (apparel `Style`, automotive `Model`, furniture `Design`, etc.).\n- **Material**: STI subtype. Raw input consumed by manufacturing (fabric, trim, thread, packaging, component). Meta fields: `materialKind`, `uom`, `costPerUnit`. Materials are first-class products in the catalog — the SAP/NetSuite pattern. Bills of materials in `@happyvertical/smrt-manufacturing` reference Materials by id.\n- **Assembly** (`ProductType.ASSEMBLY`, `'assembly'`): the made counterpart to `Material`, defined in `@happyvertical/smrt-manufacturing` as a cross-package STI subtype. Its own fields are columns on `products`; the enum value lives here so catalog code can filter by type without importing manufacturing.\n- **ProductVariant**: standalone (NOT a Product STI subtype). Declarative axis definition: `productId`, `axisName` (e.g. `'size'`, `'color'`, `'finish'`), `allowedValues` (JSON-stored array), optional `label` and `sortOrder`. Per-SKU value pins live on `Sku.attributes`. Lives in its own `product_variants` table; `conflictColumns: ['product_id', 'axis_name', 'tenant_id']`.\n- **Sku**: standalone. The smallest sellable / countable unit. `productId` points at a `Product` or any of its STI subtypes; `code` is the human-meaningful identifier; `attributes` JSON pins each axis value (`{ size: 'M', color: 'navy' }`). Lives in its own `product_skus` table; `conflictColumns: ['code', 'tenant_id']`. Stock balance and movement history for a Sku live in `@happyvertical/smrt-inventory`.\n- **ProductAsset**: dedicated owned-asset join in `product_assets` with `relationship` and `sortOrder`. Tenant-scoped to match Product.\n- **Category**: hierarchical (parentId, level, productCount). STI base, tenant-scoped.\n\n## Vertical-specific Product subtypes\n\nThis package deliberately ships ONLY the generic primitives. Domain-specific top-level item types live in the consumer's template:\n\n- Apparel: `Style extends Product`, `Makeup extends Product`\n- Furniture: `Design extends Product`, `Configuration extends Product`\n- Automotive: `Model extends Product`, `Trim extends Product`\n- CPG: `Brand extends Product`, `Recipe extends Product`\n\nEach is a small subclass: `@smrt()`, override `productType`, add `@meta()` fields. See `packages/template-apparel-erp` for a worked example.\n\n## Variants — the two concepts\n\nThe framework's variant story uses two distinct primitives that look similar but do different jobs:\n\n- **`ProductVariant`** — *axis declaration*. \"For product X, axis `size` accepts the values `[XS, S, M, L, XL]`.\" Drives form/UI choices.\n- **`Sku.attributes`** — *per-unit value pins*. `{ color: 'navy', size: 'M' }` on each concrete sellable SKU.\n\nBoth live in this package — all catalog shapes are here. Stock motion (where the SKU is, how many, history) lives in `@happyvertical/smrt-inventory`.\n\nThere is deliberately no separate \"catalog grouping above SKU\" row (a la a \"Navy colorway\" row sitting between the Product and its Skus). Group SKUs by axis value via `attributes.color = 'navy'` queries; attach per-axis-value assets via `ProductAsset` rows with relationship metadata. Matches how Shopify, Stripe Products, and most e-commerce platforms model the same shape.\n\n## Collections\n\n- **ProductCollection** — base. Polymorphic queries return the correct subclass instance per row.\n- **MaterialCollection** — STI-filtered subclass. Override `_itemClass`; framework auto-filters by `_meta_type`.\n- **ProductVariantCollection** — standalone collection over `product_variants`. Helpers: `findForProduct(productId)`, `findAxis(productId, axisName)`.\n- **SkuCollection** — standalone collection over `product_skus`. Helpers: `findByCode`, `findByBarcode`, `findByProduct`, `findByParent`, `findActive`.\n- **CategoryCollection** — standard Category CRUD with `getRootCategories()`.\n- **ProductAssetCollection** — direct access to `product_assets` rows and product asset helper wrappers.\n\n## Multi-tenancy\n\nOptional. With `withTenant(id, fn)` (from `@happyvertical/smrt-tenancy`), all queries auto-filter and inserts auto-stamp `tenantId`. Without it, models behave globally (`tenantId = null`). This lets the same package serve both shared reference catalogs and per-merchant SaaS catalogs.\n\n## Triple-Consumption Pattern\n\nSame codebase consumed three ways:\n1. **NPM library**: import classes directly\n2. **Module federation**: runtime component sharing (experimental)\n3. **Standalone API**: `startRestServer([Product, Category])`\n\n## Virtual Modules (Vite)\n\nAuto-generated via Vite plugins: `@happyvertical/smrt-client` (TypeScript client), `@happyvertical/smrt-types`, `@happyvertical/smrt-routes` (Express), `@happyvertical/smrt-mcp`, `@happyvertical/smrt-manifest`.\n\nSvelte 5 stores use runes (`$state`, `$derived`, `$effect`). `product-store.svelte.ts` is the main store (backed by the SMRT client); `product-store.client.svelte.ts` is a virtual-module-free variant for federation builds.\n\n## Client-data runtime — reference store (#1761)\n\nProducts is the reference consumer of the `@happyvertical/smrt-web` browser client-data runtime.\n\n- **Store** — `src/lib/stores/product-collection.ts` (subpath `@happyvertical/smrt-products/stores/product-collection`). `createProductCollection(definition, options)` builds a cached, reactive `SmrtWebCollection<ProductData>` over the generated `/api/v1/products` REST surface via `createSmrtCollection`. It is plugin-agnostic on purpose: the `products` definition is a PARAMETER (not a top-level import), so importing the store never eagerly resolves `@happyvertical/smrt-virt-web` (which exists only under the SMRT Vite plugin) — a unit test / npm consumer supplies its own definition. `productsCollectionDefinition()` lazily resolves the plugin definition (dynamic `import()`; resolved for `tsc` via the `@smrt/web` ambient alias). Deliberately NOT re-exported from the always-loaded `./stores` barrel — importing it is an explicit opt-in to the engine.\n- **Live surface** — `src/lib/components/LiveProductList.svelte` binds the store with `liveCollection` from `@happyvertical/smrt-svelte/web` (live rows + optimistic insert); it takes the definition as a prop. `src/app/pages/LiveProductsPage.svelte` (route `#live`) resolves the component AND the definition via `import()` and passes the definition down.\n- **Code-split (ratified condition ①)** — the ~76 kB TanStack engine must NEVER load on public / smrt-sites pages. `LiveProductsPage` reaches `LiveProductList` and the store ONLY through dynamic `import()`, so the engine lands in a lazily-loaded chunk; the app entry stays engine-free. NEVER import the store or live component statically from an app-root / public entry. `scripts/check-web-engine-code-split.mjs` (wrapped by `src/web-engine-code-split.spec.ts`, `pnpm test:code-split`) proves this against the REAL app graph: it runs the `--mode standalone` vite build and asserts, over the emitted rollup chunk graph, that the entry's static-import closure has zero `@tanstack/*` and the engine is reached only via `dynamicImports`. If the build hits the pre-existing nested-worktree `Tsconfig not found` failure locally, it falls back to a static-import-graph walk of the real `src/app/main.ts` (CI runs the real build).\n\n## Schema migrations (Phase 1 release)\n\nThis package's schema changed shape between the previous release and the Phase 1 apparel-ERP release. Consumers upgrading need to migrate two tables.\n\n### `Sku` rows moved tables\n\nPreviously `Sku` shipped in `@happyvertical/smrt-inventory` under table `inventory_skus`. It now lives here under `product_skus`. Cross-package refs (`StockLevel.skuId`, `BomLine.componentSkuId`) carry plain string ids that still resolve.\n\n**Upgrade procedure** (works on SQLite + Postgres; does NOT rely on `CREATE TABLE AS` which strips constraints):\n\n1. **Boot the new version once** so the framework's lazy `syncSchema` creates `product_skus` with the right PRIMARY KEY, NOT NULL, UNIQUE (`code`, `tenant_id`), and indexes derived from the `Sku` model.\n\n2. **Idempotently copy rows**:\n\n ```sql\n BEGIN;\n INSERT INTO product_skus (\n id, slug, context, created_at, updated_at,\n tenant_id, product_id, code, barcode, name,\n attributes, weight_grams, parent_sku_id, active\n )\n SELECT\n id, slug, context, created_at, updated_at,\n tenant_id, product_id, code, barcode, name,\n attributes, weight_grams, parent_sku_id, active\n FROM inventory_skus\n WHERE NOT EXISTS (\n SELECT 1 FROM product_skus p WHERE p.id = inventory_skus.id\n );\n COMMIT;\n ```\n\n3. **Drop the legacy table** once row counts match:\n\n ```sql\n DROP TABLE IF EXISTS inventory_skus;\n ```\n\n### `ProductVariant` changed shape entirely\n\nPreviously a Product STI subtype carrying `parentProductId` + `axisValues` JSON inside `_meta_data` on the shared `products` table (`_meta_type='@happyvertical/smrt-products:ProductVariant'`). It is now a **standalone model** on its own `product_variants` table, with columns `productId`, `axisName`, `allowedValues`, `label`, `sortOrder`.\n\n**There is no automatic data conversion.** The old \"catalog grouping above SKU\" concept doesn't map 1:1 to the new \"per-axis declaration\" concept. Recommended procedure:\n\n1. Inspect the old rows: `SELECT * FROM products WHERE _meta_type = '@happyvertical/smrt-products:ProductVariant';`. Treat them as historical reference.\n2. Re-author axis declarations against the new shape (one `ProductVariant` row per `(productId, axisName)` pair, with `allowedValues` listing the values).\n3. Once the new declarations are populated and verified, remove the legacy rows: `DELETE FROM products WHERE _meta_type = '@happyvertical/smrt-products:ProductVariant';`.\n\nIf you had per-colorway / per-variant images attached via `ProductAsset` rows pointing at old ProductVariant ids, repoint those to the parent Product id; group-by-axis-value queries on `Sku.attributes` cover the same use case at the SKU level.\n\n## Gotchas\n\n- **`ProductVariant` and `Sku` are NOT Product STI subtypes** — they each have their own table (`product_variants`, `product_skus`) because their shapes don't fit the Product schema. Don't try to query them via `ProductCollection`.\n- **`npm run build` emits the published library surface directly**: package consumers read model, collection, and helper exports from `dist/lib`. Cross-package imports from this package should target `/models` or `/collections` subpaths (not the main entry) when the consumer isn't a vite app — the main entry pulls in vite virtual modules.\n- **Use `npm run build:all` only when you need standalone or federation bundles** in addition to the library output\n- **Constructor must explicitly assign all properties**: `Object.assign` doesn't work reliably with decorators\n- **STI subtype-specific fields use `Meta<T>`** — declare them as `fieldName: Meta<FieldType> = defaultValue`. The AST scanner detects the `Meta<T>` type wrapper at build time and routes the field through `_meta_data` JSON storage instead of materializing it as a column on the parent's table. Do **NOT** use the runtime `@meta()` decorator on STI children — it never reaches the manifest, so the schema generator treats the field as an ordinary column on the parent table and the framework's hydration path can't tell it's meta. Override `productType` on each subclass.\n- **Tenant-scoped STI children must repeat `@TenantScoped`** — `@TenantScoped` registers per concrete className, so `Material extends Product` inheriting from a tenant-scoped `Product` is NOT automatically tenant-scoped itself. `MaterialCollection.list/save` passes `'Material'` to the tenant interceptor, which looks up `'Material'` (not `'Product'`) in the per-class registry. Without an explicit `@TenantScoped({ mode: 'optional' })` on `Material`, material rows skip the tenant auto-filter and auto-populate.\n- **STI children must repeat `@smrt({ api, mcp, cli })` generation config (S5 #1406)** — like `@TenantScoped`, the generation config is registered per concrete className and is NOT inherited from the STI parent. An empty `@smrt()` on a child resolves `getConfig(child).api/.mcp` to `undefined`, which the REST and MCP generators treat as \"expose EVERYTHING\" — including `delete` and write-capable MCP tools — even when the parent deliberately restricts its surface. The package's `mcp.ts` generator enumerates the whole registry, so an under-configured child ships a wide-open surface silently. Re-declare the parent's `api`/`mcp`/`cli` posture on every subtype (see `Material`). Consumer subtypes (apparel `Style`/`Makeup`, automotive `Model`/`Trim`, …) must do the same.\n- **Two tenants can share a slug on `Product`/`Category` (smrt#2360)** — a tenant-scoped STI base keys on `(tenant_id, slug, context, _meta_type)` by default, on the schema index and the runtime upsert alike, so no per-tenant slug namespacing and no `conflictColumns` override is needed. Global rows (`tenantId = null`) still dedup among themselves through the SDK's null-aware upsert. Existing databases pick the new key up through `smrt db:migrate` (same-name index swap) — deploy the code and the migration together, since neither version's create binds against the other's index.\n- **`price` is integer minor units** (cents, satoshis) — `$19.99` is `1999`. Money is exact, so `price` initializes `= 0`; writing `19.99` is the bug, and PostgreSQL rejects it with `22P02` while SQLite's affinity stores it and hides it from this package's SQLite suites. `pnpm --filter @happyvertical/smrt-products test:postgres` is the lane that holds the line (#2361). Because `Product` is the STI base, the column is shared by every consumer subtype. `Material.costPerUnit` is a `Meta<number>` in `_meta_data` rather than a column, so it is outside this rule.\n- **Module Federation marked experimental**: may change\n",
3048
2723
  "recipes": [