Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Apr 8, 2025

Resolves #16116

Summary by CodeRabbit

  • New Features

    • Introduced actions for retrieving dataset items and executing tasks synchronously.
    • Enhanced data integration with additional configuration options to streamline dataset interactions.
  • Chores

    • Updated module versions and platform dependencies to ensure improved performance and compatibility.

@vercel
Copy link

vercel bot commented Apr 8, 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) Apr 8, 2025 9:08pm
pipedream-docs ⬜️ Ignored (Inspect) Apr 8, 2025 9:08pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Apr 8, 2025 9:08pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 8, 2025

Walkthrough

This pull request introduces new Apify actions and updates existing ones. It adds two new modules: one for retrieving dataset items ("Get Dataset Items") and another for running tasks synchronously ("Run Task Synchronously"). Additionally, the Apify app file is enhanced with new dataset-related properties and helper methods. Several existing modules have their version numbers bumped, and the package version and dependency for @pipedream/platform are updated. These changes support more seamless integration with the Apify API and improve dataset handling capabilities.

Changes

File(s) Change Summary
components/apify/actions/get-dataset-items/…/get-dataset-items.mjs New action "Get Dataset Items" that retrieves dataset items using Apify API with pagination and optional filters.
components/apify/actions/run-task-synchronously/…/run-task-synchronously.mjs New module for running Apify tasks synchronously with configurable parameters.
components/apify/actions/run-actor.mjs, components/apify/actions/scrape-single-url/…/scrape-single-url.mjs, components/apify/actions/set-key-value-store-record/…/set-key-value-store-record.mjs, components/apify/sources/new-finished-actor-run-instant/…/new-finished-actor-run-instant.mjs, components/apify/sources/new-finished-task-run-instant/…/new-finished-task-run-instant.mjs Version bumps from "0.0.1" to "0.0.2" with no other functional changes.
components/apify/apify.app.mjs Added new properties (datasetId, clean, fields, omit, flatten, maxResults) in prop definitions and new methods (listDatasets, listDatasetItems, runTaskSynchronously).
components/apify/package.json Version updated from "0.1.0" to "0.2.0" and dependency on @pipedream/platform upgraded from "^1.6.5" to "^3.0.3".

Sequence Diagram(s)

sequenceDiagram
    participant C as Client
    participant GDI as Get Dataset Items Action
    participant API as Apify API

    C->>GDI: Invoke action with datasetId, filters, maxResults
    GDI->>API: Request dataset items with limit & offset
    API-->>GDI: Return page of items
    loop While more items available & below maxResults
        GDI->>API: Request next page
        API-->>GDI: Return next set of items
    end
    GDI->>C: Return aggregated items and summary
Loading
sequenceDiagram
    participant C as Client
    participant RTS as Run Task Synchronously Action
    participant API as Apify API

    C->>RTS: Invoke action with taskId and parameters
    RTS->>API: Call runTaskSynchronously with provided options
    API-->>RTS: Return task execution response
    RTS->>C: Return response and summary message
Loading

Assessment against linked issues

