@happyvertical/smrt-inventory 0.55.7 → 0.55.9

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.d.ts CHANGED
@@ -46,6 +46,7 @@
46
46
  import './__smrt-register__.js';
47
47
  export { InventoryLocationCollection, StockLevelCollection, StockMovementCollection, } from './collections/index.js';
48
48
  export { InventoryLocation, type InventoryLocationOptions, StockLevel, type StockLevelOptions, StockMovement, type StockMovementOptions, } from './models/index.js';
49
+ export { StockRecipe } from './recipes.js';
49
50
  export { type ContractCreatedLine, type ContractCreatedPayload, createStockService, type FulfillmentShippedLine, type FulfillmentShippedPayload, type InstalledInventoryDispatchHandlers, type InstallInventoryDispatchHandlersOptions, InsufficientStockError, installInventoryDispatchHandlers, type StockMutationOptions, StockService, type StockServiceOptions, } from './services/index.js';
50
51
  export type { InventoryLocationKind, StockMovementReason, StockState, } from './types.js';
51
52
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAMH,OAAO,wBAAwB,CAAC;AAKhC,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,UAAU,EACV,KAAK,iBAAiB,EACtB,aAAa,EACb,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,kCAAkC,EACvC,KAAK,uCAAuC,EAC5C,sBAAsB,EACtB,gCAAgC,EAChC,KAAK,oBAAoB,EACzB,YAAY,EACZ,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAK7B,YAAY,EACV,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,GACX,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAMH,OAAO,wBAAwB,CAAC;AAKhC,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,UAAU,EACV,KAAK,iBAAiB,EACtB,aAAa,EACb,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,kCAAkC,EACvC,KAAK,uCAAuC,EAC5C,sBAAsB,EACtB,gCAAgC,EAChC,KAAK,oBAAoB,EACzB,YAAY,EACZ,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAI7B,YAAY,EACV,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,GACX,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { ObjectRegistry, SmrtCollection, SmrtObject, crossPackageRef, field, resolveDatabase, smrt } from "@happyvertical/smrt-core";
1
+ import { ObjectRegistry, SmrtCollection, SmrtObject, SmrtRecipe, crossPackageRef, field, resolveDatabase, smrt } from "@happyvertical/smrt-core";
2
2
  import { TenantScoped, tenantId } from "@happyvertical/smrt-tenancy";
3
3
  import { createLogger } from "@happyvertical/logger";
4
4
  //#region src/__smrt-register__.ts
