mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
refactor(core): Stop importing LoggerProxy and createDeferredPromise in nodes-base (no-changelog) (#5742)
* refactor(core): Stop importing LoggerProxy in nodes-base * refactor(core): Stop importing createDeferredPromise in nodes-base
This commit is contained in:
parent
40aacf9279
commit
38e91ab730
|
@ -62,6 +62,7 @@ import type {
|
||||||
FileSystemHelperFunctions,
|
FileSystemHelperFunctions,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import {
|
import {
|
||||||
|
createDeferredPromise,
|
||||||
NodeApiError,
|
NodeApiError,
|
||||||
NodeHelpers,
|
NodeHelpers,
|
||||||
NodeOperationError,
|
NodeOperationError,
|
||||||
|
@ -1956,6 +1957,7 @@ const getCommonWorkflowFunctions = (
|
||||||
node: INode,
|
node: INode,
|
||||||
additionalData: IWorkflowExecuteAdditionalData,
|
additionalData: IWorkflowExecuteAdditionalData,
|
||||||
): Omit<FunctionsBase, 'getCredentials'> => ({
|
): Omit<FunctionsBase, 'getCredentials'> => ({
|
||||||
|
logger: Logger,
|
||||||
getNode: () => deepCopy(node),
|
getNode: () => deepCopy(node),
|
||||||
getWorkflow: () => ({
|
getWorkflow: () => ({
|
||||||
id: workflow.id,
|
id: workflow.id,
|
||||||
|
@ -2118,6 +2120,7 @@ export function getExecutePollFunctions(
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
helpers: {
|
helpers: {
|
||||||
|
createDeferredPromise,
|
||||||
...getRequestHelperFunctions(workflow, node, additionalData),
|
...getRequestHelperFunctions(workflow, node, additionalData),
|
||||||
...getBinaryHelperFunctions(additionalData),
|
...getBinaryHelperFunctions(additionalData),
|
||||||
returnJsonArray,
|
returnJsonArray,
|
||||||
|
@ -2176,6 +2179,7 @@ export function getExecuteTriggerFunctions(
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
helpers: {
|
helpers: {
|
||||||
|
createDeferredPromise,
|
||||||
...getRequestHelperFunctions(workflow, node, additionalData),
|
...getRequestHelperFunctions(workflow, node, additionalData),
|
||||||
...getBinaryHelperFunctions(additionalData),
|
...getBinaryHelperFunctions(additionalData),
|
||||||
returnJsonArray,
|
returnJsonArray,
|
||||||
|
@ -2351,6 +2355,7 @@ export function getExecuteFunctions(
|
||||||
await additionalData.hooks?.executeHookFunctions('sendResponse', [response]);
|
await additionalData.hooks?.executeHookFunctions('sendResponse', [response]);
|
||||||
},
|
},
|
||||||
helpers: {
|
helpers: {
|
||||||
|
createDeferredPromise,
|
||||||
...getRequestHelperFunctions(workflow, node, additionalData),
|
...getRequestHelperFunctions(workflow, node, additionalData),
|
||||||
...getFileSystemHelperFunctions(node),
|
...getFileSystemHelperFunctions(node),
|
||||||
...getBinaryHelperFunctions(additionalData),
|
...getBinaryHelperFunctions(additionalData),
|
||||||
|
@ -2492,6 +2497,7 @@ export function getExecuteSingleFunctions(
|
||||||
return dataProxy.getDataProxy();
|
return dataProxy.getDataProxy();
|
||||||
},
|
},
|
||||||
helpers: {
|
helpers: {
|
||||||
|
createDeferredPromise,
|
||||||
...getRequestHelperFunctions(workflow, node, additionalData),
|
...getRequestHelperFunctions(workflow, node, additionalData),
|
||||||
...getBinaryHelperFunctions(additionalData),
|
...getBinaryHelperFunctions(additionalData),
|
||||||
|
|
||||||
|
@ -2747,6 +2753,7 @@ export function getExecuteWebhookFunctions(
|
||||||
getWebhookName: () => webhookData.webhookDescription.name,
|
getWebhookName: () => webhookData.webhookDescription.name,
|
||||||
prepareOutputData: NodeHelpers.prepareOutputData,
|
prepareOutputData: NodeHelpers.prepareOutputData,
|
||||||
helpers: {
|
helpers: {
|
||||||
|
createDeferredPromise,
|
||||||
...getRequestHelperFunctions(workflow, node, additionalData),
|
...getRequestHelperFunctions(workflow, node, additionalData),
|
||||||
...getBinaryHelperFunctions(additionalData),
|
...getBinaryHelperFunctions(additionalData),
|
||||||
returnJsonArray,
|
returnJsonArray,
|
||||||
|
|
|
@ -7,7 +7,6 @@ import type {
|
||||||
ICredentialsDecrypted,
|
ICredentialsDecrypted,
|
||||||
ICredentialTestFunctions,
|
ICredentialTestFunctions,
|
||||||
IDataObject,
|
IDataObject,
|
||||||
IDeferredPromise,
|
|
||||||
INodeCredentialTestResult,
|
INodeCredentialTestResult,
|
||||||
INodeExecutionData,
|
INodeExecutionData,
|
||||||
INodeType,
|
INodeType,
|
||||||
|
@ -15,7 +14,7 @@ import type {
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
ITriggerResponse,
|
ITriggerResponse,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { createDeferredPromise, LoggerProxy as Logger, NodeOperationError } from 'n8n-workflow';
|
import { NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
import type { ImapSimple, ImapSimpleOptions, Message } from 'imap-simple';
|
import type { ImapSimple, ImapSimpleOptions, Message } from 'imap-simple';
|
||||||
import { connect as imapConnect, getParts } from 'imap-simple';
|
import { connect as imapConnect, getParts } from 'imap-simple';
|
||||||
|
@ -272,7 +271,7 @@ export class EmailReadImapV1 implements INodeType {
|
||||||
const options = this.getNodeParameter('options', {}) as IDataObject;
|
const options = this.getNodeParameter('options', {}) as IDataObject;
|
||||||
|
|
||||||
const staticData = this.getWorkflowStaticData('node');
|
const staticData = this.getWorkflowStaticData('node');
|
||||||
Logger.debug('Loaded static data for node "EmailReadImap"', { staticData });
|
this.logger.debug('Loaded static data for node "EmailReadImap"', { staticData });
|
||||||
|
|
||||||
let connection: ImapSimple;
|
let connection: ImapSimple;
|
||||||
|
|
||||||
|
@ -501,7 +500,7 @@ export class EmailReadImapV1 implements INodeType {
|
||||||
return newEmails;
|
return newEmails;
|
||||||
};
|
};
|
||||||
|
|
||||||
const returnedPromise: IDeferredPromise<void> | undefined = await createDeferredPromise();
|
const returnedPromise = await this.helpers.createDeferredPromise();
|
||||||
|
|
||||||
const establishConnection = async (): Promise<ImapSimple> => {
|
const establishConnection = async (): Promise<ImapSimple> => {
|
||||||
let searchCriteria = ['UNSEEN'] as Array<string | string[]>;
|
let searchCriteria = ['UNSEEN'] as Array<string | string[]>;
|
||||||
|
@ -538,7 +537,9 @@ export class EmailReadImapV1 implements INodeType {
|
||||||
* - You can check if UIDs changed in the above example
|
* - You can check if UIDs changed in the above example
|
||||||
* by checking UIDValidity.
|
* by checking UIDValidity.
|
||||||
*/
|
*/
|
||||||
Logger.debug('Querying for new messages on node "EmailReadImap"', { searchCriteria });
|
this.logger.debug('Querying for new messages on node "EmailReadImap"', {
|
||||||
|
searchCriteria,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -547,7 +548,7 @@ export class EmailReadImapV1 implements INodeType {
|
||||||
this.emit([returnData]);
|
this.emit([returnData]);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('Email Read Imap node encountered an error fetching new emails', {
|
this.logger.error('Email Read Imap node encountered an error fetching new emails', {
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
// Wait with resolving till the returnedPromise got resolved, else n8n will be unhappy
|
// Wait with resolving till the returnedPromise got resolved, else n8n will be unhappy
|
||||||
|
@ -580,17 +581,19 @@ export class EmailReadImapV1 implements INodeType {
|
||||||
conn.on('error', async (error) => {
|
conn.on('error', async (error) => {
|
||||||
const errorCode = error.code.toUpperCase();
|
const errorCode = error.code.toUpperCase();
|
||||||
if (['ECONNRESET', 'EPIPE'].includes(errorCode as string)) {
|
if (['ECONNRESET', 'EPIPE'].includes(errorCode as string)) {
|
||||||
Logger.verbose(`IMAP connection was reset (${errorCode}) - reconnecting.`, { error });
|
this.logger.verbose(`IMAP connection was reset (${errorCode}) - reconnecting.`, {
|
||||||
|
error,
|
||||||
|
});
|
||||||
try {
|
try {
|
||||||
connection = await establishConnection();
|
connection = await establishConnection();
|
||||||
await connection.openBox(mailbox);
|
await connection.openBox(mailbox);
|
||||||
return;
|
return;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger.error('IMAP reconnect did fail', { error: e });
|
this.logger.error('IMAP reconnect did fail', { error: e });
|
||||||
// If something goes wrong we want to run emitError
|
// If something goes wrong we want to run emitError
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Logger.error('Email Read Imap node encountered a connection error', { error });
|
this.logger.error('Email Read Imap node encountered a connection error', { error });
|
||||||
this.emitError(error as Error);
|
this.emitError(error as Error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -606,7 +609,7 @@ export class EmailReadImapV1 implements INodeType {
|
||||||
|
|
||||||
if (options.forceReconnect !== undefined) {
|
if (options.forceReconnect !== undefined) {
|
||||||
reconnectionInterval = setInterval(async () => {
|
reconnectionInterval = setInterval(async () => {
|
||||||
Logger.verbose('Forcing reconnection of IMAP node.');
|
this.logger.verbose('Forcing reconnection of IMAP node.');
|
||||||
connection.end();
|
connection.end();
|
||||||
connection = await establishConnection();
|
connection = await establishConnection();
|
||||||
await connection.openBox(mailbox);
|
await connection.openBox(mailbox);
|
||||||
|
|
|
@ -6,7 +6,6 @@ import type {
|
||||||
ICredentialsDecrypted,
|
ICredentialsDecrypted,
|
||||||
ICredentialTestFunctions,
|
ICredentialTestFunctions,
|
||||||
IDataObject,
|
IDataObject,
|
||||||
IDeferredPromise,
|
|
||||||
INodeCredentialTestResult,
|
INodeCredentialTestResult,
|
||||||
INodeExecutionData,
|
INodeExecutionData,
|
||||||
INodeType,
|
INodeType,
|
||||||
|
@ -14,7 +13,7 @@ import type {
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
ITriggerResponse,
|
ITriggerResponse,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { createDeferredPromise, LoggerProxy as Logger, NodeOperationError } from 'n8n-workflow';
|
import { NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
import type { ImapSimple, ImapSimpleOptions, Message } from 'imap-simple';
|
import type { ImapSimple, ImapSimpleOptions, Message } from 'imap-simple';
|
||||||
import { connect as imapConnect, getParts } from 'imap-simple';
|
import { connect as imapConnect, getParts } from 'imap-simple';
|
||||||
|
@ -278,7 +277,7 @@ export class EmailReadImapV2 implements INodeType {
|
||||||
const options = this.getNodeParameter('options', {}) as IDataObject;
|
const options = this.getNodeParameter('options', {}) as IDataObject;
|
||||||
|
|
||||||
const staticData = this.getWorkflowStaticData('node');
|
const staticData = this.getWorkflowStaticData('node');
|
||||||
Logger.debug('Loaded static data for node "EmailReadImap"', { staticData });
|
this.logger.debug('Loaded static data for node "EmailReadImap"', { staticData });
|
||||||
|
|
||||||
let connection: ImapSimple;
|
let connection: ImapSimple;
|
||||||
let closeFunctionWasCalled = false;
|
let closeFunctionWasCalled = false;
|
||||||
|
@ -509,7 +508,7 @@ export class EmailReadImapV2 implements INodeType {
|
||||||
return newEmails;
|
return newEmails;
|
||||||
};
|
};
|
||||||
|
|
||||||
const returnedPromise: IDeferredPromise<void> | undefined = await createDeferredPromise();
|
const returnedPromise = await this.helpers.createDeferredPromise();
|
||||||
|
|
||||||
const establishConnection = async (): Promise<ImapSimple> => {
|
const establishConnection = async (): Promise<ImapSimple> => {
|
||||||
let searchCriteria = ['UNSEEN'] as Array<string | string[]>;
|
let searchCriteria = ['UNSEEN'] as Array<string | string[]>;
|
||||||
|
@ -546,7 +545,9 @@ export class EmailReadImapV2 implements INodeType {
|
||||||
* - You can check if UIDs changed in the above example
|
* - You can check if UIDs changed in the above example
|
||||||
* by checking UIDValidity.
|
* by checking UIDValidity.
|
||||||
*/
|
*/
|
||||||
Logger.debug('Querying for new messages on node "EmailReadImap"', { searchCriteria });
|
this.logger.debug('Querying for new messages on node "EmailReadImap"', {
|
||||||
|
searchCriteria,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -555,7 +556,7 @@ export class EmailReadImapV2 implements INodeType {
|
||||||
this.emit([returnData]);
|
this.emit([returnData]);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('Email Read Imap node encountered an error fetching new emails', {
|
this.logger.error('Email Read Imap node encountered an error fetching new emails', {
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
// Wait with resolving till the returnedPromise got resolved, else n8n will be unhappy
|
// Wait with resolving till the returnedPromise got resolved, else n8n will be unhappy
|
||||||
|
@ -567,7 +568,7 @@ export class EmailReadImapV2 implements INodeType {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onupdate: async (seqno: number, info) => {
|
onupdate: async (seqno: number, info) => {
|
||||||
Logger.verbose(`Email Read Imap:update ${seqno}`, info as IDataObject);
|
this.logger.verbose(`Email Read Imap:update ${seqno}`, info as IDataObject);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -590,17 +591,17 @@ export class EmailReadImapV2 implements INodeType {
|
||||||
return imapConnect(config).then(async (conn) => {
|
return imapConnect(config).then(async (conn) => {
|
||||||
conn.on('close', async (_hadError: boolean) => {
|
conn.on('close', async (_hadError: boolean) => {
|
||||||
if (isCurrentlyReconnecting) {
|
if (isCurrentlyReconnecting) {
|
||||||
Logger.debug('Email Read Imap: Connected closed for forced reconnecting');
|
this.logger.debug('Email Read Imap: Connected closed for forced reconnecting');
|
||||||
} else if (closeFunctionWasCalled) {
|
} else if (closeFunctionWasCalled) {
|
||||||
Logger.debug('Email Read Imap: Shutting down workflow - connected closed');
|
this.logger.debug('Email Read Imap: Shutting down workflow - connected closed');
|
||||||
} else {
|
} else {
|
||||||
Logger.error('Email Read Imap: Connected closed unexpectedly');
|
this.logger.error('Email Read Imap: Connected closed unexpectedly');
|
||||||
this.emitError(new Error('Imap connection closed unexpectedly'));
|
this.emitError(new Error('Imap connection closed unexpectedly'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
conn.on('error', async (error) => {
|
conn.on('error', async (error) => {
|
||||||
const errorCode = error.code.toUpperCase();
|
const errorCode = error.code.toUpperCase();
|
||||||
Logger.verbose(`IMAP connection experienced an error: (${errorCode})`, { error });
|
this.logger.verbose(`IMAP connection experienced an error: (${errorCode})`, { error });
|
||||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||||
await closeFunction();
|
await closeFunction();
|
||||||
this.emitError(error as Error);
|
this.emitError(error as Error);
|
||||||
|
@ -617,7 +618,7 @@ export class EmailReadImapV2 implements INodeType {
|
||||||
|
|
||||||
if (options.forceReconnect !== undefined) {
|
if (options.forceReconnect !== undefined) {
|
||||||
reconnectionInterval = setInterval(async () => {
|
reconnectionInterval = setInterval(async () => {
|
||||||
Logger.verbose('Forcing reconnect to IMAP server');
|
this.logger.verbose('Forcing reconnect to IMAP server');
|
||||||
try {
|
try {
|
||||||
isCurrentlyReconnecting = true;
|
isCurrentlyReconnecting = true;
|
||||||
if (connection.closeBox) await connection.closeBox(false);
|
if (connection.closeBox) await connection.closeBox(false);
|
||||||
|
@ -625,7 +626,7 @@ export class EmailReadImapV2 implements INodeType {
|
||||||
connection = await establishConnection();
|
connection = await establishConnection();
|
||||||
await connection.openBox(mailbox);
|
await connection.openBox(mailbox);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error as string);
|
this.logger.error(error as string);
|
||||||
} finally {
|
} finally {
|
||||||
isCurrentlyReconnecting = false;
|
isCurrentlyReconnecting = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import type {
|
||||||
INodeType,
|
INodeType,
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { LoggerProxy as Logger } from 'n8n-workflow';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
googleApiRequest,
|
googleApiRequest,
|
||||||
|
@ -303,7 +302,7 @@ export class GmailTrigger implements INodeType {
|
||||||
}
|
}
|
||||||
const workflow = this.getWorkflow();
|
const workflow = this.getWorkflow();
|
||||||
const node = this.getNode();
|
const node = this.getNode();
|
||||||
Logger.error(
|
this.logger.error(
|
||||||
`There was a problem in '${node.name}' node in workflow '${workflow.id}': '${error.description}'`,
|
`There was a problem in '${node.name}' node in workflow '${workflow.id}': '${error.description}'`,
|
||||||
{
|
{
|
||||||
node: node.name,
|
node: node.name,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-filename-against-convention */
|
/* eslint-disable n8n-nodes-base/node-filename-against-convention */
|
||||||
import type {
|
import type {
|
||||||
IDataObject,
|
IDataObject,
|
||||||
|
IDeferredPromise,
|
||||||
INodeExecutionData,
|
INodeExecutionData,
|
||||||
INodeProperties,
|
INodeProperties,
|
||||||
INodeType,
|
INodeType,
|
||||||
|
@ -9,7 +10,7 @@ import type {
|
||||||
ITriggerFunctions,
|
ITriggerFunctions,
|
||||||
ITriggerResponse,
|
ITriggerResponse,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { createDeferredPromise, LoggerProxy as Logger, NodeOperationError } from 'n8n-workflow';
|
import { NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
import { rabbitDefaultOptions } from './DefaultOptions';
|
import { rabbitDefaultOptions } from './DefaultOptions';
|
||||||
|
|
||||||
|
@ -220,9 +221,9 @@ export class RabbitMQTrigger implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let responsePromise = undefined;
|
let responsePromise: IDeferredPromise<IRun> | undefined = undefined;
|
||||||
if (acknowledgeMode !== 'immediately') {
|
if (acknowledgeMode !== 'immediately') {
|
||||||
responsePromise = await createDeferredPromise<IRun>();
|
responsePromise = await this.helpers.createDeferredPromise();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.emit([[item]], undefined, responsePromise);
|
this.emit([[item]], undefined, responsePromise);
|
||||||
|
@ -253,7 +254,7 @@ export class RabbitMQTrigger implements INodeType {
|
||||||
messageTracker.answered(message);
|
messageTracker.answered(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.error(
|
this.logger.error(
|
||||||
`There was a problem with the RabbitMQ Trigger node "${node.name}" in workflow "${workflow.id}": "${error.message}"`,
|
`There was a problem with the RabbitMQ Trigger node "${node.name}" in workflow "${workflow.id}": "${error.message}"`,
|
||||||
{
|
{
|
||||||
node: node.name,
|
node: node.name,
|
||||||
|
@ -277,7 +278,7 @@ export class RabbitMQTrigger implements INodeType {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const workflow = this.getWorkflow();
|
const workflow = this.getWorkflow();
|
||||||
const node = this.getNode();
|
const node = this.getNode();
|
||||||
Logger.error(
|
this.logger.error(
|
||||||
`There was a problem closing the RabbitMQ Trigger node connection "${node.name}" in workflow "${workflow.id}": "${error.message}"`,
|
`There was a problem closing the RabbitMQ Trigger node connection "${node.name}" in workflow "${workflow.id}": "${error.message}"`,
|
||||||
{
|
{
|
||||||
node: node.name,
|
node: node.name,
|
||||||
|
|
|
@ -8,7 +8,7 @@ import type {
|
||||||
INodePropertyOptions,
|
INodePropertyOptions,
|
||||||
JsonObject,
|
JsonObject,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { LoggerProxy as Logger, NodeApiError } from 'n8n-workflow';
|
import { NodeApiError } from 'n8n-workflow';
|
||||||
|
|
||||||
import moment from 'moment-timezone';
|
import moment from 'moment-timezone';
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ export async function salesforceApiRequest(
|
||||||
qs,
|
qs,
|
||||||
instance_url as string,
|
instance_url as string,
|
||||||
);
|
);
|
||||||
Logger.debug(
|
this.logger.debug(
|
||||||
`Authentication for "Salesforce" node is using "jwt". Invoking URI ${options.uri}`,
|
`Authentication for "Salesforce" node is using "jwt". Invoking URI ${options.uri}`,
|
||||||
);
|
);
|
||||||
options.headers!.Authorization = `Bearer ${access_token}`;
|
options.headers!.Authorization = `Bearer ${access_token}`;
|
||||||
|
@ -130,7 +130,7 @@ export async function salesforceApiRequest(
|
||||||
qs,
|
qs,
|
||||||
credentials.oauthTokenData.instance_url,
|
credentials.oauthTokenData.instance_url,
|
||||||
);
|
);
|
||||||
Logger.debug(
|
this.logger.debug(
|
||||||
`Authentication for "Salesforce" node is using "OAuth2". Invoking URI ${options.uri}`,
|
`Authentication for "Salesforce" node is using "OAuth2". Invoking URI ${options.uri}`,
|
||||||
);
|
);
|
||||||
Object.assign(options, option);
|
Object.assign(options, option);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import type {
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
JsonObject,
|
JsonObject,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { LoggerProxy as Logger, NodeApiError, NodeOperationError } from 'n8n-workflow';
|
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
import { accountFields, accountOperations } from './AccountDescription';
|
import { accountFields, accountOperations } from './AccountDescription';
|
||||||
|
|
||||||
|
@ -1065,7 +1065,7 @@ export class Salesforce implements INodeType {
|
||||||
const resource = this.getNodeParameter('resource', 0);
|
const resource = this.getNodeParameter('resource', 0);
|
||||||
const operation = this.getNodeParameter('operation', 0);
|
const operation = this.getNodeParameter('operation', 0);
|
||||||
|
|
||||||
Logger.debug(
|
this.logger.debug(
|
||||||
`Running "Salesforce" node named "${this.getNode.name}" resource "${resource}" operation "${operation}"`,
|
`Running "Salesforce" node named "${this.getNode.name}" resource "${resource}" operation "${operation}"`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ export interface IDeferredPromise<T> {
|
||||||
resolve: (result: T) => void;
|
resolve: (result: T) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createDeferredPromise<T>(): Promise<IDeferredPromise<T>> {
|
export async function createDeferredPromise<T = void>(): Promise<IDeferredPromise<T>> {
|
||||||
return new Promise<IDeferredPromise<T>>((resolveCreate) => {
|
return new Promise<IDeferredPromise<T>>((resolveCreate) => {
|
||||||
const promise = new Promise<T>((resolve, reject) => {
|
const promise = new Promise<T>((resolve, reject) => {
|
||||||
resolveCreate({ promise: async () => promise, resolve, reject });
|
resolveCreate({ promise: async () => promise, resolve, reject });
|
||||||
|
|
|
@ -657,7 +657,11 @@ export interface ICredentialTestFunctions {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface JsonHelperFunctions {
|
interface BaseHelperFunctions {
|
||||||
|
createDeferredPromise: <T = void>() => Promise<IDeferredPromise<T>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface JsonHelperFunctions {
|
||||||
returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExecutionData[];
|
returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExecutionData[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,6 +713,7 @@ export interface RequestHelperFunctions {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FunctionsBase {
|
export interface FunctionsBase {
|
||||||
|
logger: ILogger;
|
||||||
getCredentials(type: string, itemIndex?: number): Promise<ICredentialDataDecryptedObject>;
|
getCredentials(type: string, itemIndex?: number): Promise<ICredentialDataDecryptedObject>;
|
||||||
getNode(): INode;
|
getNode(): INode;
|
||||||
getWorkflow(): IWorkflowMetadata;
|
getWorkflow(): IWorkflowMetadata;
|
||||||
|
@ -749,6 +754,7 @@ export type IExecuteFunctions = ExecuteFunctions.GetNodeParameterFn &
|
||||||
sendResponse(response: IExecuteResponsePromiseData): void;
|
sendResponse(response: IExecuteResponsePromiseData): void;
|
||||||
|
|
||||||
helpers: RequestHelperFunctions &
|
helpers: RequestHelperFunctions &
|
||||||
|
BaseHelperFunctions &
|
||||||
BinaryHelperFunctions &
|
BinaryHelperFunctions &
|
||||||
FileSystemHelperFunctions &
|
FileSystemHelperFunctions &
|
||||||
JsonHelperFunctions & {
|
JsonHelperFunctions & {
|
||||||
|
@ -772,6 +778,7 @@ export interface IExecuteSingleFunctions extends BaseExecutionFunctions {
|
||||||
): NodeParameterValueType | object;
|
): NodeParameterValueType | object;
|
||||||
|
|
||||||
helpers: RequestHelperFunctions &
|
helpers: RequestHelperFunctions &
|
||||||
|
BaseHelperFunctions &
|
||||||
BinaryHelperFunctions & {
|
BinaryHelperFunctions & {
|
||||||
assertBinaryData(propertyName: string, inputIndex?: number): IBinaryData;
|
assertBinaryData(propertyName: string, inputIndex?: number): IBinaryData;
|
||||||
getBinaryDataBuffer(propertyName: string, inputIndex?: number): Promise<Buffer>;
|
getBinaryDataBuffer(propertyName: string, inputIndex?: number): Promise<Buffer>;
|
||||||
|
@ -812,7 +819,10 @@ export interface IPollFunctions
|
||||||
fallbackValue?: any,
|
fallbackValue?: any,
|
||||||
options?: IGetNodeParameterOptions,
|
options?: IGetNodeParameterOptions,
|
||||||
): NodeParameterValueType | object;
|
): NodeParameterValueType | object;
|
||||||
helpers: RequestHelperFunctions & BinaryHelperFunctions & JsonHelperFunctions;
|
helpers: RequestHelperFunctions &
|
||||||
|
BaseHelperFunctions &
|
||||||
|
BinaryHelperFunctions &
|
||||||
|
JsonHelperFunctions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITriggerFunctions
|
export interface ITriggerFunctions
|
||||||
|
@ -828,7 +838,10 @@ export interface ITriggerFunctions
|
||||||
fallbackValue?: any,
|
fallbackValue?: any,
|
||||||
options?: IGetNodeParameterOptions,
|
options?: IGetNodeParameterOptions,
|
||||||
): NodeParameterValueType | object;
|
): NodeParameterValueType | object;
|
||||||
helpers: RequestHelperFunctions & BinaryHelperFunctions & JsonHelperFunctions;
|
helpers: RequestHelperFunctions &
|
||||||
|
BaseHelperFunctions &
|
||||||
|
BinaryHelperFunctions &
|
||||||
|
JsonHelperFunctions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IHookFunctions
|
export interface IHookFunctions
|
||||||
|
@ -862,7 +875,10 @@ export interface IWebhookFunctions extends FunctionsBaseWithRequiredKeys<'getMod
|
||||||
outputData: INodeExecutionData[],
|
outputData: INodeExecutionData[],
|
||||||
outputIndex?: number,
|
outputIndex?: number,
|
||||||
): Promise<INodeExecutionData[][]>;
|
): Promise<INodeExecutionData[][]>;
|
||||||
helpers: RequestHelperFunctions & BinaryHelperFunctions & JsonHelperFunctions;
|
helpers: RequestHelperFunctions &
|
||||||
|
BaseHelperFunctions &
|
||||||
|
BinaryHelperFunctions &
|
||||||
|
JsonHelperFunctions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface INodeCredentialsDetails {
|
export interface INodeCredentialsDetails {
|
||||||
|
|
Loading…
Reference in a new issue