mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user