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 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);
}));

View file

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

View file

@ -513,12 +513,15 @@ export function getLoadOptionsFunctions(workflow: Workflow, node: INode, additio
getCredentials(type: string): ICredentialDataDecryptedObject | undefined {
return getCredentials(workflow, node, type, additionalData);
},
getCurrentNodeParameters : (parameterName : string): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object => {
const nodeParameters = JSON.parse(''+additionalData.currentNodeParameters);
if(nodeParameters && nodeParameters[parameterName] ){
getCurrentNodeParameter: (parameterName: string): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object | undefined => {
const nodeParameters = JSON.parse('' + additionalData.currentNodeParameters);
if (nodeParameters && 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
const runExecutionData: IRunExecutionData | null = null;

View file

@ -181,7 +181,8 @@ export interface IExecuteSingleFunctions {
export interface ILoadOptionsFunctions {
getCredentials(type: string): ICredentialDataDecryptedObject | undefined;
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;
helpers: {
[key: string]: ((...args: any[]) => any) | undefined; //tslint:disable-line:no-any
@ -291,7 +292,7 @@ export type NodeParameterValue = string | number | boolean;
export interface INodeParameters {
// 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[];
}