@happyvertical/smrt-inventory 0.61.3 → 0.61.4
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 +14 -3
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +721 -315
- package/dist/models/InventoryLocation.d.ts.map +1 -1
- package/dist/models/Lot.d.ts.map +1 -1
- package/dist/models/LotCorrection.d.ts.map +1 -1
- package/dist/models/LotDocument.d.ts.map +1 -1
- package/dist/models/LotStockLevel.d.ts.map +1 -1
- package/dist/models/LotUsage.d.ts.map +1 -1
- package/dist/models/StockLevel.d.ts.map +1 -1
- package/dist/models/StockMovement.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +5 -5
- package/package.json +8 -8
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.61.3","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","collectionOf":"@happyvertical/smrt-inventory:InventoryLocation","inheritedExposure":["api","mcp"],"schema":{"tableName":"inventory_locations","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_locations\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"e8bce6a0"},"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","collectionOf":"@happyvertical/smrt-inventory:Lot","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"inventory_lots","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lots\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"245e4002"},"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","collectionOf":"@happyvertical/smrt-inventory:LotCorrection","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"inventory_lot_corrections","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_corrections\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"bcf787a0"},"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","collectionOf":"@happyvertical/smrt-inventory:LotDocument","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"inventory_lot_documents","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_documents\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"deee5903"},"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","collectionOf":"@happyvertical/smrt-inventory:LotStockLevel","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"inventory_lot_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_stock_levels\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"d39d7b51"},"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","collectionOf":"@happyvertical/smrt-inventory:LotUsage","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"inventory_lot_usages","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_usages\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"edce33e6"},"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","collectionOf":"@happyvertical/smrt-inventory:StockLevel","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"inventory_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_levels\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"b249d8e6"},"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","collectionOf":"@happyvertical/smrt-inventory:StockMovement","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"inventory_stock_movements","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_movements\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"c82313b7"},"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"e8bce6a0"},"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"245e4002"},"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"bcf787a0"},"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"deee5903"},"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"d39d7b51"},"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"edce33e6"},"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":{"display":{"references":{"skuId":"@happyvertical/smrt-products:Sku"},"label":{"via":"skuId","field":"name","fallback":"Unknown item"},"list":["displayLabel","state","qty"]},"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","displayLabelProjection":{"via":"skuId","field":"name","fallback":"Unknown item"},"displayLabelField":"displayLabel","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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"b249d8e6"},"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":{"display":{"references":{"skuId":"@happyvertical/smrt-products:Sku"},"label":{"via":"skuId","field":"name","fallback":"Unknown item"},"list":["displayLabel","reasonCode","qty","occurredAt"]},"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","displayLabelProjection":{"via":"skuId","field":"name","fallback":"Unknown item"},"displayLabelField":"displayLabel","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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"c82313b7"},"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-products, @happyvertical/smrt-tenancy, which do not build for a browser (#3616, #3624, #3626)."]}}],"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-products","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3616","#3624","#3626"],"via":["@happyvertical/smrt-products","@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
|
|
6
|
+
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-inventory","packageVersion":"0.61.4","objects":{"@happyvertical/smrt-inventory:InventoryLocationCollection":{"name":"inventorylocationcollection","className":"InventoryLocationCollection","qualifiedName":"@happyvertical/smrt-inventory:InventoryLocationCollection","collection":"inventorylocations","filePath":"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","collectionOf":"@happyvertical/smrt-inventory:InventoryLocation","inheritedExposure":["api","mcp"],"schema":{"tableName":"inventory_locations","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_locations\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"e8bce6a0"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotCollection":{"name":"lotcollection","className":"LotCollection","qualifiedName":"@happyvertical/smrt-inventory:LotCollection","collection":"lots","filePath":"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","collectionOf":"@happyvertical/smrt-inventory:Lot","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"inventory_lots","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lots\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":false,"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":"3b8aef6c"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotCorrectionCollection":{"name":"lotcorrectioncollection","className":"LotCorrectionCollection","qualifiedName":"@happyvertical/smrt-inventory:LotCorrectionCollection","collection":"lotcorrections","filePath":"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","collectionOf":"@happyvertical/smrt-inventory:LotCorrection","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"inventory_lot_corrections","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_corrections\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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,\\n \\"usage_id\\" TEXT,\\n \\"document_id\\" TEXT,\\n \\"actor_profile_id\\" UUID,\\n \\"corrected_at\\" TIMESTAMP\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":false,"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":"a4ab8ad7"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotDocumentCollection":{"name":"lotdocumentcollection","className":"LotDocumentCollection","qualifiedName":"@happyvertical/smrt-inventory:LotDocumentCollection","collection":"lotdocuments","filePath":"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","collectionOf":"@happyvertical/smrt-inventory:LotDocument","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"inventory_lot_documents","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_documents\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"deee5903"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotStockLevelCollection":{"name":"lotstocklevelcollection","className":"LotStockLevelCollection","qualifiedName":"@happyvertical/smrt-inventory:LotStockLevelCollection","collection":"lotstocklevels","filePath":"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","collectionOf":"@happyvertical/smrt-inventory:LotStockLevel","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"inventory_lot_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_stock_levels\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"d39d7b51"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotUsageCollection":{"name":"lotusagecollection","className":"LotUsageCollection","qualifiedName":"@happyvertical/smrt-inventory:LotUsageCollection","collection":"lotusages","filePath":"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","collectionOf":"@happyvertical/smrt-inventory:LotUsage","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"inventory_lot_usages","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_usages\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"edce33e6"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockLevelCollection":{"name":"stocklevelcollection","className":"StockLevelCollection","qualifiedName":"@happyvertical/smrt-inventory:StockLevelCollection","collection":"stocklevels","filePath":"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","collectionOf":"@happyvertical/smrt-inventory:StockLevel","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"inventory_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_levels\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"b249d8e6"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockMovementCollection":{"name":"stockmovementcollection","className":"StockMovementCollection","qualifiedName":"@happyvertical/smrt-inventory:StockMovementCollection","collection":"stockmovements","filePath":"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","collectionOf":"@happyvertical/smrt-inventory:StockMovement","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"inventory_stock_movements","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_movements\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"c82313b7"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:InventoryLocation":{"name":"inventorylocation","className":"InventoryLocation","qualifiedName":"@happyvertical/smrt-inventory:InventoryLocation","collection":"inventorylocations","filePath":"src/models/InventoryLocation.ts","packageName":"@happyvertical/smrt-inventory","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","nullable","__tenancy","required"],"sqlType":"UUID","nullable":true,"required":false},"required":false},"code":{"type":"text","_meta":{"__statedOptions":["required","requiredFor","description","default"],"required":true,"description":"A short code for the place stock is kept, for example MAIN.","requiredFor":"identity"},"required":true,"default":"","description":"A short code for the place stock is kept, for example MAIN."},"name":{"type":"text","_meta":{"__statedOptions":["description","default"],"description":"What you call the place, for example Main warehouse."},"required":false,"default":"","description":"What you call the place, for example Main warehouse."},"kind":{"type":"text","_meta":{"__statedOptions":["description","default"],"description":"What sort of place it is, for example a warehouse or a shop floor."},"required":false,"default":"warehouse","description":"What sort of place it is, for example a warehouse or a shop floor."},"placeId":{"type":"text","_meta":{"__statedOptions":["default"]},"required":false,"default":""},"active":{"type":"boolean","_meta":{"__statedOptions":["default"]},"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"e8bce6a0"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:Lot":{"name":"lot","className":"Lot","qualifiedName":"@happyvertical/smrt-inventory:Lot","collection":"lots","filePath":"src/models/Lot.ts","packageName":"@happyvertical/smrt-inventory","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","nullable","__tenancy","required"],"sqlType":"UUID","nullable":true,"required":false},"required":false},"skuId":{"type":"text","_meta":{"__statedOptions":["nullable","description","required"],"description":"The item this lot is of, if catalogued.","nullable":true,"required":false},"required":false,"description":"The item this lot is of, if catalogued."},"kind":{"type":"text","_meta":{"__statedOptions":["description","default","enum"],"description":"Whether this is a batch (lot) or a single unit (serial)."},"required":false,"default":"lot","description":"Whether this is a batch (lot) or a single unit (serial).","enum":["lot","serial"]},"lotNumber":{"type":"text","_meta":{"__statedOptions":["maxLength","description","default"],"description":"The batch code, supplier lot or serial number.","maxLength":128},"required":false,"default":"","description":"The batch code, supplier lot or serial number.","maxLength":128},"searchKey":{"type":"text","_meta":{"__statedOptions":["maxLength","description","default"],"description":"The number in normal form, used for lookup.","maxLength":160},"required":false,"default":"","description":"The number in normal form, used for lookup.","maxLength":160},"identityKey":{"type":"text","_meta":{"__statedOptions":["required","requiredFor","maxLength","description","default"],"required":true,"description":"Internal identity that keeps lots from being created twice.","maxLength":160,"requiredFor":"identity"},"required":true,"default":"","description":"Internal identity that keeps lots from being created twice.","maxLength":160},"uniqueNumber":{"type":"boolean","_meta":{"__statedOptions":["description","default"],"description":"Whether the number must be unique for this item."},"required":false,"default":false,"description":"Whether the number must be unique for this item."},"receivedQty":{"type":"decimal","_meta":{"__statedOptions":["description"],"description":"How many came in on the receipt."},"required":false,"description":"How many came in on the receipt."},"unit":{"type":"text","_meta":{"__statedOptions":["description","default"],"description":"The unit of measure."},"required":false,"default":"","description":"The unit of measure."},"sourceType":{"type":"text","_meta":{"__statedOptions":["description","default"],"description":"What kind of record received this lot."},"required":false,"default":"","description":"What kind of record received this lot."},"sourceId":{"type":"text","_meta":{"__statedOptions":["description","default"],"description":"The record that received this lot."},"required":false,"default":"","description":"The record that received this lot."},"attributes":{"type":"text","_meta":{"__statedOptions":["description"],"description":"Anything else worth knowing about this lot, stored as JSON."},"required":false,"description":"Anything else worth knowing about this lot, stored as JSON."},"status":{"type":"text","_meta":{"__statedOptions":["description","default"],"description":"Where the lot stands: active, quarantined, consumed or void."},"required":false,"default":"active","description":"Where the lot stands: active, quarantined, consumed or void."},"receivedAt":{"type":"datetime","_meta":{"__statedOptions":["description"],"description":"When the lot was received."},"required":false,"description":"When the lot was received."},"receivedByProfileId":{"type":"crossPackageRef","_meta":{"__statedOptions":["related"]},"required":false,"related":"@happyvertical/smrt-profiles:Profile"},"lastUsedAt":{"type":"datetime","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false}},"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":"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":false,"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":"3b8aef6c"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotCorrection":{"name":"lotcorrection","className":"LotCorrection","qualifiedName":"@happyvertical/smrt-inventory:LotCorrection","collection":"lotcorrections","filePath":"src/models/LotCorrection.ts","packageName":"@happyvertical/smrt-inventory","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","nullable","__tenancy","required"],"sqlType":"UUID","nullable":true,"required":false},"required":false},"lotId":{"type":"foreignKey","_meta":{"__statedOptions":["required","requiredFor","onDelete","onUpdate","constraint","related"],"required":true,"requiredFor":"identity","onDelete":"RESTRICT","onUpdate":"RESTRICT","constraint":{"engines":["postgres","sqlite"]}},"required":true,"related":"Lot"},"kind":{"type":"text","_meta":{"__statedOptions":["required","description","default","enum"],"required":true,"description":"What was corrected."},"required":true,"default":"attribute","description":"What was corrected.","enum":["lot_number","attribute","status","unlink","document_detach"]},"field":{"type":"text","_meta":{"__statedOptions":["description","default"],"description":"Which attribute changed, if one did."},"required":false,"default":"","description":"Which attribute changed, if one did."},"oldValue":{"type":"text","_meta":{"__statedOptions":["description"],"description":"What it was."},"required":false,"description":"What it was."},"newValue":{"type":"text","_meta":{"__statedOptions":["description"],"description":"What it is now."},"required":false,"description":"What it is now."},"reason":{"type":"text","_meta":{"__statedOptions":["maxLength","description"],"description":"Why it was corrected.","maxLength":1000},"required":false,"description":"Why it was corrected.","maxLength":1000},"usageId":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"documentId":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"actorProfileId":{"type":"crossPackageRef","_meta":{"__statedOptions":["related"]},"required":false,"related":"@happyvertical/smrt-profiles:Profile"},"correctedAt":{"type":"datetime","_meta":{"__statedOptions":["description"],"description":"When it was corrected."},"required":false,"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":"maxLength","value":1000,"fieldType":"text"}],"schema":{"tableName":"inventory_lot_corrections","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_lot_corrections\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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,\\n \\"usage_id\\" TEXT,\\n \\"document_id\\" TEXT,\\n \\"actor_profile_id\\" UUID,\\n \\"corrected_at\\" TIMESTAMP\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":false,"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":"a4ab8ad7"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotDocument":{"name":"lotdocument","className":"LotDocument","qualifiedName":"@happyvertical/smrt-inventory:LotDocument","collection":"lotdocuments","filePath":"src/models/LotDocument.ts","packageName":"@happyvertical/smrt-inventory","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","nullable","__tenancy","required"],"sqlType":"UUID","nullable":true,"required":false},"required":false},"lotId":{"type":"foreignKey","_meta":{"__statedOptions":["required","requiredFor","onDelete","onUpdate","constraint","related"],"required":true,"requiredFor":"identity","onDelete":"RESTRICT","onUpdate":"RESTRICT","constraint":{"engines":["postgres","sqlite"]}},"required":true,"related":"Lot"},"assetId":{"type":"crossPackageRef","_meta":{"__statedOptions":["related"]},"required":false,"related":"@happyvertical/smrt-assets:Asset"},"role":{"type":"text","_meta":{"__statedOptions":["description","default"],"description":"What the document is for, for example certificate."},"required":false,"default":"certificate","description":"What the document is for, for example certificate."},"attachedAt":{"type":"datetime","_meta":{"__statedOptions":["description"],"description":"When it was attached."},"required":false,"description":"When it was attached."},"attachedByProfileId":{"type":"crossPackageRef","_meta":{"__statedOptions":["related"]},"required":false,"related":"@happyvertical/smrt-profiles:Profile"},"detachedAt":{"type":"datetime","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"detachedByProfileId":{"type":"crossPackageRef","_meta":{"__statedOptions":["related"]},"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"deee5903"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotStockLevel":{"name":"lotstocklevel","className":"LotStockLevel","qualifiedName":"@happyvertical/smrt-inventory:LotStockLevel","collection":"lotstocklevels","filePath":"src/models/LotStockLevel.ts","packageName":"@happyvertical/smrt-inventory","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","nullable","__tenancy","required"],"sqlType":"UUID","nullable":true,"required":false},"required":false},"lotId":{"type":"foreignKey","_meta":{"__statedOptions":["required","requiredFor","onDelete","onUpdate","constraint","related"],"required":true,"requiredFor":"identity","onDelete":"RESTRICT","onUpdate":"RESTRICT","constraint":{"engines":["postgres","sqlite"]}},"required":true,"related":"Lot"},"skuId":{"type":"text","_meta":{"__statedOptions":["description","default"],"description":"The item the lot is of."},"required":false,"default":"","description":"The item the lot is of."},"locationId":{"type":"text","_meta":{"__statedOptions":["required","requiredFor","description","default"],"required":true,"description":"Where the lot is kept.","requiredFor":"identity"},"required":true,"default":"","description":"Where the lot is kept."},"state":{"type":"text","_meta":{"__statedOptions":["required","description","default","enum"],"required":true,"description":"The state of this stock: available, allocated, wip, qc_hold or damaged."},"required":true,"default":"available","description":"The state of this stock: available, allocated, wip, qc_hold or damaged.","enum":["available","allocated","wip","qc_hold","damaged"]},"qty":{"type":"decimal","_meta":{"__statedOptions":["description"],"description":"How many are on hand."},"required":false,"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"d39d7b51"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:LotUsage":{"name":"lotusage","className":"LotUsage","qualifiedName":"@happyvertical/smrt-inventory:LotUsage","collection":"lotusages","filePath":"src/models/LotUsage.ts","packageName":"@happyvertical/smrt-inventory","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","nullable","__tenancy","required"],"sqlType":"UUID","nullable":true,"required":false},"required":false},"lotId":{"type":"foreignKey","_meta":{"__statedOptions":["required","requiredFor","onDelete","onUpdate","constraint","related"],"required":true,"requiredFor":"identity","onDelete":"RESTRICT","onUpdate":"RESTRICT","constraint":{"engines":["postgres","sqlite"]}},"required":true,"related":"Lot"},"consumerType":{"type":"text","_meta":{"__statedOptions":["required","requiredFor","description","default"],"required":true,"description":"What kind of record used the lot.","requiredFor":"identity"},"required":true,"default":"","description":"What kind of record used the lot."},"consumerId":{"type":"text","_meta":{"__statedOptions":["required","requiredFor","description","default"],"required":true,"description":"The record that used the lot.","requiredFor":"identity"},"required":true,"default":"","description":"The record that used the lot."},"qty":{"type":"decimal","_meta":{"__statedOptions":["nullable","description","required"],"description":"How much was used.","nullable":true,"required":false},"required":false,"description":"How much was used."},"unit":{"type":"text","_meta":{"__statedOptions":["description","default"],"description":"The unit of measure."},"required":false,"default":"","description":"The unit of measure."},"status":{"type":"text","_meta":{"__statedOptions":["description","default","enum"],"description":"Whether the link still stands: active or unlinked."},"required":false,"default":"active","description":"Whether the link still stands: active or unlinked.","enum":["active","unlinked"]},"linkedAt":{"type":"datetime","_meta":{"__statedOptions":["description"],"description":"When the lot was linked."},"required":false,"description":"When the lot was linked."},"linkedByProfileId":{"type":"crossPackageRef","_meta":{"__statedOptions":["related"]},"required":false,"related":"@happyvertical/smrt-profiles:Profile"},"unlinkedAt":{"type":"datetime","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"unlinkedByProfileId":{"type":"crossPackageRef","_meta":{"__statedOptions":["related"]},"required":false,"related":"@happyvertical/smrt-profiles:Profile"},"unlinkReason":{"type":"text","_meta":{"__statedOptions":["description"],"description":"Why the link was removed."},"required":false,"description":"Why the link was removed."},"movementId":{"type":"text","_meta":{"__statedOptions":["nullable","description","required"],"description":"The stock movement for this use, if any.","nullable":true,"required":false},"required":false,"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"edce33e6"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockLevel":{"name":"stocklevel","className":"StockLevel","qualifiedName":"@happyvertical/smrt-inventory:StockLevel","collection":"stocklevels","filePath":"src/models/StockLevel.ts","packageName":"@happyvertical/smrt-inventory","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","nullable","__tenancy","required"],"sqlType":"UUID","nullable":true,"required":false},"required":false},"skuId":{"type":"text","_meta":{"__statedOptions":["required","requiredFor","description","default"],"required":true,"description":"The item being counted.","requiredFor":"identity"},"required":true,"default":"","description":"The item being counted."},"locationId":{"type":"text","_meta":{"__statedOptions":["required","requiredFor","description","default"],"required":true,"description":"Where the stock is kept.","requiredFor":"identity"},"required":true,"default":"","description":"Where the stock is kept."},"state":{"type":"text","_meta":{"__statedOptions":["required","description","default","enum"],"required":true,"description":"The state of this stock: available, allocated, wip, qc_hold or damaged."},"required":true,"default":"available","description":"The state of this stock: available, allocated, wip, qc_hold or damaged.","enum":["available","allocated","wip","qc_hold","damaged"]},"qty":{"type":"decimal","_meta":{"__statedOptions":["description"],"description":"How many are on hand."},"required":false,"description":"How many are on hand."},"reorderPoint":{"type":"decimal","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"reorderQuantity":{"type":"decimal","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false}},"methods":{},"decoratorConfig":{"display":{"references":{"skuId":"@happyvertical/smrt-products:Sku"},"label":{"via":"skuId","field":"name","fallback":"Unknown item"},"list":["displayLabel","state","qty"]},"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","displayLabelProjection":{"via":"skuId","field":"name","fallback":"Unknown item"},"displayLabelField":"displayLabel","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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"b249d8e6"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockMovement":{"name":"stockmovement","className":"StockMovement","qualifiedName":"@happyvertical/smrt-inventory:StockMovement","collection":"stockmovements","filePath":"src/models/StockMovement.ts","packageName":"@happyvertical/smrt-inventory","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","nullable","__tenancy","required"],"sqlType":"UUID","nullable":true,"required":false},"required":false},"skuId":{"type":"text","_meta":{"__statedOptions":["required","requiredFor","description","default"],"required":true,"description":"The item that moved.","requiredFor":"identity"},"required":true,"default":"","description":"The item that moved."},"locationId":{"type":"text","_meta":{"__statedOptions":["required","requiredFor","description","default"],"required":true,"description":"The place it moved at.","requiredFor":"identity"},"required":true,"default":"","description":"The place it moved at."},"lotId":{"type":"text","_meta":{"__statedOptions":["nullable","description","required"],"description":"The lot that moved, when tracked by lot.","nullable":true,"required":false},"required":false,"description":"The lot that moved, when tracked by lot."},"fromState":{"type":"text","_meta":{"__statedOptions":["description","enum"],"description":"What it was before, for example available or damaged."},"required":false,"description":"What it was before, for example available or damaged.","enum":["available","allocated","wip","qc_hold","damaged"]},"toState":{"type":"text","_meta":{"__statedOptions":["description","enum"],"description":"What it became."},"required":false,"description":"What it became.","enum":["available","allocated","wip","qc_hold","damaged"]},"qty":{"type":"decimal","_meta":{"__statedOptions":["description"],"description":"How many moved."},"required":false,"description":"How many moved."},"reasonCode":{"type":"text","_meta":{"__statedOptions":["required","description","default"],"required":true,"description":"Why it moved, for example adjustment, sale or return."},"required":true,"default":"adjustment","description":"Why it moved, for example adjustment, sale or return."},"sourceType":{"type":"text","_meta":{"__statedOptions":["default"]},"required":false,"default":""},"sourceId":{"type":"text","_meta":{"__statedOptions":["default"]},"required":false,"default":""},"actorProfileId":{"type":"crossPackageRef","_meta":{"__statedOptions":["related"]},"required":false,"related":"@happyvertical/smrt-profiles:Profile"},"note":{"type":"text","_meta":{"__statedOptions":["description","default"],"description":"Anything worth remembering about this movement."},"required":false,"default":"","description":"Anything worth remembering about this movement."},"occurredAt":{"type":"datetime","_meta":{"__statedOptions":["description"],"description":"When it happened."},"required":false,"description":"When it happened."}},"methods":{},"decoratorConfig":{"display":{"references":{"skuId":"@happyvertical/smrt-products:Sku"},"label":{"via":"skuId","field":"name","fallback":"Unknown item"},"list":["displayLabel","reasonCode","qty","occurredAt"]},"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","displayLabelProjection":{"via":"skuId","field":"name","fallback":"Unknown item"},"displayLabelField":"displayLabel","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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"c82313b7"},"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-products, @happyvertical/smrt-tenancy, which do not build for a browser (#3616, #3624, #3626)."]}}],"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-products","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3616","#3624","#3626"],"via":["@happyvertical/smrt-products","@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/models/InventoryLocation.ts
|
|
9
9
|
var __defProp$7 = Object.defineProperty;
|
|
@@ -49,6 +49,7 @@ __publicField$7(InventoryLocation, "__smrtPackage__", "@happyvertical/smrt-inven
|
|
|
49
49
|
__decorateClass$7([tenantId({ nullable: true })], InventoryLocation.prototype, "tenantId", 2);
|
|
50
50
|
__decorateClass$7([field({
|
|
51
51
|
required: true,
|
|
52
|
+
requiredFor: "identity",
|
|
52
53
|
description: "A short code for the place stock is kept, for example MAIN."
|
|
53
54
|
})], InventoryLocation.prototype, "code", 2);
|
|
54
55
|
__decorateClass$7([field({ description: "What you call the place, for example Main warehouse." })], InventoryLocation.prototype, "name", 2);
|
|
@@ -190,7 +191,6 @@ __decorateClass$6([field({
|
|
|
190
191
|
})], Lot.prototype, "skuId", 2);
|
|
191
192
|
__decorateClass$6([field({ description: "Whether this is a batch (lot) or a single unit (serial)." })], Lot.prototype, "kind", 2);
|
|
192
193
|
__decorateClass$6([field({
|
|
193
|
-
required: true,
|
|
194
194
|
maxLength: 128,
|
|
195
195
|
description: "The batch code, supplier lot or serial number."
|
|
196
196
|
})], Lot.prototype, "lotNumber", 2);
|
|
@@ -200,6 +200,7 @@ __decorateClass$6([field({
|
|
|
200
200
|
})], Lot.prototype, "searchKey", 2);
|
|
201
201
|
__decorateClass$6([field({
|
|
202
202
|
required: true,
|
|
203
|
+
requiredFor: "identity",
|
|
203
204
|
maxLength: 160,
|
|
204
205
|
description: "Internal identity that keeps lots from being created twice."
|
|
205
206
|
})], Lot.prototype, "identityKey", 2);
|
|
@@ -302,6 +303,7 @@ __publicField$5(LotCorrection, "__smrtPackage__", "@happyvertical/smrt-inventory
|
|
|
302
303
|
__decorateClass$5([tenantId({ nullable: true })], LotCorrection.prototype, "tenantId", 2);
|
|
303
304
|
__decorateClass$5([foreignKey(Lot, {
|
|
304
305
|
required: true,
|
|
306
|
+
requiredFor: "identity",
|
|
305
307
|
onDelete: "RESTRICT",
|
|
306
308
|
onUpdate: "RESTRICT",
|
|
307
309
|
constraint: { engines: ["postgres", "sqlite"] }
|
|
@@ -321,7 +323,6 @@ __decorateClass$5([field({
|
|
|
321
323
|
})], LotCorrection.prototype, "newValue", 2);
|
|
322
324
|
__decorateClass$5([field({
|
|
323
325
|
type: "text",
|
|
324
|
-
required: true,
|
|
325
326
|
maxLength: 1e3,
|
|
326
327
|
description: "Why it was corrected."
|
|
327
328
|
})], LotCorrection.prototype, "reason", 2);
|
|
@@ -388,6 +389,7 @@ __publicField$4(LotDocument, "__smrtPackage__", "@happyvertical/smrt-inventory")
|
|
|
388
389
|
__decorateClass$4([tenantId({ nullable: true })], LotDocument.prototype, "tenantId", 2);
|
|
389
390
|
__decorateClass$4([foreignKey(Lot, {
|
|
390
391
|
required: true,
|
|
392
|
+
requiredFor: "identity",
|
|
391
393
|
onDelete: "RESTRICT",
|
|
392
394
|
onUpdate: "RESTRICT",
|
|
393
395
|
constraint: { engines: ["postgres", "sqlite"] }
|
|
@@ -454,6 +456,7 @@ __publicField$3(LotStockLevel, "__smrtPackage__", "@happyvertical/smrt-inventory
|
|
|
454
456
|
__decorateClass$3([tenantId({ nullable: true })], LotStockLevel.prototype, "tenantId", 2);
|
|
455
457
|
__decorateClass$3([foreignKey(Lot, {
|
|
456
458
|
required: true,
|
|
459
|
+
requiredFor: "identity",
|
|
457
460
|
onDelete: "RESTRICT",
|
|
458
461
|
onUpdate: "RESTRICT",
|
|
459
462
|
constraint: { engines: ["postgres", "sqlite"] }
|
|
@@ -461,6 +464,7 @@ __decorateClass$3([foreignKey(Lot, {
|
|
|
461
464
|
__decorateClass$3([field({ description: "The item the lot is of." })], LotStockLevel.prototype, "skuId", 2);
|
|
462
465
|
__decorateClass$3([field({
|
|
463
466
|
required: true,
|
|
467
|
+
requiredFor: "identity",
|
|
464
468
|
description: "Where the lot is kept."
|
|
465
469
|
})], LotStockLevel.prototype, "locationId", 2);
|
|
466
470
|
__decorateClass$3([field({
|
|
@@ -561,16 +565,19 @@ __publicField$2(LotUsage, "__smrtPackage__", "@happyvertical/smrt-inventory");
|
|
|
561
565
|
__decorateClass$2([tenantId({ nullable: true })], LotUsage.prototype, "tenantId", 2);
|
|
562
566
|
__decorateClass$2([foreignKey(Lot, {
|
|
563
567
|
required: true,
|
|
568
|
+
requiredFor: "identity",
|
|
564
569
|
onDelete: "RESTRICT",
|
|
565
570
|
onUpdate: "RESTRICT",
|
|
566
571
|
constraint: { engines: ["postgres", "sqlite"] }
|
|
567
572
|
})], LotUsage.prototype, "lotId", 2);
|
|
568
573
|
__decorateClass$2([field({
|
|
569
574
|
required: true,
|
|
575
|
+
requiredFor: "identity",
|
|
570
576
|
description: "What kind of record used the lot."
|
|
571
577
|
})], LotUsage.prototype, "consumerType", 2);
|
|
572
578
|
__decorateClass$2([field({
|
|
573
579
|
required: true,
|
|
580
|
+
requiredFor: "identity",
|
|
574
581
|
description: "The record that used the lot."
|
|
575
582
|
})], LotUsage.prototype, "consumerId", 2);
|
|
576
583
|
__decorateClass$2([field({
|
|
@@ -675,10 +682,12 @@ __publicField$1(StockLevel, "__smrtPackage__", "@happyvertical/smrt-inventory");
|
|
|
675
682
|
__decorateClass$1([tenantId({ nullable: true })], StockLevel.prototype, "tenantId", 2);
|
|
676
683
|
__decorateClass$1([field({
|
|
677
684
|
required: true,
|
|
685
|
+
requiredFor: "identity",
|
|
678
686
|
description: "The item being counted."
|
|
679
687
|
})], StockLevel.prototype, "skuId", 2);
|
|
680
688
|
__decorateClass$1([field({
|
|
681
689
|
required: true,
|
|
690
|
+
requiredFor: "identity",
|
|
682
691
|
description: "Where the stock is kept."
|
|
683
692
|
})], StockLevel.prototype, "locationId", 2);
|
|
684
693
|
__decorateClass$1([field({
|
|
@@ -847,10 +856,12 @@ __publicField(StockMovement, "__smrtPackage__", "@happyvertical/smrt-inventory")
|
|
|
847
856
|
__decorateClass([tenantId({ nullable: true })], StockMovement.prototype, "tenantId", 2);
|
|
848
857
|
__decorateClass([field({
|
|
849
858
|
required: true,
|
|
859
|
+
requiredFor: "identity",
|
|
850
860
|
description: "The item that moved."
|
|
851
861
|
})], StockMovement.prototype, "skuId", 2);
|
|
852
862
|
__decorateClass([field({
|
|
853
863
|
required: true,
|
|
864
|
+
requiredFor: "identity",
|
|
854
865
|
description: "The place it moved at."
|
|
855
866
|
})], StockMovement.prototype, "locationId", 2);
|
|
856
867
|
__decorateClass([field({
|