@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.
@@ -24,26 +24,37 @@ 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 { StockEntityClass, MaterialEntityClass, LocationEntityClass, BatchEntityClass, BatchGroupEntityClass } from '@rytass/wms-module-core';
27
+ import { StockEntityClass, WmsEntities, BatchGroupEntityClass } from '@rytass/wms-module-core';
28
28
  import { LocationDto } from '../dto/location.dto.js';
29
29
  import { BatchDto } from '../dto/batch.dto.js';
30
30
 
31
31
  let ChangeLogResolver = class ChangeLogResolver {
32
+ entities;
33
+ /**
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.
39
+ */
40
+ constructor(entities) {
41
+ this.entities = entities;
42
+ }
32
43
  material({ materialId }, { loaders }) {
33
44
  return loaders.batchSingle.load({
34
- __entity: MaterialEntityClass,
45
+ __entity: this.entities.material,
35
46
  __from: { id: materialId },
36
47
  });
37
48
  }
38
49
  location({ locationId }, { loaders }) {
39
50
  return loaders.batchSingle.load({
40
- __entity: LocationEntityClass,
51
+ __entity: this.entities.location,
41
52
  __from: { id: locationId },
42
53
  });
43
54
  }
44
55
  async batch({ batchId }, { loaders }) {
45
56
  const { groupId } = await loaders.batchSingle.load({
46
- __entity: BatchEntityClass,
57
+ __entity: this.entities.batch,
47
58
  __from: { id: batchId },
48
59
  });
49
60
  return loaders.batchSingle.load({
@@ -77,7 +88,8 @@ __decorate([
77
88
  __metadata("design:returntype", Promise)
78
89
  ], ChangeLogResolver.prototype, "batch", null);
79
90
  ChangeLogResolver = __decorate([
80
- Resolver(() => ChangeLogDto)
91
+ Resolver(() => ChangeLogDto),
92
+ __metadata("design:paramtypes", [WmsEntities])
81
93
  ], ChangeLogResolver);
82
94
 
83
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,12 +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 entities;
11
+ /**
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
+ */
18
+ constructor(entities: WmsEntities);
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>;
@@ -24,7 +24,7 @@ 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 { ReceiveInventoryOrderItemEntityClass, MaterialEntityClass, BatchEntityClass, BatchGroupEntityClass, LocationEntityClass, LoadersEntityClass, ReceiveInventoryOrderChangeEntityClass } from '@rytass/wms-module-core';
27
+ import { ReceiveInventoryOrderItemEntityClass, WmsEntities, BatchGroupEntityClass, LoadersEntityClass, ReceiveInventoryOrderChangeEntityClass } 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
 
@@ -49,9 +49,20 @@ ReceiveInventoryOrderResolver = __decorate([
49
49
  Resolver(() => ReceiveInventoryOrderDto)
50
50
  ], ReceiveInventoryOrderResolver);
51
51
  let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver {
52
+ entities;
53
+ /**
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.
59
+ */
60
+ constructor(entities) {
61
+ this.entities = entities;
62
+ }
52
63
  material({ materialId }, { loaders }) {
53
64
  return loaders.batchSingle.load({
54
- __entity: MaterialEntityClass,
65
+ __entity: this.entities.material,
55
66
  __from: { id: materialId },
56
67
  });
57
68
  }
@@ -59,7 +70,7 @@ let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver
59
70
  if (!batchId)
60
71
  return null;
61
72
  const { groupId } = await loaders.batchSingle.load({
62
- __entity: BatchEntityClass,
73
+ __entity: this.entities.batch,
63
74
  __from: { id: batchId },
64
75
  });
65
76
  return loaders.batchSingle.load({
@@ -71,7 +82,7 @@ let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver
71
82
  if (!locationId)
72
83
  return null;
73
84
  return loaders.batchSingle.load({
74
- __entity: LocationEntityClass,
85
+ __entity: this.entities.location,
75
86
  __from: { id: locationId },
76
87
  });
77
88
  }
@@ -134,7 +145,8 @@ __decorate([
134
145
  __metadata("design:returntype", Promise)
135
146
  ], ReceiveInventoryOrderItemResolver.prototype, "receivedQuantity", null);
136
147
  ReceiveInventoryOrderItemResolver = __decorate([
137
- Resolver(() => ReceiveInventoryOrderItemDto)
148
+ Resolver(() => ReceiveInventoryOrderItemDto),
149
+ __metadata("design:paramtypes", [WmsEntities])
138
150
  ], ReceiveInventoryOrderItemResolver);
139
151
 
140
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,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 entities;
13
+ /**
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
+ */
20
+ constructor(entities: WmsEntities);
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 entities;
31
+ /**
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
+ */
38
+ constructor(entities: WmsEntities);
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>;
@@ -24,7 +24,7 @@ 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 { ShipInventoryOrderEntityClass, ShipInventoryOrderItemEntityClass, ShipInventoryOrderReferenceEntityClass, MaterialEntityClass, BatchEntityClass, BatchGroupEntityClass, LocationEntityClass, LoadersEntityClass, ShipInventoryOrderChangeEntityClass } from '@rytass/wms-module-core';
27
+ import { ShipInventoryOrderEntityClass, ShipInventoryOrderItemEntityClass, WmsEntities, ShipInventoryOrderReferenceEntityClass, BatchGroupEntityClass, LoadersEntityClass, ShipInventoryOrderChangeEntityClass } 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
  import { ShipInventoryOrderReferenceDto } from '../dto/ship-inventory-order-reference.dto.js';
@@ -64,9 +64,20 @@ ShipInventoryOrderResolver = __decorate([
64
64
  Resolver(() => ShipInventoryOrderDto)
65
65
  ], ShipInventoryOrderResolver);
66
66
  let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
67
+ entities;
68
+ /**
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.
74
+ */
75
+ constructor(entities) {
76
+ this.entities = entities;
77
+ }
67
78
  material({ materialId }, { loaders }) {
68
79
  return loaders.batchSingle.load({
69
- __entity: MaterialEntityClass,
80
+ __entity: this.entities.material,
70
81
  __from: { id: materialId },
71
82
  });
72
83
  }
@@ -74,7 +85,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
74
85
  if (!batchId)
75
86
  return null;
76
87
  const { groupId } = await loaders.batchSingle.load({
77
- __entity: BatchEntityClass,
88
+ __entity: this.entities.batch,
78
89
  __from: { id: batchId },
79
90
  });
80
91
  return loaders.batchSingle.load({
@@ -86,7 +97,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
86
97
  if (!batchId)
87
98
  return null;
88
99
  const { groupId } = await loaders.batchSingle.load({
89
- __entity: BatchEntityClass,
100
+ __entity: this.entities.batch,
90
101
  __from: { id: batchId },
91
102
  });
92
103
  return loaders.batchSingle
@@ -100,7 +111,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
100
111
  if (!batchId)
101
112
  return null;
102
113
  const { groupId } = await loaders.batchSingle.load({
103
- __entity: BatchEntityClass,
114
+ __entity: this.entities.batch,
104
115
  __from: { id: batchId },
105
116
  });
106
117
  return loaders.batchSingle
@@ -114,7 +125,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
114
125
  if (!locationId)
115
126
  return null;
116
127
  return loaders.batchSingle.load({
117
- __entity: LocationEntityClass,
128
+ __entity: this.entities.location,
118
129
  __from: { id: locationId },
119
130
  });
120
131
  }
@@ -194,9 +205,21 @@ __decorate([
194
205
  __metadata("design:returntype", Promise)
195
206
  ], ShipInventoryOrderItemResolver.prototype, "shippedQuantity", null);
196
207
  ShipInventoryOrderItemResolver = __decorate([
197
- Resolver(() => ShipInventoryOrderItemDto)
208
+ Resolver(() => ShipInventoryOrderItemDto),
209
+ __metadata("design:paramtypes", [WmsEntities])
198
210
  ], ShipInventoryOrderItemResolver);
199
211
  let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResolver {
212
+ entities;
213
+ /**
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.
219
+ */
220
+ constructor(entities) {
221
+ this.entities = entities;
222
+ }
200
223
  async shippedQuantity({ orderId, serialId }, { loaders }) {
201
224
  const items = await loaders.batchMany.load({
202
225
  __entity: ShipInventoryOrderItemEntityClass,
@@ -211,7 +234,7 @@ let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResol
211
234
  }
212
235
  material({ materialId }, { loaders }) {
213
236
  return loaders.batchSingle.load({
214
- __entity: MaterialEntityClass,
237
+ __entity: this.entities.material,
215
238
  __from: { id: materialId },
216
239
  });
217
240
  }
@@ -219,7 +242,7 @@ let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResol
219
242
  if (!batchId)
220
243
  return null;
221
244
  const { groupId } = await loaders.batchSingle.load({
222
- __entity: BatchEntityClass,
245
+ __entity: this.entities.batch,
223
246
  __from: { id: batchId },
224
247
  });
225
248
  return loaders.batchSingle.load({
@@ -267,7 +290,8 @@ __decorate([
267
290
  __metadata("design:returntype", Promise)
268
291
  ], ShipInventoryOrderReferenceResolver.prototype, "items", null);
269
292
  ShipInventoryOrderReferenceResolver = __decorate([
270
- Resolver(() => ShipInventoryOrderReferenceDto)
293
+ Resolver(() => ShipInventoryOrderReferenceDto),
294
+ __metadata("design:paramtypes", [WmsEntities])
271
295
  ], ShipInventoryOrderReferenceResolver);
272
296
 
273
297
  export { ShipInventoryOrderItemResolver, ShipInventoryOrderReferenceResolver, ShipInventoryOrderResolver };
@@ -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 StockResolver {
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 | null>;
@@ -24,26 +24,37 @@ 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 { StockEntityClass, MaterialEntityClass, LocationEntityClass, BatchEntityClass, BatchGroupEntityClass } from '@rytass/wms-module-core';
27
+ import { StockEntityClass, WmsEntities, BatchGroupEntityClass } from '@rytass/wms-module-core';
28
28
  import { LocationDto } from '../dto/location.dto.js';
29
29
  import { BatchDto } from '../dto/batch.dto.js';
30
30
 
31
31
  let StockResolver = class StockResolver {
32
+ entities;
33
+ /**
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.
39
+ */
40
+ constructor(entities) {
41
+ this.entities = entities;
42
+ }
32
43
  material({ materialId }, { loaders }) {
33
44
  return loaders.batchSingle.load({
34
- __entity: MaterialEntityClass,
45
+ __entity: this.entities.material,
35
46
  __from: { id: materialId },
36
47
  });
37
48
  }
38
49
  location({ locationId }, { loaders }) {
39
50
  return loaders.batchSingle.load({
40
- __entity: LocationEntityClass,
51
+ __entity: this.entities.location,
41
52
  __from: { id: locationId },
42
53
  });
43
54
  }
44
55
  async batch({ batchId }, { loaders }) {
45
56
  const { groupId } = await loaders.batchSingle.load({
46
- __entity: BatchEntityClass,
57
+ __entity: this.entities.batch,
47
58
  __from: { id: batchId },
48
59
  });
49
60
  return loaders.batchSingle.load({
@@ -77,7 +88,8 @@ __decorate([
77
88
  __metadata("design:returntype", Promise)
78
89
  ], StockResolver.prototype, "batch", null);
79
90
  StockResolver = __decorate([
80
- Resolver(() => StockDto)
91
+ Resolver(() => StockDto),
92
+ __metadata("design:paramtypes", [WmsEntities])
81
93
  ], StockResolver);
82
94
 
83
95
  export { StockResolver };
@@ -1,16 +1,34 @@
1
1
  import { TransferOrderDto } from '../dto/transfer-order.dto';
2
2
  import { TransferOrderItemDto } from '../dto/transfer-order-item.dto';
3
3
  import { type LoaderType } from '../helpers';
4
- import { BatchEntityClass, LoadersEntityClass, LocationEntityClass, MaterialEntityClass, TransferOrderChangeEntityClass, TransferOrderItemEntityClass } from '@rytass/wms-module-core';
4
+ import { BatchEntityClass, LoadersEntityClass, LocationEntityClass, MaterialEntityClass, TransferOrderChangeEntityClass, TransferOrderItemEntityClass, WmsEntities } from '@rytass/wms-module-core';
5
5
  import { LoaderDto, MaterialDto } from '../dto';
6
6
  import { BatchDto } from '../dto/batch.dto';
7
7
  import { LocationDto } from '../dto/location.dto';
8
8
  export declare class TransferOrderResolver {
9
+ private readonly entities;
10
+ /**
11
+ * The configured entities, not the built-in classes: `__entity` decides which
12
+ * repository the DataLoader opens, so it has to follow whatever the consumer
13
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
14
+ * on its single-table-inheritance discriminator and resolves nothing for an
15
+ * override.
16
+ */
17
+ constructor(entities: WmsEntities);
9
18
  items({ id }: TransferOrderDto, { loaders }: LoaderType<TransferOrderItemEntityClass>): Promise<TransferOrderItemDto[]>;
10
19
  targetLocation({ id }: TransferOrderDto, { loaders }: LoaderType<TransferOrderItemEntityClass>, locationLoader: LoaderType<LocationEntityClass>): Promise<LocationDto | null>;
11
20
  targetLoader({ id }: TransferOrderDto, { loaders }: LoaderType<TransferOrderItemEntityClass>, loaderLoader: LoaderType<LoadersEntityClass>): Promise<LoaderDto | null>;
12
21
  }
13
22
  export declare class TransferOrderItemResolver {
23
+ private readonly entities;
24
+ /**
25
+ * The configured entities, not the built-in classes: `__entity` decides which
26
+ * repository the DataLoader opens, so it has to follow whatever the consumer
27
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
28
+ * on its single-table-inheritance discriminator and resolves nothing for an
29
+ * override.
30
+ */
31
+ constructor(entities: WmsEntities);
14
32
  material({ materialId }: TransferOrderItemEntityClass, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
15
33
  batch({ batchId }: TransferOrderItemEntityClass, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto | null>;
16
34
  location({ locationId }: TransferOrderItemEntityClass, { loaders }: LoaderType<LocationEntityClass>): Promise<LocationDto | null>;
@@ -2,7 +2,7 @@ import { __decorate, __param, __metadata } from 'tslib';
2
2
  import { ResolveField, Parent, Context, Resolver, ID, Int } from '@nestjs/graphql';
3
3
  import { TransferOrderDto } from '../dto/transfer-order.dto.js';
4
4
  import { TransferOrderItemDto } from '../dto/transfer-order-item.dto.js';
5
- import { TransferOrderItemEntityClass, LocationEntityClass, LoadersEntityClass, MaterialEntityClass, BatchEntityClass, BatchGroupEntityClass, TransferOrderChangeEntityClass } from '@rytass/wms-module-core';
5
+ import { WmsEntities, TransferOrderItemEntityClass, LoadersEntityClass, BatchGroupEntityClass, TransferOrderChangeEntityClass } from '@rytass/wms-module-core';
6
6
  import '../dto/loader-type.dto.js';
7
7
  import { LoaderDto } from '../dto/loader.dto.js';
8
8
  import { MaterialDto } from '../dto/material.dto.js';
@@ -29,6 +29,17 @@ import { BatchDto } from '../dto/batch.dto.js';
29
29
  import { LocationDto } from '../dto/location.dto.js';
30
30
 
31
31
  let TransferOrderResolver = class TransferOrderResolver {
32
+ entities;
33
+ /**
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.
39
+ */
40
+ constructor(entities) {
41
+ this.entities = entities;
42
+ }
32
43
  items({ id }, { loaders }) {
33
44
  return loaders.batchMany.load({
34
45
  __entity: TransferOrderItemEntityClass,
@@ -43,7 +54,7 @@ let TransferOrderResolver = class TransferOrderResolver {
43
54
  if (!item?.targetLocationId)
44
55
  return null;
45
56
  return locationLoader.loaders.batchSingle.load({
46
- __entity: LocationEntityClass,
57
+ __entity: this.entities.location,
47
58
  __from: { id: item.targetLocationId },
48
59
  });
49
60
  }
@@ -87,12 +98,24 @@ __decorate([
87
98
  __metadata("design:returntype", Promise)
88
99
  ], TransferOrderResolver.prototype, "targetLoader", null);
89
100
  TransferOrderResolver = __decorate([
90
- Resolver(() => TransferOrderDto)
101
+ Resolver(() => TransferOrderDto),
102
+ __metadata("design:paramtypes", [WmsEntities])
91
103
  ], TransferOrderResolver);
92
104
  let TransferOrderItemResolver = class TransferOrderItemResolver {
105
+ entities;
106
+ /**
107
+ * The configured entities, not the built-in classes: `__entity` decides which
108
+ * repository the DataLoader opens, so it has to follow whatever the consumer
109
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
110
+ * on its single-table-inheritance discriminator and resolves nothing for an
111
+ * override.
112
+ */
113
+ constructor(entities) {
114
+ this.entities = entities;
115
+ }
93
116
  material({ materialId }, { loaders }) {
94
117
  return loaders.batchSingle.load({
95
- __entity: MaterialEntityClass,
118
+ __entity: this.entities.material,
96
119
  __from: { id: materialId },
97
120
  });
98
121
  }
@@ -100,7 +123,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
100
123
  if (!batchId)
101
124
  return null;
102
125
  const { groupId } = await loaders.batchSingle.load({
103
- __entity: BatchEntityClass,
126
+ __entity: this.entities.batch,
104
127
  __from: { id: batchId },
105
128
  });
106
129
  return loaders.batchSingle.load({
@@ -112,7 +135,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
112
135
  if (!locationId)
113
136
  return null;
114
137
  return loaders.batchSingle.load({
115
- __entity: LocationEntityClass,
138
+ __entity: this.entities.location,
116
139
  __from: { id: locationId },
117
140
  });
118
141
  }
@@ -129,7 +152,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
129
152
  return null;
130
153
  return loaders.batchSingle
131
154
  .load({
132
- __entity: BatchEntityClass,
155
+ __entity: this.entities.batch,
133
156
  __from: { id: batchId },
134
157
  })
135
158
  .then((batch) => batch.saleId);
@@ -139,7 +162,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
139
162
  return null;
140
163
  return loaders.batchSingle
141
164
  .load({
142
- __entity: BatchEntityClass,
165
+ __entity: this.entities.batch,
143
166
  __from: { id: batchId },
144
167
  })
145
168
  .then((batch) => batch.saleSerialId);
@@ -212,7 +235,8 @@ __decorate([
212
235
  __metadata("design:returntype", Promise)
213
236
  ], TransferOrderItemResolver.prototype, "transferredQuantity", null);
214
237
  TransferOrderItemResolver = __decorate([
215
- Resolver(() => TransferOrderItemDto)
238
+ Resolver(() => TransferOrderItemDto),
239
+ __metadata("design:paramtypes", [WmsEntities])
216
240
  ], TransferOrderItemResolver);
217
241
 
218
242
  export { TransferOrderItemResolver, TransferOrderResolver };