5
- ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-inventory","packageVersion":"0.55.7","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"},"extends":"SmrtCollection","extendsTypeArg":"InventoryLocation","exportName":"InventoryLocationCollection","collectionExportName":"InventoryLocationCollectionCollection","schema":{"tableName":"inventory_locations","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_locations\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"code\\" TEXT NOT NULL DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"kind\\" TEXT DEFAULT 'warehouse',\\n \\"place_id\\" TEXT DEFAULT '',\\n \\"active\\" BOOLEAN DEFAULT TRUE\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"code":{"type":"TEXT","notNull":true,"unique":false,"default":""},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"warehouse"},"place_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true}},"indexes":[{"name":"inventory_locations_code_tenant_id_idx","columns":["code","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_locations_slug_context_idx","columns":["slug","context"]},{"name":"inventory_locations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"401c28a1"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory: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"},"extends":"SmrtCollection","extendsTypeArg":"StockLevel","exportName":"StockLevelCollection","collectionExportName":"StockLevelCollectionCollection","schema":{"tableName":"inventory_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_levels\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"state\\" TEXT NOT NULL DEFAULT 'available',\\n \\"qty\\" REAL,\\n \\"reorder_point\\" REAL,\\n \\"reorder_quantity\\" REAL\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"state":{"type":"TEXT","notNull":true,"unique":false,"default":"available"},"qty":{"type":"REAL","notNull":false,"unique":false},"reorder_point":{"type":"REAL","notNull":false,"unique":false},"reorder_quantity":{"type":"REAL","notNull":false,"unique":false}},"indexes":[{"name":"inventory_stock_levels_sku_id_location_id_idx","columns":["sku_id","location_id","state","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_stock_levels_slug_context_idx","columns":["slug","context"]},{"name":"inventory_stock_levels_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"02387935"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockMovementCollection":{"name":"stockmovementcollection","className":"StockMovementCollection","qualifiedName":"@happyvertical/smrt-inventory:StockMovementCollection","collection":"stockmovements","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockMovementCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"findBySku":{"name":"findBySku","async":true,"parameters":[{"name":"skuId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findByLocation":{"name":"findByLocation","async":true,"parameters":[{"name":"locationId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findBySource":{"name":"findBySource","async":true,"parameters":[{"name":"sourceType","type":"string","optional":false},{"name":"sourceId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findByReason":{"name":"findByReason","async":true,"parameters":[{"name":"reasonCode","type":"StockMovementReason","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_stock_movements"},"extends":"SmrtCollection","extendsTypeArg":"StockMovement","exportName":"StockMovementCollection","collectionExportName":"StockMovementCollectionCollection","schema":{"tableName":"inventory_stock_movements","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_movements\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"from_state\\" TEXT,\\n \\"to_state\\" TEXT,\\n \\"qty\\" REAL,\\n \\"reason_code\\" TEXT NOT NULL DEFAULT 'adjustment',\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"actor_profile_id\\" UUID,\\n \\"note\\" TEXT DEFAULT '',\\n \\"occurred_at\\" TIMESTAMP\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"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_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_stock_movements_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"eff1027e"},"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":"","_meta":{"required":true}},"name":{"type":"text","required":false,"default":""},"kind":{"type":"text","required":false,"default":"warehouse"},"placeId":{"type":"text","required":false,"default":""},"active":{"type":"boolean","required":false,"default":true}},"methods":{},"decoratorConfig":{"tableName":"inventory_locations","conflictColumns":["code","tenant_id"],"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":true,"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"InventoryLocation","collectionExportName":"InventoryLocationCollection","displayLabelField":"name","validationRules":[{"field":"code","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_locations","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_locations\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"code\\" TEXT NOT NULL DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"kind\\" TEXT DEFAULT 'warehouse',\\n \\"place_id\\" TEXT DEFAULT '',\\n \\"active\\" BOOLEAN DEFAULT TRUE\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"code":{"type":"TEXT","notNull":true,"unique":false,"default":""},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"warehouse"},"place_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true}},"indexes":[{"name":"inventory_locations_code_tenant_id_idx","columns":["code","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_locations_slug_context_idx","columns":["slug","context"]},{"name":"inventory_locations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"401c28a1"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory: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":"","_meta":{"required":true}},"locationId":{"type":"text","required":true,"default":"","_meta":{"required":true}},"state":{"type":"text","required":true,"default":"available","_meta":{"required":true},"enum":["available","allocated","wip","qc_hold","damaged"]},"qty":{"type":"decimal","required":false,"_meta":{}},"reorderPoint":{"type":"decimal","required":false,"_meta":{"nullable":true}},"reorderQuantity":{"type":"decimal","required":false,"_meta":{"nullable":true}}},"methods":{},"decoratorConfig":{"tableName":"inventory_stock_levels","conflictColumns":["sku_id","location_id","state","tenant_id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"StockLevel","collectionExportName":"StockLevelCollection","validationRules":[{"field":"skuId","rule":"required","fieldType":"text"},{"field":"locationId","rule":"required","fieldType":"text"},{"field":"state","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_levels\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"state\\" TEXT NOT NULL DEFAULT 'available',\\n \\"qty\\" REAL,\\n \\"reorder_point\\" REAL,\\n \\"reorder_quantity\\" REAL\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"state":{"type":"TEXT","notNull":true,"unique":false,"default":"available"},"qty":{"type":"REAL","notNull":false,"unique":false},"reorder_point":{"type":"REAL","notNull":false,"unique":false},"reorder_quantity":{"type":"REAL","notNull":false,"unique":false}},"indexes":[{"name":"inventory_stock_levels_sku_id_location_id_idx","columns":["sku_id","location_id","state","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_stock_levels_slug_context_idx","columns":["slug","context"]},{"name":"inventory_stock_levels_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"02387935"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockMovement":{"name":"stockmovement","className":"StockMovement","qualifiedName":"@happyvertical/smrt-inventory:StockMovement","collection":"stockmovements","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/StockMovement.ts","packageName":"@happyvertical/smrt-inventory","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"skuId":{"type":"text","required":true,"default":"","_meta":{"required":true}},"locationId":{"type":"text","required":true,"default":"","_meta":{"required":true}},"fromState":{"type":"text","required":false,"enum":["available","allocated","wip","qc_hold","damaged"]},"toState":{"type":"text","required":false,"enum":["available","allocated","wip","qc_hold","damaged"]},"qty":{"type":"decimal","required":false,"_meta":{}},"reasonCode":{"type":"text","required":true,"default":"adjustment","_meta":{"required":true}},"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":""},"occurredAt":{"type":"datetime","required":false}},"methods":{},"decoratorConfig":{"tableName":"inventory_stock_movements","conflictColumns":["id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"StockMovement","collectionExportName":"StockMovementCollection","validationRules":[{"field":"skuId","rule":"required","fieldType":"text"},{"field":"locationId","rule":"required","fieldType":"text"},{"field":"reasonCode","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_stock_movements","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_movements\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"from_state\\" TEXT,\\n \\"to_state\\" TEXT,\\n \\"qty\\" REAL,\\n \\"reason_code\\" TEXT NOT NULL DEFAULT 'adjustment',\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"actor_profile_id\\" UUID,\\n \\"note\\" TEXT DEFAULT '',\\n \\"occurred_at\\" TIMESTAMP\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"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_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_stock_movements_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"eff1027e"},"importPath":"@happyvertical/smrt-inventory"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-tenancy"],"stampsConstructors":true}`));
5
+ ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-inventory","packageVersion":"0.55.9","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"},"extends":"SmrtCollection","extendsTypeArg":"InventoryLocation","exportName":"InventoryLocationCollection","collectionExportName":"InventoryLocationCollectionCollection","schema":{"tableName":"inventory_locations","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_locations\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"code\\" TEXT NOT NULL DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"kind\\" TEXT DEFAULT 'warehouse',\\n \\"place_id\\" TEXT DEFAULT '',\\n \\"active\\" BOOLEAN DEFAULT TRUE\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"code":{"type":"TEXT","notNull":true,"unique":false,"default":""},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"warehouse"},"place_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true}},"indexes":[{"name":"inventory_locations_code_tenant_id_idx","columns":["code","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_locations_slug_context_idx","columns":["slug","context"]},{"name":"inventory_locations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"401c28a1"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory: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"},"extends":"SmrtCollection","extendsTypeArg":"StockLevel","exportName":"StockLevelCollection","collectionExportName":"StockLevelCollectionCollection","schema":{"tableName":"inventory_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_levels\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"state\\" TEXT NOT NULL DEFAULT 'available',\\n \\"qty\\" REAL,\\n \\"reorder_point\\" REAL,\\n \\"reorder_quantity\\" REAL\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"state":{"type":"TEXT","notNull":true,"unique":false,"default":"available"},"qty":{"type":"REAL","notNull":false,"unique":false},"reorder_point":{"type":"REAL","notNull":false,"unique":false},"reorder_quantity":{"type":"REAL","notNull":false,"unique":false}},"indexes":[{"name":"inventory_stock_levels_sku_id_location_id_idx","columns":["sku_id","location_id","state","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_stock_levels_slug_context_idx","columns":["slug","context"]},{"name":"inventory_stock_levels_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"02387935"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockMovementCollection":{"name":"stockmovementcollection","className":"StockMovementCollection","qualifiedName":"@happyvertical/smrt-inventory:StockMovementCollection","collection":"stockmovements","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockMovementCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"findBySku":{"name":"findBySku","async":true,"parameters":[{"name":"skuId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findByLocation":{"name":"findByLocation","async":true,"parameters":[{"name":"locationId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findBySource":{"name":"findBySource","async":true,"parameters":[{"name":"sourceType","type":"string","optional":false},{"name":"sourceId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findByReason":{"name":"findByReason","async":true,"parameters":[{"name":"reasonCode","type":"StockMovementReason","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_stock_movements"},"extends":"SmrtCollection","extendsTypeArg":"StockMovement","exportName":"StockMovementCollection","collectionExportName":"StockMovementCollectionCollection","schema":{"tableName":"inventory_stock_movements","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_movements\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"from_state\\" TEXT,\\n \\"to_state\\" TEXT,\\n \\"qty\\" REAL,\\n \\"reason_code\\" TEXT NOT NULL DEFAULT 'adjustment',\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"actor_profile_id\\" UUID,\\n \\"note\\" TEXT DEFAULT '',\\n \\"occurred_at\\" TIMESTAMP\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"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_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_stock_movements_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"eff1027e"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:InventoryLocation":{"name":"inventorylocation","className":"InventoryLocation","qualifiedName":"@happyvertical/smrt-inventory:InventoryLocation","collection":"inventorylocations","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/InventoryLocation.ts","packageName":"@happyvertical/smrt-inventory","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"code":{"type":"text","required":true,"default":"","description":"A short code for the place stock is kept, for example MAIN.","_meta":{"required":true,"description":"A short code for the place stock is kept, for example MAIN."}},"name":{"type":"text","required":false,"default":"","description":"What you call the place, for example Main warehouse.","_meta":{"description":"What you call the place, for example Main warehouse."}},"kind":{"type":"text","required":false,"default":"warehouse","description":"What sort of place it is, for example a warehouse or a shop floor.","_meta":{"description":"What sort of place it is, for example a warehouse or a shop floor."}},"placeId":{"type":"text","required":false,"default":""},"active":{"type":"boolean","required":false,"default":true}},"methods":{},"decoratorConfig":{"tableName":"inventory_locations","conflictColumns":["code","tenant_id"],"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":true,"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"InventoryLocation","collectionExportName":"InventoryLocationCollection","displayLabelField":"name","validationRules":[{"field":"code","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_locations","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_locations\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"code\\" TEXT NOT NULL DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"kind\\" TEXT DEFAULT 'warehouse',\\n \\"place_id\\" TEXT DEFAULT '',\\n \\"active\\" BOOLEAN DEFAULT TRUE\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"code":{"type":"TEXT","notNull":true,"unique":false,"default":""},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"warehouse"},"place_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true}},"indexes":[{"name":"inventory_locations_code_tenant_id_idx","columns":["code","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_locations_slug_context_idx","columns":["slug","context"]},{"name":"inventory_locations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"401c28a1"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockLevel":{"name":"stocklevel","className":"StockLevel","qualifiedName":"@happyvertical/smrt-inventory:StockLevel","collection":"stocklevels","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/StockLevel.ts","packageName":"@happyvertical/smrt-inventory","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"skuId":{"type":"text","required":true,"default":"","description":"The item being counted.","_meta":{"required":true,"description":"The item being counted."}},"locationId":{"type":"text","required":true,"default":"","description":"Where the stock is kept.","_meta":{"required":true,"description":"Where the stock is kept."}},"state":{"type":"text","required":true,"default":"available","description":"The state of this stock: available, allocated, wip, qc_hold or damaged.","_meta":{"required":true,"description":"The state of this stock: available, allocated, wip, qc_hold or damaged."},"enum":["available","allocated","wip","qc_hold","damaged"]},"qty":{"type":"decimal","required":false,"description":"How many are on hand.","_meta":{"description":"How many are on hand."}},"reorderPoint":{"type":"decimal","required":false,"_meta":{"nullable":true}},"reorderQuantity":{"type":"decimal","required":false,"_meta":{"nullable":true}}},"methods":{},"decoratorConfig":{"tableName":"inventory_stock_levels","conflictColumns":["sku_id","location_id","state","tenant_id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"StockLevel","collectionExportName":"StockLevelCollection","validationRules":[{"field":"skuId","rule":"required","fieldType":"text"},{"field":"locationId","rule":"required","fieldType":"text"},{"field":"state","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_levels\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"state\\" TEXT NOT NULL DEFAULT 'available',\\n \\"qty\\" REAL,\\n \\"reorder_point\\" REAL,\\n \\"reorder_quantity\\" REAL\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"state":{"type":"TEXT","notNull":true,"unique":false,"default":"available"},"qty":{"type":"REAL","notNull":false,"unique":false},"reorder_point":{"type":"REAL","notNull":false,"unique":false},"reorder_quantity":{"type":"REAL","notNull":false,"unique":false}},"indexes":[{"name":"inventory_stock_levels_sku_id_location_id_idx","columns":["sku_id","location_id","state","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_stock_levels_slug_context_idx","columns":["slug","context"]},{"name":"inventory_stock_levels_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"02387935"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockMovement":{"name":"stockmovement","className":"StockMovement","qualifiedName":"@happyvertical/smrt-inventory:StockMovement","collection":"stockmovements","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/models/StockMovement.ts","packageName":"@happyvertical/smrt-inventory","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"skuId":{"type":"text","required":true,"default":"","description":"The item that moved.","_meta":{"required":true,"description":"The item that moved."}},"locationId":{"type":"text","required":true,"default":"","description":"The place it moved at.","_meta":{"required":true,"description":"The place it moved at."}},"fromState":{"type":"text","required":false,"description":"What it was before, for example available or damaged.","_meta":{"description":"What it was before, for example available or damaged."},"enum":["available","allocated","wip","qc_hold","damaged"]},"toState":{"type":"text","required":false,"description":"What it became.","_meta":{"description":"What it became."},"enum":["available","allocated","wip","qc_hold","damaged"]},"qty":{"type":"decimal","required":false,"description":"How many moved.","_meta":{"description":"How many moved."}},"reasonCode":{"type":"text","required":true,"default":"adjustment","description":"Why it moved, for example adjustment, sale or return.","_meta":{"required":true,"description":"Why it moved, for example adjustment, sale or return."}},"sourceType":{"type":"text","required":false,"default":""},"sourceId":{"type":"text","required":false,"default":""},"actorProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile"},"note":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this movement.","_meta":{"description":"Anything worth remembering about this movement."}},"occurredAt":{"type":"datetime","required":false,"description":"When it happened.","_meta":{"description":"When it happened."}}},"methods":{},"decoratorConfig":{"tableName":"inventory_stock_movements","conflictColumns":["id"],"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"StockMovement","collectionExportName":"StockMovementCollection","validationRules":[{"field":"skuId","rule":"required","fieldType":"text"},{"field":"locationId","rule":"required","fieldType":"text"},{"field":"reasonCode","rule":"required","fieldType":"text"}],"schema":{"tableName":"inventory_stock_movements","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_movements\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"from_state\\" TEXT,\\n \\"to_state\\" TEXT,\\n \\"qty\\" REAL,\\n \\"reason_code\\" TEXT NOT NULL DEFAULT 'adjustment',\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"actor_profile_id\\" UUID,\\n \\"note\\" TEXT DEFAULT '',\\n \\"occurred_at\\" TIMESTAMP\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"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_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"inventory_stock_movements_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"eff1027e"},"importPath":"@happyvertical/smrt-inventory"}},"moduleType":"smrt","recipes":[{"id":"inventory.stock","className":"StockRecipe","label":"Inventory","summary":"Keep count of how many of each product you have.","synonyms":["stock","quantity","on hand"],"models":["@happyvertical/smrt-inventory:StockLevel","@happyvertical/smrt-inventory:InventoryLocation","@happyvertical/smrt-inventory:StockMovement"],"nav":[{"label":"Stock levels","model":"@happyvertical/smrt-inventory:StockLevel","icon":"archive","description":"How much of each item you have on hand right now.","noun":"stock entry"},{"label":"Locations","model":"@happyvertical/smrt-inventory:InventoryLocation","icon":"home","description":"The places you keep stock, like shelves, rooms or vans."},{"label":"Stock movements","model":"@happyvertical/smrt-inventory:StockMovement","icon":"truck","description":"Every time stock came in, went out or moved."}],"requires":[],"requiresAny":[["products.simple","products.clothing"]],"section":{"id":"catalog","label":"Catalog","icon":"package","description":"Products, ingredients and the stock you hold."},"options":{"@happyvertical/smrt-inventory:StockLevel":{"fields":{"reorderPoint":{"visibility":"hidden"},"reorderQuantity":{"visibility":"hidden"}}},"@happyvertical/smrt-inventory:InventoryLocation":{"fields":{"placeId":{"visibility":"hidden"},"active":{"visibility":"hidden"}}},"@happyvertical/smrt-inventory:StockMovement":{"fields":{"sourceType":{"visibility":"hidden"},"sourceId":{"visibility":"hidden"},"actorProfileId":{"visibility":"hidden"}}}},"help":{"markdown":"## Overview\\n\\nInventory keeps count of how many of each product you have. Each count is a\\nstock level: an item, the place it is kept and how many are on hand. Stock can\\nsit in more than one place, and every change is recorded as a stock movement so\\nthere is a trail.\\n\\n## Tasks\\n\\n### Count what you have\\n\\n1. Create a stock level for the item and the place it is kept.\\n2. Set **{field:qty}** to how many you have on hand.\\n3. Set **{field:state}** if the stock is not available to sell, for example\\n allocated or on quality hold.\\n\\n### Correct a count\\n\\n1. Find the stock level for the item.\\n2. Set **{field:qty}** to what you really have. Record why as a stock movement.\\n\\n### Keep stock in more than one place\\n\\n1. Add a location with a **{field:code}** and a **{field:name}**, and say what\\n sort it is in **{field:kind}**.\\n2. Create stock levels against that location.\\n","fieldRefs":["code","kind","name","qty","state"]},"demo":{"mode":"server","reasons":["Needs a server because its package depends on @happyvertical/smrt-tenancy, which do not build for a browser (#3624)."]}}],"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3624"],"via":["@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
6
6
  //#endregion
7
7
  //#region src/models/InventoryLocation.ts
8
8
  var __defProp$2 = Object.defineProperty;
@@ -23,13 +23,7 @@ var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !==
23
23
  var InventoryLocation = class extends SmrtObject {
24
24
  tenantId = null;
25
25
  code = "";
26
- /** Display name for UIs. */
27
26
  name = "";
28
- /**
29
- * Open-ended classifier (`'warehouse'`, `'factory'`, `'retail'`,
30
- * `'in_transit'`, `'virtual'`, or anything else your domain needs).
31
- * The framework never branches on this value.
32
- */
33
27
  kind = "warehouse";
34
28
  /**
35
29
  * Optional plain-string reference to a `Place.id` in
@@ -52,7 +46,12 @@ var InventoryLocation = class extends SmrtObject {
52
46
  };
53
47
  __publicField$2(InventoryLocation, "__smrtPackage__", "@happyvertical/smrt-inventory");
54
48
  __decorateClass$2([tenantId({ nullable: true })], InventoryLocation.prototype, "tenantId", 2);
55
- __decorateClass$2([field({ required: true })], InventoryLocation.prototype, "code", 2);
49
+ __decorateClass$2([field({
50
+ required: true,
51
+ description: "A short code for the place stock is kept, for example MAIN."
52
+ })], InventoryLocation.prototype, "code", 2);
53
+ __decorateClass$2([field({ description: "What you call the place, for example Main warehouse." })], InventoryLocation.prototype, "name", 2);
54
+ __decorateClass$2([field({ description: "What sort of place it is, for example a warehouse or a shop floor." })], InventoryLocation.prototype, "kind", 2);
56
55
  InventoryLocation = __decorateClass$2([TenantScoped({ mode: "optional" }), smrt({
57
56
  tableName: "inventory_locations",
58
57
  conflictColumns: ["code", "tenant_id"],
@@ -149,10 +148,22 @@ var StockLevel = class extends SmrtObject {
149
148
  };
150
149
  __publicField$1(StockLevel, "__smrtPackage__", "@happyvertical/smrt-inventory");
151
150
  __decorateClass$1([tenantId({ nullable: true })], StockLevel.prototype, "tenantId", 2);
152
- __decorateClass$1([field({ required: true })], StockLevel.prototype, "skuId", 2);
153
- __decorateClass$1([field({ required: true })], StockLevel.prototype, "locationId", 2);
154
- __decorateClass$1([field({ required: true })], StockLevel.prototype, "state", 2);
155
- __decorateClass$1([field({ type: "decimal" })], StockLevel.prototype, "qty", 2);
151
+ __decorateClass$1([field({
152
+ required: true,
153
+ description: "The item being counted."
154
+ })], StockLevel.prototype, "skuId", 2);
155
+ __decorateClass$1([field({
156
+ required: true,
157
+ description: "Where the stock is kept."
158
+ })], StockLevel.prototype, "locationId", 2);
159
+ __decorateClass$1([field({
160
+ required: true,
161
+ description: "The state of this stock: available, allocated, wip, qc_hold or damaged."
162
+ })], StockLevel.prototype, "state", 2);
163
+ __decorateClass$1([field({
164
+ type: "decimal",
165
+ description: "How many are on hand."
166
+ })], StockLevel.prototype, "qty", 2);
156
167
  __decorateClass$1([field({
157
168
  type: "decimal",
158
169
  nullable: true
@@ -257,16 +268,7 @@ var StockMovement = class extends SmrtObject {
257
268
  tenantId = null;
258
269
  skuId = "";
259
270
  locationId = "";
260
- /**
261
- * Origin state for transitions (e.g. `available` → `allocated` for a
262
- * reservation). `null` indicates "no origin" — used when stock enters
263
- * the system fresh via {@link StockService.receive} or production.
264
- */
265
271
  fromState = null;
266
- /**
267
- * Destination state. `null` indicates "no destination" — used for
268
- * fulfilment, where stock leaves the building entirely.
269
- */
270
272
  toState = null;
271
273
  qty = 0;
272
274
  reasonCode = "adjustment";
@@ -283,12 +285,7 @@ var StockMovement = class extends SmrtObject {
283
285
  */
284
286
  sourceId = "";
285
287
  actorProfileId = null;
286
- /** Optional free-form note shown in audit UIs. */
287
288
  note = "";
288
- /**
289
- * When the movement happened. Set to `now` at write time; explicit
290
- * values are allowed when back-dating an import.
291
- */
292
289
  occurredAt = /* @__PURE__ */ new Date();
293
290
  constructor(options = {}) {
294
291
  super(options);
@@ -308,11 +305,27 @@ var StockMovement = class extends SmrtObject {
308
305
  };
309
306
  __publicField(StockMovement, "__smrtPackage__", "@happyvertical/smrt-inventory");
310
307
  __decorateClass([tenantId({ nullable: true })], StockMovement.prototype, "tenantId", 2);
311
- __decorateClass([field({ required: true })], StockMovement.prototype, "skuId", 2);
312
- __decorateClass([field({ required: true })], StockMovement.prototype, "locationId", 2);
313
- __decorateClass([field({ type: "decimal" })], StockMovement.prototype, "qty", 2);
314
- __decorateClass([field({ required: true })], StockMovement.prototype, "reasonCode", 2);
308
+ __decorateClass([field({
309
+ required: true,
310
+ description: "The item that moved."
311
+ })], StockMovement.prototype, "skuId", 2);
312
+ __decorateClass([field({
313
+ required: true,
314
+ description: "The place it moved at."
315
+ })], StockMovement.prototype, "locationId", 2);
316
+ __decorateClass([field({ description: "What it was before, for example available or damaged." })], StockMovement.prototype, "fromState", 2);
317
+ __decorateClass([field({ description: "What it became." })], StockMovement.prototype, "toState", 2);
318
+ __decorateClass([field({
319
+ type: "decimal",
320
+ description: "How many moved."
321
+ })], StockMovement.prototype, "qty", 2);
322
+ __decorateClass([field({
323
+ required: true,
324
+ description: "Why it moved, for example adjustment, sale or return."
325
+ })], StockMovement.prototype, "reasonCode", 2);
315
326
  __decorateClass([crossPackageRef("@happyvertical/smrt-profiles:Profile")], StockMovement.prototype, "actorProfileId", 2);
327
+ __decorateClass([field({ description: "Anything worth remembering about this movement." })], StockMovement.prototype, "note", 2);
328
+ __decorateClass([field({ description: "When it happened." })], StockMovement.prototype, "occurredAt", 2);
316
329
  StockMovement = __decorateClass([TenantScoped({ mode: "optional" }), smrt({
317
330
  tableName: "inventory_stock_movements",
318
331
  conflictColumns: ["id"],
@@ -371,6 +384,67 @@ var StockMovementCollection = class extends SmrtCollection {
371
384
  }
372
385
  };
373
386
  //#endregion
387
+ //#region src/recipes.ts
388
+ var StockRecipe = class extends SmrtRecipe {
389
+ static id = "inventory.stock";
390
+ static help = "./stock.recipe.md";
391
+ static label = "Inventory";
392
+ static summary = "Keep count of how many of each product you have.";
393
+ static synonyms = [
394
+ "stock",
395
+ "quantity",
396
+ "on hand"
397
+ ];
398
+ static section = {
399
+ id: "catalog",
400
+ label: "Catalog",
401
+ icon: "package",
402
+ description: "Products, ingredients and the stock you hold."
403
+ };
404
+ static models = [
405
+ StockLevel,
406
+ InventoryLocation,
407
+ StockMovement
408
+ ];
409
+ static nav = [
410
+ {
411
+ label: "Stock levels",
412
+ model: StockLevel,
413
+ icon: "archive",
414
+ description: "How much of each item you have on hand right now.",
415
+ noun: "stock entry"
416
+ },
417
+ {
418
+ label: "Locations",
419
+ model: InventoryLocation,
420
+ icon: "home",
421
+ description: "The places you keep stock, like shelves, rooms or vans."
422
+ },
423
+ {
424
+ label: "Stock movements",
425
+ model: StockMovement,
426
+ icon: "truck",
427
+ description: "Every time stock came in, went out or moved."
428
+ }
429
+ ];
430
+ static requiresAny = [["products.simple", "products.clothing"]];
431
+ static options = {
432
+ StockLevel: { fields: {
433
+ reorderPoint: { visibility: "hidden" },
434
+ reorderQuantity: { visibility: "hidden" }
435
+ } },
436
+ InventoryLocation: { fields: {
437
+ placeId: { visibility: "hidden" },
438
+ active: { visibility: "hidden" }
439
+ } },
440
+ StockMovement: { fields: {
441
+ sourceType: { visibility: "hidden" },
442
+ sourceId: { visibility: "hidden" },
443
+ actorProfileId: { visibility: "hidden" }
444
+ } }
445
+ };
446
+ };
447
+ //#endregion
374
448
  //#region src/services/StockService.ts
375
449
  var logger$1 = createLogger({ level: "info" });
376
450
  var InsufficientStockError = class extends Error {
@@ -863,6 +937,6 @@ async function buildStockService(options) {
863
937
  return createStockService({ db: options.db });
864
938
  }
865
939
  //#endregion
866
- export { InsufficientStockError, InventoryLocation, InventoryLocationCollection, StockLevel, StockLevelCollection, StockMovement, StockMovementCollection, StockService, createStockService, installInventoryDispatchHandlers };
940
+ export { InsufficientStockError, InventoryLocation, InventoryLocationCollection, StockLevel, StockLevelCollection, StockMovement, StockMovementCollection, StockRecipe, StockService, createStockService, installInventoryDispatchHandlers };
867
941
 
868
942
  //# sourceMappingURL=index.js.map