mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +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,13 +1,6 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
adjustCompanyFields,
|
||||
@@ -128,17 +121,13 @@ export class Copper implements INodeType {
|
||||
let responseData;
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
|
||||
try {
|
||||
|
||||
if (resource === 'company') {
|
||||
|
||||
// **********************************************************************
|
||||
// company
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------------
|
||||
// company: create
|
||||
// ----------------------------------------
|
||||
@@ -156,9 +145,7 @@ export class Copper implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'POST', '/companies', body);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
|
||||
// ----------------------------------------
|
||||
// company: delete
|
||||
// ----------------------------------------
|
||||
@@ -168,9 +155,7 @@ export class Copper implements INodeType {
|
||||
const companyId = this.getNodeParameter('companyId', i);
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'DELETE', `/companies/${companyId}`);
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// company: get
|
||||
// ----------------------------------------
|
||||
@@ -180,9 +165,7 @@ export class Copper implements INodeType {
|
||||
const companyId = this.getNodeParameter('companyId', i);
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'GET', `/companies/${companyId}`);
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// company: getAll
|
||||
// ----------------------------------------
|
||||
@@ -197,9 +180,7 @@ export class Copper implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await handleListing.call(this, 'POST', '/companies/search', body);
|
||||
|
||||
} else if (operation === 'update') {
|
||||
|
||||
// ----------------------------------------
|
||||
// company: update
|
||||
// ----------------------------------------
|
||||
@@ -215,34 +196,31 @@ export class Copper implements INodeType {
|
||||
Object.assign(body, adjustCompanyFields(updateFields));
|
||||
}
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'PUT', `/companies/${companyId}`, body);
|
||||
|
||||
responseData = await copperApiRequest.call(
|
||||
this,
|
||||
'PUT',
|
||||
`/companies/${companyId}`,
|
||||
body,
|
||||
);
|
||||
}
|
||||
|
||||
} else if (resource === 'customerSource') {
|
||||
|
||||
// **********************************************************************
|
||||
// customerSource
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// customerSource: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
responseData = await handleListing.call(this, 'GET', '/customer_sources');
|
||||
|
||||
}
|
||||
|
||||
} else if (resource === 'lead') {
|
||||
|
||||
// **********************************************************************
|
||||
// lead
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------------
|
||||
// lead: create
|
||||
// ----------------------------------------
|
||||
@@ -260,9 +238,7 @@ export class Copper implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'POST', '/leads', body);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
|
||||
// ----------------------------------------
|
||||
// lead: delete
|
||||
// ----------------------------------------
|
||||
@@ -272,9 +248,7 @@ export class Copper implements INodeType {
|
||||
const leadId = this.getNodeParameter('leadId', i);
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'DELETE', `/leads/${leadId}`);
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// lead: get
|
||||
// ----------------------------------------
|
||||
@@ -284,9 +258,7 @@ export class Copper implements INodeType {
|
||||
const leadId = this.getNodeParameter('leadId', i);
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'GET', `/leads/${leadId}`);
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// lead: getAll
|
||||
// ----------------------------------------
|
||||
@@ -299,9 +271,7 @@ export class Copper implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await handleListing.call(this, 'POST', '/leads/search', body);
|
||||
|
||||
} else if (operation === 'update') {
|
||||
|
||||
// ----------------------------------------
|
||||
// lead: update
|
||||
// ----------------------------------------
|
||||
@@ -318,17 +288,13 @@ export class Copper implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'PUT', `/leads/${leadId}`, body);
|
||||
|
||||
}
|
||||
|
||||
} else if (resource === 'opportunity') {
|
||||
|
||||
// **********************************************************************
|
||||
// opportunity
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------------
|
||||
// opportunity: create
|
||||
// ----------------------------------------
|
||||
@@ -342,9 +308,7 @@ export class Copper implements INodeType {
|
||||
};
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'POST', '/opportunities', body);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
|
||||
// ----------------------------------------
|
||||
// opportunity: delete
|
||||
// ----------------------------------------
|
||||
@@ -353,10 +317,12 @@ export class Copper implements INodeType {
|
||||
|
||||
const opportunityId = this.getNodeParameter('opportunityId', i);
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'DELETE', `/opportunities/${opportunityId}`);
|
||||
|
||||
responseData = await copperApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/opportunities/${opportunityId}`,
|
||||
);
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// opportunity: get
|
||||
// ----------------------------------------
|
||||
@@ -365,10 +331,12 @@ export class Copper implements INodeType {
|
||||
|
||||
const opportunityId = this.getNodeParameter('opportunityId', i);
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'GET', `/opportunities/${opportunityId}`);
|
||||
|
||||
responseData = await copperApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/opportunities/${opportunityId}`,
|
||||
);
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// opportunity: getAll
|
||||
// ----------------------------------------
|
||||
@@ -383,9 +351,7 @@ export class Copper implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await handleListing.call(this, 'POST', '/opportunities/search', body);
|
||||
|
||||
} else if (operation === 'update') {
|
||||
|
||||
// ----------------------------------------
|
||||
// opportunity: update
|
||||
// ----------------------------------------
|
||||
@@ -401,18 +367,19 @@ export class Copper implements INodeType {
|
||||
Object.assign(body, updateFields);
|
||||
}
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'PUT', `/opportunities/${opportunityId}`, body);
|
||||
|
||||
responseData = await copperApiRequest.call(
|
||||
this,
|
||||
'PUT',
|
||||
`/opportunities/${opportunityId}`,
|
||||
body,
|
||||
);
|
||||
}
|
||||
|
||||
} else if (resource === 'person') {
|
||||
|
||||
// **********************************************************************
|
||||
// person
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------------
|
||||
// person: create
|
||||
// ----------------------------------------
|
||||
@@ -430,9 +397,7 @@ export class Copper implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'POST', '/people', body);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
|
||||
// ----------------------------------------
|
||||
// person: delete
|
||||
// ----------------------------------------
|
||||
@@ -442,9 +407,7 @@ export class Copper implements INodeType {
|
||||
const personId = this.getNodeParameter('personId', i);
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'DELETE', `/people/${personId}`);
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// person: get
|
||||
// ----------------------------------------
|
||||
@@ -454,9 +417,7 @@ export class Copper implements INodeType {
|
||||
const personId = this.getNodeParameter('personId', i);
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'GET', `/people/${personId}`);
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// person: getAll
|
||||
// ----------------------------------------
|
||||
@@ -469,9 +430,7 @@ export class Copper implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await handleListing.call(this, 'POST', '/people/search', body);
|
||||
|
||||
} else if (operation === 'update') {
|
||||
|
||||
// ----------------------------------------
|
||||
// person: update
|
||||
// ----------------------------------------
|
||||
@@ -488,17 +447,13 @@ export class Copper implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'PUT', `/people/${personId}`, body);
|
||||
|
||||
}
|
||||
|
||||
} else if (resource === 'project') {
|
||||
|
||||
// **********************************************************************
|
||||
// project
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------------
|
||||
// project: create
|
||||
// ----------------------------------------
|
||||
@@ -516,9 +471,7 @@ export class Copper implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'POST', '/projects', body);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
|
||||
// ----------------------------------------
|
||||
// project: delete
|
||||
// ----------------------------------------
|
||||
@@ -528,9 +481,7 @@ export class Copper implements INodeType {
|
||||
const projectId = this.getNodeParameter('projectId', i);
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'DELETE', `/projects/${projectId}`);
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// project: get
|
||||
// ----------------------------------------
|
||||
@@ -540,9 +491,7 @@ export class Copper implements INodeType {
|
||||
const projectId = this.getNodeParameter('projectId', i);
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'GET', `/projects/${projectId}`);
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// project: getAll
|
||||
// ----------------------------------------
|
||||
@@ -557,9 +506,7 @@ export class Copper implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await handleListing.call(this, 'POST', '/projects/search', body);
|
||||
|
||||
} else if (operation === 'update') {
|
||||
|
||||
// ----------------------------------------
|
||||
// project: update
|
||||
// ----------------------------------------
|
||||
@@ -576,17 +523,13 @@ export class Copper implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'PUT', `/projects/${projectId}`, body);
|
||||
|
||||
}
|
||||
|
||||
} else if (resource === 'task') {
|
||||
|
||||
// **********************************************************************
|
||||
// task
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------------
|
||||
// task: create
|
||||
// ----------------------------------------
|
||||
@@ -604,9 +547,7 @@ export class Copper implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'POST', '/tasks', body);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
|
||||
// ----------------------------------------
|
||||
// task: delete
|
||||
// ----------------------------------------
|
||||
@@ -616,9 +557,7 @@ export class Copper implements INodeType {
|
||||
const taskId = this.getNodeParameter('taskId', i);
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'DELETE', `/tasks/${taskId}`);
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// task: get
|
||||
// ----------------------------------------
|
||||
@@ -628,9 +567,7 @@ export class Copper implements INodeType {
|
||||
const taskId = this.getNodeParameter('taskId', i);
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'GET', `/tasks/${taskId}`);
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// task: getAll
|
||||
// ----------------------------------------
|
||||
@@ -645,9 +582,7 @@ export class Copper implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await handleListing.call(this, 'POST', '/tasks/search', body);
|
||||
|
||||
} else if (operation === 'update') {
|
||||
|
||||
// ----------------------------------------
|
||||
// task: update
|
||||
// ----------------------------------------
|
||||
@@ -665,24 +600,19 @@ export class Copper implements INodeType {
|
||||
|
||||
responseData = await copperApiRequest.call(this, 'PUT', `/tasks/${taskId}`, body);
|
||||
}
|
||||
|
||||
} else if (resource === 'user') {
|
||||
|
||||
// **********************************************************************
|
||||
// user
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// user: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
responseData = await handleListing.call(this, 'POST', '/users/search');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.toString() });
|
||||
@@ -695,7 +625,6 @@ export class Copper implements INodeType {
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
Reference in New Issue
Block a user