@nestia/sdk 11.0.0-dev.20260316 → 11.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.
Files changed (65) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +93 -93
  3. package/assets/bundle/api/HttpError.ts +1 -1
  4. package/assets/bundle/api/IConnection.ts +1 -1
  5. package/assets/bundle/api/Primitive.ts +1 -1
  6. package/assets/bundle/api/Resolved.ts +1 -1
  7. package/assets/bundle/api/index.ts +4 -4
  8. package/assets/bundle/api/module.ts +6 -6
  9. package/assets/bundle/distribute/README.md +37 -37
  10. package/assets/bundle/distribute/package.json +28 -28
  11. package/assets/bundle/distribute/tsconfig.json +109 -109
  12. package/assets/bundle/e2e/index.ts +42 -42
  13. package/assets/config/nestia.config.ts +97 -97
  14. package/lib/executable/internal/NestiaConfigLoader.js +5 -5
  15. package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
  16. package/package.json +8 -8
  17. package/src/INestiaConfig.ts +267 -267
  18. package/src/NestiaSdkApplication.ts +307 -307
  19. package/src/NestiaSwaggerComposer.ts +143 -143
  20. package/src/analyses/AccessorAnalyzer.ts +67 -67
  21. package/src/analyses/DtoAnalyzer.ts +260 -260
  22. package/src/analyses/ImportAnalyzer.ts +126 -126
  23. package/src/analyses/ReflectHttpOperationAnalyzer.ts +183 -183
  24. package/src/analyses/ReflectHttpOperationExceptionAnalyzer.ts +72 -72
  25. package/src/analyses/ReflectHttpOperationParameterAnalyzer.ts +350 -350
  26. package/src/analyses/ReflectHttpOperationResponseAnalyzer.ts +126 -126
  27. package/src/analyses/TypedHttpRouteAnalyzer.ts +208 -208
  28. package/src/executable/internal/NestiaConfigLoader.ts +85 -85
  29. package/src/executable/internal/NestiaSdkCommand.ts +107 -107
  30. package/src/generates/SwaggerGenerator.ts +291 -291
  31. package/src/generates/internal/E2eFileProgrammer.ts +196 -196
  32. package/src/generates/internal/FilePrinter.ts +64 -64
  33. package/src/generates/internal/ImportDictionary.ts +192 -192
  34. package/src/generates/internal/SdkAliasCollection.ts +260 -260
  35. package/src/generates/internal/SdkFileProgrammer.ts +110 -110
  36. package/src/generates/internal/SdkHttpCloneProgrammer.ts +126 -126
  37. package/src/generates/internal/SdkHttpCloneReferencer.ts +77 -77
  38. package/src/generates/internal/SdkHttpFunctionProgrammer.ts +278 -278
  39. package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +502 -502
  40. package/src/generates/internal/SdkHttpRouteProgrammer.ts +109 -109
  41. package/src/generates/internal/SdkHttpSimulationProgrammer.ts +312 -312
  42. package/src/generates/internal/SdkImportWizard.ts +62 -62
  43. package/src/generates/internal/SdkTypeProgrammer.ts +388 -388
  44. package/src/generates/internal/SdkTypeTagProgrammer.ts +114 -114
  45. package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +379 -379
  46. package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +302 -302
  47. package/src/generates/internal/SwaggerOperationComposer.ts +119 -119
  48. package/src/generates/internal/SwaggerOperationParameterComposer.ts +161 -161
  49. package/src/generates/internal/SwaggerOperationResponseComposer.ts +110 -110
  50. package/src/module.ts +4 -4
  51. package/src/structures/IReflectHttpOperationException.ts +18 -18
  52. package/src/structures/IReflectHttpOperationParameter.ts +79 -79
  53. package/src/structures/IReflectHttpOperationSuccess.ts +21 -21
  54. package/src/structures/ITypedApplication.ts +11 -11
  55. package/src/structures/ITypedHttpRouteException.ts +15 -15
  56. package/src/structures/ITypedHttpRouteParameter.ts +41 -41
  57. package/src/structures/ITypedHttpRouteSuccess.ts +22 -22
  58. package/src/transformers/IOperationMetadata.ts +46 -46
  59. package/src/transformers/ISdkOperationTransformerContext.ts +8 -8
  60. package/src/transformers/SdkOperationProgrammer.ts +240 -240
  61. package/src/transformers/SdkOperationTransformer.ts +248 -248
  62. package/src/transformers/TextPlainValidator.ts +17 -17
  63. package/src/utils/MetadataUtil.ts +26 -26
  64. package/src/validators/HttpHeadersValidator.ts +40 -40
  65. package/src/validators/HttpQueryValidator.ts +40 -40
