UNPKG

typia

Version:

Superfast runtime validators with only one line

1 lines 1.62 kB
{"version":3,"file":"_llmApplicationFinalize.mjs","names":[],"sources":["../../src/internal/_llmApplicationFinalize.ts"],"sourcesContent":["import { IJsonParseResult, ILlmApplication } from \"@typia/interface\";\nimport { LlmJson, LlmSchemaConverter } from \"@typia/utils\";\n\nexport const _llmApplicationFinalize = <Class extends object = any>(\n app: ILlmApplication.__IPrimitive<Class>,\n config?: Partial<Pick<ILlmApplication.IConfig, \"validate\">>,\n): ILlmApplication<Class> => ({\n ...app,\n config: {\n // The schema configuration comes from the emitted application, which is\n // where the `Config` generic was resolved. Rebuilding it from the\n // converter's defaults reported `strict: false` for a strict build, and\n // `@typia/mcp` then inverted a strict output schema without strict, which\n // drops every constraint it carries as a description tag (issue #2293).\n ...LlmSchemaConverter.getConfig(app.config),\n validate: config?.validate ?? null,\n },\n functions: app.functions.map((func) => ({\n ...func,\n parse: (input: string): IJsonParseResult<unknown> =>\n LlmJson.parse(input, func.parameters),\n coerce: (input: unknown): unknown => LlmJson.coerce(input, func.parameters),\n validate: config?.validate?.[func.name] ?? func.validate,\n })),\n});\n"],"mappings":";;AAGA,MAAa,2BACX,KACA,YAC4B;CAC5B,GAAG;CACH,QAAQ;EAMN,GAAG,mBAAmB,UAAU,IAAI,MAAM;EAC1C,UAAU,QAAQ,YAAY;CAChC;CACA,WAAW,IAAI,UAAU,KAAK,UAAU;EACtC,GAAG;EACH,QAAQ,UACN,QAAQ,MAAM,OAAO,KAAK,UAAU;EACtC,SAAS,UAA4B,QAAQ,OAAO,OAAO,KAAK,UAAU;EAC1E,UAAU,QAAQ,WAAW,KAAK,SAAS,KAAK;CAClD,EAAE;AACJ"}