mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor: Format nodes-base package (A-F) (#3800)
* 🔨 prettier formated nodes - A * 🔨 prettier formated nodes - B * ⚡ prettier formated nodes - C * ⚡ prettier formated nodes - D * ⚡ prettier formated nodes - E-F * 🎨 Adjust nodes-base formatting command (#3805) * Format additional files in nodes A-F (#3811) * ⚡ fixes * 🎨 Add Mindee to ignored dirs Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, IHookFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject, ILoadOptionsFunctions, INodeProperties, NodeApiError, NodeOperationError,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodeProperties,
|
||||
NodeApiError,
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { OptionsWithUri } from 'request';
|
||||
@@ -15,7 +16,6 @@ export interface IProduct {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make an API request to ActiveCampaign
|
||||
*
|
||||
@@ -25,7 +25,15 @@ export interface IProduct {
|
||||
* @param {object} body
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export async function activeCampaignApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: IDataObject, query?: IDataObject, dataKey?: string): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function activeCampaignApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
endpoint: string,
|
||||
body: IDataObject,
|
||||
query?: IDataObject,
|
||||
dataKey?: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('activeCampaignApi');
|
||||
|
||||
if (query === undefined) {
|
||||
@@ -33,8 +41,7 @@ export async function activeCampaignApiRequest(this: IHookFunctions | IExecuteFu
|
||||
}
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
headers: {
|
||||
},
|
||||
headers: {},
|
||||
method,
|
||||
qs: query,
|
||||
uri: `${credentials.apiUrl}${endpoint}`,
|
||||
@@ -46,7 +53,11 @@ export async function activeCampaignApiRequest(this: IHookFunctions | IExecuteFu
|
||||
}
|
||||
|
||||
try {
|
||||
const responseData = await this.helpers.requestWithAuthentication.call(this, 'activeCampaignApi',options);
|
||||
const responseData = await this.helpers.requestWithAuthentication.call(
|
||||
this,
|
||||
'activeCampaignApi',
|
||||
options,
|
||||
);
|
||||
|
||||
if (responseData.success === false) {
|
||||
throw new NodeApiError(this.getNode(), responseData);
|
||||
@@ -57,14 +68,11 @@ export async function activeCampaignApiRequest(this: IHookFunctions | IExecuteFu
|
||||
} else {
|
||||
return responseData[dataKey] as IDataObject;
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Make an API request to paginated ActiveCampaign endpoint
|
||||
* and return all results
|
||||
@@ -77,8 +85,15 @@ export async function activeCampaignApiRequest(this: IHookFunctions | IExecuteFu
|
||||
* @param {IDataObject} [query]
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export async function activeCampaignApiRequestAllItems(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: IDataObject, query?: IDataObject, dataKey?: string): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
export async function activeCampaignApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
endpoint: string,
|
||||
body: IDataObject,
|
||||
query?: IDataObject,
|
||||
dataKey?: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
if (query === undefined) {
|
||||
query = {};
|
||||
}
|
||||
@@ -115,7 +130,10 @@ export async function activeCampaignApiRequestAllItems(this: IHookFunctions | IE
|
||||
return returnData;
|
||||
}
|
||||
|
||||
export function activeCampaignDefaultGetAllProperties(resource: string, operation: string): INodeProperties[] {
|
||||
export function activeCampaignDefaultGetAllProperties(
|
||||
resource: string,
|
||||
operation: string,
|
||||
): INodeProperties[] {
|
||||
return [
|
||||
{
|
||||
displayName: 'Return All',
|
||||
@@ -123,12 +141,8 @@ export function activeCampaignDefaultGetAllProperties(resource: string, operatio
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
operation,
|
||||
],
|
||||
resource: [
|
||||
resource,
|
||||
],
|
||||
operation: [operation],
|
||||
resource: [resource],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -140,15 +154,9 @@ export function activeCampaignDefaultGetAllProperties(resource: string, operatio
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
operation,
|
||||
],
|
||||
resource: [
|
||||
resource,
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
operation: [operation],
|
||||
resource: [resource],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -164,12 +172,8 @@ export function activeCampaignDefaultGetAllProperties(resource: string, operatio
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
operation,
|
||||
],
|
||||
resource: [
|
||||
resource,
|
||||
],
|
||||
operation: [operation],
|
||||
resource: [resource],
|
||||
},
|
||||
},
|
||||
default: true,
|
||||
|
||||
Reference in New Issue
Block a user