Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions components/lusha/actions/company-enrich/company-enrich.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import lusha from "../../lusha.app.mjs";
export default {
key: "lusha-company-enrich",
name: "Enrich Companies",
description: "Enriches company information based on provided company IDs. [See the documentation](https://www.lusha.com/docs/#company-enrich)",
version: "0.0.2",
description: "Enriches company information based on provided company IDs. [See the documentation](https://docs.lusha.com/apis/openapi/company-search-and-enrich/enrichprospectingcompanies)",
version: "0.0.3",
type: "action",
props: {
lusha,
Expand All @@ -14,7 +14,7 @@ export default {
"requestId",
],
label: "Company Request ID",
description: "The request ID generated from the company search response.",
description: "The request ID generated from the company search response",
},
companiesIds: {
propDefinition: [
Expand Down
18 changes: 6 additions & 12 deletions components/lusha/actions/company-search/company-search.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import lusha from "../../lusha.app.mjs";
export default {
key: "lusha-company-search",
name: "Search Companies",
description: "Search for companies using various filters. [See the documentation](https://www.lusha.com/docs/#contactcompany-search)",
version: "0.0.1",
description: "Search for companies using various filters. [See the documentation](https://docs.lusha.com/apis/openapi/company-search-and-enrich/searchprospectingcompanies)",
version: "0.0.2",
type: "action",
props: {
lusha,
Expand All @@ -14,54 +14,48 @@ export default {
lusha,
"companyNames",
],
optional: true,
},
domains: {
propDefinition: [
lusha,
"domains",
],
optional: true,
},
locations: {
propDefinition: [
lusha,
"locations",
],
optional: true,
},
sizes: {
propDefinition: [
lusha,
"sizes",
],
optional: true,
},
revenues: {
propDefinition: [
lusha,
"revenues",
],
optional: true,
},
sicCodes: {
propDefinition: [
lusha,
"sicCodes",
],
optional: true,
},
naicsCodes: {
propDefinition: [
lusha,
"naicsCodes",
],
optional: true,
},
limit: {
type: "string",
label: "Limit",
description: "The maximum number of results to return. **This feature is used to avoid timeouts due to very long returns.**",
propDefinition: [
lusha,
"limit",
],
},
},
async run({ $ }) {
Expand Down
6 changes: 3 additions & 3 deletions components/lusha/actions/contact-enrich/contact-enrich.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import lusha from "../../lusha.app.mjs";
export default {
key: "lusha-contact-enrich",
name: "Enrich Contacts",
description: "Enriches contacts based on provided IDs. [See the documentation](https://www.lusha.com/docs/#contact-enrich)",
version: "0.0.1",
description: "Enriches contacts based on provided IDs. [See the documentation](https://docs.lusha.com/apis/openapi/contact-search-and-enrich/enrichprospectingcontacts)",
version: "0.0.2",
type: "action",
props: {
lusha,
Expand All @@ -14,7 +14,7 @@ export default {
"requestId",
],
label: "Contact Request ID",
description: "The request ID generated from the contact search response.",
description: "The request ID generated from the contact search response",
},
contactIds: {
propDefinition: [
Expand Down
14 changes: 10 additions & 4 deletions components/lusha/actions/contact-search/contact-search.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import lusha from "../../lusha.app.mjs";
export default {
key: "lusha-contact-search",
name: "Search Contacts",
description: "Search for contacts using various filters. [See the documentation](https://www.lusha.com/docs/#contactcompany-search)",
version: "0.0.1",
description: "Search for contacts using various filters. [See the documentation](https://docs.lusha.com/apis/openapi/contact-search-and-enrich/searchprospectingcontacts)",
version: "0.0.2",
type: "action",
props: {
lusha,
Expand All @@ -15,7 +15,7 @@ export default {
"contactNames",
],
label: "Contact Names",
description: "Names of contacts to search.",
description: "Names of contacts to search",
},
jobTitles: {
propDefinition: [
Expand Down Expand Up @@ -59,6 +59,12 @@ export default {
"location",
],
},
limit: {
propDefinition: [
lusha,
"limit",
],
},
},
async run({ $ }) {
const include = {};
Expand Down Expand Up @@ -93,6 +99,6 @@ export default {
}

$.export("$summary", `Found ${responseArray.length} contacts`);
return response;
return responseArray;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import lusha from "../../lusha.app.mjs";
import { parseObject } from "../../common/utils.mjs";

export default {
key: "lusha-search-and-enrich-companies",
name: "Search and Enrich Companies",
description: "Search for companies and enrich them. [See the documentation](https://docs.lusha.com/apis/openapi/company-search-and-enrich)",
version: "0.0.1",
type: "action",
props: {
lusha,
names: {
propDefinition: [
lusha,
"companyNames",
],
},
domains: {
propDefinition: [
lusha,
"domains",
],
},
locations: {
propDefinition: [
lusha,
"locations",
],
},
sizes: {
propDefinition: [
lusha,
"sizes",
],
},
revenues: {
propDefinition: [
lusha,
"revenues",
],
},
sicCodes: {
propDefinition: [
lusha,
"sicCodes",
],
},
naicsCodes: {
propDefinition: [
lusha,
"naicsCodes",
],
},
limit: {
propDefinition: [
lusha,
"limit",
],
},
},
async run({ $ }) {
const include = {};

if (this.names) include.names = parseObject(this.names);
if (this.domains) include.domains = parseObject(this.domains);
if (this.locations) include.locations = parseObject(this.locations);
if (this.sizes) include.sizes = parseObject(this.sizes);
if (this.revenues) include.revenues = parseObject(this.revenues);
if (this.sicCodes) include.sicCodes = parseObject(this.sicCodes);
if (this.naicsCodes) include.naicsCodes = parseObject(this.naicsCodes);

const companies = [];
let hasMore, count = 0, page = 0;

do {
const {
requestId, data = [],
} = await this.lusha.searchCompanies({
$,
params: {
pages: {
page,
size: 50,
},
},
data: {
filters: {
companies: {
include,
},
},
},
});
hasMore = data.length;
const companyIds = [];

for (const d of data) {
companyIds.push(d.id);
if (++count >= this.limit) {
hasMore = false;
break;
}
}

const enrichedCompanies = await this.lusha.enrichCompanies({
$,
data: {
requestId,
companyIds,
},
});

companies.push(...enrichedCompanies.companies);
page++;
} while (hasMore);

$.export("$summary", `Found and enriched ${companies.length} companies`);
return companies;
},
};
Loading
Loading