Rename function and fix styling

This commit is contained in:
Jan Oberhauser 2019-10-20 21:42:34 +02:00
parent f0c75ec9b7
commit e3b71c2ed4
4 changed files with 14 additions and 10 deletions

View file

@ -538,7 +538,7 @@ class App {
const workflowData = loadDataInstance.getWorkflowData() as IWorkflowBase; const workflowData = loadDataInstance.getWorkflowData() as IWorkflowBase;
const workflowCredentials = await WorkflowCredentials(workflowData.nodes); const workflowCredentials = await WorkflowCredentials(workflowData.nodes);
const additionalData = await WorkflowExecuteAdditionalData.getBase(executionMode, workflowCredentials,currentNodeParameters); const additionalData = await WorkflowExecuteAdditionalData.getBase(executionMode, workflowCredentials, currentNodeParameters);
return loadDataInstance.getOptions(methodName, additionalData); return loadDataInstance.getOptions(methodName, additionalData);
})); }));

View file

@ -17,13 +17,13 @@ import {
import { import {
IDataObject, IDataObject,
INodeParameters,
IRun, IRun,
ITaskData, ITaskData,
IWorkflowCredentials, IWorkflowCredentials,
IWorkflowExecuteAdditionalData, IWorkflowExecuteAdditionalData,
IWorkflowExecuteHooks, IWorkflowExecuteHooks,
WorkflowExecuteMode, WorkflowExecuteMode,
INodeParameters,
} from 'n8n-workflow'; } from 'n8n-workflow';
import * as config from '../config'; import * as config from '../config';
@ -246,7 +246,7 @@ const hooks = (mode: WorkflowExecuteMode, workflowData: IWorkflowBase, execution
* @param {IWorkflowCredentials} credentials * @param {IWorkflowCredentials} credentials
* @returns {Promise<IWorkflowExecuteAdditionalData>} * @returns {Promise<IWorkflowExecuteAdditionalData>}
*/ */
export async function getBase(mode: WorkflowExecuteMode, credentials: IWorkflowCredentials,currentNodeParameters: INodeParameters[] = []): Promise<IWorkflowExecuteAdditionalData> { export async function getBase(mode: WorkflowExecuteMode, credentials: IWorkflowCredentials, currentNodeParameters: INodeParameters[] = []): Promise<IWorkflowExecuteAdditionalData> {
const urlBaseWebhook = WebhookHelpers.getWebhookBaseUrl(); const urlBaseWebhook = WebhookHelpers.getWebhookBaseUrl();
const timezone = config.get('generic.timezone') as string; const timezone = config.get('generic.timezone') as string;
@ -264,7 +264,7 @@ export async function getBase(mode: WorkflowExecuteMode, credentials: IWorkflowC
timezone, timezone,
webhookBaseUrl, webhookBaseUrl,
webhookTestBaseUrl, webhookTestBaseUrl,
currentNodeParameters currentNodeParameters,
}; };
} }

View file

@ -513,12 +513,15 @@ export function getLoadOptionsFunctions(workflow: Workflow, node: INode, additio
getCredentials(type: string): ICredentialDataDecryptedObject | undefined { getCredentials(type: string): ICredentialDataDecryptedObject | undefined {
return getCredentials(workflow, node, type, additionalData); return getCredentials(workflow, node, type, additionalData);
}, },
getCurrentNodeParameters : (parameterName : string): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object => { getCurrentNodeParameter: (parameterName: string): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object | undefined => {
const nodeParameters = JSON.parse(''+additionalData.currentNodeParameters); const nodeParameters = JSON.parse('' + additionalData.currentNodeParameters);
if(nodeParameters && nodeParameters[parameterName] ){ if (nodeParameters && nodeParameters[parameterName]) {
return nodeParameters[parameterName]; return nodeParameters[parameterName];
} }
return false; return undefined;
},
getCurrentNodeParameters: (): INodeParameters | undefined => {
return JSON.parse('' + additionalData.currentNodeParameters);
}, },
getNodeParameter: (parameterName: string, fallbackValue?: any): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object => { //tslint:disable-line:no-any getNodeParameter: (parameterName: string, fallbackValue?: any): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object => { //tslint:disable-line:no-any
const runExecutionData: IRunExecutionData | null = null; const runExecutionData: IRunExecutionData | null = null;

View file

@ -181,7 +181,8 @@ export interface IExecuteSingleFunctions {
export interface ILoadOptionsFunctions { export interface ILoadOptionsFunctions {
getCredentials(type: string): ICredentialDataDecryptedObject | undefined; getCredentials(type: string): ICredentialDataDecryptedObject | undefined;
getNodeParameter(parameterName: string, fallbackValue?: any): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object; //tslint:disable-line:no-any getNodeParameter(parameterName: string, fallbackValue?: any): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object; //tslint:disable-line:no-any
getCurrentNodeParameters(parameterName: string): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object; getCurrentNodeParameter(parameterName: string): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object | undefined;
getCurrentNodeParameters(): INodeParameters | undefined;
getTimezone(): string; getTimezone(): string;
helpers: { helpers: {
[key: string]: ((...args: any[]) => any) | undefined; //tslint:disable-line:no-any [key: string]: ((...args: any[]) => any) | undefined; //tslint:disable-line:no-any
@ -291,7 +292,7 @@ export type NodeParameterValue = string | number | boolean;
export interface INodeParameters { export interface INodeParameters {
// TODO: Later also has to be possible to add multiple ones with the name name. So array has to be possible // TODO: Later also has to be possible to add multiple ones with the name name. So array has to be possible
[key: string]: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] ; [key: string]: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[];
} }