@autobe/agent 0.21.0 → 0.22.0

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 (291) hide show
  1. package/lib/agent/src/AutoBeAgent.js +2 -2
  2. package/lib/agent/src/AutoBeAgent.js.map +1 -1
  3. package/lib/agent/src/constants/AutoBeConfigConstant.d.ts +3 -0
  4. package/lib/agent/src/{orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js → constants/AutoBeConfigConstant.js} +1 -1
  5. package/lib/agent/src/constants/AutoBeConfigConstant.js.map +1 -0
  6. package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +27 -27
  7. package/lib/agent/src/context/AutoBeContext.d.ts +1 -0
  8. package/lib/agent/src/context/AutoBeTokenUsageComponent.js +4 -3
  9. package/lib/agent/src/context/AutoBeTokenUsageComponent.js.map +1 -1
  10. package/lib/agent/src/factory/consentFunctionCall.js +4 -4
  11. package/lib/agent/src/factory/consentFunctionCall.js.map +1 -1
  12. package/lib/agent/src/factory/createAutoBeContext.js +13 -10
  13. package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
  14. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
  15. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
  16. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
  17. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  18. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +1 -1
  19. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  20. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +6 -6
  21. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +50 -8
  22. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  23. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +4 -4
  24. package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
  25. package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
  26. package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js +1 -1
  27. package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  28. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +19 -1
  29. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  30. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
  31. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  32. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
  33. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  34. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +2 -2
  35. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
  36. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
  37. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  38. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
  39. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  40. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
  41. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  42. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
  43. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  44. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
  45. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
  46. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  47. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +5 -1
  48. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
  49. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +16 -10
  50. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  51. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
  52. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +3731 -228
  53. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  54. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +2 -2
  55. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +2 -2
  56. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +43 -63
  57. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  58. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +1261 -1628
  59. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  60. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +3466 -103
  61. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  62. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
  63. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +3672 -358
  64. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
  65. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
  66. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -141
  67. package/lib/agent/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
  68. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
  69. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js +1385 -0
  70. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -0
  71. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
  72. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js +78 -0
  73. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js.map +1 -0
  74. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
  75. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js +81 -0
  76. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js.map +1 -0
  77. package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js.map +1 -1
  78. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +1 -1
  79. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  80. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +1 -1
  81. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
  82. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
  83. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  84. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
  85. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  86. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
  87. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +2 -2
  88. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  89. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +1 -1
  90. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  91. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +2 -2
  92. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  93. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
  94. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +22 -7
  95. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  96. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
  97. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +13 -29
  98. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  99. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
  100. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js +2 -8
  101. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
  102. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +6 -49
  103. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
  104. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +4 -2
  105. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  106. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +5 -3
  107. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  108. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
  109. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +206 -118
  110. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  111. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
  112. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
  113. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
  114. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +24 -39
  115. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  116. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
  117. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
  118. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
  119. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
  120. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js +3 -0
  121. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js.map +1 -0
  122. package/{src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.ts → lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts} +2 -13
  123. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js +3 -0
  124. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js.map +1 -0
  125. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +33 -22
  126. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
  127. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +86 -0
  128. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -0
  129. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
  130. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js +55 -0
  131. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -0
  132. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
  133. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js +20 -0
  134. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -0
  135. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
  136. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js +73 -0
  137. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -0
  138. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
  139. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js +63 -69
  140. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  141. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +15 -14
  142. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
  143. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +1 -1
  144. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
  145. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
  146. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js +19 -0
  147. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js.map +1 -0
  148. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
  149. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js +2 -0
  150. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
  151. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
  152. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js +21 -0
  153. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js.map +1 -0
  154. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +2 -2
  155. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +16 -17
  156. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  157. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +5 -4
  158. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  159. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +21 -2
  160. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  161. package/lib/agent/src/orchestrate/test/orchestrateTest.js +6 -0
  162. package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
  163. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
  164. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +126 -72
  165. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  166. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +46 -40
  167. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  168. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +121 -42
  169. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  170. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
  171. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
  172. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js +3 -0
  173. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js.map +1 -0
  174. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
  175. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
  176. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
  177. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js +28 -0
  178. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js.map +1 -0
  179. package/lib/agent/src/structures/IAutoBeConfig.d.ts +2 -0
  180. package/lib/constants/AutoBeConfigConstant.d.ts +3 -0
  181. package/lib/constants/AutoBeSystemPromptConstant.d.ts +27 -27
  182. package/lib/context/AutoBeContext.d.ts +1 -0
  183. package/lib/index.mjs +13805 -3871
  184. package/lib/index.mjs.map +1 -1
  185. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
  186. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
  187. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
  188. package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
  189. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
  190. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
  191. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -141
  192. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
  193. package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
  194. package/lib/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
  195. package/lib/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
  196. package/lib/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
  197. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
  198. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
  199. package/lib/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
  200. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
  201. package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
  202. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
  203. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
  204. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
  205. package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
  206. package/lib/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
  207. package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts +36 -0
  208. package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +33 -22
  209. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
  210. package/lib/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
  211. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
  212. package/lib/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
  213. package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
  214. package/lib/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
  215. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
  216. package/lib/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
  217. package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +2 -2
  218. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
  219. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
  220. package/lib/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
  221. package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
  222. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
  223. package/lib/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
  224. package/lib/structures/IAutoBeConfig.d.ts +2 -0
  225. package/package.json +5 -5
  226. package/src/AutoBeAgent.ts +2 -0
  227. package/src/constants/AutoBeConfigConstant.ts +3 -0
  228. package/src/constants/AutoBeSystemPromptConstant.ts +27 -27
  229. package/src/context/AutoBeContext.ts +1 -0
  230. package/src/context/AutoBeTokenUsageComponent.ts +3 -3
  231. package/src/factory/consentFunctionCall.ts +2 -0
  232. package/src/factory/createAutoBeContext.ts +145 -136
  233. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +6 -0
  234. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +4 -0
  235. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +19 -1
  236. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +1 -4
  237. package/src/orchestrate/interface/orchestrateInterface.ts +15 -4
  238. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +13 -5
  239. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +58 -19
  240. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +11 -11
  241. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +13 -117
  242. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +33 -91
  243. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +72 -95
  244. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +0 -39
  245. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +50 -146
  246. package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +31 -27
  247. package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +171 -0
  248. package/src/orchestrate/interface/utils/JsonSchemaNamingConvention.ts +83 -0
  249. package/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.ts +90 -0
  250. package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +2 -2
  251. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +1 -2
  252. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +30 -15
  253. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +27 -49
  254. package/src/orchestrate/realize/internal/compileRealizeFiles.ts +4 -11
  255. package/src/orchestrate/realize/orchestrateRealize.ts +19 -75
  256. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +1 -1
  257. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +114 -25
  258. package/src/orchestrate/realize/orchestrateRealizeScenario.ts +2 -2
  259. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +11 -15
  260. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +17 -0
  261. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +20 -0
  262. package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +40 -74
  263. package/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.ts +9 -0
  264. package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.ts +45 -0
  265. package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +33 -22
  266. package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +97 -0
  267. package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +64 -0
  268. package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +29 -0
  269. package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +82 -0
  270. package/src/orchestrate/realize/utils/replaceImportStatements.ts +101 -111
  271. package/src/orchestrate/test/compile/completeTestCode.ts +15 -26
  272. package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +1 -0
  273. package/src/orchestrate/test/compile/getTestImportStatements.ts +25 -0
  274. package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +6 -1
  275. package/src/orchestrate/test/compile/getTestTemplateCode.ts +25 -0
  276. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +26 -26
  277. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +6 -5
  278. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +19 -0
  279. package/src/orchestrate/test/orchestrateTest.ts +6 -0
  280. package/src/orchestrate/test/orchestrateTestCorrect.ts +46 -15
  281. package/src/orchestrate/test/orchestrateTestScenario.ts +52 -48
  282. package/src/orchestrate/test/orchestrateTestWrite.ts +23 -5
  283. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +49 -46
  284. package/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.ts +8 -0
  285. package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +1 -0
  286. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +14 -0
  287. package/src/orchestrate/test/utils/getReferenceIds.ts +25 -0
  288. package/src/structures/IAutoBeConfig.ts +3 -0
  289. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
  290. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js.map +0 -1
  291. package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
