@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,350 @@
|
|
|
1
|
+
import { Connection, Document, Model, Types } from "mongoose";
|
|
2
|
+
|
|
3
|
+
//#region src/models/cost-layer.model.d.ts
|
|
4
|
+
interface CostLayerDocument extends Document {
|
|
5
|
+
organizationId: Types.ObjectId;
|
|
6
|
+
skuRef: string;
|
|
7
|
+
locationId: string;
|
|
8
|
+
lotId?: Types.ObjectId;
|
|
9
|
+
remainingQty: number;
|
|
10
|
+
unitCost: number;
|
|
11
|
+
receivedAt: Date;
|
|
12
|
+
expiresAt?: Date;
|
|
13
|
+
procurementRef?: string;
|
|
14
|
+
moveRef: string;
|
|
15
|
+
createdAt: Date;
|
|
16
|
+
updatedAt: Date;
|
|
17
|
+
}
|
|
18
|
+
declare function createCostLayerModel(connection: Connection): Model<CostLayerDocument>;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/models/count-line.model.d.ts
|
|
21
|
+
interface CountLineDocument extends Document {
|
|
22
|
+
organizationId: Types.ObjectId;
|
|
23
|
+
countId: Types.ObjectId;
|
|
24
|
+
skuRef: string;
|
|
25
|
+
locationId: string;
|
|
26
|
+
lotId?: Types.ObjectId;
|
|
27
|
+
serialCode?: string;
|
|
28
|
+
expectedQuantity: number;
|
|
29
|
+
countedQuantity: number;
|
|
30
|
+
variance: number;
|
|
31
|
+
varianceReason?: string;
|
|
32
|
+
recountFlag: boolean;
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
updatedAt: Date;
|
|
35
|
+
}
|
|
36
|
+
declare function createCountLineModel(connection: Connection): Model<CountLineDocument>;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/models/counters.model.d.ts
|
|
39
|
+
interface CounterDocument extends Document {
|
|
40
|
+
organizationId: string;
|
|
41
|
+
prefix: string;
|
|
42
|
+
currentValue: number;
|
|
43
|
+
}
|
|
44
|
+
declare function createCounterModel(connection: Connection): Model<CounterDocument>;
|
|
45
|
+
/**
|
|
46
|
+
* Atomically increments the counter for the given organization + prefix
|
|
47
|
+
* and returns the next sequence value.
|
|
48
|
+
*/
|
|
49
|
+
declare function getNextSequence(counterModel: Model<CounterDocument>, organizationId: string, prefix: string): Promise<number>;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/models/inventory-count.model.d.ts
|
|
52
|
+
interface CountScope {
|
|
53
|
+
nodeId?: Types.ObjectId;
|
|
54
|
+
locationId?: Types.ObjectId;
|
|
55
|
+
skuRefs?: string[];
|
|
56
|
+
}
|
|
57
|
+
interface InventoryCountDocument extends Document {
|
|
58
|
+
organizationId: Types.ObjectId;
|
|
59
|
+
countNumber: string;
|
|
60
|
+
countType: 'full' | 'cycle' | 'spot';
|
|
61
|
+
scope?: CountScope;
|
|
62
|
+
status: string;
|
|
63
|
+
freezePolicy: string;
|
|
64
|
+
startedAt?: Date;
|
|
65
|
+
submittedAt?: Date;
|
|
66
|
+
reconciledAt?: Date;
|
|
67
|
+
createdBy?: string;
|
|
68
|
+
modifiedBy?: string;
|
|
69
|
+
approvedBy?: string;
|
|
70
|
+
metadata?: Record<string, unknown>;
|
|
71
|
+
createdAt: Date;
|
|
72
|
+
updatedAt: Date;
|
|
73
|
+
}
|
|
74
|
+
declare function createInventoryCountModel(connection: Connection): Model<InventoryCountDocument>;
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/models/inventory-node.model.d.ts
|
|
77
|
+
interface InventoryNodeDocument extends Document {
|
|
78
|
+
organizationId: Types.ObjectId;
|
|
79
|
+
code: string;
|
|
80
|
+
name: string;
|
|
81
|
+
type: string;
|
|
82
|
+
status: 'active' | 'inactive';
|
|
83
|
+
timezone?: string;
|
|
84
|
+
currency?: string;
|
|
85
|
+
address?: {
|
|
86
|
+
street?: string;
|
|
87
|
+
city?: string;
|
|
88
|
+
state?: string;
|
|
89
|
+
postalCode?: string;
|
|
90
|
+
country?: string;
|
|
91
|
+
coordinates?: {
|
|
92
|
+
lat: number;
|
|
93
|
+
lng: number;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
capabilities?: string[];
|
|
97
|
+
isDefault: boolean;
|
|
98
|
+
metadata?: Record<string, unknown>;
|
|
99
|
+
createdAt: Date;
|
|
100
|
+
updatedAt: Date;
|
|
101
|
+
}
|
|
102
|
+
declare function createInventoryNodeModel(connection: Connection): Model<InventoryNodeDocument>;
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/models/location.model.d.ts
|
|
105
|
+
interface LocationDocument extends Document {
|
|
106
|
+
organizationId: Types.ObjectId;
|
|
107
|
+
nodeId: Types.ObjectId;
|
|
108
|
+
parentLocationId?: Types.ObjectId;
|
|
109
|
+
code: string;
|
|
110
|
+
name: string;
|
|
111
|
+
type: string;
|
|
112
|
+
status: 'active' | 'inactive';
|
|
113
|
+
barcode?: string;
|
|
114
|
+
capacity?: number;
|
|
115
|
+
sortOrder?: number;
|
|
116
|
+
coordinates?: {
|
|
117
|
+
zone?: string;
|
|
118
|
+
aisle?: number;
|
|
119
|
+
bay?: number;
|
|
120
|
+
level?: number;
|
|
121
|
+
bin?: string;
|
|
122
|
+
};
|
|
123
|
+
maxWeight?: number;
|
|
124
|
+
maxVolume?: number;
|
|
125
|
+
allowReservations: boolean;
|
|
126
|
+
allowNegativeStock: boolean;
|
|
127
|
+
metadata?: Record<string, unknown>;
|
|
128
|
+
createdAt: Date;
|
|
129
|
+
updatedAt: Date;
|
|
130
|
+
}
|
|
131
|
+
declare function createLocationModel(connection: Connection): Model<LocationDocument>;
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/models/procurement-order.model.d.ts
|
|
134
|
+
interface ProcurementItemSubdoc {
|
|
135
|
+
skuRef: string;
|
|
136
|
+
quantity: number;
|
|
137
|
+
quantityReceived: number;
|
|
138
|
+
unitCost: number;
|
|
139
|
+
expectedAt?: Date;
|
|
140
|
+
}
|
|
141
|
+
interface ProcurementOrderDocument extends Document {
|
|
142
|
+
organizationId: Types.ObjectId;
|
|
143
|
+
orderNumber: string;
|
|
144
|
+
vendorRef: string;
|
|
145
|
+
destinationNodeId: Types.ObjectId;
|
|
146
|
+
destinationLocationId?: Types.ObjectId;
|
|
147
|
+
status: string;
|
|
148
|
+
items: ProcurementItemSubdoc[];
|
|
149
|
+
expectedAt?: Date;
|
|
150
|
+
receivedAt?: Date;
|
|
151
|
+
sourceDemandRefs?: string[];
|
|
152
|
+
createdBy?: string;
|
|
153
|
+
modifiedBy?: string;
|
|
154
|
+
metadata?: Record<string, unknown>;
|
|
155
|
+
createdAt: Date;
|
|
156
|
+
updatedAt: Date;
|
|
157
|
+
}
|
|
158
|
+
declare function createProcurementOrderModel(connection: Connection): Model<ProcurementOrderDocument>;
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/models/replenishment-rule.model.d.ts
|
|
161
|
+
interface ReplenishmentRuleDocument extends Document {
|
|
162
|
+
organizationId: Types.ObjectId;
|
|
163
|
+
scopeType: string;
|
|
164
|
+
scopeRef: string;
|
|
165
|
+
skuRef: string;
|
|
166
|
+
locationId?: string;
|
|
167
|
+
triggerType: string;
|
|
168
|
+
reorderPoint: number;
|
|
169
|
+
targetLevel: number;
|
|
170
|
+
preferredSourceType?: string;
|
|
171
|
+
preferredSourceRef?: string;
|
|
172
|
+
procurementMode?: string;
|
|
173
|
+
leadTimeDays?: number;
|
|
174
|
+
minOrderQty?: number;
|
|
175
|
+
maxOrderQty?: number;
|
|
176
|
+
multipleOf?: number;
|
|
177
|
+
safetyStock?: number;
|
|
178
|
+
enabled: boolean;
|
|
179
|
+
metadata?: Record<string, unknown>;
|
|
180
|
+
createdAt: Date;
|
|
181
|
+
updatedAt: Date;
|
|
182
|
+
}
|
|
183
|
+
declare function createReplenishmentRuleModel(connection: Connection): Model<ReplenishmentRuleDocument>;
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/models/reservation.model.d.ts
|
|
186
|
+
interface ReservationDocument extends Document {
|
|
187
|
+
organizationId: Types.ObjectId;
|
|
188
|
+
reservationType: 'soft' | 'hard';
|
|
189
|
+
ownerType: string;
|
|
190
|
+
ownerId: string;
|
|
191
|
+
skuRef: string;
|
|
192
|
+
locationId: string;
|
|
193
|
+
lotId?: Types.ObjectId;
|
|
194
|
+
quantity: number;
|
|
195
|
+
quantityConsumed: number;
|
|
196
|
+
status: string;
|
|
197
|
+
expiresAt?: Date;
|
|
198
|
+
allocationPolicy?: string;
|
|
199
|
+
createdBy?: string;
|
|
200
|
+
releasedAt?: Date;
|
|
201
|
+
createdAt: Date;
|
|
202
|
+
updatedAt: Date;
|
|
203
|
+
}
|
|
204
|
+
declare function createReservationModel(connection: Connection): Model<ReservationDocument>;
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/models/stock-lot.model.d.ts
|
|
207
|
+
interface StockLotDocument extends Document {
|
|
208
|
+
organizationId: Types.ObjectId;
|
|
209
|
+
skuRef: string;
|
|
210
|
+
trackingType: 'lot' | 'serial';
|
|
211
|
+
lotCode?: string;
|
|
212
|
+
serialCode?: string;
|
|
213
|
+
manufacturedAt?: Date;
|
|
214
|
+
receivedAt?: Date;
|
|
215
|
+
expiresAt?: Date;
|
|
216
|
+
vendorBatchRef?: string;
|
|
217
|
+
status: string;
|
|
218
|
+
metadata?: Record<string, unknown>;
|
|
219
|
+
createdAt: Date;
|
|
220
|
+
updatedAt: Date;
|
|
221
|
+
}
|
|
222
|
+
declare function createStockLotModel(connection: Connection): Model<StockLotDocument>;
|
|
223
|
+
//#endregion
|
|
224
|
+
//#region src/models/stock-move.model.d.ts
|
|
225
|
+
interface TrackingAssignment {
|
|
226
|
+
trackingMode: string;
|
|
227
|
+
lotId?: string;
|
|
228
|
+
lotCode?: string;
|
|
229
|
+
serialCode?: string;
|
|
230
|
+
quantity: number;
|
|
231
|
+
expiresAt?: Date;
|
|
232
|
+
}
|
|
233
|
+
interface StockMoveDocument extends Document {
|
|
234
|
+
organizationId: Types.ObjectId;
|
|
235
|
+
moveGroupId: Types.ObjectId;
|
|
236
|
+
referenceType?: string;
|
|
237
|
+
referenceId?: string;
|
|
238
|
+
operationType: string;
|
|
239
|
+
skuRef: string;
|
|
240
|
+
sourceLocationId: string;
|
|
241
|
+
destinationLocationId: string;
|
|
242
|
+
trackingAssignments?: TrackingAssignment[];
|
|
243
|
+
uom: string;
|
|
244
|
+
quantityPlanned: number;
|
|
245
|
+
quantityReserved: number;
|
|
246
|
+
quantityDone: number;
|
|
247
|
+
status: string;
|
|
248
|
+
scheduledAt?: Date;
|
|
249
|
+
executedAt?: Date;
|
|
250
|
+
cancelledAt?: Date;
|
|
251
|
+
reservationIds?: Types.ObjectId[];
|
|
252
|
+
policySnapshot?: Record<string, unknown>;
|
|
253
|
+
createdBy?: string;
|
|
254
|
+
modifiedBy?: string;
|
|
255
|
+
metadata?: Record<string, unknown>;
|
|
256
|
+
createdAt: Date;
|
|
257
|
+
updatedAt: Date;
|
|
258
|
+
}
|
|
259
|
+
declare function createStockMoveModel(connection: Connection): Model<StockMoveDocument>;
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/models/stock-move-group.model.d.ts
|
|
262
|
+
interface StockMoveGroupDocument extends Document {
|
|
263
|
+
organizationId: Types.ObjectId;
|
|
264
|
+
groupType: string;
|
|
265
|
+
documentNumber: string;
|
|
266
|
+
sourceNodeId?: Types.ObjectId;
|
|
267
|
+
destinationNodeId?: Types.ObjectId;
|
|
268
|
+
status: string;
|
|
269
|
+
priority: number;
|
|
270
|
+
routePlanId?: Types.ObjectId;
|
|
271
|
+
counterparty?: {
|
|
272
|
+
type: string;
|
|
273
|
+
id: string;
|
|
274
|
+
};
|
|
275
|
+
requestedAt?: Date;
|
|
276
|
+
confirmedAt?: Date;
|
|
277
|
+
completedAt?: Date;
|
|
278
|
+
createdBy?: string;
|
|
279
|
+
modifiedBy?: string;
|
|
280
|
+
notes?: string;
|
|
281
|
+
metadata?: Record<string, unknown>;
|
|
282
|
+
createdAt: Date;
|
|
283
|
+
updatedAt: Date;
|
|
284
|
+
}
|
|
285
|
+
declare function createStockMoveGroupModel(connection: Connection): Model<StockMoveGroupDocument>;
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/models/stock-package.model.d.ts
|
|
288
|
+
interface StockPackageDocument extends Document {
|
|
289
|
+
organizationId: Types.ObjectId;
|
|
290
|
+
name: string;
|
|
291
|
+
barcode: string;
|
|
292
|
+
packageTypeId?: Types.ObjectId;
|
|
293
|
+
parentPackageId?: Types.ObjectId;
|
|
294
|
+
locationId?: Types.ObjectId;
|
|
295
|
+
destinationLocationId?: Types.ObjectId;
|
|
296
|
+
baseWeight?: number;
|
|
297
|
+
maxWeight?: number;
|
|
298
|
+
packageUse: string;
|
|
299
|
+
metadata?: Record<string, unknown>;
|
|
300
|
+
createdAt: Date;
|
|
301
|
+
updatedAt: Date;
|
|
302
|
+
}
|
|
303
|
+
declare function createStockPackageModel(connection: Connection): Model<StockPackageDocument>;
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/models/stock-quant.model.d.ts
|
|
306
|
+
interface StockQuantDocument extends Document {
|
|
307
|
+
organizationId: Types.ObjectId;
|
|
308
|
+
skuRef: string;
|
|
309
|
+
locationId: string;
|
|
310
|
+
lotId?: Types.ObjectId;
|
|
311
|
+
ownerRef?: string;
|
|
312
|
+
stockStatus: string;
|
|
313
|
+
quantityOnHand: number;
|
|
314
|
+
quantityReserved: number;
|
|
315
|
+
quantityAvailable: number;
|
|
316
|
+
quantityIncoming: number;
|
|
317
|
+
quantityOutgoing: number;
|
|
318
|
+
inDate: Date;
|
|
319
|
+
lotExpiresAt?: Date;
|
|
320
|
+
unitCost?: number;
|
|
321
|
+
lastMovementAt?: Date;
|
|
322
|
+
createdAt: Date;
|
|
323
|
+
updatedAt: Date;
|
|
324
|
+
}
|
|
325
|
+
declare function createStockQuantModel(connection: Connection): Model<StockQuantDocument>;
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/models/index.d.ts
|
|
328
|
+
interface FlowModels {
|
|
329
|
+
InventoryNode: Model<InventoryNodeDocument>;
|
|
330
|
+
Location: Model<LocationDocument>;
|
|
331
|
+
StockMove: Model<StockMoveDocument>;
|
|
332
|
+
StockMoveGroup: Model<StockMoveGroupDocument>;
|
|
333
|
+
StockQuant: Model<StockQuantDocument>;
|
|
334
|
+
Reservation: Model<ReservationDocument>;
|
|
335
|
+
StockLot: Model<StockLotDocument>;
|
|
336
|
+
CostLayer: Model<CostLayerDocument>;
|
|
337
|
+
ProcurementOrder: Model<ProcurementOrderDocument>;
|
|
338
|
+
InventoryCount: Model<InventoryCountDocument>;
|
|
339
|
+
CountLine: Model<CountLineDocument>;
|
|
340
|
+
ReplenishmentRule: Model<ReplenishmentRuleDocument>;
|
|
341
|
+
StockPackage: Model<StockPackageDocument>;
|
|
342
|
+
Counter: Model<CounterDocument>;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Creates all Flow inventory models on the given Mongoose connection.
|
|
346
|
+
* Designed for multi-tenant usage where each tenant gets its own connection.
|
|
347
|
+
*/
|
|
348
|
+
declare function createModels(connection: Connection): FlowModels;
|
|
349
|
+
//#endregion
|
|
350
|
+
export { getNextSequence as A, InventoryNodeDocument as C, createInventoryCountModel as D, InventoryCountDocument as E, createCountLineModel as M, CostLayerDocument as N, CounterDocument as O, createCostLayerModel as P, createLocationModel as S, CountScope as T, createReplenishmentRuleModel as _, StockPackageDocument as a, createProcurementOrderModel as b, createStockMoveGroupModel as c, createStockMoveModel as d, StockLotDocument as f, ReplenishmentRuleDocument as g, createReservationModel as h, createStockQuantModel as i, CountLineDocument as j, createCounterModel as k, StockMoveDocument as l, ReservationDocument as m, createModels as n, createStockPackageModel as o, createStockLotModel as p, StockQuantDocument as r, StockMoveGroupDocument as s, FlowModels as t, TrackingAssignment as u, ProcurementItemSubdoc as v, createInventoryNodeModel as w, LocationDocument as x, ProcurementOrderDocument as y };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { i as resolveVirtualLocations, n as VirtualLocationMap, r as buildVirtualSourceTypes, t as DEFAULT_VIRTUAL_LOCATIONS } from "./virtual-locations-B9zXqPdi.mjs";
|
|
2
|
+
import { a as CountLine, i as InventoryCount, n as CountScope, r as CountStatus, t as CountPort } from "./count.port-BRqwGbi3.mjs";
|
|
3
|
+
import { a as ReservationStatus, c as VIRTUAL_LOCATION_TYPES, d as MOVE_STATUS_TRANSITIONS, f as MoveStatus, i as StockStatus, l as GroupType, n as TrackingMode, o as LocationType, p as isValidMoveTransition, r as SELLABLE_STATUSES, s as STOCKABLE_LOCATION_TYPES, t as ValuationMethod, u as OperationType } from "./index-CulWO137.mjs";
|
|
4
|
+
import { a as TrackingAssignment, i as assertMoveTransition, n as MovePort, r as StockMove, t as CreateMoveInput } from "./move.port-Qg1CYp7h.mjs";
|
|
5
|
+
import { a as QueryOptions, i as PaginatedResult, n as FlowMode, r as ListQuery, t as FlowContext } from "./index-DFF0GJ4J.mjs";
|
|
6
|
+
import { n as CostLayer, t as CostLayerPort } from "./cost-layer.port-iH9pvZqB.mjs";
|
|
7
|
+
import { a as Address, i as Reservation, n as ReservationPort, o as InventoryNode, r as NodePort, t as CreateReservationInput } from "./reservation.port-l9NFQ0si.mjs";
|
|
8
|
+
import { n as Location, t as LocationPort } from "./location.port-CValXIpb.mjs";
|
|
9
|
+
import { a as ProcurementOrder, i as ProcurementItem, n as ProcurementPort, o as ProcurementStatus, r as ReplenishmentRule, t as ReplenishmentRulePort } from "./replenishment-rule.port-DnEYtbyD.mjs";
|
|
10
|
+
import { n as StockLot, t as LotPort } from "./lot.port-ChsmvZqs.mjs";
|
|
11
|
+
import { a as StockMoveGroup, i as MoveGroupStatus, n as MoveGroupPort, r as MOVE_GROUP_STATUS_TRANSITIONS, t as CreateMoveGroupInput } from "./move-group.port-DHGoQA3d.mjs";
|
|
12
|
+
import { t as StockPackage } from "./stock-package-BIarxbDS.mjs";
|
|
13
|
+
import { n as StockQuant, t as QuantIdentity } from "./stock-quant-CZhgvTu7.mjs";
|
|
14
|
+
import { n as UnitOfWork, t as TransactionSession } from "./unit-of-work.port-CWEkrDKu.mjs";
|
|
15
|
+
import { i as FlowEvents, n as FlowEventMap, r as FlowEventName, t as EventEmitterPort } from "./event-emitter.port-BFh2pasY.mjs";
|
|
16
|
+
import { i as QuantUpdate, n as AvailabilityQuery, r as QuantPort, t as Availability } from "./quant.port-BBa66PBT.mjs";
|
|
17
|
+
import { t as AuthContext } from "./index-DsE7lZdO.mjs";
|
|
18
|
+
import { n as CatalogBridge, r as SkuDetails, t as AvailabilityUpdate } from "./catalog-bridge-K8bdkncJ.mjs";
|
|
19
|
+
import { C as ReservationNotFoundError, D as FlowError, E as ValidationError, S as QuantMismatchError, T as StockFrozenError, _ as MoveAlreadyPostedError, a as SkuRef, b as NodeNotFoundError, c as ReservationExpiredError, d as InsufficientStockError, f as ConcurrencyConflictError, g as LotRequiredError, h as LocationNotStockableError, i as convertToBase, l as LocationCapacityExceededError, m as LocationNotFoundError, n as UoMQuantity, o as Quantity, p as DuplicateReservationError, r as convertFromBase, s as TenantIsolationError, t as UoMConversion, u as InvalidTransitionError, v as MoveGroupNotFoundError, w as SerialQuantityError, x as ProcurementNotApprovedError, y as NegativeStockError } from "./index-C_aEnozN.mjs";
|
|
20
|
+
import { n as AllocationResult, t as AllocationPolicy } from "./allocation-policy-my_HfzdV.mjs";
|
|
21
|
+
import { n as PutawayPolicy, t as RemovalPolicy } from "./removal-policy-BItBB8FD.mjs";
|
|
22
|
+
import { t as ValuationPolicy } from "./valuation-policy-Dco8c9Vw.mjs";
|
|
23
|
+
import { t as IdempotencyPort } from "./idempotency.port-CTC70JON.mjs";
|
|
24
|
+
import { n as ScanResolution, t as GS1Resolution } from "./scan-token-CNM9QVLY.mjs";
|
|
25
|
+
import { t as InProcessEventBus } from "./event-bus-Um_xrcMY.mjs";
|
|
26
|
+
import { t as FlowModels } from "./index-dtWUZr2a2.mjs";
|
|
27
|
+
import { n as RepositoryPlugins, t as FlowRepositories } from "./index-C5PciI9P.mjs";
|
|
28
|
+
import { n as FlowServices } from "./index-CMTUKEK_.mjs";
|
|
29
|
+
import { a as FefoStrategy, n as LifoStrategy, o as ExactLotStrategy, r as FifoStrategy, t as NearestStrategy } from "./index-Bia4m8d2.mjs";
|
|
30
|
+
import { Connection } from "mongoose";
|
|
31
|
+
|
|
32
|
+
//#region src/index.d.ts
|
|
33
|
+
interface FlowConfig {
|
|
34
|
+
/** Mongoose connection instance. */
|
|
35
|
+
mongoose: Connection;
|
|
36
|
+
/** Deployment mode — controls which features are enabled. */
|
|
37
|
+
mode: FlowMode;
|
|
38
|
+
/** Multi-tenant settings. */
|
|
39
|
+
multiTenant?: {
|
|
40
|
+
orgField?: string;
|
|
41
|
+
orgRef?: string;
|
|
42
|
+
};
|
|
43
|
+
/** Inventory valuation settings. */
|
|
44
|
+
valuation?: Partial<ValuationPolicy>;
|
|
45
|
+
/** Allocation policy settings. */
|
|
46
|
+
allocation?: {
|
|
47
|
+
defaultPolicy?: 'fifo' | 'fefo' | 'lifo';
|
|
48
|
+
};
|
|
49
|
+
/** Enterprise routing features. */
|
|
50
|
+
routing?: {
|
|
51
|
+
putaway?: boolean;
|
|
52
|
+
removal?: boolean;
|
|
53
|
+
crossDock?: boolean;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Override virtual location sentinels to match your app's seeded locations.
|
|
57
|
+
* Defaults: `{ vendor: 'vendor', customer: 'customer', adjustment: 'inventory_loss', transit: 'transit', scrap: 'scrap' }`
|
|
58
|
+
*
|
|
59
|
+
* Example: `{ adjustment: 'adjustment' }` to align with be-prod's location conventions.
|
|
60
|
+
*/
|
|
61
|
+
virtualLocations?: Partial<VirtualLocationMap>;
|
|
62
|
+
/** Required: how Flow resolves SKU details. */
|
|
63
|
+
catalog: CatalogBridge;
|
|
64
|
+
/** Event emitter configuration. */
|
|
65
|
+
events?: {
|
|
66
|
+
adapter?: EventEmitterPort;
|
|
67
|
+
};
|
|
68
|
+
/** Custom allocation policy. */
|
|
69
|
+
policies?: {
|
|
70
|
+
allocation?: AllocationPolicy;
|
|
71
|
+
};
|
|
72
|
+
/** Custom idempotency implementation. */
|
|
73
|
+
idempotency?: IdempotencyPort;
|
|
74
|
+
/**
|
|
75
|
+
* MongoKit plugins per repository. Only add plugins where you need them.
|
|
76
|
+
*
|
|
77
|
+
* ```typescript
|
|
78
|
+
* plugins: {
|
|
79
|
+
* quant: [cachePlugin({ adapter: redis, ttl: 30 })],
|
|
80
|
+
* move: [multiTenantPlugin({ tenantField: 'organizationId' }), auditTrailPlugin()],
|
|
81
|
+
* reservation: [multiTenantPlugin({ tenantField: 'organizationId' })],
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
plugins?: RepositoryPlugins;
|
|
86
|
+
/**
|
|
87
|
+
* Suppress MongoKit internal warnings (e.g. missing index hints for keyset pagination).
|
|
88
|
+
* Set `true` to silence all warnings, or provide a custom logger config.
|
|
89
|
+
*
|
|
90
|
+
* ```typescript
|
|
91
|
+
* silent: true // silence all mongokit warnings
|
|
92
|
+
* silent: { warn: (msg) => myLogger.warn(msg) } // redirect to your logger
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
silent?: boolean | {
|
|
96
|
+
warn: (msg: string, ...args: unknown[]) => void;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
interface FlowEngine {
|
|
100
|
+
models: FlowModels;
|
|
101
|
+
repositories: FlowRepositories;
|
|
102
|
+
services: FlowServices;
|
|
103
|
+
events: EventEmitterPort;
|
|
104
|
+
/** Register a named allocation policy (per-node, per-category, etc.). */
|
|
105
|
+
registerPolicy: (type: 'allocation', name: string, policy: AllocationPolicy) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Gracefully tear down the engine — releases Flow-owned resources.
|
|
108
|
+
* Does NOT close the caller-owned Mongoose connection by default.
|
|
109
|
+
* Pass `{ closeConnection: true }` to also close the connection.
|
|
110
|
+
*/
|
|
111
|
+
destroy: (options?: {
|
|
112
|
+
closeConnection?: boolean;
|
|
113
|
+
}) => Promise<void>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Create a Flow inventory engine.
|
|
117
|
+
*
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const flow = createFlowEngine({
|
|
120
|
+
* mongoose: connection,
|
|
121
|
+
* mode: 'standard',
|
|
122
|
+
* catalog: myCatalogBridge,
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
declare function createFlowEngine(config: FlowConfig): FlowEngine;
|
|
127
|
+
//#endregion
|
|
128
|
+
export { Address, AllocationPolicy, AllocationResult, AuthContext, Availability, AvailabilityQuery, AvailabilityUpdate, CatalogBridge, ConcurrencyConflictError, CostLayer, CostLayerPort, CountLine, CountPort, CountScope, CountStatus, CreateMoveGroupInput, CreateMoveInput, CreateReservationInput, DEFAULT_VIRTUAL_LOCATIONS, DuplicateReservationError, EventEmitterPort, ExactLotStrategy, FefoStrategy, FifoStrategy, FlowConfig, type FlowContext, FlowEngine, FlowError, type FlowEventMap, type FlowEventName, FlowEvents, type FlowMode, type FlowModels, type FlowRepositories, type FlowServices, GS1Resolution, GroupType, IdempotencyPort, InProcessEventBus, InsufficientStockError, InvalidTransitionError, InventoryCount, InventoryNode, LifoStrategy, type ListQuery, Location, LocationCapacityExceededError, LocationNotFoundError, LocationNotStockableError, LocationPort, LocationType, LotPort, LotRequiredError, MOVE_GROUP_STATUS_TRANSITIONS, MOVE_STATUS_TRANSITIONS, MoveAlreadyPostedError, MoveGroupNotFoundError, MoveGroupPort, MoveGroupStatus, MovePort, MoveStatus, NearestStrategy, NegativeStockError, NodeNotFoundError, NodePort, OperationType, type PaginatedResult, ProcurementItem, ProcurementNotApprovedError, ProcurementOrder, ProcurementPort, ProcurementStatus, PutawayPolicy, QuantIdentity, QuantMismatchError, QuantPort, QuantUpdate, Quantity, type QueryOptions, RemovalPolicy, ReplenishmentRule, ReplenishmentRulePort, type RepositoryPlugins, Reservation, ReservationExpiredError, ReservationNotFoundError, ReservationPort, ReservationStatus, SELLABLE_STATUSES, STOCKABLE_LOCATION_TYPES, ScanResolution, SerialQuantityError, SkuDetails, SkuRef, StockFrozenError, StockLot, StockMove, StockMoveGroup, StockPackage, StockQuant, StockStatus, TenantIsolationError, TrackingAssignment, TrackingMode, TransactionSession, UnitOfWork, UoMConversion, UoMQuantity, VIRTUAL_LOCATION_TYPES, ValidationError, ValuationMethod, ValuationPolicy, VirtualLocationMap, assertMoveTransition, buildVirtualSourceTypes, convertFromBase, convertToBase, createFlowEngine, isValidMoveTransition, resolveVirtualLocations };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { a as DEFAULT_VIRTUAL_LOCATIONS, i as InvalidTransitionError, n as assertMoveTransition, o as buildVirtualSourceTypes, r as ReservationExpiredError, s as resolveVirtualLocations, t as MOVE_GROUP_STATUS_TRANSITIONS } from "./stock-move-group-C0DqUfPY.mjs";
|
|
2
|
+
import { t as InProcessEventBus } from "./event-bus-BNmyoJb4.mjs";
|
|
3
|
+
import { m as getNextSequence, t as createModels } from "./models-CHTMbp-G.mjs";
|
|
4
|
+
import { t as createRepositories } from "./repositories-nZXJKvLW.mjs";
|
|
5
|
+
import { t as FlowError } from "./base-MWBqRFM2.mjs";
|
|
6
|
+
import { a as LotRequiredError, c as NegativeStockError, d as QuantMismatchError, f as ReservationNotFoundError, h as ValidationError, i as LocationNotStockableError, l as NodeNotFoundError, m as StockFrozenError, n as DuplicateReservationError, o as MoveAlreadyPostedError, p as SerialQuantityError, r as LocationNotFoundError, s as MoveGroupNotFoundError, t as ConcurrencyConflictError, u as ProcurementNotApprovedError } from "./domain-errors-D7S9ydNF.mjs";
|
|
7
|
+
import { t as InsufficientStockError } from "./insufficient-stock.error-Dyr4BYaV.mjs";
|
|
8
|
+
import { a as LocationCapacityExceededError, i as Quantity, n as convertToBase, r as SkuRef, t as convertFromBase } from "./domain-D5cpMpR0.mjs";
|
|
9
|
+
import { t as TenantIsolationError } from "./tenant-isolation.error-D3OcKUdx.mjs";
|
|
10
|
+
import { a as FifoStrategy, i as FefoStrategy, n as ExactLotStrategy, r as LifoStrategy, t as NearestStrategy } from "./reservations-Cg4wN0QB.mjs";
|
|
11
|
+
import { t as createServices } from "./services-_lLO4Xbl.mjs";
|
|
12
|
+
import { t as FlowEvents } from "./event-types-BSqQOvXv.mjs";
|
|
13
|
+
import { n as MoveStatus, r as isValidMoveTransition, t as MOVE_STATUS_TRANSITIONS } from "./move-status-DkaFp2GD.mjs";
|
|
14
|
+
import { n as GroupType, t as ReservationStatus } from "./reservation-status-ZfuTaWG0.mjs";
|
|
15
|
+
import { a as OperationType, c as VIRTUAL_LOCATION_TYPES, i as StockStatus, n as TrackingMode, o as LocationType, r as SELLABLE_STATUSES, s as STOCKABLE_LOCATION_TYPES, t as ValuationMethod } from "./enums-C3_z6aHC.mjs";
|
|
16
|
+
import { configureLogger } from "@classytic/mongokit";
|
|
17
|
+
//#region src/index.ts
|
|
18
|
+
var MongoUnitOfWork = class {
|
|
19
|
+
constructor(connection) {
|
|
20
|
+
this.connection = connection;
|
|
21
|
+
}
|
|
22
|
+
async withTransaction(fn) {
|
|
23
|
+
const session = await this.connection.startSession();
|
|
24
|
+
try {
|
|
25
|
+
let result;
|
|
26
|
+
let assigned = false;
|
|
27
|
+
await session.withTransaction(async () => {
|
|
28
|
+
result = await fn(session);
|
|
29
|
+
assigned = true;
|
|
30
|
+
});
|
|
31
|
+
if (!assigned) throw new Error("Transaction callback was never executed");
|
|
32
|
+
return result;
|
|
33
|
+
} finally {
|
|
34
|
+
await session.endSession();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Create a Flow inventory engine.
|
|
40
|
+
*
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const flow = createFlowEngine({
|
|
43
|
+
* mongoose: connection,
|
|
44
|
+
* mode: 'standard',
|
|
45
|
+
* catalog: myCatalogBridge,
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
function createFlowEngine(config) {
|
|
50
|
+
const { mongoose: connection, catalog } = config;
|
|
51
|
+
const mode = config.mode ?? "standard";
|
|
52
|
+
if (config.silent === true) configureLogger(false);
|
|
53
|
+
else if (config.silent && typeof config.silent === "object") configureLogger({ warn: config.silent.warn });
|
|
54
|
+
const models = createModels(connection);
|
|
55
|
+
const repositories = createRepositories(models, config.plugins);
|
|
56
|
+
const unitOfWork = new MongoUnitOfWork(connection);
|
|
57
|
+
const eventEmitter = config.events?.adapter ?? new InProcessEventBus();
|
|
58
|
+
const idempotency = config.idempotency ?? null;
|
|
59
|
+
const allocationPolicy = config.policies?.allocation ?? resolveAllocationPolicy(config);
|
|
60
|
+
const boundGetNextSequence = async (prefix, organizationId) => {
|
|
61
|
+
return getNextSequence(models.Counter, organizationId, prefix);
|
|
62
|
+
};
|
|
63
|
+
const virtualLocations = resolveVirtualLocations(config.virtualLocations);
|
|
64
|
+
const services = createServices({
|
|
65
|
+
repositories,
|
|
66
|
+
unitOfWork,
|
|
67
|
+
eventEmitter,
|
|
68
|
+
idempotency,
|
|
69
|
+
catalogBridge: catalog,
|
|
70
|
+
allocationPolicy,
|
|
71
|
+
getNextSequence: boundGetNextSequence,
|
|
72
|
+
mode,
|
|
73
|
+
routing: mode === "enterprise" ? config.routing : void 0,
|
|
74
|
+
valuation: config.valuation,
|
|
75
|
+
virtualLocations,
|
|
76
|
+
packageModel: models.StockPackage
|
|
77
|
+
});
|
|
78
|
+
const registerPolicy = (_type, _name, policy) => {
|
|
79
|
+
services.allocation.registerPolicy(policy);
|
|
80
|
+
};
|
|
81
|
+
const destroy = async (options) => {
|
|
82
|
+
if (options?.closeConnection) await connection.close();
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
models,
|
|
86
|
+
repositories,
|
|
87
|
+
services,
|
|
88
|
+
events: eventEmitter,
|
|
89
|
+
registerPolicy,
|
|
90
|
+
destroy
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/** Resolve the default allocation policy from config shorthand. */
|
|
94
|
+
function resolveAllocationPolicy(config) {
|
|
95
|
+
switch (config.allocation?.defaultPolicy ?? "fifo") {
|
|
96
|
+
case "fefo": return new FefoStrategy();
|
|
97
|
+
case "lifo": return new LifoStrategy();
|
|
98
|
+
default: return new FifoStrategy();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
export { ConcurrencyConflictError, DEFAULT_VIRTUAL_LOCATIONS, DuplicateReservationError, ExactLotStrategy, FefoStrategy, FifoStrategy, FlowError, FlowEvents, GroupType, InProcessEventBus, InsufficientStockError, InvalidTransitionError, LifoStrategy, LocationCapacityExceededError, LocationNotFoundError, LocationNotStockableError, LocationType, LotRequiredError, MOVE_GROUP_STATUS_TRANSITIONS, MOVE_STATUS_TRANSITIONS, MoveAlreadyPostedError, MoveGroupNotFoundError, MoveStatus, NearestStrategy, NegativeStockError, NodeNotFoundError, OperationType, ProcurementNotApprovedError, QuantMismatchError, Quantity, ReservationExpiredError, ReservationNotFoundError, ReservationStatus, SELLABLE_STATUSES, STOCKABLE_LOCATION_TYPES, SerialQuantityError, SkuRef, StockFrozenError, StockStatus, TenantIsolationError, TrackingMode, VIRTUAL_LOCATION_TYPES, ValidationError, ValuationMethod, assertMoveTransition, buildVirtualSourceTypes, convertFromBase, convertToBase, createFlowEngine, isValidMoveTransition, resolveVirtualLocations };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { t as FlowError } from "./base-MWBqRFM2.mjs";
|
|
2
|
+
//#region src/domain/errors/insufficient-stock.error.ts
|
|
3
|
+
var InsufficientStockError = class extends FlowError {
|
|
4
|
+
code = "INSUFFICIENT_STOCK";
|
|
5
|
+
httpStatus = 409;
|
|
6
|
+
constructor(skuRef, requested, available, locationId) {
|
|
7
|
+
super(`Insufficient stock for ${skuRef}: requested ${requested}, available ${available}${locationId ? ` at location ${locationId}` : ""}`);
|
|
8
|
+
this.skuRef = skuRef;
|
|
9
|
+
this.requested = requested;
|
|
10
|
+
this.available = available;
|
|
11
|
+
this.locationId = locationId;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { InsufficientStockError as t };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { o as LocationType } from "./index-CulWO137.mjs";
|
|
2
|
+
import { t as FlowContext } from "./index-DFF0GJ4J.mjs";
|
|
3
|
+
import { t as TransactionSession } from "./unit-of-work.port-CWEkrDKu.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/domain/entities/location.d.ts
|
|
6
|
+
interface Location {
|
|
7
|
+
_id: string;
|
|
8
|
+
organizationId: string;
|
|
9
|
+
nodeId: string;
|
|
10
|
+
parentLocationId?: string;
|
|
11
|
+
code: string;
|
|
12
|
+
name: string;
|
|
13
|
+
type: LocationType;
|
|
14
|
+
status: 'active' | 'inactive';
|
|
15
|
+
barcode?: string;
|
|
16
|
+
capacity?: number;
|
|
17
|
+
sortOrder?: number;
|
|
18
|
+
/**
|
|
19
|
+
* 3D warehouse coordinates for pick-path optimization.
|
|
20
|
+
* Tuple: [zone, aisle, bay, level, bin] — sorted lexicographically for snake-path.
|
|
21
|
+
* Example: { zone: 'A', aisle: 3, bay: 12, level: 2, bin: 'L' }
|
|
22
|
+
*/
|
|
23
|
+
coordinates?: {
|
|
24
|
+
zone?: string;
|
|
25
|
+
aisle?: number;
|
|
26
|
+
bay?: number;
|
|
27
|
+
level?: number;
|
|
28
|
+
bin?: string;
|
|
29
|
+
};
|
|
30
|
+
/** Maximum weight capacity in grams */
|
|
31
|
+
maxWeight?: number;
|
|
32
|
+
/** Maximum volume capacity in cm³ */
|
|
33
|
+
maxVolume?: number;
|
|
34
|
+
allowReservations?: boolean;
|
|
35
|
+
allowNegativeStock?: boolean;
|
|
36
|
+
metadata?: Record<string, unknown>;
|
|
37
|
+
createdAt?: Date;
|
|
38
|
+
updatedAt?: Date;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/domain/ports/location.port.d.ts
|
|
42
|
+
interface LocationPort {
|
|
43
|
+
findById(id: string, ctx: FlowContext, session?: TransactionSession): Promise<Location | null>;
|
|
44
|
+
findByNode(nodeId: string, ctx: FlowContext, session?: TransactionSession): Promise<Location[]>;
|
|
45
|
+
findByBarcode(barcode: string, ctx: FlowContext, session?: TransactionSession): Promise<Location | null>;
|
|
46
|
+
findByCode(code: string, nodeId: string, ctx: FlowContext, session?: TransactionSession): Promise<Location | null>;
|
|
47
|
+
getTree(nodeId: string, ctx: FlowContext, session?: TransactionSession): Promise<Location[]>;
|
|
48
|
+
create(input: Omit<Location, '_id' | 'createdAt' | 'updatedAt'>, session?: TransactionSession): Promise<Location>;
|
|
49
|
+
update(id: string, updates: Partial<Location>, ctx: FlowContext, session?: TransactionSession): Promise<Location>;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { Location as n, LocationPort as t };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { a as QueryOptions, t as FlowContext } from "./index-DFF0GJ4J.mjs";
|
|
2
|
+
import { t as TransactionSession } from "./unit-of-work.port-CWEkrDKu.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/domain/entities/stock-lot.d.ts
|
|
5
|
+
interface StockLot {
|
|
6
|
+
_id: string;
|
|
7
|
+
organizationId: string;
|
|
8
|
+
skuRef: string;
|
|
9
|
+
trackingType: 'lot' | 'serial';
|
|
10
|
+
lotCode?: string;
|
|
11
|
+
serialCode?: string;
|
|
12
|
+
manufacturedAt?: Date;
|
|
13
|
+
receivedAt?: Date;
|
|
14
|
+
expiresAt?: Date;
|
|
15
|
+
vendorBatchRef?: string;
|
|
16
|
+
status: 'active' | 'recalled' | 'expired';
|
|
17
|
+
metadata?: Record<string, unknown>;
|
|
18
|
+
createdAt?: Date;
|
|
19
|
+
updatedAt?: Date;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/domain/ports/lot.port.d.ts
|
|
23
|
+
interface LotPort {
|
|
24
|
+
findById(id: string, ctx: FlowContext, session?: TransactionSession): Promise<StockLot | null>;
|
|
25
|
+
findByCode(lotCode: string, skuRef: string, ctx: FlowContext, session?: TransactionSession): Promise<StockLot | null>;
|
|
26
|
+
findBySerial(serialCode: string, skuRef: string, ctx: FlowContext, session?: TransactionSession): Promise<StockLot | null>;
|
|
27
|
+
findMany(filter: Record<string, unknown>, ctx: FlowContext, session?: TransactionSession, options?: QueryOptions): Promise<StockLot[]>;
|
|
28
|
+
create(input: Omit<StockLot, '_id' | 'createdAt' | 'updatedAt'>, session?: TransactionSession): Promise<StockLot>;
|
|
29
|
+
update(id: string, updates: Partial<StockLot>, ctx: FlowContext, session?: TransactionSession): Promise<StockLot>;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { StockLot as n, LotPort as t };
|