@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.
- package/lib/converters/LlmSchemaConverter.js +6 -15
- package/lib/converters/LlmSchemaConverter.js.map +1 -1
- package/lib/converters/LlmSchemaConverter.mjs +2 -7
- package/lib/converters/LlmSchemaConverter.mjs.map +1 -1
- package/lib/converters/LlmSchemaConverter2.mjs +440 -451
- package/lib/converters/LlmSchemaConverter2.mjs.map +1 -1
- package/lib/converters/OpenApiConverter.mjs +2 -7
- package/lib/converters/OpenApiConverter.mjs.map +1 -1
- package/lib/converters/OpenApiConverter2.mjs +163 -164
- package/lib/converters/OpenApiConverter2.mjs.map +1 -1
- package/lib/converters/index.mjs +1 -7
- package/lib/converters/index.mjs.map +1 -1
- package/lib/converters/index2.mjs +31 -32
- package/lib/converters/index2.mjs.map +1 -1
- package/lib/converters/internal/LlmDescriptionInverter.mjs +2 -7
- package/lib/converters/internal/LlmDescriptionInverter.mjs.map +1 -1
- package/lib/converters/internal/LlmDescriptionInverter2.mjs +143 -150
- package/lib/converters/internal/LlmDescriptionInverter2.mjs.map +1 -1
- package/lib/converters/internal/LlmParametersComposer.mjs +2 -7
- package/lib/converters/internal/LlmParametersComposer.mjs.map +1 -1
- package/lib/converters/internal/LlmParametersComposer2.mjs +37 -44
- package/lib/converters/internal/LlmParametersComposer2.mjs.map +1 -1
- package/lib/converters/internal/OpenApiConstraintShifter.mjs +2 -7
- package/lib/converters/internal/OpenApiConstraintShifter.mjs.map +1 -1
- package/lib/converters/internal/OpenApiConstraintShifter2.mjs +105 -112
- package/lib/converters/internal/OpenApiConstraintShifter2.mjs.map +1 -1
- package/lib/converters/internal/OpenApiExclusiveEmender.mjs +2 -7
- package/lib/converters/internal/OpenApiExclusiveEmender.mjs.map +1 -1
- package/lib/converters/internal/OpenApiExclusiveEmender2.mjs +32 -40
- package/lib/converters/internal/OpenApiExclusiveEmender2.mjs.map +1 -1
- package/lib/converters/internal/OpenApiV3Downgrader.mjs +2 -7
- package/lib/converters/internal/OpenApiV3Downgrader.mjs.map +1 -1
- package/lib/converters/internal/OpenApiV3Downgrader2.mjs +237 -244
- package/lib/converters/internal/OpenApiV3Downgrader2.mjs.map +1 -1
- package/lib/converters/internal/OpenApiV3Upgrader.mjs +2 -7
- package/lib/converters/internal/OpenApiV3Upgrader.mjs.map +1 -1
- package/lib/converters/internal/OpenApiV3Upgrader2.mjs +300 -305
- package/lib/converters/internal/OpenApiV3Upgrader2.mjs.map +1 -1
- package/lib/converters/internal/OpenApiV3_1Downgrader.mjs +2 -7
- package/lib/converters/internal/OpenApiV3_1Downgrader.mjs.map +1 -1
- package/lib/converters/internal/OpenApiV3_1Downgrader2.mjs +193 -200
- package/lib/converters/internal/OpenApiV3_1Downgrader2.mjs.map +1 -1
- package/lib/converters/internal/OpenApiV3_1Upgrader.mjs +2 -7
- package/lib/converters/internal/OpenApiV3_1Upgrader.mjs.map +1 -1
- package/lib/converters/internal/OpenApiV3_1Upgrader2.mjs +424 -429
- package/lib/converters/internal/OpenApiV3_1Upgrader2.mjs.map +1 -1
- package/lib/converters/internal/OpenApiV3_2Upgrader.mjs +2 -7
- package/lib/converters/internal/OpenApiV3_2Upgrader.mjs.map +1 -1
- package/lib/converters/internal/OpenApiV3_2Upgrader2.mjs +202 -208
- package/lib/converters/internal/OpenApiV3_2Upgrader2.mjs.map +1 -1
- package/lib/converters/internal/SwaggerV2Downgrader.mjs +2 -7
- package/lib/converters/internal/SwaggerV2Downgrader.mjs.map +1 -1
- package/lib/converters/internal/SwaggerV2Downgrader2.mjs +287 -294
- package/lib/converters/internal/SwaggerV2Downgrader2.mjs.map +1 -1
- package/lib/converters/internal/SwaggerV2Upgrader.mjs +2 -7
- package/lib/converters/internal/SwaggerV2Upgrader.mjs.map +1 -1
- package/lib/converters/internal/SwaggerV2Upgrader2.mjs +370 -375
- package/lib/converters/internal/SwaggerV2Upgrader2.mjs.map +1 -1
- package/lib/http/HttpError.mjs +2 -7
- package/lib/http/HttpError.mjs.map +1 -1
- package/lib/http/HttpError2.mjs +69 -77
- package/lib/http/HttpError2.mjs.map +1 -1
- package/lib/http/HttpLlm.mjs +2 -7
- package/lib/http/HttpLlm.mjs.map +1 -1
- package/lib/http/HttpLlm2.mjs +107 -112
- package/lib/http/HttpLlm2.mjs.map +1 -1
- package/lib/http/HttpMigration.mjs +2 -7
- package/lib/http/HttpMigration.mjs.map +1 -1
- package/lib/http/HttpMigration2.mjs +58 -63
- package/lib/http/HttpMigration2.mjs.map +1 -1
- package/lib/http/index.mjs +1 -7
- package/lib/http/index.mjs.map +1 -1
- package/lib/http/index2.mjs +30 -31
- package/lib/http/index2.mjs.map +1 -1
- package/lib/http/internal/HttpLlmApplicationComposer.mjs +2 -7
- package/lib/http/internal/HttpLlmApplicationComposer.mjs.map +1 -1
- package/lib/http/internal/HttpLlmApplicationComposer2.mjs +301 -306
- package/lib/http/internal/HttpLlmApplicationComposer2.mjs.map +1 -1
- package/lib/http/internal/HttpLlmFunctionFetcher.mjs +2 -7
- package/lib/http/internal/HttpLlmFunctionFetcher.mjs.map +1 -1
- package/lib/http/internal/HttpLlmFunctionFetcher2.mjs +26 -33
- package/lib/http/internal/HttpLlmFunctionFetcher2.mjs.map +1 -1
- package/lib/http/internal/HttpMigrateApplicationComposer.mjs +2 -7
- package/lib/http/internal/HttpMigrateApplicationComposer.mjs.map +1 -1
- package/lib/http/internal/HttpMigrateApplicationComposer2.mjs +51 -56
- package/lib/http/internal/HttpMigrateApplicationComposer2.mjs.map +1 -1
- package/lib/http/internal/HttpMigrateRouteAccessor.mjs +2 -7
- package/lib/http/internal/HttpMigrateRouteAccessor.mjs.map +1 -1
- package/lib/http/internal/HttpMigrateRouteAccessor2.mjs +113 -118
- package/lib/http/internal/HttpMigrateRouteAccessor2.mjs.map +1 -1
- package/lib/http/internal/HttpMigrateRouteComposer.mjs +2 -7
- package/lib/http/internal/HttpMigrateRouteComposer.mjs.map +1 -1
- package/lib/http/internal/HttpMigrateRouteComposer2.mjs +376 -381
- package/lib/http/internal/HttpMigrateRouteComposer2.mjs.map +1 -1
- package/lib/http/internal/HttpMigrateRouteFetcher.mjs +2 -7
- package/lib/http/internal/HttpMigrateRouteFetcher.mjs.map +1 -1
- package/lib/http/internal/HttpMigrateRouteFetcher2.mjs +182 -189
- package/lib/http/internal/HttpMigrateRouteFetcher2.mjs.map +1 -1
- package/lib/index.mjs +1 -7
- package/lib/index.mjs.map +1 -1
- package/lib/index2.mjs +33 -33
- package/lib/index2.mjs.map +1 -1
- package/lib/utils/ArrayUtil.mjs +2 -7
- package/lib/utils/ArrayUtil.mjs.map +1 -1
- package/lib/utils/ArrayUtil2.mjs +29 -37
- package/lib/utils/ArrayUtil2.mjs.map +1 -1
- package/lib/utils/LlmJson.mjs +2 -7
- package/lib/utils/LlmJson.mjs.map +1 -1
- package/lib/utils/LlmJson2.mjs +166 -169
- package/lib/utils/LlmJson2.mjs.map +1 -1
- package/lib/utils/MapUtil.mjs +2 -7
- package/lib/utils/MapUtil.mjs.map +1 -1
- package/lib/utils/MapUtil2.mjs +16 -24
- package/lib/utils/MapUtil2.mjs.map +1 -1
- package/lib/utils/NamingConvention.mjs +2 -7
- package/lib/utils/NamingConvention.mjs.map +1 -1
- package/lib/utils/NamingConvention2.mjs +199 -207
- package/lib/utils/NamingConvention2.mjs.map +1 -1
- package/lib/utils/Singleton.d.ts +1 -6
- package/lib/utils/Singleton.js +1 -0
- package/lib/utils/Singleton.js.map +1 -1
- package/lib/utils/Singleton.mjs +2 -7
- package/lib/utils/Singleton.mjs.map +1 -1
- package/lib/utils/Singleton2.mjs +17 -24
- package/lib/utils/Singleton2.mjs.map +1 -1
- package/lib/utils/StringUtil.mjs +2 -7
- package/lib/utils/StringUtil.mjs.map +1 -1
- package/lib/utils/StringUtil2.mjs +14 -22
- package/lib/utils/StringUtil2.mjs.map +1 -1
- package/lib/utils/dedent.mjs +2 -7
- package/lib/utils/dedent.mjs.map +1 -1
- package/lib/utils/dedent2.mjs +50 -58
- package/lib/utils/dedent2.mjs.map +1 -1
- package/lib/utils/index.mjs +1 -7
- package/lib/utils/index.mjs.map +1 -1
- package/lib/utils/index2.mjs +42 -39
- package/lib/utils/index2.mjs.map +1 -1
- package/lib/utils/internal/EndpointUtil.mjs +2 -7
- package/lib/utils/internal/EndpointUtil.mjs.map +1 -1
- package/lib/utils/internal/EndpointUtil2.mjs +39 -46
- package/lib/utils/internal/EndpointUtil2.mjs.map +1 -1
- package/lib/utils/internal/JsonDescriptor.mjs +2 -7
- package/lib/utils/internal/JsonDescriptor.mjs.map +1 -1
- package/lib/utils/internal/JsonDescriptor2.mjs +55 -61
- package/lib/utils/internal/JsonDescriptor2.mjs.map +1 -1
- package/lib/utils/internal/OpenApiTypeCheckerBase.js +23 -14
- package/lib/utils/internal/OpenApiTypeCheckerBase.js.map +1 -1
- package/lib/utils/internal/OpenApiTypeCheckerBase.mjs +2 -7
- package/lib/utils/internal/OpenApiTypeCheckerBase.mjs.map +1 -1
- package/lib/utils/internal/OpenApiTypeCheckerBase2.mjs +539 -536
- package/lib/utils/internal/OpenApiTypeCheckerBase2.mjs.map +1 -1
- package/lib/utils/internal/coerceLlmArguments.js +27 -1
- package/lib/utils/internal/coerceLlmArguments.js.map +1 -1
- package/lib/utils/internal/coerceLlmArguments.mjs +2 -7
- package/lib/utils/internal/coerceLlmArguments.mjs.map +1 -1
- package/lib/utils/internal/coerceLlmArguments2.mjs +278 -258
- package/lib/utils/internal/coerceLlmArguments2.mjs.map +1 -1
- package/lib/utils/internal/parseLenientJson.mjs +2 -7
- package/lib/utils/internal/parseLenientJson.mjs.map +1 -1
- package/lib/utils/internal/parseLenientJson2.mjs +803 -811
- package/lib/utils/internal/parseLenientJson2.mjs.map +1 -1
- package/lib/utils/internal/stringifyValidationFailure.mjs +2 -7
- package/lib/utils/internal/stringifyValidationFailure.mjs.map +1 -1
- package/lib/utils/internal/stringifyValidationFailure2.mjs +310 -316
- package/lib/utils/internal/stringifyValidationFailure2.mjs.map +1 -1
- package/lib/validators/LlmTypeChecker.mjs +2 -7
- package/lib/validators/LlmTypeChecker.mjs.map +1 -1
- package/lib/validators/LlmTypeChecker2.mjs +314 -320
- package/lib/validators/LlmTypeChecker2.mjs.map +1 -1
- package/lib/validators/OpenApiTypeChecker.mjs +2 -7
- package/lib/validators/OpenApiTypeChecker.mjs.map +1 -1
- package/lib/validators/OpenApiTypeChecker2.mjs +209 -216
- package/lib/validators/OpenApiTypeChecker2.mjs.map +1 -1
- package/lib/validators/OpenApiV3TypeChecker.mjs +2 -7
- package/lib/validators/OpenApiV3TypeChecker.mjs.map +1 -1
- package/lib/validators/OpenApiV3TypeChecker2.mjs +30 -38
- package/lib/validators/OpenApiV3TypeChecker2.mjs.map +1 -1
- package/lib/validators/OpenApiV3_1TypeChecker.mjs +2 -7
- package/lib/validators/OpenApiV3_1TypeChecker.mjs.map +1 -1
- package/lib/validators/OpenApiV3_1TypeChecker2.mjs +34 -42
- package/lib/validators/OpenApiV3_1TypeChecker2.mjs.map +1 -1
- package/lib/validators/OpenApiValidator.mjs +2 -7
- package/lib/validators/OpenApiValidator.mjs.map +1 -1
- package/lib/validators/OpenApiValidator2.mjs +73 -80
- package/lib/validators/OpenApiValidator2.mjs.map +1 -1
- package/lib/validators/SwaggerV2TypeChecker.mjs +2 -7
- package/lib/validators/SwaggerV2TypeChecker.mjs.map +1 -1
- package/lib/validators/SwaggerV2TypeChecker2.mjs +31 -39
- package/lib/validators/SwaggerV2TypeChecker2.mjs.map +1 -1
- package/lib/validators/functional/_isBigintString.mjs +2 -7
- package/lib/validators/functional/_isBigintString.mjs.map +1 -1
- package/lib/validators/functional/_isBigintString2.mjs +14 -22
- package/lib/validators/functional/_isBigintString2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatByte.mjs +2 -7
- package/lib/validators/functional/_isFormatByte.mjs.map +1 -1
- package/lib/validators/functional/_isFormatByte2.mjs +10 -18
- package/lib/validators/functional/_isFormatByte2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatDate.mjs +2 -7
- package/lib/validators/functional/_isFormatDate.mjs.map +1 -1
- package/lib/validators/functional/_isFormatDate2.mjs +7 -15
- package/lib/validators/functional/_isFormatDate2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatDateTime.mjs +2 -7
- package/lib/validators/functional/_isFormatDateTime.mjs.map +1 -1
- package/lib/validators/functional/_isFormatDateTime2.mjs +7 -15
- package/lib/validators/functional/_isFormatDateTime2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatDuration.mjs +2 -7
- package/lib/validators/functional/_isFormatDuration.mjs.map +1 -1
- package/lib/validators/functional/_isFormatDuration2.mjs +7 -15
- package/lib/validators/functional/_isFormatDuration2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatEmail.mjs +2 -7
- package/lib/validators/functional/_isFormatEmail.mjs.map +1 -1
- package/lib/validators/functional/_isFormatEmail2.mjs +7 -15
- package/lib/validators/functional/_isFormatEmail2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatHostname.mjs +2 -7
- package/lib/validators/functional/_isFormatHostname.mjs.map +1 -1
- package/lib/validators/functional/_isFormatHostname2.mjs +7 -15
- package/lib/validators/functional/_isFormatHostname2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatIdnEmail.mjs +2 -7
- package/lib/validators/functional/_isFormatIdnEmail.mjs.map +1 -1
- package/lib/validators/functional/_isFormatIdnEmail2.mjs +7 -15
- package/lib/validators/functional/_isFormatIdnEmail2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatIdnHostname.mjs +2 -7
- package/lib/validators/functional/_isFormatIdnHostname.mjs.map +1 -1
- package/lib/validators/functional/_isFormatIdnHostname2.mjs +7 -15
- package/lib/validators/functional/_isFormatIdnHostname2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatIpv4.mjs +2 -7
- package/lib/validators/functional/_isFormatIpv4.mjs.map +1 -1
- package/lib/validators/functional/_isFormatIpv42.mjs +7 -15
- package/lib/validators/functional/_isFormatIpv42.mjs.map +1 -1
- package/lib/validators/functional/_isFormatIpv6.mjs +2 -7
- package/lib/validators/functional/_isFormatIpv6.mjs.map +1 -1
- package/lib/validators/functional/_isFormatIpv62.mjs +7 -15
- package/lib/validators/functional/_isFormatIpv62.mjs.map +1 -1
- package/lib/validators/functional/_isFormatIri.mjs +2 -7
- package/lib/validators/functional/_isFormatIri.mjs.map +1 -1
- package/lib/validators/functional/_isFormatIri2.mjs +7 -15
- package/lib/validators/functional/_isFormatIri2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatIriReference.mjs +2 -7
- package/lib/validators/functional/_isFormatIriReference.mjs.map +1 -1
- package/lib/validators/functional/_isFormatIriReference2.mjs +7 -15
- package/lib/validators/functional/_isFormatIriReference2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatJsonPointer.mjs +2 -7
- package/lib/validators/functional/_isFormatJsonPointer.mjs.map +1 -1
- package/lib/validators/functional/_isFormatJsonPointer2.mjs +7 -15
- package/lib/validators/functional/_isFormatJsonPointer2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatPassword.mjs +2 -7
- package/lib/validators/functional/_isFormatPassword.mjs.map +1 -1
- package/lib/validators/functional/_isFormatPassword2.mjs +6 -14
- package/lib/validators/functional/_isFormatPassword2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatRegex.mjs +2 -7
- package/lib/validators/functional/_isFormatRegex.mjs.map +1 -1
- package/lib/validators/functional/_isFormatRegex2.mjs +14 -22
- package/lib/validators/functional/_isFormatRegex2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatRelativeJsonPointer.mjs +2 -7
- package/lib/validators/functional/_isFormatRelativeJsonPointer.mjs.map +1 -1
- package/lib/validators/functional/_isFormatRelativeJsonPointer2.mjs +7 -15
- package/lib/validators/functional/_isFormatRelativeJsonPointer2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatTime.mjs +2 -7
- package/lib/validators/functional/_isFormatTime.mjs.map +1 -1
- package/lib/validators/functional/_isFormatTime2.mjs +7 -15
- package/lib/validators/functional/_isFormatTime2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatUri.mjs +2 -7
- package/lib/validators/functional/_isFormatUri.mjs.map +1 -1
- package/lib/validators/functional/_isFormatUri2.mjs +8 -16
- package/lib/validators/functional/_isFormatUri2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatUriReference.mjs +2 -7
- package/lib/validators/functional/_isFormatUriReference.mjs.map +1 -1
- package/lib/validators/functional/_isFormatUriReference2.mjs +7 -15
- package/lib/validators/functional/_isFormatUriReference2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatUriTemplate.mjs +2 -7
- package/lib/validators/functional/_isFormatUriTemplate.mjs.map +1 -1
- package/lib/validators/functional/_isFormatUriTemplate2.mjs +7 -15
- package/lib/validators/functional/_isFormatUriTemplate2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatUrl.mjs +2 -7
- package/lib/validators/functional/_isFormatUrl.mjs.map +1 -1
- package/lib/validators/functional/_isFormatUrl2.mjs +7 -15
- package/lib/validators/functional/_isFormatUrl2.mjs.map +1 -1
- package/lib/validators/functional/_isFormatUuid.mjs +2 -7
- package/lib/validators/functional/_isFormatUuid.mjs.map +1 -1
- package/lib/validators/functional/_isFormatUuid2.mjs +7 -15
- package/lib/validators/functional/_isFormatUuid2.mjs.map +1 -1
- package/lib/validators/functional/_isUniqueItems.mjs +2 -7
- package/lib/validators/functional/_isUniqueItems.mjs.map +1 -1
- package/lib/validators/functional/_isUniqueItems2.mjs +140 -148
- package/lib/validators/functional/_isUniqueItems2.mjs.map +1 -1
- package/lib/validators/index.mjs +1 -7
- package/lib/validators/index.mjs.map +1 -1
- package/lib/validators/index2.mjs +42 -40
- package/lib/validators/index2.mjs.map +1 -1
- package/lib/validators/internal/IOpenApiValidatorContext.mjs +2 -7
- package/lib/validators/internal/IOpenApiValidatorContext.mjs.map +1 -1
- package/lib/validators/internal/IOpenApiValidatorContext2.mjs +2 -10
- package/lib/validators/internal/IOpenApiValidatorContext2.mjs.map +1 -1
- package/lib/validators/internal/OpenApiArrayValidator.mjs +2 -7
- package/lib/validators/internal/OpenApiArrayValidator.mjs.map +1 -1
- package/lib/validators/internal/OpenApiArrayValidator2.mjs +36 -42
- package/lib/validators/internal/OpenApiArrayValidator2.mjs.map +1 -1
- package/lib/validators/internal/OpenApiBooleanValidator.mjs +2 -7
- package/lib/validators/internal/OpenApiBooleanValidator.mjs.map +1 -1
- package/lib/validators/internal/OpenApiBooleanValidator2.mjs +10 -18
- package/lib/validators/internal/OpenApiBooleanValidator2.mjs.map +1 -1
- package/lib/validators/internal/OpenApiConstantValidator.mjs +2 -7
- package/lib/validators/internal/OpenApiConstantValidator.mjs.map +1 -1
- package/lib/validators/internal/OpenApiConstantValidator2.mjs +10 -18
- package/lib/validators/internal/OpenApiConstantValidator2.mjs.map +1 -1
- package/lib/validators/internal/OpenApiIntegerValidator.mjs +2 -7
- package/lib/validators/internal/OpenApiIntegerValidator.mjs.map +1 -1
- package/lib/validators/internal/OpenApiIntegerValidator2.mjs +33 -41
- package/lib/validators/internal/OpenApiIntegerValidator2.mjs.map +1 -1
- package/lib/validators/internal/OpenApiNumberValidator.mjs +2 -7
- package/lib/validators/internal/OpenApiNumberValidator.mjs.map +1 -1
- package/lib/validators/internal/OpenApiNumberValidator2.mjs +33 -41
- package/lib/validators/internal/OpenApiNumberValidator2.mjs.map +1 -1
- package/lib/validators/internal/OpenApiObjectValidator.js +2 -3
- package/lib/validators/internal/OpenApiObjectValidator.js.map +1 -1
- package/lib/validators/internal/OpenApiObjectValidator.mjs +2 -7
- package/lib/validators/internal/OpenApiObjectValidator.mjs.map +1 -1
- package/lib/validators/internal/OpenApiObjectValidator2.mjs +55 -62
- package/lib/validators/internal/OpenApiObjectValidator2.mjs.map +1 -1
- package/lib/validators/internal/OpenApiOneOfValidator.mjs +2 -7
- package/lib/validators/internal/OpenApiOneOfValidator.mjs.map +1 -1
- package/lib/validators/internal/OpenApiOneOfValidator2.mjs +188 -193
- package/lib/validators/internal/OpenApiOneOfValidator2.mjs.map +1 -1
- package/lib/validators/internal/OpenApiSchemaNamingRule.mjs +2 -7
- package/lib/validators/internal/OpenApiSchemaNamingRule.mjs.map +1 -1
- package/lib/validators/internal/OpenApiSchemaNamingRule2.mjs +124 -131
- package/lib/validators/internal/OpenApiSchemaNamingRule2.mjs.map +1 -1
- package/lib/validators/internal/OpenApiStationValidator.mjs +2 -7
- package/lib/validators/internal/OpenApiStationValidator.mjs.map +1 -1
- package/lib/validators/internal/OpenApiStationValidator2.mjs +86 -83
- package/lib/validators/internal/OpenApiStationValidator2.mjs.map +1 -1
- package/lib/validators/internal/OpenApiStringValidator.mjs +2 -7
- package/lib/validators/internal/OpenApiStringValidator.mjs.map +1 -1
- package/lib/validators/internal/OpenApiStringValidator2.mjs +115 -102
- package/lib/validators/internal/OpenApiStringValidator2.mjs.map +1 -1
- package/lib/validators/internal/OpenApiTupleValidator.mjs +2 -7
- package/lib/validators/internal/OpenApiTupleValidator.mjs.map +1 -1
- package/lib/validators/internal/OpenApiTupleValidator2.mjs +33 -40
- package/lib/validators/internal/OpenApiTupleValidator2.mjs.map +1 -1
- package/package.json +4 -4
- package/src/converters/LlmSchemaConverter.ts +1 -8
- package/src/utils/Singleton.ts +1 -0
- package/src/utils/internal/OpenApiTypeCheckerBase.ts +12 -3
- package/src/utils/internal/coerceLlmArguments.ts +27 -1
- package/src/validators/internal/OpenApiObjectValidator.ts +1 -2
package/lib/utils/LlmJson2.mjs
CHANGED
|
@@ -1,172 +1,169 @@
|
|
|
1
|
-
import { __exports as LlmJson } from '../_virtual/LlmJson.mjs';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { __exports as LlmJson$1 } from '../_virtual/LlmJson.mjs';
|
|
2
|
+
import '../converters/index2.mjs';
|
|
3
|
+
import '../validators/index2.mjs';
|
|
4
|
+
import './internal/coerceLlmArguments2.mjs';
|
|
5
|
+
import './internal/parseLenientJson2.mjs';
|
|
6
|
+
import './internal/stringifyValidationFailure2.mjs';
|
|
7
|
+
import { __exports as coerceLlmArguments } from '../_virtual/coerceLlmArguments.mjs';
|
|
8
|
+
import { __exports as parseLenientJson } from '../_virtual/parseLenientJson.mjs';
|
|
9
|
+
import { __exports as stringifyValidationFailure } from '../_virtual/stringifyValidationFailure.mjs';
|
|
10
|
+
import { __exports as converters } from '../_virtual/index2.mjs';
|
|
11
|
+
import { __exports as validators } from '../_virtual/index5.mjs';
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
Object.defineProperty(LlmJson$1, "__esModule", { value: true });
|
|
14
|
+
var LlmJson_2 = LlmJson$1.LlmJson = void 0;
|
|
15
|
+
const converters_1 = converters;
|
|
16
|
+
const validators_1 = validators;
|
|
17
|
+
const coerceLlmArguments_1 = coerceLlmArguments;
|
|
18
|
+
const parseLenientJson_1 = parseLenientJson;
|
|
19
|
+
const stringifyValidationFailure_1 = stringifyValidationFailure;
|
|
20
|
+
/**
|
|
21
|
+
* JSON utilities for LLM function calling.
|
|
22
|
+
*
|
|
23
|
+
* - {@link LlmJson.parse}: Lenient JSON parser for incomplete/malformed JSON
|
|
24
|
+
* - {@link LlmJson.stringify}: Format validation errors for LLM feedback
|
|
25
|
+
* - {@link LlmJson.validate}: Create a reusable validator from schema
|
|
26
|
+
*
|
|
27
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
28
|
+
*/
|
|
29
|
+
var LlmJson;
|
|
30
|
+
(function (LlmJson) {
|
|
31
|
+
/**
|
|
32
|
+
* Coerce LLM arguments to match expected schema types.
|
|
33
|
+
*
|
|
34
|
+
* LLMs often return values with incorrect types (e.g., numbers as strings).
|
|
35
|
+
* This function recursively coerces values based on the schema:
|
|
36
|
+
*
|
|
37
|
+
* - `"42"` → `42` (when schema expects number)
|
|
38
|
+
* - `"true"` → `true` (when schema expects boolean)
|
|
39
|
+
* - `"null"` → `null` (when schema expects null)
|
|
40
|
+
* - `"{...}"` → `{...}` (when schema expects object)
|
|
41
|
+
* - `"[...]"` → `[...]` (when schema expects array)
|
|
42
|
+
*
|
|
43
|
+
* Use this when SDK provides already-parsed objects but values may have wrong
|
|
44
|
+
* types. For raw JSON strings, use {@link parse} instead.
|
|
45
|
+
*
|
|
46
|
+
* @param input Parsed arguments object from LLM
|
|
47
|
+
* @param parameters LLM function parameters schema for type coercion
|
|
48
|
+
* @returns Coerced arguments with corrected types
|
|
49
|
+
*/
|
|
50
|
+
function coerce(input, parameters) {
|
|
51
|
+
return (0, coerceLlmArguments_1.coerceLlmArguments)(input, parameters);
|
|
52
|
+
}
|
|
53
|
+
LlmJson.coerce = coerce;
|
|
54
|
+
/**
|
|
55
|
+
* Parse lenient JSON with optional schema-based coercion.
|
|
56
|
+
*
|
|
57
|
+
* Handles incomplete/malformed JSON commonly produced by LLMs:
|
|
58
|
+
*
|
|
59
|
+
* - Unclosed brackets, strings, trailing commas
|
|
60
|
+
* - JavaScript-style comments (`//` and multi-line)
|
|
61
|
+
* - Unquoted object keys, incomplete keywords (`tru`, `fal`, `nul`)
|
|
62
|
+
* - Markdown code block extraction, junk prefix skipping
|
|
63
|
+
*
|
|
64
|
+
* When `parameters` schema is provided, also coerces double-stringified
|
|
65
|
+
* values: `"42"` → `42`, `"true"` → `true`, `"{...}"` → `{...}` based on
|
|
66
|
+
* expected types.
|
|
67
|
+
*
|
|
68
|
+
* Type validation is NOT performed - use {@link ILlmFunction.validate}.
|
|
69
|
+
*
|
|
70
|
+
* @param input Raw JSON string (potentially incomplete or malformed)
|
|
71
|
+
* @param parameters Optional LLM parameters schema for type coercion
|
|
72
|
+
* @returns Parse result with data on success, or partial data with errors
|
|
73
|
+
*/
|
|
74
|
+
function parse(input, parameters) {
|
|
75
|
+
const result = (0, parseLenientJson_1.parseLenientJson)(input);
|
|
76
|
+
// Apply schema-based coercion if parameters provided and parsing succeeded
|
|
77
|
+
if (parameters !== undefined && result.success) {
|
|
78
|
+
return {
|
|
79
|
+
success: true,
|
|
80
|
+
data: (0, coerceLlmArguments_1.coerceLlmArguments)(result.data, parameters),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
LlmJson.parse = parse;
|
|
86
|
+
/**
|
|
87
|
+
* Format validation failure for LLM auto-correction feedback.
|
|
88
|
+
*
|
|
89
|
+
* When LLM generates invalid function call arguments, this produces annotated
|
|
90
|
+
* JSON with inline `// ❌` error comments at each invalid property. The output
|
|
91
|
+
* is wrapped in a markdown code block so that LLM can understand and correct
|
|
92
|
+
* its mistakes in the next turn.
|
|
93
|
+
*
|
|
94
|
+
* Below is an example of the output format:
|
|
95
|
+
*
|
|
96
|
+
* ```json
|
|
97
|
+
* {
|
|
98
|
+
* "name": "John",
|
|
99
|
+
* "age": "twenty", // ❌ [{"path":"$input.age","expected":"number & Type<\"uint32\">"}]
|
|
100
|
+
* "email": "not-an-email", // ❌ [{"path":"$input.email","expected":"string & Format<\"email\">"}]
|
|
101
|
+
* "hobbies": "reading" // ❌ [{"path":"$input.hobbies","expected":"Array<string>"}]
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @param failure Validation failure from {@link ILlmFunction.validate}
|
|
106
|
+
*/
|
|
107
|
+
function stringify(failure) {
|
|
108
|
+
return (0, stringifyValidationFailure_1.stringifyValidationFailure)(failure);
|
|
109
|
+
}
|
|
110
|
+
LlmJson.stringify = stringify;
|
|
111
|
+
/**
|
|
112
|
+
* Create a reusable validator from LLM parameters schema.
|
|
113
|
+
*
|
|
114
|
+
* When validation fails, format the failure with {@link stringify} for LLM
|
|
115
|
+
* auto-correction feedback.
|
|
116
|
+
*
|
|
117
|
+
* @param parameters LLM function parameters schema
|
|
118
|
+
* @param equals If `true`, reject extraneous properties not defined in the
|
|
119
|
+
* schema. Otherwise, extra properties are ignored.
|
|
120
|
+
* @returns Validator function that checks data against the schema
|
|
121
|
+
*/
|
|
122
|
+
function validate(parameters, equals) {
|
|
123
|
+
const components = {
|
|
124
|
+
schemas: {},
|
|
125
|
+
};
|
|
126
|
+
const schema = converters_1.LlmSchemaConverter.invert({
|
|
127
|
+
components,
|
|
128
|
+
schema: parameters,
|
|
129
|
+
$defs: parameters.$defs,
|
|
130
|
+
});
|
|
131
|
+
return validators_1.OpenApiValidator.create({
|
|
132
|
+
components,
|
|
133
|
+
schema,
|
|
134
|
+
required: true,
|
|
135
|
+
equals,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
LlmJson.validate = validate;
|
|
139
|
+
/**
|
|
140
|
+
* Convert LLM parameters schema to structured output interface.
|
|
141
|
+
*
|
|
142
|
+
* Creates an {@link ILlmStructuredOutput} containing everything needed for
|
|
143
|
+
* handling LLM structured outputs: the parameters schema for prompting, and
|
|
144
|
+
* functions for parsing, coercing, and validating responses.
|
|
145
|
+
*
|
|
146
|
+
* This is useful when you have a parameters schema (e.g., from
|
|
147
|
+
* `typia.llm.parameters()`) and need the full structured output interface
|
|
148
|
+
* with all utility functions.
|
|
149
|
+
*
|
|
150
|
+
* @template T The expected output type
|
|
151
|
+
* @param parameters LLM parameters schema
|
|
152
|
+
* @param equals If `true`, reject extraneous properties not defined in the
|
|
153
|
+
* schema during validation. Otherwise, extra properties are ignored.
|
|
154
|
+
* @returns Structured output interface with parse, coerce, and validate
|
|
155
|
+
*/
|
|
156
|
+
function structuredOutput(parameters, equals) {
|
|
157
|
+
const validator = validate(parameters, equals);
|
|
158
|
+
return {
|
|
159
|
+
parameters,
|
|
160
|
+
parse: (str) => parse(str, parameters),
|
|
161
|
+
coerce: (input) => coerce(input, parameters),
|
|
162
|
+
validate: (input) => validator(input),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
LlmJson.structuredOutput = structuredOutput;
|
|
166
|
+
})(LlmJson || (LlmJson_2 = LlmJson$1.LlmJson = LlmJson = {}));
|
|
9
167
|
|
|
10
|
-
|
|
11
|
-
if (hasRequiredLlmJson) return LlmJson;
|
|
12
|
-
hasRequiredLlmJson = 1;
|
|
13
|
-
Object.defineProperty(LlmJson, "__esModule", { value: true });
|
|
14
|
-
LlmJson.LlmJson = void 0;
|
|
15
|
-
const converters_1 = requireConverters();
|
|
16
|
-
const validators_1 = requireValidators();
|
|
17
|
-
const coerceLlmArguments_1 = requireCoerceLlmArguments();
|
|
18
|
-
const parseLenientJson_1 = requireParseLenientJson();
|
|
19
|
-
const stringifyValidationFailure_1 = requireStringifyValidationFailure();
|
|
20
|
-
/**
|
|
21
|
-
* JSON utilities for LLM function calling.
|
|
22
|
-
*
|
|
23
|
-
* - {@link LlmJson.parse}: Lenient JSON parser for incomplete/malformed JSON
|
|
24
|
-
* - {@link LlmJson.stringify}: Format validation errors for LLM feedback
|
|
25
|
-
* - {@link LlmJson.validate}: Create a reusable validator from schema
|
|
26
|
-
*
|
|
27
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
28
|
-
*/
|
|
29
|
-
var LlmJson$1;
|
|
30
|
-
(function (LlmJson) {
|
|
31
|
-
/**
|
|
32
|
-
* Coerce LLM arguments to match expected schema types.
|
|
33
|
-
*
|
|
34
|
-
* LLMs often return values with incorrect types (e.g., numbers as strings).
|
|
35
|
-
* This function recursively coerces values based on the schema:
|
|
36
|
-
*
|
|
37
|
-
* - `"42"` → `42` (when schema expects number)
|
|
38
|
-
* - `"true"` → `true` (when schema expects boolean)
|
|
39
|
-
* - `"null"` → `null` (when schema expects null)
|
|
40
|
-
* - `"{...}"` → `{...}` (when schema expects object)
|
|
41
|
-
* - `"[...]"` → `[...]` (when schema expects array)
|
|
42
|
-
*
|
|
43
|
-
* Use this when SDK provides already-parsed objects but values may have wrong
|
|
44
|
-
* types. For raw JSON strings, use {@link parse} instead.
|
|
45
|
-
*
|
|
46
|
-
* @param input Parsed arguments object from LLM
|
|
47
|
-
* @param parameters LLM function parameters schema for type coercion
|
|
48
|
-
* @returns Coerced arguments with corrected types
|
|
49
|
-
*/
|
|
50
|
-
function coerce(input, parameters) {
|
|
51
|
-
return (0, coerceLlmArguments_1.coerceLlmArguments)(input, parameters);
|
|
52
|
-
}
|
|
53
|
-
LlmJson.coerce = coerce;
|
|
54
|
-
/**
|
|
55
|
-
* Parse lenient JSON with optional schema-based coercion.
|
|
56
|
-
*
|
|
57
|
-
* Handles incomplete/malformed JSON commonly produced by LLMs:
|
|
58
|
-
*
|
|
59
|
-
* - Unclosed brackets, strings, trailing commas
|
|
60
|
-
* - JavaScript-style comments (`//` and multi-line)
|
|
61
|
-
* - Unquoted object keys, incomplete keywords (`tru`, `fal`, `nul`)
|
|
62
|
-
* - Markdown code block extraction, junk prefix skipping
|
|
63
|
-
*
|
|
64
|
-
* When `parameters` schema is provided, also coerces double-stringified
|
|
65
|
-
* values: `"42"` → `42`, `"true"` → `true`, `"{...}"` → `{...}` based on
|
|
66
|
-
* expected types.
|
|
67
|
-
*
|
|
68
|
-
* Type validation is NOT performed - use {@link ILlmFunction.validate}.
|
|
69
|
-
*
|
|
70
|
-
* @param input Raw JSON string (potentially incomplete or malformed)
|
|
71
|
-
* @param parameters Optional LLM parameters schema for type coercion
|
|
72
|
-
* @returns Parse result with data on success, or partial data with errors
|
|
73
|
-
*/
|
|
74
|
-
function parse(input, parameters) {
|
|
75
|
-
const result = (0, parseLenientJson_1.parseLenientJson)(input);
|
|
76
|
-
// Apply schema-based coercion if parameters provided and parsing succeeded
|
|
77
|
-
if (parameters !== undefined && result.success) {
|
|
78
|
-
return {
|
|
79
|
-
success: true,
|
|
80
|
-
data: (0, coerceLlmArguments_1.coerceLlmArguments)(result.data, parameters),
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
return result;
|
|
84
|
-
}
|
|
85
|
-
LlmJson.parse = parse;
|
|
86
|
-
/**
|
|
87
|
-
* Format validation failure for LLM auto-correction feedback.
|
|
88
|
-
*
|
|
89
|
-
* When LLM generates invalid function call arguments, this produces annotated
|
|
90
|
-
* JSON with inline `// ❌` error comments at each invalid property. The output
|
|
91
|
-
* is wrapped in a markdown code block so that LLM can understand and correct
|
|
92
|
-
* its mistakes in the next turn.
|
|
93
|
-
*
|
|
94
|
-
* Below is an example of the output format:
|
|
95
|
-
*
|
|
96
|
-
* ```json
|
|
97
|
-
* {
|
|
98
|
-
* "name": "John",
|
|
99
|
-
* "age": "twenty", // ❌ [{"path":"$input.age","expected":"number & Type<\"uint32\">"}]
|
|
100
|
-
* "email": "not-an-email", // ❌ [{"path":"$input.email","expected":"string & Format<\"email\">"}]
|
|
101
|
-
* "hobbies": "reading" // ❌ [{"path":"$input.hobbies","expected":"Array<string>"}]
|
|
102
|
-
* }
|
|
103
|
-
* ```
|
|
104
|
-
*
|
|
105
|
-
* @param failure Validation failure from {@link ILlmFunction.validate}
|
|
106
|
-
*/
|
|
107
|
-
function stringify(failure) {
|
|
108
|
-
return (0, stringifyValidationFailure_1.stringifyValidationFailure)(failure);
|
|
109
|
-
}
|
|
110
|
-
LlmJson.stringify = stringify;
|
|
111
|
-
/**
|
|
112
|
-
* Create a reusable validator from LLM parameters schema.
|
|
113
|
-
*
|
|
114
|
-
* When validation fails, format the failure with {@link stringify} for LLM
|
|
115
|
-
* auto-correction feedback.
|
|
116
|
-
*
|
|
117
|
-
* @param parameters LLM function parameters schema
|
|
118
|
-
* @param equals If `true`, reject extraneous properties not defined in the
|
|
119
|
-
* schema. Otherwise, extra properties are ignored.
|
|
120
|
-
* @returns Validator function that checks data against the schema
|
|
121
|
-
*/
|
|
122
|
-
function validate(parameters, equals) {
|
|
123
|
-
const components = {
|
|
124
|
-
schemas: {},
|
|
125
|
-
};
|
|
126
|
-
const schema = converters_1.LlmSchemaConverter.invert({
|
|
127
|
-
components,
|
|
128
|
-
schema: parameters,
|
|
129
|
-
$defs: parameters.$defs,
|
|
130
|
-
});
|
|
131
|
-
return validators_1.OpenApiValidator.create({
|
|
132
|
-
components,
|
|
133
|
-
schema,
|
|
134
|
-
required: true,
|
|
135
|
-
equals,
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
LlmJson.validate = validate;
|
|
139
|
-
/**
|
|
140
|
-
* Convert LLM parameters schema to structured output interface.
|
|
141
|
-
*
|
|
142
|
-
* Creates an {@link ILlmStructuredOutput} containing everything needed for
|
|
143
|
-
* handling LLM structured outputs: the parameters schema for prompting, and
|
|
144
|
-
* functions for parsing, coercing, and validating responses.
|
|
145
|
-
*
|
|
146
|
-
* This is useful when you have a parameters schema (e.g., from
|
|
147
|
-
* `typia.llm.parameters()`) and need the full structured output interface
|
|
148
|
-
* with all utility functions.
|
|
149
|
-
*
|
|
150
|
-
* @template T The expected output type
|
|
151
|
-
* @param parameters LLM parameters schema
|
|
152
|
-
* @param equals If `true`, reject extraneous properties not defined in the
|
|
153
|
-
* schema during validation. Otherwise, extra properties are ignored.
|
|
154
|
-
* @returns Structured output interface with parse, coerce, and validate
|
|
155
|
-
*/
|
|
156
|
-
function structuredOutput(parameters, equals) {
|
|
157
|
-
const validator = validate(parameters, equals);
|
|
158
|
-
return {
|
|
159
|
-
parameters,
|
|
160
|
-
parse: (str) => parse(str, parameters),
|
|
161
|
-
coerce: (input) => coerce(input, parameters),
|
|
162
|
-
validate: (input) => validator(input),
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
LlmJson.structuredOutput = structuredOutput;
|
|
166
|
-
})(LlmJson$1 || (LlmJson.LlmJson = LlmJson$1 = {}));
|
|
167
|
-
|
|
168
|
-
return LlmJson;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export { requireLlmJson as __require };
|
|
168
|
+
export { LlmJson_2 as LlmJson, LlmJson$1 as default };
|
|
172
169
|
//# sourceMappingURL=LlmJson2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LlmJson2.mjs","sources":["LlmJson.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LlmJson = void 0;\nconst converters_1 = require(\"../converters\");\nconst validators_1 = require(\"../validators\");\nconst coerceLlmArguments_1 = require(\"./internal/coerceLlmArguments\");\nconst parseLenientJson_1 = require(\"./internal/parseLenientJson\");\nconst stringifyValidationFailure_1 = require(\"./internal/stringifyValidationFailure\");\n/**\n * JSON utilities for LLM function calling.\n *\n * - {@link LlmJson.parse}: Lenient JSON parser for incomplete/malformed JSON\n * - {@link LlmJson.stringify}: Format validation errors for LLM feedback\n * - {@link LlmJson.validate}: Create a reusable validator from schema\n *\n * @author Jeongho Nam - https://github.com/samchon\n */\nvar LlmJson;\n(function (LlmJson) {\n /**\n * Coerce LLM arguments to match expected schema types.\n *\n * LLMs often return values with incorrect types (e.g., numbers as strings).\n * This function recursively coerces values based on the schema:\n *\n * - `\"42\"` → `42` (when schema expects number)\n * - `\"true\"` → `true` (when schema expects boolean)\n * - `\"null\"` → `null` (when schema expects null)\n * - `\"{...}\"` → `{...}` (when schema expects object)\n * - `\"[...]\"` → `[...]` (when schema expects array)\n *\n * Use this when SDK provides already-parsed objects but values may have wrong\n * types. For raw JSON strings, use {@link parse} instead.\n *\n * @param input Parsed arguments object from LLM\n * @param parameters LLM function parameters schema for type coercion\n * @returns Coerced arguments with corrected types\n */\n function coerce(input, parameters) {\n return (0, coerceLlmArguments_1.coerceLlmArguments)(input, parameters);\n }\n LlmJson.coerce = coerce;\n /**\n * Parse lenient JSON with optional schema-based coercion.\n *\n * Handles incomplete/malformed JSON commonly produced by LLMs:\n *\n * - Unclosed brackets, strings, trailing commas\n * - JavaScript-style comments (`//` and multi-line)\n * - Unquoted object keys, incomplete keywords (`tru`, `fal`, `nul`)\n * - Markdown code block extraction, junk prefix skipping\n *\n * When `parameters` schema is provided, also coerces double-stringified\n * values: `\"42\"` → `42`, `\"true\"` → `true`, `\"{...}\"` → `{...}` based on\n * expected types.\n *\n * Type validation is NOT performed - use {@link ILlmFunction.validate}.\n *\n * @param input Raw JSON string (potentially incomplete or malformed)\n * @param parameters Optional LLM parameters schema for type coercion\n * @returns Parse result with data on success, or partial data with errors\n */\n function parse(input, parameters) {\n const result = (0, parseLenientJson_1.parseLenientJson)(input);\n // Apply schema-based coercion if parameters provided and parsing succeeded\n if (parameters !== undefined && result.success) {\n return {\n success: true,\n data: (0, coerceLlmArguments_1.coerceLlmArguments)(result.data, parameters),\n };\n }\n return result;\n }\n LlmJson.parse = parse;\n /**\n * Format validation failure for LLM auto-correction feedback.\n *\n * When LLM generates invalid function call arguments, this produces annotated\n * JSON with inline `// ❌` error comments at each invalid property. The output\n * is wrapped in a markdown code block so that LLM can understand and correct\n * its mistakes in the next turn.\n *\n * Below is an example of the output format:\n *\n * ```json\n * {\n * \"name\": \"John\",\n * \"age\": \"twenty\", // ❌ [{\"path\":\"$input.age\",\"expected\":\"number & Type<\\\"uint32\\\">\"}]\n * \"email\": \"not-an-email\", // ❌ [{\"path\":\"$input.email\",\"expected\":\"string & Format<\\\"email\\\">\"}]\n * \"hobbies\": \"reading\" // ❌ [{\"path\":\"$input.hobbies\",\"expected\":\"Array<string>\"}]\n * }\n * ```\n *\n * @param failure Validation failure from {@link ILlmFunction.validate}\n */\n function stringify(failure) {\n return (0, stringifyValidationFailure_1.stringifyValidationFailure)(failure);\n }\n LlmJson.stringify = stringify;\n /**\n * Create a reusable validator from LLM parameters schema.\n *\n * When validation fails, format the failure with {@link stringify} for LLM\n * auto-correction feedback.\n *\n * @param parameters LLM function parameters schema\n * @param equals If `true`, reject extraneous properties not defined in the\n * schema. Otherwise, extra properties are ignored.\n * @returns Validator function that checks data against the schema\n */\n function validate(parameters, equals) {\n const components = {\n schemas: {},\n };\n const schema = converters_1.LlmSchemaConverter.invert({\n components,\n schema: parameters,\n $defs: parameters.$defs,\n });\n return validators_1.OpenApiValidator.create({\n components,\n schema,\n required: true,\n equals,\n });\n }\n LlmJson.validate = validate;\n /**\n * Convert LLM parameters schema to structured output interface.\n *\n * Creates an {@link ILlmStructuredOutput} containing everything needed for\n * handling LLM structured outputs: the parameters schema for prompting, and\n * functions for parsing, coercing, and validating responses.\n *\n * This is useful when you have a parameters schema (e.g., from\n * `typia.llm.parameters()`) and need the full structured output interface\n * with all utility functions.\n *\n * @template T The expected output type\n * @param parameters LLM parameters schema\n * @param equals If `true`, reject extraneous properties not defined in the\n * schema during validation. Otherwise, extra properties are ignored.\n * @returns Structured output interface with parse, coerce, and validate\n */\n function structuredOutput(parameters, equals) {\n const validator = validate(parameters, equals);\n return {\n parameters,\n parse: (str) => parse(str, parameters),\n coerce: (input) => coerce(input, parameters),\n validate: (input) => validator(input),\n };\n }\n LlmJson.structuredOutput = structuredOutput;\n})(LlmJson || (exports.LlmJson = LlmJson = {}));\n//# sourceMappingURL=LlmJson.js.map"],"names":["LlmJson_1","require$$0","require$$1","require$$2","require$$3","require$$4"
|
|
1
|
+
{"version":3,"file":"LlmJson2.mjs","sources":["LlmJson.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LlmJson = void 0;\nconst converters_1 = require(\"../converters\");\nconst validators_1 = require(\"../validators\");\nconst coerceLlmArguments_1 = require(\"./internal/coerceLlmArguments\");\nconst parseLenientJson_1 = require(\"./internal/parseLenientJson\");\nconst stringifyValidationFailure_1 = require(\"./internal/stringifyValidationFailure\");\n/**\n * JSON utilities for LLM function calling.\n *\n * - {@link LlmJson.parse}: Lenient JSON parser for incomplete/malformed JSON\n * - {@link LlmJson.stringify}: Format validation errors for LLM feedback\n * - {@link LlmJson.validate}: Create a reusable validator from schema\n *\n * @author Jeongho Nam - https://github.com/samchon\n */\nvar LlmJson;\n(function (LlmJson) {\n /**\n * Coerce LLM arguments to match expected schema types.\n *\n * LLMs often return values with incorrect types (e.g., numbers as strings).\n * This function recursively coerces values based on the schema:\n *\n * - `\"42\"` → `42` (when schema expects number)\n * - `\"true\"` → `true` (when schema expects boolean)\n * - `\"null\"` → `null` (when schema expects null)\n * - `\"{...}\"` → `{...}` (when schema expects object)\n * - `\"[...]\"` → `[...]` (when schema expects array)\n *\n * Use this when SDK provides already-parsed objects but values may have wrong\n * types. For raw JSON strings, use {@link parse} instead.\n *\n * @param input Parsed arguments object from LLM\n * @param parameters LLM function parameters schema for type coercion\n * @returns Coerced arguments with corrected types\n */\n function coerce(input, parameters) {\n return (0, coerceLlmArguments_1.coerceLlmArguments)(input, parameters);\n }\n LlmJson.coerce = coerce;\n /**\n * Parse lenient JSON with optional schema-based coercion.\n *\n * Handles incomplete/malformed JSON commonly produced by LLMs:\n *\n * - Unclosed brackets, strings, trailing commas\n * - JavaScript-style comments (`//` and multi-line)\n * - Unquoted object keys, incomplete keywords (`tru`, `fal`, `nul`)\n * - Markdown code block extraction, junk prefix skipping\n *\n * When `parameters` schema is provided, also coerces double-stringified\n * values: `\"42\"` → `42`, `\"true\"` → `true`, `\"{...}\"` → `{...}` based on\n * expected types.\n *\n * Type validation is NOT performed - use {@link ILlmFunction.validate}.\n *\n * @param input Raw JSON string (potentially incomplete or malformed)\n * @param parameters Optional LLM parameters schema for type coercion\n * @returns Parse result with data on success, or partial data with errors\n */\n function parse(input, parameters) {\n const result = (0, parseLenientJson_1.parseLenientJson)(input);\n // Apply schema-based coercion if parameters provided and parsing succeeded\n if (parameters !== undefined && result.success) {\n return {\n success: true,\n data: (0, coerceLlmArguments_1.coerceLlmArguments)(result.data, parameters),\n };\n }\n return result;\n }\n LlmJson.parse = parse;\n /**\n * Format validation failure for LLM auto-correction feedback.\n *\n * When LLM generates invalid function call arguments, this produces annotated\n * JSON with inline `// ❌` error comments at each invalid property. The output\n * is wrapped in a markdown code block so that LLM can understand and correct\n * its mistakes in the next turn.\n *\n * Below is an example of the output format:\n *\n * ```json\n * {\n * \"name\": \"John\",\n * \"age\": \"twenty\", // ❌ [{\"path\":\"$input.age\",\"expected\":\"number & Type<\\\"uint32\\\">\"}]\n * \"email\": \"not-an-email\", // ❌ [{\"path\":\"$input.email\",\"expected\":\"string & Format<\\\"email\\\">\"}]\n * \"hobbies\": \"reading\" // ❌ [{\"path\":\"$input.hobbies\",\"expected\":\"Array<string>\"}]\n * }\n * ```\n *\n * @param failure Validation failure from {@link ILlmFunction.validate}\n */\n function stringify(failure) {\n return (0, stringifyValidationFailure_1.stringifyValidationFailure)(failure);\n }\n LlmJson.stringify = stringify;\n /**\n * Create a reusable validator from LLM parameters schema.\n *\n * When validation fails, format the failure with {@link stringify} for LLM\n * auto-correction feedback.\n *\n * @param parameters LLM function parameters schema\n * @param equals If `true`, reject extraneous properties not defined in the\n * schema. Otherwise, extra properties are ignored.\n * @returns Validator function that checks data against the schema\n */\n function validate(parameters, equals) {\n const components = {\n schemas: {},\n };\n const schema = converters_1.LlmSchemaConverter.invert({\n components,\n schema: parameters,\n $defs: parameters.$defs,\n });\n return validators_1.OpenApiValidator.create({\n components,\n schema,\n required: true,\n equals,\n });\n }\n LlmJson.validate = validate;\n /**\n * Convert LLM parameters schema to structured output interface.\n *\n * Creates an {@link ILlmStructuredOutput} containing everything needed for\n * handling LLM structured outputs: the parameters schema for prompting, and\n * functions for parsing, coercing, and validating responses.\n *\n * This is useful when you have a parameters schema (e.g., from\n * `typia.llm.parameters()`) and need the full structured output interface\n * with all utility functions.\n *\n * @template T The expected output type\n * @param parameters LLM parameters schema\n * @param equals If `true`, reject extraneous properties not defined in the\n * schema during validation. Otherwise, extra properties are ignored.\n * @returns Structured output interface with parse, coerce, and validate\n */\n function structuredOutput(parameters, equals) {\n const validator = validate(parameters, equals);\n return {\n parameters,\n parse: (str) => parse(str, parameters),\n coerce: (input) => coerce(input, parameters),\n validate: (input) => validator(input),\n };\n }\n LlmJson.structuredOutput = structuredOutput;\n})(LlmJson || (exports.LlmJson = LlmJson = {}));\n//# sourceMappingURL=LlmJson.js.map"],"names":["LlmJson_1","require$$0","require$$1","require$$2","require$$3","require$$4"],"mappings":"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"}
|
package/lib/utils/MapUtil.mjs
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var MapUtilExports = requireMapUtil();
|
|
5
|
-
var MapUtil = /*@__PURE__*/getDefaultExportFromCjs(MapUtilExports);
|
|
6
|
-
|
|
7
|
-
export { MapUtil as default };
|
|
1
|
+
export { MapUtil } from './MapUtil2.mjs';
|
|
2
|
+
export { __exports as default } from '../_virtual/MapUtil.mjs';
|
|
8
3
|
//# sourceMappingURL=MapUtil.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapUtil.mjs","sources":[
|
|
1
|
+
{"version":3,"file":"MapUtil.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/lib/utils/MapUtil2.mjs
CHANGED
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
import { __exports as MapUtil } from '../_virtual/MapUtil.mjs';
|
|
1
|
+
import { __exports as MapUtil$1 } from '../_virtual/MapUtil.mjs';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(MapUtil$1, "__esModule", { value: true });
|
|
4
|
+
var MapUtil_2 = MapUtil$1.MapUtil = void 0;
|
|
5
|
+
/** @internal */
|
|
6
|
+
var MapUtil;
|
|
7
|
+
(function (MapUtil) {
|
|
8
|
+
MapUtil.take = (dict, key, generator) => {
|
|
9
|
+
const oldbie = dict.get(key);
|
|
10
|
+
if (oldbie)
|
|
11
|
+
return oldbie;
|
|
12
|
+
const value = generator();
|
|
13
|
+
dict.set(key, value);
|
|
14
|
+
return value;
|
|
15
|
+
};
|
|
16
|
+
})(MapUtil || (MapUtil_2 = MapUtil$1.MapUtil = MapUtil = {}));
|
|
4
17
|
|
|
5
|
-
|
|
6
|
-
if (hasRequiredMapUtil) return MapUtil;
|
|
7
|
-
hasRequiredMapUtil = 1;
|
|
8
|
-
Object.defineProperty(MapUtil, "__esModule", { value: true });
|
|
9
|
-
MapUtil.MapUtil = void 0;
|
|
10
|
-
/** @internal */
|
|
11
|
-
var MapUtil$1;
|
|
12
|
-
(function (MapUtil) {
|
|
13
|
-
MapUtil.take = (dict, key, generator) => {
|
|
14
|
-
const oldbie = dict.get(key);
|
|
15
|
-
if (oldbie)
|
|
16
|
-
return oldbie;
|
|
17
|
-
const value = generator();
|
|
18
|
-
dict.set(key, value);
|
|
19
|
-
return value;
|
|
20
|
-
};
|
|
21
|
-
})(MapUtil$1 || (MapUtil.MapUtil = MapUtil$1 = {}));
|
|
22
|
-
|
|
23
|
-
return MapUtil;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { requireMapUtil as __require };
|
|
18
|
+
export { MapUtil_2 as MapUtil, MapUtil$1 as default };
|
|
27
19
|
//# sourceMappingURL=MapUtil2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapUtil2.mjs","sources":["MapUtil.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MapUtil = void 0;\n/** @internal */\nvar MapUtil;\n(function (MapUtil) {\n MapUtil.take = (dict, key, generator) => {\n const oldbie = dict.get(key);\n if (oldbie)\n return oldbie;\n const value = generator();\n dict.set(key, value);\n return value;\n };\n})(MapUtil || (exports.MapUtil = MapUtil = {}));\n//# sourceMappingURL=MapUtil.js.map"],"names":["MapUtil_1"
|
|
1
|
+
{"version":3,"file":"MapUtil2.mjs","sources":["MapUtil.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MapUtil = void 0;\n/** @internal */\nvar MapUtil;\n(function (MapUtil) {\n MapUtil.take = (dict, key, generator) => {\n const oldbie = dict.get(key);\n if (oldbie)\n return oldbie;\n const value = generator();\n dict.set(key, value);\n return value;\n };\n})(MapUtil || (exports.MapUtil = MapUtil = {}));\n//# sourceMappingURL=MapUtil.js.map"],"names":["MapUtil_1"],"mappings":";;AACA,MAAM,CAAC,cAAc,CAACA,SAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,IAAA,SAAA,GAAAA,SAAA,CAAA,OAAe,GAAG;AAClB;AACA,IAAI,OAAO;AACX,CAAC,UAAU,OAAO,EAAE;AACpB,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,KAAK;AAC7C,QAAQ,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AACpC,QAAQ,IAAI,MAAM;AAClB,YAAY,OAAO,MAAM;AACzB,QAAQ,MAAM,KAAK,GAAG,SAAS,EAAE;AACjC,QAAQ,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;AAC5B,QAAQ,OAAO,KAAK;AACpB,IAAA,CAAK;AACL,CAAC,EAAE,OAAO,KAAK,SAAA,GAAAA,SAAA,CAAA,OAAe,GAAG,OAAO,GAAG,EAAE,CAAC,CAAC;;;;"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var NamingConventionExports = requireNamingConvention();
|
|
5
|
-
var NamingConvention = /*@__PURE__*/getDefaultExportFromCjs(NamingConventionExports);
|
|
6
|
-
|
|
7
|
-
export { NamingConvention as default };
|
|
1
|
+
export { NamingConvention } from './NamingConvention2.mjs';
|
|
2
|
+
export { __exports as default } from '../_virtual/NamingConvention.mjs';
|
|
8
3
|
//# sourceMappingURL=NamingConvention.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NamingConvention.mjs","sources":[
|
|
1
|
+
{"version":3,"file":"NamingConvention.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|