Objective Addressed Explanation
Enable dataset item retrieval as action (#16116)

Suggested labels

ai-assisted

Poem

I'm a rabbit with a twinkle in my eye,
Hopping through code, reaching data high.
"Get Dataset Items" now makes it a breeze,
Synchronous tasks dance with so much ease.
With version hops and updates so neat,
I celebrate the changes with a joyful beat!
🐇✨

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/apify/actions/run-actor/run-actor.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 packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/apify/actions/get-dataset-items/get-dataset-items.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 packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/apify/actions/run-task-synchronously/run-task-synchronously.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 packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

  • 5 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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: 1

🧹 Nitpick comments (3)
components/apify/actions/run-task-synchronously/run-task-synchronously.mjs (1)

76-79: Use optional chaining for cleaner code.

The current implementation uses logical AND operators for optional fields, but optional chaining would be more elegant.

-        fields: this.fields && this.fields.join(),
-        omit: this.omit && this.omit.join(),
-        flatten: this.flatten && this.flatten.join(),
+        fields: this.fields?.join(),
+        omit: this.omit?.join(),
+        flatten: this.flatten?.join(),
🧰 Tools
🪛 Biome (1.9.4)

[error] 76-76: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 77-77: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 78-78: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

components/apify/actions/get-dataset-items/get-dataset-items.mjs (1)

54-56: Use optional chaining for cleaner code.

Similar to the other action, optional chaining would be more elegant here.

-      fields: this.fields && this.fields.join(),
-      omit: this.omit && this.omit.join(),
-      flatten: this.flatten && this.flatten.join(),
+      fields: this.fields?.join(),
+      omit: this.omit?.join(),
+      flatten: this.flatten?.join(),
🧰 Tools
🪛 Biome (1.9.4)

[error] 54-54: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 55-55: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 56-56: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

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

100-105: Improve null handling with nullish coalescing.

While the current implementation works, using nullish coalescing with optional chaining would be more elegant.

-        return items?.map(({
-          id: value, name: label,
-        }) => ({
-          label,
-          value,
-        })) || [];
+        return items?.map(({
+          id: value, name: label,
+        }) => ({
+          label,
+          value,
+        })) ?? [];
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f92efba and 9574f51.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • components/apify/actions/get-dataset-items/get-dataset-items.mjs (1 hunks)
  • components/apify/actions/run-actor/run-actor.mjs (1 hunks)
  • components/apify/actions/run-task-synchronously/run-task-synchronously.mjs (1 hunks)
  • components/apify/actions/scrape-single-url/scrape-single-url.mjs (1 hunks)
  • components/apify/actions/set-key-value-store-record/set-key-value-store-record.mjs (1 hunks)
  • components/apify/apify.app.mjs (2 hunks)
  • components/apify/package.json (2 hunks)
  • components/apify/sources/new-finished-actor-run-instant/new-finished-actor-run-instant.mjs (1 hunks)
  • components/apify/sources/new-finished-task-run-instant/new-finished-task-run-instant.mjs (1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
components/apify/actions/get-dataset-items/get-dataset-items.mjs

[error] 54-54: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 55-55: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 56-56: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

components/apify/actions/run-task-synchronously/run-task-synchronously.mjs

[error] 76-76: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 77-77: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 78-78: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (16)
components/apify/sources/new-finished-task-run-instant/new-finished-task-run-instant.mjs (1)

9-9: Version update is consistent.
The module’s version has been updated to "0.0.2", which aligns with the coordinated version bump across the Apify components.

components/apify/sources/new-finished-actor-run-instant/new-finished-actor-run-instant.mjs (1)

9-9: Version update confirmed.
The version field now correctly reflects "0.0.2" in this module, offering consistency with other updated modules.

components/apify/actions/run-actor/run-actor.mjs (1)

8-8: Version bump verified.
Updating the version to "0.0.2" is a straightforward change that maintains consistency across the Apify actions. No other changes affect functionality.

components/apify/actions/scrape-single-url/scrape-single-url.mjs (1)

8-8: Module version update looks good.
The version increment to "0.0.2" is consistent with the other modules in this release and does not impact the action’s logic or behavior.

components/apify/actions/set-key-value-store-record/set-key-value-store-record.mjs (1)

8-8: Consistent version update applied.
The version update to "0.0.2" properly aligns this module with the coordinated release. No functionality changes are introduced here.

components/apify/package.json (2)

3-3: Version bumped appropriately.

Version update from 0.1.0 to 0.2.0 follows semantic versioning principles, reflecting the addition of new features without breaking changes.


16-16: Dependencies updated to support new functionality.

The update to @pipedream/platform from ^1.6.5 to ^3.0.3 aligns with the new Apify actions being introduced in this PR.

components/apify/actions/run-task-synchronously/run-task-synchronously.mjs (3)

3-9: New action implementation looks good.

The action is properly defined with a clear key, name, description, version, and type.


10-66: Props are well-defined with descriptive labels and documentation.

All properties are properly defined with appropriate types, labels, descriptions, and optional flags where needed.


67-86: Run method logic is concise and appropriate.

The implementation correctly passes all necessary parameters to the Apify API and provides a helpful summary message. Good job!

🧰 Tools
🪛 Biome (1.9.4)

[error] 76-76: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 77-77: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 78-78: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

components/apify/actions/get-dataset-items/get-dataset-items.mjs (3)

4-9: New dataset items action is well-defined.

The action has appropriate metadata including key, name, description, version, and type.


10-48: Props are well-defined and reuse app-level property definitions.

All properties correctly reference the propDefinitions from the apify app object.


76-84: Result handling and summary message look great.

The logic for truncating results to match maxResults and generating a summary message is well-implemented.

components/apify/apify.app.mjs (3)

89-107: Dataset ID property is well-implemented.

The datasetId property includes proper type, label, description, and an async options function to populate a dropdown for selection.


108-138: New properties are well-defined with clear documentation.

The properties clean, fields, omit, flatten, and maxResults are properly defined with appropriate types, labels, descriptions, and optional flags.


221-242: New methods for dataset operations are implemented correctly.

The methods listDatasets, listDatasetItems, and runTaskSynchronously correctly implement API calls to the Apify endpoints. The implementation follows the pattern established by other methods in the file.

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!

@michelle0927 michelle0927 merged commit c0ea92b into master Apr 10, 2025
11 checks passed
@michelle0927 michelle0927 deleted the issue-16116 branch April 10, 2025 14:15
@coderabbitai coderabbitai bot mentioned this pull request Apr 21, 2025
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.

Apify - Enable Dataset Item Retrieval as Action

3 participants