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

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 -15
  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 +440 -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 -8
  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,41 +1,38 @@
1
- import { __exports as stringifyValidationFailure } from '../../_virtual/stringifyValidationFailure.mjs';
2
- import { __require as requireNamingConvention } from '../NamingConvention2.mjs';
3
- import { __require as requireDedent } from '../dedent2.mjs';
1
+ import { __exports as stringifyValidationFailure$1 } from '../../_virtual/stringifyValidationFailure.mjs';
2
+ import '../NamingConvention2.mjs';
3
+ import '../dedent2.mjs';
4
+ import { __exports as dedent } from '../../_virtual/dedent.mjs';
5
+ import { __exports as NamingConvention } from '../../_virtual/NamingConvention.mjs';
4
6
 
5
- var hasRequiredStringifyValidationFailure;
6
-
7
- function requireStringifyValidationFailure () {
8
- if (hasRequiredStringifyValidationFailure) return stringifyValidationFailure;
9
- hasRequiredStringifyValidationFailure = 1;
10
- Object.defineProperty(stringifyValidationFailure, "__esModule", { value: true });
11
- stringifyValidationFailure.stringifyValidationFailure = stringifyValidationFailure$1;
12
- const NamingConvention_1 = requireNamingConvention();
13
- const dedent_1 = requireDedent();
14
- function stringifyValidationFailure$1(failure) {
15
- const usedErrors = new Set();
16
- // Pre-index errors by path for O(1) lookup
17
- const errorsByPath = new Map();
18
- for (const e of failure.errors) {
19
- const arr = errorsByPath.get(e.path);
20
- if (arr !== undefined)
21
- arr.push(e);
22
- else
23
- errorsByPath.set(e.path, [e]);
24
- }
25
- const jsonOutput = stringify({
26
- value: failure.data,
27
- errorsByPath,
28
- path: "$input",
29
- tab: 0,
30
- inArray: false,
31
- inToJson: false,
32
- usedErrors,
33
- });
34
- // Find errors that couldn't be embedded
35
- const unmappableErrors = failure.errors.filter((e) => !usedErrors.has(e));
36
- // If there are unmappable errors, append them as a separate block
37
- if (unmappableErrors.length > 0)
38
- return (0, dedent_1.dedent) `
7
+ Object.defineProperty(stringifyValidationFailure$1, "__esModule", { value: true });
8
+ var stringifyValidationFailure_2 = stringifyValidationFailure$1.stringifyValidationFailure = stringifyValidationFailure;
9
+ const NamingConvention_1 = NamingConvention;
10
+ const dedent_1 = dedent;
11
+ function stringifyValidationFailure(failure) {
12
+ const usedErrors = new Set();
13
+ // Pre-index errors by path for O(1) lookup
14
+ const errorsByPath = new Map();
15
+ for (const e of failure.errors) {
16
+ const arr = errorsByPath.get(e.path);
17
+ if (arr !== undefined)
18
+ arr.push(e);
19
+ else
20
+ errorsByPath.set(e.path, [e]);
21
+ }
22
+ const jsonOutput = stringify({
23
+ value: failure.data,
24
+ errorsByPath,
25
+ path: "$input",
26
+ tab: 0,
27
+ inArray: false,
28
+ inToJson: false,
29
+ usedErrors,
30
+ });
31
+ // Find errors that couldn't be embedded
32
+ const unmappableErrors = failure.errors.filter((e) => !usedErrors.has(e));
33
+ // If there are unmappable errors, append them as a separate block
34
+ if (unmappableErrors.length > 0)
35
+ return (0, dedent_1.dedent) `
39
36
  \`\`\`json
40
37
  ${jsonOutput}
41
38
  \`\`\`
@@ -45,289 +42,286 @@ function requireStringifyValidationFailure () {
45
42
  ${JSON.stringify(unmappableErrors, null, 2)}
46
43
  \`\`\`
47
44
  `;
48
- return (0, dedent_1.dedent) `
45
+ return (0, dedent_1.dedent) `
49
46
  \`\`\`json
50
47
  ${jsonOutput}
51
48
  \`\`\`
52
49
  `;
53
- }
54
- function stringify(props) {
55
- var _a;
56
- const { value, errorsByPath, path, tab, inArray, inToJson, usedErrors } = props;
57
- const indent = " ".repeat(tab);
58
- const errorComment = getErrorComment(path, errorsByPath, usedErrors);
59
- // Handle undefined in arrays
60
- if (inArray && value === undefined) {
61
- return `${indent}undefined${errorComment}`;
62
- }
63
- // Array
64
- if (Array.isArray(value)) {
65
- // Check for missing array element errors (path[])
66
- const missingElementErrors = getMissingArrayElementErrors(path, errorsByPath, usedErrors);
67
- const hasMissingElements = missingElementErrors.length > 0;
68
- if (value.length === 0) {
69
- // Empty array but has missing element errors - show placeholders
70
- if (hasMissingElements) {
71
- const innerIndent = " ".repeat(tab + 1);
72
- const lines = [];
73
- lines.push(`${indent}[${errorComment}`);
74
- missingElementErrors.forEach((e, idx) => {
75
- const errComment = ` // ❌ ${JSON.stringify([{ path: e.path, expected: e.expected, description: e.description }])}`;
76
- const comma = idx < missingElementErrors.length - 1 ? "," : "";
77
- lines.push(`${innerIndent}undefined${comma}${errComment}`);
78
- });
79
- lines.push(`${indent}]`);
80
- return lines.join("\n");
81
- }
82
- return `${indent}[]${errorComment}`;
83
- }
84
- const lines = [];
85
- lines.push(`${indent}[${errorComment}`);
86
- value.forEach((item, index) => {
87
- const itemPath = `${path}[${index}]`;
88
- const isLastElement = index === value.length - 1;
89
- // If there are missing element errors, this is not truly the last line
90
- const needsComma = !isLastElement || hasMissingElements;
91
- let itemStr = stringify({
92
- value: item,
93
- errorsByPath,
94
- path: itemPath,
95
- tab: tab + 1,
96
- inArray: true,
97
- inToJson: false,
98
- usedErrors,
99
- });
100
- // Add comma before the error comment if not the last element
101
- if (needsComma) {
102
- itemStr = insertCommaBeforeComment(itemStr);
103
- }
104
- lines.push(itemStr);
105
- });
106
- // Add missing element placeholders at the end for each [] error
107
- if (hasMissingElements) {
108
- const innerIndent = " ".repeat(tab + 1);
109
- missingElementErrors.forEach((e, idx) => {
110
- const errComment = ` // ❌ ${JSON.stringify([{ path: e.path, expected: e.expected, description: e.description }])}`;
111
- const comma = idx < missingElementErrors.length - 1 ? "," : "";
112
- lines.push(`${innerIndent}undefined${comma}${errComment}`);
113
- });
114
- }
115
- lines.push(`${indent}]`);
116
- return lines.join("\n");
117
- }
118
- // Object
119
- if (typeof value === "object" && value !== null) {
120
- // Check for toJSON method
121
- // biome-ignore lint: intended
122
- if (!inToJson && typeof value.toJSON === "function") {
123
- // biome-ignore lint: intended
124
- const jsonValue = value.toJSON();
125
- return stringify({
126
- value: jsonValue,
127
- errorsByPath,
128
- path,
129
- tab,
130
- inArray,
131
- inToJson: true,
132
- usedErrors,
133
- });
134
- }
135
- // Get all entries from the object (including undefined values that have errors)
136
- const allEntries = Object.entries(value);
137
- // Split into defined and undefined entries
138
- const definedEntries = allEntries.filter(([_, val]) => val !== undefined);
139
- const undefinedEntryKeys = new Set(allEntries.filter(([_, val]) => val === undefined).map(([key]) => key));
140
- // Find missing properties that have validation errors (not in object at all)
141
- const missingKeys = getMissingProperties(path, value, errorsByPath);
142
- // Combine: defined entries + undefined entries with errors + missing properties
143
- const undefinedKeysWithErrors = Array.from(undefinedEntryKeys).filter((key) => {
144
- const propPath = NamingConvention_1.NamingConvention.variable(key)
145
- ? `${path}.${key}`
146
- : `${path}[${JSON.stringify(key)}]`;
147
- return hasErrorsAtOrUnder(propPath, errorsByPath);
148
- });
149
- const allKeys = [
150
- ...definedEntries.map(([key]) => key),
151
- ...undefinedKeysWithErrors,
152
- ...missingKeys,
153
- ];
154
- if (allKeys.length === 0) {
155
- return `${indent}{}${errorComment}`;
156
- }
157
- const lines = [];
158
- lines.push(`${indent}{${errorComment}`);
159
- allKeys.forEach((key, index, array) => {
160
- const propPath = NamingConvention_1.NamingConvention.variable(key)
161
- ? `${path}.${key}`
162
- : `${path}[${JSON.stringify(key)}]`;
163
- const propIndent = " ".repeat(tab + 1);
164
- // Get the value (undefined for missing properties or undefined entries)
165
- const val = missingKeys.includes(key) || undefinedKeysWithErrors.includes(key)
166
- ? undefined
167
- : // biome-ignore lint: intended
168
- value[key];
169
- // Primitive property value (including undefined for missing properties)
170
- if (val === undefined ||
171
- val === null ||
172
- typeof val === "boolean" ||
173
- typeof val === "number" ||
174
- typeof val === "string") {
175
- const propErrorComment = getErrorComment(propPath, errorsByPath, usedErrors);
176
- const keyStr = JSON.stringify(key);
177
- const valueStr = val === undefined
178
- ? `${propIndent}${keyStr}: undefined`
179
- : `${propIndent}${keyStr}: ${JSON.stringify(val)}`;
180
- const withComma = index < array.length - 1 ? `${valueStr},` : valueStr;
181
- const line = withComma + propErrorComment;
182
- lines.push(line);
183
- }
184
- // Complex property value (object or array)
185
- else {
186
- const keyLine = `${propIndent}${JSON.stringify(key)}: `;
187
- let valStr = stringify({
188
- value: val,
189
- errorsByPath,
190
- path: propPath,
191
- tab: tab + 1,
192
- inArray: false,
193
- inToJson: false,
194
- usedErrors,
195
- });
196
- const valStrWithoutIndent = valStr.trimStart();
197
- // Add comma before the error comment if not the last property
198
- if (index < array.length - 1) {
199
- valStr = insertCommaBeforeComment(valStrWithoutIndent);
200
- }
201
- else {
202
- valStr = valStrWithoutIndent;
203
- }
204
- const combined = keyLine + valStr;
205
- lines.push(combined);
206
- }
207
- });
208
- lines.push(`${indent}}`);
209
- return lines.join("\n");
210
- }
211
- // Primitive types (null, boolean, number, string, undefined, etc.)
212
- const valStr = value === undefined
213
- ? "undefined"
214
- : ((_a = JSON.stringify(value)) !== null && _a !== void 0 ? _a : String(value));
215
- return `${indent}${valStr}${errorComment}`;
216
- }
217
- /** Insert comma before inline error comment on the last line */
218
- function insertCommaBeforeComment(str) {
219
- const lines = str.split("\n");
220
- const lastLine = lines[lines.length - 1];
221
- // Use specific error marker to avoid false positives with values containing " //"
222
- const commentIndex = lastLine.lastIndexOf(" // ❌");
223
- if (commentIndex !== -1) {
224
- lines[lines.length - 1] = `${lastLine.slice(0, commentIndex)},${lastLine.slice(commentIndex)}`;
225
- }
226
- else {
227
- lines[lines.length - 1] += ",";
228
- }
229
- return lines.join("\n");
230
- }
231
- /** Get error comment for a given path */
232
- function getErrorComment(path, errorsByPath, usedErrors) {
233
- const pathErrors = errorsByPath.get(path);
234
- if (pathErrors === undefined || pathErrors.length === 0) {
235
- return "";
236
- }
237
- // Mark these errors as used
238
- pathErrors.forEach((e) => usedErrors.add(e));
239
- return ` // ❌ ${JSON.stringify(pathErrors.map((e) => ({
240
- path: e.path,
241
- expected: e.expected,
242
- description: e.description,
243
- })))}`;
244
- }
245
- /**
246
- * Check if there are missing array element errors (path ending with []) Returns
247
- * an array of error objects, one per missing element
248
- */
249
- function getMissingArrayElementErrors(path, errorsByPath, usedErrors) {
250
- var _a;
251
- const wildcardPath = `${path}[]`;
252
- const missingErrors = (_a = errorsByPath.get(wildcardPath)) !== null && _a !== void 0 ? _a : [];
253
- // Mark these errors as used
254
- missingErrors.forEach((e) => usedErrors.add(e));
255
- return missingErrors;
256
- }
257
- /** Check if any errors exist at or under the given path prefix */
258
- function hasErrorsAtOrUnder(pathPrefix, errorsByPath) {
259
- for (const errorPath of errorsByPath.keys()) {
260
- if (errorPath === pathPrefix ||
261
- errorPath.startsWith(pathPrefix + ".") ||
262
- errorPath.startsWith(pathPrefix + "[")) {
263
- return true;
264
- }
265
- }
266
- return false;
267
- }
268
- /**
269
- * Find missing properties that have validation errors but don't exist in the
270
- * data Returns array of property keys that should be displayed as undefined
271
- */
272
- function getMissingProperties(path, value, errorsByPath) {
273
- const missingKeys = new Set();
274
- for (const errorPath of errorsByPath.keys()) {
275
- // Check if error.path is a direct child of current path
276
- const childKey = extractDirectChildKey(path, errorPath);
277
- if (childKey !== null) {
278
- // Check if this property actually exists in the value
279
- if (!(childKey in value)) {
280
- missingKeys.add(childKey);
281
- }
282
- }
283
- }
284
- return Array.from(missingKeys);
285
- }
286
- /**
287
- * Extract direct child property key if errorPath is a direct child of
288
- * parentPath Returns null if not a direct child
289
- *
290
- * Examples:
291
- *
292
- * - ExtractDirectChildKey("$input", "$input.email") => "email"
293
- * - ExtractDirectChildKey("$input", "$input.user.email") => null (grandchild)
294
- * - ExtractDirectChildKey("$input.user", "$input.user.email") => "email"
295
- * - ExtractDirectChildKey("$input", "$input[0]") => null (array index, not object
296
- * property)
297
- * - ExtractDirectChildKey("$input", "$input["foo-bar"]") => "foo-bar"
298
- * - ExtractDirectChildKey("$input", "$input["foo"]["bar"]") => null (grandchild)
299
- */
300
- function extractDirectChildKey(parentPath, errorPath) {
301
- if (!errorPath.startsWith(parentPath)) {
302
- return null;
303
- }
304
- const suffix = errorPath.slice(parentPath.length);
305
- // Match ".propertyName" pattern (direct child property with dot notation)
306
- // Should not contain additional dots or brackets after the property name
307
- const dotMatch = suffix.match(/^\.([^.[\]]+)$/);
308
- if (dotMatch !== null) {
309
- return dotMatch[1];
310
- }
311
- // Match '["key"]' pattern (direct child property with bracket notation)
312
- // The key is a JSON-encoded string
313
- const bracketMatch = suffix.match(/^\[("[^"\\]*(?:\\.[^"\\]*)*")\]$/);
314
- if (bracketMatch !== null) {
315
- try {
316
- const parsed = JSON.parse(bracketMatch[1]);
317
- // Ensure it's a string key, not a number (array index)
318
- if (typeof parsed === "string") {
319
- return parsed;
320
- }
321
- }
322
- catch (_a) {
323
- // Invalid JSON, ignore
324
- }
325
- }
326
- return null;
327
- }
328
-
329
- return stringifyValidationFailure;
50
+ }
51
+ function stringify(props) {
52
+ var _a;
53
+ const { value, errorsByPath, path, tab, inArray, inToJson, usedErrors } = props;
54
+ const indent = " ".repeat(tab);
55
+ const errorComment = getErrorComment(path, errorsByPath, usedErrors);
56
+ // Handle undefined in arrays
57
+ if (inArray && value === undefined) {
58
+ return `${indent}undefined${errorComment}`;
59
+ }
60
+ // Array
61
+ if (Array.isArray(value)) {
62
+ // Check for missing array element errors (path[])
63
+ const missingElementErrors = getMissingArrayElementErrors(path, errorsByPath, usedErrors);
64
+ const hasMissingElements = missingElementErrors.length > 0;
65
+ if (value.length === 0) {
66
+ // Empty array but has missing element errors - show placeholders
67
+ if (hasMissingElements) {
68
+ const innerIndent = " ".repeat(tab + 1);
69
+ const lines = [];
70
+ lines.push(`${indent}[${errorComment}`);
71
+ missingElementErrors.forEach((e, idx) => {
72
+ const errComment = ` // ❌ ${JSON.stringify([{ path: e.path, expected: e.expected, description: e.description }])}`;
73
+ const comma = idx < missingElementErrors.length - 1 ? "," : "";
74
+ lines.push(`${innerIndent}undefined${comma}${errComment}`);
75
+ });
76
+ lines.push(`${indent}]`);
77
+ return lines.join("\n");
78
+ }
79
+ return `${indent}[]${errorComment}`;
80
+ }
81
+ const lines = [];
82
+ lines.push(`${indent}[${errorComment}`);
83
+ value.forEach((item, index) => {
84
+ const itemPath = `${path}[${index}]`;
85
+ const isLastElement = index === value.length - 1;
86
+ // If there are missing element errors, this is not truly the last line
87
+ const needsComma = !isLastElement || hasMissingElements;
88
+ let itemStr = stringify({
89
+ value: item,
90
+ errorsByPath,
91
+ path: itemPath,
92
+ tab: tab + 1,
93
+ inArray: true,
94
+ inToJson: false,
95
+ usedErrors,
96
+ });
97
+ // Add comma before the error comment if not the last element
98
+ if (needsComma) {
99
+ itemStr = insertCommaBeforeComment(itemStr);
100
+ }
101
+ lines.push(itemStr);
102
+ });
103
+ // Add missing element placeholders at the end for each [] error
104
+ if (hasMissingElements) {
105
+ const innerIndent = " ".repeat(tab + 1);
106
+ missingElementErrors.forEach((e, idx) => {
107
+ const errComment = ` // ❌ ${JSON.stringify([{ path: e.path, expected: e.expected, description: e.description }])}`;
108
+ const comma = idx < missingElementErrors.length - 1 ? "," : "";
109
+ lines.push(`${innerIndent}undefined${comma}${errComment}`);
110
+ });
111
+ }
112
+ lines.push(`${indent}]`);
113
+ return lines.join("\n");
114
+ }
115
+ // Object
116
+ if (typeof value === "object" && value !== null) {
117
+ // Check for toJSON method
118
+ // biome-ignore lint: intended
119
+ if (!inToJson && typeof value.toJSON === "function") {
120
+ // biome-ignore lint: intended
121
+ const jsonValue = value.toJSON();
122
+ return stringify({
123
+ value: jsonValue,
124
+ errorsByPath,
125
+ path,
126
+ tab,
127
+ inArray,
128
+ inToJson: true,
129
+ usedErrors,
130
+ });
131
+ }
132
+ // Get all entries from the object (including undefined values that have errors)
133
+ const allEntries = Object.entries(value);
134
+ // Split into defined and undefined entries
135
+ const definedEntries = allEntries.filter(([_, val]) => val !== undefined);
136
+ const undefinedEntryKeys = new Set(allEntries.filter(([_, val]) => val === undefined).map(([key]) => key));
137
+ // Find missing properties that have validation errors (not in object at all)
138
+ const missingKeys = getMissingProperties(path, value, errorsByPath);
139
+ // Combine: defined entries + undefined entries with errors + missing properties
140
+ const undefinedKeysWithErrors = Array.from(undefinedEntryKeys).filter((key) => {
141
+ const propPath = NamingConvention_1.NamingConvention.variable(key)
142
+ ? `${path}.${key}`
143
+ : `${path}[${JSON.stringify(key)}]`;
144
+ return hasErrorsAtOrUnder(propPath, errorsByPath);
145
+ });
146
+ const allKeys = [
147
+ ...definedEntries.map(([key]) => key),
148
+ ...undefinedKeysWithErrors,
149
+ ...missingKeys,
150
+ ];
151
+ if (allKeys.length === 0) {
152
+ return `${indent}{}${errorComment}`;
153
+ }
154
+ const lines = [];
155
+ lines.push(`${indent}{${errorComment}`);
156
+ allKeys.forEach((key, index, array) => {
157
+ const propPath = NamingConvention_1.NamingConvention.variable(key)
158
+ ? `${path}.${key}`
159
+ : `${path}[${JSON.stringify(key)}]`;
160
+ const propIndent = " ".repeat(tab + 1);
161
+ // Get the value (undefined for missing properties or undefined entries)
162
+ const val = missingKeys.includes(key) || undefinedKeysWithErrors.includes(key)
163
+ ? undefined
164
+ : // biome-ignore lint: intended
165
+ value[key];
166
+ // Primitive property value (including undefined for missing properties)
167
+ if (val === undefined ||
168
+ val === null ||
169
+ typeof val === "boolean" ||
170
+ typeof val === "number" ||
171
+ typeof val === "string") {
172
+ const propErrorComment = getErrorComment(propPath, errorsByPath, usedErrors);
173
+ const keyStr = JSON.stringify(key);
174
+ const valueStr = val === undefined
175
+ ? `${propIndent}${keyStr}: undefined`
176
+ : `${propIndent}${keyStr}: ${JSON.stringify(val)}`;
177
+ const withComma = index < array.length - 1 ? `${valueStr},` : valueStr;
178
+ const line = withComma + propErrorComment;
179
+ lines.push(line);
180
+ }
181
+ // Complex property value (object or array)
182
+ else {
183
+ const keyLine = `${propIndent}${JSON.stringify(key)}: `;
184
+ let valStr = stringify({
185
+ value: val,
186
+ errorsByPath,
187
+ path: propPath,
188
+ tab: tab + 1,
189
+ inArray: false,
190
+ inToJson: false,
191
+ usedErrors,
192
+ });
193
+ const valStrWithoutIndent = valStr.trimStart();
194
+ // Add comma before the error comment if not the last property
195
+ if (index < array.length - 1) {
196
+ valStr = insertCommaBeforeComment(valStrWithoutIndent);
197
+ }
198
+ else {
199
+ valStr = valStrWithoutIndent;
200
+ }
201
+ const combined = keyLine + valStr;
202
+ lines.push(combined);
203
+ }
204
+ });
205
+ lines.push(`${indent}}`);
206
+ return lines.join("\n");
207
+ }
208
+ // Primitive types (null, boolean, number, string, undefined, etc.)
209
+ const valStr = value === undefined
210
+ ? "undefined"
211
+ : ((_a = JSON.stringify(value)) !== null && _a !== void 0 ? _a : String(value));
212
+ return `${indent}${valStr}${errorComment}`;
213
+ }
214
+ /** Insert comma before inline error comment on the last line */
215
+ function insertCommaBeforeComment(str) {
216
+ const lines = str.split("\n");
217
+ const lastLine = lines[lines.length - 1];
218
+ // Use specific error marker to avoid false positives with values containing " //"
219
+ const commentIndex = lastLine.lastIndexOf(" // ❌");
220
+ if (commentIndex !== -1) {
221
+ lines[lines.length - 1] = `${lastLine.slice(0, commentIndex)},${lastLine.slice(commentIndex)}`;
222
+ }
223
+ else {
224
+ lines[lines.length - 1] += ",";
225
+ }
226
+ return lines.join("\n");
227
+ }
228
+ /** Get error comment for a given path */
229
+ function getErrorComment(path, errorsByPath, usedErrors) {
230
+ const pathErrors = errorsByPath.get(path);
231
+ if (pathErrors === undefined || pathErrors.length === 0) {
232
+ return "";
233
+ }
234
+ // Mark these errors as used
235
+ pathErrors.forEach((e) => usedErrors.add(e));
236
+ return ` // ❌ ${JSON.stringify(pathErrors.map((e) => ({
237
+ path: e.path,
238
+ expected: e.expected,
239
+ description: e.description,
240
+ })))}`;
241
+ }
242
+ /**
243
+ * Check if there are missing array element errors (path ending with []) Returns
244
+ * an array of error objects, one per missing element
245
+ */
246
+ function getMissingArrayElementErrors(path, errorsByPath, usedErrors) {
247
+ var _a;
248
+ const wildcardPath = `${path}[]`;
249
+ const missingErrors = (_a = errorsByPath.get(wildcardPath)) !== null && _a !== void 0 ? _a : [];
250
+ // Mark these errors as used
251
+ missingErrors.forEach((e) => usedErrors.add(e));
252
+ return missingErrors;
253
+ }
254
+ /** Check if any errors exist at or under the given path prefix */
255
+ function hasErrorsAtOrUnder(pathPrefix, errorsByPath) {
256
+ for (const errorPath of errorsByPath.keys()) {
257
+ if (errorPath === pathPrefix ||
258
+ errorPath.startsWith(pathPrefix + ".") ||
259
+ errorPath.startsWith(pathPrefix + "[")) {
260
+ return true;
261
+ }
262
+ }
263
+ return false;
264
+ }
265
+ /**
266
+ * Find missing properties that have validation errors but don't exist in the
267
+ * data Returns array of property keys that should be displayed as undefined
268
+ */
269
+ function getMissingProperties(path, value, errorsByPath) {
270
+ const missingKeys = new Set();
271
+ for (const errorPath of errorsByPath.keys()) {
272
+ // Check if error.path is a direct child of current path
273
+ const childKey = extractDirectChildKey(path, errorPath);
274
+ if (childKey !== null) {
275
+ // Check if this property actually exists in the value
276
+ if (!(childKey in value)) {
277
+ missingKeys.add(childKey);
278
+ }
279
+ }
280
+ }
281
+ return Array.from(missingKeys);
282
+ }
283
+ /**
284
+ * Extract direct child property key if errorPath is a direct child of
285
+ * parentPath Returns null if not a direct child
286
+ *
287
+ * Examples:
288
+ *
289
+ * - ExtractDirectChildKey("$input", "$input.email") => "email"
290
+ * - ExtractDirectChildKey("$input", "$input.user.email") => null (grandchild)
291
+ * - ExtractDirectChildKey("$input.user", "$input.user.email") => "email"
292
+ * - ExtractDirectChildKey("$input", "$input[0]") => null (array index, not object
293
+ * property)
294
+ * - ExtractDirectChildKey("$input", "$input["foo-bar"]") => "foo-bar"
295
+ * - ExtractDirectChildKey("$input", "$input["foo"]["bar"]") => null (grandchild)
296
+ */
297
+ function extractDirectChildKey(parentPath, errorPath) {
298
+ if (!errorPath.startsWith(parentPath)) {
299
+ return null;
300
+ }
301
+ const suffix = errorPath.slice(parentPath.length);
302
+ // Match ".propertyName" pattern (direct child property with dot notation)
303
+ // Should not contain additional dots or brackets after the property name
304
+ const dotMatch = suffix.match(/^\.([^.[\]]+)$/);
305
+ if (dotMatch !== null) {
306
+ return dotMatch[1];
307
+ }
308
+ // Match '["key"]' pattern (direct child property with bracket notation)
309
+ // The key is a JSON-encoded string
310
+ const bracketMatch = suffix.match(/^\[("[^"\\]*(?:\\.[^"\\]*)*")\]$/);
311
+ if (bracketMatch !== null) {
312
+ try {
313
+ const parsed = JSON.parse(bracketMatch[1]);
314
+ // Ensure it's a string key, not a number (array index)
315
+ if (typeof parsed === "string") {
316
+ return parsed;
317
+ }
318
+ }
319
+ catch (_a) {
320
+ // Invalid JSON, ignore
321
+ }
322
+ }
323
+ return null;
330
324
  }
331
325
 
332
- export { requireStringifyValidationFailure as __require };
326
+ export { stringifyValidationFailure$1 as default, stringifyValidationFailure_2 as stringifyValidationFailure };
333
327
  //# sourceMappingURL=stringifyValidationFailure2.mjs.map