@happyvertical/smrt-manufacturing 0.53.4 → 0.53.6

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 (106) hide show
  1. package/AGENTS.md +58 -7
  2. package/README.md +228 -4
  3. package/agents/multilevel-and-runs.md +28 -0
  4. package/dist/collections/AssemblyCollection.d.ts +15 -0
  5. package/dist/collections/AssemblyCollection.d.ts.map +1 -0
  6. package/dist/collections/OperationCollection.d.ts +20 -0
  7. package/dist/collections/OperationCollection.d.ts.map +1 -0
  8. package/dist/collections/ProductionRunCollection.d.ts +15 -0
  9. package/dist/collections/ProductionRunCollection.d.ts.map +1 -0
  10. package/dist/collections/ProductionRunCompletionCollection.d.ts +14 -0
  11. package/dist/collections/ProductionRunCompletionCollection.d.ts.map +1 -0
  12. package/dist/collections/RoutingStepCollection.d.ts +15 -0
  13. package/dist/collections/RoutingStepCollection.d.ts.map +1 -0
  14. package/dist/collections/index.d.ts +5 -0
  15. package/dist/collections/index.d.ts.map +1 -1
  16. package/dist/index.d.ts +23 -5
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +1660 -42
  19. package/dist/index.js.map +1 -1
  20. package/dist/manifest.json +1910 -161
  21. package/dist/models/Assembly.d.ts +62 -0
  22. package/dist/models/Assembly.d.ts.map +1 -0
  23. package/dist/models/BillOfMaterials.d.ts +12 -4
  24. package/dist/models/BillOfMaterials.d.ts.map +1 -1
  25. package/dist/models/BomLine.d.ts +11 -5
  26. package/dist/models/BomLine.d.ts.map +1 -1
  27. package/dist/models/Operation.d.ts +59 -0
  28. package/dist/models/Operation.d.ts.map +1 -0
  29. package/dist/models/ProductionRun.d.ts +67 -0
  30. package/dist/models/ProductionRun.d.ts.map +1 -0
  31. package/dist/models/ProductionRunCompletion.d.ts +36 -0
  32. package/dist/models/ProductionRunCompletion.d.ts.map +1 -0
  33. package/dist/models/RoutingStep.d.ts +46 -0
  34. package/dist/models/RoutingStep.d.ts.map +1 -0
  35. package/dist/models/index.d.ts +5 -0
  36. package/dist/models/index.d.ts.map +1 -1
  37. package/dist/operation-types.d.ts +108 -0
  38. package/dist/operation-types.d.ts.map +1 -0
  39. package/dist/production-run-types.d.ts +100 -0
  40. package/dist/production-run-types.d.ts.map +1 -0
  41. package/dist/quantity.d.ts +36 -0
  42. package/dist/quantity.d.ts.map +1 -0
  43. package/dist/services/AssemblyService.d.ts +222 -0
  44. package/dist/services/AssemblyService.d.ts.map +1 -0
  45. package/dist/services/BomService.d.ts +108 -5
  46. package/dist/services/BomService.d.ts.map +1 -1
  47. package/dist/services/OperationService.d.ts +48 -0
  48. package/dist/services/OperationService.d.ts.map +1 -0
  49. package/dist/services/ProductionRunService.d.ts +123 -0
  50. package/dist/services/ProductionRunService.d.ts.map +1 -0
  51. package/dist/services/ProductionService.d.ts +11 -0
  52. package/dist/services/ProductionService.d.ts.map +1 -1
  53. package/dist/services/RoutingService.d.ts +50 -0
  54. package/dist/services/RoutingService.d.ts.map +1 -0
  55. package/dist/services/index.d.ts +5 -0
  56. package/dist/services/index.d.ts.map +1 -1
  57. package/dist/services/structure-walk.d.ts +77 -0
  58. package/dist/services/structure-walk.d.ts.map +1 -0
  59. package/dist/smrt-knowledge.json +1771 -207
  60. package/dist/svelte/components/AssemblyForm.svelte +69 -0
  61. package/dist/svelte/components/AssemblyForm.svelte.d.ts +38 -0
  62. package/dist/svelte/components/AssemblyForm.svelte.d.ts.map +1 -0
  63. package/dist/svelte/components/AssemblyList.svelte +229 -0
  64. package/dist/svelte/components/AssemblyList.svelte.d.ts +28 -0
  65. package/dist/svelte/components/AssemblyList.svelte.d.ts.map +1 -0
  66. package/dist/svelte/components/BomEditor.svelte +575 -0
  67. package/dist/svelte/components/BomEditor.svelte.d.ts +29 -0
  68. package/dist/svelte/components/BomEditor.svelte.d.ts.map +1 -0
  69. package/dist/svelte/components/BomStructureTree.svelte +164 -0
  70. package/dist/svelte/components/BomStructureTree.svelte.d.ts +16 -0
  71. package/dist/svelte/components/BomStructureTree.svelte.d.ts.map +1 -0
  72. package/dist/svelte/components/OperationForm.svelte +258 -0
  73. package/dist/svelte/components/OperationForm.svelte.d.ts +17 -0
  74. package/dist/svelte/components/OperationForm.svelte.d.ts.map +1 -0
  75. package/dist/svelte/components/OperationList.svelte +170 -0
  76. package/dist/svelte/components/OperationList.svelte.d.ts +17 -0
  77. package/dist/svelte/components/OperationList.svelte.d.ts.map +1 -0
  78. package/dist/svelte/components/ProductionRunList.svelte +213 -0
  79. package/dist/svelte/components/ProductionRunList.svelte.d.ts +18 -0
  80. package/dist/svelte/components/ProductionRunList.svelte.d.ts.map +1 -0
  81. package/dist/svelte/components/RequirementsTree.svelte +125 -0
  82. package/dist/svelte/components/RequirementsTree.svelte.d.ts +13 -0
  83. package/dist/svelte/components/RequirementsTree.svelte.d.ts.map +1 -0
  84. package/dist/svelte/components/RequirementsTreeLevel.svelte +120 -0
  85. package/dist/svelte/components/RequirementsTreeLevel.svelte.d.ts +12 -0
  86. package/dist/svelte/components/RequirementsTreeLevel.svelte.d.ts.map +1 -0
  87. package/dist/svelte/i18n.d.ts +119 -0
  88. package/dist/svelte/i18n.d.ts.map +1 -0
  89. package/dist/svelte/i18n.js +119 -0
  90. package/dist/svelte/index.d.ts +33 -0
  91. package/dist/svelte/index.d.ts.map +1 -0
  92. package/dist/svelte/index.js +34 -0
  93. package/dist/svelte/types.d.ts +257 -0
  94. package/dist/svelte/types.d.ts.map +1 -0
  95. package/dist/svelte/types.js +249 -0
  96. package/dist/tenant-scope.d.ts +25 -0
  97. package/dist/tenant-scope.d.ts.map +1 -0
  98. package/dist/types.d.ts +207 -3
  99. package/dist/types.d.ts.map +1 -1
  100. package/dist/types.js +13 -1
  101. package/dist/types.js.map +1 -1
  102. package/dist/ui.d.ts +17 -0
  103. package/dist/ui.d.ts.map +1 -0
  104. package/dist/ui.js +94 -0
  105. package/dist/ui.js.map +1 -0
  106. package/package.json +41 -11
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-manufacturing",
5
- "packageVersion": "0.53.4",
5
+ "packageVersion": "0.53.6",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-manufacturing:BillOfMaterialsCollection": {
8
8
  "name": "billofmaterialscollection",
@@ -309,6 +309,942 @@
309
309
  },
310
310
  "importPath": "@happyvertical/smrt-manufacturing"
311
311
  },
