@nestia/migrate 14.0.1 → 14.0.3

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 (183) hide show
  1. package/lib/NestiaMigrateApplication.d.ts +111 -0
  2. package/lib/NestiaMigrateApplication.js +148 -9
  3. package/lib/NestiaMigrateApplication.js.map +1 -1
  4. package/lib/NestiaMigrateApplication.mjs +147 -5
  5. package/lib/_virtual/_rolldown/runtime.mjs +6 -1
  6. package/lib/analyzers/NestiaMigrateControllerAnalyzer.d.ts +45 -0
  7. package/lib/analyzers/NestiaMigrateControllerAnalyzer.js +59 -3
  8. package/lib/analyzers/NestiaMigrateControllerAnalyzer.js.map +1 -1
  9. package/lib/analyzers/NestiaMigrateControllerAnalyzer.mjs +9 -3
  10. package/lib/archivers/NestiaMigrateFileArchiver.d.ts +34 -0
  11. package/lib/archivers/NestiaMigrateFileArchiver.js +34 -0
  12. package/lib/archivers/NestiaMigrateFileArchiver.js.map +1 -1
  13. package/lib/bundles/NEST_TEMPLATE.js +1 -1
  14. package/lib/bundles/NEST_TEMPLATE.mjs +1 -1
  15. package/lib/bundles/SDK_TEMPLATE.js +1 -1
  16. package/lib/bundles/SDK_TEMPLATE.mjs +1 -1
  17. package/lib/executable/NestiaMigrateCommander.d.ts +39 -1
  18. package/lib/executable/NestiaMigrateCommander.js +42 -2
  19. package/lib/executable/NestiaMigrateCommander.js.map +1 -1
  20. package/lib/executable/NestiaMigrateCommander.mjs +5 -3
  21. package/lib/executable/NestiaMigrateInquirer.d.ts +32 -1
  22. package/lib/executable/NestiaMigrateInquirer.js +33 -10
  23. package/lib/executable/NestiaMigrateInquirer.js.map +1 -1
  24. package/lib/executable/NestiaMigrateInquirer.mjs +4 -3
  25. package/lib/executable/TemplateBundleCache.d.ts +23 -0
  26. package/lib/executable/TemplateBundleCache.js +60 -0
  27. package/lib/executable/TemplateBundleCache.js.map +1 -0
  28. package/lib/executable/TemplateBundleCache.mjs +39 -0
  29. package/lib/executable/TemplateBundleCache.mjs.map +1 -0
  30. package/lib/executable/bundle.d.ts +1 -0
  31. package/lib/executable/bundle.js +404 -0
  32. package/lib/executable/bundle.js.map +1 -0
  33. package/lib/executable/bundle.mjs +324 -0
  34. package/lib/executable/bundle.mjs.map +1 -0
  35. package/lib/factories/ExpressionFactory.d.ts +14 -0
  36. package/lib/factories/ExpressionFactory.js +14 -0
  37. package/lib/factories/ExpressionFactory.js.map +1 -1
  38. package/lib/factories/IdentifierFactory.d.ts +20 -0
  39. package/lib/factories/IdentifierFactory.js +20 -0
  40. package/lib/factories/IdentifierFactory.js.map +1 -1
  41. package/lib/factories/LiteralFactory.d.ts +18 -2
  42. package/lib/factories/LiteralFactory.js +18 -2
  43. package/lib/factories/LiteralFactory.js.map +1 -1
  44. package/lib/factories/StatementFactory.d.ts +26 -1
  45. package/lib/factories/StatementFactory.js +26 -1
  46. package/lib/factories/StatementFactory.js.map +1 -1
  47. package/lib/factories/SupportedStringFormats.d.ts +6 -0
  48. package/lib/factories/SupportedStringFormats.js +33 -0
  49. package/lib/factories/SupportedStringFormats.js.map +1 -0
  50. package/lib/factories/SupportedStringFormats.mjs +34 -0
  51. package/lib/factories/SupportedStringFormats.mjs.map +1 -0
  52. package/lib/factories/TypeFactory.d.ts +21 -0
  53. package/lib/factories/TypeFactory.js +13 -0
  54. package/lib/factories/TypeFactory.js.map +1 -1
  55. package/lib/factories/TypeLiteralFactory.d.ts +18 -0
  56. package/lib/factories/TypeLiteralFactory.js +18 -0
  57. package/lib/factories/TypeLiteralFactory.js.map +1 -1
  58. package/lib/internal/ts.d.ts +153 -0
  59. package/lib/internal/ts.js.map +1 -1
  60. package/lib/package.mjs +55 -0
  61. package/lib/package.mjs.map +1 -0
  62. package/lib/programmers/NestiaMigrateApiFileProgrammer.d.ts +31 -0
  63. package/lib/programmers/NestiaMigrateApiFileProgrammer.js +17 -0
  64. package/lib/programmers/NestiaMigrateApiFileProgrammer.js.map +1 -1
  65. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.d.ts +40 -0
  66. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +27 -0
  67. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -1
  68. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.d.ts +39 -0
  69. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js +26 -0
  70. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js.map +1 -1
  71. package/lib/programmers/NestiaMigrateApiProgrammer.d.ts +18 -0
  72. package/lib/programmers/NestiaMigrateApiProgrammer.js +18 -0
  73. package/lib/programmers/NestiaMigrateApiProgrammer.js.map +1 -1
  74. package/lib/programmers/NestiaMigrateApiProgrammer.mjs +1 -1
  75. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.d.ts +40 -0
  76. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js +27 -0
  77. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js.map +1 -1
  78. package/lib/programmers/NestiaMigrateApiStartProgrammer.d.ts +17 -0
  79. package/lib/programmers/NestiaMigrateApiStartProgrammer.js +19 -8
  80. package/lib/programmers/NestiaMigrateApiStartProgrammer.js.map +1 -1
  81. package/lib/programmers/NestiaMigrateApiStartProgrammer.mjs +1 -6
  82. package/lib/programmers/NestiaMigrateDtoProgrammer.d.ts +30 -0
  83. package/lib/programmers/NestiaMigrateDtoProgrammer.js +17 -0
  84. package/lib/programmers/NestiaMigrateDtoProgrammer.js.map +1 -1
  85. package/lib/programmers/NestiaMigrateE2eFileProgrammer.d.ts +39 -0
  86. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js +26 -0
  87. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js.map +1 -1
  88. package/lib/programmers/NestiaMigrateE2eProgrammer.d.ts +16 -0
  89. package/lib/programmers/NestiaMigrateE2eProgrammer.js +16 -0
  90. package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +1 -1
  91. package/lib/programmers/NestiaMigrateImportProgrammer.d.ts +75 -0
  92. package/lib/programmers/NestiaMigrateImportProgrammer.js +58 -3
  93. package/lib/programmers/NestiaMigrateImportProgrammer.js.map +1 -1
  94. package/lib/programmers/NestiaMigrateImportProgrammer.mjs +58 -3
  95. package/lib/programmers/NestiaMigrateNestControllerProgrammer.d.ts +28 -0
  96. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +16 -0
  97. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +1 -1
  98. package/lib/programmers/NestiaMigrateNestMethodProgrammer.d.ts +30 -0
  99. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js +16 -0
  100. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js.map +1 -1
  101. package/lib/programmers/NestiaMigrateNestModuleProgrammer.d.ts +16 -0
  102. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js +16 -0
  103. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js.map +1 -1
  104. package/lib/programmers/NestiaMigrateNestProgrammer.d.ts +17 -0
  105. package/lib/programmers/NestiaMigrateNestProgrammer.js +17 -0
  106. package/lib/programmers/NestiaMigrateNestProgrammer.js.map +1 -1
  107. package/lib/programmers/NestiaMigrateSchemaProgrammer.d.ts +16 -0
  108. package/lib/programmers/NestiaMigrateSchemaProgrammer.js +20 -5
  109. package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +1 -1
  110. package/lib/programmers/NestiaMigrateSchemaProgrammer.mjs +4 -4
  111. package/lib/structures/INestiaMigrateConfig.d.ts +21 -0
  112. package/lib/structures/INestiaMigrateContext.d.ts +15 -0
  113. package/lib/structures/INestiaMigrateController.d.ts +13 -0
  114. package/lib/structures/INestiaMigrateFile.d.ts +11 -0
  115. package/lib/utils/FilePrinter.d.ts +33 -0
  116. package/lib/utils/FilePrinter.js +33 -0
  117. package/lib/utils/FilePrinter.js.map +1 -1
  118. package/lib/utils/MapUtil.d.ts +17 -0
  119. package/lib/utils/MapUtil.js +19 -3
  120. package/lib/utils/MapUtil.js.map +1 -1
  121. package/lib/utils/MapUtil.mjs +1 -2
  122. package/lib/utils/PathTemplate.d.ts +23 -1
  123. package/lib/utils/PathTemplate.js +15 -1
  124. package/lib/utils/PathTemplate.js.map +1 -1
  125. package/lib/utils/RequestBody.d.ts +13 -0
  126. package/lib/utils/RequestBody.js +13 -0
  127. package/lib/utils/RequestBody.js.map +1 -1
  128. package/lib/utils/StringUtil.d.ts +55 -0
  129. package/lib/utils/StringUtil.js +93 -8
  130. package/lib/utils/StringUtil.js.map +1 -1
  131. package/lib/utils/StringUtil.mjs +30 -8
  132. package/lib/utils/SuccessStatus.d.ts +21 -1
  133. package/lib/utils/SuccessStatus.js +21 -1
  134. package/lib/utils/SuccessStatus.js.map +1 -1
  135. package/package.json +5 -4
  136. package/src/NestiaMigrateApplication.ts +151 -13
  137. package/src/analyzers/NestiaMigrateControllerAnalyzer.ts +59 -4
  138. package/src/archivers/NestiaMigrateFileArchiver.ts +34 -0
  139. package/src/bundles/NEST_TEMPLATE.ts +1 -1
  140. package/src/bundles/SDK_TEMPLATE.ts +1 -1
  141. package/src/executable/NestiaMigrateCommander.ts +44 -2
  142. package/src/executable/NestiaMigrateInquirer.ts +35 -3
  143. package/src/executable/TemplateBundleCache.ts +65 -0
  144. package/src/executable/{bundle.js → bundle.ts} +110 -43
  145. package/src/factories/ExpressionFactory.ts +14 -0
  146. package/src/factories/IdentifierFactory.ts +20 -0
  147. package/src/factories/LiteralFactory.ts +18 -2
  148. package/src/factories/StatementFactory.ts +26 -1
  149. package/src/factories/SupportedStringFormats.ts +29 -0
  150. package/src/factories/TypeFactory.ts +21 -0
  151. package/src/factories/TypeLiteralFactory.ts +18 -0
  152. package/src/internal/ts.ts +153 -0
  153. package/src/programmers/NestiaMigrateApiFileProgrammer.ts +35 -0
  154. package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +43 -0
  155. package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +42 -0
  156. package/src/programmers/NestiaMigrateApiProgrammer.ts +18 -0
  157. package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +43 -0
  158. package/src/programmers/NestiaMigrateApiStartProgrammer.ts +19 -10
  159. package/src/programmers/NestiaMigrateDtoProgrammer.ts +33 -0
  160. package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +42 -0
  161. package/src/programmers/NestiaMigrateE2eProgrammer.ts +16 -0
  162. package/src/programmers/NestiaMigrateImportProgrammer.ts +86 -5
  163. package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +30 -0
  164. package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +34 -0
  165. package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +16 -0
  166. package/src/programmers/NestiaMigrateNestProgrammer.ts +17 -0
  167. package/src/programmers/NestiaMigrateSchemaProgrammer.ts +25 -8
  168. package/src/structures/INestiaMigrateConfig.ts +26 -0
  169. package/src/structures/INestiaMigrateContext.ts +17 -0
  170. package/src/structures/INestiaMigrateController.ts +16 -0
  171. package/src/structures/INestiaMigrateFile.ts +13 -0
  172. package/src/utils/FilePrinter.ts +33 -0
  173. package/src/utils/MapUtil.ts +18 -2
  174. package/src/utils/PathTemplate.ts +23 -1
  175. package/src/utils/RequestBody.ts +13 -0
  176. package/src/utils/StringUtil.ts +101 -9
  177. package/src/utils/SuccessStatus.ts +21 -1
  178. package/lib/factories/FormatCheatSheet.d.ts +0 -25
  179. package/lib/factories/FormatCheatSheet.js +0 -34
  180. package/lib/factories/FormatCheatSheet.js.map +0 -1
  181. package/lib/factories/FormatCheatSheet.mjs +0 -31
  182. package/lib/factories/FormatCheatSheet.mjs.map +0 -1
  183. package/src/factories/FormatCheatSheet.ts +0 -71
