@happyvertical/smrt-inventory 0.57.16 → 0.57.18

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 (45) hide show
  1. package/AGENTS.md +19 -1
  2. package/README.md +32 -2
  3. package/dist/collections/LotCollection.d.ts +22 -0
  4. package/dist/collections/LotCollection.d.ts.map +1 -0
  5. package/dist/collections/LotCorrectionCollection.d.ts +12 -0
  6. package/dist/collections/LotCorrectionCollection.d.ts.map +1 -0
  7. package/dist/collections/LotDocumentCollection.d.ts +12 -0
  8. package/dist/collections/LotDocumentCollection.d.ts.map +1 -0
  9. package/dist/collections/LotStockLevelCollection.d.ts +21 -0
  10. package/dist/collections/LotStockLevelCollection.d.ts.map +1 -0
  11. package/dist/collections/LotUsageCollection.d.ts +18 -0
  12. package/dist/collections/LotUsageCollection.d.ts.map +1 -0
  13. package/dist/collections/index.d.ts +5 -0
  14. package/dist/collections/index.d.ts.map +1 -1
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1168 -31
  18. package/dist/index.js.map +1 -1
  19. package/dist/manifest.json +2921 -288
  20. package/dist/models/Lot.d.ts +96 -0
  21. package/dist/models/Lot.d.ts.map +1 -0
  22. package/dist/models/LotCorrection.d.ts +55 -0
  23. package/dist/models/LotCorrection.d.ts.map +1 -0
  24. package/dist/models/LotDocument.d.ts +45 -0
  25. package/dist/models/LotDocument.d.ts.map +1 -0
  26. package/dist/models/LotStockLevel.d.ts +43 -0
  27. package/dist/models/LotStockLevel.d.ts.map +1 -0
  28. package/dist/models/LotUsage.d.ts +64 -0
  29. package/dist/models/LotUsage.d.ts.map +1 -0
  30. package/dist/models/StockMovement.d.ts +7 -0
  31. package/dist/models/StockMovement.d.ts.map +1 -1
  32. package/dist/models/index.d.ts +5 -0
  33. package/dist/models/index.d.ts.map +1 -1
  34. package/dist/services/LotService.d.ts +258 -0
  35. package/dist/services/LotService.d.ts.map +1 -0
  36. package/dist/services/StockService.d.ts +25 -2
  37. package/dist/services/StockService.d.ts.map +1 -1
  38. package/dist/services/index.d.ts +2 -0
  39. package/dist/services/index.d.ts.map +1 -1
  40. package/dist/services/lot-errors.d.ts +44 -0
  41. package/dist/services/lot-errors.d.ts.map +1 -0
  42. package/dist/smrt-knowledge.json +1333 -76
  43. package/dist/types.d.ts +6 -0
  44. package/dist/types.d.ts.map +1 -1
  45. package/package.json +6 -6
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-inventory",
5
- "packageVersion": "0.57.16",
5
+ "packageVersion": "0.57.18",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-inventory:InventoryLocationCollection": {
8
8
  "name": "inventorylocationcollection",
@@ -186,123 +186,40 @@
186
186
  },
187
187
  "importPath": "@happyvertical/smrt-inventory"
188
188
  },
