@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.
@@ -1,5 +1,4 @@
1
1
  import { __decorate, __param, __metadata } from 'tslib';
2
- import { Inject } from '@nestjs/common';
3
2
  import { ResolveField, ID, Parent, Context, Resolver } from '@nestjs/graphql';
4
3
  import '../dto/loader-type.dto.js';
5
4
  import { LoaderDto } from '../dto/loader.dto.js';
@@ -25,37 +24,29 @@ import '../dto/scrape-order.dto.js';
25
24
  import '../dto/scrape-order-item.dto.js';
26
25
  import '../dto/quality-inspection-order.dto.js';
27
26
  import '../dto/quality-inspection-order-item.dto.js';
28
- import { MaterialEntity, StockService, BatchEntityClass, BatchGroupEntityClass, LocationEntityClass, LoadersEntityClass } from '@rytass/wms-module-core';
27
+ import { StockService, WmsEntities, BatchGroupEntityClass, LoadersEntityClass } from '@rytass/wms-module-core';
29
28
  import { BatchDto } from '../dto/batch.dto.js';
30
29
  import { LocationDto } from '../dto/location.dto.js';
31
30
 
32
31
  let AggregatedStockResolver = class AggregatedStockResolver {
33
32
  stockService;
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) {
33
+ entities;
34
+ constructor(stockService, entities) {
44
35
  this.stockService = stockService;
45
- this.materialEntity = materialEntity;
36
+ this.entities = entities;
46
37
  }
47
38
  async id(stock) {
48
39
  return this.stockService.generatedAggregateKey(stock);
49
40
  }
50
41
  async material({ materialId }, { loaders }) {
51
42
  return loaders.batchSingle.load({
52
- __entity: this.materialEntity,
43
+ __entity: this.entities.material,
53
44
  __from: { id: materialId },
54
45
  });
55
46
  }
56
47
  async batch({ batchId }, { loaders }) {
57
48
  const { groupId } = await loaders.batchSingle.load({
58
- __entity: BatchEntityClass,
49
+ __entity: this.entities.batch,
59
50
  __from: { id: batchId },
60
51
  });
61
52
  return loaders.batchSingle.load({
@@ -65,7 +56,7 @@ let AggregatedStockResolver = class AggregatedStockResolver {
65
56
  }
66
57
  async location({ locationId }, { loaders }) {
67
58
  return loaders.batchSingle.load({
68
- __entity: LocationEntityClass,
59
+ __entity: this.entities.location,
69
60
  __from: { id: locationId },
70
61
  });
71
62
  }
@@ -117,8 +108,8 @@ __decorate([
117
108
  ], AggregatedStockResolver.prototype, "loader", null);
118
109
  AggregatedStockResolver = __decorate([
119
110
  Resolver(() => AggregatedStockDto),
120
- __param(1, Inject(MaterialEntity)),
121
- __metadata("design:paramtypes", [StockService, Function])
111
+ __metadata("design:paramtypes", [StockService,
112
+ WmsEntities])
122
113
  ], AggregatedStockResolver);
123
114
 
124
115
  export { AggregatedStockResolver };
@@ -1,18 +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 materialEntity;
7
+ private readonly entities;
8
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.
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
14
  */
15
- constructor(materialEntity: new () => MaterialEntityClass);
15
+ constructor(entities: WmsEntities);
16
16
  material({ materialId }: StockEntityClass, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
17
17
  location({ locationId }: StockEntityClass, { loaders }: LoaderType<LocationEntityClass>): Promise<LocationDto>;
18
18
  batch({ batchId }: StockEntityClass, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto>;
@@ -1,5 +1,4 @@
1
1
  import { __decorate, __param, __metadata } from 'tslib';
2
- import { Inject } from '@nestjs/common';
3
2
  import { ResolveField, Parent, Context, Resolver } from '@nestjs/graphql';
4
3
  import '../dto/loader-type.dto.js';
5
4
  import '../dto/loader.dto.js';
@@ -25,37 +24,37 @@ import '../dto/scrape-order.dto.js';
25
24
  import '../dto/scrape-order-item.dto.js';
26
25
  import '../dto/quality-inspection-order.dto.js';
27
26
  import '../dto/quality-inspection-order-item.dto.js';
28
- import { StockEntityClass, MaterialEntity, LocationEntityClass, BatchEntityClass, BatchGroupEntityClass } from '@rytass/wms-module-core';
27
+ import { StockEntityClass, WmsEntities, BatchGroupEntityClass } from '@rytass/wms-module-core';
29
28
  import { LocationDto } from '../dto/location.dto.js';
30
29
  import { BatchDto } from '../dto/batch.dto.js';
31
30
 
32
31
  let ChangeLogResolver = class ChangeLogResolver {
33
- materialEntity;
32
+ entities;
34
33
  /**
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.
34
+ * The configured entities, not the built-in classes: `__entity` decides which
35
+ * repository the DataLoader opens, so it has to follow whatever the consumer
36
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
37
+ * on its single-table-inheritance discriminator and resolves nothing for an
38
+ * override.
40
39
  */
41
- constructor(materialEntity) {
42
- this.materialEntity = materialEntity;
40
+ constructor(entities) {
41
+ this.entities = entities;
43
42
  }
44
43
  material({ materialId }, { loaders }) {
45
44
  return loaders.batchSingle.load({
46
- __entity: this.materialEntity,
45
+ __entity: this.entities.material,
47
46
  __from: { id: materialId },
48
47
  });
49
48
  }
50
49
  location({ locationId }, { loaders }) {
51
50
  return loaders.batchSingle.load({
52
- __entity: LocationEntityClass,
51
+ __entity: this.entities.location,
53
52
  __from: { id: locationId },
54
53
  });
55
54
  }
56
55
  async batch({ batchId }, { loaders }) {
57
56
  const { groupId } = await loaders.batchSingle.load({
58
- __entity: BatchEntityClass,
57
+ __entity: this.entities.batch,
59
58
  __from: { id: batchId },
60
59
  });
61
60
  return loaders.batchSingle.load({
@@ -90,8 +89,7 @@ __decorate([
90
89
  ], ChangeLogResolver.prototype, "batch", null);
91
90
  ChangeLogResolver = __decorate([
92
91
  Resolver(() => ChangeLogDto),
93
- __param(0, Inject(MaterialEntity)),
94
- __metadata("design:paramtypes", [Function])
92
+ __metadata("design:paramtypes", [WmsEntities])
95
93
  ], ChangeLogResolver);
96
94
 
97
95
  export { ChangeLogResolver };
@@ -1,8 +1,16 @@
1
- import { LoadersEntityClass, LoaderTypeEntityClass, LocationEntityClass, StockService } from '@rytass/wms-module-core';
1
+ import { LoaderTypeEntityClass, LoadersEntityClass, LocationEntityClass, StockService, WmsEntities } from '@rytass/wms-module-core';
2
2
  import { type LoaderType } from '../helpers';
3
3
  export declare class LoaderResolver {
4
+ private readonly entities;
4
5
  private readonly stockService;
5
- constructor(stockService: StockService);
6
+ /**
7
+ * The configured entities, not the built-in classes: `__entity` decides which
8
+ * repository the DataLoader opens, so it has to follow whatever the consumer
9
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
10
+ * on its single-table-inheritance discriminator and resolves nothing for an
11
+ * override.
12
+ */
13
+ constructor(entities: WmsEntities, stockService: StockService);
6
14
  type({ typeId }: LoadersEntityClass, { loaders }: LoaderType<LoaderTypeEntityClass>): Promise<LoaderTypeEntityClass>;
7
15
  location({ locationId }: LoadersEntityClass, { loaders }: LoaderType<LocationEntityClass>): Promise<LocationEntityClass>;
8
16
  totalQuantity({ id }: LoadersEntityClass): Promise<number>;
@@ -24,13 +24,22 @@ 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 { LoadersEntityClass, StockService, LoaderTypeEntityClass, LocationEntityClass } from '@rytass/wms-module-core';
27
+ import { LoadersEntityClass, WmsEntities, StockService, LoaderTypeEntityClass } from '@rytass/wms-module-core';
28
28
  import { LocationDto } from '../dto/location.dto.js';
29
29
  import _ from 'lodash';
30
30
 
31
31
  let LoaderResolver = class LoaderResolver {
32
+ entities;
32
33
  stockService;
33
- constructor(stockService) {
34
+ /**
35
+ * The configured entities, not the built-in classes: `__entity` decides which
36
+ * repository the DataLoader opens, so it has to follow whatever the consumer
37
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
38
+ * on its single-table-inheritance discriminator and resolves nothing for an
39
+ * override.
40
+ */
41
+ constructor(entities, stockService) {
42
+ this.entities = entities;
34
43
  this.stockService = stockService;
35
44
  }
36
45
  type({ typeId }, { loaders }) {
@@ -41,7 +50,7 @@ let LoaderResolver = class LoaderResolver {
41
50
  }
42
51
  location({ locationId }, { loaders }) {
43
52
  return loaders.batchSingle.load({
44
- __entity: LocationEntityClass,
53
+ __entity: this.entities.location,
45
54
  __from: { id: locationId },
46
55
  });
47
56
  }
@@ -80,7 +89,8 @@ __decorate([
80
89
  ], LoaderResolver.prototype, "totalQuantity", null);
81
90
  LoaderResolver = __decorate([
82
91
  Resolver(() => LoaderDto),
83
- __metadata("design:paramtypes", [StockService])
92
+ __metadata("design:paramtypes", [WmsEntities,
93
+ StockService])
84
94
  ], LoaderResolver);
85
95
 
86
96
  export { LoaderResolver };
@@ -2,8 +2,17 @@ import { LocationDto } from '../dto/location.dto';
2
2
  import { MapDataDto } from '../dto/warehouse-map.dto';
3
3
  import { type LoaderType } from '../helpers';
4
4
  import { WarehouseMapEntity } from '@rytass/wms-base-nestjs-module/models/warehouse-map.entity';
5
- import { LocationEntityClass } from '@rytass/wms-module-core';
5
+ import { LocationEntityClass, WmsEntities } from '@rytass/wms-module-core';
6
6
  export declare class LocationResolver {
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
  mapData({ id }: LocationDto, { loaders }: LoaderType<WarehouseMapEntity>): Promise<MapDataDto | null>;
8
17
  parent({ parentId }: LocationEntityClass, { loaders }: LoaderType<LocationEntityClass>): Promise<LocationEntityClass> | null;
9
18
  /**
@@ -2,13 +2,23 @@ import { __decorate, __param, __metadata } from 'tslib';
2
2
  import { ResolveField, Parent, Context, Resolver } from '@nestjs/graphql';
3
3
  import { LocationDto } from '../dto/location.dto.js';
4
4
  import { MapDataDto } from '../dto/warehouse-map.dto.js';
5
- import { WarehouseMapEntity } from '@rytass/wms-base-nestjs-module/models/warehouse-map.entity';
6
- import { LocationEntityClass } from '@rytass/wms-module-core';
5
+ import { LocationEntityClass, WmsEntities } from '@rytass/wms-module-core';
7
6
 
8
7
  let LocationResolver = class LocationResolver {
8
+ entities;
9
+ /**
10
+ * The configured entities, not the built-in classes: `__entity` decides which
11
+ * repository the DataLoader opens, so it has to follow whatever the consumer
12
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
13
+ * on its single-table-inheritance discriminator and resolves nothing for an
14
+ * override.
15
+ */
16
+ constructor(entities) {
17
+ this.entities = entities;
18
+ }
9
19
  async mapData({ id }, { loaders }) {
10
20
  const map = await loaders.batchSingle.load({
11
- __entity: WarehouseMapEntity,
21
+ __entity: this.entities.warehouseMap,
12
22
  __from: { id },
13
23
  });
14
24
  return map?.mapData || null;
@@ -17,7 +27,7 @@ let LocationResolver = class LocationResolver {
17
27
  if (!parentId)
18
28
  return null;
19
29
  return loaders.batchSingle.load({
20
- __entity: LocationEntityClass,
30
+ __entity: this.entities.location,
21
31
  __from: { id: parentId },
22
32
  });
23
33
  }
@@ -32,7 +42,7 @@ let LocationResolver = class LocationResolver {
32
42
  */
33
43
  children({ id }, { loaders }) {
34
44
  return loaders.batchMany.load({
35
- __entity: LocationEntityClass,
45
+ __entity: this.entities.location,
36
46
  __from: { parentId: id },
37
47
  __conditions: (qb) => qb.orderBy('entity."key"', 'ASC'),
38
48
  });
@@ -63,7 +73,8 @@ __decorate([
63
73
  __metadata("design:returntype", Promise)
64
74
  ], LocationResolver.prototype, "children", null);
65
75
  LocationResolver = __decorate([
66
- Resolver(() => LocationDto)
76
+ Resolver(() => LocationDto),
77
+ __metadata("design:paramtypes", [WmsEntities])
67
78
  ], LocationResolver);
68
79
 
69
80
  export { LocationResolver };
@@ -1,21 +1,21 @@
1
1
  import { LoaderDto, MaterialDto, ReceiveInventoryOrderDto, ReceiveInventoryOrderItemDto } from '../dto';
2
2
  import { type LoaderType } from '../helpers';
3
- import { BatchEntityClass, LoadersEntityClass, LocationEntityClass, MaterialEntityClass, ReceiveInventoryOrderChangeEntityClass, ReceiveInventoryOrderItemEntityClass } from '@rytass/wms-module-core';
3
+ import { BatchEntityClass, LoadersEntityClass, LocationEntityClass, MaterialEntityClass, ReceiveInventoryOrderChangeEntityClass, ReceiveInventoryOrderItemEntityClass, 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 ReceiveInventoryOrderResolver {
7
7
  items({ id }: ReceiveInventoryOrderDto, { loaders }: LoaderType<ReceiveInventoryOrderItemEntityClass>): Promise<ReceiveInventoryOrderItemDto[]>;
8
8
  }
9
9
  export declare class ReceiveInventoryOrderItemResolver {
10
- private readonly materialEntity;
10
+ private readonly entities;
11
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.
12
+ * The configured entities, not the built-in classes: `__entity` decides which
13
+ * repository the DataLoader opens, so it has to follow whatever the consumer
14
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
15
+ * on its single-table-inheritance discriminator and resolves nothing for an
16
+ * override.
17
17
  */
18
- constructor(materialEntity: new () => MaterialEntityClass);
18
+ constructor(entities: WmsEntities);
19
19
  material({ materialId }: ReceiveInventoryOrderItemEntityClass, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
20
20
  batch({ batchId }: ReceiveInventoryOrderItemEntityClass, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto | null>;
21
21
  location({ locationId }: ReceiveInventoryOrderItemEntityClass, { loaders }: LoaderType<LocationEntityClass>): Promise<LocationDto | null>;
@@ -1,5 +1,4 @@
1
1
  import { __decorate, __param, __metadata } from 'tslib';
2
- import { Inject } from '@nestjs/common';
3
2
  import { ResolveField, Parent, Context, Resolver, Int } from '@nestjs/graphql';
4
3
  import '../dto/loader-type.dto.js';
5
4
  import { LoaderDto } from '../dto/loader.dto.js';
@@ -25,7 +24,7 @@ import '../dto/scrape-order.dto.js';
25
24
  import '../dto/scrape-order-item.dto.js';
26
25
  import '../dto/quality-inspection-order.dto.js';
27
26
  import '../dto/quality-inspection-order-item.dto.js';
28
- import { ReceiveInventoryOrderItemEntityClass, MaterialEntity, BatchEntityClass, BatchGroupEntityClass, LocationEntityClass, LoadersEntityClass, ReceiveInventoryOrderChangeEntityClass } from '@rytass/wms-module-core';
27
+ import { ReceiveInventoryOrderItemEntityClass, WmsEntities, BatchGroupEntityClass, LoadersEntityClass, ReceiveInventoryOrderChangeEntityClass } from '@rytass/wms-module-core';
29
28
  import { BatchDto } from '../dto/batch.dto.js';
30
29
  import { LocationDto } from '../dto/location.dto.js';
31
30
 
@@ -50,20 +49,20 @@ ReceiveInventoryOrderResolver = __decorate([
50
49
  Resolver(() => ReceiveInventoryOrderDto)
51
50
  ], ReceiveInventoryOrderResolver);
52
51
  let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver {
53
- materialEntity;
52
+ entities;
54
53
  /**
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.
54
+ * The configured entities, not the built-in classes: `__entity` decides which
55
+ * repository the DataLoader opens, so it has to follow whatever the consumer
56
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
57
+ * on its single-table-inheritance discriminator and resolves nothing for an
58
+ * override.
60
59
  */
61
- constructor(materialEntity) {
62
- this.materialEntity = materialEntity;
60
+ constructor(entities) {
61
+ this.entities = entities;
63
62
  }
64
63
  material({ materialId }, { loaders }) {
65
64
  return loaders.batchSingle.load({
66
- __entity: this.materialEntity,
65
+ __entity: this.entities.material,
67
66
  __from: { id: materialId },
68
67
  });
69
68
  }
@@ -71,7 +70,7 @@ let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver
71
70
  if (!batchId)
72
71
  return null;
73
72
  const { groupId } = await loaders.batchSingle.load({
74
- __entity: BatchEntityClass,
73
+ __entity: this.entities.batch,
75
74
  __from: { id: batchId },
76
75
  });
77
76
  return loaders.batchSingle.load({
@@ -83,7 +82,7 @@ let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver
83
82
  if (!locationId)
84
83
  return null;
85
84
  return loaders.batchSingle.load({
86
- __entity: LocationEntityClass,
85
+ __entity: this.entities.location,
87
86
  __from: { id: locationId },
88
87
  });
89
88
  }
@@ -147,8 +146,7 @@ __decorate([
147
146
  ], ReceiveInventoryOrderItemResolver.prototype, "receivedQuantity", null);
148
147
  ReceiveInventoryOrderItemResolver = __decorate([
149
148
  Resolver(() => ReceiveInventoryOrderItemDto),
150
- __param(0, Inject(MaterialEntity)),
151
- __metadata("design:paramtypes", [Function])
149
+ __metadata("design:paramtypes", [WmsEntities])
152
150
  ], ReceiveInventoryOrderItemResolver);
153
151
 
154
152
  export { ReceiveInventoryOrderItemResolver, ReceiveInventoryOrderResolver };
@@ -1,5 +1,5 @@
1
1
  import { LoaderDto, MaterialDto, ShipInventoryOrderItemDto } from '../dto';
2
- import { BatchEntityClass, LoadersEntityClass, LocationEntityClass, MaterialEntityClass, ShipInventoryOrderChangeEntityClass, ShipInventoryOrderEntityClass, ShipInventoryOrderItemEntityClass, ShipInventoryOrderReferenceEntityClass } from '@rytass/wms-module-core';
2
+ import { BatchEntityClass, LoadersEntityClass, LocationEntityClass, MaterialEntityClass, ShipInventoryOrderChangeEntityClass, ShipInventoryOrderEntityClass, ShipInventoryOrderItemEntityClass, ShipInventoryOrderReferenceEntityClass, WmsEntities } from '@rytass/wms-module-core';
3
3
  import { type LoaderType } from '../helpers';
4
4
  import { BatchDto } from '../dto/batch.dto';
5
5
  import { LocationDto } from '../dto/location.dto';
@@ -9,15 +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;
12
+ private readonly entities;
13
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.
14
+ * The configured entities, not the built-in classes: `__entity` decides which
15
+ * repository the DataLoader opens, so it has to follow whatever the consumer
16
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
17
+ * on its single-table-inheritance discriminator and resolves nothing for an
18
+ * override.
19
19
  */
20
- constructor(materialEntity: new () => MaterialEntityClass);
20
+ constructor(entities: WmsEntities);
21
21
  material({ materialId }: ShipInventoryOrderItemEntityClass, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
22
22
  batch({ batchId }: ShipInventoryOrderItemEntityClass, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto | null>;
23
23
  saleId({ batchId }: ShipInventoryOrderItemEntityClass, { loaders }: LoaderType<BatchEntityClass>): Promise<string | null>;
@@ -27,15 +27,15 @@ export declare class ShipInventoryOrderItemResolver {
27
27
  shippedQuantity({ id }: ShipInventoryOrderItemEntityClass, { loaders }: LoaderType<ShipInventoryOrderChangeEntityClass>): Promise<number>;
28
28
  }
29
29
  export declare class ShipInventoryOrderReferenceResolver {
30
- private readonly materialEntity;
30
+ private readonly entities;
31
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.
32
+ * The configured entities, not the built-in classes: `__entity` decides which
33
+ * repository the DataLoader opens, so it has to follow whatever the consumer
34
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
35
+ * on its single-table-inheritance discriminator and resolves nothing for an
36
+ * override.
37
37
  */
38
- constructor(materialEntity: new () => MaterialEntityClass);
38
+ constructor(entities: WmsEntities);
39
39
  shippedQuantity({ orderId, serialId }: ShipInventoryOrderReferenceEntityClass, { loaders }: LoaderType<ShipInventoryOrderItemEntityClass>): Promise<number>;
40
40
  material({ materialId }: ShipInventoryOrderReferenceEntityClass, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
41
41
  batch({ batchId }: ShipInventoryOrderReferenceEntityClass, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto | null>;
@@ -1,5 +1,4 @@
1
1
  import { __decorate, __param, __metadata } from 'tslib';
2
- import { Inject } from '@nestjs/common';
3
2
  import { ResolveField, Parent, Context, Resolver, ID, Int } from '@nestjs/graphql';
4
3
  import '../dto/loader-type.dto.js';
5
4
  import { LoaderDto } from '../dto/loader.dto.js';
@@ -25,7 +24,7 @@ import '../dto/scrape-order.dto.js';
25
24
  import '../dto/scrape-order-item.dto.js';
26
25
  import '../dto/quality-inspection-order.dto.js';
27
26
  import '../dto/quality-inspection-order-item.dto.js';
28
- import { ShipInventoryOrderEntityClass, ShipInventoryOrderItemEntityClass, MaterialEntity, ShipInventoryOrderReferenceEntityClass, BatchEntityClass, BatchGroupEntityClass, LocationEntityClass, LoadersEntityClass, ShipInventoryOrderChangeEntityClass } from '@rytass/wms-module-core';
27
+ import { ShipInventoryOrderEntityClass, ShipInventoryOrderItemEntityClass, WmsEntities, ShipInventoryOrderReferenceEntityClass, BatchGroupEntityClass, LoadersEntityClass, ShipInventoryOrderChangeEntityClass } from '@rytass/wms-module-core';
29
28
  import { BatchDto } from '../dto/batch.dto.js';
30
29
  import { LocationDto } from '../dto/location.dto.js';
31
30
  import { ShipInventoryOrderReferenceDto } from '../dto/ship-inventory-order-reference.dto.js';
@@ -65,20 +64,20 @@ ShipInventoryOrderResolver = __decorate([
65
64
  Resolver(() => ShipInventoryOrderDto)
66
65
  ], ShipInventoryOrderResolver);
67
66
  let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
68
- materialEntity;
67
+ entities;
69
68
  /**
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.
69
+ * The configured entities, not the built-in classes: `__entity` decides which
70
+ * repository the DataLoader opens, so it has to follow whatever the consumer
71
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
72
+ * on its single-table-inheritance discriminator and resolves nothing for an
73
+ * override.
75
74
  */
76
- constructor(materialEntity) {
77
- this.materialEntity = materialEntity;
75
+ constructor(entities) {
76
+ this.entities = entities;
78
77
  }
79
78
  material({ materialId }, { loaders }) {
80
79
  return loaders.batchSingle.load({
81
- __entity: this.materialEntity,
80
+ __entity: this.entities.material,
82
81
  __from: { id: materialId },
83
82
  });
84
83
  }
@@ -86,7 +85,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
86
85
  if (!batchId)
87
86
  return null;
88
87
  const { groupId } = await loaders.batchSingle.load({
89
- __entity: BatchEntityClass,
88
+ __entity: this.entities.batch,
90
89
  __from: { id: batchId },
91
90
  });
92
91
  return loaders.batchSingle.load({
@@ -98,7 +97,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
98
97
  if (!batchId)
99
98
  return null;
100
99
  const { groupId } = await loaders.batchSingle.load({
101
- __entity: BatchEntityClass,
100
+ __entity: this.entities.batch,
102
101
  __from: { id: batchId },
103
102
  });
104
103
  return loaders.batchSingle
@@ -112,7 +111,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
112
111
  if (!batchId)
113
112
  return null;
114
113
  const { groupId } = await loaders.batchSingle.load({
115
- __entity: BatchEntityClass,
114
+ __entity: this.entities.batch,
116
115
  __from: { id: batchId },
117
116
  });
118
117
  return loaders.batchSingle
@@ -126,7 +125,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
126
125
  if (!locationId)
127
126
  return null;
128
127
  return loaders.batchSingle.load({
129
- __entity: LocationEntityClass,
128
+ __entity: this.entities.location,
130
129
  __from: { id: locationId },
131
130
  });
132
131
  }
@@ -207,20 +206,19 @@ __decorate([
207
206
  ], ShipInventoryOrderItemResolver.prototype, "shippedQuantity", null);
208
207
  ShipInventoryOrderItemResolver = __decorate([
209
208
  Resolver(() => ShipInventoryOrderItemDto),
210
- __param(0, Inject(MaterialEntity)),
211
- __metadata("design:paramtypes", [Function])
209
+ __metadata("design:paramtypes", [WmsEntities])
212
210
  ], ShipInventoryOrderItemResolver);
213
211
  let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResolver {
214
- materialEntity;
212
+ entities;
215
213
  /**
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.
214
+ * The configured entities, not the built-in classes: `__entity` decides which
215
+ * repository the DataLoader opens, so it has to follow whatever the consumer
216
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
217
+ * on its single-table-inheritance discriminator and resolves nothing for an
218
+ * override.
221
219
  */
222
- constructor(materialEntity) {
223
- this.materialEntity = materialEntity;
220
+ constructor(entities) {
221
+ this.entities = entities;
224
222
  }
225
223
  async shippedQuantity({ orderId, serialId }, { loaders }) {
226
224
  const items = await loaders.batchMany.load({
@@ -236,7 +234,7 @@ let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResol
236
234
  }
237
235
  material({ materialId }, { loaders }) {
238
236
  return loaders.batchSingle.load({
239
- __entity: this.materialEntity,
237
+ __entity: this.entities.material,
240
238
  __from: { id: materialId },
241
239
  });
242
240
  }
@@ -244,7 +242,7 @@ let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResol
244
242
  if (!batchId)
245
243
  return null;
246
244
  const { groupId } = await loaders.batchSingle.load({
247
- __entity: BatchEntityClass,
245
+ __entity: this.entities.batch,
248
246
  __from: { id: batchId },
249
247
  });
250
248
  return loaders.batchSingle.load({
@@ -293,8 +291,7 @@ __decorate([
293
291
  ], ShipInventoryOrderReferenceResolver.prototype, "items", null);
294
292
  ShipInventoryOrderReferenceResolver = __decorate([
295
293
  Resolver(() => ShipInventoryOrderReferenceDto),
296
- __param(0, Inject(MaterialEntity)),
297
- __metadata("design:paramtypes", [Function])
294
+ __metadata("design:paramtypes", [WmsEntities])
298
295
  ], ShipInventoryOrderReferenceResolver);
299
296
 
300
297
  export { ShipInventoryOrderItemResolver, ShipInventoryOrderReferenceResolver, ShipInventoryOrderResolver };
@@ -1,18 +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 StockResolver {
7
- private readonly materialEntity;
7
+ private readonly entities;
8
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.
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
14
  */
15
- constructor(materialEntity: new () => MaterialEntityClass);
15
+ constructor(entities: WmsEntities);
16
16
  material({ materialId }: StockEntityClass, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
17
17
  location({ locationId }: StockEntityClass, { loaders }: LoaderType<LocationEntityClass>): Promise<LocationDto>;
18
18
  batch({ batchId }: StockEntityClass, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto | null>;