@@ -51,24 +51,177 @@ type _TypeReferenceNode = TypeReferenceNode;
51
51
  type _UnionTypeNode = UnionTypeNode;
52
52
  type _VariableStatement = VariableStatement;
53
53
 
54
+ /**
55
+ * A compatibility stand-in for `import ts from "typescript"`: the one value the
56
+ * generators still call, and the node types under the names they use.
57
+ *
58
+ * @evidence contracts/common.md#principled-implementation The value is the union-type guard, and the namespace aliases map each used compiler type name to the matching node type of the factory package, so existing annotations keep their exact shapes.
59
+ * @evidence contracts/common.md#clear-and-simple-design One value and one declaration-only namespace of aliases.
60
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It avoids loading the compiler; the guard is implemented on the node kind, not on a patched compiler.
61
+ * @evidence contracts/common.md#meaningful-documentation The leading comment explains why the shim exists.
62
+ */
54
63
  declare namespace ts {
64
+ /**
65
+ * The `Node` node type under the name the generators use.
66
+ *
67
+ * @evidence contracts/common.md#principled-implementation The alias names the `Node` node type of the factory package.
68
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
69
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
70
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
71
+ */
55
72
  export type Node = _Node;
73
+ /**
74
+ * The `Block` node type under the name the generators use.
75
+ *
76
+ * @evidence contracts/common.md#principled-implementation The alias names the `Block` node type of the factory package.
77
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
78
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
79
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
80
+ */
56
81
  export type Block = _Block;
82
+ /**
83
+ * The `CallExpression` node type under the name the generators use.
84
+ *
85
+ * @evidence contracts/common.md#principled-implementation The alias names the `CallExpression` node type of the factory package.
86
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
87
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
88
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
89
+ */
57
90
  export type CallExpression = _CallExpression;
91
+ /**
92
+ * The `ConciseBody` node type under the name the generators use.
93
+ *
94
+ * @evidence contracts/common.md#principled-implementation A concise body is a block or an expression, the same union the compiler defines.
95
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
96
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
97
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
98
+ */
58
99
  export type ConciseBody = _Block | _Expression;
100
+ /**
101
+ * The `Decorator` node type under the name the generators use.
102
+ *
103
+ * @evidence contracts/common.md#principled-implementation The alias names the `Decorator` node type of the factory package.
104
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
105
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
106
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
107
+ */
59
108
  export type Decorator = _Decorator;
109
+ /**
110
+ * The `Expression` node type under the name the generators use.
111
+ *
112
+ * @evidence contracts/common.md#principled-implementation The alias names the `Expression` node type of the factory package.
113
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
114
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
115
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
116
+ */
60
117
  export type Expression = _Expression;
118
+ /**
119
+ * The `FunctionDeclaration` node type under the name the generators use.
120
+ *
121
+ * @evidence contracts/common.md#principled-implementation The alias names the `FunctionDeclaration` node type of the factory package.
122
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
123
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
124
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
125
+ */
61
126
  export type FunctionDeclaration = _FunctionDeclaration;
127
+ /**
128
+ * The `Identifier` node type under the name the generators use.
129
+ *
130
+ * @evidence contracts/common.md#principled-implementation The alias names the `Identifier` node type of the factory package.
131
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
132
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
133
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
134
+ */
62
135
  export type Identifier = _Identifier;
136
+ /**
137
+ * The `KeywordTypeNode` node type under the name the generators use.
138
+ *
139
+ * @evidence contracts/common.md#principled-implementation The alias names the `KeywordTypeNode` node type of the factory package.
140
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
141
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
142
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
143
+ */
63
144
  export type KeywordTypeNode = _KeywordTypeNode;
145
+ /**
146
+ * The `MethodDeclaration` node type under the name the generators use.
147
+ *
148
+ * @evidence contracts/common.md#principled-implementation The alias names the `MethodDeclaration` node type of the factory package.
149
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
150
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
151
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
152
+ */
64
153
  export type MethodDeclaration = _MethodDeclaration;
154
+ /**
155
+ * The `ModuleDeclaration` node type under the name the generators use.
156
+ *
157
+ * @evidence contracts/common.md#principled-implementation The alias names the `ModuleDeclaration` node type of the factory package.
158
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
159
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
160
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
161
+ */
65
162
  export type ModuleDeclaration = _ModuleDeclaration;
163
+ /**
164
+ * The `ParameterDeclaration` node type under the name the generators use.
165
+ *
166
+ * @evidence contracts/common.md#principled-implementation The alias names the `ParameterDeclaration` node type of the factory package.
167
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
168
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
169
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
170
+ */
66
171
  export type ParameterDeclaration = _ParameterDeclaration;
172
+ /**
173
+ * The `Statement` node type under the name the generators use.
174
+ *
175
+ * @evidence contracts/common.md#principled-implementation The alias names the `Statement` node type of the factory package.
176
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
177
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
178
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
179
+ */
67
180
  export type Statement = _Statement;
181
+ /**
182
+ * The `TypeAliasDeclaration` node type under the name the generators use.
183
+ *
184
+ * @evidence contracts/common.md#principled-implementation The alias names the `TypeAliasDeclaration` node type of the factory package.
185
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
186
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
187
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
188
+ */
68
189
  export type TypeAliasDeclaration = _TypeAliasDeclaration;
190
+ /**
191
+ * The `TypeNode` node type under the name the generators use.
192
+ *
193
+ * @evidence contracts/common.md#principled-implementation The alias names the `TypeNode` node type of the factory package.
194
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
195
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
196
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
197
+ */
69
198
  export type TypeNode = _TypeNode;
199
+ /**
200
+ * The `TypeReferenceNode` node type under the name the generators use.
201
+ *
202
+ * @evidence contracts/common.md#principled-implementation The alias names the `TypeReferenceNode` node type of the factory package.
203
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
204
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
205
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
206
+ */
70
207
  export type TypeReferenceNode = _TypeReferenceNode;
208
+ /**
209
+ * The `UnionTypeNode` node type under the name the generators use.
210
+ *
211
+ * @evidence contracts/common.md#principled-implementation The alias names the `UnionTypeNode` node type of the factory package.
212
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
213
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
214
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
215
+ */
71
216
  export type UnionTypeNode = _UnionTypeNode;
217
+ /**
218
+ * The `VariableStatement` node type under the name the generators use.
219
+ *
220
+ * @evidence contracts/common.md#principled-implementation The alias names the `VariableStatement` node type of the factory package.
221
+ * @evidence contracts/common.md#clear-and-simple-design One alias.
222
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
223
+ * @evidence contracts/common.md#meaningful-documentation The alias is named after the compiler type it replaces, and the file comment explains the shim.
224
+ */
72
225
  export type VariableStatement = _VariableStatement;
73
226
  }
