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,6 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
@@ -138,7 +136,6 @@ export class ActionNetwork implements INodeType {
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
try {
|
||||
if (resource === 'attendance') {
|
||||
|
||||
// **********************************************************************
|
||||
// attendance
|
||||
// **********************************************************************
|
||||
@@ -146,7 +143,6 @@ export class ActionNetwork implements INodeType {
|
||||
// https://actionnetwork.org/docs/v2/attendances
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------------
|
||||
// attendance: create
|
||||
// ----------------------------------------
|
||||
@@ -158,9 +154,7 @@ export class ActionNetwork implements INodeType {
|
||||
|
||||
const endpoint = `/events/${eventId}/attendances`;
|
||||
response = await actionNetworkApiRequest.call(this, 'POST', endpoint, body);
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// attendance: get
|
||||
// ----------------------------------------
|
||||
@@ -170,9 +164,7 @@ export class ActionNetwork implements INodeType {
|
||||
|
||||
const endpoint = `/events/${eventId}/attendances/${attendanceId}`;
|
||||
response = await actionNetworkApiRequest.call(this, 'GET', endpoint);
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// attendance: getAll
|
||||
// ----------------------------------------
|
||||
@@ -181,11 +173,8 @@ export class ActionNetwork implements INodeType {
|
||||
|
||||
const endpoint = `/events/${eventId}/attendances`;
|
||||
response = await handleListing.call(this, 'GET', endpoint);
|
||||
|
||||
}
|
||||
|
||||
} else if (resource === 'event') {
|
||||
|
||||
// **********************************************************************
|
||||
// event
|
||||
// **********************************************************************
|
||||
@@ -193,7 +182,6 @@ export class ActionNetwork implements INodeType {
|
||||
// https://actionnetwork.org/docs/v2/events
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------------
|
||||
// event: create
|
||||
// ----------------------------------------
|
||||
@@ -210,9 +198,7 @@ export class ActionNetwork implements INodeType {
|
||||
}
|
||||
|
||||
response = await actionNetworkApiRequest.call(this, 'POST', '/events', body);
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// event: get
|
||||
// ----------------------------------------
|
||||
@@ -220,19 +206,14 @@ export class ActionNetwork implements INodeType {
|
||||
const eventId = this.getNodeParameter('eventId', i);
|
||||
|
||||
response = await actionNetworkApiRequest.call(this, 'GET', `/events/${eventId}`);
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// event: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
response = await handleListing.call(this, 'GET', '/events');
|
||||
|
||||
}
|
||||
|
||||
} else if (resource === 'person') {
|
||||
|
||||
// **********************************************************************
|
||||
// person
|
||||
// **********************************************************************
|
||||
@@ -240,7 +221,6 @@ export class ActionNetwork implements INodeType {
|
||||
// https://actionnetwork.org/docs/v2/people
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------------
|
||||
// person: create
|
||||
// ----------------------------------------
|
||||
@@ -260,27 +240,25 @@ export class ActionNetwork implements INodeType {
|
||||
}
|
||||
|
||||
response = await actionNetworkApiRequest.call(this, 'POST', '/people', body);
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// person: get
|
||||
// ----------------------------------------
|
||||
|
||||
const personId = this.getNodeParameter('personId', i);
|
||||
|
||||
response = await actionNetworkApiRequest.call(this, 'GET', `/people/${personId}`) as PersonResponse;
|
||||
|
||||
response = (await actionNetworkApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/people/${personId}`,
|
||||
)) as PersonResponse;
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// person: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
response = await handleListing.call(this, 'GET', '/people') as PersonResponse[];
|
||||
|
||||
response = (await handleListing.call(this, 'GET', '/people')) as PersonResponse[];
|
||||
} else if (operation === 'update') {
|
||||
|
||||
// ----------------------------------------
|
||||
// person: update
|
||||
// ----------------------------------------
|
||||
@@ -300,11 +278,8 @@ export class ActionNetwork implements INodeType {
|
||||
}
|
||||
|
||||
response = await actionNetworkApiRequest.call(this, 'PUT', `/people/${personId}`, body);
|
||||
|
||||
}
|
||||
|
||||
} else if (resource === 'petition') {
|
||||
|
||||
// **********************************************************************
|
||||
// petition
|
||||
// **********************************************************************
|
||||
@@ -312,7 +287,6 @@ export class ActionNetwork implements INodeType {
|
||||
// https://actionnetwork.org/docs/v2/petitions
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------------
|
||||
// petition: create
|
||||
// ----------------------------------------
|
||||
@@ -329,9 +303,7 @@ export class ActionNetwork implements INodeType {
|
||||
}
|
||||
|
||||
response = await actionNetworkApiRequest.call(this, 'POST', '/petitions', body);
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// petition: get
|
||||
// ----------------------------------------
|
||||
@@ -340,17 +312,13 @@ export class ActionNetwork implements INodeType {
|
||||
|
||||
const endpoint = `/petitions/${petitionId}`;
|
||||
response = await actionNetworkApiRequest.call(this, 'GET', endpoint);
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// petition: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
response = await handleListing.call(this, 'GET', '/petitions');
|
||||
|
||||
} else if (operation === 'update') {
|
||||
|
||||
// ----------------------------------------
|
||||
// petition: update
|
||||
// ----------------------------------------
|
||||
@@ -369,12 +337,14 @@ export class ActionNetwork implements INodeType {
|
||||
);
|
||||
}
|
||||
|
||||
response = await actionNetworkApiRequest.call(this, 'PUT', `/petitions/${petitionId}`, body);
|
||||
|
||||
response = await actionNetworkApiRequest.call(
|
||||
this,
|
||||
'PUT',
|
||||
`/petitions/${petitionId}`,
|
||||
body,
|
||||
);
|
||||
}
|
||||
|
||||
} else if (resource === 'signature') {
|
||||
|
||||
// **********************************************************************
|
||||
// signature
|
||||
// **********************************************************************
|
||||
@@ -382,7 +352,6 @@ export class ActionNetwork implements INodeType {
|
||||
// https://actionnetwork.org/docs/v2/signatures
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------------
|
||||
// signature: create
|
||||
// ----------------------------------------
|
||||
@@ -400,9 +369,7 @@ export class ActionNetwork implements INodeType {
|
||||
|
||||
const endpoint = `/petitions/${petitionId}/signatures`;
|
||||
response = await actionNetworkApiRequest.call(this, 'POST', endpoint, body);
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// signature: get
|
||||
// ----------------------------------------
|
||||
@@ -412,9 +379,7 @@ export class ActionNetwork implements INodeType {
|
||||
|
||||
const endpoint = `/petitions/${petitionId}/signatures/${signatureId}`;
|
||||
response = await actionNetworkApiRequest.call(this, 'GET', endpoint);
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// signature: getAll
|
||||
// ----------------------------------------
|
||||
@@ -423,9 +388,7 @@ export class ActionNetwork implements INodeType {
|
||||
|
||||
const endpoint = `/petitions/${petitionId}/signatures`;
|
||||
response = await handleListing.call(this, 'GET', endpoint);
|
||||
|
||||
} else if (operation === 'update') {
|
||||
|
||||
// ----------------------------------------
|
||||
// signature: update
|
||||
// ----------------------------------------
|
||||
@@ -447,11 +410,8 @@ export class ActionNetwork implements INodeType {
|
||||
|
||||
const endpoint = `/petitions/${petitionId}/signatures/${signatureId}`;
|
||||
response = await actionNetworkApiRequest.call(this, 'PUT', endpoint, body);
|
||||
|
||||
}
|
||||
|
||||
} else if (resource === 'tag') {
|
||||
|
||||
// **********************************************************************
|
||||
// tag
|
||||
// **********************************************************************
|
||||
@@ -459,7 +419,6 @@ export class ActionNetwork implements INodeType {
|
||||
// https://actionnetwork.org/docs/v2/tags
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------------
|
||||
// tag: create
|
||||
// ----------------------------------------
|
||||
@@ -469,9 +428,7 @@ export class ActionNetwork implements INodeType {
|
||||
} as IDataObject;
|
||||
|
||||
response = await actionNetworkApiRequest.call(this, 'POST', '/tags', body);
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// tag: get
|
||||
// ----------------------------------------
|
||||
@@ -479,19 +436,14 @@ export class ActionNetwork implements INodeType {
|
||||
const tagId = this.getNodeParameter('tagId', i);
|
||||
|
||||
response = await actionNetworkApiRequest.call(this, 'GET', `/tags/${tagId}`);
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// tag: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
response = await handleListing.call(this, 'GET', '/tags');
|
||||
|
||||
}
|
||||
|
||||
} else if (resource === 'personTag') {
|
||||
|
||||
// **********************************************************************
|
||||
// personTag
|
||||
// **********************************************************************
|
||||
@@ -499,7 +451,6 @@ export class ActionNetwork implements INodeType {
|
||||
// https://actionnetwork.org/docs/v2/taggings
|
||||
|
||||
if (operation === 'add') {
|
||||
|
||||
// ----------------------------------------
|
||||
// personTag: add
|
||||
// ----------------------------------------
|
||||
@@ -511,9 +462,7 @@ export class ActionNetwork implements INodeType {
|
||||
|
||||
const endpoint = `/tags/${tagId}/taggings`;
|
||||
response = await actionNetworkApiRequest.call(this, 'POST', endpoint, body);
|
||||
|
||||
} else if (operation === 'remove') {
|
||||
|
||||
// ----------------------------------------
|
||||
// personTag: remove
|
||||
// ----------------------------------------
|
||||
@@ -523,23 +472,19 @@ export class ActionNetwork implements INodeType {
|
||||
|
||||
const endpoint = `/tags/${tagId}/taggings/${taggingId}`;
|
||||
response = await actionNetworkApiRequest.call(this, 'DELETE', endpoint);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const simplify = this.getNodeParameter('simple', i, false) as boolean;
|
||||
|
||||
if (simplify) {
|
||||
response = operation === 'getAll'
|
||||
? response.map((i: Response) => simplifyResponse(i, resource))
|
||||
: simplifyResponse(response, resource);
|
||||
response =
|
||||
operation === 'getAll'
|
||||
? response.map((i: Response) => simplifyResponse(i, resource))
|
||||
: simplifyResponse(response, resource);
|
||||
}
|
||||
|
||||
Array.isArray(response)
|
||||
? returnData.push(...response)
|
||||
: returnData.push(response);
|
||||
|
||||
Array.isArray(response) ? returnData.push(...response) : returnData.push(response);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
|
||||
Reference in New Issue
Block a user