@happyvertical/smrt-manufacturing 0.55.7 → 0.55.8

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.
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-manufacturing",
5
- "packageVersion": "0.55.7",
5
+ "packageVersion": "0.55.8",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-manufacturing:BillOfMaterialsCollection": {
8
8
  "name": "billofmaterialscollection",
@@ -911,11 +911,19 @@
911
911
  },
912
912
  "name": {
913
913
  "type": "text",
914
- "required": false
914
+ "required": false,
915
+ "description": "The product name, as customers see it.",
916
+ "_meta": {
917
+ "description": "The product name, as customers see it."
918
+ }
915
919
  },
916
920
  "description": {
917
921
  "type": "text",
918
- "required": false
922
+ "required": false,
923
+ "description": "A few words on what the product is and who it is for.",
924
+ "_meta": {
925
+ "description": "A few words on what the product is and who it is for."
926
+ }
919
927
  },
920
928
  "category": {
921
929
  "type": "text",
@@ -932,7 +940,11 @@
932
940
  "price": {
933
941
  "type": "integer",
934
942
  "required": true,
935
- "default": 0
943
+ "default": 0,
944
+ "description": "The price in minor units (cents), for example 1999 for 19.99.",
945
+ "_meta": {
946
+ "description": "The price in minor units (cents), for example 1999 for 19.99."
947
+ }
936
948
  },
937
949
  "inStock": {
938
950
  "type": "boolean",
@@ -2506,5 +2518,17 @@
2506
2518
  "@happyvertical/smrt-products",
2507
2519
  "@happyvertical/smrt-tenancy"
2508
2520
  ],
2521
+ "browser": {
2522
+ "status": "server-only",
2523
+ "issues": [
2524
+ "#3616",
2525
+ "#3624",
2526
+ "#3626"
2527
+ ],
2528
+ "via": [
2529
+ "@happyvertical/smrt-products",
2530
+ "@happyvertical/smrt-tenancy"
2531
+ ]
2532
+ },
2509
2533
  "stampsConstructors": true
2510
2534
  }
@@ -3,12 +3,12 @@
3
3
  "sensitiveFieldsExcluded": true,
4
4
  "generatedAt": "1970-01-01T00:00:00.000Z",
5
5
  "packageName": "@happyvertical/smrt-manufacturing",
6
- "packageVersion": "0.55.7",
6
+ "packageVersion": "0.55.8",
7
7
  "sourceManifestPath": "dist/manifest.json",
8
8
  "agentDocPath": "AGENTS.md",
9
9
  "sourceHashes": {
10
- "manifest": "982a8e5e3443e817ab08c634ea06ee59b24a981c7db5318f00e9ef086da4adc1",
11
- "packageJson": "4c6932031a0d9c27a5970b67b04aafc14e6b471516318fd3eca8ee1daad25e2f",
10
+ "manifest": "ff468f8739d83d6c0d632c1f6f6da6f732b552cecdb7b78423d395a5314dec6f",
11
+ "packageJson": "9fec7cd719009eccde0b76f0696ed56b066f2f2ba394f28bbbaf041b452e3f3b",
12
12
  "agents": "53bbb8d8dfd7e1dbd438a4ad1559be8cd1ad8ed46c726d5498d2dda5b3535054",
13
13
  "moduleDoc:agents/multilevel-and-runs.md": "544d519356801f3cb3beb9e6d49a3e0eec93fdddf3f56150cf3141f766f98c9d"
14
14
  },
@@ -579,13 +579,15 @@
579
579
  "name": "name",
580
580
  "type": "text",
581
581
  "required": false,
582
- "columnType": "TEXT"
582
+ "columnType": "TEXT",
583
+ "description": "The product name, as customers see it."
583
584
  },
584
585
  {
585
586
  "name": "description",
586
587
  "type": "text",
587
588
  "required": false,
588
- "columnType": "TEXT"
589
+ "columnType": "TEXT",
590
+ "description": "A few words on what the product is and who it is for."
589
591
  },
