@nestia/sdk 3.10.0 → 3.11.0-dev.20240812

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 (279) hide show
  1. package/lib/NestiaSdkApplication.d.ts +1 -3
  2. package/lib/NestiaSdkApplication.js +138 -136
  3. package/lib/NestiaSdkApplication.js.map +1 -1
  4. package/lib/analyses/ConfigAnalyzer.d.ts +2 -2
  5. package/lib/analyses/ConfigAnalyzer.js +39 -80
  6. package/lib/analyses/ConfigAnalyzer.js.map +1 -1
  7. package/lib/analyses/ExceptionAnalyzer.d.ts +0 -16
  8. package/lib/analyses/ExceptionAnalyzer.js +142 -105
  9. package/lib/analyses/ExceptionAnalyzer.js.map +1 -1
  10. package/lib/analyses/GenericAnalyzer.d.ts +1 -2
  11. package/lib/analyses/GenericAnalyzer.js.map +1 -1
  12. package/lib/analyses/ImportAnalyzer.d.ts +6 -11
  13. package/lib/analyses/ImportAnalyzer.js +70 -42
  14. package/lib/analyses/ImportAnalyzer.js.map +1 -1
  15. package/lib/analyses/ReflectControllerAnalyzer.d.ts +7 -1
  16. package/lib/analyses/ReflectControllerAnalyzer.js +28 -99
  17. package/lib/analyses/ReflectControllerAnalyzer.js.map +1 -1
  18. package/lib/analyses/ReflectHttpOperationAnalyzer.d.ts +6 -2
  19. package/lib/analyses/ReflectHttpOperationAnalyzer.js +72 -152
  20. package/lib/analyses/ReflectHttpOperationAnalyzer.js.map +1 -1
  21. package/lib/analyses/ReflectHttpOperationParameterAnalyzer.d.ts +15 -0
  22. package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js +215 -0
  23. package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js.map +1 -0
  24. package/lib/analyses/ReflectHttpOperationResponseAnalyzer.d.ts +15 -0
  25. package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js +81 -0
  26. package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js.map +1 -0
  27. package/lib/analyses/ReflectMetadataAnalyzer.d.ts +1 -3
  28. package/lib/analyses/ReflectMetadataAnalyzer.js +0 -4
  29. package/lib/analyses/ReflectMetadataAnalyzer.js.map +1 -1
  30. package/lib/analyses/ReflectWebSocketOperationAnalyzer.d.ts +6 -2
  31. package/lib/analyses/ReflectWebSocketOperationAnalyzer.js +72 -48
  32. package/lib/analyses/ReflectWebSocketOperationAnalyzer.js.map +1 -1
  33. package/lib/analyses/TypedHttpRouteAnalyzer.d.ts +15 -0
  34. package/lib/analyses/TypedHttpRouteAnalyzer.js +111 -0
  35. package/lib/analyses/TypedHttpRouteAnalyzer.js.map +1 -0
  36. package/lib/analyses/TypedWebSocketRouteAnalyzer.d.ts +10 -0
  37. package/lib/analyses/TypedWebSocketRouteAnalyzer.js +9 -0
  38. package/lib/analyses/TypedWebSocketRouteAnalyzer.js.map +1 -0
  39. package/lib/decorators/OperationMetadata.d.ts +2 -0
  40. package/lib/decorators/OperationMetadata.js +10 -0
  41. package/lib/decorators/OperationMetadata.js.map +1 -0
  42. package/lib/executable/internal/NestiaConfigLoader.d.ts +1 -1
  43. package/lib/executable/internal/NestiaConfigLoader.js +33 -3
  44. package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
  45. package/lib/executable/internal/NestiaSdkCommand.js +1 -1
  46. package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
  47. package/lib/generates/CloneGenerator.d.ts +0 -5
  48. package/lib/generates/CloneGenerator.js +60 -60
  49. package/lib/generates/CloneGenerator.js.map +1 -1
  50. package/lib/generates/E2eGenerator.d.ts +2 -3
  51. package/lib/generates/E2eGenerator.js +9 -8
  52. package/lib/generates/E2eGenerator.js.map +1 -1
  53. package/lib/generates/OpenAiGenerator.d.ts +2 -4
  54. package/lib/generates/OpenAiGenerator.js +13 -3
  55. package/lib/generates/OpenAiGenerator.js.map +1 -1
  56. package/lib/generates/SdkGenerator.d.ts +4 -4
  57. package/lib/generates/SdkGenerator.js +63 -73
  58. package/lib/generates/SdkGenerator.js.map +1 -1
  59. package/lib/generates/SwaggerGenerator.d.ts +6 -18
  60. package/lib/generates/SwaggerGenerator.js +60 -235
  61. package/lib/generates/SwaggerGenerator.js.map +1 -1
  62. package/lib/generates/internal/E2eFileProgrammer.js +5 -9
  63. package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
  64. package/lib/generates/internal/SdkAliasCollection.d.ts +6 -4
  65. package/lib/generates/internal/SdkAliasCollection.js +33 -31
  66. package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
  67. package/lib/generates/internal/SdkDistributionComposer.d.ts +4 -1
  68. package/lib/generates/internal/SdkDistributionComposer.js +6 -6
  69. package/lib/generates/internal/SdkDistributionComposer.js.map +1 -1
  70. package/lib/generates/internal/SdkFileProgrammer.d.ts +2 -4
  71. package/lib/generates/internal/SdkFileProgrammer.js +6 -6
  72. package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
  73. package/lib/generates/internal/SdkHttpCloneProgrammer.d.ts +0 -12
  74. package/lib/generates/internal/SdkHttpCloneProgrammer.js +142 -97
  75. package/lib/generates/internal/SdkHttpCloneProgrammer.js.map +1 -1
  76. package/lib/generates/internal/SdkHttpFunctionProgrammer.d.ts +4 -3
  77. package/lib/generates/internal/SdkHttpFunctionProgrammer.js +37 -59
  78. package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
  79. package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +4 -3
  80. package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +31 -48
  81. package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
  82. package/lib/generates/internal/SdkHttpRouteProgrammer.js +7 -3
  83. package/lib/generates/internal/SdkHttpRouteProgrammer.js.map +1 -1
  84. package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +4 -3
  85. package/lib/generates/internal/SdkHttpSimulationProgrammer.js +7 -13
  86. package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
  87. package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.d.ts +1 -2
  88. package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +11 -16
  89. package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
  90. package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +1 -2
  91. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +7 -10
  92. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
  93. package/lib/generates/internal/SwaggerDescriptionComposer.d.ts +23 -0
  94. package/lib/generates/internal/SwaggerDescriptionComposer.js +44 -0
  95. package/lib/generates/internal/SwaggerDescriptionComposer.js.map +1 -0
  96. package/lib/generates/internal/SwaggerOperationComposer.d.ts +12 -0
  97. package/lib/generates/internal/SwaggerOperationComposer.js +68 -0
  98. package/lib/generates/internal/SwaggerOperationComposer.js.map +1 -0
  99. package/lib/generates/internal/SwaggerOperationParameterComposer.d.ts +18 -0
  100. package/lib/generates/internal/SwaggerOperationParameterComposer.js +99 -0
  101. package/lib/generates/internal/SwaggerOperationParameterComposer.js.map +1 -0
  102. package/lib/generates/internal/SwaggerOperationResponseComposer.d.ts +9 -0
  103. package/lib/generates/internal/SwaggerOperationResponseComposer.js +91 -0
  104. package/lib/generates/internal/SwaggerOperationResponseComposer.js.map +1 -0
  105. package/lib/structures/INestiaProject.d.ts +5 -5
  106. package/lib/structures/INestiaSdkInput.d.ts +20 -0
  107. package/lib/structures/{ISwaggerError.js → INestiaSdkInput.js} +1 -1
  108. package/lib/structures/INestiaSdkInput.js.map +1 -0
  109. package/lib/structures/IReflectApplication.d.ts +6 -0
  110. package/lib/structures/IReflectApplication.js +3 -0
  111. package/lib/structures/IReflectApplication.js.map +1 -0
  112. package/lib/structures/IReflectController.d.ts +3 -5
  113. package/lib/structures/IReflectHttpOperation.d.ts +13 -65
  114. package/lib/structures/IReflectHttpOperationException.d.ts +14 -0
  115. package/lib/structures/IReflectHttpOperationException.js +3 -0
  116. package/lib/structures/IReflectHttpOperationException.js.map +1 -0
  117. package/lib/structures/IReflectHttpOperationParameter.d.ts +35 -0
  118. package/lib/structures/IReflectHttpOperationParameter.js +3 -0
  119. package/lib/structures/IReflectHttpOperationParameter.js.map +1 -0
  120. package/lib/structures/IReflectHttpOperationSuccess.d.ts +15 -0
  121. package/lib/structures/IReflectHttpOperationSuccess.js +3 -0
  122. package/lib/structures/IReflectHttpOperationSuccess.js.map +1 -0
  123. package/lib/structures/IReflectOperationError.d.ts +16 -0
  124. package/lib/structures/IReflectOperationError.js +23 -0
  125. package/lib/structures/IReflectOperationError.js.map +1 -0
  126. package/lib/structures/IReflectType.d.ts +4 -0
  127. package/lib/structures/{IErrorReport.js → IReflectType.js} +1 -1
  128. package/lib/structures/IReflectType.js.map +1 -0
  129. package/lib/structures/IReflectTypeImport.d.ts +4 -0
  130. package/lib/structures/{ISwaggerLazySchema.js → IReflectTypeImport.js} +1 -1
  131. package/lib/structures/IReflectTypeImport.js.map +1 -0
  132. package/lib/structures/IReflectWebSocketOperation.d.ts +8 -9
  133. package/lib/structures/IReflectWebSocketOperationParameter.d.ts +23 -0
  134. package/lib/structures/IReflectWebSocketOperationParameter.js +3 -0
  135. package/lib/structures/IReflectWebSocketOperationParameter.js.map +1 -0
  136. package/lib/structures/ITypedApplication.d.ts +7 -0
  137. package/lib/structures/{INormalizedInput.js → ITypedApplication.js} +1 -1
  138. package/lib/structures/ITypedApplication.js.map +1 -0
  139. package/lib/structures/ITypedHttpRoute.d.ts +14 -42
  140. package/lib/structures/ITypedHttpRouteException.d.ts +10 -0
  141. package/lib/structures/ITypedHttpRouteException.js +3 -0
  142. package/lib/structures/ITypedHttpRouteException.js.map +1 -0
  143. package/lib/structures/ITypedHttpRouteParameter.d.ts +31 -0
  144. package/lib/structures/ITypedHttpRouteParameter.js +3 -0
  145. package/lib/structures/ITypedHttpRouteParameter.js.map +1 -0
  146. package/lib/structures/ITypedHttpRouteSuccess.d.ts +19 -0
  147. package/lib/structures/{ISwaggerLazyProperty.js → ITypedHttpRouteSuccess.js} +1 -1
  148. package/lib/structures/ITypedHttpRouteSuccess.js.map +1 -0
  149. package/lib/structures/ITypedWebSocketRoute.d.ts +8 -44
  150. package/lib/structures/ITypedWebSocketRouteParameter.d.ts +2 -0
  151. package/lib/structures/ITypedWebSocketRouteParameter.js +3 -0
  152. package/lib/structures/ITypedWebSocketRouteParameter.js.map +1 -0
  153. package/lib/transform.d.ts +3 -0
  154. package/lib/transform.js +8 -0
  155. package/lib/transform.js.map +1 -0
  156. package/lib/transformers/IOperationMetadata.d.ts +36 -0
  157. package/lib/transformers/IOperationMetadata.js +3 -0
  158. package/lib/transformers/IOperationMetadata.js.map +1 -0
  159. package/lib/transformers/ISdkTransformerContext.d.ts +7 -0
  160. package/lib/transformers/ISdkTransformerContext.js +3 -0
  161. package/lib/transformers/ISdkTransformerContext.js.map +1 -0
  162. package/lib/transformers/SdkMetadataProgrammer.d.ts +11 -0
  163. package/lib/transformers/SdkMetadataProgrammer.js +159 -0
  164. package/lib/transformers/SdkMetadataProgrammer.js.map +1 -0
  165. package/lib/transformers/SdkTransformer.d.ts +4 -0
  166. package/lib/transformers/SdkTransformer.js +88 -0
  167. package/lib/transformers/SdkTransformer.js.map +1 -0
  168. package/lib/transformers/TextPlainValidator.d.ts +4 -0
  169. package/lib/transformers/TextPlainValidator.js +19 -0
  170. package/lib/transformers/TextPlainValidator.js.map +1 -0
  171. package/lib/utils/StringUtil.d.ts +1 -0
  172. package/lib/utils/StringUtil.js +1 -0
  173. package/lib/utils/StringUtil.js.map +1 -1
  174. package/package.json +8 -8
  175. package/src/NestiaSdkApplication.ts +173 -160
  176. package/src/analyses/ConfigAnalyzer.ts +50 -98
  177. package/src/analyses/ExceptionAnalyzer.ts +142 -142
  178. package/src/analyses/GenericAnalyzer.ts +3 -5
  179. package/src/analyses/ImportAnalyzer.ts +130 -115
  180. package/src/analyses/ReflectControllerAnalyzer.ts +63 -115
  181. package/src/analyses/ReflectHttpOperationAnalyzer.ts +142 -278
  182. package/src/analyses/ReflectHttpOperationParameterAnalyzer.ts +319 -0
  183. package/src/analyses/ReflectHttpOperationResponseAnalyzer.ts +117 -0
  184. package/src/analyses/ReflectMetadataAnalyzer.ts +1 -18
  185. package/src/analyses/ReflectWebSocketOperationAnalyzer.ts +143 -78
  186. package/src/analyses/TypedHttpRouteAnalyzer.ts +178 -0
  187. package/src/analyses/TypedWebSocketRouteAnalyzer.ts +18 -0
  188. package/src/decorators/OperationMetadata.ts +15 -0
  189. package/src/executable/internal/NestiaConfigLoader.ts +17 -3
  190. package/src/executable/internal/NestiaSdkCommand.ts +1 -4
  191. package/src/generates/CloneGenerator.ts +60 -59
  192. package/src/generates/E2eGenerator.ts +20 -21
  193. package/src/generates/OpenAiGenerator.ts +44 -45
  194. package/src/generates/SdkGenerator.ts +97 -125
  195. package/src/generates/SwaggerGenerator.ts +114 -416
  196. package/src/generates/internal/E2eFileProgrammer.ts +5 -14
  197. package/src/generates/internal/SdkAliasCollection.ts +33 -41
  198. package/src/generates/internal/SdkDistributionComposer.ts +9 -6
  199. package/src/generates/internal/SdkFileProgrammer.ts +11 -14
  200. package/src/generates/internal/SdkHttpCloneProgrammer.ts +142 -142
  201. package/src/generates/internal/SdkHttpFunctionProgrammer.ts +20 -47
  202. package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +245 -275
  203. package/src/generates/internal/SdkHttpRouteProgrammer.ts +7 -7
  204. package/src/generates/internal/SdkHttpSimulationProgrammer.ts +11 -23
  205. package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +197 -233
  206. package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +5 -15
  207. package/src/generates/internal/{SwaggerDescriptionGenerator.ts → SwaggerDescriptionComposer.ts} +25 -5
  208. package/src/generates/internal/SwaggerOperationComposer.ts +90 -0
  209. package/src/generates/internal/SwaggerOperationParameterComposer.ts +173 -0
  210. package/src/generates/internal/SwaggerOperationResponseComposer.ts +110 -0
  211. package/src/structures/INestiaProject.ts +5 -5
  212. package/src/structures/INestiaSdkInput.ts +25 -0
  213. package/src/structures/IReflectApplication.ts +8 -0
  214. package/src/structures/IReflectController.ts +3 -5
  215. package/src/structures/IReflectHttpOperation.ts +14 -76
  216. package/src/structures/IReflectHttpOperationException.ts +19 -0
  217. package/src/structures/IReflectHttpOperationParameter.ts +81 -0
  218. package/src/structures/IReflectHttpOperationSuccess.ts +22 -0
  219. package/src/structures/IReflectOperationError.ts +26 -0
  220. package/src/structures/IReflectType.ts +4 -0
  221. package/src/structures/IReflectTypeImport.ts +4 -0
  222. package/src/structures/IReflectWebSocketOperation.ts +9 -9
  223. package/src/structures/IReflectWebSocketOperationParameter.ts +38 -0
  224. package/src/structures/ITypedApplication.ts +8 -0
  225. package/src/structures/ITypedHttpRoute.ts +15 -45
  226. package/src/structures/ITypedHttpRouteException.ts +15 -0
  227. package/src/structures/ITypedHttpRouteParameter.ts +41 -0
  228. package/src/structures/ITypedHttpRouteSuccess.ts +22 -0
  229. package/src/structures/ITypedWebSocketRoute.ts +8 -56
  230. package/src/structures/ITypedWebSocketRouteParameter.ts +3 -0
  231. package/src/transform.ts +9 -0
  232. package/src/transformers/IOperationMetadata.ts +38 -0
  233. package/src/transformers/ISdkTransformerContext.ts +8 -0
  234. package/src/transformers/SdkMetadataProgrammer.ts +227 -0
  235. package/src/transformers/SdkTransformer.ts +168 -0
  236. package/src/transformers/TextPlainValidator.ts +17 -0
  237. package/src/utils/StringUtil.ts +3 -0
  238. package/lib/analyses/TypedControllerAnalyzer.d.ts +0 -8
  239. package/lib/analyses/TypedControllerAnalyzer.js +0 -77
  240. package/lib/analyses/TypedControllerAnalyzer.js.map +0 -1
  241. package/lib/analyses/TypedHttpOperationAnalyzer.d.ts +0 -15
  242. package/lib/analyses/TypedHttpOperationAnalyzer.js +0 -263
  243. package/lib/analyses/TypedHttpOperationAnalyzer.js.map +0 -1
  244. package/lib/analyses/TypedWebSocketOperationAnalyzer.d.ts +0 -15
  245. package/lib/analyses/TypedWebSocketOperationAnalyzer.js +0 -226
  246. package/lib/analyses/TypedWebSocketOperationAnalyzer.js.map +0 -1
  247. package/lib/generates/internal/SwaggerDescriptionGenerator.d.ts +0 -14
  248. package/lib/generates/internal/SwaggerDescriptionGenerator.js +0 -33
  249. package/lib/generates/internal/SwaggerDescriptionGenerator.js.map +0 -1
  250. package/lib/generates/internal/SwaggerSchemaGenerator.d.ts +0 -21
  251. package/lib/generates/internal/SwaggerSchemaGenerator.js +0 -289
  252. package/lib/generates/internal/SwaggerSchemaGenerator.js.map +0 -1
  253. package/lib/generates/internal/SwaggerSchemaValidator.d.ts +0 -7
  254. package/lib/generates/internal/SwaggerSchemaValidator.js +0 -191
  255. package/lib/generates/internal/SwaggerSchemaValidator.js.map +0 -1
  256. package/lib/structures/IErrorReport.d.ts +0 -6
  257. package/lib/structures/IErrorReport.js.map +0 -1
  258. package/lib/structures/INormalizedInput.d.ts +0 -19
  259. package/lib/structures/INormalizedInput.js.map +0 -1
  260. package/lib/structures/ISwaggerError.d.ts +0 -6
  261. package/lib/structures/ISwaggerError.js.map +0 -1
  262. package/lib/structures/ISwaggerLazyProperty.d.ts +0 -6
  263. package/lib/structures/ISwaggerLazyProperty.js.map +0 -1
  264. package/lib/structures/ISwaggerLazySchema.d.ts +0 -6
  265. package/lib/structures/ISwaggerLazySchema.js.map +0 -1
  266. package/lib/structures/ITypeTuple.d.ts +0 -5
  267. package/lib/structures/ITypeTuple.js +0 -3
  268. package/lib/structures/ITypeTuple.js.map +0 -1
  269. package/src/analyses/TypedControllerAnalyzer.ts +0 -92
  270. package/src/analyses/TypedHttpOperationAnalyzer.ts +0 -365
  271. package/src/analyses/TypedWebSocketOperationAnalyzer.ts +0 -375
  272. package/src/generates/internal/SwaggerSchemaGenerator.ts +0 -473
  273. package/src/generates/internal/SwaggerSchemaValidator.ts +0 -206
  274. package/src/structures/IErrorReport.ts +0 -6
  275. package/src/structures/INormalizedInput.ts +0 -20
  276. package/src/structures/ISwaggerError.ts +0 -8
  277. package/src/structures/ISwaggerLazyProperty.ts +0 -7
  278. package/src/structures/ISwaggerLazySchema.ts +0 -7
  279. package/src/structures/ITypeTuple.ts +0 -6
