feat(core): Expose data store service to Data Store Node (no-changelog) (#17970)

Co-authored-by: Daria Staferova <daria.staferova@n8n.io>
This commit is contained in:
Charlie Kolb
2025-08-19 17:43:19 +02:00
committed by GitHub
parent 970351bf23
commit 169acd12bd
20 changed files with 547 additions and 15 deletions

View File

@@ -1,3 +1,5 @@
import type { DataStoreProxyProvider } from 'n8n-workflow';
import type { ExecutionLifecycleHooks } from './execution-lifecycle-hooks';
import type { ExternalSecretsProxy } from './external-secrets-proxy';
@@ -5,6 +7,7 @@ declare module 'n8n-workflow' {
interface IWorkflowExecuteAdditionalData {
hooks?: ExecutionLifecycleHooks;
externalSecretsProxy: ExternalSecretsProxy;
dataStoreProxyProvider?: DataStoreProxyProvider;
}
}

View File

@@ -37,6 +37,7 @@ import {
} from './utils/binary-helper-functions';
import { constructExecutionMetaData } from './utils/construct-execution-metadata';
import { copyInputItems } from './utils/copy-input-items';
import { getDataStoreHelperFunctions } from './utils/data-store-helper-functions';
import { getDeduplicationHelperFunctions } from './utils/deduplication-helper-functions';
import { getFileSystemHelperFunctions } from './utils/file-system-helper-functions';
import { getInputConnectionData } from './utils/get-input-connection-data';
@@ -94,6 +95,7 @@ export class ExecuteContext extends BaseExecuteContext implements IExecuteFuncti
connectionInputData,
),
...getBinaryHelperFunctions(additionalData, workflow.id),
...getDataStoreHelperFunctions(additionalData, workflow, node),
...getSSHTunnelFunctions(),
...getFileSystemHelperFunctions(node),
...getDeduplicationHelperFunctions(workflow, node),

View File

@@ -10,6 +10,7 @@ import type {
} from 'n8n-workflow';
import { NodeExecutionContext } from './node-execution-context';
import { getDataStoreHelperFunctions } from './utils/data-store-helper-functions';
import { extractValue } from './utils/extract-value';
import { getRequestHelperFunctions } from './utils/request-helper-functions';
import { getSSHTunnelFunctions } from './utils/ssh-tunnel-helper-functions';
@@ -28,6 +29,7 @@ export class LoadOptionsContext extends NodeExecutionContext implements ILoadOpt
this.helpers = {
...getSSHTunnelFunctions(),
...getRequestHelperFunctions(workflow, node, additionalData),
...getDataStoreHelperFunctions(additionalData, workflow, node),
};
}

View File

@@ -29,6 +29,7 @@ import {
} from './utils/binary-helper-functions';
import { constructExecutionMetaData } from './utils/construct-execution-metadata';
import { copyInputItems } from './utils/copy-input-items';
import { getDataStoreHelperFunctions } from './utils/data-store-helper-functions';
import { getDeduplicationHelperFunctions } from './utils/deduplication-helper-functions';
import { getFileSystemHelperFunctions } from './utils/file-system-helper-functions';
// eslint-disable-next-line import-x/no-cycle
@@ -88,6 +89,7 @@ export class SupplyDataContext extends BaseExecuteContext implements ISupplyData
...getSSHTunnelFunctions(),
...getFileSystemHelperFunctions(node),
...getBinaryHelperFunctions(additionalData, workflow.id),
...getDataStoreHelperFunctions(additionalData, workflow, node),
...getDeduplicationHelperFunctions(workflow, node),
assertBinaryData: (itemIndex, propertyName) =>
assertBinaryData(inputData, node, itemIndex, propertyName, 0),

View File

@@ -0,0 +1,21 @@
import type {
DataStoreProxyFunctions,
INode,
Workflow,
IWorkflowExecuteAdditionalData,
} from 'n8n-workflow';
export function getDataStoreHelperFunctions(
additionalData: IWorkflowExecuteAdditionalData,
workflow: Workflow,
node: INode,
): Partial<DataStoreProxyFunctions> {
if (additionalData.dataStoreProxyProvider === undefined) return {};
const dataStoreProxyProvider = additionalData.dataStoreProxyProvider;
return {
getDataStoreAggregateProxy: async () =>
await dataStoreProxyProvider.getDataStoreAggregateProxy(workflow, node),
getDataStoreProxy: async (dataStoreId: string) =>
await dataStoreProxyProvider.getDataStoreProxy(workflow, node, dataStoreId),
};
}