312
+ "@happyvertical/smrt-manufacturing:OperationCollection": {
313
+ "name": "operationcollection",
314
+ "className": "OperationCollection",
315
+ "qualifiedName": "@happyvertical/smrt-manufacturing:OperationCollection",
316
+ "collection": "operations",
317
+ "filePath": "/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/OperationCollection.ts",
318
+ "packageName": "@happyvertical/smrt-manufacturing",
319
+ "fields": {},
320
+ "methods": {
321
+ "findByCode": {
322
+ "name": "findByCode",
323
+ "async": true,
324
+ "parameters": [
325
+ {
326
+ "name": "code",
327
+ "type": "string",
328
+ "optional": false
329
+ }
330
+ ],
331
+ "returnType": "Promise<Operation | null>",
332
+ "isStatic": false,
333
+ "isPublic": true
334
+ },
335
+ "listOperations": {
336
+ "name": "listOperations",
337
+ "async": true,
338
+ "parameters": [
339
+ {
340
+ "name": "options",
341
+ "type": "object",
342
+ "optional": true,
343
+ "memberTypes": [
344
+ "boolean"
345
+ ]
346
+ }
347
+ ],
348
+ "returnType": "Promise<Operation[]>",
349
+ "isStatic": false,
350
+ "isPublic": true
351
+ }
352
+ },
353
+ "decoratorConfig": {
354
+ "tableName": "manufacturing_operations"
355
+ },
356
+ "extends": "SmrtCollection",
357
+ "extendsTypeArg": "Operation",
358
+ "exportName": "OperationCollection",
359
+ "collectionExportName": "OperationCollectionCollection",
360
+ "schema": {
361
+ "tableName": "manufacturing_operations",
362
+ "ddl": "CREATE TABLE IF NOT EXISTS \"manufacturing_operations\" (\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 NOT NULL DEFAULT '',\n \"category\" TEXT DEFAULT '',\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"required_qualification_id\" UUID\n);",
363
+ "columns": {
364
+ "id": {
365
+ "type": "UUID",
366
+ "primaryKey": true,
367
+ "referenceKind": "id",
368
+ "notNull": true
369
+ },
370
+ "slug": {
371
+ "type": "TEXT",
372
+ "notNull": true
373
+ },
374
+ "context": {
375
+ "type": "TEXT",
376
+ "notNull": true,
377
+ "default": ""
378
+ },
379
+ "created_at": {
380
+ "type": "TIMESTAMP",
381
+ "notNull": true,
382
+ "default": "current_timestamp"
383
+ },
384
+ "updated_at": {
385
+ "type": "TIMESTAMP",
386
+ "notNull": true,
387
+ "default": "current_timestamp"
388
+ },
389
+ "tenant_id": {
390
+ "type": "UUID",
391
+ "referenceKind": "tenantId",
392
+ "notNull": false,
393
+ "unique": false
394
+ },
395
+ "code": {
396
+ "type": "TEXT",
397
+ "notNull": true,
398
+ "unique": false,
399
+ "default": ""
400
+ },
401
+ "name": {
402
+ "type": "TEXT",
403
+ "notNull": true,
404
+ "unique": false,
405
+ "default": ""
406
+ },
407
+ "category": {
408
+ "type": "TEXT",
409
+ "notNull": false,
410
+ "unique": false,
411
+ "default": ""
412
+ },
413
+ "is_active": {
414
+ "type": "BOOLEAN",
415
+ "notNull": false,
416
+ "unique": false,
417
+ "default": true
418
+ },
419
+ "required_qualification_id": {
420
+ "type": "UUID",
421
+ "referenceKind": "crossPackageRef",
422
+ "notNull": false,
423
+ "unique": false
424
+ }
425
+ },
426
+ "indexes": [
427
+ {
428
+ "name": "manufacturing_operations_code_tenant_id_idx",
429
+ "columns": [
430
+ "code",
431
+ "tenant_id"
432
+ ],
433
+ "unique": true,
434
+ "nullsNotDistinct": true
435
+ },
436
+ {
437
+ "name": "manufacturing_operations_slug_context_idx",
438
+ "columns": [
439
+ "slug",
440
+ "context"
441
+ ]
442
+ },
443
+ {
444
+ "name": "manufacturing_operations_tenant_id_created_at_idx",
445
+ "columns": [
446
+ "tenant_id",
447
+ "created_at"
448
+ ]
449
+ },
450
+ {
451
+ "name": "manufacturing_operations_required_qualification_id_idx",
452
+ "columns": [
453
+ "required_qualification_id"
454
+ ]
455
+ }
456
+ ],
457
+ "version": "0b3134d6"
458
+ },
459
+ "importPath": "@happyvertical/smrt-manufacturing"
460
+ },
461
+ "@happyvertical/smrt-manufacturing:ProductionRunCollection": {
462
+ "name": "productionruncollection",
463
+ "className": "ProductionRunCollection",
464
+ "qualifiedName": "@happyvertical/smrt-manufacturing:ProductionRunCollection",
465
+ "collection": "productionruns",
466
+ "filePath": "/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/ProductionRunCollection.ts",
467
+ "packageName": "@happyvertical/smrt-manufacturing",
468
+ "fields": {},
469
+ "methods": {
470
+ "findByBom": {
471
+ "name": "findByBom",
472
+ "async": true,
473
+ "parameters": [
474
+ {
475
+ "name": "bomId",
476
+ "type": "string",
477
+ "optional": false
478
+ }
479
+ ],
480
+ "returnType": "Promise<ProductionRun[]>",
481
+ "isStatic": false,
482
+ "isPublic": true
483
+ },
484
+ "findByStatus": {
485
+ "name": "findByStatus",
486
+ "async": true,
487
+ "parameters": [
488
+ {
489
+ "name": "status",
490
+ "type": "ProductionRunStatus",
491
+ "optional": false
492
+ }
493
+ ],
494
+ "returnType": "Promise<ProductionRun[]>",
495
+ "isStatic": false,
496
+ "isPublic": true
497
+ }
498
+ },
499
+ "decoratorConfig": {
500
+ "tableName": "manufacturing_production_runs"
501
+ },
502
+ "extends": "SmrtCollection",
503
+ "extendsTypeArg": "ProductionRun",
504
+ "exportName": "ProductionRunCollection",
505
+ "collectionExportName": "ProductionRunCollectionCollection",
506
+ "schema": {
507
+ "tableName": "manufacturing_production_runs",
508
+ "ddl": "CREATE TABLE IF NOT EXISTS \"manufacturing_production_runs\" (\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 \"bom_id\" UUID NOT NULL,\n \"target_qty\" REAL,\n \"completed_qty\" REAL,\n \"status\" TEXT NOT NULL DEFAULT 'planned'\n);",
509
+ "columns": {
510
+ "id": {
511
+ "type": "UUID",
512
+ "primaryKey": true,
513
+ "referenceKind": "id",
514
+ "notNull": true
515
+ },
516
+ "slug": {
517
+ "type": "TEXT",
518
+ "notNull": true
519
+ },
520
+ "context": {
521
+ "type": "TEXT",
522
+ "notNull": true,
523
+ "default": ""
524
+ },
525
+ "created_at": {
526
+ "type": "TIMESTAMP",
527
+ "notNull": true,
528
+ "default": "current_timestamp"
529
+ },
530
+ "updated_at": {
531
+ "type": "TIMESTAMP",
532
+ "notNull": true,
533
+ "default": "current_timestamp"
534
+ },
535
+ "tenant_id": {
536
+ "type": "UUID",
537
+ "referenceKind": "tenantId",
538
+ "notNull": false,
539
+ "unique": false
540
+ },
541
+ "bom_id": {
542
+ "type": "UUID",
543
+ "referenceKind": "foreignKey",
544
+ "notNull": true,
545
+ "unique": false,
546
+ "foreignKey": {
547
+ "table": "manufacturing_boms",
548
+ "column": "id",
549
+ "onDelete": "RESTRICT",
550
+ "onUpdate": "CASCADE"
551
+ }
552
+ },
553
+ "target_qty": {
554
+ "type": "REAL",
555
+ "notNull": false,
556
+ "unique": false
557
+ },
558
+ "completed_qty": {
559
+ "type": "REAL",
560
+ "notNull": false,
561
+ "unique": false
562
+ },
563
+ "status": {
564
+ "type": "TEXT",
565
+ "notNull": true,
566
+ "unique": false,
567
+ "default": "planned"
568
+ }
569
+ },
570
+ "indexes": [
571
+ {
572
+ "name": "manufacturing_production_runs_slug_context_idx",
573
+ "columns": [
574
+ "tenant_id",
575
+ "slug",
576
+ "context"
577
+ ],
578
+ "unique": true,
579
+ "nullsNotDistinct": true
580
+ },
581
+ {
582
+ "name": "manufacturing_production_runs_tenant_id_created_at_idx",
583
+ "columns": [
584
+ "tenant_id",
585
+ "created_at"
586
+ ]
587
+ },
588
+ {
589
+ "name": "manufacturing_production_runs_bom_id_idx",
590
+ "columns": [
591
+ "bom_id"
592
+ ]
593
+ }
594
+ ],
595
+ "version": "2ca8147d"
596
+ },
597
+ "importPath": "@happyvertical/smrt-manufacturing"
598
+ },
599
+ "@happyvertical/smrt-manufacturing:ProductionRunCompletionCollection": {
600
+ "name": "productionruncompletioncollection",
601
+ "className": "ProductionRunCompletionCollection",
602
+ "qualifiedName": "@happyvertical/smrt-manufacturing:ProductionRunCompletionCollection",
603
+ "collection": "productionruncompletions",
604
+ "filePath": "/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/ProductionRunCompletionCollection.ts",
605
+ "packageName": "@happyvertical/smrt-manufacturing",
606
+ "fields": {},
607
+ "methods": {
608
+ "findByRun": {
609
+ "name": "findByRun",
610
+ "async": true,
611
+ "parameters": [
612
+ {
613
+ "name": "runId",
614
+ "type": "string",
615
+ "optional": false
616
+ }
617
+ ],
618
+ "returnType": "Promise<ProductionRunCompletion[]>",
619
+ "isStatic": false,
620
+ "isPublic": true
621
+ }
622
+ },
623
+ "decoratorConfig": {
624
+ "tableName": "manufacturing_production_run_completions"
625
+ },
626
+ "extends": "SmrtCollection",
627
+ "extendsTypeArg": "ProductionRunCompletion",
628
+ "exportName": "ProductionRunCompletionCollection",
629
+ "collectionExportName": "ProductionRunCompletionCollectionCollection",
630
+ "schema": {
631
+ "tableName": "manufacturing_production_run_completions",
632
+ "ddl": "CREATE TABLE IF NOT EXISTS \"manufacturing_production_run_completions\" (\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 \"run_id\" UUID NOT NULL,\n \"qty\" REAL,\n \"completed_at\" TIMESTAMP\n);",
633
+ "columns": {
634
+ "id": {
635
+ "type": "UUID",
636
+ "primaryKey": true,
637
+ "referenceKind": "id",
638
+ "notNull": true
639
+ },
640
+ "slug": {
641
+ "type": "TEXT",
642
+ "notNull": true
643
+ },
644
+ "context": {
645
+ "type": "TEXT",
646
+ "notNull": true,
647
+ "default": ""
648
+ },
649
+ "created_at": {
650
+ "type": "TIMESTAMP",
651
+ "notNull": true,
652
+ "default": "current_timestamp"
653
+ },
654
+ "updated_at": {
655
+ "type": "TIMESTAMP",
656
+ "notNull": true,
657
+ "default": "current_timestamp"
658
+ },
659
+ "tenant_id": {
660
+ "type": "UUID",
661
+ "referenceKind": "tenantId",
662
+ "notNull": false,
663
+ "unique": false
664
+ },
665
+ "run_id": {
666
+ "type": "UUID",
667
+ "referenceKind": "foreignKey",
668
+ "notNull": true,
669
+ "unique": false,
670
+ "foreignKey": {
671
+ "table": "manufacturing_production_runs",
672
+ "column": "id",
673
+ "onDelete": "CASCADE",
674
+ "onUpdate": "CASCADE"
675
+ }
676
+ },
677
+ "qty": {
678
+ "type": "REAL",
679
+ "notNull": false,
680
+ "unique": false
681
+ },
682
+ "completed_at": {
683
+ "type": "TIMESTAMP",
684
+ "notNull": false,
685
+ "unique": false
686
+ }
687
+ },
688
+ "indexes": [
689
+ {
690
+ "name": "manufacturing_production_run_completions_slug_context_idx",
691
+ "columns": [
692
+ "tenant_id",
693
+ "slug",
694
+ "context"
695
+ ],
696
+ "unique": true,
697
+ "nullsNotDistinct": true
698
+ },
699
+ {
700
+ "name": "manufacturing_production_run_completions_tenant_ea7a0d0125_idx",
701
+ "columns": [
702
+ "tenant_id",
703
+ "created_at"
704
+ ]
705
+ },
706
+ {
707
+ "name": "manufacturing_production_run_completions_run_id_idx",
708
+ "columns": [
709
+ "run_id"
710
+ ]
711
+ }
712
+ ],
713
+ "version": "c940de6c"
714
+ },
715
+ "importPath": "@happyvertical/smrt-manufacturing"
716
+ },
717
+ "@happyvertical/smrt-manufacturing:RoutingStepCollection": {
718
+ "name": "routingstepcollection",
719
+ "className": "RoutingStepCollection",
720
+ "qualifiedName": "@happyvertical/smrt-manufacturing:RoutingStepCollection",
721
+ "collection": "routingsteps",
722
+ "filePath": "/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/RoutingStepCollection.ts",
723
+ "packageName": "@happyvertical/smrt-manufacturing",
724
+ "fields": {},
725
+ "methods": {
726
+ "findByBom": {
727
+ "name": "findByBom",
728
+ "async": true,
729
+ "parameters": [
730
+ {
731
+ "name": "bomId",
732
+ "type": "string",
733
+ "optional": false
734
+ }
735
+ ],
736
+ "returnType": "Promise<RoutingStep[]>",
737
+ "isStatic": false,
738
+ "isPublic": true
739
+ },
740
+ "findByOperation": {
741
+ "name": "findByOperation",
742
+ "async": true,
743
+ "parameters": [
744
+ {
745
+ "name": "operationId",
746
+ "type": "string",
747
+ "optional": false
748
+ }
749
+ ],
750
+ "returnType": "Promise<RoutingStep[]>",
751
+ "isStatic": false,
752
+ "isPublic": true
753
+ }
754
+ },
755
+ "decoratorConfig": {
756
+ "tableName": "manufacturing_routing_steps"
757
+ },
758
+ "extends": "SmrtCollection",
759
+ "extendsTypeArg": "RoutingStep",
760
+ "exportName": "RoutingStepCollection",
761
+ "collectionExportName": "RoutingStepCollectionCollection",
762
+ "schema": {
763
+ "tableName": "manufacturing_routing_steps",
764
+ "ddl": "CREATE TABLE IF NOT EXISTS \"manufacturing_routing_steps\" (\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 \"bom_id\" UUID NOT NULL,\n \"operation_id\" UUID NOT NULL,\n \"sequence\" INTEGER NOT NULL DEFAULT 1,\n \"estimated_minutes\" REAL,\n \"notes\" TEXT DEFAULT ''\n);",
765
+ "columns": {
766
+ "id": {
767
+ "type": "UUID",
768
+ "primaryKey": true,
769
+ "referenceKind": "id",
770
+ "notNull": true
771
+ },
772
+ "slug": {
773
+ "type": "TEXT",
774
+ "notNull": true
775
+ },
776
+ "context": {
777
+ "type": "TEXT",
778
+ "notNull": true,
779
+ "default": ""
780
+ },
781
+ "created_at": {
782
+ "type": "TIMESTAMP",
783
+ "notNull": true,
784
+ "default": "current_timestamp"
785
+ },
786
+ "updated_at": {
787
+ "type": "TIMESTAMP",
788
+ "notNull": true,
789
+ "default": "current_timestamp"
790
+ },
791
+ "tenant_id": {
792
+ "type": "UUID",
793
+ "referenceKind": "tenantId",
794
+ "notNull": false,
795
+ "unique": false
796
+ },
797
+ "bom_id": {
798
+ "type": "UUID",
799
+ "referenceKind": "foreignKey",
800
+ "notNull": true,
801
+ "unique": false,
802
+ "foreignKey": {
803
+ "table": "manufacturing_boms",
804
+ "column": "id",
805
+ "onDelete": "CASCADE",
806
+ "onUpdate": "CASCADE"
807
+ }
808
+ },
809
+ "operation_id": {
810
+ "type": "UUID",
811
+ "referenceKind": "foreignKey",
812
+ "notNull": true,
813
+ "unique": false,
814
+ "foreignKey": {
815
+ "table": "manufacturing_operations",
816
+ "column": "id",
817
+ "onDelete": "RESTRICT",
818
+ "onUpdate": "CASCADE"
819
+ }
820
+ },
821
+ "sequence": {
822
+ "type": "INTEGER",
823
+ "notNull": true,
824
+ "unique": false,
825
+ "default": 1
826
+ },
827
+ "estimated_minutes": {
828
+ "type": "REAL",
829
+ "notNull": false,
830
+ "unique": false
831
+ },
832
+ "notes": {
833
+ "type": "TEXT",
834
+ "notNull": false,
835
+ "unique": false,
836
+ "default": ""
837
+ }
838
+ },
839
+ "indexes": [
840
+ {
841
+ "name": "manufacturing_routing_steps_bom_id_sequence_idx",
842
+ "columns": [
843
+ "bom_id",
844
+ "sequence",
845
+ "tenant_id"
846
+ ],
847
+ "unique": true,
848
+ "nullsNotDistinct": true
849
+ },
850
+ {
851
+ "name": "manufacturing_routing_steps_slug_context_idx",
852
+ "columns": [
853
+ "slug",
854
+ "context"
855
+ ]
856
+ },
857
+ {
858
+ "name": "manufacturing_routing_steps_tenant_id_created_at_idx",
859
+ "columns": [
860
+ "tenant_id",
861
+ "created_at"
862
+ ]
863
+ },
864
+ {
865
+ "name": "manufacturing_routing_steps_operation_id_idx",
866
+ "columns": [
867
+ "operation_id"
868
+ ]
869
+ }
870
+ ],
871
+ "version": "41ac3c66"
872
+ },
873
+ "importPath": "@happyvertical/smrt-manufacturing"
874
+ },
875
+ "@happyvertical/smrt-manufacturing:Assembly": {
876
+ "name": "assembly",
877
+ "className": "Assembly",
878
+ "qualifiedName": "@happyvertical/smrt-manufacturing:Assembly",
879
+ "collection": "products",
880
+ "filePath": "/home/runner/work/smrt/smrt/packages/manufacturing/src/models/Assembly.ts",
881
+ "packageName": "@happyvertical/smrt-manufacturing",
882
+ "fields": {
883
+ "created_at": {
884
+ "type": "datetime",
885
+ "required": false
886
+ },
887
+ "updated_at": {
888
+ "type": "datetime",
889
+ "required": false
890
+ },
891
+ "tenantId": {
892
+ "type": "text",
893
+ "required": false,
894
+ "_meta": {
895
+ "generated": true,
896
+ "source": "tenantScoped_decorator",
897
+ "sqlType": "UUID",
898
+ "__tenancy": {
899
+ "isTenantIdField": true,
900
+ "mode": "optional",
901
+ "field": "tenantId",
902
+ "autoFilter": true,
903
+ "autoPopulate": true,
904
+ "allowSuperAdminBypass": false
905
+ }
906
+ }
907
+ },
908
+ "productType": {
909
+ "type": "json",
910
+ "required": false
911
+ },
912
+ "name": {
913
+ "type": "text",
914
+ "required": false
915
+ },
916
+ "description": {
917
+ "type": "text",
918
+ "required": false
919
+ },
920
+ "category": {
921
+ "type": "text",
922
+ "required": false
923
+ },
924
+ "manufacturer": {
925
+ "type": "text",
926
+ "required": false
927
+ },
928
+ "model": {
929
+ "type": "text",
930
+ "required": false
931
+ },
932
+ "price": {
933
+ "type": "integer",
934
+ "required": true,
935
+ "default": 0
936
+ },
937
+ "inStock": {
938
+ "type": "boolean",
939
+ "required": true,
940
+ "default": true
941
+ },
942
+ "specifications": {
943
+ "type": "json",
944
+ "required": false,
945
+ "default": {}
946
+ },
947
+ "tags": {
948
+ "type": "json",
949
+ "required": false,
950
+ "default": []
951
+ },
952
+ "estimatedLabourMinutes": {
953
+ "type": "integer",
954
+ "required": false,
955
+ "default": 0
956
+ },
957
+ "defaultOperationId": {
958
+ "type": "foreignKey",
959
+ "required": false,
960
+ "related": "Operation",
961
+ "_meta": {
962
+ "nullable": true,
963
+ "onDelete": "RESTRICT"
964
+ }
965
+ },
966
+ "partReference": {
967
+ "type": "text",
968
+ "required": false,
969
+ "default": ""
970
+ }
971
+ },
972
+ "methods": {
973
+ "getSpecification": {
974
+ "name": "getSpecification",
975
+ "async": true,
976
+ "parameters": [
977
+ {
978
+ "name": "key",
979
+ "type": "string",
980
+ "optional": false
981
+ }
982
+ ],
983
+ "returnType": "Promise<unknown>",
984
+ "isStatic": false,
985
+ "isPublic": true
986
+ },
987
+ "updateSpecification": {
988
+ "name": "updateSpecification",
989
+ "async": true,
990
+ "parameters": [
991
+ {
992
+ "name": "key",
993
+ "type": "string",
994
+ "optional": false
995
+ },
996
+ {
997
+ "name": "value",
998
+ "type": "unknown",
999
+ "optional": false
1000
+ }
1001
+ ],
1002
+ "returnType": "Promise<void>",
1003
+ "isStatic": false,
1004
+ "isPublic": true
1005
+ },
1006
+ "getAssets": {
1007
+ "name": "getAssets",
1008
+ "async": true,
1009
+ "parameters": [
1010
+ {
1011
+ "name": "relationship",
1012
+ "type": "string",
1013
+ "optional": true
1014
+ }
1015
+ ],
1016
+ "returnType": "Promise<Asset[]>",
1017
+ "isStatic": false,
1018
+ "isPublic": true
1019
+ },
1020
+ "addAsset": {
1021
+ "name": "addAsset",
1022
+ "async": true,
1023
+ "parameters": [
1024
+ {
1025
+ "name": "asset",
1026
+ "type": "Asset",
1027
+ "optional": false
1028
+ },
1029
+ {
1030
+ "name": "relationship",
1031
+ "type": "any",
1032
+ "optional": true,
1033
+ "default": "attachment"
1034
+ },
1035
+ {
1036
+ "name": "sortOrder",
1037
+ "type": "any",
1038
+ "optional": true
1039
+ }
1040
+ ],
1041
+ "returnType": "Promise<void>",
1042
+ "isStatic": false,
1043
+ "isPublic": true
1044
+ },
1045
+ "removeAsset": {
1046
+ "name": "removeAsset",
1047
+ "async": true,
1048
+ "parameters": [
1049
+ {
1050
+ "name": "assetId",
1051
+ "type": "string",
1052
+ "optional": false
1053
+ },
1054
+ {
1055
+ "name": "relationship",
1056
+ "type": "string",
1057
+ "optional": true
1058
+ }
1059
+ ],
1060
+ "returnType": "Promise<void>",
1061
+ "isStatic": false,
1062
+ "isPublic": true
1063
+ }
1064
+ },
1065
+ "decoratorConfig": {
1066
+ "api": {
1067
+ "include": [
1068
+ "list",
1069
+ "get",
1070
+ "create",
1071
+ "update"
1072
+ ]
1073
+ },
1074
+ "mcp": {
1075
+ "include": [
1076
+ "list",
1077
+ "get"
1078
+ ]
1079
+ },
1080
+ "cli": {
1081
+ "skipApiCheck": true
1082
+ },
1083
+ "tenantScoped": {
1084
+ "mode": "optional"
1085
+ },
1086
+ "tableName": "products",
1087
+ "tableStrategy": "sti"
1088
+ },
1089
+ "extends": "Product",
1090
+ "exportName": "Assembly",
1091
+ "collectionExportName": "AssemblyCollection",
1092
+ "validationRules": [
1093
+ {
1094
+ "field": "price",
1095
+ "rule": "required",
1096
+ "fieldType": "integer"
1097
+ },
1098
+ {
1099
+ "field": "inStock",
1100
+ "rule": "required",
1101
+ "fieldType": "boolean"
1102
+ }
1103
+ ],
1104
+ "schema": {
1105
+ "tableName": "products",
1106
+ "ddl": "CREATE TABLE IF NOT EXISTS \"products\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"product_type\" TEXT,\n \"name\" TEXT,\n \"description\" TEXT,\n \"category\" TEXT,\n \"manufacturer\" TEXT,\n \"model\" TEXT,\n \"price\" INTEGER DEFAULT 0,\n \"in_stock\" BOOLEAN DEFAULT TRUE,\n \"specifications\" JSON DEFAULT '{}',\n \"tags\" JSON DEFAULT '[]',\n \"estimated_labour_minutes\" INTEGER DEFAULT 0,\n \"default_operation_id\" UUID,\n \"part_reference\" TEXT DEFAULT ''\n);",
1107
+ "columns": {
1108
+ "id": {
1109
+ "type": "UUID",
1110
+ "primaryKey": true,
1111
+ "referenceKind": "id",
1112
+ "notNull": true
1113
+ },
1114
+ "slug": {
1115
+ "type": "TEXT",
1116
+ "notNull": true
1117
+ },
1118
+ "context": {
1119
+ "type": "TEXT",
1120
+ "notNull": true,
1121
+ "default": ""
1122
+ },
1123
+ "_meta_type": {
1124
+ "type": "TEXT",
1125
+ "notNull": true
1126
+ },
1127
+ "_meta_data": {
1128
+ "type": "JSON",
1129
+ "notNull": false
1130
+ },
1131
+ "created_at": {
1132
+ "type": "TIMESTAMP",
1133
+ "notNull": true,
1134
+ "default": "current_timestamp"
1135
+ },
1136
+ "updated_at": {
1137
+ "type": "TIMESTAMP",
1138
+ "notNull": true,
1139
+ "default": "current_timestamp"
1140
+ },
1141
+ "tenant_id": {
1142
+ "type": "UUID",
1143
+ "referenceKind": "tenantId",
1144
+ "notNull": false
1145
+ },
1146
+ "product_type": {
1147
+ "type": "TEXT",
1148
+ "notNull": false
1149
+ },
1150
+ "name": {
1151
+ "type": "TEXT",
1152
+ "notNull": false
1153
+ },
1154
+ "description": {
1155
+ "type": "TEXT",
1156
+ "notNull": false
1157
+ },
1158
+ "category": {
1159
+ "type": "TEXT",
1160
+ "notNull": false
1161
+ },
1162
+ "manufacturer": {
1163
+ "type": "TEXT",
1164
+ "notNull": false
1165
+ },
1166
+ "model": {
1167
+ "type": "TEXT",
1168
+ "notNull": false
1169
+ },
1170
+ "price": {
1171
+ "type": "INTEGER",
1172
+ "notNull": false,
1173
+ "default": 0
1174
+ },
1175
+ "in_stock": {
1176
+ "type": "BOOLEAN",
1177
+ "notNull": false,
1178
+ "default": true
1179
+ },
1180
+ "specifications": {
1181
+ "type": "JSON",
1182
+ "notNull": false,
1183
+ "default": {}
1184
+ },
1185
+ "tags": {
1186
+ "type": "JSON",
1187
+ "notNull": false,
1188
+ "default": []
1189
+ },
1190
+ "estimated_labour_minutes": {
1191
+ "type": "INTEGER",
1192
+ "notNull": false,
1193
+ "default": 0
1194
+ },
1195
+ "default_operation_id": {
1196
+ "type": "UUID",
1197
+ "referenceKind": "foreignKey",
1198
+ "notNull": false,
1199
+ "foreignKey": {
1200
+ "table": "manufacturing_operations",
1201
+ "column": "id",
1202
+ "onDelete": "RESTRICT",
1203
+ "onUpdate": "CASCADE"
1204
+ }
1205
+ },
1206
+ "part_reference": {
1207
+ "type": "TEXT",
1208
+ "notNull": false,
1209
+ "default": ""
1210
+ }
1211
+ },
1212
+ "indexes": [
1213
+ {
1214
+ "name": "products_slug_context_meta_type_idx",
1215
+ "columns": [
1216
+ "tenant_id",
1217
+ "slug",
1218
+ "context",
1219
+ "_meta_type"
1220
+ ],
1221
+ "unique": true,
1222
+ "nullsNotDistinct": true
1223
+ },
1224
+ {
1225
+ "name": "products_meta_type_idx",
1226
+ "columns": [
1227
+ "_meta_type"
1228
+ ]
1229
+ },
1230
+ {
1231
+ "name": "products_tenant_id_created_at_idx",
1232
+ "columns": [
1233
+ "tenant_id",
1234
+ "created_at"
1235
+ ]
1236
+ },
1237
+ {
1238
+ "name": "products_default_operation_id_idx",
1239
+ "columns": [
1240
+ "default_operation_id"
1241
+ ]
1242
+ }
1243
+ ],
1244
+ "version": "f2f2bf95"
1245
+ },
1246
+ "importPath": "@happyvertical/smrt-manufacturing"
1247
+ },
312
1248
  "@happyvertical/smrt-manufacturing:BillOfMaterials": {
313
1249
  "name": "billofmaterials",
314
1250
  "className": "BillOfMaterials",
@@ -335,59 +1271,877 @@
335
1271
  }
