mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -5,14 +5,19 @@ import {
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
JsonObject,
|
||||
NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, JsonObject, NodeApiError } from 'n8n-workflow';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
export async function mauticApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: any = {}, query?: IDataObject, uri?: string): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function mauticApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
endpoint: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
query?: IDataObject,
|
||||
uri?: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const authenticationMethod = this.getNodeParameter('authentication', 0, 'credentials') as string;
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
@@ -25,7 +30,6 @@ export async function mauticApiRequest(this: IHookFunctions | IExecuteFunctions
|
||||
};
|
||||
|
||||
try {
|
||||
|
||||
let returnData;
|
||||
|
||||
if (authenticationMethod === 'credentials') {
|
||||
@@ -41,7 +45,9 @@ export async function mauticApiRequest(this: IHookFunctions | IExecuteFunctions
|
||||
|
||||
options.uri = `${baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl}${options.uri}`;
|
||||
//@ts-ignore
|
||||
returnData = await this.helpers.requestOAuth2.call(this, 'mauticOAuth2Api', options, { includeCredentialsOnRefreshOnBody: true });
|
||||
returnData = await this.helpers.requestOAuth2.call(this, 'mauticOAuth2Api', options, {
|
||||
includeCredentialsOnRefreshOnBody: true,
|
||||
});
|
||||
}
|
||||
|
||||
if (returnData.errors) {
|
||||
@@ -59,8 +65,16 @@ export async function mauticApiRequest(this: IHookFunctions | IExecuteFunctions
|
||||
* Make an API request to paginated mautic endpoint
|
||||
* and return all results
|
||||
*/
|
||||
export async function mauticApiRequestAllItems(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
export async function mauticApiRequestAllItems(
|
||||
this: IHookFunctions | 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;
|
||||
@@ -77,13 +91,14 @@ export async function mauticApiRequestAllItems(this: IHookFunctions | IExecuteFu
|
||||
data = [];
|
||||
} while (
|
||||
responseData.total !== undefined &&
|
||||
(returnData.length - parseInt(responseData.total, 10)) < 0
|
||||
returnData.length - parseInt(responseData.total, 10) < 0
|
||||
);
|
||||
|
||||
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!);
|
||||
|
||||
Reference in New Issue
Block a user