-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
base: master
Are you sure you want to change the base?
New Components - rendi #16713
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
""" WalkthroughThis 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
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
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
Assessment against linked issues
Poem
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
components/rendi/actions/run-ffmpeg-command/run-ffmpeg-command.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit 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. Note ⚡️ Faster reviews with cachingCodeRabbit 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 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 13
🧹 Nitpick comments (5)
components/rendi/sources/new-ffmpeg-command/new-ffmpeg-command.mjs (1)
15-22
: Fix incorrect API reference in timer descriptionThe 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 assignmentThe 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 requestsThe
_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 operationsReplace the synchronous
fs.writeFileSync
with asynchronousfs.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 parsingThe code assumes
inputFiles
andoutputFiles
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
⛔ 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.0This 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 addedAdding 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 goodThe 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 goodThe 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 correctThe implementation for sending the FFmpeg command to the Rendi API is well structured, correctly passing all the required parameters.
components/rendi/actions/get-ffmpeg-command-status/get-ffmpeg-command-status.mjs
Show resolved
Hide resolved
components/rendi/actions/run-ffmpeg-command/run-ffmpeg-command.mjs
Outdated
Show resolved
Hide resolved
components/rendi/actions/run-ffmpeg-command/run-ffmpeg-command.mjs
Outdated
Show resolved
Hide resolved
components/rendi/actions/run-ffmpeg-command/run-ffmpeg-command.mjs
Outdated
Show resolved
Hide resolved
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.
Hi @michelle0927, LGTM! Ready for QA!
Resolves #16689
Summary by CodeRabbit