@rytass/wms-module-graphql 0.8.0 → 0.10.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.
Files changed (47) hide show
  1. package/README.md +92 -2
  2. package/adapters/event-emitter.cjs.js +43 -0
  3. package/adapters/member-base.cjs.js +66 -0
  4. package/docs/api-reference.md +80 -1
  5. package/docs/events.md +23 -4
  6. package/docs/integration-guide.md +31 -17
  7. package/index.cjs.js +935 -1
  8. package/index.d.ts +3 -1
  9. package/index.js +2 -0
  10. package/lib/dto/index.d.ts +1 -0
  11. package/lib/dto/inventory-count-order.dto.d.ts +61 -0
  12. package/lib/dto/inventory-count-order.dto.js +197 -0
  13. package/lib/events/operation-result-map.d.ts +8 -0
  14. package/lib/graphql.module.d.ts +6 -2
  15. package/lib/graphql.module.js +18 -1
  16. package/lib/inputs/find-stock.args.d.ts +9 -0
  17. package/lib/inputs/find-stock.args.js +25 -0
  18. package/lib/inputs/inventory-count-order.args.d.ts +69 -0
  19. package/lib/inputs/inventory-count-order.args.js +257 -0
  20. package/lib/mutations/inventory-count-order.mutation.d.ts +19 -0
  21. package/lib/mutations/inventory-count-order.mutation.js +138 -0
  22. package/lib/mutations/loader.mutation.js +1 -0
  23. package/lib/mutations/material.mutation.js +1 -0
  24. package/lib/mutations/receive-inventory-order.mutation.js +1 -0
  25. package/lib/mutations/ship-inventory-order.mutation.js +1 -0
  26. package/lib/queries/inventory-count-order.query.d.ts +17 -0
  27. package/lib/queries/inventory-count-order.query.js +63 -0
  28. package/lib/queries/loader.query.js +1 -0
  29. package/lib/queries/material.query.js +1 -0
  30. package/lib/queries/recieve-inventory-order.query.js +1 -0
  31. package/lib/queries/ship-inventory-order.query.js +1 -0
  32. package/lib/queries/stock.query.js +1 -0
  33. package/lib/registry/index.d.ts +1 -0
  34. package/lib/registry/operation-registry.d.ts +59 -0
  35. package/lib/registry/operation-registry.js +136 -0
  36. package/lib/resolvers/aggregated-stock.resolver.js +1 -0
  37. package/lib/resolvers/change-log.resolver.js +1 -0
  38. package/lib/resolvers/inventory-count-order.resolver.d.ts +34 -0
  39. package/lib/resolvers/inventory-count-order.resolver.js +148 -0
  40. package/lib/resolvers/loader-type.resolver.js +1 -0
  41. package/lib/resolvers/loader.resolver.js +1 -0
  42. package/lib/resolvers/material.resolver.js +1 -0
  43. package/lib/resolvers/receive-inventory-order.resolver.js +1 -0
  44. package/lib/resolvers/ship-inventory-order.resolver.js +1 -0
  45. package/lib/resolvers/stock.resolver.js +1 -0
  46. package/lib/resolvers/transfer-order.resolver.js +1 -0
  47. package/package.json +12 -6
