@nestia/sdk 14.0.0 → 14.0.2

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 (391) hide show
  1. package/README.md +1 -1
  2. package/assets/bundle/distribute/build-sdk.cjs +28 -0
  3. package/assets/bundle/distribute/package.json +7 -3
  4. package/assets/bundle/distribute/tsconfig.json +15 -105
  5. package/lib/INestiaConfig.d.ts +74 -34
  6. package/lib/NestiaSdkApplication.d.ts +60 -0
  7. package/lib/NestiaSdkApplication.js +121 -32
  8. package/lib/NestiaSdkApplication.js.map +1 -1
  9. package/lib/NestiaSwaggerComposer.d.ts +21 -0
  10. package/lib/NestiaSwaggerComposer.js +32 -13
  11. package/lib/NestiaSwaggerComposer.js.map +1 -1
  12. package/lib/analyses/AccessorAnalyzer.d.ts +26 -0
  13. package/lib/analyses/AccessorAnalyzer.js +26 -0
  14. package/lib/analyses/AccessorAnalyzer.js.map +1 -1
  15. package/lib/analyses/ConfigAnalyzer.d.ts +41 -0
  16. package/lib/analyses/ConfigAnalyzer.js +52 -77
  17. package/lib/analyses/ConfigAnalyzer.js.map +1 -1
  18. package/lib/analyses/ImportAnalyzer.d.ts +25 -0
  19. package/lib/analyses/ImportAnalyzer.js +25 -0
  20. package/lib/analyses/ImportAnalyzer.js.map +1 -1
  21. package/lib/analyses/ParameterNameAnalyzer.d.ts +44 -0
  22. package/lib/analyses/ParameterNameAnalyzer.js +63 -0
  23. package/lib/analyses/ParameterNameAnalyzer.js.map +1 -0
  24. package/lib/analyses/PathAnalyzer.d.ts +93 -1
  25. package/lib/analyses/PathAnalyzer.js +160 -23
  26. package/lib/analyses/PathAnalyzer.js.map +1 -1
  27. package/lib/analyses/ReflectControllerAnalyzer.d.ts +32 -0
  28. package/lib/analyses/ReflectControllerAnalyzer.js +24 -1
  29. package/lib/analyses/ReflectControllerAnalyzer.js.map +1 -1
  30. package/lib/analyses/ReflectHttpOperationAnalyzer.d.ts +29 -0
  31. package/lib/analyses/ReflectHttpOperationAnalyzer.js +35 -24
  32. package/lib/analyses/ReflectHttpOperationAnalyzer.js.map +1 -1
  33. package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.d.ts +31 -0
  34. package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.js +21 -0
  35. package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.js.map +1 -1
  36. package/lib/analyses/ReflectHttpOperationParameterAnalyzer.d.ts +31 -0
  37. package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js +143 -23
  38. package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js.map +1 -1
  39. package/lib/analyses/ReflectHttpOperationResponseAnalyzer.d.ts +32 -0
  40. package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js +27 -2
  41. package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js.map +1 -1
  42. package/lib/analyses/ReflectMcpOperationAnalyzer.d.ts +29 -0
  43. package/lib/analyses/ReflectMcpOperationAnalyzer.js +35 -11
  44. package/lib/analyses/ReflectMcpOperationAnalyzer.js.map +1 -1
  45. package/lib/analyses/ReflectMetadataAnalyzer.d.ts +47 -0
  46. package/lib/analyses/ReflectMetadataAnalyzer.js +47 -0
  47. package/lib/analyses/ReflectMetadataAnalyzer.js.map +1 -1
  48. package/lib/analyses/ReflectWebSocketOperationAnalyzer.d.ts +29 -0
  49. package/lib/analyses/ReflectWebSocketOperationAnalyzer.js +27 -5
  50. package/lib/analyses/ReflectWebSocketOperationAnalyzer.js.map +1 -1
  51. package/lib/analyses/SecurityAnalyzer.d.ts +25 -0
  52. package/lib/analyses/SecurityAnalyzer.js +39 -19
  53. package/lib/analyses/SecurityAnalyzer.js.map +1 -1
  54. package/lib/analyses/SwaggerExampleAnalyzer.d.ts +31 -0
  55. package/lib/analyses/SwaggerExampleAnalyzer.js +36 -0
  56. package/lib/analyses/SwaggerExampleAnalyzer.js.map +1 -0
  57. package/lib/analyses/TypedHttpRouteAnalyzer.d.ts +41 -3
  58. package/lib/analyses/TypedHttpRouteAnalyzer.js +196 -172
  59. package/lib/analyses/TypedHttpRouteAnalyzer.js.map +1 -1
  60. package/lib/analyses/TypedMcpRouteAnalyzer.d.ts +29 -0
  61. package/lib/analyses/TypedMcpRouteAnalyzer.js +152 -20
  62. package/lib/analyses/TypedMcpRouteAnalyzer.js.map +1 -1
  63. package/lib/analyses/TypedWebSocketRouteAnalyzer.d.ts +19 -0
  64. package/lib/analyses/TypedWebSocketRouteAnalyzer.js +20 -1
  65. package/lib/analyses/TypedWebSocketRouteAnalyzer.js.map +1 -1
  66. package/lib/decorators/OperationMetadata.d.ts +6 -0
  67. package/lib/decorators/OperationMetadata.js +6 -0
  68. package/lib/decorators/OperationMetadata.js.map +1 -1
  69. package/lib/executable/internal/CommandParser.d.ts +19 -0
  70. package/lib/executable/internal/CommandParser.js +19 -0
  71. package/lib/executable/internal/CommandParser.js.map +1 -1
  72. package/lib/executable/internal/NestiaConfigLoader.d.ts +56 -0
  73. package/lib/executable/internal/NestiaConfigLoader.js +48 -42
  74. package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
  75. package/lib/executable/internal/NestiaSdkCommand.d.ts +60 -0
  76. package/lib/executable/internal/NestiaSdkCommand.js +95 -3
  77. package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
  78. package/lib/executable/internal/NestiaSdkWatcher.d.ts +81 -0
  79. package/lib/executable/internal/NestiaSdkWatcher.js +125 -41
  80. package/lib/executable/internal/NestiaSdkWatcher.js.map +1 -1
  81. package/lib/executable/internal/NestiaSwaggerWatch.d.ts +80 -0
  82. package/lib/executable/internal/NestiaSwaggerWatch.js +308 -0
  83. package/lib/executable/internal/NestiaSwaggerWatch.js.map +1 -0
  84. package/lib/executable/sdk.js +16 -1
  85. package/lib/executable/sdk.js.map +1 -1
  86. package/lib/factories/ExpressionFactory.d.ts +18 -0
  87. package/lib/factories/ExpressionFactory.js +21 -2
  88. package/lib/factories/ExpressionFactory.js.map +1 -1
  89. package/lib/factories/IdentifierFactory.d.ts +24 -0
  90. package/lib/factories/IdentifierFactory.js +24 -0
  91. package/lib/factories/IdentifierFactory.js.map +1 -1
  92. package/lib/factories/LiteralFactory.d.ts +22 -4
  93. package/lib/factories/LiteralFactory.js +33 -11
  94. package/lib/factories/LiteralFactory.js.map +1 -1
  95. package/lib/factories/StatementFactory.d.ts +28 -1
  96. package/lib/factories/StatementFactory.js +28 -1
  97. package/lib/factories/StatementFactory.js.map +1 -1
  98. package/lib/factories/TypeFactory.d.ts +24 -0
  99. package/lib/factories/TypeFactory.js +15 -0
  100. package/lib/factories/TypeFactory.js.map +1 -1
  101. package/lib/generates/CloneGenerator.d.ts +22 -0
  102. package/lib/generates/CloneGenerator.js +26 -5
  103. package/lib/generates/CloneGenerator.js.map +1 -1
  104. package/lib/generates/E2eGenerator.d.ts +19 -0
  105. package/lib/generates/E2eGenerator.js +19 -0
  106. package/lib/generates/E2eGenerator.js.map +1 -1
  107. package/lib/generates/SdkGenerator.d.ts +38 -0
  108. package/lib/generates/SdkGenerator.js +43 -5
  109. package/lib/generates/SdkGenerator.js.map +1 -1
  110. package/lib/generates/SwaggerGenerator.d.ts +36 -6
  111. package/lib/generates/SwaggerGenerator.js +190 -40
  112. package/lib/generates/SwaggerGenerator.js.map +1 -1
  113. package/lib/generates/internal/E2eFileProgrammer.d.ts +19 -0
  114. package/lib/generates/internal/E2eFileProgrammer.js +20 -1
  115. package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
  116. package/lib/generates/internal/FilePrinter.d.ts +57 -0
  117. package/lib/generates/internal/FilePrinter.js +74 -0
  118. package/lib/generates/internal/FilePrinter.js.map +1 -1
  119. package/lib/generates/internal/ImportDictionary.d.ts +93 -1
  120. package/lib/generates/internal/ImportDictionary.js +103 -2
  121. package/lib/generates/internal/ImportDictionary.js.map +1 -1
  122. package/lib/generates/internal/SdkAliasCollection.d.ts +121 -1
  123. package/lib/generates/internal/SdkAliasCollection.js +132 -11
  124. package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
  125. package/lib/generates/internal/SdkDistributionComposer.d.ts +19 -0
  126. package/lib/generates/internal/SdkDistributionComposer.js +149 -52
  127. package/lib/generates/internal/SdkDistributionComposer.js.map +1 -1
  128. package/lib/generates/internal/SdkFileProgrammer.d.ts +18 -0
  129. package/lib/generates/internal/SdkFileProgrammer.js +101 -12
  130. package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
  131. package/lib/generates/internal/SdkHttpCloneProgrammer.d.ts +29 -0
  132. package/lib/generates/internal/SdkHttpCloneProgrammer.js +33 -0
  133. package/lib/generates/internal/SdkHttpCloneProgrammer.js.map +1 -1
  134. package/lib/generates/internal/SdkHttpCloneReferencer.d.ts +19 -0
  135. package/lib/generates/internal/SdkHttpCloneReferencer.js +78 -25
  136. package/lib/generates/internal/SdkHttpCloneReferencer.js.map +1 -1
  137. package/lib/generates/internal/SdkHttpFunctionProgrammer.d.ts +19 -0
  138. package/lib/generates/internal/SdkHttpFunctionProgrammer.js +40 -23
  139. package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
  140. package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +19 -0
  141. package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +46 -34
  142. package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
  143. package/lib/generates/internal/SdkHttpParameterProgrammer.d.ts +142 -1
  144. package/lib/generates/internal/SdkHttpParameterProgrammer.js +175 -6
  145. package/lib/generates/internal/SdkHttpParameterProgrammer.js.map +1 -1
  146. package/lib/generates/internal/SdkHttpRouteProgrammer.d.ts +20 -0
  147. package/lib/generates/internal/SdkHttpRouteProgrammer.js +36 -32
  148. package/lib/generates/internal/SdkHttpRouteProgrammer.js.map +1 -1
  149. package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +38 -0
  150. package/lib/generates/internal/SdkHttpSimulationProgrammer.js +66 -18
  151. package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
  152. package/lib/generates/internal/SdkImportWizard.d.ts +63 -0
  153. package/lib/generates/internal/SdkImportWizard.js +63 -0
  154. package/lib/generates/internal/SdkImportWizard.js.map +1 -1
  155. package/lib/generates/internal/SdkMcpRouteProgrammer.d.ts +17 -2
  156. package/lib/generates/internal/SdkMcpRouteProgrammer.js +72 -24
  157. package/lib/generates/internal/SdkMcpRouteProgrammer.js.map +1 -1
  158. package/lib/generates/internal/SdkPathTemplate.d.ts +36 -0
  159. package/lib/generates/internal/SdkPathTemplate.js +65 -0
  160. package/lib/generates/internal/SdkPathTemplate.js.map +1 -0
  161. package/lib/generates/internal/SdkRouteDirectory.d.ts +10 -0
  162. package/lib/generates/internal/SdkRouteDirectory.js +10 -0
  163. package/lib/generates/internal/SdkRouteDirectory.js.map +1 -1
  164. package/lib/generates/internal/SdkTypeProgrammer.d.ts +54 -1
  165. package/lib/generates/internal/SdkTypeProgrammer.js +111 -27
  166. package/lib/generates/internal/SdkTypeProgrammer.js.map +1 -1
  167. package/lib/generates/internal/SdkTypeTagProgrammer.d.ts +53 -1
  168. package/lib/generates/internal/SdkTypeTagProgrammer.js +407 -67
  169. package/lib/generates/internal/SdkTypeTagProgrammer.js.map +1 -1
  170. package/lib/generates/internal/SdkWebSocketCloneProgrammer.d.ts +40 -0
  171. package/lib/generates/internal/SdkWebSocketCloneProgrammer.js +149 -142
  172. package/lib/generates/internal/SdkWebSocketCloneProgrammer.js.map +1 -1
  173. package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.d.ts +19 -0
  174. package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +46 -36
  175. package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
  176. package/lib/generates/internal/SdkWebSocketParameterProgrammer.d.ts +114 -1
  177. package/lib/generates/internal/SdkWebSocketParameterProgrammer.js +120 -5
  178. package/lib/generates/internal/SdkWebSocketParameterProgrammer.js.map +1 -1
  179. package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +18 -0
  180. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +75 -33
  181. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
  182. package/lib/generates/internal/SwaggerDescriptionComposer.d.ts +42 -0
  183. package/lib/generates/internal/SwaggerDescriptionComposer.js +44 -1
  184. package/lib/generates/internal/SwaggerDescriptionComposer.js.map +1 -1
  185. package/lib/generates/internal/SwaggerOperationComposer.d.ts +18 -0
  186. package/lib/generates/internal/SwaggerOperationComposer.js +37 -8
  187. package/lib/generates/internal/SwaggerOperationComposer.js.map +1 -1
  188. package/lib/generates/internal/SwaggerOperationParameterComposer.d.ts +40 -1
  189. package/lib/generates/internal/SwaggerOperationParameterComposer.js +230 -25
  190. package/lib/generates/internal/SwaggerOperationParameterComposer.js.map +1 -1
  191. package/lib/generates/internal/SwaggerOperationResponseComposer.d.ts +21 -0
  192. package/lib/generates/internal/SwaggerOperationResponseComposer.js +58 -7
  193. package/lib/generates/internal/SwaggerOperationResponseComposer.js.map +1 -1
  194. package/lib/internal/legacy.d.ts +342 -31
  195. package/lib/internal/legacy.js +207 -31
  196. package/lib/internal/legacy.js.map +1 -1
  197. package/lib/structures/INestiaProject.d.ts +10 -0
  198. package/lib/structures/INestiaSdkInput.d.ts +30 -0
  199. package/lib/structures/IOperationMetadata.d.ts +77 -0
  200. package/lib/structures/IReflectController.d.ts +10 -0
  201. package/lib/structures/IReflectHttpOperation.d.ts +10 -0
  202. package/lib/structures/IReflectHttpOperationException.d.ts +13 -2
  203. package/lib/structures/IReflectHttpOperationParameter.d.ts +55 -3
  204. package/lib/structures/IReflectHttpOperationSuccess.d.ts +15 -3
  205. package/lib/structures/IReflectImport.d.ts +10 -0
  206. package/lib/structures/IReflectMcpOperation.d.ts +19 -0
  207. package/lib/structures/IReflectMcpOperationParameter.d.ts +9 -0
  208. package/lib/structures/IReflectOperationError.d.ts +28 -0
  209. package/lib/structures/IReflectOperationError.js +22 -2
  210. package/lib/structures/IReflectOperationError.js.map +1 -1
  211. package/lib/structures/IReflectType.d.ts +9 -0
  212. package/lib/structures/IReflectWebSocketOperation.d.ts +10 -0
  213. package/lib/structures/IReflectWebSocketOperationParameter.d.ts +55 -0
  214. package/lib/structures/ITypedApplication.d.ts +10 -0
  215. package/lib/structures/ITypedHttpRoute.d.ts +18 -0
  216. package/lib/structures/ITypedHttpRouteException.d.ts +13 -1
  217. package/lib/structures/ITypedHttpRouteParameter.d.ts +48 -1
  218. package/lib/structures/ITypedHttpRouteSuccess.d.ts +13 -1
  219. package/lib/structures/ITypedMcpRoute.d.ts +11 -0
  220. package/lib/structures/ITypedWebSocketRoute.d.ts +18 -0
  221. package/lib/transform.d.ts +6 -0
  222. package/lib/transform.js +6 -0
  223. package/lib/transform.js.map +1 -1
  224. package/lib/utils/ArrayUtil.d.ts +31 -1
  225. package/lib/utils/ArrayUtil.js +32 -11
  226. package/lib/utils/ArrayUtil.js.map +1 -1
  227. package/lib/utils/EmittedJavaScriptPatcher.d.ts +20 -0
  228. package/lib/utils/EmittedJavaScriptPatcher.js +65 -46
  229. package/lib/utils/EmittedJavaScriptPatcher.js.map +1 -1
  230. package/lib/utils/FileRetriever.d.ts +29 -0
  231. package/lib/utils/FileRetriever.js +29 -0
  232. package/lib/utils/FileRetriever.js.map +1 -1
  233. package/lib/utils/HttpResponseContentTypeUtil.d.ts +41 -0
  234. package/lib/utils/HttpResponseContentTypeUtil.js +31 -0
  235. package/lib/utils/HttpResponseContentTypeUtil.js.map +1 -1
  236. package/lib/utils/MapUtil.d.ts +64 -1
  237. package/lib/utils/MapUtil.js +24 -3
  238. package/lib/utils/MapUtil.js.map +1 -1
  239. package/lib/utils/PathUtil.d.ts +31 -0
  240. package/lib/utils/PathUtil.js +38 -0
  241. package/lib/utils/PathUtil.js.map +1 -1
  242. package/lib/utils/SdkBundlePath.d.ts +2 -0
  243. package/lib/utils/SdkBundlePath.js +10 -0
  244. package/lib/utils/SdkBundlePath.js.map +1 -0
  245. package/lib/utils/SdkInputFilter.d.ts +31 -0
  246. package/lib/utils/SdkInputFilter.js +115 -0
  247. package/lib/utils/SdkInputFilter.js.map +1 -0
  248. package/lib/utils/SourceFinder.d.ts +45 -0
  249. package/lib/utils/SourceFinder.js +74 -16
  250. package/lib/utils/SourceFinder.js.map +1 -1
  251. package/lib/utils/StringUtil.d.ts +77 -2
  252. package/lib/utils/StringUtil.js +166 -4
  253. package/lib/utils/StringUtil.js.map +1 -1
  254. package/lib/utils/TemporaryDirectory.d.ts +60 -0
  255. package/lib/utils/TemporaryDirectory.js +112 -0
  256. package/lib/utils/TemporaryDirectory.js.map +1 -0
  257. package/lib/utils/TsConfigReader.d.ts +42 -0
  258. package/lib/utils/TsConfigReader.js +98 -14
  259. package/lib/utils/TsConfigReader.js.map +1 -1
  260. package/lib/utils/TtscExecutor.d.ts +23 -1
  261. package/lib/utils/TtscExecutor.js +22 -0
  262. package/lib/utils/TtscExecutor.js.map +1 -1
  263. package/lib/utils/VersioningStrategy.d.ts +39 -2
  264. package/lib/utils/VersioningStrategy.js +46 -13
  265. package/lib/utils/VersioningStrategy.js.map +1 -1
  266. package/lib/validators/TextPlainValidator.d.ts +19 -0
  267. package/lib/validators/TextPlainValidator.js +19 -0
  268. package/lib/validators/TextPlainValidator.js.map +1 -1
  269. package/native/go.mod +1 -1
  270. package/native/go.sum +2 -2
  271. package/native/sdk/register.go +12 -2
  272. package/native/sdk/sdk_http_rules.go +210 -0
  273. package/native/sdk/sdk_metadata_json.go +79 -4
  274. package/native/sdk/sdk_transform.go +1157 -414
  275. package/package.json +8 -6
  276. package/src/INestiaConfig.ts +74 -34
  277. package/src/NestiaSdkApplication.ts +129 -41
  278. package/src/NestiaSwaggerComposer.ts +32 -14
  279. package/src/analyses/AccessorAnalyzer.ts +26 -0
  280. package/src/analyses/ConfigAnalyzer.ts +52 -90
  281. package/src/analyses/ImportAnalyzer.ts +25 -0
  282. package/src/analyses/ParameterNameAnalyzer.ts +75 -0
  283. package/src/analyses/PathAnalyzer.ts +167 -23
  284. package/src/analyses/ReflectControllerAnalyzer.ts +34 -1
  285. package/src/analyses/ReflectHttpOperationAnalyzer.ts +36 -14
  286. package/src/analyses/ReflectHttpOperationExceptionAnalyzer.ts +31 -0
  287. package/src/analyses/ReflectHttpOperationParameterAnalyzer.ts +153 -39
  288. package/src/analyses/ReflectHttpOperationResponseAnalyzer.ts +38 -7
  289. package/src/analyses/ReflectMcpOperationAnalyzer.ts +38 -3
  290. package/src/analyses/ReflectMetadataAnalyzer.ts +47 -0
  291. package/src/analyses/ReflectWebSocketOperationAnalyzer.ts +40 -7
  292. package/src/analyses/SecurityAnalyzer.ts +45 -20
  293. package/src/analyses/SwaggerExampleAnalyzer.ts +39 -0
  294. package/src/analyses/TypedHttpRouteAnalyzer.ts +263 -198
  295. package/src/analyses/TypedMcpRouteAnalyzer.ts +180 -20
  296. package/src/analyses/TypedWebSocketRouteAnalyzer.ts +20 -0
  297. package/src/decorators/OperationMetadata.ts +6 -0
  298. package/src/executable/internal/CommandParser.ts +19 -0
  299. package/src/executable/internal/NestiaConfigLoader.ts +66 -50
  300. package/src/executable/internal/NestiaSdkCommand.ts +96 -3
  301. package/src/executable/internal/NestiaSdkWatcher.ts +172 -44
  302. package/src/executable/internal/NestiaSwaggerWatch.ts +359 -0
  303. package/src/executable/sdk.ts +24 -1
  304. package/src/factories/ExpressionFactory.ts +23 -2
  305. package/src/factories/IdentifierFactory.ts +24 -0
  306. package/src/factories/LiteralFactory.ts +51 -13
  307. package/src/factories/StatementFactory.ts +28 -1
  308. package/src/factories/TypeFactory.ts +24 -0
  309. package/src/generates/CloneGenerator.ts +26 -5
  310. package/src/generates/E2eGenerator.ts +19 -0
  311. package/src/generates/SdkGenerator.ts +43 -12
  312. package/src/generates/SwaggerGenerator.ts +229 -46
  313. package/src/generates/internal/E2eFileProgrammer.ts +20 -0
  314. package/src/generates/internal/FilePrinter.ts +71 -0
  315. package/src/generates/internal/ImportDictionary.ts +120 -2
  316. package/src/generates/internal/SdkAliasCollection.ts +144 -15
  317. package/src/generates/internal/SdkDistributionComposer.ts +181 -56
  318. package/src/generates/internal/SdkFileProgrammer.ts +126 -16
  319. package/src/generates/internal/SdkHttpCloneProgrammer.ts +55 -0
  320. package/src/generates/internal/SdkHttpCloneReferencer.ts +97 -23
  321. package/src/generates/internal/SdkHttpFunctionProgrammer.ts +47 -30
  322. package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +53 -64
  323. package/src/generates/internal/SdkHttpParameterProgrammer.ts +295 -13
  324. package/src/generates/internal/SdkHttpRouteProgrammer.ts +37 -31
  325. package/src/generates/internal/SdkHttpSimulationProgrammer.ts +122 -18
  326. package/src/generates/internal/SdkImportWizard.ts +63 -0
  327. package/src/generates/internal/SdkMcpRouteProgrammer.ts +150 -33
  328. package/src/generates/internal/SdkPathTemplate.ts +88 -0
  329. package/src/generates/internal/SdkRouteDirectory.ts +10 -0
  330. package/src/generates/internal/SdkTypeProgrammer.ts +137 -36
  331. package/src/generates/internal/SdkTypeTagProgrammer.ts +536 -78
  332. package/src/generates/internal/SdkWebSocketCloneProgrammer.ts +185 -142
  333. package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +62 -68
  334. package/src/generates/internal/SdkWebSocketParameterProgrammer.ts +205 -5
  335. package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +89 -48
  336. package/src/generates/internal/SwaggerDescriptionComposer.ts +47 -1
  337. package/src/generates/internal/SwaggerOperationComposer.ts +38 -6
  338. package/src/generates/internal/SwaggerOperationParameterComposer.ts +318 -36
  339. package/src/generates/internal/SwaggerOperationResponseComposer.ts +74 -11
  340. package/src/internal/legacy-augmentation.d.ts +16 -0
  341. package/src/internal/legacy.ts +407 -49
  342. package/src/structures/INestiaProject.ts +10 -0
  343. package/src/structures/INestiaSdkInput.ts +30 -0
  344. package/src/structures/IOperationMetadata.ts +83 -0
  345. package/src/structures/IReflectController.ts +10 -0
  346. package/src/structures/IReflectHttpOperation.ts +10 -0
  347. package/src/structures/IReflectHttpOperationException.ts +17 -2
  348. package/src/structures/IReflectHttpOperationParameter.ts +56 -2
  349. package/src/structures/IReflectHttpOperationSuccess.ts +19 -3
  350. package/src/structures/IReflectImport.ts +10 -0
  351. package/src/structures/IReflectMcpOperation.ts +19 -0
  352. package/src/structures/IReflectMcpOperationParameter.ts +9 -0
  353. package/src/structures/IReflectOperationError.ts +31 -2
  354. package/src/structures/IReflectType.ts +9 -0
  355. package/src/structures/IReflectWebSocketOperation.ts +10 -0
  356. package/src/structures/IReflectWebSocketOperationParameter.ts +55 -0
  357. package/src/structures/ITypedApplication.ts +10 -0
  358. package/src/structures/ITypedHttpRoute.ts +18 -0
  359. package/src/structures/ITypedHttpRouteException.ts +14 -1
  360. package/src/structures/ITypedHttpRouteParameter.ts +48 -1
  361. package/src/structures/ITypedHttpRouteSuccess.ts +14 -1
  362. package/src/structures/ITypedMcpRoute.ts +12 -0
  363. package/src/structures/ITypedWebSocketRoute.ts +18 -0
  364. package/src/transform.ts +6 -0
  365. package/src/utils/ArrayUtil.ts +32 -13
  366. package/src/utils/EmittedJavaScriptPatcher.ts +70 -47
  367. package/src/utils/FileRetriever.ts +29 -0
  368. package/src/utils/HttpResponseContentTypeUtil.ts +41 -0
  369. package/src/utils/MapUtil.ts +68 -3
  370. package/src/utils/PathUtil.ts +38 -0
  371. package/src/utils/SdkBundlePath.ts +11 -0
  372. package/src/utils/SdkInputFilter.ts +108 -0
  373. package/src/utils/SourceFinder.ts +76 -18
  374. package/src/utils/StringUtil.ts +182 -5
  375. package/src/utils/TemporaryDirectory.ts +108 -0
  376. package/src/utils/TsConfigReader.ts +124 -26
  377. package/src/utils/TtscExecutor.ts +23 -1
  378. package/src/utils/VersioningStrategy.ts +51 -16
  379. package/src/validators/TextPlainValidator.ts +19 -0
  380. package/lib/generates/internal/SwaggerReadonlyArrayEmender.d.ts +0 -9
  381. package/lib/generates/internal/SwaggerReadonlyArrayEmender.js +0 -178
  382. package/lib/generates/internal/SwaggerReadonlyArrayEmender.js.map +0 -1
  383. package/lib/validators/HttpHeadersValidator.d.ts +0 -11
  384. package/lib/validators/HttpHeadersValidator.js +0 -15
  385. package/lib/validators/HttpHeadersValidator.js.map +0 -1
  386. package/lib/validators/HttpQueryValidator.d.ts +0 -10
  387. package/lib/validators/HttpQueryValidator.js +0 -14
  388. package/lib/validators/HttpQueryValidator.js.map +0 -1
  389. package/src/generates/internal/SwaggerReadonlyArrayEmender.ts +0 -264
  390. package/src/validators/HttpHeadersValidator.ts +0 -12
  391. package/src/validators/HttpQueryValidator.ts +0 -11
