@happyvertical/smrt-inventory 0.51.31 → 0.51.33

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=__smrt-register__.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__smrt-register__.d.ts","sourceRoot":"","sources":["../src/__smrt-register__.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * InventoryLocationCollection — query helpers for {@link InventoryLocation}.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import { SmrtCollection } from '@happyvertical/smrt-core';
7
+ import { InventoryLocation } from '../models/InventoryLocation.js';
8
+ import type { InventoryLocationKind } from '../types.js';
9
+ export declare class InventoryLocationCollection extends SmrtCollection<InventoryLocation> {
10
+ static readonly _itemClass: typeof InventoryLocation;
11
+ /**
12
+ * Look up a location by its tenant-scoped `code`. Returns `null` when
13
+ * no row matches.
14
+ */
15
+ findByCode(code: string): Promise<InventoryLocation | null>;
16
+ /**
17
+ * Find every location classified as the given kind (`'warehouse'`,
18
+ * `'factory'`, `'retail'`, `'in_transit'`, …).
19
+ */
20
+ findByKind(kind: InventoryLocationKind): Promise<InventoryLocation[]>;
21
+ /**
22
+ * Find every location linked to a particular `Place.id` from
23
+ * `@happyvertical/smrt-places`. Returns an empty array when no row
24
+ * references the place.
25
+ */
26
+ findByPlace(placeId: string): Promise<InventoryLocation[]>;
27
+ /** Find every active location, optionally narrowed by kind. */
28
+ findActive(kind?: InventoryLocationKind): Promise<InventoryLocation[]>;
29
+ }
30
+ //# sourceMappingURL=InventoryLocationCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InventoryLocationCollection.d.ts","sourceRoot":"","sources":["../../src/collections/InventoryLocationCollection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,qBAAa,2BAA4B,SAAQ,cAAc,CAAC,iBAAiB,CAAC;IAChF,MAAM,CAAC,QAAQ,CAAC,UAAU,2BAAqB;IAE/C;;;OAGG;IACG,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAKjE;;;OAGG;IACG,UAAU,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAI3E;;;;OAIG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAKhE,+DAA+D;IACzD,UAAU,CAAC,IAAI,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;CAK7E"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * StockLevelCollection — read helpers and balance aggregations.
3
+ *
4
+ * Mutations live in {@link StockService}. The collection here is for
5
+ * reading the materialized view only; callers that want to change
6
+ * `qty` must go through the service so the StockMovement audit row is
7
+ * also written.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ import { SmrtCollection } from '@happyvertical/smrt-core';
12
+ import { StockLevel } from '../models/StockLevel.js';
13
+ import type { StockState } from '../types.js';
14
+ export declare class StockLevelCollection extends SmrtCollection<StockLevel> {
15
+ static readonly _itemClass: typeof StockLevel;
16
+ /**
17
+ * Fetch the level row for a `(skuId, locationId, state)` tuple, or
18
+ * `null` when the row has never been written. State defaults to
19
+ * `'available'` because that is the common case (selling / picking
20
+ * decisions are driven by available stock).
21
+ */
22
+ getLevel(skuId: string, locationId: string, state?: StockState): Promise<StockLevel | null>;
23
+ /**
24
+ * Return every level row for the given SKU across all locations and
25
+ * states. Useful for "where is this SKU?" admin screens.
26
+ */
27
+ findBySku(skuId: string): Promise<StockLevel[]>;
28
+ /**
29
+ * Return every level row at the given location. Useful for "what is
30
+ * in this warehouse?" reports.
31
+ */
32
+ findByLocation(locationId: string): Promise<StockLevel[]>;
33
+ /**
34
+ * Sum `qty` across all level rows for the given SKU. Pass `state` to
35
+ * narrow the sum to one logical state (e.g. only `available`);
36
+ * omit it for grand total across all states.
37
+ */
38
+ totalForSku(skuId: string, state?: StockState): Promise<number>;
39
+ /**
40
+ * Sum `qty` across all level rows at the given location, optionally
41
+ * narrowed by state.
42
+ */
43
+ totalForLocation(locationId: string, state?: StockState): Promise<number>;
44
+ }
45
+ //# sourceMappingURL=StockLevelCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StockLevelCollection.d.ts","sourceRoot":"","sources":["../../src/collections/StockLevelCollection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,qBAAa,oBAAqB,SAAQ,cAAc,CAAC,UAAU,CAAC;IAClE,MAAM,CAAC,QAAQ,CAAC,UAAU,oBAAc;IAExC;;;;;OAKG;IACG,QAAQ,CACZ,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,KAAK,GAAE,UAAwB,GAC9B,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAQ7B;;;OAGG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAIrD;;;OAGG;IACG,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAI/D;;;;OAIG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAOrE;;;OAGG;IACG,gBAAgB,CACpB,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,UAAU,GACjB,OAAO,CAAC,MAAM,CAAC;CAMnB"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * StockMovementCollection — read-only access to the append-only audit log.
3
+ *
4
+ * Treat this collection as a ledger. The `StockService` is the only
5
+ * sanctioned writer; query helpers here exist so reporting code, audit
6
+ * UIs, and cycle-count tooling can reconstruct history.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ import { SmrtCollection } from '@happyvertical/smrt-core';
11
+ import { StockMovement } from '../models/StockMovement.js';
12
+ import type { StockMovementReason } from '../types.js';
13
+ export declare class StockMovementCollection extends SmrtCollection<StockMovement> {
14
+ static readonly _itemClass: typeof StockMovement;
15
+ /**
16
+ * Return every movement for the given SKU, newest first. Useful for a
17
+ * per-SKU audit trail.
18
+ */
19
+ findBySku(skuId: string): Promise<StockMovement[]>;
20
+ /**
21
+ * Return every movement at the given location, newest first. Useful
22
+ * for a per-warehouse audit trail.
23
+ */
24
+ findByLocation(locationId: string): Promise<StockMovement[]>;
25
+ /**
26
+ * Return every movement attributed to the given upstream source — for
27
+ * example `findBySource('Contract', contract.id)` returns every
28
+ * movement caused by the reservation/fulfilment/release of that
29
+ * contract. Newest first.
30
+ */
31
+ findBySource(sourceType: string, sourceId: string): Promise<StockMovement[]>;
32
+ /**
33
+ * Return every movement with the given reason code (`'receipt'`,
34
+ * `'reservation'`, `'adjustment'`, …). Newest first.
35
+ */
36
+ findByReason(reasonCode: StockMovementReason): Promise<StockMovement[]>;
37
+ }
38
+ //# sourceMappingURL=StockMovementCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StockMovementCollection.d.ts","sourceRoot":"","sources":["../../src/collections/StockMovementCollection.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,qBAAa,uBAAwB,SAAQ,cAAc,CAAC,aAAa,CAAC;IACxE,MAAM,CAAC,QAAQ,CAAC,UAAU,uBAAiB;IAE3C;;;OAGG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAIxD;;;OAGG;IACG,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAOlE;;;;;OAKG;IACG,YAAY,CAChB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,EAAE,CAAC;IAO3B;;;OAGG;IACG,YAAY,CAChB,UAAU,EAAE,mBAAmB,GAC9B,OAAO,CAAC,aAAa,EAAE,CAAC;CAM5B"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Collection exports for `@happyvertical/smrt-inventory`.
3
+ *
4
+ * Importing this barrel triggers `__smrt-register__.ts` first so the
5
+ * package's build-time manifest is published before any class module
6
+ * (transitively) imported by a collection touches the registry. See
7
+ * `__smrt-register__.ts` and issue #1132 for the full background.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ import '../__smrt-register__.js';
12
+ export { InventoryLocationCollection } from './InventoryLocationCollection.js';
13
+ export { StockLevelCollection } from './StockLevelCollection.js';
14
+ export { StockMovementCollection } from './StockMovementCollection.js';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}