Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Jun 20, 2025

Resolves #5786

Actions Implemented

  • Scrape URL
  • Scrape with Query
  • Create Proxy Session
  • Create Schedule

Sources Implemented

  • New Scheduled Run Completed

Skipped

  • Fetch Data (action) - I think this is the same as web scraping via URL or query?
  • Close Proxy Session (action) - Proxy sessions are given an expiration date that determines when they close
  • Proxy Request Completed (source) - I couldn't find an endpoint for this in the docs
  • Data Fetch Recieved (source) - I couldn't find an endpoint for this in the docs

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Introduced integration with Oxylabs, enabling users to create proxy sessions, scrape URLs, perform query-based scraping, and schedule scraping jobs.
    • Added a source to detect when a scheduled run is completed and emit events accordingly.
  • Improvements
    • Provided selectable options for sources and query types for scraping actions.
    • Added utility functions for parsing input and constants for source options.
  • Chores
    • Updated package metadata and dependencies.
    • Removed obsolete files and configuration.

@vercel
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) Visit Preview Jun 23, 2025 3:12pm
pipedream-docs ⬜️ Ignored (Inspect) Jun 23, 2025 3:12pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jun 23, 2025 3:12pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 20, 2025

Walkthrough

Several new modules and actions were added to the Oxylabs integration, including actions for scraping URLs and queries, creating proxy sessions, and scheduling jobs. A new source for detecting completed scheduled runs was introduced. Utility and constants modules were added, and the main app implementation was migrated from TypeScript to JavaScript. The .gitignore and old app definition files were removed.

Changes

File(s) Change Summary
components/oxylabs/.gitignore Deleted .gitignore—JS, MJS, and dist directory are no longer ignored.
components/oxylabs/app/oxylabs.app.ts Removed old TypeScript app definition and authKeys method.
components/oxylabs/oxylabs.app.mjs Added new Oxylabs app component in JavaScript with API methods and property definitions.
components/oxylabs/package.json Updated version, entry point, dependencies, and removed dist from files.
components/oxylabs/common/constants.mjs Added constants for URL and query sources, exported as default.
components/oxylabs/common/utils.mjs Added parseObject utility function for parsing strings/objects recursively.
components/oxylabs/actions/create-proxy-session/create-proxy-session.mjs New action: creates proxy sessions with validation and dynamic proxy URL construction.
components/oxylabs/actions/create-schedule/create-schedule.mjs New action: creates schedules for scraping jobs using cron expressions and job parameters.
components/oxylabs/actions/scrape-url/scrape-url.mjs New action: scrapes a URL using the Oxylabs API with geo-location support.
components/oxylabs/actions/scrape-with-query/scrape-with-query.mjs New action: scrapes data using a search query and source selection.
components/oxylabs/sources/new-scheduled-run-completed/new-scheduled-run-completed.mjs New source: emits events when scheduled runs are completed, with deduplication and polling.
components/oxylabs/sources/new-scheduled-run-completed/test-event.mjs New test event fixture for scheduled run completion events.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Action (Scrape URL)
    participant Oxylabs App
    participant Oxylabs API

    User->>Action (Scrape URL): Provide URL, source, geoLocation
    Action (Scrape URL)->>Oxylabs App: scrape({ url, source, geoLocation })
    Oxylabs App->>Oxylabs API: POST /queries with params
    Oxylabs API-->>Oxylabs App: Scrape response
    Oxylabs App-->>Action (Scrape URL): Return response
    Action (Scrape URL)-->>User: Return scrape result
Loading
sequenceDiagram
    participant User
    participant Action (Create Schedule)
    participant Oxylabs App
    participant Oxylabs API

    User->>Action (Create Schedule): Provide cron, items, endTime
    Action (Create Schedule)->>Oxylabs App: createSchedule({ cron, items, endTime })
    Oxylabs App->>Oxylabs API: POST /schedules with schedule data
    Oxylabs API-->>Oxylabs App: Schedule creation response
    Oxylabs App-->>Action (Create Schedule): Return response
    Action (Create Schedule)-->>User: Return schedule info
