@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.
Files changed (93) hide show
  1. package/assets/bundle/distribute/package.json +1 -1
  2. package/lib/factories/ExpressionFactory.d.ts +9 -0
  3. package/lib/factories/ExpressionFactory.js +16 -0
  4. package/lib/factories/ExpressionFactory.js.map +1 -0
  5. package/lib/factories/IdentifierFactory.d.ts +22 -0
  6. package/lib/factories/IdentifierFactory.js +50 -0
  7. package/lib/factories/IdentifierFactory.js.map +1 -0
  8. package/lib/factories/LiteralFactory.d.ts +9 -0
  9. package/lib/factories/LiteralFactory.js +48 -0
  10. package/lib/factories/LiteralFactory.js.map +1 -0
  11. package/lib/factories/StatementFactory.d.ts +14 -0
  12. package/lib/factories/StatementFactory.js +20 -0
  13. package/lib/factories/StatementFactory.js.map +1 -0
  14. package/lib/factories/TypeFactory.d.ts +24 -0
  15. package/lib/factories/TypeFactory.js +27 -0
  16. package/lib/factories/TypeFactory.js.map +1 -0
  17. package/lib/generates/CloneGenerator.js +2 -2
  18. package/lib/generates/CloneGenerator.js.map +1 -1
  19. package/lib/generates/internal/E2eFileProgrammer.js +30 -29
  20. package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
  21. package/lib/generates/internal/FilePrinter.d.ts +2 -2
  22. package/lib/generates/internal/FilePrinter.js +14 -25
  23. package/lib/generates/internal/FilePrinter.js.map +1 -1
  24. package/lib/generates/internal/ImportDictionary.d.ts +1 -1
  25. package/lib/generates/internal/ImportDictionary.js +10 -9
  26. package/lib/generates/internal/ImportDictionary.js.map +1 -1
  27. package/lib/generates/internal/SdkAliasCollection.d.ts +12 -12
  28. package/lib/generates/internal/SdkAliasCollection.js +23 -25
  29. package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
  30. package/lib/generates/internal/SdkFileProgrammer.js +2 -2
  31. package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
  32. package/lib/generates/internal/SdkHttpCloneProgrammer.d.ts +1 -1
  33. package/lib/generates/internal/SdkHttpCloneProgrammer.js +3 -3
  34. package/lib/generates/internal/SdkHttpCloneProgrammer.js.map +1 -1
  35. package/lib/generates/internal/SdkHttpFunctionProgrammer.d.ts +1 -1
  36. package/lib/generates/internal/SdkHttpFunctionProgrammer.js +45 -48
  37. package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
  38. package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +1 -1
  39. package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +61 -60
  40. package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
  41. package/lib/generates/internal/SdkHttpParameterProgrammer.d.ts +2 -2
  42. package/lib/generates/internal/SdkHttpParameterProgrammer.js +11 -13
  43. package/lib/generates/internal/SdkHttpParameterProgrammer.js.map +1 -1
  44. package/lib/generates/internal/SdkHttpRouteProgrammer.d.ts +1 -1
  45. package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +1 -1
  46. package/lib/generates/internal/SdkHttpSimulationProgrammer.js +50 -48
  47. package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
  48. package/lib/generates/internal/SdkMcpRouteProgrammer.d.ts +1 -1
  49. package/lib/generates/internal/SdkMcpRouteProgrammer.js +54 -53
  50. package/lib/generates/internal/SdkMcpRouteProgrammer.js.map +1 -1
  51. package/lib/generates/internal/SdkTypeProgrammer.d.ts +3 -3
  52. package/lib/generates/internal/SdkTypeProgrammer.js +42 -43
  53. package/lib/generates/internal/SdkTypeProgrammer.js.map +1 -1
  54. package/lib/generates/internal/SdkTypeTagProgrammer.d.ts +2 -1
  55. package/lib/generates/internal/SdkTypeTagProgrammer.js +7 -9
  56. package/lib/generates/internal/SdkTypeTagProgrammer.js.map +1 -1
  57. package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.d.ts +2 -2
  58. package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +45 -47
  59. package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
  60. package/lib/generates/internal/SdkWebSocketParameterProgrammer.d.ts +3 -3
  61. package/lib/generates/internal/SdkWebSocketParameterProgrammer.js +9 -9
  62. package/lib/generates/internal/SdkWebSocketParameterProgrammer.js.map +1 -1
  63. package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +2 -2
  64. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +34 -40
  65. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
  66. package/lib/transform.d.ts +5 -9
  67. package/lib/transform.js +8 -31
  68. package/lib/transform.js.map +1 -1
  69. package/package.json +11 -11
  70. package/src/factories/ExpressionFactory.ts +23 -0
  71. package/src/factories/IdentifierFactory.ts +84 -0
  72. package/src/factories/LiteralFactory.ts +54 -0
  73. package/src/factories/StatementFactory.ts +56 -0
  74. package/src/factories/TypeFactory.ts +27 -0
  75. package/src/generates/CloneGenerator.ts +8 -7
  76. package/src/generates/internal/E2eFileProgrammer.ts +59 -53
  77. package/src/generates/internal/FilePrinter.ts +28 -36
  78. package/src/generates/internal/ImportDictionary.ts +19 -21
  79. package/src/generates/internal/SdkAliasCollection.ts +55 -49
  80. package/src/generates/internal/SdkFileProgrammer.ts +4 -7
  81. package/src/generates/internal/SdkHttpCloneProgrammer.ts +11 -13
  82. package/src/generates/internal/SdkHttpFunctionProgrammer.ts +90 -101
  83. package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +153 -166
  84. package/src/generates/internal/SdkHttpParameterProgrammer.ts +15 -17
  85. package/src/generates/internal/SdkHttpRouteProgrammer.ts +1 -1
  86. package/src/generates/internal/SdkHttpSimulationProgrammer.ts +121 -130
  87. package/src/generates/internal/SdkMcpRouteProgrammer.ts +135 -140
  88. package/src/generates/internal/SdkTypeProgrammer.ts +389 -382
  89. package/src/generates/internal/SdkTypeTagProgrammer.ts +13 -17
  90. package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +124 -130
  91. package/src/generates/internal/SdkWebSocketParameterProgrammer.ts +17 -15
  92. package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +112 -139
  93. package/src/transform.ts +14 -45
