@happyvertical/smrt-manufacturing 0.51.32 → 0.51.34

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/types.d.ts CHANGED
@@ -1,138 +1,129 @@
1
- /**
2
- * Shared types and error classes for `@happyvertical/smrt-manufacturing`.
3
- *
4
- * Strictly industry-neutral. The same vocabulary serves apparel, furniture,
5
- * automotive, CPG, electronics, food production, custom hardware, and any
6
- * other vertical that builds finished goods from raw inputs by recipe.
7
- *
8
- * @packageDocumentation
9
- */
10
-
11
- /**
12
- * Aggregate cost rollup returned by {@link BomService.computeMaterialCost}.
13
- */
14
- export declare interface BomCostRollup {
15
- /** BOM that was rolled up. */
16
- bomId: string;
17
- /** Total material cost per produced unit. */
18
- totalCost: number;
19
- /** ISO 4217 currency code. Defaults to `'USD'`. */
20
- currency: string;
21
- /** Per-line breakdown. Empty array when the BOM has no lines. */
22
- lineBreakdown: BomLineCost[];
23
- /**
24
- * `true` when at least one line's unit cost could not be resolved.
25
- * Callers should treat `totalCost` as a lower bound in that case.
26
- */
27
- hasMissingCosts: boolean;
28
- }
29
-
30
- /**
31
- * Per-line cost breakdown returned by {@link BomService.computeMaterialCost}.
32
- * Lets callers surface "here's where the $42 came from" UIs without
33
- * recomputing on the client.
34
- */
35
- export declare interface BomLineCost {
36
- /**
37
- * Plain string reference to a component SKU id. The `Sku` model
38
- * itself lives in `@happyvertical/smrt-products`; inventory only
39
- * tracks stock motion against that id.
40
- */
41
- componentSkuId: string;
42
- /** Quantity per produced unit (pre-waste). */
43
- qtyPerUnit: number;
44
- /** Waste percent applied to this line (`0` if none). */
45
- wastePercent: number;
46
- /** Effective quantity used per produced unit, including waste. */
47
- effectiveQty: number;
48
- /** Latest known unit cost, or `0` if unavailable. */
49
- unitCost: number;
50
- /** Effective unit-cost contribution to the rolled-up total. */
51
- lineCost: number;
52
- /** Unit of measure as declared on the line (`'yards'`, `'each'`, ...). */
53
- uom: string;
54
- /**
55
- * `true` when the unit cost could not be resolved from upstream
56
- * `smrt-products`. The line still contributes `0` to the total; the
57
- * flag lets UIs warn the user that the cost rollup is incomplete.
58
- */
59
- costUnavailable: boolean;
60
- }
61
-
62
- /**
63
- * Thrown when a service operation needs to resolve a BOM by id but the row
64
- * does not exist. Carries the requested id so callers can surface a
65
- * meaningful message.
66
- */
67
- export declare class BomNotFoundError extends Error {
68
- readonly bomId: string;
69
- name: string;
70
- constructor(bomId: string);
71
- }
72
-
73
- /**
74
- * Lifecycle state of a {@link BillOfMaterials}.
75
- *
76
- * - `draft` — under construction; not yet released for production. Cost
77
- * rollups can still be computed, but the BOM should not yet be referenced
78
- * by a production order.
79
- * - `active` — currently in use. New production orders should reference the
80
- * active BOM for a given product.
81
- * - `superseded` — an older revision that has been replaced by a newer
82
- * `active` BOM. Historical production orders may still reference the
83
- * superseded row for audit, but no new orders should pick it up.
84
- */
85
- export declare type BomStatus = 'draft' | 'active' | 'superseded';
86
-
87
- /**
88
- * Result returned by {@link BomService.canProduce}.
89
- *
90
- * `ok: true` means every material requirement is currently covered by
91
- * available stock; `ok: false` means at least one component is short.
92
- */
93
- export declare type CanProduceResult = {
94
- ok: true;
95
- shortages: [];
96
- } | {
97
- ok: false;
98
- shortages: MaterialShortage[];
99
- };
100
-
101
- /**
102
- * A single entry on a requirements explosion. Multiple BOM lines pointing
103
- * at the same component SKU are summed.
104
- */
105
- export declare interface MaterialRequirement {
106
- /** Plain string reference to the required component {@link Sku}. */
107
- componentSkuId: string;
108
- /** Total quantity needed across the full production run (waste included). */
109
- totalQty: number;
110
- /** Unit of measure carried over from the originating BOM line(s). */
111
- uom: string;
112
- }
113
-
114
- /**
115
- * A single shortage discovered by {@link BomService.canProduce}.
116
- */
117
- export declare interface MaterialShortage {
118
- /** Plain string reference to the missing component {@link Sku}. */
119
- componentSkuId: string;
120
- /** Total quantity required for the requested production run. */
121
- requested: number;
122
- /** Available stock across all locations (`available` state). */
123
- available: number;
124
- }
125
-
126
- /**
127
- * Thrown when a production-order operation needs a BOM to plan against but
128
- * no active BOM is currently registered for the production order's
129
- * `productId`. The caller should either link a BOM by passing one in
130
- * explicitly or activate one for the given product.
131
- */
132
- export declare class NoActiveBomForProductError extends Error {
133
- readonly productId: string;
134
- name: string;
135
- constructor(productId: string);
136
- }
137
-
138
- export { }
1
+ /**
2
+ * Shared types and error classes for `@happyvertical/smrt-manufacturing`.
3
+ *
4
+ * Strictly industry-neutral. The same vocabulary serves apparel, furniture,
5
+ * automotive, CPG, electronics, food production, custom hardware, and any
6
+ * other vertical that builds finished goods from raw inputs by recipe.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ /**
11
+ * Lifecycle state of a {@link BillOfMaterials}.
12
+ *
13
+ * - `draft` — under construction; not yet released for production. Cost
14
+ * rollups can still be computed, but the BOM should not yet be referenced
15
+ * by a production order.
16
+ * - `active` — currently in use. New production orders should reference the
17
+ * active BOM for a given product.
18
+ * - `superseded` — an older revision that has been replaced by a newer
19
+ * `active` BOM. Historical production orders may still reference the
20
+ * superseded row for audit, but no new orders should pick it up.
21
+ */
22
+ export type BomStatus = 'draft' | 'active' | 'superseded';
23
+ /**
24
+ * Per-line cost breakdown returned by {@link BomService.computeMaterialCost}.
25
+ * Lets callers surface "here's where the $42 came from" UIs without
26
+ * recomputing on the client.
27
+ */
28
+ export interface BomLineCost {
29
+ /**
30
+ * Plain string reference to a component SKU id. The `Sku` model
31
+ * itself lives in `@happyvertical/smrt-products`; inventory only
32
+ * tracks stock motion against that id.
33
+ */
34
+ componentSkuId: string;
35
+ /** Quantity per produced unit (pre-waste). */
36
+ qtyPerUnit: number;
37
+ /** Waste percent applied to this line (`0` if none). */
38
+ wastePercent: number;
39
+ /** Effective quantity used per produced unit, including waste. */
40
+ effectiveQty: number;
41
+ /** Latest known unit cost, or `0` if unavailable. */
42
+ unitCost: number;
43
+ /** Effective unit-cost contribution to the rolled-up total. */
44
+ lineCost: number;
45
+ /** Unit of measure as declared on the line (`'yards'`, `'each'`, ...). */
46
+ uom: string;
47
+ /**
48
+ * `true` when the unit cost could not be resolved from upstream
49
+ * `smrt-products`. The line still contributes `0` to the total; the
50
+ * flag lets UIs warn the user that the cost rollup is incomplete.
51
+ */
52
+ costUnavailable: boolean;
53
+ }
54
+ /**
55
+ * Aggregate cost rollup returned by {@link BomService.computeMaterialCost}.
56
+ */
57
+ export interface BomCostRollup {
58
+ /** BOM that was rolled up. */
59
+ bomId: string;
60
+ /** Total material cost per produced unit. */
61
+ totalCost: number;
62
+ /** ISO 4217 currency code. Defaults to `'USD'`. */
63
+ currency: string;
64
+ /** Per-line breakdown. Empty array when the BOM has no lines. */
65
+ lineBreakdown: BomLineCost[];
66
+ /**
67
+ * `true` when at least one line's unit cost could not be resolved.
68
+ * Callers should treat `totalCost` as a lower bound in that case.
69
+ */
70
+ hasMissingCosts: boolean;
71
+ }
72
+ /**
73
+ * A single entry on a requirements explosion. Multiple BOM lines pointing
74
+ * at the same component SKU are summed.
75
+ */
76
+ export interface MaterialRequirement {
77
+ /** Plain string reference to the required component {@link Sku}. */
78
+ componentSkuId: string;
79
+ /** Total quantity needed across the full production run (waste included). */
80
+ totalQty: number;
81
+ /** Unit of measure carried over from the originating BOM line(s). */
82
+ uom: string;
83
+ }
84
+ /**
85
+ * A single shortage discovered by {@link BomService.canProduce}.
86
+ */
87
+ export interface MaterialShortage {
88
+ /** Plain string reference to the missing component {@link Sku}. */
89
+ componentSkuId: string;
90
+ /** Total quantity required for the requested production run. */
91
+ requested: number;
92
+ /** Available stock across all locations (`available` state). */
93
+ available: number;
94
+ }
95
+ /**
96
+ * Result returned by {@link BomService.canProduce}.
97
+ *
98
+ * `ok: true` means every material requirement is currently covered by
99
+ * available stock; `ok: false` means at least one component is short.
100
+ */
101
+ export type CanProduceResult = {
102
+ ok: true;
103
+ shortages: [];
104
+ } | {
105
+ ok: false;
106
+ shortages: MaterialShortage[];
107
+ };
108
+ /**
109
+ * Thrown when a service operation needs to resolve a BOM by id but the row
110
+ * does not exist. Carries the requested id so callers can surface a
111
+ * meaningful message.
112
+ */
113
+ export declare class BomNotFoundError extends Error {
114
+ readonly bomId: string;
115
+ name: string;
116
+ constructor(bomId: string);
117
+ }
118
+ /**
119
+ * Thrown when a production-order operation needs a BOM to plan against but
120
+ * no active BOM is currently registered for the production order's
121
+ * `productId`. The caller should either link a BOM by passing one in
122
+ * explicitly or activate one for the given product.
123
+ */
124
+ export declare class NoActiveBomForProductError extends Error {
125
+ readonly productId: string;
126
+ name: string;
127
+ constructor(productId: string);
128
+ }
129
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,YAAY,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,aAAa,EAAE,WAAW,EAAE,CAAC;IAC7B;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,cAAc,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mEAAmE;IACnE,cAAc,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,EAAE,CAAA;CAAE,GAC3B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAAC;AAEjD;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;aAGb,KAAK,EAAE,MAAM;IAFhC,IAAI,SAAsB;gBAEP,KAAK,EAAE,MAAM;CAG1C;AAED;;;;;GAKG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;aAGvB,SAAS,EAAE,MAAM;IAFpC,IAAI,SAAgC;gBAEjB,SAAS,EAAE,MAAM;CAM9C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-manufacturing",
3
- "version": "0.51.32",
3
+ "version": "0.51.34",
4
4
  "description": "Bills of materials, cost rollup, and production-order operations for the SMRT framework — strictly industry-neutral",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,15 +20,15 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@happyvertical/logger": "^0.94.1",
23
- "@happyvertical/smrt-core": "0.51.32",
24
- "@happyvertical/smrt-inventory": "0.51.32",
25
- "@happyvertical/smrt-tenancy": "0.51.32",
23
+ "@happyvertical/smrt-core": "0.51.34",
24
+ "@happyvertical/smrt-inventory": "0.51.34",
25
+ "@happyvertical/smrt-tenancy": "0.51.34",
26
26
  "@happyvertical/sql": "^0.94.1"
27
27
  },
28
28
  "devDependencies": {
29
- "@happyvertical/smrt-vitest": "0.51.32",
29
+ "@happyvertical/smrt-vitest": "0.51.34",
30
30
  "@types/node": "24.13.6",
31
- "typescript": "5.9.3",
31
+ "typescript": "6.0.3",
32
32
  "vite": "8.1.4",
33
33
  "vitest": "4.1.10"
34
34
  },