@happyvertical/smrt-inventory 0.56.1 → 0.57.0
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 +1 -1
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +54 -4
- package/dist/smrt-knowledge.json +55 -465
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ObjectRegistry, SmrtCollection, SmrtObject, SmrtRecipe, crossPackageRef
|
|
|
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.56.1","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}`));
|
|
5
|
+
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-inventory","packageVersion":"0.57.0","objects":{"@happyvertical/smrt-inventory:InventoryLocationCollection":{"name":"inventorylocationcollection","className":"InventoryLocationCollection","qualifiedName":"@happyvertical/smrt-inventory:InventoryLocationCollection","collection":"inventorylocations","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/InventoryLocationCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"findByCode":{"name":"findByCode","async":true,"parameters":[{"name":"code","type":"string","optional":false}],"returnType":"Promise<InventoryLocation | null>","isStatic":false,"isPublic":true},"findByKind":{"name":"findByKind","async":true,"parameters":[{"name":"kind","type":"InventoryLocationKind","optional":false}],"returnType":"Promise<InventoryLocation[]>","isStatic":false,"isPublic":true},"findByPlace":{"name":"findByPlace","async":true,"parameters":[{"name":"placeId","type":"string","optional":false}],"returnType":"Promise<InventoryLocation[]>","isStatic":false,"isPublic":true},"findActive":{"name":"findActive","async":true,"parameters":[{"name":"kind","type":"InventoryLocationKind","optional":true}],"returnType":"Promise<InventoryLocation[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_locations","api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"InventoryLocation","exportName":"InventoryLocationCollection","collectionExportName":"InventoryLocationCollectionCollection","schema":{"tableName":"inventory_locations","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_locations\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"code\\" TEXT NOT NULL DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"kind\\" TEXT DEFAULT 'warehouse',\\n \\"place_id\\" TEXT DEFAULT '',\\n \\"active\\" BOOLEAN DEFAULT TRUE\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"code":{"type":"TEXT","notNull":true,"unique":false,"default":""},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"warehouse"},"place_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true}},"indexes":[{"name":"inventory_locations_code_tenant_id_idx","columns":["code","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_locations_slug_context_idx","columns":["slug","context"]},{"name":"inventory_locations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"401c28a1"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockLevelCollection":{"name":"stocklevelcollection","className":"StockLevelCollection","qualifiedName":"@happyvertical/smrt-inventory:StockLevelCollection","collection":"stocklevels","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockLevelCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"getLevel":{"name":"getLevel","async":true,"parameters":[{"name":"skuId","type":"string","optional":false},{"name":"locationId","type":"string","optional":false},{"name":"state","type":"StockState","optional":true,"default":"available"}],"returnType":"Promise<StockLevel | null>","isStatic":false,"isPublic":true},"findBySku":{"name":"findBySku","async":true,"parameters":[{"name":"skuId","type":"string","optional":false}],"returnType":"Promise<StockLevel[]>","isStatic":false,"isPublic":true},"findByLocation":{"name":"findByLocation","async":true,"parameters":[{"name":"locationId","type":"string","optional":false}],"returnType":"Promise<StockLevel[]>","isStatic":false,"isPublic":true},"findBelowReorderPoint":{"name":"findBelowReorderPoint","async":true,"parameters":[{"name":"locationId","type":"string","optional":true}],"returnType":"Promise<StockLevel[]>","isStatic":false,"isPublic":true},"totalForSku":{"name":"totalForSku","async":true,"parameters":[{"name":"skuId","type":"string","optional":false},{"name":"state","type":"StockState","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"totalForLocation":{"name":"totalForLocation","async":true,"parameters":[{"name":"locationId","type":"string","optional":false},{"name":"state","type":"StockState","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_stock_levels","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"StockLevel","exportName":"StockLevelCollection","collectionExportName":"StockLevelCollectionCollection","schema":{"tableName":"inventory_stock_levels","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_levels\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"state\\" TEXT NOT NULL DEFAULT 'available',\\n \\"qty\\" REAL,\\n \\"reorder_point\\" REAL,\\n \\"reorder_quantity\\" REAL\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"sku_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"location_id":{"type":"TEXT","notNull":true,"unique":false,"default":""},"state":{"type":"TEXT","notNull":true,"unique":false,"default":"available"},"qty":{"type":"REAL","notNull":false,"unique":false},"reorder_point":{"type":"REAL","notNull":false,"unique":false},"reorder_quantity":{"type":"REAL","notNull":false,"unique":false}},"indexes":[{"name":"inventory_stock_levels_sku_id_location_id_idx","columns":["sku_id","location_id","state","tenant_id"],"unique":true,"nullsNotDistinct":true},{"name":"inventory_stock_levels_slug_context_idx","columns":["slug","context"]},{"name":"inventory_stock_levels_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"02387935"},"importPath":"@happyvertical/smrt-inventory"},"@happyvertical/smrt-inventory:StockMovementCollection":{"name":"stockmovementcollection","className":"StockMovementCollection","qualifiedName":"@happyvertical/smrt-inventory:StockMovementCollection","collection":"stockmovements","filePath":"/home/runner/work/smrt/smrt/packages/inventory/src/collections/StockMovementCollection.ts","packageName":"@happyvertical/smrt-inventory","fields":{},"methods":{"findBySku":{"name":"findBySku","async":true,"parameters":[{"name":"skuId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findByLocation":{"name":"findByLocation","async":true,"parameters":[{"name":"locationId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findBySource":{"name":"findBySource","async":true,"parameters":[{"name":"sourceType","type":"string","optional":false},{"name":"sourceId","type":"string","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true},"findByReason":{"name":"findByReason","async":true,"parameters":[{"name":"reasonCode","type":"StockMovementReason","optional":false}],"returnType":"Promise<StockMovement[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"inventory_stock_movements","api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]}},"extends":"SmrtCollection","extendsTypeArg":"StockMovement","exportName":"StockMovementCollection","collectionExportName":"StockMovementCollectionCollection","schema":{"tableName":"inventory_stock_movements","ddl":"CREATE TABLE IF NOT EXISTS \\"inventory_stock_movements\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"sku_id\\" TEXT NOT NULL DEFAULT '',\\n \\"location_id\\" TEXT NOT NULL DEFAULT '',\\n \\"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;
|