@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.
- package/README.md +92 -2
- package/adapters/event-emitter.cjs.js +43 -0
- package/adapters/member-base.cjs.js +66 -0
- package/docs/api-reference.md +80 -1
- package/docs/events.md +23 -4
- package/docs/integration-guide.md +31 -17
- package/index.cjs.js +935 -1
- package/index.d.ts +3 -1
- package/index.js +2 -0
- package/lib/dto/index.d.ts +1 -0
- package/lib/dto/inventory-count-order.dto.d.ts +61 -0
- package/lib/dto/inventory-count-order.dto.js +197 -0
- package/lib/events/operation-result-map.d.ts +8 -0
- package/lib/graphql.module.d.ts +6 -2
- package/lib/graphql.module.js +18 -1
- package/lib/inputs/find-stock.args.d.ts +9 -0
- package/lib/inputs/find-stock.args.js +25 -0
- package/lib/inputs/inventory-count-order.args.d.ts +69 -0
- package/lib/inputs/inventory-count-order.args.js +257 -0
- package/lib/mutations/inventory-count-order.mutation.d.ts +19 -0
- package/lib/mutations/inventory-count-order.mutation.js +138 -0
- package/lib/mutations/loader.mutation.js +1 -0
- package/lib/mutations/material.mutation.js +1 -0
- package/lib/mutations/receive-inventory-order.mutation.js +1 -0
- package/lib/mutations/ship-inventory-order.mutation.js +1 -0
- package/lib/queries/inventory-count-order.query.d.ts +17 -0
- package/lib/queries/inventory-count-order.query.js +63 -0
- package/lib/queries/loader.query.js +1 -0
- package/lib/queries/material.query.js +1 -0
- package/lib/queries/recieve-inventory-order.query.js +1 -0
- package/lib/queries/ship-inventory-order.query.js +1 -0
- package/lib/queries/stock.query.js +1 -0
- package/lib/registry/index.d.ts +1 -0
- package/lib/registry/operation-registry.d.ts +59 -0
- package/lib/registry/operation-registry.js +136 -0
- package/lib/resolvers/aggregated-stock.resolver.js +1 -0
- package/lib/resolvers/change-log.resolver.js +1 -0
- package/lib/resolvers/inventory-count-order.resolver.d.ts +34 -0
- package/lib/resolvers/inventory-count-order.resolver.js +148 -0
- package/lib/resolvers/loader-type.resolver.js +1 -0
- package/lib/resolvers/loader.resolver.js +1 -0
- package/lib/resolvers/material.resolver.js +1 -0
- package/lib/resolvers/receive-inventory-order.resolver.js +1 -0
- package/lib/resolvers/ship-inventory-order.resolver.js +1 -0
- package/lib/resolvers/stock.resolver.js +1 -0
- package/lib/resolvers/transfer-order.resolver.js +1 -0
- package/package.json +12 -6
package/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export type { LoaderOptions, LoaderOptionsWithPagination, } from './lib/helpers/
|
|
|
4
4
|
export type { LoaderType } from './lib/helpers/dataloader.type';
|
|
5
5
|
export { createWmsLoaders, type WmsLoaders, } from './lib/helpers/create-wms-loaders';
|
|
6
6
|
export { HOST_SKIP_METADATA_KEY, WmsAuthGuard, WmsOperation, WMS_AUTH_OPTIONS, WMS_OPERATION_METADATA, type WmsAuthChecker, type WmsAuthModuleOptions, type WmsOperationRequirement, } from './lib/auth';
|
|
7
|
+
export { pruneDisabledOperations, type PrunedOperations, type WmsOperationRegistrationOptions, } from './lib/registry';
|
|
7
8
|
export type { WmsModuleGraphqlModuleAsyncOptions } from './lib/graphql.module';
|
|
8
9
|
export { WmsMutationEvent, WmsMutationInterceptor, WMS_MUTATION_EVENT_METADATA, type WmsMutationEventConfig, type WmsOperationResultMap, type WmsEventPayloadFor, type WmsTypedAfterEventContext, type WmsTypedAfterListenerMap, type WmsTypedBeforeHookContext, type WmsTypedBeforeHookMap, } from './lib/events';
|
|
9
|
-
export type { WmsActor, WmsActorExtractor, WmsAfterEventContext, WmsAfterListener, WmsAfterListenerMap, WmsBeforeHook, WmsBeforeHookContext, WmsBeforeHookMap, WmsDomainEvent, WmsEventModuleOptions, WmsEventName, WmsEventPayloadMap, WmsOperationEventName, WmsOperationEventPayload, WmsStockEventName, WmsStockEventPayload, } from '@rytass/wms-module-core';
|
|
10
|
+
export type { WmsActor, WmsActorExtractor, WmsAfterEventContext, WmsAfterListener, WmsAfterListenerMap, WmsBeforeHook, WmsBeforeHookContext, WmsBeforeHookMap, WmsDomainEvent, WmsEventModuleOptions, WmsEventName, WmsEventPayloadMap, WmsOperationEventName, WmsOperationEventPayload, WmsOperationName, WmsStockEventName, WmsStockEventPayload, } from '@rytass/wms-module-core';
|
|
11
|
+
export { WMS_OPERATION_NAMES } from '@rytass/wms-module-core';
|
package/index.js
CHANGED
|
@@ -5,6 +5,8 @@ export { HOST_SKIP_METADATA_KEY } from './lib/auth/host-skip.constant.js';
|
|
|
5
5
|
export { WmsAuthGuard } from './lib/auth/wms-auth.guard.js';
|
|
6
6
|
export { WmsOperation } from './lib/auth/wms-operation.decorator.js';
|
|
7
7
|
export { WMS_AUTH_OPTIONS, WMS_OPERATION_METADATA } from './lib/auth/wms-auth.types.js';
|
|
8
|
+
export { pruneDisabledOperations } from './lib/registry/operation-registry.js';
|
|
8
9
|
export { WmsMutationEvent } from './lib/events/wms-mutation-event.decorator.js';
|
|
9
10
|
export { WMS_MUTATION_EVENT_METADATA } from './lib/events/wms-mutation-event.constants.js';
|
|
10
11
|
export { WmsMutationInterceptor } from './lib/events/wms-mutation.interceptor.js';
|
|
12
|
+
export { WMS_OPERATION_NAMES } from '@rytass/wms-module-core';
|
package/lib/dto/index.d.ts
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { InventoryCountStatus } from '@rytass/wms-module-core';
|
|
2
|
+
/**
|
|
3
|
+
* A count-sheet line.
|
|
4
|
+
*
|
|
5
|
+
* `material` / `batch` / `location` / `loader` are deliberately absent from this
|
|
6
|
+
* class: they are added to the schema by `InventoryCountOrderItemResolver` as
|
|
7
|
+
* `@ResolveField`s so they load through DataLoaders, and declaring them here
|
|
8
|
+
* would make the class stop matching the entity the service returns.
|
|
9
|
+
*/
|
|
10
|
+
export declare class InventoryCountOrderItemDto {
|
|
11
|
+
id: string;
|
|
12
|
+
orderId: string;
|
|
13
|
+
materialId: string;
|
|
14
|
+
batchId: string;
|
|
15
|
+
locationId: string | null;
|
|
16
|
+
loaderId: string | null;
|
|
17
|
+
unitId: string | null;
|
|
18
|
+
/** Ledger quantity in base units, frozen when counting started. */
|
|
19
|
+
bookQuantity: number;
|
|
20
|
+
/** What was found, expressed in `unitId`. `null` until someone counts it. */
|
|
21
|
+
countedQuantity: number | null;
|
|
22
|
+
/** `true` for a line added during counting for stock the books never had. */
|
|
23
|
+
isAddition: boolean;
|
|
24
|
+
held: boolean | null;
|
|
25
|
+
inShipment: boolean | null;
|
|
26
|
+
/** `null` = awaiting inspection, `false` = failed, `true` = passed. */
|
|
27
|
+
inspectionResult: boolean | null;
|
|
28
|
+
transferId: string | null;
|
|
29
|
+
vendorId: string | null;
|
|
30
|
+
customerId: string | null;
|
|
31
|
+
saleId: string | null;
|
|
32
|
+
saleSerialId: string | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A count order. `items` and `locations` come from
|
|
36
|
+
* `InventoryCountOrderResolver`, for the same reason as above; `locations`
|
|
37
|
+
* exposes the roots the user picked, not the expanded subtree.
|
|
38
|
+
*/
|
|
39
|
+
export declare class InventoryCountOrderDto {
|
|
40
|
+
id: string;
|
|
41
|
+
key: string;
|
|
42
|
+
name: string;
|
|
43
|
+
/**
|
|
44
|
+
* The count's base date. Stock adjustments from settlement are reported under
|
|
45
|
+
* this date rather than the day settlement happened to run.
|
|
46
|
+
*/
|
|
47
|
+
countDate: string;
|
|
48
|
+
status: InventoryCountStatus;
|
|
49
|
+
createdBy: string | null;
|
|
50
|
+
startedAt: Date | null;
|
|
51
|
+
settledAt: Date | null;
|
|
52
|
+
cancelledAt: Date | null;
|
|
53
|
+
createdAt: Date;
|
|
54
|
+
}
|
|
55
|
+
declare const InventoryCountOrderItems_base: new () => import("./pagination.dto").PaginatedType<InventoryCountOrderItemDto>;
|
|
56
|
+
export declare class InventoryCountOrderItems extends InventoryCountOrderItems_base {
|
|
57
|
+
}
|
|
58
|
+
declare const InventoryCountOrders_base: new () => import("./pagination.dto").PaginatedType<InventoryCountOrderDto>;
|
|
59
|
+
export declare class InventoryCountOrders extends InventoryCountOrders_base {
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { __decorate, __metadata } from 'tslib';
|
|
2
|
+
import { registerEnumType, Field, ID, Float, ObjectType } from '@nestjs/graphql';
|
|
3
|
+
import { InventoryCountStatus } from '@rytass/wms-module-core';
|
|
4
|
+
import { PaginatedResponse } from './pagination.dto.js';
|
|
5
|
+
|
|
6
|
+
registerEnumType(InventoryCountStatus, {
|
|
7
|
+
name: 'InventoryCountStatus',
|
|
8
|
+
description: 'Lifecycle of an inventory count: PENDING (尚未執行) → COUNTING (盤點中) → COMPLETED (已完成), or CANCELLED (已取消).',
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* A count-sheet line.
|
|
12
|
+
*
|
|
13
|
+
* `material` / `batch` / `location` / `loader` are deliberately absent from this
|
|
14
|
+
* class: they are added to the schema by `InventoryCountOrderItemResolver` as
|
|
15
|
+
* `@ResolveField`s so they load through DataLoaders, and declaring them here
|
|
16
|
+
* would make the class stop matching the entity the service returns.
|
|
17
|
+
*/
|
|
18
|
+
let InventoryCountOrderItemDto = class InventoryCountOrderItemDto {
|
|
19
|
+
id;
|
|
20
|
+
orderId;
|
|
21
|
+
materialId;
|
|
22
|
+
batchId;
|
|
23
|
+
locationId;
|
|
24
|
+
loaderId;
|
|
25
|
+
unitId;
|
|
26
|
+
/** Ledger quantity in base units, frozen when counting started. */
|
|
27
|
+
bookQuantity;
|
|
28
|
+
/** What was found, expressed in `unitId`. `null` until someone counts it. */
|
|
29
|
+
countedQuantity;
|
|
30
|
+
/** `true` for a line added during counting for stock the books never had. */
|
|
31
|
+
isAddition;
|
|
32
|
+
// ── Batch attributes as they were when counting started ────────────────── //
|
|
33
|
+
//
|
|
34
|
+
// Snapshotted rather than resolved live: the batch keeps moving after a count
|
|
35
|
+
// settles, and a sheet that silently rewrites itself months later stops being
|
|
36
|
+
// a record of what was found. `null` before counting has started.
|
|
37
|
+
held;
|
|
38
|
+
inShipment;
|
|
39
|
+
/** `null` = awaiting inspection, `false` = failed, `true` = passed. */
|
|
40
|
+
inspectionResult;
|
|
41
|
+
transferId;
|
|
42
|
+
vendorId;
|
|
43
|
+
customerId;
|
|
44
|
+
saleId;
|
|
45
|
+
saleSerialId;
|
|
46
|
+
};
|
|
47
|
+
__decorate([
|
|
48
|
+
Field(() => ID),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], InventoryCountOrderItemDto.prototype, "id", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
Field(() => ID),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], InventoryCountOrderItemDto.prototype, "orderId", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
Field(() => ID),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], InventoryCountOrderItemDto.prototype, "materialId", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
Field(() => ID),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], InventoryCountOrderItemDto.prototype, "batchId", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
Field(() => ID, { nullable: true }),
|
|
65
|
+
__metadata("design:type", Object)
|
|
66
|
+
], InventoryCountOrderItemDto.prototype, "locationId", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
Field(() => ID, { nullable: true }),
|
|
69
|
+
__metadata("design:type", Object)
|
|
70
|
+
], InventoryCountOrderItemDto.prototype, "loaderId", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
Field(() => ID, { nullable: true }),
|
|
73
|
+
__metadata("design:type", Object)
|
|
74
|
+
], InventoryCountOrderItemDto.prototype, "unitId", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
Field(() => Float),
|
|
77
|
+
__metadata("design:type", Number)
|
|
78
|
+
], InventoryCountOrderItemDto.prototype, "bookQuantity", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
Field(() => Float, { nullable: true }),
|
|
81
|
+
__metadata("design:type", Object)
|
|
82
|
+
], InventoryCountOrderItemDto.prototype, "countedQuantity", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
Field(() => Boolean),
|
|
85
|
+
__metadata("design:type", Boolean)
|
|
86
|
+
], InventoryCountOrderItemDto.prototype, "isAddition", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
Field(() => Boolean, { nullable: true }),
|
|
89
|
+
__metadata("design:type", Object)
|
|
90
|
+
], InventoryCountOrderItemDto.prototype, "held", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
Field(() => Boolean, { nullable: true }),
|
|
93
|
+
__metadata("design:type", Object)
|
|
94
|
+
], InventoryCountOrderItemDto.prototype, "inShipment", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
Field(() => Boolean, { nullable: true }),
|
|
97
|
+
__metadata("design:type", Object)
|
|
98
|
+
], InventoryCountOrderItemDto.prototype, "inspectionResult", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
Field(() => ID, { nullable: true }),
|
|
101
|
+
__metadata("design:type", Object)
|
|
102
|
+
], InventoryCountOrderItemDto.prototype, "transferId", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
Field(() => String, { nullable: true }),
|
|
105
|
+
__metadata("design:type", Object)
|
|
106
|
+
], InventoryCountOrderItemDto.prototype, "vendorId", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
Field(() => String, { nullable: true }),
|
|
109
|
+
__metadata("design:type", Object)
|
|
110
|
+
], InventoryCountOrderItemDto.prototype, "customerId", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
Field(() => String, { nullable: true }),
|
|
113
|
+
__metadata("design:type", Object)
|
|
114
|
+
], InventoryCountOrderItemDto.prototype, "saleId", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
Field(() => String, { nullable: true }),
|
|
117
|
+
__metadata("design:type", Object)
|
|
118
|
+
], InventoryCountOrderItemDto.prototype, "saleSerialId", void 0);
|
|
119
|
+
InventoryCountOrderItemDto = __decorate([
|
|
120
|
+
ObjectType()
|
|
121
|
+
], InventoryCountOrderItemDto);
|
|
122
|
+
/**
|
|
123
|
+
* A count order. `items` and `locations` come from
|
|
124
|
+
* `InventoryCountOrderResolver`, for the same reason as above; `locations`
|
|
125
|
+
* exposes the roots the user picked, not the expanded subtree.
|
|
126
|
+
*/
|
|
127
|
+
let InventoryCountOrderDto = class InventoryCountOrderDto {
|
|
128
|
+
id;
|
|
129
|
+
key;
|
|
130
|
+
name;
|
|
131
|
+
/**
|
|
132
|
+
* The count's base date. Stock adjustments from settlement are reported under
|
|
133
|
+
* this date rather than the day settlement happened to run.
|
|
134
|
+
*/
|
|
135
|
+
countDate;
|
|
136
|
+
status;
|
|
137
|
+
createdBy;
|
|
138
|
+
startedAt;
|
|
139
|
+
settledAt;
|
|
140
|
+
cancelledAt;
|
|
141
|
+
createdAt;
|
|
142
|
+
};
|
|
143
|
+
__decorate([
|
|
144
|
+
Field(() => ID),
|
|
145
|
+
__metadata("design:type", String)
|
|
146
|
+
], InventoryCountOrderDto.prototype, "id", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
Field(() => String),
|
|
149
|
+
__metadata("design:type", String)
|
|
150
|
+
], InventoryCountOrderDto.prototype, "key", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
Field(() => String),
|
|
153
|
+
__metadata("design:type", String)
|
|
154
|
+
], InventoryCountOrderDto.prototype, "name", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
Field(() => String),
|
|
157
|
+
__metadata("design:type", String)
|
|
158
|
+
], InventoryCountOrderDto.prototype, "countDate", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
Field(() => InventoryCountStatus),
|
|
161
|
+
__metadata("design:type", String)
|
|
162
|
+
], InventoryCountOrderDto.prototype, "status", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
Field(() => String, { nullable: true }),
|
|
165
|
+
__metadata("design:type", Object)
|
|
166
|
+
], InventoryCountOrderDto.prototype, "createdBy", void 0);
|
|
167
|
+
__decorate([
|
|
168
|
+
Field(() => Date, { nullable: true }),
|
|
169
|
+
__metadata("design:type", Object)
|
|
170
|
+
], InventoryCountOrderDto.prototype, "startedAt", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
Field(() => Date, { nullable: true }),
|
|
173
|
+
__metadata("design:type", Object)
|
|
174
|
+
], InventoryCountOrderDto.prototype, "settledAt", void 0);
|
|
175
|
+
__decorate([
|
|
176
|
+
Field(() => Date, { nullable: true }),
|
|
177
|
+
__metadata("design:type", Object)
|
|
178
|
+
], InventoryCountOrderDto.prototype, "cancelledAt", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
Field(() => Date),
|
|
181
|
+
__metadata("design:type", Date)
|
|
182
|
+
], InventoryCountOrderDto.prototype, "createdAt", void 0);
|
|
183
|
+
InventoryCountOrderDto = __decorate([
|
|
184
|
+
ObjectType()
|
|
185
|
+
], InventoryCountOrderDto);
|
|
186
|
+
let InventoryCountOrderItems = class InventoryCountOrderItems extends PaginatedResponse(InventoryCountOrderItemDto) {
|
|
187
|
+
};
|
|
188
|
+
InventoryCountOrderItems = __decorate([
|
|
189
|
+
ObjectType()
|
|
190
|
+
], InventoryCountOrderItems);
|
|
191
|
+
let InventoryCountOrders = class InventoryCountOrders extends PaginatedResponse(InventoryCountOrderDto) {
|
|
192
|
+
};
|
|
193
|
+
InventoryCountOrders = __decorate([
|
|
194
|
+
ObjectType()
|
|
195
|
+
], InventoryCountOrders);
|
|
196
|
+
|
|
197
|
+
export { InventoryCountOrderDto, InventoryCountOrderItemDto, InventoryCountOrderItems, InventoryCountOrders };
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import type { WmsOperationEventName } from '@rytass/wms-module-core';
|
|
13
13
|
import type { AllocateInventoryOrderDto, HoldInventoryOrderDto, LoaderDto, LoaderTypeDto, MaterialDto, QualityInspectionOrderDto, ReceiveInventoryOrderDto, ScrapeOrderDto, ShipInventoryOrderDto, TransferCustomerOrderDto, TransferOrderDto, TransferVendorOrderDto } from '../dto';
|
|
14
14
|
import type { LocationDto } from '../dto/location.dto';
|
|
15
|
+
import type { InventoryCountOrderDto, InventoryCountOrderItemDto } from '../dto/inventory-count-order.dto';
|
|
15
16
|
import type { MapDataDto } from '../dto/warehouse-map.dto';
|
|
16
17
|
import type { MergeBatchOrderDto } from '../dto/merge-batch-order.dto';
|
|
17
18
|
import type { ReclassifyInventoryOrderDto } from '../dto/reclassify-inventory-order.dto';
|
|
@@ -27,6 +28,13 @@ import type { SplitBatchOrderDto } from '../dto/split-batch-order.dto';
|
|
|
27
28
|
* Maintenance: for every new `@Mutation`, add the matching entry here.
|
|
28
29
|
*/
|
|
29
30
|
export interface WmsOperationResultMap extends Record<WmsOperationEventName, unknown> {
|
|
31
|
+
'inventory-count-order.created': InventoryCountOrderDto;
|
|
32
|
+
'inventory-count-order.updated': InventoryCountOrderDto | InventoryCountOrderItemDto;
|
|
33
|
+
'inventory-count-order.started': InventoryCountOrderDto;
|
|
34
|
+
'inventory-count-order.counted': InventoryCountOrderDto;
|
|
35
|
+
'inventory-count-order.reset': InventoryCountOrderDto;
|
|
36
|
+
'inventory-count-order.cancelled': InventoryCountOrderDto;
|
|
37
|
+
'inventory-count-order.settled': InventoryCountOrderDto;
|
|
30
38
|
'material.created': MaterialDto;
|
|
31
39
|
'material.updated': MaterialDto;
|
|
32
40
|
'location.created': LocationDto;
|
package/lib/graphql.module.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { DynamicModule, type Provider } from '@nestjs/common';
|
|
|
2
2
|
import { type WmsActorExtractor, type WmsModuleCoreModuleAsyncOptions } from '@rytass/wms-module-core';
|
|
3
3
|
import { type WmsAuthModuleOptions } from './auth';
|
|
4
4
|
import { type WmsTypedAfterListenerMap, type WmsTypedBeforeHookMap } from './events';
|
|
5
|
+
import { type WmsOperationRegistrationOptions } from './registry';
|
|
5
6
|
/**
|
|
6
7
|
* Options for `WmsModuleGraphqlModule.forRootAsync`. Extends the core module
|
|
7
8
|
* options with:
|
|
@@ -16,11 +17,14 @@ import { type WmsTypedAfterListenerMap, type WmsTypedBeforeHookMap } from './eve
|
|
|
16
17
|
* - `eventEmitterBridge` — pass `wmsEventEmitterBridgeProvider` from
|
|
17
18
|
* `@rytass/wms-module-graphql/adapters/event-emitter` to also fan events out
|
|
18
19
|
* to `@nestjs/event-emitter` (`@OnEvent('wms.<event>')`).
|
|
20
|
+
* - `enabledOperations` / `disabledOperations` / `disabledFields` — deployment
|
|
21
|
+
* switches that keep an operation **out of the schema entirely** rather than
|
|
22
|
+
* merely refusing it (see {@link WmsOperationRegistrationOptions}).
|
|
19
23
|
*
|
|
20
24
|
* Everything is optional; with nothing configured the module behaves exactly as
|
|
21
|
-
* before (no events emitted, fully permissive).
|
|
25
|
+
* before (no events emitted, fully permissive, every operation registered).
|
|
22
26
|
*/
|
|
23
|
-
export type WmsModuleGraphqlModuleAsyncOptions = WmsModuleCoreModuleAsyncOptions & WmsAuthModuleOptions & {
|
|
27
|
+
export type WmsModuleGraphqlModuleAsyncOptions = WmsModuleCoreModuleAsyncOptions & WmsAuthModuleOptions & WmsOperationRegistrationOptions & {
|
|
24
28
|
readonly beforeHooks?: WmsTypedBeforeHookMap;
|
|
25
29
|
readonly afterListeners?: WmsTypedAfterListenerMap;
|
|
26
30
|
readonly actorExtractor?: WmsActorExtractor;
|
package/lib/graphql.module.js
CHANGED
|
@@ -7,6 +7,7 @@ import './helpers/query-path.js';
|
|
|
7
7
|
import { WmsAuthGuard } from './auth/wms-auth.guard.js';
|
|
8
8
|
import { WMS_AUTH_OPTIONS } from './auth/wms-auth.types.js';
|
|
9
9
|
import { WmsMutationInterceptor } from './events/wms-mutation.interceptor.js';
|
|
10
|
+
import { pruneDisabledOperations } from './registry/operation-registry.js';
|
|
10
11
|
import { LoaderMutation } from './mutations/loader.mutation.js';
|
|
11
12
|
import { LoaderQuery } from './queries/loader.query.js';
|
|
12
13
|
import { MaterialMutation } from './mutations/material.mutation.js';
|
|
@@ -53,6 +54,9 @@ import { ScrapeMutation } from './mutations/scrape-order.mutation.js';
|
|
|
53
54
|
import { QualityInspectionOrderMutation } from './mutations/quality-inspection-order.mutation.js';
|
|
54
55
|
import { WarehouseMapDataQuery } from './queries/warehouse-map.query.js';
|
|
55
56
|
import { MapRangeUnionResolver } from './resolvers/warehouse-map.resolver.js';
|
|
57
|
+
import { InventoryCountOrderQuery } from './queries/inventory-count-order.query.js';
|
|
58
|
+
import { InventoryCountOrderMutation } from './mutations/inventory-count-order.mutation.js';
|
|
59
|
+
import { InventoryCountOrderResolver, InventoryCountOrderItemResolver } from './resolvers/inventory-count-order.resolver.js';
|
|
56
60
|
|
|
57
61
|
var WmsModuleGraphqlModule_1;
|
|
58
62
|
const exportDependencies = [
|
|
@@ -108,10 +112,23 @@ const exportDependencies = [
|
|
|
108
112
|
QualityInspectionOrderMutation,
|
|
109
113
|
WarehouseMapDataQuery,
|
|
110
114
|
MapRangeUnionResolver,
|
|
115
|
+
InventoryCountOrderQuery,
|
|
116
|
+
InventoryCountOrderMutation,
|
|
117
|
+
InventoryCountOrderResolver,
|
|
118
|
+
InventoryCountOrderItemResolver,
|
|
111
119
|
];
|
|
112
120
|
let WmsModuleGraphqlModule = WmsModuleGraphqlModule_1 = class WmsModuleGraphqlModule {
|
|
113
121
|
static forRootAsync(options) {
|
|
114
|
-
const { authChecker, beforeHooks, afterListeners, actorExtractor, eventEmitterBridge, ...coreOptions } = options;
|
|
122
|
+
const { authChecker, beforeHooks, afterListeners, actorExtractor, eventEmitterBridge, enabledOperations, disabledOperations, disabledFields, ...coreOptions } = options;
|
|
123
|
+
// Must run before `GraphQLModule` builds the schema. `forRootAsync` is
|
|
124
|
+
// called while `AppModule` is still being defined, so this is the earliest
|
|
125
|
+
// point at which the deployment's switches are known — and it is early
|
|
126
|
+
// enough: the schema is not built until the app bootstraps.
|
|
127
|
+
pruneDisabledOperations(exportDependencies, {
|
|
128
|
+
enabledOperations,
|
|
129
|
+
disabledOperations,
|
|
130
|
+
disabledFields,
|
|
131
|
+
});
|
|
115
132
|
// coreOptions still carries `enrichStockEvents`, forwarded to the core module.
|
|
116
133
|
const coreModule = WmsModuleCoreModule.forRootAsync(coreOptions);
|
|
117
134
|
const authOptions = { authChecker };
|
|
@@ -12,4 +12,13 @@ export declare class FindStockArgs extends PaginationArgs {
|
|
|
12
12
|
batchKey?: string;
|
|
13
13
|
locationKey?: string;
|
|
14
14
|
loaderKey?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Commercial attributes carried by the stock's batch. Matched exactly — they
|
|
17
|
+
* are identifiers from the host system, and a partial match on 「SO-1」 would
|
|
18
|
+
* quietly sweep in 「SO-10」.
|
|
19
|
+
*/
|
|
20
|
+
vendorId?: string;
|
|
21
|
+
customerId?: string;
|
|
22
|
+
saleId?: string;
|
|
23
|
+
saleSerialId?: string;
|
|
15
24
|
}
|
|
@@ -15,6 +15,15 @@ let FindStockArgs = class FindStockArgs extends PaginationArgs {
|
|
|
15
15
|
batchKey;
|
|
16
16
|
locationKey;
|
|
17
17
|
loaderKey;
|
|
18
|
+
/**
|
|
19
|
+
* Commercial attributes carried by the stock's batch. Matched exactly — they
|
|
20
|
+
* are identifiers from the host system, and a partial match on 「SO-1」 would
|
|
21
|
+
* quietly sweep in 「SO-10」.
|
|
22
|
+
*/
|
|
23
|
+
vendorId;
|
|
24
|
+
customerId;
|
|
25
|
+
saleId;
|
|
26
|
+
saleSerialId;
|
|
18
27
|
};
|
|
19
28
|
__decorate([
|
|
20
29
|
Field(() => ID, { nullable: true }),
|
|
@@ -60,6 +69,22 @@ __decorate([
|
|
|
60
69
|
Field(() => String, { nullable: true }),
|
|
61
70
|
__metadata("design:type", String)
|
|
62
71
|
], FindStockArgs.prototype, "loaderKey", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
Field(() => String, { nullable: true }),
|
|
74
|
+
__metadata("design:type", String)
|
|
75
|
+
], FindStockArgs.prototype, "vendorId", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
Field(() => String, { nullable: true }),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], FindStockArgs.prototype, "customerId", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
Field(() => String, { nullable: true }),
|
|
82
|
+
__metadata("design:type", String)
|
|
83
|
+
], FindStockArgs.prototype, "saleId", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
Field(() => String, { nullable: true }),
|
|
86
|
+
__metadata("design:type", String)
|
|
87
|
+
], FindStockArgs.prototype, "saleSerialId", void 0);
|
|
63
88
|
FindStockArgs = __decorate([
|
|
64
89
|
ArgsType()
|
|
65
90
|
], FindStockArgs);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { InventoryCountStatus } from '@rytass/wms-module-core';
|
|
2
|
+
import { PaginationArgs } from './pagination.args';
|
|
3
|
+
export declare class FindInventoryCountOrderArgs extends PaginationArgs {
|
|
4
|
+
name?: string;
|
|
5
|
+
statuses?: InventoryCountStatus[];
|
|
6
|
+
createdBy?: string;
|
|
7
|
+
/** Inclusive lower bound on `countDate`, `YYYY-MM-DD`. */
|
|
8
|
+
countDateFrom?: string;
|
|
9
|
+
/** Inclusive upper bound on `countDate`, `YYYY-MM-DD`. */
|
|
10
|
+
countDateTo?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Matches against the expanded scope, not the roots the user picked, so
|
|
13
|
+
* filtering by a shelf finds the count that covers its whole aisle.
|
|
14
|
+
*/
|
|
15
|
+
locationIds?: string[];
|
|
16
|
+
}
|
|
17
|
+
export declare class FindInventoryCountOrderItemArgs extends PaginationArgs {
|
|
18
|
+
id: string;
|
|
19
|
+
materialKey?: string;
|
|
20
|
+
materialDescription?: string;
|
|
21
|
+
batchKey?: string;
|
|
22
|
+
locationKey?: string;
|
|
23
|
+
loaderSerialId?: string;
|
|
24
|
+
vendorId?: string;
|
|
25
|
+
customerId?: string;
|
|
26
|
+
saleId?: string;
|
|
27
|
+
saleSerialId?: string;
|
|
28
|
+
/** Only lines whose counted quantity differs from the books (顯示盤差項目). */
|
|
29
|
+
onlyVariance?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare class CreateInventoryCountOrderArgs {
|
|
32
|
+
name: string;
|
|
33
|
+
countDate: string;
|
|
34
|
+
/** Root locations; every descendant is pulled into scope automatically. */
|
|
35
|
+
locationIds: string[];
|
|
36
|
+
}
|
|
37
|
+
export declare class UpdateInventoryCountOrderArgs {
|
|
38
|
+
id: string;
|
|
39
|
+
name?: string;
|
|
40
|
+
countDate?: string;
|
|
41
|
+
locationIds?: string[];
|
|
42
|
+
}
|
|
43
|
+
export declare class CountInventoryItemInput {
|
|
44
|
+
itemId: string;
|
|
45
|
+
/** `null` clears the entry, putting the line back to "not counted". */
|
|
46
|
+
countedQuantity?: number | null;
|
|
47
|
+
unitId?: string | null;
|
|
48
|
+
}
|
|
49
|
+
export declare class CountInventoryArgs {
|
|
50
|
+
id: string;
|
|
51
|
+
items: CountInventoryItemInput[];
|
|
52
|
+
}
|
|
53
|
+
export declare class AddInventoryCountItemArgs {
|
|
54
|
+
id: string;
|
|
55
|
+
materialId: string;
|
|
56
|
+
/** An existing batch key, or a new one — the batch is created on demand. */
|
|
57
|
+
batchKey: string;
|
|
58
|
+
locationId: string;
|
|
59
|
+
loaderId?: string | null;
|
|
60
|
+
countedQuantity: number;
|
|
61
|
+
unitId?: string | null;
|
|
62
|
+
}
|
|
63
|
+
export declare class RemoveInventoryCountItemArgs {
|
|
64
|
+
id: string;
|
|
65
|
+
itemId: string;
|
|
66
|
+
}
|
|
67
|
+
export declare class InventoryCountOrderIdArgs {
|
|
68
|
+
id: string;
|
|
69
|
+
}
|