@rsdk/nest-tools 1.0.12 → 2.0.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,45 @@
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.0.0](https://github.com/R-Vision/rsdk/compare/v1.0.12...v2.0.0) (2023-06-06)
7
+
8
+ ### Draft
9
+
10
+ * Pfm 303 static to meta migration ([#45](https://github.com/R-Vision/rsdk/issues/45)) ([d98e303](https://github.com/R-Vision/rsdk/commit/d98e3032f9b10446b478427d841b9209ed68fa2d))
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ * GrpcClientModule removed
15
+ new way for declaration with `GrpcServers.define()` and `@InjectGrpcClient`
16
+
17
+ * fix: rework interaction with metadata and generating modules from metadata
18
+
19
+ * refactor: destructring added
20
+
21
+ * docs: added docs for autodoc pre-commit hook
22
+
23
+ * chore: spell fix
24
+
25
+ * chore: some improves declaration
26
+
27
+ * chore: laconic naming for constants
28
+
29
+ * chore: remove useless
30
+
31
+ * chore: move file to suitable place
32
+
33
+ * chore: remove useless imports
34
+
35
+ * chore!: remove boostrap tasks from Makefile
36
+
37
+ * chore: rework test tasks
38
+
39
+ * feat: grpc client plugin useless
40
+
41
+ * chore: verbosed naming
42
+
43
+ * docs: improve verbosity
44
+
6
45
  ## 1.0.12 (2023-05-23)
7
46
 
8
47
  ### Bug Fixes
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { NestDefinitionType } from './constants';
2
- export { NestDefinitionMediator } from './nest-definition.mediator';
2
+ export { NestDefinitionIterator } from './nest-definition.iterator';
3
3
  export { NestDefinition } from './nest-definition';
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NestDefinition = exports.NestDefinitionMediator = exports.NestDefinitionType = void 0;
3
+ exports.NestDefinition = exports.NestDefinitionIterator = exports.NestDefinitionType = void 0;
4
4
  var constants_1 = require("./constants");
5
5
  Object.defineProperty(exports, "NestDefinitionType", { enumerable: true, get: function () { return constants_1.NestDefinitionType; } });
6
- var nest_definition_mediator_1 = require("./nest-definition.mediator");
7
- Object.defineProperty(exports, "NestDefinitionMediator", { enumerable: true, get: function () { return nest_definition_mediator_1.NestDefinitionMediator; } });
6
+ var nest_definition_iterator_1 = require("./nest-definition.iterator");
7
+ Object.defineProperty(exports, "NestDefinitionIterator", { enumerable: true, get: function () { return nest_definition_iterator_1.NestDefinitionIterator; } });
8
8
  var nest_definition_1 = require("./nest-definition");
9
9
  Object.defineProperty(exports, "NestDefinition", { enumerable: true, get: function () { return nest_definition_1.NestDefinition; } });
@@ -3,8 +3,6 @@ export type NestModuleDefinition = DynamicModule | Type;
3
3
  /**
4
4
  * Хелпер для работы с объявлением модуля nest.
5
5
  * Получения провайдеров и импортов
6
- *
7
- * TODO: Объяснить что это за нафиг?
8
6
  */
9
7
  export declare class NestDefinition {
10
8
  private definition;
@@ -1,8 +1,13 @@
1
1
  import type { Provider } from '@nestjs/common';
2
+ import type { Promisable } from 'type-fest';
2
3
  import { NestDefinitionType } from './constants';
3
4
  import type { NestModuleDefinition } from './nest-definition';
4
- export declare class NestDefinitionMediator {
5
+ export declare class NestDefinitionIterator {
5
6
  private nestModuleDefinition;
6
- constructor(nestModuleDefinition: NestModuleDefinition);
7
+ constructor(nestModuleDefinition: Promisable<NestModuleDefinition>);
8
+ /**
9
+ * By default dont iterate by exports
10
+ * @param type
11
+ */
7
12
  iterate(type?: NestDefinitionType): AsyncIterableIterator<NestModuleDefinition | Provider>;
8
13
  }
@@ -1,20 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NestDefinitionMediator = void 0;
3
+ exports.NestDefinitionIterator = void 0;
4
4
  const constants_1 = require("./constants");
5
5
  const nest_definition_1 = require("./nest-definition");
6
- class NestDefinitionMediator {
6
+ class NestDefinitionIterator {
7
7
  nestModuleDefinition;
8
8
  constructor(nestModuleDefinition) {
9
9
  this.nestModuleDefinition = nestModuleDefinition;
10
10
  }
11
+ /**
12
+ * By default dont iterate by exports
13
+ * @param type
14
+ */
11
15
  async *iterate(type) {
12
16
  const iterateAll = typeof type === 'undefined';
13
17
  const iterateModule = iterateAll || type & constants_1.NestDefinitionType.Module;
18
+ const awaitedNestModuleDefinition = await this.nestModuleDefinition;
14
19
  if (iterateModule) {
15
- yield this.nestModuleDefinition;
20
+ yield awaitedNestModuleDefinition;
21
+ if ('module' in awaitedNestModuleDefinition) {
22
+ yield awaitedNestModuleDefinition.module;
23
+ }
16
24
  }
17
- const nestDefinition = new nest_definition_1.NestDefinition(this.nestModuleDefinition);
25
+ const nestDefinition = new nest_definition_1.NestDefinition(awaitedNestModuleDefinition);
18
26
  const nestImports = await nestDefinition.getImports();
19
27
  const iterateProviders = iterateAll || type & constants_1.NestDefinitionType.Providers;
20
28
  if (iterateProviders) {
@@ -23,7 +31,7 @@ class NestDefinitionMediator {
23
31
  yield provider;
24
32
  }
25
33
  }
26
- const iterateExports = iterateAll || type & constants_1.NestDefinitionType.Exports;
34
+ const iterateExports = type !== undefined && type & constants_1.NestDefinitionType.Exports;
27
35
  if (iterateExports) {
28
36
  const exports = nestDefinition.getExports();
29
37
  for (const nestExport of exports ?? []) {
@@ -38,8 +46,8 @@ class NestDefinitionMediator {
38
46
  }
39
47
  }
40
48
  for (const nestImport of nestImports ?? []) {
41
- yield* new NestDefinitionMediator(nestImport).iterate(type);
49
+ yield* new NestDefinitionIterator(nestImport).iterate(type);
42
50
  }
43
51
  }
44
52
  }
45
- exports.NestDefinitionMediator = NestDefinitionMediator;
53
+ exports.NestDefinitionIterator = NestDefinitionIterator;
@@ -6,8 +6,6 @@ const scanner_1 = require("@nestjs/core/scanner");
6
6
  /**
7
7
  * Хелпер для работы с объявлением модуля nest.
8
8
  * Получения провайдеров и импортов
9
- *
10
- * TODO: Объяснить что это за нафиг?
11
9
  */
12
10
  class NestDefinition {
13
11
  definition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdk/nest-tools",
3
- "version": "1.0.12",
3
+ "version": "2.0.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": "e2741fe798655b87946330f8db0705e0f7ba2fb2"
13
+ "gitHead": "9fe1395b8e38e1c7b9578dd5eed12e0c57a9087f"
14
14
  }
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { NestDefinitionType } from './constants';
2
2
 
3
- export { NestDefinitionMediator } from './nest-definition.mediator';
3
+ export { NestDefinitionIterator } from './nest-definition.iterator';
4
4
 
5
5
  export { NestDefinition } from './nest-definition';
@@ -1,21 +1,30 @@
1
1
  import type { Provider } from '@nestjs/common';
2
+ import type { Promisable } from 'type-fest';
2
3
 
3
4
  import { NestDefinitionType } from './constants';
4
5
  import type { NestModuleDefinition } from './nest-definition';
5
6
  import { NestDefinition } from './nest-definition';
6
7
 
7
- export class NestDefinitionMediator {
8
- constructor(private nestModuleDefinition: NestModuleDefinition) {}
8
+ export class NestDefinitionIterator {
9
+ constructor(private nestModuleDefinition: Promisable<NestModuleDefinition>) {}
9
10
 
11
+ /**
12
+ * By default dont iterate by exports
13
+ * @param type
14
+ */
10
15
  async *iterate(
11
16
  type?: NestDefinitionType,
12
17
  ): AsyncIterableIterator<NestModuleDefinition | Provider> {
13
18
  const iterateAll = typeof type === 'undefined';
14
19
  const iterateModule = iterateAll || type & NestDefinitionType.Module;
20
+ const awaitedNestModuleDefinition = await this.nestModuleDefinition;
15
21
  if (iterateModule) {
16
- yield this.nestModuleDefinition;
22
+ yield awaitedNestModuleDefinition;
23
+ if ('module' in awaitedNestModuleDefinition) {
24
+ yield awaitedNestModuleDefinition.module;
25
+ }
17
26
  }
18
- const nestDefinition = new NestDefinition(this.nestModuleDefinition);
27
+ const nestDefinition = new NestDefinition(awaitedNestModuleDefinition);
19
28
 
20
29
  const nestImports = await nestDefinition.getImports();
21
30
 
@@ -28,7 +37,8 @@ export class NestDefinitionMediator {
28
37
  }
29
38
  }
30
39
 
31
- const iterateExports = iterateAll || type & NestDefinitionType.Exports;
40
+ const iterateExports =
41
+ type !== undefined && type & NestDefinitionType.Exports;
32
42
 
33
43
  if (iterateExports) {
34
44
  const exports = nestDefinition.getExports();
@@ -50,7 +60,7 @@ export class NestDefinitionMediator {
50
60
  }
51
61
 
52
62
  for (const nestImport of nestImports ?? []) {
53
- yield* new NestDefinitionMediator(nestImport).iterate(type);
63
+ yield* new NestDefinitionIterator(nestImport).iterate(type);
54
64
  }
55
65
  }
56
66
  }
@@ -7,8 +7,6 @@ export type NestModuleDefinition = DynamicModule | Type;
7
7
  /**
8
8
  * Хелпер для работы с объявлением модуля nest.
9
9
  * Получения провайдеров и импортов
10
- *
11
- * TODO: Объяснить что это за нафиг?
12
10
  */
13
11
  export class NestDefinition {
14
12
  constructor(private definition: NestModuleDefinition) {}