@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
@@ -2,25 +2,24 @@ import ts from "typescript";
2
2
  import typia from "typia";
3
3
 
4
4
  import { INestiaProject } from "../../structures/INestiaProject";
5
- import { IReflectHttpOperation } from "../../structures/IReflectHttpOperation";
5
+ import { IReflectHttpOperationParameter } from "../../structures/IReflectHttpOperationParameter";
6
+ import { IReflectType } from "../../structures/IReflectType";
6
7
  import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
8
+ import { ITypedHttpRouteParameter } from "../../structures/ITypedHttpRouteParameter";
7
9
  import { ImportDictionary } from "./ImportDictionary";
8
- import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
9
10
 
10
11
  export namespace SdkAliasCollection {
11
- export const name =
12
- (project: INestiaProject) =>
13
- (importer: ImportDictionary) =>
14
- (p: ITypedHttpRoute.IParameter | ITypedHttpRoute.IOutput): ts.TypeNode =>
15
- p.metadata
16
- ? SdkTypeProgrammer.write(project)(importer)(p.metadata)
17
- : ts.factory.createTypeReferenceNode(p.typeName);
12
+ export const name = (type: IReflectType): ts.TypeNode =>
13
+ ts.factory.createTypeReferenceNode(
14
+ type.name,
15
+ type.typeArguments ? type.typeArguments.map(name) : undefined,
16
+ );
18
17
 
19
18
  export const headers =
20
19
  (project: INestiaProject) =>
21
20
  (importer: ImportDictionary) =>
22
- (param: ITypedHttpRoute.IParameter): ts.TypeNode => {
23
- const type: ts.TypeNode = name(project)(importer)(param);
21
+ (param: ITypedHttpRouteParameter.IHeaders): ts.TypeNode => {
22
+ const type: ts.TypeNode = name(param);
24
23
  if (project.config.primitive === false) return type;
25
24
  return ts.factory.createTypeReferenceNode(
26
25
  importer.external({
@@ -35,8 +34,8 @@ export namespace SdkAliasCollection {
35
34
  export const query =
36
35
  (project: INestiaProject) =>
37
36
  (importer: ImportDictionary) =>
38
- (param: ITypedHttpRoute.IParameter): ts.TypeNode => {
39
- const type: ts.TypeNode = name(project)(importer)(param);
37
+ (param: ITypedHttpRouteParameter.IQuery): ts.TypeNode => {
38
+ const type: ts.TypeNode = name(param);
40
39
  if (project.config.primitive === false) return type;
41
40
  return ts.factory.createTypeReferenceNode(
42
41
  importer.external({
@@ -51,8 +50,8 @@ export namespace SdkAliasCollection {
51
50
  export const input =
52
51
  (project: INestiaProject) =>
53
52
  (importer: ImportDictionary) =>
54
- (param: ITypedHttpRoute.IParameter): ts.TypeNode => {
55
- const type: ts.TypeNode = name(project)(importer)(param);
53
+ (param: ITypedHttpRouteParameter): ts.TypeNode => {
54
+ const type: ts.TypeNode = name(param.type);
56
55
  if (project.config.clone === true || project.config.primitive === false)
57
56
  return type;
58
57
  return ts.factory.createTypeReferenceNode(
@@ -60,10 +59,11 @@ export namespace SdkAliasCollection {
60
59
  type: true,
61
60
  library: "@nestia/fetcher",
62
61
  instance:
63
- typia.is<IReflectHttpOperation.IBodyParameter>(param) &&
64
- param.contentType === "multipart/form-data"
65
- ? "Resolved"
66
- : "Primitive",
62
+ typia.is<IReflectHttpOperationParameter.IBody>(param) &&
63
+ (param.contentType === "application/json" ||
64
+ param.encrypted === true)
65
+ ? "Primitive"
66
+ : "Resolved",
67
67
  }),
68
68
  [type],
69
69
  );
@@ -74,40 +74,32 @@ export namespace SdkAliasCollection {
74
74
  (importer: ImportDictionary) =>
75
75
  (route: ITypedHttpRoute): ts.TypeNode => {
76
76
  if (project.config.propagate !== true) {
77
- const node: ts.TypeNode = name(project)(importer)(route.output);
78
- const type = project.checker.getTypeAtLocation(node);
79
- const filter = (flag: ts.TypeFlags) => (type.getFlags() & flag) !== 0;
80
-
81
- if (
82
- project.config.clone === true ||
83
- project.config.primitive === false ||
84
- filter(ts.TypeFlags.Undefined) ||
85
- filter(ts.TypeFlags.Never) ||
86
- filter(ts.TypeFlags.Void) ||
87
- filter(ts.TypeFlags.VoidLike)
88
- )
89
- return node;
77
+ if (project.config.clone === true || project.config.primitive === false)
78
+ return name(route.success.type);
90
79
  return ts.factory.createTypeReferenceNode(
91
80
  importer.external({
92
81
  type: true,
93
82
  library: "@nestia/fetcher",
94
83
  instance:
95
- route.output.contentType === "application/x-www-form-urlencoded"
96
- ? "Resolved"
97
- : "Primitive",
84
+ route.success.contentType === "application/json" ||
85
+ route.success.encrypted === true
86
+ ? "Primitive"
87
+ : "Resolved",
98
88
  }),
99
- [node],
89
+ [name(route.success.type)],
100
90
  );
101
91
  }
102
92
 
103
93
  const branches: IBranch[] = [
104
94
  {
105
- status: String(route.status ?? (route.method === "POST" ? 201 : 200)),
106
- type: name(project)(importer)(route.output),
95
+ status: String(
96
+ route.success.status ?? (route.method === "POST" ? 201 : 200),
97
+ ),
98
+ type: name(route.success.type),
107
99
  },
108
100
  ...Object.entries(route.exceptions).map(([status, value]) => ({
109
101
  status,
110
- type: name(project)(importer)(value),
102
+ type: name(value.type),
111
103
  })),
112
104
  ];
113
105
  return ts.factory.createTypeReferenceNode(
@@ -127,10 +119,10 @@ export namespace SdkAliasCollection {
127
119
  ),
128
120
  ),
129
121
  ),
130
- ...(route.status
122
+ ...(route.success.status
131
123
  ? [
132
124
  ts.factory.createLiteralTypeNode(
133
- ts.factory.createNumericLiteral(route.status),
125
+ ts.factory.createNumericLiteral(route.success.status),
134
126
  ),
135
127
  ]
136
128
  : []),
@@ -6,13 +6,16 @@ import typia from "typia";
6
6
  import { INestiaConfig } from "../../INestiaConfig";
7
7
 
8
8
  export namespace SdkDistributionComposer {
9
- export const compose = async (config: INestiaConfig, websocket: boolean) => {
10
- if (!fs.existsSync(config.distribute!))
11
- await fs.promises.mkdir(config.distribute!);
9
+ export const compose = async (props: {
10
+ config: INestiaConfig;
11
+ websocket: boolean;
12
+ }) => {
13
+ if (!fs.existsSync(props.config.distribute!))
14
+ await fs.promises.mkdir(props.config.distribute!);
12
15
 
13
16
  const root: string = process.cwd();
14
- const output: string = path.resolve(config.output!);
15
- process.chdir(config.distribute!);
17
+ const output: string = path.resolve(props.config.output!);
18
+ process.chdir(props.config.distribute!);
16
19
 
17
20
  const exit = () => process.chdir(root);
18
21
  if (await configured()) return exit();
@@ -31,7 +34,7 @@ export namespace SdkDistributionComposer {
31
34
  execute("npm install --save-dev rimraf");
32
35
  execute(`npm install --save @nestia/fetcher@${v.version}`);
33
36
  execute(`npm install --save typia@${v.typia}`);
34
- if (websocket) execute(`npm install --save tgrid@${v.tgrid}`);
37
+ if (props.websocket) execute(`npm install --save tgrid@${v.tgrid}`);
35
38
  execute("npx typia setup --manager npm");
36
39
 
37
40
  exit();
@@ -2,6 +2,7 @@ import fs from "fs";
2
2
  import ts from "typescript";
3
3
 
4
4
  import { INestiaProject } from "../../structures/INestiaProject";
5
+ import { ITypedApplication } from "../../structures/ITypedApplication";
5
6
  import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
6
7
  import { ITypedWebSocketRoute } from "../../structures/ITypedWebSocketRoute";
7
8
  import { MapUtil } from "../../utils/MapUtil";
@@ -15,18 +16,14 @@ export namespace SdkFileProgrammer {
15
16
  /* ---------------------------------------------------------
16
17
  CONSTRUCTOR
17
18
  --------------------------------------------------------- */
18
- export const generate =
19
- (project: INestiaProject) =>
20
- async (
21
- routeList: Array<ITypedHttpRoute | ITypedWebSocketRoute>,
22
- ): Promise<void> => {
23
- // CONSTRUCT FOLDER TREE
24
- const root: SdkRouteDirectory = new SdkRouteDirectory(null, "functional");
25
- for (const route of routeList) emplace(root)(route);
19
+ export const generate = async (app: ITypedApplication): Promise<void> => {
20
+ // CONSTRUCT FOLDER TREE
21
+ const root: SdkRouteDirectory = new SdkRouteDirectory(null, "functional");
22
+ for (const route of app.routes) emplace(root)(route);
26
23
 
27
- // ITERATE FILES
28
- await iterate(project)(root)(project.config.output + "/functional");
29
- };
24
+ // ITERATE FILES
25
+ await iterate(app.project)(root)(`${app.project.config.output}/functional`);
26
+ };
30
27
 
31
28
  const emplace =
32
29
  (directory: SdkRouteDirectory) =>
@@ -80,16 +77,16 @@ export namespace SdkFileProgrammer {
80
77
  directory.routes.forEach((route, i) => {
81
78
  if (project.config.clone !== true || route.protocol === "websocket")
82
79
  for (const tuple of route.imports)
83
- for (const instance of tuple[1])
80
+ for (const instance of tuple.instances)
84
81
  importer.internal({
85
- file: tuple[0],
82
+ file: tuple.file,
86
83
  instance,
87
84
  type: true,
88
85
  });
89
86
  statements.push(
90
87
  ...(route.protocol === "http"
91
88
  ? SdkHttpRouteProgrammer.write(project)(importer)(route)
92
- : SdkWebSocketRouteProgrammer.write(project)(importer)(route)),
89
+ : SdkWebSocketRouteProgrammer.write(importer)(route)),
93
90
  );
94
91
  if (i !== directory.routes.length - 1)
95
92
  statements.push(FilePrinter.enter());
@@ -1,154 +1,154 @@
1
- import { IPointer } from "tstl";
2
- import ts from "typescript";
3
- import { IJsDocTagInfo } from "typia";
4
- import { MetadataCollection } from "typia/lib/factories/MetadataCollection";
5
- import { MetadataFactory } from "typia/lib/factories/MetadataFactory";
6
- import { MetadataAlias } from "typia/lib/schemas/metadata/MetadataAlias";
7
- import { MetadataAtomic } from "typia/lib/schemas/metadata/MetadataAtomic";
8
- import { MetadataObject } from "typia/lib/schemas/metadata/MetadataObject";
1
+ // import { IPointer } from "tstl";
2
+ // import ts from "typescript";
3
+ // import { IJsDocTagInfo } from "typia";
4
+ // import { MetadataCollection } from "typia/lib/factories/MetadataCollection";
5
+ // import { MetadataFactory } from "typia/lib/factories/MetadataFactory";
6
+ // import { MetadataAlias } from "typia/lib/schemas/metadata/MetadataAlias";
7
+ // import { MetadataAtomic } from "typia/lib/schemas/metadata/MetadataAtomic";
8
+ // import { MetadataObject } from "typia/lib/schemas/metadata/MetadataObject";
9
9
 
10
- import { INestiaProject } from "../../structures/INestiaProject";
11
- import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
12
- import { MapUtil } from "../../utils/MapUtil";
13
- import { FilePrinter } from "./FilePrinter";
14
- import { ImportDictionary } from "./ImportDictionary";
15
- import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
10
+ // import { INestiaProject } from "../../structures/INestiaProject";
11
+ // import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
12
+ // import { MapUtil } from "../../utils/MapUtil";
13
+ // import { FilePrinter } from "./FilePrinter";
14
+ // import { ImportDictionary } from "./ImportDictionary";
15
+ // import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
16
16
 
17
- export namespace SdkHttpCloneProgrammer {
18
- export interface IModule {
19
- name: string;
20
- children: Map<string, IModule>;
21
- programmer:
22
- | null
23
- | ((importer: ImportDictionary) => ts.TypeAliasDeclaration);
24
- }
17
+ // export namespace SdkHttpCloneProgrammer {
18
+ // export interface IModule {
19
+ // name: string;
20
+ // children: Map<string, IModule>;
21
+ // programmer:
22
+ // | null
23
+ // | ((importer: ImportDictionary) => ts.TypeAliasDeclaration);
24
+ // }
25
25
 
26
- export const write =
27
- (project: INestiaProject) =>
28
- (routes: ITypedHttpRoute[]): Map<string, IModule> => {
29
- const collection = new MetadataCollection({
30
- replace: MetadataCollection.replace,
31
- });
32
- for (const r of routes) {
33
- for (const p of r.parameters) {
34
- const res = MetadataFactory.analyze(project.checker)({
35
- escape: false,
36
- constant: true,
37
- absorb: false,
38
- })(collection)(p.type);
39
- if (res.success) p.metadata = res.data;
40
- }
41
- for (const e of Object.values(r.exceptions)) {
42
- const res = MetadataFactory.analyze(project.checker)({
43
- escape: true,
44
- constant: true,
45
- absorb: false,
46
- })(collection)(e.type);
47
- if (res.success) e.metadata = res.data;
48
- }
49
- const res = MetadataFactory.analyze(project.checker)({
50
- escape: true,
51
- constant: true,
52
- absorb: false,
53
- })(collection)(r.output.type);
54
- if (res.success) r.output.metadata = res.data;
55
- }
26
+ // export const write =
27
+ // (project: INestiaProject) =>
28
+ // (routes: ITypedHttpRoute[]): Map<string, IModule> => {
29
+ // const collection = new MetadataCollection({
30
+ // replace: MetadataCollection.replace,
31
+ // });
32
+ // for (const r of routes) {
33
+ // for (const p of r.parameters) {
34
+ // const res = MetadataFactory.analyze(project.checker)({
35
+ // escape: false,
36
+ // constant: true,
37
+ // absorb: false,
38
+ // })(collection)(p.type);
39
+ // if (res.success) p.metadata = res.data;
40
+ // }
41
+ // for (const e of Object.values(r.exceptions)) {
42
+ // const res = MetadataFactory.analyze(project.checker)({
43
+ // escape: true,
44
+ // constant: true,
45
+ // absorb: false,
46
+ // })(collection)(e.type);
47
+ // if (res.success) e.metadata = res.data;
48
+ // }
49
+ // const res = MetadataFactory.analyze(project.checker)({
50
+ // escape: true,
51
+ // constant: true,
52
+ // absorb: false,
53
+ // })(collection)(r.output.type);
54
+ // if (res.success) r.success.metadata = res.data;
55
+ // }
56
56
 
57
- const dict: Map<string, IModule> = new Map();
58
- for (const alias of collection.aliases())
59
- if (isNamedDeclaration(alias.name))
60
- prepare(dict)(alias.name)((importer) =>
61
- write_alias(project)(importer)(alias),
62
- );
63
- for (const object of collection.objects())
64
- if (isNamedDeclaration(object.name))
65
- prepare(dict)(object.name)((importer) =>
66
- write_object(project)(importer)(object),
67
- );
68
- return dict;
69
- };
57
+ // const dict: Map<string, IModule> = new Map();
58
+ // for (const alias of collection.aliases())
59
+ // if (isNamedDeclaration(alias.name))
60
+ // prepare(dict)(alias.name)((importer) =>
61
+ // write_alias(project)(importer)(alias),
62
+ // );
63
+ // for (const object of collection.objects())
64
+ // if (isNamedDeclaration(object.name))
65
+ // prepare(dict)(object.name)((importer) =>
66
+ // write_object(project)(importer)(object),
67
+ // );
68
+ // return dict;
69
+ // };
70
70
 
71
- const prepare =
72
- (dict: Map<string, IModule>) =>
73
- (name: string) =>
74
- (programmer: (importer: ImportDictionary) => ts.TypeAliasDeclaration) => {
75
- const accessors: string[] = name.split(".");
76
- const modulo: IPointer<IModule> = { value: null! };
71
+ // const prepare =
72
+ // (dict: Map<string, IModule>) =>
73
+ // (name: string) =>
74
+ // (programmer: (importer: ImportDictionary) => ts.TypeAliasDeclaration) => {
75
+ // const accessors: string[] = name.split(".");
76
+ // const modulo: IPointer<IModule> = { value: null! };
77
77
 
78
- accessors.forEach((acc, i) => {
79
- modulo.value = MapUtil.take(dict, acc, () => ({
80
- name: acc,
81
- children: new Map(),
82
- programmer: null,
83
- }));
84
- if (i === accessors.length - 1) modulo.value.programmer = programmer;
85
- dict = modulo.value.children;
86
- });
87
- return modulo!;
88
- };
78
+ // accessors.forEach((acc, i) => {
79
+ // modulo.value = MapUtil.take(dict, acc, () => ({
80
+ // name: acc,
81
+ // children: new Map(),
82
+ // programmer: null,
83
+ // }));
84
+ // if (i === accessors.length - 1) modulo.value.programmer = programmer;
85
+ // dict = modulo.value.children;
86
+ // });
87
+ // return modulo!;
88
+ // };
89
89
 
90
- const write_alias =
91
- (project: INestiaProject) =>
92
- (importer: ImportDictionary) =>
93
- (alias: MetadataAlias): ts.TypeAliasDeclaration =>
94
- FilePrinter.description(
95
- ts.factory.createTypeAliasDeclaration(
96
- [ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
97
- alias.name.split(".").at(-1)!,
98
- [],
99
- SdkTypeProgrammer.write(project)(importer)(alias.value),
100
- ),
101
- writeComment([])(alias.description, alias.jsDocTags),
102
- );
90
+ // const write_alias =
91
+ // (project: INestiaProject) =>
92
+ // (importer: ImportDictionary) =>
93
+ // (alias: MetadataAlias): ts.TypeAliasDeclaration =>
94
+ // FilePrinter.description(
95
+ // ts.factory.createTypeAliasDeclaration(
96
+ // [ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
97
+ // alias.name.split(".").at(-1)!,
98
+ // [],
99
+ // SdkTypeProgrammer.write(project)(importer)(alias.value),
100
+ // ),
101
+ // writeComment([])(alias.description, alias.jsDocTags),
102
+ // );
103
103
 
104
- const write_object =
105
- (project: INestiaProject) =>
106
- (importer: ImportDictionary) =>
107
- (object: MetadataObject): ts.TypeAliasDeclaration => {
108
- return FilePrinter.description(
109
- ts.factory.createTypeAliasDeclaration(
110
- [ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
111
- object.name.split(".").at(-1)!,
112
- [],
113
- SdkTypeProgrammer.write_object(project)(importer)(object),
114
- ),
115
- writeComment([])(object.description ?? null, object.jsDocTags),
116
- );
117
- };
118
- }
104
+ // const write_object =
105
+ // (project: INestiaProject) =>
106
+ // (importer: ImportDictionary) =>
107
+ // (object: MetadataObject): ts.TypeAliasDeclaration => {
108
+ // return FilePrinter.description(
109
+ // ts.factory.createTypeAliasDeclaration(
110
+ // [ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
111
+ // object.name.split(".").at(-1)!,
112
+ // [],
113
+ // SdkTypeProgrammer.write_object(project)(importer)(object),
114
+ // ),
115
+ // writeComment([])(object.description ?? null, object.jsDocTags),
116
+ // );
117
+ // };
118
+ // }
119
119
 
120
- const isNamedDeclaration = (name: string) =>
121
- name !== "object" &&
122
- name !== "__type" &&
123
- !name.startsWith("__type.") &&
124
- name !== "__object" &&
125
- !name.startsWith("__object.");
120
+ // const isNamedDeclaration = (name: string) =>
121
+ // name !== "object" &&
122
+ // name !== "__type" &&
123
+ // !name.startsWith("__type.") &&
124
+ // name !== "__object" &&
125
+ // !name.startsWith("__object.");
126
126
 
127
- const writeComment =
128
- (atomics: MetadataAtomic[]) =>
129
- (description: string | null, jsDocTags: IJsDocTagInfo[]): string => {
130
- const lines: string[] = [];
131
- if (description?.length)
132
- lines.push(...description.split("\n").map((s) => `${s}`));
127
+ // const writeComment =
128
+ // (atomics: MetadataAtomic[]) =>
129
+ // (description: string | null, jsDocTags: IJsDocTagInfo[]): string => {
130
+ // const lines: string[] = [];
131
+ // if (description?.length)
132
+ // lines.push(...description.split("\n").map((s) => `${s}`));
133
133
 
134
- const filtered: IJsDocTagInfo[] =
135
- !!atomics.length && !!jsDocTags?.length
136
- ? jsDocTags.filter(
137
- (tag) =>
138
- !atomics.some((a) =>
139
- a.tags.some((r) => r.some((t) => t.kind === tag.name)),
140
- ),
141
- )
142
- : jsDocTags ?? [];
134
+ // const filtered: IJsDocTagInfo[] =
135
+ // !!atomics.length && !!jsDocTags?.length
136
+ // ? jsDocTags.filter(
137
+ // (tag) =>
138
+ // !atomics.some((a) =>
139
+ // a.tags.some((r) => r.some((t) => t.kind === tag.name)),
140
+ // ),
141
+ // )
142
+ // : jsDocTags ?? [];
143
143
 
144
- if (description?.length && filtered.length) lines.push("");
145
- if (filtered.length)
146
- lines.push(
147
- ...filtered.map((t) =>
148
- t.text?.length
149
- ? `@${t.name} ${t.text.map((e) => e.text).join("")}`
150
- : `@${t.name}`,
151
- ),
152
- );
153
- return lines.join("\n");
154
- };
144
+ // if (description?.length && filtered.length) lines.push("");
145
+ // if (filtered.length)
146
+ // lines.push(
147
+ // ...filtered.map((t) =>
148
+ // t.text?.length
149
+ // ? `@${t.name} ${t.text.map((e) => e.text).join("")}`
150
+ // : `@${t.name}`,
151
+ // ),
152
+ // );
153
+ // return lines.join("\n");
154
+ // };