-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Component] CSVBox components #18981
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
[Component] CSVBox components #18981
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified. |
|
Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughAdds a new CSVBox webhook-based source component for detecting new rows, introduces a shared constants module with BASE_URL, and refactors the CSVBox app module with standardized request helpers and new public methods for webhook and sheet management. Version downgraded to 0.0.1 with updated dependencies. Changes
Sequence DiagramsequenceDiagram
participant User
participant Source as csvbox-new-row
participant App as csvbox.app
participant CSVBox as CSVBox API
participant DB as Database
rect rgb(200, 220, 240)
Note over Source,DB: Activation Phase
User->>Source: Enable source
Source->>App: createHook(data)
App->>App: _getAuthKeys() & _getHeaders()
App->>CSVBox: POST /register-webhook
CSVBox-->>App: { hookId }
App-->>Source: Response with hookId
Source->>DB: Store hookId & sample row
end
rect rgb(220, 240, 220)
Note over Source,CSVBox: Webhook Reception Phase
CSVBox->>Source: POST webhook body (new row)
Source->>Source: Extract id & summary
Source->>User: Emit row event
end
rect rgb(240, 220, 220)
Note over Source,DB: Deactivation Phase
User->>Source: Disable source
Source->>App: deleteHook({ hookId })
App->>CSVBox: DELETE /delete-webhook
CSVBox-->>App: Success
Source->>DB: Clear hookId & sample row
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Areas requiring extra attention:
Pre-merge checks and finishing touches❌ Failed checks (2 inconclusive)
✅ Passed checks (3 passed)
Comment |
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: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
components/csvbox/package.json (1)
3-17: Avoid decreasing the published package version.The version rollback from 0.1.0 to 0.0.1 will be rejected by the npm registry: once a version is published it cannot be reused, so the publish step will fail. Please bump the version forward (e.g., 0.1.1) instead of decrementing it.(docs.npmjs.com)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
components/csvbox/common/constants.mjs(1 hunks)components/csvbox/csvbox-new-row/csvbox-new-row.mjs(1 hunks)components/csvbox/csvbox.app.mjs(1 hunks)components/csvbox/package.json(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
Applied to files:
components/csvbox/package.json
📚 Learning: 2025-09-15T22:01:11.472Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18362
File: components/leonardo_ai/actions/generate-image/generate-image.mjs:103-105
Timestamp: 2025-09-15T22:01:11.472Z
Learning: In Pipedream components, pipedream/platform's axios implementation automatically excludes undefined values from HTTP requests, so there's no need to manually check for truthiness before including properties in request payloads.
Applied to files:
components/csvbox/package.jsoncomponents/csvbox/csvbox.app.mjs
| async run(event) { | ||
| const { body } = event; | ||
| if (!body) { | ||
| console.error("Received empty webhook body"); | ||
| return; | ||
| } | ||
|
|
||
| this.$emit(body, { | ||
| id: body[0].import_id || `${body[0].sheet_id}_${Date.now()}`, | ||
| summary: `New data imported to sheet ${body[0].sheet_name}`, | ||
| ts: Date.now(), | ||
| }); |
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.
Guard against empty or non-array webhook payloads.
CSVBox sends webhook payloads as JSON arrays of rows, but chunking and configuration can yield empty arrays; dereferencing body[0] without checking will throw and drop the delivery. Add a shape check and iterate the rows (or at least guard the first element) before emitting.(help.csvbox.io)
async run(event) {
const { body } = event;
- if (!body) {
- console.error("Received empty webhook body");
- return;
- }
-
- this.$emit(body, {
- id: body[0].import_id || `${body[0].sheet_id}_${Date.now()}`,
- summary: `New data imported to sheet ${body[0].sheet_name}`,
- ts: Date.now(),
- });
+ if (!Array.isArray(body) || body.length === 0) {
+ console.error("Received webhook payload without row data");
+ return;
+ }
+
+ for (const row of body) {
+ this.$emit(row, {
+ id: row.import_id || `${row.sheet_id}_${Date.now()}`,
+ summary: `New data imported to sheet ${row.sheet_name}`,
+ ts: Date.now(),
+ });
+ }
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| async run(event) { | |
| const { body } = event; | |
| if (!body) { | |
| console.error("Received empty webhook body"); | |
| return; | |
| } | |
| this.$emit(body, { | |
| id: body[0].import_id || `${body[0].sheet_id}_${Date.now()}`, | |
| summary: `New data imported to sheet ${body[0].sheet_name}`, | |
| ts: Date.now(), | |
| }); | |
| async run(event) { | |
| const { body } = event; | |
| if (!Array.isArray(body) || body.length === 0) { | |
| console.error("Received webhook payload without row data"); | |
| return; | |
| } | |
| for (const row of body) { | |
| this.$emit(row, { | |
| id: row.import_id || `${row.sheet_id}_${Date.now()}`, | |
| summary: `New data imported to sheet ${row.sheet_name}`, | |
| ts: Date.now(), | |
| }); | |
| } | |
| } |
|
I have created a new PR #18982, so closing this one. |
WHY
Resolves #18697
Summary
This PR introduces a new Csvbox component to the Pipedream components library.
Csvbox allows users to collect CSV data through hosted importers and send it directly into their applications.
This component connects to a user’s Csvbox account, retrieves available sheets, provides sample data for mapping with subsequent components, and listens for import events once deployed.
Functionality
Summary by CodeRabbit
Release Notes
New Features
Improvements