@rsdk/autodoc.protocol 5.7.0-next.2 → 6.0.0-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.
@@ -0,0 +1,6 @@
1
+ import type { RsdkJson, Value } from './rsdk-json.types';
2
+ export declare function getMetadata(rsdkJson: RsdkJson, scope: string): Value[];
3
+ export declare function getMetadataByPredict(rsdkJson: RsdkJson, predict: (meta: {
4
+ scope: string;
5
+ }) => boolean): Value[];
6
+ export declare function getKafkaMetadata(rsdkJson: RsdkJson): Value[];
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMetadata = getMetadata;
4
+ exports.getMetadataByPredict = getMetadataByPredict;
5
+ exports.getKafkaMetadata = getKafkaMetadata;
6
+ function getMetadata(rsdkJson, scope) {
7
+ return rsdkJson.rsdkMetadata
8
+ .filter((meta) => meta.scope === scope)
9
+ .map(({ value }) => value);
10
+ }
11
+ function getMetadataByPredict(rsdkJson, predict) {
12
+ return rsdkJson.rsdkMetadata.filter(predict).map(({ value }) => value);
13
+ }
14
+ function getKafkaMetadata(rsdkJson) {
15
+ return getMetadata(rsdkJson, 'kafka-topic');
16
+ }
17
+ //# sourceMappingURL=metadata.aggregator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.aggregator.js","sourceRoot":"","sources":["../../src/rsdk-json/metadata.aggregator.ts"],"names":[],"mappings":";;AAEA,kCAIC;AACD,oDAKC;AAED,4CAEC;AAdD,SAAgB,WAAW,CAAC,QAAkB,EAAE,KAAa;IAC3D,OAAO,QAAQ,CAAC,YAAY;SACzB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC;SACtC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AACD,SAAgB,oBAAoB,CAClC,QAAkB,EAClB,OAA6C;IAE7C,OAAO,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AACzE,CAAC;AAED,SAAgB,gBAAgB,CAAC,QAAkB;IACjD,OAAO,WAAW,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { RsdkJson } from './rsdk-json.types';
2
+ export declare class RsdkJsonParser {
3
+ readonly path: string;
4
+ constructor(path?: string);
5
+ parseRsdkJson(): Promise<RsdkJson>;
6
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RsdkJsonParser = void 0;
7
+ const promises_1 = require("node:fs/promises");
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ class RsdkJsonParser {
10
+ path;
11
+ constructor(path = 'autodoc/rsdk.json') {
12
+ this.path = path;
13
+ }
14
+ async parseRsdkJson() {
15
+ const pathToRsdkJson = node_path_1.default.resolve(this.path);
16
+ const rsdkJson = JSON.parse(await (0, promises_1.readFile)(pathToRsdkJson, 'utf8'));
17
+ return rsdkJson;
18
+ }
19
+ }
20
+ exports.RsdkJsonParser = RsdkJsonParser;
21
+ //# sourceMappingURL=rsdk-json.parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rsdk-json.parser.js","sourceRoot":"","sources":["../../src/rsdk-json/rsdk-json.parser.ts"],"names":[],"mappings":";;;;;;AAAA,+CAA4C;AAC5C,0DAA6B;AAI7B,MAAa,cAAc;IACJ;IAArB,YAAqB,OAAe,mBAAmB;QAAlC,SAAI,GAAJ,IAAI,CAA8B;IAAG,CAAC;IAE3D,KAAK,CAAC,aAAa;QACjB,MAAM,cAAc,GAAG,mBAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,MAAM,QAAQ,GAAa,IAAI,CAAC,KAAK,CACnC,MAAM,IAAA,mBAAQ,EAAC,cAAc,EAAE,MAAM,CAAC,CACvC,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAXD,wCAWC"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * FIXME: Это вообще надо бы вынести из CLI в corе.
3
+ */
4
+ export interface RsdkJson {
5
+ metadata: Metadata;
6
+ rsdkMetadata: RsdkMetadata[];
7
+ }
8
+ export interface Metadata {
9
+ name: string;
10
+ version: string;
11
+ description: string;
12
+ protocols: string[];
13
+ config: Config;
14
+ }
15
+ export interface Config {
16
+ prefix: string;
17
+ sections: Section[];
18
+ sources: any[];
19
+ properties: any[];
20
+ }
21
+ export interface Section {
22
+ tags?: string[];
23
+ constructorName: string;
24
+ properties: Property[];
25
+ name?: string;
26
+ }
27
+ export interface Property {
28
+ expectedInEnv: boolean;
29
+ key: string;
30
+ description: string;
31
+ parser: Parser;
32
+ defaultValue: any;
33
+ }
34
+ export interface Parser {
35
+ type: string;
36
+ description: string;
37
+ }
38
+ export interface RsdkMetadata {
39
+ scope: string;
40
+ value: Value;
41
+ }
42
+ export interface Value {
43
+ global?: boolean;
44
+ imports?: Import[];
45
+ providers?: Provider2[];
46
+ exports?: string[];
47
+ token?: string;
48
+ partitionKeyField: any;
49
+ topicName?: string;
50
+ group?: string;
51
+ type?: number;
52
+ eventType?: EventType;
53
+ options?: Options3;
54
+ constructorName?: string;
55
+ }
56
+ export interface Import {
57
+ providers: Provider[];
58
+ exports: Export[];
59
+ }
60
+ export interface Provider {
61
+ inject: Inject | undefined[];
62
+ }
63
+ export interface Inject {
64
+ optional: boolean;
65
+ }
66
+ export interface Export {
67
+ inject: Inject2 | undefined[];
68
+ }
69
+ export interface Inject2 {
70
+ optional: boolean;
71
+ }
72
+ export interface Provider2 {
73
+ provide: string;
74
+ useValue: UseValue;
75
+ }
76
+ export interface UseValue {
77
+ context: string;
78
+ }
79
+ export interface EventType {
80
+ $group: string;
81
+ $partitionKeyField: any;
82
+ $type: string;
83
+ }
84
+ export interface Options3 {
85
+ key: string;
86
+ scope: string;
87
+ description: string;
88
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * FIXME: Это вообще надо бы вынести из CLI в corе.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=rsdk-json.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rsdk-json.types.js","sourceRoot":"","sources":["../../src/rsdk-json/rsdk-json.types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdk/autodoc.protocol",
3
- "version": "5.7.0-next.2",
3
+ "version": "6.0.0-next.0",
4
4
  "description": "Sort of autodoc-contract",
5
5
  "license": "Apache License 2.0",
6
6
  "publishConfig": {
@@ -12,10 +12,11 @@
12
12
  "@nestjs/core": "^10.0.0",
13
13
  "@rsdk/common": "*",
14
14
  "@rsdk/metadata": "*",
15
- "reflect-metadata": "^0.1.12 || ^0.2.0"
15
+ "reflect-metadata": "^0.1.12 || ^0.2.0",
16
+ "rxjs": "^7.8.1"
16
17
  },
17
18
  "dependencies": {
18
19
  "markdown-table": "2.0.0"
19
20
  },
20
- "gitHead": "c85fca0b594a2ea168d06f1d2941a4fb05b59440"
21
+ "gitHead": "215cccea23d95118dd8b6af3ce11c6a35ce19c30"
21
22
  }
@@ -0,0 +1,17 @@
1
+ import type { RsdkJson, Value } from './rsdk-json.types';
2
+
3
+ export function getMetadata(rsdkJson: RsdkJson, scope: string): Value[] {
4
+ return rsdkJson.rsdkMetadata
5
+ .filter((meta) => meta.scope === scope)
6
+ .map(({ value }) => value);
7
+ }
8
+ export function getMetadataByPredict(
9
+ rsdkJson: RsdkJson,
10
+ predict: (meta: { scope: string }) => boolean,
11
+ ): Value[] {
12
+ return rsdkJson.rsdkMetadata.filter(predict).map(({ value }) => value);
13
+ }
14
+
15
+ export function getKafkaMetadata(rsdkJson: RsdkJson): Value[] {
16
+ return getMetadata(rsdkJson, 'kafka-topic');
17
+ }
@@ -0,0 +1,17 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+
4
+ import type { RsdkJson } from './rsdk-json.types';
5
+
6
+ export class RsdkJsonParser {
7
+ constructor(readonly path: string = 'autodoc/rsdk.json') {}
8
+
9
+ async parseRsdkJson(): Promise<RsdkJson> {
10
+ const pathToRsdkJson = path.resolve(this.path);
11
+ const rsdkJson: RsdkJson = JSON.parse(
12
+ await readFile(pathToRsdkJson, 'utf8'),
13
+ );
14
+
15
+ return rsdkJson;
16
+ }
17
+ }
@@ -0,0 +1,94 @@
1
+ /**
2
+ * FIXME: Это вообще надо бы вынести из CLI в corе.
3
+ */
4
+
5
+ export interface RsdkJson {
6
+ metadata: Metadata;
7
+ rsdkMetadata: RsdkMetadata[];
8
+ }
9
+ export interface Metadata {
10
+ name: string;
11
+ version: string;
12
+ description: string;
13
+ protocols: string[];
14
+ config: Config;
15
+ }
16
+ export interface Config {
17
+ prefix: string;
18
+ sections: Section[];
19
+ sources: any[];
20
+ properties: any[];
21
+ }
22
+
23
+ export interface Section {
24
+ tags?: string[];
25
+ constructorName: string;
26
+ properties: Property[];
27
+ name?: string;
28
+ }
29
+
30
+ export interface Property {
31
+ expectedInEnv: boolean;
32
+ key: string;
33
+ description: string;
34
+ parser: Parser;
35
+ defaultValue: any;
36
+ }
37
+
38
+ export interface Parser {
39
+ type: string;
40
+ description: string;
41
+ }
42
+
43
+ export interface RsdkMetadata {
44
+ scope: string;
45
+ value: Value;
46
+ }
47
+
48
+ export interface Value {
49
+ global?: boolean;
50
+ imports?: Import[];
51
+ providers?: Provider2[];
52
+ exports?: string[];
53
+ token?: string;
54
+ partitionKeyField: any;
55
+ topicName?: string;
56
+ group?: string;
57
+ type?: number;
58
+ eventType?: EventType;
59
+ options?: Options3;
60
+ constructorName?: string;
61
+ }
62
+ export interface Import {
63
+ providers: Provider[];
64
+ exports: Export[];
65
+ }
66
+ export interface Provider {
67
+ inject: Inject | undefined[];
68
+ }
69
+ export interface Inject {
70
+ optional: boolean;
71
+ }
72
+ export interface Export {
73
+ inject: Inject2 | undefined[];
74
+ }
75
+ export interface Inject2 {
76
+ optional: boolean;
77
+ }
78
+ export interface Provider2 {
79
+ provide: string;
80
+ useValue: UseValue;
81
+ }
82
+ export interface UseValue {
83
+ context: string;
84
+ }
85
+ export interface EventType {
86
+ $group: string;
87
+ $partitionKeyField: any;
88
+ $type: string;
89
+ }
90
+ export interface Options3 {
91
+ key: string;
92
+ scope: string;
93
+ description: string;
94
+ }