@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.
@@ -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.6.1",
3
+ "version": "0.8.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.3.1",
60
+ "@rytass/wms-module-core": "^0.5.0",
61
61
  "graphql": "^16.0.0",
62
62
  "reflect-metadata": "^0.1.13 || ^0.2.0",
63
63
  "rxjs": "^7.8.0",