@nestia/sdk 0.2.0 → 1.0.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/config/nestia.config.ts +79 -70
- package/lib/INestiaConfig.d.ts +18 -14
- package/lib/executable/sdk.js +16 -16
- package/lib/generates/FunctionGenerator.js +9 -9
- package/lib/generates/FunctionGenerator.js.map +1 -1
- package/lib/generates/SwaggerGenerator.js +9 -9
- package/package.json +3 -3
- package/src/INestiaConfig.ts +124 -120
- package/src/NestiaSdkApplication.ts +183 -183
- package/src/analyses/ControllerAnalyzer.ts +203 -203
- package/src/analyses/GenericAnalyzer.ts +53 -53
- package/src/analyses/ImportAnalyzer.ts +143 -143
- package/src/analyses/PathAnalyzer.ts +58 -58
- package/src/analyses/ReflectAnalyzer.ts +279 -279
- package/src/analyses/SourceFinder.ts +59 -59
- package/src/executable/internal/CommandParser.ts +15 -15
- package/src/executable/internal/NestiaConfigCompilerOptions.ts +18 -18
- package/src/executable/internal/NestiaSdkCommand.ts +174 -174
- package/src/executable/internal/NestiaSdkConfig.ts +35 -35
- package/src/executable/internal/nestia.config.getter.ts +12 -12
- package/src/executable/sdk.ts +74 -74
- package/src/generates/FileGenerator.ts +156 -156
- package/src/generates/FunctionGenerator.ts +284 -287
- package/src/generates/SdkGenerator.ts +50 -50
- package/src/generates/SwaggerGenerator.ts +393 -393
- package/src/index.ts +3 -3
- package/src/module.ts +2 -2
- package/src/structures/IController.ts +27 -27
- package/src/structures/IRoute.ts +29 -29
- package/src/structures/ISwagger.ts +55 -55
- package/src/structures/ITypeTuple.ts +6 -6
- package/src/structures/MethodType.ts +11 -11
- package/src/structures/ParamCategory.ts +1 -1
- package/src/structures/TypeEntry.ts +22 -22
- package/src/utils/ArrayUtil.ts +26 -26
- package/src/utils/ImportDictionary.ts +56 -56
- package/src/utils/MapUtil.ts +14 -14
- package/src/utils/StripEnums.ts +10 -10
|
@@ -1,287 +1,284 @@
|
|
|
1
|
-
import { Vector } from "tstl/container/Vector";
|
|
2
|
-
import { Pair } from "tstl/utility/Pair";
|
|
3
|
-
import ts from "typescript";
|
|
4
|
-
import { Escaper } from "typia/lib/utils/Escaper";
|
|
5
|
-
|
|
6
|
-
import { INestiaConfig } from "../INestiaConfig";
|
|
7
|
-
import { IRoute } from "../structures/IRoute";
|
|
8
|
-
|
|
9
|
-
export namespace FunctionGenerator {
|
|
10
|
-
export function generate(config: INestiaConfig, route: IRoute): string {
|
|
11
|
-
const query: IRoute.IParameter | undefined = route.parameters.find(
|
|
12
|
-
(param) => param.category === "query" && param.field === undefined,
|
|
13
|
-
);
|
|
14
|
-
const input: IRoute.IParameter | undefined = route.parameters.find(
|
|
15
|
-
(param) => param.category === "body",
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
return [head, body, tail]
|
|
19
|
-
.map((closure) => closure(route, query, input, config))
|
|
20
|
-
.filter((str) => !!str)
|
|
21
|
-
.join("\n");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/* ---------------------------------------------------------
|
|
25
|
-
BODY
|
|
26
|
-
--------------------------------------------------------- */
|
|
27
|
-
function body(
|
|
28
|
-
route: IRoute,
|
|
29
|
-
query: IRoute.IParameter | undefined,
|
|
30
|
-
input: IRoute.IParameter | undefined,
|
|
31
|
-
config: INestiaConfig,
|
|
32
|
-
): string {
|
|
33
|
-
// FETCH ARGUMENTS WITH REQUST BODY
|
|
34
|
-
const parameters = filter_parameters(route, query);
|
|
35
|
-
const fetchArguments: string[] = [
|
|
36
|
-
"connection",
|
|
37
|
-
`${route.name}.ENCRYPTED`,
|
|
38
|
-
`${route.name}.METHOD`,
|
|
39
|
-
`${route.name}.path(${parameters.map((p) => p.name).join(", ")})`,
|
|
40
|
-
];
|
|
41
|
-
if (input !== undefined) {
|
|
42
|
-
fetchArguments.push(input.name);
|
|
43
|
-
if (config.json === true)
|
|
44
|
-
fetchArguments.push(`${route.name}.stringify`);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const assertions: string =
|
|
48
|
-
config.assert === true && route.parameters.length !== 0
|
|
49
|
-
? route.parameters
|
|
50
|
-
.map(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
.
|
|
98
|
-
.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
"" +
|
|
173
|
-
"
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
"
|
|
177
|
-
`
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
`
|
|
218
|
-
`
|
|
219
|
-
`
|
|
220
|
-
|
|
221
|
-
`
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
`
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
parameters
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
.join(`,\n${" ".repeat(12)}`);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
1
|
+
import { Vector } from "tstl/container/Vector";
|
|
2
|
+
import { Pair } from "tstl/utility/Pair";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
import { Escaper } from "typia/lib/utils/Escaper";
|
|
5
|
+
|
|
6
|
+
import { INestiaConfig } from "../INestiaConfig";
|
|
7
|
+
import { IRoute } from "../structures/IRoute";
|
|
8
|
+
|
|
9
|
+
export namespace FunctionGenerator {
|
|
10
|
+
export function generate(config: INestiaConfig, route: IRoute): string {
|
|
11
|
+
const query: IRoute.IParameter | undefined = route.parameters.find(
|
|
12
|
+
(param) => param.category === "query" && param.field === undefined,
|
|
13
|
+
);
|
|
14
|
+
const input: IRoute.IParameter | undefined = route.parameters.find(
|
|
15
|
+
(param) => param.category === "body",
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
return [head, body, tail]
|
|
19
|
+
.map((closure) => closure(route, query, input, config))
|
|
20
|
+
.filter((str) => !!str)
|
|
21
|
+
.join("\n");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* ---------------------------------------------------------
|
|
25
|
+
BODY
|
|
26
|
+
--------------------------------------------------------- */
|
|
27
|
+
function body(
|
|
28
|
+
route: IRoute,
|
|
29
|
+
query: IRoute.IParameter | undefined,
|
|
30
|
+
input: IRoute.IParameter | undefined,
|
|
31
|
+
config: INestiaConfig,
|
|
32
|
+
): string {
|
|
33
|
+
// FETCH ARGUMENTS WITH REQUST BODY
|
|
34
|
+
const parameters = filter_parameters(route, query);
|
|
35
|
+
const fetchArguments: string[] = [
|
|
36
|
+
"connection",
|
|
37
|
+
`${route.name}.ENCRYPTED`,
|
|
38
|
+
`${route.name}.METHOD`,
|
|
39
|
+
`${route.name}.path(${parameters.map((p) => p.name).join(", ")})`,
|
|
40
|
+
];
|
|
41
|
+
if (input !== undefined) {
|
|
42
|
+
fetchArguments.push(input.name);
|
|
43
|
+
if (config.json === true)
|
|
44
|
+
fetchArguments.push(`${route.name}.stringify`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const assertions: string =
|
|
48
|
+
config.assert === true && route.parameters.length !== 0
|
|
49
|
+
? route.parameters
|
|
50
|
+
.map((param) => ` typia.assert(${param.name});`)
|
|
51
|
+
.join("\n") + "\n\n"
|
|
52
|
+
: "";
|
|
53
|
+
|
|
54
|
+
// RETURNS WITH FINALIZATION
|
|
55
|
+
return (
|
|
56
|
+
"{\n" +
|
|
57
|
+
assertions +
|
|
58
|
+
" return Fetcher.fetch\n" +
|
|
59
|
+
" (\n" +
|
|
60
|
+
fetchArguments.map((param) => ` ${param}`).join(",\n") +
|
|
61
|
+
"\n" +
|
|
62
|
+
" );\n" +
|
|
63
|
+
"}"
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function filter_parameters(
|
|
68
|
+
route: IRoute,
|
|
69
|
+
query: IRoute.IParameter | undefined,
|
|
70
|
+
): IRoute.IParameter[] {
|
|
71
|
+
const parameters: IRoute.IParameter[] = route.parameters.filter(
|
|
72
|
+
(param) =>
|
|
73
|
+
param.category === "param" ||
|
|
74
|
+
(param.category === "query" && param.field !== undefined),
|
|
75
|
+
);
|
|
76
|
+
if (query) parameters.push(query);
|
|
77
|
+
return parameters;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* ---------------------------------------------------------
|
|
81
|
+
HEAD & TAIL
|
|
82
|
+
--------------------------------------------------------- */
|
|
83
|
+
function head(
|
|
84
|
+
route: IRoute,
|
|
85
|
+
query: IRoute.IParameter | undefined,
|
|
86
|
+
input: IRoute.IParameter | undefined,
|
|
87
|
+
config: INestiaConfig,
|
|
88
|
+
): string {
|
|
89
|
+
//----
|
|
90
|
+
// CONSTRUCT COMMENT
|
|
91
|
+
//----
|
|
92
|
+
// MAIN DESCRIPTION
|
|
93
|
+
const comments: string[] = route.comments
|
|
94
|
+
.map((part) => `${part.kind === "linkText" ? " " : ""}${part.text}`)
|
|
95
|
+
.map((str) => str.split("\r\n").join("\n"))
|
|
96
|
+
.join("")
|
|
97
|
+
.split("\n")
|
|
98
|
+
.filter((str, i, array) => str !== "" || i !== array.length - 1);
|
|
99
|
+
if (comments.length) comments.push("");
|
|
100
|
+
|
|
101
|
+
// FILTER TAGS (VULNERABLE PARAMETERS WOULD BE REMOVED)
|
|
102
|
+
const tagList: ts.JSDocTagInfo[] = route.tags.filter(
|
|
103
|
+
(tag) => tag.text !== undefined,
|
|
104
|
+
);
|
|
105
|
+
if (tagList.length !== 0) {
|
|
106
|
+
const index: number = tagList.findIndex((t) => t.name === "param");
|
|
107
|
+
if (index !== -1) {
|
|
108
|
+
const capsule: Vector<ts.JSDocTagInfo> = Vector.wrap(tagList);
|
|
109
|
+
capsule.insert(capsule.nth(index), {
|
|
110
|
+
name: "param",
|
|
111
|
+
text: [
|
|
112
|
+
{
|
|
113
|
+
kind: "parameterName",
|
|
114
|
+
text: "connection",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
kind: "space",
|
|
118
|
+
text: " ",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
kind: "text",
|
|
122
|
+
text: "connection Information of the remote HTTP(s) server with headers (+encryption password)",
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
comments.push(
|
|
128
|
+
...tagList.map(
|
|
129
|
+
(tag) =>
|
|
130
|
+
`@${tag.name} ${tag
|
|
131
|
+
.text!.map((elem) => elem.text)
|
|
132
|
+
.join("")}`,
|
|
133
|
+
),
|
|
134
|
+
"",
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// COMPLETE THE COMMENT
|
|
139
|
+
comments.push(
|
|
140
|
+
`@controller ${route.symbol}`,
|
|
141
|
+
`@path ${route.method} ${route.path}`,
|
|
142
|
+
`@nestia Generated by Nestia - https://github.com/samchon/nestia`,
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
//----
|
|
146
|
+
// FINALIZATION
|
|
147
|
+
//----
|
|
148
|
+
// REFORM PARAMETERS TEXT
|
|
149
|
+
const parameters: string[] = [
|
|
150
|
+
"connection: IConnection",
|
|
151
|
+
...route.parameters.map((param) => {
|
|
152
|
+
const type: string =
|
|
153
|
+
config.primitive !== false &&
|
|
154
|
+
(param === query || param === input)
|
|
155
|
+
? `Primitive<${route.name}.${
|
|
156
|
+
param === query ? "Query" : "Input"
|
|
157
|
+
}>`
|
|
158
|
+
: param.type.name;
|
|
159
|
+
return `${param.name}: ${type}`;
|
|
160
|
+
}),
|
|
161
|
+
];
|
|
162
|
+
|
|
163
|
+
// OUTPUT TYPE
|
|
164
|
+
const output: string =
|
|
165
|
+
route.output.name === "void" ? "void" : `${route.name}.Output`;
|
|
166
|
+
|
|
167
|
+
// RETURNS WITH CONSTRUCTION
|
|
168
|
+
return (
|
|
169
|
+
"" +
|
|
170
|
+
"/**\n" +
|
|
171
|
+
comments.map((str) => ` * ${str}`).join("\n") +
|
|
172
|
+
"\n" +
|
|
173
|
+
" */\n" +
|
|
174
|
+
`export function ${route.name}\n` +
|
|
175
|
+
` (\n` +
|
|
176
|
+
`${parameters.map((str) => ` ${str}`).join(",\n")}\n` +
|
|
177
|
+
` ): Promise<${output}>`
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function tail(
|
|
182
|
+
route: IRoute,
|
|
183
|
+
query: IRoute.IParameter | undefined,
|
|
184
|
+
input: IRoute.IParameter | undefined,
|
|
185
|
+
config: INestiaConfig,
|
|
186
|
+
): string | null {
|
|
187
|
+
// LIST UP TYPES
|
|
188
|
+
const types: Pair<string, string>[] = [];
|
|
189
|
+
if (query !== undefined) types.push(new Pair("Query", query.type.name));
|
|
190
|
+
if (input !== undefined) types.push(new Pair("Input", input.type.name));
|
|
191
|
+
if (route.output.name !== "void")
|
|
192
|
+
types.push(new Pair("Output", route.output.name));
|
|
193
|
+
|
|
194
|
+
// PATH WITH PARAMETERS
|
|
195
|
+
const parameters: IRoute.IParameter[] = filter_parameters(route, query);
|
|
196
|
+
const path: string = compute_path(query, parameters, route.path);
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
`export namespace ${route.name}\n` +
|
|
200
|
+
"{\n" +
|
|
201
|
+
(types.length !== 0
|
|
202
|
+
? types
|
|
203
|
+
.map(
|
|
204
|
+
(tuple) =>
|
|
205
|
+
` export type ${tuple.first} = ${
|
|
206
|
+
config.primitive !== false
|
|
207
|
+
? `Primitive<${tuple.second}>`
|
|
208
|
+
: tuple.second
|
|
209
|
+
};`,
|
|
210
|
+
)
|
|
211
|
+
.join("\n") + "\n"
|
|
212
|
+
: "") +
|
|
213
|
+
"\n" +
|
|
214
|
+
` export const METHOD = "${route.method}" as const;\n` +
|
|
215
|
+
` export const PATH: string = "${route.path}";\n` +
|
|
216
|
+
` export const ENCRYPTED: Fetcher.IEncrypted = {\n` +
|
|
217
|
+
` request: ${input !== undefined && input.encrypted},\n` +
|
|
218
|
+
` response: ${route.encrypted},\n` +
|
|
219
|
+
` };\n` +
|
|
220
|
+
"\n" +
|
|
221
|
+
` export function path(${parameters
|
|
222
|
+
.map((param) => `${param.name}: ${param.type.name}`)
|
|
223
|
+
.join(", ")}): string\n` +
|
|
224
|
+
` {\n` +
|
|
225
|
+
` return ${path};\n` +
|
|
226
|
+
` }\n` +
|
|
227
|
+
(config.json === true &&
|
|
228
|
+
(route.method === "POST" ||
|
|
229
|
+
route.method === "PUT" ||
|
|
230
|
+
route.method === "PATCH")
|
|
231
|
+
? ` export const stringify = typia.createAssertStringify<Input>();\n`
|
|
232
|
+
: "") +
|
|
233
|
+
"}"
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function compute_path(
|
|
238
|
+
query: IRoute.IParameter | undefined,
|
|
239
|
+
parameters: IRoute.IParameter[],
|
|
240
|
+
path: string,
|
|
241
|
+
): string {
|
|
242
|
+
for (const param of parameters)
|
|
243
|
+
if (param.category === "param")
|
|
244
|
+
path = path.replace(
|
|
245
|
+
`:${param.field}`,
|
|
246
|
+
`\${encodeURIComponent(${param.name})}`,
|
|
247
|
+
);
|
|
248
|
+
const queryParams: IRoute.IParameter[] = parameters.filter(
|
|
249
|
+
(param) => param.category === "query" && param.field !== undefined,
|
|
250
|
+
);
|
|
251
|
+
if (query === undefined && queryParams.length === 0)
|
|
252
|
+
return `\`${path}\``;
|
|
253
|
+
|
|
254
|
+
const wrapper = (str: string) =>
|
|
255
|
+
`\`${path}?\${new URLSearchParams(${str}).toString()}\``;
|
|
256
|
+
if (query !== undefined && queryParams.length === 0)
|
|
257
|
+
return wrapper(`${query.name} as any`);
|
|
258
|
+
else if (query === undefined)
|
|
259
|
+
return wrapper(`
|
|
260
|
+
{
|
|
261
|
+
${rest_query_parameters(queryParams)}
|
|
262
|
+
} as any`);
|
|
263
|
+
|
|
264
|
+
return wrapper(`
|
|
265
|
+
{
|
|
266
|
+
...${query.name},
|
|
267
|
+
${rest_query_parameters(queryParams)},
|
|
268
|
+
} as any`);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function rest_query_parameters(parameters: IRoute.IParameter[]): string {
|
|
272
|
+
return parameters
|
|
273
|
+
.map((param) =>
|
|
274
|
+
param.name === param.field
|
|
275
|
+
? param.name
|
|
276
|
+
: `${
|
|
277
|
+
Escaper.variable(param.field!)
|
|
278
|
+
? param.field
|
|
279
|
+
: JSON.stringify(param.field)
|
|
280
|
+
}: ${param.name}`,
|
|
281
|
+
)
|
|
282
|
+
.join(`,\n${" ".repeat(12)}`);
|
|
283
|
+
}
|
|
284
|
+
}
|