@nestia/sdk 7.1.1 → 7.2.1

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 (76) hide show
  1. package/lib/analyses/DtoAnalyzer.d.ts +21 -0
  2. package/lib/analyses/DtoAnalyzer.js +203 -0
  3. package/lib/analyses/DtoAnalyzer.js.map +1 -0
  4. package/lib/analyses/ImportAnalyzer.d.ts +3 -8
  5. package/lib/analyses/ImportAnalyzer.js +84 -102
  6. package/lib/analyses/ImportAnalyzer.js.map +1 -1
  7. package/lib/analyses/ReflectHttpOperationAnalyzer.js +1 -1
  8. package/lib/analyses/ReflectHttpOperationAnalyzer.js.map +1 -1
  9. package/lib/analyses/ReflectWebSocketOperationAnalyzer.js +1 -1
  10. package/lib/analyses/ReflectWebSocketOperationAnalyzer.js.map +1 -1
  11. package/lib/generates/internal/E2eFileProgrammer.js +3 -9
  12. package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
  13. package/lib/generates/internal/ImportDictionary.d.ts +9 -11
  14. package/lib/generates/internal/ImportDictionary.js +55 -48
  15. package/lib/generates/internal/ImportDictionary.js.map +1 -1
  16. package/lib/generates/internal/SdkAliasCollection.js +24 -18
  17. package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
  18. package/lib/generates/internal/SdkFileProgrammer.js +1 -7
  19. package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
  20. package/lib/generates/internal/SdkHttpCloneReferencer.js +3 -1
  21. package/lib/generates/internal/SdkHttpCloneReferencer.js.map +1 -1
  22. package/lib/generates/internal/SdkHttpSimulationProgrammer.js +4 -3
  23. package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
  24. package/lib/generates/internal/SdkImportWizard.js +28 -21
  25. package/lib/generates/internal/SdkImportWizard.js.map +1 -1
  26. package/lib/generates/internal/SdkTypeProgrammer.js +3 -2
  27. package/lib/generates/internal/SdkTypeProgrammer.js.map +1 -1
  28. package/lib/generates/internal/SdkTypeTagProgrammer.js +10 -8
  29. package/lib/generates/internal/SdkTypeTagProgrammer.js.map +1 -1
  30. package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +8 -6
  31. package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
  32. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +12 -9
  33. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
  34. package/lib/structures/IReflectHttpOperation.d.ts +2 -2
  35. package/lib/structures/IReflectImport.d.ts +6 -0
  36. package/lib/structures/{IReflectTypeImport.js → IReflectImport.js} +1 -1
  37. package/lib/structures/IReflectImport.js.map +1 -0
  38. package/lib/structures/IReflectWebSocketOperation.d.ts +2 -2
  39. package/lib/structures/IReflectWebSocketOperationParameter.d.ts +2 -2
  40. package/lib/structures/ITypedHttpRoute.d.ts +2 -2
  41. package/lib/structures/ITypedWebSocketRoute.d.ts +2 -2
  42. package/lib/transformers/IOperationMetadata.d.ts +3 -3
  43. package/lib/transformers/SdkOperationProgrammer.d.ts +3 -1
  44. package/lib/transformers/SdkOperationProgrammer.js +57 -26
  45. package/lib/transformers/SdkOperationProgrammer.js.map +1 -1
  46. package/lib/transformers/SdkOperationTransformer.js +3 -3
  47. package/lib/transformers/SdkOperationTransformer.js.map +1 -1
  48. package/package.json +4 -4
  49. package/src/analyses/DtoAnalyzer.ts +246 -0
  50. package/src/analyses/ImportAnalyzer.ts +110 -155
  51. package/src/analyses/ReflectHttpOperationAnalyzer.ts +1 -1
  52. package/src/analyses/ReflectWebSocketOperationAnalyzer.ts +3 -3
  53. package/src/generates/internal/E2eFileProgrammer.ts +3 -11
  54. package/src/generates/internal/ImportDictionary.ts +111 -84
  55. package/src/generates/internal/SdkAliasCollection.ts +24 -18
  56. package/src/generates/internal/SdkFileProgrammer.ts +1 -7
  57. package/src/generates/internal/SdkHttpCloneReferencer.ts +3 -1
  58. package/src/generates/internal/SdkHttpSimulationProgrammer.ts +4 -3
  59. package/src/generates/internal/SdkImportWizard.ts +28 -21
  60. package/src/generates/internal/SdkTypeProgrammer.ts +3 -2
  61. package/src/generates/internal/SdkTypeTagProgrammer.ts +10 -8
  62. package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +8 -6
  63. package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +12 -9
  64. package/src/structures/IReflectHttpOperation.ts +2 -2
  65. package/src/structures/IReflectHttpOperationParameter.ts +2 -6
  66. package/src/structures/IReflectImport.ts +6 -0
  67. package/src/structures/IReflectWebSocketOperation.ts +2 -2
  68. package/src/structures/IReflectWebSocketOperationParameter.ts +3 -5
  69. package/src/structures/ITypedHttpRoute.ts +2 -2
  70. package/src/structures/ITypedWebSocketRoute.ts +2 -2
  71. package/src/transformers/IOperationMetadata.ts +3 -3
  72. package/src/transformers/SdkOperationProgrammer.ts +60 -31
  73. package/src/transformers/SdkOperationTransformer.ts +7 -8
  74. package/lib/structures/IReflectTypeImport.d.ts +0 -4
  75. package/lib/structures/IReflectTypeImport.js.map +0 -1
  76. package/src/structures/IReflectTypeImport.ts +0 -4
@@ -1,12 +1,21 @@
1
1
  import path from "path";
2
- import { HashMap, HashSet, Pair } from "tstl";
2
+ import { HashMap, TreeSet, hash } from "tstl";
3
3
  import ts from "typescript";
4
4
 
5
+ import { ImportAnalyzer } from "../../analyses/ImportAnalyzer";
6
+ import { IReflectImport } from "../../structures/IReflectImport";
5
7
  import { FilePrinter } from "./FilePrinter";
6
8
 
7
9
  export class ImportDictionary {
8
- private readonly components_: HashMap<Pair<string, boolean>, IComposition> =
9
- new HashMap();
10
+ private readonly components_: HashMap<ICompositeKey, ICompositeValue> =
11
+ new HashMap(
12
+ (key) => hash(key.file, key.declaration, key.asterisk, key.default),
13
+ (a, b) =>
14
+ a.file === b.file &&
15
+ a.declaration === b.declaration &&
16
+ a.asterisk === b.asterisk &&
17
+ a.default === b.default,
18
+ );
10
19
 
11
20
  public constructor(public readonly file: string) {}
12
21
 
@@ -14,23 +23,42 @@ export class ImportDictionary {
14
23
  return this.components_.empty();
15
24
  }
16
25
 
17
- public external(props: ImportDictionary.IExternalProps): string {
18
- const key: string = `node_modules/${props.library}`;
19
- const composition: IComposition = this.components_.take(
20
- new Pair(key, props.type),
21
- () => ({
22
- location: key,
23
- elements: new HashSet(),
24
- default: false,
25
- type: props.type,
26
- }),
27
- );
28
- if (props.instance === null) composition.default = true;
29
- else composition.elements.insert(props.instance);
30
- return props.instance ?? props.library;
26
+ public declarations(imports: IReflectImport[]): void {
27
+ imports = ImportAnalyzer.merge(imports);
28
+ for (const imp of imports) {
29
+ if (imp.asterisk !== null)
30
+ this.internal({
31
+ type: "asterisk",
32
+ file: imp.file,
33
+ name: imp.asterisk,
34
+ declaration: true,
35
+ });
36
+ if (imp.default !== null)
37
+ this.internal({
38
+ type: "default",
39
+ file: imp.file,
40
+ name: imp.default,
41
+ declaration: true,
42
+ });
43
+ for (const elem of imp.elements)
44
+ this.internal({
45
+ type: "element",
46
+ file: imp.file,
47
+ name: elem,
48
+ declaration: true,
49
+ });
50
+ }
31
51
  }
32
52
 
33
- public internal(props: ImportDictionary.IInternalProps): string {
53
+ public external(props: ImportDictionary.IProps): string {
54
+ const file: string = `node_modules/${props.file}`;
55
+ return this.internal({
56
+ ...props,
57
+ file,
58
+ });
59
+ }
60
+
61
+ public internal(props: ImportDictionary.IProps): string {
34
62
  const file: string = normalize(
35
63
  (() => {
36
64
  if (props.file.substring(props.file.length - 5) === ".d.ts")
@@ -40,27 +68,25 @@ export class ImportDictionary {
40
68
  return props.file;
41
69
  })(),
42
70
  );
43
- const composition: IComposition = this.components_.take(
44
- new Pair(file, props.type),
45
- () => ({
46
- location: file,
47
- elements: new HashSet(),
48
- default: false,
49
- type: props.type,
50
- }),
51
- );
52
- if (props.instance === null) {
53
- composition.default = true;
54
- if (props.name) composition.name = props.name;
55
- } else composition.elements.insert(props.instance);
56
- return props.instance ?? file;
71
+ const key: ICompositeKey = {
72
+ file: file,
73
+ declaration: props.declaration,
74
+ asterisk: props.type === "asterisk" ? props.name : null,
75
+ default: props.type === "default" ? props.name : null,
76
+ };
77
+ const value: ICompositeValue = this.components_.take(key, () => ({
78
+ ...key,
79
+ elements: new TreeSet<string>(),
80
+ }));
81
+ if (props.type === "element") value.elements.insert(props.name);
82
+ return props.name;
57
83
  }
58
84
 
59
85
  public toStatements(outDir: string): ts.Statement[] {
60
86
  outDir = path.resolve(outDir);
87
+
61
88
  const external: ts.ImportDeclaration[] = [];
62
89
  const internal: ts.ImportDeclaration[] = [];
63
-
64
90
  const locator = (str: string) => {
65
91
  const location: string = path
66
92
  .relative(outDir, str)
@@ -76,48 +102,26 @@ export class ImportDictionary {
76
102
  const enroll =
77
103
  (filter: (str: string) => boolean) =>
78
104
  (container: ts.ImportDeclaration[]) => {
79
- const compositions: IComposition[] = this.components_
105
+ const compositions: ICompositeValue[] = this.components_
80
106
  .toJSON()
81
- .filter((c) => filter(c.second.location))
82
- .map((e) => ({
83
- ...e.second,
84
- location: locator(e.second.location),
85
- }))
86
- .sort((a, b) => a.location.localeCompare(b.location));
87
- for (const c of compositions) {
88
- const brackets: string[] = [];
89
- if (c.default) brackets.push(c.name ?? c.location);
90
- if (c.elements.empty() === false)
91
- brackets.push(
92
- `{ ${c.elements
93
- .toJSON()
94
- .sort((a, b) => a.localeCompare(b))
95
- .join(", ")} }`,
96
- );
107
+ .filter((c) => filter(c.second.file))
108
+ .map(
109
+ (e) =>
110
+ ({
111
+ ...e.second,
112
+ file: locator(e.second.file),
113
+ }) satisfies ICompositeValue,
114
+ )
115
+ .sort((a, b) => a.file.localeCompare(b.file));
116
+ for (const c of compositions)
97
117
  container.push(
98
118
  ts.factory.createImportDeclaration(
99
119
  undefined,
100
- ts.factory.createImportClause(
101
- c.type,
102
- c.default
103
- ? ts.factory.createIdentifier(c.name ?? c.location)
104
- : undefined,
105
- c.elements.empty() === false
106
- ? ts.factory.createNamedImports(
107
- [...c.elements].map((elem) =>
108
- ts.factory.createImportSpecifier(
109
- false,
110
- undefined,
111
- ts.factory.createIdentifier(elem),
112
- ),
113
- ),
114
- )
115
- : undefined,
116
- ),
117
- ts.factory.createStringLiteral(c.location),
120
+ this.toImportClaude(c),
121
+ ts.factory.createStringLiteral(c.file),
122
+ undefined,
118
123
  ),
119
124
  );
120
- }
121
125
  };
122
126
 
123
127
  enroll((str) => str.indexOf(NODE_MODULES) !== -1)(external);
@@ -128,27 +132,50 @@ export class ImportDictionary {
128
132
  ...internal,
129
133
  ];
130
134
  }
135
+
136
+ private toImportClaude(c: ICompositeValue): ts.ImportClause {
137
+ if (c.asterisk !== null)
138
+ return ts.factory.createImportClause(
139
+ c.declaration,
140
+ undefined,
141
+ ts.factory.createNamespaceImport(
142
+ ts.factory.createIdentifier(c.asterisk),
143
+ ),
144
+ );
145
+ return ts.factory.createImportClause(
146
+ c.declaration,
147
+ c.default !== null ? ts.factory.createIdentifier(c.default) : undefined,
148
+ c.elements.size() !== 0
149
+ ? ts.factory.createNamedImports(
150
+ Array.from(c.elements).map((elem) =>
151
+ ts.factory.createImportSpecifier(
152
+ false,
153
+ undefined,
154
+ ts.factory.createIdentifier(elem),
155
+ ),
156
+ ),
157
+ )
158
+ : undefined,
159
+ );
160
+ }
131
161
  }
132
162
  export namespace ImportDictionary {
133
- export interface IExternalProps {
134
- type: boolean;
135
- library: string;
136
- instance: string | null;
137
- }
138
- export interface IInternalProps {
139
- type: boolean;
163
+ export interface IProps {
164
+ type: "default" | "element" | "asterisk";
140
165
  file: string;
141
- instance: string | null;
142
- name?: string | null;
166
+ name: string;
167
+ declaration: boolean;
143
168
  }
144
169
  }
145
170
 
146
- interface IComposition {
147
- location: string;
148
- type: boolean;
149
- default: boolean;
150
- name?: string;
151
- elements: HashSet<string>;
171
+ interface ICompositeKey {
172
+ file: string;
173
+ declaration: boolean;
174
+ asterisk: string | null;
175
+ default: string | null;
176
+ }
177
+ interface ICompositeValue extends ICompositeKey {
178
+ elements: TreeSet<string>;
152
179
  }
153
180
 
154
181
  const NODE_MODULES = "node_modules/";
@@ -108,9 +108,10 @@ export namespace SdkAliasCollection {
108
108
  if (project.config.primitive === false) return type;
109
109
  return ts.factory.createTypeReferenceNode(
110
110
  importer.external({
111
- type: true,
112
- library: "typia",
113
- instance: "Resolved",
111
+ file: "typia",
112
+ declaration: true,
113
+ type: "element",
114
+ name: "Resolved",
114
115
  }),
115
116
  [type],
116
117
  );
@@ -126,9 +127,10 @@ export namespace SdkAliasCollection {
126
127
  if (project.config.primitive === false) return type;
127
128
  return ts.factory.createTypeReferenceNode(
128
129
  importer.external({
129
- type: true,
130
- library: "typia",
131
- instance: "Resolved",
130
+ file: "typia",
131
+ declaration: true,
132
+ type: "element",
133
+ name: "Resolved",
132
134
  }),
133
135
  [type],
134
136
  );
@@ -150,9 +152,10 @@ export namespace SdkAliasCollection {
150
152
  else if (project.config.primitive === false) return type;
151
153
  return ts.factory.createTypeReferenceNode(
152
154
  importer.external({
153
- type: true,
154
- library: "typia",
155
- instance:
155
+ file: "typia",
156
+ declaration: true,
157
+ type: "element",
158
+ name:
156
159
  param.contentType === "application/json" || param.encrypted === true
157
160
  ? "Primitive"
158
161
  : "Resolved",
@@ -173,9 +176,10 @@ export namespace SdkAliasCollection {
173
176
  : project.config.primitive !== false
174
177
  ? ts.factory.createTypeReferenceNode(
175
178
  importer.external({
176
- type: true,
177
- library: "typia",
178
- instance:
179
+ file: "typia",
180
+ declaration: true,
181
+ type: "element",
182
+ name:
179
183
  route.success.contentType === "application/json" ||
180
184
  route.success.encrypted === true
181
185
  ? "Primitive"
@@ -200,9 +204,10 @@ export namespace SdkAliasCollection {
200
204
  ];
201
205
  return ts.factory.createTypeReferenceNode(
202
206
  importer.external({
203
- type: true,
204
- library: "@nestia/fetcher",
205
- instance: "IPropagation",
207
+ file: "@nestia/fetcher",
208
+ declaration: true,
209
+ type: "element",
210
+ name: "IPropagation",
206
211
  }),
207
212
  [
208
213
  ts.factory.createTypeLiteralNode(
@@ -241,9 +246,10 @@ export namespace SdkAliasCollection {
241
246
  const formDataInput = (importer: ImportDictionary) => (type: ts.TypeNode) =>
242
247
  ts.factory.createTypeReferenceNode(
243
248
  importer.external({
244
- type: true,
245
- library: "@nestia/fetcher",
246
- instance: "FormDataInput",
249
+ file: "@nestia/fetcher",
250
+ declaration: true,
251
+ type: "element",
252
+ name: "FormDataInput",
247
253
  }),
248
254
  [type],
249
255
  );
@@ -76,13 +76,7 @@ export namespace SdkFileProgrammer {
76
76
  );
77
77
  directory.routes.forEach((route, i) => {
78
78
  if (!(project.config.clone === true && route.protocol === "http"))
79
- for (const tuple of route.imports)
80
- for (const instance of tuple.instances)
81
- importer.internal({
82
- file: tuple.file,
83
- instance,
84
- type: true,
85
- });
79
+ importer.declarations(route.imports);
86
80
  statements.push(
87
81
  ...(route.protocol === "http"
88
82
  ? SdkHttpRouteProgrammer.write(project)(importer)(route)
@@ -47,7 +47,9 @@ export namespace SdkHttpCloneReferencer {
47
47
  });
48
48
  props.route.imports = Array.from(unique).map((str) => ({
49
49
  file: `${props.directory}/${str}`,
50
- instances: [str],
50
+ asterisk: null,
51
+ default: null,
52
+ elements: [str],
51
53
  }));
52
54
  };
53
55
 
@@ -140,9 +140,10 @@ export namespace SdkHttpSimulationProgrammer {
140
140
  IdentifierFactory.access(
141
141
  ts.factory.createIdentifier(
142
142
  importer.external({
143
- type: false,
144
- library: `@nestia/fetcher/lib/NestiaSimulator`,
145
- instance: "NestiaSimulator",
143
+ file: `@nestia/fetcher/lib/NestiaSimulator`,
144
+ declaration: false,
145
+ type: "element",
146
+ name: "NestiaSimulator",
146
147
  }),
147
148
  ),
148
149
  "assert",
@@ -6,50 +6,57 @@ export namespace SdkImportWizard {
6
6
 
7
7
  export const HttpError = (importer: ImportDictionary) =>
8
8
  importer.external({
9
- type: true,
10
- library: "@nestia/fetcher",
11
- instance: "HttpError",
9
+ declaration: true,
10
+ file: "@nestia/fetcher",
11
+ type: "element",
12
+ name: "HttpError",
12
13
  });
13
14
 
14
15
  export const IConnection = (importer: ImportDictionary) =>
15
16
  importer.external({
16
- type: true,
17
- library: "@nestia/fetcher",
18
- instance: "IConnection",
17
+ declaration: true,
18
+ file: "@nestia/fetcher",
19
+ type: "element",
20
+ name: "IConnection",
19
21
  });
20
22
 
21
23
  export const Primitive = (importer: ImportDictionary) =>
22
24
  importer.external({
23
- type: true,
24
- library: "typia",
25
- instance: "Primitive",
25
+ declaration: true,
26
+ file: "typia",
27
+ type: "element",
28
+ name: "Primitive",
26
29
  });
27
30
 
28
31
  export const Resolved = (importer: ImportDictionary) =>
29
32
  importer.external({
30
- type: true,
31
- library: "typia",
32
- instance: "Resolved",
33
+ declaration: true,
34
+ file: "typia",
35
+ type: "element",
36
+ name: "Resolved",
33
37
  });
34
38
 
35
39
  export const typia = (importer: ImportDictionary) =>
36
40
  importer.external({
37
- type: false,
38
- library: "typia",
39
- instance: null,
41
+ declaration: false,
42
+ file: "typia",
43
+ type: "default",
44
+ name: "typia",
40
45
  });
41
46
  }
42
47
 
43
48
  const PlainFetcher = (importer: ImportDictionary) =>
44
49
  importer.external({
45
- type: false,
46
- library: "@nestia/fetcher/lib/PlainFetcher",
47
- instance: "PlainFetcher",
50
+ declaration: false,
51
+ file: "@nestia/fetcher/lib/PlainFetcher",
52
+ type: "element",
53
+ name: "PlainFetcher",
48
54
  });
49
55
 
50
56
  const EncryptedFetcher = (importer: ImportDictionary) =>
51
57
  importer.external({
52
- type: false,
53
- library: "@nestia/fetcher/lib/EncryptedFetcher",
54
- instance: "EncryptedFetcher",
58
+ declaration: false,
59
+ file: "@nestia/fetcher/lib/EncryptedFetcher",
60
+ type: "element",
61
+ name: "EncryptedFetcher",
55
62
  });
@@ -377,8 +377,9 @@ const importInternalFile =
377
377
  if (importer.file === `${project.config.output}/structures/${top}.ts`)
378
378
  return;
379
379
  importer.internal({
380
- type: true,
380
+ declaration: true,
381
381
  file: `${project.config.output}/structures/${name.split(".")[0]}`,
382
- instance: top,
382
+ type: "element",
383
+ name: top,
383
384
  });
384
385
  };
@@ -10,13 +10,14 @@ export namespace SdkTypeTagProgrammer {
10
10
  from: "object" | "array" | "boolean" | "number" | "bigint" | "string",
11
11
  tag: IMetadataTypeTag,
12
12
  ) => {
13
- const instance: string = tag.name.split("<")[0];
14
- if (PREDEFINED[from]?.has(instance) === true)
13
+ const name: string = tag.name.split("<")[0];
14
+ if (PREDEFINED[from]?.has(name) === true)
15
15
  return ts.factory.createTypeReferenceNode(
16
16
  importer.external({
17
- type: true,
18
- library: `typia/lib/tags/${instance}`,
19
- instance,
17
+ declaration: true,
18
+ file: `typia/lib/tags/${name}`,
19
+ type: "element",
20
+ name: name,
20
21
  }),
21
22
  [
22
23
  ts.factory.createLiteralTypeNode(
@@ -26,9 +27,10 @@ export namespace SdkTypeTagProgrammer {
26
27
  );
27
28
  return ts.factory.createTypeReferenceNode(
28
29
  importer.external({
29
- type: true,
30
- library: `typia/lib/tags/TagBase`,
31
- instance: "TagBase",
30
+ declaration: true,
31
+ file: `typia/lib/tags/TagBase`,
32
+ type: "element",
33
+ name: "TagBase",
32
34
  }),
33
35
  [
34
36
  ts.factory.createLiteralTypeNode(
@@ -52,9 +52,10 @@ export namespace SdkWebSocketNamespaceProgrammer {
52
52
  undefined,
53
53
  ts.factory.createTypeReferenceNode(
54
54
  importer.external({
55
- type: false,
56
- library: "tgrid",
57
- instance: "WebSocketConnector",
55
+ declaration: false,
56
+ file: "tgrid",
57
+ type: "element",
58
+ name: "WebSocketConnector",
58
59
  }),
59
60
  [
60
61
  ts.factory.createTypeReferenceNode("Header"),
@@ -69,9 +70,10 @@ export namespace SdkWebSocketNamespaceProgrammer {
69
70
  undefined,
70
71
  ts.factory.createTypeReferenceNode(
71
72
  importer.external({
72
- type: true,
73
- library: "tgrid",
74
- instance: "Driver",
73
+ declaration: true,
74
+ file: "tgrid",
75
+ type: "element",
76
+ name: "Driver",
75
77
  }),
76
78
  [ts.factory.createTypeReferenceNode("Listener")],
77
79
  ),
@@ -107,9 +107,10 @@ export namespace SdkWebSocketRouteProgrammer {
107
107
  local("connector")(
108
108
  ts.factory.createTypeReferenceNode(
109
109
  importer.external({
110
- type: false,
111
- library: "tgrid",
112
- instance: "WebSocketConnector",
110
+ declaration: false,
111
+ file: "tgrid",
112
+ type: "element",
113
+ name: "WebSocketConnector",
113
114
  }),
114
115
  [
115
116
  ts.factory.createTypeReferenceNode(`${route.name}.Header`),
@@ -121,9 +122,10 @@ export namespace SdkWebSocketRouteProgrammer {
121
122
  ts.factory.createNewExpression(
122
123
  ts.factory.createIdentifier(
123
124
  importer.external({
124
- type: false,
125
- library: "tgrid",
126
- instance: "WebSocketConnector",
125
+ declaration: false,
126
+ file: "tgrid",
127
+ type: "element",
128
+ name: "WebSocketConnector",
127
129
  }),
128
130
  ),
129
131
  undefined,
@@ -178,9 +180,10 @@ export namespace SdkWebSocketRouteProgrammer {
178
180
  local("driver")(
179
181
  ts.factory.createTypeReferenceNode(
180
182
  importer.external({
181
- type: true,
182
- library: "tgrid",
183
- instance: "Driver",
183
+ declaration: true,
184
+ file: "tgrid",
185
+ type: "element",
186
+ name: "Driver",
184
187
  }),
185
188
  [ts.factory.createTypeReferenceNode(`${route.name}.Listener`)],
186
189
  ),
@@ -4,7 +4,7 @@ import { IJsDocTagInfo } from "typia";
4
4
  import { IReflectHttpOperationException } from "./IReflectHttpOperationException";
5
5
  import { IReflectHttpOperationParameter } from "./IReflectHttpOperationParameter";
6
6
  import { IReflectHttpOperationSuccess } from "./IReflectHttpOperationSuccess";
7
- import { IReflectTypeImport } from "./IReflectTypeImport";
7
+ import { IReflectImport } from "./IReflectImport";
8
8
 
9
9
  export interface IReflectHttpOperation {
10
10
  protocol: "http";
@@ -18,7 +18,7 @@ export interface IReflectHttpOperation {
18
18
  exceptions: Record<string, IReflectHttpOperationException>;
19
19
  security: Record<string, string[]>[];
20
20
  tags: string[];
21
- imports: IReflectTypeImport[];
21
+ imports: IReflectImport[];
22
22
  operationId: string | undefined;
23
23
  description: string | null;
24
24
  jsDocTags: IJsDocTagInfo[];
@@ -42,18 +42,14 @@ export namespace IReflectHttpOperationParameter {
42
42
  jsDocTags: IJsDocTagInfo[];
43
43
  }
44
44
 
45
- /**
46
- * @internal
47
- */
45
+ /** @internal */
48
46
  export type IPreconfigured =
49
47
  | IPreconfigured.IBody
50
48
  | IPreconfigured.IHeaders
51
49
  | IPreconfigured.IParam
52
50
  | IPreconfigured.IQuery;
53
51
 
54
- /**
55
- * @internal
56
- */
52
+ /** @internal */
57
53
  export namespace IPreconfigured {
58
54
  export interface IBody extends IBase<"body"> {
59
55
  field?: string;
@@ -0,0 +1,6 @@
1
+ export interface IReflectImport {
2
+ file: string;
3
+ asterisk: string | null;
4
+ default: string | null;
5
+ elements: string[];
6
+ }
@@ -1,7 +1,7 @@
1
1
  import { VERSION_NEUTRAL } from "@nestjs/common";
2
2
  import ts from "typescript";
3
3
 
4
- import { IReflectTypeImport } from "./IReflectTypeImport";
4
+ import { IReflectImport } from "./IReflectImport";
5
5
  import { IReflectWebSocketOperationParameter } from "./IReflectWebSocketOperationParameter";
6
6
 
7
7
  export interface IReflectWebSocketOperation {
@@ -11,7 +11,7 @@ export interface IReflectWebSocketOperation {
11
11
  function: Function;
12
12
  versions: Array<string | typeof VERSION_NEUTRAL> | undefined;
13
13
  parameters: IReflectWebSocketOperationParameter[];
14
- imports: IReflectTypeImport[];
14
+ imports: IReflectImport[];
15
15
  description: string | null;
16
16
  jsDocTags: ts.JSDocTagInfo[];
17
17
  }
@@ -1,7 +1,7 @@
1
1
  import { IJsDocTagInfo } from "typia";
2
2
 
3
+ import { IReflectImport } from "./IReflectImport";
3
4
  import { IReflectType } from "./IReflectType";
4
- import { IReflectTypeImport } from "./IReflectTypeImport";
5
5
 
6
6
  export type IReflectWebSocketOperationParameter =
7
7
  | IReflectWebSocketOperationParameter.IAcceptor
@@ -22,14 +22,12 @@ export namespace IReflectWebSocketOperationParameter {
22
22
  name: string;
23
23
  index: number;
24
24
  type: IReflectType;
25
- imports: IReflectTypeImport[];
25
+ imports: IReflectImport[];
26
26
  description: string | null;
27
27
  jsDocTags: IJsDocTagInfo[];
28
28
  }
29
29
 
30
- /**
31
- * @internal
32
- */
30
+ /** @internal */
33
31
  export interface IPreconfigured {
34
32
  category: "acceptor" | "driver" | "header" | "param" | "query";
35
33
  index: number;