@nestia/sdk 7.0.0-dev.20250606 → 7.0.0-dev.20250608
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/lib/analyses/TypedHttpRouteAnalyzer.js +12 -3
- package/lib/analyses/TypedHttpRouteAnalyzer.js.map +1 -1
- package/lib/analyses/TypedWebSocketRouteAnalyzer.js +4 -1
- package/lib/analyses/TypedWebSocketRouteAnalyzer.js.map +1 -1
- package/lib/generates/SdkGenerator.js +2 -1
- package/lib/generates/SdkGenerator.js.map +1 -1
- package/lib/generates/SwaggerGenerator.js +3 -3
- package/lib/generates/SwaggerGenerator.js.map +1 -1
- package/lib/generates/internal/E2eFileProgrammer.js +17 -22
- package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkAliasCollection.d.ts +3 -1
- package/lib/generates/internal/SdkAliasCollection.js +23 -12
- package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
- package/lib/generates/internal/SdkFileProgrammer.js +1 -1
- package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneReferencer.js +2 -1
- package/lib/generates/internal/SdkHttpCloneReferencer.js.map +1 -1
- package/lib/generates/internal/SdkHttpFunctionProgrammer.d.ts +1 -6
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js +33 -48
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +1 -6
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +46 -66
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpParameterProgrammer.d.ts +41 -0
- package/lib/generates/internal/SdkHttpParameterProgrammer.js +110 -0
- package/lib/generates/internal/SdkHttpParameterProgrammer.js.map +1 -0
- package/lib/generates/internal/SdkHttpRouteProgrammer.js +6 -18
- package/lib/generates/internal/SdkHttpRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +1 -6
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js +23 -34
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.d.ts +2 -1
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +33 -27
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.d.ts +22 -0
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js +58 -0
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js.map +1 -0
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +2 -1
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +65 -51
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationComposer.js +9 -6
- package/lib/generates/internal/SwaggerOperationComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationParameterComposer.d.ts +1 -1
- package/lib/generates/internal/SwaggerOperationParameterComposer.js.map +1 -1
- package/lib/structures/ITypedHttpRoute.d.ts +6 -1
- package/lib/structures/ITypedHttpRouteParameter.d.ts +2 -2
- package/lib/structures/ITypedWebSocketRoute.d.ts +5 -1
- package/package.json +5 -5
- package/src/analyses/TypedHttpRouteAnalyzer.ts +28 -10
- package/src/analyses/TypedWebSocketRouteAnalyzer.ts +15 -0
- package/src/generates/SdkGenerator.ts +2 -1
- package/src/generates/SwaggerGenerator.ts +5 -13
- package/src/generates/internal/E2eFileProgrammer.ts +34 -43
- package/src/generates/internal/SdkAliasCollection.ts +46 -17
- package/src/generates/internal/SdkFileProgrammer.ts +1 -1
- package/src/generates/internal/SdkHttpCloneReferencer.ts +5 -1
- package/src/generates/internal/SdkHttpFunctionProgrammer.ts +49 -109
- package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +58 -118
- package/src/generates/internal/SdkHttpParameterProgrammer.ts +178 -0
- package/src/generates/internal/SdkHttpRouteProgrammer.ts +9 -21
- package/src/generates/internal/SdkHttpSimulationProgrammer.ts +23 -77
- package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +214 -210
- package/src/generates/internal/SdkWebSocketParameterProgrammer.ts +87 -0
- package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +112 -98
- package/src/generates/internal/SwaggerOperationComposer.ts +9 -9
- package/src/generates/internal/SwaggerOperationParameterComposer.ts +1 -1
- package/src/structures/ITypedHttpRoute.ts +12 -1
- package/src/structures/ITypedHttpRouteParameter.ts +2 -2
- package/src/structures/ITypedWebSocketRoute.ts +5 -1
|
@@ -6,8 +6,10 @@ import { INestiaProject } from "../../structures/INestiaProject";
|
|
|
6
6
|
import { IReflectType } from "../../structures/IReflectType";
|
|
7
7
|
import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
|
|
8
8
|
import { ITypedHttpRouteParameter } from "../../structures/ITypedHttpRouteParameter";
|
|
9
|
+
import { ITypedWebSocketRoute } from "../../structures/ITypedWebSocketRoute";
|
|
9
10
|
import { FilePrinter } from "./FilePrinter";
|
|
10
11
|
import { ImportDictionary } from "./ImportDictionary";
|
|
12
|
+
import { SdkHttpParameterProgrammer } from "./SdkHttpParameterProgrammer";
|
|
11
13
|
import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
|
|
12
14
|
|
|
13
15
|
export namespace SdkAliasCollection {
|
|
@@ -25,37 +27,36 @@ export namespace SdkAliasCollection {
|
|
|
25
27
|
(metadata: Metadata) =>
|
|
26
28
|
SdkTypeProgrammer.write(project)(importer)(metadata);
|
|
27
29
|
|
|
28
|
-
export const
|
|
30
|
+
export const httpProps =
|
|
29
31
|
(project: INestiaProject) =>
|
|
30
32
|
(importer: ImportDictionary) =>
|
|
31
33
|
(route: ITypedHttpRoute): ts.TypeNode =>
|
|
32
34
|
ts.factory.createTypeLiteralNode(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
SdkHttpParameterProgrammer.getEntries({
|
|
36
|
+
project,
|
|
37
|
+
importer,
|
|
38
|
+
route,
|
|
39
|
+
body: true,
|
|
40
|
+
prefix: false,
|
|
41
|
+
})
|
|
42
|
+
.map((e) => {
|
|
36
43
|
const signature: ts.PropertySignature =
|
|
37
44
|
ts.factory.createPropertySignature(
|
|
38
45
|
undefined,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
?
|
|
42
|
-
:
|
|
43
|
-
|
|
44
|
-
? ts.factory.createTypeReferenceNode("Body")
|
|
45
|
-
: param.category === "query" && param.field === null
|
|
46
|
-
? ts.factory.createTypeReferenceNode("Query")
|
|
47
|
-
: SdkTypeProgrammer.write(project)(importer)(
|
|
48
|
-
param.metadata,
|
|
49
|
-
),
|
|
46
|
+
e.key,
|
|
47
|
+
e.required
|
|
48
|
+
? undefined
|
|
49
|
+
: ts.factory.createToken(ts.SyntaxKind.QuestionToken),
|
|
50
|
+
e.type,
|
|
50
51
|
);
|
|
51
52
|
const description: string | null =
|
|
52
|
-
|
|
53
|
+
e.parameter.description ??
|
|
53
54
|
route.jsDocTags
|
|
54
55
|
?.find(
|
|
55
56
|
(tag) =>
|
|
56
57
|
tag.name === "param" &&
|
|
57
58
|
tag.text?.[0]?.kind === "parameterName" &&
|
|
58
|
-
tag.text?.[0]?.text ===
|
|
59
|
+
tag.text?.[0]?.text === e.key,
|
|
59
60
|
)
|
|
60
61
|
?.text?.find((t) => t.kind === "text")?.text ??
|
|
61
62
|
null;
|
|
@@ -69,6 +70,34 @@ export namespace SdkAliasCollection {
|
|
|
69
70
|
.flat(),
|
|
70
71
|
);
|
|
71
72
|
|
|
73
|
+
export const websocketProps = (route: ITypedWebSocketRoute): ts.TypeNode =>
|
|
74
|
+
ts.factory.createTypeLiteralNode([
|
|
75
|
+
...route.pathParameters.map((p) =>
|
|
76
|
+
ts.factory.createPropertySignature(
|
|
77
|
+
undefined,
|
|
78
|
+
p.name,
|
|
79
|
+
undefined,
|
|
80
|
+
SdkAliasCollection.name(p),
|
|
81
|
+
),
|
|
82
|
+
),
|
|
83
|
+
...(route.query
|
|
84
|
+
? [
|
|
85
|
+
ts.factory.createPropertySignature(
|
|
86
|
+
undefined,
|
|
87
|
+
"query",
|
|
88
|
+
undefined,
|
|
89
|
+
ts.factory.createTypeReferenceNode("Query"),
|
|
90
|
+
),
|
|
91
|
+
]
|
|
92
|
+
: []),
|
|
93
|
+
ts.factory.createPropertySignature(
|
|
94
|
+
undefined,
|
|
95
|
+
"provider",
|
|
96
|
+
undefined,
|
|
97
|
+
ts.factory.createTypeReferenceNode("Provider"),
|
|
98
|
+
),
|
|
99
|
+
]);
|
|
100
|
+
|
|
72
101
|
export const headers =
|
|
73
102
|
(project: INestiaProject) =>
|
|
74
103
|
(importer: ImportDictionary) =>
|
|
@@ -86,7 +86,7 @@ export namespace SdkFileProgrammer {
|
|
|
86
86
|
statements.push(
|
|
87
87
|
...(route.protocol === "http"
|
|
88
88
|
? SdkHttpRouteProgrammer.write(project)(importer)(route)
|
|
89
|
-
: SdkWebSocketRouteProgrammer.write(importer)(route)),
|
|
89
|
+
: SdkWebSocketRouteProgrammer.write(project)(importer)(route)),
|
|
90
90
|
);
|
|
91
91
|
if (i !== directory.routes.length - 1)
|
|
92
92
|
statements.push(FilePrinter.enter());
|
|
@@ -4,6 +4,7 @@ import { IReflectType } from "../../structures/IReflectType";
|
|
|
4
4
|
import { ITypedApplication } from "../../structures/ITypedApplication";
|
|
5
5
|
import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
|
|
6
6
|
import { StringUtil } from "../../utils/StringUtil";
|
|
7
|
+
import { SdkHttpParameterProgrammer } from "./SdkHttpParameterProgrammer";
|
|
7
8
|
|
|
8
9
|
export namespace SdkHttpCloneReferencer {
|
|
9
10
|
export const replace = (app: ITypedApplication): void => {
|
|
@@ -21,7 +22,10 @@ export namespace SdkHttpCloneReferencer {
|
|
|
21
22
|
route: ITypedHttpRoute;
|
|
22
23
|
}): void => {
|
|
23
24
|
const unique: Set<string> = new Set();
|
|
24
|
-
for (const p of
|
|
25
|
+
for (const p of SdkHttpParameterProgrammer.getSignificant(
|
|
26
|
+
props.route,
|
|
27
|
+
true,
|
|
28
|
+
))
|
|
25
29
|
visitType({
|
|
26
30
|
unique,
|
|
27
31
|
metadata: p.metadata,
|
|
@@ -4,44 +4,17 @@ import { TypeFactory } from "typia/lib/factories/TypeFactory";
|
|
|
4
4
|
|
|
5
5
|
import { INestiaProject } from "../../structures/INestiaProject";
|
|
6
6
|
import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
|
|
7
|
-
import { ITypedHttpRouteParameter } from "../../structures/ITypedHttpRouteParameter";
|
|
8
7
|
import { StringUtil } from "../../utils/StringUtil";
|
|
9
8
|
import { ImportDictionary } from "./ImportDictionary";
|
|
10
9
|
import { SdkAliasCollection } from "./SdkAliasCollection";
|
|
10
|
+
import { SdkHttpParameterProgrammer } from "./SdkHttpParameterProgrammer";
|
|
11
11
|
import { SdkImportWizard } from "./SdkImportWizard";
|
|
12
12
|
|
|
13
13
|
export namespace SdkHttpFunctionProgrammer {
|
|
14
14
|
export const write =
|
|
15
15
|
(project: INestiaProject) =>
|
|
16
16
|
(importer: ImportDictionary) =>
|
|
17
|
-
(
|
|
18
|
-
route: ITypedHttpRoute,
|
|
19
|
-
props: {
|
|
20
|
-
headers: ITypedHttpRouteParameter.IHeaders | undefined;
|
|
21
|
-
query: ITypedHttpRouteParameter.IQuery | undefined;
|
|
22
|
-
body: ITypedHttpRouteParameter.IBody | undefined;
|
|
23
|
-
},
|
|
24
|
-
): ts.FunctionDeclaration => {
|
|
25
|
-
interface IProperty {
|
|
26
|
-
key: string;
|
|
27
|
-
type: ts.TypeNode;
|
|
28
|
-
optional: boolean;
|
|
29
|
-
}
|
|
30
|
-
const properties: IProperty[] = route.parameters
|
|
31
|
-
.filter((p) => p.category !== "headers")
|
|
32
|
-
.map((p) => ({
|
|
33
|
-
key: p.name,
|
|
34
|
-
type:
|
|
35
|
-
project.config.primitive !== false &&
|
|
36
|
-
(p === props.query || p === props.body)
|
|
37
|
-
? ts.factory.createTypeReferenceNode(
|
|
38
|
-
`${route.name}.${p === props.query ? "Query" : "Body"}`,
|
|
39
|
-
)
|
|
40
|
-
: project.config.clone === true
|
|
41
|
-
? SdkAliasCollection.from(project)(importer)(p.metadata)
|
|
42
|
-
: SdkAliasCollection.name(p),
|
|
43
|
-
optional: p.metadata.optional,
|
|
44
|
-
}));
|
|
17
|
+
(route: ITypedHttpRoute): ts.FunctionDeclaration => {
|
|
45
18
|
return ts.factory.createFunctionDeclaration(
|
|
46
19
|
[
|
|
47
20
|
ts.factory.createModifier(ts.SyntaxKind.ExportKeyword),
|
|
@@ -55,58 +28,34 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
55
28
|
"connection",
|
|
56
29
|
ts.factory.createTypeReferenceNode(
|
|
57
30
|
SdkImportWizard.IConnection(importer),
|
|
58
|
-
|
|
31
|
+
route.headerObject !== null
|
|
59
32
|
? [ts.factory.createTypeReferenceNode(`${route.name}.Headers`)]
|
|
60
33
|
: undefined,
|
|
61
34
|
),
|
|
62
35
|
),
|
|
63
|
-
...(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
ts.factory.createTypeReferenceNode(`${route.name}.IProps`),
|
|
71
|
-
),
|
|
72
|
-
]
|
|
73
|
-
: properties.map((p) =>
|
|
74
|
-
ts.factory.createParameterDeclaration(
|
|
75
|
-
[],
|
|
76
|
-
undefined,
|
|
77
|
-
p.key,
|
|
78
|
-
p.optional === true
|
|
79
|
-
? ts.factory.createToken(ts.SyntaxKind.QuestionToken)
|
|
80
|
-
: undefined,
|
|
81
|
-
p.type,
|
|
82
|
-
),
|
|
83
|
-
)),
|
|
36
|
+
...SdkHttpParameterProgrammer.getParameterDeclarations({
|
|
37
|
+
project,
|
|
38
|
+
importer,
|
|
39
|
+
route,
|
|
40
|
+
body: true,
|
|
41
|
+
prefix: true,
|
|
42
|
+
}),
|
|
84
43
|
],
|
|
85
44
|
ts.factory.createTypeReferenceNode("Promise", [
|
|
86
45
|
project.config.propagate === true ||
|
|
87
46
|
route.success.metadata.size() !== 0
|
|
88
|
-
? ts.factory.createTypeReferenceNode(`${route.name}.
|
|
47
|
+
? ts.factory.createTypeReferenceNode(`${route.name}.Output`)
|
|
89
48
|
: ts.factory.createTypeReferenceNode("void"),
|
|
90
49
|
]),
|
|
91
|
-
ts.factory.createBlock(
|
|
92
|
-
writeBody(project)(importer)(route, props),
|
|
93
|
-
true,
|
|
94
|
-
),
|
|
50
|
+
ts.factory.createBlock(writeBody(project)(importer)(route), true),
|
|
95
51
|
);
|
|
96
52
|
};
|
|
97
53
|
|
|
98
54
|
const writeBody =
|
|
99
55
|
(project: INestiaProject) =>
|
|
100
56
|
(importer: ImportDictionary) =>
|
|
101
|
-
(
|
|
102
|
-
|
|
103
|
-
props: {
|
|
104
|
-
headers: ITypedHttpRouteParameter.IHeaders | undefined;
|
|
105
|
-
query: ITypedHttpRouteParameter.IQuery | undefined;
|
|
106
|
-
body: ITypedHttpRouteParameter.IBody | undefined;
|
|
107
|
-
},
|
|
108
|
-
): ts.Statement[] => {
|
|
109
|
-
const property = (name: string): ts.Expression =>
|
|
57
|
+
(route: ITypedHttpRoute): ts.Statement[] => {
|
|
58
|
+
const access = (name: string): ts.Expression =>
|
|
110
59
|
project.config.keyword === true
|
|
111
60
|
? IdentifierFactory.access(ts.factory.createIdentifier("props"), name)
|
|
112
61
|
: ts.factory.createIdentifier(name);
|
|
@@ -115,7 +64,7 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
115
64
|
IdentifierFactory.access(
|
|
116
65
|
ts.factory.createIdentifier(
|
|
117
66
|
SdkImportWizard.Fetcher(
|
|
118
|
-
!!
|
|
67
|
+
!!route.body?.encrypted || route.success.encrypted,
|
|
119
68
|
)(importer),
|
|
120
69
|
),
|
|
121
70
|
project.config.propagate ? "propagate" : "fetch",
|
|
@@ -127,7 +76,7 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
127
76
|
: [TypeFactory.keyword("any"), TypeFactory.keyword("any")]
|
|
128
77
|
: undefined,
|
|
129
78
|
[
|
|
130
|
-
|
|
79
|
+
route.body && route.body.contentType !== "multipart/form-data"
|
|
131
80
|
? ts.factory.createObjectLiteralExpression(
|
|
132
81
|
[
|
|
133
82
|
ts.factory.createSpreadAssignment(
|
|
@@ -146,7 +95,7 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
146
95
|
ts.factory.createPropertyAssignment(
|
|
147
96
|
ts.factory.createStringLiteral("Content-Type"),
|
|
148
97
|
ts.factory.createStringLiteral(
|
|
149
|
-
|
|
98
|
+
route.body?.contentType ?? "application/json",
|
|
150
99
|
),
|
|
151
100
|
),
|
|
152
101
|
],
|
|
@@ -183,17 +132,21 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
183
132
|
"path",
|
|
184
133
|
),
|
|
185
134
|
undefined,
|
|
186
|
-
getArguments(
|
|
135
|
+
SdkHttpParameterProgrammer.getArguments({
|
|
136
|
+
project,
|
|
137
|
+
route,
|
|
138
|
+
body: false,
|
|
139
|
+
}),
|
|
187
140
|
),
|
|
188
141
|
),
|
|
189
142
|
],
|
|
190
143
|
true,
|
|
191
144
|
),
|
|
192
|
-
...(
|
|
145
|
+
...(route.body ? [access(route.body.name)] : []),
|
|
193
146
|
...(project.config.json &&
|
|
194
|
-
|
|
195
|
-
(
|
|
196
|
-
|
|
147
|
+
route.body !== null &&
|
|
148
|
+
(route.body.contentType === "application/json" ||
|
|
149
|
+
route.body.encrypted === true)
|
|
197
150
|
? [ts.factory.createIdentifier(`${route.name}.stringify`)]
|
|
198
151
|
: []),
|
|
199
152
|
],
|
|
@@ -208,7 +161,11 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
208
161
|
[],
|
|
209
162
|
[
|
|
210
163
|
ts.factory.createIdentifier("connection"),
|
|
211
|
-
...getArguments(
|
|
164
|
+
...SdkHttpParameterProgrammer.getArguments({
|
|
165
|
+
project,
|
|
166
|
+
route,
|
|
167
|
+
body: true,
|
|
168
|
+
}),
|
|
212
169
|
],
|
|
213
170
|
),
|
|
214
171
|
undefined,
|
|
@@ -219,26 +176,24 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
219
176
|
: fetch();
|
|
220
177
|
return [
|
|
221
178
|
...(project.config.assert
|
|
222
|
-
? route.
|
|
223
|
-
.
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
ts.factory.createIdentifier(
|
|
229
|
-
SdkImportWizard.typia(importer),
|
|
230
|
-
),
|
|
231
|
-
"assert",
|
|
179
|
+
? SdkHttpParameterProgrammer.getSignificant(route, true).map((p) =>
|
|
180
|
+
ts.factory.createExpressionStatement(
|
|
181
|
+
ts.factory.createCallExpression(
|
|
182
|
+
IdentifierFactory.access(
|
|
183
|
+
ts.factory.createIdentifier(
|
|
184
|
+
SdkImportWizard.typia(importer),
|
|
232
185
|
),
|
|
233
|
-
|
|
234
|
-
ts.factory.createTypeQueryNode(
|
|
235
|
-
ts.factory.createIdentifier(p.name),
|
|
236
|
-
),
|
|
237
|
-
],
|
|
238
|
-
[ts.factory.createIdentifier(p.name)],
|
|
186
|
+
"assert",
|
|
239
187
|
),
|
|
188
|
+
[
|
|
189
|
+
ts.factory.createTypeQueryNode(
|
|
190
|
+
ts.factory.createIdentifier(p.name),
|
|
191
|
+
),
|
|
192
|
+
],
|
|
193
|
+
[ts.factory.createIdentifier(p.name)],
|
|
240
194
|
),
|
|
241
|
-
)
|
|
195
|
+
),
|
|
196
|
+
)
|
|
242
197
|
: []),
|
|
243
198
|
...(route.success.setHeaders.length === 0
|
|
244
199
|
? [ts.factory.createReturnStatement(output(false))]
|
|
@@ -255,7 +210,9 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
255
210
|
x[0] === "[" ? `${x}${y}` : `${x}.${y}`;
|
|
256
211
|
const output: string = StringUtil.escapeDuplicate([
|
|
257
212
|
"connection",
|
|
258
|
-
...route.
|
|
213
|
+
...SdkHttpParameterProgrammer.getSignificant(route, true).map(
|
|
214
|
+
(p) => p.name,
|
|
215
|
+
),
|
|
259
216
|
])("output");
|
|
260
217
|
const headers: string = accessor("connection")("headers");
|
|
261
218
|
const data: string = project.config.propagate
|
|
@@ -316,21 +273,4 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
316
273
|
ts.factory.createReturnStatement(ts.factory.createIdentifier(output)),
|
|
317
274
|
];
|
|
318
275
|
};
|
|
319
|
-
|
|
320
|
-
const getArguments = (
|
|
321
|
-
project: INestiaProject,
|
|
322
|
-
route: ITypedHttpRoute,
|
|
323
|
-
body: boolean,
|
|
324
|
-
): ts.Expression[] => {
|
|
325
|
-
const parameters = route.parameters.filter(
|
|
326
|
-
(p) =>
|
|
327
|
-
p.category === "param" ||
|
|
328
|
-
p.category === "query" ||
|
|
329
|
-
(body === true && p.category === "body"),
|
|
330
|
-
);
|
|
331
|
-
if (parameters.length === 0) return [];
|
|
332
|
-
else if (project.config.keyword === true)
|
|
333
|
-
return [ts.factory.createIdentifier("props")];
|
|
334
|
-
return parameters.map((p) => ts.factory.createIdentifier(p.name));
|
|
335
|
-
};
|
|
336
276
|
}
|