@typia/utils 13.0.0-dev.20260427-3 → 13.0.0-dev.20260501

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 (345) hide show
  1. package/lib/converters/LlmSchemaConverter.js +6 -6
  2. package/lib/converters/LlmSchemaConverter.js.map +1 -1
  3. package/lib/converters/LlmSchemaConverter.mjs +2 -7
  4. package/lib/converters/LlmSchemaConverter.mjs.map +1 -1
  5. package/lib/converters/LlmSchemaConverter2.mjs +449 -451
  6. package/lib/converters/LlmSchemaConverter2.mjs.map +1 -1
  7. package/lib/converters/OpenApiConverter.mjs +2 -7
  8. package/lib/converters/OpenApiConverter.mjs.map +1 -1
  9. package/lib/converters/OpenApiConverter2.mjs +163 -164
  10. package/lib/converters/OpenApiConverter2.mjs.map +1 -1
  11. package/lib/converters/index.mjs +1 -7
  12. package/lib/converters/index.mjs.map +1 -1
  13. package/lib/converters/index2.mjs +31 -32
  14. package/lib/converters/index2.mjs.map +1 -1
  15. package/lib/converters/internal/LlmDescriptionInverter.mjs +2 -7
  16. package/lib/converters/internal/LlmDescriptionInverter.mjs.map +1 -1
  17. package/lib/converters/internal/LlmDescriptionInverter2.mjs +143 -150
  18. package/lib/converters/internal/LlmDescriptionInverter2.mjs.map +1 -1
  19. package/lib/converters/internal/LlmParametersComposer.mjs +2 -7
  20. package/lib/converters/internal/LlmParametersComposer.mjs.map +1 -1
  21. package/lib/converters/internal/LlmParametersComposer2.mjs +37 -44
  22. package/lib/converters/internal/LlmParametersComposer2.mjs.map +1 -1
  23. package/lib/converters/internal/OpenApiConstraintShifter.mjs +2 -7
  24. package/lib/converters/internal/OpenApiConstraintShifter.mjs.map +1 -1
  25. package/lib/converters/internal/OpenApiConstraintShifter2.mjs +105 -112
  26. package/lib/converters/internal/OpenApiConstraintShifter2.mjs.map +1 -1
  27. package/lib/converters/internal/OpenApiExclusiveEmender.mjs +2 -7
  28. package/lib/converters/internal/OpenApiExclusiveEmender.mjs.map +1 -1
  29. package/lib/converters/internal/OpenApiExclusiveEmender2.mjs +32 -40
  30. package/lib/converters/internal/OpenApiExclusiveEmender2.mjs.map +1 -1
  31. package/lib/converters/internal/OpenApiV3Downgrader.mjs +2 -7
  32. package/lib/converters/internal/OpenApiV3Downgrader.mjs.map +1 -1
  33. package/lib/converters/internal/OpenApiV3Downgrader2.mjs +237 -244
  34. package/lib/converters/internal/OpenApiV3Downgrader2.mjs.map +1 -1
  35. package/lib/converters/internal/OpenApiV3Upgrader.mjs +2 -7
  36. package/lib/converters/internal/OpenApiV3Upgrader.mjs.map +1 -1
  37. package/lib/converters/internal/OpenApiV3Upgrader2.mjs +300 -305
  38. package/lib/converters/internal/OpenApiV3Upgrader2.mjs.map +1 -1
  39. package/lib/converters/internal/OpenApiV3_1Downgrader.mjs +2 -7
  40. package/lib/converters/internal/OpenApiV3_1Downgrader.mjs.map +1 -1
  41. package/lib/converters/internal/OpenApiV3_1Downgrader2.mjs +193 -200
  42. package/lib/converters/internal/OpenApiV3_1Downgrader2.mjs.map +1 -1
  43. package/lib/converters/internal/OpenApiV3_1Upgrader.mjs +2 -7
  44. package/lib/converters/internal/OpenApiV3_1Upgrader.mjs.map +1 -1
  45. package/lib/converters/internal/OpenApiV3_1Upgrader2.mjs +424 -429
  46. package/lib/converters/internal/OpenApiV3_1Upgrader2.mjs.map +1 -1
  47. package/lib/converters/internal/OpenApiV3_2Upgrader.mjs +2 -7
  48. package/lib/converters/internal/OpenApiV3_2Upgrader.mjs.map +1 -1
  49. package/lib/converters/internal/OpenApiV3_2Upgrader2.mjs +202 -208
  50. package/lib/converters/internal/OpenApiV3_2Upgrader2.mjs.map +1 -1
  51. package/lib/converters/internal/SwaggerV2Downgrader.mjs +2 -7
  52. package/lib/converters/internal/SwaggerV2Downgrader.mjs.map +1 -1
  53. package/lib/converters/internal/SwaggerV2Downgrader2.mjs +287 -294
  54. package/lib/converters/internal/SwaggerV2Downgrader2.mjs.map +1 -1
  55. package/lib/converters/internal/SwaggerV2Upgrader.mjs +2 -7
  56. package/lib/converters/internal/SwaggerV2Upgrader.mjs.map +1 -1
  57. package/lib/converters/internal/SwaggerV2Upgrader2.mjs +370 -375
  58. package/lib/converters/internal/SwaggerV2Upgrader2.mjs.map +1 -1
  59. package/lib/http/HttpError.mjs +2 -7
  60. package/lib/http/HttpError.mjs.map +1 -1
  61. package/lib/http/HttpError2.mjs +69 -77
  62. package/lib/http/HttpError2.mjs.map +1 -1
  63. package/lib/http/HttpLlm.mjs +2 -7
  64. package/lib/http/HttpLlm.mjs.map +1 -1
  65. package/lib/http/HttpLlm2.mjs +107 -112
  66. package/lib/http/HttpLlm2.mjs.map +1 -1
  67. package/lib/http/HttpMigration.mjs +2 -7
  68. package/lib/http/HttpMigration.mjs.map +1 -1
  69. package/lib/http/HttpMigration2.mjs +58 -63
  70. package/lib/http/HttpMigration2.mjs.map +1 -1
  71. package/lib/http/index.mjs +1 -7
  72. package/lib/http/index.mjs.map +1 -1
  73. package/lib/http/index2.mjs +30 -31
  74. package/lib/http/index2.mjs.map +1 -1
  75. package/lib/http/internal/HttpLlmApplicationComposer.mjs +2 -7
  76. package/lib/http/internal/HttpLlmApplicationComposer.mjs.map +1 -1
  77. package/lib/http/internal/HttpLlmApplicationComposer2.mjs +301 -306
  78. package/lib/http/internal/HttpLlmApplicationComposer2.mjs.map +1 -1
  79. package/lib/http/internal/HttpLlmFunctionFetcher.mjs +2 -7
  80. package/lib/http/internal/HttpLlmFunctionFetcher.mjs.map +1 -1
  81. package/lib/http/internal/HttpLlmFunctionFetcher2.mjs +26 -33
  82. package/lib/http/internal/HttpLlmFunctionFetcher2.mjs.map +1 -1
  83. package/lib/http/internal/HttpMigrateApplicationComposer.mjs +2 -7
  84. package/lib/http/internal/HttpMigrateApplicationComposer.mjs.map +1 -1
  85. package/lib/http/internal/HttpMigrateApplicationComposer2.mjs +51 -56
  86. package/lib/http/internal/HttpMigrateApplicationComposer2.mjs.map +1 -1
  87. package/lib/http/internal/HttpMigrateRouteAccessor.mjs +2 -7
  88. package/lib/http/internal/HttpMigrateRouteAccessor.mjs.map +1 -1
  89. package/lib/http/internal/HttpMigrateRouteAccessor2.mjs +113 -118
  90. package/lib/http/internal/HttpMigrateRouteAccessor2.mjs.map +1 -1
  91. package/lib/http/internal/HttpMigrateRouteComposer.mjs +2 -7
  92. package/lib/http/internal/HttpMigrateRouteComposer.mjs.map +1 -1
  93. package/lib/http/internal/HttpMigrateRouteComposer2.mjs +376 -381
  94. package/lib/http/internal/HttpMigrateRouteComposer2.mjs.map +1 -1
  95. package/lib/http/internal/HttpMigrateRouteFetcher.mjs +2 -7
  96. package/lib/http/internal/HttpMigrateRouteFetcher.mjs.map +1 -1
  97. package/lib/http/internal/HttpMigrateRouteFetcher2.mjs +182 -189
  98. package/lib/http/internal/HttpMigrateRouteFetcher2.mjs.map +1 -1
  99. package/lib/index.mjs +1 -7
  100. package/lib/index.mjs.map +1 -1
  101. package/lib/index2.mjs +33 -33
  102. package/lib/index2.mjs.map +1 -1
  103. package/lib/utils/ArrayUtil.mjs +2 -7
  104. package/lib/utils/ArrayUtil.mjs.map +1 -1
  105. package/lib/utils/ArrayUtil2.mjs +29 -37
  106. package/lib/utils/ArrayUtil2.mjs.map +1 -1
  107. package/lib/utils/LlmJson.mjs +2 -7
  108. package/lib/utils/LlmJson.mjs.map +1 -1
  109. package/lib/utils/LlmJson2.mjs +166 -169
  110. package/lib/utils/LlmJson2.mjs.map +1 -1
  111. package/lib/utils/MapUtil.mjs +2 -7
  112. package/lib/utils/MapUtil.mjs.map +1 -1
  113. package/lib/utils/MapUtil2.mjs +16 -24
  114. package/lib/utils/MapUtil2.mjs.map +1 -1
  115. package/lib/utils/NamingConvention.mjs +2 -7
  116. package/lib/utils/NamingConvention.mjs.map +1 -1
  117. package/lib/utils/NamingConvention2.mjs +199 -207
  118. package/lib/utils/NamingConvention2.mjs.map +1 -1
  119. package/lib/utils/Singleton.d.ts +1 -6
  120. package/lib/utils/Singleton.js +1 -0
  121. package/lib/utils/Singleton.js.map +1 -1
  122. package/lib/utils/Singleton.mjs +2 -7
  123. package/lib/utils/Singleton.mjs.map +1 -1
  124. package/lib/utils/Singleton2.mjs +17 -24
  125. package/lib/utils/Singleton2.mjs.map +1 -1
  126. package/lib/utils/StringUtil.mjs +2 -7
  127. package/lib/utils/StringUtil.mjs.map +1 -1
  128. package/lib/utils/StringUtil2.mjs +14 -22
  129. package/lib/utils/StringUtil2.mjs.map +1 -1
  130. package/lib/utils/dedent.mjs +2 -7
  131. package/lib/utils/dedent.mjs.map +1 -1
  132. package/lib/utils/dedent2.mjs +50 -58
  133. package/lib/utils/dedent2.mjs.map +1 -1
  134. package/lib/utils/index.mjs +1 -7
  135. package/lib/utils/index.mjs.map +1 -1
  136. package/lib/utils/index2.mjs +42 -39
  137. package/lib/utils/index2.mjs.map +1 -1
  138. package/lib/utils/internal/EndpointUtil.mjs +2 -7
  139. package/lib/utils/internal/EndpointUtil.mjs.map +1 -1
  140. package/lib/utils/internal/EndpointUtil2.mjs +39 -46
  141. package/lib/utils/internal/EndpointUtil2.mjs.map +1 -1
  142. package/lib/utils/internal/JsonDescriptor.mjs +2 -7
  143. package/lib/utils/internal/JsonDescriptor.mjs.map +1 -1
  144. package/lib/utils/internal/JsonDescriptor2.mjs +55 -61
  145. package/lib/utils/internal/JsonDescriptor2.mjs.map +1 -1
  146. package/lib/utils/internal/OpenApiTypeCheckerBase.js +23 -14
  147. package/lib/utils/internal/OpenApiTypeCheckerBase.js.map +1 -1
  148. package/lib/utils/internal/OpenApiTypeCheckerBase.mjs +2 -7
  149. package/lib/utils/internal/OpenApiTypeCheckerBase.mjs.map +1 -1
  150. package/lib/utils/internal/OpenApiTypeCheckerBase2.mjs +539 -536
  151. package/lib/utils/internal/OpenApiTypeCheckerBase2.mjs.map +1 -1
  152. package/lib/utils/internal/coerceLlmArguments.js +27 -1
  153. package/lib/utils/internal/coerceLlmArguments.js.map +1 -1
  154. package/lib/utils/internal/coerceLlmArguments.mjs +2 -7
  155. package/lib/utils/internal/coerceLlmArguments.mjs.map +1 -1
  156. package/lib/utils/internal/coerceLlmArguments2.mjs +278 -258
  157. package/lib/utils/internal/coerceLlmArguments2.mjs.map +1 -1
  158. package/lib/utils/internal/parseLenientJson.mjs +2 -7
  159. package/lib/utils/internal/parseLenientJson.mjs.map +1 -1
  160. package/lib/utils/internal/parseLenientJson2.mjs +803 -811
  161. package/lib/utils/internal/parseLenientJson2.mjs.map +1 -1
  162. package/lib/utils/internal/stringifyValidationFailure.mjs +2 -7
  163. package/lib/utils/internal/stringifyValidationFailure.mjs.map +1 -1
  164. package/lib/utils/internal/stringifyValidationFailure2.mjs +310 -316
  165. package/lib/utils/internal/stringifyValidationFailure2.mjs.map +1 -1
  166. package/lib/validators/LlmTypeChecker.mjs +2 -7
  167. package/lib/validators/LlmTypeChecker.mjs.map +1 -1
  168. package/lib/validators/LlmTypeChecker2.mjs +314 -320
  169. package/lib/validators/LlmTypeChecker2.mjs.map +1 -1
  170. package/lib/validators/OpenApiTypeChecker.mjs +2 -7
  171. package/lib/validators/OpenApiTypeChecker.mjs.map +1 -1
  172. package/lib/validators/OpenApiTypeChecker2.mjs +209 -216
  173. package/lib/validators/OpenApiTypeChecker2.mjs.map +1 -1
  174. package/lib/validators/OpenApiV3TypeChecker.mjs +2 -7
  175. package/lib/validators/OpenApiV3TypeChecker.mjs.map +1 -1
  176. package/lib/validators/OpenApiV3TypeChecker2.mjs +30 -38
  177. package/lib/validators/OpenApiV3TypeChecker2.mjs.map +1 -1
  178. package/lib/validators/OpenApiV3_1TypeChecker.mjs +2 -7
  179. package/lib/validators/OpenApiV3_1TypeChecker.mjs.map +1 -1
  180. package/lib/validators/OpenApiV3_1TypeChecker2.mjs +34 -42
  181. package/lib/validators/OpenApiV3_1TypeChecker2.mjs.map +1 -1
  182. package/lib/validators/OpenApiValidator.mjs +2 -7
  183. package/lib/validators/OpenApiValidator.mjs.map +1 -1
  184. package/lib/validators/OpenApiValidator2.mjs +73 -80
  185. package/lib/validators/OpenApiValidator2.mjs.map +1 -1
  186. package/lib/validators/SwaggerV2TypeChecker.mjs +2 -7
  187. package/lib/validators/SwaggerV2TypeChecker.mjs.map +1 -1
  188. package/lib/validators/SwaggerV2TypeChecker2.mjs +31 -39
  189. package/lib/validators/SwaggerV2TypeChecker2.mjs.map +1 -1
  190. package/lib/validators/functional/_isBigintString.mjs +2 -7
  191. package/lib/validators/functional/_isBigintString.mjs.map +1 -1
  192. package/lib/validators/functional/_isBigintString2.mjs +14 -22
  193. package/lib/validators/functional/_isBigintString2.mjs.map +1 -1
  194. package/lib/validators/functional/_isFormatByte.mjs +2 -7
  195. package/lib/validators/functional/_isFormatByte.mjs.map +1 -1
  196. package/lib/validators/functional/_isFormatByte2.mjs +10 -18
  197. package/lib/validators/functional/_isFormatByte2.mjs.map +1 -1
  198. package/lib/validators/functional/_isFormatDate.mjs +2 -7
  199. package/lib/validators/functional/_isFormatDate.mjs.map +1 -1
  200. package/lib/validators/functional/_isFormatDate2.mjs +7 -15
  201. package/lib/validators/functional/_isFormatDate2.mjs.map +1 -1
  202. package/lib/validators/functional/_isFormatDateTime.mjs +2 -7
  203. package/lib/validators/functional/_isFormatDateTime.mjs.map +1 -1
  204. package/lib/validators/functional/_isFormatDateTime2.mjs +7 -15
  205. package/lib/validators/functional/_isFormatDateTime2.mjs.map +1 -1
  206. package/lib/validators/functional/_isFormatDuration.mjs +2 -7
  207. package/lib/validators/functional/_isFormatDuration.mjs.map +1 -1
  208. package/lib/validators/functional/_isFormatDuration2.mjs +7 -15
  209. package/lib/validators/functional/_isFormatDuration2.mjs.map +1 -1
  210. package/lib/validators/functional/_isFormatEmail.mjs +2 -7
  211. package/lib/validators/functional/_isFormatEmail.mjs.map +1 -1
  212. package/lib/validators/functional/_isFormatEmail2.mjs +7 -15
  213. package/lib/validators/functional/_isFormatEmail2.mjs.map +1 -1
  214. package/lib/validators/functional/_isFormatHostname.mjs +2 -7
  215. package/lib/validators/functional/_isFormatHostname.mjs.map +1 -1
  216. package/lib/validators/functional/_isFormatHostname2.mjs +7 -15
  217. package/lib/validators/functional/_isFormatHostname2.mjs.map +1 -1
  218. package/lib/validators/functional/_isFormatIdnEmail.mjs +2 -7
  219. package/lib/validators/functional/_isFormatIdnEmail.mjs.map +1 -1
  220. package/lib/validators/functional/_isFormatIdnEmail2.mjs +7 -15
  221. package/lib/validators/functional/_isFormatIdnEmail2.mjs.map +1 -1
  222. package/lib/validators/functional/_isFormatIdnHostname.mjs +2 -7
  223. package/lib/validators/functional/_isFormatIdnHostname.mjs.map +1 -1
  224. package/lib/validators/functional/_isFormatIdnHostname2.mjs +7 -15
  225. package/lib/validators/functional/_isFormatIdnHostname2.mjs.map +1 -1
  226. package/lib/validators/functional/_isFormatIpv4.mjs +2 -7
  227. package/lib/validators/functional/_isFormatIpv4.mjs.map +1 -1
  228. package/lib/validators/functional/_isFormatIpv42.mjs +7 -15
  229. package/lib/validators/functional/_isFormatIpv42.mjs.map +1 -1
  230. package/lib/validators/functional/_isFormatIpv6.mjs +2 -7
  231. package/lib/validators/functional/_isFormatIpv6.mjs.map +1 -1
  232. package/lib/validators/functional/_isFormatIpv62.mjs +7 -15
  233. package/lib/validators/functional/_isFormatIpv62.mjs.map +1 -1
  234. package/lib/validators/functional/_isFormatIri.mjs +2 -7
  235. package/lib/validators/functional/_isFormatIri.mjs.map +1 -1
  236. package/lib/validators/functional/_isFormatIri2.mjs +7 -15
  237. package/lib/validators/functional/_isFormatIri2.mjs.map +1 -1
  238. package/lib/validators/functional/_isFormatIriReference.mjs +2 -7
  239. package/lib/validators/functional/_isFormatIriReference.mjs.map +1 -1
  240. package/lib/validators/functional/_isFormatIriReference2.mjs +7 -15
  241. package/lib/validators/functional/_isFormatIriReference2.mjs.map +1 -1
  242. package/lib/validators/functional/_isFormatJsonPointer.mjs +2 -7
  243. package/lib/validators/functional/_isFormatJsonPointer.mjs.map +1 -1
  244. package/lib/validators/functional/_isFormatJsonPointer2.mjs +7 -15
  245. package/lib/validators/functional/_isFormatJsonPointer2.mjs.map +1 -1
  246. package/lib/validators/functional/_isFormatPassword.mjs +2 -7
  247. package/lib/validators/functional/_isFormatPassword.mjs.map +1 -1
  248. package/lib/validators/functional/_isFormatPassword2.mjs +6 -14
  249. package/lib/validators/functional/_isFormatPassword2.mjs.map +1 -1
  250. package/lib/validators/functional/_isFormatRegex.mjs +2 -7
  251. package/lib/validators/functional/_isFormatRegex.mjs.map +1 -1
  252. package/lib/validators/functional/_isFormatRegex2.mjs +14 -22
  253. package/lib/validators/functional/_isFormatRegex2.mjs.map +1 -1
  254. package/lib/validators/functional/_isFormatRelativeJsonPointer.mjs +2 -7
  255. package/lib/validators/functional/_isFormatRelativeJsonPointer.mjs.map +1 -1
  256. package/lib/validators/functional/_isFormatRelativeJsonPointer2.mjs +7 -15
  257. package/lib/validators/functional/_isFormatRelativeJsonPointer2.mjs.map +1 -1
  258. package/lib/validators/functional/_isFormatTime.mjs +2 -7
  259. package/lib/validators/functional/_isFormatTime.mjs.map +1 -1
  260. package/lib/validators/functional/_isFormatTime2.mjs +7 -15
  261. package/lib/validators/functional/_isFormatTime2.mjs.map +1 -1
  262. package/lib/validators/functional/_isFormatUri.mjs +2 -7
  263. package/lib/validators/functional/_isFormatUri.mjs.map +1 -1
  264. package/lib/validators/functional/_isFormatUri2.mjs +8 -16
  265. package/lib/validators/functional/_isFormatUri2.mjs.map +1 -1
  266. package/lib/validators/functional/_isFormatUriReference.mjs +2 -7
  267. package/lib/validators/functional/_isFormatUriReference.mjs.map +1 -1
  268. package/lib/validators/functional/_isFormatUriReference2.mjs +7 -15
  269. package/lib/validators/functional/_isFormatUriReference2.mjs.map +1 -1
  270. package/lib/validators/functional/_isFormatUriTemplate.mjs +2 -7
  271. package/lib/validators/functional/_isFormatUriTemplate.mjs.map +1 -1
  272. package/lib/validators/functional/_isFormatUriTemplate2.mjs +7 -15
  273. package/lib/validators/functional/_isFormatUriTemplate2.mjs.map +1 -1
  274. package/lib/validators/functional/_isFormatUrl.mjs +2 -7
  275. package/lib/validators/functional/_isFormatUrl.mjs.map +1 -1
  276. package/lib/validators/functional/_isFormatUrl2.mjs +7 -15
  277. package/lib/validators/functional/_isFormatUrl2.mjs.map +1 -1
  278. package/lib/validators/functional/_isFormatUuid.mjs +2 -7
  279. package/lib/validators/functional/_isFormatUuid.mjs.map +1 -1
  280. package/lib/validators/functional/_isFormatUuid2.mjs +7 -15
  281. package/lib/validators/functional/_isFormatUuid2.mjs.map +1 -1
  282. package/lib/validators/functional/_isUniqueItems.mjs +2 -7
  283. package/lib/validators/functional/_isUniqueItems.mjs.map +1 -1
  284. package/lib/validators/functional/_isUniqueItems2.mjs +140 -148
  285. package/lib/validators/functional/_isUniqueItems2.mjs.map +1 -1
  286. package/lib/validators/index.mjs +1 -7
  287. package/lib/validators/index.mjs.map +1 -1
  288. package/lib/validators/index2.mjs +42 -40
  289. package/lib/validators/index2.mjs.map +1 -1
  290. package/lib/validators/internal/IOpenApiValidatorContext.mjs +2 -7
  291. package/lib/validators/internal/IOpenApiValidatorContext.mjs.map +1 -1
  292. package/lib/validators/internal/IOpenApiValidatorContext2.mjs +2 -10
  293. package/lib/validators/internal/IOpenApiValidatorContext2.mjs.map +1 -1
  294. package/lib/validators/internal/OpenApiArrayValidator.mjs +2 -7
  295. package/lib/validators/internal/OpenApiArrayValidator.mjs.map +1 -1
  296. package/lib/validators/internal/OpenApiArrayValidator2.mjs +36 -42
  297. package/lib/validators/internal/OpenApiArrayValidator2.mjs.map +1 -1
  298. package/lib/validators/internal/OpenApiBooleanValidator.mjs +2 -7
  299. package/lib/validators/internal/OpenApiBooleanValidator.mjs.map +1 -1
  300. package/lib/validators/internal/OpenApiBooleanValidator2.mjs +10 -18
  301. package/lib/validators/internal/OpenApiBooleanValidator2.mjs.map +1 -1
  302. package/lib/validators/internal/OpenApiConstantValidator.mjs +2 -7
  303. package/lib/validators/internal/OpenApiConstantValidator.mjs.map +1 -1
  304. package/lib/validators/internal/OpenApiConstantValidator2.mjs +10 -18
  305. package/lib/validators/internal/OpenApiConstantValidator2.mjs.map +1 -1
  306. package/lib/validators/internal/OpenApiIntegerValidator.mjs +2 -7
  307. package/lib/validators/internal/OpenApiIntegerValidator.mjs.map +1 -1
  308. package/lib/validators/internal/OpenApiIntegerValidator2.mjs +33 -41
  309. package/lib/validators/internal/OpenApiIntegerValidator2.mjs.map +1 -1
  310. package/lib/validators/internal/OpenApiNumberValidator.mjs +2 -7
  311. package/lib/validators/internal/OpenApiNumberValidator.mjs.map +1 -1
  312. package/lib/validators/internal/OpenApiNumberValidator2.mjs +33 -41
  313. package/lib/validators/internal/OpenApiNumberValidator2.mjs.map +1 -1
  314. package/lib/validators/internal/OpenApiObjectValidator.js +2 -3
  315. package/lib/validators/internal/OpenApiObjectValidator.js.map +1 -1
  316. package/lib/validators/internal/OpenApiObjectValidator.mjs +2 -7
  317. package/lib/validators/internal/OpenApiObjectValidator.mjs.map +1 -1
  318. package/lib/validators/internal/OpenApiObjectValidator2.mjs +55 -62
  319. package/lib/validators/internal/OpenApiObjectValidator2.mjs.map +1 -1
  320. package/lib/validators/internal/OpenApiOneOfValidator.mjs +2 -7
  321. package/lib/validators/internal/OpenApiOneOfValidator.mjs.map +1 -1
  322. package/lib/validators/internal/OpenApiOneOfValidator2.mjs +188 -193
  323. package/lib/validators/internal/OpenApiOneOfValidator2.mjs.map +1 -1
  324. package/lib/validators/internal/OpenApiSchemaNamingRule.mjs +2 -7
  325. package/lib/validators/internal/OpenApiSchemaNamingRule.mjs.map +1 -1
  326. package/lib/validators/internal/OpenApiSchemaNamingRule2.mjs +124 -131
  327. package/lib/validators/internal/OpenApiSchemaNamingRule2.mjs.map +1 -1
  328. package/lib/validators/internal/OpenApiStationValidator.mjs +2 -7
  329. package/lib/validators/internal/OpenApiStationValidator.mjs.map +1 -1
  330. package/lib/validators/internal/OpenApiStationValidator2.mjs +86 -83
  331. package/lib/validators/internal/OpenApiStationValidator2.mjs.map +1 -1
  332. package/lib/validators/internal/OpenApiStringValidator.mjs +2 -7
  333. package/lib/validators/internal/OpenApiStringValidator.mjs.map +1 -1
  334. package/lib/validators/internal/OpenApiStringValidator2.mjs +115 -102
  335. package/lib/validators/internal/OpenApiStringValidator2.mjs.map +1 -1
  336. package/lib/validators/internal/OpenApiTupleValidator.mjs +2 -7
  337. package/lib/validators/internal/OpenApiTupleValidator.mjs.map +1 -1
  338. package/lib/validators/internal/OpenApiTupleValidator2.mjs +33 -40
  339. package/lib/validators/internal/OpenApiTupleValidator2.mjs.map +1 -1
  340. package/package.json +4 -4
  341. package/src/converters/LlmSchemaConverter.ts +1 -1
  342. package/src/utils/Singleton.ts +1 -0
  343. package/src/utils/internal/OpenApiTypeCheckerBase.ts +12 -3
  344. package/src/utils/internal/coerceLlmArguments.ts +27 -1
  345. package/src/validators/internal/OpenApiObjectValidator.ts +1 -2
