@rsdk/cli.cmd.autodoc 4.3.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.
Files changed (64) hide show
  1. package/dist/autodoc.cmd.d.ts +3 -0
  2. package/dist/autodoc.cmd.js +123 -0
  3. package/dist/autodoc.cmd.js.map +1 -0
  4. package/dist/autodoc.context.d.ts +7 -0
  5. package/dist/autodoc.context.js +14 -0
  6. package/dist/autodoc.context.js.map +1 -0
  7. package/dist/autodoc.d.ts +2 -0
  8. package/dist/autodoc.js +61 -0
  9. package/dist/autodoc.js.map +1 -0
  10. package/dist/cli.d.ts +20 -0
  11. package/dist/cli.js +103 -0
  12. package/dist/cli.js.map +1 -0
  13. package/dist/document.file.d.ts +7 -0
  14. package/dist/document.file.js +25 -0
  15. package/dist/document.file.js.map +1 -0
  16. package/dist/documentation.d.ts +9 -0
  17. package/dist/documentation.js +44 -0
  18. package/dist/documentation.js.map +1 -0
  19. package/dist/extractor/extractor.d.ts +18 -0
  20. package/dist/extractor/extractor.js +47 -0
  21. package/dist/extractor/extractor.js.map +1 -0
  22. package/dist/fragments/additional-sources.fragment.d.ts +9 -0
  23. package/dist/fragments/additional-sources.fragment.js +34 -0
  24. package/dist/fragments/additional-sources.fragment.js.map +1 -0
  25. package/dist/fragments/app-metadata.fragment.d.ts +8 -0
  26. package/dist/fragments/app-metadata.fragment.js +19 -0
  27. package/dist/fragments/app-metadata.fragment.js.map +1 -0
  28. package/dist/fragments/autodoc.fragment.d.ts +8 -0
  29. package/dist/fragments/autodoc.fragment.js +23 -0
  30. package/dist/fragments/autodoc.fragment.js.map +1 -0
  31. package/dist/fragments/config-section/config-section.fragment.d.ts +11 -0
  32. package/dist/fragments/config-section/config-section.fragment.js +91 -0
  33. package/dist/fragments/config-section/config-section.fragment.js.map +1 -0
  34. package/dist/fragments/config-section/constants.d.ts +1 -0
  35. package/dist/fragments/config-section/constants.js +5 -0
  36. package/dist/fragments/config-section/constants.js.map +1 -0
  37. package/dist/fragments/config-section/types.d.ts +4 -0
  38. package/dist/fragments/config-section/types.js +3 -0
  39. package/dist/fragments/config-section/types.js.map +1 -0
  40. package/dist/fragments/core.d.ts +5 -0
  41. package/dist/fragments/core.js +7 -0
  42. package/dist/fragments/core.js.map +1 -0
  43. package/dist/fragments/header.fragment.d.ts +8 -0
  44. package/dist/fragments/header.fragment.js +18 -0
  45. package/dist/fragments/header.fragment.js.map +1 -0
  46. package/dist/fragments/plugin.fragment.d.ts +8 -0
  47. package/dist/fragments/plugin.fragment.js +20 -0
  48. package/dist/fragments/plugin.fragment.js.map +1 -0
  49. package/dist/fragments/transports.fragment.d.ts +9 -0
  50. package/dist/fragments/transports.fragment.js +32 -0
  51. package/dist/fragments/transports.fragment.js.map +1 -0
  52. package/dist/index.d.ts +7 -0
  53. package/dist/index.js +12 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/md-formats/md-formats.d.ts +4 -0
  56. package/dist/md-formats/md-formats.js +13 -0
  57. package/dist/md-formats/md-formats.js.map +1 -0
  58. package/dist/openapi.generator.d.ts +11 -0
  59. package/dist/openapi.generator.js +85 -0
  60. package/dist/openapi.generator.js.map +1 -0
  61. package/dist/rsdk.file-generator.d.ts +9 -0
  62. package/dist/rsdk.file-generator.js +26 -0
  63. package/dist/rsdk.file-generator.js.map +1 -0
  64. package/package.json +38 -0
