Skip to content

[Components] predictleads #17228

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

Merged
merged 1 commit into from
Jun 23, 2025
Merged

[Components] predictleads #17228

merged 1 commit into from
Jun 23, 2025

Conversation

jcortes
Copy link
Collaborator

@jcortes jcortes commented Jun 20, 2025

WHY

Resolves #17022

Summary by CodeRabbit

  • New Features

    • Added actions to retrieve technologies, look up companies by domain, retrieve companies by technology, and fetch news events by domain.
    • Introduced event sources for detecting new financing events, job openings, news events, and technologies related to companies.
    • Enabled filtering and polling for new events with customizable options.
    • Provided sample event data for easier testing and integration.
  • Chores

    • Updated package metadata and dependencies for improved reliability and compatibility.

@jcortes jcortes self-assigned this Jun 20, 2025
Copy link

vercel bot commented Jun 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Jun 20, 2025 8:31pm
pipedream-docs ⬜️ Ignored (Inspect) Jun 20, 2025 8:31pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jun 20, 2025 8:31pm

Copy link
Contributor

coderabbitai bot commented Jun 20, 2025

Walkthrough

This update introduces a new integration for PredictLeads, implementing both actions and event sources. It adds API client logic, actions for company and technology data retrieval, and polling-based sources for job openings, news events, technology detections, and financing events, each with sample event data and configuration options.

Changes

Files / Group Change Summary
components/predictleads/predictleads.app.mjs Implements PredictLeads app integration with API client, prop definitions, and multiple resource retrieval and pagination methods.
components/predictleads/package.json Updates package version, adds dependency on @pipedream/platform, and fixes JSON structure.
components/predictleads/actions/get-technologies/..., lookup-company/..., retrieve-companies-by-technology/..., retrieve-news-events-by-domain/... Adds actions for retrieving technologies, looking up companies by domain, retrieving companies by technology, and retrieving news events by domain.
components/predictleads/sources/common/polling.mjs Introduces a reusable polling source with state management and resource processing logic for event triggers.
components/predictleads/sources/new-financing-event/..., new-job-opening/..., new-news-event/..., new-technology-detected/... Adds source components for new financing events, job openings, news events, and technology detections, each extending the polling logic and providing event metadata and configuration.
components/predictleads/sources/new-financing-event/test-event.mjs, new-job-opening/test-event.mjs, new-news-event/test-event.mjs, new-technology-detected/test-event.mjs Adds sample event data files for each new source component, representing realistic API responses for testing and demonstration.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Action/Source
    participant PredictLeadsApp
    participant PredictLeadsAPI

    User->>Action/Source: Trigger action/source with input
    Action/Source->>PredictLeadsApp: Call method (e.g., retrieveCompany, retrieveTechnologies)
    PredictLeadsApp->>PredictLeadsAPI: Make HTTP request with params
    PredictLeadsAPI-->>PredictLeadsApp: Respond with data
    PredictLeadsApp-->>Action/Source: Return processed data
    Action/Source-->>User: Emit event or return result
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement PredictLeads integration with actions for company, technology, and event data (#17022)
Provide polling-based sources for new job openings, news events, technology detections, financing events (#17022)
Include sample event data for each source (#17022)
Use proper API authentication and pagination as per PredictLeads documentation (#17022)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Suggested labels

action, trigger / source

Poem

In the warren of code, a new lead appears,
PredictLeads hops in, dispelling all fears.
With actions and sources, events now abound,
Technologies, jobs, and news to be found.
So let’s thump our feet and wiggle our nose—
This rabbit’s delighted with how the code grows! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/predictleads/actions/lookup-company/lookup-company.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:201:49)

components/predictleads/actions/get-technologies/get-technologies.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:201:49)

components/predictleads/actions/retrieve-news-events-by-domain/retrieve-news-events-by-domain.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:201:49)

  • 11 others
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

🧹 Nitpick comments (6)
components/predictleads/actions/retrieve-companies-by-technology/retrieve-companies-by-technology.mjs (1)

18-29: Consider adding error handling for robustness.

The action should handle potential API errors gracefully to provide better user experience.

  async run({ $ }) {
    const {
      app,
      technologyId,
    } = this;
-   const response = await app.retrieveCompaniesByTechnology({
-     $,
-     technologyId,
-   });
-   $.export("$summary", "Successfully retrieved the first page of companies.");
-   return response;
+   try {
+     const response = await app.retrieveCompaniesByTechnology({
+       $,
+       technologyId,
+     });
+     $.export("$summary", "Successfully retrieved the first page of companies.");
+     return response;
+   } catch (error) {
+     throw new Error(`Failed to retrieve companies: ${error.message}`);
+   }
  },
components/predictleads/actions/get-technologies/get-technologies.mjs (1)

19-19: Fix misleading summary message.

The summary mentions "first page" but there's no pagination implementation, which could confuse users.

-    $.export("$summary", "Successfully retrieved the first page of technologies.");
+    $.export("$summary", `Successfully retrieved ${response.data?.length || 0} technologies.`);
components/predictleads/actions/retrieve-news-events-by-domain/retrieve-news-events-by-domain.mjs (1)

28-28: Fix misleading summary message.

Similar to the previous action, the summary mentions "first page" without pagination implementation.

-    $.export("$summary", "Successfully retrieved the first page of news events.");
+    $.export("$summary", `Successfully retrieved news events for domain \`${domain}\`.`);
components/predictleads/sources/new-news-event/new-news-event.mjs (1)

26-56: Consider extracting categories to a constant.

The categories array could be defined as a constant at the module level for better maintainability and potential reuse.

Extract the categories to a constant:

+const NEWS_EVENT_CATEGORIES = [
+  "acquires",
+  "merges_with",
+  "sells_assets_to",
+  // ... rest of categories
+];
+
 export default {
   ...common,
   // ...
   props: {
     ...common.props,
     // ...
     categories: {
       type: "string[]",
       label: "Categories",
       description: "Filter news events by specific categories.",
       optional: true,
-      options: [
-        "acquires",
-        "merges_with",
-        // ... all categories
-      ],
+      options: NEWS_EVENT_CATEGORIES,
     },
   },
components/predictleads/predictleads.app.mjs (1)

44-52: Consider adding error handling for API requests.

The _makeRequest method could benefit from error handling to provide better error messages and debugging information.

Add error handling wrapper:

 _makeRequest({
   $ = this, path, headers, ...args
 }) {
-  return axios($, {
-    url: this.getUrl(path),
-    headers: this.getHeaders(headers),
-    ...args,
-  });
+  return axios($, {
+    url: this.getUrl(path),
+    headers: this.getHeaders(headers),
+    ...args,
+  }).catch((error) => {
+    console.error(`PredictLeads API error on ${path}:`, error.response?.data || error.message);
+    throw error;
+  });
 },
components/predictleads/sources/common/polling.mjs (1)

47-52: Consider more descriptive error messages.

The ConfigurationError messages could be more specific about which component failed to implement the required methods.

Enhance error messages:

 generateMeta() {
-  throw new ConfigurationError("The 'generateMeta' method must be implemented.");
+  throw new ConfigurationError(`The 'generateMeta' method must be implemented by ${this.key || 'the source component'}.`);
 },
 getResourcesFn() {
-  throw new ConfigurationError("The 'getResourcesFn' method must be implemented.");
+  throw new ConfigurationError(`The 'getResourcesFn' method must be implemented by ${this.key || 'the source component'}.`);
 },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 869ac40 and 9bd9fe3.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (15)
  • components/predictleads/actions/get-technologies/get-technologies.mjs (1 hunks)
  • components/predictleads/actions/lookup-company/lookup-company.mjs (1 hunks)
  • components/predictleads/actions/retrieve-companies-by-technology/retrieve-companies-by-technology.mjs (1 hunks)
  • components/predictleads/actions/retrieve-news-events-by-domain/retrieve-news-events-by-domain.mjs (1 hunks)
  • components/predictleads/package.json (2 hunks)
  • components/predictleads/predictleads.app.mjs (1 hunks)
  • components/predictleads/sources/common/polling.mjs (1 hunks)
  • components/predictleads/sources/new-financing-event/new-financing-event.mjs (1 hunks)
  • components/predictleads/sources/new-financing-event/test-event.mjs (1 hunks)
  • components/predictleads/sources/new-job-opening/new-job-opening.mjs (1 hunks)
  • components/predictleads/sources/new-job-opening/test-event.mjs (1 hunks)
  • components/predictleads/sources/new-news-event/new-news-event.mjs (1 hunks)
  • components/predictleads/sources/new-news-event/test-event.mjs (1 hunks)
  • components/predictleads/sources/new-technology-detected/new-technology-detected.mjs (1 hunks)
  • components/predictleads/sources/new-technology-detected/test-event.mjs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
🔇 Additional comments (18)
components/predictleads/sources/new-news-event/test-event.mjs (1)

1-55: Well-structured test fixture with comprehensive field coverage.

The test event structure follows JSON API specification patterns and includes realistic data. The presence of null values and empty arrays for unused fields is appropriate for a test fixture, as it demonstrates the complete API response schema.

components/predictleads/package.json (2)

3-3: Appropriate version bump for new functionality.

The version bump from 0.0.1 to 0.1.0 correctly reflects the addition of new integration features.


15-16: Verify the @pipedream/platform dependency version.

Ensure that version ^3.1.0 of @pipedream/platform exists and is secure.

What is the latest version of @pipedream/platform npm package and are there any known security vulnerabilities?
components/predictleads/sources/new-technology-detected/test-event.mjs (1)

1-45: Comprehensive and realistic test fixture for technology detection events.

The test event structure appropriately represents a technology detection with relevant attributes like confidence score (0.85), detection timestamps, and firewall status. The relationships structure correctly demonstrates multiple job openings while showing empty arrays for unused relationship types.

components/predictleads/sources/new-financing-event/test-event.mjs (1)

1-30: Excellent dual representation of financial data.

The test fixture correctly demonstrates best practices for financial APIs by providing both human-readable ("$14 million") and normalized (14000000) amount values. The structure and realistic data make this a solid test fixture.

components/predictleads/actions/retrieve-companies-by-technology/retrieve-companies-by-technology.mjs (2)

1-30: Well-structured action following Pipedream conventions.

The action correctly uses propDefinition for dynamic property loading and follows the standard Pipedream action pattern with appropriate key, name, description, and version fields.


6-6: Verify the documentation URL accuracy.

Ensure the documentation URL correctly points to the relevant API endpoint documentation.

Is this PredictLeads API documentation URL valid: https://docs.predictleads.com/v3/api_endpoints/technologies_dataset/retrieve_a_single_technology_by_id
components/predictleads/actions/retrieve-news-events-by-domain/retrieve-news-events-by-domain.mjs (1)

11-17: Good use of propDefinition pattern.

The domain prop correctly uses the app's propDefinition, promoting consistency across components.

components/predictleads/sources/new-job-opening/test-event.mjs (1)

1-66: Comprehensive and realistic test event data.

The test event data is well-structured with realistic job opening attributes, proper markdown formatting in the description, complete salary and location data, and appropriate relationship links. This provides good coverage for testing the job opening source component.

components/predictleads/actions/lookup-company/lookup-company.mjs (1)

24-33: Good conditional logic for user feedback.

The conditional logic provides clear feedback to users about whether a company was found, enhancing the user experience.

components/predictleads/sources/new-job-opening/new-job-opening.mjs (4)

1-11: Well-structured polling source component.

The component properly extends the common polling pattern and follows Pipedream conventions with appropriate metadata and deduplication settings.


39-73: Comprehensive filtering options with good UX.

The extensive list of job categories and boolean filtering options (activeOnly, withDescriptionOnly, withLocationOnly) provide users with fine-grained control over the data they receive.


97-97: Good defensive programming with optional chaining.

The use of categories?.join(",") properly handles the case where categories might be undefined, preventing runtime errors.


101-107: Proper metadata generation for event deduplication.

The metadata generation correctly uses the resource ID for uniqueness, creates a descriptive summary, and properly parses the timestamp from the first_seen_at field.

components/predictleads/sources/new-news-event/new-news-event.mjs (1)

78-84: LGTM! Proper timestamp parsing implementation.

The generateMeta method correctly parses the found_at timestamp from the resource attributes, ensuring accurate event timing.

components/predictleads/sources/new-technology-detected/new-technology-detected.mjs (1)

22-42: LGTM! Clean and consistent implementation.

The source component properly extends the common polling module with appropriate method overrides. The timestamp parsing in generateMeta correctly uses the first_seen_at field.

components/predictleads/predictleads.app.mjs (1)

142-145: ```shell
#!/bin/bash

Show the pagination block including the boundary check in getIterations

sed -n '130,170p' components/predictleads/predictleads.app.mjs


</details>
<details>
<summary>components/predictleads/sources/common/polling.mjs (1)</summary>

`62-113`: **LGTM! Well-designed polling implementation.**

The polling logic properly manages state, handles first-run scenarios with resource limiting, and maintains correct chronological order by sorting descending then reversing for emission. The abstraction allows for clean extension by specific source components.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Copy link
Collaborator

@michelle0927 michelle0927 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jcortes jcortes merged commit 1c39758 into master Jun 23, 2025
11 checks passed
@jcortes jcortes deleted the predictleads-new-components branch June 23, 2025 14:50
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.

[Components] predictleads
2 participants