@@ -1,5 +1,4 @@
1
1
  import ts from "typescript";
2
- import typia from "typia";
3
2
  import { ExpressionFactory } from "typia/lib/factories/ExpressionFactory";
4
3
  import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
5
4
  import { LiteralFactory } from "typia/lib/factories/LiteralFactory";
@@ -7,14 +6,13 @@ import { TypeFactory } from "typia/lib/factories/TypeFactory";
7
6
  import { Escaper } from "typia/lib/utils/Escaper";
8
7
 
9
8
  import { INestiaProject } from "../../structures/INestiaProject";
10
- import { IReflectHttpOperation } from "../../structures/IReflectHttpOperation";
11
9
  import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
10
+ import { ITypedHttpRouteParameter } from "../../structures/ITypedHttpRouteParameter";
12
11
  import { FilePrinter } from "./FilePrinter";
13
12
  import { ImportDictionary } from "./ImportDictionary";
14
13
  import { SdkAliasCollection } from "./SdkAliasCollection";
15
14
  import { SdkHttpSimulationProgrammer } from "./SdkHttpSimulationProgrammer";
16
15
  import { SdkImportWizard } from "./SdkImportWizard";
17
- import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
18
16
 
19
17
  export namespace SdkHttpNamespaceProgrammer {
20
18
  export const write =
@@ -23,9 +21,9 @@ export namespace SdkHttpNamespaceProgrammer {
23
21
  (
24
22
  route: ITypedHttpRoute,
25
23
  props: {
26
- headers: ITypedHttpRoute.IParameter | undefined;
27
- query: ITypedHttpRoute.IParameter | undefined;
28
- input: ITypedHttpRoute.IParameter | undefined;
24
+ headers: ITypedHttpRouteParameter.IHeaders | undefined;
25
+ query: ITypedHttpRouteParameter.IQuery | undefined;
26
+ input: ITypedHttpRouteParameter.IBody | undefined;
29
27
  },
30
28
  ): ts.ModuleDeclaration => {
31
29
  const types = write_types(project)(importer)(route, props);
@@ -37,7 +35,7 @@ export namespace SdkHttpNamespaceProgrammer {
37
35
  ...(types.length ? [FilePrinter.enter()] : []),
38
36
  write_metadata(importer)(route, props),
39
37
  FilePrinter.enter(),
40
- write_path(project)(importer)(route, props),
38
+ write_path(route, props.query),
41
39
  ...(project.config.simulate
42
40
  ? [
43
41
  SdkHttpSimulationProgrammer.random(project)(importer)(route),
@@ -48,7 +46,7 @@ export namespace SdkHttpNamespaceProgrammer {
48
46
  ]
49
47
  : []),
50
48
  ...(project.config.json &&
51
- typia.is<IReflectHttpOperation.IBodyParameter>(props.input) &&
49
+ props.input !== undefined &&
52
50
  (props.input.contentType === "application/json" ||
53
51
  props.input.encrypted === true)
54
52
  ? [write_stringify(project)(importer)]
@@ -64,9 +62,9 @@ export namespace SdkHttpNamespaceProgrammer {
64
62
  (
65
63
  route: ITypedHttpRoute,
66
64
  props: {
67
- headers: ITypedHttpRoute.IParameter | undefined;
68
- query: ITypedHttpRoute.IParameter | undefined;
69
- input: ITypedHttpRoute.IParameter | undefined;
65
+ headers: ITypedHttpRouteParameter.IHeaders | undefined;
66
+ query: ITypedHttpRouteParameter.IQuery | undefined;
67
+ input: ITypedHttpRouteParameter.IBody | undefined;
70
68
  },
71
69
  ): ts.TypeAliasDeclaration[] => {
72
70
  const array: ts.TypeAliasDeclaration[] = [];
@@ -94,7 +92,7 @@ export namespace SdkHttpNamespaceProgrammer {
94
92
  "Input",
95
93
  SdkAliasCollection.input(project)(importer)(props.input),
96
94
  );
97
- if (project.config.propagate === true || route.output.typeName !== "void")
95
+ if (route.success.type.name !== "void")
98
96
  declare("Output", SdkAliasCollection.output(project)(importer)(route));
99
97
  return array;
100
98
  };
@@ -104,9 +102,9 @@ export namespace SdkHttpNamespaceProgrammer {
104
102
  (
105
103
  route: ITypedHttpRoute,
106
104
  props: {
107
- headers: ITypedHttpRoute.IParameter | undefined;
108
- query: ITypedHttpRoute.IParameter | undefined;
109
- input: ITypedHttpRoute.IParameter | undefined;
105
+ headers: ITypedHttpRouteParameter.IHeaders | undefined;
106
+ query: ITypedHttpRouteParameter.IQuery | undefined;
107
+ input: ITypedHttpRouteParameter.IBody | undefined;
110
108
  },
111
109
  ): ts.VariableStatement =>
112
110
  constant("METADATA")(
@@ -125,9 +123,7 @@ export namespace SdkHttpNamespaceProgrammer {
125
123
  "request",
126
124
  props.input
127
125
  ? LiteralFactory.generate(
128
- typia.is<IReflectHttpOperation.IBodyParameter>(
129
- props.input,
130
- )
126
+ props.input !== undefined
131
127
  ? {
132
128
  type: props.input.contentType,
133
129
  encrypted: !!props.input.encrypted,
@@ -143,18 +139,18 @@ export namespace SdkHttpNamespaceProgrammer {
143
139
  "response",
144
140
  route.method !== "HEAD"
145
141
  ? LiteralFactory.generate({
146
- type: route.output.contentType,
147
- encrypted: !!route.encrypted,
142
+ type: route.success.contentType,
143
+ encrypted: !!route.success.encrypted,
148
144
  })
149
145
  : ts.factory.createNull(),
150
146
  ),
151
147
  ts.factory.createPropertyAssignment(
152
148
  "status",
153
- route.status !== undefined
154
- ? ExpressionFactory.number(route.status)
149
+ route.success.status !== null
150
+ ? ExpressionFactory.number(route.success.status)
155
151
  : ts.factory.createNull(),
156
152
  ),
157
- ...(route.output.contentType ===
153
+ ...(route.success.contentType ===
158
154
  "application/x-www-form-urlencoded"
159
155
  ? [
160
156
  ts.factory.createPropertyAssignment(
@@ -163,11 +159,7 @@ export namespace SdkHttpNamespaceProgrammer {
163
159
  ts.factory.createIdentifier(
164
160
  `${SdkImportWizard.typia(importer)}.http.createAssertQuery`,
165
161
  ),
166
- [
167
- ts.factory.createTypeReferenceNode(
168
- route.output.typeName,
169
- ),
170
- ],
162
+ [SdkAliasCollection.name(route.success.type)],
171
163
  undefined,
172
164
  ),
173
165
  ),
@@ -182,278 +174,263 @@ export namespace SdkHttpNamespaceProgrammer {
182
174
  ),
183
175
  );
184
176
 
185
- const write_path =
186
- (project: INestiaProject) =>
187
- (importer: ImportDictionary) =>
188
- (
189
- route: ITypedHttpRoute,
190
- props: {
191
- query: ITypedHttpRoute.IParameter | undefined;
192
- },
193
- ): ts.VariableStatement => {
194
- const g = {
195
- total: [
196
- ...route.parameters.filter(
197
- (param) => param.category === "param" || param.category === "query",
198
- ),
199
- ],
200
- query: route.parameters.filter(
201
- (param) => param.category === "query" && param.field !== undefined,
177
+ const write_path = (
178
+ route: ITypedHttpRoute,
179
+ query: ITypedHttpRouteParameter.IQuery | undefined,
180
+ ): ts.VariableStatement => {
181
+ const g = {
182
+ total: [
183
+ ...route.parameters.filter(
184
+ (param) => param.category === "param" || param.category === "query",
202
185
  ),
203
- path: route.parameters.filter((param) => param.category === "param"),
204
- };
205
- const out = (body: ts.ConciseBody) =>
206
- constant("path")(
207
- ts.factory.createArrowFunction(
208
- [],
209
- [],
210
- g.total.map((p) =>
211
- IdentifierFactory.parameter(
212
- p.name,
213
- p === props.query
214
- ? p.optional
215
- ? ts.factory.createUnionTypeNode([
216
- ts.factory.createTypeReferenceNode(
217
- `${route.name}.Query`,
218
- ),
219
- ts.factory.createTypeReferenceNode("undefined"),
220
- ])
221
- : ts.factory.createTypeReferenceNode(`${route.name}.Query`)
222
- : getType(project)(importer)(p),
223
- ),
186
+ ],
187
+ query: route.parameters
188
+ .filter((param) => param.category === "query")
189
+ .filter((param) => param.field !== null),
190
+ path: route.parameters.filter((param) => param.category === "param"),
191
+ };
192
+ const out = (body: ts.ConciseBody) =>
193
+ constant("path")(
194
+ ts.factory.createArrowFunction(
195
+ [],
196
+ [],
197
+ g.total.map((p) =>
198
+ IdentifierFactory.parameter(
199
+ p.name,
200
+ p === query
201
+ ? p.metadata.isRequired() === false
202
+ ? ts.factory.createUnionTypeNode([
203
+ ts.factory.createTypeReferenceNode(`${route.name}.Query`),
204
+ ts.factory.createTypeReferenceNode("undefined"),
205
+ ])
206
+ : ts.factory.createTypeReferenceNode(`${route.name}.Query`)
207
+ : SdkAliasCollection.name(p.type),
224
208
  ),
225
- undefined,
226
- undefined,
227
- body,
228
209
  ),
229
- );
230
- if (g.total.length === 0)
231
- return out(ts.factory.createStringLiteral(route.path));
210
+ undefined,
211
+ undefined,
212
+ body,
213
+ ),
214
+ );
215
+ if (g.total.length === 0)
216
+ return out(ts.factory.createStringLiteral(route.path));
232
217
 
233
- const template = () => {
234
- const splitted: string[] = route.path.split(":");
235
- if (splitted.length === 1)
236
- return ts.factory.createStringLiteral(route.path);
237
- return ts.factory.createTemplateExpression(
238
- ts.factory.createTemplateHead(splitted[0]),
239
- splitted.slice(1).map((s, i, arr) => {
240
- const name: string = s.split("/")[0];
241
- return ts.factory.createTemplateSpan(
242
- ts.factory.createCallExpression(
243
- ts.factory.createIdentifier("encodeURIComponent"),
244
- undefined,
245
- [
246
- ts.factory.createBinaryExpression(
247
- ts.factory.createIdentifier(
248
- g.path.find((p) => p.field === name)!.name,
249
- ),
250
- ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
251
- ts.factory.createStringLiteral("null"),
218
+ const template = () => {
219
+ const splitted: string[] = route.path.split(":");
220
+ if (splitted.length === 1)
221
+ return ts.factory.createStringLiteral(route.path);
222
+ return ts.factory.createTemplateExpression(
223
+ ts.factory.createTemplateHead(splitted[0]),
224
+ splitted.slice(1).map((s, i, arr) => {
225
+ const name: string = s.split("/")[0];
226
+ return ts.factory.createTemplateSpan(
227
+ ts.factory.createCallExpression(
228
+ ts.factory.createIdentifier("encodeURIComponent"),
229
+ undefined,
230
+ [
231
+ ts.factory.createBinaryExpression(
232
+ ts.factory.createIdentifier(
233
+ g.path.find((p) => p.field === name)!.name,
252
234
  ),
253
- ],
254
- ),
255
- (i !== arr.length - 1
256
- ? ts.factory.createTemplateMiddle
257
- : ts.factory.createTemplateTail)(s.substring(name.length)),
258
- );
259
- }),
260
- );
261
- };
262
- if (props.query === undefined && g.query.length === 0)
263
- return out(template());
235
+ ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
236
+ ts.factory.createStringLiteral("null"),
237
+ ),
238
+ ],
239
+ ),
240
+ (i !== arr.length - 1
241
+ ? ts.factory.createTemplateMiddle
242
+ : ts.factory.createTemplateTail)(s.substring(name.length)),
243
+ );
244
+ }),
245
+ );
246
+ };
247
+ if (query === undefined && g.query.length === 0) return out(template());
264
248
 
265
- const block = (expr: ts.Expression) => {
266
- const computeName = (str: string): string =>
267
- g.total
268
- .filter((p) => p.category !== "headers")
269
- .find((p) => p.name === str) !== undefined
270
- ? computeName("_" + str)
271
- : str;
272
- const variables: string = computeName("variables");
273
- return ts.factory.createBlock(
274
- [
275
- local(variables)("URLSearchParams")(
276
- ts.factory.createNewExpression(
277
- ts.factory.createIdentifier("URLSearchParams"),
278
- [],
279
- [],
280
- ),
249
+ const block = (expr: ts.Expression) => {
250
+ const computeName = (str: string): string =>
251
+ g.total.find((p) => p.name === str) !== undefined
252
+ ? computeName("_" + str)
253
+ : str;
254
+ const variables: string = computeName("variables");
255
+ return ts.factory.createBlock(
256
+ [
257
+ local(variables)("URLSearchParams")(
258
+ ts.factory.createNewExpression(
259
+ ts.factory.createIdentifier("URLSearchParams"),
260
+ [],
261
+ [],
281
262
  ),
282
- ts.factory.createForOfStatement(
263
+ ),
264
+ ts.factory.createForOfStatement(
265
+ undefined,
266
+ ts.factory.createVariableDeclarationList(
267
+ [
268
+ ts.factory.createVariableDeclaration(
269
+ ts.factory.createArrayBindingPattern([
270
+ ts.factory.createBindingElement(
271
+ undefined,
272
+ undefined,
273
+ ts.factory.createIdentifier("key"),
274
+ undefined,
275
+ ),
276
+ ts.factory.createBindingElement(
277
+ undefined,
278
+ undefined,
279
+ ts.factory.createIdentifier("value"),
280
+ undefined,
281
+ ),
282
+ ]),
283
+ undefined,
284
+ undefined,
285
+ undefined,
286
+ ),
287
+ ],
288
+ ts.NodeFlags.Const,
289
+ ),
290
+ ts.factory.createCallExpression(
291
+ ts.factory.createIdentifier("Object.entries"),
283
292
  undefined,
284
- ts.factory.createVariableDeclarationList(
285
- [
286
- ts.factory.createVariableDeclaration(
287
- ts.factory.createArrayBindingPattern([
288
- ts.factory.createBindingElement(
289
- undefined,
290
- undefined,
291
- ts.factory.createIdentifier("key"),
293
+ [ts.factory.createAsExpression(expr, TypeFactory.keyword("any"))],
294
+ ),
295
+ ts.factory.createIfStatement(
296
+ ts.factory.createStrictEquality(
297
+ ts.factory.createIdentifier("undefined"),
298
+ ts.factory.createIdentifier("value"),
299
+ ),
300
+ ts.factory.createContinueStatement(),
301
+ ts.factory.createIfStatement(
302
+ ts.factory.createCallExpression(
303
+ ts.factory.createIdentifier("Array.isArray"),
304
+ undefined,
305
+ [ts.factory.createIdentifier("value")],
306
+ ),
307
+ ts.factory.createExpressionStatement(
308
+ ts.factory.createCallExpression(
309
+ ts.factory.createPropertyAccessExpression(
310
+ ts.factory.createIdentifier("value"),
311
+ ts.factory.createIdentifier("forEach"),
312
+ ),
313
+ undefined,
314
+ [
315
+ ts.factory.createArrowFunction(
292
316
  undefined,
293
- ),
294
- ts.factory.createBindingElement(
295
317
  undefined,
318
+ [IdentifierFactory.parameter("elem")],
296
319
  undefined,
297
- ts.factory.createIdentifier("value"),
298
320
  undefined,
321
+ ts.factory.createCallExpression(
322
+ IdentifierFactory.access(
323
+ ts.factory.createIdentifier(variables),
324
+ )("append"),
325
+ undefined,
326
+ [
327
+ ts.factory.createIdentifier("key"),
328
+ ts.factory.createCallExpression(
329
+ ts.factory.createIdentifier("String"),
330
+ undefined,
331
+ [ts.factory.createIdentifier("elem")],
332
+ ),
333
+ ],
334
+ ),
299
335
  ),
300
- ]),
301
- undefined,
302
- undefined,
303
- undefined,
336
+ ],
304
337
  ),
305
- ],
306
- ts.NodeFlags.Const,
307
- ),
308
- ts.factory.createCallExpression(
309
- ts.factory.createIdentifier("Object.entries"),
310
- undefined,
311
- [
312
- ts.factory.createAsExpression(
313
- expr,
314
- TypeFactory.keyword("any"),
315
- ),
316
- ],
317
- ),
318
- ts.factory.createIfStatement(
319
- ts.factory.createStrictEquality(
320
- ts.factory.createIdentifier("undefined"),
321
- ts.factory.createIdentifier("value"),
322
338
  ),
323
- ts.factory.createContinueStatement(),
324
- ts.factory.createIfStatement(
339
+ ts.factory.createExpressionStatement(
325
340
  ts.factory.createCallExpression(
326
- ts.factory.createIdentifier("Array.isArray"),
341
+ IdentifierFactory.access(
342
+ ts.factory.createIdentifier(variables),
343
+ )("set"),
327
344
  undefined,
328
- [ts.factory.createIdentifier("value")],
329
- ),
330
- ts.factory.createExpressionStatement(
331
- ts.factory.createCallExpression(
332
- ts.factory.createPropertyAccessExpression(
333
- ts.factory.createIdentifier("value"),
334
- ts.factory.createIdentifier("forEach"),
345
+ [
346
+ ts.factory.createIdentifier("key"),
347
+ ts.factory.createCallExpression(
348
+ ts.factory.createIdentifier("String"),
349
+ undefined,
350
+ [ts.factory.createIdentifier("value")],
335
351
  ),
336
- undefined,
337
- [
338
- ts.factory.createArrowFunction(
339
- undefined,
340
- undefined,
341
- [IdentifierFactory.parameter("elem")],
342
- undefined,
343
- undefined,
344
- ts.factory.createCallExpression(
345
- IdentifierFactory.access(
346
- ts.factory.createIdentifier(variables),
347
- )("append"),
348
- undefined,
349
- [
350
- ts.factory.createIdentifier("key"),
351
- ts.factory.createCallExpression(
352
- ts.factory.createIdentifier("String"),
353
- undefined,
354
- [ts.factory.createIdentifier("elem")],
355
- ),
356
- ],
357
- ),
358
- ),
359
- ],
360
- ),
352
+ ],
353
+ ),
354
+ ),
355
+ ),
356
+ ),
357
+ ),
358
+ local("location")("string")(template()),
359
+ ts.factory.createReturnStatement(
360
+ ts.factory.createConditionalExpression(
361
+ ts.factory.createStrictEquality(
362
+ ExpressionFactory.number(0),
363
+ IdentifierFactory.access(
364
+ ts.factory.createIdentifier(variables),
365
+ )("size"),
366
+ ),
367
+ undefined,
368
+ ts.factory.createIdentifier("location"),
369
+ undefined,
370
+ ts.factory.createTemplateExpression(
371
+ ts.factory.createTemplateHead(""),
372
+ [
373
+ ts.factory.createTemplateSpan(
374
+ ts.factory.createIdentifier("location"),
375
+ ts.factory.createTemplateMiddle("?"),
361
376
  ),
362
- ts.factory.createExpressionStatement(
377
+ ts.factory.createTemplateSpan(
363
378
  ts.factory.createCallExpression(
364
379
  IdentifierFactory.access(
365
380
  ts.factory.createIdentifier(variables),
366
- )("set"),
381
+ )("toString"),
382
+ undefined,
367
383
  undefined,
368
- [
369
- ts.factory.createIdentifier("key"),
370
- ts.factory.createCallExpression(
371
- ts.factory.createIdentifier("String"),
372
- undefined,
373
- [ts.factory.createIdentifier("value")],
374
- ),
375
- ],
376
384
  ),
385
+ ts.factory.createTemplateTail(""),
377
386
  ),
378
- ),
379
- ),
380
- ),
381
- local("location")("string")(template()),
382
- ts.factory.createReturnStatement(
383
- ts.factory.createConditionalExpression(
384
- ts.factory.createStrictEquality(
385
- ExpressionFactory.number(0),
386
- IdentifierFactory.access(
387
- ts.factory.createIdentifier(variables),
388
- )("size"),
389
- ),
390
- undefined,
391
- ts.factory.createIdentifier("location"),
392
- undefined,
393
- ts.factory.createTemplateExpression(
394
- ts.factory.createTemplateHead(""),
395
- [
396
- ts.factory.createTemplateSpan(
397
- ts.factory.createIdentifier("location"),
398
- ts.factory.createTemplateMiddle("?"),
399
- ),
400
- ts.factory.createTemplateSpan(
401
- ts.factory.createCallExpression(
402
- IdentifierFactory.access(
403
- ts.factory.createIdentifier(variables),
404
- )("toString"),
405
- undefined,
406
- undefined,
407
- ),
408
- ts.factory.createTemplateTail(""),
409
- ),
410
- ],
411
- ),
387
+ ],
412
388
  ),
413
389
  ),
414
- ],
415
- true,
416
- );
417
- };
418
- if (props.query !== undefined && g.query.length === 0)
419
- return out(
420
- block(
421
- props.query.optional
422
- ? ts.factory.createBinaryExpression(
423
- ts.factory.createIdentifier(props.query.name),
424
- ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
425
- ts.factory.createObjectLiteralExpression([], false),
426
- )
427
- : ts.factory.createIdentifier(props.query.name),
428
390
  ),
429
- );
391
+ ],
392
+ true,
393
+ );
394
+ };
395
+ if (query !== undefined && g.query.length === 0)
430
396
  return out(
431
397
  block(
432
- ts.factory.createObjectLiteralExpression(
433
- [
434
- ...(props.query
435
- ? [
436
- ts.factory.createSpreadAssignment(
437
- ts.factory.createIdentifier(props.query.name),
438
- ),
439
- ]
440
- : []),
441
- ...g.query.map((q) =>
442
- q.name === q.field
443
- ? ts.factory.createShorthandPropertyAssignment(q.name)
444
- : ts.factory.createPropertyAssignment(
445
- Escaper.variable(q.field!)
446
- ? q.field!
447
- : ts.factory.createStringLiteral(q.field!),
448
- ts.factory.createIdentifier(q.name),
449
- ),
450
- ),
451
- ],
452
- true,
453
- ),
398
+ query.metadata.isRequired() === false
399
+ ? ts.factory.createBinaryExpression(
400
+ ts.factory.createIdentifier(query.name),
401
+ ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
402
+ ts.factory.createObjectLiteralExpression([], false),
403
+ )
404
+ : ts.factory.createIdentifier(query.name),
454
405
  ),
455
406
  );
456
- };
407
+ return out(
408
+ block(
409
+ ts.factory.createObjectLiteralExpression(
410
+ [
411
+ ...(query
412
+ ? [
413
+ ts.factory.createSpreadAssignment(
414
+ ts.factory.createIdentifier(query.name),
415
+ ),
416
+ ]
417
+ : []),
418
+ ...g.query.map((q) =>
419
+ q.name === q.field
420
+ ? ts.factory.createShorthandPropertyAssignment(q.name)
421
+ : ts.factory.createPropertyAssignment(
422
+ Escaper.variable(q.field!)
423
+ ? q.field!
424
+ : ts.factory.createStringLiteral(q.field!),
425
+ ts.factory.createIdentifier(q.name),
426
+ ),
427
+ ),
428
+ ],
429
+ true,
430
+ ),
431
+ ),
432
+ );
433
+ };
457
434
 
458
435
  const write_stringify =
459
436
  (project: INestiaProject) =>
@@ -513,10 +490,3 @@ const constant = (name: string) => (expression: ts.Expression) =>
513
490
  ts.NodeFlags.Const,
514
491
  ),
515
492
  );
516
- const getType =
517
- (project: INestiaProject) =>
518
- (importer: ImportDictionary) =>
519
- (p: ITypedHttpRoute.IParameter | ITypedHttpRoute.IOutput) =>
520
- p.metadata
521
- ? SdkTypeProgrammer.write(project)(importer)(p.metadata)
522
- : ts.factory.createTypeReferenceNode(p.typeName);