590
592
  {
591
593
  "name": "category",
@@ -610,7 +612,8 @@
610
612
  "type": "integer",
611
613
  "required": true,
612
614
  "columnType": "INTEGER",
613
- "default": 0
615
+ "default": 0,
616
+ "description": "The price in minor units (cents), for example 1999 for 19.99."
614
617
  },
615
618
  {
616
619
  "name": "inStock",
@@ -2391,5 +2394,17 @@
2391
2394
  "module": "multilevel-and-runs",
2392
2395
  "content": "# Multi-level walks and production runs\n\nDetail for `services/structure-walk.ts`, the multi-level forms of `BomService`, and `ProductionRunService`. Orientation and gotchas stay in the package [AGENTS.md](../AGENTS.md).\n\n## Multi-level walks (sub-assemblies)\n\nEvery `BomService` method takes `{ levels }` (`1` by default: the single-level behaviour, unchanged; a number up to `MAX_EXPLOSION_DEPTH` = 32; or `'all'`). The walk is `services/structure-walk.ts`, shared by all of them: resolve each line through `AssemblyService.resolveComponent` (in the top bill's tenant), open an assembly's active bill while `levels` allows, stop at materials, bought items, missing components and assemblies without an active bill.\n\n| Method | Multi-level behaviour |\n|---|---|\n| `explode(bomId, qty, { levels })` | Gross: every line depth first with `level`, `path` (bills from the top), `totalQty` (waste compounds: a child is the parent line's quantity times its own effective quantity), `buildable`, `expanded`; `totals` sums the lines not opened per SKU (first unit kept, as before). |\n| `planRequirements(bomId, qty, { levels })` | Net: per line, `available` stock not yet allocated to an earlier line and `short`; a short buildable sub-assembly is opened for the shortfall only. Lines short and not opened are `shortages`, each at its own level. Facts only: no make-or-buy policy. |\n| `explodeRequirements` / `canProduce` | `explode().totals` / the plan's shortages (`level`, `path`, `uom`, `buildable` added). |\n| `computeMaterialCost` | An opened sub-assembly is costed from its bill (`subBomId`, nested `components`); a missing price below marks it. A sub-assembly bill in another currency is not added: its line is priced through the resolver. |\n| `computeLabourEstimate` | Adds each opened sub-assembly's routing times its units per top unit (`subAssemblies`); `steps` stays the top routing. Minutes always count; cost from a bill in another currency does not, and sets `hasMissingRates`. |\n\nSafety: a loop already in stored data (written around the save-time refusal) fails with `BomStructureCycleError` (a `BomCycleError`) naming it; `'all'` past 32 levels or a walk past `MAX_EXPLOSION_LINES` (10,000, counted per use of a shared sub-assembly) fails with `BomExplosionLimitError`. Stock in a plan is summed across locations, as in `canProduce`, counting only the top bill's tenant's rows and global ones (like the lines the walk reads), whatever tenant context is active.\n\n## Production runs\n\n`ProductionRunService` (`createRun({ bomId } | { productId }, targetQty)`, `start`, `recordCompletion`, `finish`, `cancel`, `setTarget`, `get`, `listCompletions`). Every write is one transaction that saves the run row first; the revision-guarded save locks it, and a concurrent writer's conflict reruns its whole transaction (up to 10 attempts), so concurrent completions all count and never pass the target. The service refuses an adapter without `transaction()`; it never falls back to step-by-step writes.\n\n- Tenant: every structure read goes through `src/tenant-scope.ts`: list reads run in `withTenantGlobalRead` for the owning tenant (its rows plus global rows; a tenant context alone would hide global rows, no context would show every tenant's) and keep own-or-global rows. Routing and operations in `computeLabourEstimate`, and the top bill itself under a tenant context, are read the same way. `createRun` reads the active tenant's bills and global ones (no context: global bills only, by `productId` or `bomId`). The run takes its bill's tenant; a completion takes the run's; stock legs run inside `withTenant(run.tenantId)`, so the bill's lines and the levels read and written are that tenant's whatever the caller's context. `ProductionService` consumes only a bill's own tenant's lines and global ones (a global bill: global lines only), for every caller; a global run's stock legs run in the caller's context.\n- A completion moves no stock unless asked. With `consume` / `produce` it calls `ProductionService` (`runProduction` for both) on the transaction's stock service, stamping movements `sourceType: 'ProductionRunCompletion'` with the completion id; a shortfall rolls the completion back. Consumption is the run's bill's own lines: a sub-assembly is taken from stock, and building it is its own run.\n- Quantities are kept to `QUANTITY_DECIMALS` (6) places, never compared with a tolerance. A run's target, completed quantity and each report are summed and compared as whole millionths, exactly; a run accepts quantities up to `MAX_QUANTITY` (999,999,999, so every value has at most 15 significant digits and survives a double exactly) and refuses one that rounds to zero. A plan's `short` is rounded with `roundQuantity`.\n- Reaching the target marks the run `done`; `finish` closes it short; `cancel` keeps its completions; `setTarget` cannot go below what is done.\n- Why not commerce `ProductionOrder`: that is a `Contract` (terms, money, customer or vendor, a contract status flow), owned by `smrt-commerce`, which this package does not depend on. A run is the shop-floor record of building; one order may need several runs, and make-to-stock needs none. An application that has both links them.\n- Deliberately absent (nothing here would use them): a link to an order, who did the work, a location on the run (passed per call, as in `ProductionService`).\n"
2393
2396
  }
