refactor(core): Refactor some imports to reduce baseline memory usage (#15916)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-06-03 11:23:44 +02:00
committed by GitHub
parent 8abd556597
commit 7c806ff532
133 changed files with 237 additions and 238 deletions

View File

@@ -1,5 +1,5 @@
import { mockDeep } from 'jest-mock-extended';
import { get } from 'lodash';
import get from 'lodash/get';
import type { IExecuteFunctions } from 'n8n-workflow';
import * as getSchema from '../../../../v2/actions/base/getSchema.operation';

View File

@@ -1,4 +1,4 @@
import { get } from 'lodash';
import get from 'lodash/get';
import { constructExecutionMetaData } from 'n8n-core';
import type { IDataObject, IExecuteFunctions, IGetNodeParameterOptions, INode } from 'n8n-workflow';

View File

@@ -1,4 +1,4 @@
import { get } from 'lodash';
import get from 'lodash/get';
import { constructExecutionMetaData } from 'n8n-core';
import type {
IDataObject,

View File

@@ -1,4 +1,4 @@
import { cloneDeep } from 'lodash';
import cloneDeep from 'lodash/cloneDeep';
import difference from 'lodash/difference';
import get from 'lodash/get';
import intersection from 'lodash/intersection';

View File

@@ -1,4 +1,4 @@
import { get } from 'lodash';
import get from 'lodash/get';
import {
type ITriggerFunctions,
type IDataObject,

View File

@@ -1,5 +1,5 @@
import FormData from 'form-data';
import { isEmpty } from 'lodash';
import isEmpty from 'lodash/isEmpty';
import { extension } from 'mime-types';
import type {
IBinaryKeyData,

View File

@@ -1,5 +1,5 @@
import { getParts, type ImapSimple, type Message, type MessagePart } from '@n8n/imap';
import { find } from 'lodash';
import find from 'lodash/find';
import { simpleParser, type Source as ParserSource } from 'mailparser';
import {
type IBinaryData,

View File

@@ -1,4 +1,4 @@
import _ from 'lodash';
import pickBy from 'lodash/pickBy';
import {
type INodeExecutionData,
NodeConnectionTypes,
@@ -217,7 +217,7 @@ export class ExecuteWorkflowTrigger implements INodeType {
...Object.fromEntries(newParams.fields.map((x) => [x.name, FALLBACK_DEFAULT_VALUE])),
// Need to trim to the expected schema to support legacy Execute Workflow callers passing through all their data
// which we do not want to expose past this node.
..._.pickBy(json, (_value, key) => newKeys.has(key)),
...pickBy(json, (_value, key) => newKeys.has(key)),
},
index,
binary,

View File

@@ -1,4 +1,4 @@
import { omit } from 'lodash';
import omit from 'lodash/omit';
import type {
IExecuteFunctions,
IHookFunctions,

View File

@@ -1,4 +1,4 @@
import { get } from 'lodash';
import get from 'lodash/get';
import { constructExecutionMetaData } from 'n8n-core';
import type { IDataObject, IExecuteFunctions, IGetNodeParameterOptions, INode } from 'n8n-workflow';
import { Readable } from 'stream';

View File

@@ -2,7 +2,9 @@ import { Readability } from '@mozilla/readability';
import * as cheerio from 'cheerio';
import { convert } from 'html-to-text';
import { JSDOM } from 'jsdom';
import { get, set, unset } from 'lodash';
import get from 'lodash/get';
import set from 'lodash/set';
import unset from 'lodash/unset';
import {
type INodeProperties,
jsonParse,

View File

@@ -1,6 +1,6 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import { mock } from 'jest-mock-extended';
import { get } from 'lodash';
import get from 'lodash/get';
import {
NodeOperationError,
type IExecuteFunctions,

View File

@@ -1,4 +1,4 @@
import { merge } from 'lodash';
import merge from 'lodash/merge';
import type {
IDataObject,
IExecuteSingleFunctions,

View File

@@ -1,4 +1,4 @@
import { merge } from 'lodash';
import merge from 'lodash/merge';
import type { DateTime } from 'luxon';
import {
NodeOperationError,

View File

@@ -1,5 +1,5 @@
import { mock } from 'jest-mock-extended';
import { get } from 'lodash';
import get from 'lodash/get';
import { constructExecutionMetaData } from 'n8n-core';
import type { IDataObject, IExecuteFunctions, IGetNodeParameterOptions, INode } from 'n8n-workflow';

View File

@@ -1,4 +1,4 @@
import { get } from 'lodash';
import get from 'lodash/get';
import type {
IDataObject,
IExecuteFunctions,

View File

@@ -1,4 +1,4 @@
import { get } from 'lodash';
import get from 'lodash/get';
import { constructExecutionMetaData } from 'n8n-core';
import {
NodeOperationError,

View File

@@ -1,5 +1,5 @@
import { mock } from 'jest-mock-extended';
import { get } from 'lodash';
import get from 'lodash/get';
import {
type IDataObject,
type IExecuteFunctions,

View File

@@ -1,4 +1,4 @@
import { get } from 'lodash';
import get from 'lodash/get';
import type { IDataObject, IExecuteFunctions, IGetNodeParameterOptions, INode } from 'n8n-workflow';
export const telegramNode: INode = {

View File

@@ -1,5 +1,7 @@
import { isEqual, lt, pick } from 'lodash';
import get from 'lodash/get';
import isEqual from 'lodash/isEqual';
import lt from 'lodash/lt';
import pick from 'lodash/pick';
import { NodeOperationError } from 'n8n-workflow';
import type { IExecuteFunctions, INode, INodeExecutionData } from 'n8n-workflow';

View File

@@ -1,4 +1,4 @@
import { get } from 'lodash';
import get from 'lodash/get';
import { constructExecutionMetaData } from 'n8n-core';
import type { IDataObject, IExecuteFunctions, IGetNodeParameterOptions, INode } from 'n8n-workflow';

View File

@@ -1,4 +1,9 @@
import { isEqual, isNull, merge, isObject, reduce, get } from 'lodash';
import get from 'lodash/get';
import isEqual from 'lodash/isEqual';
import isNull from 'lodash/isNull';
import isObject from 'lodash/isObject';
import merge from 'lodash/merge';
import reduce from 'lodash/reduce';
import type {
IDataObject,
IDisplayOptions,

View File

@@ -1,6 +1,6 @@
import { json as generateSchemaFromExample, type SchemaObject } from 'generate-schema';
import type { JSONSchema7 } from 'json-schema';
import _ from 'lodash';
import pickBy from 'lodash/pickBy';
import type {
FieldValueOption,
FieldType,
@@ -157,7 +157,7 @@ export function getCurrentWorkflowInputData(this: IExecuteFunctions | ISupplyDat
const filteredInputData: INodeExecutionData[] = inputData.map(({ json, binary }, index) => ({
index,
pairedItem: { item: index },
json: _.pickBy(json, (_v, key) => !removedKeys.has(key)),
json: pickBy(json, (_v, key) => !removedKeys.has(key)),
binary,
}));