189
- "@happyvertical/smrt-inventory:StockLevelCollection": {
190
- "name": "stocklevelcollection",
191
- "className": "StockLevelCollection",
192
- "qualifiedName": "@happyvertical/smrt-inventory:StockLevelCollection",
193
- "collection": "stocklevels",
194
- "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockLevelCollection.ts",
189
+ "@happyvertical/smrt-inventory:LotCollection": {
190
+ "name": "lotcollection",
191
+ "className": "LotCollection",
192
+ "qualifiedName": "@happyvertical/smrt-inventory:LotCollection",
193
+ "collection": "lots",
194
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotCollection.ts",
195
195
  "packageName": "@happyvertical/smrt-inventory",
196
196
  "fields": {},
197
197
  "methods": {
198
- "getLevel": {
199
- "name": "getLevel",
198
+ "findByLotNumber": {
199
+ "name": "findByLotNumber",
200
200
  "async": true,
201
201
  "parameters": [
202
202
  {
203
- "name": "skuId",
204
- "type": "string",
205
- "optional": false
206
- },
207
- {
208
- "name": "locationId",
203
+ "name": "lotNumber",
209
204
  "type": "string",
210
205
  "optional": false
211
206
  },
212
207
  {
213
- "name": "state",
214
- "type": "StockState",
208
+ "name": "options",
209
+ "type": "object",
215
210
  "optional": true,
216
- "default": "available"
217
- }
218
- ],
219
- "returnType": "Promise<StockLevel | null>",
220
- "isStatic": false,
221
- "isPublic": true
222
- },
223
- "findBySku": {
224
- "name": "findBySku",
225
- "async": true,
226
- "parameters": [
227
- {
228
- "name": "skuId",
229
- "type": "string",
230
- "optional": false
231
- }
232
- ],
233
- "returnType": "Promise<StockLevel[]>",
234
- "isStatic": false,
235
- "isPublic": true
236
- },
237
- "findByLocation": {
238
- "name": "findByLocation",
239
- "async": true,
240
- "parameters": [
241
- {
242
- "name": "locationId",
243
- "type": "string",
244
- "optional": false
245
- }
246
- ],
247
- "returnType": "Promise<StockLevel[]>",
248
- "isStatic": false,
249
- "isPublic": true
250
- },
251
- "findBelowReorderPoint": {
252
- "name": "findBelowReorderPoint",
253
- "async": true,
254
- "parameters": [
255
- {
256
- "name": "locationId",
257
- "type": "string",
258
- "optional": true
259
- }
260
- ],
261
- "returnType": "Promise<StockLevel[]>",
262
- "isStatic": false,
263
- "isPublic": true
264
- },
265
- "totalForSku": {
266
- "name": "totalForSku",
267
- "async": true,
268
- "parameters": [
269
- {
270
- "name": "skuId",
271
- "type": "string",
272
- "optional": false
273
- },
274
- {
275
- "name": "state",
276
- "type": "StockState",
277
- "optional": true
278
- }
279
- ],
280
- "returnType": "Promise<number>",
281
- "isStatic": false,
282
- "isPublic": true
283
- },
284
- "totalForLocation": {
285
- "name": "totalForLocation",
286
- "async": true,
287
- "parameters": [
288
- {
289
- "name": "locationId",
290
- "type": "string",
291
- "optional": false
292
- },
293
- {
294
- "name": "state",
295
- "type": "StockState",
296
- "optional": true
211
+ "memberTypes": [
212
+ "string | null"
213
+ ]
297
214
  }
298
215
  ],
299
- "returnType": "Promise<number>",
216
+ "returnType": "Promise<Lot[]>",
300
217
  "isStatic": false,
301
218
  "isPublic": true
302
219
  }
303
220
  },
304
221
  "decoratorConfig": {
305
- "tableName": "inventory_stock_levels",
222
+ "tableName": "inventory_lots",
306
223
  "api": {
307
224
  "include": [
308
225
  "list",
@@ -323,12 +240,12 @@
323
240
  }
324
241
  },
325
242
  "extends": "SmrtCollection",
326
- "extendsTypeArg": "StockLevel",
327
- "exportName": "StockLevelCollection",
328
- "collectionExportName": "StockLevelCollectionCollection",
243
+ "extendsTypeArg": "Lot",
244
+ "exportName": "LotCollection",
245
+ "collectionExportName": "LotCollectionCollection",
329
246
  "schema": {
330
- "tableName": "inventory_stock_levels",
331
- "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 \"reorder_point\" REAL,\n \"reorder_quantity\" REAL\n);",
247
+ "tableName": "inventory_lots",
248
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_lots\" (\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,\n \"kind\" TEXT DEFAULT 'lot',\n \"lot_number\" TEXT NOT NULL DEFAULT '',\n \"search_key\" TEXT DEFAULT '',\n \"identity_key\" TEXT NOT NULL DEFAULT '',\n \"unique_number\" BOOLEAN DEFAULT FALSE,\n \"received_qty\" REAL,\n \"unit\" TEXT DEFAULT '',\n \"source_type\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"attributes\" TEXT,\n \"status\" TEXT DEFAULT 'active',\n \"received_at\" TIMESTAMP,\n \"received_by_profile_id\" UUID,\n \"last_used_at\" TIMESTAMP\n);",
332
249
  "columns": {
333
250
  "id": {
334
251
  "type": "UUID",
@@ -362,143 +279,144 @@
362
279
  "unique": false
363
280
  },
364
281
  "sku_id": {
282
+ "type": "TEXT",
283
+ "notNull": false,
284
+ "unique": false
285
+ },
286
+ "kind": {
287
+ "type": "TEXT",
288
+ "notNull": false,
289
+ "unique": false,
290
+ "default": "lot"
291
+ },
292
+ "lot_number": {
365
293
  "type": "TEXT",
366
294
  "notNull": true,
367
295
  "unique": false,
368
296
  "default": ""
369
297
  },
370
- "location_id": {
298
+ "search_key": {
371
299
  "type": "TEXT",
372
- "notNull": true,
300
+ "notNull": false,
373
301
  "unique": false,
374
302
  "default": ""
375
303
  },
376
- "state": {
304
+ "identity_key": {
377
305
  "type": "TEXT",
378
306
  "notNull": true,
379
307
  "unique": false,
380
- "default": "available"
308
+ "default": ""
381
309
  },
382
- "qty": {
310
+ "unique_number": {
311
+ "type": "BOOLEAN",
312
+ "notNull": false,
313
+ "unique": false,
314
+ "default": false
315
+ },
316
+ "received_qty": {
383
317
  "type": "REAL",
384
318
  "notNull": false,
385
319
  "unique": false
386
320
  },
387
- "reorder_point": {
388
- "type": "REAL",
321
+ "unit": {
322
+ "type": "TEXT",
323
+ "notNull": false,
324
+ "unique": false,
325
+ "default": ""
326
+ },
327
+ "source_type": {
328
+ "type": "TEXT",
329
+ "notNull": false,
330
+ "unique": false,
331
+ "default": ""
332
+ },
333
+ "source_id": {
334
+ "type": "TEXT",
335
+ "notNull": false,
336
+ "unique": false,
337
+ "default": ""
338
+ },
339
+ "attributes": {
340
+ "type": "TEXT",
389
341
  "notNull": false,
390
342
  "unique": false
391
343
  },
392
- "reorder_quantity": {
393
- "type": "REAL",
344
+ "status": {
345
+ "type": "TEXT",
346
+ "notNull": false,
347
+ "unique": false,
348
+ "default": "active"
349
+ },
350
+ "received_at": {
351
+ "type": "TIMESTAMP",
352
+ "notNull": false,
353
+ "unique": false
354
+ },
355
+ "received_by_profile_id": {
356
+ "type": "UUID",
357
+ "referenceKind": "crossPackageRef",
358
+ "notNull": false,
359
+ "unique": false
360
+ },
361
+ "last_used_at": {
362
+ "type": "TIMESTAMP",
394
363
  "notNull": false,
395
364
  "unique": false
396
365
  }
397
366
  },
398
367
  "indexes": [
399
368
  {
400
- "name": "inventory_stock_levels_sku_id_location_id_idx",
369
+ "name": "inventory_lots_identity_key_tenant_id_idx",
401
370
  "columns": [
402
- "sku_id",
403
- "location_id",
404
- "state",
371
+ "identity_key",
405
372
  "tenant_id"
406
373
  ],
407
374
  "unique": true,
408
375
  "nullsNotDistinct": true
409
376
  },
410
377
  {
411
- "name": "inventory_stock_levels_slug_context_idx",
378
+ "name": "inventory_lots_slug_context_idx",
412
379
  "columns": [
413
380
  "slug",
414
381
  "context"
415
382
  ]
416
383
  },
417
384
  {
418
- "name": "inventory_stock_levels_tenant_id_created_at_idx",
385
+ "name": "inventory_lots_search_key_idx",
386
+ "columns": [
387
+ "tenant_id",
388
+ "search_key"
389
+ ]
390
+ },
391
+ {
392
+ "name": "inventory_lots_tenant_id_created_at_idx",
419
393
  "columns": [
420
394
  "tenant_id",
421
395
  "created_at"
422
396
  ]
397
+ },
398
+ {
399
+ "name": "inventory_lots_received_by_profile_id_idx",
400
+ "columns": [
401
+ "received_by_profile_id"
402
+ ]
423
403
  }
424
404
  ],
425
- "version": "02387935"
405
+ "version": "eb959677"
426
406
  },
427
407
  "importPath": "@happyvertical/smrt-inventory"
428
408
  },
429
- "@happyvertical/smrt-inventory:StockMovementCollection": {
430
- "name": "stockmovementcollection",
431
- "className": "StockMovementCollection",
432
- "qualifiedName": "@happyvertical/smrt-inventory:StockMovementCollection",
433
- "collection": "stockmovements",
434
- "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockMovementCollection.ts",
409
+ "@happyvertical/smrt-inventory:LotCorrectionCollection": {
410
+ "name": "lotcorrectioncollection",
411
+ "className": "LotCorrectionCollection",
412
+ "qualifiedName": "@happyvertical/smrt-inventory:LotCorrectionCollection",
413
+ "collection": "lotcorrections",
414
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotCorrectionCollection.ts",
435
415
  "packageName": "@happyvertical/smrt-inventory",
436
416
  "fields": {},
437
- "methods": {
438
- "findBySku": {
439
- "name": "findBySku",
440
- "async": true,
441
- "parameters": [
442
- {
443
- "name": "skuId",
444
- "type": "string",
445
- "optional": false
446
- }
447
- ],
448
- "returnType": "Promise<StockMovement[]>",
449
- "isStatic": false,
450
- "isPublic": true
451
- },
452
- "findByLocation": {
453
- "name": "findByLocation",
454
- "async": true,
455
- "parameters": [
456
- {
457
- "name": "locationId",
458
- "type": "string",
459
- "optional": false
460
- }
461
- ],
462
- "returnType": "Promise<StockMovement[]>",
463
- "isStatic": false,
464
- "isPublic": true
465
- },
466
- "findBySource": {
467
- "name": "findBySource",
468
- "async": true,
469
- "parameters": [
470
- {
471
- "name": "sourceType",
472
- "type": "string",
473
- "optional": false
474
- },
475
- {
476
- "name": "sourceId",
477
- "type": "string",
478
- "optional": false
479
- }
480
- ],
481
- "returnType": "Promise<StockMovement[]>",
482
- "isStatic": false,
483
- "isPublic": true
484
- },
485
- "findByReason": {
486
- "name": "findByReason",
487
- "async": true,
488
- "parameters": [
489
- {
490
- "name": "reasonCode",
491
- "type": "StockMovementReason",
492
- "optional": false
493
- }
494
- ],
495
- "returnType": "Promise<StockMovement[]>",
496
- "isStatic": false,
497
- "isPublic": true
498
- }
499
- },
417
+ "methods": {},
500
418
  "decoratorConfig": {
501
- "tableName": "inventory_stock_movements",
419
+ "tableName": "inventory_lot_corrections",
502
420
  "api": {
503
421
  "include": [
504
422
  "list",
@@ -519,12 +437,12 @@
519
437
  }
520
438
  },
521
439
  "extends": "SmrtCollection",
522
- "extendsTypeArg": "StockMovement",
523
- "exportName": "StockMovementCollection",
524
- "collectionExportName": "StockMovementCollectionCollection",
440
+ "extendsTypeArg": "LotCorrection",
441
+ "exportName": "LotCorrectionCollection",
442
+ "collectionExportName": "LotCorrectionCollectionCollection",
525
443
  "schema": {
526
- "tableName": "inventory_stock_movements",
527
- "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 \"actor_profile_id\" UUID,\n \"note\" TEXT DEFAULT '',\n \"occurred_at\" TIMESTAMP\n);",
444
+ "tableName": "inventory_lot_corrections",
445
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_lot_corrections\" (\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 \"lot_id\" UUID NOT NULL,\n \"kind\" TEXT NOT NULL DEFAULT 'attribute',\n \"field\" TEXT DEFAULT '',\n \"old_value\" TEXT,\n \"new_value\" TEXT,\n \"reason\" TEXT NOT NULL,\n \"usage_id\" TEXT,\n \"document_id\" TEXT,\n \"actor_profile_id\" UUID,\n \"corrected_at\" TIMESTAMP\n);",
528
446
  "columns": {
529
447
  "id": {
530
448
  "type": "UUID",
@@ -557,101 +475,2621 @@
557
475
  "notNull": false,
558
476
  "unique": false
559
477
  },
560
- "sku_id": {
561
- "type": "TEXT",
478
+ "lot_id": {
479
+ "type": "UUID",
480
+ "referenceKind": "foreignKey",
562
481
  "notNull": true,
563
482
  "unique": false,
564
- "default": ""
483
+ "foreignKey": {
484
+ "table": "inventory_lots",
485
+ "column": "id",
486
+ "onDelete": "RESTRICT",
487
+ "onUpdate": "RESTRICT",
488
+ "engines": [
489
+ "postgres",
490
+ "sqlite"
491
+ ]
492
+ }
565
493
  },
566
- "location_id": {
494
+ "kind": {
567
495
  "type": "TEXT",
568
496
  "notNull": true,
569
497
  "unique": false,
498
+ "default": "attribute"
499
+ },
500
+ "field": {
501
+ "type": "TEXT",
502
+ "notNull": false,
503
+ "unique": false,
570
504
  "default": ""
571
505
  },
572
- "from_state": {
506
+ "old_value": {
573
507
  "type": "TEXT",
574
508
  "notNull": false,
575
509
  "unique": false
576
510
  },
577
- "to_state": {
511
+ "new_value": {
512
+ "type": "TEXT",
513
+ "notNull": false,
514
+ "unique": false
515
+ },
516
+ "reason": {
517
+ "type": "TEXT",
518
+ "notNull": true,
519
+ "unique": false
520
+ },
521
+ "usage_id": {
522
+ "type": "TEXT",
523
+ "notNull": false,
524
+ "unique": false
525
+ },
526
+ "document_id": {
527
+ "type": "TEXT",
528
+ "notNull": false,
529
+ "unique": false
530
+ },
531
+ "actor_profile_id": {
532
+ "type": "UUID",
533
+ "referenceKind": "crossPackageRef",
534
+ "notNull": false,
535
+ "unique": false
536
+ },
537
+ "corrected_at": {
538
+ "type": "TIMESTAMP",
539
+ "notNull": false,
540
+ "unique": false
541
+ }
542
+ },
543
+ "indexes": [
544
+ {
545
+ "name": "inventory_lot_corrections_slug_context_idx",
546
+ "columns": [
547
+ "slug",
548
+ "context"
549
+ ]
550
+ },
551
+ {
552
+ "name": "inventory_lot_corrections_lot_idx",
553
+ "columns": [
554
+ "lot_id"
555
+ ]
556
+ },
557
+ {
558
+ "name": "inventory_lot_corrections_tenant_id_created_at_idx",
559
+ "columns": [
560
+ "tenant_id",
561
+ "created_at"
562
+ ]
563
+ },
564
+ {
565
+ "name": "inventory_lot_corrections_actor_profile_id_idx",
566
+ "columns": [
567
+ "actor_profile_id"
568
+ ]
569
+ }
570
+ ],
571
+ "version": "d903252e"
572
+ },
573
+ "importPath": "@happyvertical/smrt-inventory"
574
+ },
575
+ "@happyvertical/smrt-inventory:LotDocumentCollection": {
576
+ "name": "lotdocumentcollection",
577
+ "className": "LotDocumentCollection",
578
+ "qualifiedName": "@happyvertical/smrt-inventory:LotDocumentCollection",
579
+ "collection": "lotdocuments",
580
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotDocumentCollection.ts",
581
+ "packageName": "@happyvertical/smrt-inventory",
582
+ "fields": {},
583
+ "methods": {},
584
+ "decoratorConfig": {
585
+ "tableName": "inventory_lot_documents",
586
+ "api": {
587
+ "include": [
588
+ "list",
589
+ "get"
590
+ ]
591
+ },
592
+ "mcp": {
593
+ "include": [
594
+ "list",
595
+ "get"
596
+ ]
597
+ },
598
+ "cli": {
599
+ "include": [
600
+ "list",
601
+ "get"
602
+ ]
603
+ }
604
+ },
605
+ "extends": "SmrtCollection",
606
+ "extendsTypeArg": "LotDocument",
607
+ "exportName": "LotDocumentCollection",
608
+ "collectionExportName": "LotDocumentCollectionCollection",
609
+ "schema": {
610
+ "tableName": "inventory_lot_documents",
611
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_lot_documents\" (\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 \"lot_id\" UUID NOT NULL,\n \"asset_id\" UUID,\n \"role\" TEXT DEFAULT 'certificate',\n \"attached_at\" TIMESTAMP,\n \"attached_by_profile_id\" UUID,\n \"detached_at\" TIMESTAMP,\n \"detached_by_profile_id\" UUID\n);",
612
+ "columns": {
613
+ "id": {
614
+ "type": "UUID",
615
+ "primaryKey": true,
616
+ "referenceKind": "id",
617
+ "notNull": true
618
+ },
619
+ "slug": {
620
+ "type": "TEXT",
621
+ "notNull": true
622
+ },
623
+ "context": {
624
+ "type": "TEXT",
625
+ "notNull": true,
626
+ "default": ""
627
+ },
628
+ "created_at": {
629
+ "type": "TIMESTAMP",
630
+ "notNull": true,
631
+ "default": "current_timestamp"
632
+ },
633
+ "updated_at": {
634
+ "type": "TIMESTAMP",
635
+ "notNull": true,
636
+ "default": "current_timestamp"
637
+ },
638
+ "tenant_id": {
639
+ "type": "UUID",
640
+ "referenceKind": "tenantId",
641
+ "notNull": false,
642
+ "unique": false
643
+ },
644
+ "lot_id": {
645
+ "type": "UUID",
646
+ "referenceKind": "foreignKey",
647
+ "notNull": true,
648
+ "unique": false,
649
+ "foreignKey": {
650
+ "table": "inventory_lots",
651
+ "column": "id",
652
+ "onDelete": "RESTRICT",
653
+ "onUpdate": "RESTRICT",
654
+ "engines": [
655
+ "postgres",
656
+ "sqlite"
657
+ ]
658
+ }
659
+ },
660
+ "asset_id": {
661
+ "type": "UUID",
662
+ "referenceKind": "crossPackageRef",
663
+ "notNull": false,
664
+ "unique": false
665
+ },
666
+ "role": {
578
667
  "type": "TEXT",
579
668
  "notNull": false,
669
+ "unique": false,
670
+ "default": "certificate"
671
+ },
672
+ "attached_at": {
673
+ "type": "TIMESTAMP",
674
+ "notNull": false,
675
+ "unique": false
676
+ },
677
+ "attached_by_profile_id": {
678
+ "type": "UUID",
679
+ "referenceKind": "crossPackageRef",
680
+ "notNull": false,
681
+ "unique": false
682
+ },
683
+ "detached_at": {
684
+ "type": "TIMESTAMP",
685
+ "notNull": false,
686
+ "unique": false
687
+ },
688
+ "detached_by_profile_id": {
689
+ "type": "UUID",
690
+ "referenceKind": "crossPackageRef",
691
+ "notNull": false,
580
692
  "unique": false
693
+ }
694
+ },
695
+ "indexes": [
696
+ {
697
+ "name": "inventory_lot_documents_slug_context_idx",
698
+ "columns": [
699
+ "tenant_id",
700
+ "slug",
701
+ "context"
702
+ ],
703
+ "unique": true,
704
+ "nullsNotDistinct": true
705
+ },
706
+ {
707
+ "name": "inventory_lot_documents_lot_idx",
708
+ "columns": [
709
+ "lot_id"
710
+ ]
711
+ },
712
+ {
713
+ "name": "inventory_lot_documents_tenant_id_created_at_idx",
714
+ "columns": [
715
+ "tenant_id",
716
+ "created_at"
717
+ ]
718
+ },
719
+ {
720
+ "name": "inventory_lot_documents_asset_id_idx",
721
+ "columns": [
722
+ "asset_id"
723
+ ]
724
+ },
725
+ {
726
+ "name": "inventory_lot_documents_attached_by_profile_id_idx",
727
+ "columns": [
728
+ "attached_by_profile_id"
729
+ ]
730
+ },
731
+ {
732
+ "name": "inventory_lot_documents_detached_by_profile_id_idx",
733
+ "columns": [
734
+ "detached_by_profile_id"
735
+ ]
736
+ }
737
+ ],
738
+ "version": "076940be"
739
+ },
740
+ "importPath": "@happyvertical/smrt-inventory"
741
+ },
742
+ "@happyvertical/smrt-inventory:LotStockLevelCollection": {
743
+ "name": "lotstocklevelcollection",
744
+ "className": "LotStockLevelCollection",
745
+ "qualifiedName": "@happyvertical/smrt-inventory:LotStockLevelCollection",
746
+ "collection": "lotstocklevels",
747
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotStockLevelCollection.ts",
748
+ "packageName": "@happyvertical/smrt-inventory",
749
+ "fields": {},
750
+ "methods": {
751
+ "getLevel": {
752
+ "name": "getLevel",
753
+ "async": true,
754
+ "parameters": [
755
+ {
756
+ "name": "lotId",
757
+ "type": "string",
758
+ "optional": false
759
+ },
760
+ {
761
+ "name": "locationId",
762
+ "type": "string",
763
+ "optional": false
764
+ },
765
+ {
766
+ "name": "state",
767
+ "type": "StockState",
768
+ "optional": true,
769
+ "default": "available"
770
+ }
771
+ ],
772
+ "returnType": "Promise<LotStockLevel | null>",
773
+ "isStatic": false,
774
+ "isPublic": true
775
+ },
776
+ "onHand": {
777
+ "name": "onHand",
778
+ "async": true,
779
+ "parameters": [
780
+ {
781
+ "name": "lotId",
782
+ "type": "string",
783
+ "optional": false
784
+ },
785
+ {
786
+ "name": "state",
787
+ "type": "StockState",
788
+ "optional": true
789
+ }
790
+ ],
791
+ "returnType": "Promise<number>",
792
+ "isStatic": false,
793
+ "isPublic": true
794
+ }
795
+ },
796
+ "decoratorConfig": {
797
+ "tableName": "inventory_lot_stock_levels",
798
+ "api": {
799
+ "include": [
800
+ "list",
801
+ "get"
802
+ ]
803
+ },
804
+ "mcp": {
805
+ "include": [
806
+ "list",
807
+ "get"
808
+ ]
809
+ },
810
+ "cli": {
811
+ "include": [
812
+ "list",
813
+ "get"
814
+ ]
815
+ }
816
+ },
817
+ "extends": "SmrtCollection",
818
+ "extendsTypeArg": "LotStockLevel",
819
+ "exportName": "LotStockLevelCollection",
820
+ "collectionExportName": "LotStockLevelCollectionCollection",
821
+ "schema": {
822
+ "tableName": "inventory_lot_stock_levels",
823
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_lot_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 \"lot_id\" UUID NOT NULL,\n \"sku_id\" TEXT DEFAULT '',\n \"location_id\" TEXT NOT NULL DEFAULT '',\n \"state\" TEXT NOT NULL DEFAULT 'available',\n \"qty\" REAL\n);",
824
+ "columns": {
825
+ "id": {
826
+ "type": "UUID",
827
+ "primaryKey": true,
828
+ "referenceKind": "id",
829
+ "notNull": true
830
+ },
831
+ "slug": {
832
+ "type": "TEXT",
833
+ "notNull": true
834
+ },
835
+ "context": {
836
+ "type": "TEXT",
837
+ "notNull": true,
838
+ "default": ""
839
+ },
840
+ "created_at": {
841
+ "type": "TIMESTAMP",
842
+ "notNull": true,
843
+ "default": "current_timestamp"
844
+ },
845
+ "updated_at": {
846
+ "type": "TIMESTAMP",
847
+ "notNull": true,
848
+ "default": "current_timestamp"
849
+ },
850
+ "tenant_id": {
851
+ "type": "UUID",
852
+ "referenceKind": "tenantId",
853
+ "notNull": false,
854
+ "unique": false
855
+ },
856
+ "lot_id": {
857
+ "type": "UUID",
858
+ "referenceKind": "foreignKey",
859
+ "notNull": true,
860
+ "unique": false,
861
+ "foreignKey": {
862
+ "table": "inventory_lots",
863
+ "column": "id",
864
+ "onDelete": "RESTRICT",
865
+ "onUpdate": "RESTRICT",
866
+ "engines": [
867
+ "postgres",
868
+ "sqlite"
869
+ ]
870
+ }
871
+ },
872
+ "sku_id": {
873
+ "type": "TEXT",
874
+ "notNull": false,
875
+ "unique": false,
876
+ "default": ""
877
+ },
878
+ "location_id": {
879
+ "type": "TEXT",
880
+ "notNull": true,
881
+ "unique": false,
882
+ "default": ""
883
+ },
884
+ "state": {
885
+ "type": "TEXT",
886
+ "notNull": true,
887
+ "unique": false,
888
+ "default": "available"
889
+ },
890
+ "qty": {
891
+ "type": "REAL",
892
+ "notNull": false,
893
+ "unique": false
894
+ }
895
+ },
896
+ "indexes": [
897
+ {
898
+ "name": "inventory_lot_stock_levels_lot_id_location_id_idx",
899
+ "columns": [
900
+ "lot_id",
901
+ "location_id",
902
+ "state",
903
+ "tenant_id"
904
+ ],
905
+ "unique": true,
906
+ "nullsNotDistinct": true
907
+ },
908
+ {
909
+ "name": "inventory_lot_stock_levels_slug_context_idx",
910
+ "columns": [
911
+ "slug",
912
+ "context"
913
+ ]
914
+ },
915
+ {
916
+ "name": "inventory_lot_stock_levels_tenant_id_created_at_idx",
917
+ "columns": [
918
+ "tenant_id",
919
+ "created_at"
920
+ ]
921
+ }
922
+ ],
923
+ "version": "6f6becfa"
924
+ },
925
+ "importPath": "@happyvertical/smrt-inventory"
926
+ },
927
+ "@happyvertical/smrt-inventory:LotUsageCollection": {
928
+ "name": "lotusagecollection",
929
+ "className": "LotUsageCollection",
930
+ "qualifiedName": "@happyvertical/smrt-inventory:LotUsageCollection",
931
+ "collection": "lotusages",
932
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotUsageCollection.ts",
933
+ "packageName": "@happyvertical/smrt-inventory",
934
+ "fields": {},
935
+ "methods": {
936
+ "findActiveForLot": {
937
+ "name": "findActiveForLot",
938
+ "async": true,
939
+ "parameters": [
940
+ {
941
+ "name": "lotId",
942
+ "type": "string",
943
+ "optional": false
944
+ }
945
+ ],
946
+ "returnType": "Promise<LotUsage[]>",
947
+ "isStatic": false,
948
+ "isPublic": true
949
+ },
950
+ "findForConsumer": {
951
+ "name": "findForConsumer",
952
+ "async": true,
953
+ "parameters": [
954
+ {
955
+ "name": "consumerType",
956
+ "type": "string",
957
+ "optional": false
958
+ },
959
+ {
960
+ "name": "consumerId",
961
+ "type": "string",
962
+ "optional": false
963
+ },
964
+ {
965
+ "name": "options",
966
+ "type": "object",
967
+ "optional": true,
968
+ "memberTypes": [
969
+ "boolean"
970
+ ]
971
+ }
972
+ ],
973
+ "returnType": "Promise<LotUsage[]>",
974
+ "isStatic": false,
975
+ "isPublic": true
976
+ }
977
+ },
978
+ "decoratorConfig": {
979
+ "tableName": "inventory_lot_usages",
980
+ "api": {
981
+ "include": [
982
+ "list",
983
+ "get"
984
+ ]
985
+ },
986
+ "mcp": {
987
+ "include": [
988
+ "list",
989
+ "get"
990
+ ]
991
+ },
992
+ "cli": {
993
+ "include": [
994
+ "list",
995
+ "get"
996
+ ]
997
+ }
998
+ },
999
+ "extends": "SmrtCollection",
1000
+ "extendsTypeArg": "LotUsage",
1001
+ "exportName": "LotUsageCollection",
1002
+ "collectionExportName": "LotUsageCollectionCollection",
1003
+ "schema": {
1004
+ "tableName": "inventory_lot_usages",
1005
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_lot_usages\" (\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 \"lot_id\" UUID NOT NULL,\n \"consumer_type\" TEXT NOT NULL DEFAULT '',\n \"consumer_id\" TEXT NOT NULL DEFAULT '',\n \"qty\" REAL,\n \"unit\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"linked_at\" TIMESTAMP,\n \"linked_by_profile_id\" UUID,\n \"unlinked_at\" TIMESTAMP,\n \"unlinked_by_profile_id\" UUID,\n \"unlink_reason\" TEXT,\n \"movement_id\" TEXT\n);",
1006
+ "columns": {
1007
+ "id": {
1008
+ "type": "UUID",
1009
+ "primaryKey": true,
1010
+ "referenceKind": "id",
1011
+ "notNull": true
1012
+ },
1013
+ "slug": {
1014
+ "type": "TEXT",
1015
+ "notNull": true
1016
+ },
1017
+ "context": {
1018
+ "type": "TEXT",
1019
+ "notNull": true,
1020
+ "default": ""
1021
+ },
1022
+ "created_at": {
1023
+ "type": "TIMESTAMP",
1024
+ "notNull": true,
1025
+ "default": "current_timestamp"
1026
+ },
1027
+ "updated_at": {
1028
+ "type": "TIMESTAMP",
1029
+ "notNull": true,
1030
+ "default": "current_timestamp"
1031
+ },
1032
+ "tenant_id": {
1033
+ "type": "UUID",
1034
+ "referenceKind": "tenantId",
1035
+ "notNull": false,
1036
+ "unique": false
1037
+ },
1038
+ "lot_id": {
1039
+ "type": "UUID",
1040
+ "referenceKind": "foreignKey",
1041
+ "notNull": true,
1042
+ "unique": false,
1043
+ "foreignKey": {
1044
+ "table": "inventory_lots",
1045
+ "column": "id",
1046
+ "onDelete": "RESTRICT",
1047
+ "onUpdate": "RESTRICT",
1048
+ "engines": [
1049
+ "postgres",
1050
+ "sqlite"
1051
+ ]
1052
+ }
1053
+ },
1054
+ "consumer_type": {
1055
+ "type": "TEXT",
1056
+ "notNull": true,
1057
+ "unique": false,
1058
+ "default": ""
1059
+ },
1060
+ "consumer_id": {
1061
+ "type": "TEXT",
1062
+ "notNull": true,
1063
+ "unique": false,
1064
+ "default": ""
1065
+ },
1066
+ "qty": {
1067
+ "type": "REAL",
1068
+ "notNull": false,
1069
+ "unique": false
1070
+ },
1071
+ "unit": {
1072
+ "type": "TEXT",
1073
+ "notNull": false,
1074
+ "unique": false,
1075
+ "default": ""
1076
+ },
1077
+ "status": {
1078
+ "type": "TEXT",
1079
+ "notNull": false,
1080
+ "unique": false,
1081
+ "default": "active"
1082
+ },
1083
+ "linked_at": {
1084
+ "type": "TIMESTAMP",
1085
+ "notNull": false,
1086
+ "unique": false
1087
+ },
1088
+ "linked_by_profile_id": {
1089
+ "type": "UUID",
1090
+ "referenceKind": "crossPackageRef",
1091
+ "notNull": false,
1092
+ "unique": false
1093
+ },
1094
+ "unlinked_at": {
1095
+ "type": "TIMESTAMP",
1096
+ "notNull": false,
1097
+ "unique": false
1098
+ },
1099
+ "unlinked_by_profile_id": {
1100
+ "type": "UUID",
1101
+ "referenceKind": "crossPackageRef",
1102
+ "notNull": false,
1103
+ "unique": false
1104
+ },
1105
+ "unlink_reason": {
1106
+ "type": "TEXT",
1107
+ "notNull": false,
1108
+ "unique": false
1109
+ },
1110
+ "movement_id": {
1111
+ "type": "TEXT",
1112
+ "notNull": false,
1113
+ "unique": false
1114
+ }
1115
+ },
1116
+ "indexes": [
1117
+ {
1118
+ "name": "inventory_lot_usages_slug_context_idx",
1119
+ "columns": [
1120
+ "tenant_id",
1121
+ "slug",
1122
+ "context"
1123
+ ],
1124
+ "unique": true,
1125
+ "nullsNotDistinct": true
1126
+ },
1127
+ {
1128
+ "name": "inventory_lot_usages_consumer_idx",
1129
+ "columns": [
1130
+ "consumer_type",
1131
+ "consumer_id"
1132
+ ]
1133
+ },
1134
+ {
1135
+ "name": "inventory_lot_usages_lot_status_idx",
1136
+ "columns": [
1137
+ "lot_id",
1138
+ "status"
1139
+ ]
1140
+ },
1141
+ {
1142
+ "name": "inventory_lot_usages_tenant_id_created_at_idx",
1143
+ "columns": [
1144
+ "tenant_id",
1145
+ "created_at"
1146
+ ]
1147
+ },
1148
+ {
1149
+ "name": "inventory_lot_usages_linked_by_profile_id_idx",
1150
+ "columns": [
1151
+ "linked_by_profile_id"
1152
+ ]
1153
+ },
1154
+ {
1155
+ "name": "inventory_lot_usages_unlinked_by_profile_id_idx",
1156
+ "columns": [
1157
+ "unlinked_by_profile_id"
1158
+ ]
1159
+ }
1160
+ ],
1161
+ "version": "c106a419"
1162
+ },
1163
+ "importPath": "@happyvertical/smrt-inventory"
1164
+ },
1165
+ "@happyvertical/smrt-inventory:StockLevelCollection": {
1166
+ "name": "stocklevelcollection",
1167
+ "className": "StockLevelCollection",
1168
+ "qualifiedName": "@happyvertical/smrt-inventory:StockLevelCollection",
1169
+ "collection": "stocklevels",
1170
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockLevelCollection.ts",
1171
+ "packageName": "@happyvertical/smrt-inventory",
1172
+ "fields": {},
1173
+ "methods": {
1174
+ "getLevel": {
1175
+ "name": "getLevel",
1176
+ "async": true,
1177
+ "parameters": [
1178
+ {
1179
+ "name": "skuId",
1180
+ "type": "string",
1181
+ "optional": false
1182
+ },
1183
+ {
1184
+ "name": "locationId",
1185
+ "type": "string",
1186
+ "optional": false
1187
+ },
1188
+ {
1189
+ "name": "state",
1190
+ "type": "StockState",
1191
+ "optional": true,
1192
+ "default": "available"
1193
+ }
1194
+ ],
1195
+ "returnType": "Promise<StockLevel | null>",
1196
+ "isStatic": false,
1197
+ "isPublic": true
1198
+ },
1199
+ "findBySku": {
1200
+ "name": "findBySku",
1201
+ "async": true,
1202
+ "parameters": [
1203
+ {
1204
+ "name": "skuId",
1205
+ "type": "string",
1206
+ "optional": false
1207
+ }
1208
+ ],
1209
+ "returnType": "Promise<StockLevel[]>",
1210
+ "isStatic": false,
1211
+ "isPublic": true
1212
+ },
1213
+ "findByLocation": {
1214
+ "name": "findByLocation",
1215
+ "async": true,
1216
+ "parameters": [
1217
+ {
1218
+ "name": "locationId",
1219
+ "type": "string",
1220
+ "optional": false
1221
+ }
1222
+ ],
1223
+ "returnType": "Promise<StockLevel[]>",
1224
+ "isStatic": false,
1225
+ "isPublic": true
1226
+ },
1227
+ "findBelowReorderPoint": {
1228
+ "name": "findBelowReorderPoint",
1229
+ "async": true,
1230
+ "parameters": [
1231
+ {
1232
+ "name": "locationId",
1233
+ "type": "string",
1234
+ "optional": true
1235
+ }
1236
+ ],
1237
+ "returnType": "Promise<StockLevel[]>",
1238
+ "isStatic": false,
1239
+ "isPublic": true
1240
+ },
1241
+ "totalForSku": {
1242
+ "name": "totalForSku",
1243
+ "async": true,
1244
+ "parameters": [
1245
+ {
1246
+ "name": "skuId",
1247
+ "type": "string",
1248
+ "optional": false
1249
+ },
1250
+ {
1251
+ "name": "state",
1252
+ "type": "StockState",
1253
+ "optional": true
1254
+ }
1255
+ ],
1256
+ "returnType": "Promise<number>",
1257
+ "isStatic": false,
1258
+ "isPublic": true
1259
+ },
1260
+ "totalForLocation": {
1261
+ "name": "totalForLocation",
1262
+ "async": true,
1263
+ "parameters": [
1264
+ {
1265
+ "name": "locationId",
1266
+ "type": "string",
1267
+ "optional": false
1268
+ },
1269
+ {
1270
+ "name": "state",
1271
+ "type": "StockState",
1272
+ "optional": true
1273
+ }
1274
+ ],
1275
+ "returnType": "Promise<number>",
1276
+ "isStatic": false,
1277
+ "isPublic": true
1278
+ }
1279
+ },
1280
+ "decoratorConfig": {
1281
+ "tableName": "inventory_stock_levels",
1282
+ "api": {
1283
+ "include": [
1284
+ "list",
1285
+ "get"
1286
+ ]
1287
+ },
1288
+ "mcp": {
1289
+ "include": [
1290
+ "list",
1291
+ "get"
1292
+ ]
1293
+ },
1294
+ "cli": {
1295
+ "include": [
1296
+ "list",
1297
+ "get"
1298
+ ]
1299
+ }
1300
+ },
1301
+ "extends": "SmrtCollection",
1302
+ "extendsTypeArg": "StockLevel",
1303
+ "exportName": "StockLevelCollection",
1304
+ "collectionExportName": "StockLevelCollectionCollection",
1305
+ "schema": {
1306
+ "tableName": "inventory_stock_levels",
1307
+ "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 \"reorder_point\" REAL,\n \"reorder_quantity\" REAL\n);",
1308
+ "columns": {
1309
+ "id": {
1310
+ "type": "UUID",
1311
+ "primaryKey": true,
1312
+ "referenceKind": "id",
1313
+ "notNull": true
1314
+ },
1315
+ "slug": {
1316
+ "type": "TEXT",
1317
+ "notNull": true
1318
+ },
1319
+ "context": {
1320
+ "type": "TEXT",
1321
+ "notNull": true,
1322
+ "default": ""
1323
+ },
1324
+ "created_at": {
1325
+ "type": "TIMESTAMP",
1326
+ "notNull": true,
1327
+ "default": "current_timestamp"
1328
+ },
1329
+ "updated_at": {
1330
+ "type": "TIMESTAMP",
1331
+ "notNull": true,
1332
+ "default": "current_timestamp"
1333
+ },
1334
+ "tenant_id": {
1335
+ "type": "UUID",
1336
+ "referenceKind": "tenantId",
1337
+ "notNull": false,
1338
+ "unique": false
1339
+ },
1340
+ "sku_id": {
1341
+ "type": "TEXT",
1342
+ "notNull": true,
1343
+ "unique": false,
1344
+ "default": ""
1345
+ },
1346
+ "location_id": {
1347
+ "type": "TEXT",
1348
+ "notNull": true,
1349
+ "unique": false,
1350
+ "default": ""
1351
+ },
1352
+ "state": {
1353
+ "type": "TEXT",
1354
+ "notNull": true,
1355
+ "unique": false,
1356
+ "default": "available"
1357
+ },
1358
+ "qty": {
1359
+ "type": "REAL",
1360
+ "notNull": false,
1361
+ "unique": false
1362
+ },
1363
+ "reorder_point": {
1364
+ "type": "REAL",
1365
+ "notNull": false,
1366
+ "unique": false
1367
+ },
1368
+ "reorder_quantity": {
1369
+ "type": "REAL",
1370
+ "notNull": false,
1371
+ "unique": false
1372
+ }
1373
+ },
1374
+ "indexes": [
1375
+ {
1376
+ "name": "inventory_stock_levels_sku_id_location_id_idx",
1377
+ "columns": [
1378
+ "sku_id",
1379
+ "location_id",
1380
+ "state",
1381
+ "tenant_id"
1382
+ ],
1383
+ "unique": true,
1384
+ "nullsNotDistinct": true
1385
+ },
1386
+ {
1387
+ "name": "inventory_stock_levels_slug_context_idx",
1388
+ "columns": [
1389
+ "slug",
1390
+ "context"
1391
+ ]
1392
+ },
1393
+ {
1394
+ "name": "inventory_stock_levels_tenant_id_created_at_idx",
1395
+ "columns": [
1396
+ "tenant_id",
1397
+ "created_at"
1398
+ ]
1399
+ }
1400
+ ],
1401
+ "version": "02387935"
1402
+ },
1403
+ "importPath": "@happyvertical/smrt-inventory"
1404
+ },
1405
+ "@happyvertical/smrt-inventory:StockMovementCollection": {
1406
+ "name": "stockmovementcollection",
1407
+ "className": "StockMovementCollection",
1408
+ "qualifiedName": "@happyvertical/smrt-inventory:StockMovementCollection",
1409
+ "collection": "stockmovements",
1410
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockMovementCollection.ts",
1411
+ "packageName": "@happyvertical/smrt-inventory",
1412
+ "fields": {},
1413
+ "methods": {
1414
+ "findBySku": {
1415
+ "name": "findBySku",
1416
+ "async": true,
1417
+ "parameters": [
1418
+ {
1419
+ "name": "skuId",
1420
+ "type": "string",
1421
+ "optional": false
1422
+ }
1423
+ ],
1424
+ "returnType": "Promise<StockMovement[]>",
1425
+ "isStatic": false,
1426
+ "isPublic": true
1427
+ },
1428
+ "findByLocation": {
1429
+ "name": "findByLocation",
1430
+ "async": true,
1431
+ "parameters": [
1432
+ {
1433
+ "name": "locationId",
1434
+ "type": "string",
1435
+ "optional": false
1436
+ }
1437
+ ],
1438
+ "returnType": "Promise<StockMovement[]>",
1439
+ "isStatic": false,
1440
+ "isPublic": true
1441
+ },
1442
+ "findBySource": {
1443
+ "name": "findBySource",
1444
+ "async": true,
1445
+ "parameters": [
1446
+ {
1447
+ "name": "sourceType",
1448
+ "type": "string",
1449
+ "optional": false
1450
+ },
1451
+ {
1452
+ "name": "sourceId",
1453
+ "type": "string",
1454
+ "optional": false
1455
+ }
1456
+ ],
1457
+ "returnType": "Promise<StockMovement[]>",
1458
+ "isStatic": false,
1459
+ "isPublic": true
1460
+ },
1461
+ "findByReason": {
1462
+ "name": "findByReason",
1463
+ "async": true,
1464
+ "parameters": [
1465
+ {
1466
+ "name": "reasonCode",
1467
+ "type": "StockMovementReason",
1468
+ "optional": false
1469
+ }
1470
+ ],
1471
+ "returnType": "Promise<StockMovement[]>",
1472
+ "isStatic": false,
1473
+ "isPublic": true
1474
+ }
1475
+ },
1476
+ "decoratorConfig": {
1477
+ "tableName": "inventory_stock_movements",
1478
+ "api": {
1479
+ "include": [
1480
+ "list",
1481
+ "get"
1482
+ ]
1483
+ },
1484
+ "mcp": {
1485
+ "include": [
1486
+ "list",
1487
+ "get"
1488
+ ]
1489
+ },
1490
+ "cli": {
1491
+ "include": [
1492
+ "list",
1493
+ "get"
1494
+ ]
1495
+ }
1496
+ },
1497
+ "extends": "SmrtCollection",
1498
+ "extendsTypeArg": "StockMovement",
1499
+ "exportName": "StockMovementCollection",
1500
+ "collectionExportName": "StockMovementCollectionCollection",
1501
+ "schema": {
1502
+ "tableName": "inventory_stock_movements",
1503
+ "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 \"lot_id\" TEXT,\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 \"actor_profile_id\" UUID,\n \"note\" TEXT DEFAULT '',\n \"occurred_at\" TIMESTAMP\n);",
1504
+ "columns": {
1505
+ "id": {
1506
+ "type": "UUID",
1507
+ "primaryKey": true,
1508
+ "referenceKind": "id",
1509
+ "notNull": true
1510
+ },
1511
+ "slug": {
1512
+ "type": "TEXT",
1513
+ "notNull": true
1514
+ },
1515
+ "context": {
1516
+ "type": "TEXT",
1517
+ "notNull": true,
1518
+ "default": ""
1519
+ },
1520
+ "created_at": {
1521
+ "type": "TIMESTAMP",
1522
+ "notNull": true,
1523
+ "default": "current_timestamp"
1524
+ },
1525
+ "updated_at": {
1526
+ "type": "TIMESTAMP",
1527
+ "notNull": true,
1528
+ "default": "current_timestamp"
1529
+ },
1530
+ "tenant_id": {
1531
+ "type": "UUID",
1532
+ "referenceKind": "tenantId",
1533
+ "notNull": false,
1534
+ "unique": false
1535
+ },
1536
+ "sku_id": {
1537
+ "type": "TEXT",
1538
+ "notNull": true,
1539
+ "unique": false,
1540
+ "default": ""
1541
+ },
1542
+ "location_id": {
1543
+ "type": "TEXT",
1544
+ "notNull": true,
1545
+ "unique": false,
1546
+ "default": ""
1547
+ },
1548
+ "lot_id": {
1549
+ "type": "TEXT",
1550
+ "notNull": false,
1551
+ "unique": false
1552
+ },
1553
+ "from_state": {
1554
+ "type": "TEXT",
1555
+ "notNull": false,
1556
+ "unique": false
1557
+ },
1558
+ "to_state": {
1559
+ "type": "TEXT",
1560
+ "notNull": false,
1561
+ "unique": false
1562
+ },
1563
+ "qty": {
1564
+ "type": "REAL",
1565
+ "notNull": false,
1566
+ "unique": false
1567
+ },
1568
+ "reason_code": {
1569
+ "type": "TEXT",
1570
+ "notNull": true,
1571
+ "unique": false,
1572
+ "default": "adjustment"
1573
+ },
1574
+ "source_type": {
1575
+ "type": "TEXT",
1576
+ "notNull": false,
1577
+ "unique": false,
1578
+ "default": ""
1579
+ },
1580
+ "source_id": {
1581
+ "type": "TEXT",
1582
+ "notNull": false,
1583
+ "unique": false,
1584
+ "default": ""
1585
+ },
1586
+ "actor_profile_id": {
1587
+ "type": "UUID",
1588
+ "referenceKind": "crossPackageRef",
1589
+ "notNull": false,
1590
+ "unique": false
1591
+ },
1592
+ "note": {
1593
+ "type": "TEXT",
1594
+ "notNull": false,
1595
+ "unique": false,
1596
+ "default": ""
1597
+ },
1598
+ "occurred_at": {
1599
+ "type": "TIMESTAMP",
1600
+ "notNull": false,
1601
+ "unique": false
1602
+ }
1603
+ },
1604
+ "indexes": [
1605
+ {
1606
+ "name": "inventory_stock_movements_slug_context_idx",
1607
+ "columns": [
1608
+ "slug",
1609
+ "context"
1610
+ ]
1611
+ },
1612
+ {
1613
+ "name": "inventory_stock_movements_lot_idx",
1614
+ "columns": [
1615
+ "lot_id"
1616
+ ]
1617
+ },
1618
+ {
1619
+ "name": "inventory_stock_movements_tenant_id_created_at_idx",
1620
+ "columns": [
1621
+ "tenant_id",
1622
+ "created_at"
1623
+ ]
1624
+ },
1625
+ {
1626
+ "name": "inventory_stock_movements_actor_profile_id_idx",
1627
+ "columns": [
1628
+ "actor_profile_id"
1629
+ ]
1630
+ }
1631
+ ],
1632
+ "version": "b426c2c5"
1633
+ },
1634
+ "importPath": "@happyvertical/smrt-inventory"
1635
+ },
1636
+ "@happyvertical/smrt-inventory:InventoryLocation": {
1637
+ "name": "inventorylocation",
1638
+ "className": "InventoryLocation",
1639
+ "qualifiedName": "@happyvertical/smrt-inventory:InventoryLocation",
1640
+ "collection": "inventorylocations",
1641
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/models/InventoryLocation.ts",
1642
+ "packageName": "@happyvertical/smrt-inventory",
1643
+ "fields": {
1644
+ "tenantId": {
1645
+ "type": "text",
1646
+ "required": false,
1647
+ "_meta": {
1648
+ "sqlType": "UUID",
1649
+ "nullable": true,
1650
+ "__tenancy": {
1651
+ "isTenantIdField": true,
1652
+ "autoFilter": true,
1653
+ "required": false,
1654
+ "autoPopulate": true,
1655
+ "nullable": true,
1656
+ "mode": "optional",
1657
+ "field": "tenantId",
1658
+ "allowSuperAdminBypass": false
1659
+ }
1660
+ }
1661
+ },
1662
+ "code": {
1663
+ "type": "text",
1664
+ "required": true,
1665
+ "default": "",
1666
+ "description": "A short code for the place stock is kept, for example MAIN.",
1667
+ "_meta": {
1668
+ "required": true,
1669
+ "description": "A short code for the place stock is kept, for example MAIN."
1670
+ }
1671
+ },
1672
+ "name": {
1673
+ "type": "text",
1674
+ "required": false,
1675
+ "default": "",
1676
+ "description": "What you call the place, for example Main warehouse.",
1677
+ "_meta": {
1678
+ "description": "What you call the place, for example Main warehouse."
1679
+ }
1680
+ },
1681
+ "kind": {
1682
+ "type": "text",
1683
+ "required": false,
1684
+ "default": "warehouse",
1685
+ "description": "What sort of place it is, for example a warehouse or a shop floor.",
1686
+ "_meta": {
1687
+ "description": "What sort of place it is, for example a warehouse or a shop floor."
1688
+ }
1689
+ },
1690
+ "placeId": {
1691
+ "type": "text",
1692
+ "required": false,
1693
+ "default": ""
1694
+ },
1695
+ "active": {
1696
+ "type": "boolean",
1697
+ "required": false,
1698
+ "default": true
1699
+ }
1700
+ },
1701
+ "methods": {},
1702
+ "decoratorConfig": {
1703
+ "tableName": "inventory_locations",
1704
+ "conflictColumns": [
1705
+ "code",
1706
+ "tenant_id"
1707
+ ],
1708
+ "api": {
1709
+ "include": [
1710
+ "list",
1711
+ "get",
1712
+ "create",
1713
+ "update"
1714
+ ]
1715
+ },
1716
+ "mcp": {
1717
+ "include": [
1718
+ "list",
1719
+ "get"
1720
+ ]
1721
+ },
1722
+ "cli": true,
1723
+ "tenantScoped": {
1724
+ "mode": "optional"
1725
+ }
1726
+ },
1727
+ "extends": "SmrtObject",
1728
+ "exportName": "InventoryLocation",
1729
+ "collectionExportName": "InventoryLocationCollection",
1730
+ "displayLabelField": "name",
1731
+ "validationRules": [
1732
+ {
1733
+ "field": "code",
1734
+ "rule": "required",
1735
+ "fieldType": "text"
1736
+ }
1737
+ ],
1738
+ "schema": {
1739
+ "tableName": "inventory_locations",
1740
+ "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);",
1741
+ "columns": {
1742
+ "id": {
1743
+ "type": "UUID",
1744
+ "primaryKey": true,
1745
+ "referenceKind": "id",
1746
+ "notNull": true
1747
+ },
1748
+ "slug": {
1749
+ "type": "TEXT",
1750
+ "notNull": true
1751
+ },
1752
+ "context": {
1753
+ "type": "TEXT",
1754
+ "notNull": true,
1755
+ "default": ""
1756
+ },
1757
+ "created_at": {
1758
+ "type": "TIMESTAMP",
1759
+ "notNull": true,
1760
+ "default": "current_timestamp"
1761
+ },
1762
+ "updated_at": {
1763
+ "type": "TIMESTAMP",
1764
+ "notNull": true,
1765
+ "default": "current_timestamp"
1766
+ },
1767
+ "tenant_id": {
1768
+ "type": "UUID",
1769
+ "referenceKind": "tenantId",
1770
+ "notNull": false,
1771
+ "unique": false
1772
+ },
1773
+ "code": {
1774
+ "type": "TEXT",
1775
+ "notNull": true,
1776
+ "unique": false,
1777
+ "default": ""
1778
+ },
1779
+ "name": {
1780
+ "type": "TEXT",
1781
+ "notNull": false,
1782
+ "unique": false,
1783
+ "default": ""
1784
+ },
1785
+ "kind": {
1786
+ "type": "TEXT",
1787
+ "notNull": false,
1788
+ "unique": false,
1789
+ "default": "warehouse"
1790
+ },
1791
+ "place_id": {
1792
+ "type": "TEXT",
1793
+ "notNull": false,
1794
+ "unique": false,
1795
+ "default": ""
1796
+ },
1797
+ "active": {
1798
+ "type": "BOOLEAN",
1799
+ "notNull": false,
1800
+ "unique": false,
1801
+ "default": true
1802
+ }
1803
+ },
1804
+ "indexes": [
1805
+ {
1806
+ "name": "inventory_locations_code_tenant_id_idx",
1807
+ "columns": [
1808
+ "code",
1809
+ "tenant_id"
1810
+ ],
1811
+ "unique": true,
1812
+ "nullsNotDistinct": true
1813
+ },
1814
+ {
1815
+ "name": "inventory_locations_slug_context_idx",
1816
+ "columns": [
1817
+ "slug",
1818
+ "context"
1819
+ ]
1820
+ },
1821
+ {
1822
+ "name": "inventory_locations_tenant_id_created_at_idx",
1823
+ "columns": [
1824
+ "tenant_id",
1825
+ "created_at"
1826
+ ]
1827
+ }
1828
+ ],
1829
+ "version": "401c28a1"
1830
+ },
1831
+ "importPath": "@happyvertical/smrt-inventory"
1832
+ },
1833
+ "@happyvertical/smrt-inventory:Lot": {
1834
+ "name": "lot",
1835
+ "className": "Lot",
1836
+ "qualifiedName": "@happyvertical/smrt-inventory:Lot",
1837
+ "collection": "lots",
1838
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/models/Lot.ts",
1839
+ "packageName": "@happyvertical/smrt-inventory",
1840
+ "fields": {
1841
+ "tenantId": {
1842
+ "type": "text",
1843
+ "required": false,
1844
+ "_meta": {
1845
+ "sqlType": "UUID",
1846
+ "nullable": true,
1847
+ "__tenancy": {
1848
+ "isTenantIdField": true,
1849
+ "autoFilter": true,
1850
+ "required": false,
1851
+ "autoPopulate": true,
1852
+ "nullable": true,
1853
+ "mode": "optional",
1854
+ "field": "tenantId",
1855
+ "allowSuperAdminBypass": false
1856
+ }
1857
+ }
1858
+ },
1859
+ "skuId": {
1860
+ "type": "text",
1861
+ "required": false,
1862
+ "description": "The item this lot is of, if catalogued.",
1863
+ "_meta": {
1864
+ "nullable": true,
1865
+ "description": "The item this lot is of, if catalogued."
1866
+ }
1867
+ },
1868
+ "kind": {
1869
+ "type": "text",
1870
+ "required": false,
1871
+ "default": "lot",
1872
+ "description": "Whether this is a batch (lot) or a single unit (serial).",
1873
+ "_meta": {
1874
+ "description": "Whether this is a batch (lot) or a single unit (serial)."
1875
+ },
1876
+ "enum": [
1877
+ "lot",
1878
+ "serial"
1879
+ ]
1880
+ },
1881
+ "lotNumber": {
1882
+ "type": "text",
1883
+ "required": true,
1884
+ "default": "",
1885
+ "description": "The batch code, supplier lot or serial number.",
1886
+ "maxLength": 128,
1887
+ "_meta": {
1888
+ "required": true,
1889
+ "maxLength": 128,
1890
+ "description": "The batch code, supplier lot or serial number."
1891
+ }
1892
+ },
1893
+ "searchKey": {
1894
+ "type": "text",
1895
+ "required": false,
1896
+ "default": "",
1897
+ "description": "The number in normal form, used for lookup.",
1898
+ "maxLength": 160,
1899
+ "_meta": {
1900
+ "maxLength": 160,
1901
+ "description": "The number in normal form, used for lookup."
1902
+ }
1903
+ },
1904
+ "identityKey": {
1905
+ "type": "text",
1906
+ "required": true,
1907
+ "default": "",
1908
+ "description": "Internal identity that keeps lots from being created twice.",
1909
+ "maxLength": 160,
1910
+ "_meta": {
1911
+ "required": true,
1912
+ "maxLength": 160,
1913
+ "description": "Internal identity that keeps lots from being created twice."
1914
+ }
1915
+ },
1916
+ "uniqueNumber": {
1917
+ "type": "boolean",
1918
+ "required": false,
1919
+ "default": false,
1920
+ "description": "Whether the number must be unique for this item.",
1921
+ "_meta": {
1922
+ "description": "Whether the number must be unique for this item."
1923
+ }
1924
+ },
1925
+ "receivedQty": {
1926
+ "type": "decimal",
1927
+ "required": false,
1928
+ "description": "How many came in on the receipt.",
1929
+ "_meta": {
1930
+ "description": "How many came in on the receipt."
1931
+ }
1932
+ },
1933
+ "unit": {
1934
+ "type": "text",
1935
+ "required": false,
1936
+ "default": "",
1937
+ "description": "The unit of measure.",
1938
+ "_meta": {
1939
+ "description": "The unit of measure."
1940
+ }
1941
+ },
1942
+ "sourceType": {
1943
+ "type": "text",
1944
+ "required": false,
1945
+ "default": "",
1946
+ "description": "What kind of record received this lot.",
1947
+ "_meta": {
1948
+ "description": "What kind of record received this lot."
1949
+ }
1950
+ },
1951
+ "sourceId": {
1952
+ "type": "text",
1953
+ "required": false,
1954
+ "default": "",
1955
+ "description": "The record that received this lot.",
1956
+ "_meta": {
1957
+ "description": "The record that received this lot."
1958
+ }
1959
+ },
1960
+ "attributes": {
1961
+ "type": "text",
1962
+ "required": false,
1963
+ "description": "Anything else worth knowing about this lot, stored as JSON.",
1964
+ "_meta": {
1965
+ "description": "Anything else worth knowing about this lot, stored as JSON."
1966
+ }
1967
+ },
1968
+ "status": {
1969
+ "type": "text",
1970
+ "required": false,
1971
+ "default": "active",
1972
+ "description": "Where the lot stands: active, quarantined, consumed or void.",
1973
+ "_meta": {
1974
+ "description": "Where the lot stands: active, quarantined, consumed or void."
1975
+ }
1976
+ },
1977
+ "receivedAt": {
1978
+ "type": "datetime",
1979
+ "required": false,
1980
+ "description": "When the lot was received.",
1981
+ "_meta": {
1982
+ "description": "When the lot was received."
1983
+ }
1984
+ },
1985
+ "receivedByProfileId": {
1986
+ "type": "crossPackageRef",
1987
+ "required": false,
1988
+ "related": "@happyvertical/smrt-profiles:Profile"
1989
+ },
1990
+ "lastUsedAt": {
1991
+ "type": "datetime",
1992
+ "required": false,
1993
+ "_meta": {
1994
+ "nullable": true
1995
+ }
1996
+ }
1997
+ },
1998
+ "methods": {
1999
+ "getAttributes": {
2000
+ "name": "getAttributes",
2001
+ "async": false,
2002
+ "parameters": [],
2003
+ "returnType": "Record<string, unknown>",
2004
+ "isStatic": false,
2005
+ "isPublic": true
2006
+ },
2007
+ "setAttributes": {
2008
+ "name": "setAttributes",
2009
+ "async": false,
2010
+ "parameters": [
2011
+ {
2012
+ "name": "value",
2013
+ "type": "Record<string, unknown> | string",
2014
+ "optional": false,
2015
+ "unionBranches": [
2016
+ {
2017
+ "type": "Record<string, unknown>"
2018
+ },
2019
+ {
2020
+ "type": "string"
2021
+ }
2022
+ ]
2023
+ }
2024
+ ],
2025
+ "returnType": "void",
2026
+ "isStatic": false,
2027
+ "isPublic": true
2028
+ }
2029
+ },
2030
+ "decoratorConfig": {
2031
+ "tableName": "inventory_lots",
2032
+ "conflictColumns": [
2033
+ "identity_key",
2034
+ "tenant_id"
2035
+ ],
2036
+ "api": {
2037
+ "include": [
2038
+ "list",
2039
+ "get"
2040
+ ]
2041
+ },
2042
+ "mcp": {
2043
+ "include": [
2044
+ "list",
2045
+ "get"
2046
+ ]
2047
+ },
2048
+ "cli": {
2049
+ "include": [
2050
+ "list",
2051
+ "get"
2052
+ ]
2053
+ },
2054
+ "indexes": [
2055
+ {
2056
+ "name": "inventory_lots_search_key_idx",
2057
+ "columns": [
2058
+ "tenantId",
2059
+ "searchKey"
2060
+ ]
2061
+ }
2062
+ ],
2063
+ "tenantScoped": {
2064
+ "mode": "optional"
2065
+ }
2066
+ },
2067
+ "extends": "SmrtObject",
2068
+ "exportName": "Lot",
2069
+ "collectionExportName": "LotCollection",
2070
+ "validationRules": [
2071
+ {
2072
+ "field": "lotNumber",
2073
+ "rule": "required",
2074
+ "fieldType": "text"
2075
+ },
2076
+ {
2077
+ "field": "lotNumber",
2078
+ "rule": "maxLength",
2079
+ "value": 128,
2080
+ "fieldType": "text"
2081
+ },
2082
+ {
2083
+ "field": "searchKey",
2084
+ "rule": "maxLength",
2085
+ "value": 160,
2086
+ "fieldType": "text"
2087
+ },
2088
+ {
2089
+ "field": "identityKey",
2090
+ "rule": "required",
2091
+ "fieldType": "text"
2092
+ },
2093
+ {
2094
+ "field": "identityKey",
2095
+ "rule": "maxLength",
2096
+ "value": 160,
2097
+ "fieldType": "text"
2098
+ }
2099
+ ],
2100
+ "schema": {
2101
+ "tableName": "inventory_lots",
2102
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_lots\" (\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,\n \"kind\" TEXT DEFAULT 'lot',\n \"lot_number\" TEXT NOT NULL DEFAULT '',\n \"search_key\" TEXT DEFAULT '',\n \"identity_key\" TEXT NOT NULL DEFAULT '',\n \"unique_number\" BOOLEAN DEFAULT FALSE,\n \"received_qty\" REAL,\n \"unit\" TEXT DEFAULT '',\n \"source_type\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"attributes\" TEXT,\n \"status\" TEXT DEFAULT 'active',\n \"received_at\" TIMESTAMP,\n \"received_by_profile_id\" UUID,\n \"last_used_at\" TIMESTAMP\n);",
2103
+ "columns": {
2104
+ "id": {
2105
+ "type": "UUID",
2106
+ "primaryKey": true,
2107
+ "referenceKind": "id",
2108
+ "notNull": true
2109
+ },
2110
+ "slug": {
2111
+ "type": "TEXT",
2112
+ "notNull": true
2113
+ },
2114
+ "context": {
2115
+ "type": "TEXT",
2116
+ "notNull": true,
2117
+ "default": ""
2118
+ },
2119
+ "created_at": {
2120
+ "type": "TIMESTAMP",
2121
+ "notNull": true,
2122
+ "default": "current_timestamp"
2123
+ },
2124
+ "updated_at": {
2125
+ "type": "TIMESTAMP",
2126
+ "notNull": true,
2127
+ "default": "current_timestamp"
2128
+ },
2129
+ "tenant_id": {
2130
+ "type": "UUID",
2131
+ "referenceKind": "tenantId",
2132
+ "notNull": false,
2133
+ "unique": false
2134
+ },
2135
+ "sku_id": {
2136
+ "type": "TEXT",
2137
+ "notNull": false,
2138
+ "unique": false
2139
+ },
2140
+ "kind": {
2141
+ "type": "TEXT",
2142
+ "notNull": false,
2143
+ "unique": false,
2144
+ "default": "lot"
2145
+ },
2146
+ "lot_number": {
2147
+ "type": "TEXT",
2148
+ "notNull": true,
2149
+ "unique": false,
2150
+ "default": ""
2151
+ },
2152
+ "search_key": {
2153
+ "type": "TEXT",
2154
+ "notNull": false,
2155
+ "unique": false,
2156
+ "default": ""
2157
+ },
2158
+ "identity_key": {
2159
+ "type": "TEXT",
2160
+ "notNull": true,
2161
+ "unique": false,
2162
+ "default": ""
2163
+ },
2164
+ "unique_number": {
2165
+ "type": "BOOLEAN",
2166
+ "notNull": false,
2167
+ "unique": false,
2168
+ "default": false
2169
+ },
2170
+ "received_qty": {
2171
+ "type": "REAL",
2172
+ "notNull": false,
2173
+ "unique": false
2174
+ },
2175
+ "unit": {
2176
+ "type": "TEXT",
2177
+ "notNull": false,
2178
+ "unique": false,
2179
+ "default": ""
2180
+ },
2181
+ "source_type": {
2182
+ "type": "TEXT",
2183
+ "notNull": false,
2184
+ "unique": false,
2185
+ "default": ""
2186
+ },
2187
+ "source_id": {
2188
+ "type": "TEXT",
2189
+ "notNull": false,
2190
+ "unique": false,
2191
+ "default": ""
2192
+ },
2193
+ "attributes": {
2194
+ "type": "TEXT",
2195
+ "notNull": false,
2196
+ "unique": false
2197
+ },
2198
+ "status": {
2199
+ "type": "TEXT",
2200
+ "notNull": false,
2201
+ "unique": false,
2202
+ "default": "active"
2203
+ },
2204
+ "received_at": {
2205
+ "type": "TIMESTAMP",
2206
+ "notNull": false,
2207
+ "unique": false
2208
+ },
2209
+ "received_by_profile_id": {
2210
+ "type": "UUID",
2211
+ "referenceKind": "crossPackageRef",
2212
+ "notNull": false,
2213
+ "unique": false
2214
+ },
2215
+ "last_used_at": {
2216
+ "type": "TIMESTAMP",
2217
+ "notNull": false,
2218
+ "unique": false
2219
+ }
2220
+ },
2221
+ "indexes": [
2222
+ {
2223
+ "name": "inventory_lots_identity_key_tenant_id_idx",
2224
+ "columns": [
2225
+ "identity_key",
2226
+ "tenant_id"
2227
+ ],
2228
+ "unique": true,
2229
+ "nullsNotDistinct": true
2230
+ },
2231
+ {
2232
+ "name": "inventory_lots_slug_context_idx",
2233
+ "columns": [
2234
+ "slug",
2235
+ "context"
2236
+ ]
2237
+ },
2238
+ {
2239
+ "name": "inventory_lots_search_key_idx",
2240
+ "columns": [
2241
+ "tenant_id",
2242
+ "search_key"
2243
+ ]
2244
+ },
2245
+ {
2246
+ "name": "inventory_lots_tenant_id_created_at_idx",
2247
+ "columns": [
2248
+ "tenant_id",
2249
+ "created_at"
2250
+ ]
2251
+ },
2252
+ {
2253
+ "name": "inventory_lots_received_by_profile_id_idx",
2254
+ "columns": [
2255
+ "received_by_profile_id"
2256
+ ]
2257
+ }
2258
+ ],
2259
+ "version": "eb959677"
2260
+ },
2261
+ "importPath": "@happyvertical/smrt-inventory"
2262
+ },
2263
+ "@happyvertical/smrt-inventory:LotCorrection": {
2264
+ "name": "lotcorrection",
2265
+ "className": "LotCorrection",
2266
+ "qualifiedName": "@happyvertical/smrt-inventory:LotCorrection",
2267
+ "collection": "lotcorrections",
2268
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/models/LotCorrection.ts",
2269
+ "packageName": "@happyvertical/smrt-inventory",
2270
+ "fields": {
2271
+ "tenantId": {
2272
+ "type": "text",
2273
+ "required": false,
2274
+ "_meta": {
2275
+ "sqlType": "UUID",
2276
+ "nullable": true,
2277
+ "__tenancy": {
2278
+ "isTenantIdField": true,
2279
+ "autoFilter": true,
2280
+ "required": false,
2281
+ "autoPopulate": true,
2282
+ "nullable": true,
2283
+ "mode": "optional",
2284
+ "field": "tenantId",
2285
+ "allowSuperAdminBypass": false
2286
+ }
2287
+ }
2288
+ },
2289
+ "lotId": {
2290
+ "type": "foreignKey",
2291
+ "required": true,
2292
+ "related": "Lot",
2293
+ "_meta": {
2294
+ "required": true,
2295
+ "constraint": {
2296
+ "engines": [
2297
+ "postgres",
2298
+ "sqlite"
2299
+ ]
2300
+ },
2301
+ "onDelete": "RESTRICT",
2302
+ "onUpdate": "RESTRICT"
2303
+ }
2304
+ },
2305
+ "kind": {
2306
+ "type": "text",
2307
+ "required": true,
2308
+ "default": "attribute",
2309
+ "description": "What was corrected.",
2310
+ "_meta": {
2311
+ "required": true,
2312
+ "description": "What was corrected."
2313
+ },
2314
+ "enum": [
2315
+ "lot_number",
2316
+ "attribute",
2317
+ "status",
2318
+ "unlink",
2319
+ "document_detach"
2320
+ ]
2321
+ },
2322
+ "field": {
2323
+ "type": "text",
2324
+ "required": false,
2325
+ "default": "",
2326
+ "description": "Which attribute changed, if one did.",
2327
+ "_meta": {
2328
+ "description": "Which attribute changed, if one did."
2329
+ }
2330
+ },
2331
+ "oldValue": {
2332
+ "type": "text",
2333
+ "required": false,
2334
+ "description": "What it was.",
2335
+ "_meta": {
2336
+ "description": "What it was."
2337
+ }
2338
+ },
2339
+ "newValue": {
2340
+ "type": "text",
2341
+ "required": false,
2342
+ "description": "What it is now.",
2343
+ "_meta": {
2344
+ "description": "What it is now."
2345
+ }
2346
+ },
2347
+ "reason": {
2348
+ "type": "text",
2349
+ "required": true,
2350
+ "description": "Why it was corrected.",
2351
+ "maxLength": 1000,
2352
+ "_meta": {
2353
+ "required": true,
2354
+ "maxLength": 1000,
2355
+ "description": "Why it was corrected."
2356
+ }
2357
+ },
2358
+ "usageId": {
2359
+ "type": "text",
2360
+ "required": false,
2361
+ "_meta": {
2362
+ "nullable": true
2363
+ }
2364
+ },
2365
+ "documentId": {
2366
+ "type": "text",
2367
+ "required": false,
2368
+ "_meta": {
2369
+ "nullable": true
2370
+ }
2371
+ },
2372
+ "actorProfileId": {
2373
+ "type": "crossPackageRef",
2374
+ "required": false,
2375
+ "related": "@happyvertical/smrt-profiles:Profile"
2376
+ },
2377
+ "correctedAt": {
2378
+ "type": "datetime",
2379
+ "required": false,
2380
+ "description": "When it was corrected.",
2381
+ "_meta": {
2382
+ "description": "When it was corrected."
2383
+ }
2384
+ }
2385
+ },
2386
+ "methods": {},
2387
+ "decoratorConfig": {
2388
+ "tableName": "inventory_lot_corrections",
2389
+ "conflictColumns": [
2390
+ "id"
2391
+ ],
2392
+ "api": {
2393
+ "include": [
2394
+ "list",
2395
+ "get"
2396
+ ]
2397
+ },
2398
+ "mcp": {
2399
+ "include": [
2400
+ "list",
2401
+ "get"
2402
+ ]
2403
+ },
2404
+ "cli": {
2405
+ "include": [
2406
+ "list",
2407
+ "get"
2408
+ ]
2409
+ },
2410
+ "indexes": [
2411
+ {
2412
+ "name": "inventory_lot_corrections_lot_idx",
2413
+ "columns": [
2414
+ "lotId"
2415
+ ]
2416
+ }
2417
+ ],
2418
+ "tenantScoped": {
2419
+ "mode": "optional"
2420
+ }
2421
+ },
2422
+ "extends": "SmrtObject",
2423
+ "exportName": "LotCorrection",
2424
+ "collectionExportName": "LotCorrectionCollection",
2425
+ "validationRules": [
2426
+ {
2427
+ "field": "lotId",
2428
+ "rule": "required",
2429
+ "fieldType": "foreignKey"
2430
+ },
2431
+ {
2432
+ "field": "kind",
2433
+ "rule": "required",
2434
+ "fieldType": "text"
2435
+ },
2436
+ {
2437
+ "field": "reason",
2438
+ "rule": "required",
2439
+ "fieldType": "text"
2440
+ },
2441
+ {
2442
+ "field": "reason",
2443
+ "rule": "maxLength",
2444
+ "value": 1000,
2445
+ "fieldType": "text"
2446
+ }
2447
+ ],
2448
+ "schema": {
2449
+ "tableName": "inventory_lot_corrections",
2450
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_lot_corrections\" (\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 \"lot_id\" UUID NOT NULL,\n \"kind\" TEXT NOT NULL DEFAULT 'attribute',\n \"field\" TEXT DEFAULT '',\n \"old_value\" TEXT,\n \"new_value\" TEXT,\n \"reason\" TEXT NOT NULL,\n \"usage_id\" TEXT,\n \"document_id\" TEXT,\n \"actor_profile_id\" UUID,\n \"corrected_at\" TIMESTAMP\n);",
2451
+ "columns": {
2452
+ "id": {
2453
+ "type": "UUID",
2454
+ "primaryKey": true,
2455
+ "referenceKind": "id",
2456
+ "notNull": true
2457
+ },
2458
+ "slug": {
2459
+ "type": "TEXT",
2460
+ "notNull": true
2461
+ },
2462
+ "context": {
2463
+ "type": "TEXT",
2464
+ "notNull": true,
2465
+ "default": ""
2466
+ },
2467
+ "created_at": {
2468
+ "type": "TIMESTAMP",
2469
+ "notNull": true,
2470
+ "default": "current_timestamp"
2471
+ },
2472
+ "updated_at": {
2473
+ "type": "TIMESTAMP",
2474
+ "notNull": true,
2475
+ "default": "current_timestamp"
2476
+ },
2477
+ "tenant_id": {
2478
+ "type": "UUID",
2479
+ "referenceKind": "tenantId",
2480
+ "notNull": false,
2481
+ "unique": false
2482
+ },
2483
+ "lot_id": {
2484
+ "type": "UUID",
2485
+ "referenceKind": "foreignKey",
2486
+ "notNull": true,
2487
+ "unique": false,
2488
+ "foreignKey": {
2489
+ "table": "inventory_lots",
2490
+ "column": "id",
2491
+ "onDelete": "RESTRICT",
2492
+ "onUpdate": "RESTRICT",
2493
+ "engines": [
2494
+ "postgres",
2495
+ "sqlite"
2496
+ ]
2497
+ }
2498
+ },
2499
+ "kind": {
2500
+ "type": "TEXT",
2501
+ "notNull": true,
2502
+ "unique": false,
2503
+ "default": "attribute"
2504
+ },
2505
+ "field": {
2506
+ "type": "TEXT",
2507
+ "notNull": false,
2508
+ "unique": false,
2509
+ "default": ""
2510
+ },
2511
+ "old_value": {
2512
+ "type": "TEXT",
2513
+ "notNull": false,
2514
+ "unique": false
2515
+ },
2516
+ "new_value": {
2517
+ "type": "TEXT",
2518
+ "notNull": false,
2519
+ "unique": false
2520
+ },
2521
+ "reason": {
2522
+ "type": "TEXT",
2523
+ "notNull": true,
2524
+ "unique": false
2525
+ },
2526
+ "usage_id": {
2527
+ "type": "TEXT",
2528
+ "notNull": false,
2529
+ "unique": false
2530
+ },
2531
+ "document_id": {
2532
+ "type": "TEXT",
2533
+ "notNull": false,
2534
+ "unique": false
2535
+ },
2536
+ "actor_profile_id": {
2537
+ "type": "UUID",
2538
+ "referenceKind": "crossPackageRef",
2539
+ "notNull": false,
2540
+ "unique": false
2541
+ },
2542
+ "corrected_at": {
2543
+ "type": "TIMESTAMP",
2544
+ "notNull": false,
2545
+ "unique": false
2546
+ }
2547
+ },
2548
+ "indexes": [
2549
+ {
2550
+ "name": "inventory_lot_corrections_slug_context_idx",
2551
+ "columns": [
2552
+ "slug",
2553
+ "context"
2554
+ ]
2555
+ },
2556
+ {
2557
+ "name": "inventory_lot_corrections_lot_idx",
2558
+ "columns": [
2559
+ "lot_id"
2560
+ ]
2561
+ },
2562
+ {
2563
+ "name": "inventory_lot_corrections_tenant_id_created_at_idx",
2564
+ "columns": [
2565
+ "tenant_id",
2566
+ "created_at"
2567
+ ]
2568
+ },
2569
+ {
2570
+ "name": "inventory_lot_corrections_actor_profile_id_idx",
2571
+ "columns": [
2572
+ "actor_profile_id"
2573
+ ]
2574
+ }
2575
+ ],
2576
+ "version": "d903252e"
2577
+ },
2578
+ "importPath": "@happyvertical/smrt-inventory"
2579
+ },
2580
+ "@happyvertical/smrt-inventory:LotDocument": {
2581
+ "name": "lotdocument",
2582
+ "className": "LotDocument",
2583
+ "qualifiedName": "@happyvertical/smrt-inventory:LotDocument",
2584
+ "collection": "lotdocuments",
2585
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/models/LotDocument.ts",
2586
+ "packageName": "@happyvertical/smrt-inventory",
2587
+ "fields": {
2588
+ "tenantId": {
2589
+ "type": "text",
2590
+ "required": false,
2591
+ "_meta": {
2592
+ "sqlType": "UUID",
2593
+ "nullable": true,
2594
+ "__tenancy": {
2595
+ "isTenantIdField": true,
2596
+ "autoFilter": true,
2597
+ "required": false,
2598
+ "autoPopulate": true,
2599
+ "nullable": true,
2600
+ "mode": "optional",
2601
+ "field": "tenantId",
2602
+ "allowSuperAdminBypass": false
2603
+ }
2604
+ }
2605
+ },
2606
+ "lotId": {
2607
+ "type": "foreignKey",
2608
+ "required": true,
2609
+ "related": "Lot",
2610
+ "_meta": {
2611
+ "required": true,
2612
+ "constraint": {
2613
+ "engines": [
2614
+ "postgres",
2615
+ "sqlite"
2616
+ ]
2617
+ },
2618
+ "onDelete": "RESTRICT",
2619
+ "onUpdate": "RESTRICT"
2620
+ }
2621
+ },
2622
+ "assetId": {
2623
+ "type": "crossPackageRef",
2624
+ "required": false,
2625
+ "related": "@happyvertical/smrt-assets:Asset"
2626
+ },
2627
+ "role": {
2628
+ "type": "text",
2629
+ "required": false,
2630
+ "default": "certificate",
2631
+ "description": "What the document is for, for example certificate.",
2632
+ "_meta": {
2633
+ "description": "What the document is for, for example certificate."
2634
+ }
2635
+ },
2636
+ "attachedAt": {
2637
+ "type": "datetime",
2638
+ "required": false,
2639
+ "description": "When it was attached.",
2640
+ "_meta": {
2641
+ "description": "When it was attached."
2642
+ }
2643
+ },
2644
+ "attachedByProfileId": {
2645
+ "type": "crossPackageRef",
2646
+ "required": false,
2647
+ "related": "@happyvertical/smrt-profiles:Profile"
2648
+ },
2649
+ "detachedAt": {
2650
+ "type": "datetime",
2651
+ "required": false,
2652
+ "_meta": {
2653
+ "nullable": true
2654
+ }
2655
+ },
2656
+ "detachedByProfileId": {
2657
+ "type": "crossPackageRef",
2658
+ "required": false,
2659
+ "related": "@happyvertical/smrt-profiles:Profile"
2660
+ }
2661
+ },
2662
+ "methods": {},
2663
+ "decoratorConfig": {
2664
+ "tableName": "inventory_lot_documents",
2665
+ "api": {
2666
+ "include": [
2667
+ "list",
2668
+ "get"
2669
+ ]
2670
+ },
2671
+ "mcp": {
2672
+ "include": [
2673
+ "list",
2674
+ "get"
2675
+ ]
2676
+ },
2677
+ "cli": {
2678
+ "include": [
2679
+ "list",
2680
+ "get"
2681
+ ]
2682
+ },
2683
+ "indexes": [
2684
+ {
2685
+ "name": "inventory_lot_documents_lot_idx",
2686
+ "columns": [
2687
+ "lotId"
2688
+ ]
2689
+ }
2690
+ ],
2691
+ "tenantScoped": {
2692
+ "mode": "optional"
2693
+ },
2694
+ "conflictColumns": [
2695
+ "tenant_id",
2696
+ "slug",
2697
+ "context"
2698
+ ]
2699
+ },
2700
+ "extends": "SmrtObject",
2701
+ "exportName": "LotDocument",
2702
+ "collectionExportName": "LotDocumentCollection",
2703
+ "validationRules": [
2704
+ {
2705
+ "field": "lotId",
2706
+ "rule": "required",
2707
+ "fieldType": "foreignKey"
2708
+ }
2709
+ ],
2710
+ "schema": {
2711
+ "tableName": "inventory_lot_documents",
2712
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_lot_documents\" (\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 \"lot_id\" UUID NOT NULL,\n \"asset_id\" UUID,\n \"role\" TEXT DEFAULT 'certificate',\n \"attached_at\" TIMESTAMP,\n \"attached_by_profile_id\" UUID,\n \"detached_at\" TIMESTAMP,\n \"detached_by_profile_id\" UUID\n);",
2713
+ "columns": {
2714
+ "id": {
2715
+ "type": "UUID",
2716
+ "primaryKey": true,
2717
+ "referenceKind": "id",
2718
+ "notNull": true
2719
+ },
2720
+ "slug": {
2721
+ "type": "TEXT",
2722
+ "notNull": true
2723
+ },
2724
+ "context": {
2725
+ "type": "TEXT",
2726
+ "notNull": true,
2727
+ "default": ""
2728
+ },
2729
+ "created_at": {
2730
+ "type": "TIMESTAMP",
2731
+ "notNull": true,
2732
+ "default": "current_timestamp"
2733
+ },
2734
+ "updated_at": {
2735
+ "type": "TIMESTAMP",
2736
+ "notNull": true,
2737
+ "default": "current_timestamp"
2738
+ },
2739
+ "tenant_id": {
2740
+ "type": "UUID",
2741
+ "referenceKind": "tenantId",
2742
+ "notNull": false,
2743
+ "unique": false
2744
+ },
2745
+ "lot_id": {
2746
+ "type": "UUID",
2747
+ "referenceKind": "foreignKey",
2748
+ "notNull": true,
2749
+ "unique": false,
2750
+ "foreignKey": {
2751
+ "table": "inventory_lots",
2752
+ "column": "id",
2753
+ "onDelete": "RESTRICT",
2754
+ "onUpdate": "RESTRICT",
2755
+ "engines": [
2756
+ "postgres",
2757
+ "sqlite"
2758
+ ]
2759
+ }
2760
+ },
2761
+ "asset_id": {
2762
+ "type": "UUID",
2763
+ "referenceKind": "crossPackageRef",
2764
+ "notNull": false,
2765
+ "unique": false
2766
+ },
2767
+ "role": {
2768
+ "type": "TEXT",
2769
+ "notNull": false,
2770
+ "unique": false,
2771
+ "default": "certificate"
2772
+ },
2773
+ "attached_at": {
2774
+ "type": "TIMESTAMP",
2775
+ "notNull": false,
2776
+ "unique": false
2777
+ },
2778
+ "attached_by_profile_id": {
2779
+ "type": "UUID",
2780
+ "referenceKind": "crossPackageRef",
2781
+ "notNull": false,
2782
+ "unique": false
2783
+ },
2784
+ "detached_at": {
2785
+ "type": "TIMESTAMP",
2786
+ "notNull": false,
2787
+ "unique": false
2788
+ },
2789
+ "detached_by_profile_id": {
2790
+ "type": "UUID",
2791
+ "referenceKind": "crossPackageRef",
2792
+ "notNull": false,
2793
+ "unique": false
2794
+ }
2795
+ },
2796
+ "indexes": [
2797
+ {
2798
+ "name": "inventory_lot_documents_slug_context_idx",
2799
+ "columns": [
2800
+ "tenant_id",
2801
+ "slug",
2802
+ "context"
2803
+ ],
2804
+ "unique": true,
2805
+ "nullsNotDistinct": true
2806
+ },
2807
+ {
2808
+ "name": "inventory_lot_documents_lot_idx",
2809
+ "columns": [
2810
+ "lot_id"
2811
+ ]
2812
+ },
2813
+ {
2814
+ "name": "inventory_lot_documents_tenant_id_created_at_idx",
2815
+ "columns": [
2816
+ "tenant_id",
2817
+ "created_at"
2818
+ ]
2819
+ },
2820
+ {
2821
+ "name": "inventory_lot_documents_asset_id_idx",
2822
+ "columns": [
2823
+ "asset_id"
2824
+ ]
2825
+ },
2826
+ {
2827
+ "name": "inventory_lot_documents_attached_by_profile_id_idx",
2828
+ "columns": [
2829
+ "attached_by_profile_id"
2830
+ ]
2831
+ },
2832
+ {
2833
+ "name": "inventory_lot_documents_detached_by_profile_id_idx",
2834
+ "columns": [
2835
+ "detached_by_profile_id"
2836
+ ]
2837
+ }
2838
+ ],
2839
+ "version": "076940be"
2840
+ },
2841
+ "importPath": "@happyvertical/smrt-inventory"
2842
+ },
2843
+ "@happyvertical/smrt-inventory:LotStockLevel": {
2844
+ "name": "lotstocklevel",
2845
+ "className": "LotStockLevel",
2846
+ "qualifiedName": "@happyvertical/smrt-inventory:LotStockLevel",
2847
+ "collection": "lotstocklevels",
2848
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/models/LotStockLevel.ts",
2849
+ "packageName": "@happyvertical/smrt-inventory",
2850
+ "fields": {
2851
+ "tenantId": {
2852
+ "type": "text",
2853
+ "required": false,
2854
+ "_meta": {
2855
+ "sqlType": "UUID",
2856
+ "nullable": true,
2857
+ "__tenancy": {
2858
+ "isTenantIdField": true,
2859
+ "autoFilter": true,
2860
+ "required": false,
2861
+ "autoPopulate": true,
2862
+ "nullable": true,
2863
+ "mode": "optional",
2864
+ "field": "tenantId",
2865
+ "allowSuperAdminBypass": false
2866
+ }
2867
+ }
2868
+ },
2869
+ "lotId": {
2870
+ "type": "foreignKey",
2871
+ "required": true,
2872
+ "related": "Lot",
2873
+ "_meta": {
2874
+ "required": true,
2875
+ "constraint": {
2876
+ "engines": [
2877
+ "postgres",
2878
+ "sqlite"
2879
+ ]
2880
+ },
2881
+ "onDelete": "RESTRICT",
2882
+ "onUpdate": "RESTRICT"
2883
+ }
2884
+ },
2885
+ "skuId": {
2886
+ "type": "text",
2887
+ "required": false,
2888
+ "default": "",
2889
+ "description": "The item the lot is of.",
2890
+ "_meta": {
2891
+ "description": "The item the lot is of."
2892
+ }
2893
+ },
2894
+ "locationId": {
2895
+ "type": "text",
2896
+ "required": true,
2897
+ "default": "",
2898
+ "description": "Where the lot is kept.",
2899
+ "_meta": {
2900
+ "required": true,
2901
+ "description": "Where the lot is kept."
2902
+ }
2903
+ },
2904
+ "state": {
2905
+ "type": "text",
2906
+ "required": true,
2907
+ "default": "available",
2908
+ "description": "The state of this stock: available, allocated, wip, qc_hold or damaged.",
2909
+ "_meta": {
2910
+ "required": true,
2911
+ "description": "The state of this stock: available, allocated, wip, qc_hold or damaged."
2912
+ },
2913
+ "enum": [
2914
+ "available",
2915
+ "allocated",
2916
+ "wip",
2917
+ "qc_hold",
2918
+ "damaged"
2919
+ ]
2920
+ },
2921
+ "qty": {
2922
+ "type": "decimal",
2923
+ "required": false,
2924
+ "description": "How many are on hand.",
2925
+ "_meta": {
2926
+ "description": "How many are on hand."
2927
+ }
2928
+ }
2929
+ },
2930
+ "methods": {},
2931
+ "decoratorConfig": {
2932
+ "tableName": "inventory_lot_stock_levels",
2933
+ "conflictColumns": [
2934
+ "lot_id",
2935
+ "location_id",
2936
+ "state",
2937
+ "tenant_id"
2938
+ ],
2939
+ "api": {
2940
+ "include": [
2941
+ "list",
2942
+ "get"
2943
+ ]
2944
+ },
2945
+ "mcp": {
2946
+ "include": [
2947
+ "list",
2948
+ "get"
2949
+ ]
2950
+ },
2951
+ "cli": {
2952
+ "include": [
2953
+ "list",
2954
+ "get"
2955
+ ]
2956
+ },
2957
+ "tenantScoped": {
2958
+ "mode": "optional"
2959
+ }
2960
+ },
2961
+ "extends": "SmrtObject",
2962
+ "exportName": "LotStockLevel",
2963
+ "collectionExportName": "LotStockLevelCollection",
2964
+ "validationRules": [
2965
+ {
2966
+ "field": "lotId",
2967
+ "rule": "required",
2968
+ "fieldType": "foreignKey"
2969
+ },
2970
+ {
2971
+ "field": "locationId",
2972
+ "rule": "required",
2973
+ "fieldType": "text"
2974
+ },
2975
+ {
2976
+ "field": "state",
2977
+ "rule": "required",
2978
+ "fieldType": "text"
2979
+ }
2980
+ ],
2981
+ "schema": {
2982
+ "tableName": "inventory_lot_stock_levels",
2983
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_lot_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 \"lot_id\" UUID NOT NULL,\n \"sku_id\" TEXT DEFAULT '',\n \"location_id\" TEXT NOT NULL DEFAULT '',\n \"state\" TEXT NOT NULL DEFAULT 'available',\n \"qty\" REAL\n);",
2984
+ "columns": {
2985
+ "id": {
2986
+ "type": "UUID",
2987
+ "primaryKey": true,
2988
+ "referenceKind": "id",
2989
+ "notNull": true
2990
+ },
2991
+ "slug": {
2992
+ "type": "TEXT",
2993
+ "notNull": true
2994
+ },
2995
+ "context": {
2996
+ "type": "TEXT",
2997
+ "notNull": true,
2998
+ "default": ""
2999
+ },
3000
+ "created_at": {
3001
+ "type": "TIMESTAMP",
3002
+ "notNull": true,
3003
+ "default": "current_timestamp"
581
3004
  },
582
- "qty": {
583
- "type": "REAL",
3005
+ "updated_at": {
3006
+ "type": "TIMESTAMP",
3007
+ "notNull": true,
3008
+ "default": "current_timestamp"
3009
+ },
3010
+ "tenant_id": {
3011
+ "type": "UUID",
3012
+ "referenceKind": "tenantId",
584
3013
  "notNull": false,
585
3014
  "unique": false
586
3015
  },
587
- "reason_code": {
588
- "type": "TEXT",
3016
+ "lot_id": {
3017
+ "type": "UUID",
3018
+ "referenceKind": "foreignKey",
589
3019
  "notNull": true,
590
3020
  "unique": false,
591
- "default": "adjustment"
3021
+ "foreignKey": {
3022
+ "table": "inventory_lots",
3023
+ "column": "id",
3024
+ "onDelete": "RESTRICT",
3025
+ "onUpdate": "RESTRICT",
3026
+ "engines": [
3027
+ "postgres",
3028
+ "sqlite"
3029
+ ]
3030
+ }
592
3031
  },
593
- "source_type": {
3032
+ "sku_id": {
594
3033
  "type": "TEXT",
595
3034
  "notNull": false,
596
3035
  "unique": false,
597
3036
  "default": ""
598
3037
  },
599
- "source_id": {
3038
+ "location_id": {
600
3039
  "type": "TEXT",
601
- "notNull": false,
3040
+ "notNull": true,
602
3041
  "unique": false,
603
3042
  "default": ""
604
3043
  },
605
- "actor_profile_id": {
606
- "type": "UUID",
607
- "referenceKind": "crossPackageRef",
608
- "notNull": false,
609
- "unique": false
610
- },
611
- "note": {
3044
+ "state": {
612
3045
  "type": "TEXT",
613
- "notNull": false,
3046
+ "notNull": true,
614
3047
  "unique": false,
615
- "default": ""
3048
+ "default": "available"
616
3049
  },
617
- "occurred_at": {
618
- "type": "TIMESTAMP",
3050
+ "qty": {
3051
+ "type": "REAL",
619
3052
  "notNull": false,
620
3053
  "unique": false
621
3054
  }
622
3055
  },
623
3056
  "indexes": [
624
3057
  {
625
- "name": "inventory_stock_movements_slug_context_idx",
3058
+ "name": "inventory_lot_stock_levels_lot_id_location_id_idx",
3059
+ "columns": [
3060
+ "lot_id",
3061
+ "location_id",
3062
+ "state",
3063
+ "tenant_id"
3064
+ ],
3065
+ "unique": true,
3066
+ "nullsNotDistinct": true
3067
+ },
3068
+ {
3069
+ "name": "inventory_lot_stock_levels_slug_context_idx",
626
3070
  "columns": [
627
3071
  "slug",
628
3072
  "context"
629
3073
  ]
630
3074
  },
631
3075
  {
632
- "name": "inventory_stock_movements_tenant_id_created_at_idx",
3076
+ "name": "inventory_lot_stock_levels_tenant_id_created_at_idx",
633
3077
  "columns": [
634
3078
  "tenant_id",
635
3079
  "created_at"
636
3080
  ]
637
- },
638
- {
639
- "name": "inventory_stock_movements_actor_profile_id_idx",
640
- "columns": [
641
- "actor_profile_id"
642
- ]
643
3081
  }
644
3082
  ],
645
- "version": "eff1027e"
3083
+ "version": "6f6becfa"
646
3084
  },
647
3085
  "importPath": "@happyvertical/smrt-inventory"
648
3086
  },
649
- "@happyvertical/smrt-inventory:InventoryLocation": {
650
- "name": "inventorylocation",
651
- "className": "InventoryLocation",
652
- "qualifiedName": "@happyvertical/smrt-inventory:InventoryLocation",
653
- "collection": "inventorylocations",
654
- "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/models/InventoryLocation.ts",
3087
+ "@happyvertical/smrt-inventory:LotUsage": {
3088
+ "name": "lotusage",
3089
+ "className": "LotUsage",
3090
+ "qualifiedName": "@happyvertical/smrt-inventory:LotUsage",
3091
+ "collection": "lotusages",
3092
+ "filePath": "/home/runner/work/smrt/smrt/packages/inventory/src/models/LotUsage.ts",
655
3093
  "packageName": "@happyvertical/smrt-inventory",
656
3094
  "fields": {
657
3095
  "tenantId": {
@@ -672,58 +3110,123 @@
672
3110
  }
673
3111
  }
674
3112
  },
675
- "code": {
3113
+ "lotId": {
3114
+ "type": "foreignKey",
3115
+ "required": true,
3116
+ "related": "Lot",
3117
+ "_meta": {
3118
+ "required": true,
3119
+ "constraint": {
3120
+ "engines": [
3121
+ "postgres",
3122
+ "sqlite"
3123
+ ]
3124
+ },
3125
+ "onDelete": "RESTRICT",
3126
+ "onUpdate": "RESTRICT"
3127
+ }
3128
+ },
3129
+ "consumerType": {
676
3130
  "type": "text",
677
3131
  "required": true,
678
3132
  "default": "",
679
- "description": "A short code for the place stock is kept, for example MAIN.",
3133
+ "description": "What kind of record used the lot.",
680
3134
  "_meta": {
681
3135
  "required": true,
682
- "description": "A short code for the place stock is kept, for example MAIN."
3136
+ "description": "What kind of record used the lot."
683
3137
  }
684
3138
  },
685
- "name": {
3139
+ "consumerId": {
3140
+ "type": "text",
3141
+ "required": true,
3142
+ "default": "",
3143
+ "description": "The record that used the lot.",
3144
+ "_meta": {
3145
+ "required": true,
3146
+ "description": "The record that used the lot."
3147
+ }
3148
+ },
3149
+ "qty": {
3150
+ "type": "decimal",
3151
+ "required": false,
3152
+ "description": "How much was used.",
3153
+ "_meta": {
3154
+ "nullable": true,
3155
+ "description": "How much was used."
3156
+ }
3157
+ },
3158
+ "unit": {
686
3159
  "type": "text",
687
3160
  "required": false,
688
3161
  "default": "",
689
- "description": "What you call the place, for example Main warehouse.",
3162
+ "description": "The unit of measure.",
690
3163
  "_meta": {
691
- "description": "What you call the place, for example Main warehouse."
3164
+ "description": "The unit of measure."
692
3165
  }
693
3166
  },
694
- "kind": {
3167
+ "status": {
695
3168
  "type": "text",
696
3169
  "required": false,
697
- "default": "warehouse",
698
- "description": "What sort of place it is, for example a warehouse or a shop floor.",
3170
+ "default": "active",
3171
+ "description": "Whether the link still stands: active or unlinked.",
699
3172
  "_meta": {
700
- "description": "What sort of place it is, for example a warehouse or a shop floor."
3173
+ "description": "Whether the link still stands: active or unlinked."
3174
+ },
3175
+ "enum": [
3176
+ "active",
3177
+ "unlinked"
3178
+ ]
3179
+ },
3180
+ "linkedAt": {
3181
+ "type": "datetime",
3182
+ "required": false,
3183
+ "description": "When the lot was linked.",
3184
+ "_meta": {
3185
+ "description": "When the lot was linked."
701
3186
  }
702
3187
  },
703
- "placeId": {
3188
+ "linkedByProfileId": {
3189
+ "type": "crossPackageRef",
3190
+ "required": false,
3191
+ "related": "@happyvertical/smrt-profiles:Profile"
3192
+ },
3193
+ "unlinkedAt": {
3194
+ "type": "datetime",
3195
+ "required": false,
3196
+ "_meta": {
3197
+ "nullable": true
3198
+ }
3199
+ },
3200
+ "unlinkedByProfileId": {
3201
+ "type": "crossPackageRef",
3202
+ "required": false,
3203
+ "related": "@happyvertical/smrt-profiles:Profile"
3204
+ },
3205
+ "unlinkReason": {
704
3206
  "type": "text",
705
3207
  "required": false,
706
- "default": ""
3208
+ "description": "Why the link was removed.",
3209
+ "_meta": {
3210
+ "description": "Why the link was removed."
3211
+ }
707
3212
  },
708
- "active": {
709
- "type": "boolean",
3213
+ "movementId": {
3214
+ "type": "text",
710
3215
  "required": false,
711
- "default": true
3216
+ "description": "The stock movement for this use, if any.",
3217
+ "_meta": {
3218
+ "nullable": true,
3219
+ "description": "The stock movement for this use, if any."
3220
+ }
712
3221
  }
713
3222
  },
714
3223
  "methods": {},
715
3224
  "decoratorConfig": {
716
- "tableName": "inventory_locations",
717
- "conflictColumns": [
718
- "code",
719
- "tenant_id"
720
- ],
3225
+ "tableName": "inventory_lot_usages",
721
3226
  "api": {
722
3227
  "include": [
723
3228
  "list",
724
- "get",
725
- "create",
726
- "update"
3229
+ "get"
727
3230
  ]
728
3231
  },
729
3232
  "mcp": {
@@ -732,25 +3235,60 @@
732
3235
  "get"
733
3236
  ]
734
3237
  },
735
- "cli": true,
3238
+ "cli": {
3239
+ "include": [
3240
+ "list",
3241
+ "get"
3242
+ ]
3243
+ },
3244
+ "indexes": [
3245
+ {
3246
+ "name": "inventory_lot_usages_consumer_idx",
3247
+ "columns": [
3248
+ "consumerType",
3249
+ "consumerId"
3250
+ ]
3251
+ },
3252
+ {
3253
+ "name": "inventory_lot_usages_lot_status_idx",
3254
+ "columns": [
3255
+ "lotId",
3256
+ "status"
3257
+ ]
3258
+ }
3259
+ ],
736
3260
  "tenantScoped": {
737
3261
  "mode": "optional"
738
- }
3262
+ },
3263
+ "conflictColumns": [
3264
+ "tenant_id",
3265
+ "slug",
3266
+ "context"
3267
+ ]
739
3268
  },
740
3269
  "extends": "SmrtObject",
741
- "exportName": "InventoryLocation",
742
- "collectionExportName": "InventoryLocationCollection",
743
- "displayLabelField": "name",
3270
+ "exportName": "LotUsage",
3271
+ "collectionExportName": "LotUsageCollection",
744
3272
  "validationRules": [
745
3273
  {
746
- "field": "code",
3274
+ "field": "lotId",
3275
+ "rule": "required",
3276
+ "fieldType": "foreignKey"
3277
+ },
3278
+ {
3279
+ "field": "consumerType",
3280
+ "rule": "required",
3281
+ "fieldType": "text"
3282
+ },
3283
+ {
3284
+ "field": "consumerId",
747
3285
  "rule": "required",
748
3286
  "fieldType": "text"
749
3287
  }
750
3288
  ],
751
3289
  "schema": {
752
- "tableName": "inventory_locations",
753
- "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);",
3290
+ "tableName": "inventory_lot_usages",
3291
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_lot_usages\" (\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 \"lot_id\" UUID NOT NULL,\n \"consumer_type\" TEXT NOT NULL DEFAULT '',\n \"consumer_id\" TEXT NOT NULL DEFAULT '',\n \"qty\" REAL,\n \"unit\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"linked_at\" TIMESTAMP,\n \"linked_by_profile_id\" UUID,\n \"unlinked_at\" TIMESTAMP,\n \"unlinked_by_profile_id\" UUID,\n \"unlink_reason\" TEXT,\n \"movement_id\" TEXT\n);",
754
3292
  "columns": {
755
3293
  "id": {
756
3294
  "type": "UUID",
@@ -783,63 +3321,130 @@
783
3321
  "notNull": false,
784
3322
  "unique": false
785
3323
  },
786
- "code": {
3324
+ "lot_id": {
3325
+ "type": "UUID",
3326
+ "referenceKind": "foreignKey",
3327
+ "notNull": true,
3328
+ "unique": false,
3329
+ "foreignKey": {
3330
+ "table": "inventory_lots",
3331
+ "column": "id",
3332
+ "onDelete": "RESTRICT",
3333
+ "onUpdate": "RESTRICT",
3334
+ "engines": [
3335
+ "postgres",
3336
+ "sqlite"
3337
+ ]
3338
+ }
3339
+ },
3340
+ "consumer_type": {
787
3341
  "type": "TEXT",
788
3342
  "notNull": true,
789
3343
  "unique": false,
790
3344
  "default": ""
791
3345
  },
792
- "name": {
3346
+ "consumer_id": {
793
3347
  "type": "TEXT",
794
- "notNull": false,
3348
+ "notNull": true,
795
3349
  "unique": false,
796
3350
  "default": ""
797
3351
  },
798
- "kind": {
799
- "type": "TEXT",
3352
+ "qty": {
3353
+ "type": "REAL",
800
3354
  "notNull": false,
801
- "unique": false,
802
- "default": "warehouse"
3355
+ "unique": false
803
3356
  },
804
- "place_id": {
3357
+ "unit": {
805
3358
  "type": "TEXT",
806
3359
  "notNull": false,
807
3360
  "unique": false,
808
3361
  "default": ""
809
3362
  },
810
- "active": {
811
- "type": "BOOLEAN",
3363
+ "status": {
3364
+ "type": "TEXT",
812
3365
  "notNull": false,
813
3366
  "unique": false,
814
- "default": true
3367
+ "default": "active"
3368
+ },
3369
+ "linked_at": {
3370
+ "type": "TIMESTAMP",
3371
+ "notNull": false,
3372
+ "unique": false
3373
+ },
3374
+ "linked_by_profile_id": {
3375
+ "type": "UUID",
3376
+ "referenceKind": "crossPackageRef",
3377
+ "notNull": false,
3378
+ "unique": false
3379
+ },
3380
+ "unlinked_at": {
3381
+ "type": "TIMESTAMP",
3382
+ "notNull": false,
3383
+ "unique": false
3384
+ },
3385
+ "unlinked_by_profile_id": {
3386
+ "type": "UUID",
3387
+ "referenceKind": "crossPackageRef",
3388
+ "notNull": false,
3389
+ "unique": false
3390
+ },
3391
+ "unlink_reason": {
3392
+ "type": "TEXT",
3393
+ "notNull": false,
3394
+ "unique": false
3395
+ },
3396
+ "movement_id": {
3397
+ "type": "TEXT",
3398
+ "notNull": false,
3399
+ "unique": false
815
3400
  }
816
3401
  },
817
3402
  "indexes": [
818
3403
  {
819
- "name": "inventory_locations_code_tenant_id_idx",
3404
+ "name": "inventory_lot_usages_slug_context_idx",
820
3405
  "columns": [
821
- "code",
822
- "tenant_id"
3406
+ "tenant_id",
3407
+ "slug",
3408
+ "context"
823
3409
  ],
824
3410
  "unique": true,
825
3411
  "nullsNotDistinct": true
826
3412
  },
827
3413
  {
828
- "name": "inventory_locations_slug_context_idx",
3414
+ "name": "inventory_lot_usages_consumer_idx",
829
3415
  "columns": [
830
- "slug",
831
- "context"
3416
+ "consumer_type",
3417
+ "consumer_id"
832
3418
  ]
833
3419
  },
834
3420
  {
835
- "name": "inventory_locations_tenant_id_created_at_idx",
3421
+ "name": "inventory_lot_usages_lot_status_idx",
3422
+ "columns": [
3423
+ "lot_id",
3424
+ "status"
3425
+ ]
3426
+ },
3427
+ {
3428
+ "name": "inventory_lot_usages_tenant_id_created_at_idx",
836
3429
  "columns": [
837
3430
  "tenant_id",
838
3431
  "created_at"
839
3432
  ]
3433
+ },
3434
+ {
3435
+ "name": "inventory_lot_usages_linked_by_profile_id_idx",
3436
+ "columns": [
3437
+ "linked_by_profile_id"
3438
+ ]
3439
+ },
3440
+ {
3441
+ "name": "inventory_lot_usages_unlinked_by_profile_id_idx",
3442
+ "columns": [
3443
+ "unlinked_by_profile_id"
3444
+ ]
840
3445
  }
841
3446
  ],
842
- "version": "401c28a1"
3447
+ "version": "c106a419"
843
3448
  },
844
3449
  "importPath": "@happyvertical/smrt-inventory"
845
3450
  },
@@ -1126,6 +3731,15 @@
1126
3731
  "description": "The place it moved at."
1127
3732
  }
1128
3733
  },
3734
+ "lotId": {
3735
+ "type": "text",
3736
+ "required": false,
3737
+ "description": "The lot that moved, when tracked by lot.",
3738
+ "_meta": {
3739
+ "nullable": true,
3740
+ "description": "The lot that moved, when tracked by lot."
3741
+ }
3742
+ },
1129
3743
  "fromState": {
1130
3744
  "type": "text",
1131
3745
  "required": false,
@@ -1231,6 +3845,14 @@
1231
3845
  "get"
1232
3846
  ]
1233
3847
  },
3848
+ "indexes": [
3849
+ {
3850
+ "name": "inventory_stock_movements_lot_idx",
3851
+ "columns": [
3852
+ "lotId"
3853
+ ]
3854
+ }
3855
+ ],
1234
3856
  "tenantScoped": {
1235
3857
  "mode": "optional"
1236
3858
  }
@@ -1257,7 +3879,7 @@
1257
3879
  ],
1258
3880
  "schema": {
1259
3881
  "tableName": "inventory_stock_movements",
1260
- "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 \"actor_profile_id\" UUID,\n \"note\" TEXT DEFAULT '',\n \"occurred_at\" TIMESTAMP\n);",
3882
+ "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 \"lot_id\" TEXT,\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 \"actor_profile_id\" UUID,\n \"note\" TEXT DEFAULT '',\n \"occurred_at\" TIMESTAMP\n);",
1261
3883
  "columns": {
1262
3884
  "id": {
1263
3885
  "type": "UUID",
@@ -1302,6 +3924,11 @@
1302
3924
  "unique": false,
1303
3925
  "default": ""
1304
3926
  },
3927
+ "lot_id": {
3928
+ "type": "TEXT",
3929
+ "notNull": false,
3930
+ "unique": false
3931
+ },
1305
3932
  "from_state": {
1306
3933
  "type": "TEXT",
1307
3934
  "notNull": false,
@@ -1361,6 +3988,12 @@
1361
3988
  "context"
1362
3989
  ]
1363
3990
  },
3991
+ {
3992
+ "name": "inventory_stock_movements_lot_idx",
3993
+ "columns": [
3994
+ "lot_id"
3995
+ ]
3996
+ },
1364
3997
  {
1365
3998
  "name": "inventory_stock_movements_tenant_id_created_at_idx",
1366
3999
  "columns": [
@@ -1375,7 +4008,7 @@
1375
4008
  ]
1376
4009
  }
1377
4010
  ],
1378
- "version": "eff1027e"
4011
+ "version": "b426c2c5"
1379
4012
  },
1380
4013
  "importPath": "@happyvertical/smrt-inventory"
1381
4014
  }