Skip to content

Commit 2d2a242

Browse files
committed
[FIX] Lusha API Authentication Issue
1 parent 6182744 commit 2d2a242

File tree

8 files changed

+60
-23
lines changed

8 files changed

+60
-23
lines changed

components/lusha/actions/company-enrich/company-enrich.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "lusha-company-enrich",
55
name: "Enrich Companies",
66
description: "Enriches company information based on provided company IDs. [See the documentation](https://docs.lusha.com/apis/openapi/company-search-and-enrich/enrichprospectingcompanies)",
7-
version: "0.0.4",
7+
version: "0.0.5",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/lusha/actions/company-search/company-search.mjs

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "lusha-company-search",
66
name: "Search Companies",
77
description: "Search for companies using various filters. [See the documentation](https://docs.lusha.com/apis/openapi/company-search-and-enrich/searchprospectingcompanies)",
8-
version: "0.0.3",
8+
version: "0.0.4",
99
annotations: {
1010
destructiveHint: false,
1111
openWorldHint: true,
@@ -67,13 +67,30 @@ export default {
6767
try {
6868
const include = {};
6969

70-
if (this.names) include.names = parseObject(this.names);
71-
if (this.domains) include.domains = parseObject(this.domains);
72-
if (this.locations) include.locations = parseObject(this.locations);
73-
if (this.sizes) include.sizes = parseObject(this.sizes);
74-
if (this.revenues) include.revenues = parseObject(this.revenues);
75-
if (this.sicCodes) include.sicCodes = parseObject(this.sicCodes);
76-
if (this.naicsCodes) include.naicsCodes = parseObject(this.naicsCodes);
70+
if (this.names) {
71+
include.names = parseObject(this.names);
72+
}
73+
if (this.domains) {
74+
include.domains = parseObject(this.domains);
75+
}
76+
if (this.locations) {
77+
include.locations = parseObject(this.locations)
78+
.map((country) => ({
79+
country,
80+
}));
81+
}
82+
if (this.sizes) {
83+
include.sizes = parseObject(this.sizes);
84+
}
85+
if (this.revenues) {
86+
include.revenues = parseObject(this.revenues);
87+
}
88+
if (this.sicCodes) {
89+
include.sicCodes = parseObject(this.sicCodes);
90+
}
91+
if (this.naicsCodes) {
92+
include.naicsCodes = parseObject(this.naicsCodes);
93+
}
7794

7895
const response = this.lusha.paginate({
7996
$,

components/lusha/actions/contact-enrich/contact-enrich.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "lusha-contact-enrich",
55
name: "Enrich Contacts",
66
description: "Enriches contacts based on provided IDs. [See the documentation](https://docs.lusha.com/apis/openapi/contact-search-and-enrich/enrichprospectingcontacts)",
7-
version: "0.0.3",
7+
version: "0.0.4",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/lusha/actions/contact-search/contact-search.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "lusha-contact-search",
66
name: "Search Contacts",
77
description: "Search for contacts using various filters. [See the documentation](https://docs.lusha.com/apis/openapi/contact-search-and-enrich/searchprospectingcontacts)",
8-
version: "0.0.3",
8+
version: "0.0.4",
99
annotations: {
1010
destructiveHint: false,
1111
openWorldHint: true,
@@ -82,7 +82,7 @@ export default {
8282
if (this.seniority) include.seniority = parseObject(this.seniority);
8383
if (this.departments) include.departments = parseObject(this.departments);
8484
if (this.existingDataPoints) include.existingDataPoints = parseObject(this.existingDataPoints);
85-
if (this.location) include.location = parseObject(this.location);
85+
if (this.location) include.locations = parseObject(this.location);
8686

8787
const response = this.lusha.paginate({
8888
$,

components/lusha/actions/search-and-enrich-companies/search-and-enrich-companies.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "lusha-search-and-enrich-companies",
66
name: "Search and Enrich Companies",
77
description: "Search for companies and enrich them. [See the documentation](https://docs.lusha.com/apis/openapi/company-search-and-enrich)",
8-
version: "0.0.2",
8+
version: "0.0.3",
99
annotations: {
1010
destructiveHint: false,
1111
openWorldHint: true,

components/lusha/actions/search-and-enrich-contacts/search-and-enrich-contacts.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "lusha-search-and-enrich-contacts",
66
name: "Search and Enrich Contacts",
77
description: "Search for contacts and enrich them. [See the documentation](https://docs.lusha.com/apis/openapi/contact-search-and-enrich)",
8-
version: "0.0.2",
8+
version: "0.0.3",
99
annotations: {
1010
destructiveHint: false,
1111
openWorldHint: true,
@@ -82,7 +82,7 @@ export default {
8282
if (this.seniority) include.seniority = parseObject(this.seniority);
8383
if (this.departments) include.departments = parseObject(this.departments);
8484
if (this.existingDataPoints) include.existingDataPoints = parseObject(this.existingDataPoints);
85-
if (this.location) include.location = parseObject(this.location);
85+
if (this.location) include.locations = parseObject(this.location);
8686

8787
const contacts = [];
8888
let hasMore, count = 0, page = 0;

components/lusha/lusha.app.mjs

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,26 @@ export default {
141141
location: {
142142
type: "string[]",
143143
label: "Contact Locations",
144-
description: "Location filters for contacts to search (JSON strings)",
144+
description: `Location filters for contacts to search. Each entry should be a JSON object with the following optional fields:
145+
146+
**Available Fields:**
147+
- \`continent\` - The continent name (e.g., "North America")
148+
- \`country\` - The country name (e.g., "United States")
149+
- \`country_grouping\` - Country grouping code (e.g., "na" for North America)
150+
- \`state\` - The state or region name (e.g., "New York")
151+
- \`city\` - The city name (e.g., "New York")
152+
153+
**Example JSON:**
154+
\`\`\`json
155+
[
156+
{
157+
"continent": "North America",
158+
"country": "United States",
159+
"state": "New York",
160+
"city": "New York"
161+
}
162+
]
163+
\`\`\``,
145164
optional: true,
146165
},
147166
requestId: {
@@ -261,30 +280,31 @@ export default {
261280
});
262281
},
263282
async *paginate({
264-
fn, params = {}, maxResults = null, ...opts
283+
fn, data = {}, maxResults = null, ...opts
265284
}) {
266285
let hasMore = false;
267286
let count = 0;
268287
let page = -1;
269288

270289
do {
271-
params.pages = {
290+
data.pages = {
272291
page: ++page,
273292
size: 50,
274293
};
275-
const { data } = await fn({
276-
params,
294+
const response = await fn({
295+
data,
277296
...opts,
278297
});
279-
for (const d of data) {
298+
const results = response.data || [];
299+
for (const d of results) {
280300
yield d;
281301

282302
if (maxResults && ++count === maxResults) {
283303
return count;
284304
}
285305
}
286306

287-
hasMore = data.length;
307+
hasMore = results.length;
288308

289309
} while (hasMore);
290310
},

components/lusha/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/lusha",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "Pipedream Lusha Components",
55
"main": "lusha.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)