@@ -0,0 +1,257 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import { Field, ID, ArgsType, Float, InputType } from '@nestjs/graphql';
3
+ import { InventoryCountStatus } from '@rytass/wms-module-core';
4
+ import { PaginationArgs } from './pagination.args.js';
5
+
6
+ let FindInventoryCountOrderArgs = class FindInventoryCountOrderArgs extends PaginationArgs {
7
+ name;
8
+ statuses;
9
+ createdBy;
10
+ /** Inclusive lower bound on `countDate`, `YYYY-MM-DD`. */
11
+ countDateFrom;
12
+ /** Inclusive upper bound on `countDate`, `YYYY-MM-DD`. */
13
+ countDateTo;
14
+ /**
15
+ * Matches against the expanded scope, not the roots the user picked, so
16
+ * filtering by a shelf finds the count that covers its whole aisle.
17
+ */
18
+ locationIds;
19
+ };
20
+ __decorate([
21
+ Field(() => String, { nullable: true }),
22
+ __metadata("design:type", String)
23
+ ], FindInventoryCountOrderArgs.prototype, "name", void 0);
24
+ __decorate([
25
+ Field(() => [InventoryCountStatus], { nullable: true }),
26
+ __metadata("design:type", Array)
27
+ ], FindInventoryCountOrderArgs.prototype, "statuses", void 0);
28
+ __decorate([
29
+ Field(() => String, { nullable: true }),
30
+ __metadata("design:type", String)
31
+ ], FindInventoryCountOrderArgs.prototype, "createdBy", void 0);
32
+ __decorate([
33
+ Field(() => String, { nullable: true }),
34
+ __metadata("design:type", String)
35
+ ], FindInventoryCountOrderArgs.prototype, "countDateFrom", void 0);
36
+ __decorate([
37
+ Field(() => String, { nullable: true }),
38
+ __metadata("design:type", String)
39
+ ], FindInventoryCountOrderArgs.prototype, "countDateTo", void 0);
40
+ __decorate([
41
+ Field(() => [ID], { nullable: true }),
42
+ __metadata("design:type", Array)
43
+ ], FindInventoryCountOrderArgs.prototype, "locationIds", void 0);
44
+ FindInventoryCountOrderArgs = __decorate([
45
+ ArgsType()
46
+ ], FindInventoryCountOrderArgs);
47
+ let FindInventoryCountOrderItemArgs = class FindInventoryCountOrderItemArgs extends PaginationArgs {
48
+ id;
49
+ materialKey;
50
+ materialDescription;
51
+ batchKey;
52
+ locationKey;
53
+ loaderSerialId;
54
+ vendorId;
55
+ customerId;
56
+ saleId;
57
+ saleSerialId;
58
+ /** Only lines whose counted quantity differs from the books (顯示盤差項目). */
59
+ onlyVariance;
60
+ };
61
+ __decorate([
62
+ Field(() => ID),
63
+ __metadata("design:type", String)
64
+ ], FindInventoryCountOrderItemArgs.prototype, "id", void 0);
65
+ __decorate([
66
+ Field(() => String, { nullable: true }),
67
+ __metadata("design:type", String)
68
+ ], FindInventoryCountOrderItemArgs.prototype, "materialKey", void 0);
69
+ __decorate([
70
+ Field(() => String, { nullable: true }),
71
+ __metadata("design:type", String)
72
+ ], FindInventoryCountOrderItemArgs.prototype, "materialDescription", void 0);
73
+ __decorate([
74
+ Field(() => String, { nullable: true }),
75
+ __metadata("design:type", String)
76
+ ], FindInventoryCountOrderItemArgs.prototype, "batchKey", void 0);
77
+ __decorate([
78
+ Field(() => String, { nullable: true }),
79
+ __metadata("design:type", String)
80
+ ], FindInventoryCountOrderItemArgs.prototype, "locationKey", void 0);
81
+ __decorate([
82
+ Field(() => String, { nullable: true }),
83
+ __metadata("design:type", String)
84
+ ], FindInventoryCountOrderItemArgs.prototype, "loaderSerialId", void 0);
85
+ __decorate([
86
+ Field(() => String, { nullable: true }),
87
+ __metadata("design:type", String)
88
+ ], FindInventoryCountOrderItemArgs.prototype, "vendorId", void 0);
89
+ __decorate([
90
+ Field(() => String, { nullable: true }),
91
+ __metadata("design:type", String)
92
+ ], FindInventoryCountOrderItemArgs.prototype, "customerId", void 0);
93
+ __decorate([
94
+ Field(() => String, { nullable: true }),
95
+ __metadata("design:type", String)
96
+ ], FindInventoryCountOrderItemArgs.prototype, "saleId", void 0);
97
+ __decorate([
98
+ Field(() => String, { nullable: true }),
99
+ __metadata("design:type", String)
100
+ ], FindInventoryCountOrderItemArgs.prototype, "saleSerialId", void 0);
101
+ __decorate([
102
+ Field(() => Boolean, { nullable: true }),
103
+ __metadata("design:type", Boolean)
104
+ ], FindInventoryCountOrderItemArgs.prototype, "onlyVariance", void 0);
105
+ FindInventoryCountOrderItemArgs = __decorate([
106
+ ArgsType()
107
+ ], FindInventoryCountOrderItemArgs);
108
+ let CreateInventoryCountOrderArgs = class CreateInventoryCountOrderArgs {
109
+ name;
110
+ countDate;
111
+ /** Root locations; every descendant is pulled into scope automatically. */
112
+ locationIds;
113
+ };
114
+ __decorate([
115
+ Field(() => String),
116
+ __metadata("design:type", String)
117
+ ], CreateInventoryCountOrderArgs.prototype, "name", void 0);
118
+ __decorate([
119
+ Field(() => String),
120
+ __metadata("design:type", String)
121
+ ], CreateInventoryCountOrderArgs.prototype, "countDate", void 0);
122
+ __decorate([
123
+ Field(() => [ID]),
124
+ __metadata("design:type", Array)
125
+ ], CreateInventoryCountOrderArgs.prototype, "locationIds", void 0);
126
+ CreateInventoryCountOrderArgs = __decorate([
127
+ ArgsType()
128
+ ], CreateInventoryCountOrderArgs);
129
+ let UpdateInventoryCountOrderArgs = class UpdateInventoryCountOrderArgs {
130
+ id;
131
+ name;
132
+ countDate;
133
+ locationIds;
134
+ };
135
+ __decorate([
136
+ Field(() => ID),
137
+ __metadata("design:type", String)
138
+ ], UpdateInventoryCountOrderArgs.prototype, "id", void 0);
139
+ __decorate([
140
+ Field(() => String, { nullable: true }),
141
+ __metadata("design:type", String)
142
+ ], UpdateInventoryCountOrderArgs.prototype, "name", void 0);
143
+ __decorate([
144
+ Field(() => String, { nullable: true }),
145
+ __metadata("design:type", String)
146
+ ], UpdateInventoryCountOrderArgs.prototype, "countDate", void 0);
147
+ __decorate([
148
+ Field(() => [ID], { nullable: true }),
149
+ __metadata("design:type", Array)
150
+ ], UpdateInventoryCountOrderArgs.prototype, "locationIds", void 0);
151
+ UpdateInventoryCountOrderArgs = __decorate([
152
+ ArgsType()
153
+ ], UpdateInventoryCountOrderArgs);
154
+ let CountInventoryItemInput = class CountInventoryItemInput {
155
+ itemId;
156
+ /** `null` clears the entry, putting the line back to "not counted". */
157
+ countedQuantity;
158
+ unitId;
159
+ };
160
+ __decorate([
161
+ Field(() => ID),
162
+ __metadata("design:type", String)
163
+ ], CountInventoryItemInput.prototype, "itemId", void 0);
164
+ __decorate([
165
+ Field(() => Float, { nullable: true }),
166
+ __metadata("design:type", Object)
167
+ ], CountInventoryItemInput.prototype, "countedQuantity", void 0);
168
+ __decorate([
169
+ Field(() => ID, { nullable: true }),
170
+ __metadata("design:type", Object)
171
+ ], CountInventoryItemInput.prototype, "unitId", void 0);
172
+ CountInventoryItemInput = __decorate([
173
+ InputType()
174
+ ], CountInventoryItemInput);
175
+ let CountInventoryArgs = class CountInventoryArgs {
176
+ id;
177
+ items;
178
+ };
179
+ __decorate([
180
+ Field(() => ID),
181
+ __metadata("design:type", String)
182
+ ], CountInventoryArgs.prototype, "id", void 0);
183
+ __decorate([
184
+ Field(() => [CountInventoryItemInput]),
185
+ __metadata("design:type", Array)
186
+ ], CountInventoryArgs.prototype, "items", void 0);
187
+ CountInventoryArgs = __decorate([
188
+ ArgsType()
189
+ ], CountInventoryArgs);
190
+ let AddInventoryCountItemArgs = class AddInventoryCountItemArgs {
191
+ id;
192
+ materialId;
193
+ /** An existing batch key, or a new one — the batch is created on demand. */
194
+ batchKey;
195
+ locationId;
196
+ loaderId;
197
+ countedQuantity;
198
+ unitId;
199
+ };
200
+ __decorate([
201
+ Field(() => ID),
202
+ __metadata("design:type", String)
203
+ ], AddInventoryCountItemArgs.prototype, "id", void 0);
204
+ __decorate([
205
+ Field(() => ID),
206
+ __metadata("design:type", String)
207
+ ], AddInventoryCountItemArgs.prototype, "materialId", void 0);
208
+ __decorate([
209
+ Field(() => String),
210
+ __metadata("design:type", String)
211
+ ], AddInventoryCountItemArgs.prototype, "batchKey", void 0);
212
+ __decorate([
213
+ Field(() => ID),
214
+ __metadata("design:type", String)
215
+ ], AddInventoryCountItemArgs.prototype, "locationId", void 0);
216
+ __decorate([
217
+ Field(() => ID, { nullable: true }),
218
+ __metadata("design:type", Object)
219
+ ], AddInventoryCountItemArgs.prototype, "loaderId", void 0);
220
+ __decorate([
221
+ Field(() => Float),
222
+ __metadata("design:type", Number)
223
+ ], AddInventoryCountItemArgs.prototype, "countedQuantity", void 0);
224
+ __decorate([
225
+ Field(() => ID, { nullable: true }),
226
+ __metadata("design:type", Object)
227
+ ], AddInventoryCountItemArgs.prototype, "unitId", void 0);
228
+ AddInventoryCountItemArgs = __decorate([
229
+ ArgsType()
230
+ ], AddInventoryCountItemArgs);
231
+ let RemoveInventoryCountItemArgs = class RemoveInventoryCountItemArgs {
232
+ id;
233
+ itemId;
234
+ };
235
+ __decorate([
236
+ Field(() => ID),
237
+ __metadata("design:type", String)
238
+ ], RemoveInventoryCountItemArgs.prototype, "id", void 0);
239
+ __decorate([
240
+ Field(() => ID),
241
+ __metadata("design:type", String)
242
+ ], RemoveInventoryCountItemArgs.prototype, "itemId", void 0);
243
+ RemoveInventoryCountItemArgs = __decorate([
244
+ ArgsType()
245
+ ], RemoveInventoryCountItemArgs);
246
+ let InventoryCountOrderIdArgs = class InventoryCountOrderIdArgs {
247
+ id;
248
+ };
249
+ __decorate([
250
+ Field(() => ID),
251
+ __metadata("design:type", String)
252
+ ], InventoryCountOrderIdArgs.prototype, "id", void 0);
253
+ InventoryCountOrderIdArgs = __decorate([
254
+ ArgsType()
255
+ ], InventoryCountOrderIdArgs);
256
+
257
+ export { AddInventoryCountItemArgs, CountInventoryArgs, CountInventoryItemInput, CreateInventoryCountOrderArgs, FindInventoryCountOrderArgs, FindInventoryCountOrderItemArgs, InventoryCountOrderIdArgs, RemoveInventoryCountItemArgs, UpdateInventoryCountOrderArgs };
@@ -0,0 +1,19 @@
1
+ import { InventoryCountOrderService } from '@rytass/wms-module-core';
2
+ import { InventoryCountOrderDto, InventoryCountOrderItemDto } from '../dto/inventory-count-order.dto';
3
+ import { AddInventoryCountItemArgs, CountInventoryArgs, CreateInventoryCountOrderArgs, InventoryCountOrderIdArgs, RemoveInventoryCountItemArgs, UpdateInventoryCountOrderArgs } from '../inputs/inventory-count-order.args';
4
+ export declare class InventoryCountOrderMutation {
5
+ private readonly inventoryCountOrderService;
6
+ constructor(inventoryCountOrderService: InventoryCountOrderService);
7
+ createInventoryCountOrder(args: CreateInventoryCountOrderArgs): Promise<InventoryCountOrderDto>;
8
+ updateInventoryCountOrder({ id, ...input }: UpdateInventoryCountOrderArgs): Promise<InventoryCountOrderDto>;
9
+ startInventoryCount({ id }: InventoryCountOrderIdArgs): Promise<InventoryCountOrderDto>;
10
+ /** "暫存結果" — record what was counted without touching stock. */
11
+ countInventory({ id, items }: CountInventoryArgs): Promise<InventoryCountOrderDto>;
12
+ addInventoryCountItem({ id, ...input }: AddInventoryCountItemArgs): Promise<InventoryCountOrderItemDto>;
13
+ removeInventoryCountItem({ id, itemId }: RemoveInventoryCountItemArgs): Promise<InventoryCountOrderDto>;
14
+ /** "清空重填" — discard the counting, keep the lock and the status. */
15
+ resetInventoryCount({ id }: InventoryCountOrderIdArgs): Promise<InventoryCountOrderDto>;
16
+ cancelInventoryCount({ id }: InventoryCountOrderIdArgs): Promise<InventoryCountOrderDto>;
17
+ /** "執行盤差" — the only mutation here that changes stock. */
18
+ settleInventoryCount({ id }: InventoryCountOrderIdArgs): Promise<InventoryCountOrderDto>;
19
+ }
@@ -0,0 +1,138 @@
1
+ import { __decorate, __param, __metadata } from 'tslib';
2
+ import { Injectable } from '@nestjs/common';
3
+ import { Mutation, Args } from '@nestjs/graphql';
4
+ import { InventoryCountOrderService } from '@rytass/wms-module-core';
5
+ import { InventoryCountOrderDto, InventoryCountOrderItemDto } from '../dto/inventory-count-order.dto.js';
6
+ import { CreateInventoryCountOrderArgs, UpdateInventoryCountOrderArgs, InventoryCountOrderIdArgs, CountInventoryArgs, AddInventoryCountItemArgs, RemoveInventoryCountItemArgs } from '../inputs/inventory-count-order.args.js';
7
+ import '../auth/wms-auth.guard.js';
8
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
9
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
10
+ import '../events/wms-mutation.interceptor.js';
11
+
12
+ let InventoryCountOrderMutation = class InventoryCountOrderMutation {
13
+ inventoryCountOrderService;
14
+ constructor(inventoryCountOrderService) {
15
+ this.inventoryCountOrderService = inventoryCountOrderService;
16
+ }
17
+ async createInventoryCountOrder(args) {
18
+ return this.inventoryCountOrderService.create(args);
19
+ }
20
+ async updateInventoryCountOrder({ id, ...input }) {
21
+ return this.inventoryCountOrderService.update(id, input);
22
+ }
23
+ async startInventoryCount({ id }) {
24
+ return this.inventoryCountOrderService.start(id);
25
+ }
26
+ /** "暫存結果" — record what was counted without touching stock. */
27
+ async countInventory({ id, items }) {
28
+ return this.inventoryCountOrderService.count(id, items.map((item) => ({
29
+ itemId: item.itemId,
30
+ countedQuantity: item.countedQuantity ?? null,
31
+ unitId: item.unitId,
32
+ })));
33
+ }
34
+ async addInventoryCountItem({ id, ...input }) {
35
+ return this.inventoryCountOrderService.addItem(id, input);
36
+ }
37
+ async removeInventoryCountItem({ id, itemId }) {
38
+ return this.inventoryCountOrderService.removeItem(id, itemId);
39
+ }
40
+ /** "清空重填" — discard the counting, keep the lock and the status. */
41
+ async resetInventoryCount({ id }) {
42
+ return this.inventoryCountOrderService.reset(id);
43
+ }
44
+ async cancelInventoryCount({ id }) {
45
+ return this.inventoryCountOrderService.cancel(id);
46
+ }
47
+ /** "執行盤差" — the only mutation here that changes stock. */
48
+ async settleInventoryCount({ id }) {
49
+ return this.inventoryCountOrderService.settle(id);
50
+ }
51
+ };
52
+ __decorate([
53
+ Mutation(() => InventoryCountOrderDto),
54
+ WmsOperation({ resource: 'inventory-count-order', action: 'create' }),
55
+ WmsMutationEvent({ event: 'inventory-count-order.created' }),
56
+ __param(0, Args()),
57
+ __metadata("design:type", Function),
58
+ __metadata("design:paramtypes", [CreateInventoryCountOrderArgs]),
59
+ __metadata("design:returntype", Promise)
60
+ ], InventoryCountOrderMutation.prototype, "createInventoryCountOrder", null);
61
+ __decorate([
62
+ Mutation(() => InventoryCountOrderDto),
63
+ WmsOperation({ resource: 'inventory-count-order', action: 'update' }),
64
+ WmsMutationEvent({ event: 'inventory-count-order.updated' }),
65
+ __param(0, Args()),
66
+ __metadata("design:type", Function),
67
+ __metadata("design:paramtypes", [UpdateInventoryCountOrderArgs]),
68
+ __metadata("design:returntype", Promise)
69
+ ], InventoryCountOrderMutation.prototype, "updateInventoryCountOrder", null);
70
+ __decorate([
71
+ Mutation(() => InventoryCountOrderDto),
72
+ WmsOperation({ resource: 'inventory-count-order', action: 'start' }),
73
+ WmsMutationEvent({ event: 'inventory-count-order.started' }),
74
+ __param(0, Args()),
75
+ __metadata("design:type", Function),
76
+ __metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
77
+ __metadata("design:returntype", Promise)
78
+ ], InventoryCountOrderMutation.prototype, "startInventoryCount", null);
79
+ __decorate([
80
+ Mutation(() => InventoryCountOrderDto),
81
+ WmsOperation({ resource: 'inventory-count-order', action: 'count' }),
82
+ WmsMutationEvent({ event: 'inventory-count-order.counted' }),
83
+ __param(0, Args()),
84
+ __metadata("design:type", Function),
85
+ __metadata("design:paramtypes", [CountInventoryArgs]),
86
+ __metadata("design:returntype", Promise)
87
+ ], InventoryCountOrderMutation.prototype, "countInventory", null);
88
+ __decorate([
89
+ Mutation(() => InventoryCountOrderItemDto),
90
+ WmsOperation({ resource: 'inventory-count-order', action: 'add-item' }),
91
+ WmsMutationEvent({ event: 'inventory-count-order.updated' }),
92
+ __param(0, Args()),
93
+ __metadata("design:type", Function),
94
+ __metadata("design:paramtypes", [AddInventoryCountItemArgs]),
95
+ __metadata("design:returntype", Promise)
96
+ ], InventoryCountOrderMutation.prototype, "addInventoryCountItem", null);
97
+ __decorate([
98
+ Mutation(() => InventoryCountOrderDto),
99
+ WmsOperation({ resource: 'inventory-count-order', action: 'remove-item' }),
100
+ WmsMutationEvent({ event: 'inventory-count-order.updated' }),
101
+ __param(0, Args()),
102
+ __metadata("design:type", Function),
103
+ __metadata("design:paramtypes", [RemoveInventoryCountItemArgs]),
104
+ __metadata("design:returntype", Promise)
105
+ ], InventoryCountOrderMutation.prototype, "removeInventoryCountItem", null);
106
+ __decorate([
107
+ Mutation(() => InventoryCountOrderDto),
108
+ WmsOperation({ resource: 'inventory-count-order', action: 'reset' }),
109
+ WmsMutationEvent({ event: 'inventory-count-order.reset' }),
110
+ __param(0, Args()),
111
+ __metadata("design:type", Function),
112
+ __metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
113
+ __metadata("design:returntype", Promise)
114
+ ], InventoryCountOrderMutation.prototype, "resetInventoryCount", null);
115
+ __decorate([
116
+ Mutation(() => InventoryCountOrderDto),
117
+ WmsOperation({ resource: 'inventory-count-order', action: 'cancel' }),
118
+ WmsMutationEvent({ event: 'inventory-count-order.cancelled' }),
119
+ __param(0, Args()),
120
+ __metadata("design:type", Function),
121
+ __metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
122
+ __metadata("design:returntype", Promise)
123
+ ], InventoryCountOrderMutation.prototype, "cancelInventoryCount", null);
124
+ __decorate([
125
+ Mutation(() => InventoryCountOrderDto),
126
+ WmsOperation({ resource: 'inventory-count-order', action: 'settle' }),
127
+ WmsMutationEvent({ event: 'inventory-count-order.settled' }),
128
+ __param(0, Args()),
129
+ __metadata("design:type", Function),
130
+ __metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
131
+ __metadata("design:returntype", Promise)
132
+ ], InventoryCountOrderMutation.prototype, "settleInventoryCount", null);
133
+ InventoryCountOrderMutation = __decorate([
134
+ Injectable(),
135
+ __metadata("design:paramtypes", [InventoryCountOrderService])
136
+ ], InventoryCountOrderMutation);
137
+
138
+ export { InventoryCountOrderMutation };
@@ -25,6 +25,7 @@ import '../dto/scrape-order.dto.js';
25
25
  import '../dto/scrape-order-item.dto.js';
