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,27 +1,12 @@
|
||||
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 {
|
||||
clearbitApiRequest,
|
||||
} from './GenericFunctions';
|
||||
import { clearbitApiRequest } from './GenericFunctions';
|
||||
|
||||
import {
|
||||
companyFields,
|
||||
companyOperations,
|
||||
} from './CompanyDescription';
|
||||
import { companyFields, companyOperations } from './CompanyDescription';
|
||||
|
||||
import {
|
||||
personFields,
|
||||
personOperations,
|
||||
} from './PersonDescription';
|
||||
import { personFields, personOperations } from './PersonDescription';
|
||||
|
||||
export class Clearbit implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -58,7 +43,8 @@ export class Clearbit implements INodeType {
|
||||
{
|
||||
name: 'Person',
|
||||
value: 'person',
|
||||
description: 'The Person API lets you retrieve social information associated with an email address, such as a person’s name, location and Twitter handle',
|
||||
description:
|
||||
'The Person API lets you retrieve social information associated with an email address, such as a person’s name, location and Twitter handle',
|
||||
},
|
||||
],
|
||||
default: 'company',
|
||||
@@ -112,7 +98,14 @@ export class Clearbit implements INodeType {
|
||||
if (additionalFields.facebook) {
|
||||
qs.facebook = additionalFields.facebook as string;
|
||||
}
|
||||
responseData = await clearbitApiRequest.call(this, 'GET', `${resource}-stream`, '/v2/people/find', {}, qs);
|
||||
responseData = await clearbitApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`${resource}-stream`,
|
||||
'/v2/people/find',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (resource === 'company') {
|
||||
@@ -132,12 +125,26 @@ export class Clearbit implements INodeType {
|
||||
if (additionalFields.facebook) {
|
||||
qs.facebook = additionalFields.facebook as string;
|
||||
}
|
||||
responseData = await clearbitApiRequest.call(this, 'GET', `${resource}-stream`, '/v2/companies/find', {}, qs);
|
||||
responseData = await clearbitApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`${resource}-stream`,
|
||||
'/v2/companies/find',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
}
|
||||
if (operation === 'autocomplete') {
|
||||
const name = this.getNodeParameter('name', i) as string;
|
||||
qs.query = name;
|
||||
responseData = await clearbitApiRequest.call(this, 'GET', 'autocomplete', '/v1/companies/suggest', {}, qs);
|
||||
responseData = await clearbitApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'autocomplete',
|
||||
'/v1/companies/suggest',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
|
||||
@@ -8,9 +8,7 @@ export const companyOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'company',
|
||||
],
|
||||
resource: ['company'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -32,7 +30,6 @@ export const companyOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const companyFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* company:enrich */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -44,12 +41,8 @@ export const companyFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'company',
|
||||
],
|
||||
operation: [
|
||||
'enrich',
|
||||
],
|
||||
resource: ['company'],
|
||||
operation: ['enrich'],
|
||||
},
|
||||
},
|
||||
description: 'The domain to look up',
|
||||
@@ -62,12 +55,8 @@ export const companyFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'company',
|
||||
],
|
||||
operation: [
|
||||
'enrich',
|
||||
],
|
||||
resource: ['company'],
|
||||
operation: ['enrich'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -113,12 +102,8 @@ export const companyFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'company',
|
||||
],
|
||||
operation: [
|
||||
'autocomplete',
|
||||
],
|
||||
resource: ['company'],
|
||||
operation: ['autocomplete'],
|
||||
},
|
||||
},
|
||||
description: 'Name is the partial name of the company',
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
@@ -9,9 +7,20 @@ import {
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import { IDataObject, NodeApiError, NodeOperationError, } from 'n8n-workflow';
|
||||
import { IDataObject, NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
export async function clearbitApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, api: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function clearbitApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
api: string,
|
||||
resource: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
qs: IDataObject = {},
|
||||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('clearbitApi');
|
||||
let options: OptionsWithUri = {
|
||||
headers: { Authorization: `Bearer ${credentials.apiKey}` },
|
||||
|
||||
@@ -8,9 +8,7 @@ export const personOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'person',
|
||||
],
|
||||
resource: ['person'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -26,7 +24,6 @@ export const personOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const personFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* person:enrich */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -39,12 +36,8 @@ export const personFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'person',
|
||||
],
|
||||
operation: [
|
||||
'enrich',
|
||||
],
|
||||
resource: ['person'],
|
||||
operation: ['enrich'],
|
||||
},
|
||||
},
|
||||
description: 'The email address to look up',
|
||||
@@ -57,12 +50,8 @@ export const personFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'person',
|
||||
],
|
||||
operation: [
|
||||
'enrich',
|
||||
],
|
||||
resource: ['person'],
|
||||
operation: ['enrich'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -92,7 +81,8 @@ export const personFields: INodeProperties[] = [
|
||||
name: 'familyName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Last name of person. If you have this, passing this is strongly recommended to improve match rates.',
|
||||
description:
|
||||
'Last name of person. If you have this, passing this is strongly recommended to improve match rates.',
|
||||
},
|
||||
{
|
||||
displayName: 'Given Name',
|
||||
@@ -106,7 +96,8 @@ export const personFields: INodeProperties[] = [
|
||||
name: 'ipAddress',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'IP address of the person. If you have this, passing this is strongly recommended to improve match rates.',
|
||||
description:
|
||||
'IP address of the person. If you have this, passing this is strongly recommended to improve match rates.',
|
||||
},
|
||||
{
|
||||
displayName: 'Location',
|
||||
|
||||
Reference in New Issue
Block a user