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,16 +1,8 @@
import {
IExecuteFunctions,
IHookFunctions,
} from 'n8n-core';
import { IExecuteFunctions, IHookFunctions } from 'n8n-core';
import {
JsonObject,
NodeApiError,
} from 'n8n-workflow';
import { JsonObject, NodeApiError } from 'n8n-workflow';
import {
OptionsWithUri,
} from 'request';
import { OptionsWithUri } from 'request';
/**
* Make an API request to NextCloud
@@ -21,7 +13,16 @@ import {
* @param {object} body
* @returns {Promise<any>}
*/
export async function nextCloudApiRequest(this: IHookFunctions | IExecuteFunctions, method: string, endpoint: string, body: object | string | Buffer, headers?: object, encoding?: null | undefined, query?: object): Promise<any> { // tslint:disable-line:no-any
export async function nextCloudApiRequest(
this: IHookFunctions | IExecuteFunctions,
method: string,
endpoint: string,
body: object | string | Buffer,
headers?: object,
encoding?: null | undefined,
query?: object,
// tslint:disable-next-line:no-any
): Promise<any> {
const resource = this.getNodeParameter('resource', 0);
const operation = this.getNodeParameter('operation', 0);
const authenticationMethod = this.getNodeParameter('authentication', 0);
@@ -29,9 +30,9 @@ export async function nextCloudApiRequest(this: IHookFunctions | IExecuteFunctio
let credentials;
if (authenticationMethod === 'accessToken') {
credentials = await this.getCredentials('nextCloudApi') as { webDavUrl: string };
credentials = (await this.getCredentials('nextCloudApi')) as { webDavUrl: string };
} else {
credentials = await this.getCredentials('nextCloudOAuth2Api') as { webDavUrl: string };
credentials = (await this.getCredentials('nextCloudOAuth2Api')) as { webDavUrl: string };
}
const options: OptionsWithUri = {
@@ -52,11 +53,12 @@ export async function nextCloudApiRequest(this: IHookFunctions | IExecuteFunctio
options.uri = options.uri.replace('/remote.php/webdav', '');
}
const credentialType = authenticationMethod === 'accessToken' ? 'nextCloudApi' : 'nextCloudOAuth2Api';
const credentialType =
authenticationMethod === 'accessToken' ? 'nextCloudApi' : 'nextCloudOAuth2Api';
try {
return await this.helpers.requestWithAuthentication.call(this, credentialType, options);
} catch(error) {
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}