@nestia/sdk 3.1.0-dev.20240426 → 3.1.0-dev.20240430

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 (58) hide show
  1. package/lib/analyses/TypedWebSocketOperationAnalyzer.js +1 -1
  2. package/lib/analyses/TypedWebSocketOperationAnalyzer.js.map +1 -1
  3. package/lib/executable/sdk.js +11 -11
  4. package/lib/generates/SwaggerGenerator.js +1 -1
  5. package/lib/generates/SwaggerGenerator.js.map +1 -1
  6. package/lib/generates/internal/SdkHttpFunctionProgrammer.js +18 -20
  7. package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
  8. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +30 -1
  9. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
  10. package/lib/structures/ITypedWebSocketRoute.d.ts +1 -0
  11. package/package.json +4 -4
  12. package/src/NestiaSdkApplication.ts +257 -257
  13. package/src/analyses/AccessorAnalyzer.ts +67 -67
  14. package/src/analyses/ConfigAnalyzer.ts +147 -147
  15. package/src/analyses/GenericAnalyzer.ts +51 -51
  16. package/src/analyses/PathAnalyzer.ts +69 -69
  17. package/src/analyses/SecurityAnalyzer.ts +25 -25
  18. package/src/analyses/TypedWebSocketOperationAnalyzer.ts +1 -0
  19. package/src/executable/internal/CommandParser.ts +15 -15
  20. package/src/executable/internal/NestiaConfigLoader.ts +67 -67
  21. package/src/executable/internal/NestiaSdkCommand.ts +60 -60
  22. package/src/executable/sdk.ts +73 -73
  23. package/src/generates/CloneGenerator.ts +64 -64
  24. package/src/generates/E2eGenerator.ts +64 -64
  25. package/src/generates/SdkGenerator.ts +91 -91
  26. package/src/generates/SwaggerGenerator.ts +1 -1
  27. package/src/generates/internal/E2eFileProgrammer.ts +178 -178
  28. package/src/generates/internal/FilePrinter.ts +53 -53
  29. package/src/generates/internal/SdkAliasCollection.ts +157 -157
  30. package/src/generates/internal/SdkDistributionComposer.ts +100 -100
  31. package/src/generates/internal/SdkFileProgrammer.ts +119 -119
  32. package/src/generates/internal/SdkHttpCloneProgrammer.ts +154 -154
  33. package/src/generates/internal/SdkHttpFunctionProgrammer.ts +298 -299
  34. package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +505 -505
  35. package/src/generates/internal/SdkHttpRouteProgrammer.ts +82 -82
  36. package/src/generates/internal/SdkHttpSimulationProgrammer.ts +363 -363
  37. package/src/generates/internal/SdkImportWizard.ts +55 -55
  38. package/src/generates/internal/SdkRouteDirectory.ts +18 -18
  39. package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +42 -1
  40. package/src/generates/internal/SwaggerSchemaValidator.ts +198 -198
  41. package/src/index.ts +4 -4
  42. package/src/module.ts +2 -2
  43. package/src/structures/IErrorReport.ts +6 -6
  44. package/src/structures/INestiaProject.ts +13 -13
  45. package/src/structures/INormalizedInput.ts +20 -20
  46. package/src/structures/IReflectController.ts +17 -17
  47. package/src/structures/ITypeTuple.ts +6 -6
  48. package/src/structures/ITypedHttpRoute.ts +55 -55
  49. package/src/structures/ITypedWebSocketRoute.ts +1 -0
  50. package/src/structures/MethodType.ts +5 -5
  51. package/src/structures/ParamCategory.ts +1 -1
  52. package/src/utils/ArrayUtil.ts +26 -26
  53. package/src/utils/FileRetriever.ts +22 -22
  54. package/src/utils/MapUtil.ts +14 -14
  55. package/src/utils/PathUtil.ts +10 -10
  56. package/src/utils/SourceFinder.ts +66 -66
  57. package/src/utils/StringUtil.ts +6 -6
  58. package/src/utils/StripEnums.ts +5 -5
