@rytass/wms-module-graphql 0.11.1 → 0.12.1
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/index.d.ts +0 -0
- package/lib/inputs/inventory-count-order.args.d.ts +6 -0
- package/package.json +8 -29
- package/adapters/event-emitter.d.mts +0 -6
- package/adapters/event-emitter.mjs +0 -41
- package/adapters/member-base.d.mts +0 -6
- package/adapters/member-base.mjs +0 -63
- package/index.d.mts +0 -6
- package/index.mjs +0 -12
- package/lib/auth/host-skip.constant.mjs +0 -29
- package/lib/auth/wms-auth.guard.mjs +0 -41
- package/lib/auth/wms-auth.types.mjs +0 -6
- package/lib/auth/wms-operation.decorator.mjs +0 -29
- package/lib/dto/allocate-inventory-order-item.dto.mjs +0 -36
- package/lib/dto/allocate-inventory-order.dto.mjs +0 -31
- package/lib/dto/batch.dto.mjs +0 -26
- package/lib/dto/consumption-order-item.dto.mjs +0 -43
- package/lib/dto/consumption-order.dto.mjs +0 -52
- package/lib/dto/hold-inventory-order-item.dto.mjs +0 -37
- package/lib/dto/hold-inventory-order.dto.mjs +0 -47
- package/lib/dto/inventory-count-order.dto.mjs +0 -207
- package/lib/dto/loader-type.dto.mjs +0 -46
- package/lib/dto/loader-unit.dto.mjs +0 -21
- package/lib/dto/loader.dto.mjs +0 -71
- package/lib/dto/location.dto.mjs +0 -36
- package/lib/dto/material-unit.dto.mjs +0 -46
- package/lib/dto/material.dto.mjs +0 -36
- package/lib/dto/merge-batch-order.dto.mjs +0 -50
- package/lib/dto/order-reference.dto.mjs +0 -73
- package/lib/dto/pagination.dto.mjs +0 -51
- package/lib/dto/quality-inspection-order-item.dto.mjs +0 -50
- package/lib/dto/quality-inspection-order.dto.mjs +0 -42
- package/lib/dto/receive-inventory-order-item.dto.mjs +0 -60
- package/lib/dto/receive-inventory-order.dto.mjs +0 -58
- package/lib/dto/reclassify-inventory-order.dto.mjs +0 -55
- package/lib/dto/sale-order.dto.mjs +0 -20
- package/lib/dto/scrape-order-item.dto.mjs +0 -56
- package/lib/dto/scrape-order.dto.mjs +0 -37
- package/lib/dto/ship-inventory-order-item.dto.mjs +0 -56
- package/lib/dto/ship-inventory-order-reference.dto.mjs +0 -48
- package/lib/dto/ship-inventory-order.dto.mjs +0 -58
- package/lib/dto/split-batch-order.dto.mjs +0 -50
- package/lib/dto/stock.dto.mjs +0 -166
- package/lib/dto/transfer-customer-order-item.dto.mjs +0 -61
- package/lib/dto/transfer-customer-order.dto.mjs +0 -37
- package/lib/dto/transfer-order-item.dto.mjs +0 -41
- package/lib/dto/transfer-order.dto.mjs +0 -57
- package/lib/dto/transfer-vendor-order-item.dto.mjs +0 -61
- package/lib/dto/transfer-vendor-order.dto.mjs +0 -37
- package/lib/dto/unit.dto.mjs +0 -20
- package/lib/dto/warehouse-map.dto.mjs +0 -165
- package/lib/events/wms-mutation-event.constants.mjs +0 -4
- package/lib/events/wms-mutation-event.decorator.mjs +0 -20
- package/lib/events/wms-mutation.interceptor.mjs +0 -64
- package/lib/graphql.module.mjs +0 -183
- package/lib/helpers/create-wms-loaders.mjs +0 -11
- package/lib/helpers/helper.module.mjs +0 -15
- package/lib/helpers/loader.service.mjs +0 -230
- package/lib/helpers/query-path.mjs +0 -19
- package/lib/inputs/cancel-ship-order.args.mjs +0 -20
- package/lib/inputs/cancel-transfer-order.args.mjs +0 -23
- package/lib/inputs/consumption-order.args.mjs +0 -182
- package/lib/inputs/create-allocate-inventory-order-item.args.mjs +0 -50
- package/lib/inputs/create-allocate-inventory-order.args.mjs +0 -36
- package/lib/inputs/create-hold-inventory-order-item.args.mjs +0 -40
- package/lib/inputs/create-hold-inventory-order.args.mjs +0 -41
- package/lib/inputs/create-loader-type.args.mjs +0 -35
- package/lib/inputs/create-loader.args.mjs +0 -130
- package/lib/inputs/create-location.args.mjs +0 -50
- package/lib/inputs/create-material-unit.args.mjs +0 -25
- package/lib/inputs/create-material.args.mjs +0 -51
- package/lib/inputs/create-quality-inspection-order.args.mjs +0 -50
- package/lib/inputs/create-receive-inventory-order-item.args.mjs +0 -70
- package/lib/inputs/create-receive-inventory-order.args.mjs +0 -51
- package/lib/inputs/create-ship-inventory-order-item.args.mjs +0 -45
- package/lib/inputs/create-ship-inventory-order-reference.args.mjs +0 -65
- package/lib/inputs/create-ship-inventory-order.args.mjs +0 -57
- package/lib/inputs/create-transfer-customer-order-item.args.mjs +0 -40
- package/lib/inputs/create-transfer-customer-order.args.mjs +0 -51
- package/lib/inputs/create-transfer-order-item.args.mjs +0 -40
- package/lib/inputs/create-transfer-order.args.mjs +0 -61
- package/lib/inputs/create-transfer-vendor-order-item.args.mjs +0 -40
- package/lib/inputs/create-transfer-vendor-order.args.mjs +0 -51
- package/lib/inputs/date-range.args.mjs +0 -20
- package/lib/inputs/deallocate-order.args.mjs +0 -25
- package/lib/inputs/find-allocate-inventory-order.args.mjs +0 -42
- package/lib/inputs/find-batch.args.mjs +0 -21
- package/lib/inputs/find-hold-inventory-order.args.mjs +0 -42
- package/lib/inputs/find-loader-type.args.mjs +0 -32
- package/lib/inputs/find-loader.args.mjs +0 -72
- package/lib/inputs/find-location.args.mjs +0 -26
- package/lib/inputs/find-material.args.mjs +0 -21
- package/lib/inputs/find-receive-inventory-order.args.mjs +0 -71
- package/lib/inputs/find-sale-order.args.mjs +0 -16
- package/lib/inputs/find-ship-inventory-order.args.mjs +0 -71
- package/lib/inputs/find-stock.args.mjs +0 -102
- package/lib/inputs/find-transfer-order.args.mjs +0 -82
- package/lib/inputs/inventory-count-order.args.mjs +0 -257
- package/lib/inputs/merge-batch.args.mjs +0 -40
- package/lib/inputs/order-reference.args.mjs +0 -103
- package/lib/inputs/pagination.args.mjs +0 -20
- package/lib/inputs/receive-order.args.mjs +0 -40
- package/lib/inputs/reclassify-inventory-order.args.mjs +0 -40
- package/lib/inputs/release-order.args.mjs +0 -25
- package/lib/inputs/return-transfer-customer-order.args.mjs +0 -35
- package/lib/inputs/return-transfer-vendor-order.args.mjs +0 -35
- package/lib/inputs/scrape-order.args.mjs +0 -35
- package/lib/inputs/ship-order.args.mjs +0 -20
- package/lib/inputs/split-batch.args.mjs +0 -51
- package/lib/inputs/transfer-order.args.mjs +0 -20
- package/lib/inputs/update-warehouse-map.args.mjs +0 -121
- package/lib/mutations/allocate-inventory-order.mutation.mjs +0 -91
- package/lib/mutations/consumption-order.mutation.mjs +0 -90
- package/lib/mutations/hold-inventory-order.mutation.mjs +0 -91
- package/lib/mutations/inventory-count-order.mutation.mjs +0 -138
- package/lib/mutations/loader.mutation.mjs +0 -123
- package/lib/mutations/location.mutation.mjs +0 -47
- package/lib/mutations/material.mutation.mjs +0 -74
- package/lib/mutations/merge-batch.mutation.mjs +0 -50
- package/lib/mutations/order-reference.mutation.mjs +0 -57
- package/lib/mutations/quality-inspection-order.mutation.mjs +0 -50
- package/lib/mutations/receive-inventory-order.mutation.mjs +0 -106
- package/lib/mutations/reclassify-inventory-order.mutation.mjs +0 -51
- package/lib/mutations/scrape-order.mutation.mjs +0 -44
- package/lib/mutations/ship-inventory-order.mutation.mjs +0 -123
- package/lib/mutations/split-batch.mutation.mjs +0 -44
- package/lib/mutations/transfer-customer-order.mutation.mjs +0 -91
- package/lib/mutations/transfer-order.mutation.mjs +0 -96
- package/lib/mutations/transfer-vendor-order.mutation.mjs +0 -91
- package/lib/mutations/warehouse-map.mutation.mjs +0 -60
- package/lib/queries/allocate-inventory-order.query.mjs +0 -33
- package/lib/queries/batch.query.mjs +0 -36
- package/lib/queries/consumption-order.query.mjs +0 -45
- package/lib/queries/hold-inventory-order.query.mjs +0 -33
- package/lib/queries/inventory-count-order.query.mjs +0 -63
- package/lib/queries/loader.query.mjs +0 -167
- package/lib/queries/location.query.mjs +0 -51
- package/lib/queries/material.query.mjs +0 -79
- package/lib/queries/order-reference.query.mjs +0 -34
- package/lib/queries/recieve-inventory-order.query.mjs +0 -77
- package/lib/queries/sale-order.query.mjs +0 -57
- package/lib/queries/ship-inventory-order.query.mjs +0 -77
- package/lib/queries/stock.query.mjs +0 -116
- package/lib/queries/transfer-order.query.mjs +0 -46
- package/lib/queries/unit.query.mjs +0 -30
- package/lib/queries/warehouse-map.query.mjs +0 -32
- package/lib/registry/operation-registry.mjs +0 -136
- package/lib/resolvers/aggregated-stock.resolver.mjs +0 -119
- package/lib/resolvers/allocate-inventory-order.resolver.mjs +0 -27
- package/lib/resolvers/change-log.resolver.mjs +0 -99
- package/lib/resolvers/consumption-order.resolver.mjs +0 -238
- package/lib/resolvers/hold-inventory-order.resolver.mjs +0 -27
- package/lib/resolvers/inventory-count-order.resolver.mjs +0 -148
- package/lib/resolvers/loader-type.resolver.mjs +0 -54
- package/lib/resolvers/loader.resolver.mjs +0 -99
- package/lib/resolvers/location.resolver.mjs +0 -80
- package/lib/resolvers/material.resolver.mjs +0 -87
- package/lib/resolvers/merge-batch.resolver.mjs +0 -26
- package/lib/resolvers/receive-inventory-order.resolver.mjs +0 -156
- package/lib/resolvers/ship-inventory-order.resolver.mjs +0 -301
- package/lib/resolvers/split-batch.resolver.mjs +0 -26
- package/lib/resolvers/stock.resolver.mjs +0 -99
- package/lib/resolvers/transfer-customer-order.resolver.mjs +0 -27
- package/lib/resolvers/transfer-order.resolver.mjs +0 -246
- package/lib/resolvers/transfer-vendor-order.resolver.mjs +0 -27
- package/lib/resolvers/warehouse-map.resolver.mjs +0 -41
- package/lib/scalars/json-object.scalar.mjs +0 -62
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { Injectable, Optional, Inject } from '@nestjs/common';
|
|
3
|
-
import { Reflector } from '@nestjs/core';
|
|
4
|
-
import { GqlExecutionContext } from '@nestjs/graphql';
|
|
5
|
-
import { WMS_ACTOR_EXTRACTOR, WmsOperationRunner } from '@rytass/wms-module-core';
|
|
6
|
-
import { firstValueFrom, of } from 'rxjs';
|
|
7
|
-
import { WMS_MUTATION_EVENT_METADATA } from './wms-mutation-event.constants.mjs';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Hands each `@WmsMutationEvent` mutation to {@link WmsOperationRunner}, which
|
|
11
|
-
* owns the before-hook / dispatch scope / post-commit flush sequence.
|
|
12
|
-
*
|
|
13
|
-
* All this adds on top is what only a GraphQL request can supply: the raw
|
|
14
|
-
* arguments and the actor. Keeping the sequence itself in core is what stops
|
|
15
|
-
* the GraphQL path and a host's direct service call from drifting apart.
|
|
16
|
-
*
|
|
17
|
-
* When no hook, listener or bridge is configured the runner passes through
|
|
18
|
-
* untouched.
|
|
19
|
-
*/
|
|
20
|
-
let WmsMutationInterceptor = class WmsMutationInterceptor {
|
|
21
|
-
reflector;
|
|
22
|
-
runner;
|
|
23
|
-
actorExtractor;
|
|
24
|
-
constructor(reflector, runner, actorExtractor = null) {
|
|
25
|
-
this.reflector = reflector;
|
|
26
|
-
this.runner = runner;
|
|
27
|
-
this.actorExtractor = actorExtractor;
|
|
28
|
-
}
|
|
29
|
-
resolveActor(context) {
|
|
30
|
-
if (!this.actorExtractor) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
return this.actorExtractor(context);
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
// Fail-open on actor resolution: never break a mutation over audit metadata.
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
async intercept(context, next) {
|
|
42
|
-
const config = this.reflector.get(WMS_MUTATION_EVENT_METADATA, context.getHandler());
|
|
43
|
-
if (!config) {
|
|
44
|
-
return next.handle();
|
|
45
|
-
}
|
|
46
|
-
const result = await this.runner.run({
|
|
47
|
-
event: config.event,
|
|
48
|
-
args: GqlExecutionContext.create(context).getArgs() ?? {},
|
|
49
|
-
actor: this.resolveActor(context),
|
|
50
|
-
resolveId: config.resolveId,
|
|
51
|
-
executionContext: context,
|
|
52
|
-
}, () => firstValueFrom(next.handle()));
|
|
53
|
-
return of(result);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
WmsMutationInterceptor = __decorate([
|
|
57
|
-
Injectable(),
|
|
58
|
-
__param(2, Optional()),
|
|
59
|
-
__param(2, Inject(WMS_ACTOR_EXTRACTOR)),
|
|
60
|
-
__metadata("design:paramtypes", [Reflector,
|
|
61
|
-
WmsOperationRunner, Object])
|
|
62
|
-
], WmsMutationInterceptor);
|
|
63
|
-
|
|
64
|
-
export { WmsMutationInterceptor };
|
package/lib/graphql.module.mjs
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { __decorate } from 'tslib';
|
|
2
|
-
import { Module } from '@nestjs/common';
|
|
3
|
-
import { WmsModuleCoreModule } from '@rytass/wms-module-core';
|
|
4
|
-
import './helpers/loader.service.mjs';
|
|
5
|
-
import { HelperModule } from './helpers/helper.module.mjs';
|
|
6
|
-
import './helpers/query-path.mjs';
|
|
7
|
-
import { WmsAuthGuard } from './auth/wms-auth.guard.mjs';
|
|
8
|
-
import { WMS_AUTH_OPTIONS } from './auth/wms-auth.types.mjs';
|
|
9
|
-
import { WmsMutationInterceptor } from './events/wms-mutation.interceptor.mjs';
|
|
10
|
-
import { pruneDisabledOperations } from './registry/operation-registry.mjs';
|
|
11
|
-
import { LoaderMutation } from './mutations/loader.mutation.mjs';
|
|
12
|
-
import { LoaderQuery } from './queries/loader.query.mjs';
|
|
13
|
-
import { MaterialMutation } from './mutations/material.mutation.mjs';
|
|
14
|
-
import { MaterialQuery } from './queries/material.query.mjs';
|
|
15
|
-
import { StockQuery } from './queries/stock.query.mjs';
|
|
16
|
-
import { ReceiveInventoryOrderMutation } from './mutations/receive-inventory-order.mutation.mjs';
|
|
17
|
-
import { ReceiveInventoryOrderQuery } from './queries/recieve-inventory-order.query.mjs';
|
|
18
|
-
import { ShipInventoryOrderMutation } from './mutations/ship-inventory-order.mutation.mjs';
|
|
19
|
-
import { ShipInventoryOrderQuery } from './queries/ship-inventory-order.query.mjs';
|
|
20
|
-
import { LoaderResolver } from './resolvers/loader.resolver.mjs';
|
|
21
|
-
import { MaterialResolver } from './resolvers/material.resolver.mjs';
|
|
22
|
-
import { StockResolver } from './resolvers/stock.resolver.mjs';
|
|
23
|
-
import { WarehouseMapMutation } from './mutations/warehouse-map.mutation.mjs';
|
|
24
|
-
import { LocationResolver } from './resolvers/location.resolver.mjs';
|
|
25
|
-
import { LocationQuery } from './queries/location.query.mjs';
|
|
26
|
-
import { LocationMutation } from './mutations/location.mutation.mjs';
|
|
27
|
-
import { LoaderTypeResolver } from './resolvers/loader-type.resolver.mjs';
|
|
28
|
-
import { UnitQuery } from './queries/unit.query.mjs';
|
|
29
|
-
import { AggregatedStockResolver } from './resolvers/aggregated-stock.resolver.mjs';
|
|
30
|
-
import { TransferOrderMutation } from './mutations/transfer-order.mutation.mjs';
|
|
31
|
-
import { TransferOrderQuery } from './queries/transfer-order.query.mjs';
|
|
32
|
-
import { TransferOrderResolver, TransferOrderItemResolver } from './resolvers/transfer-order.resolver.mjs';
|
|
33
|
-
import { HoldInventoryOrderMutation } from './mutations/hold-inventory-order.mutation.mjs';
|
|
34
|
-
import { HoldInventoryOrderQuery } from './queries/hold-inventory-order.query.mjs';
|
|
35
|
-
import { HoldInventoryOrderResolver } from './resolvers/hold-inventory-order.resolver.mjs';
|
|
36
|
-
import { BatchQuery } from './queries/batch.query.mjs';
|
|
37
|
-
import { OrderReferenceQuery } from './queries/order-reference.query.mjs';
|
|
38
|
-
import { OrderReferenceMutation } from './mutations/order-reference.mutation.mjs';
|
|
39
|
-
import { ConsumptionOrderQuery } from './queries/consumption-order.query.mjs';
|
|
40
|
-
import { ConsumptionOrderMutation } from './mutations/consumption-order.mutation.mjs';
|
|
41
|
-
import { ConsumptionOrderResolver, ConsumptionOrderItemResolver } from './resolvers/consumption-order.resolver.mjs';
|
|
42
|
-
import { ChangeLogResolver } from './resolvers/change-log.resolver.mjs';
|
|
43
|
-
import { ReceiveInventoryOrderResolver, ReceiveInventoryOrderItemResolver } from './resolvers/receive-inventory-order.resolver.mjs';
|
|
44
|
-
import { AllocateInventoryOrderQuery } from './queries/allocate-inventory-order.query.mjs';
|
|
45
|
-
import { AllocateInventoryOrderResolver } from './resolvers/allocate-inventory-order.resolver.mjs';
|
|
46
|
-
import { AllocateInventoryOrderMutation } from './mutations/allocate-inventory-order.mutation.mjs';
|
|
47
|
-
import { ShipInventoryOrderResolver, ShipInventoryOrderItemResolver, ShipInventoryOrderReferenceResolver } from './resolvers/ship-inventory-order.resolver.mjs';
|
|
48
|
-
import { SaleOrderQuery } from './queries/sale-order.query.mjs';
|
|
49
|
-
import { SplitBatchMutation } from './mutations/split-batch.mutation.mjs';
|
|
50
|
-
import { MergeBatchMutation } from './mutations/merge-batch.mutation.mjs';
|
|
51
|
-
import { ReclassifyInventoryOrderMutation } from './mutations/reclassify-inventory-order.mutation.mjs';
|
|
52
|
-
import { TransferCustomerOrderMutation } from './mutations/transfer-customer-order.mutation.mjs';
|
|
53
|
-
import { TransferCustomerOrderResolver } from './resolvers/transfer-customer-order.resolver.mjs';
|
|
54
|
-
import { TransferVendorOrderMutation } from './mutations/transfer-vendor-order.mutation.mjs';
|
|
55
|
-
import { TransferVendorOrderResolver } from './resolvers/transfer-vendor-order.resolver.mjs';
|
|
56
|
-
import { SplitBatchResolver } from './resolvers/split-batch.resolver.mjs';
|
|
57
|
-
import { MergeBatchOrderResolver } from './resolvers/merge-batch.resolver.mjs';
|
|
58
|
-
import { ScrapeMutation } from './mutations/scrape-order.mutation.mjs';
|
|
59
|
-
import { QualityInspectionOrderMutation } from './mutations/quality-inspection-order.mutation.mjs';
|
|
60
|
-
import { WarehouseMapDataQuery } from './queries/warehouse-map.query.mjs';
|
|
61
|
-
import { MapRangeUnionResolver } from './resolvers/warehouse-map.resolver.mjs';
|
|
62
|
-
import { InventoryCountOrderQuery } from './queries/inventory-count-order.query.mjs';
|
|
63
|
-
import { InventoryCountOrderMutation } from './mutations/inventory-count-order.mutation.mjs';
|
|
64
|
-
import { InventoryCountOrderResolver, InventoryCountOrderItemResolver } from './resolvers/inventory-count-order.resolver.mjs';
|
|
65
|
-
|
|
66
|
-
var WmsModuleGraphqlModule_1;
|
|
67
|
-
const exportDependencies = [
|
|
68
|
-
UnitQuery,
|
|
69
|
-
LoaderMutation,
|
|
70
|
-
LoaderQuery,
|
|
71
|
-
LoaderResolver,
|
|
72
|
-
LoaderTypeResolver,
|
|
73
|
-
MaterialMutation,
|
|
74
|
-
MaterialQuery,
|
|
75
|
-
MaterialResolver,
|
|
76
|
-
BatchQuery,
|
|
77
|
-
StockQuery,
|
|
78
|
-
StockResolver,
|
|
79
|
-
ChangeLogResolver,
|
|
80
|
-
AggregatedStockResolver,
|
|
81
|
-
ReceiveInventoryOrderMutation,
|
|
82
|
-
ReceiveInventoryOrderQuery,
|
|
83
|
-
ReceiveInventoryOrderResolver,
|
|
84
|
-
ReceiveInventoryOrderItemResolver,
|
|
85
|
-
ShipInventoryOrderMutation,
|
|
86
|
-
ShipInventoryOrderQuery,
|
|
87
|
-
ShipInventoryOrderResolver,
|
|
88
|
-
ShipInventoryOrderItemResolver,
|
|
89
|
-
ShipInventoryOrderReferenceResolver,
|
|
90
|
-
TransferOrderMutation,
|
|
91
|
-
TransferOrderQuery,
|
|
92
|
-
TransferOrderResolver,
|
|
93
|
-
HoldInventoryOrderMutation,
|
|
94
|
-
HoldInventoryOrderQuery,
|
|
95
|
-
HoldInventoryOrderResolver,
|
|
96
|
-
WarehouseMapMutation,
|
|
97
|
-
LocationMutation,
|
|
98
|
-
LocationQuery,
|
|
99
|
-
LocationResolver,
|
|
100
|
-
TransferOrderMutation,
|
|
101
|
-
TransferOrderResolver,
|
|
102
|
-
TransferOrderItemResolver,
|
|
103
|
-
AllocateInventoryOrderQuery,
|
|
104
|
-
AllocateInventoryOrderResolver,
|
|
105
|
-
AllocateInventoryOrderMutation,
|
|
106
|
-
TransferCustomerOrderMutation,
|
|
107
|
-
TransferCustomerOrderResolver,
|
|
108
|
-
TransferVendorOrderMutation,
|
|
109
|
-
TransferVendorOrderResolver,
|
|
110
|
-
SaleOrderQuery,
|
|
111
|
-
SplitBatchMutation,
|
|
112
|
-
SplitBatchResolver,
|
|
113
|
-
MergeBatchMutation,
|
|
114
|
-
MergeBatchOrderResolver,
|
|
115
|
-
ReclassifyInventoryOrderMutation,
|
|
116
|
-
ScrapeMutation,
|
|
117
|
-
QualityInspectionOrderMutation,
|
|
118
|
-
WarehouseMapDataQuery,
|
|
119
|
-
MapRangeUnionResolver,
|
|
120
|
-
InventoryCountOrderQuery,
|
|
121
|
-
InventoryCountOrderMutation,
|
|
122
|
-
InventoryCountOrderResolver,
|
|
123
|
-
InventoryCountOrderItemResolver,
|
|
124
|
-
OrderReferenceQuery,
|
|
125
|
-
OrderReferenceMutation,
|
|
126
|
-
ConsumptionOrderQuery,
|
|
127
|
-
ConsumptionOrderMutation,
|
|
128
|
-
ConsumptionOrderResolver,
|
|
129
|
-
ConsumptionOrderItemResolver,
|
|
130
|
-
];
|
|
131
|
-
let WmsModuleGraphqlModule = WmsModuleGraphqlModule_1 = class WmsModuleGraphqlModule {
|
|
132
|
-
static forRootAsync(options) {
|
|
133
|
-
const { authChecker, beforeHooks, afterListeners, actorExtractor, eventEmitterBridge, enabledOperations, disabledOperations, disabledFields, ...coreOptions } = options;
|
|
134
|
-
// Must run before `GraphQLModule` builds the schema. `forRootAsync` is
|
|
135
|
-
// called while `AppModule` is still being defined, so this is the earliest
|
|
136
|
-
// point at which the deployment's switches are known — and it is early
|
|
137
|
-
// enough: the schema is not built until the app bootstraps.
|
|
138
|
-
pruneDisabledOperations(exportDependencies, {
|
|
139
|
-
enabledOperations,
|
|
140
|
-
disabledOperations,
|
|
141
|
-
disabledFields,
|
|
142
|
-
});
|
|
143
|
-
/*
|
|
144
|
-
* The event wiring goes down to the core module rather than being bound
|
|
145
|
-
* here. `WmsOperationRunner` lives in core so a host calling a service
|
|
146
|
-
* directly gets the same guarantee, and binding the same tokens in both
|
|
147
|
-
* modules would leave two live bindings whose winner depends on which
|
|
148
|
-
* injector the consumer reached first.
|
|
149
|
-
*
|
|
150
|
-
* `coreOptions` still carries `enrichStockEvents`, also forwarded.
|
|
151
|
-
*/
|
|
152
|
-
const coreModule = WmsModuleCoreModule.forRootAsync({
|
|
153
|
-
...coreOptions,
|
|
154
|
-
// The typed hook maps are a compile-time refinement of the core maps; at
|
|
155
|
-
// runtime the dispatched payload IS the concrete result type, so handing
|
|
156
|
-
// the refined maps to the (looser) core option contract is sound.
|
|
157
|
-
beforeHooks: beforeHooks,
|
|
158
|
-
afterListeners: afterListeners,
|
|
159
|
-
actorExtractor,
|
|
160
|
-
eventEmitterBridge,
|
|
161
|
-
});
|
|
162
|
-
const authOptions = { authChecker };
|
|
163
|
-
const providers = [
|
|
164
|
-
...exportDependencies,
|
|
165
|
-
WmsAuthGuard,
|
|
166
|
-
{ provide: WMS_AUTH_OPTIONS, useValue: authOptions },
|
|
167
|
-
WmsMutationInterceptor,
|
|
168
|
-
];
|
|
169
|
-
return {
|
|
170
|
-
module: WmsModuleGraphqlModule_1,
|
|
171
|
-
imports: [coreModule, HelperModule],
|
|
172
|
-
providers,
|
|
173
|
-
exports: [...exportDependencies, WmsAuthGuard, HelperModule, coreModule],
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
WmsModuleGraphqlModule = WmsModuleGraphqlModule_1 = __decorate([
|
|
178
|
-
Module({
|
|
179
|
-
providers: exportDependencies,
|
|
180
|
-
})
|
|
181
|
-
], WmsModuleGraphqlModule);
|
|
182
|
-
|
|
183
|
-
export { WmsModuleGraphqlModule };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
function createWmsLoaders(loaderService) {
|
|
2
|
-
return {
|
|
3
|
-
loaders: {
|
|
4
|
-
batchSingle: loaderService.batchEntity(),
|
|
5
|
-
batchMany: loaderService.batchEntities(),
|
|
6
|
-
batchManyWithPagination: loaderService.batchEntitiesWithPagination(),
|
|
7
|
-
},
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { createWmsLoaders };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { __decorate } from 'tslib';
|
|
2
|
-
import { Global, Module } from '@nestjs/common';
|
|
3
|
-
import { LoaderService } from './loader.service.mjs';
|
|
4
|
-
|
|
5
|
-
let HelperModule = class HelperModule {
|
|
6
|
-
};
|
|
7
|
-
HelperModule = __decorate([
|
|
8
|
-
Global(),
|
|
9
|
-
Module({
|
|
10
|
-
providers: [LoaderService],
|
|
11
|
-
exports: [LoaderService],
|
|
12
|
-
})
|
|
13
|
-
], HelperModule);
|
|
14
|
-
|
|
15
|
-
export { HelperModule };
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from 'tslib';
|
|
2
|
-
import { Injectable } from '@nestjs/common';
|
|
3
|
-
import { createHash } from 'crypto';
|
|
4
|
-
import _ from 'lodash';
|
|
5
|
-
import { LRUCache } from 'lru-cache';
|
|
6
|
-
import { DataSource, Brackets, In } from 'typeorm';
|
|
7
|
-
import DataLoader from 'dataloader';
|
|
8
|
-
|
|
9
|
-
let LoaderService = class LoaderService {
|
|
10
|
-
dataSource;
|
|
11
|
-
cache;
|
|
12
|
-
constructor(dataSource) {
|
|
13
|
-
this.dataSource = dataSource;
|
|
14
|
-
this.cache = new LRUCache({
|
|
15
|
-
max: 10000,
|
|
16
|
-
ttlAutopurge: true,
|
|
17
|
-
ttl: 500,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* create hash from `__entity` in loader option, and return option with `__hash` set with hash value.
|
|
22
|
-
* @param LoaderOptions
|
|
23
|
-
* @returns LoaderOptions
|
|
24
|
-
*/
|
|
25
|
-
useHash(options) {
|
|
26
|
-
const algorithm = createHash('sha1');
|
|
27
|
-
algorithm.update(options.__entity.toString());
|
|
28
|
-
algorithm.update(_(Object.keys(options.__from)).sort().join(''));
|
|
29
|
-
if (options.__seed)
|
|
30
|
-
algorithm.update(options.__seed);
|
|
31
|
-
if (options.__conditions)
|
|
32
|
-
algorithm.update(options.__conditions.toString());
|
|
33
|
-
return { ...options, __hash: algorithm.digest('hex') };
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* generate index by queried data primary keys, which is defined in loader option `__from`
|
|
37
|
-
* @param object
|
|
38
|
-
* @param LoaderOptions
|
|
39
|
-
* @returns Map<string, data>
|
|
40
|
-
*/
|
|
41
|
-
useIndex(data, { __hash, __from }) {
|
|
42
|
-
const fields = _(Object.keys(__from)).sort();
|
|
43
|
-
return `${__hash}_${fields.map((field) => data[field]).join('_')}`;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* resolve a `__from` property name to the physical column it is stored in.
|
|
47
|
-
*
|
|
48
|
-
* TypeORM's `FindOptionsWhere` only accepts real column properties. A
|
|
49
|
-
* `@RelationId()` property — e.g. `LocationEntityClass.parentId`, which mirrors
|
|
50
|
-
* the `parent` tree relation — is virtual and is rejected with
|
|
51
|
-
* `EntityPropertyNotFoundError`, even though it is backed by the relation's
|
|
52
|
-
* join column. Map those back to their join column so they stay batchable.
|
|
53
|
-
* @param EntityMetadata
|
|
54
|
-
* @param string
|
|
55
|
-
* @returns string | null
|
|
56
|
-
*/
|
|
57
|
-
resolveColumnName(metadata, propertyName) {
|
|
58
|
-
const column = metadata.findColumnWithPropertyName(propertyName);
|
|
59
|
-
if (column)
|
|
60
|
-
return column.databaseName;
|
|
61
|
-
const relationId = metadata.relationIds.find((candidate) => candidate.propertyName === propertyName);
|
|
62
|
-
const joinColumns = relationId?.relation.joinColumns ?? [];
|
|
63
|
-
return joinColumns.length === 1 ? joinColumns[0].databaseName : null;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* build the where clause for `__from` keys that TypeORM's find options cannot
|
|
67
|
-
* express (see {@link resolveColumnName}), by addressing the columns directly.
|
|
68
|
-
* @param SelectQueryBuilder
|
|
69
|
-
* @param EntityMetadata
|
|
70
|
-
* @param LoaderOptions[]
|
|
71
|
-
* @param (keyof T)[]
|
|
72
|
-
*/
|
|
73
|
-
applyColumnWhere(qb, metadata, options, primaryKeys) {
|
|
74
|
-
const columns = primaryKeys.map((primaryKey) => {
|
|
75
|
-
const columnName = this.resolveColumnName(metadata, String(primaryKey));
|
|
76
|
-
if (!columnName)
|
|
77
|
-
throw new Error(`Loader cannot resolve property "${String(primaryKey)}" to a column of "${metadata.name}".`);
|
|
78
|
-
return {
|
|
79
|
-
primaryKey,
|
|
80
|
-
column: `entity.${this.dataSource.driver.escape(columnName)}`,
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
if (columns.length === 1) {
|
|
84
|
-
const [{ primaryKey, column }] = columns;
|
|
85
|
-
qb.andWhere(`${column} IN (:...wmsLoaderValues)`, {
|
|
86
|
-
wmsLoaderValues: options.map(({ __from }) => __from[primaryKey]),
|
|
87
|
-
});
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
qb.andWhere(new Brackets((where) => {
|
|
91
|
-
options.forEach(({ __from }, optionIndex) => {
|
|
92
|
-
const parameters = {};
|
|
93
|
-
const predicate = columns
|
|
94
|
-
.map(({ primaryKey, column }, columnIndex) => {
|
|
95
|
-
const parameter = `wmsLoaderValue_${optionIndex}_${columnIndex}`;
|
|
96
|
-
parameters[parameter] = __from[primaryKey];
|
|
97
|
-
return `${column} = :${parameter}`;
|
|
98
|
-
})
|
|
99
|
-
.join(' AND ');
|
|
100
|
-
where.orWhere(`(${predicate})`, parameters);
|
|
101
|
-
});
|
|
102
|
-
}));
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* query data by collecting primary keys from options with same `__entity`
|
|
106
|
-
* @param LoaderOptions[]
|
|
107
|
-
* @returns object[]
|
|
108
|
-
*/
|
|
109
|
-
async core(options) {
|
|
110
|
-
const [{ __entity, __from, __conditions }] = options;
|
|
111
|
-
const repo = this.dataSource.getRepository(__entity);
|
|
112
|
-
let qb = repo.createQueryBuilder('entity');
|
|
113
|
-
const primaryKeys = Object.keys(__from);
|
|
114
|
-
const hasVirtualKey = primaryKeys.some((primaryKey) => !repo.metadata.findColumnWithPropertyName(String(primaryKey)));
|
|
115
|
-
if (hasVirtualKey)
|
|
116
|
-
this.applyColumnWhere(qb, repo.metadata, options, primaryKeys);
|
|
117
|
-
else if (primaryKeys.length > 1)
|
|
118
|
-
qb.setFindOptions({ where: options.map(({ __from }) => __from) });
|
|
119
|
-
else {
|
|
120
|
-
const [primaryKey] = primaryKeys;
|
|
121
|
-
qb.setFindOptions({
|
|
122
|
-
where: {
|
|
123
|
-
[primaryKey]: In(options.map(({ __from }) => __from[primaryKey])),
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
if (__conditions)
|
|
128
|
-
qb = __conditions(qb);
|
|
129
|
-
return qb.getMany();
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* batch single entity to load function calls.
|
|
133
|
-
* @returns object
|
|
134
|
-
*/
|
|
135
|
-
batchEntity() {
|
|
136
|
-
return new DataLoader(async (inputs) => {
|
|
137
|
-
const options = inputs.map((input) => this.useHash(input));
|
|
138
|
-
const dataMap = new Map();
|
|
139
|
-
const processMap = _(options)
|
|
140
|
-
.groupBy((x) => x.__hash)
|
|
141
|
-
.value();
|
|
142
|
-
await Promise.all(Object.keys(processMap).map(async (entityHash) => {
|
|
143
|
-
const options = processMap[entityHash];
|
|
144
|
-
const [option] = options;
|
|
145
|
-
const entities = await this.core(options);
|
|
146
|
-
entities.map((entity) => dataMap.set(this.useIndex(entity, option), entity));
|
|
147
|
-
}));
|
|
148
|
-
return options.map((option) => dataMap.get(this.useIndex(option.__from, option)));
|
|
149
|
-
}, {
|
|
150
|
-
batchScheduleFn: (callback) => setTimeout(callback, 50),
|
|
151
|
-
cacheKeyFn: (option) => this.useIndex(option.__from, this.useHash(option)),
|
|
152
|
-
cacheMap: this.cache,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* batch many entities to load function calls.
|
|
157
|
-
* @returns object[]
|
|
158
|
-
*/
|
|
159
|
-
batchEntities() {
|
|
160
|
-
return new DataLoader(async (inputs) => {
|
|
161
|
-
const options = inputs.map((input) => this.useHash(input));
|
|
162
|
-
const dataMap = new Map();
|
|
163
|
-
const processMap = _(options)
|
|
164
|
-
.groupBy((x) => x.__hash)
|
|
165
|
-
.value();
|
|
166
|
-
await Promise.all(Object.keys(processMap).map(async (entityHash) => {
|
|
167
|
-
const options = processMap[entityHash];
|
|
168
|
-
const [option] = options;
|
|
169
|
-
const entities = await this.core(options);
|
|
170
|
-
entities.map((entity) => {
|
|
171
|
-
const index = this.useIndex(entity, option);
|
|
172
|
-
const entities = dataMap.get(index) ?? [];
|
|
173
|
-
entities.push(entity);
|
|
174
|
-
dataMap.set(index, entities);
|
|
175
|
-
});
|
|
176
|
-
}));
|
|
177
|
-
return options.map((option) => {
|
|
178
|
-
const result = dataMap.get(this.useIndex(option.__from, option)) ?? [];
|
|
179
|
-
return option.__pagination
|
|
180
|
-
? result.slice(option.__pagination.offset, option.__pagination.offset + option.__pagination.limit)
|
|
181
|
-
: result;
|
|
182
|
-
});
|
|
183
|
-
}, {
|
|
184
|
-
batchScheduleFn: (callback) => setTimeout(callback, 100),
|
|
185
|
-
cacheKeyFn: (option) => this.useIndex(option.__from, this.useHash(option)),
|
|
186
|
-
cacheMap: this.cache,
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
batchEntitiesWithPagination() {
|
|
190
|
-
return new DataLoader(async (inputs) => {
|
|
191
|
-
const options = inputs.map((input) => this.useHash(input));
|
|
192
|
-
const dataMap = new Map();
|
|
193
|
-
const processMap = _(options)
|
|
194
|
-
.groupBy((x) => x.__hash)
|
|
195
|
-
.value();
|
|
196
|
-
await Promise.all(Object.keys(processMap).map(async (entityHash) => {
|
|
197
|
-
const options = processMap[entityHash];
|
|
198
|
-
const [option] = options;
|
|
199
|
-
const entities = await this.core(options);
|
|
200
|
-
entities.map((entity) => {
|
|
201
|
-
const index = this.useIndex(entity, option);
|
|
202
|
-
const entities = dataMap.get(index) ?? [];
|
|
203
|
-
entities.push(entity);
|
|
204
|
-
dataMap.set(index, entities);
|
|
205
|
-
});
|
|
206
|
-
}));
|
|
207
|
-
return options.map((option) => {
|
|
208
|
-
const result = dataMap.get(this.useIndex(option.__from, option));
|
|
209
|
-
if (!result)
|
|
210
|
-
return { items: [], total: 0 };
|
|
211
|
-
return {
|
|
212
|
-
items: option.__pagination
|
|
213
|
-
? result.slice(option.__pagination.offset, option.__pagination.offset + option.__pagination.limit)
|
|
214
|
-
: result,
|
|
215
|
-
total: result.length,
|
|
216
|
-
};
|
|
217
|
-
});
|
|
218
|
-
}, {
|
|
219
|
-
batchScheduleFn: (callback) => setTimeout(callback, 100),
|
|
220
|
-
cacheKeyFn: (option) => this.useIndex(option.__from, this.useHash(option)),
|
|
221
|
-
cacheMap: this.cache,
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
LoaderService = __decorate([
|
|
226
|
-
Injectable(),
|
|
227
|
-
__metadata("design:paramtypes", [DataSource])
|
|
228
|
-
], LoaderService);
|
|
229
|
-
|
|
230
|
-
export { LoaderService };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { createParamDecorator } from '@nestjs/common';
|
|
2
|
-
import { GqlExecutionContext } from '@nestjs/graphql';
|
|
3
|
-
import _ from 'lodash';
|
|
4
|
-
|
|
5
|
-
createParamDecorator((data, context) => {
|
|
6
|
-
if (context.getType().toString() === 'graphql') {
|
|
7
|
-
const ctx = GqlExecutionContext.create(context).getInfo();
|
|
8
|
-
const extractPath = ({ prev, key }, paths) => {
|
|
9
|
-
if (key && _.isString(key))
|
|
10
|
-
paths.unshift(key);
|
|
11
|
-
if (prev)
|
|
12
|
-
return extractPath(prev, paths);
|
|
13
|
-
return paths;
|
|
14
|
-
};
|
|
15
|
-
const paths = extractPath(ctx.path, []);
|
|
16
|
-
return paths.join('/');
|
|
17
|
-
}
|
|
18
|
-
return null;
|
|
19
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from 'tslib';
|
|
2
|
-
import { Field, ID, Int, InputType } from '@nestjs/graphql';
|
|
3
|
-
|
|
4
|
-
let CancelShipOrderArgs = class CancelShipOrderArgs {
|
|
5
|
-
itemId;
|
|
6
|
-
quantity;
|
|
7
|
-
};
|
|
8
|
-
__decorate([
|
|
9
|
-
Field(() => ID),
|
|
10
|
-
__metadata("design:type", String)
|
|
11
|
-
], CancelShipOrderArgs.prototype, "itemId", void 0);
|
|
12
|
-
__decorate([
|
|
13
|
-
Field(() => Int, { nullable: true }),
|
|
14
|
-
__metadata("design:type", Number)
|
|
15
|
-
], CancelShipOrderArgs.prototype, "quantity", void 0);
|
|
16
|
-
CancelShipOrderArgs = __decorate([
|
|
17
|
-
InputType()
|
|
18
|
-
], CancelShipOrderArgs);
|
|
19
|
-
|
|
20
|
-
export { CancelShipOrderArgs };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from 'tslib';
|
|
2
|
-
import { Field, ID, Int, InputType } from '@nestjs/graphql';
|
|
3
|
-
|
|
4
|
-
let CancelTransferOrderArgs = class CancelTransferOrderArgs {
|
|
5
|
-
itemId;
|
|
6
|
-
quantity;
|
|
7
|
-
};
|
|
8
|
-
__decorate([
|
|
9
|
-
Field(() => ID, { description: 'The ID of transfer order item' }),
|
|
10
|
-
__metadata("design:type", String)
|
|
11
|
-
], CancelTransferOrderArgs.prototype, "itemId", void 0);
|
|
12
|
-
__decorate([
|
|
13
|
-
Field(() => Int, {
|
|
14
|
-
nullable: true,
|
|
15
|
-
description: 'The quantity to cancel. If not provided, cancels all remaining cancellable quantity.',
|
|
16
|
-
}),
|
|
17
|
-
__metadata("design:type", Number)
|
|
18
|
-
], CancelTransferOrderArgs.prototype, "quantity", void 0);
|
|
19
|
-
CancelTransferOrderArgs = __decorate([
|
|
20
|
-
InputType()
|
|
21
|
-
], CancelTransferOrderArgs);
|
|
22
|
-
|
|
23
|
-
export { CancelTransferOrderArgs };
|