@@ -1,309 +1,304 @@
1
- import { __exports as HttpLlmApplicationComposer } from '../../_virtual/HttpLlmApplicationComposer.mjs';
2
- import { __require as requireLlmSchemaConverter } from '../../converters/LlmSchemaConverter2.mjs';
3
- import { __require as requireUtils } from '../../utils/index2.mjs';
4
- import { __require as requireOpenApiValidator } from '../../validators/OpenApiValidator2.mjs';
1
+ import { __exports as HttpLlmApplicationComposer$1 } from '../../_virtual/HttpLlmApplicationComposer.mjs';
2
+ import '../../converters/LlmSchemaConverter2.mjs';
3
+ import '../../utils/index2.mjs';
4
+ import '../../validators/OpenApiValidator2.mjs';
5
+ import { __exports as LlmSchemaConverter } from '../../_virtual/LlmSchemaConverter.mjs';
6
+ import { __exports as OpenApiValidator } from '../../_virtual/OpenApiValidator.mjs';
7
+ import { __exports as utils } from '../../_virtual/index4.mjs';
5
8
 
6
- var hasRequiredHttpLlmApplicationComposer;
9
+ Object.defineProperty(HttpLlmApplicationComposer$1, "__esModule", { value: true });
10
+ var HttpLlmApplicationComposer_2 = HttpLlmApplicationComposer$1.HttpLlmApplicationComposer = void 0;
11
+ const LlmSchemaConverter_1 = LlmSchemaConverter;
12
+ const utils_1 = utils;
13
+ const OpenApiValidator_1 = OpenApiValidator;
14
+ /**
15
+ * Composes {@link IHttpLlmApplication} from an {@link IHttpMigrateApplication}.
16
+ *
17
+ * Converts OpenAPI-migrated HTTP routes into LLM function calling schemas,
18
+ * filtering out unsupported methods (HEAD) and content types
19
+ * (multipart/form-data), and shortening function names to fit the configured
20
+ * maximum length.
21
+ */
22
+ var HttpLlmApplicationComposer;
23
+ (function (HttpLlmApplicationComposer) {
24
+ /**
25
+ * Builds an {@link IHttpLlmApplication} from migrated HTTP routes.
26
+ *
27
+ * Iterates all routes, converts each to an {@link IHttpLlmFunction}, and
28
+ * collects conversion errors. Applies function name shortening at the end.
29
+ */
30
+ HttpLlmApplicationComposer.application = (props) => {
31
+ var _a, _b, _c, _d;
32
+ var _e, _f, _g, _h;
33
+ // fill in config defaults
34
+ const config = {
35
+ maxLength: (_e = (_a = props.config) === null || _a === void 0 ? void 0 : _a.maxLength) !== null && _e !== void 0 ? _e : 64,
36
+ equals: (_f = (_b = props.config) === null || _b === void 0 ? void 0 : _b.equals) !== null && _f !== void 0 ? _f : false,
37
+ strict: (_g = (_c = props.config) === null || _c === void 0 ? void 0 : _c.strict) !== null && _g !== void 0 ? _g : false,
38
+ };
39
+ // seed with pre-existing migration errors, excluding human-only endpoints
40
+ const errors = props.migrate.errors
41
+ .filter((e) => e.operation()["x-samchon-human"] !== true)
42
+ .map((e) => ({
43
+ method: e.method,
44
+ path: e.path,
45
+ messages: e.messages,
46
+ operation: () => e.operation(),
47
+ route: () => undefined,
48
+ }));
49
+ // convert each route to an LLM function, rejecting unsupported ones
50
+ const functions = props.migrate.routes
51
+ .filter((e) => e.operation()["x-samchon-human"] !== true)
52
+ .map((route, i) => {
53
+ var _a, _b;
54
+ // reject HEAD — LLMs cannot interpret header-only responses
55
+ if (route.method === "head") {
56
+ errors.push({
57
+ method: route.method,
58
+ path: route.path,
59
+ messages: ["HEAD method is not supported in the LLM application."],
60
+ operation: () => route.operation(),
61
+ route: () => route,
62
+ });
63
+ return null;
64
+ // reject multipart/form-data — binary uploads not expressible in JSON Schema
65
+ }
66
+ else if (((_a = route.body) === null || _a === void 0 ? void 0 : _a.type) === "multipart/form-data" ||
67
+ ((_b = route.success) === null || _b === void 0 ? void 0 : _b.type) === "multipart/form-data") {
68
+ errors.push({
69
+ method: route.method,
70
+ path: route.path,
71
+ messages: [
72
+ `The "multipart/form-data" content type is not supported in the LLM application.`,
73
+ ],
74
+ operation: () => route.operation(),
75
+ route: () => route,
76
+ });
77
+ return null;
78
+ }
79
+ const localErrors = [];
80
+ const func = composeFunction({
81
+ components: props.migrate.document().components,
82
+ config,
83
+ route,
84
+ errors: localErrors});
85
+ if (func === null)
86
+ errors.push({
87
+ method: route.method,
88
+ path: route.path,
89
+ messages: localErrors,
90
+ operation: () => route.operation(),
91
+ route: () => route,
92
+ });
93
+ return func;
94
+ })
95
+ .filter((v) => v !== null);
96
+ const app = {
97
+ config,
98
+ functions,
99
+ errors,
100
+ };
101
+ HttpLlmApplicationComposer.shorten(app, (_h = (_d = props.config) === null || _d === void 0 ? void 0 : _d.maxLength) !== null && _h !== void 0 ? _h : 64);
102
+ return app;
103
+ };
104
+ /**
105
+ * Converts a single {@link IHttpMigrateRoute} into an {@link IHttpLlmFunction}
106
+ * by composing parameter/output schemas and validating function name
107
+ * constraints.
108
+ */
109
+ const composeFunction = (props) => {
110
+ var _a, _b, _c, _d, _e, _f, _g, _h;
111
+ // accessor prefix for error messages (mirrors OpenAPI document structure)
112
+ const endpoint = `$input.paths[${JSON.stringify(props.route.path)}][${JSON.stringify(props.route.method)}]`;
113
+ const operation = props.route.operation();
114
+ const description = concatDescription({
115
+ summary: operation.summary,
116
+ description: operation.description,
117
+ });
118
+ if (((_a = description === null || description === void 0 ? void 0 : description.length) !== null && _a !== void 0 ? _a : 0) > 1024) {
119
+ props.errors.push(`The description of the function is too long (must be equal or less than 1,024 characters, but ${description.length.toLocaleString()} length).`);
120
+ }
121
+ // build function name from route accessor, replacing forbidden chars
122
+ const name = emend(props.route.accessor.join("_"));
123
+ const isNameVariable = /^[a-zA-Z0-9_-]+$/.test(name);
124
+ const isNameStartsWithNumber = /^[0-9]/.test((_b = name[0]) !== null && _b !== void 0 ? _b : "");
125
+ if (isNameVariable === false)
126
+ props.errors.push(`Elements of path (separated by '/') must be composed with alphabets, numbers, underscores, and hyphens`);
127
+ if (isNameStartsWithNumber === true)
128
+ props.errors.push(`Function name cannot start with a number.`);
129
+ //----
130
+ // CONSTRUCT SCHEMAS
131
+ //----
132
+ // merge path parameters, query, and body into a single object schema
133
+ const parameters = {
134
+ type: "object",
135
+ properties: Object.fromEntries([
136
+ // path parameters (e.g., /users/:id)
137
+ ...props.route.parameters.map((s) => { var _a; return [
138
+ s.key,
139
+ Object.assign(Object.assign({}, s.schema), { description: (_a = s.parameter().description) !== null && _a !== void 0 ? _a : s.schema.description }),
140
+ ]; }),
141
+ // query parameters
142
+ ...(props.route.query
143
+ ? [
144
+ [
145
+ props.route.query.key,
146
+ Object.assign(Object.assign({}, props.route.query.schema), { title: (_c = props.route.query.title()) !== null && _c !== void 0 ? _c : props.route.query.schema.title, description: (_d = props.route.query.description()) !== null && _d !== void 0 ? _d : props.route.query.schema.description }),
147
+ ],
148
+ ]
149
+ : []),
150
+ // request body
151
+ ...(props.route.body
152
+ ? [
153
+ [
154
+ props.route.body.key,
155
+ Object.assign(Object.assign({}, props.route.body.schema), { description: (_e = props.route.body.description()) !== null && _e !== void 0 ? _e : props.route.body.schema.description }),
156
+ ],
157
+ ]
158
+ : []),
159
+ ]),
160
+ };
161
+ parameters.required = Object.keys((_f = parameters.properties) !== null && _f !== void 0 ? _f : {});
162
+ // convert merged object schema to LLM parameters
163
+ const llmParameters = LlmSchemaConverter_1.LlmSchemaConverter.parameters({
164
+ config: props.config,
165
+ components: props.components,
166
+ schema: parameters,
167
+ accessor: `${endpoint}.parameters`,
168
+ });
169
+ // convert response schema to LLM output parameters
170
+ const output = props.route.success
171
+ ? LlmSchemaConverter_1.LlmSchemaConverter.parameters({
172
+ config: props.config,
173
+ components: props.components,
174
+ schema: props.route.success.schema,
175
+ accessor: `${endpoint}.responses[${JSON.stringify(props.route.success.status)}][${JSON.stringify(props.route.success.type)}].schema`,
176
+ })
177
+ : undefined;
178
+ //----
179
+ // CONVERSION
180
+ //----
181
+ // bail out if any validation or conversion failed
182
+ if ((output === null || output === void 0 ? void 0 : output.success) === false ||
183
+ llmParameters.success === false ||
184
+ isNameVariable === false ||
185
+ isNameStartsWithNumber === true ||
186
+ ((_g = description === null || description === void 0 ? void 0 : description.length) !== null && _g !== void 0 ? _g : 0) > 1024) {
187
+ if ((output === null || output === void 0 ? void 0 : output.success) === false)
188
+ props.errors.push(...output.error.reasons.map((r) => `${r.accessor}: ${r.message}`));
189
+ if (llmParameters.success === false)
190
+ props.errors.push(
191
+ // rewrite internal accessor to match OpenAPI requestBody path
192
+ ...llmParameters.error.reasons.map((r) => {
193
+ var _a;
194
+ var _b;
195
+ const accessor = r.accessor.replace(`parameters.properties["body"]`, `requestBody.content[${JSON.stringify((_b = (_a = props.route.body) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : "application/json")}].schema`);
196
+ return `${accessor}: ${r.message}`;
197
+ }));
198
+ return null;
199
+ }
200
+ // assemble the LLM function
201
+ return {
202
+ method: props.route.method,
203
+ path: props.route.path,
204
+ name,
205
+ parameters: llmParameters.value,
206
+ output: output === null || output === void 0 ? void 0 : output.value,
207
+ description,
208
+ deprecated: operation.deprecated,
209
+ tags: operation.tags,
210
+ parse: (input) => utils_1.LlmJson.parse(input, llmParameters.value),
211
+ coerce: (input) => utils_1.LlmJson.coerce(input, llmParameters.value),
212
+ validate: OpenApiValidator_1.OpenApiValidator.create({
213
+ components: props.components,
214
+ schema: parameters,
215
+ required: true,
216
+ equals: (_h = props.config.equals) !== null && _h !== void 0 ? _h : false,
217
+ }),
218
+ route: () => props.route,
219
+ operation: () => props.route.operation(),
220
+ };
221
+ };
222
+ /**
223
+ * Shortens function names exceeding the character limit.
224
+ *
225
+ * Tries progressively shorter accessor suffixes first, then falls back to
226
+ * index-prefixed names, and finally UUID as a last resort.
227
+ */
228
+ HttpLlmApplicationComposer.shorten = (app, limit = 64) => {
229
+ // collect all names for uniqueness checks
230
+ const dictionary = new Set();
231
+ const longFunctions = [];
232
+ for (const func of app.functions) {
233
+ dictionary.add(func.name);
234
+ if (func.name.length > limit) {
235
+ longFunctions.push(func);
236
+ }
237
+ }
238
+ if (longFunctions.length === 0)
239
+ return;
240
+ let index = 0;
241
+ for (const func of longFunctions) {
242
+ let success = false;
243
+ const rename = (str) => {
244
+ dictionary.delete(func.name);
245
+ dictionary.add(str);
246
+ func.name = str;
247
+ success = true;
248
+ };
249
+ // try dropping leading accessor segments to shorten the name
250
+ // (e.g., "api_users_getById" → "users_getById" → "getById")
251
+ for (let i = 1; i < func.route().accessor.length; ++i) {
252
+ const shortName = func.route().accessor.slice(i).join("_");
253
+ if (shortName.length > limit - 8)
254
+ continue; // reserve room for "_N_" prefix
255
+ else if (dictionary.has(shortName) === false)
256
+ rename(shortName);
257
+ else {
258
+ // name collision — prefix with a counter to disambiguate
259
+ const newName = `_${index}_${shortName}`;
260
+ if (dictionary.has(newName) === true)
261
+ continue;
262
+ rename(newName);
263
+ ++index;
264
+ }
265
+ break;
266
+ }
267
+ // last resort — all suffix attempts failed or collided
268
+ if (success === false)
269
+ rename(randomFormatUuid());
270
+ }
271
+ };
272
+ })(HttpLlmApplicationComposer || (HttpLlmApplicationComposer_2 = HttpLlmApplicationComposer$1.HttpLlmApplicationComposer = HttpLlmApplicationComposer = {}));
273
+ const randomFormatUuid = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
274
+ const r = (Math.random() * 16) | 0;
275
+ const v = c === "x" ? r : (r & 0x3) | 0x8;
276
+ return v.toString(16);
277
+ });
278
+ /** Replaces forbidden characters (`$`, `%`, `.`) with underscores. */
279
+ const emend = (str) => {
280
+ for (const ch of FORBIDDEN)
281
+ str = str.split(ch).join("_");
282
+ return str;
283
+ };
284
+ const FORBIDDEN = ["$", "%", "."];
285
+ /**
286
+ * Concatenates summary and description into a single string.
287
+ *
288
+ * If both are present, joins them with a period and double newline, avoiding
289
+ * duplication when the description already starts with the summary.
290
+ */
291
+ const concatDescription = (p) => {
292
+ var _a, _b;
293
+ if (!((_a = p.summary) === null || _a === void 0 ? void 0 : _a.length) || !((_b = p.description) === null || _b === void 0 ? void 0 : _b.length))
294
+ return p.summary || p.description;
295
+ const summary = p.summary.endsWith(".")
296
+ ? p.summary.slice(0, -1)
297
+ : p.summary;
298
+ return p.description.startsWith(summary)
299
+ ? p.description
300
+ : summary + ".\n\n" + p.description;
301
+ };
7
302
 
