mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(Microsoft Excel 365 Node): Overhaul
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
import type { IDataObject, IDisplayOptions, INodeProperties } from 'n8n-workflow';
|
||||
import type {
|
||||
IDataObject,
|
||||
IDisplayOptions,
|
||||
INodeExecutionData,
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { jsonParse } from 'n8n-workflow';
|
||||
|
||||
import { isEqual, isNull, merge } from 'lodash';
|
||||
@@ -73,6 +79,25 @@ export function updateDisplayOptions(
|
||||
});
|
||||
}
|
||||
|
||||
export function processJsonInput<T>(jsonData: T, inputName?: string) {
|
||||
let values;
|
||||
const input = `'${inputName}' ` || '';
|
||||
|
||||
if (typeof jsonData === 'string') {
|
||||
try {
|
||||
values = jsonParse(jsonData);
|
||||
} catch (error) {
|
||||
throw new Error(`Input ${input}must contain a valid JSON`);
|
||||
}
|
||||
} else if (typeof jsonData === 'object') {
|
||||
values = jsonData;
|
||||
} else {
|
||||
throw new Error(`Input ${input}must contain a valid JSON`);
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
function isFalsy<T>(value: T) {
|
||||
if (isNull(value)) return true;
|
||||
if (typeof value === 'string' && value === '') return true;
|
||||
@@ -173,6 +198,15 @@ export const fuzzyCompare = (useFuzzyCompare: boolean, compareVersion = 1) => {
|
||||
};
|
||||
};
|
||||
|
||||
export function wrapData(data: IDataObject | IDataObject[]): INodeExecutionData[] {
|
||||
if (!Array.isArray(data)) {
|
||||
return [{ json: data }];
|
||||
}
|
||||
return data.map((item) => ({
|
||||
json: item,
|
||||
}));
|
||||
}
|
||||
|
||||
export const keysToLowercase = <T>(headers: T) => {
|
||||
if (typeof headers !== 'object' || Array.isArray(headers) || headers === null) return headers;
|
||||
return Object.entries(headers).reduce((acc, [key, value]) => {
|
||||
|
||||
Reference in New Issue
Block a user