Skip to content

New Components - rendi #16713

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

New Components - rendi #16713

wants to merge 4 commits into from

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented May 19, 2025

Resolves #16689

Summary by CodeRabbit

  • New Features
    • Added actions to run FFmpeg commands, check FFmpeg command status, and list stored files.
    • Introduced sources to emit events for new FFmpeg commands and new stored files.
  • Improvements
    • Enhanced API client with methods for file and command management.
  • Other Changes
    • Updated package version and dependencies.
    • Added utility for safe object parsing.

Copy link

vercel bot commented May 19, 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) May 20, 2025 3:18pm
pipedream-docs ⬜️ Ignored (Inspect) May 20, 2025 3:18pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) May 20, 2025 3:18pm

Copy link
Contributor

coderabbitai bot commented May 19, 2025

"""

Walkthrough

This update introduces a new Rendi integration, providing actions to run FFmpeg commands, check their status, and list stored files. It also adds polling sources to emit events for new FFmpeg commands and new stored files. The Rendi app client is fully implemented to support these operations, along with supporting utilities and sample event data.

Changes

File(s) Change Summary
components/rendi/actions/get-ffmpeg-command-status/get-ffmpeg-command-status.mjs New action: retrieves the status of a specific FFmpeg command by ID.
components/rendi/actions/list-stored-files/list-stored-files.mjs New action: lists all stored files for an account.
components/rendi/actions/run-ffmpeg-command/run-ffmpeg-command.mjs New action: submits and manages FFmpeg commands with input/output file handling and optional polling/download.
components/rendi/common/utils.mjs Adds utility function parseObject for safe object parsing.
components/rendi/package.json Updates version, adds @pipedream/platform dependency, and corrects formatting.
components/rendi/rendi.app.mjs Implements full Rendi API client with methods for file/command management and removes placeholder.
components/rendi/sources/new-ffmpeg-command/new-ffmpeg-command.mjs New polling source: emits events for new FFmpeg commands submitted.
components/rendi/sources/new-ffmpeg-command/test-event.mjs Adds sample event object for new FFmpeg command source.
components/rendi/sources/new-stored-file/new-stored-file.mjs New polling source: emits events for new stored files.
components/rendi/sources/new-stored-file/test-event.mjs Adds sample event object for new stored file source.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Action
    participant RendiAPI

    User->>Action: Run FFmpeg Command (with files, options)
    Action->>RendiAPI: POST /run-ffmpeg-command
    RendiAPI-->>Action: Command ID, status
    alt Wait for completion
        loop Poll until complete
            Action->>RendiAPI: GET /commands/{commandId}
            RendiAPI-->>Action: Command status
        end
        alt Download output files
            Action->>RendiAPI: GET file URLs
            RendiAPI-->>Action: File data
            Action->>User: Output file paths
        end
    else
        Action->>User: Command submitted, status info
    end
Loading
sequenceDiagram
    participant Source
    participant RendiAPI
    participant EventStream

    loop Every interval
        Source->>RendiAPI: GET /commands (or /files)
        RendiAPI-->>Source: List of new commands/files
        Source->>EventStream: Emit event for each new item
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement "run-ffmpeg-command" action to submit FFmpeg jobs with file specs (#16689)
Implement "get-ffmpeg-command-status" action to fetch FFmpeg command status by ID (#16689)
Implement "list-stored-files" action to retrieve all stored files (#16689)
Implement polling sources: "new-ffmpeg-command" and "new-stored-file" to emit events on new submissions/uploads (#16689)
Implement Rendi API client with methods for files and FFmpeg commands (#16689)

Poem

In the land of Rendi, commands now fly,
FFmpeg tasks and files, oh my!
Polling sources hop, alert and spry,
Actions fetch and run, as time goes by.
With every new event, a bunny leaps,
Integration magic—no secrets it keeps!
🐇✨
"""

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/rendi/actions/run-ffmpeg-command/run-ffmpeg-command.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:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:163:49)

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between f4fc3f8 and af9c8df.

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

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: 13

🧹 Nitpick comments (5)
components/rendi/sources/new-ffmpeg-command/new-ffmpeg-command.mjs (1)

15-22: Fix incorrect API reference in timer description

The description incorrectly references the Trello API instead of Rendi API. This appears to be a copy-paste error.

  timer: {
    label: "Polling interval",
-   description: "Pipedream will poll the Trello API on this schedule",
+   description: "Pipedream will poll the Rendi API on this schedule",
    type: "$.interface.timer",
    default: {
      intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
    },
  },
components/rendi/rendi.app.mjs (2)

16-22: Simplify API key header assignment

The template literal for the API key header on line 19 is unnecessary since this.$auth.api_key is already a string.

