@nestia/sdk 12.0.0-dev.20260612.2 → 12.0.0-dev.20260619.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.
- package/assets/bundle/distribute/package.json +1 -1
- package/lib/factories/ExpressionFactory.d.ts +9 -0
- package/lib/factories/ExpressionFactory.js +16 -0
- package/lib/factories/ExpressionFactory.js.map +1 -0
- package/lib/factories/IdentifierFactory.d.ts +22 -0
- package/lib/factories/IdentifierFactory.js +50 -0
- package/lib/factories/IdentifierFactory.js.map +1 -0
- package/lib/factories/LiteralFactory.d.ts +9 -0
- package/lib/factories/LiteralFactory.js +48 -0
- package/lib/factories/LiteralFactory.js.map +1 -0
- package/lib/factories/StatementFactory.d.ts +14 -0
- package/lib/factories/StatementFactory.js +20 -0
- package/lib/factories/StatementFactory.js.map +1 -0
- package/lib/factories/TypeFactory.d.ts +24 -0
- package/lib/factories/TypeFactory.js +27 -0
- package/lib/factories/TypeFactory.js.map +1 -0
- package/lib/generates/CloneGenerator.js +2 -2
- package/lib/generates/CloneGenerator.js.map +1 -1
- package/lib/generates/internal/E2eFileProgrammer.js +30 -29
- package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
- package/lib/generates/internal/FilePrinter.d.ts +2 -2
- package/lib/generates/internal/FilePrinter.js +14 -25
- package/lib/generates/internal/FilePrinter.js.map +1 -1
- package/lib/generates/internal/ImportDictionary.d.ts +1 -1
- package/lib/generates/internal/ImportDictionary.js +10 -9
- package/lib/generates/internal/ImportDictionary.js.map +1 -1
- package/lib/generates/internal/SdkAliasCollection.d.ts +12 -12
- package/lib/generates/internal/SdkAliasCollection.js +23 -25
- package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
- package/lib/generates/internal/SdkFileProgrammer.js +2 -2
- package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpCloneProgrammer.js +3 -3
- package/lib/generates/internal/SdkHttpCloneProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpFunctionProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js +45 -48
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +61 -60
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpParameterProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkHttpParameterProgrammer.js +11 -13
- package/lib/generates/internal/SdkHttpParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpRouteProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js +50 -48
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkMcpRouteProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkMcpRouteProgrammer.js +54 -53
- package/lib/generates/internal/SdkMcpRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkTypeProgrammer.d.ts +3 -3
- package/lib/generates/internal/SdkTypeProgrammer.js +42 -43
- package/lib/generates/internal/SdkTypeProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkTypeTagProgrammer.d.ts +2 -1
- package/lib/generates/internal/SdkTypeTagProgrammer.js +7 -9
- package/lib/generates/internal/SdkTypeTagProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +45 -47
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.d.ts +3 -3
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js +9 -9
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +34 -40
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
- package/lib/transform.d.ts +5 -9
- package/lib/transform.js +8 -31
- package/lib/transform.js.map +1 -1
- package/package.json +11 -11
- package/src/factories/ExpressionFactory.ts +23 -0
- package/src/factories/IdentifierFactory.ts +84 -0
- package/src/factories/LiteralFactory.ts +54 -0
- package/src/factories/StatementFactory.ts +56 -0
- package/src/factories/TypeFactory.ts +27 -0
- package/src/generates/CloneGenerator.ts +8 -7
- package/src/generates/internal/E2eFileProgrammer.ts +59 -53
- package/src/generates/internal/FilePrinter.ts +28 -36
- package/src/generates/internal/ImportDictionary.ts +19 -21
- package/src/generates/internal/SdkAliasCollection.ts +55 -49
- package/src/generates/internal/SdkFileProgrammer.ts +4 -7
- package/src/generates/internal/SdkHttpCloneProgrammer.ts +11 -13
- package/src/generates/internal/SdkHttpFunctionProgrammer.ts +90 -101
- package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +153 -166
- package/src/generates/internal/SdkHttpParameterProgrammer.ts +15 -17
- package/src/generates/internal/SdkHttpRouteProgrammer.ts +1 -1
- package/src/generates/internal/SdkHttpSimulationProgrammer.ts +121 -130
- package/src/generates/internal/SdkMcpRouteProgrammer.ts +135 -140
- package/src/generates/internal/SdkTypeProgrammer.ts +389 -382
- package/src/generates/internal/SdkTypeTagProgrammer.ts +13 -17
- package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +124 -130
- package/src/generates/internal/SdkWebSocketParameterProgrammer.ts +17 -15
- package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +112 -139
- package/src/transform.ts +14 -45
|
@@ -1,55 +1,47 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Node,
|
|
2
|
+
type Node,
|
|
3
|
+
type Statement,
|
|
3
4
|
SyntaxKind,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
TsPrinter,
|
|
6
|
+
addSyntheticLeadingComment,
|
|
7
|
+
factory,
|
|
8
|
+
} from "@ttsc/factory";
|
|
7
9
|
import fs from "fs";
|
|
8
10
|
import { format } from "prettier";
|
|
9
11
|
|
|
10
12
|
export namespace FilePrinter {
|
|
11
|
-
export const description = <T extends Node>(
|
|
12
|
-
node: T,
|
|
13
|
-
comment: string,
|
|
14
|
-
): T => {
|
|
13
|
+
export const description = <T extends Node>(node: T, comment: string): T => {
|
|
15
14
|
if (comment.length === 0) return node;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
hasTrailingNewLine: true,
|
|
34
|
-
},
|
|
35
|
-
];
|
|
36
|
-
return node;
|
|
15
|
+
return addSyntheticLeadingComment(
|
|
16
|
+
node,
|
|
17
|
+
SyntaxKind.MultiLineCommentTrivia,
|
|
18
|
+
[
|
|
19
|
+
"*",
|
|
20
|
+
...comment
|
|
21
|
+
.split("\r\n")
|
|
22
|
+
.join("\n")
|
|
23
|
+
.split("\n")
|
|
24
|
+
.map(
|
|
25
|
+
(str) =>
|
|
26
|
+
` * ${str.split("*/").join("*\\\\/").split("*\\/").join("*\\\\/")}`,
|
|
27
|
+
),
|
|
28
|
+
"",
|
|
29
|
+
].join("\n"),
|
|
30
|
+
true,
|
|
31
|
+
);
|
|
37
32
|
};
|
|
38
33
|
|
|
39
34
|
export const enter = () =>
|
|
40
|
-
|
|
41
|
-
TypeScriptFactory.createIdentifier("\n"),
|
|
42
|
-
);
|
|
35
|
+
factory.createExpressionStatement(factory.createIdentifier("\n"));
|
|
43
36
|
|
|
44
37
|
export const write = async (props: {
|
|
45
38
|
location: string;
|
|
46
39
|
statements: Node[];
|
|
47
40
|
top?: string;
|
|
48
41
|
}): Promise<void> => {
|
|
49
|
-
const script: string =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
42
|
+
const script: string =
|
|
43
|
+
(props.top ?? "") +
|
|
44
|
+
new TsPrinter().printFile(undefined, props.statements as Statement[]);
|
|
53
45
|
await fs.promises.writeFile(props.location, await beautify(script), "utf8");
|
|
54
46
|
};
|
|
55
47
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Node,
|
|
1
|
+
import { type ImportClause, type Node, factory } from "@ttsc/factory";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { HashMap, TreeMap, hash } from "tstl";
|
|
4
4
|
|
|
@@ -109,11 +109,10 @@ export class ImportDictionary {
|
|
|
109
109
|
.sort((a, b) => a.file.localeCompare(b.file));
|
|
110
110
|
for (const c of compositions)
|
|
111
111
|
container.push(
|
|
112
|
-
|
|
112
|
+
factory.createImportDeclaration(
|
|
113
113
|
undefined,
|
|
114
114
|
this.toImportClaude(c),
|
|
115
|
-
|
|
116
|
-
undefined,
|
|
115
|
+
factory.createStringLiteral(c.file),
|
|
117
116
|
),
|
|
118
117
|
);
|
|
119
118
|
};
|
|
@@ -127,29 +126,28 @@ export class ImportDictionary {
|
|
|
127
126
|
];
|
|
128
127
|
}
|
|
129
128
|
|
|
130
|
-
private toImportClaude(c: ICompositeValue):
|
|
129
|
+
private toImportClaude(c: ICompositeValue): ImportClause {
|
|
130
|
+
// A namespace import cannot carry a per-binding `type` modifier, so the
|
|
131
|
+
// type-only flag stays off here (a value namespace import resolves type
|
|
132
|
+
// members fine), matching the legacy printer output `import * as X`.
|
|
131
133
|
if (c.asterisk !== null)
|
|
132
|
-
return
|
|
133
|
-
|
|
134
|
+
return factory.createImportClause(
|
|
135
|
+
false,
|
|
134
136
|
undefined,
|
|
135
|
-
|
|
136
|
-
TypeScriptFactory.createIdentifier(c.asterisk),
|
|
137
|
-
),
|
|
137
|
+
factory.createNamespaceImport(factory.createIdentifier(c.asterisk)),
|
|
138
138
|
);
|
|
139
|
-
|
|
139
|
+
// `c.declaration` (type-only) belongs on the import clause, not on each
|
|
140
|
+
// specifier — emitting both produces the invalid `import type { type X }`.
|
|
141
|
+
return factory.createImportClause(
|
|
140
142
|
c.declaration,
|
|
141
|
-
c.default !== null
|
|
142
|
-
? TypeScriptFactory.createIdentifier(c.default)
|
|
143
|
-
: undefined,
|
|
143
|
+
c.default !== null ? factory.createIdentifier(c.default) : undefined,
|
|
144
144
|
c.elements.size() !== 0
|
|
145
|
-
?
|
|
145
|
+
? factory.createNamedImports(
|
|
146
146
|
Array.from(c.elements).map(({ first: name, second: alias }) =>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
alias !== null
|
|
150
|
-
|
|
151
|
-
: undefined,
|
|
152
|
-
TypeScriptFactory.createIdentifier(alias ?? name),
|
|
147
|
+
factory.createImportSpecifier(
|
|
148
|
+
false,
|
|
149
|
+
alias !== null ? factory.createIdentifier(name) : undefined,
|
|
150
|
+
factory.createIdentifier(alias ?? name),
|
|
153
151
|
),
|
|
154
152
|
),
|
|
155
153
|
)
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
SyntaxKind,
|
|
3
|
+
type TypeElement,
|
|
4
|
+
type TypeNode,
|
|
5
|
+
factory,
|
|
6
|
+
} from "@ttsc/factory";
|
|
3
7
|
|
|
8
|
+
import { TypeFactory } from "../../factories/TypeFactory";
|
|
4
9
|
import { MetadataSchema, sizeOf } from "../../internal/legacy";
|
|
5
10
|
import { INestiaProject } from "../../structures/INestiaProject";
|
|
6
11
|
import { IReflectType } from "../../structures/IReflectType";
|
|
@@ -13,35 +18,33 @@ import { SdkHttpParameterProgrammer } from "./SdkHttpParameterProgrammer";
|
|
|
13
18
|
import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
|
|
14
19
|
|
|
15
20
|
export namespace SdkAliasCollection {
|
|
16
|
-
export const name = ({ type }: { type: IReflectType }):
|
|
17
|
-
|
|
21
|
+
export const name = ({ type }: { type: IReflectType }): TypeNode =>
|
|
22
|
+
factory.createTypeReferenceNode(
|
|
18
23
|
type.name,
|
|
19
24
|
type.typeArguments
|
|
20
25
|
? type.typeArguments.map((a) => name({ type: a }))
|
|
21
26
|
: undefined,
|
|
22
27
|
);
|
|
23
28
|
|
|
24
|
-
export const binaryChunk = ():
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
export const binaryChunk = (): TypeNode =>
|
|
30
|
+
factory.createTypeReferenceNode("Uint8Array", [
|
|
31
|
+
factory.createTypeReferenceNode("ArrayBufferLike"),
|
|
27
32
|
]);
|
|
28
33
|
|
|
29
|
-
export const binaryResponse = ():
|
|
30
|
-
|
|
31
|
-
binaryChunk(),
|
|
32
|
-
]);
|
|
34
|
+
export const binaryResponse = (): TypeNode =>
|
|
35
|
+
factory.createTypeReferenceNode("ReadableStream", [binaryChunk()]);
|
|
33
36
|
|
|
34
37
|
export const from =
|
|
35
38
|
(project: INestiaProject) =>
|
|
36
39
|
(importer: ImportDictionary) =>
|
|
37
|
-
(metadata: MetadataSchema) =>
|
|
38
|
-
SdkTypeProgrammer.write(project)(importer)(metadata);
|
|
40
|
+
(metadata: MetadataSchema): TypeNode =>
|
|
41
|
+
SdkTypeProgrammer.write(project)(importer)(metadata) as TypeNode;
|
|
39
42
|
|
|
40
43
|
export const httpProps =
|
|
41
44
|
(project: INestiaProject) =>
|
|
42
45
|
(importer: ImportDictionary) =>
|
|
43
|
-
(route: ITypedHttpRoute):
|
|
44
|
-
|
|
46
|
+
(route: ITypedHttpRoute): TypeNode =>
|
|
47
|
+
factory.createTypeLiteralNode(
|
|
45
48
|
SdkHttpParameterProgrammer.getEntries({
|
|
46
49
|
project,
|
|
47
50
|
importer,
|
|
@@ -50,12 +53,12 @@ export namespace SdkAliasCollection {
|
|
|
50
53
|
prefix: false,
|
|
51
54
|
})
|
|
52
55
|
.map((e) => {
|
|
53
|
-
const signature:
|
|
56
|
+
const signature: TypeElement = factory.createPropertySignature(
|
|
54
57
|
undefined,
|
|
55
58
|
e.key,
|
|
56
59
|
e.required
|
|
57
60
|
? undefined
|
|
58
|
-
:
|
|
61
|
+
: factory.createToken(SyntaxKind.QuestionToken),
|
|
59
62
|
e.type,
|
|
60
63
|
);
|
|
61
64
|
const description: string | null =
|
|
@@ -71,7 +74,7 @@ export namespace SdkAliasCollection {
|
|
|
71
74
|
null;
|
|
72
75
|
return description?.length
|
|
73
76
|
? [
|
|
74
|
-
|
|
77
|
+
factory.createIdentifier("\n") as any,
|
|
75
78
|
FilePrinter.description(signature, description),
|
|
76
79
|
]
|
|
77
80
|
: [signature];
|
|
@@ -79,10 +82,10 @@ export namespace SdkAliasCollection {
|
|
|
79
82
|
.flat(),
|
|
80
83
|
);
|
|
81
84
|
|
|
82
|
-
export const websocketProps = (route: ITypedWebSocketRoute):
|
|
83
|
-
|
|
85
|
+
export const websocketProps = (route: ITypedWebSocketRoute): TypeNode =>
|
|
86
|
+
factory.createTypeLiteralNode([
|
|
84
87
|
...route.pathParameters.map((p) =>
|
|
85
|
-
|
|
88
|
+
factory.createPropertySignature(
|
|
86
89
|
undefined,
|
|
87
90
|
p.name,
|
|
88
91
|
undefined,
|
|
@@ -91,31 +94,31 @@ export namespace SdkAliasCollection {
|
|
|
91
94
|
),
|
|
92
95
|
...(route.query
|
|
93
96
|
? [
|
|
94
|
-
|
|
97
|
+
factory.createPropertySignature(
|
|
95
98
|
undefined,
|
|
96
99
|
"query",
|
|
97
100
|
undefined,
|
|
98
|
-
|
|
101
|
+
factory.createTypeReferenceNode("Query"),
|
|
99
102
|
),
|
|
100
103
|
]
|
|
101
104
|
: []),
|
|
102
|
-
|
|
105
|
+
factory.createPropertySignature(
|
|
103
106
|
undefined,
|
|
104
107
|
"provider",
|
|
105
108
|
undefined,
|
|
106
|
-
|
|
109
|
+
factory.createTypeReferenceNode("Provider"),
|
|
107
110
|
),
|
|
108
111
|
]);
|
|
109
112
|
|
|
110
113
|
export const headers =
|
|
111
114
|
(project: INestiaProject) =>
|
|
112
115
|
(importer: ImportDictionary) =>
|
|
113
|
-
(param: ITypedHttpRouteParameter.IHeaders):
|
|
116
|
+
(param: ITypedHttpRouteParameter.IHeaders): TypeNode => {
|
|
114
117
|
if (project.config.clone === true)
|
|
115
118
|
return from(project)(importer)(param.metadata);
|
|
116
|
-
const type:
|
|
119
|
+
const type: TypeNode = name(param);
|
|
117
120
|
if (project.config.primitive === false) return type;
|
|
118
|
-
return
|
|
121
|
+
return factory.createTypeReferenceNode(
|
|
119
122
|
importer.external({
|
|
120
123
|
file: "typia",
|
|
121
124
|
declaration: true,
|
|
@@ -129,12 +132,12 @@ export namespace SdkAliasCollection {
|
|
|
129
132
|
export const query =
|
|
130
133
|
(project: INestiaProject) =>
|
|
131
134
|
(importer: ImportDictionary) =>
|
|
132
|
-
(param: ITypedHttpRouteParameter.IQuery):
|
|
135
|
+
(param: ITypedHttpRouteParameter.IQuery): TypeNode => {
|
|
133
136
|
if (project.config.clone === true)
|
|
134
137
|
return from(project)(importer)(param.metadata);
|
|
135
|
-
const type:
|
|
138
|
+
const type: TypeNode = name(param);
|
|
136
139
|
if (project.config.primitive === false) return type;
|
|
137
|
-
return
|
|
140
|
+
return factory.createTypeReferenceNode(
|
|
138
141
|
importer.external({
|
|
139
142
|
file: "typia",
|
|
140
143
|
declaration: true,
|
|
@@ -148,18 +151,18 @@ export namespace SdkAliasCollection {
|
|
|
148
151
|
export const body =
|
|
149
152
|
(project: INestiaProject) =>
|
|
150
153
|
(importer: ImportDictionary) =>
|
|
151
|
-
(param: ITypedHttpRouteParameter.IBody):
|
|
154
|
+
(param: ITypedHttpRouteParameter.IBody): TypeNode => {
|
|
152
155
|
if (project.config.clone === true) {
|
|
153
|
-
const type:
|
|
156
|
+
const type: TypeNode = from(project)(importer)(param.metadata);
|
|
154
157
|
return param.contentType === "multipart/form-data"
|
|
155
158
|
? formDataInput(importer)(type)
|
|
156
159
|
: type;
|
|
157
160
|
}
|
|
158
|
-
const type:
|
|
161
|
+
const type: TypeNode = name(param);
|
|
159
162
|
if (param.contentType === "multipart/form-data")
|
|
160
163
|
return formDataInput(importer)(type);
|
|
161
164
|
else if (project.config.primitive === false) return type;
|
|
162
|
-
return
|
|
165
|
+
return factory.createTypeReferenceNode(
|
|
163
166
|
importer.external({
|
|
164
167
|
file: "typia",
|
|
165
168
|
declaration: true,
|
|
@@ -176,14 +179,17 @@ export namespace SdkAliasCollection {
|
|
|
176
179
|
export const response =
|
|
177
180
|
(project: INestiaProject) =>
|
|
178
181
|
(importer: ImportDictionary) =>
|
|
179
|
-
(route: ITypedHttpRoute):
|
|
180
|
-
const schema = (p: {
|
|
182
|
+
(route: ITypedHttpRoute): TypeNode => {
|
|
183
|
+
const schema = (p: {
|
|
184
|
+
metadata: MetadataSchema;
|
|
185
|
+
type: IReflectType;
|
|
186
|
+
}): TypeNode =>
|
|
181
187
|
sizeOf(p.metadata) === 0
|
|
182
188
|
? TypeFactory.keyword("void")
|
|
183
189
|
: project.config.clone === true
|
|
184
190
|
? from(project)(importer)(p.metadata)
|
|
185
191
|
: project.config.primitive !== false
|
|
186
|
-
?
|
|
192
|
+
? factory.createTypeReferenceNode(
|
|
187
193
|
importer.external({
|
|
188
194
|
file: "typia",
|
|
189
195
|
declaration: true,
|
|
@@ -197,7 +203,7 @@ export namespace SdkAliasCollection {
|
|
|
197
203
|
[name(p)],
|
|
198
204
|
)
|
|
199
205
|
: name(p);
|
|
200
|
-
const success:
|
|
206
|
+
const success: TypeNode =
|
|
201
207
|
route.success.binary === true
|
|
202
208
|
? binaryResponse()
|
|
203
209
|
: schema(route.success);
|
|
@@ -215,7 +221,7 @@ export namespace SdkAliasCollection {
|
|
|
215
221
|
type: schema(value),
|
|
216
222
|
})),
|
|
217
223
|
];
|
|
218
|
-
return
|
|
224
|
+
return factory.createTypeReferenceNode(
|
|
219
225
|
importer.external({
|
|
220
226
|
file: "@nestia/fetcher",
|
|
221
227
|
declaration: true,
|
|
@@ -223,11 +229,11 @@ export namespace SdkAliasCollection {
|
|
|
223
229
|
name: "IPropagation",
|
|
224
230
|
}),
|
|
225
231
|
[
|
|
226
|
-
|
|
232
|
+
factory.createTypeLiteralNode(
|
|
227
233
|
branches.map((b) =>
|
|
228
|
-
|
|
234
|
+
factory.createPropertySignature(
|
|
229
235
|
undefined,
|
|
230
|
-
|
|
236
|
+
factory.createNumericLiteral(b.status),
|
|
231
237
|
undefined,
|
|
232
238
|
b.type,
|
|
233
239
|
),
|
|
@@ -235,8 +241,8 @@ export namespace SdkAliasCollection {
|
|
|
235
241
|
),
|
|
236
242
|
...(route.success.status
|
|
237
243
|
? [
|
|
238
|
-
|
|
239
|
-
|
|
244
|
+
factory.createLiteralTypeNode(
|
|
245
|
+
factory.createNumericLiteral(route.success.status),
|
|
240
246
|
),
|
|
241
247
|
]
|
|
242
248
|
: []),
|
|
@@ -247,7 +253,7 @@ export namespace SdkAliasCollection {
|
|
|
247
253
|
export const responseBody =
|
|
248
254
|
(project: INestiaProject) =>
|
|
249
255
|
(importer: ImportDictionary) =>
|
|
250
|
-
(route: ITypedHttpRoute):
|
|
256
|
+
(route: ITypedHttpRoute): TypeNode =>
|
|
251
257
|
response({
|
|
252
258
|
...project,
|
|
253
259
|
config: {
|
|
@@ -256,8 +262,8 @@ export namespace SdkAliasCollection {
|
|
|
256
262
|
},
|
|
257
263
|
})(importer)(route);
|
|
258
264
|
|
|
259
|
-
const formDataInput = (importer: ImportDictionary) => (type:
|
|
260
|
-
|
|
265
|
+
const formDataInput = (importer: ImportDictionary) => (type: TypeNode) =>
|
|
266
|
+
factory.createTypeReferenceNode(
|
|
261
267
|
importer.external({
|
|
262
268
|
file: "@nestia/fetcher",
|
|
263
269
|
declaration: true,
|
|
@@ -270,5 +276,5 @@ export namespace SdkAliasCollection {
|
|
|
270
276
|
|
|
271
277
|
interface IBranch {
|
|
272
278
|
status: string;
|
|
273
|
-
type:
|
|
279
|
+
type: TypeNode;
|
|
274
280
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Node,
|
|
1
|
+
import { type Node, factory } from "@ttsc/factory";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
|
|
4
4
|
import { INestiaProject } from "../../structures/INestiaProject";
|
|
@@ -60,14 +60,11 @@ export namespace SdkFileProgrammer {
|
|
|
60
60
|
for (const [key, value] of directory.children) {
|
|
61
61
|
await iterate(project)(value)(`${outDir}/${key}`);
|
|
62
62
|
statements.push(
|
|
63
|
-
|
|
63
|
+
factory.createExportDeclaration(
|
|
64
64
|
undefined,
|
|
65
65
|
false,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
),
|
|
69
|
-
TypeScriptFactory.createStringLiteral(`./${key}/index`),
|
|
70
|
-
undefined,
|
|
66
|
+
factory.createNamespaceExport(factory.createIdentifier(key)),
|
|
67
|
+
factory.createStringLiteral(`./${key}/index`),
|
|
71
68
|
),
|
|
72
69
|
);
|
|
73
70
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Node, SyntaxKind,
|
|
1
|
+
import { type Node, SyntaxKind, type TypeNode, factory } from "@ttsc/factory";
|
|
2
|
+
import { IPointer } from "tstl";
|
|
3
|
+
import { IJsDocTagInfo } from "typia";
|
|
4
|
+
|
|
2
5
|
import {
|
|
3
6
|
MetadataAliasType,
|
|
4
7
|
MetadataAtomic,
|
|
5
8
|
MetadataObjectType,
|
|
6
9
|
} from "../../internal/legacy";
|
|
7
|
-
import { IPointer } from "tstl";
|
|
8
|
-
import { IJsDocTagInfo } from "typia";
|
|
9
|
-
|
|
10
10
|
import { INestiaProject } from "../../structures/INestiaProject";
|
|
11
11
|
import { ITypedApplication } from "../../structures/ITypedApplication";
|
|
12
12
|
import { MapUtil } from "../../utils/MapUtil";
|
|
@@ -19,9 +19,7 @@ export namespace SdkHttpCloneProgrammer {
|
|
|
19
19
|
export interface IModule {
|
|
20
20
|
name: string;
|
|
21
21
|
children: Map<string, IModule>;
|
|
22
|
-
programmer:
|
|
23
|
-
| null
|
|
24
|
-
| ((importer: ImportDictionary) => Node);
|
|
22
|
+
programmer: null | ((importer: ImportDictionary) => Node);
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
export const write = (app: ITypedApplication): Map<string, IModule> => {
|
|
@@ -71,11 +69,11 @@ export namespace SdkHttpCloneProgrammer {
|
|
|
71
69
|
(importer: ImportDictionary) =>
|
|
72
70
|
(alias: MetadataAliasType): Node =>
|
|
73
71
|
FilePrinter.description(
|
|
74
|
-
|
|
75
|
-
[
|
|
72
|
+
factory.createTypeAliasDeclaration(
|
|
73
|
+
[factory.createToken(SyntaxKind.ExportKeyword)],
|
|
76
74
|
alias.name.split(".").at(-1)!,
|
|
77
75
|
[],
|
|
78
|
-
SdkTypeProgrammer.write(project)(importer)(alias.value),
|
|
76
|
+
SdkTypeProgrammer.write(project)(importer)(alias.value) as TypeNode,
|
|
79
77
|
),
|
|
80
78
|
writeComment([])(alias.description, alias.jsDocTags),
|
|
81
79
|
);
|
|
@@ -85,11 +83,11 @@ export namespace SdkHttpCloneProgrammer {
|
|
|
85
83
|
(importer: ImportDictionary) =>
|
|
86
84
|
(object: MetadataObjectType): Node => {
|
|
87
85
|
return FilePrinter.description(
|
|
88
|
-
|
|
89
|
-
[
|
|
86
|
+
factory.createTypeAliasDeclaration(
|
|
87
|
+
[factory.createToken(SyntaxKind.ExportKeyword)],
|
|
90
88
|
object.name.split(".").at(-1)!,
|
|
91
89
|
[],
|
|
92
|
-
SdkTypeProgrammer.write_object(project)(importer)(object),
|
|
90
|
+
SdkTypeProgrammer.write_object(project)(importer)(object) as TypeNode,
|
|
93
91
|
),
|
|
94
92
|
writeComment([])(object.description ?? null, object.jsDocTags),
|
|
95
93
|
);
|