@rsdk/nest-tools 2.4.2 → 2.6.0-next.16

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,16 @@
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.6.0-next.16](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.15...v2.6.0-next.16) (2023-08-04)
7
+
8
+ **Note:** Version bump only for package @rsdk/nest-tools
9
+
10
+ # [2.6.0-next.3](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.2...v2.6.0-next.3) (2023-07-07)
11
+
12
+ ### Features
13
+
14
+ * add data-source extractor from PlatformApp ([#76](https://github.com/R-Vision/rsdk/issues/76)) ([c668f12](https://github.com/R-Vision/rsdk/commit/c668f12142a009ac7c4bc5adc84b6fa8b85d413a))
15
+
6
16
  ## [2.4.2](https://github.com/R-Vision/rsdk/compare/v2.4.2-next.0...v2.4.2) (2023-06-16)
7
17
 
8
18
  **Note:** Version bump only for package @rsdk/nest-tools
package/dist/constants.js CHANGED
@@ -8,4 +8,4 @@ var NestDefinitionType;
8
8
  NestDefinitionType[NestDefinitionType["Controllers"] = 2] = "Controllers";
9
9
  NestDefinitionType[NestDefinitionType["Providers"] = 4] = "Providers";
10
10
  NestDefinitionType[NestDefinitionType["Exports"] = 8] = "Exports";
11
- })(NestDefinitionType = exports.NestDefinitionType || (exports.NestDefinitionType = {}));
11
+ })(NestDefinitionType || (exports.NestDefinitionType = NestDefinitionType = {}));
@@ -10,4 +10,5 @@ export declare class NestDefinitionIterator {
10
10
  * @param type
11
11
  */
12
12
  iterate(type?: NestDefinitionType): AsyncIterableIterator<NestModuleDefinition | Provider>;
13
+ find<R extends NestModuleDefinition | Provider>(predicate: (definition: NestModuleDefinition | Provider) => boolean, type?: NestDefinitionType): Promise<R | null>;
13
14
  }
@@ -49,5 +49,14 @@ class NestDefinitionIterator {
49
49
  yield* new NestDefinitionIterator(nestImport).iterate(type);
50
50
  }
51
51
  }
52
+ async find(predicate, type) {
53
+ for await (const definition of this.iterate(type)) {
54
+ const isNeeded = predicate(definition);
55
+ if (isNeeded) {
56
+ return definition;
57
+ }
58
+ }
59
+ return null;
60
+ }
52
61
  }
53
62
  exports.NestDefinitionIterator = NestDefinitionIterator;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@rsdk/nest-tools",
3
- "version": "2.4.2",
3
+ "version": "2.6.0-next.16",
4
4
  "license": "Apache License 2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "main": "dist/index.js",
9
9
  "peerDependencies": {
10
- "@nestjs/common": "^9.0.0",
11
- "@nestjs/core": "^9.0.0"
10
+ "@nestjs/common": "^10.1.3",
11
+ "@nestjs/core": "^10.1.3"
12
12
  },
13
- "gitHead": "eda467ff4659536e05ed1baea445e5a6a30c056e"
13
+ "gitHead": "123d08be222c08d1efbdfb834cec836cb98527fa"
14
14
  }
@@ -63,4 +63,17 @@ export class NestDefinitionIterator {
63
63
  yield* new NestDefinitionIterator(nestImport).iterate(type);
64
64
  }
65
65
  }
66
+
67
+ async find<R extends NestModuleDefinition | Provider>(
68
+ predicate: (definition: NestModuleDefinition | Provider) => boolean,
69
+ type?: NestDefinitionType,
70
+ ): Promise<R | null> {
71
+ for await (const definition of this.iterate(type)) {
72
+ const isNeeded = predicate(definition);
73
+ if (isNeeded) {
74
+ return definition as R;
75
+ }
76
+ }
77
+ return null;
78
+ }
66
79
  }