@@ -1,119 +1,119 @@
1
- import fs from "fs";
2
- import ts from "typescript";
3
-
4
- import { INestiaProject } from "../../structures/INestiaProject";
5
- import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
6
- import { ITypedWebSocketRoute } from "../../structures/ITypedWebSocketRoute";
7
- import { MapUtil } from "../../utils/MapUtil";
8
- import { FilePrinter } from "./FilePrinter";
9
- import { ImportDictionary } from "./ImportDictionary";
10
- import { SdkHttpRouteProgrammer } from "./SdkHttpRouteProgrammer";
11
- import { SdkRouteDirectory } from "./SdkRouteDirectory";
12
- import { SdkWebSocketRouteProgrammer } from "./SdkWebSocketRouteProgrammer";
13
-
14
- export namespace SdkFileProgrammer {
15
- /* ---------------------------------------------------------
16
- CONSTRUCTOR
17
- --------------------------------------------------------- */
18
- export const generate =
19
- (project: INestiaProject) =>
20
- async (
21
- routeList: Array<ITypedHttpRoute | ITypedWebSocketRoute>,
22
- ): Promise<void> => {
23
- // CONSTRUCT FOLDER TREE
24
- const root: SdkRouteDirectory = new SdkRouteDirectory(null, "functional");
25
- for (const route of routeList) emplace(root)(route);
26
-
27
- // ITERATE FILES
28
- await iterate(project)(root)(project.config.output + "/functional");
29
- };
30
-
31
- const emplace =
32
- (directory: SdkRouteDirectory) =>
33
- (route: ITypedHttpRoute | ITypedWebSocketRoute): void => {
34
- // OPEN DIRECTORIES
35
- for (const key of route.accessors.slice(0, -1)) {
36
- directory = MapUtil.take(
37
- directory.children,
38
- key,
39
- () => new SdkRouteDirectory(directory, key),
40
- );
41
- }
42
-
43
- // ADD ROUTE
44
- directory.routes.push(route);
45
- };
46
-
47
- /* ---------------------------------------------------------
48
- FILE ITERATOR
49
- --------------------------------------------------------- */
50
- const iterate =
51
- (project: INestiaProject) =>
52
- (directory: SdkRouteDirectory) =>
53
- async (outDir: string): Promise<void> => {
54
- // CREATE A NEW DIRECTORY
55
- try {
56
- await fs.promises.mkdir(outDir);
57
- } catch {}
58
-
59
- // ITERATE CHILDREN
60
- const statements: ts.Statement[] = [];
61
- for (const [key, value] of directory.children) {
62
- await iterate(project)(value)(`${outDir}/${key}`);
63
- statements.push(
64
- ts.factory.createExportDeclaration(
65
- undefined,
66
- false,
67
- ts.factory.createNamespaceExport(ts.factory.createIdentifier(key)),
68
- ts.factory.createStringLiteral(`./${key}`),
69
- undefined,
70
- ),
71
- );
72
- }
73
- if (statements.length && directory.routes.length)
74
- statements.push(FilePrinter.enter());
75
-
76
- // ITERATE ROUTES
77
- const importer: ImportDictionary = new ImportDictionary(
78
- `${outDir}/index.ts`,
79
- );
80
- directory.routes.forEach((route, i) => {
81
- if (project.config.clone !== true)
82
- for (const tuple of route.imports)
83
- for (const instance of tuple[1])
84
- importer.internal({
85
- file: tuple[0],
86
- instance,
87
- type: true,
88
- });
89
- statements.push(
90
- ...(route.protocol === "http"
91
- ? SdkHttpRouteProgrammer.write(project)(importer)(route)
92
- : SdkWebSocketRouteProgrammer.write(project)(importer)(route)),
93
- );
94
- if (i !== directory.routes.length - 1)
95
- statements.push(FilePrinter.enter());
96
- });
97
-
98
- // FINALIZE THE CONTENT
99
- if (directory.routes.length !== 0)
100
- statements.push(
101
- ...importer.toStatements(outDir),
102
- ...(!importer.empty() && statements.length
103
- ? [FilePrinter.enter()]
104
- : []),
105
- ...statements.splice(0, statements.length),
106
- );
107
- await FilePrinter.write({
108
- location: importer.file,
109
- statements,
110
- top:
111
- "/**\n" +
112
- " * @packageDocumentation\n" +
113
- ` * @module ${directory.module}\n` +
114
- " * @nestia Generated by Nestia - https://github.com/samchon/nestia \n" +
115
- " */\n" +
116
- "//================================================================\n",
117
- });
118
- };
119
- }
1
+ import fs from "fs";
2
+ import ts from "typescript";
3
+
4
+ import { INestiaProject } from "../../structures/INestiaProject";
5
+ import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
6
+ import { ITypedWebSocketRoute } from "../../structures/ITypedWebSocketRoute";
7
+ import { MapUtil } from "../../utils/MapUtil";
8
+ import { FilePrinter } from "./FilePrinter";
9
+ import { ImportDictionary } from "./ImportDictionary";
10
+ import { SdkHttpRouteProgrammer } from "./SdkHttpRouteProgrammer";
11
+ import { SdkRouteDirectory } from "./SdkRouteDirectory";
12
+ import { SdkWebSocketRouteProgrammer } from "./SdkWebSocketRouteProgrammer";
13
+
14
+ export namespace SdkFileProgrammer {
15
+ /* ---------------------------------------------------------
16
+ CONSTRUCTOR
17
+ --------------------------------------------------------- */
18
+ export const generate =
19
+ (project: INestiaProject) =>
20
+ async (
21
+ routeList: Array<ITypedHttpRoute | ITypedWebSocketRoute>,
22
+ ): Promise<void> => {
23
+ // CONSTRUCT FOLDER TREE
24
+ const root: SdkRouteDirectory = new SdkRouteDirectory(null, "functional");
25
+ for (const route of routeList) emplace(root)(route);
26
+
27
+ // ITERATE FILES
28
+ await iterate(project)(root)(project.config.output + "/functional");
29
+ };
30
+
31
+ const emplace =
32
+ (directory: SdkRouteDirectory) =>
33
+ (route: ITypedHttpRoute | ITypedWebSocketRoute): void => {
34
+ // OPEN DIRECTORIES
35
+ for (const key of route.accessors.slice(0, -1)) {
36
+ directory = MapUtil.take(
37
+ directory.children,
38
+ key,
39
+ () => new SdkRouteDirectory(directory, key),
40
+ );
41
+ }
42
+
43
+ // ADD ROUTE
44
+ directory.routes.push(route);
45
+ };
46
+
47
+ /* ---------------------------------------------------------
48
+ FILE ITERATOR
49
+ --------------------------------------------------------- */
50
+ const iterate =
51
+ (project: INestiaProject) =>
52
+ (directory: SdkRouteDirectory) =>
53
+ async (outDir: string): Promise<void> => {
54
+ // CREATE A NEW DIRECTORY
55
+ try {
56
+ await fs.promises.mkdir(outDir);
57
+ } catch {}
58
+
59
+ // ITERATE CHILDREN
60
+ const statements: ts.Statement[] = [];
61
+ for (const [key, value] of directory.children) {
62
+ await iterate(project)(value)(`${outDir}/${key}`);
63
+ statements.push(
64
+ ts.factory.createExportDeclaration(
65
+ undefined,
66
+ false,
67
+ ts.factory.createNamespaceExport(ts.factory.createIdentifier(key)),
68
+ ts.factory.createStringLiteral(`./${key}`),
69
+ undefined,
70
+ ),
71
+ );
72
+ }
73
+ if (statements.length && directory.routes.length)
74
+ statements.push(FilePrinter.enter());
75
+
76
+ // ITERATE ROUTES
77
+ const importer: ImportDictionary = new ImportDictionary(
78
+ `${outDir}/index.ts`,
79
+ );
80
+ directory.routes.forEach((route, i) => {
81
+ if (project.config.clone !== true)
82
+ for (const tuple of route.imports)
83
+ for (const instance of tuple[1])
84
+ importer.internal({
85
+ file: tuple[0],
86
+ instance,
87
+ type: true,
88
+ });
89
+ statements.push(
90
+ ...(route.protocol === "http"
91
+ ? SdkHttpRouteProgrammer.write(project)(importer)(route)
92
+ : SdkWebSocketRouteProgrammer.write(project)(importer)(route)),
93
+ );
94
+ if (i !== directory.routes.length - 1)
95
+ statements.push(FilePrinter.enter());
96
+ });
97
+
98
+ // FINALIZE THE CONTENT
99
+ if (directory.routes.length !== 0)
100
+ statements.push(
101
+ ...importer.toStatements(outDir),
102
+ ...(!importer.empty() && statements.length
103
+ ? [FilePrinter.enter()]
104
+ : []),
105
+ ...statements.splice(0, statements.length),
106
+ );
107
+ await FilePrinter.write({
108
+ location: importer.file,
109
+ statements,
110
+ top:
111
+ "/**\n" +
112
+ " * @packageDocumentation\n" +
113
+ ` * @module ${directory.module}\n` +
114
+ " * @nestia Generated by Nestia - https://github.com/samchon/nestia \n" +
115
+ " */\n" +
116
+ "//================================================================\n",
117
+ });
118
+ };
119
+ }
@@ -1,154 +1,154 @@
1
- import { IPointer } from "tstl";
2
- import ts from "typescript";
3
- import { IJsDocTagInfo } from "typia";
4
- import { MetadataCollection } from "typia/lib/factories/MetadataCollection";
5
- import { MetadataFactory } from "typia/lib/factories/MetadataFactory";
6
- import { MetadataAlias } from "typia/lib/schemas/metadata/MetadataAlias";
7
- import { MetadataAtomic } from "typia/lib/schemas/metadata/MetadataAtomic";
8
- import { MetadataObject } from "typia/lib/schemas/metadata/MetadataObject";
9
-
10
- import { INestiaProject } from "../../structures/INestiaProject";
11
- import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
12
- import { MapUtil } from "../../utils/MapUtil";
13
- import { FilePrinter } from "./FilePrinter";
14
- import { ImportDictionary } from "./ImportDictionary";
15
- import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
16
-
17
- export namespace SdkHttpCloneProgrammer {
18
- export interface IModule {
19
- name: string;
20
- children: Map<string, IModule>;
21
- programmer:
22
- | null
23
- | ((importer: ImportDictionary) => ts.TypeAliasDeclaration);
24
- }
25
-
26
- export const write =
27
- (project: INestiaProject) =>
28
- (routes: ITypedHttpRoute[]): Map<string, IModule> => {
29
- const collection = new MetadataCollection({
30
- replace: MetadataCollection.replace,
31
- });
32
- for (const r of routes) {
33
- for (const p of r.parameters) {
34
- const res = MetadataFactory.analyze(project.checker)({
35
- escape: false,
36
- constant: true,
37
- absorb: false,
38
- })(collection)(p.type);
39
- if (res.success) p.metadata = res.data;
40
- }
41
- for (const e of Object.values(r.exceptions)) {
42
- const res = MetadataFactory.analyze(project.checker)({
43
- escape: true,
44
- constant: true,
45
- absorb: false,
46
- })(collection)(e.type);
47
- if (res.success) e.metadata = res.data;
48
- }
49
- const res = MetadataFactory.analyze(project.checker)({
50
- escape: true,
51
- constant: true,
52
- absorb: false,
53
- })(collection)(r.output.type);
54
- if (res.success) r.output.metadata = res.data;
55
- }
56
-
57
- const dict: Map<string, IModule> = new Map();
58
- for (const alias of collection.aliases())
59
- if (isNamedDeclaration(alias.name))
60
- prepare(dict)(alias.name)((importer) =>
61
- write_alias(project)(importer)(alias),
62
- );
63
- for (const object of collection.objects())
64
- if (isNamedDeclaration(object.name))
65
- prepare(dict)(object.name)((importer) =>
66
- write_object(project)(importer)(object),
67
- );
68
- return dict;
69
- };
70
-
71
- const prepare =
72
- (dict: Map<string, IModule>) =>
73
- (name: string) =>
74
- (programmer: (importer: ImportDictionary) => ts.TypeAliasDeclaration) => {
75
- const accessors: string[] = name.split(".");
76
- const modulo: IPointer<IModule> = { value: null! };
77
-
78
- accessors.forEach((acc, i) => {
79
- modulo.value = MapUtil.take(dict, acc, () => ({
80
- name: acc,
81
- children: new Map(),
82
- programmer: null,
83
- }));
84
- if (i === accessors.length - 1) modulo.value.programmer = programmer;
85
- dict = modulo.value.children;
86
- });
87
- return modulo!;
88
- };
89
-
90
- const write_alias =
91
- (project: INestiaProject) =>
92
- (importer: ImportDictionary) =>
93
- (alias: MetadataAlias): ts.TypeAliasDeclaration =>
94
- FilePrinter.description(
95
- ts.factory.createTypeAliasDeclaration(
96
- [ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
97
- alias.name.split(".").at(-1)!,
98
- [],
99
- SdkTypeProgrammer.write(project)(importer)(alias.value),
100
- ),
101
- writeComment([])(alias.description, alias.jsDocTags),
102
- );
103
-
104
- const write_object =
105
- (project: INestiaProject) =>
106
- (importer: ImportDictionary) =>
107
- (object: MetadataObject): ts.TypeAliasDeclaration => {
108
- return FilePrinter.description(
109
- ts.factory.createTypeAliasDeclaration(
110
- [ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
111
- object.name.split(".").at(-1)!,
112
- [],
113
- SdkTypeProgrammer.write_object(project)(importer)(object),
114
- ),
115
- writeComment([])(object.description ?? null, object.jsDocTags),
116
- );
117
- };
118
- }
119
-
120
- const isNamedDeclaration = (name: string) =>
121
- name !== "object" &&
122
- name !== "__type" &&
123
- !name.startsWith("__type.") &&
124
- name !== "__object" &&
125
- !name.startsWith("__object.");
126
-
127
- const writeComment =
128
- (atomics: MetadataAtomic[]) =>
129
- (description: string | null, jsDocTags: IJsDocTagInfo[]): string => {
130
- const lines: string[] = [];
131
- if (description?.length)
132
- lines.push(...description.split("\n").map((s) => `${s}`));
133
-
134
- const filtered: IJsDocTagInfo[] =
135
- !!atomics.length && !!jsDocTags?.length
136
- ? jsDocTags.filter(
137
- (tag) =>
138
- !atomics.some((a) =>
139
- a.tags.some((r) => r.some((t) => t.kind === tag.name)),
140
- ),
141
- )
142
- : jsDocTags ?? [];
143
-
144
- if (description?.length && filtered.length) lines.push("");
145
- if (filtered.length)
146
- lines.push(
147
- ...filtered.map((t) =>
148
- t.text?.length
149
- ? `@${t.name} ${t.text.map((e) => e.text).join("")}`
150
- : `@${t.name}`,
151
- ),
152
- );
153
- return lines.join("\n");
154
- };
1
+ import { IPointer } from "tstl";
2
+ import ts from "typescript";
3
+ import { IJsDocTagInfo } from "typia";
4
+ import { MetadataCollection } from "typia/lib/factories/MetadataCollection";
5
+ import { MetadataFactory } from "typia/lib/factories/MetadataFactory";
6
+ import { MetadataAlias } from "typia/lib/schemas/metadata/MetadataAlias";
7
+ import { MetadataAtomic } from "typia/lib/schemas/metadata/MetadataAtomic";
8
+ import { MetadataObject } from "typia/lib/schemas/metadata/MetadataObject";
9
+
10
+ import { INestiaProject } from "../../structures/INestiaProject";
11
+ import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
12
+ import { MapUtil } from "../../utils/MapUtil";
13
+ import { FilePrinter } from "./FilePrinter";
14
+ import { ImportDictionary } from "./ImportDictionary";
15
+ import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
16
+
17
+ export namespace SdkHttpCloneProgrammer {
18
+ export interface IModule {
19
+ name: string;
20
+ children: Map<string, IModule>;
21
+ programmer:
22
+ | null
23
+ | ((importer: ImportDictionary) => ts.TypeAliasDeclaration);
24
+ }
25
+
26
+ export const write =
27
+ (project: INestiaProject) =>
28
+ (routes: ITypedHttpRoute[]): Map<string, IModule> => {
29
+ const collection = new MetadataCollection({
30
+ replace: MetadataCollection.replace,
31
+ });
32
+ for (const r of routes) {
33
+ for (const p of r.parameters) {
34
+ const res = MetadataFactory.analyze(project.checker)({
35
+ escape: false,
36
+ constant: true,
37
+ absorb: false,
38
+ })(collection)(p.type);
39
+ if (res.success) p.metadata = res.data;
40
+ }
41
+ for (const e of Object.values(r.exceptions)) {
42
+ const res = MetadataFactory.analyze(project.checker)({
43
+ escape: true,
44
+ constant: true,
45
+ absorb: false,
46
+ })(collection)(e.type);
47
+ if (res.success) e.metadata = res.data;
48
+ }
49
+ const res = MetadataFactory.analyze(project.checker)({
50
+ escape: true,
51
+ constant: true,
52
+ absorb: false,
53
+ })(collection)(r.output.type);
54
+ if (res.success) r.output.metadata = res.data;
55
+ }
56
+
57
+ const dict: Map<string, IModule> = new Map();
58
+ for (const alias of collection.aliases())
59
+ if (isNamedDeclaration(alias.name))
60
+ prepare(dict)(alias.name)((importer) =>
61
+ write_alias(project)(importer)(alias),
62
+ );
63
+ for (const object of collection.objects())
64
+ if (isNamedDeclaration(object.name))
65
+ prepare(dict)(object.name)((importer) =>
66
+ write_object(project)(importer)(object),
67
+ );
68
+ return dict;
69
+ };
70
+
71
+ const prepare =
72
+ (dict: Map<string, IModule>) =>
73
+ (name: string) =>
74
+ (programmer: (importer: ImportDictionary) => ts.TypeAliasDeclaration) => {
75
+ const accessors: string[] = name.split(".");
76
+ const modulo: IPointer<IModule> = { value: null! };
77
+
78
+ accessors.forEach((acc, i) => {
79
+ modulo.value = MapUtil.take(dict, acc, () => ({
80
+ name: acc,
81
+ children: new Map(),
82
+ programmer: null,
83
+ }));
84
+ if (i === accessors.length - 1) modulo.value.programmer = programmer;
85
+ dict = modulo.value.children;
86
+ });
87
+ return modulo!;
88
+ };
89
+
90
+ const write_alias =
91
+ (project: INestiaProject) =>
92
+ (importer: ImportDictionary) =>
93
+ (alias: MetadataAlias): ts.TypeAliasDeclaration =>
94
+ FilePrinter.description(
95
+ ts.factory.createTypeAliasDeclaration(
96
+ [ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
97
+ alias.name.split(".").at(-1)!,
98
+ [],
99
+ SdkTypeProgrammer.write(project)(importer)(alias.value),
100
+ ),
101
+ writeComment([])(alias.description, alias.jsDocTags),
102
+ );
103
+
104
+ const write_object =
105
+ (project: INestiaProject) =>
106
+ (importer: ImportDictionary) =>
107
+ (object: MetadataObject): ts.TypeAliasDeclaration => {
108
+ return FilePrinter.description(
109
+ ts.factory.createTypeAliasDeclaration(
110
+ [ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
111
+ object.name.split(".").at(-1)!,
112
+ [],
113
+ SdkTypeProgrammer.write_object(project)(importer)(object),
114
+ ),
115
+ writeComment([])(object.description ?? null, object.jsDocTags),
116
+ );
117
+ };
118
+ }
119
+
120
+ const isNamedDeclaration = (name: string) =>
121
+ name !== "object" &&
122
+ name !== "__type" &&
123
+ !name.startsWith("__type.") &&
124
+ name !== "__object" &&
125
+ !name.startsWith("__object.");
126
+
127
+ const writeComment =
128
+ (atomics: MetadataAtomic[]) =>
129
+ (description: string | null, jsDocTags: IJsDocTagInfo[]): string => {
130
+ const lines: string[] = [];
131
+ if (description?.length)
132
+ lines.push(...description.split("\n").map((s) => `${s}`));
133
+
134
+ const filtered: IJsDocTagInfo[] =
135
+ !!atomics.length && !!jsDocTags?.length
136
+ ? jsDocTags.filter(
137
+ (tag) =>
138
+ !atomics.some((a) =>
139
+ a.tags.some((r) => r.some((t) => t.kind === tag.name)),
140
+ ),
141
+ )
142
+ : jsDocTags ?? [];
143
+
144
+ if (description?.length && filtered.length) lines.push("");
145
+ if (filtered.length)
146
+ lines.push(
147
+ ...filtered.map((t) =>
148
+ t.text?.length
149
+ ? `@${t.name} ${t.text.map((e) => e.text).join("")}`
150
+ : `@${t.name}`,
151
+ ),
152
+ );
153
+ return lines.join("\n");
154
+ };