@@ -1,4 +1,4 @@
1
- import { Node, SyntaxKind, TypeScriptFactory } from "@nestia/factory";
1
+ import { type Node, SyntaxKind, type TypeNode, factory } from "@ttsc/factory";
2
2
 
3
3
  import { INestiaProject } from "../../structures/INestiaProject";
4
4
  import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
@@ -10,7 +10,7 @@ export namespace SdkHttpParameterProgrammer {
10
10
  export interface IEntry {
11
11
  key: string;
12
12
  required: boolean;
13
- type: Node;
13
+ type: TypeNode;
14
14
  parameter: ITypedHttpRouteParameter;
15
15
  }
16
16
 
@@ -79,7 +79,7 @@ export namespace SdkHttpParameterProgrammer {
79
79
  props.route.queryObject.metadata,
80
80
  )
81
81
  : SdkAliasCollection.name(props.route.queryObject)
82
- : TypeScriptFactory.createTypeReferenceNode(`${prefix}Query`),
82
+ : factory.createTypeReferenceNode(`${prefix}Query`),
83
83
  parameter: props.route.queryObject,
84
84
  },
85
85
  ]
@@ -96,7 +96,7 @@ export namespace SdkHttpParameterProgrammer {
96
96
  props.route.body.metadata,
97
97
  )
98
98
  : SdkAliasCollection.name(props.route.body)
