@typia/utils 13.0.0-dev.20260427-2 → 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,323 +1,317 @@
1
- import { __exports as LlmTypeChecker } from '../_virtual/LlmTypeChecker.mjs';
2
- import { __require as requireMapUtil } from '../utils/MapUtil2.mjs';
3
- import { __require as requireOpenApiTypeCheckerBase } from '../utils/internal/OpenApiTypeCheckerBase2.mjs';
1
+ import { __exports as LlmTypeChecker$1 } from '../_virtual/LlmTypeChecker.mjs';
2
+ import '../utils/MapUtil2.mjs';
3
+ import '../utils/internal/OpenApiTypeCheckerBase2.mjs';
4
+ import { __exports as MapUtil } from '../_virtual/MapUtil.mjs';
5
+ import { __exports as OpenApiTypeCheckerBase } from '../_virtual/OpenApiTypeCheckerBase.mjs';
4
6
 
5
- var hasRequiredLlmTypeChecker;
7
+ Object.defineProperty(LlmTypeChecker$1, "__esModule", { value: true });
8
+ var LlmTypeChecker_2 = LlmTypeChecker$1.LlmTypeChecker = void 0;
9
+ const MapUtil_1 = MapUtil;
10
+ const OpenApiTypeCheckerBase_1 = OpenApiTypeCheckerBase;
11
+ /**
12
+ * Type checker for LLM function calling schema.
13
+ *
14
+ * `LlmTypeChecker` is a type checker of {@link ILlmSchema}, the type schema for
15
+ * LLM (Large Language Model) function calling.
16
+ *
17
+ * This checker provides type guard functions for validating schema types, and
18
+ * operators for traversing and comparing schemas.
19
+ *
20
+ * @author Jeongho Nam - https://github.com/samchon
21
+ */
22
+ var LlmTypeChecker;
23
+ (function (LlmTypeChecker) {
24
+ /* -----------------------------------------------------------
25
+ TYPE CHECKERS
26
+ ----------------------------------------------------------- */
27
+ /**
28
+ * Test whether the schema is a null type.
29
+ *
30
+ * @param schema Target schema
31
+ * @returns Whether null type or not
32
+ */
33
+ LlmTypeChecker.isNull = (schema) => schema.type === "null";
34
+ /**
35
+ * Test whether the schema is an unknown type.
36
+ *
37
+ * @param schema Target schema
38
+ * @returns Whether unknown type or not
39
+ */
40
+ LlmTypeChecker.isUnknown = (schema) => schema.type === undefined &&
41
+ !LlmTypeChecker.isAnyOf(schema) &&
42
+ !LlmTypeChecker.isReference(schema);
43
+ /**
44
+ * Test whether the schema is a boolean type.
45
+ *
46
+ * @param schema Target schema
47
+ * @returns Whether boolean type or not
48
+ */
49
+ LlmTypeChecker.isBoolean = (schema) => schema.type === "boolean";
50
+ /**
51
+ * Test whether the schema is an integer type.
52
+ *
53
+ * @param schema Target schema
54
+ * @returns Whether integer type or not
55
+ */
56
+ LlmTypeChecker.isInteger = (schema) => schema.type === "integer";
57
+ /**
58
+ * Test whether the schema is a number type.
59
+ *
60
+ * @param schema Target schema
61
+ * @returns Whether number type or not
62
+ */
63
+ LlmTypeChecker.isNumber = (schema) => schema.type === "number";
64
+ /**
65
+ * Test whether the schema is a string type.
66
+ *
67
+ * @param schema Target schema
68
+ * @returns Whether string type or not
69
+ */
70
+ LlmTypeChecker.isString = (schema) => schema.type === "string";
71
+ /**
72
+ * Test whether the schema is an array type.
73
+ *
74
+ * @param schema Target schema
75
+ * @returns Whether array type or not
76
+ */
77
+ LlmTypeChecker.isArray = (schema) => schema.type === "array" &&
78
+ schema.items !== undefined;
79
+ /**
80
+ * Test whether the schema is an object type.
81
+ *
82
+ * @param schema Target schema
83
+ * @returns Whether object type or not
84
+ */
85
+ LlmTypeChecker.isObject = (schema) => schema.type === "object";
86
+ /**
87
+ * Test whether the schema is a reference type.
88
+ *
89
+ * @param schema Target schema
90
+ * @returns Whether reference type or not
91
+ */
92
+ LlmTypeChecker.isReference = (schema) => schema.$ref !== undefined;
93
+ /**
94
+ * Test whether the schema is a union type.
95
+ *
96
+ * @param schema Target schema
97
+ * @returns Whether union type or not
98
+ */
99
+ LlmTypeChecker.isAnyOf = (schema) => schema.anyOf !== undefined;
100
+ /* -----------------------------------------------------------
101
+ OPERATORS
102
+ ----------------------------------------------------------- */
103
+ /**
104
+ * Visit every nested schemas.
105
+ *
106
+ * Visit every nested schemas of the target, and apply the `props.closure`
107
+ * function.
108
+ *
109
+ * Here is the list of occurring nested visitings:
110
+ *
111
+ * - {@link ILlmSchema.IAnyOf.anyOf}
112
+ * - {@link ILlmSchema.IReference}
113
+ * - {@link ILlmSchema.IObject.properties}
114
+ * - {@link ILlmSchema.IArray.items}
115
+ *
116
+ * @param props Properties for visiting
117
+ */
118
+ LlmTypeChecker.visit = (props) => {
119
+ var _a, _b;
120
+ const already = new Set();
121
+ const refAccessor = (_a = props.refAccessor) !== null && _a !== void 0 ? _a : "$input.$defs";
122
+ const next = (schema, accessor) => {
123
+ var _a;
124
+ props.closure(schema, accessor);
125
+ if (LlmTypeChecker.isReference(schema)) {
126
+ const key = schema.$ref.split("#/$defs/").pop();
127
+ if (already.has(key) === true)
128
+ return;
129
+ already.add(key);
130
+ const found = (_a = props.$defs) === null || _a === void 0 ? void 0 : _a[key];
131
+ if (found !== undefined)
132
+ next(found, `${refAccessor}[${key}]`);
133
+ }
134
+ else if (LlmTypeChecker.isAnyOf(schema))
135
+ schema.anyOf.forEach((s, i) => next(s, `${accessor}.anyOf[${i}]`));
136
+ else if (LlmTypeChecker.isObject(schema)) {
137
+ for (const [key, value] of Object.entries(schema.properties))
138
+ next(value, `${accessor}.properties[${JSON.stringify(key)}]`);
139
+ if (typeof schema.additionalProperties === "object" &&
140
+ schema.additionalProperties !== null)
141
+ next(schema.additionalProperties, `${accessor}.additionalProperties`);
142
+ }
143
+ else if (LlmTypeChecker.isArray(schema))
144
+ next(schema.items, `${accessor}.items`);
145
+ };
146
+ next(props.schema, (_b = props.accessor) !== null && _b !== void 0 ? _b : "$input.schemas");
147
+ };
148
+ /**
149
+ * Test whether the `x` schema covers the `y` schema.
150
+ *
151
+ * @param props Properties for testing
152
+ * @returns Whether the `x` schema covers the `y` schema
153
+ */
154
+ LlmTypeChecker.covers = (props) => coverStation({
155
+ $defs: props.$defs,
156
+ x: props.x,
157
+ y: props.y,
158
+ visited: new Map(),
159
+ });
160
+ const coverStation = (p) => {
161
+ var _a;
162
+ const cache = (_a = p.visited.get(p.x)) === null || _a === void 0 ? void 0 : _a.get(p.y);
163
+ if (cache !== undefined)
164
+ return cache;
165
+ // FOR RECURSIVE CASE
166
+ const nested = MapUtil_1.MapUtil.take(p.visited, p.x, () => new Map());
167
+ nested.set(p.y, true);
168
+ // COMPUTE IT
169
+ const result = coverSchema(p);
170
+ nested.set(p.y, result);
171
+ return result;
172
+ };
173
+ const coverSchema = (p) => {
174
+ // CHECK EQUALITY
175
+ if (p.x === p.y)
176
+ return true;
177
+ else if (LlmTypeChecker.isReference(p.x) && LlmTypeChecker.isReference(p.y) && p.x.$ref === p.y.$ref)
178
+ return true;
179
+ // COMPARE WITH FLATTENING
180
+ const alpha = flatSchema(p.$defs, p.x);
181
+ const beta = flatSchema(p.$defs, p.y);
182
+ if (alpha.some((x) => LlmTypeChecker.isUnknown(x)))
183
+ return true;
184
+ else if (beta.some((x) => LlmTypeChecker.isUnknown(x)))
185
+ return false;
186
+ return beta.every((b) => alpha.some((a) => coverEscapedSchema({
187
+ $defs: p.$defs,
188
+ visited: p.visited,
189
+ x: a,
190
+ y: b,
191
+ })));
192
+ };
193
+ const coverEscapedSchema = (p) => {
194
+ // CHECK EQUALITY
195
+ if (p.x === p.y)
196
+ return true;
197
+ else if (LlmTypeChecker.isUnknown(p.x))
198
+ return true;
199
+ else if (LlmTypeChecker.isUnknown(p.y))
200
+ return false;
201
+ else if (LlmTypeChecker.isNull(p.x))
202
+ return LlmTypeChecker.isNull(p.y);
203
+ // ATOMIC CASE
204
+ else if (LlmTypeChecker.isBoolean(p.x))
205
+ return LlmTypeChecker.isBoolean(p.y) && coverBoolean(p.x, p.y);
206
+ else if (LlmTypeChecker.isInteger(p.x))
207
+ return LlmTypeChecker.isInteger(p.y) && coverInteger(p.x, p.y);
208
+ else if (LlmTypeChecker.isNumber(p.x))
209
+ return LlmTypeChecker.isNumber(p.y) && coverNumber(p.x, p.y);
210
+ else if (LlmTypeChecker.isString(p.x))
211
+ return LlmTypeChecker.isString(p.y) && coverString(p.x, p.y);
212
+ // INSTANCE CASE
213
+ else if (LlmTypeChecker.isArray(p.x))
214
+ return (LlmTypeChecker.isArray(p.y) &&
215
+ coverArray({
216
+ $defs: p.$defs,
217
+ visited: p.visited,
218
+ x: p.x,
219
+ y: p.y,
220
+ }));
221
+ else if (LlmTypeChecker.isObject(p.x))
222
+ return (LlmTypeChecker.isObject(p.y) &&
223
+ coverObject({
224
+ $defs: p.$defs,
225
+ visited: p.visited,
226
+ x: p.x,
227
+ y: p.y,
228
+ }));
229
+ else if (LlmTypeChecker.isReference(p.x))
230
+ return LlmTypeChecker.isReference(p.y) && p.x.$ref === p.y.$ref;
231
+ return false;
232
+ };
233
+ const coverArray = (p) => {
234
+ if (!(p.x.minItems === undefined ||
235
+ (p.y.minItems !== undefined && p.x.minItems <= p.y.minItems)))
236
+ return false;
237
+ else if (!(p.x.maxItems === undefined ||
238
+ (p.y.maxItems !== undefined && p.x.maxItems >= p.y.maxItems)))
239
+ return false;
240
+ return coverStation({
241
+ $defs: p.$defs,
242
+ visited: p.visited,
243
+ x: p.x.items,
244
+ y: p.y.items,
245
+ });
246
+ };
247
+ const coverObject = (p) => {
248
+ var _a;
249
+ if (!p.x.additionalProperties && !!p.y.additionalProperties)
250
+ return false;
251
+ else if (!!p.x.additionalProperties &&
252
+ !!p.y.additionalProperties &&
253
+ ((typeof p.x.additionalProperties === "object" &&
254
+ p.y.additionalProperties === true) ||
255
+ (typeof p.x.additionalProperties === "object" &&
256
+ typeof p.y.additionalProperties === "object" &&
257
+ !coverStation({
258
+ $defs: p.$defs,
259
+ visited: p.visited,
260
+ x: p.x.additionalProperties,
261
+ y: p.y.additionalProperties,
262
+ }))))
263
+ return false;
264
+ return Object.entries((_a = p.y.properties) !== null && _a !== void 0 ? _a : {}).every(([key, b]) => {
265
+ var _a, _b, _c;
266
+ var _d, _e;
267
+ const a = (_a = p.x.properties) === null || _a === void 0 ? void 0 : _a[key];
268
+ if (a === undefined)
269
+ return false;
270
+ else if (((_d = (_b = p.x.required) === null || _b === void 0 ? void 0 : _b.includes(key)) !== null && _d !== void 0 ? _d : false) === true &&
271
+ ((_e = (_c = p.y.required) === null || _c === void 0 ? void 0 : _c.includes(key)) !== null && _e !== void 0 ? _e : false) === false)
272
+ return false;
273
+ return coverStation({
274
+ $defs: p.$defs,
275
+ visited: p.visited,
276
+ x: a,
277
+ y: b,
278
+ });
279
+ });
280
+ };
281
+ const coverBoolean = (x, y) => {
282
+ var _a, _b;
283
+ if (!!((_a = x.enum) === null || _a === void 0 ? void 0 : _a.length))
284
+ return !!((_b = y.enum) === null || _b === void 0 ? void 0 : _b.length) && y.enum.every((v) => x.enum.includes(v));
285
+ return true;
286
+ };
287
+ const coverInteger = (x, y) => {
288
+ var _a, _b;
289
+ if (!!((_a = x.enum) === null || _a === void 0 ? void 0 : _a.length))
290
+ return !!((_b = y.enum) === null || _b === void 0 ? void 0 : _b.length) && y.enum.every((v) => x.enum.includes(v));
291
+ return OpenApiTypeCheckerBase_1.OpenApiTypeCheckerBase.coverInteger(x, y);
292
+ };
293
+ const coverNumber = (x, y) => {
294
+ var _a, _b;
295
+ if (!!((_a = x.enum) === null || _a === void 0 ? void 0 : _a.length))
296
+ return !!((_b = y.enum) === null || _b === void 0 ? void 0 : _b.length) && y.enum.every((v) => x.enum.includes(v));
297
+ return OpenApiTypeCheckerBase_1.OpenApiTypeCheckerBase.coverNumber(x, y);
298
+ };
299
+ const coverString = (x, y) => {
300
+ var _a, _b;
301
+ if (!!((_a = x.enum) === null || _a === void 0 ? void 0 : _a.length))
302
+ return !!((_b = y.enum) === null || _b === void 0 ? void 0 : _b.length) && y.enum.every((v) => x.enum.includes(v));
303
+ return OpenApiTypeCheckerBase_1.OpenApiTypeCheckerBase.coverString(x, y);
304
+ };
305
+ const flatSchema = ($defs, schema) => {
306
+ schema = escapeReference($defs, schema);
307
+ if (LlmTypeChecker.isAnyOf(schema))
308
+ return schema.anyOf.map((v) => flatSchema($defs, v)).flat();
309
+ return [schema];
310
+ };
311
+ const escapeReference = ($defs, schema) => LlmTypeChecker.isReference(schema)
312
+ ? escapeReference($defs, $defs[schema.$ref.replace("#/$defs/", "")])
313
+ : schema;
314
+ })(LlmTypeChecker || (LlmTypeChecker_2 = LlmTypeChecker$1.LlmTypeChecker = LlmTypeChecker = {}));
6
315
 
7
- function requireLlmTypeChecker () {
8
- if (hasRequiredLlmTypeChecker) return LlmTypeChecker;
9
- hasRequiredLlmTypeChecker = 1;
10
- Object.defineProperty(LlmTypeChecker, "__esModule", { value: true });
11
- LlmTypeChecker.LlmTypeChecker = void 0;
12
- const MapUtil_1 = requireMapUtil();
13
- const OpenApiTypeCheckerBase_1 = requireOpenApiTypeCheckerBase();
14
- /**
15
- * Type checker for LLM function calling schema.
16
- *
17
- * `LlmTypeChecker` is a type checker of {@link ILlmSchema}, the type schema for
18
- * LLM (Large Language Model) function calling.
19
- *
20
- * This checker provides type guard functions for validating schema types, and
21
- * operators for traversing and comparing schemas.
22
- *
23
- * @author Jeongho Nam - https://github.com/samchon
24
- */
25
- var LlmTypeChecker$1;
26
- (function (LlmTypeChecker) {
27
- /* -----------------------------------------------------------
28
- TYPE CHECKERS
29
- ----------------------------------------------------------- */
30
- /**
31
- * Test whether the schema is a null type.
32
- *
33
- * @param schema Target schema
34
- * @returns Whether null type or not
35
- */
36
- LlmTypeChecker.isNull = (schema) => schema.type === "null";
37
- /**
38
- * Test whether the schema is an unknown type.
39
- *
40
- * @param schema Target schema
41
- * @returns Whether unknown type or not
42
- */
43
- LlmTypeChecker.isUnknown = (schema) => schema.type === undefined &&
44
- !LlmTypeChecker.isAnyOf(schema) &&
45
- !LlmTypeChecker.isReference(schema);
46
- /**
47
- * Test whether the schema is a boolean type.
48
- *
49
- * @param schema Target schema
50
- * @returns Whether boolean type or not
51
- */
52
- LlmTypeChecker.isBoolean = (schema) => schema.type === "boolean";
53
- /**
54
- * Test whether the schema is an integer type.
55
- *
56
- * @param schema Target schema
57
- * @returns Whether integer type or not
58
- */
59
- LlmTypeChecker.isInteger = (schema) => schema.type === "integer";
60
- /**
61
- * Test whether the schema is a number type.
62
- *
63
- * @param schema Target schema
64
- * @returns Whether number type or not
65
- */
66
- LlmTypeChecker.isNumber = (schema) => schema.type === "number";
67
- /**
68
- * Test whether the schema is a string type.
69
- *
70
- * @param schema Target schema
71
- * @returns Whether string type or not
72
- */
73
- LlmTypeChecker.isString = (schema) => schema.type === "string";
74
- /**
75
- * Test whether the schema is an array type.
76
- *
77
- * @param schema Target schema
78
- * @returns Whether array type or not
79
- */
80
- LlmTypeChecker.isArray = (schema) => schema.type === "array" &&
81
- schema.items !== undefined;
82
- /**
83
- * Test whether the schema is an object type.
84
- *
85
- * @param schema Target schema
86
- * @returns Whether object type or not
87
- */
88
- LlmTypeChecker.isObject = (schema) => schema.type === "object";
89
- /**
90
- * Test whether the schema is a reference type.
91
- *
92
- * @param schema Target schema
93
- * @returns Whether reference type or not
94
- */
95
- LlmTypeChecker.isReference = (schema) => schema.$ref !== undefined;
96
- /**
97
- * Test whether the schema is a union type.
98
- *
99
- * @param schema Target schema
100
- * @returns Whether union type or not
101
- */
102
- LlmTypeChecker.isAnyOf = (schema) => schema.anyOf !== undefined;
103
- /* -----------------------------------------------------------
104
- OPERATORS
105
- ----------------------------------------------------------- */
106
- /**
107
- * Visit every nested schemas.
108
- *
109
- * Visit every nested schemas of the target, and apply the `props.closure`
110
- * function.
111
- *
112
- * Here is the list of occurring nested visitings:
113
- *
114
- * - {@link ILlmSchema.IAnyOf.anyOf}
115
- * - {@link ILlmSchema.IReference}
116
- * - {@link ILlmSchema.IObject.properties}
117
- * - {@link ILlmSchema.IArray.items}
118
- *
119
- * @param props Properties for visiting
120
- */
121
- LlmTypeChecker.visit = (props) => {
122
- var _a, _b;
123
- const already = new Set();
124
- const refAccessor = (_a = props.refAccessor) !== null && _a !== void 0 ? _a : "$input.$defs";
125
- const next = (schema, accessor) => {
126
- var _a;
127
- props.closure(schema, accessor);
128
- if (LlmTypeChecker.isReference(schema)) {
129
- const key = schema.$ref.split("#/$defs/").pop();
130
- if (already.has(key) === true)
131
- return;
132
- already.add(key);
133
- const found = (_a = props.$defs) === null || _a === void 0 ? void 0 : _a[key];
134
- if (found !== undefined)
135
- next(found, `${refAccessor}[${key}]`);
136
- }
137
- else if (LlmTypeChecker.isAnyOf(schema))
138
- schema.anyOf.forEach((s, i) => next(s, `${accessor}.anyOf[${i}]`));
139
- else if (LlmTypeChecker.isObject(schema)) {
140
- for (const [key, value] of Object.entries(schema.properties))
141
- next(value, `${accessor}.properties[${JSON.stringify(key)}]`);
142
- if (typeof schema.additionalProperties === "object" &&
143
- schema.additionalProperties !== null)
144
- next(schema.additionalProperties, `${accessor}.additionalProperties`);
145
- }
146
- else if (LlmTypeChecker.isArray(schema))
147
- next(schema.items, `${accessor}.items`);
148
- };
149
- next(props.schema, (_b = props.accessor) !== null && _b !== void 0 ? _b : "$input.schemas");
150
- };
151
- /**
152
- * Test whether the `x` schema covers the `y` schema.
153
- *
154
- * @param props Properties for testing
155
- * @returns Whether the `x` schema covers the `y` schema
156
- */
157
- LlmTypeChecker.covers = (props) => coverStation({
158
- $defs: props.$defs,
159
- x: props.x,
160
- y: props.y,
161
- visited: new Map(),
162
- });
163
- const coverStation = (p) => {
164
- var _a;
165
- const cache = (_a = p.visited.get(p.x)) === null || _a === void 0 ? void 0 : _a.get(p.y);
166
- if (cache !== undefined)
167
- return cache;
168
- // FOR RECURSIVE CASE
169
- const nested = MapUtil_1.MapUtil.take(p.visited, p.x, () => new Map());
170
- nested.set(p.y, true);
171
- // COMPUTE IT
172
- const result = coverSchema(p);
173
- nested.set(p.y, result);
174
- return result;
175
- };
176
- const coverSchema = (p) => {
177
- // CHECK EQUALITY
178
- if (p.x === p.y)
179
- return true;
180
- else if (LlmTypeChecker.isReference(p.x) && LlmTypeChecker.isReference(p.y) && p.x.$ref === p.y.$ref)
181
- return true;
182
- // COMPARE WITH FLATTENING
183
- const alpha = flatSchema(p.$defs, p.x);
184
- const beta = flatSchema(p.$defs, p.y);
185
- if (alpha.some((x) => LlmTypeChecker.isUnknown(x)))
186
- return true;
187
- else if (beta.some((x) => LlmTypeChecker.isUnknown(x)))
188
- return false;
189
- return beta.every((b) => alpha.some((a) => coverEscapedSchema({
190
- $defs: p.$defs,
191
- visited: p.visited,
192
- x: a,
193
- y: b,
194
- })));
195
- };
196
- const coverEscapedSchema = (p) => {
197
- // CHECK EQUALITY
198
- if (p.x === p.y)
199
- return true;
200
- else if (LlmTypeChecker.isUnknown(p.x))
201
- return true;
202
- else if (LlmTypeChecker.isUnknown(p.y))
203
- return false;
204
- else if (LlmTypeChecker.isNull(p.x))
205
- return LlmTypeChecker.isNull(p.y);
206
- // ATOMIC CASE
207
- else if (LlmTypeChecker.isBoolean(p.x))
208
- return LlmTypeChecker.isBoolean(p.y) && coverBoolean(p.x, p.y);
209
- else if (LlmTypeChecker.isInteger(p.x))
210
- return LlmTypeChecker.isInteger(p.y) && coverInteger(p.x, p.y);
211
- else if (LlmTypeChecker.isNumber(p.x))
212
- return LlmTypeChecker.isNumber(p.y) && coverNumber(p.x, p.y);
213
- else if (LlmTypeChecker.isString(p.x))
214
- return LlmTypeChecker.isString(p.y) && coverString(p.x, p.y);
215
- // INSTANCE CASE
216
- else if (LlmTypeChecker.isArray(p.x))
217
- return (LlmTypeChecker.isArray(p.y) &&
218
- coverArray({
219
- $defs: p.$defs,
220
- visited: p.visited,
221
- x: p.x,
222
- y: p.y,
223
- }));
224
- else if (LlmTypeChecker.isObject(p.x))
225
- return (LlmTypeChecker.isObject(p.y) &&
226
- coverObject({
227
- $defs: p.$defs,
228
- visited: p.visited,
229
- x: p.x,
230
- y: p.y,
231
- }));
232
- else if (LlmTypeChecker.isReference(p.x))
233
- return LlmTypeChecker.isReference(p.y) && p.x.$ref === p.y.$ref;
234
- return false;
235
- };
236
- const coverArray = (p) => {
237
- if (!(p.x.minItems === undefined ||
238
- (p.y.minItems !== undefined && p.x.minItems <= p.y.minItems)))
239
- return false;
240
- else if (!(p.x.maxItems === undefined ||
241
- (p.y.maxItems !== undefined && p.x.maxItems >= p.y.maxItems)))
242
- return false;
243
- return coverStation({
244
- $defs: p.$defs,
245
- visited: p.visited,
246
- x: p.x.items,
247
- y: p.y.items,
248
- });
249
- };
250
- const coverObject = (p) => {
251
- var _a;
252
- if (!p.x.additionalProperties && !!p.y.additionalProperties)
253
- return false;
254
- else if (!!p.x.additionalProperties &&
255
- !!p.y.additionalProperties &&
256
- ((typeof p.x.additionalProperties === "object" &&
257
- p.y.additionalProperties === true) ||
258
- (typeof p.x.additionalProperties === "object" &&
259
- typeof p.y.additionalProperties === "object" &&
260
- !coverStation({
261
- $defs: p.$defs,
262
- visited: p.visited,
263
- x: p.x.additionalProperties,
264
- y: p.y.additionalProperties,
265
- }))))
266
- return false;
267
- return Object.entries((_a = p.y.properties) !== null && _a !== void 0 ? _a : {}).every(([key, b]) => {
268
- var _a, _b, _c;
269
- var _d, _e;
270
- const a = (_a = p.x.properties) === null || _a === void 0 ? void 0 : _a[key];
271
- if (a === undefined)
272
- return false;
273
- else if (((_d = (_b = p.x.required) === null || _b === void 0 ? void 0 : _b.includes(key)) !== null && _d !== void 0 ? _d : false) === true &&
274
- ((_e = (_c = p.y.required) === null || _c === void 0 ? void 0 : _c.includes(key)) !== null && _e !== void 0 ? _e : false) === false)
275
- return false;
276
- return coverStation({
277
- $defs: p.$defs,
278
- visited: p.visited,
279
- x: a,
280
- y: b,
281
- });
282
- });
283
- };
284
- const coverBoolean = (x, y) => {
285
- var _a, _b;
286
- if (!!((_a = x.enum) === null || _a === void 0 ? void 0 : _a.length))
287
- return !!((_b = y.enum) === null || _b === void 0 ? void 0 : _b.length) && y.enum.every((v) => x.enum.includes(v));
288
- return true;
289
- };
290
- const coverInteger = (x, y) => {
291
- var _a, _b;
292
- if (!!((_a = x.enum) === null || _a === void 0 ? void 0 : _a.length))
293
- return !!((_b = y.enum) === null || _b === void 0 ? void 0 : _b.length) && y.enum.every((v) => x.enum.includes(v));
294
- return OpenApiTypeCheckerBase_1.OpenApiTypeCheckerBase.coverInteger(x, y);
295
- };
296
- const coverNumber = (x, y) => {
297
- var _a, _b;
298
- if (!!((_a = x.enum) === null || _a === void 0 ? void 0 : _a.length))
299
- return !!((_b = y.enum) === null || _b === void 0 ? void 0 : _b.length) && y.enum.every((v) => x.enum.includes(v));
300
- return OpenApiTypeCheckerBase_1.OpenApiTypeCheckerBase.coverNumber(x, y);
301
- };
302
- const coverString = (x, y) => {
303
- var _a, _b;
304
- if (!!((_a = x.enum) === null || _a === void 0 ? void 0 : _a.length))
305
- return !!((_b = y.enum) === null || _b === void 0 ? void 0 : _b.length) && y.enum.every((v) => x.enum.includes(v));
306
- return OpenApiTypeCheckerBase_1.OpenApiTypeCheckerBase.coverString(x, y);
307
- };
308
- const flatSchema = ($defs, schema) => {
309
- schema = escapeReference($defs, schema);
310
- if (LlmTypeChecker.isAnyOf(schema))
311
- return schema.anyOf.map((v) => flatSchema($defs, v)).flat();
312
- return [schema];
313
- };
314
- const escapeReference = ($defs, schema) => LlmTypeChecker.isReference(schema)
315
- ? escapeReference($defs, $defs[schema.$ref.replace("#/$defs/", "")])
316
- : schema;
317
- })(LlmTypeChecker$1 || (LlmTypeChecker.LlmTypeChecker = LlmTypeChecker$1 = {}));
318
-
319
- return LlmTypeChecker;
320
- }
321
-
322
- export { requireLlmTypeChecker as __require };
316
+ export { LlmTypeChecker_2 as LlmTypeChecker, LlmTypeChecker$1 as default };
323
317
  //# sourceMappingURL=LlmTypeChecker2.mjs.map