74
227
 
@@ -8,15 +8,50 @@ import { NestiaMigrateApiFunctionProgrammer } from "./NestiaMigrateApiFunctionPr
8
8
  import { NestiaMigrateApiNamespaceProgrammer } from "./NestiaMigrateApiNamespaceProgrammer";
9
9
  import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
10
10
 
11
+ /**
12
+ * Generates one file of the functional API: the imports, the exports of the
13
+ * child namespaces, and the functions of the routes at this level.
14
+ *
15
+ * @evidence contracts/common.md#principled-implementation Each route contributes its function and its namespace, the imports are collected by one importer and emitted first, and each child namespace is re-exported, so a file is a complete module.
16
+ * @evidence contracts/common.md#clear-and-simple-design One function over the two per-route programmers and the importer.
17
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The output derives from the routes and the configuration.
18
+ * @evidence contracts/common.md#meaningful-documentation The comment states the file's content.
19
+ */
11
20
  export namespace NestiaMigrateApiFileProgrammer {
21
+ /**
22
+ * The input of one API file: the configuration, the components, the namespace
23
+ * path, the routes, and the child namespaces.
24
+ *
25
+ * @evidence contracts/common.md#principled-implementation The record holds exactly what a file needs, so files can be generated independently.
26
+ * @evidence contracts/common.md#clear-and-simple-design A flat record.
27
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
28
+ * @evidence contracts/common.md#meaningful-documentation The comment lists the fields.
29
+ */
12
30
  export interface IProps {
31
+ /** Calling convention and optional generated features for this operation. */
13
32
  config: INestiaMigrateConfig;
33
+
34
+ /** Component schemas used to resolve DTO references. */
14
35
  components: OpenApi.IComponents;
36
+
37
+ /** Accessor prefix locating this functional API index. */
15
38
  namespace: string[];
39
+
40
+ /** Operations whose functions belong directly to this index. */
16
41
  routes: IHttpMigrateRoute[];
42
+
43
+ /** Immediate child namespace names re-exported by this index. */
17
44
  children: Set<string>;
18
45
  }
19
46
 
47
+ /**
48
+ * Returns the statements of one API file.
49
+ *
50
+ * @evidence contracts/common.md#principled-implementation The relative path to the structures directory is derived from the namespace depth, so imports resolve from every level.
51
+ * @evidence contracts/common.md#clear-and-simple-design One function.
52
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The depth is computed, not hardcoded.
53
+ * @evidence contracts/common.md#meaningful-documentation The comment states its result.
54
+ */
20
55
  export const write = (props: IProps): ts.Statement[] => {
21
56
  const importer: NestiaMigrateImportProgrammer =
22
57
  new NestiaMigrateImportProgrammer();
@@ -12,14 +12,47 @@ import { SuccessStatus } from "../utils/SuccessStatus";
12
12
  import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
13
13
  import { NestiaMigrateSchemaProgrammer } from "./NestiaMigrateSchemaProgrammer";
14
14
 
15
+ /**
16
+ * Generates the function of one route in the SDK.
17
+ *
18
+ * @evidence contracts/common.md#principled-implementation The function has the connection parameter, the path, query, header, and body parameters in positional or keyword form, and its body calls the plain or the encrypted fetcher, or the simulator when the connection asks for it, and copies response headers when the description asks.
19
+ * @evidence contracts/common.md#clear-and-simple-design One entry function, one public parameter builder shared with the simulation programmer, and private helpers for the body and the header directives.
20
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The output derives from the route and the configuration, and the header directives are read from the documented tags.
21
+ * @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
22
+ */
15
23
  export namespace NestiaMigrateApiFunctionProgrammer {
24
+ /**
25
+ * The input of one function: the configuration, the components, the importer,
26
+ * and the route.
27
+ *
28
+ * @evidence contracts/common.md#principled-implementation The record holds exactly what the function generation needs.
29
+ * @evidence contracts/common.md#clear-and-simple-design A flat record.
30
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
31
+ * @evidence contracts/common.md#meaningful-documentation The comment lists the fields.
32
+ */
16
33
  export interface IContext {
34
+ /** Calling convention and optional generated features for this operation. */
17
35
  config: INestiaMigrateConfig;
36
+
37
+ /** Component schemas used to resolve DTO references. */
18
38
  components: OpenApi.IComponents;
39
+
40
+ /** File-local import collector shared with the surrounding file writer. */
19
41
  importer: NestiaMigrateImportProgrammer;
42
+
43
+ /** Analyzed operation, with the accessor chosen for this generation. */
20
44
  route: IHttpMigrateRoute;
21
45
  }
22
46
 
47
+ /**
48
+ * Returns the exported async function declaration of the route, with its
49
+ * description.
50
+ *
51
+ * @evidence contracts/common.md#principled-implementation The function name is the last accessor segment, the return type is the namespace's response type or void, and the description comes from the route comment with the path, the accessor, and the author tag.
52
+ * @evidence contracts/common.md#clear-and-simple-design One expression over the private parts.
53
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The names come from the accessor.
54
+ * @evidence contracts/common.md#meaningful-documentation The comment states the result.
55
+ */
23
56
  export const write = (ctx: IContext): ts.FunctionDeclaration =>
24
57
  FilePrinter.description(
25
58
  factory.createFunctionDeclaration(
@@ -43,6 +76,16 @@ export namespace NestiaMigrateApiFunctionProgrammer {
43
76
  writeDescription(ctx.config, ctx.route),
44
77
  );
45
78
 
79
+ /**
80
+ * Returns the parameters of the function: the connection first, then either
81
+ * one `props` parameter in keyword mode or the path, query, and body
82
+ * parameters in positional mode.
83
+ *
84
+ * @evidence contracts/common.md#principled-implementation The connection type carries the route's header type when it has one, keyword mode adds `props` only when there is something to pass, and an optional body is marked optional.
85
+ * @evidence contracts/common.md#clear-and-simple-design One function with the two modes as two returns.
86
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The shape follows the configuration.
87
+ * @evidence contracts/common.md#meaningful-documentation The comment states the two modes.
88
+ */
46
89
  export const writeParameterDeclarations = (
47
90
  ctx: IContext,
48
91
  connectionName?: string,
@@ -15,14 +15,47 @@ import { NestiaMigrateApiSimulationProgrammer } from "./NestiaMigrateApiSimulati
15
15
  import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
16
16
  import { NestiaMigrateSchemaProgrammer } from "./NestiaMigrateSchemaProgrammer";
17
17
 
18
+ /**
19
+ * Generates the namespace that accompanies the function of a route: its types,
20
+ * its metadata, its path builder, and, in simulation mode, its simulator.
21
+ *
22
+ * @evidence contracts/common.md#principled-implementation The namespace declares the `Props`, `Query`, `Body`, `Headers`, and `Response` types from the schemas, the route metadata the fetcher reads, the `path` function that fills the parameters into the template, and the simulator members.
23
+ * @evidence contracts/common.md#clear-and-simple-design One entry function, one public path-call builder shared with the simulation programmer, and private helpers per member.
24
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The output derives from the route and the configuration.
25
+ * @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
26
+ */
18
27
  export namespace NestiaMigrateApiNamespaceProgrammer {
28
+ /**
29
+ * The input of one namespace: the configuration, the components, the
30
+ * importer, and the route.
31
+ *
32
+ * @evidence contracts/common.md#principled-implementation The record holds exactly what the namespace generation needs.
33
+ * @evidence contracts/common.md#clear-and-simple-design A flat record.
34
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
35
+ * @evidence contracts/common.md#meaningful-documentation The comment lists the fields.
36
+ */
19
37
  export interface IContext {
38
+ /** Calling convention and optional generated features for this operation. */
20
39
  config: INestiaMigrateConfig;
40
+
41
+ /** Component schemas used to resolve DTO references. */
21
42
  components: OpenApi.IComponents;
43
+
44
+ /** File-local import collector shared with the surrounding file writer. */
22
45
  importer: NestiaMigrateImportProgrammer;
46
+
47
+ /** Analyzed operation, with the accessor chosen for this generation. */
23
48
  route: IHttpMigrateRoute;
24
49
  }
25
50
 
51
+ /**
52
+ * Returns the namespace declaration of a route.
53
+ *
54
+ * @evidence contracts/common.md#principled-implementation The members are written in a fixed order: types, metadata, path function, and the random and simulate members when simulation is enabled.
55
+ * @evidence contracts/common.md#clear-and-simple-design One function composing the private writers.
56
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The members follow the configuration.
57
+ * @evidence contracts/common.md#meaningful-documentation The comment states the result.
58
+ */
26
59
  export const write = (ctx: IContext): ts.ModuleDeclaration => {
27
60
  const types: ts.TypeAliasDeclaration[] = writeTypes(ctx);
28
61
  return factory.createModuleDeclaration(
@@ -45,6 +78,15 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
45
78
  );
46
79
  };
47
80
 
81
+ /**
82
+ * Returns the call expression of the route's `path` function with the
83
+ * arguments the configuration selects.
84
+ *
85
+ * @evidence contracts/common.md#principled-implementation In keyword mode the arguments are the `props` object and otherwise the path and query parameters in order, so the same call is valid in both modes.
86
+ * @evidence contracts/common.md#clear-and-simple-design One function shared by the simulator and the namespace.
87
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The arguments follow the configuration.
88
+ * @evidence contracts/common.md#meaningful-documentation The comment states the two argument forms.
89
+ */
48
90
  export const writePathCallExpression = (
49
91
  config: INestiaMigrateConfig,
50
92
  route: IHttpMigrateRoute,
@@ -8,7 +8,25 @@ import { NestiaMigrateApiFileProgrammer } from "./NestiaMigrateApiFileProgrammer
8
8
  import { NestiaMigrateDtoProgrammer } from "./NestiaMigrateDtoProgrammer";
9
9
  import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
10
10
 
11
+ /**
12
+ * Generates the functional API files and, for an SDK project, the DTO structure
13
+ * files.
14
+ *
15
+ * @evidence contracts/common.md#principled-implementation Routes are grouped by namespace path in a hash map, each parent namespace is given its child, and each namespace becomes one `index.ts`; the DTO files are written per top-level component name.
16
+ * @evidence contracts/common.md#clear-and-simple-design One entry function and two private helpers for the DTO files.
17
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The layout follows the accessors of the routes.
18
+ * @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
19
+ */
11
20
  export namespace NestiaMigrateApiProgrammer {
21
+ /**
22
+ * Returns the map from file path to content of the functional API, with the
23
+ * DTO files for an SDK project.
24
+ *
25
+ * @evidence contracts/common.md#principled-implementation The grouping creates every ancestor namespace so that each level has an index, and the paths differ between the two modes only by their root.
26
+ * @evidence contracts/common.md#clear-and-simple-design One function.
27
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The layout follows the accessors.
28
+ * @evidence contracts/common.md#meaningful-documentation The comment states the result.
29
+ */
12
30
  export const write = (ctx: INestiaMigrateContext): Record<string, string> => {
13
31
  const dict: HashMap<string[], NestiaMigrateApiFileProgrammer.IProps> =
14
32
  new HashMap(
@@ -12,14 +12,48 @@ import { NestiaMigrateApiNamespaceProgrammer } from "./NestiaMigrateApiNamespace
12
12
  import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
13
13
  import { NestiaMigrateSchemaProgrammer } from "./NestiaMigrateSchemaProgrammer";
14
14
 
15
+ /**
16
+ * Generates the mockup simulator members of a route: a random response and a
17
+ * simulate function that validates the request first.
18
+ *
19
+ * @evidence contracts/common.md#principled-implementation The random member calls `typia.random` for the response type, and the simulate function validates the parameters, query, body, and headers with `typia.assert` through the fetcher's simulator, so an invalid simulated request throws the error the real server answers.
20
+ * @evidence contracts/common.md#clear-and-simple-design Two public functions and one private assertion writer.
21
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The simulation follows the schemas of the route.
22
+ * @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
23
+ */
15
24
  export namespace NestiaMigrateApiSimulationProgrammer {
25
+ /**
26
+ * The input of the simulation members: the configuration, the components, the
27
+ * importer, and the route.
28
+ *
29
+ * @evidence contracts/common.md#principled-implementation The record holds exactly what the generation needs.
30
+ * @evidence contracts/common.md#clear-and-simple-design A flat record.
31
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
32
+ * @evidence contracts/common.md#meaningful-documentation The comment lists the fields.
33
+ */
16
34
  export interface IContext {
35
+ /** Calling convention and optional generated features for this operation. */
17
36
  config: INestiaMigrateConfig;
37
+
38
+ /** Component schemas used to resolve DTO references. */
18
39
  components: OpenApi.IComponents;
40
+
41
+ /** File-local import collector shared with the surrounding file writer. */
19
42
  importer: NestiaMigrateImportProgrammer;
43
+
44
+ /** Analyzed operation, with the accessor chosen for this generation. */
20
45
  route: IHttpMigrateRoute;
21
46
  }
22
47
 
48
+ /**
49
+ * Returns the `random` constant: a function that returns a random value of
50
+ * the response type.
51
+ *
52
+ * @evidence contracts/common.md#principled-implementation The response schema is written as a type and given to `typia.random`, and a route without a response uses `void`.
53
+ * @evidence contracts/common.md#clear-and-simple-design One expression.
54
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The value is produced by typia at run time.
55
+ * @evidence contracts/common.md#meaningful-documentation The comment states the result.
56
+ */
23
57
  export const random = (ctx: IContext) => {
24
58
  const output = ctx.route.success
25
59
  ? NestiaMigrateSchemaProgrammer.write({
@@ -54,6 +88,15 @@ export namespace NestiaMigrateApiSimulationProgrammer {
54
88
  );
55
89
  };
56
90
 
91
+ /**
92
+ * Returns the `simulate` constant: a function with the route's parameters
93
+ * that validates the request and returns a random response.
94
+ *
95
+ * @evidence contracts/common.md#principled-implementation The parameters are those of the real function, the assertions run first, and an unused connection is renamed so the compiler does not report it.
96
+ * @evidence contracts/common.md#clear-and-simple-design One expression over the shared parameter builder.
97
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The validation is generated from the same schemas as the real function's types.
98
+ * @evidence contracts/common.md#meaningful-documentation The comment states the result.
99
+ */
57
100
  export const simulate = (ctx: IContext): ts.VariableStatement => {
58
101
  const caller = () =>
59
102
  factory.createCallExpression(
@@ -9,15 +9,31 @@ import { FilePrinter } from "../utils/FilePrinter";
9
9
  import { NestiaMigrateE2eFunctionProgrammer } from "./NestiaMigrateE2eFileProgrammer";
10
10
  import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
11
11
 
12
+ /**
13
+ * Generates the `test/start.ts` of an SDK project: a small program that calls
14
+ * one API function.
15
+ *
16
+ * @evidence contracts/common.md#principled-implementation The program builds a connection from the global test settings and the first server of the document, adds the simulate flag when requested, and calls the first route the way the generated e2e tests do, so one command can check that the SDK and a server agree.
17
+ * @evidence contracts/common.md#clear-and-simple-design One entry function and private helpers for the connection, the main function, and the starter.
18
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The route is the first one, so the same document always generates the same file.
19
+ * @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
20
+ */
12
21
  export namespace NestiaMigrateApiStartProgrammer {
22
+ /**
23
+ * Returns the `test/start.ts` file of an SDK project.
24
+ *
25
+ * @evidence contracts/common.md#principled-implementation The file imports what the body uses, defines `main`, and starts it, exiting with a failure status when it rejects.
26
+ * @evidence contracts/common.md#clear-and-simple-design One function.
27
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The content derives from the document.
28
+ * @evidence contracts/common.md#meaningful-documentation The comment states the result.
29
+ */
13
30
  export const write = (
14
31
  context: INestiaMigrateContext,
15
32
  ): Record<string, string> => {
16
33
  const importer: NestiaMigrateImportProgrammer =
17
34
  new NestiaMigrateImportProgrammer();
18
- const route: IHttpMigrateRoute | undefined = pick(
19
- context.application.routes,
20
- );
35
+ // the first route, so the same document always generates the same file
36
+ const route: IHttpMigrateRoute | undefined = context.application.routes[0];
21
37
  const main: ts.VariableStatement = writeMain(context, importer, route);
22
38
  const statements: ts.Statement[] = [
23
39
  ...importer.toStatements(
@@ -197,10 +213,3 @@ export namespace NestiaMigrateApiStartProgrammer {
197
213
  ],
198
214
  );
199
215
  }
200
-
201
- const pick = <T>(array: T[]): T | undefined => {
202
- if (array.length === 0) return undefined;
203
- const rand: number = Math.random() * array.length;
204
- const index: number = Math.min(array.length - 1, Math.floor(rand));
205
- return array[index]!;
206
- };
@@ -10,17 +10,50 @@ import { StringUtil } from "../utils/StringUtil";
10
10
  import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
11
11
  import { NestiaMigrateSchemaProgrammer } from "./NestiaMigrateSchemaProgrammer";
12
12
 
13
+ /**
14
+ * Generates the DTO type aliases from the component schemas.
15
+ *
16
+ * @evidence contracts/common.md#principled-implementation Each component name is normalized into a valid dotted name, the dots become nested namespaces, and each schema becomes an exported type alias with its description and its tags as a comment.
17
+ * @evidence contracts/common.md#clear-and-simple-design One public function and private builders for the module tree and the alias.
18
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The names derive from the schema names.
19
+ * @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
20
+ */
13
21
  export namespace NestiaMigrateDtoProgrammer {
22
+ /**
23
+ * A node of the DTO namespace tree: its name, its children, and the writer of
24
+ * its alias, or `null` for a namespace without a type of its own.
25
+ *
26
+ * @evidence contracts/common.md#principled-implementation The tree mirrors the dotted names of the schemas, so a namespace exists exactly when a name passes through it.
27
+ * @evidence contracts/common.md#clear-and-simple-design A three-member record.
28
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
29
+ * @evidence contracts/common.md#meaningful-documentation The comment states the meaning of each member.
30
+ */
14
31
  export interface IModule {
15
32
  name: string;
33
+
34
+ /** Child segments of qualified schema names, preserving insertion order. */
16
35
  children: Map<string, IModule>;
36
+
37
+ /** Alias writer for a schema at this node, or null for a namespace alone. */
17
38
  programmer:
18
39
  | null
19
40
  | ((importer: NestiaMigrateImportProgrammer) => ts.TypeAliasDeclaration);
20
41
  }
21
42
 
43
+ /**
44
+ * Returns the root of the DTO tree: a map from the first name segment to its
45
+ * module.
46
+ *
47
+ * @evidence contracts/common.md#principled-implementation Each schema key is split on slashes, its segments are escaped into valid identifiers and joined, and the result is inserted along its dotted path.
48
+ * @evidence contracts/common.md#clear-and-simple-design One function over one insertion helper.
49
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The names come from the document.
50
+ * @evidence contracts/common.md#meaningful-documentation The comment states the result.
51
+ */
22
52
  export const compose = (props: {
53
+ /** Calling convention and optional generated features for this operation. */
23
54
  config: INestiaMigrateConfig;
55
+
56
+ /** Component schemas used to resolve DTO references. */
24
57
  components: OpenApi.IComponents;
25
58
  }): Map<string, IModule> => {
26
59
  const dict: Map<string, IModule> = new Map();
@@ -9,14 +9,47 @@ import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
9
9
  import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
10
10
  import { NestiaMigrateSchemaProgrammer } from "./NestiaMigrateSchemaProgrammer";
11
11
 
12
+ /**
13
+ * Generates the e2e test function of one route.
14
+ *
15
+ * @evidence contracts/common.md#principled-implementation The function calls the route through the SDK with random arguments made by `typia.random`, including generated headers, and asserts the response with `typia.assert`, so the test checks that the server's answer matches the declared type.
16
+ * @evidence contracts/common.md#clear-and-simple-design One entry function, one public body writer shared with the start programmer, and a private call writer.
17
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The arguments are drawn at run time, and no route is special-cased.
18
+ * @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
19
+ */
12
20
  export namespace NestiaMigrateE2eFunctionProgrammer {
21
+ /**
22
+ * The input of one test function: the configuration, the components, the
23
+ * importer, and the route.
24
+ *
25
+ * @evidence contracts/common.md#principled-implementation The record holds exactly what the generation needs.
26
+ * @evidence contracts/common.md#clear-and-simple-design A flat record.
27
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
28
+ * @evidence contracts/common.md#meaningful-documentation The comment lists the fields.
29
+ */
13
30
  export interface IContext {
31
+ /** Calling convention and optional generated features for this operation. */
14
32
  config: INestiaMigrateConfig;
33
+
34
+ /** Component schemas used to resolve DTO references. */
15
35
  components: OpenApi.IComponents;
36
+
37
+ /** File-local import collector shared with the surrounding file writer. */
16
38
  importer: NestiaMigrateImportProgrammer;
39
+
40
+ /** Analyzed operation, with the accessor chosen for this generation. */
17
41
  route: IHttpMigrateRoute;
18
42
  }
19
43
 
44
+ /**
45
+ * Returns the exported async test function of a route, named `test_api_`
46
+ * followed by its accessor.
47
+ *
48
+ * @evidence contracts/common.md#principled-implementation The name joins `test`, `api`, and the accessor with underscores, so it is unique for a route and matches the prefix that the e2e executor discovers.
49
+ * @evidence contracts/common.md#clear-and-simple-design One expression.
50
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The name derives from the accessor.
51
+ * @evidence contracts/common.md#meaningful-documentation The comment states the naming rule.
52
+ */
20
53
  export const write = (ctx: IContext): ts.FunctionDeclaration =>
21
54
  factory.createFunctionDeclaration(
22
55
  [
@@ -47,6 +80,15 @@ export namespace NestiaMigrateE2eFunctionProgrammer {
47
80
  factory.createBlock(writeBody(ctx), true),
48
81
  );
49
82
 
83
+ /**
84
+ * Returns the statements of the test body: the call with random arguments and
85
+ * the type assertion of its output.
86
+ *
87
+ * @evidence contracts/common.md#principled-implementation The call expression follows the parameter mode of the configuration, and the output is typed by the response schema when there is one.
88
+ * @evidence contracts/common.md#clear-and-simple-design One function shared with the start programmer.
89
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The body follows the route.
90
+ * @evidence contracts/common.md#meaningful-documentation The comment states the result.
91
+ */
50
92
  export const writeBody = (ctx: IContext): ts.Statement[] => [
51
93
  factory.createVariableStatement(
52
94
  [],
@@ -8,7 +8,23 @@ import { FilePrinter } from "../utils/FilePrinter";
8
8
  import { NestiaMigrateE2eFunctionProgrammer } from "./NestiaMigrateE2eFileProgrammer";
9
9
  import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
10
10
 
11
+ /**
12
+ * Generates the e2e test files, one per route.
13
+ *
14
+ * @evidence contracts/common.md#principled-implementation Each route becomes a file whose path depends on the mode and whose imports are resolved through the package name for a monorepo and through the built library path otherwise.
15
+ * @evidence contracts/common.md#clear-and-simple-design One public function and one private file writer.
16
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The layout follows the accessors.
17
+ * @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
18
+ */
11
19
  export namespace NestiaMigrateE2eProgrammer {
20
+ /**
21
+ * Returns the map from file path to content of the e2e tests.
22
+ *
23
+ * @evidence contracts/common.md#principled-implementation The file name is `test_api_` plus the accessor, so each route has exactly one file.
24
+ * @evidence contracts/common.md#clear-and-simple-design One function.
25
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The names follow the accessors.
26
+ * @evidence contracts/common.md#meaningful-documentation The comment states the result.
27
+ */
12
28
  export const write = (ctx: INestiaMigrateContext): Record<string, string> =>
13
29
  Object.fromEntries(
14
30
  ctx.application.routes