336
1272
  }
337
1273
  },
338
- "productId": {
339
- "type": "text",
1274
+ "productId": {
1275
+ "type": "text",
1276
+ "required": true,
1277
+ "default": "",
1278
+ "_meta": {
1279
+ "required": true
1280
+ }
1281
+ },
1282
+ "version": {
1283
+ "type": "integer",
1284
+ "required": true,
1285
+ "default": 1,
1286
+ "_meta": {
1287
+ "required": true
1288
+ }
1289
+ },
1290
+ "effectiveDate": {
1291
+ "type": "datetime",
1292
+ "required": false
1293
+ },
1294
+ "status": {
1295
+ "type": "text",
1296
+ "required": true,
1297
+ "default": "draft",
1298
+ "_meta": {
1299
+ "required": true
1300
+ }
1301
+ },
1302
+ "notes": {
1303
+ "type": "text",
1304
+ "required": false,
1305
+ "default": ""
1306
+ },
1307
+ "currency": {
1308
+ "type": "text",
1309
+ "required": false,
1310
+ "default": "USD"
1311
+ }
1312
+ },
1313
+ "methods": {},
1314
+ "decoratorConfig": {
1315
+ "tableName": "manufacturing_boms",
1316
+ "conflictColumns": [
1317
+ "product_id",
1318
+ "version",
1319
+ "tenant_id"
1320
+ ],
1321
+ "api": {
1322
+ "include": [
1323
+ "list",
1324
+ "get",
1325
+ "create",
1326
+ "update"
1327
+ ]
1328
+ },
1329
+ "mcp": {
1330
+ "include": [
1331
+ "list",
1332
+ "get"
1333
+ ]
1334
+ },
1335
+ "cli": true,
1336
+ "tenantScoped": {
1337
+ "mode": "optional"
1338
+ }
1339
+ },
1340
+ "extends": "SmrtObject",
1341
+ "exportName": "BillOfMaterials",
1342
+ "collectionExportName": "BillOfMaterialsCollection",
1343
+ "validationRules": [
1344
+ {
1345
+ "field": "productId",
1346
+ "rule": "required",
1347
+ "fieldType": "text"
1348
+ },
1349
+ {
1350
+ "field": "version",
1351
+ "rule": "required",
1352
+ "fieldType": "integer"
1353
+ },
1354
+ {
1355
+ "field": "status",
1356
+ "rule": "required",
1357
+ "fieldType": "text"
1358
+ }
1359
+ ],
1360
+ "schema": {
1361
+ "tableName": "manufacturing_boms",
1362
+ "ddl": "CREATE TABLE IF NOT EXISTS \"manufacturing_boms\" (\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 \"product_id\" TEXT NOT NULL DEFAULT '',\n \"version\" INTEGER NOT NULL DEFAULT 1,\n \"effective_date\" TIMESTAMP,\n \"status\" TEXT NOT NULL DEFAULT 'draft',\n \"notes\" TEXT DEFAULT '',\n \"currency\" TEXT DEFAULT 'USD'\n);",
1363
+ "columns": {
1364
+ "id": {
1365
+ "type": "UUID",
1366
+ "primaryKey": true,
1367
+ "referenceKind": "id",
1368
+ "notNull": true
1369
+ },
1370
+ "slug": {
1371
+ "type": "TEXT",
1372
+ "notNull": true
1373
+ },
1374
+ "context": {
1375
+ "type": "TEXT",
1376
+ "notNull": true,
1377
+ "default": ""
1378
+ },
1379
+ "created_at": {
1380
+ "type": "TIMESTAMP",
1381
+ "notNull": true,
1382
+ "default": "current_timestamp"
1383
+ },
1384
+ "updated_at": {
1385
+ "type": "TIMESTAMP",
1386
+ "notNull": true,
1387
+ "default": "current_timestamp"
1388
+ },
1389
+ "tenant_id": {
1390
+ "type": "UUID",
1391
+ "referenceKind": "tenantId",
1392
+ "notNull": false,
1393
+ "unique": false
1394
+ },
1395
+ "product_id": {
1396
+ "type": "TEXT",
1397
+ "notNull": true,
1398
+ "unique": false,
1399
+ "default": ""
1400
+ },
1401
+ "version": {
1402
+ "type": "INTEGER",
1403
+ "notNull": true,
1404
+ "unique": false,
1405
+ "default": 1
1406
+ },
1407
+ "effective_date": {
1408
+ "type": "TIMESTAMP",
1409
+ "notNull": false,
1410
+ "unique": false
1411
+ },
1412
+ "status": {
1413
+ "type": "TEXT",
1414
+ "notNull": true,
1415
+ "unique": false,
1416
+ "default": "draft"
1417
+ },
1418
+ "notes": {
1419
+ "type": "TEXT",
1420
+ "notNull": false,
1421
+ "unique": false,
1422
+ "default": ""
1423
+ },
1424
+ "currency": {
1425
+ "type": "TEXT",
1426
+ "notNull": false,
1427
+ "unique": false,
1428
+ "default": "USD"
1429
+ }
1430
+ },
1431
+ "indexes": [
1432
+ {
1433
+ "name": "manufacturing_boms_product_id_version_idx",
1434
+ "columns": [
1435
+ "product_id",
1436
+ "version",
1437
+ "tenant_id"
1438
+ ],
1439
+ "unique": true,
1440
+ "nullsNotDistinct": true
1441
+ },
1442
+ {
1443
+ "name": "manufacturing_boms_slug_context_idx",
1444
+ "columns": [
1445
+ "slug",
1446
+ "context"
1447
+ ]
1448
+ },
1449
+ {
1450
+ "name": "manufacturing_boms_tenant_id_created_at_idx",
1451
+ "columns": [
1452
+ "tenant_id",
1453
+ "created_at"
1454
+ ]
1455
+ }
1456
+ ],
1457
+ "version": "b2691adc"
1458
+ },
1459
+ "importPath": "@happyvertical/smrt-manufacturing"
1460
+ },
1461
+ "@happyvertical/smrt-manufacturing:BomLine": {
1462
+ "name": "bomline",
1463
+ "className": "BomLine",
1464
+ "qualifiedName": "@happyvertical/smrt-manufacturing:BomLine",
1465
+ "collection": "bomlines",
1466
+ "filePath": "/home/runner/work/smrt/smrt/packages/manufacturing/src/models/BomLine.ts",
1467
+ "packageName": "@happyvertical/smrt-manufacturing",
1468
+ "fields": {
1469
+ "tenantId": {
1470
+ "type": "text",
1471
+ "required": false,
1472
+ "_meta": {
1473
+ "sqlType": "UUID",
1474
+ "nullable": true,
1475
+ "__tenancy": {
1476
+ "isTenantIdField": true,
1477
+ "autoFilter": true,
1478
+ "required": false,
1479
+ "autoPopulate": true,
1480
+ "nullable": true,
1481
+ "mode": "optional",
1482
+ "field": "tenantId",
1483
+ "allowSuperAdminBypass": false
1484
+ }
1485
+ }
1486
+ },
1487
+ "bomId": {
1488
+ "type": "text",
1489
+ "required": true,
1490
+ "default": "",
1491
+ "_meta": {
1492
+ "required": true
1493
+ }
1494
+ },
1495
+ "componentSkuId": {
1496
+ "type": "text",
1497
+ "required": true,
1498
+ "default": "",
1499
+ "_meta": {
1500
+ "required": true
1501
+ }
1502
+ },
1503
+ "qtyPerUnit": {
1504
+ "type": "decimal",
1505
+ "required": false,
1506
+ "_meta": {}
1507
+ },
1508
+ "uom": {
1509
+ "type": "text",
1510
+ "required": false,
1511
+ "default": "each"
1512
+ },
1513
+ "wastePercent": {
1514
+ "type": "decimal",
1515
+ "required": false,
1516
+ "_meta": {}
1517
+ },
1518
+ "notes": {
1519
+ "type": "text",
1520
+ "required": false,
1521
+ "default": ""
1522
+ }
1523
+ },
1524
+ "methods": {
1525
+ "effectiveQtyPerUnit": {
1526
+ "name": "effectiveQtyPerUnit",
1527
+ "async": false,
1528
+ "parameters": [],
1529
+ "returnType": "number",
1530
+ "isStatic": false,
1531
+ "isPublic": true
1532
+ }
1533
+ },
1534
+ "decoratorConfig": {
1535
+ "tableName": "manufacturing_bom_lines",
1536
+ "conflictColumns": [
1537
+ "bom_id",
1538
+ "component_sku_id",
1539
+ "tenant_id"
1540
+ ],
1541
+ "api": {
1542
+ "include": [
1543
+ "list",
1544
+ "get",
1545
+ "create",
1546
+ "update"
1547
+ ]
1548
+ },
1549
+ "mcp": {
1550
+ "include": [
1551
+ "list",
1552
+ "get"
1553
+ ]
1554
+ },
1555
+ "cli": {
1556
+ "skipApiCheck": true
1557
+ },
1558
+ "tenantScoped": {
1559
+ "mode": "optional"
1560
+ }
1561
+ },
1562
+ "extends": "SmrtObject",
1563
+ "exportName": "BomLine",
1564
+ "collectionExportName": "BomLineCollection",
1565
+ "validationRules": [
1566
+ {
1567
+ "field": "bomId",
1568
+ "rule": "required",
1569
+ "fieldType": "text"
1570
+ },
1571
+ {
1572
+ "field": "componentSkuId",
1573
+ "rule": "required",
1574
+ "fieldType": "text"
1575
+ }
1576
+ ],
1577
+ "schema": {
1578
+ "tableName": "manufacturing_bom_lines",
1579
+ "ddl": "CREATE TABLE IF NOT EXISTS \"manufacturing_bom_lines\" (\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 \"bom_id\" TEXT NOT NULL DEFAULT '',\n \"component_sku_id\" TEXT NOT NULL DEFAULT '',\n \"qty_per_unit\" REAL,\n \"uom\" TEXT DEFAULT 'each',\n \"waste_percent\" REAL,\n \"notes\" TEXT DEFAULT ''\n);",
1580
+ "columns": {
1581
+ "id": {
1582
+ "type": "UUID",
1583
+ "primaryKey": true,
1584
+ "referenceKind": "id",
1585
+ "notNull": true
1586
+ },
1587
+ "slug": {
1588
+ "type": "TEXT",
1589
+ "notNull": true
1590
+ },
1591
+ "context": {
1592
+ "type": "TEXT",
1593
+ "notNull": true,
1594
+ "default": ""
1595
+ },
1596
+ "created_at": {
1597
+ "type": "TIMESTAMP",
1598
+ "notNull": true,
1599
+ "default": "current_timestamp"
1600
+ },
1601
+ "updated_at": {
1602
+ "type": "TIMESTAMP",
1603
+ "notNull": true,
1604
+ "default": "current_timestamp"
1605
+ },
1606
+ "tenant_id": {
1607
+ "type": "UUID",
1608
+ "referenceKind": "tenantId",
1609
+ "notNull": false,
1610
+ "unique": false
1611
+ },
1612
+ "bom_id": {
1613
+ "type": "TEXT",
1614
+ "notNull": true,
1615
+ "unique": false,
1616
+ "default": ""
1617
+ },
1618
+ "component_sku_id": {
1619
+ "type": "TEXT",
1620
+ "notNull": true,
1621
+ "unique": false,
1622
+ "default": ""
1623
+ },
1624
+ "qty_per_unit": {
1625
+ "type": "REAL",
1626
+ "notNull": false,
1627
+ "unique": false
1628
+ },
1629
+ "uom": {
1630
+ "type": "TEXT",
1631
+ "notNull": false,
1632
+ "unique": false,
1633
+ "default": "each"
1634
+ },
1635
+ "waste_percent": {
1636
+ "type": "REAL",
1637
+ "notNull": false,
1638
+ "unique": false
1639
+ },
1640
+ "notes": {
1641
+ "type": "TEXT",
1642
+ "notNull": false,
1643
+ "unique": false,
1644
+ "default": ""
1645
+ }
1646
+ },
1647
+ "indexes": [
1648
+ {
1649
+ "name": "manufacturing_bom_lines_bom_id_component_sku_id_idx",
1650
+ "columns": [
1651
+ "bom_id",
1652
+ "component_sku_id",
1653
+ "tenant_id"
1654
+ ],
1655
+ "unique": true,
1656
+ "nullsNotDistinct": true
1657
+ },
1658
+ {
1659
+ "name": "manufacturing_bom_lines_slug_context_idx",
1660
+ "columns": [
1661
+ "slug",
1662
+ "context"
1663
+ ]
1664
+ },
1665
+ {
1666
+ "name": "manufacturing_bom_lines_tenant_id_created_at_idx",
1667
+ "columns": [
1668
+ "tenant_id",
1669
+ "created_at"
1670
+ ]
1671
+ }
1672
+ ],
1673
+ "version": "cfbae7e8"
1674
+ },
1675
+ "importPath": "@happyvertical/smrt-manufacturing"
1676
+ },
1677
+ "@happyvertical/smrt-manufacturing:Operation": {
1678
+ "name": "operation",
1679
+ "className": "Operation",
1680
+ "qualifiedName": "@happyvertical/smrt-manufacturing:Operation",
1681
+ "collection": "operations",
1682
+ "filePath": "/home/runner/work/smrt/smrt/packages/manufacturing/src/models/Operation.ts",
1683
+ "packageName": "@happyvertical/smrt-manufacturing",
1684
+ "fields": {
1685
+ "tenantId": {
1686
+ "type": "text",
1687
+ "required": false,
1688
+ "_meta": {
1689
+ "sqlType": "UUID",
1690
+ "nullable": true,
1691
+ "__tenancy": {
1692
+ "isTenantIdField": true,
1693
+ "autoFilter": true,
1694
+ "required": false,
1695
+ "autoPopulate": true,
1696
+ "nullable": true,
1697
+ "mode": "optional",
1698
+ "field": "tenantId",
1699
+ "allowSuperAdminBypass": false
1700
+ }
1701
+ }
1702
+ },
1703
+ "code": {
1704
+ "type": "text",
1705
+ "required": true,
1706
+ "default": "",
1707
+ "_meta": {
1708
+ "required": true
1709
+ }
1710
+ },
1711
+ "name": {
1712
+ "type": "text",
1713
+ "required": true,
1714
+ "default": "",
1715
+ "_meta": {
1716
+ "required": true
1717
+ }
1718
+ },
1719
+ "category": {
1720
+ "type": "text",
1721
+ "required": false,
1722
+ "default": ""
1723
+ },
1724
+ "isActive": {
1725
+ "type": "boolean",
1726
+ "required": false,
1727
+ "default": true
1728
+ },
1729
+ "requiredQualificationId": {
1730
+ "type": "crossPackageRef",
1731
+ "required": false,
1732
+ "related": "@happyvertical/smrt-human-resources:Qualification",
1733
+ "_meta": {
1734
+ "nullable": true
1735
+ }
1736
+ }
1737
+ },
1738
+ "methods": {
1739
+ "delete": {
1740
+ "name": "delete",
1741
+ "async": true,
1742
+ "parameters": [],
1743
+ "returnType": "Promise<void>",
1744
+ "isStatic": false,
1745
+ "isPublic": true
1746
+ }
1747
+ },
1748
+ "decoratorConfig": {
1749
+ "tableName": "manufacturing_operations",
1750
+ "conflictColumns": [
1751
+ "code",
1752
+ "tenant_id"
1753
+ ],
1754
+ "api": {
1755
+ "include": [
1756
+ "list",
1757
+ "get"
1758
+ ]
1759
+ },
1760
+ "mcp": {
1761
+ "include": [
1762
+ "list",
1763
+ "get"
1764
+ ]
1765
+ },
1766
+ "cli": {
1767
+ "include": [
1768
+ "list",
1769
+ "get"
1770
+ ]
1771
+ },
1772
+ "tenantScoped": {
1773
+ "mode": "optional"
1774
+ }
1775
+ },
1776
+ "extends": "SmrtObject",
1777
+ "exportName": "Operation",
1778
+ "collectionExportName": "OperationCollection",
1779
+ "validationRules": [
1780
+ {
1781
+ "field": "code",
1782
+ "rule": "required",
1783
+ "fieldType": "text"
1784
+ },
1785
+ {
1786
+ "field": "name",
1787
+ "rule": "required",
1788
+ "fieldType": "text"
1789
+ }
1790
+ ],
1791
+ "schema": {
1792
+ "tableName": "manufacturing_operations",
1793
+ "ddl": "CREATE TABLE IF NOT EXISTS \"manufacturing_operations\" (\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 NOT NULL DEFAULT '',\n \"category\" TEXT DEFAULT '',\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"required_qualification_id\" UUID\n);",
1794
+ "columns": {
1795
+ "id": {
1796
+ "type": "UUID",
1797
+ "primaryKey": true,
1798
+ "referenceKind": "id",
1799
+ "notNull": true
1800
+ },
1801
+ "slug": {
1802
+ "type": "TEXT",
1803
+ "notNull": true
1804
+ },
1805
+ "context": {
1806
+ "type": "TEXT",
1807
+ "notNull": true,
1808
+ "default": ""
1809
+ },
1810
+ "created_at": {
1811
+ "type": "TIMESTAMP",
1812
+ "notNull": true,
1813
+ "default": "current_timestamp"
1814
+ },
1815
+ "updated_at": {
1816
+ "type": "TIMESTAMP",
1817
+ "notNull": true,
1818
+ "default": "current_timestamp"
1819
+ },
1820
+ "tenant_id": {
1821
+ "type": "UUID",
1822
+ "referenceKind": "tenantId",
1823
+ "notNull": false,
1824
+ "unique": false
1825
+ },
1826
+ "code": {
1827
+ "type": "TEXT",
1828
+ "notNull": true,
1829
+ "unique": false,
1830
+ "default": ""
1831
+ },
1832
+ "name": {
1833
+ "type": "TEXT",
1834
+ "notNull": true,
1835
+ "unique": false,
1836
+ "default": ""
1837
+ },
1838
+ "category": {
1839
+ "type": "TEXT",
1840
+ "notNull": false,
1841
+ "unique": false,
1842
+ "default": ""
1843
+ },
1844
+ "is_active": {
1845
+ "type": "BOOLEAN",
1846
+ "notNull": false,
1847
+ "unique": false,
1848
+ "default": true
1849
+ },
1850
+ "required_qualification_id": {
1851
+ "type": "UUID",
1852
+ "referenceKind": "crossPackageRef",
1853
+ "notNull": false,
1854
+ "unique": false
1855
+ }
1856
+ },
1857
+ "indexes": [
1858
+ {
1859
+ "name": "manufacturing_operations_code_tenant_id_idx",
1860
+ "columns": [
1861
+ "code",
1862
+ "tenant_id"
1863
+ ],
1864
+ "unique": true,
1865
+ "nullsNotDistinct": true
1866
+ },
1867
+ {
1868
+ "name": "manufacturing_operations_slug_context_idx",
1869
+ "columns": [
1870
+ "slug",
1871
+ "context"
1872
+ ]
1873
+ },
1874
+ {
1875
+ "name": "manufacturing_operations_tenant_id_created_at_idx",
1876
+ "columns": [
1877
+ "tenant_id",
1878
+ "created_at"
1879
+ ]
1880
+ },
1881
+ {
1882
+ "name": "manufacturing_operations_required_qualification_id_idx",
1883
+ "columns": [
1884
+ "required_qualification_id"
1885
+ ]
1886
+ }
1887
+ ],
1888
+ "version": "0b3134d6"
1889
+ },
1890
+ "importPath": "@happyvertical/smrt-manufacturing"
1891
+ },
1892
+ "@happyvertical/smrt-manufacturing:ProductionRun": {
1893
+ "name": "productionrun",
1894
+ "className": "ProductionRun",
1895
+ "qualifiedName": "@happyvertical/smrt-manufacturing:ProductionRun",
1896
+ "collection": "productionruns",
1897
+ "filePath": "/home/runner/work/smrt/smrt/packages/manufacturing/src/models/ProductionRun.ts",
1898
+ "packageName": "@happyvertical/smrt-manufacturing",
1899
+ "fields": {
1900
+ "tenantId": {
1901
+ "type": "text",
1902
+ "required": false,
1903
+ "_meta": {
1904
+ "sqlType": "UUID",
1905
+ "nullable": true,
1906
+ "__tenancy": {
1907
+ "isTenantIdField": true,
1908
+ "autoFilter": true,
1909
+ "required": false,
1910
+ "autoPopulate": true,
1911
+ "nullable": true,
1912
+ "mode": "optional",
1913
+ "field": "tenantId",
1914
+ "allowSuperAdminBypass": false
1915
+ }
1916
+ }
1917
+ },
1918
+ "bomId": {
1919
+ "type": "foreignKey",
1920
+ "required": true,
1921
+ "related": "BillOfMaterials",
1922
+ "_meta": {
1923
+ "required": true,
1924
+ "onDelete": "RESTRICT"
1925
+ }
1926
+ },
1927
+ "targetQty": {
1928
+ "type": "decimal",
1929
+ "required": false,
1930
+ "_meta": {}
1931
+ },
1932
+ "completedQty": {
1933
+ "type": "decimal",
1934
+ "required": false,
1935
+ "_meta": {}
1936
+ },
1937
+ "status": {
1938
+ "type": "text",
1939
+ "required": true,
1940
+ "default": "planned",
1941
+ "_meta": {
1942
+ "required": true
1943
+ }
1944
+ }
1945
+ },
1946
+ "methods": {
1947
+ "remainingQty": {
1948
+ "name": "remainingQty",
1949
+ "async": false,
1950
+ "parameters": [],
1951
+ "returnType": "number",
1952
+ "isStatic": false,
1953
+ "isPublic": true
1954
+ }
1955
+ },
1956
+ "decoratorConfig": {
1957
+ "tableName": "manufacturing_production_runs",
1958
+ "api": {
1959
+ "include": [
1960
+ "list",
1961
+ "get"
1962
+ ]
1963
+ },
1964
+ "mcp": {
1965
+ "include": [
1966
+ "list",
1967
+ "get"
1968
+ ]
1969
+ },
1970
+ "cli": {
1971
+ "include": [
1972
+ "list",
1973
+ "get"
1974
+ ]
1975
+ },
1976
+ "tenantScoped": {
1977
+ "mode": "optional"
1978
+ },
1979
+ "conflictColumns": [
1980
+ "tenant_id",
1981
+ "slug",
1982
+ "context"
1983
+ ]
1984
+ },
1985
+ "extends": "SmrtObject",
1986
+ "exportName": "ProductionRun",
1987
+ "collectionExportName": "ProductionRunCollection",
1988
+ "validationRules": [
1989
+ {
1990
+ "field": "bomId",
1991
+ "rule": "required",
1992
+ "fieldType": "foreignKey"
1993
+ },
1994
+ {
1995
+ "field": "status",
1996
+ "rule": "required",
1997
+ "fieldType": "text"
1998
+ }
1999
+ ],
2000
+ "schema": {
2001
+ "tableName": "manufacturing_production_runs",
2002
+ "ddl": "CREATE TABLE IF NOT EXISTS \"manufacturing_production_runs\" (\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 \"bom_id\" UUID NOT NULL,\n \"target_qty\" REAL,\n \"completed_qty\" REAL,\n \"status\" TEXT NOT NULL DEFAULT 'planned'\n);",
2003
+ "columns": {
2004
+ "id": {
2005
+ "type": "UUID",
2006
+ "primaryKey": true,
2007
+ "referenceKind": "id",
2008
+ "notNull": true
2009
+ },
2010
+ "slug": {
2011
+ "type": "TEXT",
2012
+ "notNull": true
2013
+ },
2014
+ "context": {
2015
+ "type": "TEXT",
2016
+ "notNull": true,
2017
+ "default": ""
2018
+ },
2019
+ "created_at": {
2020
+ "type": "TIMESTAMP",
2021
+ "notNull": true,
2022
+ "default": "current_timestamp"
2023
+ },
2024
+ "updated_at": {
2025
+ "type": "TIMESTAMP",
2026
+ "notNull": true,
2027
+ "default": "current_timestamp"
2028
+ },
2029
+ "tenant_id": {
2030
+ "type": "UUID",
2031
+ "referenceKind": "tenantId",
2032
+ "notNull": false,
2033
+ "unique": false
2034
+ },
2035
+ "bom_id": {
2036
+ "type": "UUID",
2037
+ "referenceKind": "foreignKey",
2038
+ "notNull": true,
2039
+ "unique": false,
2040
+ "foreignKey": {
2041
+ "table": "manufacturing_boms",
2042
+ "column": "id",
2043
+ "onDelete": "RESTRICT",
2044
+ "onUpdate": "CASCADE"
2045
+ }
2046
+ },
2047
+ "target_qty": {
2048
+ "type": "REAL",
2049
+ "notNull": false,
2050
+ "unique": false
2051
+ },
2052
+ "completed_qty": {
2053
+ "type": "REAL",
2054
+ "notNull": false,
2055
+ "unique": false
2056
+ },
2057
+ "status": {
2058
+ "type": "TEXT",
2059
+ "notNull": true,
2060
+ "unique": false,
2061
+ "default": "planned"
2062
+ }
2063
+ },
2064
+ "indexes": [
2065
+ {
2066
+ "name": "manufacturing_production_runs_slug_context_idx",
2067
+ "columns": [
2068
+ "tenant_id",
2069
+ "slug",
2070
+ "context"
2071
+ ],
2072
+ "unique": true,
2073
+ "nullsNotDistinct": true
2074
+ },
2075
+ {
2076
+ "name": "manufacturing_production_runs_tenant_id_created_at_idx",
2077
+ "columns": [
2078
+ "tenant_id",
2079
+ "created_at"
2080
+ ]
2081
+ },
2082
+ {
2083
+ "name": "manufacturing_production_runs_bom_id_idx",
2084
+ "columns": [
2085
+ "bom_id"
2086
+ ]
2087
+ }
2088
+ ],
2089
+ "version": "2ca8147d"
2090
+ },
2091
+ "importPath": "@happyvertical/smrt-manufacturing"
2092
+ },
2093
+ "@happyvertical/smrt-manufacturing:ProductionRunCompletion": {
2094
+ "name": "productionruncompletion",
2095
+ "className": "ProductionRunCompletion",
2096
+ "qualifiedName": "@happyvertical/smrt-manufacturing:ProductionRunCompletion",
2097
+ "collection": "productionruncompletions",
2098
+ "filePath": "/home/runner/work/smrt/smrt/packages/manufacturing/src/models/ProductionRunCompletion.ts",
2099
+ "packageName": "@happyvertical/smrt-manufacturing",
2100
+ "fields": {
2101
+ "tenantId": {
2102
+ "type": "text",
2103
+ "required": false,
2104
+ "_meta": {
2105
+ "sqlType": "UUID",
2106
+ "nullable": true,
2107
+ "__tenancy": {
2108
+ "isTenantIdField": true,
2109
+ "autoFilter": true,
2110
+ "required": false,
2111
+ "autoPopulate": true,
2112
+ "nullable": true,
2113
+ "mode": "optional",
2114
+ "field": "tenantId",
2115
+ "allowSuperAdminBypass": false
2116
+ }
2117
+ }
2118
+ },
2119
+ "runId": {
2120
+ "type": "foreignKey",
340
2121
  "required": true,
341
- "default": "",
2122
+ "related": "ProductionRun",
342
2123
  "_meta": {
343
- "required": true
2124
+ "required": true,
2125
+ "onDelete": "CASCADE"
344
2126
  }
345
2127
  },
346
- "version": {
347
- "type": "integer",
348
- "required": true,
349
- "default": 1,
350
- "_meta": {
351
- "required": true
352
- }
2128
+ "qty": {
2129
+ "type": "decimal",
2130
+ "required": false,
2131
+ "_meta": {}
353
2132
  },
354
- "effectiveDate": {
2133
+ "completedAt": {
355
2134
  "type": "datetime",
356
2135
  "required": false
357
- },
358
- "status": {
359
- "type": "text",
360
- "required": true,
361
- "default": "draft",
362
- "_meta": {
363
- "required": true
364
- }
365
- },
366
- "notes": {
367
- "type": "text",
368
- "required": false,
369
- "default": ""
370
- },
371
- "currency": {
372
- "type": "text",
373
- "required": false,
374
- "default": "USD"
375
2136
  }
376
2137
  },
377
2138
  "methods": {},
378
2139
  "decoratorConfig": {
379
- "tableName": "manufacturing_boms",
380
- "conflictColumns": [
381
- "product_id",
382
- "version",
383
- "tenant_id"
384
- ],
2140
+ "tableName": "manufacturing_production_run_completions",
385
2141
  "api": {
386
2142
  "include": [
387
2143
  "list",
388
- "get",
389
- "create",
390
- "update"
2144
+ "get"
391
2145
  ]
392
2146
  },
393
2147
  "mcp": {
@@ -396,34 +2150,34 @@
396
2150
  "get"
397
2151
  ]
398
2152
  },
399
- "cli": true,
2153
+ "cli": {
2154
+ "include": [
2155
+ "list",
2156
+ "get"
2157
+ ]
2158
+ },
400
2159
  "tenantScoped": {
401
2160
  "mode": "optional"
402
- }
2161
+ },
2162
+ "conflictColumns": [
2163
+ "tenant_id",
2164
+ "slug",
2165
+ "context"
2166
+ ]
403
2167
  },
404
2168
  "extends": "SmrtObject",
405
- "exportName": "BillOfMaterials",
406
- "collectionExportName": "BillOfMaterialsCollection",
2169
+ "exportName": "ProductionRunCompletion",
2170
+ "collectionExportName": "ProductionRunCompletionCollection",
407
2171
  "validationRules": [
408
2172
  {
409
- "field": "productId",
410
- "rule": "required",
411
- "fieldType": "text"
412
- },
413
- {
414
- "field": "version",
415
- "rule": "required",
416
- "fieldType": "integer"
417
- },
418
- {
419
- "field": "status",
2173
+ "field": "runId",
420
2174
  "rule": "required",
421
- "fieldType": "text"
2175
+ "fieldType": "foreignKey"
422
2176
  }
423
2177
  ],
424
2178
  "schema": {
425
- "tableName": "manufacturing_boms",
426
- "ddl": "CREATE TABLE IF NOT EXISTS \"manufacturing_boms\" (\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 \"product_id\" TEXT NOT NULL DEFAULT '',\n \"version\" INTEGER NOT NULL DEFAULT 1,\n \"effective_date\" TIMESTAMP,\n \"status\" TEXT NOT NULL DEFAULT 'draft',\n \"notes\" TEXT DEFAULT '',\n \"currency\" TEXT DEFAULT 'USD'\n);",
2179
+ "tableName": "manufacturing_production_run_completions",
2180
+ "ddl": "CREATE TABLE IF NOT EXISTS \"manufacturing_production_run_completions\" (\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 \"run_id\" UUID NOT NULL,\n \"qty\" REAL,\n \"completed_at\" TIMESTAMP\n);",
427
2181
  "columns": {
428
2182
  "id": {
429
2183
  "type": "UUID",
@@ -456,78 +2210,64 @@
456
2210
  "notNull": false,
457
2211
  "unique": false
458
2212
  },
459
- "product_id": {
460
- "type": "TEXT",
461
- "notNull": true,
462
- "unique": false,
463
- "default": ""
464
- },
465
- "version": {
466
- "type": "INTEGER",
2213
+ "run_id": {
2214
+ "type": "UUID",
2215
+ "referenceKind": "foreignKey",
467
2216
  "notNull": true,
468
2217
  "unique": false,
469
- "default": 1
2218
+ "foreignKey": {
2219
+ "table": "manufacturing_production_runs",
2220
+ "column": "id",
2221
+ "onDelete": "CASCADE",
2222
+ "onUpdate": "CASCADE"
2223
+ }
470
2224
  },
471
- "effective_date": {
472
- "type": "TIMESTAMP",
2225
+ "qty": {
2226
+ "type": "REAL",
473
2227
  "notNull": false,
474
2228
  "unique": false
475
2229
  },
476
- "status": {
477
- "type": "TEXT",
478
- "notNull": true,
479
- "unique": false,
480
- "default": "draft"
481
- },
482
- "notes": {
483
- "type": "TEXT",
484
- "notNull": false,
485
- "unique": false,
486
- "default": ""
487
- },
488
- "currency": {
489
- "type": "TEXT",
2230
+ "completed_at": {
2231
+ "type": "TIMESTAMP",
490
2232
  "notNull": false,
491
- "unique": false,
492
- "default": "USD"
2233
+ "unique": false
493
2234
  }
494
2235
  },
495
2236
  "indexes": [
496
2237
  {
497
- "name": "manufacturing_boms_product_id_version_idx",
2238
+ "name": "manufacturing_production_run_completions_slug_context_idx",
498
2239
  "columns": [
499
- "product_id",
500
- "version",
501
- "tenant_id"
2240
+ "tenant_id",
2241
+ "slug",
2242
+ "context"
502
2243
  ],
503
2244
  "unique": true,
504
2245
  "nullsNotDistinct": true
505
2246
  },
506
2247
  {
507
- "name": "manufacturing_boms_slug_context_idx",
2248
+ "name": "manufacturing_production_run_completions_tenant_ea7a0d0125_idx",
508
2249
  "columns": [
509
- "slug",
510
- "context"
2250
+ "tenant_id",
2251
+ "created_at"
511
2252
  ]
512
2253
  },
513
2254
  {
514
- "name": "manufacturing_boms_tenant_id_created_at_idx",
2255
+ "name": "manufacturing_production_run_completions_run_id_idx",
515
2256
  "columns": [
516
- "tenant_id",
517
- "created_at"
2257
+ "run_id"
518
2258
  ]
519
2259
  }
520
2260
  ],
521
- "version": "b2691adc"
2261
+ "version": "c940de6c"
522
2262
  },
523
2263
  "importPath": "@happyvertical/smrt-manufacturing"
524
2264
  },
525
- "@happyvertical/smrt-manufacturing:BomLine": {
526
- "name": "bomline",
527
- "className": "BomLine",
528
- "qualifiedName": "@happyvertical/smrt-manufacturing:BomLine",
529
- "collection": "bomlines",
530
- "filePath": "/home/runner/work/smrt/smrt/packages/manufacturing/src/models/BomLine.ts",
2265
+ "@happyvertical/smrt-manufacturing:RoutingStep": {
2266
+ "name": "routingstep",
2267
+ "className": "RoutingStep",
2268
+ "qualifiedName": "@happyvertical/smrt-manufacturing:RoutingStep",
2269
+ "collection": "routingsteps",
2270
+ "filePath": "/home/runner/work/smrt/smrt/packages/manufacturing/src/models/RoutingStep.ts",
531
2271
  "packageName": "@happyvertical/smrt-manufacturing",
532
2272
  "fields": {
533
2273
  "tenantId": {
@@ -549,32 +2289,32 @@
549
2289
  }
550
2290
  },
551
2291
  "bomId": {
552
- "type": "text",
2292
+ "type": "foreignKey",
553
2293
  "required": true,
554
- "default": "",
2294
+ "related": "BillOfMaterials",
555
2295
  "_meta": {
556
- "required": true
2296
+ "required": true,
2297
+ "onDelete": "CASCADE"
557
2298
  }
558
2299
  },
559
- "componentSkuId": {
560
- "type": "text",
2300
+ "operationId": {
2301
+ "type": "foreignKey",
561
2302
  "required": true,
562
- "default": "",
2303
+ "related": "Operation",
563
2304
  "_meta": {
564
- "required": true
2305
+ "required": true,
2306
+ "onDelete": "RESTRICT"
565
2307
  }
566
2308
  },
567
- "qtyPerUnit": {
568
- "type": "decimal",
569
- "required": false,
570
- "_meta": {}
571
- },
572
- "uom": {
573
- "type": "text",
574
- "required": false,
575
- "default": "each"
2309
+ "sequence": {
2310
+ "type": "integer",
2311
+ "required": true,
2312
+ "default": 1,
2313
+ "_meta": {
2314
+ "required": true
2315
+ }
576
2316
  },
577
- "wastePercent": {
2317
+ "estimatedMinutes": {
578
2318
  "type": "decimal",
579
2319
  "required": false,
580
2320
  "_meta": {}
@@ -585,29 +2325,18 @@
585
2325
  "default": ""
586
2326
  }
587
2327
  },
588
- "methods": {
589
- "effectiveQtyPerUnit": {
590
- "name": "effectiveQtyPerUnit",
591
- "async": false,
592
- "parameters": [],
593
- "returnType": "number",
594
- "isStatic": false,
595
- "isPublic": true
596
- }
597
- },
2328
+ "methods": {},
598
2329
  "decoratorConfig": {
599
- "tableName": "manufacturing_bom_lines",
2330
+ "tableName": "manufacturing_routing_steps",
600
2331
  "conflictColumns": [
601
2332
  "bom_id",
602
- "component_sku_id",
2333
+ "sequence",
603
2334
  "tenant_id"
604
2335
  ],
605
2336
  "api": {
606
2337
  "include": [
607
2338
  "list",
608
- "get",
609
- "create",
610
- "update"
2339
+ "get"
611
2340
  ]
612
2341
  },
613
2342
  "mcp": {
@@ -624,23 +2353,28 @@
624
2353
  }
625
2354
  },
626
2355
  "extends": "SmrtObject",
627
- "exportName": "BomLine",
628
- "collectionExportName": "BomLineCollection",
2356
+ "exportName": "RoutingStep",
2357
+ "collectionExportName": "RoutingStepCollection",
629
2358
  "validationRules": [
630
2359
  {
631
2360
  "field": "bomId",
632
2361
  "rule": "required",
633
- "fieldType": "text"
2362
+ "fieldType": "foreignKey"
634
2363
  },
635
2364
  {
636
- "field": "componentSkuId",
2365
+ "field": "operationId",
637
2366
  "rule": "required",
638
- "fieldType": "text"
2367
+ "fieldType": "foreignKey"
2368
+ },
2369
+ {
2370
+ "field": "sequence",
2371
+ "rule": "required",
2372
+ "fieldType": "integer"
639
2373
  }
640
2374
  ],
641
2375
  "schema": {
642
- "tableName": "manufacturing_bom_lines",
643
- "ddl": "CREATE TABLE IF NOT EXISTS \"manufacturing_bom_lines\" (\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 \"bom_id\" TEXT NOT NULL DEFAULT '',\n \"component_sku_id\" TEXT NOT NULL DEFAULT '',\n \"qty_per_unit\" REAL,\n \"uom\" TEXT DEFAULT 'each',\n \"waste_percent\" REAL,\n \"notes\" TEXT DEFAULT ''\n);",
2376
+ "tableName": "manufacturing_routing_steps",
2377
+ "ddl": "CREATE TABLE IF NOT EXISTS \"manufacturing_routing_steps\" (\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 \"bom_id\" UUID NOT NULL,\n \"operation_id\" UUID NOT NULL,\n \"sequence\" INTEGER NOT NULL DEFAULT 1,\n \"estimated_minutes\" REAL,\n \"notes\" TEXT DEFAULT ''\n);",
644
2378
  "columns": {
645
2379
  "id": {
646
2380
  "type": "UUID",
@@ -674,29 +2408,36 @@
674
2408
  "unique": false
675
2409
  },
676
2410
  "bom_id": {
677
- "type": "TEXT",
2411
+ "type": "UUID",
2412
+ "referenceKind": "foreignKey",
678
2413
  "notNull": true,
679
2414
  "unique": false,
680
- "default": ""
2415
+ "foreignKey": {
2416
+ "table": "manufacturing_boms",
2417
+ "column": "id",
2418
+ "onDelete": "CASCADE",
2419
+ "onUpdate": "CASCADE"
2420
+ }
681
2421
  },
682
- "component_sku_id": {
683
- "type": "TEXT",
2422
+ "operation_id": {
2423
+ "type": "UUID",
2424
+ "referenceKind": "foreignKey",
684
2425
  "notNull": true,
685
2426
  "unique": false,
686
- "default": ""
687
- },
688
- "qty_per_unit": {
689
- "type": "REAL",
690
- "notNull": false,
691
- "unique": false
2427
+ "foreignKey": {
2428
+ "table": "manufacturing_operations",
2429
+ "column": "id",
2430
+ "onDelete": "RESTRICT",
2431
+ "onUpdate": "CASCADE"
2432
+ }
692
2433
  },
693
- "uom": {
694
- "type": "TEXT",
695
- "notNull": false,
2434
+ "sequence": {
2435
+ "type": "INTEGER",
2436
+ "notNull": true,
696
2437
  "unique": false,
697
- "default": "each"
2438
+ "default": 1
698
2439
  },
699
- "waste_percent": {
2440
+ "estimated_minutes": {
700
2441
  "type": "REAL",
701
2442
  "notNull": false,
702
2443
  "unique": false
@@ -710,31 +2451,37 @@
710
2451
  },
711
2452
  "indexes": [
712
2453
  {
713
- "name": "manufacturing_bom_lines_bom_id_component_sku_id_idx",
2454
+ "name": "manufacturing_routing_steps_bom_id_sequence_idx",
714
2455
  "columns": [
715
2456
  "bom_id",
716
- "component_sku_id",
2457
+ "sequence",
717
2458
  "tenant_id"
718
2459
  ],
719
2460
  "unique": true,
720
2461
  "nullsNotDistinct": true
721
2462
  },
722
2463
  {
723
- "name": "manufacturing_bom_lines_slug_context_idx",
2464
+ "name": "manufacturing_routing_steps_slug_context_idx",
724
2465
  "columns": [
725
2466
  "slug",
726
2467
  "context"
727
2468
  ]
728
2469
  },
729
2470
  {
730
- "name": "manufacturing_bom_lines_tenant_id_created_at_idx",
2471
+ "name": "manufacturing_routing_steps_tenant_id_created_at_idx",
731
2472
  "columns": [
732
2473
  "tenant_id",
733
2474
  "created_at"
734
2475
  ]
2476
+ },
2477
+ {
2478
+ "name": "manufacturing_routing_steps_operation_id_idx",
2479
+ "columns": [
2480
+ "operation_id"
2481
+ ]
735
2482
  }
736
2483
  ],
737
- "version": "cfbae7e8"
2484
+ "version": "41ac3c66"
738
2485
  },
739
2486
  "importPath": "@happyvertical/smrt-manufacturing"
740
2487
  }
@@ -742,7 +2489,9 @@
742
2489
  "moduleType": "smrt",
743
2490
  "smrtDependencies": [
744
2491
  "@happyvertical/smrt-core",
2492
+ "@happyvertical/smrt-fields",
745
2493
  "@happyvertical/smrt-inventory",
2494
+ "@happyvertical/smrt-products",
746
2495
  "@happyvertical/smrt-tenancy"
747
2496
  ]
748
2497
  }