@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 +39 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/nest-definition.d.ts +0 -2
- package/dist/{nest-definition.mediator.d.ts → nest-definition.iterator.d.ts} +7 -2
- package/dist/{nest-definition.mediator.js → nest-definition.iterator.js} +15 -7
- package/dist/nest-definition.js +0 -2
- package/package.json +2 -2
- package/src/index.ts +1 -1
- package/src/{nest-definition.mediator.ts → nest-definition.iterator.ts} +16 -6
- package/src/nest-definition.ts +0 -2
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
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.
|
|
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
|
|
7
|
-
Object.defineProperty(exports, "
|
|
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; } });
|
|
@@ -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
|
|
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.
|
|
3
|
+
exports.NestDefinitionIterator = void 0;
|
|
4
4
|
const constants_1 = require("./constants");
|
|
5
5
|
const nest_definition_1 = require("./nest-definition");
|
|
6
|
-
class
|
|
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
|
|
20
|
+
yield awaitedNestModuleDefinition;
|
|
21
|
+
if ('module' in awaitedNestModuleDefinition) {
|
|
22
|
+
yield awaitedNestModuleDefinition.module;
|
|
23
|
+
}
|
|
16
24
|
}
|
|
17
|
-
const nestDefinition = new nest_definition_1.NestDefinition(
|
|
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 =
|
|
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
|
|
49
|
+
yield* new NestDefinitionIterator(nestImport).iterate(type);
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
}
|
|
45
|
-
exports.
|
|
53
|
+
exports.NestDefinitionIterator = NestDefinitionIterator;
|
package/dist/nest-definition.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/nest-tools",
|
|
3
|
-
"version": "
|
|
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": "
|
|
13
|
+
"gitHead": "9fe1395b8e38e1c7b9578dd5eed12e0c57a9087f"
|
|
14
14
|
}
|
package/src/index.ts
CHANGED
|
@@ -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
|
|
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
|
|
22
|
+
yield awaitedNestModuleDefinition;
|
|
23
|
+
if ('module' in awaitedNestModuleDefinition) {
|
|
24
|
+
yield awaitedNestModuleDefinition.module;
|
|
25
|
+
}
|
|
17
26
|
}
|
|
18
|
-
const nestDefinition = new NestDefinition(
|
|
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 =
|
|
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
|
|
63
|
+
yield* new NestDefinitionIterator(nestImport).iterate(type);
|
|
54
64
|
}
|
|
55
65
|
}
|
|
56
66
|
}
|
package/src/nest-definition.ts
CHANGED
|
@@ -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) {}
|