n8n-3867-progressively-apply-prettier-to-all (#3873)

* 🔨 formatting nodes with prettier
This commit is contained in:
Michael Kret
2022-08-17 18:50:24 +03:00
committed by GitHub
parent f2d326c7f0
commit 91d7e16c81
1072 changed files with 42357 additions and 59109 deletions

View File

@@ -1,12 +1,6 @@
import {
OptionsWithUri,
} from 'request';
import { OptionsWithUri } from 'request';
import {
IExecuteFunctions,
IExecuteSingleFunctions,
ILoadOptionsFunctions,
} from 'n8n-core';
import { IExecuteFunctions, IExecuteSingleFunctions, ILoadOptionsFunctions } from 'n8n-core';
import {
IDataObject,
@@ -18,7 +12,16 @@ import {
import _ from 'lodash';
export async function slackApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: object = {}, query: object = {}, headers: {} | undefined = undefined, option: {} = {}): Promise<any> { // tslint:disable-line:no-any
export async function slackApiRequest(
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
method: string,
resource: string,
body: object = {},
query: object = {},
headers: {} | undefined = undefined,
option: {} = {},
// tslint:disable-next-line:no-any
): Promise<any> {
const authenticationMethod = this.getNodeParameter('authentication', 0, 'accessToken') as string;
let options: OptionsWithUri = {
method,
@@ -46,16 +49,27 @@ export async function slackApiRequest(this: IExecuteFunctions | IExecuteSingleFu
try {
let response: any; // tslint:disable-line:no-any
const credentialType = authenticationMethod === 'accessToken' ? 'slackApi' : 'slackOAuth2Api';
response = await this.helpers.requestWithAuthentication.call(this, credentialType, options, { oauth2: oAuth2Options });
response = await this.helpers.requestWithAuthentication.call(this, credentialType, options, {
oauth2: oAuth2Options,
});
if (response.ok === false) {
if (response.error === 'paid_teams_only') {
throw new NodeOperationError(this.getNode(), `Your current Slack plan does not include the resource '${this.getNodeParameter('resource', 0) as string}'`, {
description: `Hint: Upgrate to the Slack plan that includes the funcionality you want to use.`,
});
throw new NodeOperationError(
this.getNode(),
`Your current Slack plan does not include the resource '${
this.getNodeParameter('resource', 0) as string
}'`,
{
description: `Hint: Upgrate to the Slack plan that includes the funcionality you want to use.`,
},
);
}
throw new NodeOperationError(this.getNode(), 'Slack error response: ' + JSON.stringify(response));
throw new NodeOperationError(
this.getNode(),
'Slack error response: ' + JSON.stringify(response),
);
}
return response;
@@ -64,7 +78,16 @@ export async function slackApiRequest(this: IExecuteFunctions | IExecuteSingleFu
}
}
export async function slackApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
export async function slackApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string,
method: string,
endpoint: string,
// tslint:disable-next-line:no-any
body: any = {},
query: IDataObject = {},
// tslint:disable-next-line:no-any
): Promise<any> {
const returnData: IDataObject[] = [];
let responseData;
query.page = 1;
@@ -88,14 +111,14 @@ export async function slackApiRequestAllItems(this: IExecuteFunctions | ILoadOpt
(responseData.paging !== undefined &&
responseData.paging.pages !== undefined &&
responseData.paging.page !== undefined &&
responseData.paging.page < responseData.paging.pages
)
responseData.paging.page < responseData.paging.pages)
);
return returnData;
}
export function validateJSON(json: string | undefined): any { // tslint:disable-line:no-any
// tslint:disable-next-line:no-any
export function validateJSON(json: string | undefined): any {
let result;
try {
result = JSON.parse(json!);