8
- function requireHttpLlmApplicationComposer () {
9
- if (hasRequiredHttpLlmApplicationComposer) return HttpLlmApplicationComposer;
10
- hasRequiredHttpLlmApplicationComposer = 1;
11
- Object.defineProperty(HttpLlmApplicationComposer, "__esModule", { value: true });
12
- HttpLlmApplicationComposer.HttpLlmApplicationComposer = void 0;
13
- const LlmSchemaConverter_1 = requireLlmSchemaConverter();
14
- const utils_1 = requireUtils();
15
- const OpenApiValidator_1 = requireOpenApiValidator();
16
- /**
17
- * Composes {@link IHttpLlmApplication} from an {@link IHttpMigrateApplication}.
18
- *
19
- * Converts OpenAPI-migrated HTTP routes into LLM function calling schemas,
20
- * filtering out unsupported methods (HEAD) and content types
21
- * (multipart/form-data), and shortening function names to fit the configured
22
- * maximum length.
23
- */
24
- var HttpLlmApplicationComposer$1;
25
- (function (HttpLlmApplicationComposer) {
26
- /**
27
- * Builds an {@link IHttpLlmApplication} from migrated HTTP routes.
28
- *
29
- * Iterates all routes, converts each to an {@link IHttpLlmFunction}, and
30
- * collects conversion errors. Applies function name shortening at the end.
31
- */
32
- HttpLlmApplicationComposer.application = (props) => {
33
- var _a, _b, _c, _d;
34
- var _e, _f, _g, _h;
35
- // fill in config defaults
36
- const config = {
37
- maxLength: (_e = (_a = props.config) === null || _a === void 0 ? void 0 : _a.maxLength) !== null && _e !== void 0 ? _e : 64,
38
- equals: (_f = (_b = props.config) === null || _b === void 0 ? void 0 : _b.equals) !== null && _f !== void 0 ? _f : false,
39
- strict: (_g = (_c = props.config) === null || _c === void 0 ? void 0 : _c.strict) !== null && _g !== void 0 ? _g : false,
40
- };
41
- // seed with pre-existing migration errors, excluding human-only endpoints
42
- const errors = props.migrate.errors
43
- .filter((e) => e.operation()["x-samchon-human"] !== true)
44
- .map((e) => ({
45
- method: e.method,
46
- path: e.path,
47
- messages: e.messages,
48
- operation: () => e.operation(),
49
- route: () => undefined,
50
- }));
51
- // convert each route to an LLM function, rejecting unsupported ones
52
- const functions = props.migrate.routes
53
- .filter((e) => e.operation()["x-samchon-human"] !== true)
54
- .map((route, i) => {
55
- var _a, _b;
56
- // reject HEAD — LLMs cannot interpret header-only responses
57
- if (route.method === "head") {
58
- errors.push({
59
- method: route.method,
60
- path: route.path,
61
- messages: ["HEAD method is not supported in the LLM application."],
62
- operation: () => route.operation(),
63
- route: () => route,
64
- });
65
- return null;
66
- // reject multipart/form-data — binary uploads not expressible in JSON Schema
67
- }
68
- else if (((_a = route.body) === null || _a === void 0 ? void 0 : _a.type) === "multipart/form-data" ||
69
- ((_b = route.success) === null || _b === void 0 ? void 0 : _b.type) === "multipart/form-data") {
70
- errors.push({
71
- method: route.method,
72
- path: route.path,
73
- messages: [
74
- `The "multipart/form-data" content type is not supported in the LLM application.`,
75
- ],
76
- operation: () => route.operation(),
77
- route: () => route,
78
- });
79
- return null;
80
- }
81
- const localErrors = [];
82
- const func = composeFunction({
83
- components: props.migrate.document().components,
84
- config,
85
- route,
86
- errors: localErrors});
87
- if (func === null)
88
- errors.push({
89
- method: route.method,
90
- path: route.path,
91
- messages: localErrors,
92
- operation: () => route.operation(),
93
- route: () => route,
94
- });
95
- return func;
96
- })
97
- .filter((v) => v !== null);
98
- const app = {
99
- config,
100
- functions,
101
- errors,
102
- };
103
- HttpLlmApplicationComposer.shorten(app, (_h = (_d = props.config) === null || _d === void 0 ? void 0 : _d.maxLength) !== null && _h !== void 0 ? _h : 64);
104
- return app;
105
- };
106
- /**
107
- * Converts a single {@link IHttpMigrateRoute} into an {@link IHttpLlmFunction}
108
- * by composing parameter/output schemas and validating function name
109
- * constraints.
110
- */
111
- const composeFunction = (props) => {
112
- var _a, _b, _c, _d, _e, _f, _g, _h;
113
- // accessor prefix for error messages (mirrors OpenAPI document structure)
114
- const endpoint = `$input.paths[${JSON.stringify(props.route.path)}][${JSON.stringify(props.route.method)}]`;
115
- const operation = props.route.operation();
116
- const description = concatDescription({
117
- summary: operation.summary,
118
- description: operation.description,
119
- });
120
- if (((_a = description === null || description === void 0 ? void 0 : description.length) !== null && _a !== void 0 ? _a : 0) > 1024) {
121
- props.errors.push(`The description of the function is too long (must be equal or less than 1,024 characters, but ${description.length.toLocaleString()} length).`);
122
- }
123
- // build function name from route accessor, replacing forbidden chars
124
- const name = emend(props.route.accessor.join("_"));
125
- const isNameVariable = /^[a-zA-Z0-9_-]+$/.test(name);
126
- const isNameStartsWithNumber = /^[0-9]/.test((_b = name[0]) !== null && _b !== void 0 ? _b : "");
127
- if (isNameVariable === false)
128
- props.errors.push(`Elements of path (separated by '/') must be composed with alphabets, numbers, underscores, and hyphens`);
129
- if (isNameStartsWithNumber === true)
130
- props.errors.push(`Function name cannot start with a number.`);
131
- //----
132
- // CONSTRUCT SCHEMAS
133
- //----
134
- // merge path parameters, query, and body into a single object schema
135
- const parameters = {
136
- type: "object",
137
- properties: Object.fromEntries([
138
- // path parameters (e.g., /users/:id)
139
- ...props.route.parameters.map((s) => { var _a; return [
140
- s.key,
141
- Object.assign(Object.assign({}, s.schema), { description: (_a = s.parameter().description) !== null && _a !== void 0 ? _a : s.schema.description }),
142
- ]; }),
143
- // query parameters
144
- ...(props.route.query
145
- ? [
146
- [
147
- props.route.query.key,
148
- Object.assign(Object.assign({}, props.route.query.schema), { title: (_c = props.route.query.title()) !== null && _c !== void 0 ? _c : props.route.query.schema.title, description: (_d = props.route.query.description()) !== null && _d !== void 0 ? _d : props.route.query.schema.description }),
149
- ],
150
- ]
151
- : []),
152
- // request body
153
- ...(props.route.body
154
- ? [
155
- [
156
- props.route.body.key,
157
- Object.assign(Object.assign({}, props.route.body.schema), { description: (_e = props.route.body.description()) !== null && _e !== void 0 ? _e : props.route.body.schema.description }),
158
- ],
159
- ]
160
- : []),
161
- ]),
162
- };
163
- parameters.required = Object.keys((_f = parameters.properties) !== null && _f !== void 0 ? _f : {});
164
- // convert merged object schema to LLM parameters
165
- const llmParameters = LlmSchemaConverter_1.LlmSchemaConverter.parameters({
166
- config: props.config,
167
- components: props.components,
168
- schema: parameters,
169
- accessor: `${endpoint}.parameters`,
170
- });
171
- // convert response schema to LLM output parameters
172
- const output = props.route.success
173
- ? LlmSchemaConverter_1.LlmSchemaConverter.parameters({
174
- config: props.config,
175
- components: props.components,
176
- schema: props.route.success.schema,
177
- accessor: `${endpoint}.responses[${JSON.stringify(props.route.success.status)}][${JSON.stringify(props.route.success.type)}].schema`,
178
- })
179
- : undefined;
180
- //----
181
- // CONVERSION
182
- //----
183
- // bail out if any validation or conversion failed
184
- if ((output === null || output === void 0 ? void 0 : output.success) === false ||
185
- llmParameters.success === false ||
186
- isNameVariable === false ||
187
- isNameStartsWithNumber === true ||
188
- ((_g = description === null || description === void 0 ? void 0 : description.length) !== null && _g !== void 0 ? _g : 0) > 1024) {
189
- if ((output === null || output === void 0 ? void 0 : output.success) === false)
190
- props.errors.push(...output.error.reasons.map((r) => `${r.accessor}: ${r.message}`));
191
- if (llmParameters.success === false)
192
- props.errors.push(
193
- // rewrite internal accessor to match OpenAPI requestBody path
194
- ...llmParameters.error.reasons.map((r) => {
195
- var _a;
196
- var _b;
197
- const accessor = r.accessor.replace(`parameters.properties["body"]`, `requestBody.content[${JSON.stringify((_b = (_a = props.route.body) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : "application/json")}].schema`);
198
- return `${accessor}: ${r.message}`;
199
- }));
200
- return null;
201
- }
202
- // assemble the LLM function
203
- return {
204
- method: props.route.method,
205
- path: props.route.path,
206
- name,
207
- parameters: llmParameters.value,
208
- output: output === null || output === void 0 ? void 0 : output.value,
209
- description,
210
- deprecated: operation.deprecated,
211
- tags: operation.tags,
212
- parse: (input) => utils_1.LlmJson.parse(input, llmParameters.value),
213
- coerce: (input) => utils_1.LlmJson.coerce(input, llmParameters.value),
214
- validate: OpenApiValidator_1.OpenApiValidator.create({
215
- components: props.components,
216
- schema: parameters,
217
- required: true,
218
- equals: (_h = props.config.equals) !== null && _h !== void 0 ? _h : false,
219
- }),
220
- route: () => props.route,
221
- operation: () => props.route.operation(),
222
- };
223
- };
224
- /**
225
- * Shortens function names exceeding the character limit.
226
- *
227
- * Tries progressively shorter accessor suffixes first, then falls back to
228
- * index-prefixed names, and finally UUID as a last resort.
229
- */
230
- HttpLlmApplicationComposer.shorten = (app, limit = 64) => {
231
- // collect all names for uniqueness checks
232
- const dictionary = new Set();
233
- const longFunctions = [];
234
- for (const func of app.functions) {
235
- dictionary.add(func.name);
236
- if (func.name.length > limit) {
237
- longFunctions.push(func);
238
- }
239
- }
240
- if (longFunctions.length === 0)
241
- return;
242
- let index = 0;
243
- for (const func of longFunctions) {
244
- let success = false;
245
- const rename = (str) => {
246
- dictionary.delete(func.name);
247
- dictionary.add(str);
248
- func.name = str;
249
- success = true;
250
- };
251
- // try dropping leading accessor segments to shorten the name
252
- // (e.g., "api_users_getById" → "users_getById" → "getById")
253
- for (let i = 1; i < func.route().accessor.length; ++i) {
254
- const shortName = func.route().accessor.slice(i).join("_");
255
- if (shortName.length > limit - 8)
256
- continue; // reserve room for "_N_" prefix
257
- else if (dictionary.has(shortName) === false)
258
- rename(shortName);
259
- else {
260
- // name collision — prefix with a counter to disambiguate
261
- const newName = `_${index}_${shortName}`;
262
- if (dictionary.has(newName) === true)
263
- continue;
264
- rename(newName);
265
- ++index;
266
- }
267
- break;
268
- }
269
- // last resort — all suffix attempts failed or collided
270
- if (success === false)
271
- rename(randomFormatUuid());
272
- }
273
- };
274
- })(HttpLlmApplicationComposer$1 || (HttpLlmApplicationComposer.HttpLlmApplicationComposer = HttpLlmApplicationComposer$1 = {}));
275
- const randomFormatUuid = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
276
- const r = (Math.random() * 16) | 0;
277
- const v = c === "x" ? r : (r & 0x3) | 0x8;
278
- return v.toString(16);
279
- });
280
- /** Replaces forbidden characters (`$`, `%`, `.`) with underscores. */
281
- const emend = (str) => {
282
- for (const ch of FORBIDDEN)
283
- str = str.split(ch).join("_");
284
- return str;
285
- };
286
- const FORBIDDEN = ["$", "%", "."];
287
- /**
288
- * Concatenates summary and description into a single string.
289
- *
290
- * If both are present, joins them with a period and double newline, avoiding
291
- * duplication when the description already starts with the summary.
292
- */
293
- const concatDescription = (p) => {
294
- var _a, _b;
295
- if (!((_a = p.summary) === null || _a === void 0 ? void 0 : _a.length) || !((_b = p.description) === null || _b === void 0 ? void 0 : _b.length))
296
- return p.summary || p.description;
297
- const summary = p.summary.endsWith(".")
298
- ? p.summary.slice(0, -1)
299
- : p.summary;
300
- return p.description.startsWith(summary)
301
- ? p.description
302
- : summary + ".\n\n" + p.description;
303
- };
304
-
305
- return HttpLlmApplicationComposer;
306
- }
307
-
308
- export { requireHttpLlmApplicationComposer as __require };
303
+ export { HttpLlmApplicationComposer_2 as HttpLlmApplicationComposer, HttpLlmApplicationComposer$1 as default };
309
304
  //# sourceMappingURL=HttpLlmApplicationComposer2.mjs.map