Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Sep 24, 2025

Resolves #15298

Summary by CodeRabbit

  • New Features

    • Added “Search and Enrich Companies” and “Search and Enrich Contacts” actions, returning enriched results up to a configurable limit.
    • Introduced a limit setting (default 50) across actions for controlled result sizes.
  • Improvements

    • Dynamic dropdown options for filters (e.g., sizes, revenues, industries, countries, departments, seniority).
    • Enhanced pagination for more reliable, paged fetching.
    • Company and contact search now return arrays of results for easier use.
    • Adjusted requiredness of several company search filters.
  • Documentation

    • Updated action descriptions to new Lusha docs URLs.
  • Chores

    • Bumped package and action versions; updated a dependency.

@vercel
Copy link

vercel bot commented Sep 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Sep 24, 2025 6:43pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Sep 24, 2025 6:43pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 24, 2025

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning In addition to the requested combined actions, this PR contains unrelated metadata and propDefinition updates in existing modules, extensive app-level changes, and a dependency bump that are not part of issue #15298’s objectives. Please limit the PR to the combined search-and-enrich actions or separate unrelated metadata, app-level, and dependency changes into distinct pull requests to keep scope focused.
Description Check ⚠️ Warning The pull request description only contains a reference to issue #15298 and lacks the required “## WHY” section from the repository template, so it fails to explain the motivation for these changes. The pull request description should include a complete “## WHY” section as per the template, explaining the rationale and context behind combining and updating the Lusha search and enrich actions.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title “Lusha - Enrich Contact or Company” refers to a real part of the changeset around enriching entities but is overly broad and omits the search enhancements introduced in this PR.
Linked Issues Check ✅ Passed The changes introduce the two required combined actions for searching and enriching contacts and companies as specified in issue #15298, satisfying the primary coding objectives by adding both Search and Enrich Contacts and Search and Enrich Companies modules.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-15298

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@michelle0927 michelle0927 marked this pull request as ready for review September 24, 2025 19:33
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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.length will 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

📥 Commits

Reviewing files that changed from the base of the PR and between 31e4b0a and fdced0c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is 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 returns id, not companyId Verified that the response objects use id and no companyId field 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 the page parameter is 0- or 1-based to prevent skipping or duplicating results.

Copy link
Collaborator

@GTFalcao GTFalcao left a 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!

@vunguyenhung vunguyenhung merged commit be6e7ea into master Sep 25, 2025
10 checks passed
@vunguyenhung vunguyenhung deleted the issue-15298 branch September 25, 2025 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lusha - Enrich Contact or Company

4 participants