mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
✨ Make special variables like $node, $parameter, ... accessible
in Function Nodes
This commit is contained in:
@@ -154,6 +154,7 @@ export interface IExecuteFunctions {
|
||||
getInputData(inputIndex?: number, inputName?: string): INodeExecutionData[];
|
||||
getMode(): WorkflowExecuteMode;
|
||||
getNodeParameter(parameterName: string, itemIndex: number, fallbackValue?: any): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object; //tslint:disable-line:no-any
|
||||
getWorkflowDataProxy(itemIndex: number): IWorkflowDataProxyData;
|
||||
getWorkflowStaticData(type: string): IDataObject;
|
||||
getTimezone(): string;
|
||||
prepareOutputData(outputData: INodeExecutionData[], outputIndex?: number): Promise<INodeExecutionData[][]>;
|
||||
@@ -170,6 +171,7 @@ export interface IExecuteSingleFunctions {
|
||||
getMode(): WorkflowExecuteMode;
|
||||
getNodeParameter(parameterName: string, fallbackValue?: any): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object; //tslint:disable-line:no-any
|
||||
getTimezone(): string;
|
||||
getWorkflowDataProxy(): IWorkflowDataProxyData;
|
||||
getWorkflowStaticData(type: string): IDataObject;
|
||||
helpers: {
|
||||
[key: string]: (...args: any[]) => any //tslint:disable-line:no-any
|
||||
@@ -466,6 +468,14 @@ export interface IWebhookDescription {
|
||||
responseData?: WebhookResponseData | string;
|
||||
}
|
||||
|
||||
export interface IWorkflowDataProxyData {
|
||||
$binary: any; // tslint:disable-line:no-any
|
||||
$data: any; // tslint:disable-line:no-any
|
||||
$env: any; // tslint:disable-line:no-any
|
||||
$node: any; // tslint:disable-line:no-any
|
||||
$parameter: any; // tslint:disable-line:no-any
|
||||
}
|
||||
|
||||
export type WebhookHttpMethod = 'GET' | 'POST';
|
||||
|
||||
export interface IWebhookResonseData {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
NodeHelpers,
|
||||
IRunExecutionData,
|
||||
IWorkflowDataProxyData,
|
||||
NodeHelpers,
|
||||
Workflow,
|
||||
} from './';
|
||||
|
||||
@@ -184,12 +185,12 @@ export class WorkflowDataProxy {
|
||||
return executionData[that.itemIndex].json;
|
||||
} else if (name === 'binary') {
|
||||
// Binary-Data
|
||||
if (!executionData[that.itemIndex].binary) {
|
||||
throw new Error(`No binary data for node "${nodeName}" has been found!`);
|
||||
}
|
||||
|
||||
const returnData: IDataObject = {};
|
||||
|
||||
if (!executionData[that.itemIndex].binary) {
|
||||
return returnData;
|
||||
}
|
||||
|
||||
const binaryKeyData = executionData[that.itemIndex].binary!;
|
||||
for (const keyName of Object.keys(binaryKeyData)) {
|
||||
|
||||
@@ -263,7 +264,7 @@ export class WorkflowDataProxy {
|
||||
* @returns
|
||||
* @memberof WorkflowDataGetter
|
||||
*/
|
||||
getDataProxy() {
|
||||
getDataProxy(): IWorkflowDataProxyData {
|
||||
const that = this;
|
||||
|
||||
const base = {
|
||||
|
||||
Reference in New Issue
Block a user