mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 17:14:05 -08:00
27 lines
880 B
TypeScript
27 lines
880 B
TypeScript
|
import type { IExecuteFunctions } from 'n8n-workflow';
|
||
|
import { NodeConnectionType } from 'n8n-workflow';
|
||
|
|
||
|
import { N8nItemListOutputParser } from './N8nItemListOutputParser';
|
||
|
import { N8nOutputFixingParser } from './N8nOutputFixingParser';
|
||
|
import { N8nStructuredOutputParser } from './N8nStructuredOutputParser';
|
||
|
|
||
|
export type N8nOutputParser =
|
||
|
| N8nOutputFixingParser
|
||
|
| N8nStructuredOutputParser
|
||
|
| N8nItemListOutputParser;
|
||
|
|
||
|
export { N8nOutputFixingParser, N8nItemListOutputParser, N8nStructuredOutputParser };
|
||
|
|
||
|
export async function getOptionalOutputParsers(ctx: IExecuteFunctions): Promise<N8nOutputParser[]> {
|
||
|
let outputParsers: N8nOutputParser[] = [];
|
||
|
|
||
|
if (ctx.getNodeParameter('hasOutputParser', 0, true) === true) {
|
||
|
outputParsers = (await ctx.getInputConnectionData(
|
||
|
NodeConnectionType.AiOutputParser,
|
||
|
0,
|
||
|
)) as N8nOutputParser[];
|
||
|
}
|
||
|
|
||
|
return outputParsers;
|
||
|
}
|