@rytass/wms-module-graphql 0.7.0 → 0.8.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 +11 -5
- package/docs/api-reference.md +5 -5
- package/index.cjs.js +140 -109
- package/lib/resolvers/aggregated-stock.resolver.d.ts +3 -11
- package/lib/resolvers/aggregated-stock.resolver.js +9 -18
- package/lib/resolvers/change-log.resolver.d.ts +8 -8
- package/lib/resolvers/change-log.resolver.js +13 -15
- package/lib/resolvers/loader.resolver.d.ts +10 -2
- package/lib/resolvers/loader.resolver.js +14 -4
- package/lib/resolvers/location.resolver.d.ts +10 -1
- package/lib/resolvers/location.resolver.js +17 -6
- package/lib/resolvers/receive-inventory-order.resolver.d.ts +8 -8
- package/lib/resolvers/receive-inventory-order.resolver.js +13 -15
- package/lib/resolvers/ship-inventory-order.resolver.d.ts +15 -15
- package/lib/resolvers/ship-inventory-order.resolver.js +26 -29
- package/lib/resolvers/stock.resolver.d.ts +8 -8
- package/lib/resolvers/stock.resolver.js +13 -15
- package/lib/resolvers/transfer-order.resolver.d.ts +17 -8
- package/lib/resolvers/transfer-order.resolver.js +29 -19
- package/lib/resolvers/warehouse-map.resolver.d.ts +10 -1
- package/lib/resolvers/warehouse-map.resolver.js +15 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -62,21 +62,27 @@ You register a **single** `GraphQLModule.forRootAsync(...)` of your own, mix you
|
|
|
62
62
|
|
|
63
63
|
`WmsModuleGraphqlModule` internally wires `WmsModuleCoreModule.forRootAsync` so you do not need to import the core module separately when using this package.
|
|
64
64
|
|
|
65
|
-
## Custom
|
|
65
|
+
## Custom entities
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
Every entity option `WMSBaseModuleOptions` exposes reaches all the way down, so a downstream project's own tables can *be* the WMS tables — every resolver's DataLoader resolves against them too:
|
|
68
68
|
|
|
69
69
|
```ts
|
|
70
70
|
WmsModuleGraphqlModule.forRootAsync({
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
useFactory: async () => ({
|
|
72
|
+
materialEntity: ItemMasterEntity, // a @ChildEntity() of MaterialEntityClass
|
|
73
|
+
batchEntity: LotEntity,
|
|
74
|
+
locationEntity: BinEntity,
|
|
75
|
+
stockEntity: LedgerEntryEntity,
|
|
76
|
+
orderEntity: MovementEntity,
|
|
77
|
+
warehouseMapEntity: FloorPlanEntity,
|
|
78
|
+
}),
|
|
73
79
|
defaultLoaderSerialId: 'DEFAULT',
|
|
74
80
|
defaultLoaderTypeKey: 'DEFAULT',
|
|
75
81
|
defaultLocationKey: 'DEFAULT',
|
|
76
82
|
});
|
|
77
83
|
```
|
|
78
84
|
|
|
79
|
-
Register
|
|
85
|
+
Override as few or as many as you like. Register them with TypeORM yourself (`TypeOrmModule.forFeature([...])`); the module checks at startup and refuses to boot if any is missing. Requires `@rytass/wms-base-nestjs-module` >= 0.4.0. See [`@rytass/wms-module-core`'s custom-entities guide](https://github.com/Rytass/WMS-Module/blob/main/libs/core/docs/custom-entities.md) for the single-table-inheritance caveats.
|
|
80
86
|
|
|
81
87
|
## Authorization
|
|
82
88
|
|
package/docs/api-reference.md
CHANGED
|
@@ -312,11 +312,11 @@ static forRootAsync(
|
|
|
312
312
|
// + WmsAuthModuleOptions:
|
|
313
313
|
// authChecker?: WmsAuthChecker — 選填;resolver 授權委派函式(見 Authorization)
|
|
314
314
|
//
|
|
315
|
-
// since 0.
|
|
316
|
-
// WMSBaseModuleOptions
|
|
317
|
-
//
|
|
318
|
-
// forRoot 與 async factory 皆支援;
|
|
319
|
-
//
|
|
315
|
+
// since 0.8.0(需 wms-base-nestjs-module >= 0.4.0):
|
|
316
|
+
// WMSBaseModuleOptions 的六個 entity 選項(material / batch / location /
|
|
317
|
+
// stock / order / warehouseMap)會一路作用到所有 resolver 的 DataLoader。
|
|
318
|
+
// 傳入對應 class 的 @ChildEntity() 即可,forRoot 與 async factory 皆支援;
|
|
319
|
+
// entity 需自行註冊給 TypeORM。詳見 core 的 docs/custom-entities.md。
|
|
320
320
|
): DynamicModule
|
|
321
321
|
```
|
|
322
322
|
|
package/index.cjs.js
CHANGED
|
@@ -12,7 +12,6 @@ var graphql = require('@nestjs/graphql');
|
|
|
12
12
|
var core = require('@nestjs/core');
|
|
13
13
|
var rxjs = require('rxjs');
|
|
14
14
|
var wmsBaseNestjsModule = require('@rytass/wms-base-nestjs-module');
|
|
15
|
-
var warehouseMap_entity = require('@rytass/wms-base-nestjs-module/models/warehouse-map.entity');
|
|
16
15
|
|
|
17
16
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
17
|
|
|
@@ -3137,8 +3136,17 @@ Locations = tslib.__decorate([
|
|
|
3137
3136
|
], Locations);
|
|
3138
3137
|
|
|
3139
3138
|
let LoaderResolver = class LoaderResolver {
|
|
3139
|
+
entities;
|
|
3140
3140
|
stockService;
|
|
3141
|
-
|
|
3141
|
+
/**
|
|
3142
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
3143
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
3144
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
3145
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
3146
|
+
* override.
|
|
3147
|
+
*/
|
|
3148
|
+
constructor(entities, stockService) {
|
|
3149
|
+
this.entities = entities;
|
|
3142
3150
|
this.stockService = stockService;
|
|
3143
3151
|
}
|
|
3144
3152
|
type({ typeId }, { loaders }) {
|
|
@@ -3149,7 +3157,7 @@ let LoaderResolver = class LoaderResolver {
|
|
|
3149
3157
|
}
|
|
3150
3158
|
location({ locationId }, { loaders }) {
|
|
3151
3159
|
return loaders.batchSingle.load({
|
|
3152
|
-
__entity:
|
|
3160
|
+
__entity: this.entities.location,
|
|
3153
3161
|
__from: { id: locationId },
|
|
3154
3162
|
});
|
|
3155
3163
|
}
|
|
@@ -3188,7 +3196,8 @@ tslib.__decorate([
|
|
|
3188
3196
|
], LoaderResolver.prototype, "totalQuantity", null);
|
|
3189
3197
|
LoaderResolver = tslib.__decorate([
|
|
3190
3198
|
graphql.Resolver(() => LoaderDto),
|
|
3191
|
-
tslib.__metadata("design:paramtypes", [wmsModuleCore.
|
|
3199
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities,
|
|
3200
|
+
wmsModuleCore.StockService])
|
|
3192
3201
|
], LoaderResolver);
|
|
3193
3202
|
|
|
3194
3203
|
let UnitDto = class UnitDto {
|
|
@@ -3283,32 +3292,32 @@ Batches = tslib.__decorate([
|
|
|
3283
3292
|
], Batches);
|
|
3284
3293
|
|
|
3285
3294
|
let StockResolver = class StockResolver {
|
|
3286
|
-
|
|
3295
|
+
entities;
|
|
3287
3296
|
/**
|
|
3288
|
-
*
|
|
3289
|
-
*
|
|
3290
|
-
*
|
|
3291
|
-
*
|
|
3292
|
-
*
|
|
3297
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
3298
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
3299
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
3300
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
3301
|
+
* override.
|
|
3293
3302
|
*/
|
|
3294
|
-
constructor(
|
|
3295
|
-
this.
|
|
3303
|
+
constructor(entities) {
|
|
3304
|
+
this.entities = entities;
|
|
3296
3305
|
}
|
|
3297
3306
|
material({ materialId }, { loaders }) {
|
|
3298
3307
|
return loaders.batchSingle.load({
|
|
3299
|
-
__entity: this.
|
|
3308
|
+
__entity: this.entities.material,
|
|
3300
3309
|
__from: { id: materialId },
|
|
3301
3310
|
});
|
|
3302
3311
|
}
|
|
3303
3312
|
location({ locationId }, { loaders }) {
|
|
3304
3313
|
return loaders.batchSingle.load({
|
|
3305
|
-
__entity:
|
|
3314
|
+
__entity: this.entities.location,
|
|
3306
3315
|
__from: { id: locationId },
|
|
3307
3316
|
});
|
|
3308
3317
|
}
|
|
3309
3318
|
async batch({ batchId }, { loaders }) {
|
|
3310
3319
|
const { groupId } = await loaders.batchSingle.load({
|
|
3311
|
-
__entity:
|
|
3320
|
+
__entity: this.entities.batch,
|
|
3312
3321
|
__from: { id: batchId },
|
|
3313
3322
|
});
|
|
3314
3323
|
return loaders.batchSingle.load({
|
|
@@ -3343,8 +3352,7 @@ tslib.__decorate([
|
|
|
3343
3352
|
], StockResolver.prototype, "batch", null);
|
|
3344
3353
|
StockResolver = tslib.__decorate([
|
|
3345
3354
|
graphql.Resolver(() => StockDto),
|
|
3346
|
-
tslib.
|
|
3347
|
-
tslib.__metadata("design:paramtypes", [Function])
|
|
3355
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
3348
3356
|
], StockResolver);
|
|
3349
3357
|
|
|
3350
3358
|
var MapRangeType;
|
|
@@ -3671,9 +3679,20 @@ WarehouseMapMutation = tslib.__decorate([
|
|
|
3671
3679
|
], WarehouseMapMutation);
|
|
3672
3680
|
|
|
3673
3681
|
let LocationResolver = class LocationResolver {
|
|
3682
|
+
entities;
|
|
3683
|
+
/**
|
|
3684
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
3685
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
3686
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
3687
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
3688
|
+
* override.
|
|
3689
|
+
*/
|
|
3690
|
+
constructor(entities) {
|
|
3691
|
+
this.entities = entities;
|
|
3692
|
+
}
|
|
3674
3693
|
async mapData({ id }, { loaders }) {
|
|
3675
3694
|
const map = await loaders.batchSingle.load({
|
|
3676
|
-
__entity:
|
|
3695
|
+
__entity: this.entities.warehouseMap,
|
|
3677
3696
|
__from: { id },
|
|
3678
3697
|
});
|
|
3679
3698
|
return map?.mapData || null;
|
|
@@ -3682,7 +3701,7 @@ let LocationResolver = class LocationResolver {
|
|
|
3682
3701
|
if (!parentId)
|
|
3683
3702
|
return null;
|
|
3684
3703
|
return loaders.batchSingle.load({
|
|
3685
|
-
__entity:
|
|
3704
|
+
__entity: this.entities.location,
|
|
3686
3705
|
__from: { id: parentId },
|
|
3687
3706
|
});
|
|
3688
3707
|
}
|
|
@@ -3697,7 +3716,7 @@ let LocationResolver = class LocationResolver {
|
|
|
3697
3716
|
*/
|
|
3698
3717
|
children({ id }, { loaders }) {
|
|
3699
3718
|
return loaders.batchMany.load({
|
|
3700
|
-
__entity:
|
|
3719
|
+
__entity: this.entities.location,
|
|
3701
3720
|
__from: { parentId: id },
|
|
3702
3721
|
__conditions: (qb) => qb.orderBy('entity."key"', 'ASC'),
|
|
3703
3722
|
});
|
|
@@ -3728,7 +3747,8 @@ tslib.__decorate([
|
|
|
3728
3747
|
tslib.__metadata("design:returntype", Promise)
|
|
3729
3748
|
], LocationResolver.prototype, "children", null);
|
|
3730
3749
|
LocationResolver = tslib.__decorate([
|
|
3731
|
-
graphql.Resolver(() => LocationDto)
|
|
3750
|
+
graphql.Resolver(() => LocationDto),
|
|
3751
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
3732
3752
|
], LocationResolver);
|
|
3733
3753
|
|
|
3734
3754
|
let FindLocationArgs = class FindLocationArgs extends PaginationArgs {
|
|
@@ -3918,31 +3938,23 @@ UnitQuery = tslib.__decorate([
|
|
|
3918
3938
|
|
|
3919
3939
|
let AggregatedStockResolver = class AggregatedStockResolver {
|
|
3920
3940
|
stockService;
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
* `materialEntity` is bound to the `MaterialEntity` Symbol, so the DataLoader
|
|
3924
|
-
* queries whichever material entity the consumer configured — the built-in
|
|
3925
|
-
* `MaterialEntityClass` unless `materialEntity` was passed to
|
|
3926
|
-
* `forRoot`/`forRootAsync`. Loading the built-in class outright would filter on
|
|
3927
|
-
* its single-table-inheritance discriminator and resolve nothing for a custom
|
|
3928
|
-
* entity.
|
|
3929
|
-
*/
|
|
3930
|
-
constructor(stockService, materialEntity) {
|
|
3941
|
+
entities;
|
|
3942
|
+
constructor(stockService, entities) {
|
|
3931
3943
|
this.stockService = stockService;
|
|
3932
|
-
this.
|
|
3944
|
+
this.entities = entities;
|
|
3933
3945
|
}
|
|
3934
3946
|
async id(stock) {
|
|
3935
3947
|
return this.stockService.generatedAggregateKey(stock);
|
|
3936
3948
|
}
|
|
3937
3949
|
async material({ materialId }, { loaders }) {
|
|
3938
3950
|
return loaders.batchSingle.load({
|
|
3939
|
-
__entity: this.
|
|
3951
|
+
__entity: this.entities.material,
|
|
3940
3952
|
__from: { id: materialId },
|
|
3941
3953
|
});
|
|
3942
3954
|
}
|
|
3943
3955
|
async batch({ batchId }, { loaders }) {
|
|
3944
3956
|
const { groupId } = await loaders.batchSingle.load({
|
|
3945
|
-
__entity:
|
|
3957
|
+
__entity: this.entities.batch,
|
|
3946
3958
|
__from: { id: batchId },
|
|
3947
3959
|
});
|
|
3948
3960
|
return loaders.batchSingle.load({
|
|
@@ -3952,7 +3964,7 @@ let AggregatedStockResolver = class AggregatedStockResolver {
|
|
|
3952
3964
|
}
|
|
3953
3965
|
async location({ locationId }, { loaders }) {
|
|
3954
3966
|
return loaders.batchSingle.load({
|
|
3955
|
-
__entity:
|
|
3967
|
+
__entity: this.entities.location,
|
|
3956
3968
|
__from: { id: locationId },
|
|
3957
3969
|
});
|
|
3958
3970
|
}
|
|
@@ -4004,8 +4016,8 @@ tslib.__decorate([
|
|
|
4004
4016
|
], AggregatedStockResolver.prototype, "loader", null);
|
|
4005
4017
|
AggregatedStockResolver = tslib.__decorate([
|
|
4006
4018
|
graphql.Resolver(() => AggregatedStockDto),
|
|
4007
|
-
tslib.
|
|
4008
|
-
|
|
4019
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.StockService,
|
|
4020
|
+
wmsModuleCore.WmsEntities])
|
|
4009
4021
|
], AggregatedStockResolver);
|
|
4010
4022
|
|
|
4011
4023
|
let CreateTransferOrderItemArgs = class CreateTransferOrderItemArgs {
|
|
@@ -4330,6 +4342,17 @@ TransferOrderQuery = tslib.__decorate([
|
|
|
4330
4342
|
], TransferOrderQuery);
|
|
4331
4343
|
|
|
4332
4344
|
let TransferOrderResolver = class TransferOrderResolver {
|
|
4345
|
+
entities;
|
|
4346
|
+
/**
|
|
4347
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
4348
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
4349
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
4350
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
4351
|
+
* override.
|
|
4352
|
+
*/
|
|
4353
|
+
constructor(entities) {
|
|
4354
|
+
this.entities = entities;
|
|
4355
|
+
}
|
|
4333
4356
|
items({ id }, { loaders }) {
|
|
4334
4357
|
return loaders.batchMany.load({
|
|
4335
4358
|
__entity: wmsModuleCore.TransferOrderItemEntityClass,
|
|
@@ -4344,7 +4367,7 @@ let TransferOrderResolver = class TransferOrderResolver {
|
|
|
4344
4367
|
if (!item?.targetLocationId)
|
|
4345
4368
|
return null;
|
|
4346
4369
|
return locationLoader.loaders.batchSingle.load({
|
|
4347
|
-
__entity:
|
|
4370
|
+
__entity: this.entities.location,
|
|
4348
4371
|
__from: { id: item.targetLocationId },
|
|
4349
4372
|
});
|
|
4350
4373
|
}
|
|
@@ -4388,23 +4411,24 @@ tslib.__decorate([
|
|
|
4388
4411
|
tslib.__metadata("design:returntype", Promise)
|
|
4389
4412
|
], TransferOrderResolver.prototype, "targetLoader", null);
|
|
4390
4413
|
TransferOrderResolver = tslib.__decorate([
|
|
4391
|
-
graphql.Resolver(() => TransferOrderDto)
|
|
4414
|
+
graphql.Resolver(() => TransferOrderDto),
|
|
4415
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
4392
4416
|
], TransferOrderResolver);
|
|
4393
4417
|
let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
4394
|
-
|
|
4418
|
+
entities;
|
|
4395
4419
|
/**
|
|
4396
|
-
*
|
|
4397
|
-
*
|
|
4398
|
-
*
|
|
4399
|
-
*
|
|
4400
|
-
*
|
|
4420
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
4421
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
4422
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
4423
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
4424
|
+
* override.
|
|
4401
4425
|
*/
|
|
4402
|
-
constructor(
|
|
4403
|
-
this.
|
|
4426
|
+
constructor(entities) {
|
|
4427
|
+
this.entities = entities;
|
|
4404
4428
|
}
|
|
4405
4429
|
material({ materialId }, { loaders }) {
|
|
4406
4430
|
return loaders.batchSingle.load({
|
|
4407
|
-
__entity: this.
|
|
4431
|
+
__entity: this.entities.material,
|
|
4408
4432
|
__from: { id: materialId },
|
|
4409
4433
|
});
|
|
4410
4434
|
}
|
|
@@ -4412,7 +4436,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
|
4412
4436
|
if (!batchId)
|
|
4413
4437
|
return null;
|
|
4414
4438
|
const { groupId } = await loaders.batchSingle.load({
|
|
4415
|
-
__entity:
|
|
4439
|
+
__entity: this.entities.batch,
|
|
4416
4440
|
__from: { id: batchId },
|
|
4417
4441
|
});
|
|
4418
4442
|
return loaders.batchSingle.load({
|
|
@@ -4424,7 +4448,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
|
4424
4448
|
if (!locationId)
|
|
4425
4449
|
return null;
|
|
4426
4450
|
return loaders.batchSingle.load({
|
|
4427
|
-
__entity:
|
|
4451
|
+
__entity: this.entities.location,
|
|
4428
4452
|
__from: { id: locationId },
|
|
4429
4453
|
});
|
|
4430
4454
|
}
|
|
@@ -4441,7 +4465,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
|
4441
4465
|
return null;
|
|
4442
4466
|
return loaders.batchSingle
|
|
4443
4467
|
.load({
|
|
4444
|
-
__entity:
|
|
4468
|
+
__entity: this.entities.batch,
|
|
4445
4469
|
__from: { id: batchId },
|
|
4446
4470
|
})
|
|
4447
4471
|
.then((batch) => batch.saleId);
|
|
@@ -4451,7 +4475,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
|
4451
4475
|
return null;
|
|
4452
4476
|
return loaders.batchSingle
|
|
4453
4477
|
.load({
|
|
4454
|
-
__entity:
|
|
4478
|
+
__entity: this.entities.batch,
|
|
4455
4479
|
__from: { id: batchId },
|
|
4456
4480
|
})
|
|
4457
4481
|
.then((batch) => batch.saleSerialId);
|
|
@@ -4525,8 +4549,7 @@ tslib.__decorate([
|
|
|
4525
4549
|
], TransferOrderItemResolver.prototype, "transferredQuantity", null);
|
|
4526
4550
|
TransferOrderItemResolver = tslib.__decorate([
|
|
4527
4551
|
graphql.Resolver(() => TransferOrderItemDto),
|
|
4528
|
-
tslib.
|
|
4529
|
-
tslib.__metadata("design:paramtypes", [Function])
|
|
4552
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
4530
4553
|
], TransferOrderItemResolver);
|
|
4531
4554
|
|
|
4532
4555
|
let CreateHoldInventoryOrderItemArgs = class CreateHoldInventoryOrderItemArgs {
|
|
@@ -4822,32 +4845,32 @@ BatchQuery = tslib.__decorate([
|
|
|
4822
4845
|
], BatchQuery);
|
|
4823
4846
|
|
|
4824
4847
|
let ChangeLogResolver = class ChangeLogResolver {
|
|
4825
|
-
|
|
4848
|
+
entities;
|
|
4826
4849
|
/**
|
|
4827
|
-
*
|
|
4828
|
-
*
|
|
4829
|
-
*
|
|
4830
|
-
*
|
|
4831
|
-
*
|
|
4850
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
4851
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
4852
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
4853
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
4854
|
+
* override.
|
|
4832
4855
|
*/
|
|
4833
|
-
constructor(
|
|
4834
|
-
this.
|
|
4856
|
+
constructor(entities) {
|
|
4857
|
+
this.entities = entities;
|
|
4835
4858
|
}
|
|
4836
4859
|
material({ materialId }, { loaders }) {
|
|
4837
4860
|
return loaders.batchSingle.load({
|
|
4838
|
-
__entity: this.
|
|
4861
|
+
__entity: this.entities.material,
|
|
4839
4862
|
__from: { id: materialId },
|
|
4840
4863
|
});
|
|
4841
4864
|
}
|
|
4842
4865
|
location({ locationId }, { loaders }) {
|
|
4843
4866
|
return loaders.batchSingle.load({
|
|
4844
|
-
__entity:
|
|
4867
|
+
__entity: this.entities.location,
|
|
4845
4868
|
__from: { id: locationId },
|
|
4846
4869
|
});
|
|
4847
4870
|
}
|
|
4848
4871
|
async batch({ batchId }, { loaders }) {
|
|
4849
4872
|
const { groupId } = await loaders.batchSingle.load({
|
|
4850
|
-
__entity:
|
|
4873
|
+
__entity: this.entities.batch,
|
|
4851
4874
|
__from: { id: batchId },
|
|
4852
4875
|
});
|
|
4853
4876
|
return loaders.batchSingle.load({
|
|
@@ -4882,8 +4905,7 @@ tslib.__decorate([
|
|
|
4882
4905
|
], ChangeLogResolver.prototype, "batch", null);
|
|
4883
4906
|
ChangeLogResolver = tslib.__decorate([
|
|
4884
4907
|
graphql.Resolver(() => ChangeLogDto),
|
|
4885
|
-
tslib.
|
|
4886
|
-
tslib.__metadata("design:paramtypes", [Function])
|
|
4908
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
4887
4909
|
], ChangeLogResolver);
|
|
4888
4910
|
|
|
4889
4911
|
let ReceiveInventoryOrderResolver = class ReceiveInventoryOrderResolver {
|
|
@@ -4907,20 +4929,20 @@ ReceiveInventoryOrderResolver = tslib.__decorate([
|
|
|
4907
4929
|
graphql.Resolver(() => ReceiveInventoryOrderDto)
|
|
4908
4930
|
], ReceiveInventoryOrderResolver);
|
|
4909
4931
|
let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver {
|
|
4910
|
-
|
|
4932
|
+
entities;
|
|
4911
4933
|
/**
|
|
4912
|
-
*
|
|
4913
|
-
*
|
|
4914
|
-
*
|
|
4915
|
-
*
|
|
4916
|
-
*
|
|
4934
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
4935
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
4936
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
4937
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
4938
|
+
* override.
|
|
4917
4939
|
*/
|
|
4918
|
-
constructor(
|
|
4919
|
-
this.
|
|
4940
|
+
constructor(entities) {
|
|
4941
|
+
this.entities = entities;
|
|
4920
4942
|
}
|
|
4921
4943
|
material({ materialId }, { loaders }) {
|
|
4922
4944
|
return loaders.batchSingle.load({
|
|
4923
|
-
__entity: this.
|
|
4945
|
+
__entity: this.entities.material,
|
|
4924
4946
|
__from: { id: materialId },
|
|
4925
4947
|
});
|
|
4926
4948
|
}
|
|
@@ -4928,7 +4950,7 @@ let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver
|
|
|
4928
4950
|
if (!batchId)
|
|
4929
4951
|
return null;
|
|
4930
4952
|
const { groupId } = await loaders.batchSingle.load({
|
|
4931
|
-
__entity:
|
|
4953
|
+
__entity: this.entities.batch,
|
|
4932
4954
|
__from: { id: batchId },
|
|
4933
4955
|
});
|
|
4934
4956
|
return loaders.batchSingle.load({
|
|
@@ -4940,7 +4962,7 @@ let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver
|
|
|
4940
4962
|
if (!locationId)
|
|
4941
4963
|
return null;
|
|
4942
4964
|
return loaders.batchSingle.load({
|
|
4943
|
-
__entity:
|
|
4965
|
+
__entity: this.entities.location,
|
|
4944
4966
|
__from: { id: locationId },
|
|
4945
4967
|
});
|
|
4946
4968
|
}
|
|
@@ -5004,8 +5026,7 @@ tslib.__decorate([
|
|
|
5004
5026
|
], ReceiveInventoryOrderItemResolver.prototype, "receivedQuantity", null);
|
|
5005
5027
|
ReceiveInventoryOrderItemResolver = tslib.__decorate([
|
|
5006
5028
|
graphql.Resolver(() => ReceiveInventoryOrderItemDto),
|
|
5007
|
-
tslib.
|
|
5008
|
-
tslib.__metadata("design:paramtypes", [Function])
|
|
5029
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
5009
5030
|
], ReceiveInventoryOrderItemResolver);
|
|
5010
5031
|
|
|
5011
5032
|
let FindAllocateInventoryOrderArgs = class FindAllocateInventoryOrderArgs extends PaginationArgs {
|
|
@@ -5342,20 +5363,20 @@ ShipInventoryOrderResolver = tslib.__decorate([
|
|
|
5342
5363
|
graphql.Resolver(() => ShipInventoryOrderDto)
|
|
5343
5364
|
], ShipInventoryOrderResolver);
|
|
5344
5365
|
let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
5345
|
-
|
|
5366
|
+
entities;
|
|
5346
5367
|
/**
|
|
5347
|
-
*
|
|
5348
|
-
*
|
|
5349
|
-
*
|
|
5350
|
-
*
|
|
5351
|
-
*
|
|
5368
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
5369
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
5370
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
5371
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
5372
|
+
* override.
|
|
5352
5373
|
*/
|
|
5353
|
-
constructor(
|
|
5354
|
-
this.
|
|
5374
|
+
constructor(entities) {
|
|
5375
|
+
this.entities = entities;
|
|
5355
5376
|
}
|
|
5356
5377
|
material({ materialId }, { loaders }) {
|
|
5357
5378
|
return loaders.batchSingle.load({
|
|
5358
|
-
__entity: this.
|
|
5379
|
+
__entity: this.entities.material,
|
|
5359
5380
|
__from: { id: materialId },
|
|
5360
5381
|
});
|
|
5361
5382
|
}
|
|
@@ -5363,7 +5384,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
|
5363
5384
|
if (!batchId)
|
|
5364
5385
|
return null;
|
|
5365
5386
|
const { groupId } = await loaders.batchSingle.load({
|
|
5366
|
-
__entity:
|
|
5387
|
+
__entity: this.entities.batch,
|
|
5367
5388
|
__from: { id: batchId },
|
|
5368
5389
|
});
|
|
5369
5390
|
return loaders.batchSingle.load({
|
|
@@ -5375,7 +5396,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
|
5375
5396
|
if (!batchId)
|
|
5376
5397
|
return null;
|
|
5377
5398
|
const { groupId } = await loaders.batchSingle.load({
|
|
5378
|
-
__entity:
|
|
5399
|
+
__entity: this.entities.batch,
|
|
5379
5400
|
__from: { id: batchId },
|
|
5380
5401
|
});
|
|
5381
5402
|
return loaders.batchSingle
|
|
@@ -5389,7 +5410,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
|
5389
5410
|
if (!batchId)
|
|
5390
5411
|
return null;
|
|
5391
5412
|
const { groupId } = await loaders.batchSingle.load({
|
|
5392
|
-
__entity:
|
|
5413
|
+
__entity: this.entities.batch,
|
|
5393
5414
|
__from: { id: batchId },
|
|
5394
5415
|
});
|
|
5395
5416
|
return loaders.batchSingle
|
|
@@ -5403,7 +5424,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
|
5403
5424
|
if (!locationId)
|
|
5404
5425
|
return null;
|
|
5405
5426
|
return loaders.batchSingle.load({
|
|
5406
|
-
__entity:
|
|
5427
|
+
__entity: this.entities.location,
|
|
5407
5428
|
__from: { id: locationId },
|
|
5408
5429
|
});
|
|
5409
5430
|
}
|
|
@@ -5484,20 +5505,19 @@ tslib.__decorate([
|
|
|
5484
5505
|
], ShipInventoryOrderItemResolver.prototype, "shippedQuantity", null);
|
|
5485
5506
|
ShipInventoryOrderItemResolver = tslib.__decorate([
|
|
5486
5507
|
graphql.Resolver(() => ShipInventoryOrderItemDto),
|
|
5487
|
-
tslib.
|
|
5488
|
-
tslib.__metadata("design:paramtypes", [Function])
|
|
5508
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
5489
5509
|
], ShipInventoryOrderItemResolver);
|
|
5490
5510
|
let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResolver {
|
|
5491
|
-
|
|
5511
|
+
entities;
|
|
5492
5512
|
/**
|
|
5493
|
-
*
|
|
5494
|
-
*
|
|
5495
|
-
*
|
|
5496
|
-
*
|
|
5497
|
-
*
|
|
5513
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
5514
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
5515
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
5516
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
5517
|
+
* override.
|
|
5498
5518
|
*/
|
|
5499
|
-
constructor(
|
|
5500
|
-
this.
|
|
5519
|
+
constructor(entities) {
|
|
5520
|
+
this.entities = entities;
|
|
5501
5521
|
}
|
|
5502
5522
|
async shippedQuantity({ orderId, serialId }, { loaders }) {
|
|
5503
5523
|
const items = await loaders.batchMany.load({
|
|
@@ -5513,7 +5533,7 @@ let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResol
|
|
|
5513
5533
|
}
|
|
5514
5534
|
material({ materialId }, { loaders }) {
|
|
5515
5535
|
return loaders.batchSingle.load({
|
|
5516
|
-
__entity: this.
|
|
5536
|
+
__entity: this.entities.material,
|
|
5517
5537
|
__from: { id: materialId },
|
|
5518
5538
|
});
|
|
5519
5539
|
}
|
|
@@ -5521,7 +5541,7 @@ let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResol
|
|
|
5521
5541
|
if (!batchId)
|
|
5522
5542
|
return null;
|
|
5523
5543
|
const { groupId } = await loaders.batchSingle.load({
|
|
5524
|
-
__entity:
|
|
5544
|
+
__entity: this.entities.batch,
|
|
5525
5545
|
__from: { id: batchId },
|
|
5526
5546
|
});
|
|
5527
5547
|
return loaders.batchSingle.load({
|
|
@@ -5570,8 +5590,7 @@ tslib.__decorate([
|
|
|
5570
5590
|
], ShipInventoryOrderReferenceResolver.prototype, "items", null);
|
|
5571
5591
|
ShipInventoryOrderReferenceResolver = tslib.__decorate([
|
|
5572
5592
|
graphql.Resolver(() => ShipInventoryOrderReferenceDto),
|
|
5573
|
-
tslib.
|
|
5574
|
-
tslib.__metadata("design:paramtypes", [Function])
|
|
5593
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
5575
5594
|
], ShipInventoryOrderReferenceResolver);
|
|
5576
5595
|
|
|
5577
5596
|
let FindSaleOrderArgs = class FindSaleOrderArgs extends PaginationArgs {
|
|
@@ -6626,11 +6645,22 @@ WarehouseMapDataQuery = tslib.__decorate([
|
|
|
6626
6645
|
], WarehouseMapDataQuery);
|
|
6627
6646
|
|
|
6628
6647
|
let MapRangeUnionResolver = class MapRangeUnionResolver {
|
|
6648
|
+
entities;
|
|
6649
|
+
/**
|
|
6650
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
6651
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
6652
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
6653
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
6654
|
+
* override.
|
|
6655
|
+
*/
|
|
6656
|
+
constructor(entities) {
|
|
6657
|
+
this.entities = entities;
|
|
6658
|
+
}
|
|
6629
6659
|
location({ id }, { loaders }) {
|
|
6630
6660
|
if (!id)
|
|
6631
6661
|
return null;
|
|
6632
6662
|
return loaders.batchSingle.load({
|
|
6633
|
-
__entity:
|
|
6663
|
+
__entity: this.entities.location,
|
|
6634
6664
|
__from: { key: id },
|
|
6635
6665
|
});
|
|
6636
6666
|
}
|
|
@@ -6644,7 +6674,8 @@ tslib.__decorate([
|
|
|
6644
6674
|
tslib.__metadata("design:returntype", void 0)
|
|
6645
6675
|
], MapRangeUnionResolver.prototype, "location", null);
|
|
6646
6676
|
MapRangeUnionResolver = tslib.__decorate([
|
|
6647
|
-
graphql.Resolver(() => MapRangeDto)
|
|
6677
|
+
graphql.Resolver(() => MapRangeDto),
|
|
6678
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
6648
6679
|
], MapRangeUnionResolver);
|
|
6649
6680
|
|
|
6650
6681
|
var WmsModuleGraphqlModule_1;
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import { AggregatedStockDto, LoaderDto, MaterialDto } from '../dto';
|
|
2
2
|
import { type LoaderType } from '../helpers';
|
|
3
|
-
import { BatchEntityClass, LoadersEntityClass, LocationEntityClass, MaterialEntityClass, StockService } from '@rytass/wms-module-core';
|
|
3
|
+
import { BatchEntityClass, LoadersEntityClass, LocationEntityClass, MaterialEntityClass, StockService, WmsEntities } from '@rytass/wms-module-core';
|
|
4
4
|
import { BatchDto } from '../dto/batch.dto';
|
|
5
5
|
import { LocationDto } from '../dto/location.dto';
|
|
6
6
|
export declare class AggregatedStockResolver {
|
|
7
7
|
private readonly stockService;
|
|
8
|
-
private readonly
|
|
9
|
-
|
|
10
|
-
* `materialEntity` is bound to the `MaterialEntity` Symbol, so the DataLoader
|
|
11
|
-
* queries whichever material entity the consumer configured — the built-in
|
|
12
|
-
* `MaterialEntityClass` unless `materialEntity` was passed to
|
|
13
|
-
* `forRoot`/`forRootAsync`. Loading the built-in class outright would filter on
|
|
14
|
-
* its single-table-inheritance discriminator and resolve nothing for a custom
|
|
15
|
-
* entity.
|
|
16
|
-
*/
|
|
17
|
-
constructor(stockService: StockService, materialEntity: new () => MaterialEntityClass);
|
|
8
|
+
private readonly entities;
|
|
9
|
+
constructor(stockService: StockService, entities: WmsEntities);
|
|
18
10
|
id(stock: AggregatedStockDto): Promise<string>;
|
|
19
11
|
material({ materialId }: AggregatedStockDto, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
|
|
20
12
|
batch({ batchId }: AggregatedStockDto, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto>;
|