@@ -0,0 +1,3 @@
1
+ export declare class AutodocCmd {
2
+ generate(verbose: boolean, pretty: boolean, ifPresent: boolean, openApi: boolean, outPath: string, appPath: string): Promise<void>;
3
+ }
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var __metadata = (this && this.__metadata) || function (k, v) {
32
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33
+ };
34
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
35
+ return function (target, key) { decorator(target, key, paramIndex); }
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.AutodocCmd = void 0;
39
+ const cli_common_1 = require("@rsdk/cli.common");
40
+ const logging_1 = require("@rsdk/logging");
41
+ const promises_1 = require("node:fs/promises");
42
+ const node_path_1 = require("node:path");
43
+ const node_process_1 = require("node:process");
44
+ const autodoc_context_1 = require("./autodoc.context");
45
+ const documentation_1 = require("./documentation");
46
+ const openapi_generator_1 = require("./openapi.generator");
47
+ const rsdk_file_generator_1 = require("./rsdk.file-generator");
48
+ class AutodocCmd {
49
+ async generate(verbose, pretty, ifPresent, openApi, outPath, appPath) {
50
+ const logger = logging_1.LoggerFactory.create(AutodocCmd);
51
+ const fullAppPath = (0, node_path_1.join)((0, node_process_1.cwd)(), appPath);
52
+ const fullMdPath = (0, node_path_1.join)((0, node_process_1.cwd)(), outPath);
53
+ if (verbose) {
54
+ logger.info(`app path: ${fullAppPath}`);
55
+ logger.info(`md path: ${fullMdPath}`);
56
+ logger.info(`--if-present: ${ifPresent}`);
57
+ logger.info(`--pretty: ${pretty}`);
58
+ }
59
+ let app;
60
+ try {
61
+ const importedPlatformAppModule = await Promise.resolve(`${fullAppPath}`).then(s => __importStar(require(s)));
62
+ app = importedPlatformAppModule.app;
63
+ }
64
+ catch (error) {
65
+ logger.warn(`module by path ${fullAppPath} not found`);
66
+ if (ifPresent) {
67
+ logger.info(`found --if-present, finished with exit code 0`);
68
+ return;
69
+ }
70
+ logger.error(`Error on import ${fullAppPath}`, error);
71
+ throw error;
72
+ }
73
+ const documentFiles = [];
74
+ const autodocContext = new autodoc_context_1.AutodocContext(app);
75
+ if (openApi) {
76
+ const openApiDocument = await new openapi_generator_1.OpenapiGenerator(autodocContext).createFile();
77
+ if (openApiDocument) {
78
+ documentFiles.push(openApiDocument);
79
+ }
80
+ }
81
+ const rsdkDocument = await new rsdk_file_generator_1.RsdkFileGenerator(autodocContext).createFile();
82
+ documentFiles.push(rsdkDocument);
83
+ const documentation = new documentation_1.Documentation(autodocContext);
84
+ const documentationFile = await documentation.getDocument();
85
+ documentFiles.push(documentationFile);
86
+ try {
87
+ await (0, promises_1.mkdir)(fullMdPath, {
88
+ recursive: true,
89
+ });
90
+ await Promise.all(documentFiles.map(async (df) => {
91
+ await df.write(fullMdPath);
92
+ logger.info('document ' + df.name + ' created!');
93
+ }));
94
+ }
95
+ catch (error) {
96
+ logger.error('Error on write: ', error);
97
+ logger.info('Remove generated files');
98
+ await Promise.all(documentFiles.map(async (documentFile) => {
99
+ logger.info(`remove document: ${documentFile.name}`);
100
+ await documentFile.remove(fullMdPath);
101
+ logger.info(`finished remove document: ${documentFile.name}`);
102
+ }));
103
+ throw error;
104
+ }
105
+ }
106
+ }
107
+ exports.AutodocCmd = AutodocCmd;
108
+ __decorate([
109
+ (0, cli_common_1.SubCmd)('autodoc', 'autodoc your app'),
110
+ __param(0, (0, cli_common_1.Option)('verbose', 'Verbose output', Boolean)),
111
+ __param(1, (0, cli_common_1.Option)('pretty', 'Pretty output', Boolean)),
112
+ __param(2, (0, cli_common_1.Option)('if-present', 'Not fail if not provided app file', Boolean)),
113
+ __param(3, (0, cli_common_1.Option)('open-api', 'generate open api', Boolean)),
114
+ __param(4, (0, cli_common_1.Option)('out', 'out folder', String)),
115
+ __param(4, (0, cli_common_1.Alias)('o')),
116
+ __param(4, (0, cli_common_1.Default)('autodoc')),
117
+ __param(5, (0, cli_common_1.Option)('app', 'path to app.js file', String)),
118
+ __param(5, (0, cli_common_1.Default)('./dist/app.js')),
119
+ __metadata("design:type", Function),
120
+ __metadata("design:paramtypes", [Boolean, Boolean, Boolean, Boolean, String, String]),
121
+ __metadata("design:returntype", Promise)
122
+ ], AutodocCmd.prototype, "generate", null);
123
+ //# sourceMappingURL=autodoc.cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autodoc.cmd.js","sourceRoot":"","sources":["../src/autodoc.cmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAkE;AAElE,2CAA8C;AAC9C,+CAAyC;AACzC,yCAAiC;AACjC,+CAAmC;AAEnC,uDAAmD;AAEnD,mDAAgD;AAChD,2DAAuD;AACvD,+DAA0D;AAE1D,MAAa,UAAU;IAEf,AAAN,KAAK,CAAC,QAAQ,CACkC,OAAgB,EAElB,MAAe,EAG3D,SAAkB,EAEgC,OAAgB,EAKlE,OAAe,EAIf,OAAe;QAEf,MAAM,MAAM,GAAG,uBAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAChD,M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mBAAM,EAAC,SAAS,EAAE,kBAAkB,CAAC;IAEnC,WAAA,IAAA,mBAAM,EAAC,SAAS,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAA;IAE5C,WAAA,IAAA,mBAAM,EAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,CAAC,CAAA;IAE1C,WAAA,IAAA,mBAAM,EAAC,YAAY,EAAE,mCAAmC,EAAE,OAAO,CAAC,CAAA;IAGlE,WAAA,IAAA,mBAAM,EAAC,UAAU,EAAE,mBAAmB,EAAE,OAAO,CAAC,CAAA;IAEhD,WAAA,IAAA,mBAAM,EAAC,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,CAAA;IACnC,WAAA,IAAA,kBAAK,EAAC,GAAG,CAAC,CAAA;IACV,WAAA,IAAA,oBAAO,EAAC,SAAS,CAAC,CAAA;IAGlB,WAAA,IAAA,mBAAM,EAAC,KAAK,EAAE,qBAAqB,EAAE,MAAM,CAAC,CAAA;IAC5C,WAAA,IAAA,oBAAO,EAAC,eAAe,CAAC,CAAA;;;;0CA6E1B"}
@@ -0,0 +1,7 @@
1
+ import type { PlatformApp } from '@rsdk/core';
2
+ import type { RsdkMetadataProvider } from '@rsdk/metadata';
3
+ export declare class AutodocContext {
4
+ readonly platformApp: PlatformApp;
5
+ constructor(platformApp: PlatformApp);
6
+ getRsdkMetadataProvider(): Promise<RsdkMetadataProvider>;
7
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AutodocContext = void 0;
4
+ class AutodocContext {
5
+ platformApp;
6
+ constructor(platformApp) {
7
+ this.platformApp = platformApp;
8
+ }
9
+ async getRsdkMetadataProvider() {
10
+ return await this.platformApp.context.getRsdkMetadataProvider();
11
+ }
12
+ }
13
+ exports.AutodocContext = AutodocContext;
14
+ //# sourceMappingURL=autodoc.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autodoc.context.js","sourceRoot":"","sources":["../src/autodoc.context.ts"],"names":[],"mappings":";;;AAGA,MAAa,cAAc;IACJ;IAArB,YAAqB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAEjD,KAAK,CAAC,uBAAuB;QAC3B,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAClE,CAAC;CACF;AAND,wCAMC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export declare const main: () => Promise<void>;
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.main = void 0;
28
+ const logging_1 = require("@rsdk/logging");
29
+ const commander_1 = require("commander");
30
+ const process = __importStar(require("node:process"));
31
+ const cli_1 = require("./cli");
32
+ const parseBool = (value, previous) => JSON.parse(value ?? previous);
33
+ commander_1.program
34
+ .option('--app <path to file>', 'path to app.js', './dist/app.js')
35
+ .option('-o, --out <folder>', 'out folder for docs', 'autodoc')
36
+ .option('--open-api <boolean>', 'force disable/enable generate openapi', parseBool, true)
37
+ .option('--verbose', 'Verbose output')
38
+ .option('--if-present', 'If true, will not exit with an error when app file not found')
39
+ .option('--pretty', 'If true, logs with pino-pretty', true);
40
+ commander_1.program.parse();
41
+ const options = commander_1.program.opts();
42
+ if (options.pretty) {
43
+ logging_1.LoggerFactory.reconfigure({
44
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
45
+ stream: require('pino-pretty')(),
46
+ });
47
+ }
48
+ const logger = logging_1.LoggerFactory.create('autodoc');
49
+ const main = async () => {
50
+ try {
51
+ await new cli_1.Cli(options).execute();
52
+ process.exit();
53
+ }
54
+ catch (error) {
55
+ logger.fatal(error);
56
+ process.exit(1);
57
+ }
58
+ };
59
+ exports.main = main;
60
+ require.main === module && (0, exports.main)();
61
+ //# sourceMappingURL=autodoc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autodoc.js","sourceRoot":"","sources":["../src/autodoc.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,2CAA8C;AAC9C,yCAAoC;AACpC,sDAAwC;AAExC,+BAA4B;AAE5B,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,QAAiB,EAAW,EAAE,CAC9D,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,QAAQ,CAAC,CAAC;AAEhC,mBAAO;KACJ,MAAM,CAAC,sBAAsB,EAAE,gBAAgB,EAAE,eAAe,CAAC;KACjE,MAAM,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,SAAS,CAAC;KAC9D,MAAM,CACL,sBAAsB,EACtB,uCAAuC,EACvC,SAAS,EACT,IAAI,CACL;KACA,MAAM,CAAC,WAAW,EAAE,gBAAgB,CAAC;KACrC,MAAM,CACL,cAAc,EACd,8DAA8D,CAC/D;KACA,MAAM,CAAC,UAAU,EAAE,gCAAgC,EAAE,IAAI,CAAC,CAAC;AAE9D,mBAAO,CAAC,KAAK,EAAE,CAAC;AAEhB,MAAM,OAAO,GAAG,mBAAO,CAAC,IAAI,EAOxB,CAAC;AAEL,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IACnB,uBAAa,CAAC,WAAW,CAAC;QACxB,8DAA8D;QAC9D,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,EAAE;KACjC,CAAC,CAAC;AACL,CAAC;AACD,MAAM,MAAM,GAAG,uBAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAExC,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IAC5C,IAAI,CAAC;QACH,MAAM,IAAI,SAAG,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;QACjC,OAAO,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC;AARW,QAAA,IAAI,QAQf;AAEF,OAAO,CAAC,IAAI,KAAK,MAAM,IAAI,IAAA,YAAI,GAAE,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ export declare class Cli {
2
+ readonly options: {
3
+ verbose?: boolean;
4
+ pretty?: boolean;
5
+ ifPresent?: boolean;
6
+ openApi?: boolean;
7
+ out: string;
8
+ app: string;
9
+ };
10
+ private static logger;
11
+ constructor(options: {
12
+ verbose?: boolean;
13
+ pretty?: boolean;
14
+ ifPresent?: boolean;
15
+ openApi?: boolean;
16
+ out: string;
17
+ app: string;
18
+ });
19
+ execute(): Promise<void>;
20
+ }
package/dist/cli.js ADDED
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.Cli = void 0;
27
+ const logging_1 = require("@rsdk/logging");
28
+ const promises_1 = require("node:fs/promises");
29
+ const node_path_1 = require("node:path");
30
+ const node_process_1 = require("node:process");
31
+ const autodoc_context_1 = require("./autodoc.context");
32
+ const documentation_1 = require("./documentation");
33
+ const openapi_generator_1 = require("./openapi.generator");
34
+ const rsdk_file_generator_1 = require("./rsdk.file-generator");
35
+ class Cli {
36
+ options;
37
+ static logger = logging_1.LoggerFactory.create('Autodoc');
38
+ constructor(options) {
39
+ this.options = options;
40
+ }
41
+ async execute() {
42
+ const options = this.options;
43
+ const logger = Cli.logger;
44
+ const appPath = options.app;
45
+ const outPath = options.out;
46
+ const fullAppPath = (0, node_path_1.join)((0, node_process_1.cwd)(), appPath);
47
+ const fullMdPath = (0, node_path_1.join)((0, node_process_1.cwd)(), outPath);
48
+ if (options.verbose) {
49
+ logger.info(`app path: ${fullAppPath}`);
50
+ logger.info(`md path: ${fullMdPath}`);
51
+ logger.info(`--if-present: ${options.ifPresent}`);
52
+ logger.info(`--pretty: ${options.pretty}`);
53
+ }
54
+ let app;
55
+ try {
56
+ const importedPlatformAppModule = await Promise.resolve(`${fullAppPath}`).then(s => __importStar(require(s)));
57
+ app = importedPlatformAppModule.app;
58
+ }
59
+ catch (error) {
60
+ logger.warn(`module by path ${fullAppPath} not found`);
61
+ if (options.ifPresent) {
62
+ logger.info(`found --if-present, finished with exit code 0`);
63
+ return;
64
+ }
65
+ logger.error(`Error on import ${fullAppPath}`, error);
66
+ throw error;
67
+ }
68
+ const documentFiles = [];
69
+ const autodocContext = new autodoc_context_1.AutodocContext(app);
70
+ if (options.openApi) {
71
+ const openApiDocument = await new openapi_generator_1.OpenapiGenerator(autodocContext).createFile();
72
+ if (openApiDocument) {
73
+ documentFiles.push(openApiDocument);
74
+ }
75
+ }
76
+ const rsdkDocument = await new rsdk_file_generator_1.RsdkFileGenerator(autodocContext).createFile();
77
+ documentFiles.push(rsdkDocument);
78
+ const documentation = new documentation_1.Documentation(autodocContext);
79
+ const documentationFile = await documentation.getDocument();
80
+ documentFiles.push(documentationFile);
81
+ try {
82
+ await (0, promises_1.mkdir)(fullMdPath, {
83
+ recursive: true,
84
+ });
85
+ await Promise.all(documentFiles.map(async (df) => {
86
+ await df.write(fullMdPath);
87
+ logger.info('document ' + df.name + ' created!');
88
+ }));
89
+ }
90
+ catch (error) {
91
+ logger.error('Error on write: ', error);
92
+ logger.info('Remove generated files');
93
+ await Promise.all(documentFiles.map(async (documentFile) => {
94
+ logger.info(`remove document: ${documentFile.name}`);
95
+ await documentFile.remove(fullMdPath);
96
+ logger.info(`finished remove document: ${documentFile.name}`);
97
+ }));
98
+ throw error;
99
+ }
100
+ }
101
+ }
102
+ exports.Cli = Cli;
103
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA8C;AAC9C,+CAAyC;AACzC,yCAAiC;AACjC,+CAAmC;AAEnC,uDAAmD;AAEnD,mDAAgD;AA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Ac,CAAC,CAAC;YACjD,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;YACtC,MAAM,OAAO,CAAC,GAAG,CACf,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;gBACvC,MAAM,CAAC,IAAI,CAAC,oBAAoB,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;gBACrD,MAAM,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gBACtC,MAAM,CAAC,IAAI,CAAC,6BAA6B,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;YAChE,CAAC,CAAC,CACH,CAAC;YACF,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;;AA5FH,kBA6FC"}
@@ -0,0 +1,7 @@
1
+ export declare class DocumentFile {
2
+ readonly name: string;
3
+ readonly content: string;
4
+ constructor(name: string, content: string);
5
+ write(basePath?: string): Promise<string>;
6
+ remove(basePath?: string): Promise<string>;
7
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DocumentFile = void 0;
4
+ const promises_1 = require("node:fs/promises");
5
+ const node_path_1 = require("node:path");
6
+ class DocumentFile {
7
+ name;
8
+ content;
9
+ constructor(name, content) {
10
+ this.name = name;
11
+ this.content = content;
12
+ }
13
+ async write(basePath = __dirname) {
14
+ const fullPath = (0, node_path_1.join)(basePath, this.name);
15
+ await (0, promises_1.writeFile)(fullPath, this.content);
16
+ return fullPath;
17
+ }
18
+ async remove(basePath = __dirname) {
19
+ const fullPath = (0, node_path_1.join)(basePath, this.name);
20
+ await (0, promises_1.rm)(fullPath);
21
+ return fullPath;
22
+ }
23
+ }
24
+ exports.DocumentFile = DocumentFile;
25
+ //# sourceMappingURL=document.file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.file.js","sourceRoot":"","sources":["../src/document.file.ts"],"names":[],"mappings":";;;AAAA,+CAAiD;AACjD,yCAAiC;AAEjC,MAAa,YAAY;IAEZ;IACA;IAFX,YACW,IAAY,EACZ,OAAe;QADf,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAQ;IACvB,CAAC;IAEJ,KAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,SAAS;QAC9B,MAAM,QAAQ,GAAG,IAAA,gBAAI,EAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAE3C,MAAM,IAAA,oBAAS,EAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACxC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,QAAQ,GAAG,SAAS;QAC/B,MAAM,QAAQ,GAAG,IAAA,gBAAI,EAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAE3C,MAAM,IAAA,aAAE,EAAC,QAAQ,CAAC,CAAC;QACnB,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAnBD,oCAmBC"}
@@ -0,0 +1,9 @@
1
+ import type { AutodocContext } from './autodoc.context';
2
+ import { DocumentFile } from './document.file';
3
+ export declare class Documentation {
4
+ private readonly appContext;
5
+ private static logger;
6
+ constructor(appContext: AutodocContext);
7
+ getDocument(): Promise<DocumentFile>;
8
+ private getStructure;
9
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Documentation = void 0;
4
+ const autodoc_protocol_1 = require("@rsdk/autodoc.protocol");
5
+ const logging_1 = require("@rsdk/logging");
6
+ const additional_sources_fragment_1 = require("./fragments/additional-sources.fragment");
7
+ const app_metadata_fragment_1 = require("./fragments/app-metadata.fragment");
8
+ const autodoc_fragment_1 = require("./fragments/autodoc.fragment");
9
+ const config_section_fragment_1 = require("./fragments/config-section/config-section.fragment");
10
+ const header_fragment_1 = require("./fragments/header.fragment");
11
+ const plugin_fragment_1 = require("./fragments/plugin.fragment");
12
+ const transports_fragment_1 = require("./fragments/transports.fragment");
13
+ const document_file_1 = require("./document.file");
14
+ class Documentation {
15
+ appContext;
16
+ static logger = logging_1.LoggerFactory.create(Documentation);
17
+ constructor(appContext) {
18
+ this.appContext = appContext;
19
+ }
20
+ async getDocument() {
21
+ Documentation.logger.info('Start generating documentation');
22
+ const content = await this.getStructure();
23
+ const nodes = await Promise.all(content.map((item) => item.getDocumentNode()));
24
+ const metadata = await this.appContext.platformApp.getMetadata();
25
+ const documentationFile = new document_file_1.DocumentFile('autodoc.md', await new autodoc_protocol_1.Composite(nodes.filter((node) => node !== null), 'Application: ' + metadata.name).toString());
26
+ Documentation.logger.info('Generating documentation finished');
27
+ return documentationFile;
28
+ }
29
+ async getStructure() {
30
+ const appContext = this.appContext;
31
+ const metadata = await appContext.platformApp.getMetadata();
32
+ return [
33
+ new header_fragment_1.HeaderFragment(appContext),
34
+ new app_metadata_fragment_1.AppMetadataFragment(appContext),
35
+ new plugin_fragment_1.PluginFragment(appContext.platformApp.platformAppOptions.plugins),
36
+ new transports_fragment_1.TransportsFragment(appContext.platformApp.platformAppOptions.transports),
37
+ new additional_sources_fragment_1.AdditionalSourcesFragment(metadata.config.sources),
38
+ new config_section_fragment_1.ConfigSectionFragment(metadata),
39
+ new autodoc_fragment_1.AutodocMetadataFragment(appContext),
40
+ ];
41
+ }
42
+ }
43
+ exports.Documentation = Documentation;
44
+ //# sourceMappingURL=documentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentation.js","sourceRoot":"","sources":["../src/documentation.ts"],"names":[],"mappings":";;;AACA,6DAAmD;AACnD,2CAA8C;AAE9C,yFAAoF;AACpF,6EAAwE;AACxE,mEAAuE;AACvE,gGAA2F;AAE3F,iEAA6D;AAC7D,iEAA6D;AAC7D,yEAAqE;AAErE,mDAA+C;AAE/C,MAAa,aAAa;IAGK;IAFrB,MAAM,CAAC,MAAM,GAAG,uBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAE5D,YAA6B,UAA0B;QAA1B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AAqB,CAAC,QAAQ,CAAC;YACnC,IAAI,0CAAuB,CAAC,UAAU,CAAC;SACxC,CAAC;IACJ,CAAC;;AA3CH,sCA4CC"}
@@ -0,0 +1,18 @@
1
+ import type { DynamicModule, Type } from '@nestjs/common';
2
+ import type { DocumentResolver } from '@rsdk/autodoc.protocol';
3
+ import type { Promisable } from 'type-fest';
4
+ type DocumentResolverMap = Map<string, DocumentResolver>;
5
+ export declare class DocumentExtractor {
6
+ readonly module: Promisable<DynamicModule | Type>;
7
+ constructor(module: Promisable<DynamicModule | Type>);
8
+ getDocumentResolverMap(): Promise<DocumentResolverMap>;
9
+ /**
10
+ * Рекурсивно проходит по дереву объявлений неста и добавляет все AutodocResolver в `map`
11
+ */
12
+ private recursiveFillDocumentMap;
13
+ /**
14
+ * Извлекает autodoc-метаданные из definition и добавляет их в map
15
+ */
16
+ private fillDocumentMap;
17
+ }
18
+ export {};
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DocumentExtractor = void 0;
4
+ const autodoc_protocol_1 = require("@rsdk/autodoc.protocol");
5
+ const metadata_1 = require("@rsdk/metadata");
6
+ const nest_tools_1 = require("@rsdk/nest-tools");
7
+ class DocumentExtractor {
8
+ module;
9
+ constructor(module) {
10
+ this.module = module;
11
+ }
12
+ async getDocumentResolverMap() {
13
+ return this.recursiveFillDocumentMap();
14
+ }
15
+ /**
16
+ * Рекурсивно проходит по дереву объявлений неста и добавляет все AutodocResolver в `map`
17
+ */
18
+ async recursiveFillDocumentMap(autodocResolverMap = new Map()) {
19
+ const nestDefinitionIterator = new nest_tools_1.NestDefinitionIterator(this.module);
20
+ for await (const nestDef of nestDefinitionIterator.iterate()) {
21
+ if (!metadata_1.NestAssert.isObjectOrCtor(nestDef)) {
22
+ continue;
23
+ }
24
+ for (const value of metadata_1.RsdkMetadataProvider.getMetadataSource(nestDef)) {
25
+ if (!metadata_1.NestAssert.isObjectOrCtor(value)) {
26
+ continue;
27
+ }
28
+ this.fillDocumentMap(value, autodocResolverMap);
29
+ }
30
+ }
31
+ return autodocResolverMap;
32
+ }
33
+ /**
34
+ * Извлекает autodoc-метаданные из definition и добавляет их в map
35
+ */
36
+ fillDocumentMap(definition, extractorMap) {
37
+ const resolvers = autodoc_protocol_1.AutodocMetadata.getResolvers(definition);
38
+ if (!resolvers) {
39
+ return;
40
+ }
41
+ for (const resolver of resolvers) {
42
+ extractorMap.set(resolver.scope, resolver.resolver);
43
+ }
44
+ }
45
+ }
46
+ exports.DocumentExtractor = DocumentExtractor;
47
+ //# sourceMappingURL=extractor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractor.js","sourceRoot":"","sources":["../../src/extractor/extractor.ts"],"names":[],"mappings":";;;AAUA,6DAAyD;AACzD,6CAAkE;AAClE,iDAA0D;AAK1D,MAAa,iBAAiB;IACP;IAArB,YAAqB,MAAwC;QAAxC,WAAM,GAAN,MAAM,CAAkC;IAAG,CAAC;IAEjE,KAAK,CAAC,sBAAsB;QAC1B,OAAO,IAAI,CAAC,wBAAwB,EAAE,CAAC;IACzC,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,wBAAwB,CACpC,qBAA0C,IAAI,GAAG,EAAE;QAEnD,MAAM,sBAAsB,GAAG,IAAI,mCAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEvE,IAAI,KAAK,EAAE,MAAM,OAAO,IAAI,sBAAsB,CAAC,OAAO,EAAE,EAAE,CAAC;YAC7D,IAAI,CAAC,qBAAU,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;gBACxC,SAAS;YACX,CAAC;YACD,KAAK,MAAM,KAAK,IAAI,+BAAoB,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,CAAC;gBACpE,IAAI,CAAC,qBAAU,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;oBACtC,SAAS;gBACX,CAAC;gBACD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;QAED,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED;;OAEG;IACK,eAAe,CACrB,UASY,EACZ,YAAiC;QAEjC,MAAM,SAAS,GAAG,kCAAe,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QAE3D,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QACD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YACjC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;CACF;AAvDD,8CAuDC"}
@@ -0,0 +1,9 @@
1
+ import { Composite } from '@rsdk/autodoc.protocol';
2
+ import type { SourceMetadata } from '@rsdk/core';
3
+ import { DocumentFragment } from './core';
4
+ export declare class AdditionalSourcesFragment extends DocumentFragment {
5
+ private sources?;
6
+ constructor(sources?: SourceMetadata[] | undefined);
7
+ getContent(): string;
8
+ getDocumentNode(): Composite | null;
9
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdditionalSourcesFragment = void 0;
4
+ const autodoc_protocol_1 = require("@rsdk/autodoc.protocol");
5
+ const core_1 = require("./core");
6
+ class AdditionalSourcesFragment extends core_1.DocumentFragment {
7
+ sources;
8
+ constructor(sources) {
9
+ super();
10
+ this.sources = sources;
11
+ }
12
+ getContent() {
13
+ if (!this.sources?.length) {
14
+ return '';
15
+ }
16
+ const fragments = [];
17
+ fragments.push('## Additional Sources', '\n');
18
+ for (const metadata of this.sources) {
19
+ fragments.push(`### ${metadata.name}`, `${metadata.name} ${metadata.description}`);
20
+ }
21
+ return fragments.join('\n');
22
+ }
23
+ getDocumentNode() {
24
+ if (!this.sources) {
25
+ return null;
26
+ }
27
+ const sourceNodes = this.sources.map((metadata) => {
28
+ return new autodoc_protocol_1.Composite([`${metadata.name} ${metadata.description}`], metadata.name);
29
+ });
30
+ return new autodoc_protocol_1.Composite(sourceNodes, 'AdditionalSources');
31
+ }
32
+ }
33
+ exports.AdditionalSourcesFragment = AdditionalSourcesFragment;
34
+ //# sourceMappingURL=additional-sources.fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"additional-sources.fragment.js","sourceRoot":"","sources":["../../src/fragments/additional-sources.fragment.ts"],"names":[],"mappings":";;;AAAA,6DAAmD;AAGnD,iCAA0C;AAE1C,MAAa,yBAA0B,SAAQ,uBAAgB;IACzC;IAApB,YAAoB,OAA0B;QAC5C,KAAK,EAAE,CAAC;QADU,YAAO,GAAP,OAAO,CAAmB;IAE9C,CAAC;IAED,UAAU;QACR,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;YAC1B,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,SAAS,GAAa,EAAE,CAAC;QAE/B,SAAS,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;QAE9C,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACpC,SAAS,CAAC,IAAI,CACZ,OAAO,QAAQ,CAAC,IAAI,EAAE,EACtB,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,WAAW,EAAE,CAC3C,CAAC;QACJ,CAAC;QACD,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,eAAe;QACb,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YAChD,OAAO,IAAI,4BAAS,CAClB,CAAC,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC,EAC5C,QAAQ,CAAC,IAAI,CACd,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,4BAAS,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;IACzD,CAAC;CACF;AAnCD,8DAmCC"}
@@ -0,0 +1,8 @@
1
+ import type { DocumentNode } from '@rsdk/autodoc.protocol';
2
+ import type { AutodocContext } from '../autodoc.context';
3
+ import type { DocumentFragment } from './core';
4
+ export declare class AppMetadataFragment implements DocumentFragment {
5
+ private appContext;
6
+ constructor(appContext: AutodocContext);
7
+ getDocumentNode(): Promise<DocumentNode[] | DocumentNode | null>;
8
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppMetadataFragment = void 0;
4
+ const autodoc_protocol_1 = require("@rsdk/autodoc.protocol");
5
+ class AppMetadataFragment {
6
+ appContext;
7
+ constructor(appContext) {
8
+ this.appContext = appContext;
9
+ }
10
+ async getDocumentNode() {
11
+ const metadata = await this.appContext.platformApp.getMetadata();
12
+ if (!metadata.description) {
13
+ return null;
14
+ }
15
+ return new autodoc_protocol_1.Composite(metadata.description, 'Description');
16
+ }
17
+ }
18
+ exports.AppMetadataFragment = AppMetadataFragment;
19
+ //# sourceMappingURL=app-metadata.fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-metadata.fragment.js","sourceRoot":"","sources":["../../src/fragments/app-metadata.fragment.ts"],"names":[],"mappings":";;;AACA,6DAAmD;AAMnD,MAAa,mBAAmB;IACV;IAApB,YAAoB,UAA0B;QAA1B,eAAU,GAAV,UAAU,CAAgB;IAAG,CAAC;IAElD,KAAK,CAAC,eAAe;QACnB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;QAEjE,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,4BAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAC5D,CAAC;CACF;AAXD,kDAWC"}
@@ -0,0 +1,8 @@
1
+ import type { DocumentNode } from '@rsdk/autodoc.protocol';
2
+ import type { AutodocContext } from '../autodoc.context';
3
+ import type { DocumentFragment } from './core';
4
+ export declare class AutodocMetadataFragment implements DocumentFragment {
5
+ readonly appContext: AutodocContext;
6
+ constructor(appContext: AutodocContext);
7
+ getDocumentNode(): Promise<DocumentNode>;
8
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AutodocMetadataFragment = void 0;
4
+ const autodoc_protocol_1 = require("@rsdk/autodoc.protocol");
5
+ const extractor_1 = require("../extractor/extractor");
6
+ class AutodocMetadataFragment {
7
+ appContext;
8
+ constructor(appContext) {
9
+ this.appContext = appContext;
10
+ }
11
+ async getDocumentNode() {
12
+ const documentResolverMap = await new extractor_1.DocumentExtractor(this.appContext.platformApp.context.getRoot()).getDocumentResolverMap();
13
+ const nodes = [];
14
+ const rsdkMetadataProvider = await this.appContext.getRsdkMetadataProvider();
15
+ for (const resolver of documentResolverMap.values()) {
16
+ const node = await resolver.getNode(rsdkMetadataProvider);
17
+ node && nodes.push(node);
18
+ }
19
+ return new autodoc_protocol_1.Composite(nodes);
20
+ }
21
+ }
22
+ exports.AutodocMetadataFragment = AutodocMetadataFragment;
23
+ //# sourceMappingURL=autodoc.fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autodoc.fragment.js","sourceRoot":"","sources":["../../src/fragments/autodoc.fragment.ts"],"names":[],"mappings":";;;AACA,6DAAmD;AAGnD,sDAA2D;AAI3D,MAAa,uBAAuB;IACb;IAArB,YAAqB,UAA0B;QAA1B,eAAU,GAAV,UAAU,CAAgB;IAAG,CAAC;IAEnD,KAAK,CAAC,eAAe;QACnB,MAAM,mBAAmB,GAAG,MAAM,IAAI,6BAAiB,CACrD,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,CAC9C,CAAC,sBAAsB,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAmB,EAAE,CAAC;QAEjC,MAAM,oBAAoB,GACxB,MAAM,IAAI,CAAC,UAAU,CAAC,uBAAuB,EAAE,CAAC;QAElD,KAAK,MAAM,QAAQ,IAAI,mBAAmB,CAAC,MAAM,EAAE,EAAE,CAAC;YACpD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;YAE1D,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,IAAI,4BAAS,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CACF;AAnBD,0DAmBC"}
@@ -0,0 +1,11 @@
1
+ import { Composite } from '@rsdk/autodoc.protocol';
2
+ import type { PlatformAppMetadata } from '@rsdk/core';
3
+ import { DocumentFragment } from '../core';
4
+ export declare class ConfigSectionFragment extends DocumentFragment {
5
+ private metadata;
6
+ constructor(metadata: PlatformAppMetadata);
7
+ private static getSectionNode;
8
+ private static getSectionNodeTree;
9
+ getDocumentNode(): Composite | null;
10
+ private getSectionsNode;
11
+ }
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConfigSectionFragment = void 0;
4
+ const autodoc_protocol_1 = require("@rsdk/autodoc.protocol");
5
+ const lodash_1 = require("lodash");
6
+ const md_formats_1 = require("../../md-formats/md-formats");
7
+ const core_1 = require("../core");
8
+ const constants_1 = require("./constants");
9
+ class ConfigSectionFragment extends core_1.DocumentFragment {
10
+ metadata;
11
+ constructor(metadata) {
12
+ super();
13
+ this.metadata = metadata;
14
+ }
15
+ static getSectionNode(section) {
16
+ const content = [];
17
+ if (section.description) {
18
+ content.push(section.description);
19
+ }
20
+ content.push(new autodoc_protocol_1.Table(section.properties.map((property) => ({
21
+ Name: property.expectedInEnv
22
+ ? md_formats_1.MdFormats.bold(property.key)
23
+ : property.key,
24
+ Type: property.parser.type,
25
+ 'Default value': `${property.defaultValue}`,
26
+ Description: property.description,
27
+ }))));
28
+ const nodeTitle = section.name
29
+ ? `${section.name} (${md_formats_1.MdFormats.italic(section.constructorName)})`
30
+ : section.constructorName;
31
+ return new autodoc_protocol_1.Composite(content, nodeTitle);
32
+ }
33
+ static getSectionNodeTree(groupedSectionTree) {
34
+ const sectionNodes = [];
35
+ for (const [key, value] of Object.entries(groupedSectionTree)) {
36
+ if (Array.isArray(value)) {
37
+ sectionNodes.push(new autodoc_protocol_1.Composite(value.map((section) => ConfigSectionFragment.getSectionNode(section)), key));
38
+ continue;
39
+ }
40
+ sectionNodes.push(new autodoc_protocol_1.Composite(this.getSectionNodeTree(value), key));
41
+ }
42
+ return sectionNodes;
43
+ }
44
+ getDocumentNode() {
45
+ const { config: { properties }, } = this.metadata;
46
+ const title = 'Configuration properties';
47
+ const printProperty = (meta) => {
48
+ const { key, defaultValue, description, parser, expectedInEnv } = meta;
49
+ const fragments = [];
50
+ fragments.push(`- ${key} ${description}`, `> Parser: **${parser.type}** ${parser.description}`);
51
+ if ('defaultValue' in meta) {
52
+ fragments.push(`> Default value: ${defaultValue}`);
53
+ }
54
+ if (expectedInEnv) {
55
+ fragments.push(`> Should be in environment!`);
56
+ }
57
+ fragments.push('');
58
+ return new autodoc_protocol_1.Composite(fragments.join('\n'));
59
+ };
60
+ const sectionsNode = this.getSectionsNode();
61
+ const content = [sectionsNode];
62
+ if (properties.length > 0) {
63
+ const title = `Unbound properties`;
64
+ const propertyNodeContent = [];
65
+ const propertiesNode = new autodoc_protocol_1.Composite(propertyNodeContent, title);
66
+ for (const propMeta of properties) {
67
+ const propertyNode = printProperty(propMeta);
68
+ propertyNodeContent.push(propertyNode);
69
+ }
70
+ content.push(propertiesNode);
71
+ }
72
+ return new autodoc_protocol_1.Composite(content, title);
73
+ }
74
+ getSectionsNode() {
75
+ const groupByTags = {};
76
+ for (const section of this.metadata.config.sections) {
77
+ if (section.tags?.length) {
78
+ const existed = (0, lodash_1.get)(groupByTags, section.tags.join('.'), [section]);
79
+ (0, lodash_1.set)(groupByTags, section.tags.join('.'), existed);
80
+ }
81
+ else {
82
+ groupByTags[constants_1.APPLICATION_SECTION_NAME] ??= [];
83
+ groupByTags[constants_1.APPLICATION_SECTION_NAME].push(section);
84
+ }
85
+ }
86
+ const content = ConfigSectionFragment.getSectionNodeTree(groupByTags);
87
+ return new autodoc_protocol_1.Composite(content, 'Sections');
88
+ }
89
+ }
90
+ exports.ConfigSectionFragment = ConfigSectionFragment;
91
+ //# sourceMappingURL=config-section.fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-section.fragment.js","sourceRoot":"","sources":["../../../src/fragments/config-section/config-section.fragment.ts"],"names":[],"mappings":";;;AACA,6DAA0D;AAM1D,mCAAkC;AAElC,4DAAwD;AACxD,kCAA2C;AAE3C,2CAAuD;AAGvD,MAAa,qBAAsB,SAAQ,uBAAgB;IACrC;IAApB,YAAoB,QAA6B;QAC/C,KAAK,EAAE,CAAC;QADU,aAAQ,GAAR,QAAQ,CAAqB;IAEjD,CAAC;IAEO,MAAM,CAAC,cAAc,CAC3B,OAAoC;QAEpC,MAAM,OAAO,GAA8B,EAAE,CAAC;QAE9C,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YACxB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,CAAC,IAAI,CACV,IAAI,wBAAK,CACP,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YACpC,IAAI,EAAE,QAAQ,CAAC,aAAa;gBAC1B,CAAC,CAAC,sBAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;gBAC9B,CAAC,CAAC,QAAQ,CAAC,GAAG;YAChB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI;YAC1B,eAAe,EAAE,G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K,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpD,IAAI,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;gBACzB,MAAM,OAAO,GAAG,IAAA,YAAG,EAAC,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;gBAEpE,IAAA,YAAG,EAAC,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;YACpD,CAAC;iBAAM,CAAC;gBACN,WAAW,CAAC,oCAAwB,CAAC,KAEpC,EAAE,CAAC;gBAEJ,WAAW,CAAC,oCAAwB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;QAED,MAAM,OAAO,GACX,qBAAqB,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;QAExD,OAAO,IAAI,4BAAS,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC5C,CAAC;CACF;AA5HD,sDA4HC"}
@@ -0,0 +1 @@
1
+ export declare const APPLICATION_SECTION_NAME = "Application";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APPLICATION_SECTION_NAME = void 0;
4
+ exports.APPLICATION_SECTION_NAME = 'Application';
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/fragments/config-section/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAG,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { SerializableSectionMetadata } from '@rsdk/core';
2
+ export type GroupedSectionTree = {
3
+ [key in string]: SerializableSectionMetadata[] | GroupedSectionTree;
4
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/fragments/config-section/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { DocumentNode } from '@rsdk/autodoc.protocol';
2
+ import type { Promisable } from 'type-fest';
3
+ export declare abstract class DocumentFragment {
4
+ abstract getDocumentNode(): Promisable<DocumentNode[] | DocumentNode | null>;
5
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DocumentFragment = void 0;
4
+ class DocumentFragment {
5
+ }
6
+ exports.DocumentFragment = DocumentFragment;
7
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/fragments/core.ts"],"names":[],"mappings":";;;AAGA,MAAsB,gBAAgB;CAErC;AAFD,4CAEC"}
@@ -0,0 +1,8 @@
1
+ import type { DocumentNode } from '@rsdk/autodoc.protocol';
2
+ import type { AutodocContext } from '../autodoc.context';
3
+ import type { DocumentFragment } from './core';
4
+ export declare class HeaderFragment implements DocumentFragment {
5
+ readonly appContext: AutodocContext;
6
+ constructor(appContext: AutodocContext);
7
+ getDocumentNode(): Promise<DocumentNode[] | DocumentNode | null>;
8
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HeaderFragment = void 0;
4
+ const autodoc_protocol_1 = require("@rsdk/autodoc.protocol");
5
+ class HeaderFragment {
6
+ appContext;
7
+ constructor(appContext) {
8
+ this.appContext = appContext;
9
+ }
10
+ async getDocumentNode() {
11
+ const metadata = await this.appContext.platformApp.context.getMetadata();
12
+ const appVersion = metadata.version;
13
+ const headerFragments = [`version: ${appVersion}`];
14
+ return new autodoc_protocol_1.Composite(headerFragments);
15
+ }
16
+ }
17
+ exports.HeaderFragment = HeaderFragment;
18
+ //# sourceMappingURL=header.fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header.fragment.js","sourceRoot":"","sources":["../../src/fragments/header.fragment.ts"],"names":[],"mappings":";;;AACA,6DAAmD;AAMnD,MAAa,cAAc;IACJ;IAArB,YAAqB,UAA0B;QAA1B,eAAU,GAAV,UAAU,CAAgB;IAAG,CAAC;IAEnD,KAAK,CAAC,eAAe;QACnB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACzE,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC;QAEpC,MAAM,eAAe,GAAG,CAAC,YAAY,UAAU,EAAE,CAAC,CAAC;QAEnD,OAAO,IAAI,4BAAS,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;CACF;AAXD,wCAWC"}
@@ -0,0 +1,8 @@
1
+ import type { DocumentNode } from '@rsdk/autodoc.protocol';
2
+ import type { PlatformAppPlugin } from '@rsdk/core';
3
+ import { DocumentFragment } from './core';
4
+ export declare class PluginFragment extends DocumentFragment {
5
+ private plugins?;
6
+ constructor(plugins?: PlatformAppPlugin<import("@rsdk/core").AppropriateTransports>[] | undefined);
7
+ getDocumentNode(): DocumentNode | null;
8
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PluginFragment = void 0;
4
+ const autodoc_protocol_1 = require("@rsdk/autodoc.protocol");
5
+ const core_1 = require("./core");
6
+ class PluginFragment extends core_1.DocumentFragment {
7
+ plugins;
8
+ constructor(plugins) {
9
+ super();
10
+ this.plugins = plugins;
11
+ }
12
+ getDocumentNode() {
13
+ if (!this.plugins?.length) {
14
+ return null;
15
+ }
16
+ return new autodoc_protocol_1.Composite(new autodoc_protocol_1.List(this.plugins?.map((plugin) => plugin.constructor.name)), 'Plugins');
17
+ }
18
+ }
19
+ exports.PluginFragment = PluginFragment;
20
+ //# sourceMappingURL=plugin.fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.fragment.js","sourceRoot":"","sources":["../../src/fragments/plugin.fragment.ts"],"names":[],"mappings":";;;AACA,6DAAyD;AAGzD,iCAA0C;AAE1C,MAAa,cAAe,SAAQ,uBAAgB;IAC9B;IAApB,YAAoB,OAA6B;QAC/C,KAAK,EAAE,CAAC;QADU,YAAO,GAAP,OAAO,CAAsB;IAEjD,CAAC;IAED,eAAe;QACb,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,4BAAS,CAClB,IAAI,uBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAChE,SAAS,CACV,CAAC;IACJ,CAAC;CACF;AAdD,wCAcC"}
@@ -0,0 +1,9 @@
1
+ import { Composite } from '@rsdk/autodoc.protocol';
2
+ import type { ITransport } from '@rsdk/core';
3
+ import { DocumentFragment } from './core';
4
+ export declare class TransportsFragment extends DocumentFragment {
5
+ private transports?;
6
+ constructor(transports?: ITransport[] | undefined);
7
+ getContent(): string;
8
+ getDocumentNode(): Composite | null;
9
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransportsFragment = void 0;
4
+ const autodoc_protocol_1 = require("@rsdk/autodoc.protocol");
5
+ const core_1 = require("./core");
6
+ class TransportsFragment extends core_1.DocumentFragment {
7
+ transports;
8
+ constructor(transports) {
9
+ super();
10
+ this.transports = transports;
11
+ }
12
+ getContent() {
13
+ if (!this.transports?.length) {
14
+ return '';
15
+ }
16
+ const fragments = [];
17
+ fragments.push('## Transports', '\n');
18
+ for (const transport of this.transports) {
19
+ fragments.push('- ' + transport.getProtocol());
20
+ }
21
+ return fragments.join('\n');
22
+ }
23
+ getDocumentNode() {
24
+ if (!this.transports?.length) {
25
+ return null;
26
+ }
27
+ const transportNode = new autodoc_protocol_1.Composite(new autodoc_protocol_1.List(this.transports.map((tr) => tr.getProtocol())), 'Transports');
28
+ return transportNode;
29
+ }
30
+ }
31
+ exports.TransportsFragment = TransportsFragment;
32
+ //# sourceMappingURL=transports.fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transports.fragment.js","sourceRoot":"","sources":["../../src/fragments/transports.fragment.ts"],"names":[],"mappings":";;;AAAA,6DAAyD;AAGzD,iCAA0C;AAE1C,MAAa,kBAAmB,SAAQ,uBAAgB;IAClC;IAApB,YAAoB,UAAyB;QAC3C,KAAK,EAAE,CAAC;QADU,eAAU,GAAV,UAAU,CAAe;IAE7C,CAAC;IAED,UAAU;QACR,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;YAC7B,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,SAAS,GAAa,EAAE,CAAC;QAE/B,SAAS,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QACtC,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACxC,SAAS,CAAC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,eAAe;QACb,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,aAAa,GAAG,IAAI,4BAAS,CACjC,IAAI,uBAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,EACvD,YAAY,CACb,CAAC;QAEF,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AA9BD,gDA8BC"}
@@ -0,0 +1,7 @@
1
+ import type { RsdkCliCommand } from '@rsdk/cli.common';
2
+ import type { Command } from 'commander';
3
+ declare class AutodocRsdkCmd implements RsdkCliCommand {
4
+ getCommands(): Command[];
5
+ }
6
+ export declare const Cmd: AutodocRsdkCmd;
7
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Cmd = void 0;
4
+ const cli_common_1 = require("@rsdk/cli.common");
5
+ const autodoc_cmd_1 = require("./autodoc.cmd");
6
+ class AutodocRsdkCmd {
7
+ getCommands() {
8
+ return [...(0, cli_common_1.getCommanderCommand)(autodoc_cmd_1.AutodocCmd)];
9
+ }
10
+ }
11
+ exports.Cmd = new AutodocRsdkCmd();
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,iDAAuD;AAGvD,+CAA2C;AAE3C,MAAM,cAAc;IAClB,WAAW;QACT,OAAO,CAAC,GAAG,IAAA,gCAAmB,EAAC,wBAAU,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF;AAEY,QAAA,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare class MdFormats {
2
+ static italic(str: string): string;
3
+ static bold(str: string): string;
4
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MdFormats = void 0;
4
+ class MdFormats {
5
+ static italic(str) {
6
+ return `*${str}*`;
7
+ }
8
+ static bold(str) {
9
+ return `**${str}**`;
10
+ }
11
+ }
12
+ exports.MdFormats = MdFormats;
13
+ //# sourceMappingURL=md-formats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md-formats.js","sourceRoot":"","sources":["../../src/md-formats/md-formats.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;IACpB,MAAM,CAAC,MAAM,CAAC,GAAW;QACvB,OAAO,IAAI,GAAG,GAAG,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,GAAW;QACrB,OAAO,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;CACF;AARD,8BAQC"}
@@ -0,0 +1,11 @@
1
+ import type { OpenAPIObject } from '@nestjs/swagger/dist/interfaces';
2
+ import type { AutodocContext } from './autodoc.context';
3
+ import { DocumentFile } from './document.file';
4
+ export declare class OpenapiGenerator {
5
+ private appContext;
6
+ private static logger;
7
+ constructor(appContext: AutodocContext);
8
+ getOpenApiSpec(): Promise<OpenAPIObject | null>;
9
+ createFile(): Promise<DocumentFile | null>;
10
+ private clearController;
11
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.OpenapiGenerator = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const core_1 = require("@nestjs/core");
12
+ const swagger_1 = require("@nestjs/swagger");
13
+ const core_2 = require("@rsdk/core");
14
+ const logging_1 = require("@rsdk/logging");
15
+ const nest_tools_1 = require("@rsdk/nest-tools");
16
+ const document_file_1 = require("./document.file");
17
+ class OpenapiGenerator {
18
+ appContext;
19
+ static logger = logging_1.LoggerFactory.create(OpenapiGenerator);
20
+ constructor(appContext) {
21
+ this.appContext = appContext;
22
+ }
23
+ async getOpenApiSpec() {
24
+ const context = this.appContext.platformApp.context;
25
+ const transports = context.options.transports;
26
+ if (!transports?.length) {
27
+ OpenapiGenerator.logger.info('transports not found');
28
+ return null;
29
+ }
30
+ const httpTransport = transports?.find?.(core_2.isHttpTransport);
31
+ if (!httpTransport) {
32
+ OpenapiGenerator.logger.warn('http transport not found');
33
+ return null;
34
+ }
35
+ OpenapiGenerator.logger.info('Generate openapi starting');
36
+ const root = context.getRoot();
37
+ const nestDefinitionIterator = new nest_tools_1.NestDefinitionIterator(root);
38
+ const controllers = [];
39
+ for await (const controller of nestDefinitionIterator.iterate(nest_tools_1.NestDefinitionType.Controllers)) {
40
+ controllers.push(this.clearController(controller));
41
+ }
42
+ let OpenApiModule = class OpenApiModule {
43
+ };
44
+ OpenApiModule = __decorate([
45
+ (0, common_1.Module)({
46
+ controllers,
47
+ })
48
+ ], OpenApiModule);
49
+ const createOptions = await this.appContext.platformApp.context.getNestFactoryCreateOptions();
50
+ const app = await core_1.NestFactory.create(OpenApiModule, ...createOptions);
51
+ const metadata = await this.appContext.platformApp.getMetadata();
52
+ const builder = new swagger_1.DocumentBuilder()
53
+ .setTitle(metadata.name)
54
+ .setVersion(metadata.version)
55
+ .setDescription(metadata.description);
56
+ const openApiConfig = builder.build();
57
+ const document = swagger_1.SwaggerModule.createDocument(app, openApiConfig);
58
+ OpenapiGenerator.logger.info('Generate openapi finished');
59
+ await app.close();
60
+ return document;
61
+ }
62
+ async createFile() {
63
+ const openApiSpec = await this.getOpenApiSpec();
64
+ if (!openApiSpec) {
65
+ return null;
66
+ }
67
+ return new document_file_1.DocumentFile('openapi.json', JSON.stringify(openApiSpec, null, 2));
68
+ }
69
+ clearController(controller) {
70
+ class ClearedController extends controller {
71
+ }
72
+ const keysForRedefine = ['design:paramtypes', 'self:paramtypes'];
73
+ for (const forRedefineMetadataKey of keysForRedefine) {
74
+ Reflect.defineMetadata(forRedefineMetadataKey, [], ClearedController);
75
+ }
76
+ // Влияет на `operationId` в генерации
77
+ Object.defineProperty(ClearedController, 'name', {
78
+ value: controller.name,
79
+ writable: false,
80
+ });
81
+ return ClearedController;
82
+ }
83
+ }
84
+ exports.OpenapiGenerator = OpenapiGenerator;
85
+ //# sourceMappingURL=openapi.generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi.generator.js","sourceRoot":"","sources":["../src/openapi.generator.ts"],"names":[],"mappings":";;;;;;;;;AACA,2CAAwC;AACxC,uCAA2C;AAC3C,6CAGyB;AAEzB,qCAA6C;AAC7C,2CAA8C;AAC9C,iDAA8E;AAG9E,mDAA+C;AAE/C,MAAa,gBAAgB;IAGP;IAFZ,MAAM,CAAC,MAAM,GAAG,uBAAa,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAE/D,YAAoB,UAA0B;QAA1B,eAAU,GAAV,UAAU,CAAgB;IAAG,CAAC;IAE5C,AAAN,KAAK,CAAC,cAAc;QAClB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC;QACpD,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;QAC9C,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;YACxB,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YACrD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,aAAa,GAAG,UAAU,EAAE,IAAI,EAAE,CAAC,sBAAe,CAAC,CAAC;QAC1D,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAC1D,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;QAE/B,MAAM,sBAAsB,GAAG,IAAI,mCAAsB,CAAC,IAAI,CAAC,CAAC;QAEhE,MAAM,WAAW,GAA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QACd,CAAC;QACD,OAAO,IAAI,4BAAY,CACrB,cAAc,EACd,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CACrC,CAAC;IACJ,CAAC;IAEO,eAAe,CAAC,UAAgB;QACtC,MAAM,iBAAkB,SAAQ,UAAU;SAAG;QAE7C,MAAM,eAAe,GAAG,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;QAEjE,KAAK,MAAM,sBAAsB,IAAI,eAAe,EAAE,CAAC;YACrD,OAAO,CAAC,cAAc,CAAC,sBAAsB,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAC;QACxE,CAAC;QACD,sCAAsC;QACtC,MAAM,CAAC,cAAc,CAAC,iBAAiB,EAAE,MAAM,EAAE;YAC/C,KAAK,EAAE,UAAU,CAAC,IAAI;YACtB,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;QAEH,OAAO,iBAAiB,CAAC;IAC3B,CAAC;;AAlFH,4CAmFC"}
@@ -0,0 +1,9 @@
1
+ import type { AutodocContext } from './autodoc.context';
2
+ import { DocumentFile } from './document.file';
3
+ export declare class RsdkFileGenerator {
4
+ readonly autodocContext: AutodocContext;
5
+ static logger: import("@rsdk/logging").ILogger;
6
+ constructor(autodocContext: AutodocContext);
7
+ createFile(): Promise<DocumentFile>;
8
+ private getAllResources;
9
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RsdkFileGenerator = void 0;
4
+ const logging_1 = require("@rsdk/logging");
5
+ const document_file_1 = require("./document.file");
6
+ class RsdkFileGenerator {
7
+ autodocContext;
8
+ static logger = logging_1.LoggerFactory.create(RsdkFileGenerator);
9
+ constructor(autodocContext) {
10
+ this.autodocContext = autodocContext;
11
+ }
12
+ async createFile() {
13
+ RsdkFileGenerator.logger.info('start generating rsdk.json');
14
+ const rsdkMetadata = await this.getAllResources();
15
+ const metadata = await this.autodocContext.platformApp.getMetadata();
16
+ const rsdkJsonFile = new document_file_1.DocumentFile('rsdk.json', JSON.stringify({ metadata, rsdkMetadata }, null, 2));
17
+ RsdkFileGenerator.logger.info('Generating rsdk.json finished');
18
+ return rsdkJsonFile;
19
+ }
20
+ async getAllResources() {
21
+ // eslint-disable-next-line unicorn/no-await-expression-member
22
+ return (await this.autodocContext.getRsdkMetadataProvider()).get();
23
+ }
24
+ }
25
+ exports.RsdkFileGenerator = RsdkFileGenerator;
26
+ //# sourceMappingURL=rsdk.file-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rsdk.file-generator.js","sourceRoot":"","sources":["../src/rsdk.file-generator.ts"],"names":[],"mappings":";;;AAAA,2CAA8C;AAI9C,mDAA+C;AAE/C,MAAa,iBAAiB;IAGP;IAFrB,MAAM,CAAC,MAAM,GAAG,uBAAa,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAExD,YAAqB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;IAEvD,KAAK,CAAC,UAAU;QACd,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAC5D,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAClD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;QAErE,MAAM,YAAY,GAAG,IAAI,4BAAY,CACnC,WAAW,EACX,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CACpD,CAAC;QAEF,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QAC/D,OAAO,YAAY,CAAC;IACtB,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,8DAA8D;QAC9D,OAAO,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,uBAAuB,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;IACrE,CAAC;;AAtBH,8CAuBC"}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@rsdk/cli.cmd.autodoc",
3
+ "version": "4.3.0-next.0",
4
+ "description": "autodoc your app!",
5
+ "homepage": "https://github.com/R-Vision/rsdk",
6
+ "license": "Apache License 2.0",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "main": "dist/index.js",
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/R-Vision/rsdk"
17
+ },
18
+ "dependencies": {
19
+ "commander": "^12.0.0",
20
+ "lodash": "^4.17.21",
21
+ "log-update": "4.0.0",
22
+ "markdown-table": "2.0.0",
23
+ "pino-pretty": "^10.2.3"
24
+ },
25
+ "peerDependencies": {
26
+ "@nestjs/common": "^10.0.0",
27
+ "@nestjs/core": "^10.0.0",
28
+ "@nestjs/swagger": "^7.0.0",
29
+ "@rsdk/autodoc.protocol": "^4.3.0-next.0",
30
+ "@rsdk/cli.common": "^4.3.0-next.0",
31
+ "@rsdk/core": "^4.3.0-next.0",
32
+ "@rsdk/logging": "^4.3.0-next.0",
33
+ "@rsdk/metadata": "^4.3.0-next.0",
34
+ "@rsdk/nest-tools": "^4.3.0-next.0",
35
+ "reflect-metadata": "^0.1.12 || ^0.2.0"
36
+ },
37
+ "gitHead": "68619cc6fc60db01568eede7df182d9882e857dd"
38
+ }