@rytass/wms-module-graphql 0.7.0 → 0.9.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.
Files changed (53) hide show
  1. package/README.md +94 -6
  2. package/docs/api-reference.md +81 -6
  3. package/docs/events.md +23 -4
  4. package/index.cjs.js +919 -110
  5. package/index.d.ts +3 -1
  6. package/index.js +2 -0
  7. package/lib/dto/index.d.ts +1 -0
  8. package/lib/dto/inventory-count-order.dto.d.ts +49 -0
  9. package/lib/dto/inventory-count-order.dto.js +146 -0
  10. package/lib/events/operation-result-map.d.ts +8 -0
  11. package/lib/graphql.module.d.ts +6 -2
  12. package/lib/graphql.module.js +18 -1
  13. package/lib/inputs/inventory-count-order.args.d.ts +55 -0
  14. package/lib/inputs/inventory-count-order.args.js +196 -0
  15. package/lib/mutations/inventory-count-order.mutation.d.ts +19 -0
  16. package/lib/mutations/inventory-count-order.mutation.js +138 -0
  17. package/lib/mutations/loader.mutation.js +1 -0
  18. package/lib/mutations/material.mutation.js +1 -0
  19. package/lib/mutations/receive-inventory-order.mutation.js +1 -0
  20. package/lib/mutations/ship-inventory-order.mutation.js +1 -0
  21. package/lib/queries/inventory-count-order.query.d.ts +9 -0
  22. package/lib/queries/inventory-count-order.query.js +44 -0
  23. package/lib/queries/loader.query.js +1 -0
  24. package/lib/queries/material.query.js +1 -0
  25. package/lib/queries/recieve-inventory-order.query.js +1 -0
  26. package/lib/queries/ship-inventory-order.query.js +1 -0
  27. package/lib/queries/stock.query.js +1 -0
  28. package/lib/registry/index.d.ts +1 -0
  29. package/lib/registry/operation-registry.d.ts +59 -0
  30. package/lib/registry/operation-registry.js +136 -0
  31. package/lib/resolvers/aggregated-stock.resolver.d.ts +3 -11
  32. package/lib/resolvers/aggregated-stock.resolver.js +10 -18
  33. package/lib/resolvers/change-log.resolver.d.ts +8 -8
  34. package/lib/resolvers/change-log.resolver.js +14 -15
  35. package/lib/resolvers/inventory-count-order.resolver.d.ts +34 -0
  36. package/lib/resolvers/inventory-count-order.resolver.js +148 -0
  37. package/lib/resolvers/loader-type.resolver.js +1 -0
  38. package/lib/resolvers/loader.resolver.d.ts +10 -2
  39. package/lib/resolvers/loader.resolver.js +15 -4
  40. package/lib/resolvers/location.resolver.d.ts +10 -1
  41. package/lib/resolvers/location.resolver.js +17 -6
  42. package/lib/resolvers/material.resolver.js +1 -0
  43. package/lib/resolvers/receive-inventory-order.resolver.d.ts +8 -8
  44. package/lib/resolvers/receive-inventory-order.resolver.js +14 -15
  45. package/lib/resolvers/ship-inventory-order.resolver.d.ts +15 -15
  46. package/lib/resolvers/ship-inventory-order.resolver.js +27 -29
  47. package/lib/resolvers/stock.resolver.d.ts +8 -8
  48. package/lib/resolvers/stock.resolver.js +14 -15
  49. package/lib/resolvers/transfer-order.resolver.d.ts +17 -8
  50. package/lib/resolvers/transfer-order.resolver.js +30 -19
  51. package/lib/resolvers/warehouse-map.resolver.d.ts +10 -1
  52. package/lib/resolvers/warehouse-map.resolver.js +15 -3
  53. package/package.json +2 -2
@@ -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,8 @@ 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 '../dto/inventory-count-order.dto.js';
28
+ import { ShipInventoryOrderEntityClass, ShipInventoryOrderItemEntityClass, WmsEntities, ShipInventoryOrderReferenceEntityClass, BatchGroupEntityClass, LoadersEntityClass, ShipInventoryOrderChangeEntityClass } from '@rytass/wms-module-core';
29
29
  import { BatchDto } from '../dto/batch.dto.js';
30
30
  import { LocationDto } from '../dto/location.dto.js';
31
31
  import { ShipInventoryOrderReferenceDto } from '../dto/ship-inventory-order-reference.dto.js';
@@ -65,20 +65,20 @@ ShipInventoryOrderResolver = __decorate([
65
65
  Resolver(() => ShipInventoryOrderDto)
66
66
  ], ShipInventoryOrderResolver);
67
67
  let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
