@rytass/wms-module-graphql 0.11.0 → 0.12.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 +19 -0
- package/docs/README.md +5 -2
- package/docs/api-reference.md +10 -8
- package/docs/integration-guide.md +34 -17
- package/docs/inventory-count.md +372 -0
- package/index.cjs.js +10 -0
- package/lib/inputs/inventory-count-order.args.d.ts +6 -0
- package/package.json +12 -11
- package/adapters/event-emitter.js +0 -41
- package/adapters/member-base.js +0 -63
- package/index.js +0 -12
- package/lib/auth/host-skip.constant.js +0 -29
- package/lib/auth/wms-auth.guard.js +0 -41
- package/lib/auth/wms-auth.types.js +0 -6
- package/lib/auth/wms-operation.decorator.js +0 -29
- package/lib/dto/allocate-inventory-order-item.dto.js +0 -36
- package/lib/dto/allocate-inventory-order.dto.js +0 -31
- package/lib/dto/batch.dto.js +0 -26
- package/lib/dto/consumption-order-item.dto.js +0 -43
- package/lib/dto/consumption-order.dto.js +0 -52
- package/lib/dto/hold-inventory-order-item.dto.js +0 -37
- package/lib/dto/hold-inventory-order.dto.js +0 -47
- package/lib/dto/inventory-count-order.dto.js +0 -207
- package/lib/dto/loader-type.dto.js +0 -46
- package/lib/dto/loader-unit.dto.js +0 -21
- package/lib/dto/loader.dto.js +0 -71
- package/lib/dto/location.dto.js +0 -36
- package/lib/dto/material-unit.dto.js +0 -46
- package/lib/dto/material.dto.js +0 -36
- package/lib/dto/merge-batch-order.dto.js +0 -50
- package/lib/dto/order-reference.dto.js +0 -73
- package/lib/dto/pagination.dto.js +0 -51
- package/lib/dto/quality-inspection-order-item.dto.js +0 -50
- package/lib/dto/quality-inspection-order.dto.js +0 -42
- package/lib/dto/receive-inventory-order-item.dto.js +0 -60
- package/lib/dto/receive-inventory-order.dto.js +0 -58
- package/lib/dto/reclassify-inventory-order.dto.js +0 -55
- package/lib/dto/sale-order.dto.js +0 -20
- package/lib/dto/scrape-order-item.dto.js +0 -56
- package/lib/dto/scrape-order.dto.js +0 -37
- package/lib/dto/ship-inventory-order-item.dto.js +0 -56
- package/lib/dto/ship-inventory-order-reference.dto.js +0 -48
- package/lib/dto/ship-inventory-order.dto.js +0 -58
- package/lib/dto/split-batch-order.dto.js +0 -50
- package/lib/dto/stock.dto.js +0 -166
- package/lib/dto/transfer-customer-order-item.dto.js +0 -61
- package/lib/dto/transfer-customer-order.dto.js +0 -37
- package/lib/dto/transfer-order-item.dto.js +0 -41
- package/lib/dto/transfer-order.dto.js +0 -57
- package/lib/dto/transfer-vendor-order-item.dto.js +0 -61
- package/lib/dto/transfer-vendor-order.dto.js +0 -37
- package/lib/dto/unit.dto.js +0 -20
- package/lib/dto/warehouse-map.dto.js +0 -165
- package/lib/events/wms-mutation-event.constants.js +0 -4
- package/lib/events/wms-mutation-event.decorator.js +0 -20
- package/lib/events/wms-mutation.interceptor.js +0 -64
- package/lib/graphql.module.js +0 -183
- package/lib/helpers/create-wms-loaders.js +0 -11
- package/lib/helpers/helper.module.js +0 -15
- package/lib/helpers/loader.service.js +0 -230
- package/lib/helpers/query-path.js +0 -19
- package/lib/inputs/cancel-ship-order.args.js +0 -20
- package/lib/inputs/cancel-transfer-order.args.js +0 -23
- package/lib/inputs/consumption-order.args.js +0 -182
- package/lib/inputs/create-allocate-inventory-order-item.args.js +0 -50
- package/lib/inputs/create-allocate-inventory-order.args.js +0 -36
- package/lib/inputs/create-hold-inventory-order-item.args.js +0 -40
- package/lib/inputs/create-hold-inventory-order.args.js +0 -41
- package/lib/inputs/create-loader-type.args.js +0 -35
- package/lib/inputs/create-loader.args.js +0 -130
- package/lib/inputs/create-location.args.js +0 -50
- package/lib/inputs/create-material-unit.args.js +0 -25
- package/lib/inputs/create-material.args.js +0 -51
- package/lib/inputs/create-quality-inspection-order.args.js +0 -50
- package/lib/inputs/create-receive-inventory-order-item.args.js +0 -70
- package/lib/inputs/create-receive-inventory-order.args.js +0 -51
- package/lib/inputs/create-ship-inventory-order-item.args.js +0 -45
- package/lib/inputs/create-ship-inventory-order-reference.args.js +0 -65
- package/lib/inputs/create-ship-inventory-order.args.js +0 -57
- package/lib/inputs/create-transfer-customer-order-item.args.js +0 -40
- package/lib/inputs/create-transfer-customer-order.args.js +0 -51
- package/lib/inputs/create-transfer-order-item.args.js +0 -40
- package/lib/inputs/create-transfer-order.args.js +0 -61
- package/lib/inputs/create-transfer-vendor-order-item.args.js +0 -40
- package/lib/inputs/create-transfer-vendor-order.args.js +0 -51
- package/lib/inputs/date-range.args.js +0 -20
- package/lib/inputs/deallocate-order.args.js +0 -25
- package/lib/inputs/find-allocate-inventory-order.args.js +0 -42
- package/lib/inputs/find-batch.args.js +0 -21
- package/lib/inputs/find-hold-inventory-order.args.js +0 -42
- package/lib/inputs/find-loader-type.args.js +0 -32
- package/lib/inputs/find-loader.args.js +0 -72
- package/lib/inputs/find-location.args.js +0 -26
- package/lib/inputs/find-material.args.js +0 -21
- package/lib/inputs/find-receive-inventory-order.args.js +0 -71
- package/lib/inputs/find-sale-order.args.js +0 -16
- package/lib/inputs/find-ship-inventory-order.args.js +0 -71
- package/lib/inputs/find-stock.args.js +0 -102
- package/lib/inputs/find-transfer-order.args.js +0 -82
- package/lib/inputs/inventory-count-order.args.js +0 -257
- package/lib/inputs/merge-batch.args.js +0 -40
- package/lib/inputs/order-reference.args.js +0 -103
- package/lib/inputs/pagination.args.js +0 -20
- package/lib/inputs/receive-order.args.js +0 -40
- package/lib/inputs/reclassify-inventory-order.args.js +0 -40
- package/lib/inputs/release-order.args.js +0 -25
- package/lib/inputs/return-transfer-customer-order.args.js +0 -35
- package/lib/inputs/return-transfer-vendor-order.args.js +0 -35
- package/lib/inputs/scrape-order.args.js +0 -35
- package/lib/inputs/ship-order.args.js +0 -20
- package/lib/inputs/split-batch.args.js +0 -51
- package/lib/inputs/transfer-order.args.js +0 -20
- package/lib/inputs/update-warehouse-map.args.js +0 -121
- package/lib/mutations/allocate-inventory-order.mutation.js +0 -91
- package/lib/mutations/consumption-order.mutation.js +0 -90
- package/lib/mutations/hold-inventory-order.mutation.js +0 -91
- package/lib/mutations/inventory-count-order.mutation.js +0 -138
- package/lib/mutations/loader.mutation.js +0 -123
- package/lib/mutations/location.mutation.js +0 -47
- package/lib/mutations/material.mutation.js +0 -74
- package/lib/mutations/merge-batch.mutation.js +0 -50
- package/lib/mutations/order-reference.mutation.js +0 -57
- package/lib/mutations/quality-inspection-order.mutation.js +0 -50
- package/lib/mutations/receive-inventory-order.mutation.js +0 -106
- package/lib/mutations/reclassify-inventory-order.mutation.js +0 -51
- package/lib/mutations/scrape-order.mutation.js +0 -44
- package/lib/mutations/ship-inventory-order.mutation.js +0 -123
- package/lib/mutations/split-batch.mutation.js +0 -44
- package/lib/mutations/transfer-customer-order.mutation.js +0 -91
- package/lib/mutations/transfer-order.mutation.js +0 -96
- package/lib/mutations/transfer-vendor-order.mutation.js +0 -91
- package/lib/mutations/warehouse-map.mutation.js +0 -60
- package/lib/queries/allocate-inventory-order.query.js +0 -33
- package/lib/queries/batch.query.js +0 -36
- package/lib/queries/consumption-order.query.js +0 -45
- package/lib/queries/hold-inventory-order.query.js +0 -33
- package/lib/queries/inventory-count-order.query.js +0 -63
- package/lib/queries/loader.query.js +0 -167
- package/lib/queries/location.query.js +0 -51
- package/lib/queries/material.query.js +0 -79
- package/lib/queries/order-reference.query.js +0 -34
- package/lib/queries/recieve-inventory-order.query.js +0 -77
- package/lib/queries/sale-order.query.js +0 -57
- package/lib/queries/ship-inventory-order.query.js +0 -77
- package/lib/queries/stock.query.js +0 -116
- package/lib/queries/transfer-order.query.js +0 -46
- package/lib/queries/unit.query.js +0 -30
- package/lib/queries/warehouse-map.query.js +0 -32
- package/lib/registry/operation-registry.js +0 -136
- package/lib/resolvers/aggregated-stock.resolver.js +0 -119
- package/lib/resolvers/allocate-inventory-order.resolver.js +0 -27
- package/lib/resolvers/change-log.resolver.js +0 -99
- package/lib/resolvers/consumption-order.resolver.js +0 -238
- package/lib/resolvers/hold-inventory-order.resolver.js +0 -27
- package/lib/resolvers/inventory-count-order.resolver.js +0 -148
- package/lib/resolvers/loader-type.resolver.js +0 -54
- package/lib/resolvers/loader.resolver.js +0 -99
- package/lib/resolvers/location.resolver.js +0 -80
- package/lib/resolvers/material.resolver.js +0 -87
- package/lib/resolvers/merge-batch.resolver.js +0 -26
- package/lib/resolvers/receive-inventory-order.resolver.js +0 -156
- package/lib/resolvers/ship-inventory-order.resolver.js +0 -301
- package/lib/resolvers/split-batch.resolver.js +0 -26
- package/lib/resolvers/stock.resolver.js +0 -99
- package/lib/resolvers/transfer-customer-order.resolver.js +0 -27
- package/lib/resolvers/transfer-order.resolver.js +0 -246
- package/lib/resolvers/transfer-vendor-order.resolver.js +0 -27
- package/lib/resolvers/warehouse-map.resolver.js +0 -41
- package/lib/scalars/json-object.scalar.js +0 -62
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { Injectable } from '@nestjs/common';
|
|
3
|
-
import { Query, Args, ID } from '@nestjs/graphql';
|
|
4
|
-
import { StockService } from '@rytass/wms-module-core';
|
|
5
|
-
import '../dto/loader-type.dto.js';
|
|
6
|
-
import '../dto/loader.dto.js';
|
|
7
|
-
import { Materials } from '../dto/material.dto.js';
|
|
8
|
-
import '../dto/material-unit.dto.js';
|
|
9
|
-
import { StockDto, Stocks, AggregatedStocks, ChangeLogs } from '../dto/stock.dto.js';
|
|
10
|
-
import '../dto/sale-order.dto.js';
|
|
11
|
-
import '../dto/receive-inventory-order.dto.js';
|
|
12
|
-
import '../dto/receive-inventory-order-item.dto.js';
|
|
13
|
-
import '../dto/ship-inventory-order.dto.js';
|
|
14
|
-
import '../dto/ship-inventory-order-item.dto.js';
|
|
15
|
-
import '../dto/hold-inventory-order.dto.js';
|
|
16
|
-
import '../dto/hold-inventory-order-item.dto.js';
|
|
17
|
-
import '../dto/allocate-inventory-order.dto.js';
|
|
18
|
-
import '../dto/allocate-inventory-order-item.dto.js';
|
|
19
|
-
import '../dto/transfer-order.dto.js';
|
|
20
|
-
import '../dto/transfer-order-item.dto.js';
|
|
21
|
-
import '../dto/transfer-customer-order.dto.js';
|
|
22
|
-
import '../dto/transfer-customer-order-item.dto.js';
|
|
23
|
-
import '../dto/transfer-vendor-order.dto.js';
|
|
24
|
-
import '../dto/transfer-vendor-order-item.dto.js';
|
|
25
|
-
import '../dto/scrape-order.dto.js';
|
|
26
|
-
import '../dto/scrape-order-item.dto.js';
|
|
27
|
-
import '../dto/quality-inspection-order.dto.js';
|
|
28
|
-
import '../dto/quality-inspection-order-item.dto.js';
|
|
29
|
-
import '../dto/inventory-count-order.dto.js';
|
|
30
|
-
import '../dto/consumption-order.dto.js';
|
|
31
|
-
import '../dto/consumption-order-item.dto.js';
|
|
32
|
-
import '../dto/order-reference.dto.js';
|
|
33
|
-
import { FindStockArgs } from '../inputs/find-stock.args.js';
|
|
34
|
-
import '../auth/wms-auth.guard.js';
|
|
35
|
-
import { WmsOperation } from '../auth/wms-operation.decorator.js';
|
|
36
|
-
|
|
37
|
-
let StockQuery = class StockQuery {
|
|
38
|
-
stockService;
|
|
39
|
-
constructor(stockService) {
|
|
40
|
-
this.stockService = stockService;
|
|
41
|
-
}
|
|
42
|
-
stock(id) {
|
|
43
|
-
return this.stockService.stockRepository.findOneByOrFail({ id });
|
|
44
|
-
}
|
|
45
|
-
async stocks(args) {
|
|
46
|
-
const [items, total] = await this.stockService.findMany(args);
|
|
47
|
-
return { items, total };
|
|
48
|
-
}
|
|
49
|
-
async stocksGroupedByMaterial(args) {
|
|
50
|
-
const [items, total] = await this.stockService.findManyGroupedByMaterialId(args);
|
|
51
|
-
return { items, total };
|
|
52
|
-
}
|
|
53
|
-
async aggregatedStocks(args) {
|
|
54
|
-
const [items, total] = await this.stockService.findAggregatedStocks({
|
|
55
|
-
...args,
|
|
56
|
-
aggregatedKeys: args.ids?.length ? args.ids : [],
|
|
57
|
-
});
|
|
58
|
-
return { items, total };
|
|
59
|
-
}
|
|
60
|
-
async changeLogs(args) {
|
|
61
|
-
const [items, total] = await this.stockService.findChangeLogs(args);
|
|
62
|
-
return {
|
|
63
|
-
items: items.map((item) => ({
|
|
64
|
-
...item,
|
|
65
|
-
quantity: Math.abs(item.quantity),
|
|
66
|
-
})),
|
|
67
|
-
total,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
__decorate([
|
|
72
|
-
Query(() => StockDto),
|
|
73
|
-
WmsOperation({ resource: 'stock', action: 'read' }),
|
|
74
|
-
__param(0, Args('id', { type: () => ID })),
|
|
75
|
-
__metadata("design:type", Function),
|
|
76
|
-
__metadata("design:paramtypes", [String]),
|
|
77
|
-
__metadata("design:returntype", Promise)
|
|
78
|
-
], StockQuery.prototype, "stock", null);
|
|
79
|
-
__decorate([
|
|
80
|
-
Query(() => Stocks),
|
|
81
|
-
WmsOperation({ resource: 'stock', action: 'read' }),
|
|
82
|
-
__param(0, Args()),
|
|
83
|
-
__metadata("design:type", Function),
|
|
84
|
-
__metadata("design:paramtypes", [FindStockArgs]),
|
|
85
|
-
__metadata("design:returntype", Promise)
|
|
86
|
-
], StockQuery.prototype, "stocks", null);
|
|
87
|
-
__decorate([
|
|
88
|
-
Query(() => Materials),
|
|
89
|
-
WmsOperation({ resource: 'stock', action: 'read' }),
|
|
90
|
-
__param(0, Args()),
|
|
91
|
-
__metadata("design:type", Function),
|
|
92
|
-
__metadata("design:paramtypes", [FindStockArgs]),
|
|
93
|
-
__metadata("design:returntype", Promise)
|
|
94
|
-
], StockQuery.prototype, "stocksGroupedByMaterial", null);
|
|
95
|
-
__decorate([
|
|
96
|
-
Query(() => AggregatedStocks),
|
|
97
|
-
WmsOperation({ resource: 'stock', action: 'read' }),
|
|
98
|
-
__param(0, Args()),
|
|
99
|
-
__metadata("design:type", Function),
|
|
100
|
-
__metadata("design:paramtypes", [FindStockArgs]),
|
|
101
|
-
__metadata("design:returntype", Promise)
|
|
102
|
-
], StockQuery.prototype, "aggregatedStocks", null);
|
|
103
|
-
__decorate([
|
|
104
|
-
Query(() => ChangeLogs),
|
|
105
|
-
WmsOperation({ resource: 'stock', action: 'read' }),
|
|
106
|
-
__param(0, Args()),
|
|
107
|
-
__metadata("design:type", Function),
|
|
108
|
-
__metadata("design:paramtypes", [FindStockArgs]),
|
|
109
|
-
__metadata("design:returntype", Promise)
|
|
110
|
-
], StockQuery.prototype, "changeLogs", null);
|
|
111
|
-
StockQuery = __decorate([
|
|
112
|
-
Injectable(),
|
|
113
|
-
__metadata("design:paramtypes", [StockService])
|
|
114
|
-
], StockQuery);
|
|
115
|
-
|
|
116
|
-
export { StockQuery };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { Injectable } from '@nestjs/common';
|
|
3
|
-
import { Query, Args, ID } from '@nestjs/graphql';
|
|
4
|
-
import { TransferOrderService } from '@rytass/wms-module-core';
|
|
5
|
-
import { TransferOrders, TransferOrderDto } from '../dto/transfer-order.dto.js';
|
|
6
|
-
import { FindTransferOrderArgs } from '../inputs/find-transfer-order.args.js';
|
|
7
|
-
import '../auth/wms-auth.guard.js';
|
|
8
|
-
import { WmsOperation } from '../auth/wms-operation.decorator.js';
|
|
9
|
-
|
|
10
|
-
let TransferOrderQuery = class TransferOrderQuery {
|
|
11
|
-
transferOrderService;
|
|
12
|
-
constructor(transferOrderService) {
|
|
13
|
-
this.transferOrderService = transferOrderService;
|
|
14
|
-
}
|
|
15
|
-
async transferOrders(args) {
|
|
16
|
-
const [items, total] = await this.transferOrderService.findMany(args);
|
|
17
|
-
return { items, total };
|
|
18
|
-
}
|
|
19
|
-
async transferOrder(id) {
|
|
20
|
-
return this.transferOrderService.transferOrderRepository.findOneByOrFail({
|
|
21
|
-
id,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
__decorate([
|
|
26
|
-
Query(() => TransferOrders),
|
|
27
|
-
WmsOperation({ resource: 'transfer-order', action: 'read' }),
|
|
28
|
-
__param(0, Args()),
|
|
29
|
-
__metadata("design:type", Function),
|
|
30
|
-
__metadata("design:paramtypes", [FindTransferOrderArgs]),
|
|
31
|
-
__metadata("design:returntype", Promise)
|
|
32
|
-
], TransferOrderQuery.prototype, "transferOrders", null);
|
|
33
|
-
__decorate([
|
|
34
|
-
Query(() => TransferOrderDto),
|
|
35
|
-
WmsOperation({ resource: 'transfer-order', action: 'read' }),
|
|
36
|
-
__param(0, Args('id', { type: () => ID })),
|
|
37
|
-
__metadata("design:type", Function),
|
|
38
|
-
__metadata("design:paramtypes", [String]),
|
|
39
|
-
__metadata("design:returntype", Promise)
|
|
40
|
-
], TransferOrderQuery.prototype, "transferOrder", null);
|
|
41
|
-
TransferOrderQuery = __decorate([
|
|
42
|
-
Injectable(),
|
|
43
|
-
__metadata("design:paramtypes", [TransferOrderService])
|
|
44
|
-
], TransferOrderQuery);
|
|
45
|
-
|
|
46
|
-
export { TransferOrderQuery };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from 'tslib';
|
|
2
|
-
import { Injectable } from '@nestjs/common';
|
|
3
|
-
import { UnitDto } from '../dto/unit.dto.js';
|
|
4
|
-
import { Query } from '@nestjs/graphql';
|
|
5
|
-
import { UnitService } from '@rytass/wms-module-core';
|
|
6
|
-
import '../auth/wms-auth.guard.js';
|
|
7
|
-
import { WmsOperation } from '../auth/wms-operation.decorator.js';
|
|
8
|
-
|
|
9
|
-
let UnitQuery = class UnitQuery {
|
|
10
|
-
unitService;
|
|
11
|
-
constructor(unitService) {
|
|
12
|
-
this.unitService = unitService;
|
|
13
|
-
}
|
|
14
|
-
units() {
|
|
15
|
-
return this.unitService.unitRepository.findBy({});
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
__decorate([
|
|
19
|
-
Query(() => [UnitDto]),
|
|
20
|
-
WmsOperation({ resource: 'unit', action: 'read' }),
|
|
21
|
-
__metadata("design:type", Function),
|
|
22
|
-
__metadata("design:paramtypes", []),
|
|
23
|
-
__metadata("design:returntype", Promise)
|
|
24
|
-
], UnitQuery.prototype, "units", null);
|
|
25
|
-
UnitQuery = __decorate([
|
|
26
|
-
Injectable(),
|
|
27
|
-
__metadata("design:paramtypes", [UnitService])
|
|
28
|
-
], UnitQuery);
|
|
29
|
-
|
|
30
|
-
export { UnitQuery };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { Injectable } from '@nestjs/common';
|
|
3
|
-
import { Query, Args } from '@nestjs/graphql';
|
|
4
|
-
import { MapDataDto } from '../dto/warehouse-map.dto.js';
|
|
5
|
-
import { WarehouseMapDataService } from '@rytass/wms-module-core';
|
|
6
|
-
import '../auth/wms-auth.guard.js';
|
|
7
|
-
import { WmsOperation } from '../auth/wms-operation.decorator.js';
|
|
8
|
-
|
|
9
|
-
let WarehouseMapDataQuery = class WarehouseMapDataQuery {
|
|
10
|
-
warehouseMapDataService;
|
|
11
|
-
constructor(warehouseMapDataService) {
|
|
12
|
-
this.warehouseMapDataService = warehouseMapDataService;
|
|
13
|
-
}
|
|
14
|
-
async mapData(key) {
|
|
15
|
-
const { mapData } = await this.warehouseMapDataService.warehouseMapDataRepository.findOneByOrFail({ id: key });
|
|
16
|
-
return mapData;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
__decorate([
|
|
20
|
-
Query(() => MapDataDto),
|
|
21
|
-
WmsOperation({ resource: 'warehouse-map', action: 'read' }),
|
|
22
|
-
__param(0, Args('key')),
|
|
23
|
-
__metadata("design:type", Function),
|
|
24
|
-
__metadata("design:paramtypes", [String]),
|
|
25
|
-
__metadata("design:returntype", Promise)
|
|
26
|
-
], WarehouseMapDataQuery.prototype, "mapData", null);
|
|
27
|
-
WarehouseMapDataQuery = __decorate([
|
|
28
|
-
Injectable(),
|
|
29
|
-
__metadata("design:paramtypes", [WarehouseMapDataService])
|
|
30
|
-
], WarehouseMapDataQuery);
|
|
31
|
-
|
|
32
|
-
export { WarehouseMapDataQuery };
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { RESOLVER_TYPE_METADATA, TypeMetadataStorage, RESOLVER_NAME_METADATA } from '@nestjs/graphql';
|
|
2
|
-
import { WMS_OPERATION_METADATA } from '../auth/wms-auth.types.js';
|
|
3
|
-
|
|
4
|
-
function resolveDisabled(options) {
|
|
5
|
-
const { enabledOperations, disabledOperations, disabledFields } = options;
|
|
6
|
-
if (enabledOperations && disabledOperations) {
|
|
7
|
-
throw new Error('[wms-module-graphql] `enabledOperations` and `disabledOperations` are mutually exclusive — pass one or the other, not both.');
|
|
8
|
-
}
|
|
9
|
-
const enabled = enabledOperations ? new Set(enabledOperations) : null;
|
|
10
|
-
const disabled = disabledOperations
|
|
11
|
-
? new Set(disabledOperations)
|
|
12
|
-
: null;
|
|
13
|
-
const fields = new Set(disabledFields ?? []);
|
|
14
|
-
return {
|
|
15
|
-
hasSwitches: enabled !== null || disabled !== null || fields.size > 0,
|
|
16
|
-
isOperationDisabled: (name) => {
|
|
17
|
-
if (enabled) {
|
|
18
|
-
return !enabled.has(name);
|
|
19
|
-
}
|
|
20
|
-
if (disabled) {
|
|
21
|
-
return disabled.has(name);
|
|
22
|
-
}
|
|
23
|
-
return false;
|
|
24
|
-
},
|
|
25
|
-
disabledFields: fields,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/** Methods already pruned, so the metadata filter can drop their entries. */
|
|
29
|
-
const prunedMethods = new WeakMap();
|
|
30
|
-
let metadataFilterInstalled = false;
|
|
31
|
-
/**
|
|
32
|
-
* Stop the pruned operations from ever entering `TypeMetadataStorage`.
|
|
33
|
-
*
|
|
34
|
-
* The resolver metadata is **lazy**: `@Query()` / `@Mutation()` only register a
|
|
35
|
-
* thunk with `LazyMetadataStorage`, and the thunk calls `add*Metadata` when
|
|
36
|
-
* `GraphQLSchemaBuilder.build()` loads it. At `forRootAsync` time the storage
|
|
37
|
-
* arrays are therefore still empty, and filtering them then would remove
|
|
38
|
-
* nothing — so the filter has to sit on the writes instead.
|
|
39
|
-
*/
|
|
40
|
-
function installMetadataFilter() {
|
|
41
|
-
if (metadataFilterInstalled) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const storage = TypeMetadataStorage;
|
|
45
|
-
const addQuery = storage.addQueryMetadata.bind(storage);
|
|
46
|
-
const addMutation = storage.addMutationMetadata.bind(storage);
|
|
47
|
-
const isPruned = (metadata) => prunedMethods.get(metadata.target)?.has(metadata.methodName) === true;
|
|
48
|
-
storage.addQueryMetadata = (metadata) => {
|
|
49
|
-
if (isPruned(metadata)) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
addQuery(metadata);
|
|
53
|
-
};
|
|
54
|
-
storage.addMutationMetadata = (metadata) => {
|
|
55
|
-
if (isPruned(metadata)) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
addMutation(metadata);
|
|
59
|
-
};
|
|
60
|
-
metadataFilterInstalled = true;
|
|
61
|
-
}
|
|
62
|
-
/** The GraphQL field name a root handler ends up under. */
|
|
63
|
-
function schemaNameOf(handler, methodName) {
|
|
64
|
-
const explicit = Reflect.getMetadata(RESOLVER_NAME_METADATA, handler);
|
|
65
|
-
return explicit || methodName;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Remove the switched-off root operations before the schema is built.
|
|
69
|
-
*
|
|
70
|
-
* Two edits are needed, at two different moments, and they must happen together:
|
|
71
|
-
*
|
|
72
|
-
* 1. **now** — `delete Resolver.prototype[method]`, because
|
|
73
|
-
* `ResolversExplorerService.explore()` walks the prototype with
|
|
74
|
-
* `MetadataScanner` and runs *before* the schema builder loads the lazy
|
|
75
|
-
* metadata. Leaving the method in place would put `Query.foo` in the resolver
|
|
76
|
-
* map with no matching field in the typeDefs, and `makeExecutableSchema`
|
|
77
|
-
* rejects the whole schema (`requireResolversToMatchSchema`).
|
|
78
|
-
* 2. **at load time** — drop the metadata entry ({@link installMetadataFilter}),
|
|
79
|
-
* or the SDL would still declare a field that resolves to `null`: present,
|
|
80
|
-
* but dead.
|
|
81
|
-
*
|
|
82
|
-
* Deleting the prototype method does not disturb step 2's type reflection:
|
|
83
|
-
* `design:returntype` is stored against the prototype and property key, not
|
|
84
|
-
* against the function object, so it survives the delete.
|
|
85
|
-
*
|
|
86
|
-
* This runs synchronously from `forRootAsync`, i.e. while `AppModule` is still
|
|
87
|
-
* being defined. Both the classes and the storage are process-global, so a
|
|
88
|
-
* process may register `WmsModuleGraphqlModule` only once.
|
|
89
|
-
*/
|
|
90
|
-
function pruneDisabledOperations(resolverClasses, options) {
|
|
91
|
-
const { hasSwitches, isOperationDisabled, disabledFields } = resolveDisabled(options);
|
|
92
|
-
if (!hasSwitches) {
|
|
93
|
-
return { queries: [], mutations: [] };
|
|
94
|
-
}
|
|
95
|
-
installMetadataFilter();
|
|
96
|
-
const queries = [];
|
|
97
|
-
const mutations = [];
|
|
98
|
-
for (const resolverClass of resolverClasses) {
|
|
99
|
-
const prototype = resolverClass.prototype;
|
|
100
|
-
if (!prototype) {
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
for (const methodName of Object.getOwnPropertyNames(prototype)) {
|
|
104
|
-
if (methodName === 'constructor') {
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
const handler = prototype[methodName];
|
|
108
|
-
if (typeof handler !== 'function') {
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
const resolverType = Reflect.getMetadata(RESOLVER_TYPE_METADATA, handler);
|
|
112
|
-
// Only root operations are switchable. `@ResolveField` handlers are
|
|
113
|
-
// reached exclusively through an already-registered root field, so
|
|
114
|
-
// removing one would break the type rather than the deployment surface.
|
|
115
|
-
if (resolverType !== 'Query' && resolverType !== 'Mutation') {
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
const schemaName = schemaNameOf(handler, methodName);
|
|
119
|
-
const requirement = Reflect.getMetadata(WMS_OPERATION_METADATA, handler);
|
|
120
|
-
const disabled = disabledFields.has(schemaName) ||
|
|
121
|
-
(requirement !== undefined &&
|
|
122
|
-
isOperationDisabled(`${requirement.resource}:${requirement.action}`));
|
|
123
|
-
if (!disabled) {
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
const alreadyPruned = prunedMethods.get(resolverClass) ?? new Set();
|
|
127
|
-
alreadyPruned.add(methodName);
|
|
128
|
-
prunedMethods.set(resolverClass, alreadyPruned);
|
|
129
|
-
delete prototype[methodName];
|
|
130
|
-
(resolverType === 'Query' ? queries : mutations).push(schemaName);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return { queries, mutations };
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export { pruneDisabledOperations, resolveDisabled };
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { ResolveField, ID, Parent, Context, Resolver } from '@nestjs/graphql';
|
|
3
|
-
import '../dto/loader-type.dto.js';
|
|
4
|
-
import { LoaderDto } from '../dto/loader.dto.js';
|
|
5
|
-
import { MaterialDto } from '../dto/material.dto.js';
|
|
6
|
-
import '../dto/material-unit.dto.js';
|
|
7
|
-
import { AggregatedStockDto } from '../dto/stock.dto.js';
|
|
8
|
-
import '../dto/sale-order.dto.js';
|
|
9
|
-
import '../dto/receive-inventory-order.dto.js';
|
|
10
|
-
import '../dto/receive-inventory-order-item.dto.js';
|
|
11
|
-
import '../dto/ship-inventory-order.dto.js';
|
|
12
|
-
import '../dto/ship-inventory-order-item.dto.js';
|
|
13
|
-
import '../dto/hold-inventory-order.dto.js';
|
|
14
|
-
import '../dto/hold-inventory-order-item.dto.js';
|
|
15
|
-
import '../dto/allocate-inventory-order.dto.js';
|
|
16
|
-
import '../dto/allocate-inventory-order-item.dto.js';
|
|
17
|
-
import '../dto/transfer-order.dto.js';
|
|
18
|
-
import '../dto/transfer-order-item.dto.js';
|
|
19
|
-
import '../dto/transfer-customer-order.dto.js';
|
|
20
|
-
import '../dto/transfer-customer-order-item.dto.js';
|
|
21
|
-
import '../dto/transfer-vendor-order.dto.js';
|
|
22
|
-
import '../dto/transfer-vendor-order-item.dto.js';
|
|
23
|
-
import '../dto/scrape-order.dto.js';
|
|
24
|
-
import '../dto/scrape-order-item.dto.js';
|
|
25
|
-
import '../dto/quality-inspection-order.dto.js';
|
|
26
|
-
import '../dto/quality-inspection-order-item.dto.js';
|
|
27
|
-
import '../dto/inventory-count-order.dto.js';
|
|
28
|
-
import '../dto/consumption-order.dto.js';
|
|
29
|
-
import '../dto/consumption-order-item.dto.js';
|
|
30
|
-
import '../dto/order-reference.dto.js';
|
|
31
|
-
import { StockService, WmsEntities, BatchGroupEntityClass, LoadersEntityClass } from '@rytass/wms-module-core';
|
|
32
|
-
import { BatchDto } from '../dto/batch.dto.js';
|
|
33
|
-
import { LocationDto } from '../dto/location.dto.js';
|
|
34
|
-
|
|
35
|
-
let AggregatedStockResolver = class AggregatedStockResolver {
|
|
36
|
-
stockService;
|
|
37
|
-
entities;
|
|
38
|
-
constructor(stockService, entities) {
|
|
39
|
-
this.stockService = stockService;
|
|
40
|
-
this.entities = entities;
|
|
41
|
-
}
|
|
42
|
-
async id(stock) {
|
|
43
|
-
return this.stockService.generatedAggregateKey(stock);
|
|
44
|
-
}
|
|
45
|
-
async material({ materialId }, { loaders }) {
|
|
46
|
-
return loaders.batchSingle.load({
|
|
47
|
-
__entity: this.entities.material,
|
|
48
|
-
__from: { id: materialId },
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
async batch({ batchId }, { loaders }) {
|
|
52
|
-
const { groupId } = await loaders.batchSingle.load({
|
|
53
|
-
__entity: this.entities.batch,
|
|
54
|
-
__from: { id: batchId },
|
|
55
|
-
});
|
|
56
|
-
return loaders.batchSingle.load({
|
|
57
|
-
__entity: BatchGroupEntityClass,
|
|
58
|
-
__from: { id: groupId },
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
async location({ locationId }, { loaders }) {
|
|
62
|
-
return loaders.batchSingle.load({
|
|
63
|
-
__entity: this.entities.location,
|
|
64
|
-
__from: { id: locationId },
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
async loader({ loaderId }, { loaders }) {
|
|
68
|
-
return loaders.batchSingle.load({
|
|
69
|
-
__entity: LoadersEntityClass,
|
|
70
|
-
__from: { id: loaderId },
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
__decorate([
|
|
75
|
-
ResolveField(() => ID),
|
|
76
|
-
__param(0, Parent()),
|
|
77
|
-
__metadata("design:type", Function),
|
|
78
|
-
__metadata("design:paramtypes", [AggregatedStockDto]),
|
|
79
|
-
__metadata("design:returntype", Promise)
|
|
80
|
-
], AggregatedStockResolver.prototype, "id", null);
|
|
81
|
-
__decorate([
|
|
82
|
-
ResolveField(() => MaterialDto),
|
|
83
|
-
__param(0, Parent()),
|
|
84
|
-
__param(1, Context()),
|
|
85
|
-
__metadata("design:type", Function),
|
|
86
|
-
__metadata("design:paramtypes", [AggregatedStockDto, Object]),
|
|
87
|
-
__metadata("design:returntype", Promise)
|
|
88
|
-
], AggregatedStockResolver.prototype, "material", null);
|
|
89
|
-
__decorate([
|
|
90
|
-
ResolveField(() => BatchDto),
|
|
91
|
-
__param(0, Parent()),
|
|
92
|
-
__param(1, Context()),
|
|
93
|
-
__metadata("design:type", Function),
|
|
94
|
-
__metadata("design:paramtypes", [AggregatedStockDto, Object]),
|
|
95
|
-
__metadata("design:returntype", Promise)
|
|
96
|
-
], AggregatedStockResolver.prototype, "batch", null);
|
|
97
|
-
__decorate([
|
|
98
|
-
ResolveField(() => LocationDto),
|
|
99
|
-
__param(0, Parent()),
|
|
100
|
-
__param(1, Context()),
|
|
101
|
-
__metadata("design:type", Function),
|
|
102
|
-
__metadata("design:paramtypes", [AggregatedStockDto, Object]),
|
|
103
|
-
__metadata("design:returntype", Promise)
|
|
104
|
-
], AggregatedStockResolver.prototype, "location", null);
|
|
105
|
-
__decorate([
|
|
106
|
-
ResolveField(() => LoaderDto),
|
|
107
|
-
__param(0, Parent()),
|
|
108
|
-
__param(1, Context()),
|
|
109
|
-
__metadata("design:type", Function),
|
|
110
|
-
__metadata("design:paramtypes", [AggregatedStockDto, Object]),
|
|
111
|
-
__metadata("design:returntype", Promise)
|
|
112
|
-
], AggregatedStockResolver.prototype, "loader", null);
|
|
113
|
-
AggregatedStockResolver = __decorate([
|
|
114
|
-
Resolver(() => AggregatedStockDto),
|
|
115
|
-
__metadata("design:paramtypes", [StockService,
|
|
116
|
-
WmsEntities])
|
|
117
|
-
], AggregatedStockResolver);
|
|
118
|
-
|
|
119
|
-
export { AggregatedStockResolver };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { ResolveField, Parent, Context, Resolver } from '@nestjs/graphql';
|
|
3
|
-
import { AllocateInventoryOrderDto } from '../dto/allocate-inventory-order.dto.js';
|
|
4
|
-
import { AllocateInventoryOrderItemDto } from '../dto/allocate-inventory-order-item.dto.js';
|
|
5
|
-
import { AllocateInventoryOrderEntityClass, AllocateInventoryOrderItemEntityClass } from '@rytass/wms-module-core';
|
|
6
|
-
|
|
7
|
-
let AllocateInventoryOrderResolver = class AllocateInventoryOrderResolver {
|
|
8
|
-
items({ id }, { loaders }) {
|
|
9
|
-
return loaders.batchMany.load({
|
|
10
|
-
__entity: AllocateInventoryOrderItemEntityClass,
|
|
11
|
-
__from: { orderId: id },
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
__decorate([
|
|
16
|
-
ResolveField(() => [AllocateInventoryOrderItemDto]),
|
|
17
|
-
__param(0, Parent()),
|
|
18
|
-
__param(1, Context()),
|
|
19
|
-
__metadata("design:type", Function),
|
|
20
|
-
__metadata("design:paramtypes", [AllocateInventoryOrderEntityClass, Object]),
|
|
21
|
-
__metadata("design:returntype", Promise)
|
|
22
|
-
], AllocateInventoryOrderResolver.prototype, "items", null);
|
|
23
|
-
AllocateInventoryOrderResolver = __decorate([
|
|
24
|
-
Resolver(() => AllocateInventoryOrderDto)
|
|
25
|
-
], AllocateInventoryOrderResolver);
|
|
26
|
-
|
|
27
|
-
export { AllocateInventoryOrderResolver };
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { ResolveField, Parent, Context, Resolver } from '@nestjs/graphql';
|
|
3
|
-
import '../dto/loader-type.dto.js';
|
|
4
|
-
import '../dto/loader.dto.js';
|
|
5
|
-
import { MaterialDto } from '../dto/material.dto.js';
|
|
6
|
-
import '../dto/material-unit.dto.js';
|
|
7
|
-
import { ChangeLogDto } from '../dto/stock.dto.js';
|
|
8
|
-
import '../dto/sale-order.dto.js';
|
|
9
|
-
import '../dto/receive-inventory-order.dto.js';
|
|
10
|
-
import '../dto/receive-inventory-order-item.dto.js';
|
|
11
|
-
import '../dto/ship-inventory-order.dto.js';
|
|
12
|
-
import '../dto/ship-inventory-order-item.dto.js';
|
|
13
|
-
import '../dto/hold-inventory-order.dto.js';
|
|
14
|
-
import '../dto/hold-inventory-order-item.dto.js';
|
|
15
|
-
import '../dto/allocate-inventory-order.dto.js';
|
|
16
|
-
import '../dto/allocate-inventory-order-item.dto.js';
|
|
17
|
-
import '../dto/transfer-order.dto.js';
|
|
18
|
-
import '../dto/transfer-order-item.dto.js';
|
|
19
|
-
import '../dto/transfer-customer-order.dto.js';
|
|
20
|
-
import '../dto/transfer-customer-order-item.dto.js';
|
|
21
|
-
import '../dto/transfer-vendor-order.dto.js';
|
|
22
|
-
import '../dto/transfer-vendor-order-item.dto.js';
|
|
23
|
-
import '../dto/scrape-order.dto.js';
|
|
24
|
-
import '../dto/scrape-order-item.dto.js';
|
|
25
|
-
import '../dto/quality-inspection-order.dto.js';
|
|
26
|
-
import '../dto/quality-inspection-order-item.dto.js';
|
|
27
|
-
import '../dto/inventory-count-order.dto.js';
|
|
28
|
-
import '../dto/consumption-order.dto.js';
|
|
29
|
-
import '../dto/consumption-order-item.dto.js';
|
|
30
|
-
import '../dto/order-reference.dto.js';
|
|
31
|
-
import { StockEntityClass, WmsEntities, BatchGroupEntityClass } from '@rytass/wms-module-core';
|
|
32
|
-
import { LocationDto } from '../dto/location.dto.js';
|
|
33
|
-
import { BatchDto } from '../dto/batch.dto.js';
|
|
34
|
-
|
|
35
|
-
let ChangeLogResolver = class ChangeLogResolver {
|
|
36
|
-
entities;
|
|
37
|
-
/**
|
|
38
|
-
* The configured entities, not the built-in classes: `__entity` decides which
|
|
39
|
-
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
40
|
-
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
41
|
-
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
42
|
-
* override.
|
|
43
|
-
*/
|
|
44
|
-
constructor(entities) {
|
|
45
|
-
this.entities = entities;
|
|
46
|
-
}
|
|
47
|
-
material({ materialId }, { loaders }) {
|
|
48
|
-
return loaders.batchSingle.load({
|
|
49
|
-
__entity: this.entities.material,
|
|
50
|
-
__from: { id: materialId },
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
location({ locationId }, { loaders }) {
|
|
54
|
-
return loaders.batchSingle.load({
|
|
55
|
-
__entity: this.entities.location,
|
|
56
|
-
__from: { id: locationId },
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
async batch({ batchId }, { loaders }) {
|
|
60
|
-
const { groupId } = await loaders.batchSingle.load({
|
|
61
|
-
__entity: this.entities.batch,
|
|
62
|
-
__from: { id: batchId },
|
|
63
|
-
});
|
|
64
|
-
return loaders.batchSingle.load({
|
|
65
|
-
__entity: BatchGroupEntityClass,
|
|
66
|
-
__from: { id: groupId },
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
__decorate([
|
|
71
|
-
ResolveField(() => MaterialDto),
|
|
72
|
-
__param(0, Parent()),
|
|
73
|
-
__param(1, Context()),
|
|
74
|
-
__metadata("design:type", Function),
|
|
75
|
-
__metadata("design:paramtypes", [StockEntityClass, Object]),
|
|
76
|
-
__metadata("design:returntype", Promise)
|
|
77
|
-
], ChangeLogResolver.prototype, "material", null);
|
|
78
|
-
__decorate([
|
|
79
|
-
ResolveField(() => LocationDto),
|
|
80
|
-
__param(0, Parent()),
|
|
81
|
-
__param(1, Context()),
|
|
82
|
-
__metadata("design:type", Function),
|
|
83
|
-
__metadata("design:paramtypes", [StockEntityClass, Object]),
|
|
84
|
-
__metadata("design:returntype", Promise)
|
|
85
|
-
], ChangeLogResolver.prototype, "location", null);
|
|
86
|
-
__decorate([
|
|
87
|
-
ResolveField(() => BatchDto),
|
|
88
|
-
__param(0, Parent()),
|
|
89
|
-
__param(1, Context()),
|
|
90
|
-
__metadata("design:type", Function),
|
|
91
|
-
__metadata("design:paramtypes", [StockEntityClass, Object]),
|
|
92
|
-
__metadata("design:returntype", Promise)
|
|
93
|
-
], ChangeLogResolver.prototype, "batch", null);
|
|
94
|
-
ChangeLogResolver = __decorate([
|
|
95
|
-
Resolver(() => ChangeLogDto),
|
|
96
|
-
__metadata("design:paramtypes", [WmsEntities])
|
|
97
|
-
], ChangeLogResolver);
|
|
98
|
-
|
|
99
|
-
export { ChangeLogResolver };
|