get-top-countries-of-partners-hubspot
Advanced tools
Comparing version 1.0.1 to 1.0.2
14
index.js
@@ -5,3 +5,3 @@ 'use strict'; | ||
const { areProvidedCompaniesCorrectType } = require('are-provided-companies-correct-type'); | ||
const { bulkUpdateHubspotCompanies, getTopCountriesOfClients, getHubspotCompanies } = require('./services'); | ||
const { bulkUpdateHubspotCompanies, getTopCountriesOfPartners, getHubspotCompanies } = require('./services'); | ||
@@ -28,15 +28,15 @@ const getTopCountriesOfPartnersHubspot = async ({ hubspotApiKey, ippqlKey, ipqqlHost, providedHsCompanies }) => { | ||
const results = await getTopCountriesOfClients(hsCompanies, ippqlKey, ipqqlHost); | ||
const results = await getTopCountriesOfPartners(hsCompanies, ippqlKey, ipqqlHost); | ||
if (!results) return; | ||
const topCountriesOfClients = results.filter((el) => el.topCountriesOfClients.length); | ||
const topCountriesOfPartners = results.filter((el) => el.topCountriesOfPartners.length); | ||
if (!topCountriesOfClients || !topCountriesOfClients.length) throw new Error('no topCountriesOfClients found'); | ||
if (!topCountriesOfPartners || !topCountriesOfPartners.length) throw new Error('no topCountriesOfPartners found'); | ||
const noResults = results.filter((el) => !el.topCountriesOfClients.length); | ||
const noResults = results.filter((el) => !el.topCountriesOfPartners.length); | ||
console.log('noResults.length', noResults.length); | ||
console.log('topCountriesOfClients.length', topCountriesOfClients.length); | ||
console.log('topCountriesOfPartners.length', topCountriesOfPartners.length); | ||
const result = await bulkUpdateHubspotCompanies(topCountriesOfClients, hubspotApiKey); | ||
const result = await bulkUpdateHubspotCompanies(topCountriesOfPartners, hubspotApiKey); | ||
if (!result) throw new Error('failed to update companies in Hubspot'); | ||
@@ -43,0 +43,0 @@ console.log(`updated ${result.updated} companies out of ${result.total} comapnies`); |
{ | ||
"name": "get-top-countries-of-partners-hubspot", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A demo package that allows you to match retrieve top countries of partners from IP Pilot's database and save it for every company in your Hubspot account.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,4 +5,4 @@ 'use strict'; | ||
const { getHubspotCompanies } = require('./getHubspotCompanies'); | ||
const { getTopCountriesOfClients } = require('./getTopCountriesOfClients'); | ||
const { getTopCountriesOfPartners } = require('./getTopCountriesOfPartners'); | ||
module.exports = { bulkUpdateHubspotCompanies, getHubspotCompanies, getTopCountriesOfClients }; | ||
module.exports = { bulkUpdateHubspotCompanies, getHubspotCompanies, getTopCountriesOfPartners }; |
9641