feat(Summarize Node): Turns error when field not found in items into warning (#11889)

Co-authored-by: Dana Lee <dana@n8n.io>
Co-authored-by: Elias Meire <elias@meire.dev>
This commit is contained in:
Ria Scholz
2025-01-28 14:19:51 +01:00
committed by GitHub
parent 69a97bd32d
commit d7dda3f5de
5 changed files with 237 additions and 27 deletions

View File

@@ -231,20 +231,20 @@ export function splitData(
const [firstSplitKey, ...restSplitKeys] = splitKeys;
const groupedData = data.reduce((acc, item) => {
let keyValuee = getValue(item, firstSplitKey) as string;
let keyValue = getValue(item, firstSplitKey) as string;
if (typeof keyValuee === 'object') {
keyValuee = JSON.stringify(keyValuee);
if (typeof keyValue === 'object') {
keyValue = JSON.stringify(keyValue);
}
if (options.skipEmptySplitFields && typeof keyValuee !== 'number' && !keyValuee) {
if (options.skipEmptySplitFields && typeof keyValue !== 'number' && !keyValue) {
return acc;
}
if (acc[keyValuee] === undefined) {
acc[keyValuee] = [item];
if (acc[keyValue] === undefined) {
acc[keyValue] = [item];
} else {
(acc[keyValuee] as IDataObject[]).push(item);
(acc[keyValue] as IDataObject[]).push(item);
}
return acc;
}, {} as IDataObject);