Loading
sequenceDiagram
    participant Source (New Scheduled Run Completed)
    participant Oxylabs App
    participant Oxylabs API
    participant Event Stream

    Source (New Scheduled Run Completed)->>Oxylabs App: getRunsInfo({ scheduleId })
    Oxylabs App->>Oxylabs API: GET /schedules/{scheduleId}/runs
    Oxylabs API-->>Oxylabs App: List of runs
    Oxylabs App-->>Source (New Scheduled Run Completed): Return runs
    Source (New Scheduled Run Completed)->>Event Stream: Emit new run events
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement Oxylabs app integration with API methods for proxy sessions and scraping (#5786)
Add action to create proxy sessions using Residential or Datacenter Proxy endpoint (#5786)
Add actions for data fetching via scraping (scrape URL and scrape with query) (#5786)
Add source to detect proxy request completion or data fetch events (#5786) No explicit trigger for "Proxy Request Completed" or "Data Fetch Received" events found; only scheduled run completion source added.
Remove old app definition and migrate to new app implementation (#5786)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Addition of test event fixture for scheduled run completion (components/oxylabs/sources/new-scheduled-run-completed/test-event.mjs) Not explicitly required by linked issue objectives; serves as a test utility rather than core functionality.

Poem

🐇
New actions hop in, with scraping delight,
Schedules and queries now run through the night.
Proxy sessions burrow, utilities bloom,
Constants and sources—so much more room!
The old code is gone, the new code is bright—
Oxylabs rabbits, ready to byte!

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/oxylabs/oxylabs.app.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)


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 811b967 and d8fc39e.

📒 Files selected for processing (1)
  • components/oxylabs/oxylabs.app.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/oxylabs/oxylabs.app.mjs
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
✨ 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.

@michelle0927 michelle0927 marked this pull request as ready for review June 20, 2025 17:27
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: 4

🧹 Nitpick comments (5)
components/oxylabs/actions/create-schedule/create-schedule.mjs (1)

12-12: Fix typo: "chron" should be "cron".

The property name contains a typo that could cause confusion since it references cron expressions.

Apply this diff to fix the typo:

-    chron: {
+    cron: {
-        cron: this.chron,
+        cron: this.cron,

Also applies to: 36-36

components/oxylabs/sources/new-scheduled-run-completed/new-scheduled-run-completed.mjs (1)

28-34: Consider using run timestamp instead of current time.

Using Date.now() for the timestamp means all events will have nearly identical timestamps. If the run data includes an actual completion timestamp, that would be more meaningful for event ordering and debugging.

generateMeta(run) {
  return {
    id: run.id,
    summary: `New Run with ID: ${run.id}`,
-   ts: Date.now(),
+   ts: run.completed_at ? new Date(run.completed_at).getTime() : Date.now(),
  };
},
components/oxylabs/actions/create-proxy-session/create-proxy-session.mjs (1)

67-77: Refactor proxy URL construction for better readability.

The current proxy URL construction is difficult to read and maintain. Consider breaking it down into smaller, more readable parts.

- const proxyUrl = `http://customer-${username}${cc
-   ? `-cc-${cc}`
-   : ""}${city
-   ? `-city-${city}`
-   : ""}${st
-   ? `-st-${st}`
-   : ""}${sessid
-   ? `-sessid-${sessid}`
-   : ""}${sstime
-   ? `-sstime-${sstime}`
-   : ""}:${password}@pr.oxylabs.io:7777`;
+ const urlParts = [`customer-${username}`];
+ if (cc) urlParts.push(`cc-${cc}`);
+ if (city) urlParts.push(`city-${city}`);
+ if (st) urlParts.push(`st-${st}`);
+ if (sessid) urlParts.push(`sessid-${sessid}`);
+ if (sstime) urlParts.push(`sstime-${sstime}`);
+ 
+ const proxyUrl = `http://${urlParts.join('-')}:${password}@pr.oxylabs.io:7777`;
components/oxylabs/oxylabs.app.mjs (2)

20-20: Fix typo in description.

There's a typo in the geoLocation description.

- description: "The geo locatio to scrape from. E.g. `United States`",
+ description: "The geo location to scrape from. E.g. `United States`",

56-65: Consider adding error handling for proxy connection failures.

The createSession method creates an HTTPS proxy agent but doesn't handle potential proxy connection failures. This could result in unclear error messages for users.

async createSession({
  $ = this, proxyUrl, ...opts
}) {
+ try {
    const agent = new HttpsProxyAgent(proxyUrl);
    return axios($, {
      url: "https://ip.oxylabs.io/location",
      httpsAgent: agent,
      ...opts,
    });
+ } catch (error) {
+   throw new Error(`Failed to create proxy session: ${error.message}`);
+ }
},
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f35c20d and 186281f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (12)
  • components/oxylabs/.gitignore (0 hunks)
  • components/oxylabs/actions/create-proxy-session/create-proxy-session.mjs (1 hunks)
  • components/oxylabs/actions/create-schedule/create-schedule.mjs (1 hunks)
  • components/oxylabs/actions/scrape-url/scrape-url.mjs (1 hunks)
  • components/oxylabs/actions/scrape-with-query/scrape-with-query.mjs (1 hunks)
  • components/oxylabs/app/oxylabs.app.ts (0 hunks)
  • components/oxylabs/common/constants.mjs (1 hunks)
  • components/oxylabs/common/utils.mjs (1 hunks)
  • components/oxylabs/oxylabs.app.mjs (1 hunks)
  • components/oxylabs/package.json (1 hunks)
  • components/oxylabs/sources/new-scheduled-run-completed/new-scheduled-run-completed.mjs (1 hunks)
  • components/oxylabs/sources/new-scheduled-run-completed/test-event.mjs (1 hunks)
💤 Files with no reviewable changes (2)
  • components/oxylabs/.gitignore
  • components/oxylabs/app/oxylabs.app.ts
🧰 Additional context used
🪛 Biome (1.9.4)
components/oxylabs/sources/new-scheduled-run-completed/test-event.mjs

[error] 5-5: This number literal will lose precision at runtime.

The value at runtime will be 7300439540206948000

(lint/correctness/noPrecisionLoss)


[error] 12-12: This number literal will lose precision at runtime.

The value at runtime will be 7300439540169188000

(lint/correctness/noPrecisionLoss)


[error] 19-19: This number literal will lose precision at runtime.

The value at runtime will be 7300439540198552000

(lint/correctness/noPrecisionLoss)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (6)
components/oxylabs/common/utils.mjs (1)

1-25: LGTM! Clean recursive parsing utility.

The parseObject function is well-implemented with proper error handling for JSON parsing and recursive processing of nested structures. The logic correctly handles all major data types.

components/oxylabs/common/constants.mjs (1)

1-37: LGTM! Well-organized constants for Oxylabs sources.

The constant definitions are comprehensive and well-structured. The separation between URL_SOURCES and QUERY_SOURCES provides clear categorization for different scraping use cases.

components/oxylabs/package.json (1)

3-3: LGTM! Package configuration properly updated for the migration.

The version bump, main entry point change, and new dependencies appropriately reflect the migration from TypeScript to JavaScript and the addition of new functionality.

Also applies to: 5-5, 15-18

components/oxylabs/actions/create-schedule/create-schedule.mjs (1)

4-44: LGTM! Well-structured Pipedream action component.

The action follows Pipedream conventions properly with clear property definitions, good documentation links, and appropriate use of the parseObject utility for input processing.

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

12-15: ```shell
#!/bin/bash

Inspect the implementation of listSchedules in the Oxylabs component

rg -n "listSchedules" -C 5 components/oxylabs/oxylabs.app.mjs


</details>
<details>
<summary>components/oxylabs/actions/scrape-with-query/scrape-with-query.mjs (1)</summary>

`4-42`: **Clean implementation following good patterns.**

The action is well-structured with proper use of constants for source options, clear prop definitions, and appropriate API integration. The implementation follows Pipedream action conventions effectively.

</details>

</blockquote></details>

</details>

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

@michelle0927 michelle0927 linked an issue Jun 20, 2025 that may be closed by this pull request
@michelle0927 michelle0927 linked an issue Jun 20, 2025 that may be closed by this pull request
jcortes
jcortes previously approved these changes Jun 20, 2025
Copy link
Collaborator

@jcortes jcortes left a comment

Choose a reason for hiding this comment

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

@michelle0927 lgtm! Ready for QA!

@michelle0927
Copy link
Collaborator Author

/approve

@michelle0927 michelle0927 merged commit 884ec80 into master Jun 24, 2025
11 checks passed
@michelle0927 michelle0927 deleted the issue-5786 branch June 24, 2025 14:28
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] Oxylabs

3 participants