@happyvertical/smrt-manufacturing 0.57.33 → 0.57.35

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.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BomExplosionLimitError, BomNotFoundError, MAX_EXPLOSION_DEPTH, MAX_EXPLOSION_LINES, NoActiveBomForProductError } from "./types.js";
2
- import { ObjectRegistry, SmrtCollection, SmrtObject, ValidationError, crossPackageRef, field, foreignKey, resolveDatabase, smrt } from "@happyvertical/smrt-core";
2
+ import { ObjectRegistry, SmrtCollection, SmrtObject, SmrtRecipe, ValidationError, crossPackageRef, field, foreignKey, resolveDatabase, smrt } from "@happyvertical/smrt-core";
3
3
  import { ProductCollection, SkuCollection } from "@happyvertical/smrt-products/collections";
4
4
  import { Material, Product, ProductType } from "@happyvertical/smrt-products/models";
5
5
  import { TenantScoped, getCurrentTenant, tenantId, withTenant, withTenantGlobalRead } from "@happyvertical/smrt-tenancy";
@@ -18,7 +18,7 @@ var __exportAll = (all, no_symbols) => {
18
18
  };
19
19
  //#endregion
20
20
  //#region src/__smrt-register__.ts
21
- ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-manufacturing","packageVersion":"0.57.33","objects":{"@happyvertical/smrt-manufacturing:BillOfMaterialsCollection":{"name":"billofmaterialscollection","className":"BillOfMaterialsCollection","qualifiedName":"@happyvertical/smrt-manufacturing:BillOfMaterialsCollection","collection":"billofmaterialses","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/BillOfMaterialsCollection.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{},"methods":{"findByProduct":{"name":"findByProduct","async":true,"parameters":[{"name":"productId","type":"string","optional":false}],"returnType":"Promise<BillOfMaterials[]>","isStatic":false,"isPublic":true},"findActiveForProduct":{"name":"findActiveForProduct","async":true,"parameters":[{"name":"productId","type":"string","optional":false}],"returnType":"Promise<BillOfMaterials | null>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"BomStatus","optional":false}],"returnType":"Promise<BillOfMaterials[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_boms","api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"BillOfMaterials","exportName":"BillOfMaterialsCollection","collectionExportName":"BillOfMaterialsCollectionCollection","schema":{"tableName":"manufacturing_boms","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"product_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"version":{"type":"INTEGER","notNull":true,"unique":false,"default":1},"effective_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":true,"unique":false,"default":"draft"},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"}},"indexes":[{"name":"manufacturing_boms_product_id_version_idx","columns":["product_id","version","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_boms_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_boms_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"b2691adc"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:BomLineCollection":{"name":"bomlinecollection","className":"BomLineCollection","qualifiedName":"@happyvertical/smrt-manufacturing:BomLineCollection","collection":"bomlines","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/BomLineCollection.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{},"methods":{"findByBom":{"name":"findByBom","async":true,"parameters":[{"name":"bomId","type":"string","optional":false}],"returnType":"Promise<BomLine[]>","isStatic":false,"isPublic":true},"findByComponent":{"name":"findByComponent","async":true,"parameters":[{"name":"componentSkuId","type":"string","optional":false}],"returnType":"Promise<BomLine[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_bom_lines","api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"BomLine","exportName":"BomLineCollection","collectionExportName":"BomLineCollectionCollection","schema":{"tableName":"manufacturing_bom_lines","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"bom_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"component_sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"qty_per_unit":{"type":"REAL","notNull":false,"unique":false},"uom":{"type":"TEXT","notNull":false,"unique":false,"default":"each"},"waste_percent":{"type":"REAL","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"manufacturing_bom_lines_bom_id_component_sku_id_idx","columns":["bom_id","component_sku_id","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_bom_lines_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_bom_lines_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"cfbae7e8"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:OperationCollection":{"name":"operationcollection","className":"OperationCollection","qualifiedName":"@happyvertical/smrt-manufacturing:OperationCollection","collection":"operations","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/OperationCollection.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{},"methods":{"findByCode":{"name":"findByCode","async":true,"parameters":[{"name":"code","type":"string","optional":false}],"returnType":"Promise<Operation | null>","isStatic":false,"isPublic":true},"listOperations":{"name":"listOperations","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["boolean"]}],"returnType":"Promise<Operation[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_operations","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"Operation","exportName":"OperationCollection","collectionExportName":"OperationCollectionCollection","schema":{"tableName":"manufacturing_operations","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"code":{"type":"TEXT","notNull":true,"unique":false,"default":""},"name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"category":{"type":"TEXT","notNull":false,"unique":false,"default":""},"is_active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"required_qualification_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false}},"indexes":[{"name":"manufacturing_operations_code_tenant_id_idx","columns":["code","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_operations_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_operations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_operations_required_qualification_id_idx","columns":["required_qualification_id"]}],"version":"0b3134d6"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:ProductionRunCollection":{"name":"productionruncollection","className":"ProductionRunCollection","qualifiedName":"@happyvertical/smrt-manufacturing:ProductionRunCollection","collection":"productionruns","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/ProductionRunCollection.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{},"methods":{"findByBom":{"name":"findByBom","async":true,"parameters":[{"name":"bomId","type":"string","optional":false}],"returnType":"Promise<ProductionRun[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"ProductionRunStatus","optional":false}],"returnType":"Promise<ProductionRun[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_production_runs","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"ProductionRun","exportName":"ProductionRunCollection","collectionExportName":"ProductionRunCollectionCollection","schema":{"tableName":"manufacturing_production_runs","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"bom_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_boms","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"target_qty":{"type":"REAL","notNull":false,"unique":false},"completed_qty":{"type":"REAL","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":true,"unique":false,"default":"planned"}},"indexes":[{"name":"manufacturing_production_runs_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_production_runs_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_production_runs_bom_id_idx","columns":["bom_id"]}],"version":"2ca8147d"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:ProductionRunCompletionCollection":{"name":"productionruncompletioncollection","className":"ProductionRunCompletionCollection","qualifiedName":"@happyvertical/smrt-manufacturing:ProductionRunCompletionCollection","collection":"productionruncompletions","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/ProductionRunCompletionCollection.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{},"methods":{"findByRun":{"name":"findByRun","async":true,"parameters":[{"name":"runId","type":"string","optional":false}],"returnType":"Promise<ProductionRunCompletion[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_production_run_completions","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"ProductionRunCompletion","exportName":"ProductionRunCompletionCollection","collectionExportName":"ProductionRunCompletionCollectionCollection","schema":{"tableName":"manufacturing_production_run_completions","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"run_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_production_runs","column":"id","onDelete":"CASCADE","onUpdate":"CASCADE"}},"qty":{"type":"REAL","notNull":false,"unique":false},"completed_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"manufacturing_production_run_completions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_production_run_completions_tenant_ea7a0d0125_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_production_run_completions_run_id_idx","columns":["run_id"]}],"version":"c940de6c"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:RoutingStepCollection":{"name":"routingstepcollection","className":"RoutingStepCollection","qualifiedName":"@happyvertical/smrt-manufacturing:RoutingStepCollection","collection":"routingsteps","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/RoutingStepCollection.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{},"methods":{"findByBom":{"name":"findByBom","async":true,"parameters":[{"name":"bomId","type":"string","optional":false}],"returnType":"Promise<RoutingStep[]>","isStatic":false,"isPublic":true},"findByOperation":{"name":"findByOperation","async":true,"parameters":[{"name":"operationId","type":"string","optional":false}],"returnType":"Promise<RoutingStep[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_routing_steps","api":{"include":["list","get"]},"mcp":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"RoutingStep","exportName":"RoutingStepCollection","collectionExportName":"RoutingStepCollectionCollection","schema":{"tableName":"manufacturing_routing_steps","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"bom_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_boms","column":"id","onDelete":"CASCADE","onUpdate":"CASCADE"}},"operation_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_operations","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"sequence":{"type":"INTEGER","notNull":true,"unique":false,"default":1},"estimated_minutes":{"type":"REAL","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"manufacturing_routing_steps_bom_id_sequence_idx","columns":["bom_id","sequence","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_routing_steps_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_routing_steps_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_routing_steps_operation_id_idx","columns":["operation_id"]}],"version":"41ac3c66"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:Assembly":{"name":"assembly","className":"Assembly","qualifiedName":"@happyvertical/smrt-manufacturing:Assembly","collection":"products","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/models/Assembly.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"tenantId":{"type":"text","required":false,"_meta":{"generated":true,"source":"tenantScoped_decorator","sqlType":"UUID","__tenancy":{"isTenantIdField":true,"mode":"optional","field":"tenantId","autoFilter":true,"autoPopulate":true,"allowSuperAdminBypass":false}}},"productType":{"type":"json","required":false,"enum":["product","material","assembly"]},"name":{"type":"text","required":false,"description":"The product name, as customers see it.","_meta":{"description":"The product name, as customers see it."}},"description":{"type":"text","required":false,"description":"A few words on what the product is and who it is for.","_meta":{"description":"A few words on what the product is and who it is for."}},"category":{"type":"text","required":false},"manufacturer":{"type":"text","required":false},"model":{"type":"text","required":false},"price":{"type":"integer","required":true,"default":0,"description":"The price in minor units (cents), for example 1999 for 19.99.","_meta":{"description":"The price in minor units (cents), for example 1999 for 19.99."}},"defaultSalesTaxCodeId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-commerce:TaxCode","_meta":{"description":"The tax code normally used when this product is sold."}},"defaultPurchaseTaxCodeId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-commerce:TaxCode","_meta":{"description":"The tax code normally used when this product is purchased."}},"inStock":{"type":"boolean","required":true,"default":true},"specifications":{"type":"json","required":false,"default":{}},"tags":{"type":"json","required":false,"default":[]},"estimatedLabourMinutes":{"type":"integer","required":false,"default":0},"defaultOperationId":{"type":"foreignKey","required":false,"related":"Operation","_meta":{"nullable":true,"onDelete":"RESTRICT"}},"partReference":{"type":"text","required":false,"default":""}},"methods":{"getSpecification":{"name":"getSpecification","async":true,"parameters":[{"name":"key","type":"string","optional":false}],"returnType":"Promise<unknown>","isStatic":false,"isPublic":true},"updateSpecification":{"name":"updateSpecification","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"value","type":"unknown","optional":false}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"getAssets":{"name":"getAssets","async":true,"parameters":[{"name":"relationship","type":"string","optional":true}],"returnType":"Promise<Asset[]>","isStatic":false,"isPublic":true},"addAsset":{"name":"addAsset","async":true,"parameters":[{"name":"asset","type":"Asset","optional":false},{"name":"relationship","type":"any","optional":true,"default":"attachment"},{"name":"sortOrder","type":"any","optional":true}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"removeAsset":{"name":"removeAsset","async":true,"parameters":[{"name":"assetId","type":"string","optional":false},{"name":"relationship","type":"string","optional":true}],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"tableName":"products","tableStrategy":"sti"},"extends":"Product","extendsQualified":"@happyvertical/smrt-products:Product","exportName":"Assembly","collectionExportName":"AssemblyCollection","displayLabelField":"name","validationRules":[{"field":"price","rule":"required","fieldType":"integer"},{"field":"inStock","rule":"required","fieldType":"boolean"}],"schema":{"tableName":"products","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 \\"default_sales_tax_code_id\\" UUID,\\n \\"default_purchase_tax_code_id\\" UUID,\\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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false},"product_type":{"type":"TEXT","notNull":false},"name":{"type":"TEXT","notNull":false},"description":{"type":"TEXT","notNull":false},"category":{"type":"TEXT","notNull":false},"manufacturer":{"type":"TEXT","notNull":false},"model":{"type":"TEXT","notNull":false},"price":{"type":"INTEGER","notNull":false,"default":0},"default_sales_tax_code_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false},"default_purchase_tax_code_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false},"in_stock":{"type":"BOOLEAN","notNull":false,"default":true},"specifications":{"type":"JSON","notNull":false,"default":{}},"tags":{"type":"JSON","notNull":false,"default":[]},"estimated_labour_minutes":{"type":"INTEGER","notNull":false,"default":0},"default_operation_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"manufacturing_operations","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"part_reference":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"products_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"products_meta_type_idx","columns":["_meta_type"]},{"name":"products_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"products_default_sales_tax_code_id_idx","columns":["default_sales_tax_code_id"]},{"name":"products_default_purchase_tax_code_id_idx","columns":["default_purchase_tax_code_id"]},{"name":"products_default_operation_id_idx","columns":["default_operation_id"]}],"version":"e1a54866"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:BillOfMaterials":{"name":"billofmaterials","className":"BillOfMaterials","qualifiedName":"@happyvertical/smrt-manufacturing:BillOfMaterials","collection":"billofmaterialses","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/models/BillOfMaterials.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"productId":{"type":"text","required":true,"default":"","_meta":{"required":true}},"version":{"type":"integer","required":true,"default":1,"_meta":{"required":true}},"effectiveDate":{"type":"datetime","required":false},"status":{"type":"text","required":true,"default":"draft","_meta":{"required":true},"enum":["draft","active","superseded"]},"notes":{"type":"text","required":false,"default":""},"currency":{"type":"text","required":false,"default":"USD"}},"methods":{},"decoratorConfig":{"tableName":"manufacturing_boms","conflictColumns":["product_id","version","tenant_id"],"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":true,"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"BillOfMaterials","collectionExportName":"BillOfMaterialsCollection","validationRules":[{"field":"productId","rule":"required","fieldType":"text"},{"field":"version","rule":"required","fieldType":"integer"},{"field":"status","rule":"required","fieldType":"text"}],"schema":{"tableName":"manufacturing_boms","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"product_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"version":{"type":"INTEGER","notNull":true,"unique":false,"default":1},"effective_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":true,"unique":false,"default":"draft"},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"}},"indexes":[{"name":"manufacturing_boms_product_id_version_idx","columns":["product_id","version","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_boms_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_boms_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"b2691adc"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:BomLine":{"name":"bomline","className":"BomLine","qualifiedName":"@happyvertical/smrt-manufacturing:BomLine","collection":"bomlines","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/models/BomLine.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"bomId":{"type":"text","required":true,"default":"","_meta":{"required":true}},"componentSkuId":{"type":"text","required":true,"default":"","_meta":{"required":true}},"qtyPerUnit":{"type":"decimal","required":false,"_meta":{}},"uom":{"type":"text","required":false,"default":"each"},"wastePercent":{"type":"decimal","required":false,"_meta":{}},"notes":{"type":"text","required":false,"default":""}},"methods":{"effectiveQtyPerUnit":{"name":"effectiveQtyPerUnit","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_bom_lines","conflictColumns":["bom_id","component_sku_id","tenant_id"],"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"BomLine","collectionExportName":"BomLineCollection","validationRules":[{"field":"bomId","rule":"required","fieldType":"text"},{"field":"componentSkuId","rule":"required","fieldType":"text"}],"schema":{"tableName":"manufacturing_bom_lines","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"bom_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"component_sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"qty_per_unit":{"type":"REAL","notNull":false,"unique":false},"uom":{"type":"TEXT","notNull":false,"unique":false,"default":"each"},"waste_percent":{"type":"REAL","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"manufacturing_bom_lines_bom_id_component_sku_id_idx","columns":["bom_id","component_sku_id","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_bom_lines_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_bom_lines_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"cfbae7e8"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:Operation":{"name":"operation","className":"Operation","qualifiedName":"@happyvertical/smrt-manufacturing:Operation","collection":"operations","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/models/Operation.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"code":{"type":"text","required":true,"default":"","_meta":{"required":true}},"name":{"type":"text","required":true,"default":"","_meta":{"required":true}},"category":{"type":"text","required":false,"default":""},"isActive":{"type":"boolean","required":false,"default":true},"requiredQualificationId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-human-resources:Qualification","_meta":{"nullable":true}}},"methods":{"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_operations","conflictColumns":["code","tenant_id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"Operation","collectionExportName":"OperationCollection","displayLabelField":"name","validationRules":[{"field":"code","rule":"required","fieldType":"text"},{"field":"name","rule":"required","fieldType":"text"}],"schema":{"tableName":"manufacturing_operations","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"code":{"type":"TEXT","notNull":true,"unique":false,"default":""},"name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"category":{"type":"TEXT","notNull":false,"unique":false,"default":""},"is_active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"required_qualification_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false}},"indexes":[{"name":"manufacturing_operations_code_tenant_id_idx","columns":["code","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_operations_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_operations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_operations_required_qualification_id_idx","columns":["required_qualification_id"]}],"version":"0b3134d6"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:ProductionRun":{"name":"productionrun","className":"ProductionRun","qualifiedName":"@happyvertical/smrt-manufacturing:ProductionRun","collection":"productionruns","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/models/ProductionRun.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"bomId":{"type":"foreignKey","required":true,"related":"BillOfMaterials","_meta":{"required":true,"onDelete":"RESTRICT"}},"targetQty":{"type":"decimal","required":false,"_meta":{}},"completedQty":{"type":"decimal","required":false,"_meta":{}},"status":{"type":"text","required":true,"default":"planned","_meta":{"required":true},"enum":["planned","in_progress","done","cancelled"]}},"methods":{"remainingQty":{"name":"remainingQty","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_production_runs","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"ProductionRun","collectionExportName":"ProductionRunCollection","validationRules":[{"field":"bomId","rule":"required","fieldType":"foreignKey"},{"field":"status","rule":"required","fieldType":"text"}],"schema":{"tableName":"manufacturing_production_runs","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"bom_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_boms","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"target_qty":{"type":"REAL","notNull":false,"unique":false},"completed_qty":{"type":"REAL","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":true,"unique":false,"default":"planned"}},"indexes":[{"name":"manufacturing_production_runs_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_production_runs_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_production_runs_bom_id_idx","columns":["bom_id"]}],"version":"2ca8147d"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:ProductionRunCompletion":{"name":"productionruncompletion","className":"ProductionRunCompletion","qualifiedName":"@happyvertical/smrt-manufacturing:ProductionRunCompletion","collection":"productionruncompletions","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/models/ProductionRunCompletion.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"runId":{"type":"foreignKey","required":true,"related":"ProductionRun","_meta":{"required":true,"onDelete":"CASCADE"}},"qty":{"type":"decimal","required":false,"_meta":{}},"completedAt":{"type":"datetime","required":false}},"methods":{},"decoratorConfig":{"tableName":"manufacturing_production_run_completions","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"ProductionRunCompletion","collectionExportName":"ProductionRunCompletionCollection","validationRules":[{"field":"runId","rule":"required","fieldType":"foreignKey"}],"schema":{"tableName":"manufacturing_production_run_completions","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"run_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_production_runs","column":"id","onDelete":"CASCADE","onUpdate":"CASCADE"}},"qty":{"type":"REAL","notNull":false,"unique":false},"completed_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"manufacturing_production_run_completions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_production_run_completions_tenant_ea7a0d0125_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_production_run_completions_run_id_idx","columns":["run_id"]}],"version":"c940de6c"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:RoutingStep":{"name":"routingstep","className":"RoutingStep","qualifiedName":"@happyvertical/smrt-manufacturing:RoutingStep","collection":"routingsteps","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/models/RoutingStep.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"bomId":{"type":"foreignKey","required":true,"related":"BillOfMaterials","_meta":{"required":true,"onDelete":"CASCADE"}},"operationId":{"type":"foreignKey","required":true,"related":"Operation","_meta":{"required":true,"onDelete":"RESTRICT"}},"sequence":{"type":"integer","required":true,"default":1,"_meta":{"required":true}},"estimatedMinutes":{"type":"decimal","required":false,"_meta":{}},"notes":{"type":"text","required":false,"default":""}},"methods":{},"decoratorConfig":{"tableName":"manufacturing_routing_steps","conflictColumns":["bom_id","sequence","tenant_id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"RoutingStep","collectionExportName":"RoutingStepCollection","validationRules":[{"field":"bomId","rule":"required","fieldType":"foreignKey"},{"field":"operationId","rule":"required","fieldType":"foreignKey"},{"field":"sequence","rule":"required","fieldType":"integer"}],"schema":{"tableName":"manufacturing_routing_steps","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"bom_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_boms","column":"id","onDelete":"CASCADE","onUpdate":"CASCADE"}},"operation_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_operations","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"sequence":{"type":"INTEGER","notNull":true,"unique":false,"default":1},"estimated_minutes":{"type":"REAL","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"manufacturing_routing_steps_bom_id_sequence_idx","columns":["bom_id","sequence","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_routing_steps_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_routing_steps_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_routing_steps_operation_id_idx","columns":["operation_id"]}],"version":"41ac3c66"},"importPath":"@happyvertical/smrt-manufacturing"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-inventory","@happyvertical/smrt-products","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3616","#3624","#3626"],"via":["@happyvertical/smrt-products","@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
21
+ ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-manufacturing","packageVersion":"0.57.35","objects":{"@happyvertical/smrt-manufacturing:BillOfMaterialsCollection":{"name":"billofmaterialscollection","className":"BillOfMaterialsCollection","qualifiedName":"@happyvertical/smrt-manufacturing:BillOfMaterialsCollection","collection":"billofmaterialses","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/BillOfMaterialsCollection.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{},"methods":{"findByProduct":{"name":"findByProduct","async":true,"parameters":[{"name":"productId","type":"string","optional":false}],"returnType":"Promise<BillOfMaterials[]>","isStatic":false,"isPublic":true},"findActiveForProduct":{"name":"findActiveForProduct","async":true,"parameters":[{"name":"productId","type":"string","optional":false}],"returnType":"Promise<BillOfMaterials | null>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"BomStatus","optional":false}],"returnType":"Promise<BillOfMaterials[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_boms","api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"BillOfMaterials","exportName":"BillOfMaterialsCollection","collectionExportName":"BillOfMaterialsCollectionCollection","schema":{"tableName":"manufacturing_boms","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"product_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"version":{"type":"INTEGER","notNull":true,"unique":false,"default":1},"effective_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":true,"unique":false,"default":"draft"},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"}},"indexes":[{"name":"manufacturing_boms_product_id_version_idx","columns":["product_id","version","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_boms_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_boms_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"b2691adc"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:BomLineCollection":{"name":"bomlinecollection","className":"BomLineCollection","qualifiedName":"@happyvertical/smrt-manufacturing:BomLineCollection","collection":"bomlines","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/BomLineCollection.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{},"methods":{"findByBom":{"name":"findByBom","async":true,"parameters":[{"name":"bomId","type":"string","optional":false}],"returnType":"Promise<BomLine[]>","isStatic":false,"isPublic":true},"findByComponent":{"name":"findByComponent","async":true,"parameters":[{"name":"componentSkuId","type":"string","optional":false}],"returnType":"Promise<BomLine[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_bom_lines","api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"BomLine","exportName":"BomLineCollection","collectionExportName":"BomLineCollectionCollection","schema":{"tableName":"manufacturing_bom_lines","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"bom_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"component_sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"qty_per_unit":{"type":"REAL","notNull":false,"unique":false},"uom":{"type":"TEXT","notNull":false,"unique":false,"default":"each"},"waste_percent":{"type":"REAL","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"manufacturing_bom_lines_bom_id_component_sku_id_idx","columns":["bom_id","component_sku_id","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_bom_lines_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_bom_lines_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"cfbae7e8"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:OperationCollection":{"name":"operationcollection","className":"OperationCollection","qualifiedName":"@happyvertical/smrt-manufacturing:OperationCollection","collection":"operations","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/OperationCollection.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{},"methods":{"findByCode":{"name":"findByCode","async":true,"parameters":[{"name":"code","type":"string","optional":false}],"returnType":"Promise<Operation | null>","isStatic":false,"isPublic":true},"listOperations":{"name":"listOperations","async":true,"parameters":[{"name":"options","type":"object","optional":true,"memberTypes":["boolean"]}],"returnType":"Promise<Operation[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_operations","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"Operation","exportName":"OperationCollection","collectionExportName":"OperationCollectionCollection","schema":{"tableName":"manufacturing_operations","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"code":{"type":"TEXT","notNull":true,"unique":false,"default":""},"name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"category":{"type":"TEXT","notNull":false,"unique":false,"default":""},"is_active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"required_qualification_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false}},"indexes":[{"name":"manufacturing_operations_code_tenant_id_idx","columns":["code","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_operations_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_operations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_operations_required_qualification_id_idx","columns":["required_qualification_id"]}],"version":"0b3134d6"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:ProductionRunCollection":{"name":"productionruncollection","className":"ProductionRunCollection","qualifiedName":"@happyvertical/smrt-manufacturing:ProductionRunCollection","collection":"productionruns","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/ProductionRunCollection.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{},"methods":{"findByBom":{"name":"findByBom","async":true,"parameters":[{"name":"bomId","type":"string","optional":false}],"returnType":"Promise<ProductionRun[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"ProductionRunStatus","optional":false}],"returnType":"Promise<ProductionRun[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_production_runs","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"ProductionRun","exportName":"ProductionRunCollection","collectionExportName":"ProductionRunCollectionCollection","schema":{"tableName":"manufacturing_production_runs","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"bom_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_boms","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"target_qty":{"type":"REAL","notNull":false,"unique":false},"completed_qty":{"type":"REAL","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":true,"unique":false,"default":"planned"}},"indexes":[{"name":"manufacturing_production_runs_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_production_runs_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_production_runs_bom_id_idx","columns":["bom_id"]}],"version":"2ca8147d"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:ProductionRunCompletionCollection":{"name":"productionruncompletioncollection","className":"ProductionRunCompletionCollection","qualifiedName":"@happyvertical/smrt-manufacturing:ProductionRunCompletionCollection","collection":"productionruncompletions","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/ProductionRunCompletionCollection.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{},"methods":{"findByRun":{"name":"findByRun","async":true,"parameters":[{"name":"runId","type":"string","optional":false}],"returnType":"Promise<ProductionRunCompletion[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_production_run_completions","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"ProductionRunCompletion","exportName":"ProductionRunCompletionCollection","collectionExportName":"ProductionRunCompletionCollectionCollection","schema":{"tableName":"manufacturing_production_run_completions","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"run_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_production_runs","column":"id","onDelete":"CASCADE","onUpdate":"CASCADE"}},"qty":{"type":"REAL","notNull":false,"unique":false},"completed_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"manufacturing_production_run_completions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_production_run_completions_tenant_ea7a0d0125_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_production_run_completions_run_id_idx","columns":["run_id"]}],"version":"c940de6c"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:RoutingStepCollection":{"name":"routingstepcollection","className":"RoutingStepCollection","qualifiedName":"@happyvertical/smrt-manufacturing:RoutingStepCollection","collection":"routingsteps","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/collections/RoutingStepCollection.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{},"methods":{"findByBom":{"name":"findByBom","async":true,"parameters":[{"name":"bomId","type":"string","optional":false}],"returnType":"Promise<RoutingStep[]>","isStatic":false,"isPublic":true},"findByOperation":{"name":"findByOperation","async":true,"parameters":[{"name":"operationId","type":"string","optional":false}],"returnType":"Promise<RoutingStep[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_routing_steps","api":{"include":["list","get"]},"mcp":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"RoutingStep","exportName":"RoutingStepCollection","collectionExportName":"RoutingStepCollectionCollection","schema":{"tableName":"manufacturing_routing_steps","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"bom_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_boms","column":"id","onDelete":"CASCADE","onUpdate":"CASCADE"}},"operation_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_operations","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"sequence":{"type":"INTEGER","notNull":true,"unique":false,"default":1},"estimated_minutes":{"type":"REAL","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"manufacturing_routing_steps_bom_id_sequence_idx","columns":["bom_id","sequence","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_routing_steps_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_routing_steps_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_routing_steps_operation_id_idx","columns":["operation_id"]}],"version":"41ac3c66"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:Assembly":{"name":"assembly","className":"Assembly","qualifiedName":"@happyvertical/smrt-manufacturing:Assembly","collection":"products","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/models/Assembly.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"tenantId":{"type":"text","required":false,"_meta":{"generated":true,"source":"tenantScoped_decorator","sqlType":"UUID","__tenancy":{"isTenantIdField":true,"mode":"optional","field":"tenantId","autoFilter":true,"autoPopulate":true,"allowSuperAdminBypass":false}}},"productType":{"type":"json","required":false,"enum":["product","material","assembly"]},"name":{"type":"text","required":false,"description":"The product name, as customers see it.","_meta":{"description":"The product name, as customers see it."}},"description":{"type":"text","required":false,"description":"A few words on what the product is and who it is for.","_meta":{"description":"A few words on what the product is and who it is for."}},"category":{"type":"text","required":false},"manufacturer":{"type":"text","required":false},"model":{"type":"text","required":false},"price":{"type":"integer","required":true,"default":0,"description":"The price in minor units (cents), for example 1999 for 19.99.","_meta":{"description":"The price in minor units (cents), for example 1999 for 19.99."}},"defaultSalesTaxCodeId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-commerce:TaxCode","_meta":{"description":"The tax code normally used when this product is sold."}},"defaultPurchaseTaxCodeId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-commerce:TaxCode","_meta":{"description":"The tax code normally used when this product is purchased."}},"inStock":{"type":"boolean","required":true,"default":true},"specifications":{"type":"json","required":false,"default":{}},"tags":{"type":"json","required":false,"default":[]},"estimatedLabourMinutes":{"type":"integer","required":false,"default":0,"description":"About how many minutes it takes to make one.","_meta":{"description":"About how many minutes it takes to make one."}},"defaultOperationId":{"type":"foreignKey","required":false,"related":"Operation","description":"The kind of work usually booked to this assembly.","_meta":{"description":"The kind of work usually booked to this assembly.","nullable":true,"onDelete":"RESTRICT"}},"partReference":{"type":"text","required":false,"default":"","description":"Your own drawing or part number for this assembly.","_meta":{"description":"Your own drawing or part number for this assembly."}}},"methods":{"getSpecification":{"name":"getSpecification","async":true,"parameters":[{"name":"key","type":"string","optional":false}],"returnType":"Promise<unknown>","isStatic":false,"isPublic":true},"updateSpecification":{"name":"updateSpecification","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"value","type":"unknown","optional":false}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"getAssets":{"name":"getAssets","async":true,"parameters":[{"name":"relationship","type":"string","optional":true}],"returnType":"Promise<Asset[]>","isStatic":false,"isPublic":true},"addAsset":{"name":"addAsset","async":true,"parameters":[{"name":"asset","type":"Asset","optional":false},{"name":"relationship","type":"any","optional":true,"default":"attachment"},{"name":"sortOrder","type":"any","optional":true}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"removeAsset":{"name":"removeAsset","async":true,"parameters":[{"name":"assetId","type":"string","optional":false},{"name":"relationship","type":"string","optional":true}],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"tableName":"products","tableStrategy":"sti"},"extends":"Product","extendsQualified":"@happyvertical/smrt-products:Product","exportName":"Assembly","collectionExportName":"AssemblyCollection","displayLabelField":"name","validationRules":[{"field":"price","rule":"required","fieldType":"integer"},{"field":"inStock","rule":"required","fieldType":"boolean"}],"schema":{"tableName":"products","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 \\"default_sales_tax_code_id\\" UUID,\\n \\"default_purchase_tax_code_id\\" UUID,\\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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false},"product_type":{"type":"TEXT","notNull":false},"name":{"type":"TEXT","notNull":false},"description":{"type":"TEXT","notNull":false},"category":{"type":"TEXT","notNull":false},"manufacturer":{"type":"TEXT","notNull":false},"model":{"type":"TEXT","notNull":false},"price":{"type":"INTEGER","notNull":false,"default":0},"default_sales_tax_code_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false},"default_purchase_tax_code_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false},"in_stock":{"type":"BOOLEAN","notNull":false,"default":true},"specifications":{"type":"JSON","notNull":false,"default":{}},"tags":{"type":"JSON","notNull":false,"default":[]},"estimated_labour_minutes":{"type":"INTEGER","notNull":false,"default":0},"default_operation_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"manufacturing_operations","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"part_reference":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"products_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"products_meta_type_idx","columns":["_meta_type"]},{"name":"products_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"products_default_sales_tax_code_id_idx","columns":["default_sales_tax_code_id"]},{"name":"products_default_purchase_tax_code_id_idx","columns":["default_purchase_tax_code_id"]},{"name":"products_default_operation_id_idx","columns":["default_operation_id"]}],"version":"e1a54866"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:BillOfMaterials":{"name":"billofmaterials","className":"BillOfMaterials","qualifiedName":"@happyvertical/smrt-manufacturing:BillOfMaterials","collection":"billofmaterialses","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/models/BillOfMaterials.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"productId":{"type":"text","required":true,"default":"","description":"The assembly this list of parts is for.","_meta":{"required":true,"description":"The assembly this list of parts is for."}},"version":{"type":"integer","required":true,"default":1,"description":"The revision number, so you can change a list and keep the old one.","_meta":{"required":true,"description":"The revision number, so you can change a list and keep the old one."}},"effectiveDate":{"type":"datetime","required":false,"description":"The day this list starts to be used.","_meta":{"description":"The day this list starts to be used."}},"status":{"type":"text","required":true,"default":"draft","description":"Whether this list is a draft, in use or retired.","_meta":{"required":true,"description":"Whether this list is a draft, in use or retired."},"enum":["draft","active","superseded"]},"notes":{"type":"text","required":false,"default":"","description":"Anything people making it should know.","_meta":{"description":"Anything people making it should know."}},"currency":{"type":"text","required":false,"default":"USD"}},"methods":{},"decoratorConfig":{"tableName":"manufacturing_boms","conflictColumns":["product_id","version","tenant_id"],"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":true,"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"BillOfMaterials","collectionExportName":"BillOfMaterialsCollection","validationRules":[{"field":"productId","rule":"required","fieldType":"text"},{"field":"version","rule":"required","fieldType":"integer"},{"field":"status","rule":"required","fieldType":"text"}],"schema":{"tableName":"manufacturing_boms","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"product_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"version":{"type":"INTEGER","notNull":true,"unique":false,"default":1},"effective_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":true,"unique":false,"default":"draft"},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"}},"indexes":[{"name":"manufacturing_boms_product_id_version_idx","columns":["product_id","version","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_boms_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_boms_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"b2691adc"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:BomLine":{"name":"bomline","className":"BomLine","qualifiedName":"@happyvertical/smrt-manufacturing:BomLine","collection":"bomlines","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/models/BomLine.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"bomId":{"type":"text","required":true,"default":"","description":"The list of parts this line belongs to.","_meta":{"required":true,"description":"The list of parts this line belongs to."}},"componentSkuId":{"type":"text","required":true,"default":"","description":"The part that goes into the assembly.","_meta":{"required":true,"description":"The part that goes into the assembly."}},"qtyPerUnit":{"type":"decimal","required":false,"description":"How much of this part goes into one unit.","_meta":{"description":"How much of this part goes into one unit."}},"uom":{"type":"text","required":false,"default":"each","description":"What the amount is counted in, such as each or kilograms.","_meta":{"description":"What the amount is counted in, such as each or kilograms."}},"wastePercent":{"type":"decimal","required":false,"_meta":{}},"notes":{"type":"text","required":false,"default":""}},"methods":{"effectiveQtyPerUnit":{"name":"effectiveQtyPerUnit","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_bom_lines","conflictColumns":["bom_id","component_sku_id","tenant_id"],"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"BomLine","collectionExportName":"BomLineCollection","validationRules":[{"field":"bomId","rule":"required","fieldType":"text"},{"field":"componentSkuId","rule":"required","fieldType":"text"}],"schema":{"tableName":"manufacturing_bom_lines","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"bom_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"component_sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"qty_per_unit":{"type":"REAL","notNull":false,"unique":false},"uom":{"type":"TEXT","notNull":false,"unique":false,"default":"each"},"waste_percent":{"type":"REAL","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"manufacturing_bom_lines_bom_id_component_sku_id_idx","columns":["bom_id","component_sku_id","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_bom_lines_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_bom_lines_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"cfbae7e8"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:Operation":{"name":"operation","className":"Operation","qualifiedName":"@happyvertical/smrt-manufacturing:Operation","collection":"operations","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/models/Operation.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"code":{"type":"text","required":true,"default":"","description":"A short code for this kind of work.","_meta":{"required":true,"description":"A short code for this kind of work."}},"name":{"type":"text","required":true,"default":"","description":"What this kind of work is called, such as cutting.","_meta":{"required":true,"description":"What this kind of work is called, such as cutting."}},"category":{"type":"text","required":false,"default":"","description":"A group to sort similar work together.","_meta":{"description":"A group to sort similar work together."}},"isActive":{"type":"boolean","required":false,"default":true},"requiredQualificationId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-human-resources:Qualification","_meta":{"nullable":true}}},"methods":{"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_operations","conflictColumns":["code","tenant_id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"Operation","collectionExportName":"OperationCollection","displayLabelField":"name","validationRules":[{"field":"code","rule":"required","fieldType":"text"},{"field":"name","rule":"required","fieldType":"text"}],"schema":{"tableName":"manufacturing_operations","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"code":{"type":"TEXT","notNull":true,"unique":false,"default":""},"name":{"type":"TEXT","notNull":true,"unique":false,"default":""},"category":{"type":"TEXT","notNull":false,"unique":false,"default":""},"is_active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"required_qualification_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false}},"indexes":[{"name":"manufacturing_operations_code_tenant_id_idx","columns":["code","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_operations_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_operations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_operations_required_qualification_id_idx","columns":["required_qualification_id"]}],"version":"0b3134d6"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:ProductionRun":{"name":"productionrun","className":"ProductionRun","qualifiedName":"@happyvertical/smrt-manufacturing:ProductionRun","collection":"productionruns","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/models/ProductionRun.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"bomId":{"type":"foreignKey","required":true,"related":"BillOfMaterials","description":"The list of parts this run makes from.","_meta":{"description":"The list of parts this run makes from.","required":true,"onDelete":"RESTRICT"}},"targetQty":{"type":"decimal","required":false,"description":"How many you plan to make.","_meta":{"description":"How many you plan to make."}},"completedQty":{"type":"decimal","required":false,"description":"How many have been finished so far.","_meta":{"description":"How many have been finished so far."}},"status":{"type":"text","required":true,"default":"planned","description":"Whether the run is planned, under way, done or cancelled.","_meta":{"required":true,"description":"Whether the run is planned, under way, done or cancelled."},"enum":["planned","in_progress","done","cancelled"]}},"methods":{"remainingQty":{"name":"remainingQty","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"manufacturing_production_runs","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"ProductionRun","collectionExportName":"ProductionRunCollection","validationRules":[{"field":"bomId","rule":"required","fieldType":"foreignKey"},{"field":"status","rule":"required","fieldType":"text"}],"schema":{"tableName":"manufacturing_production_runs","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"bom_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_boms","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"target_qty":{"type":"REAL","notNull":false,"unique":false},"completed_qty":{"type":"REAL","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":true,"unique":false,"default":"planned"}},"indexes":[{"name":"manufacturing_production_runs_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_production_runs_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_production_runs_bom_id_idx","columns":["bom_id"]}],"version":"2ca8147d"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:ProductionRunCompletion":{"name":"productionruncompletion","className":"ProductionRunCompletion","qualifiedName":"@happyvertical/smrt-manufacturing:ProductionRunCompletion","collection":"productionruncompletions","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/models/ProductionRunCompletion.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"runId":{"type":"foreignKey","required":true,"related":"ProductionRun","description":"The production run this batch belongs to.","_meta":{"description":"The production run this batch belongs to.","required":true,"onDelete":"CASCADE"}},"qty":{"type":"decimal","required":false,"description":"How many were finished in this batch.","_meta":{"description":"How many were finished in this batch."}},"completedAt":{"type":"datetime","required":false,"description":"When this batch was finished.","_meta":{"description":"When this batch was finished."}}},"methods":{},"decoratorConfig":{"tableName":"manufacturing_production_run_completions","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"ProductionRunCompletion","collectionExportName":"ProductionRunCompletionCollection","validationRules":[{"field":"runId","rule":"required","fieldType":"foreignKey"}],"schema":{"tableName":"manufacturing_production_run_completions","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"run_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_production_runs","column":"id","onDelete":"CASCADE","onUpdate":"CASCADE"}},"qty":{"type":"REAL","notNull":false,"unique":false},"completed_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"manufacturing_production_run_completions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_production_run_completions_tenant_ea7a0d0125_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_production_run_completions_run_id_idx","columns":["run_id"]}],"version":"c940de6c"},"importPath":"@happyvertical/smrt-manufacturing"},"@happyvertical/smrt-manufacturing:RoutingStep":{"name":"routingstep","className":"RoutingStep","qualifiedName":"@happyvertical/smrt-manufacturing:RoutingStep","collection":"routingsteps","filePath":"/home/runner/work/smrt/smrt/packages/manufacturing/src/models/RoutingStep.ts","packageName":"@happyvertical/smrt-manufacturing","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"bomId":{"type":"foreignKey","required":true,"related":"BillOfMaterials","description":"The list of parts this step is part of.","_meta":{"description":"The list of parts this step is part of.","required":true,"onDelete":"CASCADE"}},"operationId":{"type":"foreignKey","required":true,"related":"Operation","description":"The kind of work done in this step.","_meta":{"description":"The kind of work done in this step.","required":true,"onDelete":"RESTRICT"}},"sequence":{"type":"integer","required":true,"default":1,"description":"The order of this step, starting at 1.","_meta":{"required":true,"description":"The order of this step, starting at 1."}},"estimatedMinutes":{"type":"decimal","required":false,"description":"About how many minutes this step takes.","_meta":{"description":"About how many minutes this step takes."}},"notes":{"type":"text","required":false,"default":""}},"methods":{},"decoratorConfig":{"tableName":"manufacturing_routing_steps","conflictColumns":["bom_id","sequence","tenant_id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"RoutingStep","collectionExportName":"RoutingStepCollection","validationRules":[{"field":"bomId","rule":"required","fieldType":"foreignKey"},{"field":"operationId","rule":"required","fieldType":"foreignKey"},{"field":"sequence","rule":"required","fieldType":"integer"}],"schema":{"tableName":"manufacturing_routing_steps","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);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"bom_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_boms","column":"id","onDelete":"CASCADE","onUpdate":"CASCADE"}},"operation_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"manufacturing_operations","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"sequence":{"type":"INTEGER","notNull":true,"unique":false,"default":1},"estimated_minutes":{"type":"REAL","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"manufacturing_routing_steps_bom_id_sequence_idx","columns":["bom_id","sequence","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"manufacturing_routing_steps_slug_context_idx","columns":["slug","context"]},{"name":"manufacturing_routing_steps_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"manufacturing_routing_steps_operation_id_idx","columns":["operation_id"]}],"version":"41ac3c66"},"importPath":"@happyvertical/smrt-manufacturing"}},"moduleType":"smrt","recipes":[{"id":"manufacturing.assemblies","className":"AssembliesRecipe","label":"Assemblies","summary":"Define what you make, what goes into it and the steps to make it.","synonyms":["bill of materials","bills of materials","bom","recipes","products you make","routing"],"models":["@happyvertical/smrt-manufacturing:Assembly","@happyvertical/smrt-manufacturing:BillOfMaterials","@happyvertical/smrt-manufacturing:BomLine","@happyvertical/smrt-manufacturing:Operation","@happyvertical/smrt-manufacturing:RoutingStep"],"nav":[{"label":"Assemblies","model":"@happyvertical/smrt-manufacturing:Assembly","icon":"package","description":"The things you make, each built from parts.","noun":"assembly"},{"label":"Bills of materials","model":"@happyvertical/smrt-manufacturing:BillOfMaterials","icon":"fileText","description":"The list of parts and amounts that go into each assembly.","noun":"bill of materials"},{"label":"Operations","model":"@happyvertical/smrt-manufacturing:Operation","icon":"wrench","description":"The kinds of work done to make something, like cutting."}],"requires":[],"requiresAny":[["products.simple","products.clothing"]],"section":{"id":"make","label":"Make","icon":"wrench","description":"Make what you sell from the parts you hold."},"options":{"@happyvertical/smrt-manufacturing:Assembly":{"fields":{"name":{"order":1},"partReference":{"order":2},"description":{"order":3},"price":{"order":4},"estimatedLabourMinutes":{"label":"Minutes to make one","order":5},"defaultOperationId":{"label":"Usual operation","order":6},"tenantId":{"visibility":"hidden"},"productType":{"visibility":"hidden"},"category":{"visibility":"advanced"},"manufacturer":{"visibility":"hidden"},"model":{"visibility":"hidden"},"inStock":{"visibility":"hidden","default":true},"specifications":{"visibility":"hidden"},"tags":{"visibility":"advanced"},"defaultSalesTaxCodeId":{"visibility":"hidden"},"defaultPurchaseTaxCodeId":{"visibility":"hidden"}}},"@happyvertical/smrt-manufacturing:BillOfMaterials":{"fields":{"productId":{"label":"Assembly","order":1},"version":{"order":2},"status":{"order":3},"effectiveDate":{"order":4},"notes":{"order":5},"tenantId":{"visibility":"hidden"},"currency":{"visibility":"advanced"}}},"@happyvertical/smrt-manufacturing:BomLine":{"fields":{"bomId":{"label":"Bill of materials","order":1},"componentSkuId":{"label":"Part","order":2},"qtyPerUnit":{"label":"Amount per unit","order":3},"uom":{"label":"Unit of measure","order":4},"wastePercent":{"visibility":"advanced"},"notes":{"visibility":"advanced"},"tenantId":{"visibility":"hidden"}}},"@happyvertical/smrt-manufacturing:Operation":{"fields":{"name":{"order":1},"code":{"order":2},"category":{"order":3},"isActive":{"visibility":"advanced"},"requiredQualificationId":{"visibility":"advanced"},"tenantId":{"visibility":"hidden"}}},"@happyvertical/smrt-manufacturing:RoutingStep":{"fields":{"bomId":{"label":"Bill of materials","order":1},"operationId":{"label":"Operation","order":2},"sequence":{"label":"Step number","order":3},"estimatedMinutes":{"order":4},"notes":{"visibility":"advanced"},"tenantId":{"visibility":"hidden"}}}},"help":{"markdown":"## Overview\\n\\nAssemblies is where you describe what you make. An assembly is a product built\\nfrom parts. Its bill of materials lists those parts and how much of each goes\\ninto one unit, and its steps say which operations, such as cutting or painting,\\nit passes through and how long each takes.\\n\\n## Tasks\\n\\n### Add something you make\\n\\n1. Open the list of assemblies and choose **New**.\\n2. Give it a **{field:Assembly.name}** and your own **{field:Assembly.partReference}**, such as a drawing or part number.\\n3. Note roughly how long one takes in **{field:Assembly.estimatedLabourMinutes}**.\\n4. Save.\\n\\n### List what goes into it\\n\\n1. Open the bills of materials and choose **New**.\\n2. Pick the **{field:BillOfMaterials.productId}** the list is for.\\n3. Save, then add a line for each part.\\n4. For each line pick the **{field:BomLine.componentSkuId}** and set the **{field:BomLine.qtyPerUnit}** that goes into one unit.\\n\\n### Change how something is made\\n\\n1. Create a new bill of materials with a higher **{field:BillOfMaterials.version}**.\\n2. Set its **{field:BillOfMaterials.status}** to active when it is ready to use.\\n3. Set the old version's **{field:BillOfMaterials.status}** to superseded so only one version is in use.\\n4. The old version stays on file, so past runs still make sense.\\n\\n### See the kinds of work\\n\\nOperations are set up by the manufacturing service, not by hand in the app.\\n\\n1. Open the operations.\\n2. Read each **{field:Operation.name}** and its short **{field:Operation.code}**.\\n3. The steps of a bill of materials use these, each with its **{field:RoutingStep.estimatedMinutes}**.\\n","fieldRefs":["Assembly.estimatedLabourMinutes","Assembly.name","Assembly.partReference","BillOfMaterials.productId","BillOfMaterials.status","BillOfMaterials.version","BomLine.componentSkuId","BomLine.qtyPerUnit","Operation.code","Operation.name","RoutingStep.estimatedMinutes"]},"demo":{"mode":"server","reasons":["Needs a server because its package depends on @happyvertical/smrt-products, @happyvertical/smrt-tenancy, which do not build for a browser (#3616, #3624, #3626)."]}},{"id":"manufacturing.production","className":"ProductionRecipe","label":"Production","summary":"Plan how many to make, record what came out and see each run through to done.","synonyms":["production runs","work orders","manufacturing","batches","build orders"],"models":["@happyvertical/smrt-manufacturing:ProductionRun","@happyvertical/smrt-manufacturing:ProductionRunCompletion"],"nav":[{"label":"Production runs","model":"@happyvertical/smrt-manufacturing:ProductionRun","icon":"layers","description":"Each batch you plan to make, and how far along it is.","noun":"production run"}],"requires":["manufacturing.assemblies"],"section":{"id":"make","label":"Make","icon":"wrench","description":"Make what you sell from the parts you hold."},"options":{"@happyvertical/smrt-manufacturing:ProductionRun":{"fields":{"bomId":{"label":"Bill of materials","order":1},"targetQty":{"label":"How many to make","order":2},"completedQty":{"label":"How many made so far","locked":true,"order":3},"status":{"locked":true,"order":4},"tenantId":{"visibility":"hidden"}}},"@happyvertical/smrt-manufacturing:ProductionRunCompletion":{"fields":{"runId":{"label":"Production run","order":1},"qty":{"label":"How many finished","order":2},"completedAt":{"label":"Finished on","order":3},"tenantId":{"visibility":"hidden"}}}},"help":{"markdown":"## Overview\\n\\nProduction is where you plan and follow what you make. A production run says\\nhow many of an assembly you intend to make, using one of its bills of\\nmaterials. As batches come off the line they are recorded against it, and the run\\nkeeps count until it is done.\\n\\n## Tasks\\n\\nProduction runs and their finished batches are created and updated by the\\nproduction service, not by hand in the app. Here you follow them.\\n\\n### Find a run\\n\\n1. Open the production runs.\\n2. Check the **{field:ProductionRun.bomId}** it makes from and the **{field:ProductionRun.targetQty}** you want.\\n\\n### See how a run is going\\n\\nOpen the run and compare **{field:ProductionRun.completedQty}** with\\n**{field:ProductionRun.targetQty}**. Its **{field:ProductionRun.status}** shows\\nwhether it is planned, under way, finished or cancelled.\\n\\n### See what was finished\\n\\n1. Open the run's finished batches.\\n2. Each one shows the **{field:ProductionRunCompletion.runId}** it belongs to and **{field:ProductionRunCompletion.qty}**, how many came out.\\n","fieldRefs":["ProductionRun.bomId","ProductionRun.completedQty","ProductionRun.status","ProductionRun.targetQty","ProductionRunCompletion.qty","ProductionRunCompletion.runId"]},"demo":{"mode":"server","reasons":["Needs a server because its package depends on @happyvertical/smrt-products, @happyvertical/smrt-tenancy, which do not build for a browser (#3616, #3624, #3626)."]}}],"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-inventory","@happyvertical/smrt-products","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3616","#3624","#3626"],"via":["@happyvertical/smrt-products","@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
22
22
  //#endregion
23
23
  //#region src/models/Operation.ts
24
24
  var __defProp$6 = Object.defineProperty;
@@ -40,10 +40,6 @@ var Operation = class extends SmrtObject {
40
40
  tenantId = null;
41
41
  code = "";
42
42
  name = "";
43
- /**
44
- * Free-text grouping for lists (`fabrication`, `finishing`, `quality`).
45
- * Empty when the operation is not grouped.
46
- */
47
43
  category = "";
48
44
  /**
49
45
  * `false` once the operation is retired. A retired operation stays on the
@@ -67,8 +63,15 @@ var Operation = class extends SmrtObject {
67
63
  };
68
64
  __publicField$6(Operation, "__smrtPackage__", "@happyvertical/smrt-manufacturing");
69
65
  __decorateClass$6([tenantId({ nullable: true })], Operation.prototype, "tenantId", 2);
70
- __decorateClass$6([field({ required: true })], Operation.prototype, "code", 2);
71
- __decorateClass$6([field({ required: true })], Operation.prototype, "name", 2);
66
+ __decorateClass$6([field({
67
+ required: true,
68
+ description: "A short code for this kind of work."
69
+ })], Operation.prototype, "code", 2);
70
+ __decorateClass$6([field({
71
+ required: true,
72
+ description: "What this kind of work is called, such as cutting."
73
+ })], Operation.prototype, "name", 2);
74
+ __decorateClass$6([field({ description: "A group to sort similar work together." })], Operation.prototype, "category", 2);
72
75
  __decorateClass$6([crossPackageRef("@happyvertical/smrt-human-resources:Qualification", { nullable: true })], Operation.prototype, "requiredQualificationId", 2);
73
76
  Operation = __decorateClass$6([TenantScoped({ mode: "optional" }), smrt({
74
77
  tableName: "manufacturing_operations",
@@ -116,12 +119,12 @@ var Assembly = class extends Product {
116
119
  }
117
120
  };
118
121
  __publicField$5(Assembly, "__smrtPackage__", "@happyvertical/smrt-manufacturing");
119
- __decorateClass$5([field()], Assembly.prototype, "estimatedLabourMinutes", 2);
120
- __decorateClass$5([foreignKey(Operation, {
122
+ __decorateClass$5([field({ description: "About how many minutes it takes to make one." })], Assembly.prototype, "estimatedLabourMinutes", 2);
123
+ __decorateClass$5([field({ description: "The kind of work usually booked to this assembly." }), foreignKey(Operation, {
121
124
  nullable: true,
122
125
  onDelete: "RESTRICT"
123
126
  })], Assembly.prototype, "defaultOperationId", 2);
124
- __decorateClass$5([field()], Assembly.prototype, "partReference", 2);
127
+ __decorateClass$5([field({ description: "Your own drawing or part number for this assembly." })], Assembly.prototype, "partReference", 2);
125
128
  Assembly = __decorateClass$5([TenantScoped({ mode: "optional" }), smrt({
126
129
  api: { include: [
127
130
  "list",
@@ -158,17 +161,8 @@ var BillOfMaterials = class extends SmrtObject {
158
161
  tenantId = null;
159
162
  productId = "";
160
163
  version = 1;
161
- /**
162
- * Date from which this BOM is intended to take effect for new production
163
- * runs. Optional — older BOMs imported from legacy systems may have no
164
- * effective date on file.
165
- */
166
164
  effectiveDate = null;
167
165
  status = "draft";
168
- /**
169
- * Optional free-form notes shown in admin UIs (revision reason, source
170
- * document reference, sign-off chain, etc.).
171
- */
172
166
  notes = "";
173
167
  /**
174
168
  * ISO 4217 currency code for cost rollups. Mostly a hint for the rollup
@@ -202,9 +196,20 @@ var BillOfMaterials = class extends SmrtObject {
202
196
  };
203
197
  __publicField$4(BillOfMaterials, "__smrtPackage__", "@happyvertical/smrt-manufacturing");
204
198
  __decorateClass$4([tenantId({ nullable: true })], BillOfMaterials.prototype, "tenantId", 2);
205
- __decorateClass$4([field({ required: true })], BillOfMaterials.prototype, "productId", 2);
206
- __decorateClass$4([field({ required: true })], BillOfMaterials.prototype, "version", 2);
207
- __decorateClass$4([field({ required: true })], BillOfMaterials.prototype, "status", 2);
199
+ __decorateClass$4([field({
200
+ required: true,
201
+ description: "The assembly this list of parts is for."
202
+ })], BillOfMaterials.prototype, "productId", 2);
203
+ __decorateClass$4([field({
204
+ required: true,
205
+ description: "The revision number, so you can change a list and keep the old one."
206
+ })], BillOfMaterials.prototype, "version", 2);
207
+ __decorateClass$4([field({ description: "The day this list starts to be used." })], BillOfMaterials.prototype, "effectiveDate", 2);
208
+ __decorateClass$4([field({
209
+ required: true,
210
+ description: "Whether this list is a draft, in use or retired."
211
+ })], BillOfMaterials.prototype, "status", 2);
212
+ __decorateClass$4([field({ description: "Anything people making it should know." })], BillOfMaterials.prototype, "notes", 2);
208
213
  BillOfMaterials = __decorateClass$4([TenantScoped({ mode: "optional" }), smrt({
209
214
  tableName: "manufacturing_boms",
210
215
  conflictColumns: [
@@ -285,13 +290,6 @@ var BomLine = class extends SmrtObject {
285
290
  bomId = "";
286
291
  componentSkuId = "";
287
292
  qtyPerUnit = 0;
288
- /**
289
- * Unit of measure for {@link qtyPerUnit}. Open-ended string so the
290
- * framework does not constrain the vocabulary — `'yards'`, `'each'`,
291
- * `'grams'`, `'kg'`, `'m'`, `'litres'`, `'sq_ft'`, anything.
292
- *
293
- * Conventions follow the upstream `Material.uom` value when applicable.
294
- */
295
293
  uom = "each";
296
294
  wastePercent = 0;
297
295
  /**
@@ -332,9 +330,19 @@ var BomLine = class extends SmrtObject {
332
330
  };
333
331
  __publicField$3(BomLine, "__smrtPackage__", "@happyvertical/smrt-manufacturing");
334
332
  __decorateClass$3([tenantId({ nullable: true })], BomLine.prototype, "tenantId", 2);
335
- __decorateClass$3([field({ required: true })], BomLine.prototype, "bomId", 2);
336
- __decorateClass$3([field({ required: true })], BomLine.prototype, "componentSkuId", 2);
337
- __decorateClass$3([field({ type: "decimal" })], BomLine.prototype, "qtyPerUnit", 2);
333
+ __decorateClass$3([field({
334
+ required: true,
335
+ description: "The list of parts this line belongs to."
336
+ })], BomLine.prototype, "bomId", 2);
337
+ __decorateClass$3([field({
338
+ required: true,
339
+ description: "The part that goes into the assembly."
340
+ })], BomLine.prototype, "componentSkuId", 2);
341
+ __decorateClass$3([field({
342
+ type: "decimal",
343
+ description: "How much of this part goes into one unit."
344
+ })], BomLine.prototype, "qtyPerUnit", 2);
345
+ __decorateClass$3([field({ description: "What the amount is counted in, such as each or kilograms." })], BomLine.prototype, "uom", 2);
338
346
  __decorateClass$3([field({ type: "decimal" })], BomLine.prototype, "wastePercent", 2);
339
347
  BomLine = __decorateClass$3([TenantScoped({ mode: "optional" }), smrt({
340
348
  tableName: "manufacturing_bom_lines",
@@ -471,13 +479,22 @@ var ProductionRun = class extends SmrtObject {
471
479
  };
472
480
  __publicField$2(ProductionRun, "__smrtPackage__", "@happyvertical/smrt-manufacturing");
473
481
  __decorateClass$2([tenantId({ nullable: true })], ProductionRun.prototype, "tenantId", 2);
474
- __decorateClass$2([foreignKey(BillOfMaterials, {
482
+ __decorateClass$2([field({ description: "The list of parts this run makes from." }), foreignKey(BillOfMaterials, {
475
483
  required: true,
476
484
  onDelete: "RESTRICT"
477
485
  })], ProductionRun.prototype, "bomId", 2);
478
- __decorateClass$2([field({ type: "decimal" })], ProductionRun.prototype, "targetQty", 2);
479
- __decorateClass$2([field({ type: "decimal" })], ProductionRun.prototype, "completedQty", 2);
480
- __decorateClass$2([field({ required: true })], ProductionRun.prototype, "status", 2);
486
+ __decorateClass$2([field({
487
+ type: "decimal",
488
+ description: "How many you plan to make."
489
+ })], ProductionRun.prototype, "targetQty", 2);
490
+ __decorateClass$2([field({
491
+ type: "decimal",
492
+ description: "How many have been finished so far."
493
+ })], ProductionRun.prototype, "completedQty", 2);
494
+ __decorateClass$2([field({
495
+ required: true,
496
+ description: "Whether the run is planned, under way, done or cancelled."
497
+ })], ProductionRun.prototype, "status", 2);
481
498
  ProductionRun = __decorateClass$2([TenantScoped({ mode: "optional" }), smrt({
482
499
  tableName: "manufacturing_production_runs",
483
500
  api: { include: ["list", "get"] },
@@ -524,7 +541,6 @@ var ProductionRunCompletion = class extends SmrtObject {
524
541
  tenantId = null;
525
542
  runId = "";
526
543
  qty = 0;
527
- /** When the units were finished (defaults to when the report was made). */
528
544
  completedAt = /* @__PURE__ */ new Date();
529
545
  constructor(options = {}) {
530
546
  super(options);
@@ -542,11 +558,15 @@ var ProductionRunCompletion = class extends SmrtObject {
542
558
  };
543
559
  __publicField$1(ProductionRunCompletion, "__smrtPackage__", "@happyvertical/smrt-manufacturing");
544
560
  __decorateClass$1([tenantId({ nullable: true })], ProductionRunCompletion.prototype, "tenantId", 2);
545
- __decorateClass$1([foreignKey(ProductionRun, {
561
+ __decorateClass$1([field({ description: "The production run this batch belongs to." }), foreignKey(ProductionRun, {
546
562
  required: true,
547
563
  onDelete: "CASCADE"
548
564
  })], ProductionRunCompletion.prototype, "runId", 2);
549
- __decorateClass$1([field({ type: "decimal" })], ProductionRunCompletion.prototype, "qty", 2);
565
+ __decorateClass$1([field({
566
+ type: "decimal",
567
+ description: "How many were finished in this batch."
568
+ })], ProductionRunCompletion.prototype, "qty", 2);
569
+ __decorateClass$1([field({ description: "When this batch was finished." })], ProductionRunCompletion.prototype, "completedAt", 2);
550
570
  ProductionRunCompletion = __decorateClass$1([TenantScoped({ mode: "optional" }), smrt({
551
571
  tableName: "manufacturing_production_run_completions",
552
572
  api: { include: ["list", "get"] },
@@ -602,16 +622,22 @@ var RoutingStep = class extends SmrtObject {
602
622
  };
603
623
  __publicField(RoutingStep, "__smrtPackage__", "@happyvertical/smrt-manufacturing");
604
624
  __decorateClass([tenantId({ nullable: true })], RoutingStep.prototype, "tenantId", 2);
605
- __decorateClass([foreignKey(BillOfMaterials, {
625
+ __decorateClass([field({ description: "The list of parts this step is part of." }), foreignKey(BillOfMaterials, {
606
626
  required: true,
607
627
  onDelete: "CASCADE"
608
628
  })], RoutingStep.prototype, "bomId", 2);
609
- __decorateClass([foreignKey(Operation, {
629
+ __decorateClass([field({ description: "The kind of work done in this step." }), foreignKey(Operation, {
610
630
  required: true,
611
631
  onDelete: "RESTRICT"
612
632
  })], RoutingStep.prototype, "operationId", 2);
613
- __decorateClass([field({ required: true })], RoutingStep.prototype, "sequence", 2);
614
- __decorateClass([field({ type: "decimal" })], RoutingStep.prototype, "estimatedMinutes", 2);
633
+ __decorateClass([field({
634
+ required: true,
635
+ description: "The order of this step, starting at 1."
636
+ })], RoutingStep.prototype, "sequence", 2);
637
+ __decorateClass([field({
638
+ type: "decimal",
639
+ description: "About how many minutes this step takes."
640
+ })], RoutingStep.prototype, "estimatedMinutes", 2);
615
641
  RoutingStep = __decorateClass([TenantScoped({ mode: "optional" }), smrt({
616
642
  tableName: "manufacturing_routing_steps",
617
643
  conflictColumns: [
@@ -709,6 +735,210 @@ var InvalidProductionRunInputError = class extends Error {
709
735
  name = "InvalidProductionRunInputError";
710
736
  };
711
737
  //#endregion
738
+ //#region src/recipes.ts
739
+ var AssembliesRecipe = class extends SmrtRecipe {
740
+ static id = "manufacturing.assemblies";
741
+ static help = "./assemblies.recipe.md";
742
+ static label = "Assemblies";
743
+ static summary = "Define what you make, what goes into it and the steps to make it.";
744
+ static synonyms = [
745
+ "bill of materials",
746
+ "bills of materials",
747
+ "bom",
748
+ "recipes",
749
+ "products you make",
750
+ "routing"
751
+ ];
752
+ static section = {
753
+ id: "make",
754
+ label: "Make",
755
+ icon: "wrench",
756
+ description: "Make what you sell from the parts you hold."
757
+ };
758
+ static models = [
759
+ Assembly,
760
+ BillOfMaterials,
761
+ BomLine,
762
+ Operation,
763
+ RoutingStep
764
+ ];
765
+ static nav = [
766
+ {
767
+ label: "Assemblies",
768
+ model: Assembly,
769
+ icon: "package",
770
+ description: "The things you make, each built from parts.",
771
+ noun: "assembly"
772
+ },
773
+ {
774
+ label: "Bills of materials",
775
+ model: BillOfMaterials,
776
+ icon: "fileText",
777
+ description: "The list of parts and amounts that go into each assembly.",
778
+ noun: "bill of materials"
779
+ },
780
+ {
781
+ label: "Operations",
782
+ model: Operation,
783
+ icon: "wrench",
784
+ description: "The kinds of work done to make something, like cutting."
785
+ }
786
+ ];
787
+ static requiresAny = [["products.simple", "products.clothing"]];
788
+ static options = {
789
+ Assembly: { fields: {
790
+ name: { order: 1 },
791
+ partReference: { order: 2 },
792
+ description: { order: 3 },
793
+ price: { order: 4 },
794
+ estimatedLabourMinutes: {
795
+ label: "Minutes to make one",
796
+ order: 5
797
+ },
798
+ defaultOperationId: {
799
+ label: "Usual operation",
800
+ order: 6
801
+ },
802
+ tenantId: { visibility: "hidden" },
803
+ productType: { visibility: "hidden" },
804
+ category: { visibility: "advanced" },
805
+ manufacturer: { visibility: "hidden" },
806
+ model: { visibility: "hidden" },
807
+ inStock: {
808
+ visibility: "hidden",
809
+ default: true
810
+ },
811
+ specifications: { visibility: "hidden" },
812
+ tags: { visibility: "advanced" },
813
+ defaultSalesTaxCodeId: { visibility: "hidden" },
814
+ defaultPurchaseTaxCodeId: { visibility: "hidden" }
815
+ } },
816
+ BillOfMaterials: { fields: {
817
+ productId: {
818
+ label: "Assembly",
819
+ order: 1
820
+ },
821
+ version: { order: 2 },
822
+ status: { order: 3 },
823
+ effectiveDate: { order: 4 },
824
+ notes: { order: 5 },
825
+ tenantId: { visibility: "hidden" },
826
+ currency: { visibility: "advanced" }
827
+ } },
828
+ BomLine: { fields: {
829
+ bomId: {
830
+ label: "Bill of materials",
831
+ order: 1
832
+ },
833
+ componentSkuId: {
834
+ label: "Part",
835
+ order: 2
836
+ },
837
+ qtyPerUnit: {
838
+ label: "Amount per unit",
839
+ order: 3
840
+ },
841
+ uom: {
842
+ label: "Unit of measure",
843
+ order: 4
844
+ },
845
+ wastePercent: { visibility: "advanced" },
846
+ notes: { visibility: "advanced" },
847
+ tenantId: { visibility: "hidden" }
848
+ } },
849
+ Operation: { fields: {
850
+ name: { order: 1 },
851
+ code: { order: 2 },
852
+ category: { order: 3 },
853
+ isActive: { visibility: "advanced" },
854
+ requiredQualificationId: { visibility: "advanced" },
855
+ tenantId: { visibility: "hidden" }
856
+ } },
857
+ RoutingStep: { fields: {
858
+ bomId: {
859
+ label: "Bill of materials",
860
+ order: 1
861
+ },
862
+ operationId: {
863
+ label: "Operation",
864
+ order: 2
865
+ },
866
+ sequence: {
867
+ label: "Step number",
868
+ order: 3
869
+ },
870
+ estimatedMinutes: { order: 4 },
871
+ notes: { visibility: "advanced" },
872
+ tenantId: { visibility: "hidden" }
873
+ } }
874
+ };
875
+ };
876
+ var ProductionRecipe = class extends SmrtRecipe {
877
+ static id = "manufacturing.production";
878
+ static help = "./production.recipe.md";
879
+ static label = "Production";
880
+ static summary = "Plan how many to make, record what came out and see each run through to done.";
881
+ static synonyms = [
882
+ "production runs",
883
+ "work orders",
884
+ "manufacturing",
885
+ "batches",
886
+ "build orders"
887
+ ];
888
+ static section = {
889
+ id: "make",
890
+ label: "Make",
891
+ icon: "wrench",
892
+ description: "Make what you sell from the parts you hold."
893
+ };
894
+ static models = [ProductionRun, ProductionRunCompletion];
895
+ static nav = [{
896
+ label: "Production runs",
897
+ model: ProductionRun,
898
+ icon: "layers",
899
+ description: "Each batch you plan to make, and how far along it is.",
900
+ noun: "production run"
901
+ }];
902
+ static requires = ["manufacturing.assemblies"];
903
+ static options = {
904
+ ProductionRun: { fields: {
905
+ bomId: {
906
+ label: "Bill of materials",
907
+ order: 1
908
+ },
909
+ targetQty: {
910
+ label: "How many to make",
911
+ order: 2
912
+ },
913
+ completedQty: {
914
+ label: "How many made so far",
915
+ locked: true,
916
+ order: 3
917
+ },
918
+ status: {
919
+ locked: true,
920
+ order: 4
921
+ },
922
+ tenantId: { visibility: "hidden" }
923
+ } },
924
+ ProductionRunCompletion: { fields: {
925
+ runId: {
926
+ label: "Production run",
927
+ order: 1
928
+ },
929
+ qty: {
930
+ label: "How many finished",
931
+ order: 2
932
+ },
933
+ completedAt: {
934
+ label: "Finished on",
935
+ order: 3
936
+ },
937
+ tenantId: { visibility: "hidden" }
938
+ } }
939
+ };
940
+ };
941
+ //#endregion
712
942
  //#region src/tenant-scope.ts
713
943
  function readOwnAndGlobal(owner, read) {
714
944
  const scope = owner ?? getCurrentTenant()?.tenantId ?? null;
@@ -2367,6 +2597,6 @@ async function createRoutingService(options) {
2367
2597
  return RoutingService.create(options);
2368
2598
  }
2369
2599
  //#endregion
2370
- export { Assembly, AssemblyCollection, AssemblyService, BillOfMaterials, BillOfMaterialsCollection, BomCycleError, BomExplosionLimitError, BomLine, BomLineCollection, BomNotFoundError, BomService, BomStructureCycleError, DuplicateOperationCodeError, InvalidOperationInputError, InvalidProductionRunInputError, MAX_EXPLOSION_DEPTH, MAX_EXPLOSION_LINES, MAX_QUANTITY, NoActiveBomForProductError, Operation, OperationCollection, OperationNotFoundError, OperationRetiredError, OperationService, PRODUCTION_RUN_STATUSES, ProductionRun, ProductionRunCollection, ProductionRunCompletion, ProductionRunCompletionCollection, ProductionRunNotFoundError, ProductionRunOverCompletionError, ProductionRunService, ProductionRunStateError, ProductionService, QUANTITY_DECIMALS, RoutingService, RoutingStep, RoutingStepCollection, createAssemblyService, createBomService, createOperationService, createProductionRunService, createProductionService, createRoutingService, installManufacturingDispatchHandlers, roundQuantity };
2600
+ export { AssembliesRecipe, Assembly, AssemblyCollection, AssemblyService, BillOfMaterials, BillOfMaterialsCollection, BomCycleError, BomExplosionLimitError, BomLine, BomLineCollection, BomNotFoundError, BomService, BomStructureCycleError, DuplicateOperationCodeError, InvalidOperationInputError, InvalidProductionRunInputError, MAX_EXPLOSION_DEPTH, MAX_EXPLOSION_LINES, MAX_QUANTITY, NoActiveBomForProductError, Operation, OperationCollection, OperationNotFoundError, OperationRetiredError, OperationService, PRODUCTION_RUN_STATUSES, ProductionRecipe, ProductionRun, ProductionRunCollection, ProductionRunCompletion, ProductionRunCompletionCollection, ProductionRunNotFoundError, ProductionRunOverCompletionError, ProductionRunService, ProductionRunStateError, ProductionService, QUANTITY_DECIMALS, RoutingService, RoutingStep, RoutingStepCollection, createAssemblyService, createBomService, createOperationService, createProductionRunService, createProductionService, createRoutingService, installManufacturingDispatchHandlers, roundQuantity };
2371
2601
 
2372
2602
  //# sourceMappingURL=index.js.map