@@ -1,278 +1,278 @@
1
- import { IdentifierFactory, TypeFactory } from "@typia/core";
2
- import ts from "typescript";
3
-
4
- import { INestiaProject } from "../../structures/INestiaProject";
5
- import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
6
- import { StringUtil } from "../../utils/StringUtil";
7
- import { ImportDictionary } from "./ImportDictionary";
8
- import { SdkAliasCollection } from "./SdkAliasCollection";
9
- import { SdkHttpParameterProgrammer } from "./SdkHttpParameterProgrammer";
10
- import { SdkImportWizard } from "./SdkImportWizard";
11
-
12
- export namespace SdkHttpFunctionProgrammer {
13
- export const write =
14
- (project: INestiaProject) =>
15
- (importer: ImportDictionary) =>
16
- (route: ITypedHttpRoute): ts.FunctionDeclaration => {
17
- return ts.factory.createFunctionDeclaration(
18
- [
19
- ts.factory.createModifier(ts.SyntaxKind.ExportKeyword),
20
- ts.factory.createModifier(ts.SyntaxKind.AsyncKeyword),
21
- ],
22
- undefined,
23
- route.name,
24
- undefined,
25
- [
26
- IdentifierFactory.parameter(
27
- "connection",
28
- ts.factory.createTypeReferenceNode(
29
- SdkImportWizard.IConnection(importer),
30
- route.headerObject !== null
31
- ? [ts.factory.createTypeReferenceNode(`${route.name}.Headers`)]
32
- : undefined,
33
- ),
34
- ),
35
- ...SdkHttpParameterProgrammer.getParameterDeclarations({
36
- project,
37
- importer,
38
- route,
39
- body: true,
40
- prefix: true,
41
- }),
42
- ],
43
- ts.factory.createTypeReferenceNode("Promise", [
44
- project.config.propagate === true ||
45
- route.success.metadata.size() !== 0
46
- ? ts.factory.createTypeReferenceNode(`${route.name}.Output`)
47
- : ts.factory.createTypeReferenceNode("void"),
48
- ]),
49
- ts.factory.createBlock(writeBody(project)(importer)(route), true),
50
- );
51
- };
52
-
53
- const writeBody =
54
- (project: INestiaProject) =>
55
- (importer: ImportDictionary) =>
56
- (route: ITypedHttpRoute): ts.Statement[] => {
57
- const access = (name: string): ts.Expression =>
58
- project.config.keyword === true
59
- ? IdentifierFactory.access(ts.factory.createIdentifier("props"), name)
60
- : ts.factory.createIdentifier(name);
61
- const fetch = () =>
62
- ts.factory.createCallExpression(
63
- IdentifierFactory.access(
64
- ts.factory.createIdentifier(
65
- SdkImportWizard.Fetcher(
66
- !!route.body?.encrypted || route.success.encrypted,
67
- )(importer),
68
- ),
69
- project.config.propagate ? "propagate" : "fetch",
70
- ),
71
- project.config.propagate
72
- ? route.method.toLowerCase() === "get" ||
73
- route.method.toLowerCase() === "head"
74
- ? [TypeFactory.keyword("any")]
75
- : [TypeFactory.keyword("any"), TypeFactory.keyword("any")]
76
- : undefined,
77
- [
78
- route.body && route.body.contentType !== "multipart/form-data"
79
- ? ts.factory.createObjectLiteralExpression(
80
- [
81
- ts.factory.createSpreadAssignment(
82
- ts.factory.createIdentifier("connection"),
83
- ),
84
- ts.factory.createPropertyAssignment(
85
- "headers",
86
- ts.factory.createObjectLiteralExpression(
87
- [
88
- ts.factory.createSpreadAssignment(
89
- IdentifierFactory.access(
90
- ts.factory.createIdentifier("connection"),
91
- "headers",
92
- ),
93
- ),
94
- ts.factory.createPropertyAssignment(
95
- ts.factory.createStringLiteral("Content-Type"),
96
- ts.factory.createStringLiteral(
97
- route.body?.contentType ?? "application/json",
98
- ),
99
- ),
100
- ],
101
- true,
102
- ),
103
- ),
104
- ],
105
- true,
106
- )
107
- : ts.factory.createIdentifier("connection"),
108
- ts.factory.createObjectLiteralExpression(
109
- [
110
- ts.factory.createSpreadAssignment(
111
- IdentifierFactory.access(
112
- ts.factory.createIdentifier(route.name),
113
- "METADATA",
114
- ),
115
- ),
116
- ts.factory.createPropertyAssignment(
117
- "template",
118
- IdentifierFactory.access(
119
- IdentifierFactory.access(
120
- ts.factory.createIdentifier(route.name),
121
- "METADATA",
122
- ),
123
- "path",
124
- ),
125
- ),
126
- ts.factory.createPropertyAssignment(
127
- "path",
128
- ts.factory.createCallExpression(
129
- IdentifierFactory.access(
130
- ts.factory.createIdentifier(route.name),
131
- "path",
132
- ),
133
- undefined,
134
- SdkHttpParameterProgrammer.getArguments({
135
- project,
136
- route,
137
- body: false,
138
- }),
139
- ),
140
- ),
141
- ],
142
- true,
143
- ),
144
- ...(route.body ? [access(route.body.name)] : []),
145
- ...(project.config.json &&
146
- route.body !== null &&
147
- (route.body.contentType === "application/json" ||
148
- route.body.encrypted === true)
149
- ? [ts.factory.createIdentifier(`${route.name}.stringify`)]
150
- : []),
151
- ],
152
- );
153
- const output = (awaiter: boolean) =>
154
- project.config.simulate
155
- ? ts.factory.createConditionalExpression(
156
- ts.factory.createStrictEquality(
157
- ts.factory.createTrue(),
158
- ts.factory.createIdentifier("connection.simulate"),
159
- ),
160
- undefined,
161
- ts.factory.createCallExpression(
162
- ts.factory.createIdentifier(`${route.name}.simulate`),
163
- [],
164
- [
165
- ts.factory.createIdentifier("connection"),
166
- ...SdkHttpParameterProgrammer.getArguments({
167
- project,
168
- route,
169
- body: true,
170
- }),
171
- ],
172
- ),
173
- undefined,
174
- awaiter ? ts.factory.createAwaitExpression(fetch()) : fetch(),
175
- )
176
- : awaiter
177
- ? ts.factory.createAwaitExpression(fetch())
178
- : fetch();
179
- return [
180
- ...(project.config.assert
181
- ? SdkHttpParameterProgrammer.getSignificant(route, true).map((p) =>
182
- ts.factory.createExpressionStatement(
183
- ts.factory.createCallExpression(
184
- IdentifierFactory.access(
185
- ts.factory.createIdentifier(
186
- SdkImportWizard.typia(importer),
187
- ),
188
- "assert",
189
- ),
190
- [
191
- ts.factory.createTypeQueryNode(
192
- ts.factory.createIdentifier(p.name),
193
- ),
194
- ],
195
- [ts.factory.createIdentifier(p.name)],
196
- ),
197
- ),
198
- )
199
- : []),
200
- ...(route.success.setHeaders.length === 0
201
- ? [ts.factory.createReturnStatement(output(false))]
202
- : writeSetHeaders(project)(importer)(route)(output(true))),
203
- ];
204
- };
205
-
206
- const writeSetHeaders =
207
- (project: INestiaProject) =>
208
- (importer: ImportDictionary) =>
209
- (route: ITypedHttpRoute) =>
210
- (condition: ts.Expression): ts.Statement[] => {
211
- const accessor = (x: string) => (y: string) =>
212
- x[0] === "[" ? `${x}${y}` : `${x}.${y}`;
213
- const output: string = StringUtil.escapeDuplicate([
214
- "connection",
215
- ...SdkHttpParameterProgrammer.getSignificant(route, true).map(
216
- (p) => p.name,
217
- ),
218
- ])("output");
219
- const headers: string = accessor("connection")("headers");
220
- const data: string = project.config.propagate
221
- ? accessor(output)("data")
222
- : output;
223
-
224
- const assigners: ts.ExpressionStatement[] = [
225
- ts.factory.createBinaryExpression(
226
- ts.factory.createIdentifier(headers),
227
- ts.factory.createToken(ts.SyntaxKind.QuestionQuestionEqualsToken),
228
- ts.factory.createObjectLiteralExpression([]),
229
- ),
230
- ...route.success.setHeaders.map((tuple) =>
231
- tuple.type === "assigner"
232
- ? ts.factory.createCallExpression(
233
- ts.factory.createIdentifier("Object.assign"),
234
- [],
235
- [
236
- ts.factory.createIdentifier(headers),
237
- ts.factory.createIdentifier(accessor(data)(tuple.source)),
238
- ],
239
- )
240
- : ts.factory.createBinaryExpression(
241
- ts.factory.createIdentifier(
242
- accessor(headers)(tuple.target ?? tuple.source),
243
- ),
244
- ts.factory.createToken(ts.SyntaxKind.EqualsToken),
245
- ts.factory.createIdentifier(accessor(data)(tuple.source)),
246
- ),
247
- ),
248
- ].map(ts.factory.createExpressionStatement);
249
- return [
250
- ts.factory.createVariableStatement(
251
- [],
252
- ts.factory.createVariableDeclarationList(
253
- [
254
- ts.factory.createVariableDeclaration(
255
- output,
256
- undefined,
257
- SdkAliasCollection.response(project)(importer)(route),
258
- condition,
259
- ),
260
- ],
261
- ts.NodeFlags.Const,
262
- ),
263
- ),
264
- ...(project.config.propagate
265
- ? [
266
- ts.factory.createIfStatement(
267
- ts.factory.createIdentifier(accessor(output)("success")),
268
- assigners.length === 1
269
- ? assigners[0]!
270
- : ts.factory.createBlock(assigners, true),
271
- undefined,
272
- ),
273
- ]
274
- : assigners),
275
- ts.factory.createReturnStatement(ts.factory.createIdentifier(output)),
276
- ];
277
- };
278
- }
1
+ import { IdentifierFactory, TypeFactory } from "@typia/core";
2
+ import ts from "typescript";
3
+
4
+ import { INestiaProject } from "../../structures/INestiaProject";
5
+ import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
6
+ import { StringUtil } from "../../utils/StringUtil";
7
+ import { ImportDictionary } from "./ImportDictionary";
8
+ import { SdkAliasCollection } from "./SdkAliasCollection";
9
+ import { SdkHttpParameterProgrammer } from "./SdkHttpParameterProgrammer";
10
+ import { SdkImportWizard } from "./SdkImportWizard";
11
+
12
+ export namespace SdkHttpFunctionProgrammer {
13
+ export const write =
14
+ (project: INestiaProject) =>
15
+ (importer: ImportDictionary) =>
16
+ (route: ITypedHttpRoute): ts.FunctionDeclaration => {
17
+ return ts.factory.createFunctionDeclaration(
18
+ [
19
+ ts.factory.createModifier(ts.SyntaxKind.ExportKeyword),
20
+ ts.factory.createModifier(ts.SyntaxKind.AsyncKeyword),
21
+ ],
22
+ undefined,
23
+ route.name,
24
+ undefined,
25
+ [
26
+ IdentifierFactory.parameter(
27
+ "connection",
28
+ ts.factory.createTypeReferenceNode(
29
+ SdkImportWizard.IConnection(importer),
30
+ route.headerObject !== null
31
+ ? [ts.factory.createTypeReferenceNode(`${route.name}.Headers`)]
32
+ : undefined,
33
+ ),
34
+ ),
35
+ ...SdkHttpParameterProgrammer.getParameterDeclarations({
36
+ project,
37
+ importer,
38
+ route,
39
+ body: true,
40
+ prefix: true,
41
+ }),
42
+ ],
43
+ ts.factory.createTypeReferenceNode("Promise", [
44
+ project.config.propagate === true ||
45
+ route.success.metadata.size() !== 0
46
+ ? ts.factory.createTypeReferenceNode(`${route.name}.Output`)
47
+ : ts.factory.createTypeReferenceNode("void"),
48
+ ]),
49
+ ts.factory.createBlock(writeBody(project)(importer)(route), true),
50
+ );
51
+ };
52
+
53
+ const writeBody =
54
+ (project: INestiaProject) =>
55
+ (importer: ImportDictionary) =>
56
+ (route: ITypedHttpRoute): ts.Statement[] => {
57
+ const access = (name: string): ts.Expression =>
58
+ project.config.keyword === true
59
+ ? IdentifierFactory.access(ts.factory.createIdentifier("props"), name)
60
+ : ts.factory.createIdentifier(name);
61
+ const fetch = () =>
62
+ ts.factory.createCallExpression(
63
+ IdentifierFactory.access(
64
+ ts.factory.createIdentifier(
65
+ SdkImportWizard.Fetcher(
66
+ !!route.body?.encrypted || route.success.encrypted,
67
+ )(importer),
68
+ ),
69
+ project.config.propagate ? "propagate" : "fetch",
70
+ ),
71
+ project.config.propagate
72
+ ? route.method.toLowerCase() === "get" ||
73
+ route.method.toLowerCase() === "head"
74
+ ? [TypeFactory.keyword("any")]
75
+ : [TypeFactory.keyword("any"), TypeFactory.keyword("any")]
76
+ : undefined,
77
+ [
78
+ route.body && route.body.contentType !== "multipart/form-data"
79
+ ? ts.factory.createObjectLiteralExpression(
80
+ [
81
+ ts.factory.createSpreadAssignment(
82
+ ts.factory.createIdentifier("connection"),
83
+ ),
84
+ ts.factory.createPropertyAssignment(
85
+ "headers",
86
+ ts.factory.createObjectLiteralExpression(
87
+ [
88
+ ts.factory.createSpreadAssignment(
89
+ IdentifierFactory.access(
90
+ ts.factory.createIdentifier("connection"),
91
+ "headers",
92
+ ),
93
+ ),
94
+ ts.factory.createPropertyAssignment(
95
+ ts.factory.createStringLiteral("Content-Type"),
96
+ ts.factory.createStringLiteral(
97
+ route.body?.contentType ?? "application/json",
98
+ ),
99
+ ),
100
+ ],
101
+ true,
102
+ ),
103
+ ),
104
+ ],
105
+ true,
106
+ )
107
+ : ts.factory.createIdentifier("connection"),
108
+ ts.factory.createObjectLiteralExpression(
109
+ [
110
+ ts.factory.createSpreadAssignment(
111
+ IdentifierFactory.access(
112
+ ts.factory.createIdentifier(route.name),
113
+ "METADATA",
114
+ ),
115
+ ),
116
+ ts.factory.createPropertyAssignment(
117
+ "template",
118
+ IdentifierFactory.access(
119
+ IdentifierFactory.access(
120
+ ts.factory.createIdentifier(route.name),
121
+ "METADATA",
122
+ ),
123
+ "path",
124
+ ),
125
+ ),
126
+ ts.factory.createPropertyAssignment(
127
+ "path",
128
+ ts.factory.createCallExpression(
129
+ IdentifierFactory.access(
130
+ ts.factory.createIdentifier(route.name),
131
+ "path",
132
+ ),
133
+ undefined,
134
+ SdkHttpParameterProgrammer.getArguments({
135
+ project,
136
+ route,
137
+ body: false,
138
+ }),
139
+ ),
140
+ ),
141
+ ],
142
+ true,
143
+ ),
144
+ ...(route.body ? [access(route.body.name)] : []),
145
+ ...(project.config.json &&
146
+ route.body !== null &&
147
+ (route.body.contentType === "application/json" ||
148
+ route.body.encrypted === true)
149
+ ? [ts.factory.createIdentifier(`${route.name}.stringify`)]
150
+ : []),
151
+ ],
152
+ );
153
+ const output = (awaiter: boolean) =>
154
+ project.config.simulate
155
+ ? ts.factory.createConditionalExpression(
156
+ ts.factory.createStrictEquality(
157
+ ts.factory.createTrue(),
158
+ ts.factory.createIdentifier("connection.simulate"),
159
+ ),
160
+ undefined,
161
+ ts.factory.createCallExpression(
162
+ ts.factory.createIdentifier(`${route.name}.simulate`),
163
+ [],
164
+ [
165
+ ts.factory.createIdentifier("connection"),
166
+ ...SdkHttpParameterProgrammer.getArguments({
167
+ project,
168
+ route,
169
+ body: true,
170
+ }),
171
+ ],
172
+ ),
173
+ undefined,
174
+ awaiter ? ts.factory.createAwaitExpression(fetch()) : fetch(),
175
+ )
176
+ : awaiter
177
+ ? ts.factory.createAwaitExpression(fetch())
178
+ : fetch();
179
+ return [
180
+ ...(project.config.assert
181
+ ? SdkHttpParameterProgrammer.getSignificant(route, true).map((p) =>
182
+ ts.factory.createExpressionStatement(
183
+ ts.factory.createCallExpression(
184
+ IdentifierFactory.access(
185
+ ts.factory.createIdentifier(
186
+ SdkImportWizard.typia(importer),
187
+ ),
188
+ "assert",
189
+ ),
190
+ [
191
+ ts.factory.createTypeQueryNode(
192
+ ts.factory.createIdentifier(p.name),
193
+ ),
194
+ ],
195
+ [ts.factory.createIdentifier(p.name)],
196
+ ),
197
+ ),
198
+ )
199
+ : []),
200
+ ...(route.success.setHeaders.length === 0
201
+ ? [ts.factory.createReturnStatement(output(false))]
202
+ : writeSetHeaders(project)(importer)(route)(output(true))),
203
+ ];
204
+ };
205
+
206
+ const writeSetHeaders =
207
+ (project: INestiaProject) =>
208
+ (importer: ImportDictionary) =>
209
+ (route: ITypedHttpRoute) =>
210
+ (condition: ts.Expression): ts.Statement[] => {
211
+ const accessor = (x: string) => (y: string) =>
212
+ x[0] === "[" ? `${x}${y}` : `${x}.${y}`;
213
+ const output: string = StringUtil.escapeDuplicate([
214
+ "connection",
215
+ ...SdkHttpParameterProgrammer.getSignificant(route, true).map(
216
+ (p) => p.name,
217
+ ),
218
+ ])("output");
219
+ const headers: string = accessor("connection")("headers");
220
+ const data: string = project.config.propagate
221
+ ? accessor(output)("data")
222
+ : output;
223
+
224
+ const assigners: ts.ExpressionStatement[] = [
225
+ ts.factory.createBinaryExpression(
226
+ ts.factory.createIdentifier(headers),
227
+ ts.factory.createToken(ts.SyntaxKind.QuestionQuestionEqualsToken),
228
+ ts.factory.createObjectLiteralExpression([]),
229
+ ),
230
+ ...route.success.setHeaders.map((tuple) =>
231
+ tuple.type === "assigner"
232
+ ? ts.factory.createCallExpression(
233
+ ts.factory.createIdentifier("Object.assign"),
234
+ [],
235
+ [
236
+ ts.factory.createIdentifier(headers),
237
+ ts.factory.createIdentifier(accessor(data)(tuple.source)),
238
+ ],
239
+ )
240
+ : ts.factory.createBinaryExpression(
241
+ ts.factory.createIdentifier(
242
+ accessor(headers)(tuple.target ?? tuple.source),
243
+ ),
244
+ ts.factory.createToken(ts.SyntaxKind.EqualsToken),
245
+ ts.factory.createIdentifier(accessor(data)(tuple.source)),
246
+ ),
247
+ ),
248
+ ].map(ts.factory.createExpressionStatement);
249
+ return [
250
+ ts.factory.createVariableStatement(
251
+ [],
252
+ ts.factory.createVariableDeclarationList(
253
+ [
254
+ ts.factory.createVariableDeclaration(
255
+ output,
256
+ undefined,
257
+ SdkAliasCollection.response(project)(importer)(route),
258
+ condition,
259
+ ),
260
+ ],
261
+ ts.NodeFlags.Const,
262
+ ),
263
+ ),
264
+ ...(project.config.propagate
265
+ ? [
266
+ ts.factory.createIfStatement(
267
+ ts.factory.createIdentifier(accessor(output)("success")),
268
+ assigners.length === 1
269
+ ? assigners[0]!
270
+ : ts.factory.createBlock(assigners, true),
271
+ undefined,
272
+ ),
273
+ ]
274
+ : assigners),
275
+ ts.factory.createReturnStatement(ts.factory.createIdentifier(output)),
276
+ ];
277
+ };
278
+ }