Skip to content

Commit

Permalink
Add Paired Items for AWS Comprehend node
Browse files Browse the repository at this point in the history
  • Loading branch information
ShireenMissi committed Jul 11, 2024
1 parent c7af161 commit 72f74eb
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/nodes-base/nodes/Aws/Comprehend/AwsComprehend.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export class AwsComprehend implements INodeType {

async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const returnData: IDataObject[] = [];
const returnData: INodeExecutionData[] = [];
let responseData;
const resource = this.getNodeParameter('resource', 0);
const operation = this.getNodeParameter('operation', 0);
Expand Down Expand Up @@ -270,19 +270,23 @@ export class AwsComprehend implements INodeType {
}
}

if (Array.isArray(responseData)) {
returnData.push.apply(returnData, responseData as IDataObject[]);
} else {
returnData.push(responseData as IDataObject);
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
returnData.push(...executionData);
} catch (error) {
if (this.continueOnFail(error)) {
returnData.push({ error: error.message });
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({ error: error.message }),
{ itemData: { item: i } },
);
returnData.push(...executionData);
continue;
}
throw error;
}
}
return [this.helpers.returnJsonArray(returnData)];
return [returnData];
}
}

0 comments on commit 72f74eb

Please sign in to comment.