@rsdk/nest-tools 2.0.0 → 2.4.1-next.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.4.1-next.0](https://github.com/R-Vision/rsdk/compare/v2.4.0...v2.4.1-next.0) (2023-06-15)
7
+
8
+ **Note:** Version bump only for package @rsdk/nest-tools
9
+
6
10
  # [2.0.0](https://github.com/R-Vision/rsdk/compare/v1.0.12...v2.0.0) (2023-06-06)
7
11
 
8
12
  ### Draft
package/dist/constants.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NestDefinitionType = void 0;
4
4
  var NestDefinitionType;
5
5
  (function (NestDefinitionType) {
6
+ // eslint-disable-next-line unicorn/prefer-math-trunc
6
7
  NestDefinitionType[NestDefinitionType["Module"] = 1] = "Module";
7
8
  NestDefinitionType[NestDefinitionType["Controllers"] = 2] = "Controllers";
8
9
  NestDefinitionType[NestDefinitionType["Providers"] = 4] = "Providers";
@@ -13,7 +13,7 @@ class NestDefinitionIterator {
13
13
  * @param type
14
14
  */
15
15
  async *iterate(type) {
16
- const iterateAll = typeof type === 'undefined';
16
+ const iterateAll = type === undefined;
17
17
  const iterateModule = iterateAll || type & constants_1.NestDefinitionType.Module;
18
18
  const awaitedNestModuleDefinition = await this.nestModuleDefinition;
19
19
  if (iterateModule) {
@@ -13,36 +13,36 @@ class NestDefinition {
13
13
  this.definition = definition;
14
14
  }
15
15
  getProviders() {
16
- return !scanner_1.DependenciesScanner.prototype.isDynamicModule(this.definition)
17
- ? this.reflectMetadata(constants_1.MODULE_METADATA.PROVIDERS, this.definition)
18
- : [
16
+ return scanner_1.DependenciesScanner.prototype.isDynamicModule(this.definition)
17
+ ? [
19
18
  ...this.reflectMetadata(constants_1.MODULE_METADATA.PROVIDERS, this.definition.module),
20
19
  ...(this.definition.providers || []),
21
- ];
20
+ ]
21
+ : this.reflectMetadata(constants_1.MODULE_METADATA.PROVIDERS, this.definition);
22
22
  }
23
23
  getImports() {
24
- return !scanner_1.DependenciesScanner.prototype.isDynamicModule(this.definition)
25
- ? this.reflectMetadata(constants_1.MODULE_METADATA.IMPORTS, this.definition)
26
- : [
24
+ return scanner_1.DependenciesScanner.prototype.isDynamicModule(this.definition)
25
+ ? [
27
26
  ...this.reflectMetadata(constants_1.MODULE_METADATA.IMPORTS, this.definition.module),
28
27
  ...(this.definition.imports || []),
29
- ];
28
+ ]
29
+ : this.reflectMetadata(constants_1.MODULE_METADATA.IMPORTS, this.definition);
30
30
  }
31
31
  getControllers() {
32
- return !scanner_1.DependenciesScanner.prototype.isDynamicModule(this.definition)
33
- ? this.reflectMetadata(constants_1.MODULE_METADATA.CONTROLLERS, this.definition)
34
- : [
32
+ return scanner_1.DependenciesScanner.prototype.isDynamicModule(this.definition)
33
+ ? [
35
34
  ...this.reflectMetadata(constants_1.MODULE_METADATA.CONTROLLERS, this.definition.module),
36
35
  ...(this.definition.controllers || []),
37
- ];
36
+ ]
37
+ : this.reflectMetadata(constants_1.MODULE_METADATA.CONTROLLERS, this.definition);
38
38
  }
39
39
  getExports() {
40
- return !scanner_1.DependenciesScanner.prototype.isDynamicModule(this.definition)
41
- ? this.reflectMetadata(constants_1.MODULE_METADATA.EXPORTS, this.definition)
42
- : [
40
+ return scanner_1.DependenciesScanner.prototype.isDynamicModule(this.definition)
41
+ ? [
43
42
  ...this.reflectMetadata(constants_1.MODULE_METADATA.EXPORTS, this.definition.module),
44
43
  ...(this.definition.exports || []),
45
- ];
44
+ ]
45
+ : this.reflectMetadata(constants_1.MODULE_METADATA.EXPORTS, this.definition);
46
46
  }
47
47
  reflectMetadata(metadataKey, metatype) {
48
48
  return Reflect.getMetadata(metadataKey, metatype) || [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdk/nest-tools",
3
- "version": "2.0.0",
3
+ "version": "2.4.1-next.0",
4
4
  "license": "Apache License 2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -10,5 +10,5 @@
10
10
  "@nestjs/common": "^9.0.0",
11
11
  "@nestjs/core": "^9.0.0"
12
12
  },
13
- "gitHead": "9fe1395b8e38e1c7b9578dd5eed12e0c57a9087f"
13
+ "gitHead": "02cbc6be59dcf7d7784b316b315eb746c6d5ac4a"
14
14
  }
package/src/constants.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export enum NestDefinitionType {
2
+ // eslint-disable-next-line unicorn/prefer-math-trunc
2
3
  Module = 1 << 0,
3
4
  Controllers = 1 << 1,
4
5
  Providers = 1 << 2,
@@ -15,7 +15,7 @@ export class NestDefinitionIterator {
15
15
  async *iterate(
16
16
  type?: NestDefinitionType,
17
17
  ): AsyncIterableIterator<NestModuleDefinition | Provider> {
18
- const iterateAll = typeof type === 'undefined';
18
+ const iterateAll = type === undefined;
19
19
  const iterateModule = iterateAll || type & NestDefinitionType.Module;
20
20
  const awaitedNestModuleDefinition = await this.nestModuleDefinition;
21
21
  if (iterateModule) {
@@ -12,51 +12,51 @@ export class NestDefinition {
12
12
  constructor(private definition: NestModuleDefinition) {}
13
13
 
14
14
  getProviders(): Provider[] | undefined {
15
- return !DependenciesScanner.prototype.isDynamicModule(this.definition)
16
- ? this.reflectMetadata(MODULE_METADATA.PROVIDERS, this.definition)
17
- : [
15
+ return DependenciesScanner.prototype.isDynamicModule(this.definition)
16
+ ? [
18
17
  ...this.reflectMetadata(
19
18
  MODULE_METADATA.PROVIDERS,
20
19
  this.definition.module,
21
20
  ),
22
21
  ...(this.definition.providers || []),
23
- ];
22
+ ]
23
+ : this.reflectMetadata(MODULE_METADATA.PROVIDERS, this.definition);
24
24
  }
25
25
 
26
26
  getImports(): NestModuleDefinition[] | undefined {
27
- return !DependenciesScanner.prototype.isDynamicModule(this.definition)
28
- ? this.reflectMetadata(MODULE_METADATA.IMPORTS, this.definition)
29
- : [
27
+ return DependenciesScanner.prototype.isDynamicModule(this.definition)
28
+ ? [
30
29
  ...this.reflectMetadata(
31
30
  MODULE_METADATA.IMPORTS,
32
31
  this.definition.module,
33
32
  ),
34
33
  ...(this.definition.imports || []),
35
- ];
34
+ ]
35
+ : this.reflectMetadata(MODULE_METADATA.IMPORTS, this.definition);
36
36
  }
37
37
 
38
38
  getControllers(): Type[] | undefined {
39
- return !DependenciesScanner.prototype.isDynamicModule(this.definition)
40
- ? this.reflectMetadata(MODULE_METADATA.CONTROLLERS, this.definition)
41
- : [
39
+ return DependenciesScanner.prototype.isDynamicModule(this.definition)
40
+ ? [
42
41
  ...this.reflectMetadata(
43
42
  MODULE_METADATA.CONTROLLERS,
44
43
  this.definition.module,
45
44
  ),
46
45
  ...(this.definition.controllers || []),
47
- ];
46
+ ]
47
+ : this.reflectMetadata(MODULE_METADATA.CONTROLLERS, this.definition);
48
48
  }
49
49
 
50
50
  getExports(): Type[] | undefined {
51
- return !DependenciesScanner.prototype.isDynamicModule(this.definition)
52
- ? this.reflectMetadata(MODULE_METADATA.EXPORTS, this.definition)
53
- : [
51
+ return DependenciesScanner.prototype.isDynamicModule(this.definition)
52
+ ? [
54
53
  ...this.reflectMetadata(
55
54
  MODULE_METADATA.EXPORTS,
56
55
  this.definition.module,
57
56
  ),
58
57
  ...(this.definition.exports || []),
59
- ];
58
+ ]
59
+ : this.reflectMetadata(MODULE_METADATA.EXPORTS, this.definition);
60
60
  }
61
61
 
62
62
  private reflectMetadata<T = any>(metadataKey: string, metatype: Type): T[] {