26
26
  import '../dto/quality-inspection-order.dto.js';
27
27
  import '../dto/quality-inspection-order-item.dto.js';
28
+ import '../dto/inventory-count-order.dto.js';
28
29
  import { Mutation, Args } from '@nestjs/graphql';
29
30
  import { CreateLoaderTypeArgs, UpdateLoaderTypeArgs } from '../inputs/create-loader-type.args.js';
30
31
  import { CreateLoaderArgs, CreateLoadersArgs, UpdateLoaderArgs } from '../inputs/create-loader.args.js';
@@ -25,6 +25,7 @@ import '../dto/scrape-order.dto.js';
25
25
  import '../dto/scrape-order-item.dto.js';
26
26
  import '../dto/quality-inspection-order.dto.js';
27
27
  import '../dto/quality-inspection-order-item.dto.js';
28
+ import '../dto/inventory-count-order.dto.js';
28
29
  import { CreateMaterialArgs, UpdateMaterialArgs } from '../inputs/create-material.args.js';
29
30
  import { MaterialService } from '@rytass/wms-module-core';
30
31
  import '../auth/wms-auth.guard.js';
@@ -26,6 +26,7 @@ import '../dto/scrape-order.dto.js';
26
26
  import '../dto/scrape-order-item.dto.js';
