@classytic/flow 0.1.4
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/CHANGELOG.md +70 -0
- package/LICENSE +21 -0
- package/README.md +258 -0
- package/dist/allocation-policy-my_HfzdV.d.mts +23 -0
- package/dist/base-MWBqRFM2.mjs +16 -0
- package/dist/catalog-bridge-K8bdkncJ.d.mts +29 -0
- package/dist/cost-layer.port-iH9pvZqB.d.mts +30 -0
- package/dist/cost-layer.service-BQ1bs-XN.mjs +86 -0
- package/dist/cost-layer.service-DWmo9dQz.d.mts +53 -0
- package/dist/count.port-BRqwGbi3.d.mts +57 -0
- package/dist/counting/index.d.mts +2 -0
- package/dist/counting/index.mjs +2 -0
- package/dist/counting.service-BiQXqorv.mjs +232 -0
- package/dist/counting.service-CpAxU2G0.d.mts +74 -0
- package/dist/domain/contracts/index.d.mts +3 -0
- package/dist/domain/contracts/index.mjs +1 -0
- package/dist/domain/enums/index.d.mts +2 -0
- package/dist/domain/enums/index.mjs +4 -0
- package/dist/domain/index.d.mts +24 -0
- package/dist/domain/index.mjs +10 -0
- package/dist/domain/policies/index.d.mts +4 -0
- package/dist/domain/policies/index.mjs +1 -0
- package/dist/domain-D5cpMpR0.mjs +96 -0
- package/dist/domain-errors-D7S9ydNF.mjs +133 -0
- package/dist/enums-C3_z6aHC.mjs +82 -0
- package/dist/event-bus-BNmyoJb4.mjs +37 -0
- package/dist/event-bus-Um_xrcMY.d.mts +21 -0
- package/dist/event-emitter.port-BFh2pasY.d.mts +183 -0
- package/dist/event-types-BSqQOvXv.mjs +29 -0
- package/dist/events/index.d.mts +3 -0
- package/dist/events/index.mjs +3 -0
- package/dist/idempotency.port-CTC70JON.d.mts +55 -0
- package/dist/index-Bia4m8d2.d.mts +67 -0
- package/dist/index-BmNm3oNU2.d.mts +107 -0
- package/dist/index-C5PciI9P.d.mts +203 -0
- package/dist/index-CMTUKEK_.d.mts +308 -0
- package/dist/index-C_aEnozN.d.mts +220 -0
- package/dist/index-CulWO137.d.mts +107 -0
- package/dist/index-DFF0GJ4J.d.mts +36 -0
- package/dist/index-DsE7lZdO.d.mts +11 -0
- package/dist/index-DwO9IdNa.d.mts +1 -0
- package/dist/index-dtWUZr2a2.d.mts +350 -0
- package/dist/index.d.mts +128 -0
- package/dist/index.mjs +102 -0
- package/dist/insufficient-stock.error-Dyr4BYaV.mjs +15 -0
- package/dist/location.port-CValXIpb.d.mts +52 -0
- package/dist/lot.port-ChsmvZqs.d.mts +32 -0
- package/dist/models/index.d.mts +2 -0
- package/dist/models/index.mjs +2 -0
- package/dist/models-CHTMbp-G.mjs +1020 -0
- package/dist/move-group.port-DHGoQA3d.d.mts +56 -0
- package/dist/move-status-DkaFp2GD.mjs +38 -0
- package/dist/move.port-Qg1CYp7h.d.mts +89 -0
- package/dist/package.service-4tcAwBbr.mjs +95 -0
- package/dist/package.service-C605NaBQ.d.mts +42 -0
- package/dist/packaging/index.d.mts +2 -0
- package/dist/packaging/index.mjs +2 -0
- package/dist/procurement/index.d.mts +2 -0
- package/dist/procurement/index.mjs +2 -0
- package/dist/quant.port-BBa66PBT.d.mts +42 -0
- package/dist/removal-policy-BItBB8FD.d.mts +29 -0
- package/dist/replenishment-rule.port-DnEYtbyD.d.mts +78 -0
- package/dist/replenishment.service-BT9P-HKM.mjs +284 -0
- package/dist/replenishment.service-HO0sDhB_.d.mts +89 -0
- package/dist/reporting/index.d.mts +2 -0
- package/dist/reporting/index.mjs +2 -0
- package/dist/reporting-CL5ffrKM.mjs +243 -0
- package/dist/repositories/index.d.mts +2 -0
- package/dist/repositories/index.mjs +2 -0
- package/dist/repositories-nZXJKvLW.mjs +842 -0
- package/dist/reservation-status-ZfuTaWG0.mjs +22 -0
- package/dist/reservation.port-l9NFQ0si.d.mts +85 -0
- package/dist/reservations/index.d.mts +2 -0
- package/dist/reservations/index.mjs +2 -0
- package/dist/reservations-Cg4wN0QB.mjs +112 -0
- package/dist/routing/index.d.mts +362 -0
- package/dist/routing/index.mjs +582 -0
- package/dist/runtime-config-C0ggPkiK.mjs +40 -0
- package/dist/runtime-config-CQLtPPqY.d.mts +38 -0
- package/dist/scan-token-CNM9QVLY.d.mts +26 -0
- package/dist/scanning/index.d.mts +45 -0
- package/dist/scanning/index.mjs +228 -0
- package/dist/services/index.d.mts +8 -0
- package/dist/services/index.mjs +8 -0
- package/dist/services-_lLO4Xbl.mjs +1009 -0
- package/dist/stock-move-group-C0DqUfPY.mjs +88 -0
- package/dist/stock-package-BIarxbDS.d.mts +19 -0
- package/dist/stock-quant-CZhgvTu7.d.mts +41 -0
- package/dist/tenant-guard-6Ne-BILP.mjs +12 -0
- package/dist/tenant-isolation.error-D3OcKUdx.mjs +11 -0
- package/dist/trace.service-B9vAh-l-.d.mts +55 -0
- package/dist/trace.service-DE6Eh8_8.mjs +71 -0
- package/dist/traceability/index.d.mts +2 -0
- package/dist/traceability/index.mjs +2 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.mjs +1 -0
- package/dist/unit-of-work.port-CWEkrDKu.d.mts +17 -0
- package/dist/valuation/index.d.mts +78 -0
- package/dist/valuation/index.mjs +103 -0
- package/dist/valuation-policy-Dco8c9Vw.d.mts +14 -0
- package/dist/virtual-locations-B9zXqPdi.d.mts +38 -0
- package/package.json +155 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { a as CountLine, i as InventoryCount, r as CountStatus, t as CountPort } from "./count.port-BRqwGbi3.mjs";
|
|
2
|
+
import { a as ReservationStatus, f as MoveStatus } from "./index-CulWO137.mjs";
|
|
3
|
+
import { n as MovePort, r as StockMove, t as CreateMoveInput } from "./move.port-Qg1CYp7h.mjs";
|
|
4
|
+
import { a as QueryOptions, i as PaginatedResult, r as ListQuery, t as FlowContext } from "./index-DFF0GJ4J.mjs";
|
|
5
|
+
import { n as CostLayer, t as CostLayerPort } from "./cost-layer.port-iH9pvZqB.mjs";
|
|
6
|
+
import { i as Reservation, n as ReservationPort, o as InventoryNode, r as NodePort, t as CreateReservationInput } from "./reservation.port-l9NFQ0si.mjs";
|
|
7
|
+
import { n as Location, t as LocationPort } from "./location.port-CValXIpb.mjs";
|
|
8
|
+
import { a as ProcurementOrder, n as ProcurementPort, o as ProcurementStatus, r as ReplenishmentRule, t as ReplenishmentRulePort } from "./replenishment-rule.port-DnEYtbyD.mjs";
|
|
9
|
+
import { n as StockLot, t as LotPort } from "./lot.port-ChsmvZqs.mjs";
|
|
10
|
+
import { a as StockMoveGroup, i as MoveGroupStatus, n as MoveGroupPort, t as CreateMoveGroupInput } from "./move-group.port-DHGoQA3d.mjs";
|
|
11
|
+
import { n as StockQuant, t as QuantIdentity } from "./stock-quant-CZhgvTu7.mjs";
|
|
12
|
+
import { t as TransactionSession } from "./unit-of-work.port-CWEkrDKu.mjs";
|
|
13
|
+
import { i as QuantUpdate, n as AvailabilityQuery, r as QuantPort, t as Availability } from "./quant.port-BBa66PBT.mjs";
|
|
14
|
+
import { C as InventoryNodeDocument, E as InventoryCountDocument, N as CostLayerDocument, f as StockLotDocument, g as ReplenishmentRuleDocument, j as CountLineDocument, l as StockMoveDocument, m as ReservationDocument, r as StockQuantDocument, s as StockMoveGroupDocument, t as FlowModels, x as LocationDocument, y as ProcurementOrderDocument } from "./index-dtWUZr2a2.mjs";
|
|
15
|
+
import { OffsetPaginationResult, PaginationResult, PluginType } from "@classytic/mongokit";
|
|
16
|
+
import { ClientSession, Model, Types } from "mongoose";
|
|
17
|
+
|
|
18
|
+
//#region src/repositories/cost-layer.repository.d.ts
|
|
19
|
+
declare class CostLayerRepository implements CostLayerPort {
|
|
20
|
+
private repo;
|
|
21
|
+
constructor(model: Model<CostLayerDocument>, plugins?: PluginType[]);
|
|
22
|
+
create(input: Omit<CostLayer, '_id' | 'createdAt' | 'updatedAt'>, session?: TransactionSession): Promise<CostLayer>;
|
|
23
|
+
drain(id: string, quantity: number, ctx: FlowContext, session?: TransactionSession): Promise<CostLayer>;
|
|
24
|
+
findBySkuRef(skuRef: string, locationId: string, ctx: FlowContext, session?: TransactionSession): Promise<CostLayer[]>;
|
|
25
|
+
findMany(filter: Record<string, unknown>, ctx: FlowContext, session?: TransactionSession, options?: QueryOptions): Promise<CostLayer[]>;
|
|
26
|
+
findOrderedForConsumption(skuRef: string, locationId: string, method: 'fifo' | 'fefo', ctx: FlowContext, session?: TransactionSession): Promise<CostLayer[]>;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/repositories/count.repository.d.ts
|
|
30
|
+
declare class CountRepository implements CountPort {
|
|
31
|
+
private countRepo;
|
|
32
|
+
private lineRepo;
|
|
33
|
+
constructor(countModel: Model<InventoryCountDocument>, lineModel: Model<CountLineDocument>, plugins?: PluginType[]);
|
|
34
|
+
create(input: Omit<InventoryCount, '_id' | 'createdAt' | 'updatedAt'>, session?: TransactionSession): Promise<InventoryCount>;
|
|
35
|
+
findById(id: string, ctx: FlowContext, session?: TransactionSession): Promise<InventoryCount | null>;
|
|
36
|
+
updateStatus(id: string, status: CountStatus, updates: Partial<InventoryCount>, session?: TransactionSession): Promise<InventoryCount>;
|
|
37
|
+
submitLines(countId: string, lines: Omit<CountLine, '_id' | 'createdAt' | 'updatedAt'>[], session?: TransactionSession): Promise<CountLine[]>;
|
|
38
|
+
getLines(countId: string, ctx: FlowContext, session?: TransactionSession): Promise<CountLine[]>;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/repositories/location.repository.d.ts
|
|
42
|
+
declare class LocationRepository implements LocationPort {
|
|
43
|
+
private repo;
|
|
44
|
+
constructor(model: Model<LocationDocument>, plugins?: PluginType[]);
|
|
45
|
+
findById(id: string, ctx: FlowContext, session?: TransactionSession): Promise<Location | null>;
|
|
46
|
+
findByNode(nodeId: string, ctx: FlowContext, session?: TransactionSession): Promise<Location[]>;
|
|
47
|
+
findByBarcode(barcode: string, ctx: FlowContext, session?: TransactionSession): Promise<Location | null>;
|
|
48
|
+
findByCode(code: string, nodeId: string, ctx: FlowContext, session?: TransactionSession): Promise<Location | null>;
|
|
49
|
+
getTree(nodeId: string, ctx: FlowContext, session?: TransactionSession): Promise<Location[]>;
|
|
50
|
+
create(input: Omit<Location, '_id' | 'createdAt' | 'updatedAt'>, session?: TransactionSession): Promise<Location>;
|
|
51
|
+
update(id: string, updates: Partial<Location>, ctx: FlowContext, session?: TransactionSession): Promise<Location>;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/repositories/lot.repository.d.ts
|
|
55
|
+
declare class LotRepository implements LotPort {
|
|
56
|
+
private repo;
|
|
57
|
+
constructor(model: Model<StockLotDocument>, plugins?: PluginType[]);
|
|
58
|
+
findById(id: string, ctx: FlowContext, session?: TransactionSession): Promise<StockLot | null>;
|
|
59
|
+
findByCode(lotCode: string, skuRef: string, ctx: FlowContext, session?: TransactionSession): Promise<StockLot | null>;
|
|
60
|
+
findBySerial(serialCode: string, skuRef: string, ctx: FlowContext, session?: TransactionSession): Promise<StockLot | null>;
|
|
61
|
+
findMany(filter: Record<string, unknown>, ctx: FlowContext, session?: TransactionSession, options?: QueryOptions): Promise<StockLot[]>;
|
|
62
|
+
create(input: Omit<StockLot, '_id' | 'createdAt' | 'updatedAt'>, session?: TransactionSession): Promise<StockLot>;
|
|
63
|
+
update(id: string, updates: Partial<StockLot>, ctx: FlowContext, session?: TransactionSession): Promise<StockLot>;
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/repositories/move.repository.d.ts
|
|
67
|
+
declare class MoveRepository implements MovePort {
|
|
68
|
+
private repo;
|
|
69
|
+
constructor(model: Model<StockMoveDocument>, plugins?: PluginType[]);
|
|
70
|
+
create(input: CreateMoveInput & {
|
|
71
|
+
organizationId: string;
|
|
72
|
+
createdBy: string;
|
|
73
|
+
}, session?: TransactionSession): Promise<StockMove>;
|
|
74
|
+
findById(id: string, ctx: FlowContext, session?: TransactionSession): Promise<StockMove | null>;
|
|
75
|
+
findByGroupId(groupId: string, ctx: FlowContext, session?: TransactionSession): Promise<StockMove[]>;
|
|
76
|
+
updateStatus(id: string, status: MoveStatus, updates: Partial<StockMove>, session?: TransactionSession): Promise<StockMove>;
|
|
77
|
+
findMany(filter: Record<string, unknown>, ctx: FlowContext, session?: TransactionSession, options?: QueryOptions): Promise<StockMove[]>;
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/repositories/move-group.repository.d.ts
|
|
81
|
+
declare class MoveGroupRepository implements MoveGroupPort {
|
|
82
|
+
private repo;
|
|
83
|
+
constructor(model: Model<StockMoveGroupDocument>, plugins?: PluginType[]);
|
|
84
|
+
create(input: CreateMoveGroupInput, session?: TransactionSession): Promise<StockMoveGroup>;
|
|
85
|
+
findById(id: string, ctx: FlowContext, session?: TransactionSession): Promise<StockMoveGroup | null>;
|
|
86
|
+
updateStatus(id: string, status: MoveGroupStatus, updates: Partial<StockMoveGroup>, session?: TransactionSession): Promise<StockMoveGroup>;
|
|
87
|
+
list(query: ListQuery, ctx: FlowContext, session?: TransactionSession): Promise<PaginatedResult<StockMoveGroup>>;
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/repositories/node.repository.d.ts
|
|
91
|
+
declare class NodeRepository implements NodePort {
|
|
92
|
+
private repo;
|
|
93
|
+
constructor(model: Model<InventoryNodeDocument>, plugins?: PluginType[]);
|
|
94
|
+
findById(id: string, ctx: FlowContext, session?: TransactionSession): Promise<InventoryNode | null>;
|
|
95
|
+
findDefault(ctx: FlowContext, session?: TransactionSession): Promise<InventoryNode | null>;
|
|
96
|
+
list(ctx: FlowContext, session?: TransactionSession): Promise<InventoryNode[]>;
|
|
97
|
+
create(input: Omit<InventoryNode, '_id' | 'createdAt' | 'updatedAt'>, session?: TransactionSession): Promise<InventoryNode>;
|
|
98
|
+
update(id: string, updates: Partial<InventoryNode>, ctx: FlowContext, session?: TransactionSession): Promise<InventoryNode>;
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/repositories/procurement.repository.d.ts
|
|
102
|
+
declare class ProcurementRepository implements ProcurementPort {
|
|
103
|
+
private repo;
|
|
104
|
+
constructor(model: Model<ProcurementOrderDocument>, plugins?: PluginType[]);
|
|
105
|
+
create(input: Omit<ProcurementOrder, '_id' | 'createdAt' | 'updatedAt'>, session?: TransactionSession): Promise<ProcurementOrder>;
|
|
106
|
+
findById(id: string, ctx: FlowContext, session?: TransactionSession): Promise<ProcurementOrder | null>;
|
|
107
|
+
updateStatus(id: string, status: ProcurementStatus, updates: Partial<ProcurementOrder>, session?: TransactionSession): Promise<ProcurementOrder>;
|
|
108
|
+
findMany(filter: Record<string, unknown>, ctx: FlowContext, session?: TransactionSession, options?: QueryOptions): Promise<ProcurementOrder[]>;
|
|
109
|
+
list(query: ListQuery, ctx: FlowContext, session?: TransactionSession): Promise<PaginatedResult<ProcurementOrder>>;
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/repositories/quant.repository.d.ts
|
|
113
|
+
declare class QuantRepository implements QuantPort {
|
|
114
|
+
private repo;
|
|
115
|
+
constructor(model: Model<StockQuantDocument>, plugins?: PluginType[]);
|
|
116
|
+
getAvailability(query: AvailabilityQuery, ctx: FlowContext, session?: TransactionSession): Promise<Availability>;
|
|
117
|
+
upsert(update: QuantUpdate, session?: TransactionSession): Promise<StockQuant>;
|
|
118
|
+
batchUpsert(updates: QuantUpdate[], session?: TransactionSession): Promise<void>;
|
|
119
|
+
findByIdentity(identity: QuantIdentity, session?: TransactionSession): Promise<StockQuant | null>;
|
|
120
|
+
findMany(filter: Record<string, unknown>, ctx: FlowContext, session?: TransactionSession, options?: QueryOptions): Promise<StockQuant[]>;
|
|
121
|
+
deleteAll(ctx: FlowContext, session?: TransactionSession): Promise<void>;
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/repositories/replenishment-rule.repository.d.ts
|
|
125
|
+
declare class ReplenishmentRuleRepository implements ReplenishmentRulePort {
|
|
126
|
+
private repo;
|
|
127
|
+
constructor(model: Model<ReplenishmentRuleDocument>, plugins?: PluginType[]);
|
|
128
|
+
findByNode(nodeId: string, ctx: FlowContext, session?: TransactionSession): Promise<ReplenishmentRule[]>;
|
|
129
|
+
findBySkuRef(skuRef: string, ctx: FlowContext, session?: TransactionSession): Promise<ReplenishmentRule[]>;
|
|
130
|
+
list(ctx: FlowContext, session?: TransactionSession): Promise<ReplenishmentRule[]>;
|
|
131
|
+
findById(id: string, ctx: FlowContext, session?: TransactionSession): Promise<ReplenishmentRule | null>;
|
|
132
|
+
delete(id: string, ctx: FlowContext, session?: TransactionSession): Promise<void>;
|
|
133
|
+
findMany(filter: Record<string, unknown>, ctx: FlowContext, session?: TransactionSession, options?: QueryOptions): Promise<ReplenishmentRule[]>;
|
|
134
|
+
create(input: Omit<ReplenishmentRule, '_id' | 'createdAt' | 'updatedAt'>, session?: TransactionSession): Promise<ReplenishmentRule>;
|
|
135
|
+
update(id: string, updates: Partial<ReplenishmentRule>, ctx: FlowContext, session?: TransactionSession): Promise<ReplenishmentRule>;
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/repositories/reservation.repository.d.ts
|
|
139
|
+
declare class ReservationRepository implements ReservationPort {
|
|
140
|
+
private repo;
|
|
141
|
+
constructor(model: Model<ReservationDocument>, plugins?: PluginType[]);
|
|
142
|
+
create(input: CreateReservationInput, session?: TransactionSession): Promise<Reservation>;
|
|
143
|
+
findById(id: string, ctx: FlowContext, session?: TransactionSession): Promise<Reservation | null>;
|
|
144
|
+
findByOwner(ownerType: string, ownerId: string, ctx: FlowContext, session?: TransactionSession): Promise<Reservation[]>;
|
|
145
|
+
updateStatus(id: string, status: ReservationStatus, updates: Partial<Reservation>, session?: TransactionSession): Promise<Reservation>;
|
|
146
|
+
findExpired(asOf: Date, ctx: FlowContext, session?: TransactionSession): Promise<Reservation[]>;
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/repositories/types.d.ts
|
|
150
|
+
/**
|
|
151
|
+
* Cast the opaque TransactionSession to Mongoose ClientSession.
|
|
152
|
+
* This is the one unavoidable branded-type cast in the repo layer — the port
|
|
153
|
+
* uses an opaque type so services never touch mongoose directly.
|
|
154
|
+
*/
|
|
155
|
+
declare function toSession(session?: TransactionSession): ClientSession | undefined;
|
|
156
|
+
/** Convert FlowContext organizationId (string) to ObjectId for MongoDB queries. */
|
|
157
|
+
declare function toOrgId(ctx: FlowContext): Types.ObjectId;
|
|
158
|
+
/**
|
|
159
|
+
* Extract docs from MongoKit's PaginationResult or raw array.
|
|
160
|
+
* - Paginated result (offset, keyset, aggregate): returns `.docs`
|
|
161
|
+
* - Raw array (from noPagination: true / findAll): returns as-is
|
|
162
|
+
*/
|
|
163
|
+
declare function extractDocs<T>(result: PaginationResult<T> | T[]): T[];
|
|
164
|
+
/**
|
|
165
|
+
* Narrow a PaginationResult to its offset variant with full metadata.
|
|
166
|
+
* Safe to call when you know the query used offset pagination (page param).
|
|
167
|
+
*/
|
|
168
|
+
declare function asOffsetResult<T>(result: PaginationResult<T>): OffsetPaginationResult<T>;
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/repositories/index.d.ts
|
|
171
|
+
interface FlowRepositories {
|
|
172
|
+
quant: QuantPort;
|
|
173
|
+
move: MovePort;
|
|
174
|
+
moveGroup: MoveGroupPort;
|
|
175
|
+
reservation: ReservationPort;
|
|
176
|
+
location: LocationPort;
|
|
177
|
+
node: NodePort;
|
|
178
|
+
lot: LotPort;
|
|
179
|
+
costLayer: CostLayerPort;
|
|
180
|
+
procurement: ProcurementPort;
|
|
181
|
+
count: CountPort;
|
|
182
|
+
replenishmentRule: ReplenishmentRulePort;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Per-repository plugin overrides.
|
|
186
|
+
* Only specify plugins for repos that need them — others get no plugins (lean).
|
|
187
|
+
*/
|
|
188
|
+
interface RepositoryPlugins {
|
|
189
|
+
quant?: PluginType[];
|
|
190
|
+
move?: PluginType[];
|
|
191
|
+
moveGroup?: PluginType[];
|
|
192
|
+
reservation?: PluginType[];
|
|
193
|
+
location?: PluginType[];
|
|
194
|
+
node?: PluginType[];
|
|
195
|
+
lot?: PluginType[];
|
|
196
|
+
costLayer?: PluginType[];
|
|
197
|
+
procurement?: PluginType[];
|
|
198
|
+
count?: PluginType[];
|
|
199
|
+
replenishmentRule?: PluginType[];
|
|
200
|
+
}
|
|
201
|
+
declare function createRepositories(models: FlowModels, plugins?: RepositoryPlugins): FlowRepositories;
|
|
202
|
+
//#endregion
|
|
203
|
+
export { CountRepository as _, extractDocs as a, ReservationRepository as c, ProcurementRepository as d, NodeRepository as f, LocationRepository as g, LotRepository as h, asOffsetResult as i, ReplenishmentRuleRepository as l, MoveRepository as m, RepositoryPlugins as n, toOrgId as o, MoveGroupRepository as p, createRepositories as r, toSession as s, FlowRepositories as t, QuantRepository as u, CostLayerRepository as v };
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { n as VirtualLocationMap } from "./virtual-locations-B9zXqPdi.mjs";
|
|
2
|
+
import { t as CountPort } from "./count.port-BRqwGbi3.mjs";
|
|
3
|
+
import { n as MovePort, r as StockMove, t as CreateMoveInput } from "./move.port-Qg1CYp7h.mjs";
|
|
4
|
+
import { i as PaginatedResult, n as FlowMode, r as ListQuery, t as FlowContext } from "./index-DFF0GJ4J.mjs";
|
|
5
|
+
import { t as CostLayerPort } from "./cost-layer.port-iH9pvZqB.mjs";
|
|
6
|
+
import { i as Reservation, n as ReservationPort, r as NodePort } from "./reservation.port-l9NFQ0si.mjs";
|
|
7
|
+
import { t as LocationPort } from "./location.port-CValXIpb.mjs";
|
|
8
|
+
import { n as ProcurementPort, t as ReplenishmentRulePort } from "./replenishment-rule.port-DnEYtbyD.mjs";
|
|
9
|
+
import { t as LotPort } from "./lot.port-ChsmvZqs.mjs";
|
|
10
|
+
import { a as StockMoveGroup, n as MoveGroupPort } from "./move-group.port-DHGoQA3d.mjs";
|
|
11
|
+
import { n as StockQuant } from "./stock-quant-CZhgvTu7.mjs";
|
|
12
|
+
import { n as UnitOfWork } from "./unit-of-work.port-CWEkrDKu.mjs";
|
|
13
|
+
import { t as EventEmitterPort } from "./event-emitter.port-BFh2pasY.mjs";
|
|
14
|
+
import { n as AvailabilityQuery, r as QuantPort, t as Availability } from "./quant.port-BBa66PBT.mjs";
|
|
15
|
+
import { t as RuntimeConfig } from "./runtime-config-CQLtPPqY.mjs";
|
|
16
|
+
import { n as CountingService } from "./counting.service-CpAxU2G0.mjs";
|
|
17
|
+
import { n as CatalogBridge } from "./catalog-bridge-K8bdkncJ.mjs";
|
|
18
|
+
import { n as AllocationResult, t as AllocationPolicy } from "./allocation-policy-my_HfzdV.mjs";
|
|
19
|
+
import { t as ValuationPolicy } from "./valuation-policy-Dco8c9Vw.mjs";
|
|
20
|
+
import { t as IdempotencyPort } from "./idempotency.port-CTC70JON.mjs";
|
|
21
|
+
import { n as ScanResolution } from "./scan-token-CNM9QVLY.mjs";
|
|
22
|
+
import { i as StockAgingReport, o as HealthMetricsReport, t as TurnoverReport, u as AvailabilityReport } from "./index-BmNm3oNU2.mjs";
|
|
23
|
+
import { r as TraceService } from "./trace.service-B9vAh-l-.mjs";
|
|
24
|
+
import { t as CostLayerService } from "./cost-layer.service-DWmo9dQz.mjs";
|
|
25
|
+
import { r as PackageService } from "./package.service-C605NaBQ.mjs";
|
|
26
|
+
import { o as ProcurementService, r as ReplenishmentService } from "./replenishment.service-HO0sDhB_.mjs";
|
|
27
|
+
import { Model } from "mongoose";
|
|
28
|
+
|
|
29
|
+
//#region src/services/allocation.service.d.ts
|
|
30
|
+
interface AllocateInput {
|
|
31
|
+
skuRef: string;
|
|
32
|
+
quantity: number;
|
|
33
|
+
nodeId?: string;
|
|
34
|
+
locationId?: string;
|
|
35
|
+
policy?: string;
|
|
36
|
+
}
|
|
37
|
+
interface AvailabilityCheckItem {
|
|
38
|
+
skuRef: string;
|
|
39
|
+
quantity: number;
|
|
40
|
+
}
|
|
41
|
+
interface AvailabilityCheckResult {
|
|
42
|
+
items: Array<{
|
|
43
|
+
skuRef: string;
|
|
44
|
+
requested: number;
|
|
45
|
+
available: number;
|
|
46
|
+
fulfilled: boolean;
|
|
47
|
+
}>;
|
|
48
|
+
allFulfilled: boolean;
|
|
49
|
+
}
|
|
50
|
+
declare class AllocationService {
|
|
51
|
+
private quantPort;
|
|
52
|
+
private defaultPolicy;
|
|
53
|
+
private policyRegistry;
|
|
54
|
+
constructor(quantPort: QuantPort, defaultPolicy: AllocationPolicy);
|
|
55
|
+
/**
|
|
56
|
+
* Register a named allocation policy.
|
|
57
|
+
* Consumers can register per-node or per-category policies.
|
|
58
|
+
*/
|
|
59
|
+
registerPolicy(policy: AllocationPolicy): void;
|
|
60
|
+
/**
|
|
61
|
+
* Get a policy by name. Falls back to default.
|
|
62
|
+
*/
|
|
63
|
+
getPolicy(name?: string): AllocationPolicy;
|
|
64
|
+
allocate(input: AllocateInput, ctx: FlowContext): Promise<AllocationResult>;
|
|
65
|
+
checkAvailability(items: AvailabilityCheckItem[], nodeId: string, ctx: FlowContext): Promise<AvailabilityCheckResult>;
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/services/posting.service.d.ts
|
|
69
|
+
interface PostResult {
|
|
70
|
+
move: StockMove;
|
|
71
|
+
sourceQuant: StockQuant;
|
|
72
|
+
destinationQuant: StockQuant;
|
|
73
|
+
}
|
|
74
|
+
declare class PostingService {
|
|
75
|
+
private unitOfWork;
|
|
76
|
+
private movePort;
|
|
77
|
+
private quantPort;
|
|
78
|
+
private eventEmitter;
|
|
79
|
+
private locationPort;
|
|
80
|
+
private runtimeConfig;
|
|
81
|
+
constructor(unitOfWork: UnitOfWork, movePort: MovePort, quantPort: QuantPort, eventEmitter: EventEmitterPort, locationPort: LocationPort | undefined, runtimeConfig: RuntimeConfig);
|
|
82
|
+
postMove(moveId: string, payload: {
|
|
83
|
+
quantityDone: number;
|
|
84
|
+
executedAt?: Date;
|
|
85
|
+
forceAllowNegative?: boolean;
|
|
86
|
+
}, ctx: FlowContext): Promise<PostResult>;
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/services/move.service.d.ts
|
|
90
|
+
declare class MoveService {
|
|
91
|
+
private movePort;
|
|
92
|
+
private postingService;
|
|
93
|
+
private unitOfWork;
|
|
94
|
+
private eventEmitter;
|
|
95
|
+
private idempotency;
|
|
96
|
+
constructor(movePort: MovePort, postingService: PostingService, unitOfWork: UnitOfWork, eventEmitter: EventEmitterPort, idempotency: IdempotencyPort | null);
|
|
97
|
+
create(input: CreateMoveInput, ctx: FlowContext): Promise<StockMove>;
|
|
98
|
+
commit(moveId: string, payload: {
|
|
99
|
+
quantityDone: number;
|
|
100
|
+
trackingAssignments?: Array<Record<string, unknown>>;
|
|
101
|
+
executedAt?: Date;
|
|
102
|
+
}, ctx: FlowContext): Promise<StockMove>;
|
|
103
|
+
private executeCommit;
|
|
104
|
+
cancel(moveId: string, ctx: FlowContext): Promise<StockMove>;
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/services/move-group.service.d.ts
|
|
108
|
+
type GroupAction = 'confirm' | 'allocate' | 'dispatch' | 'receive' | 'cancel';
|
|
109
|
+
interface CreateMoveGroupServiceInput {
|
|
110
|
+
groupType: string;
|
|
111
|
+
sourceNodeId?: string;
|
|
112
|
+
destinationNodeId?: string;
|
|
113
|
+
priority?: number;
|
|
114
|
+
counterparty?: {
|
|
115
|
+
type: string;
|
|
116
|
+
id: string;
|
|
117
|
+
};
|
|
118
|
+
notes?: string;
|
|
119
|
+
metadata?: Record<string, unknown>;
|
|
120
|
+
items: Array<CreateMoveInput>;
|
|
121
|
+
}
|
|
122
|
+
declare class MoveGroupService {
|
|
123
|
+
private moveGroupPort;
|
|
124
|
+
private movePort;
|
|
125
|
+
private quantPort;
|
|
126
|
+
private reservationPort;
|
|
127
|
+
private unitOfWork;
|
|
128
|
+
private eventEmitter;
|
|
129
|
+
private getNextSequence;
|
|
130
|
+
private runtimeConfig;
|
|
131
|
+
private virtualLocations;
|
|
132
|
+
private postingService;
|
|
133
|
+
private procurementPort?;
|
|
134
|
+
constructor(moveGroupPort: MoveGroupPort, movePort: MovePort, quantPort: QuantPort, reservationPort: ReservationPort, _locationPort: LocationPort, _nodePort: NodePort, unitOfWork: UnitOfWork, eventEmitter: EventEmitterPort, _idempotency: IdempotencyPort | null, _catalogBridge: CatalogBridge, getNextSequence: (prefix: string, organizationId: string) => Promise<number>, runtimeConfig: RuntimeConfig, virtualLocations: VirtualLocationMap, postingService: PostingService, procurementPort?: ProcurementPort | undefined);
|
|
135
|
+
create(input: CreateMoveGroupServiceInput, ctx: FlowContext): Promise<StockMoveGroup>;
|
|
136
|
+
createFromProcurement(orderId: string, ctx: FlowContext): Promise<StockMoveGroup>;
|
|
137
|
+
executeAction(id: string, action: GroupAction, payload: Record<string, unknown>, ctx: FlowContext): Promise<StockMoveGroup>;
|
|
138
|
+
getById(id: string, ctx: FlowContext): Promise<StockMoveGroup | null>;
|
|
139
|
+
list(query: ListQuery, ctx: FlowContext): Promise<PaginatedResult<StockMoveGroup>>;
|
|
140
|
+
private confirmGroup;
|
|
141
|
+
private allocateGroup;
|
|
142
|
+
private dispatchGroup;
|
|
143
|
+
private receiveGroup;
|
|
144
|
+
/**
|
|
145
|
+
* Consume and release a reservation after its move has been fulfilled.
|
|
146
|
+
* Consumes the fulfilled quantity, then releases the full reserved amount from the quant.
|
|
147
|
+
*/
|
|
148
|
+
private releaseReservation;
|
|
149
|
+
private cancelGroup;
|
|
150
|
+
private requireGroup;
|
|
151
|
+
private assertGroupTransition;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/services/quant.service.d.ts
|
|
155
|
+
interface ProjectedAvailability extends Availability {
|
|
156
|
+
projectedIncoming: number;
|
|
157
|
+
projectedOutgoing: number;
|
|
158
|
+
projectedAvailable: number;
|
|
159
|
+
}
|
|
160
|
+
interface RebuildScope {
|
|
161
|
+
skuRef?: string;
|
|
162
|
+
locationId?: string;
|
|
163
|
+
nodeId?: string;
|
|
164
|
+
}
|
|
165
|
+
interface RebuildResult {
|
|
166
|
+
quantsRebuilt: number;
|
|
167
|
+
discrepancies: Array<{
|
|
168
|
+
skuRef: string;
|
|
169
|
+
locationId: string;
|
|
170
|
+
previousOnHand: number;
|
|
171
|
+
rebuiltOnHand: number;
|
|
172
|
+
delta: number;
|
|
173
|
+
}>;
|
|
174
|
+
}
|
|
175
|
+
declare class QuantService {
|
|
176
|
+
private quantPort;
|
|
177
|
+
private movePort;
|
|
178
|
+
private unitOfWork;
|
|
179
|
+
private locationPort?;
|
|
180
|
+
constructor(quantPort: QuantPort, movePort: MovePort, _eventEmitter: EventEmitterPort, unitOfWork: UnitOfWork, locationPort?: LocationPort | undefined);
|
|
181
|
+
getAvailability(query: AvailabilityQuery, ctx: FlowContext): Promise<Availability>;
|
|
182
|
+
getProjectedAvailability(query: AvailabilityQuery, ctx: FlowContext): Promise<ProjectedAvailability>;
|
|
183
|
+
rebuildFromMoveHistory(scope: RebuildScope, ctx: FlowContext): Promise<RebuildResult>;
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/services/reservation.service.d.ts
|
|
187
|
+
interface ReserveInput {
|
|
188
|
+
reservationType: 'soft' | 'hard';
|
|
189
|
+
ownerType: string;
|
|
190
|
+
ownerId: string;
|
|
191
|
+
skuRef: string;
|
|
192
|
+
locationId: string;
|
|
193
|
+
lotId?: string;
|
|
194
|
+
quantity: number;
|
|
195
|
+
expiresAt?: Date;
|
|
196
|
+
allocationPolicy?: string;
|
|
197
|
+
}
|
|
198
|
+
declare class ReservationService {
|
|
199
|
+
private reservationPort;
|
|
200
|
+
private quantPort;
|
|
201
|
+
private unitOfWork;
|
|
202
|
+
private eventEmitter;
|
|
203
|
+
private movePort?;
|
|
204
|
+
private idempotency?;
|
|
205
|
+
constructor(reservationPort: ReservationPort, quantPort: QuantPort, unitOfWork: UnitOfWork, eventEmitter: EventEmitterPort, movePort?: MovePort | undefined, idempotency?: (IdempotencyPort | null) | undefined);
|
|
206
|
+
reserve(input: ReserveInput, ctx: FlowContext): Promise<Reservation>;
|
|
207
|
+
private executeReserve;
|
|
208
|
+
/**
|
|
209
|
+
* Bulk-reserve for all move lines in a move group.
|
|
210
|
+
* Creates one reservation per move line, all within a single transaction.
|
|
211
|
+
*/
|
|
212
|
+
reserveForMoveGroup(moveGroupId: string, ctx: FlowContext): Promise<Reservation[]>;
|
|
213
|
+
private _reserveInSession;
|
|
214
|
+
release(reservationId: string, ctx: FlowContext): Promise<Reservation>;
|
|
215
|
+
consume(reservationId: string, quantity: number, ctx: FlowContext): Promise<Reservation>;
|
|
216
|
+
expire(reservationId: string, ctx: FlowContext): Promise<Reservation>;
|
|
217
|
+
/**
|
|
218
|
+
* Cleanup job — find and expire all reservations past their expiresAt.
|
|
219
|
+
* Call this from a cron job or scheduled worker.
|
|
220
|
+
*/
|
|
221
|
+
cleanupExpired(ctx: FlowContext): Promise<{
|
|
222
|
+
expired: number;
|
|
223
|
+
}>;
|
|
224
|
+
}
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/services/scan.service.d.ts
|
|
227
|
+
declare class ScanService {
|
|
228
|
+
private locationPort;
|
|
229
|
+
private lotPort;
|
|
230
|
+
private catalogBridge;
|
|
231
|
+
constructor(locationPort: LocationPort, lotPort: LotPort, catalogBridge: CatalogBridge);
|
|
232
|
+
resolve(token: string, ctx: FlowContext): Promise<ScanResolution>;
|
|
233
|
+
}
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/services/index.d.ts
|
|
236
|
+
/** Aggregated reporting facade for the FlowEngine. */
|
|
237
|
+
interface ReportingServices {
|
|
238
|
+
stockAging: StockAgingReport;
|
|
239
|
+
turnover: TurnoverReport;
|
|
240
|
+
availability: AvailabilityReport;
|
|
241
|
+
healthMetrics: HealthMetricsReport;
|
|
242
|
+
}
|
|
243
|
+
interface FlowServices {
|
|
244
|
+
move: MoveService;
|
|
245
|
+
moveGroup: MoveGroupService;
|
|
246
|
+
quant: QuantService;
|
|
247
|
+
posting: PostingService;
|
|
248
|
+
reservation: ReservationService;
|
|
249
|
+
allocation: AllocationService;
|
|
250
|
+
scan: ScanService;
|
|
251
|
+
procurement: ProcurementService;
|
|
252
|
+
replenishment: ReplenishmentService;
|
|
253
|
+
counting: CountingService;
|
|
254
|
+
package: PackageService;
|
|
255
|
+
costLayer: CostLayerService;
|
|
256
|
+
trace: TraceService;
|
|
257
|
+
reporting: ReportingServices;
|
|
258
|
+
/** Active deployment mode. */
|
|
259
|
+
readonly mode: FlowMode;
|
|
260
|
+
/** Active routing config (enterprise only). */
|
|
261
|
+
readonly routing: {
|
|
262
|
+
putaway: boolean;
|
|
263
|
+
removal: boolean;
|
|
264
|
+
crossDock: boolean;
|
|
265
|
+
};
|
|
266
|
+
/** Active valuation config. */
|
|
267
|
+
readonly valuation: {
|
|
268
|
+
method: string;
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
interface CreateServicesInput {
|
|
272
|
+
repositories: {
|
|
273
|
+
move: MovePort;
|
|
274
|
+
moveGroup: MoveGroupPort;
|
|
275
|
+
quant: QuantPort;
|
|
276
|
+
reservation: ReservationPort;
|
|
277
|
+
location: LocationPort;
|
|
278
|
+
node: NodePort;
|
|
279
|
+
lot: LotPort;
|
|
280
|
+
costLayer: CostLayerPort;
|
|
281
|
+
procurement: ProcurementPort;
|
|
282
|
+
replenishmentRule: ReplenishmentRulePort;
|
|
283
|
+
count: CountPort;
|
|
284
|
+
};
|
|
285
|
+
/** Package model for PackageService (raw Mongoose model). */
|
|
286
|
+
packageModel?: Model<unknown>;
|
|
287
|
+
unitOfWork: UnitOfWork;
|
|
288
|
+
eventEmitter: EventEmitterPort;
|
|
289
|
+
idempotency: IdempotencyPort | null;
|
|
290
|
+
catalogBridge: CatalogBridge;
|
|
291
|
+
allocationPolicy: AllocationPolicy;
|
|
292
|
+
getNextSequence: (prefix: string, organizationId: string) => Promise<number>;
|
|
293
|
+
/** Deployment mode — controls feature availability. */
|
|
294
|
+
mode?: FlowMode;
|
|
295
|
+
/** Enterprise routing features. */
|
|
296
|
+
routing?: {
|
|
297
|
+
putaway?: boolean;
|
|
298
|
+
removal?: boolean;
|
|
299
|
+
crossDock?: boolean;
|
|
300
|
+
};
|
|
301
|
+
/** Valuation settings. */
|
|
302
|
+
valuation?: Partial<ValuationPolicy>;
|
|
303
|
+
/** Resolved virtual location map. */
|
|
304
|
+
virtualLocations?: VirtualLocationMap;
|
|
305
|
+
}
|
|
306
|
+
declare function createServices(input: CreateServicesInput): FlowServices;
|
|
307
|
+
//#endregion
|
|
308
|
+
export { PostingService as _, ScanService as a, AvailabilityCheckItem as b, ProjectedAvailability as c, RebuildScope as d, CreateMoveGroupServiceInput as f, PostResult as g, MoveService as h, createServices as i, QuantService as l, MoveGroupService as m, FlowServices as n, ReservationService as o, GroupAction as p, ReportingServices as r, ReserveInput as s, CreateServicesInput as t, RebuildResult as u, AllocateInput as v, AvailabilityCheckResult as x, AllocationService as y };
|