fix: PairedItems various fixes (no-changelog) (#9357)

This commit is contained in:
Michael Kret 2024-05-16 12:35:36 +03:00 committed by GitHub
parent c9855e3dce
commit 5a3122f279
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 37 additions and 21 deletions

View file

@ -692,8 +692,8 @@ export class FileMaker implements INodeType {
const action = this.getNodeParameter('action', 0) as string; const action = this.getNodeParameter('action', 0) as string;
try { for (let i = 0; i < items.length; i++) {
for (let i = 0; i < items.length; i++) { try {
// Reset all values // Reset all values
requestOptions = { requestOptions = {
uri: '', uri: '',
@ -807,17 +807,24 @@ export class FileMaker implements INodeType {
{ itemIndex: i }, { itemIndex: i },
); );
} }
returnData.push({ json: response }); returnData.push({ json: response, pairedItem: { item: i } });
} } catch (error) {
} catch (error) { if (this.continueOnFail()) {
if (error.node) { returnData.push({
throw error; json: { error: error.message },
} pairedItem: { item: i },
});
} else {
if (error.node) {
throw error;
}
throw new NodeOperationError( throw new NodeOperationError(
this.getNode(), this.getNode(),
`The action "${error.message}" is not implemented yet!`, `The action "${error.message}" is not implemented yet!`,
); );
}
}
} }
await logout.call(this, token as string); await logout.call(this, token as string);

View file

@ -260,7 +260,10 @@ export async function execute(
} }
if (nodeVersion < 4 || dataMode === 'autoMapInputData') { if (nodeVersion < 4 || dataMode === 'autoMapInputData') {
return items; return items.map((item, index) => {
item.pairedItem = { item: index };
return item;
});
} else { } else {
const returnData: INodeExecutionData[] = []; const returnData: INodeExecutionData[] = [];
for (const [index, entry] of setData.entries()) { for (const [index, entry] of setData.entries()) {

View file

@ -430,7 +430,10 @@ export async function execute(
} }
if (nodeVersion < 4 || dataMode === 'autoMapInputData') { if (nodeVersion < 4 || dataMode === 'autoMapInputData') {
return items; return items.map((item, index) => {
item.pairedItem = { item: index };
return item;
});
} else { } else {
const returnData: INodeExecutionData[] = []; const returnData: INodeExecutionData[] = [];
for (const [index, entry] of mappedValues.entries()) { for (const [index, entry] of mappedValues.entries()) {

View file

@ -404,7 +404,10 @@ export async function execute(
} }
if (nodeVersion < 4 || dataMode === 'autoMapInputData') { if (nodeVersion < 4 || dataMode === 'autoMapInputData') {
return items; return items.map((item, index) => {
item.pairedItem = { item: index };
return item;
});
} else { } else {
if (!updateData.length) { if (!updateData.length) {
return []; return [];

View file

@ -368,7 +368,7 @@ export class MergeV2 implements INodeType {
let input1 = this.getInputData(0); let input1 = this.getInputData(0);
let input2 = this.getInputData(1); let input2 = this.getInputData(1);
if (input1.length === 0 || input2.length === 0) { if (input1?.length === 0 || input2?.length === 0) {
// If data of any input is missing, return the data of // If data of any input is missing, return the data of
// the input that contains data // the input that contains data
return [[...input1, ...input2]]; return [[...input1, ...input2]];
@ -474,19 +474,19 @@ export class MergeV2 implements INodeType {
if (!input1) return [returnData]; if (!input1) return [returnData];
} }
if (input1.length === 0 || input2.length === 0) { if (input1?.length === 0 || input2?.length === 0) {
if (!input1.length && joinMode === 'keepNonMatches' && outputDataFrom === 'input1') if (!input1?.length && joinMode === 'keepNonMatches' && outputDataFrom === 'input1')
return [returnData]; return [returnData];
if (!input2.length && joinMode === 'keepNonMatches' && outputDataFrom === 'input2') if (!input2?.length && joinMode === 'keepNonMatches' && outputDataFrom === 'input2')
return [returnData]; return [returnData];
if (joinMode === 'keepMatches') { if (joinMode === 'keepMatches') {
// Stop the execution // Stop the execution
return [[]]; return [[]];
} else if (joinMode === 'enrichInput1' && input1.length === 0) { } else if (joinMode === 'enrichInput1' && input1?.length === 0) {
// No data to enrich so stop // No data to enrich so stop
return [[]]; return [[]];
} else if (joinMode === 'enrichInput2' && input2.length === 0) { } else if (joinMode === 'enrichInput2' && input2?.length === 0) {
// No data to enrich so stop // No data to enrich so stop
return [[]]; return [[]];
} else { } else {