2394
- ]
2397
+ ],
2398
+ "browser": {
2399
+ "status": "server-only",
2400
+ "issues": [
2401
+ "#3616",
2402
+ "#3624",
2403
+ "#3626"
2404
+ ],
2405
+ "via": [
2406
+ "@happyvertical/smrt-products",
2407
+ "@happyvertical/smrt-tenancy"
2408
+ ]
2409
+ }
2395
2410
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-manufacturing",
3
- "version": "0.55.7",
3
+ "version": "0.55.8",
4
4
  "smrtJsdoc": "strict",
5
5
  "description": "Bills of materials, cost rollup, and production-order operations for the SMRT framework — strictly industry-neutral",
6
6
  "type": "module",
@@ -35,14 +35,14 @@
35
35
  "./manifest.json": "./dist/manifest.json"
36
36
  },
37
37
  "dependencies": {
38
- "@happyvertical/logger": "^0.102.5",
39
- "@happyvertical/smrt-core": "0.55.7",
40
- "@happyvertical/smrt-inventory": "0.55.7",
41
- "@happyvertical/smrt-products": "0.55.7",
42
- "@happyvertical/smrt-tenancy": "0.55.7",
43
- "@happyvertical/smrt-types": "0.55.7",
44
- "@happyvertical/smrt-ui": "0.55.7",
45
- "@happyvertical/sql": "^0.102.5"
38
+ "@happyvertical/logger": "^0.103.1",
39
+ "@happyvertical/smrt-core": "0.55.8",
40
+ "@happyvertical/smrt-inventory": "0.55.8",
41
+ "@happyvertical/smrt-products": "0.55.8",
42
+ "@happyvertical/smrt-tenancy": "0.55.8",
43
+ "@happyvertical/smrt-types": "0.55.8",
44
+ "@happyvertical/smrt-ui": "0.55.8",
45
+ "@happyvertical/sql": "^0.103.1"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "svelte": "^5.57.0"
@@ -53,7 +53,7 @@
53
53
  }
54
54
  },
55
55
  "devDependencies": {
56
- "@happyvertical/smrt-vitest": "0.55.7",
56
+ "@happyvertical/smrt-vitest": "0.55.8",
57
57
  "@sveltejs/package": "^2.5.8",
58
58
  "@sveltejs/vite-plugin-svelte": "^7.3.0",
59
59
  "@types/node": "24.13.6",