Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove redundant await in node's api request functions without try/catch #4639

Merged
merged 3 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export async function actionNetworkApiRequest(
delete options.qs;
}

return await this.helpers.requestWithAuthentication.call(this, 'actionNetworkApi', options);
return this.helpers.requestWithAuthentication.call(this, 'actionNetworkApi', options);
}

export async function handleListing(
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Airtable/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export async function apiRequest(
delete options.body;
}

return await this.helpers.requestWithAuthentication.call(this, 'airtableApi', options);
return this.helpers.requestWithAuthentication.call(this, 'airtableApi', options);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function awsApiRequest(
headers,
region: credentials?.region as string,
} as IHttpRequestOptions;
return await this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions);
return this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions);
}

export async function awsApiRequestREST(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function awsApiRequest(
if (Object.keys(option).length !== 0) {
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(
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Aws/S3/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function awsApiRequest(
if (Object.keys(option).length !== 0) {
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(
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Beeminder/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function beeminderApiRequest(
delete options.qs;
}

return await this.helpers.requestWithAuthentication.call(this, 'beeminderApi', options);
return this.helpers.requestWithAuthentication.call(this, 'beeminderApi', options);
}

export async function beeminderApiRequestAllItems(
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Calendly/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function calendlyApiRequest(
delete options.qs;
}
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' {
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Clockify/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function clockifyApiRequest(
json: true,
useQuerystring: true,
};
return await this.helpers.requestWithAuthentication.call(this, 'clockifyApi', options);
return this.helpers.requestWithAuthentication.call(this, 'clockifyApi', options);
}

export async function clockifyApiRequestAllItems(
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Cortex/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function cortexApiRequest(
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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/CustomerIo/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function customerIoApiRequest(
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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Dropcontact/GenericFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ export async function dropcontactApiRequest(
delete options.qs;
}

return await this.helpers.requestWithAuthentication.call(this, 'dropcontactApi', options);
return this.helpers.requestWithAuthentication.call(this, 'dropcontactApi', options);
}
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Ghost/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function ghostApiRequest(
json: true,
};

return await this.helpers.requestWithAuthentication.call(this, credentialType, options);
return this.helpers.requestWithAuthentication.call(this, credentialType, options);
}

export async function ghostApiRequestAllItems(
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/HighLevel/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export async function highLevelApiRequest(
delete options.qs;
}
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(
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Jira/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function jiraSoftwareCloudApiRequest(
delete options.qs;
}

return await this.helpers.requestWithAuthentication.call(this, credentialType, options);
return this.helpers.requestWithAuthentication.call(this, credentialType, options);
}

export async function jiraSoftwareCloudApiRequestAllItems(
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Lemlist/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function lemlistApiRequest(
Object.assign(options, option);
}

return await this.helpers.requestWithAuthentication.call(this, 'lemlistApi', options);
return this.helpers.requestWithAuthentication.call(this, 'lemlistApi', options);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Mailjet/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function mailjetApiRequest(
delete options.body;
}

return await this.helpers.requestWithAuthentication.call(this, credentialType, options);
return this.helpers.requestWithAuthentication.call(this, credentialType, options);
}

export async function mailjetApiRequestAllItems(
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/NextCloud/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ export async function nextCloudApiRequest(

const credentialType =
authenticationMethod === 'accessToken' ? 'nextCloudApi' : 'nextCloudOAuth2Api';
return await this.helpers.requestWithAuthentication.call(this, credentialType, options);
return this.helpers.requestWithAuthentication.call(this, credentialType, options);
}
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/NocoDB/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export async function apiRequest(
delete options.body;
}

return await this.helpers.requestWithAuthentication.call(this, authenticationMethod, options);
return this.helpers.requestWithAuthentication.call(this, authenticationMethod, options);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Rocketchat/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export async function rocketchatApiRequest(
if (Object.keys(options.body).length === 0) {
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
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Segment/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ export async function segmentApiRequest(
if (!Object.keys(body).length) {
delete options.body;
}
return await this.helpers.requestWithAuthentication.call(this, 'segmentApi', options);
return this.helpers.requestWithAuthentication.call(this, 'segmentApi', options);
}
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/SendGrid/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function sendGridApiRequest(
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(
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Shopify/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function shopifyApiRequest(
delete options.qs;
}

return await this.helpers.requestWithAuthentication.call(this, credentialType, options, {
return this.helpers.requestWithAuthentication.call(this, credentialType, options, {
oauth2: oAuth2Options,
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Stripe/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function stripeApiRequest(
delete options.qs;
}

return await this.helpers.requestWithAuthentication.call(this, 'stripeApi', options);
return this.helpers.requestWithAuthentication.call(this, 'stripeApi', options);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/TheHive/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function theHiveApiRequest(
if (Object.keys(query).length === 0) {
delete options.qs;
}
return await this.helpers.requestWithAuthentication.call(this, 'theHiveApi', options);
return this.helpers.requestWithAuthentication.call(this, 'theHiveApi', options);
}

// Helpers functions
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Trello/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function apiRequest(
json: true,
};

return await this.helpers.requestWithAuthentication.call(this, 'trelloApi', options);
return this.helpers.requestWithAuthentication.call(this, 'trelloApi', options);
}

export async function apiRequestAllItems(
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Twake/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ export async function twakeApiRequest(
// options.uri = `${credentials!.hostUrl}/api/v1${resource}`;
// }

return await this.helpers.requestWithAuthentication.call(this, 'twakeCloudApi', options);
return this.helpers.requestWithAuthentication.call(this, 'twakeCloudApi', options);
}
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Twilio/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function twilioApiRequest(
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 } = {
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/UrlScanIo/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function urlScanIoApiRequest(
delete options.qs;
}

return await this.helpers.requestWithAuthentication.call(this, 'urlScanIoApi', options);
return this.helpers.requestWithAuthentication.call(this, 'urlScanIoApi', options);
}

export async function handleListing(
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Webflow/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function webflowApiRequest(
if (Object.keys(options.body).length === 0) {
delete options.body;
}
return await this.helpers.requestWithAuthentication.call(this, credentialsType, options);
return this.helpers.requestWithAuthentication.call(this, credentialsType, options);
}

export async function webflowApiRequestAllItems(
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Wekan/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export async function apiRequest(
json: true,
};

return await this.helpers.requestWithAuthentication.call(this, 'wekanApi', options);
return this.helpers.requestWithAuthentication.call(this, 'wekanApi', options);
}
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/WooCommerce/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function woocommerceApiRequest(
delete options.form;
}
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(
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Wufoo/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ export async function wufooApiRequest(
delete options.body;
}

return await this.helpers.requestWithAuthentication.call(this, 'wufooApi', options);
return this.helpers.requestWithAuthentication.call(this, 'wufooApi', options);
}
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Zendesk/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function zendeskApiRequest(

const credentialType = authenticationMethod === 'apiToken' ? 'zendeskApi' : 'zendeskOAuth2Api';

return await this.helpers.requestWithAuthentication.call(this, credentialType, options);
return this.helpers.requestWithAuthentication.call(this, credentialType, options);
}

/**
Expand Down