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;
try {
for (let i = 0; i < items.length; i++) {
try {
// Reset all values
requestOptions = {
uri: '',
@ -807,9 +807,14 @@ export class FileMaker implements INodeType {
{ itemIndex: i },
);
}
returnData.push({ json: response });
}
returnData.push({ json: response, pairedItem: { item: i } });
} catch (error) {
if (this.continueOnFail()) {
returnData.push({
json: { error: error.message },
pairedItem: { item: i },
});
} else {
if (error.node) {
throw error;
}
@ -819,6 +824,8 @@ export class FileMaker implements INodeType {
`The action "${error.message}" is not implemented yet!`,
);
}
}
}
await logout.call(this, token as string);
return [returnData];

View file

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

View file

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

View file

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

View file

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