diff --git a/packages/nodes-base/nodes/Clearbit/Clearbit.node.ts b/packages/nodes-base/nodes/Clearbit/Clearbit.node.ts index ba28e8d71e..2d5820c18b 100644 --- a/packages/nodes-base/nodes/Clearbit/Clearbit.node.ts +++ b/packages/nodes-base/nodes/Clearbit/Clearbit.node.ts @@ -1,19 +1,23 @@ import { IExecuteFunctions, } from 'n8n-core'; + import { IDataObject, INodeExecutionData, INodeType, INodeTypeDescription, } from 'n8n-workflow'; + import { clearbitApiRequest, } from './GenericFunctions'; + import { companyFields, companyOperations, } from './CompanyDescription'; + import { personFields, personOperations, @@ -23,7 +27,7 @@ export class Clearbit implements INodeType { description: INodeTypeDescription = { displayName: 'Clearbit', name: 'clearbit', - icon: 'file:clearbit.png', + icon: 'file:clearbit.svg', group: ['output'], version: 1, subtitle: '={{$parameter["operation"] + ":" + $parameter["resource"]}}', @@ -109,7 +113,7 @@ export class Clearbit implements INodeType { if (additionalFields.facebook) { qs.facebook = additionalFields.facebook as string; } - responseData = await clearbitApiRequest.call(this, 'GET', resource, '/v2/people/find', {}, qs); + responseData = await clearbitApiRequest.call(this, 'GET', `${resource}-stream`, '/v2/people/find', {}, qs); } } if (resource === 'company') { @@ -129,7 +133,7 @@ export class Clearbit implements INodeType { if (additionalFields.facebook) { qs.facebook = additionalFields.facebook as string; } - responseData = await clearbitApiRequest.call(this, 'GET', resource, '/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; diff --git a/packages/nodes-base/nodes/Clearbit/CompanyDescription.ts b/packages/nodes-base/nodes/Clearbit/CompanyDescription.ts index 2ccc3c287b..0737208b0f 100644 --- a/packages/nodes-base/nodes/Clearbit/CompanyDescription.ts +++ b/packages/nodes-base/nodes/Clearbit/CompanyDescription.ts @@ -13,16 +13,16 @@ export const companyOperations = [ }, }, options: [ - { - name: 'Enrich', - value: 'enrich', - description: 'Look up person and company data based on an email or domain', - }, { name: 'Autocomplete', value: 'autocomplete', description: 'Auto-complete company names and retrieve logo and domain', }, + { + name: 'Enrich', + value: 'enrich', + description: 'Look up person and company data based on an email or domain', + }, ], default: 'enrich', description: 'The operation to perform.', @@ -31,9 +31,9 @@ export const companyOperations = [ export const companyFields = [ -/* -------------------------------------------------------------------------- */ -/* company:enrich */ -/* -------------------------------------------------------------------------- */ + /* -------------------------------------------------------------------------- */ + /* company:enrich */ + /* -------------------------------------------------------------------------- */ { displayName: 'Domain', name: 'domain', @@ -99,25 +99,26 @@ export const companyFields = [ }, ], }, -/* -------------------------------------------------------------------------- */ -/* company:autocomplete */ -/* -------------------------------------------------------------------------- */ -{ - displayName: 'Name', - name: 'name', - type: 'string', - default: '', - required: true, - displayOptions: { - show: { - resource: [ - 'company', - ], - operation: [ - 'autocomplete', - ], + + /* -------------------------------------------------------------------------- */ + /* company:autocomplete */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + resource: [ + 'company', + ], + operation: [ + 'autocomplete', + ], + }, }, + description: 'Name is the partial name of the company.', }, - description: 'Name is the partial name of the company.', -}, ] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/Clearbit/GenericFunctions.ts b/packages/nodes-base/nodes/Clearbit/GenericFunctions.ts index 4251bd4a2f..e22d0e607e 100644 --- a/packages/nodes-base/nodes/Clearbit/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Clearbit/GenericFunctions.ts @@ -1,11 +1,17 @@ -import { OptionsWithUri } from 'request'; +import { + OptionsWithUri, +} from 'request'; + import { IExecuteFunctions, IExecuteSingleFunctions, IHookFunctions, ILoadOptionsFunctions, } from 'n8n-core'; -import { IDataObject } from 'n8n-workflow'; + +import { + IDataObject, +} 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 { // tslint:disable-line:no-any const credentials = this.getCredentials('clearbitApi'); @@ -13,11 +19,11 @@ export async function clearbitApiRequest(this: IHookFunctions | IExecuteFunction throw new Error('No credentials got returned!'); } let options: OptionsWithUri = { - headers: { Authorization: `Bearer ${credentials.apiKey}`}, + headers: { Authorization: `Bearer ${credentials.apiKey}` }, method, qs, body, - uri: uri ||`https://${api}-stream.clearbit.com${resource}`, + uri: uri || `https://${api}.clearbit.com${resource}`, json: true, }; options = Object.assign({}, options, option); diff --git a/packages/nodes-base/nodes/Clearbit/PersonDescription.ts b/packages/nodes-base/nodes/Clearbit/PersonDescription.ts index 71f6803c02..122e0d76d5 100644 --- a/packages/nodes-base/nodes/Clearbit/PersonDescription.ts +++ b/packages/nodes-base/nodes/Clearbit/PersonDescription.ts @@ -26,9 +26,9 @@ export const personOperations = [ export const personFields = [ -/* -------------------------------------------------------------------------- */ -/* person:enrich */ -/* -------------------------------------------------------------------------- */ + /* -------------------------------------------------------------------------- */ + /* person:enrich */ + /* -------------------------------------------------------------------------- */ { displayName: 'Email', name: 'email', diff --git a/packages/nodes-base/nodes/Clearbit/clearbit.png b/packages/nodes-base/nodes/Clearbit/clearbit.png deleted file mode 100644 index acb406f45d..0000000000 Binary files a/packages/nodes-base/nodes/Clearbit/clearbit.png and /dev/null differ diff --git a/packages/nodes-base/nodes/Clearbit/clearbit.svg b/packages/nodes-base/nodes/Clearbit/clearbit.svg new file mode 100644 index 0000000000..ca57f95378 --- /dev/null +++ b/packages/nodes-base/nodes/Clearbit/clearbit.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + +