@happyvertical/smrt-inventory 0.57.18 → 0.57.20

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
@@ -3,7 +3,7 @@ import { TenantScoped, getCurrentTenant, tenantId } from "@happyvertical/smrt-te
3
3
  import { createLogger } from "@happyvertical/logger";
4
4
  import { NestedTransactionError } from "@happyvertical/sql/query";
5
5
  //#region src/__smrt-register__.ts
6
- ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-inventory","packageVersion":"0.57.18","objects":{"@happyvertical/smrt-inventory:InventoryLocationCollection":{"name":"inventorylocationcollection","className":"InventoryLocationCollection","qualifiedName":"@happyvertical/smrt-inventory:InventoryLocationCollection","collection":"inventorylocations","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/InventoryLocationCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"findByCode":{"name":"findByCode","async":true,"parameters":[{"name":"code","type":"string","optional":false}],"returnType":"Promise<InventoryLocation | null>","isStatic":false,"isPublic":true},"findByKind":{"name":"findByKind","async":true,"parameters":[{"name":"kind","type":"InventoryLocationKind","optional":false}],"returnType":"Promise<InventoryLocation[]>","isStatic":false,"isPublic":true},"findByPlace":{"name":"findByPlace","async":true,"parameters":[{"name":"placeId","type":"string","optional":false}],"returnType":"Promise<InventoryLocation[]>","isStatic":false,"isPublic":true},"findActive":{"name":"findActive","async":true,"parameters":[{"name":"kind","type":"InventoryLocationKind","optional":true}],"returnType":"Promise<InventoryLocation[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_locations","api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"InventoryLocation","exportName":"InventoryLocationCollection","collectionExportName":"InventoryLocationCollectionCollection","schema":{"tableName":"inventory_locations","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_locations\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"code\\" TEXT NOT NULL DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"kind\\" TEXT DEFAULT 'warehouse',\\n \\"place_id\\" TEXT DEFAULT '',\\n \\"active\\" BOOLEAN DEFAULT TRUE\\n);","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":false,"unique":false,"default":""},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"warehouse"},"place_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true}},"indexes":[{"name":"inventory_locations_code_tenant_id_idx","columns":["code","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_locations_slug_context_idx","columns":["slug","context"]},{"name":"inventory_locations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"401c28a1"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotCollection":{"name":"lotcollection","className":"LotCollection","qualifiedName":"@happyvertical/smrt-inventory:LotCollection","collection":"lots","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"findByLotNumber":{"name":"findByLotNumber","async":true,"parameters":[{"name":"lotNumber","type":"string","optional":false},{"name":"options","type":"object","optional":true,"memberTypes":["string | null"]}],"returnType":"Promise<Lot[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_lots","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"Lot","exportName":"LotCollection","collectionExportName":"LotCollectionCollection","schema":{"tableName":"inventory_lots","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lots\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT,\\n \\"kind\\" TEXT DEFAULT 'lot',\\n \\"lot_number\\" TEXT NOT NULL DEFAULT '',\\n \\"search_key\\" TEXT DEFAULT '',\\n \\"identity_key\\" TEXT NOT NULL DEFAULT '',\\n \\"unique_number\\" BOOLEAN DEFAULT FALSE,\\n \\"received_qty\\" REAL,\\n \\"unit\\" TEXT DEFAULT '',\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"attributes\\" TEXT,\\n \\"status\\" TEXT DEFAULT 'active',\\n \\"received_at\\" TIMESTAMP,\\n \\"received_by_profile_id\\" UUID,\\n \\"last_used_at\\" TIMESTAMP\\n);","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},"sku_id":{"type":"TEXT","notNull":false,"unique":false},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"lot"},"lot_number":{"type":"TEXT","notNull":true,"unique":false,"default":""},"search_key":{"type":"TEXT","notNull":false,"unique":false,"default":""},"identity_key":{"type":"TEXT","notNull":true,"unique":false,"default":""},"unique_number":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false},"received_qty":{"type":"REAL","notNull":false,"unique":false},"unit":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"attributes":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"active"},"received_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"received_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"last_used_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lots_identity_key_tenant_id_idx","columns":["identity_key","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lots_slug_context_idx","columns":["slug","context"]},{"name":"inventory_lots_search_key_idx","columns":["tenant_id","search_key"]},{"name":"inventory_lots_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lots_received_by_profile_id_idx","columns":["received_by_profile_id"]}],"version":"eb959677"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotCorrectionCollection":{"name":"lotcorrectioncollection","className":"LotCorrectionCollection","qualifiedName":"@happyvertical/smrt-inventory:LotCorrectionCollection","collection":"lotcorrections","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotCorrectionCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{},"decoratorConfig":{"tableName":"inventory_lot_corrections","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"LotCorrection","exportName":"LotCorrectionCollection","collectionExportName":"LotCorrectionCollectionCollection","schema":{"tableName":"inventory_lot_corrections","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_corrections\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT NOT NULL DEFAULT 'attribute',\\n \\"field\\" TEXT DEFAULT '',\\n \\"old_value\\" TEXT,\\n \\"new_value\\" TEXT,\\n \\"reason\\" TEXT NOT NULL,\\n \\"usage_id\\" TEXT,\\n \\"document_id\\" TEXT,\\n \\"actor_profile_id\\" UUID,\\n \\"corrected_at\\" TIMESTAMP\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"kind":{"type":"TEXT","notNull":true,"unique":false,"default":"attribute"},"field":{"type":"TEXT","notNull":false,"unique":false,"default":""},"old_value":{"type":"TEXT","notNull":false,"unique":false},"new_value":{"type":"TEXT","notNull":false,"unique":false},"reason":{"type":"TEXT","notNull":true,"unique":false},"usage_id":{"type":"TEXT","notNull":false,"unique":false},"document_id":{"type":"TEXT","notNull":false,"unique":false},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"corrected_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_corrections_slug_context_idx","columns":["slug","context"]},{"name":"inventory_lot_corrections_lot_idx","columns":["lot_id"]},{"name":"inventory_lot_corrections_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lot_corrections_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"d903252e"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotDocumentCollection":{"name":"lotdocumentcollection","className":"LotDocumentCollection","qualifiedName":"@happyvertical/smrt-inventory:LotDocumentCollection","collection":"lotdocuments","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotDocumentCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{},"decoratorConfig":{"tableName":"inventory_lot_documents","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"LotDocument","exportName":"LotDocumentCollection","collectionExportName":"LotDocumentCollectionCollection","schema":{"tableName":"inventory_lot_documents","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_documents\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"asset_id\\" UUID,\\n \\"role\\" TEXT DEFAULT 'certificate',\\n \\"attached_at\\" TIMESTAMP,\\n \\"attached_by_profile_id\\" UUID,\\n \\"detached_at\\" TIMESTAMP,\\n \\"detached_by_profile_id\\" UUID\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"asset_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"role":{"type":"TEXT","notNull":false,"unique":false,"default":"certificate"},"attached_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"attached_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"detached_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"detached_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_documents_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lot_documents_lot_idx","columns":["lot_id"]},{"name":"inventory_lot_documents_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lot_documents_asset_id_idx","columns":["asset_id"]},{"name":"inventory_lot_documents_attached_by_profile_id_idx","columns":["attached_by_profile_id"]},{"name":"inventory_lot_documents_detached_by_profile_id_idx","columns":["detached_by_profile_id"]}],"version":"076940be"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotStockLevelCollection":{"name":"lotstocklevelcollection","className":"LotStockLevelCollection","qualifiedName":"@happyvertical/smrt-inventory:LotStockLevelCollection","collection":"lotstocklevels","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotStockLevelCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"getLevel":{"name":"getLevel","async":true,"parameters":[{"name":"lotId","type":"string","optional":false},{"name":"locationId","type":"string","optional":false},{"name":"state","type":"StockState","optional":true,"default":"available"}],"returnType":"Promise<LotStockLevel | null>","isStatic":false,"isPublic":true},"onHand":{"name":"onHand","async":true,"parameters":[{"name":"lotId","type":"string","optional":false},{"name":"state","type":"StockState","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_lot_stock_levels","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"LotStockLevel","exportName":"LotStockLevelCollection","collectionExportName":"LotStockLevelCollectionCollection","schema":{"tableName":"inventory_lot_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_stock_levels\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"sku_id\\" TEXT DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"state\\" TEXT NOT NULL DEFAULT 'available',\\n \\"qty\\" REAL\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"sku_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"state":{"type":"TEXT","notNull":true,"unique":false,"default":"available"},"qty":{"type":"REAL","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_stock_levels_lot_id_location_id_idx","columns":["lot_id","location_id","state","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lot_stock_levels_slug_context_idx","columns":["slug","context"]},{"name":"inventory_lot_stock_levels_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"6f6becfa"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotUsageCollection":{"name":"lotusagecollection","className":"LotUsageCollection","qualifiedName":"@happyvertical/smrt-inventory:LotUsageCollection","collection":"lotusages","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotUsageCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"findActiveForLot":{"name":"findActiveForLot","async":true,"parameters":[{"name":"lotId","type":"string","optional":false}],"returnType":"Promise<LotUsage[]>","isStatic":false,"isPublic":true},"findForConsumer":{"name":"findForConsumer","async":true,"parameters":[{"name":"consumerType","type":"string","optional":false},{"name":"consumerId","type":"string","optional":false},{"name":"options","type":"object","optional":true,"memberTypes":["boolean"]}],"returnType":"Promise<LotUsage[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_lot_usages","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"LotUsage","exportName":"LotUsageCollection","collectionExportName":"LotUsageCollectionCollection","schema":{"tableName":"inventory_lot_usages","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_usages\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"consumer_type\\" TEXT NOT NULL DEFAULT '',\\n \\"consumer_id\\" TEXT NOT NULL DEFAULT '',\\n \\"qty\\" REAL,\\n \\"unit\\" TEXT DEFAULT '',\\n \\"status\\" TEXT DEFAULT 'active',\\n \\"linked_at\\" TIMESTAMP,\\n \\"linked_by_profile_id\\" UUID,\\n \\"unlinked_at\\" TIMESTAMP,\\n \\"unlinked_by_profile_id\\" UUID,\\n \\"unlink_reason\\" TEXT,\\n \\"movement_id\\" TEXT\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"consumer_type":{"type":"TEXT","notNull":true,"unique":false,"default":""},"consumer_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"qty":{"type":"REAL","notNull":false,"unique":false},"unit":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"active"},"linked_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"linked_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"unlinked_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"unlinked_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"unlink_reason":{"type":"TEXT","notNull":false,"unique":false},"movement_id":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_usages_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lot_usages_consumer_idx","columns":["consumer_type","consumer_id"]},{"name":"inventory_lot_usages_lot_status_idx","columns":["lot_id","status"]},{"name":"inventory_lot_usages_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lot_usages_linked_by_profile_id_idx","columns":["linked_by_profile_id"]},{"name":"inventory_lot_usages_unlinked_by_profile_id_idx","columns":["unlinked_by_profile_id"]}],"version":"c106a419"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockLevelCollection":{"name":"stocklevelcollection","className":"StockLevelCollection","qualifiedName":"@happyvertical/smrt-inventory:StockLevelCollection","collection":"stocklevels","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockLevelCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"getLevel":{"name":"getLevel","async":true,"parameters":[{"name":"skuId","type":"string","optional":false},{"name":"locationId","type":"string","optional":false},{"name":"state","type":"StockState","optional":true,"default":"available"}],"returnType":"Promise<StockLevel | null>","isStatic":false,"isPublic":true},"findBySku":{"name":"findBySku","async":true,"parameters":[{"name":"skuId","type":"string","optional":false}],"returnType":"Promise<StockLevel[]>","isStatic":false,"isPublic":true},"findByLocation":{"name":"findByLocation","async":true,"parameters":[{"name":"locationId","type":"string","optional":false}],"returnType":"Promise<StockLevel[]>","isStatic":false,"isPublic":true},"findBelowReorderPoint":{"name":"findBelowReorderPoint","async":true,"parameters":[{"name":"locationId","type":"string","optional":true}],"returnType":"Promise<StockLevel[]>","isStatic":false,"isPublic":true},"totalForSku":{"name":"totalForSku","async":true,"parameters":[{"name":"skuId","type":"string","optional":false},{"name":"state","type":"StockState","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"totalForLocation":{"name":"totalForLocation","async":true,"parameters":[{"name":"locationId","type":"string","optional":false},{"name":"state","type":"StockState","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_stock_levels","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"StockLevel","exportName":"StockLevelCollection","collectionExportName":"StockLevelCollectionCollection","schema":{"tableName":"inventory_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_levels\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"state\\" TEXT NOT NULL DEFAULT 'available',\\n \\"qty\\" REAL,\\n \\"reorder_point\\" REAL,\\n \\"reorder_quantity\\" REAL\\n);","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},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"state":{"type":"TEXT","notNull":true,"unique":false,"default":"available"},"qty":{"type":"REAL","notNull":false,"unique":false},"reorder_point":{"type":"REAL","notNull":false,"unique":false},"reorder_quantity":{"type":"REAL","notNull":false,"unique":false}},"indexes":[{"name":"inventory_stock_levels_sku_id_location_id_idx","columns":["sku_id","location_id","state","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_stock_levels_slug_context_idx","columns":["slug","context"]},{"name":"inventory_stock_levels_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"02387935"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockMovementCollection":{"name":"stockmovementcollection","className":"StockMovementCollection","qualifiedName":"@happyvertical/smrt-inventory:StockMovementCollection","collection":"stockmovements","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockMovementCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"findBySku":{"name":"findBySku","async":true,"parameters":[{"name":"skuId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findByLocation":{"name":"findByLocation","async":true,"parameters":[{"name":"locationId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findBySource":{"name":"findBySource","async":true,"parameters":[{"name":"sourceType","type":"string","optional":false},{"name":"sourceId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findByReason":{"name":"findByReason","async":true,"parameters":[{"name":"reasonCode","type":"StockMovementReason","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_stock_movements","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"StockMovement","exportName":"StockMovementCollection","collectionExportName":"StockMovementCollectionCollection","schema":{"tableName":"inventory_stock_movements","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_movements\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"lot_id\\" TEXT,\\n \\"from_state\\" TEXT,\\n \\"to_state\\" TEXT,\\n \\"qty\\" REAL,\\n \\"reason_code\\" TEXT NOT NULL DEFAULT 'adjustment',\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"actor_profile_id\\" UUID,\\n \\"note\\" TEXT DEFAULT '',\\n \\"occurred_at\\" TIMESTAMP\\n);","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},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"lot_id":{"type":"TEXT","notNull":false,"unique":false},"from_state":{"type":"TEXT","notNull":false,"unique":false},"to_state":{"type":"TEXT","notNull":false,"unique":false},"qty":{"type":"REAL","notNull":false,"unique":false},"reason_code":{"type":"TEXT","notNull":true,"unique":false,"default":"adjustment"},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"note":{"type":"TEXT","notNull":false,"unique":false,"default":""},"occurred_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"inventory_stock_movements_slug_context_idx","columns":["slug","context"]},{"name":"inventory_stock_movements_lot_idx","columns":["lot_id"]},{"name":"inventory_stock_movements_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_stock_movements_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"b426c2c5"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:InventoryLocation":{"name":"inventorylocation","className":"InventoryLocation","qualifiedName":"@happyvertical/smrt-inventory:InventoryLocation","collection":"inventorylocations","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/InventoryLocation.ts","packageName":"@happyvertical/smrt-inventory","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 the place stock is kept, for example MAIN.","_meta":{"required":true,"description":"A short code for the place stock is kept, for example MAIN."}},"name":{"type":"text","required":false,"default":"","description":"What you call the place, for example Main warehouse.","_meta":{"description":"What you call the place, for example Main warehouse."}},"kind":{"type":"text","required":false,"default":"warehouse","description":"What sort of place it is, for example a warehouse or a shop floor.","_meta":{"description":"What sort of place it is, for example a warehouse or a shop floor."}},"placeId":{"type":"text","required":false,"default":""},"active":{"type":"boolean","required":false,"default":true}},"methods":{},"decoratorConfig":{"tableName":"inventory_locations","conflictColumns":["code","tenant_id"],"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":true,"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"InventoryLocation","collectionExportName":"InventoryLocationCollection","displayLabelField":"name","validationRules":[{"field":"code","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_locations","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_locations\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"code\\" TEXT NOT NULL DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"kind\\" TEXT DEFAULT 'warehouse',\\n \\"place_id\\" TEXT DEFAULT '',\\n \\"active\\" BOOLEAN DEFAULT TRUE\\n);","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":false,"unique":false,"default":""},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"warehouse"},"place_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true}},"indexes":[{"name":"inventory_locations_code_tenant_id_idx","columns":["code","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_locations_slug_context_idx","columns":["slug","context"]},{"name":"inventory_locations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"401c28a1"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:Lot":{"name":"lot","className":"Lot","qualifiedName":"@happyvertical/smrt-inventory:Lot","collection":"lots","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/Lot.ts","packageName":"@happyvertical/smrt-inventory","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}}},"skuId":{"type":"text","required":false,"description":"The item this lot is of, if catalogued.","_meta":{"nullable":true,"description":"The item this lot is of, if catalogued."}},"kind":{"type":"text","required":false,"default":"lot","description":"Whether this is a batch (lot) or a single unit (serial).","_meta":{"description":"Whether this is a batch (lot) or a single unit (serial)."},"enum":["lot","serial"]},"lotNumber":{"type":"text","required":true,"default":"","description":"The batch code, supplier lot or serial number.","maxLength":128,"_meta":{"required":true,"maxLength":128,"description":"The batch code, supplier lot or serial number."}},"searchKey":{"type":"text","required":false,"default":"","description":"The number in normal form, used for lookup.","maxLength":160,"_meta":{"maxLength":160,"description":"The number in normal form, used for lookup."}},"identityKey":{"type":"text","required":true,"default":"","description":"Internal identity that keeps lots from being created twice.","maxLength":160,"_meta":{"required":true,"maxLength":160,"description":"Internal identity that keeps lots from being created twice."}},"uniqueNumber":{"type":"boolean","required":false,"default":false,"description":"Whether the number must be unique for this item.","_meta":{"description":"Whether the number must be unique for this item."}},"receivedQty":{"type":"decimal","required":false,"description":"How many came in on the receipt.","_meta":{"description":"How many came in on the receipt."}},"unit":{"type":"text","required":false,"default":"","description":"The unit of measure.","_meta":{"description":"The unit of measure."}},"sourceType":{"type":"text","required":false,"default":"","description":"What kind of record received this lot.","_meta":{"description":"What kind of record received this lot."}},"sourceId":{"type":"text","required":false,"default":"","description":"The record that received this lot.","_meta":{"description":"The record that received this lot."}},"attributes":{"type":"text","required":false,"description":"Anything else worth knowing about this lot, stored as JSON.","_meta":{"description":"Anything else worth knowing about this lot, stored as JSON."}},"status":{"type":"text","required":false,"default":"active","description":"Where the lot stands: active, quarantined, consumed or void.","_meta":{"description":"Where the lot stands: active, quarantined, consumed or void."}},"receivedAt":{"type":"datetime","required":false,"description":"When the lot was received.","_meta":{"description":"When the lot was received."}},"receivedByProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"},"lastUsedAt":{"type":"datetime","required":false,"_meta":{"nullable":true}}},"methods":{"getAttributes":{"name":"getAttributes","async":false,"parameters":[],"returnType":"Record<string, unknown>","isStatic":false,"isPublic":true},"setAttributes":{"name":"setAttributes","async":false,"parameters":[{"name":"value","type":"Record<string, unknown> | string","optional":false,"unionBranches":[{"type":"Record<string, unknown>"},{"type":"string"}]}],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_lots","conflictColumns":["identity_key","tenant_id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"indexes":[{"name":"inventory_lots_search_key_idx","columns":["tenantId","searchKey"]}],"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"Lot","collectionExportName":"LotCollection","validationRules":[{"field":"lotNumber","rule":"required","fieldType":"text"},{"field":"lotNumber","rule":"maxLength","value":128,"fieldType":"text"},{"field":"searchKey","rule":"maxLength","value":160,"fieldType":"text"},{"field":"identityKey","rule":"required","fieldType":"text"},{"field":"identityKey","rule":"maxLength","value":160,"fieldType":"text"}],"schema":{"tableName":"inventory_lots","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lots\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT,\\n \\"kind\\" TEXT DEFAULT 'lot',\\n \\"lot_number\\" TEXT NOT NULL DEFAULT '',\\n \\"search_key\\" TEXT DEFAULT '',\\n \\"identity_key\\" TEXT NOT NULL DEFAULT '',\\n \\"unique_number\\" BOOLEAN DEFAULT FALSE,\\n \\"received_qty\\" REAL,\\n \\"unit\\" TEXT DEFAULT '',\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"attributes\\" TEXT,\\n \\"status\\" TEXT DEFAULT 'active',\\n \\"received_at\\" TIMESTAMP,\\n \\"received_by_profile_id\\" UUID,\\n \\"last_used_at\\" TIMESTAMP\\n);","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},"sku_id":{"type":"TEXT","notNull":false,"unique":false},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"lot"},"lot_number":{"type":"TEXT","notNull":true,"unique":false,"default":""},"search_key":{"type":"TEXT","notNull":false,"unique":false,"default":""},"identity_key":{"type":"TEXT","notNull":true,"unique":false,"default":""},"unique_number":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false},"received_qty":{"type":"REAL","notNull":false,"unique":false},"unit":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"attributes":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"active"},"received_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"received_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"last_used_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lots_identity_key_tenant_id_idx","columns":["identity_key","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lots_slug_context_idx","columns":["slug","context"]},{"name":"inventory_lots_search_key_idx","columns":["tenant_id","search_key"]},{"name":"inventory_lots_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lots_received_by_profile_id_idx","columns":["received_by_profile_id"]}],"version":"eb959677"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotCorrection":{"name":"lotcorrection","className":"LotCorrection","qualifiedName":"@happyvertical/smrt-inventory:LotCorrection","collection":"lotcorrections","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/LotCorrection.ts","packageName":"@happyvertical/smrt-inventory","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}}},"lotId":{"type":"foreignKey","required":true,"related":"Lot","_meta":{"required":true,"constraint":{"engines":["postgres","sqlite"]},"onDelete":"RESTRICT","onUpdate":"RESTRICT"}},"kind":{"type":"text","required":true,"default":"attribute","description":"What was corrected.","_meta":{"required":true,"description":"What was corrected."},"enum":["lot_number","attribute","status","unlink","document_detach"]},"field":{"type":"text","required":false,"default":"","description":"Which attribute changed, if one did.","_meta":{"description":"Which attribute changed, if one did."}},"oldValue":{"type":"text","required":false,"description":"What it was.","_meta":{"description":"What it was."}},"newValue":{"type":"text","required":false,"description":"What it is now.","_meta":{"description":"What it is now."}},"reason":{"type":"text","required":true,"description":"Why it was corrected.","maxLength":1000,"_meta":{"required":true,"maxLength":1000,"description":"Why it was corrected."}},"usageId":{"type":"text","required":false,"_meta":{"nullable":true}},"documentId":{"type":"text","required":false,"_meta":{"nullable":true}},"actorProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"},"correctedAt":{"type":"datetime","required":false,"description":"When it was corrected.","_meta":{"description":"When it was corrected."}}},"methods":{},"decoratorConfig":{"tableName":"inventory_lot_corrections","conflictColumns":["id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"indexes":[{"name":"inventory_lot_corrections_lot_idx","columns":["lotId"]}],"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"LotCorrection","collectionExportName":"LotCorrectionCollection","validationRules":[{"field":"lotId","rule":"required","fieldType":"foreignKey"},{"field":"kind","rule":"required","fieldType":"text"},{"field":"reason","rule":"required","fieldType":"text"},{"field":"reason","rule":"maxLength","value":1000,"fieldType":"text"}],"schema":{"tableName":"inventory_lot_corrections","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_corrections\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT NOT NULL DEFAULT 'attribute',\\n \\"field\\" TEXT DEFAULT '',\\n \\"old_value\\" TEXT,\\n \\"new_value\\" TEXT,\\n \\"reason\\" TEXT NOT NULL,\\n \\"usage_id\\" TEXT,\\n \\"document_id\\" TEXT,\\n \\"actor_profile_id\\" UUID,\\n \\"corrected_at\\" TIMESTAMP\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"kind":{"type":"TEXT","notNull":true,"unique":false,"default":"attribute"},"field":{"type":"TEXT","notNull":false,"unique":false,"default":""},"old_value":{"type":"TEXT","notNull":false,"unique":false},"new_value":{"type":"TEXT","notNull":false,"unique":false},"reason":{"type":"TEXT","notNull":true,"unique":false},"usage_id":{"type":"TEXT","notNull":false,"unique":false},"document_id":{"type":"TEXT","notNull":false,"unique":false},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"corrected_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_corrections_slug_context_idx","columns":["slug","context"]},{"name":"inventory_lot_corrections_lot_idx","columns":["lot_id"]},{"name":"inventory_lot_corrections_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lot_corrections_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"d903252e"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotDocument":{"name":"lotdocument","className":"LotDocument","qualifiedName":"@happyvertical/smrt-inventory:LotDocument","collection":"lotdocuments","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/LotDocument.ts","packageName":"@happyvertical/smrt-inventory","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}}},"lotId":{"type":"foreignKey","required":true,"related":"Lot","_meta":{"required":true,"constraint":{"engines":["postgres","sqlite"]},"onDelete":"RESTRICT","onUpdate":"RESTRICT"}},"assetId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-assets:Asset"},"role":{"type":"text","required":false,"default":"certificate","description":"What the document is for, for example certificate.","_meta":{"description":"What the document is for, for example certificate."}},"attachedAt":{"type":"datetime","required":false,"description":"When it was attached.","_meta":{"description":"When it was attached."}},"attachedByProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"},"detachedAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"detachedByProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"}},"methods":{},"decoratorConfig":{"tableName":"inventory_lot_documents","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"indexes":[{"name":"inventory_lot_documents_lot_idx","columns":["lotId"]}],"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"LotDocument","collectionExportName":"LotDocumentCollection","validationRules":[{"field":"lotId","rule":"required","fieldType":"foreignKey"}],"schema":{"tableName":"inventory_lot_documents","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_documents\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"asset_id\\" UUID,\\n \\"role\\" TEXT DEFAULT 'certificate',\\n \\"attached_at\\" TIMESTAMP,\\n \\"attached_by_profile_id\\" UUID,\\n \\"detached_at\\" TIMESTAMP,\\n \\"detached_by_profile_id\\" UUID\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"asset_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"role":{"type":"TEXT","notNull":false,"unique":false,"default":"certificate"},"attached_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"attached_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"detached_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"detached_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_documents_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lot_documents_lot_idx","columns":["lot_id"]},{"name":"inventory_lot_documents_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lot_documents_asset_id_idx","columns":["asset_id"]},{"name":"inventory_lot_documents_attached_by_profile_id_idx","columns":["attached_by_profile_id"]},{"name":"inventory_lot_documents_detached_by_profile_id_idx","columns":["detached_by_profile_id"]}],"version":"076940be"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotStockLevel":{"name":"lotstocklevel","className":"LotStockLevel","qualifiedName":"@happyvertical/smrt-inventory:LotStockLevel","collection":"lotstocklevels","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/LotStockLevel.ts","packageName":"@happyvertical/smrt-inventory","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}}},"lotId":{"type":"foreignKey","required":true,"related":"Lot","_meta":{"required":true,"constraint":{"engines":["postgres","sqlite"]},"onDelete":"RESTRICT","onUpdate":"RESTRICT"}},"skuId":{"type":"text","required":false,"default":"","description":"The item the lot is of.","_meta":{"description":"The item the lot is of."}},"locationId":{"type":"text","required":true,"default":"","description":"Where the lot is kept.","_meta":{"required":true,"description":"Where the lot is kept."}},"state":{"type":"text","required":true,"default":"available","description":"The state of this stock: available, allocated, wip, qc_hold or damaged.","_meta":{"required":true,"description":"The state of this stock: available, allocated, wip, qc_hold or damaged."},"enum":["available","allocated","wip","qc_hold","damaged"]},"qty":{"type":"decimal","required":false,"description":"How many are on hand.","_meta":{"description":"How many are on hand."}}},"methods":{},"decoratorConfig":{"tableName":"inventory_lot_stock_levels","conflictColumns":["lot_id","location_id","state","tenant_id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"LotStockLevel","collectionExportName":"LotStockLevelCollection","validationRules":[{"field":"lotId","rule":"required","fieldType":"foreignKey"},{"field":"locationId","rule":"required","fieldType":"text"},{"field":"state","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_lot_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_stock_levels\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"sku_id\\" TEXT DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"state\\" TEXT NOT NULL DEFAULT 'available',\\n \\"qty\\" REAL\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"sku_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"state":{"type":"TEXT","notNull":true,"unique":false,"default":"available"},"qty":{"type":"REAL","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_stock_levels_lot_id_location_id_idx","columns":["lot_id","location_id","state","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lot_stock_levels_slug_context_idx","columns":["slug","context"]},{"name":"inventory_lot_stock_levels_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"6f6becfa"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotUsage":{"name":"lotusage","className":"LotUsage","qualifiedName":"@happyvertical/smrt-inventory:LotUsage","collection":"lotusages","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/LotUsage.ts","packageName":"@happyvertical/smrt-inventory","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}}},"lotId":{"type":"foreignKey","required":true,"related":"Lot","_meta":{"required":true,"constraint":{"engines":["postgres","sqlite"]},"onDelete":"RESTRICT","onUpdate":"RESTRICT"}},"consumerType":{"type":"text","required":true,"default":"","description":"What kind of record used the lot.","_meta":{"required":true,"description":"What kind of record used the lot."}},"consumerId":{"type":"text","required":true,"default":"","description":"The record that used the lot.","_meta":{"required":true,"description":"The record that used the lot."}},"qty":{"type":"decimal","required":false,"description":"How much was used.","_meta":{"nullable":true,"description":"How much was used."}},"unit":{"type":"text","required":false,"default":"","description":"The unit of measure.","_meta":{"description":"The unit of measure."}},"status":{"type":"text","required":false,"default":"active","description":"Whether the link still stands: active or unlinked.","_meta":{"description":"Whether the link still stands: active or unlinked."},"enum":["active","unlinked"]},"linkedAt":{"type":"datetime","required":false,"description":"When the lot was linked.","_meta":{"description":"When the lot was linked."}},"linkedByProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"},"unlinkedAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"unlinkedByProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"},"unlinkReason":{"type":"text","required":false,"description":"Why the link was removed.","_meta":{"description":"Why the link was removed."}},"movementId":{"type":"text","required":false,"description":"The stock movement for this use, if any.","_meta":{"nullable":true,"description":"The stock movement for this use, if any."}}},"methods":{},"decoratorConfig":{"tableName":"inventory_lot_usages","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"indexes":[{"name":"inventory_lot_usages_consumer_idx","columns":["consumerType","consumerId"]},{"name":"inventory_lot_usages_lot_status_idx","columns":["lotId","status"]}],"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"LotUsage","collectionExportName":"LotUsageCollection","validationRules":[{"field":"lotId","rule":"required","fieldType":"foreignKey"},{"field":"consumerType","rule":"required","fieldType":"text"},{"field":"consumerId","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_lot_usages","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_usages\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"consumer_type\\" TEXT NOT NULL DEFAULT '',\\n \\"consumer_id\\" TEXT NOT NULL DEFAULT '',\\n \\"qty\\" REAL,\\n \\"unit\\" TEXT DEFAULT '',\\n \\"status\\" TEXT DEFAULT 'active',\\n \\"linked_at\\" TIMESTAMP,\\n \\"linked_by_profile_id\\" UUID,\\n \\"unlinked_at\\" TIMESTAMP,\\n \\"unlinked_by_profile_id\\" UUID,\\n \\"unlink_reason\\" TEXT,\\n \\"movement_id\\" TEXT\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"consumer_type":{"type":"TEXT","notNull":true,"unique":false,"default":""},"consumer_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"qty":{"type":"REAL","notNull":false,"unique":false},"unit":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"active"},"linked_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"linked_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"unlinked_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"unlinked_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"unlink_reason":{"type":"TEXT","notNull":false,"unique":false},"movement_id":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_usages_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lot_usages_consumer_idx","columns":["consumer_type","consumer_id"]},{"name":"inventory_lot_usages_lot_status_idx","columns":["lot_id","status"]},{"name":"inventory_lot_usages_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lot_usages_linked_by_profile_id_idx","columns":["linked_by_profile_id"]},{"name":"inventory_lot_usages_unlinked_by_profile_id_idx","columns":["unlinked_by_profile_id"]}],"version":"c106a419"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockLevel":{"name":"stocklevel","className":"StockLevel","qualifiedName":"@happyvertical/smrt-inventory:StockLevel","collection":"stocklevels","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/StockLevel.ts","packageName":"@happyvertical/smrt-inventory","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}}},"skuId":{"type":"text","required":true,"default":"","description":"The item being counted.","_meta":{"required":true,"description":"The item being counted."}},"locationId":{"type":"text","required":true,"default":"","description":"Where the stock is kept.","_meta":{"required":true,"description":"Where the stock is kept."}},"state":{"type":"text","required":true,"default":"available","description":"The state of this stock: available, allocated, wip, qc_hold or damaged.","_meta":{"required":true,"description":"The state of this stock: available, allocated, wip, qc_hold or damaged."},"enum":["available","allocated","wip","qc_hold","damaged"]},"qty":{"type":"decimal","required":false,"description":"How many are on hand.","_meta":{"description":"How many are on hand."}},"reorderPoint":{"type":"decimal","required":false,"_meta":{"nullable":true}},"reorderQuantity":{"type":"decimal","required":false,"_meta":{"nullable":true}}},"methods":{},"decoratorConfig":{"tableName":"inventory_stock_levels","conflictColumns":["sku_id","location_id","state","tenant_id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"StockLevel","collectionExportName":"StockLevelCollection","validationRules":[{"field":"skuId","rule":"required","fieldType":"text"},{"field":"locationId","rule":"required","fieldType":"text"},{"field":"state","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_levels\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"state\\" TEXT NOT NULL DEFAULT 'available',\\n \\"qty\\" REAL,\\n \\"reorder_point\\" REAL,\\n \\"reorder_quantity\\" REAL\\n);","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},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"state":{"type":"TEXT","notNull":true,"unique":false,"default":"available"},"qty":{"type":"REAL","notNull":false,"unique":false},"reorder_point":{"type":"REAL","notNull":false,"unique":false},"reorder_quantity":{"type":"REAL","notNull":false,"unique":false}},"indexes":[{"name":"inventory_stock_levels_sku_id_location_id_idx","columns":["sku_id","location_id","state","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_stock_levels_slug_context_idx","columns":["slug","context"]},{"name":"inventory_stock_levels_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"02387935"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockMovement":{"name":"stockmovement","className":"StockMovement","qualifiedName":"@happyvertical/smrt-inventory:StockMovement","collection":"stockmovements","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/StockMovement.ts","packageName":"@happyvertical/smrt-inventory","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}}},"skuId":{"type":"text","required":true,"default":"","description":"The item that moved.","_meta":{"required":true,"description":"The item that moved."}},"locationId":{"type":"text","required":true,"default":"","description":"The place it moved at.","_meta":{"required":true,"description":"The place it moved at."}},"lotId":{"type":"text","required":false,"description":"The lot that moved, when tracked by lot.","_meta":{"nullable":true,"description":"The lot that moved, when tracked by lot."}},"fromState":{"type":"text","required":false,"description":"What it was before, for example available or damaged.","_meta":{"description":"What it was before, for example available or damaged."},"enum":["available","allocated","wip","qc_hold","damaged"]},"toState":{"type":"text","required":false,"description":"What it became.","_meta":{"description":"What it became."},"enum":["available","allocated","wip","qc_hold","damaged"]},"qty":{"type":"decimal","required":false,"description":"How many moved.","_meta":{"description":"How many moved."}},"reasonCode":{"type":"text","required":true,"default":"adjustment","description":"Why it moved, for example adjustment, sale or return.","_meta":{"required":true,"description":"Why it moved, for example adjustment, sale or return."}},"sourceType":{"type":"text","required":false,"default":""},"sourceId":{"type":"text","required":false,"default":""},"actorProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"},"note":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this movement.","_meta":{"description":"Anything worth remembering about this movement."}},"occurredAt":{"type":"datetime","required":false,"description":"When it happened.","_meta":{"description":"When it happened."}}},"methods":{},"decoratorConfig":{"tableName":"inventory_stock_movements","conflictColumns":["id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"indexes":[{"name":"inventory_stock_movements_lot_idx","columns":["lotId"]}],"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"StockMovement","collectionExportName":"StockMovementCollection","validationRules":[{"field":"skuId","rule":"required","fieldType":"text"},{"field":"locationId","rule":"required","fieldType":"text"},{"field":"reasonCode","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_stock_movements","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_movements\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"lot_id\\" TEXT,\\n \\"from_state\\" TEXT,\\n \\"to_state\\" TEXT,\\n \\"qty\\" REAL,\\n \\"reason_code\\" TEXT NOT NULL DEFAULT 'adjustment',\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"actor_profile_id\\" UUID,\\n \\"note\\" TEXT DEFAULT '',\\n \\"occurred_at\\" TIMESTAMP\\n);","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},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"lot_id":{"type":"TEXT","notNull":false,"unique":false},"from_state":{"type":"TEXT","notNull":false,"unique":false},"to_state":{"type":"TEXT","notNull":false,"unique":false},"qty":{"type":"REAL","notNull":false,"unique":false},"reason_code":{"type":"TEXT","notNull":true,"unique":false,"default":"adjustment"},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"note":{"type":"TEXT","notNull":false,"unique":false,"default":""},"occurred_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"inventory_stock_movements_slug_context_idx","columns":["slug","context"]},{"name":"inventory_stock_movements_lot_idx","columns":["lot_id"]},{"name":"inventory_stock_movements_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_stock_movements_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"b426c2c5"},"importPath":"@happyvertical/smrt-inventory"}},"moduleType":"smrt","recipes":[{"id":"inventory.stock","className":"StockRecipe","label":"Inventory","summary":"Keep count of how many of each product you have.","synonyms":["stock","quantity","on hand"],"models":["@happyvertical/smrt-inventory:StockLevel","@happyvertical/smrt-inventory:InventoryLocation","@happyvertical/smrt-inventory:StockMovement"],"nav":[{"label":"Stock levels","model":"@happyvertical/smrt-inventory:StockLevel","icon":"archive","description":"How much of each item you have on hand right now.","noun":"stock entry"},{"label":"Locations","model":"@happyvertical/smrt-inventory:InventoryLocation","icon":"home","description":"The places you keep stock, like shelves, rooms or vans."},{"label":"Stock movements","model":"@happyvertical/smrt-inventory:StockMovement","icon":"truck","description":"Every time stock came in, went out or moved."}],"requires":[],"requiresAny":[["products.simple","products.clothing"]],"section":{"id":"catalog","label":"Catalog","icon":"package","description":"Products, ingredients and the stock you hold."},"options":{"@happyvertical/smrt-inventory:StockLevel":{"fields":{"reorderPoint":{"visibility":"hidden"},"reorderQuantity":{"visibility":"hidden"}}},"@happyvertical/smrt-inventory:InventoryLocation":{"fields":{"placeId":{"visibility":"hidden"},"active":{"visibility":"hidden"}}},"@happyvertical/smrt-inventory:StockMovement":{"fields":{"sourceType":{"visibility":"hidden"},"sourceId":{"visibility":"hidden"},"actorProfileId":{"visibility":"hidden"}}}},"help":{"markdown":"## Overview\\n\\nInventory keeps count of how many of each product you have. Each count is a\\nstock level: an item, the place it is kept and how many are on hand. Stock can\\nsit in more than one place, and every change is recorded as a stock movement so\\nthere is a trail.\\n\\n## Tasks\\n\\n### Count what you have\\n\\n1. Create a stock level for the item and the place it is kept.\\n2. Set **{field:qty}** to how many you have on hand.\\n3. Set **{field:state}** if the stock is not available to sell, for example\\n allocated or on quality hold.\\n\\n### Correct a count\\n\\n1. Find the stock level for the item.\\n2. Set **{field:qty}** to what you really have. Record why as a stock movement.\\n\\n### Keep stock in more than one place\\n\\n1. Add a location with a **{field:code}** and a **{field:name}**, and say what\\n sort it is in **{field:kind}**.\\n2. Create stock levels against that location.\\n","fieldRefs":["code","kind","name","qty","state"]},"demo":{"mode":"server","reasons":["Needs a server because its package depends on @happyvertical/smrt-tenancy, which do not build for a browser (#3624)."]}}],"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3624"],"via":["@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
6
+ ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-inventory","packageVersion":"0.57.20","objects":{"@happyvertical/smrt-inventory:InventoryLocationCollection":{"name":"inventorylocationcollection","className":"InventoryLocationCollection","qualifiedName":"@happyvertical/smrt-inventory:InventoryLocationCollection","collection":"inventorylocations","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/InventoryLocationCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"findByCode":{"name":"findByCode","async":true,"parameters":[{"name":"code","type":"string","optional":false}],"returnType":"Promise<InventoryLocation | null>","isStatic":false,"isPublic":true},"findByKind":{"name":"findByKind","async":true,"parameters":[{"name":"kind","type":"InventoryLocationKind","optional":false}],"returnType":"Promise<InventoryLocation[]>","isStatic":false,"isPublic":true},"findByPlace":{"name":"findByPlace","async":true,"parameters":[{"name":"placeId","type":"string","optional":false}],"returnType":"Promise<InventoryLocation[]>","isStatic":false,"isPublic":true},"findActive":{"name":"findActive","async":true,"parameters":[{"name":"kind","type":"InventoryLocationKind","optional":true}],"returnType":"Promise<InventoryLocation[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_locations","api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"InventoryLocation","exportName":"InventoryLocationCollection","collectionExportName":"InventoryLocationCollectionCollection","schema":{"tableName":"inventory_locations","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_locations\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"code\\" TEXT NOT NULL DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"kind\\" TEXT DEFAULT 'warehouse',\\n \\"place_id\\" TEXT DEFAULT '',\\n \\"active\\" BOOLEAN DEFAULT TRUE\\n);","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":false,"unique":false,"default":""},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"warehouse"},"place_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true}},"indexes":[{"name":"inventory_locations_code_tenant_id_idx","columns":["code","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_locations_slug_context_idx","columns":["slug","context"]},{"name":"inventory_locations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"401c28a1"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotCollection":{"name":"lotcollection","className":"LotCollection","qualifiedName":"@happyvertical/smrt-inventory:LotCollection","collection":"lots","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"findByLotNumber":{"name":"findByLotNumber","async":true,"parameters":[{"name":"lotNumber","type":"string","optional":false},{"name":"options","type":"object","optional":true,"memberTypes":["string | null"]}],"returnType":"Promise<Lot[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_lots","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"Lot","exportName":"LotCollection","collectionExportName":"LotCollectionCollection","schema":{"tableName":"inventory_lots","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lots\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT,\\n \\"kind\\" TEXT DEFAULT 'lot',\\n \\"lot_number\\" TEXT NOT NULL DEFAULT '',\\n \\"search_key\\" TEXT DEFAULT '',\\n \\"identity_key\\" TEXT NOT NULL DEFAULT '',\\n \\"unique_number\\" BOOLEAN DEFAULT FALSE,\\n \\"received_qty\\" REAL,\\n \\"unit\\" TEXT DEFAULT '',\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"attributes\\" TEXT,\\n \\"status\\" TEXT DEFAULT 'active',\\n \\"received_at\\" TIMESTAMP,\\n \\"received_by_profile_id\\" UUID,\\n \\"last_used_at\\" TIMESTAMP\\n);","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},"sku_id":{"type":"TEXT","notNull":false,"unique":false},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"lot"},"lot_number":{"type":"TEXT","notNull":true,"unique":false,"default":""},"search_key":{"type":"TEXT","notNull":false,"unique":false,"default":""},"identity_key":{"type":"TEXT","notNull":true,"unique":false,"default":""},"unique_number":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false},"received_qty":{"type":"REAL","notNull":false,"unique":false},"unit":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"attributes":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"active"},"received_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"received_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"last_used_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lots_identity_key_tenant_id_idx","columns":["identity_key","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lots_slug_context_idx","columns":["slug","context"]},{"name":"inventory_lots_search_key_idx","columns":["tenant_id","search_key"]},{"name":"inventory_lots_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lots_received_by_profile_id_idx","columns":["received_by_profile_id"]}],"version":"eb959677"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotCorrectionCollection":{"name":"lotcorrectioncollection","className":"LotCorrectionCollection","qualifiedName":"@happyvertical/smrt-inventory:LotCorrectionCollection","collection":"lotcorrections","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotCorrectionCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{},"decoratorConfig":{"tableName":"inventory_lot_corrections","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"LotCorrection","exportName":"LotCorrectionCollection","collectionExportName":"LotCorrectionCollectionCollection","schema":{"tableName":"inventory_lot_corrections","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_corrections\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT NOT NULL DEFAULT 'attribute',\\n \\"field\\" TEXT DEFAULT '',\\n \\"old_value\\" TEXT,\\n \\"new_value\\" TEXT,\\n \\"reason\\" TEXT NOT NULL,\\n \\"usage_id\\" TEXT,\\n \\"document_id\\" TEXT,\\n \\"actor_profile_id\\" UUID,\\n \\"corrected_at\\" TIMESTAMP\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"kind":{"type":"TEXT","notNull":true,"unique":false,"default":"attribute"},"field":{"type":"TEXT","notNull":false,"unique":false,"default":""},"old_value":{"type":"TEXT","notNull":false,"unique":false},"new_value":{"type":"TEXT","notNull":false,"unique":false},"reason":{"type":"TEXT","notNull":true,"unique":false},"usage_id":{"type":"TEXT","notNull":false,"unique":false},"document_id":{"type":"TEXT","notNull":false,"unique":false},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"corrected_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_corrections_slug_context_idx","columns":["slug","context"]},{"name":"inventory_lot_corrections_lot_idx","columns":["lot_id"]},{"name":"inventory_lot_corrections_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lot_corrections_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"d903252e"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotDocumentCollection":{"name":"lotdocumentcollection","className":"LotDocumentCollection","qualifiedName":"@happyvertical/smrt-inventory:LotDocumentCollection","collection":"lotdocuments","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotDocumentCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{},"decoratorConfig":{"tableName":"inventory_lot_documents","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"LotDocument","exportName":"LotDocumentCollection","collectionExportName":"LotDocumentCollectionCollection","schema":{"tableName":"inventory_lot_documents","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_documents\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"asset_id\\" UUID,\\n \\"role\\" TEXT DEFAULT 'certificate',\\n \\"attached_at\\" TIMESTAMP,\\n \\"attached_by_profile_id\\" UUID,\\n \\"detached_at\\" TIMESTAMP,\\n \\"detached_by_profile_id\\" UUID\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"asset_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"role":{"type":"TEXT","notNull":false,"unique":false,"default":"certificate"},"attached_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"attached_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"detached_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"detached_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_documents_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lot_documents_lot_idx","columns":["lot_id"]},{"name":"inventory_lot_documents_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lot_documents_asset_id_idx","columns":["asset_id"]},{"name":"inventory_lot_documents_attached_by_profile_id_idx","columns":["attached_by_profile_id"]},{"name":"inventory_lot_documents_detached_by_profile_id_idx","columns":["detached_by_profile_id"]}],"version":"076940be"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotStockLevelCollection":{"name":"lotstocklevelcollection","className":"LotStockLevelCollection","qualifiedName":"@happyvertical/smrt-inventory:LotStockLevelCollection","collection":"lotstocklevels","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotStockLevelCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"getLevel":{"name":"getLevel","async":true,"parameters":[{"name":"lotId","type":"string","optional":false},{"name":"locationId","type":"string","optional":false},{"name":"state","type":"StockState","optional":true,"default":"available"}],"returnType":"Promise<LotStockLevel | null>","isStatic":false,"isPublic":true},"onHand":{"name":"onHand","async":true,"parameters":[{"name":"lotId","type":"string","optional":false},{"name":"state","type":"StockState","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_lot_stock_levels","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"LotStockLevel","exportName":"LotStockLevelCollection","collectionExportName":"LotStockLevelCollectionCollection","schema":{"tableName":"inventory_lot_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_stock_levels\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"sku_id\\" TEXT DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"state\\" TEXT NOT NULL DEFAULT 'available',\\n \\"qty\\" REAL\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"sku_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"state":{"type":"TEXT","notNull":true,"unique":false,"default":"available"},"qty":{"type":"REAL","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_stock_levels_lot_id_location_id_idx","columns":["lot_id","location_id","state","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lot_stock_levels_slug_context_idx","columns":["slug","context"]},{"name":"inventory_lot_stock_levels_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"6f6becfa"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotUsageCollection":{"name":"lotusagecollection","className":"LotUsageCollection","qualifiedName":"@happyvertical/smrt-inventory:LotUsageCollection","collection":"lotusages","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/LotUsageCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"findActiveForLot":{"name":"findActiveForLot","async":true,"parameters":[{"name":"lotId","type":"string","optional":false}],"returnType":"Promise<LotUsage[]>","isStatic":false,"isPublic":true},"findForConsumer":{"name":"findForConsumer","async":true,"parameters":[{"name":"consumerType","type":"string","optional":false},{"name":"consumerId","type":"string","optional":false},{"name":"options","type":"object","optional":true,"memberTypes":["boolean"]}],"returnType":"Promise<LotUsage[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_lot_usages","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"LotUsage","exportName":"LotUsageCollection","collectionExportName":"LotUsageCollectionCollection","schema":{"tableName":"inventory_lot_usages","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_usages\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"consumer_type\\" TEXT NOT NULL DEFAULT '',\\n \\"consumer_id\\" TEXT NOT NULL DEFAULT '',\\n \\"qty\\" REAL,\\n \\"unit\\" TEXT DEFAULT '',\\n \\"status\\" TEXT DEFAULT 'active',\\n \\"linked_at\\" TIMESTAMP,\\n \\"linked_by_profile_id\\" UUID,\\n \\"unlinked_at\\" TIMESTAMP,\\n \\"unlinked_by_profile_id\\" UUID,\\n \\"unlink_reason\\" TEXT,\\n \\"movement_id\\" TEXT\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"consumer_type":{"type":"TEXT","notNull":true,"unique":false,"default":""},"consumer_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"qty":{"type":"REAL","notNull":false,"unique":false},"unit":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"active"},"linked_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"linked_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"unlinked_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"unlinked_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"unlink_reason":{"type":"TEXT","notNull":false,"unique":false},"movement_id":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_usages_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lot_usages_consumer_idx","columns":["consumer_type","consumer_id"]},{"name":"inventory_lot_usages_lot_status_idx","columns":["lot_id","status"]},{"name":"inventory_lot_usages_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lot_usages_linked_by_profile_id_idx","columns":["linked_by_profile_id"]},{"name":"inventory_lot_usages_unlinked_by_profile_id_idx","columns":["unlinked_by_profile_id"]}],"version":"c106a419"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockLevelCollection":{"name":"stocklevelcollection","className":"StockLevelCollection","qualifiedName":"@happyvertical/smrt-inventory:StockLevelCollection","collection":"stocklevels","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockLevelCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"getLevel":{"name":"getLevel","async":true,"parameters":[{"name":"skuId","type":"string","optional":false},{"name":"locationId","type":"string","optional":false},{"name":"state","type":"StockState","optional":true,"default":"available"}],"returnType":"Promise<StockLevel | null>","isStatic":false,"isPublic":true},"findBySku":{"name":"findBySku","async":true,"parameters":[{"name":"skuId","type":"string","optional":false}],"returnType":"Promise<StockLevel[]>","isStatic":false,"isPublic":true},"findByLocation":{"name":"findByLocation","async":true,"parameters":[{"name":"locationId","type":"string","optional":false}],"returnType":"Promise<StockLevel[]>","isStatic":false,"isPublic":true},"findBelowReorderPoint":{"name":"findBelowReorderPoint","async":true,"parameters":[{"name":"locationId","type":"string","optional":true}],"returnType":"Promise<StockLevel[]>","isStatic":false,"isPublic":true},"totalForSku":{"name":"totalForSku","async":true,"parameters":[{"name":"skuId","type":"string","optional":false},{"name":"state","type":"StockState","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"totalForLocation":{"name":"totalForLocation","async":true,"parameters":[{"name":"locationId","type":"string","optional":false},{"name":"state","type":"StockState","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_stock_levels","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"StockLevel","exportName":"StockLevelCollection","collectionExportName":"StockLevelCollectionCollection","schema":{"tableName":"inventory_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_levels\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"state\\" TEXT NOT NULL DEFAULT 'available',\\n \\"qty\\" REAL,\\n \\"reorder_point\\" REAL,\\n \\"reorder_quantity\\" REAL\\n);","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},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"state":{"type":"TEXT","notNull":true,"unique":false,"default":"available"},"qty":{"type":"REAL","notNull":false,"unique":false},"reorder_point":{"type":"REAL","notNull":false,"unique":false},"reorder_quantity":{"type":"REAL","notNull":false,"unique":false}},"indexes":[{"name":"inventory_stock_levels_sku_id_location_id_idx","columns":["sku_id","location_id","state","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_stock_levels_slug_context_idx","columns":["slug","context"]},{"name":"inventory_stock_levels_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"02387935"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockMovementCollection":{"name":"stockmovementcollection","className":"StockMovementCollection","qualifiedName":"@happyvertical/smrt-inventory:StockMovementCollection","collection":"stockmovements","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockMovementCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"findBySku":{"name":"findBySku","async":true,"parameters":[{"name":"skuId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findByLocation":{"name":"findByLocation","async":true,"parameters":[{"name":"locationId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findBySource":{"name":"findBySource","async":true,"parameters":[{"name":"sourceType","type":"string","optional":false},{"name":"sourceId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findByReason":{"name":"findByReason","async":true,"parameters":[{"name":"reasonCode","type":"StockMovementReason","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_stock_movements","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"StockMovement","exportName":"StockMovementCollection","collectionExportName":"StockMovementCollectionCollection","schema":{"tableName":"inventory_stock_movements","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_movements\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"lot_id\\" TEXT,\\n \\"from_state\\" TEXT,\\n \\"to_state\\" TEXT,\\n \\"qty\\" REAL,\\n \\"reason_code\\" TEXT NOT NULL DEFAULT 'adjustment',\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"actor_profile_id\\" UUID,\\n \\"note\\" TEXT DEFAULT '',\\n \\"occurred_at\\" TIMESTAMP\\n);","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},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"lot_id":{"type":"TEXT","notNull":false,"unique":false},"from_state":{"type":"TEXT","notNull":false,"unique":false},"to_state":{"type":"TEXT","notNull":false,"unique":false},"qty":{"type":"REAL","notNull":false,"unique":false},"reason_code":{"type":"TEXT","notNull":true,"unique":false,"default":"adjustment"},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"note":{"type":"TEXT","notNull":false,"unique":false,"default":""},"occurred_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"inventory_stock_movements_slug_context_idx","columns":["slug","context"]},{"name":"inventory_stock_movements_lot_idx","columns":["lot_id"]},{"name":"inventory_stock_movements_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_stock_movements_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"b426c2c5"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:InventoryLocation":{"name":"inventorylocation","className":"InventoryLocation","qualifiedName":"@happyvertical/smrt-inventory:InventoryLocation","collection":"inventorylocations","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/InventoryLocation.ts","packageName":"@happyvertical/smrt-inventory","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 the place stock is kept, for example MAIN.","_meta":{"required":true,"description":"A short code for the place stock is kept, for example MAIN."}},"name":{"type":"text","required":false,"default":"","description":"What you call the place, for example Main warehouse.","_meta":{"description":"What you call the place, for example Main warehouse."}},"kind":{"type":"text","required":false,"default":"warehouse","description":"What sort of place it is, for example a warehouse or a shop floor.","_meta":{"description":"What sort of place it is, for example a warehouse or a shop floor."}},"placeId":{"type":"text","required":false,"default":""},"active":{"type":"boolean","required":false,"default":true}},"methods":{},"decoratorConfig":{"tableName":"inventory_locations","conflictColumns":["code","tenant_id"],"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":true,"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"InventoryLocation","collectionExportName":"InventoryLocationCollection","displayLabelField":"name","validationRules":[{"field":"code","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_locations","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_locations\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"code\\" TEXT NOT NULL DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"kind\\" TEXT DEFAULT 'warehouse',\\n \\"place_id\\" TEXT DEFAULT '',\\n \\"active\\" BOOLEAN DEFAULT TRUE\\n);","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":false,"unique":false,"default":""},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"warehouse"},"place_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true}},"indexes":[{"name":"inventory_locations_code_tenant_id_idx","columns":["code","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_locations_slug_context_idx","columns":["slug","context"]},{"name":"inventory_locations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"401c28a1"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:Lot":{"name":"lot","className":"Lot","qualifiedName":"@happyvertical/smrt-inventory:Lot","collection":"lots","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/Lot.ts","packageName":"@happyvertical/smrt-inventory","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}}},"skuId":{"type":"text","required":false,"description":"The item this lot is of, if catalogued.","_meta":{"nullable":true,"description":"The item this lot is of, if catalogued."}},"kind":{"type":"text","required":false,"default":"lot","description":"Whether this is a batch (lot) or a single unit (serial).","_meta":{"description":"Whether this is a batch (lot) or a single unit (serial)."},"enum":["lot","serial"]},"lotNumber":{"type":"text","required":true,"default":"","description":"The batch code, supplier lot or serial number.","maxLength":128,"_meta":{"required":true,"maxLength":128,"description":"The batch code, supplier lot or serial number."}},"searchKey":{"type":"text","required":false,"default":"","description":"The number in normal form, used for lookup.","maxLength":160,"_meta":{"maxLength":160,"description":"The number in normal form, used for lookup."}},"identityKey":{"type":"text","required":true,"default":"","description":"Internal identity that keeps lots from being created twice.","maxLength":160,"_meta":{"required":true,"maxLength":160,"description":"Internal identity that keeps lots from being created twice."}},"uniqueNumber":{"type":"boolean","required":false,"default":false,"description":"Whether the number must be unique for this item.","_meta":{"description":"Whether the number must be unique for this item."}},"receivedQty":{"type":"decimal","required":false,"description":"How many came in on the receipt.","_meta":{"description":"How many came in on the receipt."}},"unit":{"type":"text","required":false,"default":"","description":"The unit of measure.","_meta":{"description":"The unit of measure."}},"sourceType":{"type":"text","required":false,"default":"","description":"What kind of record received this lot.","_meta":{"description":"What kind of record received this lot."}},"sourceId":{"type":"text","required":false,"default":"","description":"The record that received this lot.","_meta":{"description":"The record that received this lot."}},"attributes":{"type":"text","required":false,"description":"Anything else worth knowing about this lot, stored as JSON.","_meta":{"description":"Anything else worth knowing about this lot, stored as JSON."}},"status":{"type":"text","required":false,"default":"active","description":"Where the lot stands: active, quarantined, consumed or void.","_meta":{"description":"Where the lot stands: active, quarantined, consumed or void."}},"receivedAt":{"type":"datetime","required":false,"description":"When the lot was received.","_meta":{"description":"When the lot was received."}},"receivedByProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"},"lastUsedAt":{"type":"datetime","required":false,"_meta":{"nullable":true}}},"methods":{"getAttributes":{"name":"getAttributes","async":false,"parameters":[],"returnType":"Record<string, unknown>","isStatic":false,"isPublic":true},"setAttributes":{"name":"setAttributes","async":false,"parameters":[{"name":"value","type":"Record<string, unknown> | string","optional":false,"unionBranches":[{"type":"Record<string, unknown>"},{"type":"string"}]}],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_lots","conflictColumns":["identity_key","tenant_id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"indexes":[{"name":"inventory_lots_search_key_idx","columns":["tenantId","searchKey"]}],"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"Lot","collectionExportName":"LotCollection","validationRules":[{"field":"lotNumber","rule":"required","fieldType":"text"},{"field":"lotNumber","rule":"maxLength","value":128,"fieldType":"text"},{"field":"searchKey","rule":"maxLength","value":160,"fieldType":"text"},{"field":"identityKey","rule":"required","fieldType":"text"},{"field":"identityKey","rule":"maxLength","value":160,"fieldType":"text"}],"schema":{"tableName":"inventory_lots","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lots\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT,\\n \\"kind\\" TEXT DEFAULT 'lot',\\n \\"lot_number\\" TEXT NOT NULL DEFAULT '',\\n \\"search_key\\" TEXT DEFAULT '',\\n \\"identity_key\\" TEXT NOT NULL DEFAULT '',\\n \\"unique_number\\" BOOLEAN DEFAULT FALSE,\\n \\"received_qty\\" REAL,\\n \\"unit\\" TEXT DEFAULT '',\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"attributes\\" TEXT,\\n \\"status\\" TEXT DEFAULT 'active',\\n \\"received_at\\" TIMESTAMP,\\n \\"received_by_profile_id\\" UUID,\\n \\"last_used_at\\" TIMESTAMP\\n);","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},"sku_id":{"type":"TEXT","notNull":false,"unique":false},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"lot"},"lot_number":{"type":"TEXT","notNull":true,"unique":false,"default":""},"search_key":{"type":"TEXT","notNull":false,"unique":false,"default":""},"identity_key":{"type":"TEXT","notNull":true,"unique":false,"default":""},"unique_number":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false},"received_qty":{"type":"REAL","notNull":false,"unique":false},"unit":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"attributes":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"active"},"received_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"received_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"last_used_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lots_identity_key_tenant_id_idx","columns":["identity_key","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lots_slug_context_idx","columns":["slug","context"]},{"name":"inventory_lots_search_key_idx","columns":["tenant_id","search_key"]},{"name":"inventory_lots_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lots_received_by_profile_id_idx","columns":["received_by_profile_id"]}],"version":"eb959677"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotCorrection":{"name":"lotcorrection","className":"LotCorrection","qualifiedName":"@happyvertical/smrt-inventory:LotCorrection","collection":"lotcorrections","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/LotCorrection.ts","packageName":"@happyvertical/smrt-inventory","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}}},"lotId":{"type":"foreignKey","required":true,"related":"Lot","_meta":{"required":true,"constraint":{"engines":["postgres","sqlite"]},"onDelete":"RESTRICT","onUpdate":"RESTRICT"}},"kind":{"type":"text","required":true,"default":"attribute","description":"What was corrected.","_meta":{"required":true,"description":"What was corrected."},"enum":["lot_number","attribute","status","unlink","document_detach"]},"field":{"type":"text","required":false,"default":"","description":"Which attribute changed, if one did.","_meta":{"description":"Which attribute changed, if one did."}},"oldValue":{"type":"text","required":false,"description":"What it was.","_meta":{"description":"What it was."}},"newValue":{"type":"text","required":false,"description":"What it is now.","_meta":{"description":"What it is now."}},"reason":{"type":"text","required":true,"description":"Why it was corrected.","maxLength":1000,"_meta":{"required":true,"maxLength":1000,"description":"Why it was corrected."}},"usageId":{"type":"text","required":false,"_meta":{"nullable":true}},"documentId":{"type":"text","required":false,"_meta":{"nullable":true}},"actorProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"},"correctedAt":{"type":"datetime","required":false,"description":"When it was corrected.","_meta":{"description":"When it was corrected."}}},"methods":{},"decoratorConfig":{"tableName":"inventory_lot_corrections","conflictColumns":["id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"indexes":[{"name":"inventory_lot_corrections_lot_idx","columns":["lotId"]}],"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"LotCorrection","collectionExportName":"LotCorrectionCollection","validationRules":[{"field":"lotId","rule":"required","fieldType":"foreignKey"},{"field":"kind","rule":"required","fieldType":"text"},{"field":"reason","rule":"required","fieldType":"text"},{"field":"reason","rule":"maxLength","value":1000,"fieldType":"text"}],"schema":{"tableName":"inventory_lot_corrections","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_corrections\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT NOT NULL DEFAULT 'attribute',\\n \\"field\\" TEXT DEFAULT '',\\n \\"old_value\\" TEXT,\\n \\"new_value\\" TEXT,\\n \\"reason\\" TEXT NOT NULL,\\n \\"usage_id\\" TEXT,\\n \\"document_id\\" TEXT,\\n \\"actor_profile_id\\" UUID,\\n \\"corrected_at\\" TIMESTAMP\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"kind":{"type":"TEXT","notNull":true,"unique":false,"default":"attribute"},"field":{"type":"TEXT","notNull":false,"unique":false,"default":""},"old_value":{"type":"TEXT","notNull":false,"unique":false},"new_value":{"type":"TEXT","notNull":false,"unique":false},"reason":{"type":"TEXT","notNull":true,"unique":false},"usage_id":{"type":"TEXT","notNull":false,"unique":false},"document_id":{"type":"TEXT","notNull":false,"unique":false},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"corrected_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_corrections_slug_context_idx","columns":["slug","context"]},{"name":"inventory_lot_corrections_lot_idx","columns":["lot_id"]},{"name":"inventory_lot_corrections_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lot_corrections_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"d903252e"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotDocument":{"name":"lotdocument","className":"LotDocument","qualifiedName":"@happyvertical/smrt-inventory:LotDocument","collection":"lotdocuments","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/LotDocument.ts","packageName":"@happyvertical/smrt-inventory","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}}},"lotId":{"type":"foreignKey","required":true,"related":"Lot","_meta":{"required":true,"constraint":{"engines":["postgres","sqlite"]},"onDelete":"RESTRICT","onUpdate":"RESTRICT"}},"assetId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-assets:Asset"},"role":{"type":"text","required":false,"default":"certificate","description":"What the document is for, for example certificate.","_meta":{"description":"What the document is for, for example certificate."}},"attachedAt":{"type":"datetime","required":false,"description":"When it was attached.","_meta":{"description":"When it was attached."}},"attachedByProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"},"detachedAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"detachedByProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"}},"methods":{},"decoratorConfig":{"tableName":"inventory_lot_documents","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"indexes":[{"name":"inventory_lot_documents_lot_idx","columns":["lotId"]}],"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"LotDocument","collectionExportName":"LotDocumentCollection","validationRules":[{"field":"lotId","rule":"required","fieldType":"foreignKey"}],"schema":{"tableName":"inventory_lot_documents","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_documents\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"asset_id\\" UUID,\\n \\"role\\" TEXT DEFAULT 'certificate',\\n \\"attached_at\\" TIMESTAMP,\\n \\"attached_by_profile_id\\" UUID,\\n \\"detached_at\\" TIMESTAMP,\\n \\"detached_by_profile_id\\" UUID\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"asset_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"role":{"type":"TEXT","notNull":false,"unique":false,"default":"certificate"},"attached_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"attached_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"detached_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"detached_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_documents_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lot_documents_lot_idx","columns":["lot_id"]},{"name":"inventory_lot_documents_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lot_documents_asset_id_idx","columns":["asset_id"]},{"name":"inventory_lot_documents_attached_by_profile_id_idx","columns":["attached_by_profile_id"]},{"name":"inventory_lot_documents_detached_by_profile_id_idx","columns":["detached_by_profile_id"]}],"version":"076940be"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotStockLevel":{"name":"lotstocklevel","className":"LotStockLevel","qualifiedName":"@happyvertical/smrt-inventory:LotStockLevel","collection":"lotstocklevels","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/LotStockLevel.ts","packageName":"@happyvertical/smrt-inventory","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}}},"lotId":{"type":"foreignKey","required":true,"related":"Lot","_meta":{"required":true,"constraint":{"engines":["postgres","sqlite"]},"onDelete":"RESTRICT","onUpdate":"RESTRICT"}},"skuId":{"type":"text","required":false,"default":"","description":"The item the lot is of.","_meta":{"description":"The item the lot is of."}},"locationId":{"type":"text","required":true,"default":"","description":"Where the lot is kept.","_meta":{"required":true,"description":"Where the lot is kept."}},"state":{"type":"text","required":true,"default":"available","description":"The state of this stock: available, allocated, wip, qc_hold or damaged.","_meta":{"required":true,"description":"The state of this stock: available, allocated, wip, qc_hold or damaged."},"enum":["available","allocated","wip","qc_hold","damaged"]},"qty":{"type":"decimal","required":false,"description":"How many are on hand.","_meta":{"description":"How many are on hand."}}},"methods":{},"decoratorConfig":{"tableName":"inventory_lot_stock_levels","conflictColumns":["lot_id","location_id","state","tenant_id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"LotStockLevel","collectionExportName":"LotStockLevelCollection","validationRules":[{"field":"lotId","rule":"required","fieldType":"foreignKey"},{"field":"locationId","rule":"required","fieldType":"text"},{"field":"state","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_lot_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_stock_levels\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"sku_id\\" TEXT DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"state\\" TEXT NOT NULL DEFAULT 'available',\\n \\"qty\\" REAL\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"sku_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"state":{"type":"TEXT","notNull":true,"unique":false,"default":"available"},"qty":{"type":"REAL","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_stock_levels_lot_id_location_id_idx","columns":["lot_id","location_id","state","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lot_stock_levels_slug_context_idx","columns":["slug","context"]},{"name":"inventory_lot_stock_levels_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"6f6becfa"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotUsage":{"name":"lotusage","className":"LotUsage","qualifiedName":"@happyvertical/smrt-inventory:LotUsage","collection":"lotusages","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/LotUsage.ts","packageName":"@happyvertical/smrt-inventory","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}}},"lotId":{"type":"foreignKey","required":true,"related":"Lot","_meta":{"required":true,"constraint":{"engines":["postgres","sqlite"]},"onDelete":"RESTRICT","onUpdate":"RESTRICT"}},"consumerType":{"type":"text","required":true,"default":"","description":"What kind of record used the lot.","_meta":{"required":true,"description":"What kind of record used the lot."}},"consumerId":{"type":"text","required":true,"default":"","description":"The record that used the lot.","_meta":{"required":true,"description":"The record that used the lot."}},"qty":{"type":"decimal","required":false,"description":"How much was used.","_meta":{"nullable":true,"description":"How much was used."}},"unit":{"type":"text","required":false,"default":"","description":"The unit of measure.","_meta":{"description":"The unit of measure."}},"status":{"type":"text","required":false,"default":"active","description":"Whether the link still stands: active or unlinked.","_meta":{"description":"Whether the link still stands: active or unlinked."},"enum":["active","unlinked"]},"linkedAt":{"type":"datetime","required":false,"description":"When the lot was linked.","_meta":{"description":"When the lot was linked."}},"linkedByProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"},"unlinkedAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"unlinkedByProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"},"unlinkReason":{"type":"text","required":false,"description":"Why the link was removed.","_meta":{"description":"Why the link was removed."}},"movementId":{"type":"text","required":false,"description":"The stock movement for this use, if any.","_meta":{"nullable":true,"description":"The stock movement for this use, if any."}}},"methods":{},"decoratorConfig":{"tableName":"inventory_lot_usages","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"indexes":[{"name":"inventory_lot_usages_consumer_idx","columns":["consumerType","consumerId"]},{"name":"inventory_lot_usages_lot_status_idx","columns":["lotId","status"]}],"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"LotUsage","collectionExportName":"LotUsageCollection","validationRules":[{"field":"lotId","rule":"required","fieldType":"foreignKey"},{"field":"consumerType","rule":"required","fieldType":"text"},{"field":"consumerId","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_lot_usages","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_usages\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"lot_id\\" UUID NOT NULL,\\n \\"consumer_type\\" TEXT NOT NULL DEFAULT '',\\n \\"consumer_id\\" TEXT NOT NULL DEFAULT '',\\n \\"qty\\" REAL,\\n \\"unit\\" TEXT DEFAULT '',\\n \\"status\\" TEXT DEFAULT 'active',\\n \\"linked_at\\" TIMESTAMP,\\n \\"linked_by_profile_id\\" UUID,\\n \\"unlinked_at\\" TIMESTAMP,\\n \\"unlinked_by_profile_id\\" UUID,\\n \\"unlink_reason\\" TEXT,\\n \\"movement_id\\" TEXT\\n);","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},"lot_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"inventory_lots","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT","engines":["postgres","sqlite"]}},"consumer_type":{"type":"TEXT","notNull":true,"unique":false,"default":""},"consumer_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"qty":{"type":"REAL","notNull":false,"unique":false},"unit":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"active"},"linked_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"linked_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"unlinked_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"unlinked_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"unlink_reason":{"type":"TEXT","notNull":false,"unique":false},"movement_id":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"inventory_lot_usages_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_lot_usages_consumer_idx","columns":["consumer_type","consumer_id"]},{"name":"inventory_lot_usages_lot_status_idx","columns":["lot_id","status"]},{"name":"inventory_lot_usages_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_lot_usages_linked_by_profile_id_idx","columns":["linked_by_profile_id"]},{"name":"inventory_lot_usages_unlinked_by_profile_id_idx","columns":["unlinked_by_profile_id"]}],"version":"c106a419"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockLevel":{"name":"stocklevel","className":"StockLevel","qualifiedName":"@happyvertical/smrt-inventory:StockLevel","collection":"stocklevels","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/StockLevel.ts","packageName":"@happyvertical/smrt-inventory","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}}},"skuId":{"type":"text","required":true,"default":"","description":"The item being counted.","_meta":{"required":true,"description":"The item being counted."}},"locationId":{"type":"text","required":true,"default":"","description":"Where the stock is kept.","_meta":{"required":true,"description":"Where the stock is kept."}},"state":{"type":"text","required":true,"default":"available","description":"The state of this stock: available, allocated, wip, qc_hold or damaged.","_meta":{"required":true,"description":"The state of this stock: available, allocated, wip, qc_hold or damaged."},"enum":["available","allocated","wip","qc_hold","damaged"]},"qty":{"type":"decimal","required":false,"description":"How many are on hand.","_meta":{"description":"How many are on hand."}},"reorderPoint":{"type":"decimal","required":false,"_meta":{"nullable":true}},"reorderQuantity":{"type":"decimal","required":false,"_meta":{"nullable":true}}},"methods":{},"decoratorConfig":{"tableName":"inventory_stock_levels","conflictColumns":["sku_id","location_id","state","tenant_id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"StockLevel","collectionExportName":"StockLevelCollection","validationRules":[{"field":"skuId","rule":"required","fieldType":"text"},{"field":"locationId","rule":"required","fieldType":"text"},{"field":"state","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_levels\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"state\\" TEXT NOT NULL DEFAULT 'available',\\n \\"qty\\" REAL,\\n \\"reorder_point\\" REAL,\\n \\"reorder_quantity\\" REAL\\n);","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},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"state":{"type":"TEXT","notNull":true,"unique":false,"default":"available"},"qty":{"type":"REAL","notNull":false,"unique":false},"reorder_point":{"type":"REAL","notNull":false,"unique":false},"reorder_quantity":{"type":"REAL","notNull":false,"unique":false}},"indexes":[{"name":"inventory_stock_levels_sku_id_location_id_idx","columns":["sku_id","location_id","state","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_stock_levels_slug_context_idx","columns":["slug","context"]},{"name":"inventory_stock_levels_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"02387935"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockMovement":{"name":"stockmovement","className":"StockMovement","qualifiedName":"@happyvertical/smrt-inventory:StockMovement","collection":"stockmovements","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/StockMovement.ts","packageName":"@happyvertical/smrt-inventory","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}}},"skuId":{"type":"text","required":true,"default":"","description":"The item that moved.","_meta":{"required":true,"description":"The item that moved."}},"locationId":{"type":"text","required":true,"default":"","description":"The place it moved at.","_meta":{"required":true,"description":"The place it moved at."}},"lotId":{"type":"text","required":false,"description":"The lot that moved, when tracked by lot.","_meta":{"nullable":true,"description":"The lot that moved, when tracked by lot."}},"fromState":{"type":"text","required":false,"description":"What it was before, for example available or damaged.","_meta":{"description":"What it was before, for example available or damaged."},"enum":["available","allocated","wip","qc_hold","damaged"]},"toState":{"type":"text","required":false,"description":"What it became.","_meta":{"description":"What it became."},"enum":["available","allocated","wip","qc_hold","damaged"]},"qty":{"type":"decimal","required":false,"description":"How many moved.","_meta":{"description":"How many moved."}},"reasonCode":{"type":"text","required":true,"default":"adjustment","description":"Why it moved, for example adjustment, sale or return.","_meta":{"required":true,"description":"Why it moved, for example adjustment, sale or return."}},"sourceType":{"type":"text","required":false,"default":""},"sourceId":{"type":"text","required":false,"default":""},"actorProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"},"note":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this movement.","_meta":{"description":"Anything worth remembering about this movement."}},"occurredAt":{"type":"datetime","required":false,"description":"When it happened.","_meta":{"description":"When it happened."}}},"methods":{},"decoratorConfig":{"tableName":"inventory_stock_movements","conflictColumns":["id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"indexes":[{"name":"inventory_stock_movements_lot_idx","columns":["lotId"]}],"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"StockMovement","collectionExportName":"StockMovementCollection","validationRules":[{"field":"skuId","rule":"required","fieldType":"text"},{"field":"locationId","rule":"required","fieldType":"text"},{"field":"reasonCode","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_stock_movements","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_movements\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"lot_id\\" TEXT,\\n \\"from_state\\" TEXT,\\n \\"to_state\\" TEXT,\\n \\"qty\\" REAL,\\n \\"reason_code\\" TEXT NOT NULL DEFAULT 'adjustment',\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"actor_profile_id\\" UUID,\\n \\"note\\" TEXT DEFAULT '',\\n \\"occurred_at\\" TIMESTAMP\\n);","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},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"lot_id":{"type":"TEXT","notNull":false,"unique":false},"from_state":{"type":"TEXT","notNull":false,"unique":false},"to_state":{"type":"TEXT","notNull":false,"unique":false},"qty":{"type":"REAL","notNull":false,"unique":false},"reason_code":{"type":"TEXT","notNull":true,"unique":false,"default":"adjustment"},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"note":{"type":"TEXT","notNull":false,"unique":false,"default":""},"occurred_at":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"inventory_stock_movements_slug_context_idx","columns":["slug","context"]},{"name":"inventory_stock_movements_lot_idx","columns":["lot_id"]},{"name":"inventory_stock_movements_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_stock_movements_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"b426c2c5"},"importPath":"@happyvertical/smrt-inventory"}},"moduleType":"smrt","recipes":[{"id":"inventory.stock","className":"StockRecipe","label":"Inventory","summary":"Keep count of how many of each product you have.","synonyms":["stock","quantity","on hand"],"models":["@happyvertical/smrt-inventory:StockLevel","@happyvertical/smrt-inventory:InventoryLocation","@happyvertical/smrt-inventory:StockMovement"],"nav":[{"label":"Stock levels","model":"@happyvertical/smrt-inventory:StockLevel","icon":"archive","description":"How much of each item you have on hand right now.","noun":"stock entry"},{"label":"Locations","model":"@happyvertical/smrt-inventory:InventoryLocation","icon":"home","description":"The places you keep stock, like shelves, rooms or vans."},{"label":"Stock movements","model":"@happyvertical/smrt-inventory:StockMovement","icon":"truck","description":"Every time stock came in, went out or moved."}],"requires":[],"requiresAny":[["products.simple","products.clothing"]],"section":{"id":"catalog","label":"Catalog","icon":"package","description":"Products, ingredients and the stock you hold."},"options":{"@happyvertical/smrt-inventory:StockLevel":{"fields":{"reorderPoint":{"visibility":"hidden"},"reorderQuantity":{"visibility":"hidden"}}},"@happyvertical/smrt-inventory:InventoryLocation":{"fields":{"placeId":{"visibility":"hidden"},"active":{"visibility":"hidden"}}},"@happyvertical/smrt-inventory:StockMovement":{"fields":{"sourceType":{"visibility":"hidden"},"sourceId":{"visibility":"hidden"},"actorProfileId":{"visibility":"hidden"}}}},"help":{"markdown":"## Overview\\n\\nInventory keeps count of how many of each product you have. Each count is a\\nstock level: an item, the place it is kept and how many are on hand. Stock can\\nsit in more than one place, and every change is recorded as a stock movement so\\nthere is a trail.\\n\\n## Tasks\\n\\n### Count what you have\\n\\n1. Create a stock level for the item and the place it is kept.\\n2. Set **{field:qty}** to how many you have on hand.\\n3. Set **{field:state}** if the stock is not available to sell, for example\\n allocated or on quality hold.\\n\\n### Correct a count\\n\\n1. Find the stock level for the item.\\n2. Set **{field:qty}** to what you really have. Record why as a stock movement.\\n\\n### Keep stock in more than one place\\n\\n1. Add a location with a **{field:code}** and a **{field:name}**, and say what\\n sort it is in **{field:kind}**.\\n2. Create stock levels against that location.\\n","fieldRefs":["code","kind","name","qty","state"]},"demo":{"mode":"server","reasons":["Needs a server because its package depends on @happyvertical/smrt-tenancy, which do not build for a browser (#3624)."]}}],"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3624"],"via":["@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
7
7
  //#endregion
8
8
  //#region src/models/InventoryLocation.ts
9
9
  var __defProp$7 = Object.defineProperty;