mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
fix: Remove redundant await in node's api request functions without try/catch (#4639)
* 🐛 Remove useless await for actionNetwork * 🔥 Remove useless await * 🔥 Remove useless await keyword to other generic functions
This commit is contained in:
parent
b87c12285f
commit
67983e8f94
|
@ -39,7 +39,7 @@ export async function actionNetworkApiRequest(
|
||||||
delete options.qs;
|
delete options.qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'actionNetworkApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'actionNetworkApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function handleListing(
|
export async function handleListing(
|
||||||
|
|
|
@ -60,7 +60,7 @@ export async function apiRequest(
|
||||||
delete options.body;
|
delete options.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'airtableApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'airtableApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,7 +31,7 @@ export async function awsApiRequest(
|
||||||
headers,
|
headers,
|
||||||
region: credentials?.region as string,
|
region: credentials?.region as string,
|
||||||
} as IHttpRequestOptions;
|
} as IHttpRequestOptions;
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions);
|
return this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function awsApiRequestREST(
|
export async function awsApiRequestREST(
|
||||||
|
|
|
@ -42,7 +42,7 @@ export async function awsApiRequest(
|
||||||
if (Object.keys(option).length !== 0) {
|
if (Object.keys(option).length !== 0) {
|
||||||
Object.assign(requestOptions, option);
|
Object.assign(requestOptions, option);
|
||||||
}
|
}
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions);
|
return this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function awsApiRequestREST(
|
export async function awsApiRequestREST(
|
||||||
|
|
|
@ -40,7 +40,7 @@ export async function awsApiRequest(
|
||||||
if (Object.keys(option).length !== 0) {
|
if (Object.keys(option).length !== 0) {
|
||||||
Object.assign(requestOptions, option);
|
Object.assign(requestOptions, option);
|
||||||
}
|
}
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions);
|
return this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function awsApiRequestREST(
|
export async function awsApiRequestREST(
|
||||||
|
|
|
@ -31,7 +31,7 @@ export async function beeminderApiRequest(
|
||||||
delete options.qs;
|
delete options.qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'beeminderApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'beeminderApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function beeminderApiRequestAllItems(
|
export async function beeminderApiRequestAllItems(
|
||||||
|
|
|
@ -52,7 +52,7 @@ export async function calendlyApiRequest(
|
||||||
delete options.qs;
|
delete options.qs;
|
||||||
}
|
}
|
||||||
options = Object.assign({}, options, option);
|
options = Object.assign({}, options, option);
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'calendlyApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'calendlyApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAuthenticationType(data: string): 'accessToken' | 'apiKey' {
|
export function getAuthenticationType(data: string): 'accessToken' | 'apiKey' {
|
||||||
|
|
|
@ -28,7 +28,7 @@ export async function clockifyApiRequest(
|
||||||
json: true,
|
json: true,
|
||||||
useQuerystring: true,
|
useQuerystring: true,
|
||||||
};
|
};
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'clockifyApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'clockifyApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function clockifyApiRequestAllItems(
|
export async function clockifyApiRequestAllItems(
|
||||||
|
|
|
@ -42,7 +42,7 @@ export async function cortexApiRequest(
|
||||||
delete options.qs;
|
delete options.qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'cortexApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'cortexApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getEntityLabel(entity: IDataObject): string {
|
export function getEntityLabel(entity: IDataObject): string {
|
||||||
|
|
|
@ -32,7 +32,7 @@ export async function customerIoApiRequest(
|
||||||
options.url = `https://beta-api.customer.io/v1/api${endpoint}`;
|
options.url = `https://beta-api.customer.io/v1/api${endpoint}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'customerIoApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'customerIoApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function eventExists(currentEvents: string[], webhookEvents: IDataObject) {
|
export function eventExists(currentEvents: string[], webhookEvents: IDataObject) {
|
||||||
|
|
|
@ -30,5 +30,5 @@ export async function dropcontactApiRequest(
|
||||||
delete options.qs;
|
delete options.qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'dropcontactApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'dropcontactApi', options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ export async function ghostApiRequest(
|
||||||
json: true,
|
json: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, credentialType, options);
|
return this.helpers.requestWithAuthentication.call(this, credentialType, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function ghostApiRequestAllItems(
|
export async function ghostApiRequestAllItems(
|
||||||
|
|
|
@ -232,7 +232,7 @@ export async function highLevelApiRequest(
|
||||||
delete options.qs;
|
delete options.qs;
|
||||||
}
|
}
|
||||||
options = Object.assign({}, options, option);
|
options = Object.assign({}, options, option);
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'highLevelApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'highLevelApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getPipelineStages(
|
export async function getPipelineStages(
|
||||||
|
|
|
@ -58,7 +58,7 @@ export async function jiraSoftwareCloudApiRequest(
|
||||||
delete options.qs;
|
delete options.qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, credentialType, options);
|
return this.helpers.requestWithAuthentication.call(this, credentialType, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function jiraSoftwareCloudApiRequestAllItems(
|
export async function jiraSoftwareCloudApiRequestAllItems(
|
||||||
|
|
|
@ -38,7 +38,7 @@ export async function lemlistApiRequest(
|
||||||
Object.assign(options, option);
|
Object.assign(options, option);
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'lemlistApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'lemlistApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,7 +48,7 @@ export async function mailjetApiRequest(
|
||||||
delete options.body;
|
delete options.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, credentialType, options);
|
return this.helpers.requestWithAuthentication.call(this, credentialType, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function mailjetApiRequestAllItems(
|
export async function mailjetApiRequestAllItems(
|
||||||
|
|
|
@ -52,5 +52,5 @@ export async function nextCloudApiRequest(
|
||||||
|
|
||||||
const credentialType =
|
const credentialType =
|
||||||
authenticationMethod === 'accessToken' ? 'nextCloudApi' : 'nextCloudOAuth2Api';
|
authenticationMethod === 'accessToken' ? 'nextCloudApi' : 'nextCloudOAuth2Api';
|
||||||
return await this.helpers.requestWithAuthentication.call(this, credentialType, options);
|
return this.helpers.requestWithAuthentication.call(this, credentialType, options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ export async function apiRequest(
|
||||||
delete options.body;
|
delete options.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, authenticationMethod, options);
|
return this.helpers.requestWithAuthentication.call(this, authenticationMethod, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,7 +24,7 @@ export async function rocketchatApiRequest(
|
||||||
if (Object.keys(options.body).length === 0) {
|
if (Object.keys(options.body).length === 0) {
|
||||||
delete options.body;
|
delete options.body;
|
||||||
}
|
}
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'rocketchatApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'rocketchatApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
// tslint:disable-next-line:no-any
|
// tslint:disable-next-line:no-any
|
||||||
|
|
|
@ -36,5 +36,5 @@ export async function segmentApiRequest(
|
||||||
if (!Object.keys(body).length) {
|
if (!Object.keys(body).length) {
|
||||||
delete options.body;
|
delete options.body;
|
||||||
}
|
}
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'segmentApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'segmentApi', options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ export async function sendGridApiRequest(
|
||||||
Object.assign(options, option);
|
Object.assign(options, option);
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'sendGridApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'sendGridApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function sendGridApiRequestAllItems(
|
export async function sendGridApiRequestAllItems(
|
||||||
|
|
|
@ -66,7 +66,7 @@ export async function shopifyApiRequest(
|
||||||
delete options.qs;
|
delete options.qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, credentialType, options, {
|
return this.helpers.requestWithAuthentication.call(this, credentialType, options, {
|
||||||
oauth2: oAuth2Options,
|
oauth2: oAuth2Options,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ export async function stripeApiRequest(
|
||||||
delete options.qs;
|
delete options.qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'stripeApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'stripeApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,7 +40,7 @@ export async function theHiveApiRequest(
|
||||||
if (Object.keys(query).length === 0) {
|
if (Object.keys(query).length === 0) {
|
||||||
delete options.qs;
|
delete options.qs;
|
||||||
}
|
}
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'theHiveApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'theHiveApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helpers functions
|
// Helpers functions
|
||||||
|
|
|
@ -26,7 +26,7 @@ export async function apiRequest(
|
||||||
json: true,
|
json: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'trelloApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'trelloApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function apiRequestAllItems(
|
export async function apiRequestAllItems(
|
||||||
|
|
|
@ -30,5 +30,5 @@ export async function twakeApiRequest(
|
||||||
// options.uri = `${credentials!.hostUrl}/api/v1${resource}`;
|
// options.uri = `${credentials!.hostUrl}/api/v1${resource}`;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'twakeCloudApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'twakeCloudApi', options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ export async function twilioApiRequest(
|
||||||
json: true,
|
json: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'twilioApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'twilioApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
const XML_CHAR_MAP: { [key: string]: string } = {
|
const XML_CHAR_MAP: { [key: string]: string } = {
|
||||||
|
|
|
@ -27,7 +27,7 @@ export async function urlScanIoApiRequest(
|
||||||
delete options.qs;
|
delete options.qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'urlScanIoApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'urlScanIoApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function handleListing(
|
export async function handleListing(
|
||||||
|
|
|
@ -48,7 +48,7 @@ export async function webflowApiRequest(
|
||||||
if (Object.keys(options.body).length === 0) {
|
if (Object.keys(options.body).length === 0) {
|
||||||
delete options.body;
|
delete options.body;
|
||||||
}
|
}
|
||||||
return await this.helpers.requestWithAuthentication.call(this, credentialsType, options);
|
return this.helpers.requestWithAuthentication.call(this, credentialsType, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function webflowApiRequestAllItems(
|
export async function webflowApiRequestAllItems(
|
||||||
|
|
|
@ -27,5 +27,5 @@ export async function apiRequest(
|
||||||
json: true,
|
json: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'wekanApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'wekanApi', options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ export async function woocommerceApiRequest(
|
||||||
delete options.form;
|
delete options.form;
|
||||||
}
|
}
|
||||||
options = Object.assign({}, options, option);
|
options = Object.assign({}, options, option);
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'wooCommerceApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'wooCommerceApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function woocommerceApiRequestAllItems(
|
export async function woocommerceApiRequestAllItems(
|
||||||
|
|
|
@ -36,5 +36,5 @@ export async function wufooApiRequest(
|
||||||
delete options.body;
|
delete options.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, 'wufooApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'wufooApi', options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ export async function zendeskApiRequest(
|
||||||
|
|
||||||
const credentialType = authenticationMethod === 'apiToken' ? 'zendeskApi' : 'zendeskOAuth2Api';
|
const credentialType = authenticationMethod === 'apiToken' ? 'zendeskApi' : 'zendeskOAuth2Api';
|
||||||
|
|
||||||
return await this.helpers.requestWithAuthentication.call(this, credentialType, options);
|
return this.helpers.requestWithAuthentication.call(this, credentialType, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue