mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, IHookFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject, NodeApiError, NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
/**
|
||||
* Make an API request to Github
|
||||
@@ -18,8 +13,15 @@ import {
|
||||
* @param {object} body
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export async function githubApiRequest(this: IHookFunctions | IExecuteFunctions, method: string, endpoint: string, body: object, query?: object, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
export async function githubApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions,
|
||||
method: string,
|
||||
endpoint: string,
|
||||
body: object,
|
||||
query?: object,
|
||||
option: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const options: OptionsWithUri = {
|
||||
method,
|
||||
headers: {
|
||||
@@ -36,7 +38,11 @@ export async function githubApiRequest(this: IHookFunctions | IExecuteFunctions,
|
||||
}
|
||||
|
||||
try {
|
||||
const authenticationMethod = this.getNodeParameter('authentication', 0, 'accessToken') as string;
|
||||
const authenticationMethod = this.getNodeParameter(
|
||||
'authentication',
|
||||
0,
|
||||
'accessToken',
|
||||
) as string;
|
||||
let credentialType = '';
|
||||
|
||||
if (authenticationMethod === 'accessToken') {
|
||||
@@ -59,8 +65,6 @@ export async function githubApiRequest(this: IHookFunctions | IExecuteFunctions,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the SHA of the given file
|
||||
*
|
||||
@@ -72,7 +76,14 @@ export async function githubApiRequest(this: IHookFunctions | IExecuteFunctions,
|
||||
* @param {string} [branch]
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export async function getFileSha(this: IHookFunctions | IExecuteFunctions, owner: string, repository: string, filePath: string, branch?: string): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function getFileSha(
|
||||
this: IHookFunctions | IExecuteFunctions,
|
||||
owner: string,
|
||||
repository: string,
|
||||
filePath: string,
|
||||
branch?: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const getBody: IDataObject = {};
|
||||
if (branch !== undefined) {
|
||||
getBody.branch = branch;
|
||||
@@ -86,8 +97,15 @@ export async function getFileSha(this: IHookFunctions | IExecuteFunctions, owner
|
||||
return responseData.sha;
|
||||
}
|
||||
|
||||
export async function githubApiRequestAllItems(this: IHookFunctions | IExecuteFunctions, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
export async function githubApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions,
|
||||
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;
|
||||
@@ -96,11 +114,11 @@ export async function githubApiRequestAllItems(this: IHookFunctions | IExecuteFu
|
||||
query.page = 1;
|
||||
|
||||
do {
|
||||
responseData = await githubApiRequest.call(this, method, endpoint, body, query, { resolveWithFullResponse: true });
|
||||
responseData = await githubApiRequest.call(this, method, endpoint, body, query, {
|
||||
resolveWithFullResponse: true,
|
||||
});
|
||||
query.page++;
|
||||
returnData.push.apply(returnData, responseData.body);
|
||||
} while (
|
||||
responseData.headers.link && responseData.headers.link.includes('next')
|
||||
);
|
||||
} while (responseData.headers.link && responseData.headers.link.includes('next'));
|
||||
return returnData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user