27
27
  import '../dto/quality-inspection-order.dto.js';
28
28
  import '../dto/quality-inspection-order-item.dto.js';
29
+ import '../dto/inventory-count-order.dto.js';
29
30
  import { CreateReceiveInventoryOrderArgs, UpdateReceiveInventoryOrderArgs } from '../inputs/create-receive-inventory-order.args.js';
30
31
  import { DataSource } from 'typeorm';
31
32
  import { ReceiveOrderArgs } from '../inputs/receive-order.args.js';
@@ -25,6 +25,7 @@ import '../dto/scrape-order.dto.js';
25
25
  import '../dto/scrape-order-item.dto.js';
26
26
  import '../dto/quality-inspection-order.dto.js';
27
27
  import '../dto/quality-inspection-order-item.dto.js';
28
+ import '../dto/inventory-count-order.dto.js';
28
29
  import { Mutation, Args } from '@nestjs/graphql';
29
30
  import { CreateShipInventoryOrderArgs, UpdateShipInventoryOrderArgs } from '../inputs/create-ship-inventory-order.args.js';
30
31
  import { ShipOrderArgs } from '../inputs/ship-order.args.js';
@@ -0,0 +1,17 @@
1
+ import { InventoryCountOrderService } from '@rytass/wms-module-core';
2
+ import { InventoryCountOrderDto, InventoryCountOrderItems, InventoryCountOrders } from '../dto/inventory-count-order.dto';
3
+ import { FindInventoryCountOrderArgs, FindInventoryCountOrderItemArgs, InventoryCountOrderIdArgs } from '../inputs/inventory-count-order.args';
4
+ export declare class InventoryCountOrderQuery {
5
+ private readonly inventoryCountOrderService;
6
+ constructor(inventoryCountOrderService: InventoryCountOrderService);
7
+ inventoryCountOrders(args: FindInventoryCountOrderArgs): Promise<InventoryCountOrders>;
8
+ /**
9
+ * The count sheet, filtered and paginated.
10
+ *
11
+ * Separate from `inventoryCountOrder.items` on purpose: the detail page needs
12
+ * to narrow thousands of lines down to the shelf in front of the operator, and
13
+ * a field resolver cannot take filters or a page.
14
+ */
15
+ inventoryCountOrderItems({ id, ...options }: FindInventoryCountOrderItemArgs): Promise<InventoryCountOrderItems>;
16
+ inventoryCountOrder({ id }: InventoryCountOrderIdArgs): Promise<InventoryCountOrderDto>;
17
+ }
@@ -0,0 +1,63 @@
1
+ import { __decorate, __param, __metadata } from 'tslib';
2
+ import { Injectable } from '@nestjs/common';
3
+ import { Query, Args } from '@nestjs/graphql';
4
+ import { InventoryCountOrderService } from '@rytass/wms-module-core';
5
+ import { InventoryCountOrders, InventoryCountOrderItems, InventoryCountOrderDto } from '../dto/inventory-count-order.dto.js';
6
+ import { FindInventoryCountOrderArgs, FindInventoryCountOrderItemArgs, InventoryCountOrderIdArgs } from '../inputs/inventory-count-order.args.js';
7
+ import '../auth/wms-auth.guard.js';
8
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
9
+
10
+ let InventoryCountOrderQuery = class InventoryCountOrderQuery {
11
+ inventoryCountOrderService;
12
+ constructor(inventoryCountOrderService) {
13
+ this.inventoryCountOrderService = inventoryCountOrderService;
14
+ }
15
+ async inventoryCountOrders(args) {
16
+ const [items, total] = await this.inventoryCountOrderService.findMany(args);
17
+ return { items, total };
18
+ }
19
+ /**
20
+ * The count sheet, filtered and paginated.
21
+ *
22
+ * Separate from `inventoryCountOrder.items` on purpose: the detail page needs
23
+ * to narrow thousands of lines down to the shelf in front of the operator, and
24
+ * a field resolver cannot take filters or a page.
25
+ */
26
+ async inventoryCountOrderItems({ id, ...options }) {
27
+ const [items, total] = await this.inventoryCountOrderService.findItems(id, options);
28
+ return { items, total };
29
+ }
30
+ async inventoryCountOrder({ id }) {
31
+ return this.inventoryCountOrderService.findOne(id);
32
+ }
33
+ };
34
+ __decorate([
35
+ Query(() => InventoryCountOrders),
36
+ WmsOperation({ resource: 'inventory-count-order', action: 'read' }),
37
+ __param(0, Args()),
38
+ __metadata("design:type", Function),
39
+ __metadata("design:paramtypes", [FindInventoryCountOrderArgs]),
40
+ __metadata("design:returntype", Promise)
41
+ ], InventoryCountOrderQuery.prototype, "inventoryCountOrders", null);
42
+ __decorate([
43
+ Query(() => InventoryCountOrderItems),
44
+ WmsOperation({ resource: 'inventory-count-order', action: 'read-items' }),
45
+ __param(0, Args()),
46
+ __metadata("design:type", Function),
47
+ __metadata("design:paramtypes", [FindInventoryCountOrderItemArgs]),
48
+ __metadata("design:returntype", Promise)
49
+ ], InventoryCountOrderQuery.prototype, "inventoryCountOrderItems", null);
50
+ __decorate([
51
+ Query(() => InventoryCountOrderDto),
52
+ WmsOperation({ resource: 'inventory-count-order', action: 'read' }),
53
+ __param(0, Args()),
54
+ __metadata("design:type", Function),
55
+ __metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
56
+ __metadata("design:returntype", Promise)
57
+ ], InventoryCountOrderQuery.prototype, "inventoryCountOrder", null);
58
+ InventoryCountOrderQuery = __decorate([
59
+ Injectable(),
60
+ __metadata("design:paramtypes", [InventoryCountOrderService])
61
+ ], InventoryCountOrderQuery);
62
+
63
+ export { InventoryCountOrderQuery };
@@ -26,6 +26,7 @@ import '../dto/scrape-order.dto.js';
26
26
  import '../dto/scrape-order-item.dto.js';
27
27
  import '../dto/quality-inspection-order.dto.js';
28
28
  import '../dto/quality-inspection-order-item.dto.js';
29
+ import '../dto/inventory-count-order.dto.js';
29
30
  import { FindLoaderArgs } from '../inputs/find-loader.args.js';
30
31
  import { FindLoaderTypeArgs } from '../inputs/find-loader-type.args.js';
31
32
  import { LoaderUnitDto, LoaderUnit } from '../dto/loader-unit.dto.js';
@@ -25,6 +25,7 @@ import '../dto/scrape-order.dto.js';
25
25
  import '../dto/scrape-order-item.dto.js';
26
26
  import '../dto/quality-inspection-order.dto.js';
27
27
  import '../dto/quality-inspection-order-item.dto.js';
28
+ import '../dto/inventory-count-order.dto.js';
28
29
  import { MaterialService } from '@rytass/wms-module-core';
29
30
  import { FindMaterialArgs } from '../inputs/find-material.args.js';
30
31
  import '../auth/wms-auth.guard.js';
@@ -26,6 +26,7 @@ import '../dto/scrape-order.dto.js';
26
26
  import '../dto/scrape-order-item.dto.js';
27
27
  import '../dto/quality-inspection-order.dto.js';
28
28
  import '../dto/quality-inspection-order-item.dto.js';
