@rytass/wms-module-graphql 0.6.1 → 0.7.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 +16 -0
- package/docs/api-reference.md +6 -0
- package/index.cjs.js +104 -15
- package/lib/helpers/loader.service.d.ts +8 -2
- package/lib/resolvers/aggregated-stock.resolver.d.ts +10 -1
- package/lib/resolvers/aggregated-stock.resolver.js +16 -4
- package/lib/resolvers/change-log.resolver.d.ts +9 -0
- package/lib/resolvers/change-log.resolver.js +17 -3
- package/lib/resolvers/receive-inventory-order.resolver.d.ts +9 -0
- package/lib/resolvers/receive-inventory-order.resolver.js +17 -3
- package/lib/resolvers/ship-inventory-order.resolver.d.ts +18 -0
- package/lib/resolvers/ship-inventory-order.resolver.js +32 -5
- package/lib/resolvers/stock.resolver.d.ts +9 -0
- package/lib/resolvers/stock.resolver.js +17 -3
- package/lib/resolvers/transfer-order.resolver.d.ts +9 -0
- package/lib/resolvers/transfer-order.resolver.js +17 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -62,6 +62,22 @@ 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 material entity
|
|
66
|
+
|
|
67
|
+
`materialEntity` is an ordinary `WMSBaseModuleOptions` field that reaches all the way down, so a downstream project's own item master can *be* the WMS material master — every resolver's `material` DataLoader resolves against it too:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
WmsModuleGraphqlModule.forRootAsync({
|
|
71
|
+
// a @ChildEntity() of MaterialEntityClass
|
|
72
|
+
useFactory: async () => ({ materialEntity: ItemMasterEntity }),
|
|
73
|
+
defaultLoaderSerialId: 'DEFAULT',
|
|
74
|
+
defaultLoaderTypeKey: 'DEFAULT',
|
|
75
|
+
defaultLocationKey: 'DEFAULT',
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Register the entity with TypeORM yourself (`TypeOrmModule.forFeature([ItemMasterEntity])`); the module checks at startup and refuses to boot if it is missing. Requires `@rytass/wms-base-nestjs-module` >= 0.3.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 and which other entity options are not honoured yet.
|
|
80
|
+
|
|
65
81
|
## Authorization
|
|
66
82
|
|
|
67
83
|
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.7.0(需 wms-base-nestjs-module >= 0.3.0):
|
|
316
|
+
// WMSBaseModuleOptions.materialEntity 會一路作用到所有 resolver 的
|
|
317
|
+
// material DataLoader。傳入 MaterialEntityClass 的 @ChildEntity() 即可,
|
|
318
|
+
// forRoot 與 async factory 皆支援;entity 需自行註冊給 TypeORM。
|
|
319
|
+
// 詳見 core 的 docs/custom-entities.md。
|
|
314
320
|
): DynamicModule
|
|
315
321
|
```
|
|
316
322
|
|
package/index.cjs.js
CHANGED
|
@@ -3283,9 +3283,20 @@ Batches = tslib.__decorate([
|
|
|
3283
3283
|
], Batches);
|
|
3284
3284
|
|
|
3285
3285
|
let StockResolver = class StockResolver {
|
|
3286
|
+
materialEntity;
|
|
3287
|
+
/**
|
|
3288
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
3289
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
3290
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
3291
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
3292
|
+
* discriminator and resolve nothing for a custom entity.
|
|
3293
|
+
*/
|
|
3294
|
+
constructor(materialEntity) {
|
|
3295
|
+
this.materialEntity = materialEntity;
|
|
3296
|
+
}
|
|
3286
3297
|
material({ materialId }, { loaders }) {
|
|
3287
3298
|
return loaders.batchSingle.load({
|
|
3288
|
-
__entity:
|
|
3299
|
+
__entity: this.materialEntity,
|
|
3289
3300
|
__from: { id: materialId },
|
|
3290
3301
|
});
|
|
3291
3302
|
}
|
|
@@ -3331,7 +3342,9 @@ tslib.__decorate([
|
|
|
3331
3342
|
tslib.__metadata("design:returntype", Promise)
|
|
3332
3343
|
], StockResolver.prototype, "batch", null);
|
|
3333
3344
|
StockResolver = tslib.__decorate([
|
|
3334
|
-
graphql.Resolver(() => StockDto)
|
|
3345
|
+
graphql.Resolver(() => StockDto),
|
|
3346
|
+
tslib.__param(0, common.Inject(wmsModuleCore.MaterialEntity)),
|
|
3347
|
+
tslib.__metadata("design:paramtypes", [Function])
|
|
3335
3348
|
], StockResolver);
|
|
3336
3349
|
|
|
3337
3350
|
var MapRangeType;
|
|
@@ -3905,15 +3918,25 @@ UnitQuery = tslib.__decorate([
|
|
|
3905
3918
|
|
|
3906
3919
|
let AggregatedStockResolver = class AggregatedStockResolver {
|
|
3907
3920
|
stockService;
|
|
3908
|
-
|
|
3921
|
+
materialEntity;
|
|
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) {
|
|
3909
3931
|
this.stockService = stockService;
|
|
3932
|
+
this.materialEntity = materialEntity;
|
|
3910
3933
|
}
|
|
3911
3934
|
async id(stock) {
|
|
3912
3935
|
return this.stockService.generatedAggregateKey(stock);
|
|
3913
3936
|
}
|
|
3914
3937
|
async material({ materialId }, { loaders }) {
|
|
3915
3938
|
return loaders.batchSingle.load({
|
|
3916
|
-
__entity:
|
|
3939
|
+
__entity: this.materialEntity,
|
|
3917
3940
|
__from: { id: materialId },
|
|
3918
3941
|
});
|
|
3919
3942
|
}
|
|
@@ -3981,7 +4004,8 @@ tslib.__decorate([
|
|
|
3981
4004
|
], AggregatedStockResolver.prototype, "loader", null);
|
|
3982
4005
|
AggregatedStockResolver = tslib.__decorate([
|
|
3983
4006
|
graphql.Resolver(() => AggregatedStockDto),
|
|
3984
|
-
tslib.
|
|
4007
|
+
tslib.__param(1, common.Inject(wmsModuleCore.MaterialEntity)),
|
|
4008
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.StockService, Function])
|
|
3985
4009
|
], AggregatedStockResolver);
|
|
3986
4010
|
|
|
3987
4011
|
let CreateTransferOrderItemArgs = class CreateTransferOrderItemArgs {
|
|
@@ -4367,9 +4391,20 @@ TransferOrderResolver = tslib.__decorate([
|
|
|
4367
4391
|
graphql.Resolver(() => TransferOrderDto)
|
|
4368
4392
|
], TransferOrderResolver);
|
|
4369
4393
|
let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
4394
|
+
materialEntity;
|
|
4395
|
+
/**
|
|
4396
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
4397
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
4398
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
4399
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
4400
|
+
* discriminator and resolve nothing for a custom entity.
|
|
4401
|
+
*/
|
|
4402
|
+
constructor(materialEntity) {
|
|
4403
|
+
this.materialEntity = materialEntity;
|
|
4404
|
+
}
|
|
4370
4405
|
material({ materialId }, { loaders }) {
|
|
4371
4406
|
return loaders.batchSingle.load({
|
|
4372
|
-
__entity:
|
|
4407
|
+
__entity: this.materialEntity,
|
|
4373
4408
|
__from: { id: materialId },
|
|
4374
4409
|
});
|
|
4375
4410
|
}
|
|
@@ -4489,7 +4524,9 @@ tslib.__decorate([
|
|
|
4489
4524
|
tslib.__metadata("design:returntype", Promise)
|
|
4490
4525
|
], TransferOrderItemResolver.prototype, "transferredQuantity", null);
|
|
4491
4526
|
TransferOrderItemResolver = tslib.__decorate([
|
|
4492
|
-
graphql.Resolver(() => TransferOrderItemDto)
|
|
4527
|
+
graphql.Resolver(() => TransferOrderItemDto),
|
|
4528
|
+
tslib.__param(0, common.Inject(wmsModuleCore.MaterialEntity)),
|
|
4529
|
+
tslib.__metadata("design:paramtypes", [Function])
|
|
4493
4530
|
], TransferOrderItemResolver);
|
|
4494
4531
|
|
|
4495
4532
|
let CreateHoldInventoryOrderItemArgs = class CreateHoldInventoryOrderItemArgs {
|
|
@@ -4785,9 +4822,20 @@ BatchQuery = tslib.__decorate([
|
|
|
4785
4822
|
], BatchQuery);
|
|
4786
4823
|
|
|
4787
4824
|
let ChangeLogResolver = class ChangeLogResolver {
|
|
4825
|
+
materialEntity;
|
|
4826
|
+
/**
|
|
4827
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
4828
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
4829
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
4830
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
4831
|
+
* discriminator and resolve nothing for a custom entity.
|
|
4832
|
+
*/
|
|
4833
|
+
constructor(materialEntity) {
|
|
4834
|
+
this.materialEntity = materialEntity;
|
|
4835
|
+
}
|
|
4788
4836
|
material({ materialId }, { loaders }) {
|
|
4789
4837
|
return loaders.batchSingle.load({
|
|
4790
|
-
__entity:
|
|
4838
|
+
__entity: this.materialEntity,
|
|
4791
4839
|
__from: { id: materialId },
|
|
4792
4840
|
});
|
|
4793
4841
|
}
|
|
@@ -4833,7 +4881,9 @@ tslib.__decorate([
|
|
|
4833
4881
|
tslib.__metadata("design:returntype", Promise)
|
|
4834
4882
|
], ChangeLogResolver.prototype, "batch", null);
|
|
4835
4883
|
ChangeLogResolver = tslib.__decorate([
|
|
4836
|
-
graphql.Resolver(() => ChangeLogDto)
|
|
4884
|
+
graphql.Resolver(() => ChangeLogDto),
|
|
4885
|
+
tslib.__param(0, common.Inject(wmsModuleCore.MaterialEntity)),
|
|
4886
|
+
tslib.__metadata("design:paramtypes", [Function])
|
|
4837
4887
|
], ChangeLogResolver);
|
|
4838
4888
|
|
|
4839
4889
|
let ReceiveInventoryOrderResolver = class ReceiveInventoryOrderResolver {
|
|
@@ -4857,9 +4907,20 @@ ReceiveInventoryOrderResolver = tslib.__decorate([
|
|
|
4857
4907
|
graphql.Resolver(() => ReceiveInventoryOrderDto)
|
|
4858
4908
|
], ReceiveInventoryOrderResolver);
|
|
4859
4909
|
let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver {
|
|
4910
|
+
materialEntity;
|
|
4911
|
+
/**
|
|
4912
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
4913
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
4914
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
4915
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
4916
|
+
* discriminator and resolve nothing for a custom entity.
|
|
4917
|
+
*/
|
|
4918
|
+
constructor(materialEntity) {
|
|
4919
|
+
this.materialEntity = materialEntity;
|
|
4920
|
+
}
|
|
4860
4921
|
material({ materialId }, { loaders }) {
|
|
4861
4922
|
return loaders.batchSingle.load({
|
|
4862
|
-
__entity:
|
|
4923
|
+
__entity: this.materialEntity,
|
|
4863
4924
|
__from: { id: materialId },
|
|
4864
4925
|
});
|
|
4865
4926
|
}
|
|
@@ -4942,7 +5003,9 @@ tslib.__decorate([
|
|
|
4942
5003
|
tslib.__metadata("design:returntype", Promise)
|
|
4943
5004
|
], ReceiveInventoryOrderItemResolver.prototype, "receivedQuantity", null);
|
|
4944
5005
|
ReceiveInventoryOrderItemResolver = tslib.__decorate([
|
|
4945
|
-
graphql.Resolver(() => ReceiveInventoryOrderItemDto)
|
|
5006
|
+
graphql.Resolver(() => ReceiveInventoryOrderItemDto),
|
|
5007
|
+
tslib.__param(0, common.Inject(wmsModuleCore.MaterialEntity)),
|
|
5008
|
+
tslib.__metadata("design:paramtypes", [Function])
|
|
4946
5009
|
], ReceiveInventoryOrderItemResolver);
|
|
4947
5010
|
|
|
4948
5011
|
let FindAllocateInventoryOrderArgs = class FindAllocateInventoryOrderArgs extends PaginationArgs {
|
|
@@ -5279,9 +5342,20 @@ ShipInventoryOrderResolver = tslib.__decorate([
|
|
|
5279
5342
|
graphql.Resolver(() => ShipInventoryOrderDto)
|
|
5280
5343
|
], ShipInventoryOrderResolver);
|
|
5281
5344
|
let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
5345
|
+
materialEntity;
|
|
5346
|
+
/**
|
|
5347
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
5348
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
5349
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
5350
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
5351
|
+
* discriminator and resolve nothing for a custom entity.
|
|
5352
|
+
*/
|
|
5353
|
+
constructor(materialEntity) {
|
|
5354
|
+
this.materialEntity = materialEntity;
|
|
5355
|
+
}
|
|
5282
5356
|
material({ materialId }, { loaders }) {
|
|
5283
5357
|
return loaders.batchSingle.load({
|
|
5284
|
-
__entity:
|
|
5358
|
+
__entity: this.materialEntity,
|
|
5285
5359
|
__from: { id: materialId },
|
|
5286
5360
|
});
|
|
5287
5361
|
}
|
|
@@ -5409,9 +5483,22 @@ tslib.__decorate([
|
|
|
5409
5483
|
tslib.__metadata("design:returntype", Promise)
|
|
5410
5484
|
], ShipInventoryOrderItemResolver.prototype, "shippedQuantity", null);
|
|
5411
5485
|
ShipInventoryOrderItemResolver = tslib.__decorate([
|
|
5412
|
-
graphql.Resolver(() => ShipInventoryOrderItemDto)
|
|
5486
|
+
graphql.Resolver(() => ShipInventoryOrderItemDto),
|
|
5487
|
+
tslib.__param(0, common.Inject(wmsModuleCore.MaterialEntity)),
|
|
5488
|
+
tslib.__metadata("design:paramtypes", [Function])
|
|
5413
5489
|
], ShipInventoryOrderItemResolver);
|
|
5414
5490
|
let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResolver {
|
|
5491
|
+
materialEntity;
|
|
5492
|
+
/**
|
|
5493
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
5494
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
5495
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
5496
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
5497
|
+
* discriminator and resolve nothing for a custom entity.
|
|
5498
|
+
*/
|
|
5499
|
+
constructor(materialEntity) {
|
|
5500
|
+
this.materialEntity = materialEntity;
|
|
5501
|
+
}
|
|
5415
5502
|
async shippedQuantity({ orderId, serialId }, { loaders }) {
|
|
5416
5503
|
const items = await loaders.batchMany.load({
|
|
5417
5504
|
__entity: wmsModuleCore.ShipInventoryOrderItemEntityClass,
|
|
@@ -5426,7 +5513,7 @@ let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResol
|
|
|
5426
5513
|
}
|
|
5427
5514
|
material({ materialId }, { loaders }) {
|
|
5428
5515
|
return loaders.batchSingle.load({
|
|
5429
|
-
__entity:
|
|
5516
|
+
__entity: this.materialEntity,
|
|
5430
5517
|
__from: { id: materialId },
|
|
5431
5518
|
});
|
|
5432
5519
|
}
|
|
@@ -5482,7 +5569,9 @@ tslib.__decorate([
|
|
|
5482
5569
|
tslib.__metadata("design:returntype", Promise)
|
|
5483
5570
|
], ShipInventoryOrderReferenceResolver.prototype, "items", null);
|
|
5484
5571
|
ShipInventoryOrderReferenceResolver = tslib.__decorate([
|
|
5485
|
-
graphql.Resolver(() => ShipInventoryOrderReferenceDto)
|
|
5572
|
+
graphql.Resolver(() => ShipInventoryOrderReferenceDto),
|
|
5573
|
+
tslib.__param(0, common.Inject(wmsModuleCore.MaterialEntity)),
|
|
5574
|
+
tslib.__metadata("design:paramtypes", [Function])
|
|
5486
5575
|
], ShipInventoryOrderReferenceResolver);
|
|
5487
5576
|
|
|
5488
5577
|
let FindSaleOrderArgs = class FindSaleOrderArgs extends PaginationArgs {
|
|
@@ -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;
|
|
@@ -5,7 +5,16 @@ 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 materialEntity;
|
|
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);
|
|
9
18
|
id(stock: AggregatedStockDto): Promise<string>;
|
|
10
19
|
material({ materialId }: AggregatedStockDto, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
|
|
11
20
|
batch({ batchId }: AggregatedStockDto, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
+
import { Inject } from '@nestjs/common';
|
|
2
3
|
import { ResolveField, ID, Parent, Context, Resolver } from '@nestjs/graphql';
|
|
3
4
|
import '../dto/loader-type.dto.js';
|
|
4
5
|
import { LoaderDto } from '../dto/loader.dto.js';
|
|
@@ -24,21 +25,31 @@ import '../dto/scrape-order.dto.js';
|
|
|
24
25
|
import '../dto/scrape-order-item.dto.js';
|
|
25
26
|
import '../dto/quality-inspection-order.dto.js';
|
|
26
27
|
import '../dto/quality-inspection-order-item.dto.js';
|
|
27
|
-
import {
|
|
28
|
+
import { MaterialEntity, StockService, BatchEntityClass, BatchGroupEntityClass, LocationEntityClass, LoadersEntityClass } from '@rytass/wms-module-core';
|
|
28
29
|
import { BatchDto } from '../dto/batch.dto.js';
|
|
29
30
|
import { LocationDto } from '../dto/location.dto.js';
|
|
30
31
|
|
|
31
32
|
let AggregatedStockResolver = class AggregatedStockResolver {
|
|
32
33
|
stockService;
|
|
33
|
-
|
|
34
|
+
materialEntity;
|
|
35
|
+
/**
|
|
36
|
+
* `materialEntity` is bound to the `MaterialEntity` Symbol, so the DataLoader
|
|
37
|
+
* queries whichever material entity the consumer configured — the built-in
|
|
38
|
+
* `MaterialEntityClass` unless `materialEntity` was passed to
|
|
39
|
+
* `forRoot`/`forRootAsync`. Loading the built-in class outright would filter on
|
|
40
|
+
* its single-table-inheritance discriminator and resolve nothing for a custom
|
|
41
|
+
* entity.
|
|
42
|
+
*/
|
|
43
|
+
constructor(stockService, materialEntity) {
|
|
34
44
|
this.stockService = stockService;
|
|
45
|
+
this.materialEntity = materialEntity;
|
|
35
46
|
}
|
|
36
47
|
async id(stock) {
|
|
37
48
|
return this.stockService.generatedAggregateKey(stock);
|
|
38
49
|
}
|
|
39
50
|
async material({ materialId }, { loaders }) {
|
|
40
51
|
return loaders.batchSingle.load({
|
|
41
|
-
__entity:
|
|
52
|
+
__entity: this.materialEntity,
|
|
42
53
|
__from: { id: materialId },
|
|
43
54
|
});
|
|
44
55
|
}
|
|
@@ -106,7 +117,8 @@ __decorate([
|
|
|
106
117
|
], AggregatedStockResolver.prototype, "loader", null);
|
|
107
118
|
AggregatedStockResolver = __decorate([
|
|
108
119
|
Resolver(() => AggregatedStockDto),
|
|
109
|
-
|
|
120
|
+
__param(1, Inject(MaterialEntity)),
|
|
121
|
+
__metadata("design:paramtypes", [StockService, Function])
|
|
110
122
|
], AggregatedStockResolver);
|
|
111
123
|
|
|
112
124
|
export { AggregatedStockResolver };
|
|
@@ -4,6 +4,15 @@ 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 materialEntity;
|
|
8
|
+
/**
|
|
9
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
10
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
11
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
12
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
13
|
+
* discriminator and resolve nothing for a custom entity.
|
|
14
|
+
*/
|
|
15
|
+
constructor(materialEntity: new () => MaterialEntityClass);
|
|
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>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
+
import { Inject } from '@nestjs/common';
|
|
2
3
|
import { ResolveField, Parent, Context, Resolver } from '@nestjs/graphql';
|
|
3
4
|
import '../dto/loader-type.dto.js';
|
|
4
5
|
import '../dto/loader.dto.js';
|
|
@@ -24,14 +25,25 @@ import '../dto/scrape-order.dto.js';
|
|
|
24
25
|
import '../dto/scrape-order-item.dto.js';
|
|
25
26
|
import '../dto/quality-inspection-order.dto.js';
|
|
26
27
|
import '../dto/quality-inspection-order-item.dto.js';
|
|
27
|
-
import { StockEntityClass,
|
|
28
|
+
import { StockEntityClass, MaterialEntity, LocationEntityClass, BatchEntityClass, BatchGroupEntityClass } from '@rytass/wms-module-core';
|
|
28
29
|
import { LocationDto } from '../dto/location.dto.js';
|
|
29
30
|
import { BatchDto } from '../dto/batch.dto.js';
|
|
30
31
|
|
|
31
32
|
let ChangeLogResolver = class ChangeLogResolver {
|
|
33
|
+
materialEntity;
|
|
34
|
+
/**
|
|
35
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
36
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
37
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
38
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
39
|
+
* discriminator and resolve nothing for a custom entity.
|
|
40
|
+
*/
|
|
41
|
+
constructor(materialEntity) {
|
|
42
|
+
this.materialEntity = materialEntity;
|
|
43
|
+
}
|
|
32
44
|
material({ materialId }, { loaders }) {
|
|
33
45
|
return loaders.batchSingle.load({
|
|
34
|
-
__entity:
|
|
46
|
+
__entity: this.materialEntity,
|
|
35
47
|
__from: { id: materialId },
|
|
36
48
|
});
|
|
37
49
|
}
|
|
@@ -77,7 +89,9 @@ __decorate([
|
|
|
77
89
|
__metadata("design:returntype", Promise)
|
|
78
90
|
], ChangeLogResolver.prototype, "batch", null);
|
|
79
91
|
ChangeLogResolver = __decorate([
|
|
80
|
-
Resolver(() => ChangeLogDto)
|
|
92
|
+
Resolver(() => ChangeLogDto),
|
|
93
|
+
__param(0, Inject(MaterialEntity)),
|
|
94
|
+
__metadata("design:paramtypes", [Function])
|
|
81
95
|
], ChangeLogResolver);
|
|
82
96
|
|
|
83
97
|
export { ChangeLogResolver };
|
|
@@ -7,6 +7,15 @@ export declare class ReceiveInventoryOrderResolver {
|
|
|
7
7
|
items({ id }: ReceiveInventoryOrderDto, { loaders }: LoaderType<ReceiveInventoryOrderItemEntityClass>): Promise<ReceiveInventoryOrderItemDto[]>;
|
|
8
8
|
}
|
|
9
9
|
export declare class ReceiveInventoryOrderItemResolver {
|
|
10
|
+
private readonly materialEntity;
|
|
11
|
+
/**
|
|
12
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
13
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
14
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
15
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
16
|
+
* discriminator and resolve nothing for a custom entity.
|
|
17
|
+
*/
|
|
18
|
+
constructor(materialEntity: new () => MaterialEntityClass);
|
|
10
19
|
material({ materialId }: ReceiveInventoryOrderItemEntityClass, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
|
|
11
20
|
batch({ batchId }: ReceiveInventoryOrderItemEntityClass, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto | null>;
|
|
12
21
|
location({ locationId }: ReceiveInventoryOrderItemEntityClass, { loaders }: LoaderType<LocationEntityClass>): Promise<LocationDto | null>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
+
import { Inject } from '@nestjs/common';
|
|
2
3
|
import { ResolveField, Parent, Context, Resolver, Int } from '@nestjs/graphql';
|
|
3
4
|
import '../dto/loader-type.dto.js';
|
|
4
5
|
import { LoaderDto } from '../dto/loader.dto.js';
|
|
@@ -24,7 +25,7 @@ import '../dto/scrape-order.dto.js';
|
|
|
24
25
|
import '../dto/scrape-order-item.dto.js';
|
|
25
26
|
import '../dto/quality-inspection-order.dto.js';
|
|
26
27
|
import '../dto/quality-inspection-order-item.dto.js';
|
|
27
|
-
import { ReceiveInventoryOrderItemEntityClass,
|
|
28
|
+
import { ReceiveInventoryOrderItemEntityClass, MaterialEntity, BatchEntityClass, BatchGroupEntityClass, LocationEntityClass, LoadersEntityClass, ReceiveInventoryOrderChangeEntityClass } from '@rytass/wms-module-core';
|
|
28
29
|
import { BatchDto } from '../dto/batch.dto.js';
|
|
29
30
|
import { LocationDto } from '../dto/location.dto.js';
|
|
30
31
|
|
|
@@ -49,9 +50,20 @@ ReceiveInventoryOrderResolver = __decorate([
|
|
|
49
50
|
Resolver(() => ReceiveInventoryOrderDto)
|
|
50
51
|
], ReceiveInventoryOrderResolver);
|
|
51
52
|
let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver {
|
|
53
|
+
materialEntity;
|
|
54
|
+
/**
|
|
55
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
56
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
57
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
58
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
59
|
+
* discriminator and resolve nothing for a custom entity.
|
|
60
|
+
*/
|
|
61
|
+
constructor(materialEntity) {
|
|
62
|
+
this.materialEntity = materialEntity;
|
|
63
|
+
}
|
|
52
64
|
material({ materialId }, { loaders }) {
|
|
53
65
|
return loaders.batchSingle.load({
|
|
54
|
-
__entity:
|
|
66
|
+
__entity: this.materialEntity,
|
|
55
67
|
__from: { id: materialId },
|
|
56
68
|
});
|
|
57
69
|
}
|
|
@@ -134,7 +146,9 @@ __decorate([
|
|
|
134
146
|
__metadata("design:returntype", Promise)
|
|
135
147
|
], ReceiveInventoryOrderItemResolver.prototype, "receivedQuantity", null);
|
|
136
148
|
ReceiveInventoryOrderItemResolver = __decorate([
|
|
137
|
-
Resolver(() => ReceiveInventoryOrderItemDto)
|
|
149
|
+
Resolver(() => ReceiveInventoryOrderItemDto),
|
|
150
|
+
__param(0, Inject(MaterialEntity)),
|
|
151
|
+
__metadata("design:paramtypes", [Function])
|
|
138
152
|
], ReceiveInventoryOrderItemResolver);
|
|
139
153
|
|
|
140
154
|
export { ReceiveInventoryOrderItemResolver, ReceiveInventoryOrderResolver };
|
|
@@ -9,6 +9,15 @@ export declare class ShipInventoryOrderResolver {
|
|
|
9
9
|
references({ id }: ShipInventoryOrderEntityClass, { loaders }: LoaderType<ShipInventoryOrderReferenceEntityClass>): Promise<ShipInventoryOrderReferenceDto[]>;
|
|
10
10
|
}
|
|
11
11
|
export declare class ShipInventoryOrderItemResolver {
|
|
12
|
+
private readonly materialEntity;
|
|
13
|
+
/**
|
|
14
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
15
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
16
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
17
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
18
|
+
* discriminator and resolve nothing for a custom entity.
|
|
19
|
+
*/
|
|
20
|
+
constructor(materialEntity: new () => MaterialEntityClass);
|
|
12
21
|
material({ materialId }: ShipInventoryOrderItemEntityClass, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
|
|
13
22
|
batch({ batchId }: ShipInventoryOrderItemEntityClass, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto | null>;
|
|
14
23
|
saleId({ batchId }: ShipInventoryOrderItemEntityClass, { loaders }: LoaderType<BatchEntityClass>): Promise<string | null>;
|
|
@@ -18,6 +27,15 @@ export declare class ShipInventoryOrderItemResolver {
|
|
|
18
27
|
shippedQuantity({ id }: ShipInventoryOrderItemEntityClass, { loaders }: LoaderType<ShipInventoryOrderChangeEntityClass>): Promise<number>;
|
|
19
28
|
}
|
|
20
29
|
export declare class ShipInventoryOrderReferenceResolver {
|
|
30
|
+
private readonly materialEntity;
|
|
31
|
+
/**
|
|
32
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
33
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
34
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
35
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
36
|
+
* discriminator and resolve nothing for a custom entity.
|
|
37
|
+
*/
|
|
38
|
+
constructor(materialEntity: new () => MaterialEntityClass);
|
|
21
39
|
shippedQuantity({ orderId, serialId }: ShipInventoryOrderReferenceEntityClass, { loaders }: LoaderType<ShipInventoryOrderItemEntityClass>): Promise<number>;
|
|
22
40
|
material({ materialId }: ShipInventoryOrderReferenceEntityClass, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
|
|
23
41
|
batch({ batchId }: ShipInventoryOrderReferenceEntityClass, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto | null>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
+
import { Inject } from '@nestjs/common';
|
|
2
3
|
import { ResolveField, Parent, Context, Resolver, ID, Int } from '@nestjs/graphql';
|
|
3
4
|
import '../dto/loader-type.dto.js';
|
|
4
5
|
import { LoaderDto } from '../dto/loader.dto.js';
|
|
@@ -24,7 +25,7 @@ import '../dto/scrape-order.dto.js';
|
|
|
24
25
|
import '../dto/scrape-order-item.dto.js';
|
|
25
26
|
import '../dto/quality-inspection-order.dto.js';
|
|
26
27
|
import '../dto/quality-inspection-order-item.dto.js';
|
|
27
|
-
import { ShipInventoryOrderEntityClass, ShipInventoryOrderItemEntityClass,
|
|
28
|
+
import { ShipInventoryOrderEntityClass, ShipInventoryOrderItemEntityClass, MaterialEntity, ShipInventoryOrderReferenceEntityClass, BatchEntityClass, BatchGroupEntityClass, LocationEntityClass, LoadersEntityClass, ShipInventoryOrderChangeEntityClass } from '@rytass/wms-module-core';
|
|
28
29
|
import { BatchDto } from '../dto/batch.dto.js';
|
|
29
30
|
import { LocationDto } from '../dto/location.dto.js';
|
|
30
31
|
import { ShipInventoryOrderReferenceDto } from '../dto/ship-inventory-order-reference.dto.js';
|
|
@@ -64,9 +65,20 @@ ShipInventoryOrderResolver = __decorate([
|
|
|
64
65
|
Resolver(() => ShipInventoryOrderDto)
|
|
65
66
|
], ShipInventoryOrderResolver);
|
|
66
67
|
let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
68
|
+
materialEntity;
|
|
69
|
+
/**
|
|
70
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
71
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
72
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
73
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
74
|
+
* discriminator and resolve nothing for a custom entity.
|
|
75
|
+
*/
|
|
76
|
+
constructor(materialEntity) {
|
|
77
|
+
this.materialEntity = materialEntity;
|
|
78
|
+
}
|
|
67
79
|
material({ materialId }, { loaders }) {
|
|
68
80
|
return loaders.batchSingle.load({
|
|
69
|
-
__entity:
|
|
81
|
+
__entity: this.materialEntity,
|
|
70
82
|
__from: { id: materialId },
|
|
71
83
|
});
|
|
72
84
|
}
|
|
@@ -194,9 +206,22 @@ __decorate([
|
|
|
194
206
|
__metadata("design:returntype", Promise)
|
|
195
207
|
], ShipInventoryOrderItemResolver.prototype, "shippedQuantity", null);
|
|
196
208
|
ShipInventoryOrderItemResolver = __decorate([
|
|
197
|
-
Resolver(() => ShipInventoryOrderItemDto)
|
|
209
|
+
Resolver(() => ShipInventoryOrderItemDto),
|
|
210
|
+
__param(0, Inject(MaterialEntity)),
|
|
211
|
+
__metadata("design:paramtypes", [Function])
|
|
198
212
|
], ShipInventoryOrderItemResolver);
|
|
199
213
|
let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResolver {
|
|
214
|
+
materialEntity;
|
|
215
|
+
/**
|
|
216
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
217
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
218
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
219
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
220
|
+
* discriminator and resolve nothing for a custom entity.
|
|
221
|
+
*/
|
|
222
|
+
constructor(materialEntity) {
|
|
223
|
+
this.materialEntity = materialEntity;
|
|
224
|
+
}
|
|
200
225
|
async shippedQuantity({ orderId, serialId }, { loaders }) {
|
|
201
226
|
const items = await loaders.batchMany.load({
|
|
202
227
|
__entity: ShipInventoryOrderItemEntityClass,
|
|
@@ -211,7 +236,7 @@ let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResol
|
|
|
211
236
|
}
|
|
212
237
|
material({ materialId }, { loaders }) {
|
|
213
238
|
return loaders.batchSingle.load({
|
|
214
|
-
__entity:
|
|
239
|
+
__entity: this.materialEntity,
|
|
215
240
|
__from: { id: materialId },
|
|
216
241
|
});
|
|
217
242
|
}
|
|
@@ -267,7 +292,9 @@ __decorate([
|
|
|
267
292
|
__metadata("design:returntype", Promise)
|
|
268
293
|
], ShipInventoryOrderReferenceResolver.prototype, "items", null);
|
|
269
294
|
ShipInventoryOrderReferenceResolver = __decorate([
|
|
270
|
-
Resolver(() => ShipInventoryOrderReferenceDto)
|
|
295
|
+
Resolver(() => ShipInventoryOrderReferenceDto),
|
|
296
|
+
__param(0, Inject(MaterialEntity)),
|
|
297
|
+
__metadata("design:paramtypes", [Function])
|
|
271
298
|
], ShipInventoryOrderReferenceResolver);
|
|
272
299
|
|
|
273
300
|
export { ShipInventoryOrderItemResolver, ShipInventoryOrderReferenceResolver, ShipInventoryOrderResolver };
|
|
@@ -4,6 +4,15 @@ 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 StockResolver {
|
|
7
|
+
private readonly materialEntity;
|
|
8
|
+
/**
|
|
9
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
10
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
11
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
12
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
13
|
+
* discriminator and resolve nothing for a custom entity.
|
|
14
|
+
*/
|
|
15
|
+
constructor(materialEntity: new () => MaterialEntityClass);
|
|
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 | null>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
+
import { Inject } from '@nestjs/common';
|
|
2
3
|
import { ResolveField, Parent, Context, Resolver } from '@nestjs/graphql';
|
|
3
4
|
import '../dto/loader-type.dto.js';
|
|
4
5
|
import '../dto/loader.dto.js';
|
|
@@ -24,14 +25,25 @@ import '../dto/scrape-order.dto.js';
|
|
|
24
25
|
import '../dto/scrape-order-item.dto.js';
|
|
25
26
|
import '../dto/quality-inspection-order.dto.js';
|
|
26
27
|
import '../dto/quality-inspection-order-item.dto.js';
|
|
27
|
-
import { StockEntityClass,
|
|
28
|
+
import { StockEntityClass, MaterialEntity, LocationEntityClass, BatchEntityClass, BatchGroupEntityClass } from '@rytass/wms-module-core';
|
|
28
29
|
import { LocationDto } from '../dto/location.dto.js';
|
|
29
30
|
import { BatchDto } from '../dto/batch.dto.js';
|
|
30
31
|
|
|
31
32
|
let StockResolver = class StockResolver {
|
|
33
|
+
materialEntity;
|
|
34
|
+
/**
|
|
35
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
36
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
37
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
38
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
39
|
+
* discriminator and resolve nothing for a custom entity.
|
|
40
|
+
*/
|
|
41
|
+
constructor(materialEntity) {
|
|
42
|
+
this.materialEntity = materialEntity;
|
|
43
|
+
}
|
|
32
44
|
material({ materialId }, { loaders }) {
|
|
33
45
|
return loaders.batchSingle.load({
|
|
34
|
-
__entity:
|
|
46
|
+
__entity: this.materialEntity,
|
|
35
47
|
__from: { id: materialId },
|
|
36
48
|
});
|
|
37
49
|
}
|
|
@@ -77,7 +89,9 @@ __decorate([
|
|
|
77
89
|
__metadata("design:returntype", Promise)
|
|
78
90
|
], StockResolver.prototype, "batch", null);
|
|
79
91
|
StockResolver = __decorate([
|
|
80
|
-
Resolver(() => StockDto)
|
|
92
|
+
Resolver(() => StockDto),
|
|
93
|
+
__param(0, Inject(MaterialEntity)),
|
|
94
|
+
__metadata("design:paramtypes", [Function])
|
|
81
95
|
], StockResolver);
|
|
82
96
|
|
|
83
97
|
export { StockResolver };
|
|
@@ -11,6 +11,15 @@ export declare class TransferOrderResolver {
|
|
|
11
11
|
targetLoader({ id }: TransferOrderDto, { loaders }: LoaderType<TransferOrderItemEntityClass>, loaderLoader: LoaderType<LoadersEntityClass>): Promise<LoaderDto | null>;
|
|
12
12
|
}
|
|
13
13
|
export declare class TransferOrderItemResolver {
|
|
14
|
+
private readonly materialEntity;
|
|
15
|
+
/**
|
|
16
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
17
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
18
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
19
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
20
|
+
* discriminator and resolve nothing for a custom entity.
|
|
21
|
+
*/
|
|
22
|
+
constructor(materialEntity: new () => MaterialEntityClass);
|
|
14
23
|
material({ materialId }: TransferOrderItemEntityClass, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
|
|
15
24
|
batch({ batchId }: TransferOrderItemEntityClass, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto | null>;
|
|
16
25
|
location({ locationId }: TransferOrderItemEntityClass, { loaders }: LoaderType<LocationEntityClass>): Promise<LocationDto | null>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
+
import { Inject } from '@nestjs/common';
|
|
2
3
|
import { ResolveField, Parent, Context, Resolver, ID, Int } from '@nestjs/graphql';
|
|
3
4
|
import { TransferOrderDto } from '../dto/transfer-order.dto.js';
|
|
4
5
|
import { TransferOrderItemDto } from '../dto/transfer-order-item.dto.js';
|
|
5
|
-
import { TransferOrderItemEntityClass, LocationEntityClass, LoadersEntityClass,
|
|
6
|
+
import { TransferOrderItemEntityClass, MaterialEntity, LocationEntityClass, LoadersEntityClass, BatchEntityClass, BatchGroupEntityClass, TransferOrderChangeEntityClass } from '@rytass/wms-module-core';
|
|
6
7
|
import '../dto/loader-type.dto.js';
|
|
7
8
|
import { LoaderDto } from '../dto/loader.dto.js';
|
|
8
9
|
import { MaterialDto } from '../dto/material.dto.js';
|
|
@@ -90,9 +91,20 @@ TransferOrderResolver = __decorate([
|
|
|
90
91
|
Resolver(() => TransferOrderDto)
|
|
91
92
|
], TransferOrderResolver);
|
|
92
93
|
let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
94
|
+
materialEntity;
|
|
95
|
+
/**
|
|
96
|
+
* Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
|
|
97
|
+
* material entity the consumer configured — the built-in `MaterialEntityClass`
|
|
98
|
+
* unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
|
|
99
|
+
* built-in class outright would filter on its single-table-inheritance
|
|
100
|
+
* discriminator and resolve nothing for a custom entity.
|
|
101
|
+
*/
|
|
102
|
+
constructor(materialEntity) {
|
|
103
|
+
this.materialEntity = materialEntity;
|
|
104
|
+
}
|
|
93
105
|
material({ materialId }, { loaders }) {
|
|
94
106
|
return loaders.batchSingle.load({
|
|
95
|
-
__entity:
|
|
107
|
+
__entity: this.materialEntity,
|
|
96
108
|
__from: { id: materialId },
|
|
97
109
|
});
|
|
98
110
|
}
|
|
@@ -212,7 +224,9 @@ __decorate([
|
|
|
212
224
|
__metadata("design:returntype", Promise)
|
|
213
225
|
], TransferOrderItemResolver.prototype, "transferredQuantity", null);
|
|
214
226
|
TransferOrderItemResolver = __decorate([
|
|
215
|
-
Resolver(() => TransferOrderItemDto)
|
|
227
|
+
Resolver(() => TransferOrderItemDto),
|
|
228
|
+
__param(0, Inject(MaterialEntity)),
|
|
229
|
+
__metadata("design:paramtypes", [Function])
|
|
216
230
|
], TransferOrderItemResolver);
|
|
217
231
|
|
|
218
232
|
export { TransferOrderItemResolver, TransferOrderResolver };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rytass/wms-module-graphql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Rytass WMS Module — GraphQL schema, resolvers and DTOs for warehouse management",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rytass",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@nestjs/apollo": ">=13.0.0 <13.2.0",
|
|
58
58
|
"@nestjs/common": "^11.0.0",
|
|
59
59
|
"@nestjs/graphql": "^13.0.0",
|
|
60
|
-
"@rytass/wms-module-core": "^0.
|
|
60
|
+
"@rytass/wms-module-core": "^0.4.0",
|
|
61
61
|
"graphql": "^16.0.0",
|
|
62
62
|
"reflect-metadata": "^0.1.13 || ^0.2.0",
|
|
63
63
|
"rxjs": "^7.8.0",
|