mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
⚡ Load credentials from the database (#1741)
* Changes to types so that credentials can be always loaded from DB This first commit changes all return types from the execute functions and calls to get credentials to be async so we can use await. This is a first step as previously credentials were loaded in memory and always available. We will now be loading them from the DB which requires turning the whole call chain async. * Fix updated files * Removed unnecessary credential loading to improve performance * Fix typo * ⚡ Fix issue * Updated new nodes to load credentials async * ⚡ Remove not needed comment Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
parent
178235e148
commit
7ce7285f7a
|
@ -155,10 +155,7 @@ export class Execute extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const credentials = await WorkflowCredentials(workflowData!.nodes);
|
|
||||||
|
|
||||||
const runData: IWorkflowExecutionDataProcess = {
|
const runData: IWorkflowExecutionDataProcess = {
|
||||||
credentials,
|
|
||||||
executionMode: 'cli',
|
executionMode: 'cli',
|
||||||
startNodes: [startNode.name],
|
startNodes: [startNode.name],
|
||||||
workflowData: workflowData!,
|
workflowData: workflowData!,
|
||||||
|
|
|
@ -635,10 +635,8 @@ export class ExecuteBatch extends Command {
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const credentials = await WorkflowCredentials(workflowData!.nodes);
|
|
||||||
|
|
||||||
const runData: IWorkflowExecutionDataProcess = {
|
const runData: IWorkflowExecutionDataProcess = {
|
||||||
credentials,
|
|
||||||
executionMode: 'cli',
|
executionMode: 'cli',
|
||||||
startNodes: [startNode!.name],
|
startNodes: [startNode!.name],
|
||||||
workflowData: workflowData!,
|
workflowData: workflowData!,
|
||||||
|
|
|
@ -148,9 +148,7 @@ export class Worker extends Command {
|
||||||
|
|
||||||
const workflow = new Workflow({ id: currentExecutionDb.workflowData.id as string, name: currentExecutionDb.workflowData.name, nodes: currentExecutionDb.workflowData!.nodes, connections: currentExecutionDb.workflowData!.connections, active: currentExecutionDb.workflowData!.active, nodeTypes, staticData, settings: currentExecutionDb.workflowData!.settings });
|
const workflow = new Workflow({ id: currentExecutionDb.workflowData.id as string, name: currentExecutionDb.workflowData.name, nodes: currentExecutionDb.workflowData!.nodes, connections: currentExecutionDb.workflowData!.connections, active: currentExecutionDb.workflowData!.active, nodeTypes, staticData, settings: currentExecutionDb.workflowData!.settings });
|
||||||
|
|
||||||
const credentials = await WorkflowCredentials(currentExecutionDb.workflowData.nodes);
|
const additionalData = await WorkflowExecuteAdditionalData.getBase(undefined, executionTimeoutTimestamp);
|
||||||
|
|
||||||
const additionalData = await WorkflowExecuteAdditionalData.getBase(credentials, undefined, executionTimeoutTimestamp);
|
|
||||||
additionalData.hooks = WorkflowExecuteAdditionalData.getWorkflowHooksWorkerExecuter(currentExecutionDb.mode, job.data.executionId, currentExecutionDb.workflowData, { retryOf: currentExecutionDb.retryOf as string });
|
additionalData.hooks = WorkflowExecuteAdditionalData.getWorkflowHooksWorkerExecuter(currentExecutionDb.mode, job.data.executionId, currentExecutionDb.workflowData, { retryOf: currentExecutionDb.retryOf as string });
|
||||||
|
|
||||||
let workflowExecute: WorkflowExecute;
|
let workflowExecute: WorkflowExecute;
|
||||||
|
|
|
@ -192,9 +192,7 @@ export class ActiveWorkflowRunner {
|
||||||
const nodeTypes = NodeTypes();
|
const nodeTypes = NodeTypes();
|
||||||
const workflow = new Workflow({ id: webhook.workflowId.toString(), name: workflowData.name, nodes: workflowData.nodes, connections: workflowData.connections, active: workflowData.active, nodeTypes, staticData: workflowData.staticData, settings: workflowData.settings });
|
const workflow = new Workflow({ id: webhook.workflowId.toString(), name: workflowData.name, nodes: workflowData.nodes, connections: workflowData.connections, active: workflowData.active, nodeTypes, staticData: workflowData.staticData, settings: workflowData.settings });
|
||||||
|
|
||||||
const credentials = await WorkflowCredentials([workflow.getNode(webhook.node as string) as INode]);
|
const additionalData = await WorkflowExecuteAdditionalData.getBase();
|
||||||
|
|
||||||
const additionalData = await WorkflowExecuteAdditionalData.getBase(credentials);
|
|
||||||
|
|
||||||
const webhookData = NodeHelpers.getNodeWebhooks(workflow, workflow.getNode(webhook.node as string) as INode, additionalData).filter((webhook) => {
|
const webhookData = NodeHelpers.getNodeWebhooks(workflow, workflow.getNode(webhook.node as string) as INode, additionalData).filter((webhook) => {
|
||||||
return (webhook.httpMethod === httpMethod && webhook.path === path);
|
return (webhook.httpMethod === httpMethod && webhook.path === path);
|
||||||
|
@ -368,8 +366,7 @@ export class ActiveWorkflowRunner {
|
||||||
|
|
||||||
const mode = 'internal';
|
const mode = 'internal';
|
||||||
|
|
||||||
const credentials = await WorkflowCredentials(workflowData.nodes);
|
const additionalData = await WorkflowExecuteAdditionalData.getBase();
|
||||||
const additionalData = await WorkflowExecuteAdditionalData.getBase(credentials);
|
|
||||||
|
|
||||||
const webhooks = WebhookHelpers.getWorkflowWebhooks(workflow, additionalData);
|
const webhooks = WebhookHelpers.getWorkflowWebhooks(workflow, additionalData);
|
||||||
|
|
||||||
|
@ -421,7 +418,6 @@ export class ActiveWorkflowRunner {
|
||||||
|
|
||||||
// Start the workflow
|
// Start the workflow
|
||||||
const runData: IWorkflowExecutionDataProcess = {
|
const runData: IWorkflowExecutionDataProcess = {
|
||||||
credentials: additionalData.credentials,
|
|
||||||
executionMode: mode,
|
executionMode: mode,
|
||||||
executionData,
|
executionData,
|
||||||
workflowData,
|
workflowData,
|
||||||
|
@ -508,8 +504,7 @@ export class ActiveWorkflowRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
const mode = 'trigger';
|
const mode = 'trigger';
|
||||||
const credentials = await WorkflowCredentials(workflowData.nodes);
|
const additionalData = await WorkflowExecuteAdditionalData.getBase();
|
||||||
const additionalData = await WorkflowExecuteAdditionalData.getBase(credentials);
|
|
||||||
const getTriggerFunctions = this.getExecuteTriggerFunctions(workflowData, additionalData, mode, activation);
|
const getTriggerFunctions = this.getExecuteTriggerFunctions(workflowData, additionalData, mode, activation);
|
||||||
const getPollFunctions = this.getExecutePollFunctions(workflowData, additionalData, mode, activation);
|
const getPollFunctions = this.getExecutePollFunctions(workflowData, additionalData, mode, activation);
|
||||||
|
|
||||||
|
|
|
@ -48,16 +48,21 @@ export class CredentialsHelper extends ICredentialsHelper {
|
||||||
* @returns {Credentials}
|
* @returns {Credentials}
|
||||||
* @memberof CredentialsHelper
|
* @memberof CredentialsHelper
|
||||||
*/
|
*/
|
||||||
getCredentials(name: string, type: string): Credentials {
|
async getCredentials(name: string, type: string): Promise<Credentials> {
|
||||||
if (!this.workflowCredentials[type]) {
|
|
||||||
|
const credentialsDb = await Db.collections.Credentials?.find({type});
|
||||||
|
|
||||||
|
if (credentialsDb === undefined || credentialsDb.length === 0) {
|
||||||
throw new Error(`No credentials of type "${type}" exist.`);
|
throw new Error(`No credentials of type "${type}" exist.`);
|
||||||
}
|
}
|
||||||
if (!this.workflowCredentials[type][name]) {
|
|
||||||
|
const credential = credentialsDb.find(credential => credential.name === name);
|
||||||
|
|
||||||
|
if (credential === undefined) {
|
||||||
throw new Error(`No credentials with name "${name}" exist for type "${type}".`);
|
throw new Error(`No credentials with name "${name}" exist for type "${type}".`);
|
||||||
}
|
}
|
||||||
const credentialData = this.workflowCredentials[type][name];
|
|
||||||
|
return new Credentials(credential.name, credential.type, credential.nodesAccess, credential.data);
|
||||||
return new Credentials(credentialData.name, credentialData.type, credentialData.nodesAccess, credentialData.data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,8 +107,8 @@ export class CredentialsHelper extends ICredentialsHelper {
|
||||||
* @returns {ICredentialDataDecryptedObject}
|
* @returns {ICredentialDataDecryptedObject}
|
||||||
* @memberof CredentialsHelper
|
* @memberof CredentialsHelper
|
||||||
*/
|
*/
|
||||||
getDecrypted(name: string, type: string, mode: WorkflowExecuteMode, raw?: boolean, expressionResolveValues?: ICredentialsExpressionResolveValues): ICredentialDataDecryptedObject {
|
async getDecrypted(name: string, type: string, mode: WorkflowExecuteMode, raw?: boolean, expressionResolveValues?: ICredentialsExpressionResolveValues): Promise<ICredentialDataDecryptedObject> {
|
||||||
const credentials = this.getCredentials(name, type);
|
const credentials = await this.getCredentials(name, type);
|
||||||
|
|
||||||
const decryptedDataOriginal = credentials.getData(this.encryptionKey);
|
const decryptedDataOriginal = credentials.getData(this.encryptionKey);
|
||||||
|
|
||||||
|
|
|
@ -457,7 +457,6 @@ export interface IProcessMessageDataHook {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IWorkflowExecutionDataProcess {
|
export interface IWorkflowExecutionDataProcess {
|
||||||
credentials: IWorkflowCredentials;
|
|
||||||
destinationNode?: string;
|
destinationNode?: string;
|
||||||
executionMode: WorkflowExecuteMode;
|
executionMode: WorkflowExecuteMode;
|
||||||
executionData?: IRunExecutionData;
|
executionData?: IRunExecutionData;
|
||||||
|
|
|
@ -66,7 +66,6 @@ import {
|
||||||
TestWebhooks,
|
TestWebhooks,
|
||||||
WebhookHelpers,
|
WebhookHelpers,
|
||||||
WebhookServer,
|
WebhookServer,
|
||||||
WorkflowCredentials,
|
|
||||||
WorkflowExecuteAdditionalData,
|
WorkflowExecuteAdditionalData,
|
||||||
WorkflowHelpers,
|
WorkflowHelpers,
|
||||||
WorkflowRunner,
|
WorkflowRunner,
|
||||||
|
@ -764,8 +763,7 @@ class App {
|
||||||
|
|
||||||
// If webhooks nodes exist and are active we have to wait for till we receive a call
|
// If webhooks nodes exist and are active we have to wait for till we receive a call
|
||||||
if (runData === undefined || startNodes === undefined || startNodes.length === 0 || destinationNode === undefined) {
|
if (runData === undefined || startNodes === undefined || startNodes.length === 0 || destinationNode === undefined) {
|
||||||
const credentials = await WorkflowCredentials(workflowData.nodes);
|
const additionalData = await WorkflowExecuteAdditionalData.getBase();
|
||||||
const additionalData = await WorkflowExecuteAdditionalData.getBase(credentials);
|
|
||||||
const nodeTypes = NodeTypes();
|
const nodeTypes = NodeTypes();
|
||||||
const workflowInstance = new Workflow({ id: workflowData.id, name: workflowData.name, nodes: workflowData.nodes, connections: workflowData.connections, active: false, nodeTypes, staticData: undefined, settings: workflowData.settings });
|
const workflowInstance = new Workflow({ id: workflowData.id, name: workflowData.name, nodes: workflowData.nodes, connections: workflowData.connections, active: false, nodeTypes, staticData: undefined, settings: workflowData.settings });
|
||||||
const needsWebhook = await this.testWebhooks.needsWebhookData(workflowData, workflowInstance, additionalData, executionMode, activationMode, sessionId, destinationNode);
|
const needsWebhook = await this.testWebhooks.needsWebhookData(workflowData, workflowInstance, additionalData, executionMode, activationMode, sessionId, destinationNode);
|
||||||
|
@ -779,11 +777,8 @@ class App {
|
||||||
// For manual testing always set to not active
|
// For manual testing always set to not active
|
||||||
workflowData.active = false;
|
workflowData.active = false;
|
||||||
|
|
||||||
const credentials = await WorkflowCredentials(workflowData.nodes);
|
|
||||||
|
|
||||||
// Start the workflow
|
// Start the workflow
|
||||||
const data: IWorkflowExecutionDataProcess = {
|
const data: IWorkflowExecutionDataProcess = {
|
||||||
credentials,
|
|
||||||
destinationNode,
|
destinationNode,
|
||||||
executionMode,
|
executionMode,
|
||||||
runData,
|
runData,
|
||||||
|
@ -880,9 +875,7 @@ class App {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const loadDataInstance = new LoadNodeParameterOptions(nodeType, nodeTypes, path, JSON.parse('' + req.query.currentNodeParameters), credentials!);
|
const loadDataInstance = new LoadNodeParameterOptions(nodeType, nodeTypes, path, JSON.parse('' + req.query.currentNodeParameters), credentials!);
|
||||||
|
|
||||||
const workflowData = loadDataInstance.getWorkflowData() as IWorkflowBase;
|
const additionalData = await WorkflowExecuteAdditionalData.getBase(currentNodeParameters);
|
||||||
const workflowCredentials = await WorkflowCredentials(workflowData.nodes);
|
|
||||||
const additionalData = await WorkflowExecuteAdditionalData.getBase(workflowCredentials, currentNodeParameters);
|
|
||||||
|
|
||||||
return loadDataInstance.getOptions(methodName, additionalData);
|
return loadDataInstance.getOptions(methodName, additionalData);
|
||||||
}));
|
}));
|
||||||
|
@ -1259,15 +1252,9 @@ class App {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decrypt the currently saved credentials
|
|
||||||
const workflowCredentials: IWorkflowCredentials = {
|
|
||||||
[result.type as string]: {
|
|
||||||
[result.name as string]: result as ICredentialsEncrypted,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const mode: WorkflowExecuteMode = 'internal';
|
const mode: WorkflowExecuteMode = 'internal';
|
||||||
const credentialsHelper = new CredentialsHelper(workflowCredentials, encryptionKey);
|
const credentialsHelper = new CredentialsHelper(encryptionKey);
|
||||||
const decryptedDataOriginal = credentialsHelper.getDecrypted(result.name, result.type, mode, true);
|
const decryptedDataOriginal = await credentialsHelper.getDecrypted(result.name, result.type, mode, true);
|
||||||
const oauthCredentials = credentialsHelper.applyDefaultsAndOverwrites(decryptedDataOriginal, result.type, mode);
|
const oauthCredentials = credentialsHelper.applyDefaultsAndOverwrites(decryptedDataOriginal, result.type, mode);
|
||||||
|
|
||||||
const signatureMethod = _.get(oauthCredentials, 'signatureMethod') as string;
|
const signatureMethod = _.get(oauthCredentials, 'signatureMethod') as string;
|
||||||
|
@ -1351,6 +1338,7 @@ class App {
|
||||||
return ResponseHelper.sendErrorResponse(res, errorResponse);
|
return ResponseHelper.sendErrorResponse(res, errorResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Decrypt the currently saved credentials
|
// Decrypt the currently saved credentials
|
||||||
const workflowCredentials: IWorkflowCredentials = {
|
const workflowCredentials: IWorkflowCredentials = {
|
||||||
[result.type as string]: {
|
[result.type as string]: {
|
||||||
|
@ -1358,10 +1346,10 @@ class App {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const mode: WorkflowExecuteMode = 'internal';
|
const mode: WorkflowExecuteMode = 'internal';
|
||||||
const credentialsHelper = new CredentialsHelper(workflowCredentials, encryptionKey);
|
const credentialsHelper = new CredentialsHelper(encryptionKey);
|
||||||
const decryptedDataOriginal = credentialsHelper.getDecrypted(result.name, result.type, mode, true);
|
const decryptedDataOriginal = await credentialsHelper.getDecrypted(result.name, result.type, mode, true);
|
||||||
const oauthCredentials = credentialsHelper.applyDefaultsAndOverwrites(decryptedDataOriginal, result.type, mode);
|
const oauthCredentials = credentialsHelper.applyDefaultsAndOverwrites(decryptedDataOriginal, result.type, mode);
|
||||||
|
|
||||||
const options: OptionsWithUrl = {
|
const options: OptionsWithUrl = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: _.get(oauthCredentials, 'accessTokenUrl') as string,
|
url: _.get(oauthCredentials, 'accessTokenUrl') as string,
|
||||||
|
@ -1427,15 +1415,9 @@ class App {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decrypt the currently saved credentials
|
|
||||||
const workflowCredentials: IWorkflowCredentials = {
|
|
||||||
[result.type as string]: {
|
|
||||||
[result.name as string]: result as ICredentialsEncrypted,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const mode: WorkflowExecuteMode = 'internal';
|
const mode: WorkflowExecuteMode = 'internal';
|
||||||
const credentialsHelper = new CredentialsHelper(workflowCredentials, encryptionKey);
|
const credentialsHelper = new CredentialsHelper(encryptionKey);
|
||||||
const decryptedDataOriginal = credentialsHelper.getDecrypted(result.name, result.type, mode, true);
|
const decryptedDataOriginal = await credentialsHelper.getDecrypted(result.name, result.type, mode, true);
|
||||||
const oauthCredentials = credentialsHelper.applyDefaultsAndOverwrites(decryptedDataOriginal, result.type, mode);
|
const oauthCredentials = credentialsHelper.applyDefaultsAndOverwrites(decryptedDataOriginal, result.type, mode);
|
||||||
|
|
||||||
const token = new csrf();
|
const token = new csrf();
|
||||||
|
@ -1534,11 +1516,12 @@ class App {
|
||||||
[result.name as string]: result as ICredentialsEncrypted,
|
[result.name as string]: result as ICredentialsEncrypted,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const mode: WorkflowExecuteMode = 'internal';
|
const mode: WorkflowExecuteMode = 'internal';
|
||||||
const credentialsHelper = new CredentialsHelper(workflowCredentials, encryptionKey);
|
const credentialsHelper = new CredentialsHelper(encryptionKey);
|
||||||
const decryptedDataOriginal = credentialsHelper.getDecrypted(result.name, result.type, mode, true);
|
const decryptedDataOriginal = await credentialsHelper.getDecrypted(result.name, result.type, mode, true);
|
||||||
const oauthCredentials = credentialsHelper.applyDefaultsAndOverwrites(decryptedDataOriginal, result.type, mode);
|
const oauthCredentials = credentialsHelper.applyDefaultsAndOverwrites(decryptedDataOriginal, result.type, mode);
|
||||||
|
|
||||||
const token = new csrf();
|
const token = new csrf();
|
||||||
if (decryptedDataOriginal.csrfSecret === undefined || !token.verify(decryptedDataOriginal.csrfSecret as string, state.token)) {
|
if (decryptedDataOriginal.csrfSecret === undefined || !token.verify(decryptedDataOriginal.csrfSecret as string, state.token)) {
|
||||||
const errorResponse = new ResponseHelper.ResponseError('The OAuth2 callback state is invalid!', undefined, 404);
|
const errorResponse = new ResponseHelper.ResponseError('The OAuth2 callback state is invalid!', undefined, 404);
|
||||||
|
@ -1735,13 +1718,10 @@ class App {
|
||||||
|
|
||||||
const executionMode = 'retry';
|
const executionMode = 'retry';
|
||||||
|
|
||||||
const credentials = await WorkflowCredentials(fullExecutionData.workflowData.nodes);
|
|
||||||
|
|
||||||
fullExecutionData.workflowData.active = false;
|
fullExecutionData.workflowData.active = false;
|
||||||
|
|
||||||
// Start the workflow
|
// Start the workflow
|
||||||
const data: IWorkflowExecutionDataProcess = {
|
const data: IWorkflowExecutionDataProcess = {
|
||||||
credentials,
|
|
||||||
executionMode,
|
executionMode,
|
||||||
executionData: fullExecutionData.data,
|
executionData: fullExecutionData.data,
|
||||||
retryOf: req.params.id,
|
retryOf: req.params.id,
|
||||||
|
|
|
@ -129,8 +129,7 @@ export function getWorkflowWebhooksBasic(workflow: Workflow): IWebhookData[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare everything that is needed to run the workflow
|
// Prepare everything that is needed to run the workflow
|
||||||
const credentials = await WorkflowCredentials(workflowData.nodes);
|
const additionalData = await WorkflowExecuteAdditionalData.getBase();
|
||||||
const additionalData = await WorkflowExecuteAdditionalData.getBase(credentials);
|
|
||||||
|
|
||||||
// Add the Response and Request so that this data can be accessed in the node
|
// Add the Response and Request so that this data can be accessed in the node
|
||||||
additionalData.httpRequest = req;
|
additionalData.httpRequest = req;
|
||||||
|
@ -276,7 +275,6 @@ export function getWorkflowWebhooksBasic(workflow: Workflow): IWebhookData[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
const runData: IWorkflowExecutionDataProcess = {
|
const runData: IWorkflowExecutionDataProcess = {
|
||||||
credentials,
|
|
||||||
executionMode,
|
executionMode,
|
||||||
executionData: runExecutionData,
|
executionData: runExecutionData,
|
||||||
sessionId,
|
sessionId,
|
||||||
|
|
|
@ -545,12 +545,7 @@ export async function getRunData(workflowData: IWorkflowBase, inputData?: INodeE
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get the needed credentials for the current workflow as they will differ to the ones of the
|
|
||||||
// calling workflow.
|
|
||||||
const credentials = await WorkflowCredentials(workflowData!.nodes);
|
|
||||||
|
|
||||||
const runData: IWorkflowExecutionDataProcess = {
|
const runData: IWorkflowExecutionDataProcess = {
|
||||||
credentials,
|
|
||||||
executionMode: mode,
|
executionMode: mode,
|
||||||
executionData: runExecutionData,
|
executionData: runExecutionData,
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -618,13 +613,9 @@ export async function executeWorkflow(workflowInfo: IExecuteWorkflowInfo, additi
|
||||||
|
|
||||||
let data;
|
let data;
|
||||||
try {
|
try {
|
||||||
// Get the needed credentials for the current workflow as they will differ to the ones of the
|
|
||||||
// calling workflow.
|
|
||||||
const credentials = await WorkflowCredentials(workflowData!.nodes);
|
|
||||||
|
|
||||||
// Create new additionalData to have different workflow loaded and to call
|
// Create new additionalData to have different workflow loaded and to call
|
||||||
// different webooks
|
// different webooks
|
||||||
const additionalDataIntegrated = await getBase(credentials);
|
const additionalDataIntegrated = await getBase();
|
||||||
additionalDataIntegrated.hooks = getWorkflowHooksIntegrated(runData.executionMode, executionId, workflowData!, { parentProcessMode: additionalData.hooks!.mode });
|
additionalDataIntegrated.hooks = getWorkflowHooksIntegrated(runData.executionMode, executionId, workflowData!, { parentProcessMode: additionalData.hooks!.mode });
|
||||||
// Make sure we pass on the original executeWorkflow function we received
|
// Make sure we pass on the original executeWorkflow function we received
|
||||||
// This one already contains changes to talk to parent process
|
// This one already contains changes to talk to parent process
|
||||||
|
@ -735,7 +726,7 @@ export function sendMessageToUI(source: string, message: any) { // tslint:disabl
|
||||||
* @param {INodeParameters} currentNodeParameters
|
* @param {INodeParameters} currentNodeParameters
|
||||||
* @returns {Promise<IWorkflowExecuteAdditionalData>}
|
* @returns {Promise<IWorkflowExecuteAdditionalData>}
|
||||||
*/
|
*/
|
||||||
export async function getBase(credentials: IWorkflowCredentials, currentNodeParameters?: INodeParameters, executionTimeoutTimestamp?: number): Promise<IWorkflowExecuteAdditionalData> {
|
export async function getBase(currentNodeParameters?: INodeParameters, executionTimeoutTimestamp?: number): 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;
|
||||||
|
@ -748,8 +739,7 @@ export async function getBase(credentials: IWorkflowCredentials, currentNodePara
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
credentials,
|
credentialsHelper: new CredentialsHelper(encryptionKey),
|
||||||
credentialsHelper: new CredentialsHelper(credentials, encryptionKey),
|
|
||||||
encryptionKey,
|
encryptionKey,
|
||||||
executeWorkflow,
|
executeWorkflow,
|
||||||
restApiUrl: urlBaseWebhook + config.get('endpoints.rest') as string,
|
restApiUrl: urlBaseWebhook + config.get('endpoints.rest') as string,
|
||||||
|
|
|
@ -144,10 +144,7 @@ export async function executeErrorWorkflow(workflowId: string, workflowErrorData
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const credentials = await WorkflowCredentials(workflowData.nodes);
|
|
||||||
|
|
||||||
const runData: IWorkflowExecutionDataProcess = {
|
const runData: IWorkflowExecutionDataProcess = {
|
||||||
credentials,
|
|
||||||
executionMode,
|
executionMode,
|
||||||
executionData: runExecutionData,
|
executionData: runExecutionData,
|
||||||
workflowData,
|
workflowData,
|
||||||
|
|
|
@ -183,7 +183,7 @@ export class WorkflowRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
const workflow = new Workflow({ id: data.workflowData.id as string | undefined, name: data.workflowData.name, nodes: data.workflowData!.nodes, connections: data.workflowData!.connections, active: data.workflowData!.active, nodeTypes, staticData: data.workflowData!.staticData });
|
const workflow = new Workflow({ id: data.workflowData.id as string | undefined, name: data.workflowData.name, nodes: data.workflowData!.nodes, connections: data.workflowData!.connections, active: data.workflowData!.active, nodeTypes, staticData: data.workflowData!.staticData });
|
||||||
const additionalData = await WorkflowExecuteAdditionalData.getBase(data.credentials, undefined, workflowTimeout <= 0 ? undefined : Date.now() + workflowTimeout * 1000);
|
const additionalData = await WorkflowExecuteAdditionalData.getBase(undefined, workflowTimeout <= 0 ? undefined : Date.now() + workflowTimeout * 1000);
|
||||||
|
|
||||||
// Register the active execution
|
// Register the active execution
|
||||||
const executionId = await this.activeExecutions.add(data, undefined);
|
const executionId = await this.activeExecutions.add(data, undefined);
|
||||||
|
@ -423,43 +423,14 @@ export class WorkflowRunner {
|
||||||
// Register the active execution
|
// Register the active execution
|
||||||
const executionId = await this.activeExecutions.add(data, subprocess);
|
const executionId = await this.activeExecutions.add(data, subprocess);
|
||||||
|
|
||||||
// Check if workflow contains a "executeWorkflow" Node as in this
|
// Supply all nodeTypes and credentialTypes
|
||||||
// case we can not know which nodeTypes and credentialTypes will
|
const nodeTypeData = WorkflowHelpers.getAllNodeTypeData() as ITransferNodeTypes;
|
||||||
// be needed and so have to load all of them in the workflowRunnerProcess
|
const credentialTypes = CredentialTypes();
|
||||||
let loadAllNodeTypes = false;
|
|
||||||
for (const node of data.workflowData.nodes) {
|
|
||||||
if (node.type === 'n8n-nodes-base.executeWorkflow') {
|
|
||||||
loadAllNodeTypes = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let nodeTypeData: ITransferNodeTypes;
|
|
||||||
let credentialTypeData: ICredentialsTypeData;
|
|
||||||
let credentialsOverwrites = this.credentialsOverwrites;
|
|
||||||
|
|
||||||
if (loadAllNodeTypes === true) {
|
|
||||||
// Supply all nodeTypes and credentialTypes
|
|
||||||
nodeTypeData = WorkflowHelpers.getAllNodeTypeData();
|
|
||||||
const credentialTypes = CredentialTypes();
|
|
||||||
credentialTypeData = credentialTypes.credentialTypes;
|
|
||||||
} else {
|
|
||||||
// Supply only nodeTypes, credentialTypes and overwrites that the workflow needs
|
|
||||||
nodeTypeData = WorkflowHelpers.getNodeTypeData(data.workflowData.nodes);
|
|
||||||
credentialTypeData = WorkflowHelpers.getCredentialsData(data.credentials);
|
|
||||||
|
|
||||||
credentialsOverwrites = {};
|
|
||||||
for (const credentialName of Object.keys(credentialTypeData)) {
|
|
||||||
if (this.credentialsOverwrites[credentialName] !== undefined) {
|
|
||||||
credentialsOverwrites[credentialName] = this.credentialsOverwrites[credentialName];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
(data as unknown as IWorkflowExecutionDataProcessWithExecution).executionId = executionId;
|
(data as unknown as IWorkflowExecutionDataProcessWithExecution).executionId = executionId;
|
||||||
(data as unknown as IWorkflowExecutionDataProcessWithExecution).nodeTypeData = nodeTypeData;
|
(data as unknown as IWorkflowExecutionDataProcessWithExecution).nodeTypeData = nodeTypeData;
|
||||||
(data as unknown as IWorkflowExecutionDataProcessWithExecution).credentialsOverwrite = credentialsOverwrites;
|
(data as unknown as IWorkflowExecutionDataProcessWithExecution).credentialsOverwrite = this.credentialsOverwrites;
|
||||||
(data as unknown as IWorkflowExecutionDataProcessWithExecution).credentialsTypeData = credentialTypeData; // TODO: Still needs correct value
|
(data as unknown as IWorkflowExecutionDataProcessWithExecution).credentialsTypeData = credentialTypes.credentialTypes;
|
||||||
|
|
||||||
const workflowHooks = WorkflowExecuteAdditionalData.getWorkflowHooksMain(data, executionId);
|
const workflowHooks = WorkflowExecuteAdditionalData.getWorkflowHooksMain(data, executionId);
|
||||||
|
|
||||||
|
|
|
@ -111,9 +111,22 @@ export class WorkflowRunnerProcess {
|
||||||
const externalHooks = ExternalHooks();
|
const externalHooks = ExternalHooks();
|
||||||
await externalHooks.init();
|
await externalHooks.init();
|
||||||
|
|
||||||
// This code has been split into 3 ifs just to make it easier to understand
|
// Credentials should now be loaded from database.
|
||||||
|
// We check if any node uses credentials. If it does, then
|
||||||
|
// init database.
|
||||||
|
let shouldInitializaDb = false;
|
||||||
|
inputData.workflowData.nodes.map(node => {
|
||||||
|
if (Object.keys(node.credentials === undefined ? {} : node.credentials).length > 0) {
|
||||||
|
shouldInitializaDb = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// This code has been split into 4 ifs just to make it easier to understand
|
||||||
// Can be made smaller but in the end it will make it impossible to read.
|
// Can be made smaller but in the end it will make it impossible to read.
|
||||||
if (inputData.workflowData.settings !== undefined && inputData.workflowData.settings.saveExecutionProgress === true) {
|
if (shouldInitializaDb) {
|
||||||
|
// initialize db as we need to load credentials
|
||||||
|
await Db.init();
|
||||||
|
} else if (inputData.workflowData.settings !== undefined && inputData.workflowData.settings.saveExecutionProgress === true) {
|
||||||
// Workflow settings specifying it should save
|
// Workflow settings specifying it should save
|
||||||
await Db.init();
|
await Db.init();
|
||||||
} else if (inputData.workflowData.settings !== undefined && inputData.workflowData.settings.saveExecutionProgress !== false && config.get('executions.saveExecutionProgress') as boolean) {
|
} else if (inputData.workflowData.settings !== undefined && inputData.workflowData.settings.saveExecutionProgress !== false && config.get('executions.saveExecutionProgress') as boolean) {
|
||||||
|
@ -135,7 +148,7 @@ export class WorkflowRunnerProcess {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.workflow = new Workflow({ id: this.data.workflowData.id as string | undefined, name: this.data.workflowData.name, nodes: this.data.workflowData!.nodes, connections: this.data.workflowData!.connections, active: this.data.workflowData!.active, nodeTypes, staticData: this.data.workflowData!.staticData, settings: this.data.workflowData!.settings });
|
this.workflow = new Workflow({ id: this.data.workflowData.id as string | undefined, name: this.data.workflowData.name, nodes: this.data.workflowData!.nodes, connections: this.data.workflowData!.connections, active: this.data.workflowData!.active, nodeTypes, staticData: this.data.workflowData!.staticData, settings: this.data.workflowData!.settings });
|
||||||
const additionalData = await WorkflowExecuteAdditionalData.getBase(this.data.credentials, undefined, workflowTimeout <= 0 ? undefined : Date.now() + workflowTimeout * 1000);
|
const additionalData = await WorkflowExecuteAdditionalData.getBase(undefined, workflowTimeout <= 0 ? undefined : Date.now() + workflowTimeout * 1000);
|
||||||
additionalData.hooks = this.getProcessForwardHooks();
|
additionalData.hooks = this.getProcessForwardHooks();
|
||||||
|
|
||||||
additionalData.sendMessageToUI = async (source: string, message: any) => { // tslint:disable-line:no-any
|
additionalData.sendMessageToUI = async (source: string, message: any) => { // tslint:disable-line:no-any
|
||||||
|
|
|
@ -155,8 +155,8 @@ export async function prepareBinaryData(binaryData: Buffer, filePath?: string, m
|
||||||
*
|
*
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, node: INode, additionalData: IWorkflowExecuteAdditionalData, oAuth2Options?: IOAuth2Options) {
|
export async function requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, node: INode, additionalData: IWorkflowExecuteAdditionalData, oAuth2Options?: IOAuth2Options) {
|
||||||
const credentials = this.getCredentials(credentialsType) as ICredentialDataDecryptedObject;
|
const credentials = await this.getCredentials(credentialsType) as ICredentialDataDecryptedObject;
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new Error('No credentials got returned!');
|
throw new Error('No credentials got returned!');
|
||||||
|
@ -244,8 +244,8 @@ export function requestOAuth2(this: IAllExecuteFunctions, credentialsType: strin
|
||||||
* @param {(OptionsWithUrl | requestPromise.RequestPromiseOptions)} requestOptionså
|
* @param {(OptionsWithUrl | requestPromise.RequestPromiseOptions)} requestOptionså
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | OptionsWithUri | requestPromise.RequestPromiseOptions) {
|
export async function requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | OptionsWithUri | requestPromise.RequestPromiseOptions) {
|
||||||
const credentials = this.getCredentials(credentialsType) as ICredentialDataDecryptedObject;
|
const credentials = await this.getCredentials(credentialsType) as ICredentialDataDecryptedObject;
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new Error('No credentials got returned!');
|
throw new Error('No credentials got returned!');
|
||||||
|
@ -332,7 +332,7 @@ export function returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExe
|
||||||
* @param {IWorkflowExecuteAdditionalData} additionalData
|
* @param {IWorkflowExecuteAdditionalData} additionalData
|
||||||
* @returns {(ICredentialDataDecryptedObject | undefined)}
|
* @returns {(ICredentialDataDecryptedObject | undefined)}
|
||||||
*/
|
*/
|
||||||
export function getCredentials(workflow: Workflow, node: INode, type: string, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, runExecutionData?: IRunExecutionData | null, runIndex?: number, connectionInputData?: INodeExecutionData[], itemIndex?: number): ICredentialDataDecryptedObject | undefined {
|
export async function getCredentials(workflow: Workflow, node: INode, type: string, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, runExecutionData?: IRunExecutionData | null, runIndex?: number, connectionInputData?: INodeExecutionData[], itemIndex?: number): Promise<ICredentialDataDecryptedObject | undefined> {
|
||||||
|
|
||||||
// Get the NodeType as it has the information if the credentials are required
|
// Get the NodeType as it has the information if the credentials are required
|
||||||
const nodeType = workflow.nodeTypes.getByName(node.type);
|
const nodeType = workflow.nodeTypes.getByName(node.type);
|
||||||
|
@ -386,7 +386,7 @@ export function getCredentials(workflow: Workflow, node: INode, type: string, ad
|
||||||
|
|
||||||
const name = node.credentials[type];
|
const name = node.credentials[type];
|
||||||
|
|
||||||
const decryptedDataObject = additionalData.credentialsHelper.getDecrypted(name, type, mode, false, expressionResolveValues);
|
const decryptedDataObject = await additionalData.credentialsHelper.getDecrypted(name, type, mode, false, expressionResolveValues);
|
||||||
|
|
||||||
return decryptedDataObject;
|
return decryptedDataObject;
|
||||||
}
|
}
|
||||||
|
@ -570,8 +570,8 @@ export function getExecutePollFunctions(workflow: Workflow, node: INode, additio
|
||||||
__emit: (data: INodeExecutionData[][]): void => {
|
__emit: (data: INodeExecutionData[][]): void => {
|
||||||
throw new Error('Overwrite NodeExecuteFunctions.getExecutePullFunctions.__emit function!');
|
throw new Error('Overwrite NodeExecuteFunctions.getExecutePullFunctions.__emit function!');
|
||||||
},
|
},
|
||||||
getCredentials(type: string): ICredentialDataDecryptedObject | undefined {
|
async getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined> {
|
||||||
return getCredentials(workflow, node, type, additionalData, mode);
|
return await getCredentials(workflow, node, type, additionalData, mode);
|
||||||
},
|
},
|
||||||
getMode: (): WorkflowExecuteMode => {
|
getMode: (): WorkflowExecuteMode => {
|
||||||
return mode;
|
return mode;
|
||||||
|
@ -636,8 +636,8 @@ export function getExecuteTriggerFunctions(workflow: Workflow, node: INode, addi
|
||||||
emit: (data: INodeExecutionData[][]): void => {
|
emit: (data: INodeExecutionData[][]): void => {
|
||||||
throw new Error('Overwrite NodeExecuteFunctions.getExecuteTriggerFunctions.emit function!');
|
throw new Error('Overwrite NodeExecuteFunctions.getExecuteTriggerFunctions.emit function!');
|
||||||
},
|
},
|
||||||
getCredentials(type: string): ICredentialDataDecryptedObject | undefined {
|
async getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined> {
|
||||||
return getCredentials(workflow, node, type, additionalData, mode);
|
return await getCredentials(workflow, node, type, additionalData, mode);
|
||||||
},
|
},
|
||||||
getNode: () => {
|
getNode: () => {
|
||||||
return getNode(node);
|
return getNode(node);
|
||||||
|
@ -714,8 +714,8 @@ export function getExecuteFunctions(workflow: Workflow, runExecutionData: IRunEx
|
||||||
getContext(type: string): IContextObject {
|
getContext(type: string): IContextObject {
|
||||||
return NodeHelpers.getContext(runExecutionData, type, node);
|
return NodeHelpers.getContext(runExecutionData, type, node);
|
||||||
},
|
},
|
||||||
getCredentials(type: string, itemIndex?: number): ICredentialDataDecryptedObject | undefined {
|
async getCredentials(type: string, itemIndex?: number): Promise<ICredentialDataDecryptedObject | undefined> {
|
||||||
return getCredentials(workflow, node, type, additionalData, mode, runExecutionData, runIndex, connectionInputData, itemIndex);
|
return await getCredentials(workflow, node, type, additionalData, mode, runExecutionData, runIndex, connectionInputData, itemIndex);
|
||||||
},
|
},
|
||||||
getInputData: (inputIndex = 0, inputName = 'main') => {
|
getInputData: (inputIndex = 0, inputName = 'main') => {
|
||||||
|
|
||||||
|
@ -824,8 +824,8 @@ export function getExecuteSingleFunctions(workflow: Workflow, runExecutionData:
|
||||||
getContext(type: string): IContextObject {
|
getContext(type: string): IContextObject {
|
||||||
return NodeHelpers.getContext(runExecutionData, type, node);
|
return NodeHelpers.getContext(runExecutionData, type, node);
|
||||||
},
|
},
|
||||||
getCredentials(type: string): ICredentialDataDecryptedObject | undefined {
|
async getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined> {
|
||||||
return getCredentials(workflow, node, type, additionalData, mode, runExecutionData, runIndex, connectionInputData, itemIndex);
|
return await getCredentials(workflow, node, type, additionalData, mode, runExecutionData, runIndex, connectionInputData, itemIndex);
|
||||||
},
|
},
|
||||||
getInputData: (inputIndex = 0, inputName = 'main') => {
|
getInputData: (inputIndex = 0, inputName = 'main') => {
|
||||||
if (!inputData.hasOwnProperty(inputName)) {
|
if (!inputData.hasOwnProperty(inputName)) {
|
||||||
|
@ -904,8 +904,8 @@ export function getExecuteSingleFunctions(workflow: Workflow, runExecutionData:
|
||||||
export function getLoadOptionsFunctions(workflow: Workflow, node: INode, path: string, additionalData: IWorkflowExecuteAdditionalData): ILoadOptionsFunctions {
|
export function getLoadOptionsFunctions(workflow: Workflow, node: INode, path: string, additionalData: IWorkflowExecuteAdditionalData): ILoadOptionsFunctions {
|
||||||
return ((workflow: Workflow, node: INode, path: string) => {
|
return ((workflow: Workflow, node: INode, path: string) => {
|
||||||
const that = {
|
const that = {
|
||||||
getCredentials(type: string): ICredentialDataDecryptedObject | undefined {
|
async getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined> {
|
||||||
return getCredentials(workflow, node, type, additionalData, 'internal');
|
return await getCredentials(workflow, node, type, additionalData, 'internal');
|
||||||
},
|
},
|
||||||
getCurrentNodeParameter: (parameterPath: string): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object | undefined => {
|
getCurrentNodeParameter: (parameterPath: string): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object | undefined => {
|
||||||
const nodeParameters = additionalData.currentNodeParameters;
|
const nodeParameters = additionalData.currentNodeParameters;
|
||||||
|
@ -965,8 +965,8 @@ export function getLoadOptionsFunctions(workflow: Workflow, node: INode, path: s
|
||||||
export function getExecuteHookFunctions(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, activation: WorkflowActivateMode, isTest?: boolean, webhookData?: IWebhookData): IHookFunctions {
|
export function getExecuteHookFunctions(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, activation: WorkflowActivateMode, isTest?: boolean, webhookData?: IWebhookData): IHookFunctions {
|
||||||
return ((workflow: Workflow, node: INode) => {
|
return ((workflow: Workflow, node: INode) => {
|
||||||
const that = {
|
const that = {
|
||||||
getCredentials(type: string): ICredentialDataDecryptedObject | undefined {
|
async getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined> {
|
||||||
return getCredentials(workflow, node, type, additionalData, mode);
|
return await getCredentials(workflow, node, type, additionalData, mode);
|
||||||
},
|
},
|
||||||
getMode: (): WorkflowExecuteMode => {
|
getMode: (): WorkflowExecuteMode => {
|
||||||
return mode;
|
return mode;
|
||||||
|
@ -1042,8 +1042,8 @@ export function getExecuteWebhookFunctions(workflow: Workflow, node: INode, addi
|
||||||
}
|
}
|
||||||
return additionalData.httpRequest.body;
|
return additionalData.httpRequest.body;
|
||||||
},
|
},
|
||||||
getCredentials(type: string): ICredentialDataDecryptedObject | undefined {
|
async getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined> {
|
||||||
return getCredentials(workflow, node, type, additionalData, mode);
|
return await getCredentials(workflow, node, type, additionalData, mode);
|
||||||
},
|
},
|
||||||
getHeaderData(): object {
|
getHeaderData(): object {
|
||||||
if (additionalData.httpRequest === undefined) {
|
if (additionalData.httpRequest === undefined) {
|
||||||
|
|
|
@ -26,12 +26,14 @@ import {
|
||||||
|
|
||||||
|
|
||||||
export class CredentialsHelper extends ICredentialsHelper {
|
export class CredentialsHelper extends ICredentialsHelper {
|
||||||
getDecrypted(name: string, type: string): ICredentialDataDecryptedObject {
|
getDecrypted(name: string, type: string): Promise<ICredentialDataDecryptedObject> {
|
||||||
return {};
|
return new Promise(res => res({}));
|
||||||
}
|
}
|
||||||
|
|
||||||
getCredentials(name: string, type: string): Credentials {
|
getCredentials(name: string, type: string): Promise<Credentials> {
|
||||||
return new Credentials('', '', [], '');
|
return new Promise(res => {
|
||||||
|
res(new Credentials('', '', [], ''));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateCredentials(name: string, type: string, data: ICredentialDataDecryptedObject): Promise<void> {}
|
async updateCredentials(name: string, type: string, data: ICredentialDataDecryptedObject): Promise<void> {}
|
||||||
|
@ -748,8 +750,7 @@ export function WorkflowExecuteAdditionalData(waitPromise: IDeferredPromise<IRun
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
credentials: {},
|
credentialsHelper: new CredentialsHelper(''),
|
||||||
credentialsHelper: new CredentialsHelper({}, ''),
|
|
||||||
hooks: new WorkflowHooks(hookFunctions, 'trigger', '1', workflowData),
|
hooks: new WorkflowHooks(hookFunctions, 'trigger', '1', workflowData),
|
||||||
executeWorkflow: async (workflowInfo: IExecuteWorkflowInfo): Promise<any> => {}, // tslint:disable-line:no-any
|
executeWorkflow: async (workflowInfo: IExecuteWorkflowInfo): Promise<any> => {}, // tslint:disable-line:no-any
|
||||||
sendMessageToUI: (message: string) => {},
|
sendMessageToUI: (message: string) => {},
|
||||||
|
|
|
@ -35,7 +35,7 @@ export async function actionNetworkApiRequest(
|
||||||
body: IDataObject = {},
|
body: IDataObject = {},
|
||||||
qs: IDataObject = {},
|
qs: IDataObject = {},
|
||||||
) {
|
) {
|
||||||
const credentials = this.getCredentials('actionNetworkApi') as { apiKey: string } | undefined;
|
const credentials = await this.getCredentials('actionNetworkApi') as { apiKey: string } | undefined;
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -26,7 +26,7 @@ export interface IProduct {
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
export async function activeCampaignApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: IDataObject, query?: IDataObject, dataKey?: string): Promise<any> { // tslint:disable-line:no-any
|
export async function activeCampaignApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: IDataObject, query?: IDataObject, dataKey?: string): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('activeCampaignApi');
|
const credentials = await this.getCredentials('activeCampaignApi');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ export async function acuitySchedulingApiRequest(this: IHookFunctions | IExecute
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (authenticationMethod === 'apiKey') {
|
if (authenticationMethod === 'apiKey') {
|
||||||
const credentials = this.getCredentials('acuitySchedulingApi');
|
const credentials = await this.getCredentials('acuitySchedulingApi');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import {
|
||||||
|
|
||||||
export async function affinityApiRequest(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function affinityApiRequest(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('affinityApi');
|
const credentials = await this.getCredentials('affinityApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { IContactUpdate } from './ContactInterface';
|
||||||
|
|
||||||
export async function agileCrmApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: any = {}, query: IDataObject = {}, uri?: string): Promise<any> { // tslint:disable-line:no-any
|
export async function agileCrmApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: any = {}, query: IDataObject = {}, uri?: string): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('agileCrmApi');
|
const credentials = await this.getCredentials('agileCrmApi');
|
||||||
const options: OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
method,
|
method,
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -46,7 +46,7 @@ export async function agileCrmApiRequest(this: IHookFunctions | IExecuteFunction
|
||||||
|
|
||||||
export async function agileCrmApiRequestUpdate(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method = 'PUT', endpoint?: string, body: any = {}, query: IDataObject = {}, uri?: string): Promise<any> { // tslint:disable-line:no-any
|
export async function agileCrmApiRequestUpdate(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method = 'PUT', endpoint?: string, body: any = {}, query: IDataObject = {}, uri?: string): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('agileCrmApi');
|
const credentials = await this.getCredentials('agileCrmApi');
|
||||||
const baseUri = `https://${credentials!.subdomain}.agilecrm.com/dev/`;
|
const baseUri = `https://${credentials!.subdomain}.agilecrm.com/dev/`;
|
||||||
const options: OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
method,
|
method,
|
||||||
|
|
|
@ -40,7 +40,7 @@ export interface IRecord {
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
export async function apiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions, method: string, endpoint: string, body: object, query?: IDataObject, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function apiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions, method: string, endpoint: string, body: object, query?: IDataObject, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('airtableApi');
|
const credentials = await this.getCredentials('airtableApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -98,7 +98,7 @@ export class Amqp implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
try {
|
try {
|
||||||
const credentials = this.getCredentials('amqp');
|
const credentials = await this.getCredentials('amqp');
|
||||||
if (!credentials) {
|
if (!credentials) {
|
||||||
throw new NodeOperationError(this.getNode(), 'Credentials are mandatory!');
|
throw new NodeOperationError(this.getNode(), 'Credentials are mandatory!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ export class AmqpTrigger implements INodeType {
|
||||||
|
|
||||||
async trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {
|
async trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {
|
||||||
|
|
||||||
const credentials = this.getCredentials('amqp');
|
const credentials = await this.getCredentials('amqp');
|
||||||
if (!credentials) {
|
if (!credentials) {
|
||||||
throw new NodeOperationError(this.getNode(), 'Credentials are mandatory!');
|
throw new NodeOperationError(this.getNode(), 'Credentials are mandatory!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ export async function apiTemplateIoApiRequest(
|
||||||
qs = {},
|
qs = {},
|
||||||
body = {},
|
body = {},
|
||||||
) {
|
) {
|
||||||
const { apiKey } = this.getCredentials('apiTemplateIoApi') as { apiKey: string };
|
const { apiKey } = await this.getCredentials('apiTemplateIoApi') as { apiKey: string };
|
||||||
|
|
||||||
const options: OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
@ -42,7 +42,7 @@ export async function asanaApiRequest(this: IHookFunctions | IExecuteFunctions |
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (authenticationMethod === 'accessToken') {
|
if (authenticationMethod === 'accessToken') {
|
||||||
const credentials = this.getCredentials('asanaApi');
|
const credentials = await this.getCredentials('asanaApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
|
|
||||||
export async function automizyApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, path: string, body: any = {}, qs: IDataObject = {}, option = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function automizyApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, path: string, body: any = {}, qs: IDataObject = {}, option = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('automizyApi') as IDataObject;
|
const credentials = await this.getCredentials('automizyApi') as IDataObject;
|
||||||
|
|
||||||
const options: OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
@ -16,7 +16,7 @@ import {
|
||||||
|
|
||||||
export async function autopilotApiRequest(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function autopilotApiRequest(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('autopilotApi') as IDataObject;
|
const credentials = await this.getCredentials('autopilotApi') as IDataObject;
|
||||||
|
|
||||||
const apiKey = `${credentials.apiKey}`;
|
const apiKey = `${credentials.apiKey}`;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ function getEndpointForService(service: string, credentials: ICredentialDataDecr
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('aws');
|
const credentials = await this.getCredentials('aws');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ function getEndpointForService(service: string, credentials: ICredentialDataDecr
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: object | IRequestBody, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: object | IRequestBody, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('aws');
|
const credentials = await this.getCredentials('aws');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new Error('No credentials got returned!');
|
throw new Error('No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ function getEndpointForService(service: string, credentials: ICredentialDataDecr
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('aws');
|
const credentials = await this.getCredentials('aws');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ import {
|
||||||
} from 'change-case';
|
} from 'change-case';
|
||||||
|
|
||||||
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string | Buffer | IDataObject, query: IDataObject = {}, headers?: object, option: IDataObject = {}, region?: string): Promise<any> { // tslint:disable-line:no-any
|
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string | Buffer | IDataObject, query: IDataObject = {}, headers?: object, option: IDataObject = {}, region?: string): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('aws');
|
const credentials = await this.getCredentials('aws');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ export class AwsS3 implements INodeType {
|
||||||
if (resource === 'bucket') {
|
if (resource === 'bucket') {
|
||||||
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html
|
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html
|
||||||
if (operation === 'create') {
|
if (operation === 'create') {
|
||||||
const credentials = this.getCredentials('aws');
|
const credentials = await this.getCredentials('aws');
|
||||||
const name = this.getNodeParameter('name', i) as string;
|
const name = this.getNodeParameter('name', i) as string;
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
if (additionalFields.acl) {
|
if (additionalFields.acl) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ import {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string | Buffer, query: IDataObject = {}, headers?: object, option: IDataObject = {}, region?: string): Promise<any> { // tslint:disable-line:no-any
|
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string | Buffer, query: IDataObject = {}, headers?: object, option: IDataObject = {}, region?: string): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('aws');
|
const credentials = await this.getCredentials('aws');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ import {
|
||||||
} from 'lodash';
|
} from 'lodash';
|
||||||
|
|
||||||
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('aws');
|
const credentials = await this.getCredentials('aws');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ function getEndpointForService(service: string, credentials: ICredentialDataDecr
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('aws');
|
const credentials = await this.getCredentials('aws');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import {
|
||||||
|
|
||||||
export async function bannerbearApiRequest(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, headers: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function bannerbearApiRequest(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, headers: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('bannerbearApi');
|
const credentials = await this.getCredentials('bannerbearApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -114,7 +114,7 @@ export class Baserow implements INodeType {
|
||||||
methods = {
|
methods = {
|
||||||
loadOptions: {
|
loadOptions: {
|
||||||
async getDatabaseIds(this: ILoadOptionsFunctions) {
|
async getDatabaseIds(this: ILoadOptionsFunctions) {
|
||||||
const credentials = this.getCredentials('baserowApi') as BaserowCredentials;
|
const credentials = await this.getCredentials('baserowApi') as BaserowCredentials;
|
||||||
const jwtToken = await getJwtToken.call(this, credentials);
|
const jwtToken = await getJwtToken.call(this, credentials);
|
||||||
const endpoint = '/api/applications/';
|
const endpoint = '/api/applications/';
|
||||||
const databases = await baserowApiRequest.call(this, 'GET', endpoint, {}, {}, jwtToken) as LoadedResource[];
|
const databases = await baserowApiRequest.call(this, 'GET', endpoint, {}, {}, jwtToken) as LoadedResource[];
|
||||||
|
@ -122,7 +122,7 @@ export class Baserow implements INodeType {
|
||||||
},
|
},
|
||||||
|
|
||||||
async getTableIds(this: ILoadOptionsFunctions) {
|
async getTableIds(this: ILoadOptionsFunctions) {
|
||||||
const credentials = this.getCredentials('baserowApi') as BaserowCredentials;
|
const credentials = await this.getCredentials('baserowApi') as BaserowCredentials;
|
||||||
const jwtToken = await getJwtToken.call(this, credentials);
|
const jwtToken = await getJwtToken.call(this, credentials);
|
||||||
const databaseId = this.getNodeParameter('databaseId', 0) as string;
|
const databaseId = this.getNodeParameter('databaseId', 0) as string;
|
||||||
const endpoint = `/api/database/tables/database/${databaseId}`;
|
const endpoint = `/api/database/tables/database/${databaseId}`;
|
||||||
|
@ -131,7 +131,7 @@ export class Baserow implements INodeType {
|
||||||
},
|
},
|
||||||
|
|
||||||
async getTableFields(this: ILoadOptionsFunctions) {
|
async getTableFields(this: ILoadOptionsFunctions) {
|
||||||
const credentials = this.getCredentials('baserowApi') as BaserowCredentials;
|
const credentials = await this.getCredentials('baserowApi') as BaserowCredentials;
|
||||||
const jwtToken = await getJwtToken.call(this, credentials);
|
const jwtToken = await getJwtToken.call(this, credentials);
|
||||||
const tableId = this.getNodeParameter('tableId', 0) as string;
|
const tableId = this.getNodeParameter('tableId', 0) as string;
|
||||||
const endpoint = `/api/database/fields/table/${tableId}/`;
|
const endpoint = `/api/database/fields/table/${tableId}/`;
|
||||||
|
@ -148,7 +148,7 @@ export class Baserow implements INodeType {
|
||||||
const operation = this.getNodeParameter('operation', 0) as Operation;
|
const operation = this.getNodeParameter('operation', 0) as Operation;
|
||||||
|
|
||||||
const tableId = this.getNodeParameter('tableId', 0) as string;
|
const tableId = this.getNodeParameter('tableId', 0) as string;
|
||||||
const credentials = this.getCredentials('baserowApi') as BaserowCredentials;
|
const credentials = await this.getCredentials('baserowApi') as BaserowCredentials;
|
||||||
const jwtToken = await getJwtToken.call(this, credentials);
|
const jwtToken = await getJwtToken.call(this, credentials);
|
||||||
const fields = await mapper.getTableFields.call(this, tableId, jwtToken);
|
const fields = await mapper.getTableFields.call(this, tableId, jwtToken);
|
||||||
mapper.createMappings(fields);
|
mapper.createMappings(fields);
|
||||||
|
|
|
@ -30,7 +30,7 @@ export async function baserowApiRequest(
|
||||||
qs: IDataObject = {},
|
qs: IDataObject = {},
|
||||||
jwtToken: string,
|
jwtToken: string,
|
||||||
) {
|
) {
|
||||||
const credentials = this.getCredentials('baserowApi') as BaserowCredentials;
|
const credentials = await this.getCredentials('baserowApi') as BaserowCredentials;
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -16,7 +16,7 @@ import {
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
|
||||||
export async function createDatapoint(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, data: IDataObject) {
|
export async function createDatapoint(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, data: IDataObject) {
|
||||||
const credentials = this.getCredentials('beeminderApi');
|
const credentials = await this.getCredentials('beeminderApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
@ -28,7 +28,7 @@ export async function createDatapoint(this: IExecuteFunctions | IWebhookFunction
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getAllDatapoints(this: IExecuteFunctions | IHookFunctions | ILoadOptionsFunctions, data: IDataObject) {
|
export async function getAllDatapoints(this: IExecuteFunctions | IHookFunctions | ILoadOptionsFunctions, data: IDataObject) {
|
||||||
const credentials = this.getCredentials('beeminderApi');
|
const credentials = await this.getCredentials('beeminderApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
@ -44,7 +44,7 @@ export async function getAllDatapoints(this: IExecuteFunctions | IHookFunctions
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateDatapoint(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, data: IDataObject) {
|
export async function updateDatapoint(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, data: IDataObject) {
|
||||||
const credentials = this.getCredentials('beeminderApi');
|
const credentials = await this.getCredentials('beeminderApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
@ -56,7 +56,7 @@ export async function updateDatapoint(this: IExecuteFunctions | IWebhookFunction
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteDatapoint(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, data: IDataObject) {
|
export async function deleteDatapoint(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, data: IDataObject) {
|
||||||
const credentials = this.getCredentials('beeminderApi');
|
const credentials = await this.getCredentials('beeminderApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -306,7 +306,7 @@ export class Beeminder implements INodeType {
|
||||||
// select them easily
|
// select them easily
|
||||||
async getGoals(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
async getGoals(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
|
||||||
const credentials = this.getCredentials('beeminderApi');
|
const credentials = await this.getCredentials('beeminderApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -18,7 +18,7 @@ const BEEMINDER_URI = 'https://www.beeminder.com/api/v1';
|
||||||
|
|
||||||
export async function beeminderApiRequest(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function beeminderApiRequest(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('beeminderApi') as IDataObject;
|
const credentials = await this.getCredentials('beeminderApi') as IDataObject;
|
||||||
|
|
||||||
Object.assign(body, { auth_token: credentials.authToken });
|
Object.assign(body, { auth_token: credentials.authToken });
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,7 @@ export class BitbucketTrigger implements INodeType {
|
||||||
// Get all the repositories to display them to user so that he can
|
// Get all the repositories to display them to user so that he can
|
||||||
// select them easily
|
// select them easily
|
||||||
async getRepositories(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
async getRepositories(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
const credentials = this.getCredentials('bitbucketApi');
|
const credentials = await this.getCredentials('bitbucketApi');
|
||||||
const returnData: INodePropertyOptions[] = [];
|
const returnData: INodePropertyOptions[] = [];
|
||||||
const repositories = await bitbucketApiRequestAllItems.call(this, 'values', 'GET', `/repositories/${credentials!.username}`);
|
const repositories = await bitbucketApiRequestAllItems.call(this, 'values', 'GET', `/repositories/${credentials!.username}`);
|
||||||
for (const repository of repositories) {
|
for (const repository of repositories) {
|
||||||
|
@ -261,7 +261,7 @@ export class BitbucketTrigger implements INodeType {
|
||||||
default: {
|
default: {
|
||||||
async checkExists(this: IHookFunctions): Promise<boolean> {
|
async checkExists(this: IHookFunctions): Promise<boolean> {
|
||||||
let endpoint = '';
|
let endpoint = '';
|
||||||
const credentials = this.getCredentials('bitbucketApi');
|
const credentials = await this.getCredentials('bitbucketApi');
|
||||||
const resource = this.getNodeParameter('resource', 0) as string;
|
const resource = this.getNodeParameter('resource', 0) as string;
|
||||||
const webhookData = this.getWorkflowStaticData('node');
|
const webhookData = this.getWorkflowStaticData('node');
|
||||||
if (webhookData.webhookId === undefined) {
|
if (webhookData.webhookId === undefined) {
|
||||||
|
@ -292,7 +292,7 @@ export class BitbucketTrigger implements INodeType {
|
||||||
const webhookData = this.getWorkflowStaticData('node');
|
const webhookData = this.getWorkflowStaticData('node');
|
||||||
const events = this.getNodeParameter('events') as string[];
|
const events = this.getNodeParameter('events') as string[];
|
||||||
const resource = this.getNodeParameter('resource', 0) as string;
|
const resource = this.getNodeParameter('resource', 0) as string;
|
||||||
const credentials = this.getCredentials('bitbucketApi');
|
const credentials = await this.getCredentials('bitbucketApi');
|
||||||
|
|
||||||
if (resource === 'user') {
|
if (resource === 'user') {
|
||||||
endpoint = `/users/${credentials!.username}/hooks`;
|
endpoint = `/users/${credentials!.username}/hooks`;
|
||||||
|
@ -318,7 +318,7 @@ export class BitbucketTrigger implements INodeType {
|
||||||
async delete(this: IHookFunctions): Promise<boolean> {
|
async delete(this: IHookFunctions): Promise<boolean> {
|
||||||
let endpoint = '';
|
let endpoint = '';
|
||||||
const webhookData = this.getWorkflowStaticData('node');
|
const webhookData = this.getWorkflowStaticData('node');
|
||||||
const credentials = this.getCredentials('bitbucketApi');
|
const credentials = await this.getCredentials('bitbucketApi');
|
||||||
const resource = this.getNodeParameter('resource', 0) as string;
|
const resource = this.getNodeParameter('resource', 0) as string;
|
||||||
if (resource === 'user') {
|
if (resource === 'user') {
|
||||||
endpoint = `/users/${credentials!.username}/hooks/${webhookData.webhookId}`;
|
endpoint = `/users/${credentials!.username}/hooks/${webhookData.webhookId}`;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
import { IDataObject, NodeApiError, NodeOperationError, } from 'n8n-workflow';
|
import { IDataObject, NodeApiError, NodeOperationError, } from 'n8n-workflow';
|
||||||
|
|
||||||
export async function bitbucketApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function bitbucketApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('bitbucketApi');
|
const credentials = await this.getCredentials('bitbucketApi');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ export async function bitlyApiRequest(this: IHookFunctions | IExecuteFunctions |
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if (authenticationMethod === 'accessToken') {
|
if (authenticationMethod === 'accessToken') {
|
||||||
const credentials = this.getCredentials('bitlyApi');
|
const credentials = await this.getCredentials('bitlyApi');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ export async function bitwardenApiRequest(
|
||||||
token: string,
|
token: string,
|
||||||
): Promise<any> { // tslint:disable-line:no-any
|
): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
|
const baseUrl = await getBaseUrl.call(this);
|
||||||
const options: OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
headers: {
|
headers: {
|
||||||
'user-agent': 'n8n',
|
'user-agent': 'n8n',
|
||||||
|
@ -34,7 +35,7 @@ export async function bitwardenApiRequest(
|
||||||
method,
|
method,
|
||||||
qs,
|
qs,
|
||||||
body,
|
body,
|
||||||
uri: `${getBaseUrl.call(this)}${endpoint}`,
|
uri: `${baseUrl}${endpoint}`,
|
||||||
json: true,
|
json: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ export async function getAccessToken(
|
||||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||||
): Promise<any> { // tslint:disable-line:no-any
|
): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('bitwardenApi') as IDataObject;
|
const credentials = await this.getCredentials('bitwardenApi') as IDataObject;
|
||||||
|
|
||||||
const options: OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -76,7 +77,7 @@ export async function getAccessToken(
|
||||||
deviceType: 2, // https://github.com/bitwarden/server/blob/master/src/Core/Enums/DeviceType.cs
|
deviceType: 2, // https://github.com/bitwarden/server/blob/master/src/Core/Enums/DeviceType.cs
|
||||||
deviceIdentifier: 'n8n',
|
deviceIdentifier: 'n8n',
|
||||||
},
|
},
|
||||||
uri: getTokenUrl.call(this),
|
uri: await getTokenUrl.call(this),
|
||||||
json: true,
|
json: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -114,8 +115,8 @@ export async function handleGetAll(
|
||||||
/**
|
/**
|
||||||
* Return the access token URL based on the user's environment.
|
* Return the access token URL based on the user's environment.
|
||||||
*/
|
*/
|
||||||
function getTokenUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {
|
async function getTokenUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {
|
||||||
const { environment, domain } = this.getCredentials('bitwardenApi') as IDataObject;
|
const { environment, domain } = await this.getCredentials('bitwardenApi') as IDataObject;
|
||||||
|
|
||||||
return environment === 'cloudHosted'
|
return environment === 'cloudHosted'
|
||||||
? 'https://identity.bitwarden.com/connect/token'
|
? 'https://identity.bitwarden.com/connect/token'
|
||||||
|
@ -126,8 +127,8 @@ function getTokenUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {
|
||||||
/**
|
/**
|
||||||
* Return the base API URL based on the user's environment.
|
* Return the base API URL based on the user's environment.
|
||||||
*/
|
*/
|
||||||
function getBaseUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {
|
async function getBaseUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {
|
||||||
const { environment, domain } = this.getCredentials('bitwardenApi') as IDataObject;
|
const { environment, domain } = await this.getCredentials('bitwardenApi') as IDataObject;
|
||||||
|
|
||||||
return environment === 'cloudHosted'
|
return environment === 'cloudHosted'
|
||||||
? 'https://api.bitwarden.com'
|
? 'https://api.bitwarden.com'
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
|
|
||||||
export async function brandfetchApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function brandfetchApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
try {
|
try {
|
||||||
const credentials = this.getCredentials('brandfetchApi');
|
const credentials = await this.getCredentials('brandfetchApi');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ export async function bubbleApiRequest(
|
||||||
qs: IDataObject,
|
qs: IDataObject,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
const { apiToken, appName, domain, environment, hosting } = this.getCredentials('bubbleApi') as {
|
const { apiToken, appName, domain, environment, hosting } = await this.getCredentials('bubbleApi') as {
|
||||||
apiToken: string,
|
apiToken: string,
|
||||||
appName: string,
|
appName: string,
|
||||||
domain: string,
|
domain: string,
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
|
|
||||||
export async function calendlyApiRequest(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function calendlyApiRequest(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('calendlyApi');
|
const credentials = await this.getCredentials('calendlyApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -488,7 +488,7 @@ export class Chargebee implements INodeType {
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: IDataObject[] = [];
|
||||||
let item: INodeExecutionData;
|
let item: INodeExecutionData;
|
||||||
|
|
||||||
const credentials = this.getCredentials('chargebeeApi');
|
const credentials = await this.getCredentials('chargebeeApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
export async function circleciApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function circleciApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('circleCiApi');
|
const credentials = await this.getCredentials('circleCiApi');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {
|
||||||
INodeType,
|
INodeType,
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
IWebhookResponseData,
|
IWebhookResponseData,
|
||||||
|
NodeOperationError,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -600,7 +601,11 @@ export class CiscoWebexTrigger implements INodeType {
|
||||||
const event = this.getNodeParameter('event') as string;
|
const event = this.getNodeParameter('event') as string;
|
||||||
const resource = this.getNodeParameter('resource') as string;
|
const resource = this.getNodeParameter('resource') as string;
|
||||||
const filters = this.getNodeParameter('filters', {}) as IDataObject;
|
const filters = this.getNodeParameter('filters', {}) as IDataObject;
|
||||||
const secret = getAutomaticSecret(this.getCredentials('ciscoWebexOAuth2Api')!);
|
const credentials = await this.getCredentials('ciscoWebexOAuth2Api');
|
||||||
|
if (credentials === undefined) {
|
||||||
|
throw new NodeOperationError(this.getNode(), 'Credentials could not be obtained');
|
||||||
|
}
|
||||||
|
const secret = getAutomaticSecret(credentials);
|
||||||
const filter = [];
|
const filter = [];
|
||||||
for (const key of Object.keys(filters)) {
|
for (const key of Object.keys(filters)) {
|
||||||
if (key !== 'ownedBy') {
|
if (key !== 'ownedBy') {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {
|
||||||
import { IDataObject, NodeApiError, NodeOperationError, } from 'n8n-workflow';
|
import { IDataObject, NodeApiError, NodeOperationError, } from 'n8n-workflow';
|
||||||
|
|
||||||
export async function clearbitApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, api: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function clearbitApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, api: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('clearbitApi');
|
const credentials = await this.getCredentials('clearbitApi');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ export async function clickupApiRequest(this: IHookFunctions | IExecuteFunctions
|
||||||
|
|
||||||
if (authenticationMethod === 'accessToken') {
|
if (authenticationMethod === 'accessToken') {
|
||||||
|
|
||||||
const credentials = this.getCredentials('clickUpApi');
|
const credentials = await this.getCredentials('clickUpApi');
|
||||||
|
|
||||||
options.headers!['Authorization'] = credentials?.accessToken;
|
options.headers!['Authorization'] = credentials?.accessToken;
|
||||||
return await this.helpers.request!(options);
|
return await this.helpers.request!(options);
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
|
|
||||||
export async function clockifyApiRequest(this: ILoadOptionsFunctions | IPollFunctions | IExecuteFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function clockifyApiRequest(this: ILoadOptionsFunctions | IPollFunctions | IExecuteFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('clockifyApi');
|
const credentials = await this.getCredentials('clockifyApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { IDataObject, NodeApiError, NodeOperationError, } from 'n8n-workflow';
|
||||||
import { OptionsWithUri } from 'request';
|
import { OptionsWithUri } from 'request';
|
||||||
|
|
||||||
export async function cockpitApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function cockpitApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('cockpitApi');
|
const credentials = await this.getCredentials('cockpitApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials available.');
|
throw new NodeOperationError(this.getNode(), 'No credentials available.');
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
import { IDataObject, NodeApiError, NodeOperationError, } from 'n8n-workflow';
|
import { IDataObject, NodeApiError, NodeOperationError, } from 'n8n-workflow';
|
||||||
|
|
||||||
export async function codaApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function codaApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('codaApi');
|
const credentials = await this.getCredentials('codaApi');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ export class Contentful implements INodeType {
|
||||||
if (resource === 'space') {
|
if (resource === 'space') {
|
||||||
if (operation === 'get') {
|
if (operation === 'get') {
|
||||||
|
|
||||||
const credentials = this.getCredentials('contentfulApi');
|
const credentials = await this.getCredentials('contentfulApi');
|
||||||
|
|
||||||
responseData = await contentfulApiRequest.call(this, 'GET', `/spaces/${credentials?.spaceId}`);
|
responseData = await contentfulApiRequest.call(this, 'GET', `/spaces/${credentials?.spaceId}`);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ export class Contentful implements INodeType {
|
||||||
if (resource === 'contentType') {
|
if (resource === 'contentType') {
|
||||||
if (operation === 'get') {
|
if (operation === 'get') {
|
||||||
|
|
||||||
const credentials = this.getCredentials('contentfulApi');
|
const credentials = await this.getCredentials('contentfulApi');
|
||||||
|
|
||||||
const env = this.getNodeParameter('environmentId', 0) as string;
|
const env = this.getNodeParameter('environmentId', 0) as string;
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ export class Contentful implements INodeType {
|
||||||
|
|
||||||
if (operation === 'get') {
|
if (operation === 'get') {
|
||||||
|
|
||||||
const credentials = this.getCredentials('contentfulApi');
|
const credentials = await this.getCredentials('contentfulApi');
|
||||||
|
|
||||||
const env = this.getNodeParameter('environmentId', 0) as string;
|
const env = this.getNodeParameter('environmentId', 0) as string;
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ export class Contentful implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (operation === 'getAll') {
|
} else if (operation === 'getAll') {
|
||||||
const credentials = this.getCredentials('contentfulApi');
|
const credentials = await this.getCredentials('contentfulApi');
|
||||||
|
|
||||||
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ export class Contentful implements INodeType {
|
||||||
if (resource === 'asset') {
|
if (resource === 'asset') {
|
||||||
if (operation === 'get') {
|
if (operation === 'get') {
|
||||||
|
|
||||||
const credentials = this.getCredentials('contentfulApi');
|
const credentials = await this.getCredentials('contentfulApi');
|
||||||
|
|
||||||
const env = this.getNodeParameter('environmentId', 0) as string;
|
const env = this.getNodeParameter('environmentId', 0) as string;
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ export class Contentful implements INodeType {
|
||||||
|
|
||||||
} else if (operation === 'getAll') {
|
} else if (operation === 'getAll') {
|
||||||
|
|
||||||
const credentials = this.getCredentials('contentfulApi');
|
const credentials = await this.getCredentials('contentfulApi');
|
||||||
|
|
||||||
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ export class Contentful implements INodeType {
|
||||||
|
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
|
|
||||||
const credentials = this.getCredentials('contentfulApi');
|
const credentials = await this.getCredentials('contentfulApi');
|
||||||
|
|
||||||
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
|
|
||||||
export async function contentfulApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function contentfulApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('contentfulApi');
|
const credentials = await this.getCredentials('contentfulApi');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import {
|
||||||
export async function convertKitApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IHookFunctions,
|
export async function convertKitApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IHookFunctions,
|
||||||
method: string, endpoint: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
method: string, endpoint: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('convertKitApi');
|
const credentials = await this.getCredentials('convertKitApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -133,7 +133,7 @@ export class CopperTrigger implements INodeType {
|
||||||
event,
|
event,
|
||||||
};
|
};
|
||||||
|
|
||||||
const credentials = this.getCredentials('copperApi');
|
const credentials = await this.getCredentials('copperApi');
|
||||||
body.secret = {
|
body.secret = {
|
||||||
secret: getAutomaticSecret(credentials!),
|
secret: getAutomaticSecret(credentials!),
|
||||||
};
|
};
|
||||||
|
@ -157,7 +157,7 @@ export class CopperTrigger implements INodeType {
|
||||||
};
|
};
|
||||||
|
|
||||||
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
||||||
const credentials = this.getCredentials('copperApi');
|
const credentials = await this.getCredentials('copperApi');
|
||||||
const req = this.getRequestObject();
|
const req = this.getRequestObject();
|
||||||
|
|
||||||
// Check if the supplied secret matches. If not ignore request.
|
// Check if the supplied secret matches. If not ignore request.
|
||||||
|
|
|
@ -44,7 +44,7 @@ export async function copperApiRequest(
|
||||||
uri = '',
|
uri = '',
|
||||||
option: IDataObject = {},
|
option: IDataObject = {},
|
||||||
) {
|
) {
|
||||||
const credentials = this.getCredentials('copperApi') as { apiKey: string, email: string };
|
const credentials = await this.getCredentials('copperApi') as { apiKey: string, email: string };
|
||||||
|
|
||||||
let options: OptionsWithUri = {
|
let options: OptionsWithUri = {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import * as moment from 'moment';
|
||||||
|
|
||||||
export async function cortexApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function cortexApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('cortexApi');
|
const credentials = await this.getCredentials('cortexApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -256,7 +256,7 @@ export class CrateDb implements INodeType {
|
||||||
};
|
};
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const credentials = this.getCredentials('crateDb');
|
const credentials = await this.getCredentials('crateDb');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -17,7 +17,7 @@ import {
|
||||||
} from 'lodash';
|
} from 'lodash';
|
||||||
|
|
||||||
export async function customerIoApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: object, baseApi?: string, query?: IDataObject): Promise<any> { // tslint:disable-line:no-any
|
export async function customerIoApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: object, baseApi?: string, query?: IDataObject): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('customerIoApi');
|
const credentials = await this.getCredentials('customerIoApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -25,7 +25,7 @@ export async function deepLApiRequest(
|
||||||
const proApiEndpoint = 'https://api.deepl.com/v2';
|
const proApiEndpoint = 'https://api.deepl.com/v2';
|
||||||
const freeApiEndpoint = 'https://api-free.deepl.com/v2';
|
const freeApiEndpoint = 'https://api-free.deepl.com/v2';
|
||||||
|
|
||||||
const credentials = this.getCredentials('deepLApi');
|
const credentials = await this.getCredentials('deepLApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
@ -51,6 +51,12 @@ export async function deepLApiRequest(
|
||||||
delete options.body;
|
delete options.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const credentials = await this.getCredentials('deepLApi');
|
||||||
|
|
||||||
|
if (credentials === undefined) {
|
||||||
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
}
|
||||||
|
|
||||||
options.qs.auth_key = credentials.apiKey;
|
options.qs.auth_key = credentials.apiKey;
|
||||||
|
|
||||||
return await this.helpers.request!(options);
|
return await this.helpers.request!(options);
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
|
|
||||||
export async function demioApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function demioApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
try {
|
try {
|
||||||
const credentials = this.getCredentials('demioApi');
|
const credentials = await this.getCredentials('demioApi');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
|
|
||||||
export async function discourseApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, path: string, body: any = {}, qs: IDataObject = {}, option = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function discourseApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, path: string, body: any = {}, qs: IDataObject = {}, option = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('discourseApi') as IDataObject;
|
const credentials = await this.getCredentials('discourseApi') as IDataObject;
|
||||||
|
|
||||||
const options: OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
@ -16,7 +16,7 @@ export async function disqusApiRequest(
|
||||||
option: IDataObject = {},
|
option: IDataObject = {},
|
||||||
): Promise<any> { // tslint:disable-line:no-any
|
): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('disqusApi') as IDataObject;
|
const credentials = await this.getCredentials('disqusApi') as IDataObject;
|
||||||
qs.api_key = credentials.accessToken;
|
qs.api_key = credentials.accessToken;
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -35,7 +35,7 @@ export async function driftApiRequest(this: IExecuteFunctions | IWebhookFunction
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (authenticationMethod === 'accessToken') {
|
if (authenticationMethod === 'accessToken') {
|
||||||
const credentials = this.getCredentials('driftApi');
|
const credentials = await this.getCredentials('driftApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -796,7 +796,7 @@ export class Dropbox implements INodeType {
|
||||||
let simple = false;
|
let simple = false;
|
||||||
|
|
||||||
|
|
||||||
const { accessType } = getCredentials.call(this);
|
const { accessType } = await getCredentials.call(this);
|
||||||
|
|
||||||
if (accessType === 'full') {
|
if (accessType === 'full') {
|
||||||
// get the root directory to set it as the default for all operations
|
// get the root directory to set it as the default for all operations
|
||||||
|
|
|
@ -42,7 +42,7 @@ export async function dropboxApiRequest(this: IHookFunctions | IExecuteFunctions
|
||||||
try {
|
try {
|
||||||
if (authenticationMethod === 'accessToken') {
|
if (authenticationMethod === 'accessToken') {
|
||||||
|
|
||||||
const credentials = this.getCredentials('dropboxApi') as IDataObject;
|
const credentials = await this.getCredentials('dropboxApi') as IDataObject;
|
||||||
|
|
||||||
options.headers!['Authorization'] = `Bearer ${credentials.accessToken}`;
|
options.headers!['Authorization'] = `Bearer ${credentials.accessToken}`;
|
||||||
|
|
||||||
|
@ -101,12 +101,12 @@ export function simplify(data: IDataObject[]) {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCredentials(this: IExecuteFunctions) {
|
export async function getCredentials(this: IExecuteFunctions) {
|
||||||
const authenticationMethod = this.getNodeParameter('authentication', 0) as string;
|
const authenticationMethod = this.getNodeParameter('authentication', 0) as string;
|
||||||
if (authenticationMethod === 'accessToken') {
|
if (authenticationMethod === 'accessToken') {
|
||||||
return this.getCredentials('dropboxApi') as IDataObject;
|
return await this.getCredentials('dropboxApi') as IDataObject;
|
||||||
} else {
|
} else {
|
||||||
return this.getCredentials('dropboxOAuth2Api') as IDataObject;
|
return await this.getCredentials('dropboxOAuth2Api') as IDataObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ export async function erpNextApiRequest(
|
||||||
uri?: string,
|
uri?: string,
|
||||||
option: IDataObject = {},
|
option: IDataObject = {},
|
||||||
) {
|
) {
|
||||||
const credentials = this.getCredentials('erpNextApi') as ERPNextApiCredentials;
|
const credentials = await this.getCredentials('erpNextApi') as ERPNextApiCredentials;
|
||||||
const baseUrl = getBaseUrl(credentials);
|
const baseUrl = getBaseUrl(credentials);
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ export async function getFields(this: IExecuteFunctions, listId: string) {
|
||||||
|
|
||||||
export async function egoiApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: any = {}, qs: IDataObject = {}, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
export async function egoiApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: any = {}, qs: IDataObject = {}, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('egoiApi') as IDataObject;
|
const credentials = await this.getCredentials('egoiApi') as IDataObject;
|
||||||
|
|
||||||
const options: OptionsWithUrl = {
|
const options: OptionsWithUrl = {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
@ -26,7 +26,7 @@ export async function elasticsearchApiRequest(
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
baseUrl,
|
baseUrl,
|
||||||
} = this.getCredentials('elasticsearchApi') as ElasticsearchApiCredentials;
|
} = await this.getCredentials('elasticsearchApi') as ElasticsearchApiCredentials;
|
||||||
|
|
||||||
const token = Buffer.from(`${username}:${password}`).toString('base64');
|
const token = Buffer.from(`${username}:${password}`).toString('base64');
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ export class EmailReadImap implements INodeType {
|
||||||
|
|
||||||
|
|
||||||
async trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {
|
async trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {
|
||||||
const credentials = this.getCredentials('imap');
|
const credentials = await this.getCredentials('imap');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -147,7 +147,7 @@ export class EmailSend implements INodeType {
|
||||||
const attachmentPropertyString = this.getNodeParameter('attachments', itemIndex) as string;
|
const attachmentPropertyString = this.getNodeParameter('attachments', itemIndex) as string;
|
||||||
const options = this.getNodeParameter('options', itemIndex, {}) as IDataObject;
|
const options = this.getNodeParameter('options', itemIndex, {}) as IDataObject;
|
||||||
|
|
||||||
const credentials = this.getCredentials('smtp');
|
const credentials = await this.getCredentials('smtp');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -35,7 +35,7 @@ export async function emeliaApiRequest(
|
||||||
body: object = {},
|
body: object = {},
|
||||||
qs: object = {},
|
qs: object = {},
|
||||||
) {
|
) {
|
||||||
const { apiKey } = this.getCredentials('emeliaApi') as { apiKey: string };
|
const { apiKey } = await this.getCredentials('emeliaApi') as { apiKey: string };
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
@ -32,7 +32,7 @@ export async function eventbriteApiRequest(this: IHookFunctions | IExecuteFuncti
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (authenticationMethod === 'privateKey') {
|
if (authenticationMethod === 'privateKey') {
|
||||||
const credentials = this.getCredentials('eventbriteApi');
|
const credentials = await this.getCredentials('eventbriteApi');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,7 +295,7 @@ export class FacebookGraphApi implements INodeType {
|
||||||
const returnItems: INodeExecutionData[] = [];
|
const returnItems: INodeExecutionData[] = [];
|
||||||
|
|
||||||
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
||||||
const graphApiCredentials = this.getCredentials('facebookGraphApi');
|
const graphApiCredentials = await this.getCredentials('facebookGraphApi');
|
||||||
|
|
||||||
const hostUrl = this.getNodeParameter('hostUrl', itemIndex) as string;
|
const hostUrl = this.getNodeParameter('hostUrl', itemIndex) as string;
|
||||||
const httpRequestMethod = this.getNodeParameter('httpRequestMethod', itemIndex) as string;
|
const httpRequestMethod = this.getNodeParameter('httpRequestMethod', itemIndex) as string;
|
||||||
|
|
|
@ -248,7 +248,7 @@ export class FacebookTrigger implements INodeType {
|
||||||
const res = this.getResponseObject();
|
const res = this.getResponseObject();
|
||||||
const req = this.getRequestObject();
|
const req = this.getRequestObject();
|
||||||
const headerData = this.getHeaderData() as IDataObject;
|
const headerData = this.getHeaderData() as IDataObject;
|
||||||
const credentials = this.getCredentials('facebookGraphAppApi') as IDataObject;
|
const credentials = await this.getCredentials('facebookGraphAppApi') as IDataObject;
|
||||||
// Check if we're getting facebook's challenge request (https://developers.facebook.com/docs/graph-api/webhooks/getting-started)
|
// Check if we're getting facebook's challenge request (https://developers.facebook.com/docs/graph-api/webhooks/getting-started)
|
||||||
if (this.getWebhookName() === 'setup') {
|
if (this.getWebhookName() === 'setup') {
|
||||||
if (query['hub.challenge']) {
|
if (query['hub.challenge']) {
|
||||||
|
|
|
@ -23,9 +23,9 @@ export async function facebookApiRequest(this: IHookFunctions | IExecuteFunction
|
||||||
let credentials;
|
let credentials;
|
||||||
|
|
||||||
if (this.getNode().name.includes('Trigger')) {
|
if (this.getNode().name.includes('Trigger')) {
|
||||||
credentials = this.getCredentials('facebookGraphAppApi') as IDataObject;
|
credentials = await this.getCredentials('facebookGraphAppApi') as IDataObject;
|
||||||
} else {
|
} else {
|
||||||
credentials = this.getCredentials('facebookGraphApi') as IDataObject;
|
credentials = await this.getCredentials('facebookGraphApi') as IDataObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
qs.access_token = credentials!.accessToken;
|
qs.access_token = credentials!.accessToken;
|
||||||
|
|
|
@ -773,7 +773,7 @@ export class FileMaker implements INodeType {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: INodeExecutionData[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
|
|
||||||
const credentials = this.getCredentials('fileMaker');
|
const credentials = await this.getCredentials('fileMaker');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -39,7 +39,7 @@ interface ScriptObject {
|
||||||
*/
|
*/
|
||||||
export async function layoutsApiRequest(this: ILoadOptionsFunctions | IExecuteFunctions | IExecuteSingleFunctions): Promise<INodePropertyOptions[]> { // tslint:disable-line:no-any
|
export async function layoutsApiRequest(this: ILoadOptionsFunctions | IExecuteFunctions | IExecuteSingleFunctions): Promise<INodePropertyOptions[]> { // tslint:disable-line:no-any
|
||||||
const token = await getToken.call(this);
|
const token = await getToken.call(this);
|
||||||
const credentials = this.getCredentials('fileMaker');
|
const credentials = await this.getCredentials('fileMaker');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
@ -89,7 +89,7 @@ function parseLayouts(layouts: LayoutObject[]): INodePropertyOptions[] {
|
||||||
*/
|
*/
|
||||||
export async function getFields(this: ILoadOptionsFunctions): Promise<any> { // tslint:disable-line:no-any
|
export async function getFields(this: ILoadOptionsFunctions): Promise<any> { // tslint:disable-line:no-any
|
||||||
const token = await getToken.call(this);
|
const token = await getToken.call(this);
|
||||||
const credentials = this.getCredentials('fileMaker');
|
const credentials = await this.getCredentials('fileMaker');
|
||||||
const layout = this.getCurrentNodeParameter('layout') as string;
|
const layout = this.getCurrentNodeParameter('layout') as string;
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
|
@ -125,7 +125,7 @@ export async function getFields(this: ILoadOptionsFunctions): Promise<any> { //
|
||||||
*/
|
*/
|
||||||
export async function getPortals(this: ILoadOptionsFunctions): Promise<any> { // tslint:disable-line:no-any
|
export async function getPortals(this: ILoadOptionsFunctions): Promise<any> { // tslint:disable-line:no-any
|
||||||
const token = await getToken.call(this);
|
const token = await getToken.call(this);
|
||||||
const credentials = this.getCredentials('fileMaker');
|
const credentials = await this.getCredentials('fileMaker');
|
||||||
const layout = this.getCurrentNodeParameter('layout') as string;
|
const layout = this.getCurrentNodeParameter('layout') as string;
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
|
@ -161,7 +161,7 @@ export async function getPortals(this: ILoadOptionsFunctions): Promise<any> { //
|
||||||
*/
|
*/
|
||||||
export async function getScripts(this: ILoadOptionsFunctions): Promise<any> { // tslint:disable-line:no-any
|
export async function getScripts(this: ILoadOptionsFunctions): Promise<any> { // tslint:disable-line:no-any
|
||||||
const token = await getToken.call(this);
|
const token = await getToken.call(this);
|
||||||
const credentials = this.getCredentials('fileMaker');
|
const credentials = await this.getCredentials('fileMaker');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
@ -207,7 +207,7 @@ function parseScriptsList(scripts: ScriptObject[]): INodePropertyOptions[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getToken(this: ILoadOptionsFunctions | IExecuteFunctions | IExecuteSingleFunctions): Promise<any> { // tslint:disable-line:no-any
|
export async function getToken(this: ILoadOptionsFunctions | IExecuteFunctions | IExecuteSingleFunctions): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('fileMaker');
|
const credentials = await this.getCredentials('fileMaker');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ export async function getToken(this: ILoadOptionsFunctions | IExecuteFunctions |
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function logout(this: ILoadOptionsFunctions | IExecuteFunctions | IExecuteSingleFunctions, token: string): Promise<any> { // tslint:disable-line:no-any
|
export async function logout(this: ILoadOptionsFunctions | IExecuteFunctions | IExecuteSingleFunctions, token: string): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('fileMaker');
|
const credentials = await this.getCredentials('fileMaker');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ export class Flow implements INodeType {
|
||||||
};
|
};
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const credentials = this.getCredentials('flowApi');
|
const credentials = await this.getCredentials('flowApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -109,7 +109,7 @@ export class FlowTrigger implements INodeType {
|
||||||
webhookMethods = {
|
webhookMethods = {
|
||||||
default: {
|
default: {
|
||||||
async checkExists(this: IHookFunctions): Promise<boolean> {
|
async checkExists(this: IHookFunctions): Promise<boolean> {
|
||||||
const credentials = this.getCredentials('flowApi');
|
const credentials = await this.getCredentials('flowApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
@ -143,7 +143,7 @@ export class FlowTrigger implements INodeType {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
async create(this: IHookFunctions): Promise<boolean> {
|
async create(this: IHookFunctions): Promise<boolean> {
|
||||||
const credentials = this.getCredentials('flowApi');
|
const credentials = await this.getCredentials('flowApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
@ -187,7 +187,7 @@ export class FlowTrigger implements INodeType {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
async delete(this: IHookFunctions): Promise<boolean> {
|
async delete(this: IHookFunctions): Promise<boolean> {
|
||||||
const credentials = this.getCredentials('flowApi');
|
const credentials = await this.getCredentials('flowApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
import { IDataObject, NodeApiError, NodeOperationError, } from 'n8n-workflow';
|
import { IDataObject, NodeApiError, NodeOperationError, } from 'n8n-workflow';
|
||||||
|
|
||||||
export async function flowApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function flowApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('flowApi');
|
const credentials = await this.getCredentials('flowApi');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
|
|
||||||
export async function freshdeskApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function freshdeskApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('freshdeskApi');
|
const credentials = await this.getCredentials('freshdeskApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -31,7 +31,7 @@ export async function freshworksCrmApiRequest(
|
||||||
body: IDataObject = {},
|
body: IDataObject = {},
|
||||||
qs: IDataObject = {},
|
qs: IDataObject = {},
|
||||||
) {
|
) {
|
||||||
const { apiKey, domain } = this.getCredentials('freshworksCrmApi') as FreshworksCrmApiCredentials;
|
const { apiKey, domain } = await this.getCredentials('freshworksCrmApi') as FreshworksCrmApiCredentials;
|
||||||
|
|
||||||
const options: OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
@ -374,9 +374,9 @@ export class Ftp implements INodeType {
|
||||||
const protocol = this.getNodeParameter('protocol', 0) as string;
|
const protocol = this.getNodeParameter('protocol', 0) as string;
|
||||||
|
|
||||||
if (protocol === 'sftp') {
|
if (protocol === 'sftp') {
|
||||||
credentials = this.getCredentials('sftp');
|
credentials = await this.getCredentials('sftp');
|
||||||
} else {
|
} else {
|
||||||
credentials = this.getCredentials('ftp');
|
credentials = await this.getCredentials('ftp');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ export async function getresponseApiRequest(this: IWebhookFunctions | IHookFunct
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authentication === 'apiKey') {
|
if (authentication === 'apiKey') {
|
||||||
const credentials = this.getCredentials('getResponseApi') as IDataObject;
|
const credentials = await this.getCredentials('getResponseApi') as IDataObject;
|
||||||
options!.headers!['X-Auth-Token'] = `api-key ${credentials.apiKey}`;
|
options!.headers!['X-Auth-Token'] = `api-key ${credentials.apiKey}`;
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
return await this.helpers.request.call(this, options);
|
return await this.helpers.request.call(this, options);
|
||||||
|
|
|
@ -26,11 +26,11 @@ export async function ghostApiRequest(this: IHookFunctions | IExecuteFunctions |
|
||||||
if (source === 'contentApi') {
|
if (source === 'contentApi') {
|
||||||
//https://ghost.org/faq/api-versioning/
|
//https://ghost.org/faq/api-versioning/
|
||||||
version = 'v3';
|
version = 'v3';
|
||||||
credentials = this.getCredentials('ghostContentApi') as IDataObject;
|
credentials = await this.getCredentials('ghostContentApi') as IDataObject;
|
||||||
query.key = credentials.apiKey as string;
|
query.key = credentials.apiKey as string;
|
||||||
} else {
|
} else {
|
||||||
version = 'v2';
|
version = 'v2';
|
||||||
credentials = this.getCredentials('ghostAdminApi') as IDataObject;
|
credentials = await this.getCredentials('ghostAdminApi') as IDataObject;
|
||||||
// Create the token (including decoding secret)
|
// Create the token (including decoding secret)
|
||||||
const [id, secret] = (credentials.apiKey as string).split(':');
|
const [id, secret] = (credentials.apiKey as string).split(':');
|
||||||
|
|
||||||
|
|
|
@ -206,11 +206,11 @@ export class Git implements INodeType {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
|
|
||||||
|
|
||||||
const prepareRepository = (repositoryPath: string): string => {
|
const prepareRepository = async (repositoryPath: string): Promise<string> => {
|
||||||
const authentication = this.getNodeParameter('authentication', 0) as string;
|
const authentication = this.getNodeParameter('authentication', 0) as string;
|
||||||
|
|
||||||
if (authentication === 'gitPassword') {
|
if (authentication === 'gitPassword') {
|
||||||
const gitCredentials = this.getCredentials('gitPassword') as IDataObject;
|
const gitCredentials = await this.getCredentials('gitPassword') as IDataObject;
|
||||||
|
|
||||||
const url = new URL(repositoryPath);
|
const url = new URL(repositoryPath);
|
||||||
url.username = gitCredentials.username as string;
|
url.username = gitCredentials.username as string;
|
||||||
|
@ -284,7 +284,7 @@ export class Git implements INodeType {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
||||||
let sourceRepository = this.getNodeParameter('sourceRepository', itemIndex, '') as string;
|
let sourceRepository = this.getNodeParameter('sourceRepository', itemIndex, '') as string;
|
||||||
sourceRepository = prepareRepository(sourceRepository);
|
sourceRepository = await prepareRepository(sourceRepository);
|
||||||
|
|
||||||
await git.clone(sourceRepository, '.');
|
await git.clone(sourceRepository, '.');
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ export class Git implements INodeType {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
||||||
if (options.repository) {
|
if (options.repository) {
|
||||||
const targetRepository = prepareRepository(options.targetRepository as string);
|
const targetRepository = await prepareRepository(options.targetRepository as string);
|
||||||
await git.push(targetRepository);
|
await git.push(targetRepository);
|
||||||
} else {
|
} else {
|
||||||
const authentication = this.getNodeParameter('authentication', 0) as string;
|
const authentication = this.getNodeParameter('authentication', 0) as string;
|
||||||
|
@ -364,7 +364,7 @@ export class Git implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
targetRepository = prepareRepository(targetRepository as string);
|
targetRepository = await prepareRepository(targetRepository as string);
|
||||||
await git.push(targetRepository);
|
await git.push(targetRepository);
|
||||||
} else {
|
} else {
|
||||||
await git.push();
|
await git.push();
|
||||||
|
|
|
@ -39,7 +39,7 @@ export async function githubApiRequest(this: IHookFunctions | IExecuteFunctions,
|
||||||
const authenticationMethod = this.getNodeParameter('authentication', 0, 'accessToken') as string;
|
const authenticationMethod = this.getNodeParameter('authentication', 0, 'accessToken') as string;
|
||||||
|
|
||||||
if (authenticationMethod === 'accessToken') {
|
if (authenticationMethod === 'accessToken') {
|
||||||
const credentials = this.getCredentials('githubApi');
|
const credentials = await this.getCredentials('githubApi');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ export async function githubApiRequest(this: IHookFunctions | IExecuteFunctions,
|
||||||
options.headers!.Authorization = `token ${credentials.accessToken}`;
|
options.headers!.Authorization = `token ${credentials.accessToken}`;
|
||||||
return await this.helpers.request(options);
|
return await this.helpers.request(options);
|
||||||
} else {
|
} else {
|
||||||
const credentials = this.getCredentials('githubOAuth2Api');
|
const credentials = await this.getCredentials('githubOAuth2Api');
|
||||||
|
|
||||||
const baseUrl = credentials!.server || 'https://api.github.com';
|
const baseUrl = credentials!.server || 'https://api.github.com';
|
||||||
options.uri = `${baseUrl}${endpoint}`;
|
options.uri = `${baseUrl}${endpoint}`;
|
||||||
|
|
|
@ -39,7 +39,7 @@ export async function gitlabApiRequest(this: IHookFunctions | IExecuteFunctions,
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (authenticationMethod === 'accessToken') {
|
if (authenticationMethod === 'accessToken') {
|
||||||
const credentials = this.getCredentials('gitlabApi');
|
const credentials = await this.getCredentials('gitlabApi');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ export async function gitlabApiRequest(this: IHookFunctions | IExecuteFunctions,
|
||||||
|
|
||||||
return await this.helpers.request(options);
|
return await this.helpers.request(options);
|
||||||
} else {
|
} else {
|
||||||
const credentials = this.getCredentials('gitlabOAuth2Api');
|
const credentials = await this.getCredentials('gitlabOAuth2Api');
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1101,13 +1101,13 @@ export class Gitlab implements INodeType {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (authenticationMethod === 'accessToken') {
|
if (authenticationMethod === 'accessToken') {
|
||||||
credentials = this.getCredentials('gitlabApi');
|
credentials = await this.getCredentials('gitlabApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
credentials = this.getCredentials('gitlabOAuth2Api');
|
credentials = await this.getCredentials('gitlabOAuth2Api');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -137,7 +137,7 @@ export async function handleGetAll(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadWebinars(this: ILoadOptionsFunctions) {
|
export async function loadWebinars(this: ILoadOptionsFunctions) {
|
||||||
const { oauthTokenData } = this.getCredentials('goToWebinarOAuth2Api') as {
|
const { oauthTokenData } = await this.getCredentials('goToWebinarOAuth2Api') as {
|
||||||
oauthTokenData: { account_key: string }
|
oauthTokenData: { account_key: string }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ export async function loadWebinars(this: ILoadOptionsFunctions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadWebinarSessions(this: ILoadOptionsFunctions) {
|
export async function loadWebinarSessions(this: ILoadOptionsFunctions) {
|
||||||
const { oauthTokenData } = this.getCredentials('goToWebinarOAuth2Api') as {
|
const { oauthTokenData } = await this.getCredentials('goToWebinarOAuth2Api') as {
|
||||||
oauthTokenData: { organizer_key: string }
|
oauthTokenData: { organizer_key: string }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ export async function loadWebinarSessions(this: ILoadOptionsFunctions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadRegistranSimpleQuestions(this: ILoadOptionsFunctions) {
|
export async function loadRegistranSimpleQuestions(this: ILoadOptionsFunctions) {
|
||||||
const { oauthTokenData } = this.getCredentials('goToWebinarOAuth2Api') as {
|
const { oauthTokenData } = await this.getCredentials('goToWebinarOAuth2Api') as {
|
||||||
oauthTokenData: { organizer_key: string }
|
oauthTokenData: { organizer_key: string }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ export async function loadRegistranSimpleQuestions(this: ILoadOptionsFunctions)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadAnswers(this: ILoadOptionsFunctions) {
|
export async function loadAnswers(this: ILoadOptionsFunctions) {
|
||||||
const { oauthTokenData } = this.getCredentials('goToWebinarOAuth2Api') as {
|
const { oauthTokenData } = await this.getCredentials('goToWebinarOAuth2Api') as {
|
||||||
oauthTokenData: { organizer_key: string }
|
oauthTokenData: { organizer_key: string }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ export async function loadAnswers(this: ILoadOptionsFunctions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadRegistranMultiChoiceQuestions(this: ILoadOptionsFunctions) {
|
export async function loadRegistranMultiChoiceQuestions(this: ILoadOptionsFunctions) {
|
||||||
const { oauthTokenData } = this.getCredentials('goToWebinarOAuth2Api') as {
|
const { oauthTokenData } = await this.getCredentials('goToWebinarOAuth2Api') as {
|
||||||
oauthTokenData: { organizer_key: string }
|
oauthTokenData: { organizer_key: string }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ export class GoToWebinar implements INodeType {
|
||||||
let responseData;
|
let responseData;
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: IDataObject[] = [];
|
||||||
|
|
||||||
const { oauthTokenData } = this.getCredentials('goToWebinarOAuth2Api') as {
|
const { oauthTokenData } = await this.getCredentials('goToWebinarOAuth2Api') as {
|
||||||
oauthTokenData: { account_key: string, organizer_key: string }
|
oauthTokenData: { account_key: string, organizer_key: string }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleF
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authenticationMethod === 'serviceAccount') {
|
if (authenticationMethod === 'serviceAccount') {
|
||||||
const credentials = this.getCredentials('googleApi');
|
const credentials = await this.getCredentials('googleApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -44,7 +44,7 @@ export async function googleApiRequest(
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (authenticationMethod === 'serviceAccount') {
|
if (authenticationMethod === 'serviceAccount') {
|
||||||
const credentials = this.getCredentials('googleApi');
|
const credentials = await this.getCredentials('googleApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -36,7 +36,7 @@ export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleF
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authenticationMethod === 'serviceAccount') {
|
if (authenticationMethod === 'serviceAccount') {
|
||||||
const credentials = this.getCredentials('googleApi');
|
const credentials = await this.getCredentials('googleApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
|
|
||||||
// const resourceId = this.getNodeParameter('resourceId') as string;
|
// const resourceId = this.getNodeParameter('resourceId') as string;
|
||||||
|
|
||||||
// const credentials = this.getCredentials('googleApi');
|
// const credentials = await this.getCredentials('googleApi');
|
||||||
|
|
||||||
// if (credentials === undefined) {
|
// if (credentials === undefined) {
|
||||||
// throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
// throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
@ -190,7 +190,7 @@
|
||||||
|
|
||||||
// const resourceId = this.getNodeParameter('resourceId') as string;
|
// const resourceId = this.getNodeParameter('resourceId') as string;
|
||||||
|
|
||||||
// const credentials = this.getCredentials('googleApi');
|
// const credentials = await this.getCredentials('googleApi');
|
||||||
|
|
||||||
// if (credentials === undefined) {
|
// if (credentials === undefined) {
|
||||||
// throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
// throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue