get-top-countries-of-reps-hubspot
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "get-top-countries-of-reps-hubspot", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A demo package that allows you to match retrieve top countries of reps from IP Pilot's database and save it for every company in your Hubspot account.", | ||
@@ -21,4 +21,5 @@ "main": "index.js", | ||
"get-all-hubspot-companies": "^1.0.6", | ||
"ippql-helpers": "^1.0.1", | ||
"populate-hubspot-companies-with-id": "^1.0.3" | ||
} | ||
} |
'use strict'; | ||
const { axiosFetcher } = require('axios-fetcher'); | ||
const { ippqlHelpers } = require('ippql-helpers'); | ||
const { getFormattedCountries, sortAndSliceIppqlResults } = ippqlHelpers; | ||
@@ -26,3 +28,3 @@ const query = `query filingsRequest($params: IPPQL) { | ||
filters: { prosecution_date: { from: '1980-01-01' }, applicant_url: [url] }, | ||
aggregations: { field: 'rep_url', data: { fields: ['rep_name', 'rep_country'] }, size: 3 }, | ||
aggregations: { field: 'rep_url', data: { fields: ['rep_name', 'rep_country'] }, size: 30 }, | ||
}, | ||
@@ -47,7 +49,6 @@ }; | ||
) { | ||
const entries = result.data.filingsRequest.rep_url; | ||
temporaryCompany.topCountriesOfReps.push({ | ||
name, | ||
countries: result.data.filingsRequest.rep_url | ||
.map((el) => el.data_1 && el.data_1.length && `${el.data_1[0].rep_country} = ${el[Object.keys(el)[0]]}`) | ||
.join(', '), | ||
countries: getFormattedCountries(sortAndSliceIppqlResults(entries, 3), 'rep_country'), | ||
}); | ||
@@ -54,0 +55,0 @@ } |
9606
154
5
+ Addedippql-helpers@^1.0.1
+ Addedippql-helpers@1.0.2(transitive)