@@ -0,0 +1,31 @@
1
+ import { AutoBeOpenApi, AutoBeRealizeAuthorization } from "@autobe/interface";
2
+ import { IAutoBeRealizeScenarioResult } from "../structures/IAutoBeRealizeScenarioResult";
3
+ /**
4
+ * Generate a TypeScript function template for the Realize Agent to complete
5
+ *
6
+ * This utility creates a function skeleton with proper imports, parameters, and
7
+ * return type that the AI needs to implement. The template includes:
8
+ *
9
+ * - Import statements for required dependencies
10
+ * - Function signature with all parameters
11
+ * - Return type specification
12
+ *
13
+ * @example
14
+ * // Returns a template like:
15
+ * ```typescript
16
+ * import { MyGlobal } from "../MyGlobal";
17
+ * // ... other imports
18
+ *
19
+ * async function post__users_create(
20
+ * body: IUserCreateRequest
21
+ * ): Promise<IUserResponse> {
22
+ * ...
23
+ * }
24
+ * ```;
25
+ *
26
+ * @param scenario - The realize scenario containing function metadata
27
+ * @param operation - OpenAPI operation definition
28
+ * @param authorization - Authorization context if endpoint is authenticated
29
+ * @returns Complete TypeScript code template as a formatted string
30
+ */
31
+ export declare function getRealizeWriteCodeTemplate(scenario: IAutoBeRealizeScenarioResult, operation: AutoBeOpenApi.IOperation, authorization: AutoBeRealizeAuthorization | null): string;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRealizeWriteCodeTemplate = getRealizeWriteCodeTemplate;
4
+ const utils_1 = require("@autobe/utils");
5
+ const getRealizeWriteImportStatements_1 = require("./getRealizeWriteImportStatements");
6
+ /**
7
+ * Generate a TypeScript function template for the Realize Agent to complete
8
+ *
9
+ * This utility creates a function skeleton with proper imports, parameters, and
10
+ * return type that the AI needs to implement. The template includes:
11
+ *
12
+ * - Import statements for required dependencies
13
+ * - Function signature with all parameters
14
+ * - Return type specification
15
+ *
16
+ * @example
17
+ * // Returns a template like:
18
+ * ```typescript
19
+ * import { MyGlobal } from "../MyGlobal";
20
+ * // ... other imports
21
+ *
22
+ * async function post__users_create(
23
+ * body: IUserCreateRequest
24
+ * ): Promise<IUserResponse> {
25
+ * ...
26
+ * }
27
+ * ```;
28
+ *
29
+ * @param scenario - The realize scenario containing function metadata
30
+ * @param operation - OpenAPI operation definition
31
+ * @param authorization - Authorization context if endpoint is authenticated
32
+ * @returns Complete TypeScript code template as a formatted string
33
+ */
34
+ function getRealizeWriteCodeTemplate(scenario, operation, authorization) {
35
+ var _a, _b, _c;
36
+ // Collect all function parameters in order
37
+ const functionParameters = [];
38
+ // Add authentication parameter if needed (e.g., user: IUser, admin: IAdmin)
39
+ if (authorization && authorization.role.name) {
40
+ // Debug: Log the values to check what's being used
41
+ const authParameter = `${authorization.role.name}: ${authorization.payload.name}`;
42
+ functionParameters.push(authParameter);
43
+ }
44
+ // Add path parameters (e.g., id, postId, etc.)
45
+ const pathParameters = operation.parameters.map((param) => {
46
+ const paramType = param.schema.type;
47
+ const paramFormat = "format" in param.schema
48
+ ? ` & tags.Format<'${param.schema.format}'>`
49
+ : "";
50
+ return `${param.name}: ${paramType}${paramFormat}`;
51
+ });
52
+ functionParameters.push(...pathParameters);
53
+ // Add request body parameter if present
54
+ if ((_a = operation.requestBody) === null || _a === void 0 ? void 0 : _a.typeName) {
55
+ const bodyParameter = `body: ${operation.requestBody.typeName}`;
56
+ functionParameters.push(bodyParameter);
57
+ }
58
+ // Format parameters for props object
59
+ const hasParameters = functionParameters.length > 0;
60
+ let formattedSignature;
61
+ if (hasParameters) {
62
+ const propsFields = functionParameters
63
+ .map((param) => ` ${param}`)
64
+ .join(";\n");
65
+ formattedSignature = `props: {\n${propsFields};\n}`;
66
+ }
67
+ else {
68
+ formattedSignature = "";
69
+ }
70
+ // Determine return type
71
+ const returnType = (_c = (_b = operation.responseBody) === null || _b === void 0 ? void 0 : _b.typeName) !== null && _c !== void 0 ? _c : "void";
72
+ // Generate the complete template
73
+ return utils_1.StringUtil.trim `
74
+ Complete the code below, disregard the import part and return only the function part.
75
+
76
+ \`\`\`typescript
77
+ ${(0, getRealizeWriteImportStatements_1.getRealizeWriteImportStatements)(operation).join("\n")}
78
+
79
+ // ONLY YOU HAVE TO WRITE THIS, AND USE IMPORTED.
80
+ export async function ${scenario.functionName}(${formattedSignature}): Promise<${returnType}> {
81
+ ...
82
+ }
83
+ \`\`\`
84
+ `;
85
+ }
86
+ //# sourceMappingURL=getRealizeWriteCodeTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRealizeWriteCodeTemplate.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts"],"names":[],"mappings":";;AAkCA,kEA8DC;AA/FD,yCAA2C;AAG3C,uFAAoF;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,2BAA2B,CACzC,QAAsC,EACtC,SAAmC,EACnC,aAAgD;;IAEhD,2CAA2C;IAC3C,MAAM,kBAAkB,GAAa,EAAE,CAAC;IAExC,4EAA4E;IAC5E,IAAI,aA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ACtD,CAAC;SAAM,CAAC;QACN,kBAAkB,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED,wBAAwB;IACxB,MAAM,UAAU,GAAG,MAAA,MAAA,SAAS,CAAC,YAAY,0CAAE,QAAQ,mCAAI,MAAM,CAAC;IAE9D,iCAAiC;IACjC,OAAO,kBAAU,CAAC,IAAI,CAAA;;;;MAIlB,IAAA,iEAA+B,EAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;4BAG/B,QAAQ,CAAC,YAAY,IAAI,kBAAkB,cAAc,UAAU;;;;GAI5F,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { AutoBeOpenApi } from "@autobe/interface";
2
+ import { ILlmSchema } from "@samchon/openapi";
3
+ import { AutoBeContext } from "../../../context/AutoBeContext";
4
+ export declare function getRealizeWriteDto<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, operation: AutoBeOpenApi.IOperation): Promise<Record<string, string>>;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getRealizeWriteDto = getRealizeWriteDto;
13
+ const openapi_1 = require("@samchon/openapi");
14
+ function getRealizeWriteDto(ctx, operation) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ const document = filterDocument(operation, ctx.state().interface.document);
17
+ const compiler = yield ctx.compiler();
18
+ const entries = Object.entries(yield compiler.interface.write(document));
19
+ const filter = (prefix, exclude) => {
20
+ const result = entries.filter(([key]) => key.startsWith(prefix) === true);
21
+ return Object.fromEntries(exclude
22
+ ? result.filter(([key]) => key.startsWith(exclude) === false)
23
+ : result);
24
+ };
25
+ const dto = filter("src/api/structures");
26
+ return dto;
27
+ });
28
+ }
29
+ function filterDocument(operation, document) {
30
+ const components = {
31
+ authorization: document.components.authorization,
32
+ schemas: {},
33
+ };
34
+ const visit = (typeName) => {
35
+ openapi_1.OpenApiTypeChecker.visit({
36
+ components: document.components,
37
+ schema: { $ref: `#/components/schemas/${typeName}` },
38
+ closure: (s) => {
39
+ if (openapi_1.OpenApiTypeChecker.isReference(s)) {
40
+ const key = s.$ref.split("/").pop();
41
+ components.schemas[key] = document.components.schemas[key];
42
+ }
43
+ },
44
+ });
45
+ };
46
+ if (operation.requestBody)
47
+ visit(operation.requestBody.typeName);
48
+ if (operation.responseBody)
49
+ visit(operation.responseBody.typeName);
50
+ return {
51
+ operations: [operation],
52
+ components,
53
+ };
54
+ }
55
+ //# sourceMappingURL=getRealizeWriteDto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRealizeWriteDto.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/realize/utils/getRealizeWriteDto.ts"],"names":[],"mappings":";;;;;;;;;;;AAKA,gDA2BC;AA/BD,8CAAkE;AAIlE,SAAsB,kBAAkB,CACtC,GAAyB,EACzB,SAAmC;;QAEnC,MAAM,QAAQ,GAA4B,cAAc,CACtD,SAAS,EACT,GAAG,CAAC,KAAK,EAAE,CAAC,SAAU,CAAC,QAAQ,CAChC,CAAC;QAEF,MAAM,QAAQ,GAAoB,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC;QACvD,MAAM,OAAO,GAAuB,MAAM,CAAC,OAAO,CAChD,MAAM,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,CACzC,CAAC;QAEF,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,OAAgB,EAAE,EAAE;YACl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,CAAC,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACjE,IAAI,SAAS,CAAC,YAAY;QAAE,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAEnE,OAAO;QACL,UAAU,EAAE,CAAC,SAAS,CAAC;QACvB,UAAU;KACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { AutoBeOpenApi } from "@autobe/interface";
2
+ export declare function getRealizeWriteImportStatements(operation: AutoBeOpenApi.IOperation): string[];
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRealizeWriteImportStatements = getRealizeWriteImportStatements;
4
+ function getRealizeWriteImportStatements(operation) {
5
+ const typeReferences = Array.from(new Set([operation.requestBody, operation.responseBody]
6
+ .filter((el) => el !== null)
7
+ .map((el) => el.typeName.split(".")[0])));
8
+ // Build the standard imports
9
+ const imports = [
10
+ 'import jwt from "jsonwebtoken";',
11
+ 'import { MyGlobal } from "../MyGlobal";',
12
+ 'import typia, { tags } from "typia";',
13
+ 'import { Prisma } from "@prisma/client";',
14
+ 'import { v4 } from "uuid";',
15
+ 'import { toISOStringSafe } from "../util/toISOStringSafe"',
16
+ ...typeReferences.map((ref) => `import { ${ref} } from "@ORGANIZATION/PROJECT-api/lib/structures/${ref}";`),
17
+ ];
18
+ return imports;
19
+ }
20
+ //# sourceMappingURL=getRealizeWriteImportStatements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRealizeWriteImportStatements.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts"],"names":[],"mappings":";;AAEA,0EA0BC;AA1BD,SAAgB,+BAA+B,CAC7C,SAAmC;IAEnC,MAAM,cAAc,GAAa,KAAK,CAAC,IAAI,CACzC,IAAI,GAAG,CACL,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,YAAY,CAAC;SAC5C,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;SAC3B,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC,CAC3C,CACF,CAAC;IAEF,6BAA6B;IAC7B,MAAM,OAAO,GAAG;QACd,iCAAiC;QACjC,yCAAyC;QACzC,sCAAsC;QACtC,0CAA0C;QAC1C,4BAA4B;QAC5B,2DAA2D;QAC3D,GAAG,cAAc,CAAC,GAAG,CACnB,CAAC,GAAG,EAAE,EAAE,CACN,YAAY,GAAG,qDAAqD,GAAG,IAAI,CAC9E;KACF,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { AutoBeOpenApi, AutoBeRealizeAuthorization } from "@autobe/interface";
2
+ /**
3
+ * Generate TypeScript type definition string for provider function props
4
+ *
5
+ * This utility creates the exact props interface that the Realize Agent's
6
+ * generated provider functions must accept. It combines:
7
+ *
8
+ * - Authentication context (user/admin/member from authorization)
9
+ * - URL path parameters (e.g., id, boardId, postId)
10
+ * - Request body type (if applicable)
11
+ *
12
+ * The output is injected into REALIZE_WRITE_ARTIFACT.md template to tell the AI
13
+ * exactly what parameter type the function should accept.
14
+ *
15
+ * @example
16
+ * // For DELETE /posts/:id (authenticated)
17
+ * // Returns: "props: { user: IUser; id: string & tags.Format<'uuid'>; }"
18
+ *
19
+ * @example
20
+ * // For GET /public/info (no auth, no params)
21
+ * // Returns: "// No props parameter needed - function should have no parameters"
22
+ *
23
+ * @param operation - OpenAPI operation definition containing parameters and
24
+ * auth requirements
25
+ * @param authorization - Authorization context with user/role information (if
26
+ * authenticated endpoint)
27
+ * @returns TypeScript interface string like "props: { user: IUser; id: string;
28
+ * body: IRequest; }"
29
+ */
30
+ export declare function getRealizeWriteInputType(operation: AutoBeOpenApi.IOperation, authorization: AutoBeRealizeAuthorization | null): string;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRealizeWriteInputType = getRealizeWriteInputType;
4
+ const utils_1 = require("@autobe/utils");
5
+ /**
6
+ * Generate TypeScript type definition string for provider function props
7
+ *
8
+ * This utility creates the exact props interface that the Realize Agent's
9
+ * generated provider functions must accept. It combines:
10
+ *
11
+ * - Authentication context (user/admin/member from authorization)
12
+ * - URL path parameters (e.g., id, boardId, postId)
13
+ * - Request body type (if applicable)
14
+ *
15
+ * The output is injected into REALIZE_WRITE_ARTIFACT.md template to tell the AI
16
+ * exactly what parameter type the function should accept.
17
+ *
18
+ * @example
19
+ * // For DELETE /posts/:id (authenticated)
20
+ * // Returns: "props: { user: IUser; id: string & tags.Format<'uuid'>; }"
21
+ *
22
+ * @example
23
+ * // For GET /public/info (no auth, no params)
24
+ * // Returns: "// No props parameter needed - function should have no parameters"
25
+ *
26
+ * @param operation - OpenAPI operation definition containing parameters and
27
+ * auth requirements
28
+ * @param authorization - Authorization context with user/role information (if
29
+ * authenticated endpoint)
30
+ * @returns TypeScript interface string like "props: { user: IUser; id: string;
31
+ * body: IRequest; }"
32
+ */
33
+ function getRealizeWriteInputType(operation, authorization) {
34
+ var _a, _b;
35
+ const functionParameterFields = [];
36
+ // Add authentication field (user/admin/member) if endpoint requires auth
37
+ const hasAuthentication = authorization && operation.authorizationRole;
38
+ if (hasAuthentication) {
39
+ const authFieldName = operation.authorizationRole;
40
+ const authFieldType = authorization.payload.name;
41
+ functionParameterFields.push(`${authFieldName}: ${authFieldType};`);
42
+ }
43
+ // Add URL path parameters (e.g., /posts/:id → id parameter)
44
+ const pathParameters = operation.parameters;
45
+ pathParameters.forEach((pathParam) => {
46
+ const paramName = pathParam.name;
47
+ const paramType = pathParam.schema.type;
48
+ const paramFormat = "format" in pathParam.schema
49
+ ? ` & tags.Format<'${pathParam.schema.format}'>`
50
+ : "";
51
+ const parameterField = `${paramName}: ${paramType}${paramFormat};`;
52
+ functionParameterFields.push(parameterField);
53
+ });
54
+ // Add request body if present (POST/PUT/PATCH operations)
55
+ const hasRequestBody = (_a = operation.requestBody) === null || _a === void 0 ? void 0 : _a.typeName;
56
+ if (hasRequestBody) {
57
+ const bodyTypeName = (_b = operation.requestBody) === null || _b === void 0 ? void 0 : _b.typeName;
58
+ functionParameterFields.push(`body: ${bodyTypeName};`);
59
+ }
60
+ // Format as TypeScript props interface or indicate no parameters needed
61
+ const hasParameters = functionParameterFields.length > 0;
62
+ if (!hasParameters) {
63
+ return `// No props parameter needed - function should have no parameters`;
64
+ }
65
+ const formattedFields = functionParameterFields
66
+ .map((field) => ` ${field}`)
67
+ .join("\n");
68
+ return utils_1.StringUtil.trim `
69
+ props: {
70
+ ${formattedFields}
71
+ }`;
72
+ }
73
+ //# sourceMappingURL=getRealizeWriteInputType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRealizeWriteInputType.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/realize/utils/getRealizeWriteInputType.ts"],"names":[],"mappings":";;AA+BA,4DAkDC;AAhFD,yCAA2C;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,wBAAwB,CACtC,SAAmC,EACnC,aAAgD;;IAEhD,MAAM,uBAAuB,GAAa,EAAE,CAAC;IAE7C,yEAAyE;IACzE,MAAM,iBAAiB,GAAG,aAAa,IAAI,SAAS,CAAC,iBAAiB,CAAC;IACvE,IAAI,iBAAiB,EAAE,CAAC;QACtB,MAAM,aAAa,GAAG,SAAS,CAAC,iBAAiB,CAAC;QAClD,MAAM,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC;QACjD,uBAAuB,CAAC,IAAI,CAAC,GAAG,aAAa,KAAK,aAAa,GAAG,CAAC,CAAC;IACtE,CAAC;IAED,4DAA4D;IAC5D,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC;IAC5C,cAAc,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QACnC,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC;QACjC,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;QACxC,MAAM,WAAW,GACf,QAAQ,IAAI,SAAS,CAAC,MAAM;YAC1B,CAAC,CAAC,mBAAmB,SAAS,CAAC,MAAM,CAAC,MAAM,IAAI;YAChD,CAAC,CAAC,EAAE,CAAC;QAET,MAAM,cAAc,GAAG,GAAG,SAAS,KAAK,SAAS,GAAG,WAAW,GAAG,CAAC;QACnE,uBAAuB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,0DAA0D;IAC1D,MAAM,cAAc,GAAG,MAAA,SAAS,CAAC,WAAW,0CAAE,QAAQ,CAAC;IACvD,IAAI,cAAc,EAAE,CAAC;QACnB,MAAM,YAAY,GAAG,MAAA,SAAS,CAAC,WAAW,0CAAE,QAAQ,CAAC;QACrD,uBAAuB,CAAC,IAAI,CAAC,SAAS,YAAY,GAAG,CAAC,CAAC;IACzD,CAAC;IAED,wEAAwE;IACxE,MAAM,aAAa,GAAG,uBAAuB,CAAC,MAAM,GAAG,CAAC,CAAC;IAEzD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,mEAAmE,CAAC;IAC7E,CAAC;IAED,MAAM,eAAe,GAAG,uBAAuB;SAC5C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC;SAC5B,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO,kBAAU,CAAC,IAAI,CAAA;;MAElB,eAAe;MACf,CAAC;AACP,CAAC"}
@@ -1,4 +1,8 @@
1
+ import { AutoBeOpenApi } from "@autobe/interface";
1
2
  import { ILlmSchema } from "@samchon/openapi";
2
3
  import { AutoBeContext } from "../../../context/AutoBeContext";
3
- import { IAutoBeTestScenarioArtifacts } from "../../test/structures/IAutoBeTestScenarioArtifacts";
4
- export declare function replaceImportStatements<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>): (artifacts: IAutoBeTestScenarioArtifacts, code: string, decoratorType?: string) => Promise<string>;
4
+ export declare function replaceImportStatements<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, props: {
5
+ operation: AutoBeOpenApi.IOperation;
6
+ code: string;
7
+ decoratorType?: string;
8
+ }): Promise<string>;
@@ -10,74 +10,68 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.replaceImportStatements = replaceImportStatements;
13
- function replaceImportStatements(ctx) {
14
- return function (artifacts, code, decoratorType) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- const typeReferences = Array.from(new Set(Object.keys(artifacts.document.components.schemas).map((key) => key.split(".")[0])));
17
- const compiler = yield ctx.compiler();
18
- code = yield compiler.typescript.beautify(code);
19
- // Remove existing import statements using flexible regex patterns
20
- code = code
21
- .replace(/import\s*{\s*MyGlobal\s*}\s*from\s*["']\.\.\/MyGlobal["']\s*;?\s*/gm, "")
22
- .replace(/import\s+typia\s*,\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm, "")
23
- .replace(/import\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm, "")
24
- .replace(/import\s*{\s*tags\s*,\s*typia\s*}\s*from\s*["']typia["']\s*;?\s*/gm, "")
25
- .replace(/import\s+typia\s*from\s*["']typia["']\s*;?\s*/gm, "")
26
- .replace(/import\s*{\s*Prisma\s*}\s*from\s*["']@prisma\/client["']\s*;?\s*/gm, "")
27
- .replace(/import\s*{\s*v4\s*}\s*from\s*["']uuid["']\s*;?\s*/gm, "")
28
- .replace(/import\s*{\s*toISOStringSafe\s*}\s*from\s*["']\.\.\/util\/toISOStringSafe["']\s*;?\s*/gm, "")
29
- // Remove JWT import if it exists (to prevent duplication)
30
- .replace(/import\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm, "")
31
- .replace(/import\s*\*\s*as\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm, "");
32
- // Remove any existing API structure imports
33
- // Pattern 1: ../api/structures path
34
- code = code.replace(/import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']\.\.\/api\/structures\/[^"']+["']\s*;?\s*/gm, "");
35
- // Pattern 2: @ORGANIZATION/PROJECT-api/lib/structures path
36
- code = code.replace(/import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']@ORGANIZATION\/PROJECT-api\/lib\/structures\/[^"']+["']\s*;?\s*/gm, "");
37
- // Remove specific type imports that match our typeReferences
38
- for (const ref of typeReferences) {
39
- // Remove any import of this specific type from any path
40
- const typeImportRegex = new RegExp(`import\\s*(?:type\\s*)?{\\s*${ref}\\s*}\\s*from\\s*["'][^"']+["']\\s*;?\\s*`, "gm");
41
- code = code.replace(typeImportRegex, "");
42
- }
43
- // Remove any existing decoratorType imports if LLM mistakenly added them
44
- if (decoratorType) {
45
- const decoratorTypeRegex = new RegExp(`import\\s*(?:type\\s*)?{\\s*${decoratorType}\\s*}\\s*from\\s*["']\\.\\.\/decorators\/payload\/${decoratorType}["']\\s*;?\\s*`, "gm");
46
- code = code.replace(decoratorTypeRegex, "");
47
- }
48
- // Build the standard imports
49
- const imports = [
50
- 'import jwt from "jsonwebtoken";',
51
- 'import { MyGlobal } from "../MyGlobal";',
52
- 'import typia, { tags } from "typia";',
53
- 'import { Prisma } from "@prisma/client";',
54
- 'import { v4 } from "uuid";',
55
- 'import { toISOStringSafe } from "../util/toISOStringSafe"',
56
- ...typeReferences.map((ref) => `import { ${ref} } from "@ORGANIZATION/PROJECT-api/lib/structures/${ref}";`),
57
- ];
58
- // Only add decoratorType import if it exists
59
- if (decoratorType) {
60
- imports.push(`import { ${decoratorType} } from "../decorators/payload/${decoratorType}"`);
61
- }
62
- code = [...imports, "", code].join("\n");
63
- // Clean up formatting issues
64
- code =
65
- code
66
- // Remove lines with only whitespace
67
- .replace(/^\s+$/gm, "")
68
- // Replace 3+ consecutive newlines with exactly 2 newlines
69
- .replace(/\n{3,}/g, "\n\n")
70
- // Ensure proper spacing after import section
71
- .replace(/(import.*?;)(\s*)(\n(?!import|\s*$))/g, "$1\n\n$3")
72
- // Trim and ensure single trailing newline
73
- .trim() + "\n";
74
- // fix escaped codes
75
- code = code.replace(/\\n/g, "\n").replace(/\\"/g, '"').replace(/\\'/g, "'");
76
- // Apply final beautification
77
- code = yield compiler.typescript.beautify(code);
78
- code = code.replaceAll("typia.tags.assert", "typia.assert");
79
- return code;
80
- });
81
- };
13
+ const getRealizeWriteImportStatements_1 = require("./getRealizeWriteImportStatements");
14
+ function replaceImportStatements(ctx, props) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ let { operation, code, decoratorType } = props;
17
+ const typeReferences = Array.from(new Set([operation.requestBody, operation.responseBody]
18
+ .filter((el) => el !== null)
19
+ .map((el) => el.typeName.split(".")[0])));
20
+ const compiler = yield ctx.compiler();
21
+ code = yield compiler.typescript.beautify(code);
22
+ // Remove existing import statements using flexible regex patterns
23
+ code = code
24
+ .replace(/import\s*{\s*MyGlobal\s*}\s*from\s*["']\.\.\/MyGlobal["']\s*;?\s*/gm, "")
25
+ .replace(/import\s+typia\s*,\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm, "")
26
+ .replace(/import\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm, "")
27
+ .replace(/import\s*{\s*tags\s*,\s*typia\s*}\s*from\s*["']typia["']\s*;?\s*/gm, "")
28
+ .replace(/import\s+typia\s*from\s*["']typia["']\s*;?\s*/gm, "")
29
+ .replace(/import\s*{\s*Prisma\s*}\s*from\s*["']@prisma\/client["']\s*;?\s*/gm, "")
30
+ .replace(/import\s*{\s*v4\s*}\s*from\s*["']uuid["']\s*;?\s*/gm, "")
31
+ .replace(/import\s*{\s*toISOStringSafe\s*}\s*from\s*["']\.\.\/util\/toISOStringSafe["']\s*;?\s*/gm, "")
32
+ // Remove JWT import if it exists (to prevent duplication)
33
+ .replace(/import\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm, "")
34
+ .replace(/import\s*\*\s*as\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm, "");
35
+ // Remove any existing API structure imports
36
+ // Pattern 1: ../api/structures path
37
+ code = code.replace(/import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']\.\.\/api\/structures\/[^"']+["']\s*;?\s*/gm, "");
38
+ // Pattern 2: @ORGANIZATION/PROJECT-api/lib/structures path
39
+ code = code.replace(/import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']@ORGANIZATION\/PROJECT-api\/lib\/structures\/[^"']+["']\s*;?\s*/gm, "");
40
+ // Remove specific type imports that match our typeReferences
41
+ for (const ref of typeReferences) {
42
+ // Remove any import of this specific type from any path
43
+ const typeImportRegex = new RegExp(`import\\s*(?:type\\s*)?{\\s*${ref}\\s*}\\s*from\\s*["'][^"']+["']\\s*;?\\s*`, "gm");
44
+ code = code.replace(typeImportRegex, "");
45
+ }
46
+ // Remove any existing decoratorType imports if LLM mistakenly added them
47
+ if (decoratorType) {
48
+ const decoratorTypeRegex = new RegExp(`import\\s*(?:type\\s*)?{\\s*${decoratorType}\\s*}\\s*from\\s*["']\\.\\.\/decorators\/payload\/${decoratorType}["']\\s*;?\\s*`, "gm");
49
+ code = code.replace(decoratorTypeRegex, "");
50
+ }
51
+ // Build the standard imports
52
+ const imports = (0, getRealizeWriteImportStatements_1.getRealizeWriteImportStatements)(operation);
53
+ // Only add decoratorType import if it exists
54
+ if (decoratorType) {
55
+ imports.push(`import { ${decoratorType} } from "../decorators/payload/${decoratorType}"`);
56
+ }
57
+ code = [...imports, "", code].join("\n");
58
+ // Clean up formatting issues
59
+ code =
60
+ code
61
+ // Remove lines with only whitespace
62
+ .replace(/^\s+$/gm, "")
63
+ // Replace 3+ consecutive newlines with exactly 2 newlines
64
+ .replace(/\n{3,}/g, "\n\n")
65
+ // Ensure proper spacing after import section
66
+ .replace(/(import.*?;)(\s*)(\n(?!import|\s*$))/g, "$1\n\n$3")
67
+ // Trim and ensure single trailing newline
68
+ .trim() + "\n";
69
+ // fix escaped codes
70
+ code = code.replace(/\\n/g, "\n").replace(/\\"/g, '"').replace(/\\'/g, "'");
71
+ // Apply final beautification
72
+ code = yield compiler.typescript.beautify(code);
73
+ code = code.replaceAll("typia.tags.assert", "typia.assert");
74
+ return code;
75
+ });
82
76
  }
83
77
  //# sourceMappingURL=replaceImportStatements.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"replaceImportStatements.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/realize/utils/replaceImportStatements.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,0DA8HC;AA9HD,SAAgB,uBAAuB,CACrC,GAAyB;IAEzB,OAAO,UACL,SAAuC,EACvC,IAAY,EACZ,aAAsB;;YAEtB,MAAM,cAAc,GAAa,KAAK,CAAC,IAAI,CACzC,IAAI,GAAG,CACL,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,CACpD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAC5B,CACF,CACF,CAAC;YAEF,MAAM,QAAQ,GAAoB,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC;YACvD,IAAI,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAChD,kEAAkE;YAClE,IAAI,GAAG,IAAI;iBACR,OAAO,CACN,qEAAqE,EACrE,EAAE,CACH;iBACA,OAAO,CACN,oEAAoE,EACpE,EAAE,CACH;iBACA,OAAO,CAAC,wDAAwD,EAAE,EAAE,CAAC;iBACrE,OAAO,CACN,oEAAoE,EACpE,EAAE,CACH;iBACA,OAAO,CAAC,iDAAiD,EAAE,EAAE,CAAC;i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OAAO,CAAC,IAAI,CACV,YAAY,aAAa,kCAAkC,aAAa,GAAG,CAC5E,CAAC;YACJ,CAAC;YAED,IAAI,GAAG,CAAC,GAAG,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEzC,6BAA6B;YAC7B,IAAI;gBACF,IAAI;oBACF,oCAAoC;qBACnC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;oBACvB,0DAA0D;qBACzD,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;oBAC3B,6CAA6C;qBAC5C,OAAO,CAAC,uCAAuC,EAAE,UAAU,CAAC;oBAC7D,0CAA0C;qBACzC,IAAI,EAAE,GAAG,IAAI,CAAC;YAEnB,oBAAoB;YACpB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAE5E,6BAA6B;YAC7B,IAAI,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAEhD,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;YAE5D,OAAO,IAAI,CAAC;QACd,CAAC;KAAA,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"replaceImportStatements.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/realize/utils/replaceImportStatements.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,0DAoHC;AAtHD,uFAAoF;AAEpF,SAAsB,uBAAuB,CAC3C,GAAyB,EACzB,KAIC;;QAED,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;QAE/C,MAAM,cAAc,GAAa,KAAK,CAAC,IAAI,CACzC,IAAI,GAAG,CACL,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CA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CAAC;QAE5D,OAAO,IAAI,CAAC;IACd,CAAC;CAAA"}
@@ -2,23 +2,24 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.completeTestCode = completeTestCode;
4
4
  const utils_1 = require("@autobe/utils");
5
+ const getTestImportStatements_1 = require("./getTestImportStatements");
5
6
  function completeTestCode(artifacts, code) {
6
- const typeReferences = Array.from(new Set(Object.keys(artifacts.document.components.schemas).map((key) => key.split(".")[0])));
7
- code = code.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "").trim();
8
- code = code.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "").trim();
9
- code = code.replaceAll('string & Format<"uuid">', 'string & tags.Format<"uuid">');
10
- code = utils_1.StringUtil.trim `
11
- import { ArrayUtil, RandomGenerator, TestValidator } from "@nestia/e2e";
12
- import { IConnection } from "@nestia/fetcher";
13
- import typia, { tags } from "typia";
14
-
15
- import api from "@ORGANIZATION/PROJECT-api";
16
- ${typeReferences
17
- .map((ref) => `import type { ${ref} } from "@ORGANIZATION/PROJECT-api/lib/structures/${ref}";`)
18
- .join("\n")}
7
+ code = code
8
+ .split("\r\n")
9
+ .join("\n")
10
+ .split("\n")
11
+ .filter((str) => str.trim().startsWith("import") === false)
12
+ .join("\n");
13
+ // code = code.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "").trim();
14
+ // code = code.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "").trim();
15
+ // code = code.replaceAll(
16
+ // 'string & Format<"uuid">',
17
+ // 'string & tags.Format<"uuid">',
18
+ // );
19
+ return utils_1.StringUtil.trim `
20
+ ${(0, getTestImportStatements_1.getTestImportStatements)(artifacts.document)}
19
21
 
20
22
  ${code}
21
23
  `;
22
- return code;
23
24
  }
24
25
  //# sourceMappingURL=completeTestCode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"completeTestCode.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/test/compile/completeTestCode.ts"],"names":[],"mappings":";;AAIA,4CAkCC;AAtCD,yCAA2C;AAI3C,SAAgB,gBAAgB,CAC9B,SAAuC,EACvC,IAAY;IAEZ,MAAM,cAAc,GAAa,KAAK,CAAC,IAAI,CACzC,IAAI,GAAG,CACL,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,CACpD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAC5B,CACF,CACF,CAAC;IAEF,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpE,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpE,IAAI,GAAG,IAAI,CAAC,UAAU,CACpB,yBAAyB,EACzB,8BAA8B,CAC/B,CAAC;IACF,IAAI,GAAG,kBAAU,CAAC,IAAI,CAAA;;;;;;MAMlB,cAAc;SACb,GAAG,CACF,CAAC,GAAG,EAAE,EAAE,CACN,iBAAiB,GAAG,qDAAqD,GAAG,IAAI,CACnF;SACA,IAAI,CAAC,IAAI,CAAC;;MAEX,IAAI;GACP,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
1
+ {"version":3,"file":"completeTestCode.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/test/compile/completeTestCode.ts"],"names":[],"mappings":";;AAKA,4CAsBC;AA3BD,yCAA2C;AAG3C,uEAAoE;AAEpE,SAAgB,gBAAgB,CAC9B,SAAuC,EACvC,IAAY;IAEZ,IAAI,GAAG,IAAI;SACR,KAAK,CAAC,MAAM,CAAC;SACb,IAAI,CAAC,IAAI,CAAC;SACV,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAC;SAC1D,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,uEAAuE;IACvE,uEAAuE;IACvE,0BAA0B;IAC1B,+BAA+B;IAC/B,oCAAoC;IACpC,KAAK;IACL,OAAO,kBAAU,CAAC,IAAI,CAAA;MAClB,IAAA,iDAAuB,EAAC,SAAS,CAAC,QAAQ,CAAC;;MAE3C,IAAI;GACP,CAAC;AACJ,CAAC"}
@@ -25,6 +25,6 @@ const singleton = new tstl_1.Singleton((compiler) => __awaiter(void 0, void 0, v
25
25
  throw new Error(`File not found: ${location}`);
26
26
  return { [location]: content };
27
27
  };
28
- return Object.assign(Object.assign(Object.assign(Object.assign({}, external("node_modules/@nestia/e2e/lib/ArrayUtil.d.ts")), external("node_modules/@nestia/e2e/lib/RandomGenerator.d.ts")), external("node_modules/@nestia/e2e/lib/TestValidator.d.ts")), external("node_modules/@nestia/fetcher/lib/IConnection.d.ts"));
28
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, external("node_modules/@nestia/e2e/lib/ArrayUtil.d.ts")), external("node_modules/@nestia/e2e/lib/RandomGenerator.d.ts")), external("node_modules/@nestia/e2e/lib/TestValidator.d.ts")), external("node_modules/@nestia/fetcher/lib/IConnection.d.ts")), external("node_modules/typia/lib/module.d.ts"));
29
29
  }));
30
30
  //# sourceMappingURL=getTestExternalDeclarations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getTestExternalDeclarations.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/test/compile/getTestExternalDeclarations.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,kEAKC;AATD,+BAAiC;AAIjC,SAAsB,2BAA2B,CAE/C,GAAyB;;QACzB,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC;QACtC,OAAO,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;CAAA;AAED,MAAM,SAAS,GAAG,IAAI,gBAAS,CAAC,CAAO,QAA6B,EAAE,EAAE;IACtE,MAAM,OAAO,GAA2B,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;IACrE,MAAM,QAAQ,GAAG,CAAC,QAAgB,EAA0B,EAAE;QAC5D,MAAM,OAAO,GAAuB,OAAO,CAAC,QAAQ,CAAC,CAAC;QACtD,IAAI,OAAO,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;QAC1E,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACjC,CAAC,CAAC;IACF,OAAO,4DACF,QAAQ,CAAC,6CAA6C,CAAC,GACvD,QAAQ,CAAC,mDAAmD,CAAC,GAC7D,QAAQ,CAAC,iDAAiD,CAAC,GAC3D,QAAQ,CAAC,mDAAmD,CAAC,CAChC,CAAC;AACrC,CAAC,CAAA,CAAC,CAAC"}
1
+ {"version":3,"file":"getTestExternalDeclarations.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/test/compile/getTestExternalDeclarations.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,kEAKC;AATD,+BAAiC;AAIjC,SAAsB,2BAA2B,CAE/C,GAAyB;;QACzB,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC;QACtC,OAAO,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;CAAA;AAED,MAAM,SAAS,GAAG,IAAI,gBAAS,CAAC,CAAO,QAA6B,EAAE,EAAE;IACtE,MAAM,OAAO,GAA2B,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;IACrE,MAAM,QAAQ,GAAG,CAAC,QAAgB,EAA0B,EAAE;QAC5D,MAAM,OAAO,GAAuB,OAAO,CAAC,QAAQ,CAAC,CAAC;QACtD,IAAI,OAAO,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;QAC1E,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACjC,CAAC,CAAC;IACF,OAAO,0EACF,QAAQ,CAAC,6CAA6C,CAAC,GACvD,QAAQ,CAAC,mDAAmD,CAAC,GAC7D,QAAQ,CAAC,iDAAiD,CAAC,GAC3D,QAAQ,CAAC,mDAAmD,CAAC,GAC7D,QAAQ,CAAC,oCAAoC,CAAC,CACjB,CAAC;AACrC,CAAC,CAAA,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { AutoBeOpenApi } from "@autobe/interface";
2
+ export declare const getTestImportStatements: (document: AutoBeOpenApi.IDocument) => string;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTestImportStatements = void 0;
4
+ const utils_1 = require("@autobe/utils");
5
+ const getTestImportStatements = (document) => {
6
+ const typeReferences = Array.from(new Set(Object.keys(document.components.schemas).map((key) => key.split(".")[0]))).sort();
7
+ return utils_1.StringUtil.trim `
8
+ import { ArrayUtil, RandomGenerator, TestValidator } from "@nestia/e2e";
9
+ import { IConnection } from "@nestia/fetcher";
10
+ import typia, { tags } from "typia";
11
+
12
+ import api from "@ORGANIZATION/PROJECT-api";
13
+ ${typeReferences
14
+ .map((ref) => `import type { ${ref} } from "@ORGANIZATION/PROJECT-api/lib/structures/${ref}";`)
15
+ .join("\n")}
16
+ `;
17
+ };
18
+ exports.getTestImportStatements = getTestImportStatements;
19
+ //# sourceMappingURL=getTestImportStatements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTestImportStatements.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/test/compile/getTestImportStatements.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAEpC,MAAM,uBAAuB,GAAG,CACrC,QAAiC,EACzB,EAAE;IACV,MAAM,cAAc,GAAa,KAAK,CAAC,IAAI,CACzC,IAAI,GAAG,CACL,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC,CAC1E,CACF,CAAC,IAAI,EAAE,CAAC;IACT,OAAO,kBAAU,CAAC,IAAI,CAAA;;;;;;MAMlB,cAAc;SACb,GAAG,CACF,CAAC,GAAG,EAAE,EAAE,CACN,iBAAiB,GAAG,qDAAqD,GAAG,IAAI,CACnF;SACA,IAAI,CAAC,IAAI,CAAC;GACd,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,uBAAuB,2BAqBlC"}
@@ -2,4 +2,4 @@ import { AutoBeTestScenario } from "@autobe/interface";
2
2
  import { ILlmSchema } from "@samchon/openapi";
3
3
  import { AutoBeContext } from "../../../context/AutoBeContext";
4
4
  import { IAutoBeTestScenarioArtifacts } from "../structures/IAutoBeTestScenarioArtifacts";
5
- export declare function getTestScenarioArtifacts<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, scenario: Pick<AutoBeTestScenario, "endpoint" | "dependencies">): Promise<IAutoBeTestScenarioArtifacts>;
5
+ export declare function getTestScenarioArtifacts<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, scenario: Pick<AutoBeTestScenario, "endpoint" | "dependencies" | "functionName">): Promise<IAutoBeTestScenarioArtifacts>;