@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 } 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 ChangeLogResolver = class ChangeLogResolver {
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
  ], ChangeLogResolver.prototype, "batch", null);
91
91
  ChangeLogResolver = __decorate([
92
92
  Resolver(() => ChangeLogDto),
93
- __param(0, Inject(MaterialEntity)),
94
- __metadata("design:paramtypes", [Function])
93
+ __metadata("design:paramtypes", [WmsEntities])
95
94
  ], ChangeLogResolver);
96
95
 
97
96
  export { ChangeLogResolver };
@@ -0,0 +1,34 @@
1
+ import { BatchEntityClass, InventoryCountOrderItemEntityClass, InventoryCountOrderLocationEntityClass, LoadersEntityClass, LocationEntityClass, MaterialEntityClass, WmsEntities } from '@rytass/wms-module-core';
2
+ import { InventoryCountOrderDto, InventoryCountOrderItemDto } from '../dto/inventory-count-order.dto';
3
+ import { BatchDto } from '../dto/batch.dto';
4
+ import { LoaderDto } from '../dto/loader.dto';
5
+ import { LocationDto } from '../dto/location.dto';
6
+ import { MaterialDto } from '../dto/material.dto';
7
+ import { type LoaderType } from '../helpers';
8
+ export declare class InventoryCountOrderResolver {
9
+ private readonly entities;
10
+ constructor(entities: WmsEntities);
11
+ items({ id }: InventoryCountOrderDto, { loaders }: LoaderType<InventoryCountOrderItemEntityClass>): Promise<InventoryCountOrderItemDto[]>;
12
+ /**
13
+ * The locations the user picked.
14
+ *
15
+ * Only the roots: the scope table also holds every descendant the backend
16
+ * expanded into, and listing a whole aisle's shelves as chips would bury the
17
+ * one thing the operator actually chose. The expansion still exists in the
18
+ * database — it is what the lock reads — it just is not this field.
19
+ */
20
+ locations({ id }: InventoryCountOrderDto, { loaders }: LoaderType<InventoryCountOrderLocationEntityClass>): Promise<LocationDto[]>;
21
+ }
22
+ export declare class InventoryCountOrderItemResolver {
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`.
28
+ */
29
+ constructor(entities: WmsEntities);
30
+ material({ materialId }: InventoryCountOrderItemDto, { loaders }: LoaderType<MaterialEntityClass>): Promise<MaterialDto>;
31
+ batch({ batchId }: InventoryCountOrderItemDto, { loaders }: LoaderType<BatchEntityClass>): Promise<BatchDto>;
32
+ location({ locationId }: InventoryCountOrderItemDto, { loaders }: LoaderType<LocationEntityClass>): Promise<LocationDto> | null;
33
+ loader({ loaderId }: InventoryCountOrderItemDto, { loaders }: LoaderType<LoadersEntityClass>): Promise<LoaderDto> | null;
34
+ }
@@ -0,0 +1,148 @@
1
+ import { __decorate, __param, __metadata } from 'tslib';
2
+ import { ResolveField, Parent, Context, Resolver } from '@nestjs/graphql';
3
+ import { WmsEntities, InventoryCountOrderItemEntityClass, InventoryCountOrderLocationEntityClass, BatchGroupEntityClass, LoadersEntityClass } from '@rytass/wms-module-core';
4
+ import { InventoryCountOrderItemDto, InventoryCountOrderDto } from '../dto/inventory-count-order.dto.js';
5
+ import { BatchDto } from '../dto/batch.dto.js';
6
+ import { LoaderDto } from '../dto/loader.dto.js';
7
+ import { LocationDto } from '../dto/location.dto.js';
8
+ import { MaterialDto } from '../dto/material.dto.js';
9
+
10
+ let InventoryCountOrderResolver = class InventoryCountOrderResolver {
11
+ entities;
12
+ constructor(entities) {
13
+ this.entities = entities;
14
+ }
15
+ items({ id }, { loaders }) {
16
+ return loaders.batchMany.load({
17
+ __entity: InventoryCountOrderItemEntityClass,
18
+ __from: { orderId: id },
19
+ });
20
+ }
21
+ /**
22
+ * The locations the user picked.
23
+ *
24
+ * Only the roots: the scope table also holds every descendant the backend
25
+ * expanded into, and listing a whole aisle's shelves as chips would bury the
26
+ * one thing the operator actually chose. The expansion still exists in the
27
+ * database — it is what the lock reads — it just is not this field.
28
+ */
29
+ async locations({ id }, { loaders }) {
30
+ const scope = (await loaders.batchMany.load({
31
+ __entity: InventoryCountOrderLocationEntityClass,
32
+ __from: { orderId: id },
33
+ }));
34
+ // The join rows carry `locationId`, not a loaded `location` relation, so
35
+ // each one has to go back through the location DataLoader. Returning
36
+ // `row.location` directly yields `undefined`, and the non-nullable list then
37
+ // fails the whole query with "Cannot return null for non-nullable field".
38
+ return Promise.all(scope
39
+ .filter(({ isRoot }) => isRoot)
40
+ .map(({ locationId }) => loaders.batchSingle.load({
41
+ __entity: this.entities.location,
42
+ __from: { id: locationId },
43
+ })));
44
+ }
45
+ };
46
+ __decorate([
47
+ ResolveField(() => [InventoryCountOrderItemDto]),
48
+ __param(0, Parent()),
49
+ __param(1, Context()),
50
+ __metadata("design:type", Function),
51
+ __metadata("design:paramtypes", [InventoryCountOrderDto, Object]),
52
+ __metadata("design:returntype", Promise)
53
+ ], InventoryCountOrderResolver.prototype, "items", null);
54
+ __decorate([
55
+ ResolveField(() => [LocationDto]),
56
+ __param(0, Parent()),
57
+ __param(1, Context()),
58
+ __metadata("design:type", Function),
59
+ __metadata("design:paramtypes", [InventoryCountOrderDto, Object]),
60
+ __metadata("design:returntype", Promise)
61
+ ], InventoryCountOrderResolver.prototype, "locations", null);
62
+ InventoryCountOrderResolver = __decorate([
63
+ Resolver(() => InventoryCountOrderDto),
64
+ __metadata("design:paramtypes", [WmsEntities])
65
+ ], InventoryCountOrderResolver);
66
+ let InventoryCountOrderItemResolver = class InventoryCountOrderItemResolver {
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`.
72
+ */
73
+ constructor(entities) {
74
+ this.entities = entities;
75
+ }
76
+ material({ materialId }, { loaders }) {
77
+ return loaders.batchSingle.load({
78
+ __entity: this.entities.material,
79
+ __from: { id: materialId },
80
+ });
81
+ }
82
+ async batch({ batchId }, { loaders }) {
83
+ const { groupId } = await loaders.batchSingle.load({
84
+ __entity: this.entities.batch,
85
+ __from: { id: batchId },
86
+ });
87
+ return loaders.batchSingle.load({
88
+ __entity: BatchGroupEntityClass,
89
+ __from: { id: groupId },
90
+ });
91
+ }
92
+ location({ locationId }, { loaders }) {
93
+ if (!locationId) {
94
+ return null;
95
+ }
96
+ return loaders.batchSingle.load({
97
+ __entity: this.entities.location,
98
+ __from: { id: locationId },
99
+ });
100
+ }
101
+ loader({ loaderId }, { loaders }) {
102
+ if (!loaderId) {
103
+ return null;
104
+ }
105
+ return loaders.batchSingle.load({
106
+ __entity: LoadersEntityClass,
107
+ __from: { id: loaderId },
108
+ });
109
+ }
110
+ };
111
+ __decorate([
112
+ ResolveField(() => MaterialDto),
113
+ __param(0, Parent()),
114
+ __param(1, Context()),
115
+ __metadata("design:type", Function),
116
+ __metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
117
+ __metadata("design:returntype", Promise)
118
+ ], InventoryCountOrderItemResolver.prototype, "material", null);
119
+ __decorate([
120
+ ResolveField(() => BatchDto),
121
+ __param(0, Parent()),
122
+ __param(1, Context()),
123
+ __metadata("design:type", Function),
124
+ __metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
125
+ __metadata("design:returntype", Promise)
126
+ ], InventoryCountOrderItemResolver.prototype, "batch", null);
127
+ __decorate([
128
+ ResolveField(() => LocationDto, { nullable: true }),
129
+ __param(0, Parent()),
130
+ __param(1, Context()),
131
+ __metadata("design:type", Function),
132
+ __metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
133
+ __metadata("design:returntype", Object)
134
+ ], InventoryCountOrderItemResolver.prototype, "location", null);
135
+ __decorate([
136
+ ResolveField(() => LoaderDto, { nullable: true }),
137
+ __param(0, Parent()),
138
+ __param(1, Context()),
139
+ __metadata("design:type", Function),
140
+ __metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
141
+ __metadata("design:returntype", Object)
142
+ ], InventoryCountOrderItemResolver.prototype, "loader", null);
143
+ InventoryCountOrderItemResolver = __decorate([
144
+ Resolver(() => InventoryCountOrderItemDto),
145
+ __metadata("design:paramtypes", [WmsEntities])
146
+ ], InventoryCountOrderItemResolver);
147
+
148
+ export { InventoryCountOrderItemResolver, InventoryCountOrderResolver };
@@ -24,6 +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 '../dto/inventory-count-order.dto.js';
27
28
  import { LoaderTypeEntityClass, LoadersEntityClass } from '@rytass/wms-module-core';