99
- : TypeScriptFactory.createTypeReferenceNode(`${prefix}Body`),
99
+ : factory.createTypeReferenceNode(`${prefix}Body`),
100
100
  parameter: props.route.body,
101
101
  },
102
102
  ]
@@ -117,17 +117,17 @@ export namespace SdkHttpParameterProgrammer {
117
117
  const typeName: string = props.prefix
118
118
  ? `${props.route.name}.Props`
119
119
  : "Props";
120
- const node: Node =
120
+ const node: TypeNode =
121
121
  props.body === false && props.route.body !== null
122
- ? TypeScriptFactory.createTypeReferenceNode("Omit", [
123
- TypeScriptFactory.createTypeReferenceNode(typeName),
124
- TypeScriptFactory.createLiteralTypeNode(
125
- TypeScriptFactory.createStringLiteral(props.route.body.name),
122
+ ? factory.createTypeReferenceNode("Omit", [
123
+ factory.createTypeReferenceNode(typeName),
124
+ factory.createLiteralTypeNode(
125
+ factory.createStringLiteral(props.route.body.name),
126
126
  ),
127
127
  ])
128
- : TypeScriptFactory.createTypeReferenceNode(typeName);
128
+ : factory.createTypeReferenceNode(typeName);
129
129
  return [
130
- TypeScriptFactory.createParameterDeclaration(
130
+ factory.createParameterDeclaration(
131
131
  undefined,
132
132
  undefined,
133
133
  "props",
@@ -138,13 +138,11 @@ export namespace SdkHttpParameterProgrammer {
138
138
  ];
139
139
  }
140
140
  return entries.map((e) =>
141
- TypeScriptFactory.createParameterDeclaration(
141
+ factory.createParameterDeclaration(
142
142
  undefined,
143
143
  undefined,
144
144
  e.key,
145
- e.required
146
- ? undefined
147
- : TypeScriptFactory.createToken(SyntaxKind.QuestionToken),
145
+ e.required ? undefined : factory.createToken(SyntaxKind.QuestionToken),
148
146
  e.type,
149
147
  undefined,
150
148
  ),
@@ -159,7 +157,7 @@ export namespace SdkHttpParameterProgrammer {
159
157
  const parameters = getSignificant(props.route, props.body);
160
158
  if (parameters.length === 0) return [];
161
159
  else if (props.project.config.keyword === true)
162
- return [TypeScriptFactory.createIdentifier("props")];
163
- return parameters.map((p) => TypeScriptFactory.createIdentifier(p.name));
160
+ return [factory.createIdentifier("props")];
161
+ return parameters.map((p) => factory.createIdentifier(p.name));
164
162
  };
165
163
  }
@@ -1,4 +1,4 @@
1
- import { Node } from "@nestia/factory";
1
+ import { type Node } from "@ttsc/factory";
2
2
  import { IJsDocTagInfo } from "typia";
3
3
 
4
4
  import { INestiaConfig } from "../../INestiaConfig";
@@ -1,17 +1,20 @@
1
1
  import {
2
- Node,
2
+ type Expression,
3
+ type ExpressionStatement,
4
+ type Node,
3
5
  NodeFlags,
6
+ type ParameterDeclaration,
7
+ type Statement,
4
8
  SyntaxKind,
5
- TypeScriptFactory,
6
- } from "@nestia/factory";
7
- import {
8
- ExpressionFactory,
9
- IdentifierFactory,
10
- LiteralFactory,
11
- StatementFactory,
12
- TypeFactory,
13
- } from "@nestia/factory";
9
+ type TypeNode,
10
+ factory,
11
+ } from "@ttsc/factory";
14
12
 
13
+ import { ExpressionFactory } from "../../factories/ExpressionFactory";
14
+ import { IdentifierFactory } from "../../factories/IdentifierFactory";
15
+ import { LiteralFactory } from "../../factories/LiteralFactory";
16
+ import { StatementFactory } from "../../factories/StatementFactory";
17
+ import { TypeFactory } from "../../factories/TypeFactory";
15
18
  import { sizeOf } from "../../internal/legacy";
16
19
  import { INestiaProject } from "../../structures/INestiaProject";
17
20
  import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
@@ -25,30 +28,30 @@ export namespace SdkHttpSimulationProgrammer {
25
28
  (project: INestiaProject) =>
26
29
  (importer: ImportDictionary) =>
27
30
  (route: ITypedHttpRoute): Node => {
28
- const output = SdkAliasCollection.responseBody(project)(importer)(route);
31
+ const output: TypeNode = SdkAliasCollection.responseBody(project)(
32
+ importer,
33
+ )(route) as TypeNode;
29
34
  return constant("random")(
30
- TypeScriptFactory.createArrowFunction(
35
+ factory.createArrowFunction(
31
36
  undefined,
32
37
  undefined,
33
38
  [],
34
39
  project.config.primitive === false || route.success.binary === true
35
40
  ? output
36
- : TypeScriptFactory.createTypeReferenceNode(
41
+ : factory.createTypeReferenceNode(
37
42
  SdkImportWizard.Resolved(importer),
38
43
  [output],
39
44
  ),
40
45
  undefined,
41
46
  route.success.binary === true
42
- ? TypeScriptFactory.createNewExpression(
43
- TypeScriptFactory.createIdentifier("ReadableStream"),
44
- [SdkAliasCollection.binaryChunk()],
47
+ ? factory.createNewExpression(
48
+ factory.createIdentifier("ReadableStream"),
49
+ [SdkAliasCollection.binaryChunk() as TypeNode],
45
50
  [],
46
51
  )
47
- : TypeScriptFactory.createCallExpression(
52
+ : factory.createCallExpression(
48
53
  IdentifierFactory.access(
49
- TypeScriptFactory.createIdentifier(
50
- SdkImportWizard.typia(importer),
51
- ),
54
+ factory.createIdentifier(SdkImportWizard.typia(importer)),
52
55
  "random",
53
56
  ),
54
57
  [output],
@@ -67,13 +70,13 @@ export namespace SdkHttpSimulationProgrammer {
67
70
  route.success.binary === true ||
68
71
  sizeOf(route.success.metadata) !== 0;
69
72
  const caller = () =>
70
- TypeScriptFactory.createCallExpression(
71
- TypeScriptFactory.createIdentifier("random"),
73
+ factory.createCallExpression(
74
+ factory.createIdentifier("random"),
72
75
  undefined,
73
76
  undefined,
74
77
  );
75
78
  return constant("simulate")(
76
- TypeScriptFactory.createArrowFunction(
79
+ factory.createArrowFunction(
77
80
  undefined,
78
81
  undefined,
79
82
  [
@@ -82,60 +85,53 @@ export namespace SdkHttpSimulationProgrammer {
82
85
  0
83
86
  ? "connection"
84
87
  : "_connection",
85
- TypeScriptFactory.createTypeReferenceNode(
88
+ factory.createTypeReferenceNode(
86
89
  SdkImportWizard.IConnection(importer),
87
90
  route.headerObject
88
- ? [
89
- TypeScriptFactory.createTypeReferenceNode(
90
- `${route.name}.Headers`,
91
- ),
92
- ]
91
+ ? [factory.createTypeReferenceNode(`${route.name}.Headers`)]
93
92
  : [],
94
93
  ),
95
94
  ),
96
- ...SdkHttpParameterProgrammer.getParameterDeclarations({
95
+ ...(SdkHttpParameterProgrammer.getParameterDeclarations({
97
96
  project,
98
97
  importer,
99
98
  route,
100
99
  body: true,
101
100
  prefix: false,
102
- }),
101
+ }) as ParameterDeclaration[]),
103
102
  ],
104
- TypeScriptFactory.createTypeReferenceNode(output ? "Output" : "void"),
103
+ factory.createTypeReferenceNode(output ? "Output" : "void"),
105
104
  undefined,
106
- TypeScriptFactory.createBlock(
105
+ factory.createBlock(
107
106
  [
108
107
  ...assert(project)(importer)(route),
109
- TypeScriptFactory.createReturnStatement(
108
+ factory.createReturnStatement(
110
109
  project.config.propagate
111
- ? TypeScriptFactory.createAsExpression(
112
- TypeScriptFactory.createObjectLiteralExpression(
110
+ ? factory.createAsExpression(
111
+ factory.createObjectLiteralExpression(
113
112
  [
114
- TypeScriptFactory.createPropertyAssignment(
113
+ factory.createPropertyAssignment(
115
114
  "success",
116
- TypeScriptFactory.createTrue(),
115
+ factory.createTrue(),
117
116
  ),
118
- TypeScriptFactory.createPropertyAssignment(
117
+ factory.createPropertyAssignment(
119
118
  "status",
120
119
  ExpressionFactory.number(
121
120
  route.success.status ??
122
121
  (route.method === "POST" ? 201 : 200),
123
122
  ),
124
123
  ),
125
- TypeScriptFactory.createPropertyAssignment(
124
+ factory.createPropertyAssignment(
126
125
  "headers",
127
126
  LiteralFactory.write({
128
127
  "Content-Type": route.success.contentType,
129
128
  }),
130
129
  ),
131
- TypeScriptFactory.createPropertyAssignment(
132
- "data",
133
- caller(),
134
- ),
130
+ factory.createPropertyAssignment("data", caller()),
135
131
  ],
136
132
  true,
137
133
  ),
138
- TypeScriptFactory.createTypeReferenceNode("Output"),
134
+ factory.createTypeReferenceNode("Output"),
139
135
  )
140
136
  : caller(),
141
137
  ),
@@ -149,16 +145,16 @@ export namespace SdkHttpSimulationProgrammer {
149
145
  const assert =
150
146
  (project: INestiaProject) =>
151
147
  (importer: ImportDictionary) =>
152
- (route: ITypedHttpRoute): Node[] => {
148
+ (route: ITypedHttpRoute): Statement[] => {
153
149
  const parameters = SdkHttpParameterProgrammer.getSignificant(route, true);
154
150
  if (parameters.length === 0) return [];
155
151
 
156
152
  const typia = SdkImportWizard.typia(importer);
157
153
  const validator = StatementFactory.constant({
158
154
  name: "assert",
159
- value: TypeScriptFactory.createCallExpression(
155
+ value: factory.createCallExpression(
160
156
  IdentifierFactory.access(
161
- TypeScriptFactory.createIdentifier(
157
+ factory.createIdentifier(
162
158
  importer.external({
163
159
  file: `@nestia/fetcher`,
164
160
  declaration: false,
@@ -170,31 +166,31 @@ export namespace SdkHttpSimulationProgrammer {
170
166
  ),
171
167
  undefined,
172
168
  [
173
- TypeScriptFactory.createObjectLiteralExpression(
169
+ factory.createObjectLiteralExpression(
174
170
  [
175
- TypeScriptFactory.createPropertyAssignment(
171
+ factory.createPropertyAssignment(
176
172
  "method",
177
- TypeScriptFactory.createIdentifier("METADATA.method"),
173
+ factory.createIdentifier("METADATA.method"),
178
174
  ),
179
- TypeScriptFactory.createPropertyAssignment(
175
+ factory.createPropertyAssignment(
180
176
  "host",
181
- TypeScriptFactory.createIdentifier("connection.host"),
177
+ factory.createIdentifier("connection.host"),
182
178
  ),
183
- TypeScriptFactory.createPropertyAssignment(
179
+ factory.createPropertyAssignment(
184
180
  "path",
185
- TypeScriptFactory.createCallExpression(
186
- TypeScriptFactory.createIdentifier("path"),
181
+ factory.createCallExpression(
182
+ factory.createIdentifier("path"),
187
183
  undefined,
188
184
  SdkHttpParameterProgrammer.getArguments({
189
185
  project,
190
186
  route,
191
187
  body: false,
192
- }),
188
+ }) as Expression[],
193
189
  ),
194
190
  ),
195
- TypeScriptFactory.createPropertyAssignment(
191
+ factory.createPropertyAssignment(
196
192
  "contentType",
197
- TypeScriptFactory.createIdentifier(
193
+ factory.createIdentifier(
198
194
  JSON.stringify(route.success.contentType),
199
195
  ),
200
196
  ),
@@ -204,44 +200,44 @@ export namespace SdkHttpSimulationProgrammer {
204
200
  ],
205
201
  ),
206
202
  });
207
- const individual: Node[] = parameters
203
+ const individual: ExpressionStatement[] = parameters
208
204
  .map((p) =>
209
- TypeScriptFactory.createCallExpression(
205
+ factory.createCallExpression(
210
206
  (() => {
211
207
  const base = IdentifierFactory.access(
212
- TypeScriptFactory.createIdentifier("assert"),
208
+ factory.createIdentifier("assert"),
213
209
  p.category,
214
210
  );
215
211
  if (p.category !== "param") return base;
216
- return TypeScriptFactory.createCallExpression(base, undefined, [
217
- TypeScriptFactory.createStringLiteral(p.name),
212
+ return factory.createCallExpression(base, undefined, [
213
+ factory.createStringLiteral(p.name),
218
214
  ]);
219
215
  })(),
220
216
  undefined,
221
217
  [
222
- TypeScriptFactory.createArrowFunction(
218
+ factory.createArrowFunction(
223
219
  undefined,
224
220
  undefined,
225
221
  [],
226
222
  undefined,
227
223
  undefined,
228
- TypeScriptFactory.createCallExpression(
224
+ factory.createCallExpression(
229
225
  IdentifierFactory.access(
230
- TypeScriptFactory.createIdentifier(typia),
226
+ factory.createIdentifier(typia),
231
227
  "assert",
232
228
  ),
233
229
  undefined,
234
230
  [
235
231
  project.config.keyword === true
236
- ? TypeScriptFactory.createIdentifier(`props.${p.name}`)
237
- : TypeScriptFactory.createIdentifier(p.name),
232
+ ? factory.createIdentifier(`props.${p.name}`)
233
+ : factory.createIdentifier(p.name),
238
234
  ],
239
235
  ),
240
236
  ),
241
237
  ],
242
238
  ),
243
239
  )
244
- .map(TypeScriptFactory.createExpressionStatement) as Node[];
240
+ .map(factory.createExpressionStatement);
245
241
  return [
246
242
  validator,
247
243
  ...(project.config.propagate !== true
@@ -250,77 +246,72 @@ export namespace SdkHttpSimulationProgrammer {
250
246
  ];
251
247
  };
252
248
 
253
- const tryAndCatch = (importer: ImportDictionary) => (individual: Node[]) =>
254
- TypeScriptFactory.createTryStatement(
255
- TypeScriptFactory.createBlock(individual, true),
256
- TypeScriptFactory.createCatchClause(
257
- "exp",
258
- TypeScriptFactory.createBlock(
259
- [
260
- TypeScriptFactory.createIfStatement(
261
- TypeScriptFactory.createLogicalNot(
262
- TypeScriptFactory.createCallExpression(
263
- IdentifierFactory.access(
264
- TypeScriptFactory.createIdentifier(
265
- SdkImportWizard.typia(importer),
249
+ const tryAndCatch =
250
+ (importer: ImportDictionary) => (individual: Statement[]) =>
251
+ factory.createTryStatement(
252
+ factory.createBlock(individual, true),
253
+ factory.createCatchClause(
254
+ "exp",
255
+ factory.createBlock(
256
+ [
257
+ factory.createIfStatement(
258
+ factory.createLogicalNot(
259
+ factory.createCallExpression(
260
+ IdentifierFactory.access(
261
+ factory.createIdentifier(SdkImportWizard.typia(importer)),
262
+ "is",
266
263
  ),
267
- "is",
264
+ [
265
+ factory.createTypeReferenceNode(
266
+ SdkImportWizard.HttpError(importer),
267
+ ),
268
+ ],
269
+ [factory.createIdentifier("exp")],
268
270
  ),
269
- [
270
- TypeScriptFactory.createTypeReferenceNode(
271
- SdkImportWizard.HttpError(importer),
272
- ),
273
- ],
274
- [TypeScriptFactory.createIdentifier("exp")],
275
271
  ),
272
+ factory.createThrowStatement(factory.createIdentifier("exp")),
276
273
  ),
277
- TypeScriptFactory.createThrowStatement(
278
- TypeScriptFactory.createIdentifier("exp"),
279
- ),
280
- ),
281
- TypeScriptFactory.createReturnStatement(
282
- TypeScriptFactory.createAsExpression(
283
- TypeScriptFactory.createObjectLiteralExpression(
284
- [
285
- TypeScriptFactory.createPropertyAssignment(
286
- "success",
287
- TypeScriptFactory.createFalse(),
288
- ),
289
- TypeScriptFactory.createPropertyAssignment(
290
- "status",
291
- TypeScriptFactory.createIdentifier("exp.status"),
292
- ),
293
- TypeScriptFactory.createPropertyAssignment(
294
- "headers",
295
- TypeScriptFactory.createIdentifier("exp.headers"),
296
- ),
297
- TypeScriptFactory.createPropertyAssignment(
298
- "data",
299
- TypeScriptFactory.createIdentifier(
300
- "exp.toJSON().message",
274
+ factory.createReturnStatement(
275
+ factory.createAsExpression(
276
+ factory.createObjectLiteralExpression(
277
+ [
278
+ factory.createPropertyAssignment(
279
+ "success",
280
+ factory.createFalse(),
301
281
  ),
302
- ),
303
- ],
304
- true,
282
+ factory.createPropertyAssignment(
283
+ "status",
284
+ factory.createIdentifier("exp.status"),
285
+ ),
286
+ factory.createPropertyAssignment(
287
+ "headers",
288
+ factory.createIdentifier("exp.headers"),
289
+ ),
290
+ factory.createPropertyAssignment(
291
+ "data",
292
+ factory.createIdentifier("exp.toJSON().message"),
293
+ ),
294
+ ],
295
+ true,
296
+ ),
297
+ TypeFactory.keyword("any"),
305
298
  ),
306
- TypeFactory.keyword("any"),
307
299
  ),
308
- ),
309
- ],
310
- true,
300
+ ],
301
+ true,
302
+ ),
311
303
  ),
312
- ),
313
- undefined,
314
- );
304
+ undefined,
305
+ );
315
306
  }
316
307
 
317
- const constant = (name: string) => (expression: Node) =>
318
- TypeScriptFactory.createVariableStatement(
319
- [TypeScriptFactory.createModifier(SyntaxKind.ExportKeyword)],
320
- TypeScriptFactory.createVariableDeclarationList(
308
+ const constant = (name: string) => (expression: Expression) =>
309
+ factory.createVariableStatement(
310
+ [factory.createModifier(SyntaxKind.ExportKeyword)],
311
+ factory.createVariableDeclarationList(
321
312
  [
322
- TypeScriptFactory.createVariableDeclaration(
323
- TypeScriptFactory.createIdentifier(name),
313
+ factory.createVariableDeclaration(
314
+ factory.createIdentifier(name),
324
315
  undefined,
325
316
  undefined,
326
317
  expression,