29
+ import '../dto/inventory-count-order.dto.js';
29
30
  import { FindReceiveInventoryOrderArgs } from '../inputs/find-receive-inventory-order.args.js';
30
31
  import '../auth/wms-auth.guard.js';
31
32
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
@@ -26,6 +26,7 @@ import '../dto/scrape-order.dto.js';
26
26
  import '../dto/scrape-order-item.dto.js';
27
27
  import '../dto/quality-inspection-order.dto.js';
28
28
  import '../dto/quality-inspection-order-item.dto.js';
29
+ import '../dto/inventory-count-order.dto.js';
29
30
  import { FindShipInventoryOrderArgs } from '../inputs/find-ship-inventory-order.args.js';
30
31
  import '../auth/wms-auth.guard.js';
31
32
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
@@ -26,6 +26,7 @@ import '../dto/scrape-order.dto.js';
26
26
  import '../dto/scrape-order-item.dto.js';
27
27
  import '../dto/quality-inspection-order.dto.js';
28
28
  import '../dto/quality-inspection-order-item.dto.js';
29
+ import '../dto/inventory-count-order.dto.js';
29
30
  import { FindStockArgs } from '../inputs/find-stock.args.js';
30
31
  import '../auth/wms-auth.guard.js';
31
32
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
@@ -0,0 +1 @@
1
+ export { pruneDisabledOperations, resolveDisabled, type PrunedOperations, type WmsOperationRegistrationOptions, } from './operation-registry';
@@ -0,0 +1,59 @@
1
+ import { Type } from '@nestjs/common';
2
+ import type { WmsOperationName } from '@rytass/wms-module-core';
3
+ /**
4
+ * Deployment-level switches deciding which root operations get registered.
5
+ *
6
+ * `authChecker` and `beforeHooks` can already *refuse* an operation, but the
7
+ * resolver stays in the compiled schema — so introspection, the consumer's
8
+ * frontend codegen and any security audit still see a mutation that is
9
+ * guaranteed to fail. These options remove it instead.
10
+ */
11
+ export interface WmsOperationRegistrationOptions {
12
+ /**
13
+ * Allow-list of `${resource}:${action}` names. Only these are registered.
14
+ * Mutually exclusive with {@link disabledOperations}.
15
+ */
16
+ readonly enabledOperations?: readonly WmsOperationName[];
17
+ /** Deny-list of `${resource}:${action}` names. */
18
+ readonly disabledOperations?: readonly WmsOperationName[];
19
+ /**
20
+ * Escape hatch by GraphQL field name, for when a requirement is too coarse.
21
+ * Several queries share one requirement — `loader:read` alone covers 6 fields
22
+ * — so disabling the name would take all of them. Name the field instead.
23
+ */
24
+ readonly disabledFields?: readonly string[];
25
+ }
26
+ /** What a pruning pass removed, keyed by root type. */
27
+ export interface PrunedOperations {
28
+ readonly queries: readonly string[];
29
+ readonly mutations: readonly string[];
30
+ }
31
+ export declare function resolveDisabled(options: WmsOperationRegistrationOptions): {
32
+ readonly hasSwitches: boolean;
33
+ readonly isOperationDisabled: (name: string) => boolean;
34
+ readonly disabledFields: ReadonlySet<string>;
35
+ };
36
+ /**
37
+ * Remove the switched-off root operations before the schema is built.
38
+ *
39
+ * Two edits are needed, at two different moments, and they must happen together:
40
+ *
41
+ * 1. **now** — `delete Resolver.prototype[method]`, because
42
+ * `ResolversExplorerService.explore()` walks the prototype with
43
+ * `MetadataScanner` and runs *before* the schema builder loads the lazy
44
+ * metadata. Leaving the method in place would put `Query.foo` in the resolver
45
+ * map with no matching field in the typeDefs, and `makeExecutableSchema`
46
+ * rejects the whole schema (`requireResolversToMatchSchema`).
47
+ * 2. **at load time** — drop the metadata entry ({@link installMetadataFilter}),
48
+ * or the SDL would still declare a field that resolves to `null`: present,
49
+ * but dead.
50
+ *
51
+ * Deleting the prototype method does not disturb step 2's type reflection:
52
+ * `design:returntype` is stored against the prototype and property key, not
53
+ * against the function object, so it survives the delete.
54
+ *
55
+ * This runs synchronously from `forRootAsync`, i.e. while `AppModule` is still
56
+ * being defined. Both the classes and the storage are process-global, so a
57
+ * process may register `WmsModuleGraphqlModule` only once.
58
+ */
59
+ export declare function pruneDisabledOperations(resolverClasses: readonly Type<unknown>[], options: WmsOperationRegistrationOptions): PrunedOperations;