@rytass/wms-module-graphql 0.6.1 → 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 +22 -0
- package/docs/api-reference.md +6 -0
- package/index.cjs.js +164 -44
- package/lib/helpers/loader.service.d.ts +8 -2
- package/lib/resolvers/aggregated-stock.resolver.d.ts +3 -2
- package/lib/resolvers/aggregated-stock.resolver.js +9 -6
- package/lib/resolvers/change-log.resolver.d.ts +10 -1
- package/lib/resolvers/change-log.resolver.js +17 -5
- 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 +10 -1
- package/lib/resolvers/receive-inventory-order.resolver.js +17 -5
- package/lib/resolvers/ship-inventory-order.resolver.d.ts +19 -1
- package/lib/resolvers/ship-inventory-order.resolver.js +34 -10
- package/lib/resolvers/stock.resolver.d.ts +10 -1
- package/lib/resolvers/stock.resolver.js +17 -5
- package/lib/resolvers/transfer-order.resolver.d.ts +19 -1
- package/lib/resolvers/transfer-order.resolver.js +33 -9
- 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,6 +62,28 @@ 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 entities
|
|
66
|
+
|
|
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
|
+
|
|
69
|
+
```ts
|
|
70
|
+
WmsModuleGraphqlModule.forRootAsync({
|
|
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
|
+
}),
|
|
79
|
+
defaultLoaderSerialId: 'DEFAULT',
|
|
80
|
+
defaultLoaderTypeKey: 'DEFAULT',
|
|
81
|
+
defaultLocationKey: 'DEFAULT',
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
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.
|
|
86
|
+
|
|
65
87
|
## Authorization
|
|
66
88
|
|
|
67
89
|
Every WMS root `@Query` / `@Mutation` is annotated with `@WmsOperation({ resource, action })` — a **host-neutral** permission requirement enforced by the library's own route-level `WmsAuthGuard`, which delegates the allow/deny decision to an `authChecker` **you** supply. The library never imports your auth system; you map WMS's `resource`/`action` onto whatever you use (Casbin, RBAC, JWT scopes…).
|
package/docs/api-reference.md
CHANGED
|
@@ -311,6 +311,12 @@ static forRootAsync(
|
|
|
311
311
|
// defaultLocationKey: string — 預設儲存位置 key
|
|
312
312
|
// + WmsAuthModuleOptions:
|
|
313
313
|
// authChecker?: WmsAuthChecker — 選填;resolver 授權委派函式(見 Authorization)
|
|
314
|
+
//
|
|
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。
|
|
314
320
|
): DynamicModule
|
|
315
321
|
```
|
|
316
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,21 +3292,32 @@ Batches = tslib.__decorate([
|
|
|
3283
3292
|
], Batches);
|
|
3284
3293
|
|
|
3285
3294
|
let StockResolver = class StockResolver {
|
|
3295
|
+
entities;
|
|
3296
|
+
/**
|
|
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.
|
|
3302
|
+
*/
|
|
3303
|
+
constructor(entities) {
|
|
3304
|
+
this.entities = entities;
|
|
3305
|
+
}
|
|
3286
3306
|
material({ materialId }, { loaders }) {
|
|
3287
3307
|
return loaders.batchSingle.load({
|
|
3288
|
-
__entity:
|
|
3308
|
+
__entity: this.entities.material,
|
|
3289
3309
|
__from: { id: materialId },
|
|
3290
3310
|
});
|
|
3291
3311
|
}
|
|
3292
3312
|
location({ locationId }, { loaders }) {
|
|
3293
3313
|
return loaders.batchSingle.load({
|
|
3294
|
-
__entity:
|
|
3314
|
+
__entity: this.entities.location,
|
|
3295
3315
|
__from: { id: locationId },
|
|
3296
3316
|
});
|
|
3297
3317
|
}
|
|
3298
3318
|
async batch({ batchId }, { loaders }) {
|
|
3299
3319
|
const { groupId } = await loaders.batchSingle.load({
|
|
3300
|
-
__entity:
|
|
3320
|
+
__entity: this.entities.batch,
|
|
3301
3321
|
__from: { id: batchId },
|
|
3302
3322
|
});
|
|
3303
3323
|
return loaders.batchSingle.load({
|
|
@@ -3331,7 +3351,8 @@ tslib.__decorate([
|
|
|
3331
3351
|
tslib.__metadata("design:returntype", Promise)
|
|
3332
3352
|
], StockResolver.prototype, "batch", null);
|
|
3333
3353
|
StockResolver = tslib.__decorate([
|
|
3334
|
-
graphql.Resolver(() => StockDto)
|
|
3354
|
+
graphql.Resolver(() => StockDto),
|
|
3355
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
3335
3356
|
], StockResolver);
|
|
3336
3357
|
|
|
3337
3358
|
var MapRangeType;
|
|
@@ -3658,9 +3679,20 @@ WarehouseMapMutation = tslib.__decorate([
|
|
|
3658
3679
|
], WarehouseMapMutation);
|
|
3659
3680
|
|
|
3660
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
|
+
}
|
|
3661
3693
|
async mapData({ id }, { loaders }) {
|
|
3662
3694
|
const map = await loaders.batchSingle.load({
|
|
3663
|
-
__entity:
|
|
3695
|
+
__entity: this.entities.warehouseMap,
|
|
3664
3696
|
__from: { id },
|
|
3665
3697
|
});
|
|
3666
3698
|
return map?.mapData || null;
|
|
@@ -3669,7 +3701,7 @@ let LocationResolver = class LocationResolver {
|
|
|
3669
3701
|
if (!parentId)
|
|
3670
3702
|
return null;
|
|
3671
3703
|
return loaders.batchSingle.load({
|
|
3672
|
-
__entity:
|
|
3704
|
+
__entity: this.entities.location,
|
|
3673
3705
|
__from: { id: parentId },
|
|
3674
3706
|
});
|
|
3675
3707
|
}
|
|
@@ -3684,7 +3716,7 @@ let LocationResolver = class LocationResolver {
|
|
|
3684
3716
|
*/
|
|
3685
3717
|
children({ id }, { loaders }) {
|
|
3686
3718
|
return loaders.batchMany.load({
|
|
3687
|
-
__entity:
|
|
3719
|
+
__entity: this.entities.location,
|
|
3688
3720
|
__from: { parentId: id },
|
|
3689
3721
|
__conditions: (qb) => qb.orderBy('entity."key"', 'ASC'),
|
|
3690
3722
|
});
|
|
@@ -3715,7 +3747,8 @@ tslib.__decorate([
|
|
|
3715
3747
|
tslib.__metadata("design:returntype", Promise)
|
|
3716
3748
|
], LocationResolver.prototype, "children", null);
|
|
3717
3749
|
LocationResolver = tslib.__decorate([
|
|
3718
|
-
graphql.Resolver(() => LocationDto)
|
|
3750
|
+
graphql.Resolver(() => LocationDto),
|
|
3751
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
3719
3752
|
], LocationResolver);
|
|
3720
3753
|
|
|
3721
3754
|
let FindLocationArgs = class FindLocationArgs extends PaginationArgs {
|
|
@@ -3905,21 +3938,23 @@ UnitQuery = tslib.__decorate([
|
|
|
3905
3938
|
|
|
3906
3939
|
let AggregatedStockResolver = class AggregatedStockResolver {
|
|
3907
3940
|
stockService;
|
|
3908
|
-
|
|
3941
|
+
entities;
|
|
3942
|
+
constructor(stockService, entities) {
|
|
3909
3943
|
this.stockService = stockService;
|
|
3944
|
+
this.entities = entities;
|
|
3910
3945
|
}
|
|
3911
3946
|
async id(stock) {
|
|
3912
3947
|
return this.stockService.generatedAggregateKey(stock);
|
|
3913
3948
|
}
|
|
3914
3949
|
async material({ materialId }, { loaders }) {
|
|
3915
3950
|
return loaders.batchSingle.load({
|
|
3916
|
-
__entity:
|
|
3951
|
+
__entity: this.entities.material,
|
|
3917
3952
|
__from: { id: materialId },
|
|
3918
3953
|
});
|
|
3919
3954
|
}
|
|
3920
3955
|
async batch({ batchId }, { loaders }) {
|
|
3921
3956
|
const { groupId } = await loaders.batchSingle.load({
|
|
3922
|
-
__entity:
|
|
3957
|
+
__entity: this.entities.batch,
|
|
3923
3958
|
__from: { id: batchId },
|
|
3924
3959
|
});
|
|
3925
3960
|
return loaders.batchSingle.load({
|
|
@@ -3929,7 +3964,7 @@ let AggregatedStockResolver = class AggregatedStockResolver {
|
|
|
3929
3964
|
}
|
|
3930
3965
|
async location({ locationId }, { loaders }) {
|
|
3931
3966
|
return loaders.batchSingle.load({
|
|
3932
|
-
__entity:
|
|
3967
|
+
__entity: this.entities.location,
|
|
3933
3968
|
__from: { id: locationId },
|
|
3934
3969
|
});
|
|
3935
3970
|
}
|
|
@@ -3981,7 +4016,8 @@ tslib.__decorate([
|
|
|
3981
4016
|
], AggregatedStockResolver.prototype, "loader", null);
|
|
3982
4017
|
AggregatedStockResolver = tslib.__decorate([
|
|
3983
4018
|
graphql.Resolver(() => AggregatedStockDto),
|
|
3984
|
-
tslib.__metadata("design:paramtypes", [wmsModuleCore.StockService
|
|
4019
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.StockService,
|
|
4020
|
+
wmsModuleCore.WmsEntities])
|
|
3985
4021
|
], AggregatedStockResolver);
|
|
3986
4022
|
|
|
3987
4023
|
let CreateTransferOrderItemArgs = class CreateTransferOrderItemArgs {
|
|
@@ -4306,6 +4342,17 @@ TransferOrderQuery = tslib.__decorate([
|
|
|
4306
4342
|
], TransferOrderQuery);
|
|
4307
4343
|
|
|
4308
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
|
+
}
|
|
4309
4356
|
items({ id }, { loaders }) {
|
|
4310
4357
|
return loaders.batchMany.load({
|
|
4311
4358
|
__entity: wmsModuleCore.TransferOrderItemEntityClass,
|
|
@@ -4320,7 +4367,7 @@ let TransferOrderResolver = class TransferOrderResolver {
|
|
|
4320
4367
|
if (!item?.targetLocationId)
|
|
4321
4368
|
return null;
|
|
4322
4369
|
return locationLoader.loaders.batchSingle.load({
|
|
4323
|
-
__entity:
|
|
4370
|
+
__entity: this.entities.location,
|
|
4324
4371
|
__from: { id: item.targetLocationId },
|
|
4325
4372
|
});
|
|
4326
4373
|
}
|
|
@@ -4364,12 +4411,24 @@ tslib.__decorate([
|
|
|
4364
4411
|
tslib.__metadata("design:returntype", Promise)
|
|
4365
4412
|
], TransferOrderResolver.prototype, "targetLoader", null);
|
|
4366
4413
|
TransferOrderResolver = tslib.__decorate([
|
|
4367
|
-
graphql.Resolver(() => TransferOrderDto)
|
|
4414
|
+
graphql.Resolver(() => TransferOrderDto),
|
|
4415
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
4368
4416
|
], TransferOrderResolver);
|
|
4369
4417
|
let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
4418
|
+
entities;
|
|
4419
|
+
/**
|
|
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.
|
|
4425
|
+
*/
|
|
4426
|
+
constructor(entities) {
|
|
4427
|
+
this.entities = entities;
|
|
4428
|
+
}
|
|
4370
4429
|
material({ materialId }, { loaders }) {
|
|
4371
4430
|
return loaders.batchSingle.load({
|
|
4372
|
-
__entity:
|
|
4431
|
+
__entity: this.entities.material,
|
|
4373
4432
|
__from: { id: materialId },
|
|
4374
4433
|
});
|
|
4375
4434
|
}
|
|
@@ -4377,7 +4436,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
|
4377
4436
|
if (!batchId)
|
|
4378
4437
|
return null;
|
|
4379
4438
|
const { groupId } = await loaders.batchSingle.load({
|
|
4380
|
-
__entity:
|
|
4439
|
+
__entity: this.entities.batch,
|
|
4381
4440
|
__from: { id: batchId },
|
|
4382
4441
|
});
|
|
4383
4442
|
return loaders.batchSingle.load({
|
|
@@ -4389,7 +4448,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
|
4389
4448
|
if (!locationId)
|
|
4390
4449
|
return null;
|
|
4391
4450
|
return loaders.batchSingle.load({
|
|
4392
|
-
__entity:
|
|
4451
|
+
__entity: this.entities.location,
|
|
4393
4452
|
__from: { id: locationId },
|
|
4394
4453
|
});
|
|
4395
4454
|
}
|
|
@@ -4406,7 +4465,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
|
4406
4465
|
return null;
|
|
4407
4466
|
return loaders.batchSingle
|
|
4408
4467
|
.load({
|
|
4409
|
-
__entity:
|
|
4468
|
+
__entity: this.entities.batch,
|
|
4410
4469
|
__from: { id: batchId },
|
|
4411
4470
|
})
|
|
4412
4471
|
.then((batch) => batch.saleId);
|
|
@@ -4416,7 +4475,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
|
4416
4475
|
return null;
|
|
4417
4476
|
return loaders.batchSingle
|
|
4418
4477
|
.load({
|
|
4419
|
-
__entity:
|
|
4478
|
+
__entity: this.entities.batch,
|
|
4420
4479
|
__from: { id: batchId },
|
|
4421
4480
|
})
|
|
4422
4481
|
.then((batch) => batch.saleSerialId);
|
|
@@ -4489,7 +4548,8 @@ tslib.__decorate([
|
|
|
4489
4548
|
tslib.__metadata("design:returntype", Promise)
|
|
4490
4549
|
], TransferOrderItemResolver.prototype, "transferredQuantity", null);
|
|
4491
4550
|
TransferOrderItemResolver = tslib.__decorate([
|
|
4492
|
-
graphql.Resolver(() => TransferOrderItemDto)
|
|
4551
|
+
graphql.Resolver(() => TransferOrderItemDto),
|
|
4552
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
4493
4553
|
], TransferOrderItemResolver);
|
|
4494
4554
|
|
|
4495
4555
|
let CreateHoldInventoryOrderItemArgs = class CreateHoldInventoryOrderItemArgs {
|
|
@@ -4785,21 +4845,32 @@ BatchQuery = tslib.__decorate([
|
|
|
4785
4845
|
], BatchQuery);
|
|
4786
4846
|
|
|
4787
4847
|
let ChangeLogResolver = class ChangeLogResolver {
|
|
4848
|
+
entities;
|
|
4849
|
+
/**
|
|
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.
|
|
4855
|
+
*/
|
|
4856
|
+
constructor(entities) {
|
|
4857
|
+
this.entities = entities;
|
|
4858
|
+
}
|
|
4788
4859
|
material({ materialId }, { loaders }) {
|
|
4789
4860
|
return loaders.batchSingle.load({
|
|
4790
|
-
__entity:
|
|
4861
|
+
__entity: this.entities.material,
|
|
4791
4862
|
__from: { id: materialId },
|
|
4792
4863
|
});
|
|
4793
4864
|
}
|
|
4794
4865
|
location({ locationId }, { loaders }) {
|
|
4795
4866
|
return loaders.batchSingle.load({
|
|
4796
|
-
__entity:
|
|
4867
|
+
__entity: this.entities.location,
|
|
4797
4868
|
__from: { id: locationId },
|
|
4798
4869
|
});
|
|
4799
4870
|
}
|
|
4800
4871
|
async batch({ batchId }, { loaders }) {
|
|
4801
4872
|
const { groupId } = await loaders.batchSingle.load({
|
|
4802
|
-
__entity:
|
|
4873
|
+
__entity: this.entities.batch,
|
|
4803
4874
|
__from: { id: batchId },
|
|
4804
4875
|
});
|
|
4805
4876
|
return loaders.batchSingle.load({
|
|
@@ -4833,7 +4904,8 @@ tslib.__decorate([
|
|
|
4833
4904
|
tslib.__metadata("design:returntype", Promise)
|
|
4834
4905
|
], ChangeLogResolver.prototype, "batch", null);
|
|
4835
4906
|
ChangeLogResolver = tslib.__decorate([
|
|
4836
|
-
graphql.Resolver(() => ChangeLogDto)
|
|
4907
|
+
graphql.Resolver(() => ChangeLogDto),
|
|
4908
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
4837
4909
|
], ChangeLogResolver);
|
|
4838
4910
|
|
|
4839
4911
|
let ReceiveInventoryOrderResolver = class ReceiveInventoryOrderResolver {
|
|
@@ -4857,9 +4929,20 @@ ReceiveInventoryOrderResolver = tslib.__decorate([
|
|
|
4857
4929
|
graphql.Resolver(() => ReceiveInventoryOrderDto)
|
|
4858
4930
|
], ReceiveInventoryOrderResolver);
|
|
4859
4931
|
let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver {
|
|
4932
|
+
entities;
|
|
4933
|
+
/**
|
|
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.
|
|
4939
|
+
*/
|
|
4940
|
+
constructor(entities) {
|
|
4941
|
+
this.entities = entities;
|
|
4942
|
+
}
|
|
4860
4943
|
material({ materialId }, { loaders }) {
|
|
4861
4944
|
return loaders.batchSingle.load({
|
|
4862
|
-
__entity:
|
|
4945
|
+
__entity: this.entities.material,
|
|
4863
4946
|
__from: { id: materialId },
|
|
4864
4947
|
});
|
|
4865
4948
|
}
|
|
@@ -4867,7 +4950,7 @@ let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver
|
|
|
4867
4950
|
if (!batchId)
|
|
4868
4951
|
return null;
|
|
4869
4952
|
const { groupId } = await loaders.batchSingle.load({
|
|
4870
|
-
__entity:
|
|
4953
|
+
__entity: this.entities.batch,
|
|
4871
4954
|
__from: { id: batchId },
|
|
4872
4955
|
});
|
|
4873
4956
|
return loaders.batchSingle.load({
|
|
@@ -4879,7 +4962,7 @@ let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver
|
|
|
4879
4962
|
if (!locationId)
|
|
4880
4963
|
return null;
|
|
4881
4964
|
return loaders.batchSingle.load({
|
|
4882
|
-
__entity:
|
|
4965
|
+
__entity: this.entities.location,
|
|
4883
4966
|
__from: { id: locationId },
|
|
4884
4967
|
});
|
|
4885
4968
|
}
|
|
@@ -4942,7 +5025,8 @@ tslib.__decorate([
|
|
|
4942
5025
|
tslib.__metadata("design:returntype", Promise)
|
|
4943
5026
|
], ReceiveInventoryOrderItemResolver.prototype, "receivedQuantity", null);
|
|
4944
5027
|
ReceiveInventoryOrderItemResolver = tslib.__decorate([
|
|
4945
|
-
graphql.Resolver(() => ReceiveInventoryOrderItemDto)
|
|
5028
|
+
graphql.Resolver(() => ReceiveInventoryOrderItemDto),
|
|
5029
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
4946
5030
|
], ReceiveInventoryOrderItemResolver);
|
|
4947
5031
|
|
|
4948
5032
|
let FindAllocateInventoryOrderArgs = class FindAllocateInventoryOrderArgs extends PaginationArgs {
|
|
@@ -5279,9 +5363,20 @@ ShipInventoryOrderResolver = tslib.__decorate([
|
|
|
5279
5363
|
graphql.Resolver(() => ShipInventoryOrderDto)
|
|
5280
5364
|
], ShipInventoryOrderResolver);
|
|
5281
5365
|
let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
5366
|
+
entities;
|
|
5367
|
+
/**
|
|
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.
|
|
5373
|
+
*/
|
|
5374
|
+
constructor(entities) {
|
|
5375
|
+
this.entities = entities;
|
|
5376
|
+
}
|
|
5282
5377
|
material({ materialId }, { loaders }) {
|
|
5283
5378
|
return loaders.batchSingle.load({
|
|
5284
|
-
__entity:
|
|
5379
|
+
__entity: this.entities.material,
|
|
5285
5380
|
__from: { id: materialId },
|
|
5286
5381
|
});
|
|
5287
5382
|
}
|
|
@@ -5289,7 +5384,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
|
5289
5384
|
if (!batchId)
|
|
5290
5385
|
return null;
|
|
5291
5386
|
const { groupId } = await loaders.batchSingle.load({
|
|
5292
|
-
__entity:
|
|
5387
|
+
__entity: this.entities.batch,
|
|
5293
5388
|
__from: { id: batchId },
|
|
5294
5389
|
});
|
|
5295
5390
|
return loaders.batchSingle.load({
|
|
@@ -5301,7 +5396,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
|
5301
5396
|
if (!batchId)
|
|
5302
5397
|
return null;
|
|
5303
5398
|
const { groupId } = await loaders.batchSingle.load({
|
|
5304
|
-
__entity:
|
|
5399
|
+
__entity: this.entities.batch,
|
|
5305
5400
|
__from: { id: batchId },
|
|
5306
5401
|
});
|
|
5307
5402
|
return loaders.batchSingle
|
|
@@ -5315,7 +5410,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
|
5315
5410
|
if (!batchId)
|
|
5316
5411
|
return null;
|
|
5317
5412
|
const { groupId } = await loaders.batchSingle.load({
|
|
5318
|
-
__entity:
|
|
5413
|
+
__entity: this.entities.batch,
|
|
5319
5414
|
__from: { id: batchId },
|
|
5320
5415
|
});
|
|
5321
5416
|
return loaders.batchSingle
|
|
@@ -5329,7 +5424,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
|
5329
5424
|
if (!locationId)
|
|
5330
5425
|
return null;
|
|
5331
5426
|
return loaders.batchSingle.load({
|
|
5332
|
-
__entity:
|
|
5427
|
+
__entity: this.entities.location,
|
|
5333
5428
|
__from: { id: locationId },
|
|
5334
5429
|
});
|
|
5335
5430
|
}
|
|
@@ -5409,9 +5504,21 @@ tslib.__decorate([
|
|
|
5409
5504
|
tslib.__metadata("design:returntype", Promise)
|
|
5410
5505
|
], ShipInventoryOrderItemResolver.prototype, "shippedQuantity", null);
|
|
5411
5506
|
ShipInventoryOrderItemResolver = tslib.__decorate([
|
|
5412
|
-
graphql.Resolver(() => ShipInventoryOrderItemDto)
|
|
5507
|
+
graphql.Resolver(() => ShipInventoryOrderItemDto),
|
|
5508
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
5413
5509
|
], ShipInventoryOrderItemResolver);
|
|
5414
5510
|
let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResolver {
|
|
5511
|
+
entities;
|
|
5512
|
+
/**
|
|
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.
|
|
5518
|
+
*/
|
|
5519
|
+
constructor(entities) {
|
|
5520
|
+
this.entities = entities;
|
|
5521
|
+
}
|
|
5415
5522
|
async shippedQuantity({ orderId, serialId }, { loaders }) {
|
|
5416
5523
|
const items = await loaders.batchMany.load({
|
|
5417
5524
|
__entity: wmsModuleCore.ShipInventoryOrderItemEntityClass,
|
|
@@ -5426,7 +5533,7 @@ let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResol
|
|
|
5426
5533
|
}
|
|
5427
5534
|
material({ materialId }, { loaders }) {
|
|
5428
5535
|
return loaders.batchSingle.load({
|
|
5429
|
-
__entity:
|
|
5536
|
+
__entity: this.entities.material,
|
|
5430
5537
|
__from: { id: materialId },
|
|
5431
5538
|
});
|
|
5432
5539
|
}
|
|
@@ -5434,7 +5541,7 @@ let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResol
|
|
|
5434
5541
|
if (!batchId)
|
|
5435
5542
|
return null;
|
|
5436
5543
|
const { groupId } = await loaders.batchSingle.load({
|
|
5437
|
-
__entity:
|
|
5544
|
+
__entity: this.entities.batch,
|
|
5438
5545
|
__from: { id: batchId },
|
|
5439
5546
|
});
|
|
5440
5547
|
return loaders.batchSingle.load({
|
|
@@ -5482,7 +5589,8 @@ tslib.__decorate([
|
|
|
5482
5589
|
tslib.__metadata("design:returntype", Promise)
|
|
5483
5590
|
], ShipInventoryOrderReferenceResolver.prototype, "items", null);
|
|
5484
5591
|
ShipInventoryOrderReferenceResolver = tslib.__decorate([
|
|
5485
|
-
graphql.Resolver(() => ShipInventoryOrderReferenceDto)
|
|
5592
|
+
graphql.Resolver(() => ShipInventoryOrderReferenceDto),
|
|
5593
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
5486
5594
|
], ShipInventoryOrderReferenceResolver);
|
|
5487
5595
|
|
|
5488
5596
|
let FindSaleOrderArgs = class FindSaleOrderArgs extends PaginationArgs {
|
|
@@ -6537,11 +6645,22 @@ WarehouseMapDataQuery = tslib.__decorate([
|
|
|
6537
6645
|
], WarehouseMapDataQuery);
|
|
6538
6646
|
|
|
6539
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
|
+
}
|
|
6540
6659
|
location({ id }, { loaders }) {
|
|
6541
6660
|
if (!id)
|
|
6542
6661
|
return null;
|
|
6543
6662
|
return loaders.batchSingle.load({
|
|
6544
|
-
__entity:
|
|
6663
|
+
__entity: this.entities.location,
|
|
6545
6664
|
__from: { key: id },
|
|
6546
6665
|
});
|
|
6547
6666
|
}
|
|
@@ -6555,7 +6674,8 @@ tslib.__decorate([
|
|
|
6555
6674
|
tslib.__metadata("design:returntype", void 0)
|
|
6556
6675
|
], MapRangeUnionResolver.prototype, "location", null);
|
|
6557
6676
|
MapRangeUnionResolver = tslib.__decorate([
|
|
6558
|
-
graphql.Resolver(() => MapRangeDto)
|
|
6677
|
+
graphql.Resolver(() => MapRangeDto),
|
|
6678
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
6559
6679
|
], MapRangeUnionResolver);
|
|
6560
6680
|
|
|
6561
6681
|
var WmsModuleGraphqlModule_1;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { DataSource, FindOptionsWhere, ObjectLiteral, SelectQueryBuilder } from 'typeorm';
|
|
1
|
+
import { DataSource, EntityTarget, FindOptionsWhere, ObjectLiteral, SelectQueryBuilder } from 'typeorm';
|
|
2
2
|
import DataLoader from 'dataloader';
|
|
3
3
|
export interface LoaderOptions<K> {
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Widened from `ObjectLiteral` so a resolver can pass the entity it had
|
|
6
|
+
* injected from the `MaterialEntity` / `…Entity` Symbols — those are typed as
|
|
7
|
+
* `EntityTarget`, which is also exactly what `core()` hands to
|
|
8
|
+
* `getRepository()`.
|
|
9
|
+
*/
|
|
10
|
+
__entity: EntityTarget<ObjectLiteral>;
|
|
5
11
|
__from: FindOptionsWhere<K>;
|
|
6
12
|
__conditions?: (qb: SelectQueryBuilder<ObjectLiteral>) => SelectQueryBuilder<ObjectLiteral>;
|
|
7
13
|
__seed?: string;
|
|
@@ -1,11 +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
|
-
|
|
8
|
+
private readonly entities;
|
|
9
|
+
constructor(stockService: StockService, entities: WmsEntities);
|
|
9
10
|
id(stock: AggregatedStockDto): Promise<string>;
|
|
10
11
|
material({ materialId }: AggregatedStockDto, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
|
|
11
12
|
batch({ batchId }: AggregatedStockDto, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto>;
|
|
@@ -24,27 +24,29 @@ import '../dto/scrape-order.dto.js';
|
|
|
24
24
|
import '../dto/scrape-order-item.dto.js';
|
|
25
25
|
import '../dto/quality-inspection-order.dto.js';
|
|
26
26
|
import '../dto/quality-inspection-order-item.dto.js';
|
|
27
|
-
import { StockService,
|
|
27
|
+
import { StockService, WmsEntities, BatchGroupEntityClass, LoadersEntityClass } from '@rytass/wms-module-core';
|
|
28
28
|
import { BatchDto } from '../dto/batch.dto.js';
|
|
29
29
|
import { LocationDto } from '../dto/location.dto.js';
|
|
30
30
|
|
|
31
31
|
let AggregatedStockResolver = class AggregatedStockResolver {
|
|
32
32
|
stockService;
|
|
33
|
-
|
|
33
|
+
entities;
|
|
34
|
+
constructor(stockService, entities) {
|
|
34
35
|
this.stockService = stockService;
|
|
36
|
+
this.entities = entities;
|
|
35
37
|
}
|
|
36
38
|
async id(stock) {
|
|
37
39
|
return this.stockService.generatedAggregateKey(stock);
|
|
38
40
|
}
|
|
39
41
|
async material({ materialId }, { loaders }) {
|
|
40
42
|
return loaders.batchSingle.load({
|
|
41
|
-
__entity:
|
|
43
|
+
__entity: this.entities.material,
|
|
42
44
|
__from: { id: materialId },
|
|
43
45
|
});
|
|
44
46
|
}
|
|
45
47
|
async batch({ batchId }, { loaders }) {
|
|
46
48
|
const { groupId } = await loaders.batchSingle.load({
|
|
47
|
-
__entity:
|
|
49
|
+
__entity: this.entities.batch,
|
|
48
50
|
__from: { id: batchId },
|
|
49
51
|
});
|
|
50
52
|
return loaders.batchSingle.load({
|
|
@@ -54,7 +56,7 @@ let AggregatedStockResolver = class AggregatedStockResolver {
|
|
|
54
56
|
}
|
|
55
57
|
async location({ locationId }, { loaders }) {
|
|
56
58
|
return loaders.batchSingle.load({
|
|
57
|
-
__entity:
|
|
59
|
+
__entity: this.entities.location,
|
|
58
60
|
__from: { id: locationId },
|
|
59
61
|
});
|
|
60
62
|
}
|
|
@@ -106,7 +108,8 @@ __decorate([
|
|
|
106
108
|
], AggregatedStockResolver.prototype, "loader", null);
|
|
107
109
|
AggregatedStockResolver = __decorate([
|
|
108
110
|
Resolver(() => AggregatedStockDto),
|
|
109
|
-
__metadata("design:paramtypes", [StockService
|
|
111
|
+
__metadata("design:paramtypes", [StockService,
|
|
112
|
+
WmsEntities])
|
|
110
113
|
], AggregatedStockResolver);
|
|
111
114
|
|
|
112
115
|
export { AggregatedStockResolver };
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { MaterialDto } from '../dto';
|
|
2
|
-
import { BatchEntityClass, LocationEntityClass, MaterialEntityClass, StockEntityClass } from '@rytass/wms-module-core';
|
|
2
|
+
import { BatchEntityClass, LocationEntityClass, MaterialEntityClass, StockEntityClass, WmsEntities } from '@rytass/wms-module-core';
|
|
3
3
|
import { type LoaderType } from '../helpers';
|
|
4
4
|
import { LocationDto } from '../dto/location.dto';
|
|
5
5
|
import { BatchDto } from '../dto/batch.dto';
|
|
6
6
|
export declare class ChangeLogResolver {
|
|
7
|
+
private readonly entities;
|
|
8
|
+
/**
|
|
9
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
10
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
11
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
12
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
13
|
+
* override.
|
|
14
|
+
*/
|
|
15
|
+
constructor(entities: WmsEntities);
|
|
7
16
|
material({ materialId }: StockEntityClass, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
|
|
8
17
|
location({ locationId }: StockEntityClass, { loaders }: LoaderType<LocationEntityClass>): Promise<LocationDto>;
|
|
9
18
|
batch({ batchId }: StockEntityClass, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto>;
|