- "x-api-key": `${this.$auth.api_key}`,
+ "x-api-key": this.$auth.api_key,

11-23: Consider adding error handling for API requests

The _makeRequest method doesn't include error handling for failed requests. Consider adding try/catch logic with appropriate error messages to help with debugging API issues.

 _makeRequest({
   $ = this,
   path,
   ...otherOpts
 }) {
+  try {
     return axios($, {
       url: `${this._baseUrl()}${path}`,
       headers: {
         "x-api-key": `${this.$auth.api_key}`,
       },
       ...otherOpts,
     });
+  } catch (error) {
+    const statusCode = error.response?.status;
+    const statusText = error.response?.statusText;
+    const detail = error.response?.data?.detail || error.message;
+    throw new Error(`Rendi API request failed: ${statusCode} ${statusText} - ${detail}`);
+  }
 },
components/rendi/actions/run-ffmpeg-command/run-ffmpeg-command.mjs (2)

91-98: Use asynchronous file operations

Replace the synchronous fs.writeFileSync with asynchronous fs.promises.writeFile to avoid blocking the event loop:

- const rawcontent = resp.toString("base64");
- const buffer = Buffer.from(rawcontent, "base64");
- const downloadedFilepath = `/tmp/${filename}`;
- fs.writeFileSync(downloadedFilepath, buffer);
+ const buffer = Buffer.from(resp.data);
+ const downloadedFilepath = `/tmp/${filename}`;
+ await fs.promises.writeFile(downloadedFilepath, buffer);

57-66: Validate the input and output files before parsing

The code assumes inputFiles and outputFiles are either objects or JSON strings that can be parsed. Add validation to handle cases where they might be neither:

async run({ $ }) {
-  const inputFiles = parseObject(this.inputFiles);
-  const outputFiles = parseObject(this.outputFiles);
+  let inputFiles, outputFiles;
+  try {
+    inputFiles = parseObject(this.inputFiles);
+    outputFiles = parseObject(this.outputFiles);
+  } catch (error) {
+    throw new ConfigurationError(`Failed to parse input/output files: ${error.message}`);
+  }

  if (Object.keys(inputFiles).some((key) => !key.startsWith("in_"))) {
    throw new ConfigurationError("Input file keys must start with 'in_'");
  }
  if (Object.keys(outputFiles).some((key) => !key.startsWith("out_"))) {
    throw new ConfigurationError("Output file keys must start with 'out_'");
  }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between cb64910 and d3549f6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • components/rendi/actions/get-ffmpeg-command-status/get-ffmpeg-command-status.mjs (1 hunks)
  • components/rendi/actions/list-stored-files/list-stored-files.mjs (1 hunks)
  • components/rendi/actions/run-ffmpeg-command/run-ffmpeg-command.mjs (1 hunks)
  • components/rendi/common/utils.mjs (1 hunks)
  • components/rendi/package.json (2 hunks)
  • components/rendi/rendi.app.mjs (1 hunks)
  • components/rendi/sources/new-ffmpeg-command/new-ffmpeg-command.mjs (1 hunks)
  • components/rendi/sources/new-ffmpeg-command/test-event.mjs (1 hunks)
  • components/rendi/sources/new-stored-file/new-stored-file.mjs (1 hunks)
  • components/rendi/sources/new-stored-file/test-event.mjs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (5)
components/rendi/package.json (2)

3-3: LGTM on version bump from 0.0.1 to 0.1.0

This version update follows semantic versioning principles, indicating the addition of new functionality without breaking changes, which aligns with introducing the new Rendi integration components.


14-17: Proper dependency configuration added

Adding the @pipedream/platform dependency and fixing the JSON structure with proper closing brackets is appropriate for the new Rendi components. The platform package provides essential functionality for Pipedream integrations.

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

8-50: API client implementation looks good

The Rendi API client implementation follows good practices with clear method names corresponding to API endpoints and flexible parameter passing. The centralized _makeRequest method efficiently handles authentication and request formatting.

components/rendi/actions/run-ffmpeg-command/run-ffmpeg-command.mjs (2)

7-56: Component definition and props look good

The component definition with key, name, description, version, and props is well structured. The prop definitions clearly explain their purpose and validation rules. The dynamic props based on waitForCompletion is also implemented correctly.


68-77: API request implementation looks correct

The implementation for sending the FFmpeg command to the Rendi API is well structured, correctly passing all the required parameters.

luancazarine
luancazarine previously approved these changes May 19, 2025
Copy link
Collaborator

@luancazarine luancazarine left a comment

Choose a reason for hiding this comment

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

Hi @michelle0927, LGTM! Ready for QA!

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] rendi
2 participants