@opsregistry/contracts 0.1.5 → 0.2.0
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/README.md +48 -5
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/inventory/stock-adjust.d.ts +137 -0
- package/dist/inventory/stock-adjust.d.ts.map +1 -0
- package/dist/inventory/stock-adjust.js +51 -0
- package/dist/inventory/stock-adjust.js.map +1 -0
- package/dist/inventory/stock-common.d.ts +161 -0
- package/dist/inventory/stock-common.d.ts.map +1 -0
- package/dist/inventory/stock-common.js +88 -0
- package/dist/inventory/stock-common.js.map +1 -0
- package/dist/inventory/stock-get-availability.d.ts +113 -0
- package/dist/inventory/stock-get-availability.d.ts.map +1 -0
- package/dist/inventory/stock-get-availability.js +34 -0
- package/dist/inventory/stock-get-availability.js.map +1 -0
- package/dist/inventory/stock-issue.d.ts +109 -0
- package/dist/inventory/stock-issue.d.ts.map +1 -0
- package/dist/inventory/stock-issue.js +26 -0
- package/dist/inventory/stock-issue.js.map +1 -0
- package/dist/inventory/stock-receive.d.ts +112 -0
- package/dist/inventory/stock-receive.d.ts.map +1 -0
- package/dist/inventory/stock-receive.js +24 -0
- package/dist/inventory/stock-receive.js.map +1 -0
- package/dist/inventory/stock-release.d.ts +98 -0
- package/dist/inventory/stock-release.d.ts.map +1 -0
- package/dist/inventory/stock-release.js +39 -0
- package/dist/inventory/stock-release.js.map +1 -0
- package/dist/inventory/stock-reserve.d.ts +151 -0
- package/dist/inventory/stock-reserve.d.ts.map +1 -0
- package/dist/inventory/stock-reserve.js +52 -0
- package/dist/inventory/stock-reserve.js.map +1 -0
- package/dist/inventory/stock-transfer.d.ts +137 -0
- package/dist/inventory/stock-transfer.d.ts.map +1 -0
- package/dist/inventory/stock-transfer.js +45 -0
- package/dist/inventory/stock-transfer.js.map +1 -0
- package/package.json +35 -2
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const operationCode: 'inventory.stock.reserve';
|
|
3
|
+
export declare const stockAllocationStrategySchema: z.ZodEnum<{
|
|
4
|
+
fefo: "fefo";
|
|
5
|
+
fifo: "fifo";
|
|
6
|
+
lifo: "lifo";
|
|
7
|
+
providerDefault: "providerDefault";
|
|
8
|
+
specific: "specific";
|
|
9
|
+
}>;
|
|
10
|
+
export declare const stockReservationLineInputSchema: z.ZodObject<{
|
|
11
|
+
lineId: z.ZodOptional<z.ZodString>;
|
|
12
|
+
item: z.ZodObject<{
|
|
13
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
14
|
+
variantId: z.ZodOptional<z.ZodString>;
|
|
15
|
+
sku: z.ZodOptional<z.ZodString>;
|
|
16
|
+
gtin: z.ZodOptional<z.ZodString>;
|
|
17
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
quantity: z.ZodObject<{
|
|
20
|
+
unitCode: z.ZodString;
|
|
21
|
+
value: z.ZodNumber;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
locations: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
24
|
+
locationId: z.ZodOptional<z.ZodString>;
|
|
25
|
+
facilityId: z.ZodOptional<z.ZodString>;
|
|
26
|
+
name: z.ZodOptional<z.ZodString>;
|
|
27
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
28
|
+
}, z.core.$strip>>>;
|
|
29
|
+
lotNumbers: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
30
|
+
serialNumbers: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
31
|
+
ownerId: z.ZodOptional<z.ZodString>;
|
|
32
|
+
conditionCodes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
33
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export declare const stockReserveInputSchema: z.ZodObject<{
|
|
36
|
+
demandReference: z.ZodObject<{
|
|
37
|
+
type: z.ZodString;
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
lineId: z.ZodOptional<z.ZodString>;
|
|
40
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
43
|
+
lineId: z.ZodOptional<z.ZodString>;
|
|
44
|
+
item: z.ZodObject<{
|
|
45
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
46
|
+
variantId: z.ZodOptional<z.ZodString>;
|
|
47
|
+
sku: z.ZodOptional<z.ZodString>;
|
|
48
|
+
gtin: z.ZodOptional<z.ZodString>;
|
|
49
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
quantity: z.ZodObject<{
|
|
52
|
+
unitCode: z.ZodString;
|
|
53
|
+
value: z.ZodNumber;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
locations: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
56
|
+
locationId: z.ZodOptional<z.ZodString>;
|
|
57
|
+
facilityId: z.ZodOptional<z.ZodString>;
|
|
58
|
+
name: z.ZodOptional<z.ZodString>;
|
|
59
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
60
|
+
}, z.core.$strip>>>;
|
|
61
|
+
lotNumbers: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
62
|
+
serialNumbers: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
63
|
+
ownerId: z.ZodOptional<z.ZodString>;
|
|
64
|
+
conditionCodes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
65
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
66
|
+
}, z.core.$strip>>;
|
|
67
|
+
allocationStrategy: z.ZodDefault<z.ZodEnum<{
|
|
68
|
+
fefo: "fefo";
|
|
69
|
+
fifo: "fifo";
|
|
70
|
+
lifo: "lifo";
|
|
71
|
+
providerDefault: "providerDefault";
|
|
72
|
+
specific: "specific";
|
|
73
|
+
}>>;
|
|
74
|
+
allowPartial: z.ZodDefault<z.ZodBoolean>;
|
|
75
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
76
|
+
idempotencyKey: z.ZodString;
|
|
77
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
export declare const stockReservationLineResultSchema: z.ZodObject<{
|
|
80
|
+
lineId: z.ZodOptional<z.ZodString>;
|
|
81
|
+
item: z.ZodObject<{
|
|
82
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
83
|
+
variantId: z.ZodOptional<z.ZodString>;
|
|
84
|
+
sku: z.ZodOptional<z.ZodString>;
|
|
85
|
+
gtin: z.ZodOptional<z.ZodString>;
|
|
86
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
requestedQuantity: z.ZodObject<{
|
|
89
|
+
unitCode: z.ZodString;
|
|
90
|
+
value: z.ZodNumber;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
reservedQuantity: z.ZodObject<{
|
|
93
|
+
value: z.ZodNumber;
|
|
94
|
+
unitCode: z.ZodString;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
shortageQuantity: z.ZodObject<{
|
|
97
|
+
value: z.ZodNumber;
|
|
98
|
+
unitCode: z.ZodString;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
allocationIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
101
|
+
messages: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
102
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
export declare const stockReserveResultSchema: z.ZodObject<{
|
|
105
|
+
operationCode: z.ZodLiteral<"inventory.stock.reserve">;
|
|
106
|
+
accessModeUsed: z.ZodLiteral<"authorized">;
|
|
107
|
+
providerCode: z.ZodOptional<z.ZodString>;
|
|
108
|
+
reservationId: z.ZodString;
|
|
109
|
+
status: z.ZodEnum<{
|
|
110
|
+
accepted: "accepted";
|
|
111
|
+
cancelled: "cancelled";
|
|
112
|
+
expired: "expired";
|
|
113
|
+
partial: "partial";
|
|
114
|
+
rejected: "rejected";
|
|
115
|
+
}>;
|
|
116
|
+
lines: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
117
|
+
lineId: z.ZodOptional<z.ZodString>;
|
|
118
|
+
item: z.ZodObject<{
|
|
119
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
120
|
+
variantId: z.ZodOptional<z.ZodString>;
|
|
121
|
+
sku: z.ZodOptional<z.ZodString>;
|
|
122
|
+
gtin: z.ZodOptional<z.ZodString>;
|
|
123
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
124
|
+
}, z.core.$strip>;
|
|
125
|
+
requestedQuantity: z.ZodObject<{
|
|
126
|
+
unitCode: z.ZodString;
|
|
127
|
+
value: z.ZodNumber;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
reservedQuantity: z.ZodObject<{
|
|
130
|
+
value: z.ZodNumber;
|
|
131
|
+
unitCode: z.ZodString;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
shortageQuantity: z.ZodObject<{
|
|
134
|
+
value: z.ZodNumber;
|
|
135
|
+
unitCode: z.ZodString;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
allocationIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
138
|
+
messages: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
139
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
140
|
+
}, z.core.$strip>>>;
|
|
141
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
142
|
+
messages: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
143
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
export type StockAllocationStrategy = z.output<typeof stockAllocationStrategySchema>;
|
|
146
|
+
export type StockReservationLineInput = z.input<typeof stockReservationLineInputSchema>;
|
|
147
|
+
export type StockReserveInput = z.input<typeof stockReserveInputSchema>;
|
|
148
|
+
export type NormalizedStockReserveInput = z.output<typeof stockReserveInputSchema>;
|
|
149
|
+
export type StockReservationLineResult = z.output<typeof stockReservationLineResultSchema>;
|
|
150
|
+
export type StockReserveResult = z.output<typeof stockReserveResultSchema>;
|
|
151
|
+
//# sourceMappingURL=stock-reserve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-reserve.d.ts","sourceRoot":"","sources":["../../src/inventory/stock-reserve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,aAAa,EAAG,yBAAkC,CAAC;AAEhE,eAAO,MAAM,6BAA6B;;;;;;EAMxC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;iBAU1C,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQlC,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;iBAS3C,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUnC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACrF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACnF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAC3F,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { inventoryAccessModeSchema, inventoryItemRefSchema, inventoryLocationRefSchema, inventoryMetadataSchema, inventoryQuantitySchema, inventoryReferenceSchema, positiveInventoryQuantitySchema } from './stock-common.js';
|
|
3
|
+
export const operationCode = 'inventory.stock.reserve';
|
|
4
|
+
export const stockAllocationStrategySchema = z.enum([
|
|
5
|
+
'providerDefault',
|
|
6
|
+
'fifo',
|
|
7
|
+
'fefo',
|
|
8
|
+
'lifo',
|
|
9
|
+
'specific'
|
|
10
|
+
]);
|
|
11
|
+
export const stockReservationLineInputSchema = z.object({
|
|
12
|
+
lineId: z.string().min(1).optional(),
|
|
13
|
+
item: inventoryItemRefSchema,
|
|
14
|
+
quantity: positiveInventoryQuantitySchema,
|
|
15
|
+
locations: z.array(inventoryLocationRefSchema).default([]),
|
|
16
|
+
lotNumbers: z.array(z.string().min(1)).default([]),
|
|
17
|
+
serialNumbers: z.array(z.string().min(1)).default([]),
|
|
18
|
+
ownerId: z.string().min(1).optional(),
|
|
19
|
+
conditionCodes: z.array(z.string().min(1)).default([]),
|
|
20
|
+
metadata: inventoryMetadataSchema
|
|
21
|
+
});
|
|
22
|
+
export const stockReserveInputSchema = z.object({
|
|
23
|
+
demandReference: inventoryReferenceSchema,
|
|
24
|
+
lines: z.array(stockReservationLineInputSchema).min(1),
|
|
25
|
+
allocationStrategy: stockAllocationStrategySchema.default('providerDefault'),
|
|
26
|
+
allowPartial: z.boolean().default(false),
|
|
27
|
+
expiresAt: z.string().min(1).optional(),
|
|
28
|
+
idempotencyKey: z.string().min(1),
|
|
29
|
+
metadata: inventoryMetadataSchema
|
|
30
|
+
});
|
|
31
|
+
export const stockReservationLineResultSchema = z.object({
|
|
32
|
+
lineId: z.string().min(1).optional(),
|
|
33
|
+
item: inventoryItemRefSchema,
|
|
34
|
+
requestedQuantity: positiveInventoryQuantitySchema,
|
|
35
|
+
reservedQuantity: inventoryQuantitySchema,
|
|
36
|
+
shortageQuantity: inventoryQuantitySchema,
|
|
37
|
+
allocationIds: z.array(z.string().min(1)).default([]),
|
|
38
|
+
messages: z.array(z.string().min(1)).default([]),
|
|
39
|
+
metadata: inventoryMetadataSchema
|
|
40
|
+
});
|
|
41
|
+
export const stockReserveResultSchema = z.object({
|
|
42
|
+
operationCode: z.literal(operationCode),
|
|
43
|
+
accessModeUsed: inventoryAccessModeSchema,
|
|
44
|
+
providerCode: z.string().min(1).optional(),
|
|
45
|
+
reservationId: z.string().min(1),
|
|
46
|
+
status: z.enum(['accepted', 'partial', 'rejected', 'expired', 'cancelled']),
|
|
47
|
+
lines: z.array(stockReservationLineResultSchema).default([]),
|
|
48
|
+
expiresAt: z.string().min(1).optional(),
|
|
49
|
+
messages: z.array(z.string().min(1)).default([]),
|
|
50
|
+
metadata: inventoryMetadataSchema
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=stock-reserve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-reserve.js","sourceRoot":"","sources":["../../src/inventory/stock-reserve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACN,yBAAy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AAQ,EAAE;IAC1C,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IAC3E,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACvC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAChD,QAAQ,EAAE,uBAAuB;CACjC,CAAC,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const operationCode: 'inventory.stock.transfer';
|
|
3
|
+
export declare const stockTransferInputSchema: z.ZodObject<{
|
|
4
|
+
source: z.ZodObject<{
|
|
5
|
+
locationId: z.ZodOptional<z.ZodString>;
|
|
6
|
+
facilityId: z.ZodOptional<z.ZodString>;
|
|
7
|
+
name: z.ZodOptional<z.ZodString>;
|
|
8
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
destination: z.ZodObject<{
|
|
11
|
+
locationId: z.ZodOptional<z.ZodString>;
|
|
12
|
+
facilityId: z.ZodOptional<z.ZodString>;
|
|
13
|
+
name: z.ZodOptional<z.ZodString>;
|
|
14
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
17
|
+
lineId: z.ZodOptional<z.ZodString>;
|
|
18
|
+
item: z.ZodObject<{
|
|
19
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
20
|
+
variantId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
sku: z.ZodOptional<z.ZodString>;
|
|
22
|
+
gtin: z.ZodOptional<z.ZodString>;
|
|
23
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
quantity: z.ZodObject<{
|
|
26
|
+
unitCode: z.ZodString;
|
|
27
|
+
value: z.ZodNumber;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
30
|
+
locationId: z.ZodOptional<z.ZodString>;
|
|
31
|
+
facilityId: z.ZodOptional<z.ZodString>;
|
|
32
|
+
name: z.ZodOptional<z.ZodString>;
|
|
33
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
lotNumber: z.ZodOptional<z.ZodString>;
|
|
36
|
+
serialNumbers: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
37
|
+
ownerId: z.ZodOptional<z.ZodString>;
|
|
38
|
+
conditionCode: z.ZodOptional<z.ZodString>;
|
|
39
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
40
|
+
}, z.core.$strip>>;
|
|
41
|
+
transferReference: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
type: z.ZodString;
|
|
43
|
+
id: z.ZodString;
|
|
44
|
+
lineId: z.ZodOptional<z.ZodString>;
|
|
45
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
shipmentReference: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
type: z.ZodString;
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
lineId: z.ZodOptional<z.ZodString>;
|
|
51
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
requestedDispatchAt: z.ZodOptional<z.ZodString>;
|
|
54
|
+
allowPartial: z.ZodDefault<z.ZodBoolean>;
|
|
55
|
+
idempotencyKey: z.ZodString;
|
|
56
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
export declare const stockTransferStatusSchema: z.ZodEnum<{
|
|
59
|
+
accepted: "accepted";
|
|
60
|
+
cancelled: "cancelled";
|
|
61
|
+
inTransit: "inTransit";
|
|
62
|
+
issued: "issued";
|
|
63
|
+
partiallyReceived: "partiallyReceived";
|
|
64
|
+
received: "received";
|
|
65
|
+
rejected: "rejected";
|
|
66
|
+
}>;
|
|
67
|
+
export declare const stockTransferResultSchema: z.ZodObject<{
|
|
68
|
+
operationCode: z.ZodLiteral<"inventory.stock.transfer">;
|
|
69
|
+
accessModeUsed: z.ZodLiteral<"authorized">;
|
|
70
|
+
providerCode: z.ZodOptional<z.ZodString>;
|
|
71
|
+
transferId: z.ZodString;
|
|
72
|
+
status: z.ZodEnum<{
|
|
73
|
+
accepted: "accepted";
|
|
74
|
+
cancelled: "cancelled";
|
|
75
|
+
inTransit: "inTransit";
|
|
76
|
+
issued: "issued";
|
|
77
|
+
partiallyReceived: "partiallyReceived";
|
|
78
|
+
received: "received";
|
|
79
|
+
rejected: "rejected";
|
|
80
|
+
}>;
|
|
81
|
+
lines: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
82
|
+
lineId: z.ZodOptional<z.ZodString>;
|
|
83
|
+
item: z.ZodObject<{
|
|
84
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
85
|
+
variantId: z.ZodOptional<z.ZodString>;
|
|
86
|
+
sku: z.ZodOptional<z.ZodString>;
|
|
87
|
+
gtin: z.ZodOptional<z.ZodString>;
|
|
88
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
requestedQuantity: z.ZodObject<{
|
|
91
|
+
unitCode: z.ZodString;
|
|
92
|
+
value: z.ZodNumber;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
processedQuantity: z.ZodObject<{
|
|
95
|
+
value: z.ZodNumber;
|
|
96
|
+
unitCode: z.ZodString;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
stockRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
99
|
+
stockId: z.ZodOptional<z.ZodString>;
|
|
100
|
+
item: z.ZodObject<{
|
|
101
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
102
|
+
variantId: z.ZodOptional<z.ZodString>;
|
|
103
|
+
sku: z.ZodOptional<z.ZodString>;
|
|
104
|
+
gtin: z.ZodOptional<z.ZodString>;
|
|
105
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
108
|
+
locationId: z.ZodOptional<z.ZodString>;
|
|
109
|
+
facilityId: z.ZodOptional<z.ZodString>;
|
|
110
|
+
name: z.ZodOptional<z.ZodString>;
|
|
111
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
112
|
+
}, z.core.$strip>>;
|
|
113
|
+
lotNumber: z.ZodOptional<z.ZodString>;
|
|
114
|
+
serialNumber: z.ZodOptional<z.ZodString>;
|
|
115
|
+
ownerId: z.ZodOptional<z.ZodString>;
|
|
116
|
+
conditionCode: z.ZodOptional<z.ZodString>;
|
|
117
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
118
|
+
}, z.core.$strip>>>;
|
|
119
|
+
messages: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
120
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
121
|
+
}, z.core.$strip>>>;
|
|
122
|
+
issueTransactionId: z.ZodOptional<z.ZodString>;
|
|
123
|
+
receiptTransactionId: z.ZodOptional<z.ZodString>;
|
|
124
|
+
shipmentReference: z.ZodOptional<z.ZodObject<{
|
|
125
|
+
type: z.ZodString;
|
|
126
|
+
id: z.ZodString;
|
|
127
|
+
lineId: z.ZodOptional<z.ZodString>;
|
|
128
|
+
externalIds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
129
|
+
}, z.core.$strip>>;
|
|
130
|
+
messages: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
131
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
export type StockTransferInput = z.input<typeof stockTransferInputSchema>;
|
|
134
|
+
export type NormalizedStockTransferInput = z.output<typeof stockTransferInputSchema>;
|
|
135
|
+
export type StockTransferStatus = z.output<typeof stockTransferStatusSchema>;
|
|
136
|
+
export type StockTransferResult = z.output<typeof stockTransferResultSchema>;
|
|
137
|
+
//# sourceMappingURL=stock-transfer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-transfer.d.ts","sourceRoot":"","sources":["../../src/inventory/stock-transfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,eAAO,MAAM,aAAa,EAAG,0BAAmC,CAAC;AAcjE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAelC,CAAC;AAEJ,eAAO,MAAM,yBAAyB;;;;;;;;EAQpC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYpC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AACrF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC7E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { inventoryAccessModeSchema, inventoryLocationRefSchema, inventoryMetadataSchema, inventoryReferenceSchema, inventoryStockLineInputSchema, inventoryTransactionLineResultSchema } from './stock-common.js';
|
|
3
|
+
export const operationCode = 'inventory.stock.transfer';
|
|
4
|
+
const locationsShareIdentifier = (source, destination) => Boolean((source.locationId && source.locationId === destination.locationId) ||
|
|
5
|
+
(source.facilityId && source.facilityId === destination.facilityId) ||
|
|
6
|
+
Object.entries(source.externalIds).some(([namespace, value]) => destination.externalIds[namespace] === value));
|
|
7
|
+
export const stockTransferInputSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
source: inventoryLocationRefSchema,
|
|
10
|
+
destination: inventoryLocationRefSchema,
|
|
11
|
+
lines: z.array(inventoryStockLineInputSchema).min(1),
|
|
12
|
+
transferReference: inventoryReferenceSchema.optional(),
|
|
13
|
+
shipmentReference: inventoryReferenceSchema.optional(),
|
|
14
|
+
requestedDispatchAt: z.string().min(1).optional(),
|
|
15
|
+
allowPartial: z.boolean().default(false),
|
|
16
|
+
idempotencyKey: z.string().min(1),
|
|
17
|
+
metadata: inventoryMetadataSchema
|
|
18
|
+
})
|
|
19
|
+
.refine((value) => !locationsShareIdentifier(value.source, value.destination), {
|
|
20
|
+
message: 'Source and destination locations must differ',
|
|
21
|
+
path: ['destination']
|
|
22
|
+
});
|
|
23
|
+
export const stockTransferStatusSchema = z.enum([
|
|
24
|
+
'accepted',
|
|
25
|
+
'issued',
|
|
26
|
+
'inTransit',
|
|
27
|
+
'partiallyReceived',
|
|
28
|
+
'received',
|
|
29
|
+
'cancelled',
|
|
30
|
+
'rejected'
|
|
31
|
+
]);
|
|
32
|
+
export const stockTransferResultSchema = z.object({
|
|
33
|
+
operationCode: z.literal(operationCode),
|
|
34
|
+
accessModeUsed: inventoryAccessModeSchema,
|
|
35
|
+
providerCode: z.string().min(1).optional(),
|
|
36
|
+
transferId: z.string().min(1),
|
|
37
|
+
status: stockTransferStatusSchema,
|
|
38
|
+
lines: z.array(inventoryTransactionLineResultSchema).default([]),
|
|
39
|
+
issueTransactionId: z.string().min(1).optional(),
|
|
40
|
+
receiptTransactionId: z.string().min(1).optional(),
|
|
41
|
+
shipmentReference: inventoryReferenceSchema.optional(),
|
|
42
|
+
messages: z.array(z.string().min(1)).default([]),
|
|
43
|
+
metadata: inventoryMetadataSchema
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=stock-transfer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-transfer.js","sourceRoot":"","sources":["../../src/inventory/stock-transfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACN,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,EAC7B,oCAAoC,EACpC,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,MAAM,aAAa,GAAG,0BAAmC,CAAC;AAEjE,MAAM,wBAAwB,GAAG,CAChC,MAAmD,EACnD,WAAwD,EACvD,EAAE,CACH,OAAO,CACN,CAAC,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,KAAK,WAAW,CAAC,UAAU,CAAC;IACnE,CAAC,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,KAAK,WAAW,CAAC,UAAU,CAAC;IACnE,MAAM,CAAC,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IACvC,cAAc,EAAE,yBAAyB;IACzC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC1C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,MAAM,EAAE,yBAAyB;IACjC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAChE,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAChD,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAClD,iBAAiB,EAAE,wBAAwB,CAAC,QAAQ,EAAE;IACtD,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAChD,QAAQ,EAAE,uBAAuB;CACjC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opsregistry/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Operation specifications and shared schemas for opsregistry.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -131,11 +131,44 @@
|
|
|
131
131
|
"./it/access-policy-evaluate": {
|
|
132
132
|
"types": "./dist/it/access-policy-evaluate.d.ts",
|
|
133
133
|
"import": "./dist/it/access-policy-evaluate.js"
|
|
134
|
+
},
|
|
135
|
+
"./inventory/stock-common": {
|
|
136
|
+
"types": "./dist/inventory/stock-common.d.ts",
|
|
137
|
+
"import": "./dist/inventory/stock-common.js"
|
|
138
|
+
},
|
|
139
|
+
"./inventory/stock-get-availability": {
|
|
140
|
+
"types": "./dist/inventory/stock-get-availability.d.ts",
|
|
141
|
+
"import": "./dist/inventory/stock-get-availability.js"
|
|
142
|
+
},
|
|
143
|
+
"./inventory/stock-receive": {
|
|
144
|
+
"types": "./dist/inventory/stock-receive.d.ts",
|
|
145
|
+
"import": "./dist/inventory/stock-receive.js"
|
|
146
|
+
},
|
|
147
|
+
"./inventory/stock-issue": {
|
|
148
|
+
"types": "./dist/inventory/stock-issue.d.ts",
|
|
149
|
+
"import": "./dist/inventory/stock-issue.js"
|
|
150
|
+
},
|
|
151
|
+
"./inventory/stock-reserve": {
|
|
152
|
+
"types": "./dist/inventory/stock-reserve.d.ts",
|
|
153
|
+
"import": "./dist/inventory/stock-reserve.js"
|
|
154
|
+
},
|
|
155
|
+
"./inventory/stock-release": {
|
|
156
|
+
"types": "./dist/inventory/stock-release.d.ts",
|
|
157
|
+
"import": "./dist/inventory/stock-release.js"
|
|
158
|
+
},
|
|
159
|
+
"./inventory/stock-transfer": {
|
|
160
|
+
"types": "./dist/inventory/stock-transfer.d.ts",
|
|
161
|
+
"import": "./dist/inventory/stock-transfer.js"
|
|
162
|
+
},
|
|
163
|
+
"./inventory/stock-adjust": {
|
|
164
|
+
"types": "./dist/inventory/stock-adjust.d.ts",
|
|
165
|
+
"import": "./dist/inventory/stock-adjust.js"
|
|
134
166
|
}
|
|
135
167
|
},
|
|
136
168
|
"scripts": {
|
|
137
169
|
"build": "rm -rf dist && tsc -p tsconfig.json",
|
|
138
|
-
"check": "tsc -p tsconfig.json --noEmit"
|
|
170
|
+
"check": "tsc -p tsconfig.json --noEmit",
|
|
171
|
+
"test": "bun test"
|
|
139
172
|
},
|
|
140
173
|
"dependencies": {
|
|
141
174
|
"zod": "4.4.3"
|