@absolutejs/engagement-apollo 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +9 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -92,12 +92,18 @@ var apolloSource = (options) => {
|
|
|
92
92
|
...query.domain ? { q_organization_domains_list: [query.domain] } : {},
|
|
93
93
|
...!query.domain && query.company ? { q_keywords: query.company } : {}
|
|
94
94
|
});
|
|
95
|
+
const searchRequests = search ? 1 : 0;
|
|
95
96
|
const previews = search && Array.isArray(search.people) ? search.people : [];
|
|
96
97
|
const ids = previews.map((person) => isRecord(person) ? str(person.id) : null).filter((id) => id !== null);
|
|
97
|
-
if (ids.length === 0)
|
|
98
|
-
return [];
|
|
98
|
+
if (ids.length === 0) {
|
|
99
|
+
return { people: [], revealsAttempted: 0, searchRequests };
|
|
100
|
+
}
|
|
99
101
|
const revealed = await Promise.all(ids.map((id) => matchById(id)));
|
|
100
|
-
return
|
|
102
|
+
return {
|
|
103
|
+
people: revealed.filter((person) => person !== null),
|
|
104
|
+
revealsAttempted: ids.length,
|
|
105
|
+
searchRequests
|
|
106
|
+
};
|
|
101
107
|
};
|
|
102
108
|
const enrichCompany = async (query) => {
|
|
103
109
|
if (!query.domain)
|
package/package.json
CHANGED