@samchon/openapi
Version:
OpenAPI definitions and converters for 'typia' and 'nestia'.
1 lines • 2.5 kB
Source Map (JSON)
{"version":3,"file":"HttpLlmFunctionFetcher.mjs","sources":["../../src/http/HttpLlmFunctionFetcher.ts"],"sourcesContent":["import type { HttpLlm } from \"../HttpLlm\";\nimport type { HttpMigration } from \"../HttpMigration\";\nimport { IHttpMigrateRoute } from \"../structures/IHttpMigrateRoute\";\nimport { IHttpResponse } from \"../structures/IHttpResponse\";\nimport { ILlmSchema } from \"../structures/ILlmSchema\";\nimport { HttpMigrateRouteFetcher } from \"./HttpMigrateRouteFetcher\";\n\nexport namespace HttpLlmFunctionFetcher {\n export const execute = <Model extends ILlmSchema.Model>(\n props: HttpLlm.IFetchProps<Model>,\n ): Promise<unknown> =>\n HttpMigrateRouteFetcher.execute(getFetchArguments<Model>(\"execute\", props));\n\n export const propagate = <Model extends ILlmSchema.Model>(\n props: HttpLlm.IFetchProps<Model>,\n ): Promise<IHttpResponse> =>\n HttpMigrateRouteFetcher.propagate(\n getFetchArguments<Model>(\"propagate\", props),\n );\n\n const getFetchArguments = <Model extends ILlmSchema.Model>(\n from: string,\n props: HttpLlm.IFetchProps<Model>,\n ): HttpMigration.IFetchProps => {\n const route: IHttpMigrateRoute = props.function.route();\n const input: Record<string, any> = props.input;\n const valid: boolean = typeof input === \"object\" && input !== null;\n if (valid === false)\n throw new Error(\n `Error on HttpLlmFunctionFetcher.${from}(): keyworded arguments must be an object`,\n );\n return {\n connection: props.connection,\n route,\n parameters: Object.fromEntries(\n route.parameters.map((p) => [p.key, input[p.key]] as const),\n ),\n query: input.query,\n body: input.body,\n };\n };\n}\n"],"names":["HttpLlmFunctionFetcher","execute","props","HttpMigrateRouteFetcher","getFetchArguments","propagate","from","route","function","input","valid","Error","connection","parameters","Object","fromEntries","map","p","key","query","body"],"mappings":";;AAOM,IAAWA;;CAAjB,SAAiBA;IACFA,uBAAAC,UACXC,SAEAC,wBAAwBF,QAAQG,kBAAyB,WAAWF;IAEzDF,uBAAAK,YACXH,SAEAC,wBAAwBE,UACtBD,kBAAyB,aAAaF;IAG1C,MAAME,oBAAoB,CACxBE,MACAJ;QAEA,MAAMK,QAA2BL,MAAMM,SAASD;QAChD,MAAME,QAA6BP,MAAMO;QACzC,MAAMC,eAAwBD,UAAU,YAAYA,UAAU;QAC9D,IAAIC,UAAU,OACZ,MAAM,IAAIC,MACR,mCAAmCL;QAEvC,OAAO;YACLM,YAAYV,MAAMU;YAClBL;YACAM,YAAYC,OAAOC,YACjBR,MAAMM,WAAWG,KAAKC,KAAM,EAACA,EAAEC,KAAKT,MAAMQ,EAAEC;YAE9CC,OAAOV,MAAMU;YACbC,MAAMX,MAAMW;;AACb;AAEJ,EAlCD,CAAiBpB,2BAAAA,yBAkChB,CAAA;;"}