-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
New Components - lusha #14994
base: master
Are you sure you want to change the base?
New Components - lusha #14994
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis pull request introduces comprehensive updates to the Lusha component, adding new actions for company and contact search, enrichment, and related utilities. The changes include creating new modules for searching and enriching companies and contacts, removing legacy Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Actions - Contact Search - Company Search - Contact Enrich - Company Enrich
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: 9
🧹 Nitpick comments (1)
components/lusha/actions/company-search/company-search.mjs (1)
1-105
: Ensure consistency across search implementationsThe company-search and contact-search implementations should follow the same patterns for better maintainability. Consider extracting common functionality into a shared utility.
Create a new utility file
components/lusha/common/search.mjs
to share common search functionality:export const createSearchAction = ({ key, name, description, parseFilters, searchFn, }) => ({ key, name, description, version: "0.0.1", type: "action", props: { lusha, limit: { type: "string", label: "Limit", description: "The maximum number of results to return.", validate: (value) => { const num = parseInt(value, 10); if (isNaN(num) || num <= 0) { throw new Error("Limit must be a positive integer"); } return true; }, }, }, async run({ $ }) { try { const filters = parseFilters(this); const maxResults = parseInt(this.limit, 10); const response = this.lusha.paginate({ $, maxResults, fn: searchFn, data: filters, }); const responseArray = []; for await (const item of response) { if (responseArray.length >= maxResults) break; responseArray.push(item); } $.export("$summary", `Successfully retrieved ${responseArray.length} results`); return responseArray; } catch (error) { $.export("$summary", "Failed to search"); throw error; } }, });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
components/lusha/actions/company-enrich/company-enrich.mjs
(1 hunks)components/lusha/actions/company-search/company-search.mjs
(1 hunks)components/lusha/actions/contact-enrich/contact-enrich.mjs
(1 hunks)components/lusha/actions/contact-search/contact-search.mjs
(1 hunks)components/lusha/actions/find-company/find-company.mjs
(0 hunks)components/lusha/actions/find-contact/find-contact.mjs
(0 hunks)components/lusha/common/utils.mjs
(1 hunks)components/lusha/lusha.app.mjs
(1 hunks)components/lusha/package.json
(2 hunks)
💤 Files with no reviewable changes (2)
- components/lusha/actions/find-contact/find-contact.mjs
- components/lusha/actions/find-company/find-company.mjs
🔇 Additional comments (5)
components/lusha/lusha.app.mjs (1)
104-104
: Verify the HTTP header for API key
Ensure that the API key is passed in the headers according to the Lusha API requirements. Confirm whether the header should be "api_key"
or if it should be "Authorization"
with a specific format.
components/lusha/package.json (1)
17-17
: Verify compatibility with updated platform dependency
The @pipedream/platform
dependency has been updated from ^0.10.0
to ^3.0.3
. Ensure that your code is compatible with any changes or breaking changes introduced in the new major version.
components/lusha/common/utils.mjs (1)
1-24
: Implementation of parseObject
function looks good
The parseObject
function is well-written and handles various input types effectively, including arrays and strings with appropriate error handling.
components/lusha/actions/contact-enrich/contact-enrich.mjs (1)
1-37
: Overall implementation looks correct
The action for enriching contacts is implemented correctly, utilizing the enrichContacts
method and appropriate properties.
components/lusha/actions/company-enrich/company-enrich.mjs (1)
11-18
: Validate requestId format
Consider adding a validation pattern for the requestId to ensure it matches the expected format from company search responses.
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: 2
♻️ Duplicate comments (1)
components/lusha/actions/company-enrich/company-enrich.mjs (1)
26-36
: 🛠️ Refactor suggestionAdd error handling for the API call
The
run
method should include a try-catch block to handle potential API errors gracefully.async run({ $ }) { + try { const response = await this.lusha.enrichCompanies({ $, data: { requestId: this.requestId, companiesIds: this.companiesIds, }, }); $.export("$summary", `Successfully enriched ${this.companiesIds.length} companies`); return response; + } catch (error) { + $.export("$summary", "Failed to enrich companies"); + throw error; + } },
🧹 Nitpick comments (3)
components/lusha/lusha.app.mjs (3)
102-106
: Enhance API key securityThe current implementation exposes the API key in headers without additional security measures.
_headers() { return { - "api_key": `${this.$auth.api_key}`, + "Authorization": `Bearer ${this.$auth.api_key}`, + "Content-Type": "application/json", }; },
82-86
: Update requestId property descriptionThe property description should be generic as it's used for both contact and company enrichment.
requestId: { type: "string", - label: "Enrich Contact Request ID", - description: "The request ID generated from the contact search response.", + label: "Request ID", + description: "The request ID generated from the search response.", },
107-115
: Add request timeout and validationThe
_makeRequest
method should include timeout and basic validation._makeRequest({ $ = this, path, ...opts }) { + if (!path) { + throw new Error('Path is required for API requests'); + } return axios($, { url: `${this._baseUrl()}${path}`, headers: this._headers(), + timeout: 30000, // 30 seconds timeout + validateStatus: (status) => status >= 200 && status < 300, ...opts, }); },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
components/lusha/actions/company-enrich/company-enrich.mjs
(1 hunks)components/lusha/actions/contact-enrich/contact-enrich.mjs
(1 hunks)components/lusha/lusha.app.mjs
(1 hunks)
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!
Resolves #14992.
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Documentation
Chores