mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Refactor some imports to reduce baseline memory usage (#15916)
This commit is contained in:
committed by
GitHub
parent
8abd556597
commit
7c806ff532
@@ -33,7 +33,6 @@
|
||||
"@langchain/core": "catalog:",
|
||||
"@n8n/config": "workspace:*",
|
||||
"@n8n/typescript-config": "workspace:*",
|
||||
"@types/deep-equal": "^1.0.1",
|
||||
"@types/express": "catalog:",
|
||||
"@types/jmespath": "^0.15.0",
|
||||
"@types/lodash": "catalog:",
|
||||
@@ -44,9 +43,7 @@
|
||||
"dependencies": {
|
||||
"@n8n/tournament": "1.0.6",
|
||||
"ast-types": "0.15.2",
|
||||
"axios": "catalog:",
|
||||
"callsites": "catalog:",
|
||||
"deep-equal": "2.2.0",
|
||||
"esprima-next": "5.8.4",
|
||||
"form-data": "catalog:",
|
||||
"jmespath": "0.16.0",
|
||||
@@ -55,7 +52,7 @@
|
||||
"lodash": "catalog:",
|
||||
"luxon": "catalog:",
|
||||
"md5": "2.3.0",
|
||||
"recast": "0.21.5",
|
||||
"recast": "0.22.0",
|
||||
"title-case": "3.0.3",
|
||||
"transliteration": "2.3.5",
|
||||
"xml2js": "catalog:",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { AxiosError } from 'axios';
|
||||
import type { AxiosError } from 'axios';
|
||||
import { parseString } from 'xml2js';
|
||||
|
||||
import { NodeError } from './abstract/node.error';
|
||||
@@ -145,8 +144,12 @@ export class NodeApiError extends NodeError {
|
||||
|
||||
this.addToMessages(errorResponse.message as string);
|
||||
|
||||
if (!httpCode && errorResponse instanceof AxiosError) {
|
||||
httpCode = errorResponse.response?.status?.toString();
|
||||
if (
|
||||
!httpCode &&
|
||||
errorResponse instanceof Error &&
|
||||
errorResponse.constructor?.name === 'AxiosError'
|
||||
) {
|
||||
httpCode = (errorResponse as unknown as AxiosError).response?.status?.toString();
|
||||
}
|
||||
|
||||
// only for request library error
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import deepEqual from 'deep-equal';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import uniqWith from 'lodash/uniqWith';
|
||||
|
||||
import type { Extension, ExtensionMap } from './extensions';
|
||||
@@ -64,9 +64,7 @@ function unique(value: unknown[], extraArgs: string[]): unknown[] {
|
||||
}
|
||||
return item;
|
||||
};
|
||||
return uniqWith(value, (a, b) =>
|
||||
deepEqual(mapForEqualityCheck(a), mapForEqualityCheck(b), { strict: true }),
|
||||
);
|
||||
return uniqWith(value, (a, b) => isEqual(mapForEqualityCheck(a), mapForEqualityCheck(b)));
|
||||
}
|
||||
|
||||
const ensureNumberArray = (arr: unknown[], { fnName }: { fnName: string }) => {
|
||||
@@ -266,7 +264,7 @@ function union(value: unknown[], extraArgs: unknown[][]): unknown[] {
|
||||
}
|
||||
const newArr: unknown[] = Array.from(value);
|
||||
for (const v of others) {
|
||||
if (newArr.findIndex((w) => deepEqual(w, v, { strict: true })) === -1) {
|
||||
if (newArr.findIndex((w) => isEqual(w, v)) === -1) {
|
||||
newArr.push(v);
|
||||
}
|
||||
}
|
||||
@@ -282,7 +280,7 @@ function difference(value: unknown[], extraArgs: unknown[][]): unknown[] {
|
||||
}
|
||||
const newArr: unknown[] = [];
|
||||
for (const v of value) {
|
||||
if (others.findIndex((w) => deepEqual(w, v, { strict: true })) === -1) {
|
||||
if (others.findIndex((w) => isEqual(w, v)) === -1) {
|
||||
newArr.push(v);
|
||||
}
|
||||
}
|
||||
@@ -298,12 +296,12 @@ function intersection(value: unknown[], extraArgs: unknown[][]): unknown[] {
|
||||
}
|
||||
const newArr: unknown[] = [];
|
||||
for (const v of value) {
|
||||
if (others.findIndex((w) => deepEqual(w, v, { strict: true })) !== -1) {
|
||||
if (others.findIndex((w) => isEqual(w, v)) !== -1) {
|
||||
newArr.push(v);
|
||||
}
|
||||
}
|
||||
for (const v of others) {
|
||||
if (value.findIndex((w) => deepEqual(w, v, { strict: true })) !== -1) {
|
||||
if (value.findIndex((w) => isEqual(w, v)) !== -1) {
|
||||
newArr.push(v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { escapeRegExp, mapValues, isEqual, cloneDeep } from 'lodash';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import escapeRegExp from 'lodash/escapeRegExp';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import mapValues from 'lodash/mapValues';
|
||||
|
||||
import { OperationalError } from './errors';
|
||||
import type { INode, INodeParameters, NodeParameterValueType } from './interfaces';
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
type ExpressionStatement,
|
||||
} from 'esprima-next';
|
||||
import FormData from 'form-data';
|
||||
import { merge } from 'lodash';
|
||||
import merge from 'lodash/merge';
|
||||
|
||||
import { ALPHABET } from './constants';
|
||||
import { ApplicationError } from './errors/application.error';
|
||||
|
||||
Reference in New Issue
Block a user