Make it possible to set credentials to fixed values

This commit is contained in:
Jan Oberhauser
2020-01-25 23:48:38 -08:00
parent 8228b8505f
commit eb285ef711
19 changed files with 316 additions and 117 deletions

View File

@@ -2,6 +2,7 @@ import { set } from 'lodash';
import {
ICredentialDataDecryptedObject,
ICredentialsHelper,
IExecuteWorkflowInfo,
INodeExecutionData,
INodeParameters,
@@ -16,11 +17,25 @@ import {
} from 'n8n-workflow';
import {
Credentials,
IDeferredPromise,
IExecuteFunctions,
} from '../src';
export class CredentialsHelper extends ICredentialsHelper {
getDecrypted(name: string, type: string): ICredentialDataDecryptedObject {
return {};
}
getCredentials(name: string, type: string): Credentials {
return new Credentials('', '', [], '');
}
async updateCredentials(name: string, type: string, data: ICredentialDataDecryptedObject): Promise<void> {}
}
class NodeTypesClass implements INodeTypes {
nodeTypes: INodeTypeData = {
@@ -276,12 +291,12 @@ export function WorkflowExecuteAdditionalData(waitPromise: IDeferredPromise<IRun
return {
credentials: {},
credentialsHelper: new CredentialsHelper({}, ''),
hooks: new WorkflowHooks(hookFunctions, 'trigger', '1', workflowData),
executeWorkflow: async (workflowInfo: IExecuteWorkflowInfo): Promise<any> => {}, // tslint:disable-line:no-any
restApiUrl: '',
encryptionKey: 'test',
timezone: 'America/New_York',
updateCredentials: async (name: string, type: string, data: ICredentialDataDecryptedObject, encryptionKey: string): Promise<void> => {},
webhookBaseUrl: 'webhook',
webhookTestBaseUrl: 'webhook-test',
};