@rytass/wms-module-graphql 0.8.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 (42) hide show
  1. package/README.md +83 -1
  2. package/docs/api-reference.md +76 -1
  3. package/docs/events.md +23 -4
  4. package/index.cjs.js +779 -1
  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.js +1 -0
  32. package/lib/resolvers/change-log.resolver.js +1 -0
  33. package/lib/resolvers/inventory-count-order.resolver.d.ts +34 -0
  34. package/lib/resolvers/inventory-count-order.resolver.js +148 -0
  35. package/lib/resolvers/loader-type.resolver.js +1 -0
  36. package/lib/resolvers/loader.resolver.js +1 -0
  37. package/lib/resolvers/material.resolver.js +1 -0
  38. package/lib/resolvers/receive-inventory-order.resolver.js +1 -0
  39. package/lib/resolvers/ship-inventory-order.resolver.js +1 -0
  40. package/lib/resolvers/stock.resolver.js +1 -0
  41. package/lib/resolvers/transfer-order.resolver.js +1 -0
  42. package/package.json +2 -2
@@ -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 {
@@ -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 { LoadersEntityClass, WmsEntities, StockService, LoaderTypeEntityClass } from '@rytass/wms-module-core';
28
29
  import { LocationDto } from '../dto/location.dto.js';
29
30
  import _ from 'lodash';
@@ -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
 
@@ -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 { ReceiveInventoryOrderItemEntityClass, WmsEntities, BatchGroupEntityClass, LoadersEntityClass, ReceiveInventoryOrderChangeEntityClass } from '@rytass/wms-module-core';
28
29
  import { BatchDto } from '../dto/batch.dto.js';
29
30
  import { LocationDto } from '../dto/location.dto.js';
@@ -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 { ShipInventoryOrderEntityClass, ShipInventoryOrderItemEntityClass, WmsEntities, ShipInventoryOrderReferenceEntityClass, BatchGroupEntityClass, LoadersEntityClass, ShipInventoryOrderChangeEntityClass } from '@rytass/wms-module-core';
28
29
  import { BatchDto } from '../dto/batch.dto.js';
29
30
  import { LocationDto } from '../dto/location.dto.js';
@@ -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 { StockEntityClass, WmsEntities, BatchGroupEntityClass } from '@rytass/wms-module-core';
28
29
  import { LocationDto } from '../dto/location.dto.js';
29
30
  import { BatchDto } from '../dto/batch.dto.js';
@@ -25,6 +25,7 @@ import '../dto/scrape-order.dto.js';
25
25
  import '../dto/scrape-order-item.dto.js';
26
26
  import '../dto/quality-inspection-order.dto.js';
27
27
  import '../dto/quality-inspection-order-item.dto.js';
28
+ import '../dto/inventory-count-order.dto.js';
28
29
  import { BatchDto } from '../dto/batch.dto.js';
29
30
  import { LocationDto } from '../dto/location.dto.js';
30
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rytass/wms-module-graphql",
3
- "version": "0.8.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.5.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",