- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
Lusha - Enrich Contact or Company #18453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
 | 
| Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
 ✅ Passed checks (3 passed)
 ✨ Finishing touches
 🧪 Generate unit tests
 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment  | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️  Outside diff range comments (1)
components/lusha/actions/company-enrich/company-enrich.mjs (1)
27-35: Fix payload/prop naming: use companyIds (not companiesIds).Inconsistent naming likely breaks the enrich request. The app exposes propDefinition "companyIds", but this action defines/uses "companiesIds". Align to companyIds everywhere.
Apply this diff:
- companiesIds: { + companyIds: { propDefinition: [ lusha, - "companyIds", + "companyIds", ], }, @@ - requestId: this.requestId, - companiesIds: this.companiesIds, + requestId: this.requestId, + companyIds: this.companyIds, }, }); - $.export("$summary", `Successfully enriched ${this.companiesIds.length} companies`); + $.export("$summary", `Successfully enriched ${this.companyIds.length} companies`);
🧹 Nitpick comments (8)
components/lusha/actions/contact-search/contact-search.mjs (1)
62-67: Return shape and limit: good; add error summary for parity.This now returns a materialized array and respects limit. Consider mirroring company-search’s error summary for consistency.
async run({ $ }) { - const include = {}; + try { + const include = {}; - if (this.names) include.names = parseObject(this.names); - if (this.jobTitles) include.jobTitles = parseObject(this.jobTitles); - if (this.jobTitlesExactMatch) - include.jobTitlesExactMatch = parseObject(this.jobTitlesExactMatch); - if (this.countries) include.countries = parseObject(this.countries); - if (this.seniority) include.seniority = parseObject(this.seniority); - if (this.departments) include.departments = parseObject(this.departments); - if (this.existingDataPoints) include.existingDataPoints = parseObject(this.existingDataPoints); - if (this.location) include.location = parseObject(this.location); + if (this.names) include.names = parseObject(this.names); + if (this.jobTitles) include.jobTitles = parseObject(this.jobTitles); + if (this.jobTitlesExactMatch) include.jobTitlesExactMatch = parseObject(this.jobTitlesExactMatch); + if (this.countries) include.countries = parseObject(this.countries); + if (this.seniority) include.seniority = parseObject(this.seniority); + if (this.departments) include.departments = parseObject(this.departments); + if (this.existingDataPoints) include.existingDataPoints = parseObject(this.existingDataPoints); + if (this.location) include.location = parseObject(this.location); - const response = this.lusha.paginate({ - $, - maxResults: this.limit, - fn: this.lusha.searchContacts, - data: { - filters: { - contacts: { - include, - }, - }, - }, - }); + const response = this.lusha.paginate({ + $, + maxResults: this.limit, + fn: this.lusha.searchContacts, + data: { + filters: { + contacts: { include }, + }, + }, + }); - const responseArray = []; + const responseArray = []; - for await (const item of response) { - responseArray.push(item); - } + for await (const item of response) responseArray.push(item); - $.export("$summary", `Found ${responseArray.length} contacts`); - return responseArray; + $.export("$summary", `Found ${responseArray.length} contacts`); + return responseArray; + } catch (error) { + $.export("$summary", "Failed to search contacts"); + throw error; + } },Also applies to: 101-103
components/lusha/lusha.app.mjs (5)
30-33: Improve option labels for sizes.Returning raw JSON strings degrades UX. Provide labels with human-readable text.
- async options() { - const sizes = await this.listSizes(); - return sizes.map((size) => JSON.stringify(size)); - }, + async options() { + const sizes = await this.listSizes(); + return sizes.map((s) => ({ + value: JSON.stringify(s), + label: s.label ?? s.name ?? JSON.stringify(s), + })); + },
40-43: Improve option labels for revenues.Same as sizes: surface readable labels.
- async options() { - const revenues = await this.listRevenues(); - return revenues.map((revenue) => JSON.stringify(revenue)); - }, + async options() { + const revenues = await this.listRevenues(); + return revenues.map((r) => ({ + value: JSON.stringify(r), + label: r.label ?? r.name ?? JSON.stringify(r), + })); + },
114-121: Typo: rename senorities -> seniorities.Minor readability nit.
- const senorities = await this.listSeniorities(); - return senorities.map(({ + const seniorities = await this.listSeniorities(); + return seniorities.map(({ id: value, name: label, }) => ({ value, label, }));
162-167: Guard limit input with min.Avoid zero/negative limits.
limit: { type: "integer", label: "Limit", description: "The maximum number of results to return. **This feature is used to avoid timeouts due to very long returns.**", - default: 50, + default: 50, + min: 1, },
268-289: Clarify pagination loop condition and early-exit.Make hasMore explicitly boolean to avoid relying on numeric truthiness.
- let hasMore = false; + let hasMore = false; @@ - hasMore = data.length; + hasMore = data && Array.isArray(data) && data.length > 0; - } while (hasMore); + } while (hasMore);components/lusha/actions/search-and-enrich-contacts/search-and-enrich-contacts.mjs (1)
93-95: Tighten pagination and avoid an extra trailing request.Using
hasMore = data.lengthwill always trigger one extra empty-page request. Base continuation on the page size.- size: 50, + size: PAGE_SIZE,- hasMore = data.length; + hasMore = data.length === PAGE_SIZE;Also applies to: 105-106
components/lusha/actions/search-and-enrich-companies/search-and-enrich-companies.mjs (1)
81-84: Use page size constant and avoid extra empty page request.- size: 50, + size: PAGE_SIZE,- hasMore = data.length; + hasMore = data.length === PAGE_SIZE;Also applies to: 94-95
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
- pnpm-lock.yamlis excluded by- !**/pnpm-lock.yaml
📒 Files selected for processing (8)
- components/lusha/actions/company-enrich/company-enrich.mjs(2 hunks)
- components/lusha/actions/company-search/company-search.mjs(2 hunks)
- components/lusha/actions/contact-enrich/contact-enrich.mjs(2 hunks)
- components/lusha/actions/contact-search/contact-search.mjs(4 hunks)
- components/lusha/actions/search-and-enrich-companies/search-and-enrich-companies.mjs(1 hunks)
- components/lusha/actions/search-and-enrich-contacts/search-and-enrich-contacts.mjs(1 hunks)
- components/lusha/lusha.app.mjs(2 hunks)
- components/lusha/package.json(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
components/lusha/actions/search-and-enrich-contacts/search-and-enrich-contacts.mjs (4)
components/lusha/actions/company-search/company-search.mjs (1)
include(63-63)components/lusha/actions/contact-search/contact-search.mjs (1)
include(70-70)components/lusha/actions/search-and-enrich-companies/search-and-enrich-companies.mjs (2)
include(62-62)
hasMore(73-73)components/lusha/lusha.app.mjs (3)
hasMore(266-266)
count(267-267)
page(268-268)
components/lusha/actions/search-and-enrich-companies/search-and-enrich-companies.mjs (4)
components/lusha/actions/company-search/company-search.mjs (1)
include(63-63)components/lusha/actions/contact-search/contact-search.mjs (1)
include(70-70)components/lusha/actions/search-and-enrich-contacts/search-and-enrich-contacts.mjs (2)
include(70-70)
hasMore(83-83)components/lusha/lusha.app.mjs (3)
hasMore(266-266)
count(267-267)
page(268-268)
components/lusha/actions/contact-search/contact-search.mjs (1)
components/lusha/actions/company-search/company-search.mjs (1)
responseArray(86-86)
components/lusha/lusha.app.mjs (2)
components/lusha/actions/search-and-enrich-companies/search-and-enrich-companies.mjs (1)
hasMore(73-73)components/lusha/actions/search-and-enrich-contacts/search-and-enrich-contacts.mjs (1)
hasMore(83-83)
🔇 Additional comments (8)
components/lusha/package.json (1)
3-3: Version bump and platform dependency: sanity check.Looks good; ensure all actions remain compatible with @pipedream/platform ^3.1.0 (esp. async options usage).
If useful, run repo-wide checks to spot breaking imports or deprecated APIs referring to older platform versions.
Also applies to: 17-17
components/lusha/actions/contact-enrich/contact-enrich.mjs (1)
6-8: LGTM: metadata updates.Updated description URL and version; prop description tweak is fine. No functional changes.
Also applies to: 17-17
components/lusha/actions/company-search/company-search.mjs (2)
7-9: LGTM: metadata updates.Docs URL and version bump look consistent with the suite.
55-59: Adopted shared limit prop.Good move to use the app’s limit propDefinition; aligns with paginate(maxResults).
components/lusha/actions/search-and-enrich-companies/search-and-enrich-companies.mjs (2)
7-7: Link is correct: the URL https://docs.lusha.com/apis/openapi/company-search-and-enrich matches the official “Company Search & Enrich” documentation.
97-99: searchCompanies returnsid, notcompanyIdVerified that the response objects useidand nocompanyIdfield is present; no changes needed.components/lusha/actions/search-and-enrich-contacts/search-and-enrich-contacts.mjs (2)
7-7: Documentation link is correct — the URL matches the official Lusha “Contact Search & Enrich” docs.
91-94: Confirm Lusha pagination indexing (0 vs 1-based). Verify in Lusha’s API docs whether thepageparameter is 0- or 1-based to prevent skipping or duplicating results.
        
          
                components/lusha/actions/search-and-enrich-companies/search-and-enrich-companies.mjs
          
            Show resolved
            Hide resolved
        
              
          
                components/lusha/actions/search-and-enrich-companies/search-and-enrich-companies.mjs
          
            Show resolved
            Hide resolved
        
              
          
                components/lusha/actions/search-and-enrich-contacts/search-and-enrich-contacts.mjs
          
            Show resolved
            Hide resolved
        
              
          
                components/lusha/actions/search-and-enrich-contacts/search-and-enrich-contacts.mjs
          
            Show resolved
            Hide resolved
        
              
          
                components/lusha/actions/search-and-enrich-contacts/search-and-enrich-contacts.mjs
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice improvements on top of the new additions too!
Resolves #15298
Summary by CodeRabbit
New Features
Improvements
Documentation
Chores