28
29
 
29
30
  let LoaderTypeResolver = class LoaderTypeResolver {
@@ -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,23 @@ 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 '../dto/inventory-count-order.dto.js';
28
+ import { LoadersEntityClass, WmsEntities, StockService, LoaderTypeEntityClass } from '@rytass/wms-module-core';
28
29
  import { LocationDto } from '../dto/location.dto.js';
29
30
  import _ from 'lodash';
30
31
 
31
32
  let LoaderResolver = class LoaderResolver {
33
+ entities;
32
34
  stockService;
33
- constructor(stockService) {
35
+ /**
36
+ * The configured entities, not the built-in classes: `__entity` decides which
37
+ * repository the DataLoader opens, so it has to follow whatever the consumer
38
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
39
+ * on its single-table-inheritance discriminator and resolves nothing for an
40
+ * override.
41
+ */
42
+ constructor(entities, stockService) {
43
+ this.entities = entities;
34
44
  this.stockService = stockService;
35
45
  }
36
46
  type({ typeId }, { loaders }) {
@@ -41,7 +51,7 @@ let LoaderResolver = class LoaderResolver {
41
51
  }
42
52
  location({ locationId }, { loaders }) {
43
53
  return loaders.batchSingle.load({
44
- __entity: LocationEntityClass,
54
+ __entity: this.entities.location,
45
55
  __from: { id: locationId },
46
56
  });
47
57
  }
@@ -80,7 +90,8 @@ __decorate([
80
90
  ], LoaderResolver.prototype, "totalQuantity", null);
81
91
  LoaderResolver = __decorate([
82
92
  Resolver(() => LoaderDto),
83
- __metadata("design:paramtypes", [StockService])
93
+ __metadata("design:paramtypes", [WmsEntities,
94
+ StockService])
84
95
  ], LoaderResolver);
85
96
 
86
97
  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 };
@@ -24,6 +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 '../dto/inventory-count-order.dto.js';
27
28
  import { MaterialEntityClass, StockService, MaterialUnitEntityClass, UnitEntityClass } from '@rytass/wms-module-core';
28
29
  import { UnitDto } from '../dto/unit.dto.js';
29
30
 
@@ -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,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 { ReceiveInventoryOrderItemEntityClass, MaterialEntity, BatchEntityClass, BatchGroupEntityClass, LocationEntityClass, LoadersEntityClass, ReceiveInventoryOrderChangeEntityClass } from '@rytass/wms-module-core';
27
+ import '../dto/inventory-count-order.dto.js';
28
+ import { ReceiveInventoryOrderItemEntityClass, WmsEntities, BatchGroupEntityClass, LoadersEntityClass, ReceiveInventoryOrderChangeEntityClass } 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
 
@@ -50,20 +50,20 @@ ReceiveInventoryOrderResolver = __decorate([
50
50
  Resolver(() => ReceiveInventoryOrderDto)
51
51
  ], ReceiveInventoryOrderResolver);
52
52
  let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver {
53
- materialEntity;
53
+ entities;
54
54
  /**
55
- * Bound to the `MaterialEntity` Symbol, so the DataLoader queries whichever
56
- * material entity the consumer configured — the built-in `MaterialEntityClass`
57
- * unless `materialEntity` was passed to `forRoot`/`forRootAsync`. Loading the
58
- * built-in class outright would filter on its single-table-inheritance
59
- * discriminator and resolve nothing for a custom entity.
55
+ * The configured entities, not the built-in classes: `__entity` decides which
56
+ * repository the DataLoader opens, so it has to follow whatever the consumer
57
+ * passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
58
+ * on its single-table-inheritance discriminator and resolves nothing for an
59
+ * override.
60
60
  */
61
- constructor(materialEntity) {
62
- this.materialEntity = materialEntity;
61
+ constructor(entities) {
62
+ this.entities = entities;
63
63
  }
64
64
  material({ materialId }, { loaders }) {
65
65
  return loaders.batchSingle.load({
66
- __entity: this.materialEntity,
66
+ __entity: this.entities.material,
67
67
  __from: { id: materialId },
68
68
  });
69
69
  }
@@ -71,7 +71,7 @@ let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver
71
71
  if (!batchId)
72
72
  return null;
73
73
  const { groupId } = await loaders.batchSingle.load({
74
- __entity: BatchEntityClass,
74
+ __entity: this.entities.batch,
75
75
  __from: { id: batchId },
76
76
  });
77
77
  return loaders.batchSingle.load({
@@ -83,7 +83,7 @@ let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver
83
83
  if (!locationId)
84
84
  return null;
85
85
  return loaders.batchSingle.load({
86
- __entity: LocationEntityClass,
86
+ __entity: this.entities.location,
87
87
  __from: { id: locationId },
88
88
  });
89
89
  }
@@ -147,8 +147,7 @@ __decorate([
147
147
  ], ReceiveInventoryOrderItemResolver.prototype, "receivedQuantity", null);
148
148
  ReceiveInventoryOrderItemResolver = __decorate([
149
149
  Resolver(() => ReceiveInventoryOrderItemDto),
150
- __param(0, Inject(MaterialEntity)),
151
- __metadata("design:paramtypes", [Function])
150
+ __metadata("design:paramtypes", [WmsEntities])
152
151
  ], ReceiveInventoryOrderItemResolver);
153
152
 
154
153
  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>;