@@ -16,82 +16,179 @@ exports.SdkDistributionComposer = void 0;
16
16
  const child_process_1 = __importDefault(require("child_process"));
17
17
  const fs_1 = __importDefault(require("fs"));
18
18
  const path_1 = __importDefault(require("path"));
19
+ /**
20
+ * Composes the npm package of the SDK in the distribution directory.
21
+ *
22
+ * @evidence contracts/common.md#principled-implementation The namespace copies the bundle, fills its paths in, and installs the dependencies at the versions the project uses.
23
+ * @evidence contracts/common.md#clear-and-simple-design One public function and the private steps.
24
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Each filesystem step resolves against the distribution directory; no process-global directory or foreign method is changed.
25
+ * @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
26
+ * @evidence contracts/portability.md#os-neutral-implementation Native paths use path.relative/path.join and generated paths use slash separators. npm receives an argument vector and an explicit cwd. POSIX launches npm directly; Windows launches the npm-cli.js shipped beside the first npm.cmd on PATH through Node because a cmd shim itself requires shell interpretation. A nonstandard Windows npm shim lacking that adjacent npm installation is rejected explicitly.
27
+ */
19
28
  var SdkDistributionComposer;
20
29
  (function (SdkDistributionComposer) {
30
+ /**
31
+ * Prepares the distribution package once: files, paths, and dependencies, and
32
+ * does nothing when the package is already configured.
33
+ *
34
+ * @evidence contracts/common.md#principled-implementation The package counts as configured when it holds `@nestia/fetcher`, which is installed last with its peers, so an interrupted setup runs again. The caller directory is captured once, and every output path and package-manager cwd is explicit.
35
+ * @evidence contracts/common.md#clear-and-simple-design One function of sequential steps.
36
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No process-global directory is changed, so independent compositions retain their own destinations.
37
+ * @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
38
+ * @evidence contracts/portability.md#os-neutral-implementation Existence of the two package files is the filesystem's own answer, and the bundle files are copied over any file of the same name in a distribution directory that is not yet configured, so an interrupted setup repeats the copy.
39
+ */
21
40
  SdkDistributionComposer.compose = (props) => __awaiter(this, void 0, void 0, function* () {
22
- if (!fs_1.default.existsSync(props.config.distribute))
23
- yield fs_1.default.promises.mkdir(props.config.distribute, { recursive: true });
24
41
  const root = process.cwd();
42
+ const directory = path_1.default.resolve(props.config.distribute);
25
43
  const output = path_1.default.resolve(props.config.output);
26
- process.chdir(props.config.distribute);
27
- try {
28
- if (yield configured())
29
- return;
30
- // COPY FILES
31
- console.log("Composing SDK distribution environments...");
32
- for (const file of yield fs_1.default.promises.readdir(BUNDLE))
33
- yield fs_1.default.promises.copyFile(`${BUNDLE}/${file}`, file);
34
- // CONFIGURE PATHS
35
- for (const file of ["package.json", "tsconfig.json"])
36
- yield replace({ root, output })(file);
37
- // INSTALL PACKAGES
38
- const v = yield dependencies({
39
- websocket: props.websocket,
40
- });
41
- execute("npm install --save-dev rimraf");
42
- execute(`npm install --save @nestia/fetcher@${v.version}`);
43
- execute(`npm install --save typia@${v.typia}`);
44
- if (props.mcp && v.mcp !== undefined)
45
- execute(`npm install --save @modelcontextprotocol/sdk@${v.mcp}`);
46
- if (props.websocket && v.tgrid !== undefined)
47
- execute(`npm install --save tgrid@${v.tgrid}`);
48
- execute("npx typia setup --manager npm");
49
- }
50
- finally {
51
- process.chdir(root);
52
- }
44
+ yield fs_1.default.promises.mkdir(directory, { recursive: true });
45
+ if (yield configured(directory))
46
+ return;
47
+ console.log("Composing SDK distribution environments...");
48
+ for (const file of yield fs_1.default.promises.readdir(BUNDLE))
49
+ yield fs_1.default.promises.copyFile(path_1.default.join(BUNDLE, file), path_1.default.join(directory, file));
50
+ for (const file of ["package.json", "tsconfig.json"])
51
+ yield replace({ root, output, directory })(file);
52
+ // Compile with ttsc, which applies typia's transform; typia no longer has
53
+ // a setup command. Install each dependency kind together so an interrupted
54
+ // setup cannot mark @nestia/fetcher configured before its runtime peers.
55
+ const v = yield dependencies({
56
+ root,
57
+ websocket: props.websocket,
58
+ });
59
+ execute(directory, [
60
+ "install",
61
+ "--save-dev",
62
+ "rimraf",
63
+ `ttsc@${v.ttsc}`,
64
+ `typescript@${v.typescript}`,
65
+ ]);
66
+ execute(directory, [
67
+ "install",
68
+ "--save",
69
+ `@nestia/fetcher@${v.version}`,
70
+ `typia@${v.typia}`,
71
+ ...(props.mcp && v.mcp !== undefined
72
+ ? [`@modelcontextprotocol/sdk@${v.mcp}`]
73
+ : []),
74
+ ...(props.websocket && v.tgrid !== undefined ? [`tgrid@${v.tgrid}`] : []),
75
+ ]);
53
76
  });
54
- const configured = () => __awaiter(this, void 0, void 0, function* () {
55
- return ["package.json", "tsconfig.json"].every(fs_1.default.existsSync) &&
77
+ const configured = (directory) => __awaiter(this, void 0, void 0, function* () {
78
+ return ["package.json", "tsconfig.json"].every((file) => fs_1.default.existsSync(path_1.default.join(directory, file))) &&
56
79
  (yield (() => __awaiter(this, void 0, void 0, function* () {
57
80
  var _a;
58
- const content = JSON.parse(yield fs_1.default.promises.readFile("package.json", "utf8"));
81
+ const content = JSON.parse(yield fs_1.default.promises.readFile(path_1.default.join(directory, "package.json"), "utf8"));
59
82
  return !!((_a = content.dependencies) === null || _a === void 0 ? void 0 : _a["@nestia/fetcher"]);
60
83
  }))());
61
84
  });
62
- const execute = (command) => {
63
- console.log(` - ${command}`);
64
- child_process_1.default.execSync(command, { stdio: "ignore" });
85
+ const execute = (cwd, args) => {
86
+ var _a;
87
+ console.log(` - npm ${args.join(" ")}`);
88
+ if (process.platform !== "win32")
89
+ child_process_1.default.execFileSync("npm", args, { cwd, stdio: "ignore" });
90
+ else {
91
+ // Windows cannot execute npm.cmd without cmd.exe. Launch the JavaScript
92
+ // entry point installed beside that shim instead, so dependency ranges
93
+ // and paths never pass through a shell's metacharacter interpretation.
94
+ const directories = ((_a = process.env.PATH) !== null && _a !== void 0 ? _a : "").split(path_1.default.delimiter);
95
+ const directory = directories.find((entry) => fs_1.default.existsSync(path_1.default.join(entry, "npm.cmd")));
96
+ const cli = directory === undefined
97
+ ? undefined
98
+ : [
99
+ path_1.default.join(directory, "node_modules/npm/bin/npm-cli.js"),
100
+ path_1.default.resolve(directory, "../npm/bin/npm-cli.js"),
101
+ ].find((entry) => fs_1.default.existsSync(entry));
102
+ if (cli === undefined)
103
+ throw new Error("Unable to locate npm's JavaScript entry point beside npm.cmd on PATH.");
104
+ child_process_1.default.execFileSync(process.execPath, [cli, ...args], {
105
+ cwd,
106
+ stdio: "ignore",
107
+ });
108
+ }
65
109
  };
66
110
  const replace = (props) => (file) => __awaiter(this, void 0, void 0, function* () {
67
111
  const relative = (from) => (to) => path_1.default.relative(from, to).split("\\").join("/");
68
- const root = relative(process.cwd())(props.root);
69
- const output = relative(process.cwd())(props.output);
70
- const current = relative(props.root)(process.cwd());
71
- const content = yield fs_1.default.promises.readFile(file, "utf8");
72
- yield fs_1.default.promises.writeFile(file, content
73
- .split("${root}")
74
- .join(root)
75
- .split("${output}")
76
- .join(output)
77
- .split("${current}")
78
- .join(current), "utf8");
112
+ const root = relative(props.directory)(props.root);
113
+ const output = relative(props.directory)(props.output);
114
+ const current = relative(props.root)(props.directory);
115
+ const replacements = { root, output, current };
116
+ const location = path_1.default.join(props.directory, file);
117
+ const content = JSON.parse(yield fs_1.default.promises.readFile(location, "utf8"));
118
+ const substitute = (value) => {
119
+ if (typeof value === "string")
120
+ return value.replace(/\$\{(root|output|current)\}/g, (_match, key) => replacements[key]);
121
+ if (Array.isArray(value))
122
+ return value.map(substitute);
123
+ if (value !== null && typeof value === "object")
124
+ return Object.fromEntries(Object.entries(value).map(([key, element]) => [
125
+ key,
126
+ substitute(element),
127
+ ]));
128
+ return value;
129
+ };
130
+ yield fs_1.default.promises.writeFile(location, JSON.stringify(substitute(content), null, 2) + "\n", "utf8");
79
131
  });
132
+ /**
133
+ * The version of a package the project installed, exactly: the staged package
134
+ * must run the typia, and compile with the ttsc and TypeScript, the project
135
+ * itself uses, with the tgrid and MCP SDK its WebSocket and MCP functions
136
+ * import. `@nestia/sdk`'s own specifier is only the fallback, and a
137
+ * workspace's `catalog:` one names no version npm could install.
138
+ */
139
+ const installed = (root, name, fallback) => { var _a; return (_a = manifestVersion(root, name)) !== null && _a !== void 0 ? _a : (fallback !== undefined && fallback.startsWith("catalog:") === false
140
+ ? fallback
141
+ : undefined); };
142
+ /**
143
+ * The version in the manifest of the package as installed. Not every package
144
+ * exports its `package.json`, as tgrid does not, and a subpath export may map
145
+ * it to a nested manifest of no name, as `@modelcontextprotocol/sdk` maps it
146
+ * to `dist/cjs/package.json`; so the manifest is the nearest `package.json`
147
+ * naming the package, at or above what the request resolves to.
148
+ */
149
+ const manifestVersion = (root, name) => {
150
+ for (const request of [`${name}/package.json`, name]) {
151
+ let file;
152
+ try {
153
+ file = require.resolve(request, { paths: [root, __dirname] });
154
+ }
155
+ catch (_a) {
156
+ continue;
157
+ }
158
+ for (let directory = path_1.default.dirname(file);;) {
159
+ try {
160
+ const json = JSON.parse(fs_1.default.readFileSync(path_1.default.join(directory, "package.json"), "utf8"));
161
+ if (json.name === name &&
162
+ typeof json.version === "string" &&
163
+ json.version.length !== 0)
164
+ return json.version;
165
+ }
166
+ catch (_b) { }
167
+ const parent = path_1.default.dirname(directory);
168
+ if (parent === directory)
169
+ break;
170
+ directory = parent;
171
+ }
172
+ }
173
+ return undefined;
174
+ };
80
175
  const dependencies = (opts) => __awaiter(this, void 0, void 0, function* () {
81
176
  const content = yield fs_1.default.promises.readFile(__dirname + "/../../../package.json", "utf8");
82
177
  const json = JSON.parse(content);
83
178
  const dependencies = Object.assign(Object.assign({}, json.devDependencies), json.dependencies);
84
- const required = (key) => {
85
- const value = key === "version" ? json.version : dependencies[key];
179
+ const required = (key, value) => {
86
180
  if (typeof value !== "string" || value.length === 0)
87
181
  throw new Error(`Unable to resolve ${key} version for SDK distribution.`);
88
182
  return value;
89
183
  };
184
+ const version = (name) => installed(opts.root, name, dependencies[name]);
90
185
  return {
91
- version: required("version"),
92
- typia: required("typia"),
93
- tgrid: opts.websocket ? dependencies.tgrid : undefined,
94
- mcp: dependencies["@modelcontextprotocol/sdk"],
186
+ version: required("@nestia/fetcher", json.version),
187
+ typia: required("typia", version("typia")),
188
+ ttsc: required("ttsc", version("ttsc")),
189
+ typescript: required("typescript", version("typescript")),
190
+ tgrid: opts.websocket ? version("tgrid") : undefined,
191
+ mcp: version("@modelcontextprotocol/sdk"),
95
192
  };
96
193
  });
97
194
  })(SdkDistributionComposer || (exports.SdkDistributionComposer = SdkDistributionComposer = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"SdkDistributionComposer.js","sourceRoot":"","sources":["../../../src/generates/internal/SdkDistributionComposer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kEAA+B;AAC/B,4CAAoB;AACpB,gDAAwB;AAIxB,IAAiB,uBAAuB,CA8GvC;AA9GD,WAAiB,uBAAuB;IACzB,+BAAO,GAAG,CAAO,KAI7B,EAAE,EAAE;QACH,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,UAAW,CAAC;YAC1C,MAAM,YAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEzE,MAAM,IAAI,GAAW,OAAO,CAAC,GAAG,EAAE,CAAC;QACnC,MAAM,MAAM,GAAW,cAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAO,CAAC,CAAC;QAC1D,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAW,CAAC,CAAC;QACxC,IAAI,CAAC;YACH,IAAI,MAAM,UAAU,EAAE;gBAAE,OAAO;YAE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AAG,gCAAgC,CACzD,CAAC;YACJ,OAAO,KAAK,CAAC;QACf,CAAC,CAAC;QACF,MAAM,OAAO,GAAG,CAAC,IAAY,EAAsB,EAAE,CACnD,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QACjD,OAAO;YACL,OAAO,EAAE,QAAQ,CAAC,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC;YAClD,KAAK,EAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAC1C,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACvC,UAAU,EAAE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;YACzD,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;YACpD,GAAG,EAAE,OAAO,CAAC,2BAA2B,CAAC;SAC1C,CAAC;IACJ,CAAC,CAAA,CAAC;AACJ,CAAC,EAhOgB,uBAAuB,aAAvB,uBAAuB,GAAvB,uBAAuB,QAgOvC;AAUD,MAAM,MAAM,GAAG,SAAS,GAAG,oCAAoC,CAAC"}
@@ -1,4 +1,22 @@
1
1
  import { ITypedApplication } from "../../structures/ITypedApplication";
2
+ /**
3
+ * Writes the functional part of the SDK.
4
+ *
5
+ * @evidence contracts/common.md#principled-implementation The namespace builds the directory tree of the routes by accessor and prints one `index.ts` per directory.
6
+ * @evidence contracts/common.md#clear-and-simple-design One public function and two private helpers.
7
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The tree follows the accessors of the routes.
8
+ * @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
9
+ * @evidence contracts/portability.md#os-neutral-implementation Node mkdir creates native directories from the configured output and analyzed identifier accessors; ImportDictionary separately renders relative module specifiers with forward slashes. No filesystem case equivalence is inferred from route names.
10
+ */
2
11
  export declare namespace SdkFileProgrammer {
12
+ /**
13
+ * Writes the `functional` tree of the SDK from the routes' accessors.
14
+ *
15
+ * @evidence contracts/common.md#principled-implementation A route lands in the directory of its accessor without the last segment, and each directory exports its children as namespaces.
16
+ * @evidence contracts/common.md#clear-and-simple-design One tree build and one recursive writer.
17
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The order of routes is the analysis order.
18
+ * @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
19
+ * @evidence contracts/portability.md#os-neutral-implementation The recursive writer passes output paths to Node fs and FilePrinter, which accept the slash suffixes on Windows and POSIX. Accessor analysis supplies valid namespace names; module specifier spelling remains the importer’s separate responsibility.
20
+ */
3
21
  const generate: (app: ITypedApplication) => Promise<void>;
4
22
  }
@@ -16,17 +16,36 @@ exports.SdkFileProgrammer = void 0;
16
16
  const factory_1 = require("@ttsc/factory");
17
17
  const fs_1 = __importDefault(require("fs"));
18
18
  const MapUtil_1 = require("../../utils/MapUtil");
19
+ const StringUtil_1 = require("../../utils/StringUtil");
19
20
  const FilePrinter_1 = require("./FilePrinter");
20
21
  const ImportDictionary_1 = require("./ImportDictionary");
21
22
  const SdkHttpRouteProgrammer_1 = require("./SdkHttpRouteProgrammer");
22
23
  const SdkMcpRouteProgrammer_1 = require("./SdkMcpRouteProgrammer");
23
24
  const SdkRouteDirectory_1 = require("./SdkRouteDirectory");
24
25
  const SdkWebSocketRouteProgrammer_1 = require("./SdkWebSocketRouteProgrammer");
26
+ /**
27
+ * Writes the functional part of the SDK.
28
+ *
29
+ * @evidence contracts/common.md#principled-implementation The namespace builds the directory tree of the routes by accessor and prints one `index.ts` per directory.
30
+ * @evidence contracts/common.md#clear-and-simple-design One public function and two private helpers.
31
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The tree follows the accessors of the routes.
32
+ * @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
33
+ * @evidence contracts/portability.md#os-neutral-implementation Node mkdir creates native directories from the configured output and analyzed identifier accessors; ImportDictionary separately renders relative module specifiers with forward slashes. No filesystem case equivalence is inferred from route names.
34
+ */
25
35
  var SdkFileProgrammer;
26
36
  (function (SdkFileProgrammer) {
27
37
  /* ---------------------------------------------------------
28
38
  CONSTRUCTOR
29
39
  --------------------------------------------------------- */
40
+ /**
41
+ * Writes the `functional` tree of the SDK from the routes' accessors.
42
+ *
43
+ * @evidence contracts/common.md#principled-implementation A route lands in the directory of its accessor without the last segment, and each directory exports its children as namespaces.
44
+ * @evidence contracts/common.md#clear-and-simple-design One tree build and one recursive writer.
45
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The order of routes is the analysis order.
46
+ * @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
47
+ * @evidence contracts/portability.md#os-neutral-implementation The recursive writer passes output paths to Node fs and FilePrinter, which accept the slash suffixes on Windows and POSIX. Accessor analysis supplies valid namespace names; module specifier spelling remains the importer’s separate responsibility.
48
+ */
30
49
  SdkFileProgrammer.generate = (app) => __awaiter(this, void 0, void 0, function* () {
31
50
  // CONSTRUCT FOLDER TREE
32
51
  const root = new SdkRouteDirectory_1.SdkRouteDirectory(null, "functional");
@@ -58,18 +77,61 @@ var SdkFileProgrammer;
58
77
  if (statements.length && directory.routes.length)
59
78
  statements.push(FilePrinter_1.FilePrinter.enter());
60
79
  // ITERATE ROUTES
61
- const importer = new ImportDictionary_1.ImportDictionary(`${outDir}/index.ts`);
62
- directory.routes.forEach((route, i) => {
63
- if (!(project.config.clone === true && route.protocol === "http"))
64
- importer.declarations(route.imports);
65
- statements.push(...(route.protocol === "http"
66
- ? SdkHttpRouteProgrammer_1.SdkHttpRouteProgrammer.write(project)(importer)(route)
67
- : route.protocol === "websocket"
68
- ? SdkWebSocketRouteProgrammer_1.SdkWebSocketRouteProgrammer.write(project)(importer)(route)
69
- : SdkMcpRouteProgrammer_1.SdkMcpRouteProgrammer.write(project)(importer)(route)));
70
- if (i !== directory.routes.length - 1)
71
- statements.push(FilePrinter_1.FilePrinter.enter());
72
- });
80
+ const write = (locals) => {
81
+ const importer = new ImportDictionary_1.ImportDictionary(`${outDir}/index.ts`);
82
+ const output = [];
83
+ directory.routes.forEach((route, i) => {
84
+ if (!(project.config.clone === true && route.protocol === "http"))
85
+ importer.declarations(route.imports);
86
+ const local = locals.get(route);
87
+ const target = local === undefined ? route : Object.assign(Object.assign({}, route), { name: local });
88
+ const written = target.protocol === "http"
89
+ ? SdkHttpRouteProgrammer_1.SdkHttpRouteProgrammer.write(project)(importer)(target)
90
+ : target.protocol === "websocket"
91
+ ? SdkWebSocketRouteProgrammer_1.SdkWebSocketRouteProgrammer.write(project)(importer)(target)
92
+ : SdkMcpRouteProgrammer_1.SdkMcpRouteProgrammer.write(project)(importer)(target);
93
+ if (local !== undefined) {
94
+ written.forEach(unexport);
95
+ written.push(factory_1.factory.createExportDeclaration(undefined, false, factory_1.factory.createNamedExports([
96
+ factory_1.factory.createExportSpecifier(false, local, route.name),
97
+ ]), undefined));
98
+ }
99
+ output.push(...written);
100
+ if (i !== directory.routes.length - 1)
101
+ output.push(FilePrinter_1.FilePrinter.enter());
102
+ });
103
+ return { importer, statements: output };
104
+ };
105
+ // A route's function and namespace are declared in the module scope,
106
+ // where the file's imports and the globals its bodies reference live
107
+ // too. A route named like one of them shadows it for the whole file, or
108
+ // conflicts with the import, so the SDK would not compile (#1647); a
109
+ // method named `tags` whose path parameter is typed with `tags.Format`
110
+ // is enough. Its public name cannot change, so it is declared under a
111
+ // local one and exported as itself.
112
+ let file = write(new Map());
113
+ const scope = new Set([
114
+ ...file.importer.locals(),
115
+ ...MODULE_GLOBALS,
116
+ ]);
117
+ const shadowing = directory.routes.filter((r) => scope.has(r.name));
118
+ if (shadowing.length !== 0) {
119
+ // each local name distinct from the scope, the routes, and the other
120
+ // locals
121
+ const taken = [
122
+ ...scope,
123
+ ...directory.routes.map((r) => r.name),
124
+ ];
125
+ const locals = new Map();
126
+ for (const route of shadowing) {
127
+ const local = StringUtil_1.StringUtil.escapeDuplicate(taken)(route.name);
128
+ taken.push(local);
129
+ locals.set(route, local);
130
+ }
131
+ file = write(locals);
132
+ }
133
+ const importer = file.importer;
134
+ statements.push(...file.statements);
73
135
  // FINALIZE THE CONTENT
74
136
  if (directory.routes.length !== 0)
75
137
  statements.push(...importer.toStatements(outDir), ...(!importer.empty() && statements.length
@@ -87,4 +149,31 @@ var SdkFileProgrammer;
87
149
  });
88
150
  });
89
151
  })(SdkFileProgrammer || (exports.SdkFileProgrammer = SdkFileProgrammer = {}));
152
+ /**
153
+ * Globals the generated route bodies reference, and names TypeScript reserves
154
+ * in a module's top-level scope: `Promise` in one with async functions, and
155
+ * `require` and `exports` in a CommonJS one.
156
+ */
157
+ const MODULE_GLOBALS = [
158
+ "Array",
159
+ "Error",
160
+ "JSON",
161
+ "Object",
162
+ "Promise",
163
+ "ReadableStream",
164
+ "String",
165
+ "URLSearchParams",
166
+ "encodeURIComponent",
167
+ "exports",
168
+ "require",
169
+ "undefined",
170
+ ];
171
+ /** Drops the `export` modifier of a route's function or namespace. */
172
+ const unexport = (node) => {
173
+ const declaration = node;
174
+ if ((declaration.kind === "FunctionDeclaration" ||
175
+ declaration.kind === "ModuleDeclaration") &&
176
+ declaration.modifiers !== undefined)
177
+ declaration.modifiers = declaration.modifiers.filter((m) => m.token !== factory_1.SyntaxKind.ExportKeyword);
178
+ };
90
179
  //# sourceMappingURL=SdkFileProgrammer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SdkFileProgrammer.js","sourceRoot":"","sources":["../../../src/generates/internal/SdkFileProgrammer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmD;AACnD,4CAAoB;AAOpB,iDAA8C;AAC9C,+CAA4C;AAC5C,yDAAsD;AACtD,qEAAkE;AAClE,mEAAgE;AAChE,2DAAwD;AACxD,+EAA4E;AAE5E,IAAiB,iBAAiB,CA8FjC;AA9FD,WAAiB,iBAAiB;IAChC;;kEAE8D;IACjD,0BAAQ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E,CAAC,EACP,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAC3C,CAAC;QACJ,MAAM,yBAAW,CAAC,KAAK,CAAC;YACtB,QAAQ,EAAE,QAAQ,CAAC,IAAI;YACvB,UAAU;YACV,GAAG,EACD,OAAO;gBACP,4BAA4B;gBAC5B,cAAc,SAAS,CAAC,MAAM,IAAI;gBAClC,uEAAuE;gBACvE,OAAO;gBACP,sEAAsE;SACzE,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACN,CAAC,EA5JgB,iBAAiB,aAAjB,iBAAiB,GAAjB,iBAAiB,QA4JjC;AAID;;;;GAIG;AACH,MAAM,cAAc,GAAa;IAC/B,OAAO;IACP,OAAO;IACP,MAAM;IACN,QAAQ;IACR,SAAS;IACT,gBAAgB;IAChB,QAAQ;IACR,iBAAiB;IACjB,oBAAoB;IACpB,SAAS;IACT,SAAS;IACT,WAAW;CACZ,CAAC;AAEF,sEAAsE;AACtE,MAAM,QAAQ,GAAG,CAAC,IAAU,EAAQ,EAAE;IACpC,MAAM,WAAW,GAAG,IAGnB,CAAC;IACF,IACE,CAAC,WAAW,CAAC,IAAI,KAAK,qBAAqB;QACzC,WAAW,CAAC,IAAI,KAAK,mBAAmB,CAAC;QAC3C,WAAW,CAAC,SAAS,KAAK,SAAS;QAEnC,WAAW,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC,MAAM,CAClD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,oBAAU,CAAC,aAAa,CAC5C,CAAC;AACN,CAAC,CAAC"}
@@ -1,11 +1,40 @@
1
1
  import { type Node } from "@ttsc/factory";
2
2
  import { ITypedApplication } from "../../structures/ITypedApplication";
3
3
  import { ImportDictionary } from "./ImportDictionary";
4
+ /**
5
+ * Composes the DTO declarations of the HTTP routes.
6
+ *
7
+ * @evidence contracts/common.md#principled-implementation The namespace turns each named object, alias and recursive collection into a declaration, placed in a tree of modules by its dotted name.
8
+ * @evidence contracts/common.md#clear-and-simple-design One declaration-tree operation dispatches object, alias and recursive collection bodies through their owning writers.
9
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Implicit object and alias names are not declared; native-marked recursive collections supply named declarations so recursive references have a definition.
10
+ * @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
11
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpCloneProgrammer composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
12
+ */
4
13
  export declare namespace SdkHttpCloneProgrammer {
14
+ /**
15
+ * A module of the declaration tree: its name, its children, and the writer of
16
+ * its own declaration.
17
+ *
18
+ * @evidence contracts/common.md#principled-implementation A module without a writer only holds children.
19
+ * @evidence contracts/common.md#clear-and-simple-design A three-member record.
20
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
21
+ * @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
22
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpCloneProgrammer.IModule composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
23
+ */
5
24
  interface IModule {
6
25
  name: string;
7
26
  children: Map<string, IModule>;
8
27
  programmer: null | ((importer: ImportDictionary) => Node);
9
28
  }
29
+ /**
30
+ * Returns the declaration tree of the application's named types, keyed by
31
+ * their top-level name.
32
+ *
33
+ * @evidence contracts/common.md#principled-implementation Named objects and aliases are registered, and implicit names are skipped. Recursive arrays and tuples also need declarations: each writes one collection body whose nested uses are named references. Finite and object-mediated collections stay inline.
34
+ * @evidence contracts/common.md#clear-and-simple-design Four collection loops feed the same declaration tree, so all named forms share namespace and import decisions.
35
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The implicit test is the shared definition.
36
+ * @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
37
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpCloneProgrammer.write composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
38
+ */
10
39
  const write: (app: ITypedApplication) => Map<string, IModule>;
11
40
  }
@@ -6,8 +6,27 @@ const MapUtil_1 = require("../../utils/MapUtil");
6
6
  const StringUtil_1 = require("../../utils/StringUtil");
7
7
  const FilePrinter_1 = require("./FilePrinter");
8
8
  const SdkTypeProgrammer_1 = require("./SdkTypeProgrammer");
9
+ /**
10
+ * Composes the DTO declarations of the HTTP routes.
11
+ *
12
+ * @evidence contracts/common.md#principled-implementation The namespace turns each named object, alias and recursive collection into a declaration, placed in a tree of modules by its dotted name.
13
+ * @evidence contracts/common.md#clear-and-simple-design One declaration-tree operation dispatches object, alias and recursive collection bodies through their owning writers.
14
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Implicit object and alias names are not declared; native-marked recursive collections supply named declarations so recursive references have a definition.
15
+ * @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
16
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpCloneProgrammer composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
17
+ */
9
18
  var SdkHttpCloneProgrammer;
10
19
  (function (SdkHttpCloneProgrammer) {
20
+ /**
21
+ * Returns the declaration tree of the application's named types, keyed by
22
+ * their top-level name.
23
+ *
24
+ * @evidence contracts/common.md#principled-implementation Named objects and aliases are registered, and implicit names are skipped. Recursive arrays and tuples also need declarations: each writes one collection body whose nested uses are named references. Finite and object-mediated collections stay inline.
25
+ * @evidence contracts/common.md#clear-and-simple-design Four collection loops feed the same declaration tree, so all named forms share namespace and import decisions.
26
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The implicit test is the shared definition.
27
+ * @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
28
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpCloneProgrammer.write composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
29
+ */
11
30
  SdkHttpCloneProgrammer.write = (app) => {
12
31
  // COMPOSE THE DICTIONARY
13
32
  const dict = new Map();
@@ -25,6 +44,20 @@ var SdkHttpCloneProgrammer;
25
44
  name: k,
26
45
  programmer: (importer) => writeAlias(app.project)(importer)(v),
27
46
  });
47
+ for (const [k, v] of app.collection.arrays.entries())
48
+ if (v.recursive)
49
+ prepare({
50
+ dict,
51
+ name: k,
52
+ programmer: (importer) => factory_1.factory.createTypeAliasDeclaration([factory_1.factory.createModifier(factory_1.SyntaxKind.ExportKeyword)], StringUtil_1.StringUtil.accessorsOf(k).at(-1), [], SdkTypeProgrammer_1.SdkTypeProgrammer.write_array_type(app.project)(importer)(v)),
53
+ });
54
+ for (const [k, v] of app.collection.tuples.entries())
55
+ if (v.recursive)
56
+ prepare({
57
+ dict,
58
+ name: k,
59
+ programmer: (importer) => factory_1.factory.createTypeAliasDeclaration([factory_1.factory.createModifier(factory_1.SyntaxKind.ExportKeyword)], StringUtil_1.StringUtil.accessorsOf(k).at(-1), [], SdkTypeProgrammer_1.SdkTypeProgrammer.write_tuple_type(app.project)(importer)(v)),
60
+ });
28
61
  return dict;
29
62
  };
30
63
  const prepare = (props) => {
@@ -1 +1 @@
1
- {"version":3,"file":"SdkHttpCloneProgrammer.js","sourceRoot":"","sources":["../../../src/generates/internal/SdkHttpCloneProgrammer.ts"],"names":[],"mappings":";;;AAAA,2CAA8E;AAW9E,iDAA8C;AAC9C,uDAAoD;AACpD,+CAA4C;AAE5C,2DAAwD;AAExD,IAAiB,sBAAsB,CA6EtC;AA7ED,WAAiB,sBAAsB;IAOxB,4BAAK,GAAG,CAAC,GAAsB,EAAwB,EAAE;QACpE,yBAAyB;QACzB,MAAM,IAAI,GAAyB,IAAI,GAAG,EAAE,CAAC;QAC7C,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAA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the cloned DTOs.
4
+ *
5
+ * @evidence contracts/common.md#principled-implementation HTTP and MCP JSON types and their namespace/tag imports are emitted together from resolved metadata by the cloned declaration writer; WebSocket declarations retain their source types and redirect only cloned imports.
6
+ * @evidence contracts/common.md#clear-and-simple-design One public function and three visitors.
7
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The routes are rewritten in place, once.
8
+ * @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
9
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpCloneReferencer composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
10
+ */
2
11
  export declare namespace SdkHttpCloneReferencer {
12
+ /**
13
+ * Rewrites the HTTP, MCP and WebSocket routes so their types and imports
14
+ * refer to the `structures` files.
15
+ *
16
+ * @evidence contracts/common.md#principled-implementation HTTP and MCP JSON routes use structural TypeNodes and the writer's registered imports. Empty and any/unknown forms retain their baked keyword distinction because they require no cloned component binding; WebSocket source types only redirect imports actually cloned.
17
+ * @evidence contracts/common.md#clear-and-simple-design One loop.
18
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The routes are edited in place, as the generation owns them.
19
+ * @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
20
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpCloneReferencer.replace composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
21
+ */
3
22
  const replace: (app: ITypedApplication, websocket?: Set<string>) => void;
4
23
  }