68
- materialEntity;
68
+ entities;
69
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.
70
+ * The configured entities, not the built-in classes: `__entity` decides which
71
+ * repository the DataLoader opens, so it has to follow whatever the consumer
72
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
73
+ * on its single-table-inheritance discriminator and resolves nothing for an
74
+ * override.
75
75
  */
76
- constructor(materialEntity) {
77
- this.materialEntity = materialEntity;
76
+ constructor(entities) {
77
+ this.entities = entities;
78
78
  }
79
79
  material({ materialId }, { loaders }) {
80
80
  return loaders.batchSingle.load({
81
- __entity: this.materialEntity,
81
+ __entity: this.entities.material,
82
82
  __from: { id: materialId },
83
83
  });
84
84
  }
@@ -86,7 +86,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
86
86
  if (!batchId)
87
87
  return null;
88
88
  const { groupId } = await loaders.batchSingle.load({
89
- __entity: BatchEntityClass,
89
+ __entity: this.entities.batch,
90
90
  __from: { id: batchId },
91
91
  });
92
92
  return loaders.batchSingle.load({
@@ -98,7 +98,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
98
98
  if (!batchId)
99
99
  return null;
100
100
  const { groupId } = await loaders.batchSingle.load({
101
- __entity: BatchEntityClass,
101
+ __entity: this.entities.batch,
102
102
  __from: { id: batchId },
103
103
  });
104
104
  return loaders.batchSingle
@@ -112,7 +112,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
112
112
  if (!batchId)
113
113
  return null;
114
114
  const { groupId } = await loaders.batchSingle.load({
115
- __entity: BatchEntityClass,
115
+ __entity: this.entities.batch,
116
116
  __from: { id: batchId },
117
117
  });
118
118
  return loaders.batchSingle
@@ -126,7 +126,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
126
126
  if (!locationId)
127
127
  return null;
128
128
  return loaders.batchSingle.load({
129
- __entity: LocationEntityClass,
129
+ __entity: this.entities.location,
130
130
  __from: { id: locationId },
131
131
  });
132
132
  }
@@ -207,20 +207,19 @@ __decorate([
207
207
  ], ShipInventoryOrderItemResolver.prototype, "shippedQuantity", null);
208
208
  ShipInventoryOrderItemResolver = __decorate([
209
209
  Resolver(() => ShipInventoryOrderItemDto),
210
- __param(0, Inject(MaterialEntity)),
211
- __metadata("design:paramtypes", [Function])
210
+ __metadata("design:paramtypes", [WmsEntities])
212
211
  ], ShipInventoryOrderItemResolver);
213
212
  let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResolver {
214
- materialEntity;
213
+ entities;
215
214
  /**
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.
215
+ * The configured entities, not the built-in classes: `__entity` decides which
216
+ * repository the DataLoader opens, so it has to follow whatever the consumer
217
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
218
+ * on its single-table-inheritance discriminator and resolves nothing for an
219
+ * override.
221
220
  */
222
- constructor(materialEntity) {
223
- this.materialEntity = materialEntity;
221
+ constructor(entities) {
222
+ this.entities = entities;
224
223
  }
225
224
  async shippedQuantity({ orderId, serialId }, { loaders }) {
226
225
  const items = await loaders.batchMany.load({
@@ -236,7 +235,7 @@ let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResol
236
235
  }
237
236
  material({ materialId }, { loaders }) {
238
237
  return loaders.batchSingle.load({
239
- __entity: this.materialEntity,
238
+ __entity: this.entities.material,
240
239
  __from: { id: materialId },
241
240
  });
242
241
  }
@@ -244,7 +243,7 @@ let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResol
244
243
  if (!batchId)
245
244
  return null;
246
245
  const { groupId } = await loaders.batchSingle.load({
247
- __entity: BatchEntityClass,
246
+ __entity: this.entities.batch,
248
247
  __from: { id: batchId },
249
248
  });
250
249
  return loaders.batchSingle.load({
@@ -293,8 +292,7 @@ __decorate([
293
292
  ], ShipInventoryOrderReferenceResolver.prototype, "items", null);
294
293
  ShipInventoryOrderReferenceResolver = __decorate([
295
294
  Resolver(() => ShipInventoryOrderReferenceDto),
296
- __param(0, Inject(MaterialEntity)),
297
- __metadata("design:paramtypes", [Function])
295
+ __metadata("design:paramtypes", [WmsEntities])
298
296
  ], ShipInventoryOrderReferenceResolver);
299
297
 
300
298
  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>;
@@ -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,38 @@ 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 '../dto/inventory-count-order.dto.js';
28
+ import { StockEntityClass, WmsEntities, BatchGroupEntityClass } from '@rytass/wms-module-core';
29
29
  import { LocationDto } from '../dto/location.dto.js';
30
30
  import { BatchDto } from '../dto/batch.dto.js';
31
31
 
32
32
  let StockResolver = class StockResolver {
33
- materialEntity;
33
+ entities;
34
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.
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
40
  */
41
- constructor(materialEntity) {
42
- this.materialEntity = materialEntity;
41
+ constructor(entities) {
42
+ this.entities = entities;
43
43
  }
44
44
  material({ materialId }, { loaders }) {
45
45
  return loaders.batchSingle.load({
46
- __entity: this.materialEntity,
46
+ __entity: this.entities.material,
47
47
  __from: { id: materialId },
48
48
  });
49
49
  }
50
50
  location({ locationId }, { loaders }) {
51
51
  return loaders.batchSingle.load({
52
- __entity: LocationEntityClass,
52
+ __entity: this.entities.location,
53
53
  __from: { id: locationId },
54
54
  });
55
55
  }
56
56
  async batch({ batchId }, { loaders }) {
57
57
  const { groupId } = await loaders.batchSingle.load({
58
- __entity: BatchEntityClass,
58
+ __entity: this.entities.batch,
59
59
  __from: { id: batchId },
60
60
  });
61
61
  return loaders.batchSingle.load({
@@ -90,8 +90,7 @@ __decorate([
90
90
  ], StockResolver.prototype, "batch", null);
91
91
  StockResolver = __decorate([
92
92
  Resolver(() => StockDto),
93
- __param(0, Inject(MaterialEntity)),
94
- __metadata("design:paramtypes", [Function])
93
+ __metadata("design:paramtypes", [WmsEntities])
95
94
  ], StockResolver);
96
95
 
97
96
  export { StockResolver };
@@ -1,25 +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 {
14
- private readonly materialEntity;
23
+ private readonly entities;
15
24
  /**
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.
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.
21
30
  */
22
- constructor(materialEntity: new () => MaterialEntityClass);
31
+ constructor(entities: WmsEntities);
23
32
  material({ materialId }: TransferOrderItemEntityClass, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
24
33
  batch({ batchId }: TransferOrderItemEntityClass, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto | null>;
25
34
  location({ locationId }: TransferOrderItemEntityClass, { loaders }: LoaderType<LocationEntityClass>): Promise<LocationDto | null>;
@@ -1,9 +1,8 @@
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 { TransferOrderDto } from '../dto/transfer-order.dto.js';
5
4
  import { TransferOrderItemDto } from '../dto/transfer-order-item.dto.js';
6
- import { TransferOrderItemEntityClass, MaterialEntity, LocationEntityClass, LoadersEntityClass, BatchEntityClass, BatchGroupEntityClass, TransferOrderChangeEntityClass } from '@rytass/wms-module-core';
5
+ import { WmsEntities, TransferOrderItemEntityClass, LoadersEntityClass, BatchGroupEntityClass, TransferOrderChangeEntityClass } from '@rytass/wms-module-core';
7
6
  import '../dto/loader-type.dto.js';
8
7
  import { LoaderDto } from '../dto/loader.dto.js';
9
8
  import { MaterialDto } from '../dto/material.dto.js';
@@ -26,10 +25,22 @@ import '../dto/scrape-order.dto.js';
26
25
  import '../dto/scrape-order-item.dto.js';
27
26
  import '../dto/quality-inspection-order.dto.js';
28
27
  import '../dto/quality-inspection-order-item.dto.js';
28
+ import '../dto/inventory-count-order.dto.js';
29
29
  import { BatchDto } from '../dto/batch.dto.js';
30
30
  import { LocationDto } from '../dto/location.dto.js';
31
31
 
32
32
  let TransferOrderResolver = class TransferOrderResolver {
33
+ entities;
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) {
42
+ this.entities = entities;
43
+ }
33
44
  items({ id }, { loaders }) {
34
45
  return loaders.batchMany.load({
35
46
  __entity: TransferOrderItemEntityClass,
@@ -44,7 +55,7 @@ let TransferOrderResolver = class TransferOrderResolver {
44
55
  if (!item?.targetLocationId)
45
56
  return null;
46
57
  return locationLoader.loaders.batchSingle.load({
47
- __entity: LocationEntityClass,
58
+ __entity: this.entities.location,
48
59
  __from: { id: item.targetLocationId },
49
60
  });
50
61
  }
@@ -88,23 +99,24 @@ __decorate([
88
99
  __metadata("design:returntype", Promise)
89
100
  ], TransferOrderResolver.prototype, "targetLoader", null);
90
101
  TransferOrderResolver = __decorate([
91
- Resolver(() => TransferOrderDto)
102
+ Resolver(() => TransferOrderDto),
103
+ __metadata("design:paramtypes", [WmsEntities])
92
104
  ], TransferOrderResolver);
93
105
  let TransferOrderItemResolver = class TransferOrderItemResolver {
94
- materialEntity;
106
+ entities;
95
107
  /**
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.
108
+ * The configured entities, not the built-in classes: `__entity` decides which
109
+ * repository the DataLoader opens, so it has to follow whatever the consumer
110
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
111
+ * on its single-table-inheritance discriminator and resolves nothing for an
112
+ * override.
101
113
  */
102
- constructor(materialEntity) {
103
- this.materialEntity = materialEntity;
114
+ constructor(entities) {
115
+ this.entities = entities;
104
116
  }
105
117
  material({ materialId }, { loaders }) {
106
118
  return loaders.batchSingle.load({
107
- __entity: this.materialEntity,
119
+ __entity: this.entities.material,
108
120
  __from: { id: materialId },
109
121
  });
110
122
  }
@@ -112,7 +124,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
112
124
  if (!batchId)
113
125
  return null;
114
126
  const { groupId } = await loaders.batchSingle.load({
115
- __entity: BatchEntityClass,
127
+ __entity: this.entities.batch,
116
128
  __from: { id: batchId },
117
129
  });
118
130
  return loaders.batchSingle.load({
@@ -124,7 +136,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
124
136
  if (!locationId)
125
137
  return null;
126
138
  return loaders.batchSingle.load({
127
- __entity: LocationEntityClass,
139
+ __entity: this.entities.location,
128
140
  __from: { id: locationId },
129
141
  });
130
142
  }
@@ -141,7 +153,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
141
153
  return null;
142
154
  return loaders.batchSingle
143
155
  .load({
144
- __entity: BatchEntityClass,
156
+ __entity: this.entities.batch,
145
157
  __from: { id: batchId },
146
158
  })
147
159
  .then((batch) => batch.saleId);
@@ -151,7 +163,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
151
163
  return null;
152
164
  return loaders.batchSingle
153
165
  .load({
154
- __entity: BatchEntityClass,
166
+ __entity: this.entities.batch,
155
167
  __from: { id: batchId },
156
168
  })
157
169
  .then((batch) => batch.saleSerialId);
@@ -225,8 +237,7 @@ __decorate([
225
237
  ], TransferOrderItemResolver.prototype, "transferredQuantity", null);
226
238
  TransferOrderItemResolver = __decorate([
227
239
  Resolver(() => TransferOrderItemDto),
228
- __param(0, Inject(MaterialEntity)),
229
- __metadata("design:paramtypes", [Function])
240
+ __metadata("design:paramtypes", [WmsEntities])
230
241
  ], TransferOrderItemResolver);
231
242
 
232
243
  export { TransferOrderItemResolver, TransferOrderResolver };
@@ -1,6 +1,15 @@
1
1
  import { type LoaderType } from '../helpers';
2
- import { LocationEntityClass } from '@rytass/wms-module-core';
2
+ import { LocationEntityClass, WmsEntities } from '@rytass/wms-module-core';
3
3
  import { MapRangeDto } from '../dto/warehouse-map.dto';
4
4
  export declare class MapRangeUnionResolver {
5
+ private readonly entities;
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);
5
14
  location({ id }: MapRangeDto, { loaders }: LoaderType<LocationEntityClass>): Promise<LocationEntityClass> | null;
6
15
  }
@@ -1,15 +1,26 @@
1
1
  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
- import { LocationEntityClass } from '@rytass/wms-module-core';
4
+ import { WmsEntities } from '@rytass/wms-module-core';
5
5
  import { MapRangeDto } from '../dto/warehouse-map.dto.js';
6
6
 
7
7
  let MapRangeUnionResolver = class MapRangeUnionResolver {
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
+ }
8
19
  location({ id }, { loaders }) {
9
20
  if (!id)
10
21
  return null;
11
22
  return loaders.batchSingle.load({
12
- __entity: LocationEntityClass,
23
+ __entity: this.entities.location,
13
24
  __from: { key: id },
14
25
  });
15
26
  }
@@ -23,7 +34,8 @@ __decorate([
23
34
  __metadata("design:returntype", void 0)
24
35
  ], MapRangeUnionResolver.prototype, "location", null);
25
36
  MapRangeUnionResolver = __decorate([
26
- Resolver(() => MapRangeDto)
37
+ Resolver(() => MapRangeDto),
38
+ __metadata("design:paramtypes", [WmsEntities])
27
39
  ], MapRangeUnionResolver);
28
40
 
29
41
  export { MapRangeUnionResolver };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rytass/wms-module-graphql",
3
- "version": "0.7.0",
3
+ "version": "0.9.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.4.0",
60
+ "@rytass/wms-module-core": "^0.6.0",
61
61
  "graphql": "^16.0.0",
62
62
  "reflect-metadata": "^0.1.13 || ^0.2.0",
63
63
  "rxjs": "^7.8.0",