@happyvertical/smrt-inventory 0.51.9 → 0.51.10

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,99 +2,81 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-inventory",
5
- "packageVersion": "0.51.9",
5
+ "packageVersion": "0.51.10",
6
6
  "objects": {
7
- "@happyvertical/smrt-inventory:InventoryLocation": {
8
- "name": "inventorylocation",
9
- "className": "InventoryLocation",
10
- "qualifiedName": "@happyvertical/smrt-inventory:InventoryLocation",
7
+ "@happyvertical/smrt-inventory:InventoryLocationCollection": {
8
+ "name": "inventorylocationcollection",
9
+ "className": "InventoryLocationCollection",
10
+ "qualifiedName": "@happyvertical/smrt-inventory:InventoryLocationCollection",
11
11
  "collection": "inventorylocations",
12
- "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/models/InventoryLocation.ts",
12
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/InventoryLocationCollection.ts",
13
13
  "packageName": "@happyvertical/smrt-inventory",
14
- "fields": {
15
- "tenantId": {
16
- "type": "text",
17
- "required": false,
18
- "_meta": {
19
- "sqlType": "UUID",
20
- "nullable": true,
21
- "__tenancy": {
22
- "isTenantIdField": true,
23
- "autoFilter": true,
24
- "required": false,
25
- "autoPopulate": true,
26
- "nullable": true,
27
- "mode": "optional",
28
- "field": "tenantId",
29
- "allowSuperAdminBypass": false
14
+ "fields": {},
15
+ "methods": {
16
+ "findByCode": {
17
+ "name": "findByCode",
18
+ "async": true,
19
+ "parameters": [
20
+ {
21
+ "name": "code",
22
+ "type": "string",
23
+ "optional": false
30
24
  }
31
- }
32
- },
33
- "code": {
34
- "type": "text",
35
- "required": true,
36
- "default": "",
37
- "_meta": {
38
- "required": true
39
- }
40
- },
41
- "name": {
42
- "type": "text",
43
- "required": false,
44
- "default": ""
25
+ ],
26
+ "returnType": "Promise<InventoryLocation | null>",
27
+ "isStatic": false,
28
+ "isPublic": true
45
29
  },
46
- "kind": {
47
- "type": "text",
48
- "required": false,
49
- "default": "warehouse"
30
+ "findByKind": {
31
+ "name": "findByKind",
32
+ "async": true,
33
+ "parameters": [
34
+ {
35
+ "name": "kind",
36
+ "type": "InventoryLocationKind",
37
+ "optional": false
38
+ }
39
+ ],
40
+ "returnType": "Promise<InventoryLocation[]>",
41
+ "isStatic": false,
42
+ "isPublic": true
50
43
  },
51
- "placeId": {
52
- "type": "text",
53
- "required": false,
54
- "default": ""
44
+ "findByPlace": {
45
+ "name": "findByPlace",
46
+ "async": true,
47
+ "parameters": [
48
+ {
49
+ "name": "placeId",
50
+ "type": "string",
51
+ "optional": false
52
+ }
53
+ ],
54
+ "returnType": "Promise<InventoryLocation[]>",
55
+ "isStatic": false,
56
+ "isPublic": true
55
57
  },
56
- "active": {
57
- "type": "boolean",
58
- "required": false,
59
- "default": true
58
+ "findActive": {
59
+ "name": "findActive",
60
+ "async": true,
61
+ "parameters": [
62
+ {
63
+ "name": "kind",
64
+ "type": "InventoryLocationKind",
65
+ "optional": true
66
+ }
67
+ ],
68
+ "returnType": "Promise<InventoryLocation[]>",
69
+ "isStatic": false,
70
+ "isPublic": true
60
71
  }
61
72
  },
62
- "methods": {},
63
73
  "decoratorConfig": {
64
- "tableName": "inventory_locations",
65
- "conflictColumns": [
66
- "code",
67
- "tenant_id"
68
- ],
69
- "api": {
70
- "include": [
71
- "list",
72
- "get",
73
- "create",
74
- "update"
75
- ]
76
- },
77
- "mcp": {
78
- "include": [
79
- "list",
80
- "get"
81
- ]
82
- },
83
- "cli": true,
84
- "tenantScoped": {
85
- "mode": "optional"
86
- }
74
+ "tableName": "inventory_locations"
87
75
  },
88
- "extends": "SmrtObject",
89
- "exportName": "InventoryLocation",
90
- "collectionExportName": "InventoryLocationCollection",
91
- "validationRules": [
92
- {
93
- "field": "code",
94
- "rule": "required",
95
- "fieldType": "text"
96
- }
97
- ],
76
+ "extends": "SmrtCollection",
77
+ "extendsTypeArg": "InventoryLocation",
78
+ "exportName": "InventoryLocationCollection",
79
+ "collectionExportName": "InventoryLocationCollectionCollection",
98
80
  "schema": {
99
81
  "tableName": "inventory_locations",
100
82
  "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_locations\" (\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 \"tenant_id\" UUID,\n \"code\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"kind\" TEXT DEFAULT 'warehouse',\n \"place_id\" TEXT DEFAULT '',\n \"active\" BOOLEAN DEFAULT TRUE\n);",
@@ -190,113 +172,114 @@
190
172
  },
191
173
  "importPath": "@happyvertical/smrt-inventory"
192
174
  },
193
- "@happyvertical/smrt-inventory:StockLevel": {
194
- "name": "stocklevel",
195
- "className": "StockLevel",
196
- "qualifiedName": "@happyvertical/smrt-inventory:StockLevel",
175
+ "@happyvertical/smrt-inventory:StockLevelCollection": {
176
+ "name": "stocklevelcollection",
177
+ "className": "StockLevelCollection",
178
+ "qualifiedName": "@happyvertical/smrt-inventory:StockLevelCollection",
197
179
  "collection": "stocklevels",
198
- "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/models/StockLevel.ts",
180
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockLevelCollection.ts",
199
181
  "packageName": "@happyvertical/smrt-inventory",
200
- "fields": {
201
- "tenantId": {
202
- "type": "text",
203
- "required": false,
204
- "_meta": {
205
- "sqlType": "UUID",
206
- "nullable": true,
207
- "__tenancy": {
208
- "isTenantIdField": true,
209
- "autoFilter": true,
210
- "required": false,
211
- "autoPopulate": true,
212
- "nullable": true,
213
- "mode": "optional",
214
- "field": "tenantId",
215
- "allowSuperAdminBypass": false
182
+ "fields": {},
183
+ "methods": {
184
+ "getLevel": {
185
+ "name": "getLevel",
186
+ "async": true,
187
+ "parameters": [
188
+ {
189
+ "name": "skuId",
190
+ "type": "string",
191
+ "optional": false
192
+ },
193
+ {
194
+ "name": "locationId",
195
+ "type": "string",
196
+ "optional": false
197
+ },
198
+ {
199
+ "name": "state",
200
+ "type": "StockState",
201
+ "optional": true,
202
+ "default": "available"
216
203
  }
217
- }
218
- },
219
- "skuId": {
220
- "type": "text",
221
- "required": true,
222
- "default": "",
223
- "_meta": {
224
- "required": true
225
- }
204
+ ],
205
+ "returnType": "Promise<StockLevel | null>",
206
+ "isStatic": false,
207
+ "isPublic": true
226
208
  },
227
- "locationId": {
228
- "type": "text",
229
- "required": true,
230
- "default": "",
231
- "_meta": {
232
- "required": true
233
- }
209
+ "findBySku": {
210
+ "name": "findBySku",
211
+ "async": true,
212
+ "parameters": [
213
+ {
214
+ "name": "skuId",
215
+ "type": "string",
216
+ "optional": false
217
+ }
218
+ ],
219
+ "returnType": "Promise<StockLevel[]>",
220
+ "isStatic": false,
221
+ "isPublic": true
234
222
  },
235
- "state": {
236
- "type": "text",
237
- "required": true,
238
- "default": "available",
239
- "_meta": {
240
- "required": true
241
- }
223
+ "findByLocation": {
224
+ "name": "findByLocation",
225
+ "async": true,
226
+ "parameters": [
227
+ {
228
+ "name": "locationId",
229
+ "type": "string",
230
+ "optional": false
231
+ }
232
+ ],
233
+ "returnType": "Promise<StockLevel[]>",
234
+ "isStatic": false,
235
+ "isPublic": true
242
236
  },
243
- "qty": {
244
- "type": "decimal",
245
- "required": false,
246
- "_meta": {}
247
- }
248
- },
249
- "methods": {},
250
- "decoratorConfig": {
251
- "tableName": "inventory_stock_levels",
252
- "conflictColumns": [
253
- "sku_id",
254
- "location_id",
255
- "state",
256
- "tenant_id"
257
- ],
258
- "api": {
259
- "include": [
260
- "list",
261
- "get"
262
- ]
263
- },
264
- "mcp": {
265
- "include": [
266
- "list",
267
- "get"
268
- ]
269
- },
270
- "cli": {
271
- "include": [
272
- "list",
273
- "get"
274
- ]
237
+ "totalForSku": {
238
+ "name": "totalForSku",
239
+ "async": true,
240
+ "parameters": [
241
+ {
242
+ "name": "skuId",
243
+ "type": "string",
244
+ "optional": false
245
+ },
246
+ {
247
+ "name": "state",
248
+ "type": "StockState",
249
+ "optional": true
250
+ }
251
+ ],
252
+ "returnType": "Promise<number>",
253
+ "isStatic": false,
254
+ "isPublic": true
275
255
  },
276
- "tenantScoped": {
277
- "mode": "optional"
256
+ "totalForLocation": {
257
+ "name": "totalForLocation",
258
+ "async": true,
259
+ "parameters": [
260
+ {
261
+ "name": "locationId",
262
+ "type": "string",
263
+ "optional": false
264
+ },
265
+ {
266
+ "name": "state",
267
+ "type": "StockState",
268
+ "optional": true
269
+ }
270
+ ],
271
+ "returnType": "Promise<number>",
272
+ "isStatic": false,
273
+ "isPublic": true
278
274
  }
279
275
  },
280
- "extends": "SmrtObject",
281
- "exportName": "StockLevel",
282
- "collectionExportName": "StockLevelCollection",
283
- "validationRules": [
284
- {
285
- "field": "skuId",
286
- "rule": "required",
287
- "fieldType": "text"
288
- },
289
- {
290
- "field": "locationId",
291
- "rule": "required",
292
- "fieldType": "text"
293
- },
294
- {
295
- "field": "state",
296
- "rule": "required",
297
- "fieldType": "text"
298
- }
299
- ],
276
+ "decoratorConfig": {
277
+ "tableName": "inventory_stock_levels"
278
+ },
279
+ "extends": "SmrtCollection",
280
+ "extendsTypeArg": "StockLevel",
281
+ "exportName": "StockLevelCollection",
282
+ "collectionExportName": "StockLevelCollectionCollection",
300
283
  "schema": {
301
284
  "tableName": "inventory_stock_levels",
302
285
  "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_stock_levels\" (\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 \"tenant_id\" UUID,\n \"sku_id\" TEXT NOT NULL DEFAULT '',\n \"location_id\" TEXT NOT NULL DEFAULT '',\n \"state\" TEXT NOT NULL DEFAULT 'available',\n \"qty\" REAL\n);",
@@ -387,137 +370,84 @@
387
370
  },
388
371
  "importPath": "@happyvertical/smrt-inventory"
389
372
  },
390
- "@happyvertical/smrt-inventory:StockMovement": {
391
- "name": "stockmovement",
392
- "className": "StockMovement",
393
- "qualifiedName": "@happyvertical/smrt-inventory:StockMovement",
373
+ "@happyvertical/smrt-inventory:StockMovementCollection": {
374
+ "name": "stockmovementcollection",
375
+ "className": "StockMovementCollection",
376
+ "qualifiedName": "@happyvertical/smrt-inventory:StockMovementCollection",
394
377
  "collection": "stockmovements",
395
- "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/models/StockMovement.ts",
378
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockMovementCollection.ts",
396
379
  "packageName": "@happyvertical/smrt-inventory",
397
- "fields": {
398
- "tenantId": {
399
- "type": "text",
400
- "required": false,
401
- "_meta": {
402
- "sqlType": "UUID",
403
- "nullable": true,
404
- "__tenancy": {
405
- "isTenantIdField": true,
406
- "autoFilter": true,
407
- "required": false,
408
- "autoPopulate": true,
409
- "nullable": true,
410
- "mode": "optional",
411
- "field": "tenantId",
412
- "allowSuperAdminBypass": false
380
+ "fields": {},
381
+ "methods": {
382
+ "findBySku": {
383
+ "name": "findBySku",
384
+ "async": true,
385
+ "parameters": [
386
+ {
387
+ "name": "skuId",
388
+ "type": "string",
389
+ "optional": false
413
390
  }
414
- }
415
- },
416
- "skuId": {
417
- "type": "text",
418
- "required": true,
419
- "default": "",
420
- "_meta": {
421
- "required": true
422
- }
423
- },
424
- "locationId": {
425
- "type": "text",
426
- "required": true,
427
- "default": "",
428
- "_meta": {
429
- "required": true
430
- }
431
- },
432
- "fromState": {
433
- "type": "text",
434
- "required": false
435
- },
436
- "toState": {
437
- "type": "text",
438
- "required": false
439
- },
440
- "qty": {
441
- "type": "decimal",
442
- "required": false,
443
- "_meta": {}
444
- },
445
- "reasonCode": {
446
- "type": "text",
447
- "required": true,
448
- "default": "adjustment",
449
- "_meta": {
450
- "required": true
451
- }
452
- },
453
- "sourceType": {
454
- "type": "text",
455
- "required": false,
456
- "default": ""
391
+ ],
392
+ "returnType": "Promise<StockMovement[]>",
393
+ "isStatic": false,
394
+ "isPublic": true
457
395
  },
458
- "sourceId": {
459
- "type": "text",
460
- "required": false,
461
- "default": ""
396
+ "findByLocation": {
397
+ "name": "findByLocation",
398
+ "async": true,
399
+ "parameters": [
400
+ {
401
+ "name": "locationId",
402
+ "type": "string",
403
+ "optional": false
404
+ }
405
+ ],
406
+ "returnType": "Promise<StockMovement[]>",
407
+ "isStatic": false,
408
+ "isPublic": true
462
409
  },
463
- "note": {
464
- "type": "text",
465
- "required": false,
466
- "default": ""
410
+ "findBySource": {
411
+ "name": "findBySource",
412
+ "async": true,
413
+ "parameters": [
414
+ {
415
+ "name": "sourceType",
416
+ "type": "string",
417
+ "optional": false
418
+ },
419
+ {
420
+ "name": "sourceId",
421
+ "type": "string",
422
+ "optional": false
423
+ }
424
+ ],
425
+ "returnType": "Promise<StockMovement[]>",
426
+ "isStatic": false,
427
+ "isPublic": true
467
428
  },
468
- "occurredAt": {
469
- "type": "datetime",
470
- "required": false
429
+ "findByReason": {
430
+ "name": "findByReason",
431
+ "async": true,
432
+ "parameters": [
433
+ {
434
+ "name": "reasonCode",
435
+ "type": "StockMovementReason",
436
+ "optional": false
437
+ }
438
+ ],
439
+ "returnType": "Promise<StockMovement[]>",
440
+ "isStatic": false,
441
+ "isPublic": true
471
442
  }
472
443
  },
473
- "methods": {},
474
444
  "decoratorConfig": {
475
- "tableName": "inventory_stock_movements",
476
- "conflictColumns": [
477
- "id"
478
- ],
479
- "api": {
480
- "include": [
481
- "list",
482
- "get"
483
- ]
484
- },
485
- "mcp": {
486
- "include": [
487
- "list",
488
- "get"
489
- ]
490
- },
491
- "cli": {
492
- "include": [
493
- "list",
494
- "get"
495
- ]
496
- },
497
- "tenantScoped": {
498
- "mode": "optional"
499
- }
445
+ "tableName": "inventory_stock_movements"
500
446
  },
501
- "extends": "SmrtObject",
502
- "exportName": "StockMovement",
503
- "collectionExportName": "StockMovementCollection",
504
- "validationRules": [
505
- {
506
- "field": "skuId",
507
- "rule": "required",
508
- "fieldType": "text"
509
- },
510
- {
511
- "field": "locationId",
512
- "rule": "required",
513
- "fieldType": "text"
514
- },
515
- {
516
- "field": "reasonCode",
517
- "rule": "required",
518
- "fieldType": "text"
519
- }
520
- ],
447
+ "extends": "SmrtCollection",
448
+ "extendsTypeArg": "StockMovement",
449
+ "exportName": "StockMovementCollection",
450
+ "collectionExportName": "StockMovementCollectionCollection",
521
451
  "schema": {
522
452
  "tableName": "inventory_stock_movements",
523
453
  "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_stock_movements\" (\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 \"tenant_id\" UUID,\n \"sku_id\" TEXT NOT NULL DEFAULT '',\n \"location_id\" TEXT NOT NULL DEFAULT '',\n \"from_state\" TEXT,\n \"to_state\" TEXT,\n \"qty\" REAL,\n \"reason_code\" TEXT NOT NULL DEFAULT 'adjustment',\n \"source_type\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"note\" TEXT DEFAULT '',\n \"occurred_at\" TIMESTAMP\n);",
@@ -630,79 +560,97 @@
630
560
  },
631
561
  "importPath": "@happyvertical/smrt-inventory"
632
562
  },
633
- "@happyvertical/smrt-inventory:InventoryLocationCollection": {
634
- "name": "inventorylocationcollection",
635
- "className": "InventoryLocationCollection",
636
- "qualifiedName": "@happyvertical/smrt-inventory:InventoryLocationCollection",
563
+ "@happyvertical/smrt-inventory:InventoryLocation": {
564
+ "name": "inventorylocation",
565
+ "className": "InventoryLocation",
566
+ "qualifiedName": "@happyvertical/smrt-inventory:InventoryLocation",
637
567
  "collection": "inventorylocations",
638
- "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/InventoryLocationCollection.ts",
639
- "packageName": "@happyvertical/smrt-inventory",
640
- "fields": {},
641
- "methods": {
642
- "findByCode": {
643
- "name": "findByCode",
644
- "async": true,
645
- "parameters": [
646
- {
647
- "name": "code",
648
- "type": "string",
649
- "optional": false
568
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/models/InventoryLocation.ts",
569
+ "packageName": "@happyvertical/smrt-inventory",
570
+ "fields": {
571
+ "tenantId": {
572
+ "type": "text",
573
+ "required": false,
574
+ "_meta": {
575
+ "sqlType": "UUID",
576
+ "nullable": true,
577
+ "__tenancy": {
578
+ "isTenantIdField": true,
579
+ "autoFilter": true,
580
+ "required": false,
581
+ "autoPopulate": true,
582
+ "nullable": true,
583
+ "mode": "optional",
584
+ "field": "tenantId",
585
+ "allowSuperAdminBypass": false
650
586
  }
651
- ],
652
- "returnType": "Promise<InventoryLocation | null>",
653
- "isStatic": false,
654
- "isPublic": true
587
+ }
655
588
  },
656
- "findByKind": {
657
- "name": "findByKind",
658
- "async": true,
659
- "parameters": [
660
- {
661
- "name": "kind",
662
- "type": "InventoryLocationKind",
663
- "optional": false
664
- }
665
- ],
666
- "returnType": "Promise<InventoryLocation[]>",
667
- "isStatic": false,
668
- "isPublic": true
589
+ "code": {
590
+ "type": "text",
591
+ "required": true,
592
+ "default": "",
593
+ "_meta": {
594
+ "required": true
595
+ }
669
596
  },
670
- "findByPlace": {
671
- "name": "findByPlace",
672
- "async": true,
673
- "parameters": [
674
- {
675
- "name": "placeId",
676
- "type": "string",
677
- "optional": false
678
- }
679
- ],
680
- "returnType": "Promise<InventoryLocation[]>",
681
- "isStatic": false,
682
- "isPublic": true
597
+ "name": {
598
+ "type": "text",
599
+ "required": false,
600
+ "default": ""
683
601
  },
684
- "findActive": {
685
- "name": "findActive",
686
- "async": true,
687
- "parameters": [
688
- {
689
- "name": "kind",
690
- "type": "InventoryLocationKind",
691
- "optional": true
692
- }
693
- ],
694
- "returnType": "Promise<InventoryLocation[]>",
695
- "isStatic": false,
696
- "isPublic": true
602
+ "kind": {
603
+ "type": "text",
604
+ "required": false,
605
+ "default": "warehouse"
606
+ },
607
+ "placeId": {
608
+ "type": "text",
609
+ "required": false,
610
+ "default": ""
611
+ },
612
+ "active": {
613
+ "type": "boolean",
614
+ "required": false,
615
+ "default": true
697
616
  }
698
617
  },
618
+ "methods": {},
699
619
  "decoratorConfig": {
700
- "tableName": "inventory_locations"
620
+ "tableName": "inventory_locations",
621
+ "conflictColumns": [
622
+ "code",
623
+ "tenant_id"
624
+ ],
625
+ "api": {
626
+ "include": [
627
+ "list",
628
+ "get",
629
+ "create",
630
+ "update"
631
+ ]
632
+ },
633
+ "mcp": {
634
+ "include": [
635
+ "list",
636
+ "get"
637
+ ]
638
+ },
639
+ "cli": true,
640
+ "tenantScoped": {
641
+ "mode": "optional"
642
+ }
701
643
  },
702
- "extends": "SmrtCollection",
703
- "extendsTypeArg": "InventoryLocation",
704
- "exportName": "InventoryLocationCollection",
705
- "collectionExportName": "InventoryLocationCollectionCollection",
644
+ "extends": "SmrtObject",
645
+ "exportName": "InventoryLocation",
646
+ "collectionExportName": "InventoryLocationCollection",
647
+ "validationRules": [
648
+ {
649
+ "field": "code",
650
+ "rule": "required",
651
+ "fieldType": "text"
652
+ }
653
+ ],
706
654
  "schema": {
707
655
  "tableName": "inventory_locations",
708
656
  "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_locations\" (\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 \"tenant_id\" UUID,\n \"code\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"kind\" TEXT DEFAULT 'warehouse',\n \"place_id\" TEXT DEFAULT '',\n \"active\" BOOLEAN DEFAULT TRUE\n);",
@@ -798,114 +746,113 @@
798
746
  },
799
747
  "importPath": "@happyvertical/smrt-inventory"
800
748
  },
801
- "@happyvertical/smrt-inventory:StockLevelCollection": {
802
- "name": "stocklevelcollection",
803
- "className": "StockLevelCollection",
804
- "qualifiedName": "@happyvertical/smrt-inventory:StockLevelCollection",
749
+ "@happyvertical/smrt-inventory:StockLevel": {
750
+ "name": "stocklevel",
751
+ "className": "StockLevel",
752
+ "qualifiedName": "@happyvertical/smrt-inventory:StockLevel",
805
753
  "collection": "stocklevels",
806
- "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockLevelCollection.ts",
754
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/models/StockLevel.ts",
807
755
  "packageName": "@happyvertical/smrt-inventory",
808
- "fields": {},
809
- "methods": {
810
- "getLevel": {
811
- "name": "getLevel",
812
- "async": true,
813
- "parameters": [
814
- {
815
- "name": "skuId",
816
- "type": "string",
817
- "optional": false
818
- },
819
- {
820
- "name": "locationId",
821
- "type": "string",
822
- "optional": false
823
- },
824
- {
825
- "name": "state",
826
- "type": "StockState",
827
- "optional": true,
828
- "default": "available"
829
- }
830
- ],
831
- "returnType": "Promise<StockLevel | null>",
832
- "isStatic": false,
833
- "isPublic": true
834
- },
835
- "findBySku": {
836
- "name": "findBySku",
837
- "async": true,
838
- "parameters": [
839
- {
840
- "name": "skuId",
841
- "type": "string",
842
- "optional": false
843
- }
844
- ],
845
- "returnType": "Promise<StockLevel[]>",
846
- "isStatic": false,
847
- "isPublic": true
848
- },
849
- "findByLocation": {
850
- "name": "findByLocation",
851
- "async": true,
852
- "parameters": [
853
- {
854
- "name": "locationId",
855
- "type": "string",
856
- "optional": false
756
+ "fields": {
757
+ "tenantId": {
758
+ "type": "text",
759
+ "required": false,
760
+ "_meta": {
761
+ "sqlType": "UUID",
762
+ "nullable": true,
763
+ "__tenancy": {
764
+ "isTenantIdField": true,
765
+ "autoFilter": true,
766
+ "required": false,
767
+ "autoPopulate": true,
768
+ "nullable": true,
769
+ "mode": "optional",
770
+ "field": "tenantId",
771
+ "allowSuperAdminBypass": false
857
772
  }
858
- ],
859
- "returnType": "Promise<StockLevel[]>",
860
- "isStatic": false,
861
- "isPublic": true
773
+ }
862
774
  },
863
- "totalForSku": {
864
- "name": "totalForSku",
865
- "async": true,
866
- "parameters": [
867
- {
868
- "name": "skuId",
869
- "type": "string",
870
- "optional": false
871
- },
872
- {
873
- "name": "state",
874
- "type": "StockState",
875
- "optional": true
876
- }
877
- ],
878
- "returnType": "Promise<number>",
879
- "isStatic": false,
880
- "isPublic": true
775
+ "skuId": {
776
+ "type": "text",
777
+ "required": true,
778
+ "default": "",
779
+ "_meta": {
780
+ "required": true
781
+ }
881
782
  },
882
- "totalForLocation": {
883
- "name": "totalForLocation",
884
- "async": true,
885
- "parameters": [
886
- {
887
- "name": "locationId",
888
- "type": "string",
889
- "optional": false
890
- },
891
- {
892
- "name": "state",
893
- "type": "StockState",
894
- "optional": true
895
- }
896
- ],
897
- "returnType": "Promise<number>",
898
- "isStatic": false,
899
- "isPublic": true
783
+ "locationId": {
784
+ "type": "text",
785
+ "required": true,
786
+ "default": "",
787
+ "_meta": {
788
+ "required": true
789
+ }
790
+ },
791
+ "state": {
792
+ "type": "text",
793
+ "required": true,
794
+ "default": "available",
795
+ "_meta": {
796
+ "required": true
797
+ }
798
+ },
799
+ "qty": {
800
+ "type": "decimal",
801
+ "required": false,
802
+ "_meta": {}
900
803
  }
901
804
  },
805
+ "methods": {},
902
806
  "decoratorConfig": {
903
- "tableName": "inventory_stock_levels"
807
+ "tableName": "inventory_stock_levels",
808
+ "conflictColumns": [
809
+ "sku_id",
810
+ "location_id",
811
+ "state",
812
+ "tenant_id"
813
+ ],
814
+ "api": {
815
+ "include": [
816
+ "list",
817
+ "get"
818
+ ]
819
+ },
820
+ "mcp": {
821
+ "include": [
822
+ "list",
823
+ "get"
824
+ ]
825
+ },
826
+ "cli": {
827
+ "include": [
828
+ "list",
829
+ "get"
830
+ ]
831
+ },
832
+ "tenantScoped": {
833
+ "mode": "optional"
834
+ }
904
835
  },
905
- "extends": "SmrtCollection",
906
- "extendsTypeArg": "StockLevel",
907
- "exportName": "StockLevelCollection",
908
- "collectionExportName": "StockLevelCollectionCollection",
836
+ "extends": "SmrtObject",
837
+ "exportName": "StockLevel",
838
+ "collectionExportName": "StockLevelCollection",
839
+ "validationRules": [
840
+ {
841
+ "field": "skuId",
842
+ "rule": "required",
843
+ "fieldType": "text"
844
+ },
845
+ {
846
+ "field": "locationId",
847
+ "rule": "required",
848
+ "fieldType": "text"
849
+ },
850
+ {
851
+ "field": "state",
852
+ "rule": "required",
853
+ "fieldType": "text"
854
+ }
855
+ ],
909
856
  "schema": {
910
857
  "tableName": "inventory_stock_levels",
911
858
  "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_stock_levels\" (\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 \"tenant_id\" UUID,\n \"sku_id\" TEXT NOT NULL DEFAULT '',\n \"location_id\" TEXT NOT NULL DEFAULT '',\n \"state\" TEXT NOT NULL DEFAULT 'available',\n \"qty\" REAL\n);",
@@ -996,84 +943,137 @@
996
943
  },
997
944
  "importPath": "@happyvertical/smrt-inventory"
998
945
  },
999
- "@happyvertical/smrt-inventory:StockMovementCollection": {
1000
- "name": "stockmovementcollection",
1001
- "className": "StockMovementCollection",
1002
- "qualifiedName": "@happyvertical/smrt-inventory:StockMovementCollection",
946
+ "@happyvertical/smrt-inventory:StockMovement": {
947
+ "name": "stockmovement",
948
+ "className": "StockMovement",
949
+ "qualifiedName": "@happyvertical/smrt-inventory:StockMovement",
1003
950
  "collection": "stockmovements",
1004
- "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockMovementCollection.ts",
951
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/models/StockMovement.ts",
1005
952
  "packageName": "@happyvertical/smrt-inventory",
1006
- "fields": {},
1007
- "methods": {
1008
- "findBySku": {
1009
- "name": "findBySku",
1010
- "async": true,
1011
- "parameters": [
1012
- {
1013
- "name": "skuId",
1014
- "type": "string",
1015
- "optional": false
953
+ "fields": {
954
+ "tenantId": {
955
+ "type": "text",
956
+ "required": false,
957
+ "_meta": {
958
+ "sqlType": "UUID",
959
+ "nullable": true,
960
+ "__tenancy": {
961
+ "isTenantIdField": true,
962
+ "autoFilter": true,
963
+ "required": false,
964
+ "autoPopulate": true,
965
+ "nullable": true,
966
+ "mode": "optional",
967
+ "field": "tenantId",
968
+ "allowSuperAdminBypass": false
1016
969
  }
1017
- ],
1018
- "returnType": "Promise<StockMovement[]>",
1019
- "isStatic": false,
1020
- "isPublic": true
970
+ }
1021
971
  },
1022
- "findByLocation": {
1023
- "name": "findByLocation",
1024
- "async": true,
1025
- "parameters": [
1026
- {
1027
- "name": "locationId",
1028
- "type": "string",
1029
- "optional": false
1030
- }
1031
- ],
1032
- "returnType": "Promise<StockMovement[]>",
1033
- "isStatic": false,
1034
- "isPublic": true
972
+ "skuId": {
973
+ "type": "text",
974
+ "required": true,
975
+ "default": "",
976
+ "_meta": {
977
+ "required": true
978
+ }
1035
979
  },
1036
- "findBySource": {
1037
- "name": "findBySource",
1038
- "async": true,
1039
- "parameters": [
1040
- {
1041
- "name": "sourceType",
1042
- "type": "string",
1043
- "optional": false
1044
- },
1045
- {
1046
- "name": "sourceId",
1047
- "type": "string",
1048
- "optional": false
1049
- }
1050
- ],
1051
- "returnType": "Promise<StockMovement[]>",
1052
- "isStatic": false,
1053
- "isPublic": true
980
+ "locationId": {
981
+ "type": "text",
982
+ "required": true,
983
+ "default": "",
984
+ "_meta": {
985
+ "required": true
986
+ }
1054
987
  },
1055
- "findByReason": {
1056
- "name": "findByReason",
1057
- "async": true,
1058
- "parameters": [
1059
- {
1060
- "name": "reasonCode",
1061
- "type": "StockMovementReason",
1062
- "optional": false
1063
- }
1064
- ],
1065
- "returnType": "Promise<StockMovement[]>",
1066
- "isStatic": false,
1067
- "isPublic": true
988
+ "fromState": {
989
+ "type": "text",
990
+ "required": false
991
+ },
992
+ "toState": {
993
+ "type": "text",
994
+ "required": false
995
+ },
996
+ "qty": {
997
+ "type": "decimal",
998
+ "required": false,
999
+ "_meta": {}
1000
+ },
1001
+ "reasonCode": {
1002
+ "type": "text",
1003
+ "required": true,
1004
+ "default": "adjustment",
1005
+ "_meta": {
1006
+ "required": true
1007
+ }
1008
+ },
1009
+ "sourceType": {
1010
+ "type": "text",
1011
+ "required": false,
1012
+ "default": ""
1013
+ },
1014
+ "sourceId": {
1015
+ "type": "text",
1016
+ "required": false,
1017
+ "default": ""
1018
+ },
1019
+ "note": {
1020
+ "type": "text",
1021
+ "required": false,
1022
+ "default": ""
1023
+ },
1024
+ "occurredAt": {
1025
+ "type": "datetime",
1026
+ "required": false
1068
1027
  }
1069
1028
  },
1029
+ "methods": {},
1070
1030
  "decoratorConfig": {
1071
- "tableName": "inventory_stock_movements"
1031
+ "tableName": "inventory_stock_movements",
1032
+ "conflictColumns": [
1033
+ "id"
1034
+ ],
1035
+ "api": {
1036
+ "include": [
1037
+ "list",
1038
+ "get"
1039
+ ]
1040
+ },
1041
+ "mcp": {
1042
+ "include": [
1043
+ "list",
1044
+ "get"
1045
+ ]
1046
+ },
1047
+ "cli": {
1048
+ "include": [
1049
+ "list",
1050
+ "get"
1051
+ ]
1052
+ },
1053
+ "tenantScoped": {
1054
+ "mode": "optional"
1055
+ }
1072
1056
  },
1073
- "extends": "SmrtCollection",
1074
- "extendsTypeArg": "StockMovement",
1075
- "exportName": "StockMovementCollection",
1076
- "collectionExportName": "StockMovementCollectionCollection",
1057
+ "extends": "SmrtObject",
1058
+ "exportName": "StockMovement",
1059
+ "collectionExportName": "StockMovementCollection",
1060
+ "validationRules": [
1061
+ {
1062
+ "field": "skuId",
1063
+ "rule": "required",
1064
+ "fieldType": "text"
1065
+ },
1066
+ {
1067
+ "field": "locationId",
1068
+ "rule": "required",
1069
+ "fieldType": "text"
1070
+ },
1071
+ {
1072
+ "field": "reasonCode",
1073
+ "rule": "required",
1074
+ "fieldType": "text"
1075
+ }
1076
+ ],
1077
1077
  "schema": {
1078
1078
  "tableName": "inventory_stock_movements",
1079
1079
  "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_stock_movements\" (\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 \"tenant_id\" UUID,\n \"sku_id\" TEXT NOT NULL DEFAULT '',\n \"location_id\" TEXT NOT NULL DEFAULT '',\n \"from_state\" TEXT,\n \"to_state\" TEXT,\n \"qty\" REAL,\n \"reason_code\" TEXT NOT NULL DEFAULT 'adjustment',\n \"source_type\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"note\" TEXT DEFAULT '',\n \"occurred_at\" TIMESTAMP\n);",