-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New Components - transloadit #16579
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
New Components - transloadit #16579
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis update introduces a comprehensive Transloadit integration, adding new actions for creating, canceling, and checking the status of assemblies, as well as polling sources for completed and failed assemblies. Supporting utilities, constants, and app-level methods are implemented to handle API interactions, option loading, and event emission. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action
participant TransloaditApp
participant TransloaditAPI
User->>Action: Trigger Create Assembly
Action->>TransloaditApp: createAssembly(opts)
TransloaditApp->>TransloaditAPI: POST /assemblies
TransloaditAPI-->>TransloaditApp: Assembly response
TransloaditApp-->>Action: Assembly result
Action-->>User: Summary and result
User->>Action: Trigger Cancel Assembly
Action->>TransloaditApp: cancelAssembly(assemblyId)
TransloaditApp->>TransloaditAPI: DELETE /assemblies/{id}
TransloaditAPI-->>TransloaditApp: Cancel response
TransloaditApp-->>Action: Cancel result
Action-->>User: Summary and result
User->>Action: Get Assembly Status
Action->>TransloaditApp: getAssemblyStatus(assemblyId)
TransloaditApp->>TransloaditAPI: GET /assemblies/{id}
TransloaditAPI-->>TransloaditApp: Status response
TransloaditApp-->>Action: Status result
Action-->>User: Summary and result
sequenceDiagram
participant Source
participant TransloaditApp
participant TransloaditAPI
participant EventStream
loop Polling Interval
Source->>TransloaditApp: listAssemblies(status)
TransloaditApp->>TransloaditAPI: GET /assemblies?status={type}
TransloaditAPI-->>TransloaditApp: Assemblies list
TransloaditApp-->>Source: Assembly events
Source->>EventStream: Emit new event(s)
end
Assessment against linked issues
Suggested reviewers
Poem
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 📜 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 (3)
✨ 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 (
|
Sources - New Assembly Completed - New Assembly Error Actions - Create Assembly - Cancel Assembly - Get Assembly Status
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: 6
🧹 Nitpick comments (4)
components/transloadit/sources/common/base.mjs (1)
40-43
: Ensure responseArray is not empty before accessing index 0.While you do check if
responseArray.length
is truthy before setting the last date, it would be more explicit to check if the length is greater than 0.- if (responseArray.length) { + if (responseArray.length > 0) { this._setLastDate(responseArray[0].created); }components/transloadit/sources/new-assembly-error/new-assembly-error.mjs (1)
8-9
: Grammar + clarity in description
"Emit new event when a failed occurs during assembly processing"
reads awkwardly (“a failed” → “a failure”). A small wording fix will make the component description clearer and more professional.- description: "Emit new event when a failed occurs during assembly processing. [See the documentation](https://transloadit.com/docs/api/assemblies-get/)", + description: "Emit an event when a failure occurs during assembly processing. [See the documentation](https://transloadit.com/docs/api/assemblies-get/)",components/transloadit/actions/create-assembly/create-assembly.mjs (2)
13-17
: Missinglabel
/description
fields on theinfo
propThe linter warnings point out that every prop (even
alert
props) needs alabel
anddescription
per the Pipedream guidelines.info: { type: "alert", + label: "Information", + description: "Guidance on using the *Steps* and *Template ID* fields", alertType: "info",🧰 Tools
🪛 GitHub Check: Lint Code Base
[warning] 13-13:
Component prop info must have a label. See https://pipedream.com/docs/components/guidelines/#props
[warning] 13-13:
Component prop info must have a description. See https://pipedream.com/docs/components/guidelines/#props
78-82
: Constructing error message – prefererr.message
& snake-vs-camel case
err
is interpolated directly, which leads to[object Object]
for non-string errors.- The Transloadit SDK returns
assembly_id
, notassemblyId
.- let message = `Unable to process Assembly. ${err}`; + let message = `Unable to process Assembly. ${err?.message ?? err}`; - if (err.assemblyId) { - message += `More info: https://transloadit.com/assemblies/${err.assemblyId}`; + if (err.assembly_id) { + message += ` More info: https://transloadit.com/assemblies/${err.assembly_id}`; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (12)
common/constants.mjs
(1 hunks)components/transloadit/actions/cancel-assembly/cancel-assembly.mjs
(1 hunks)components/transloadit/actions/create-assembly/create-assembly.mjs
(1 hunks)components/transloadit/actions/get-assembly-status/get-assembly-status.mjs
(1 hunks)components/transloadit/common/utils.mjs
(1 hunks)components/transloadit/package.json
(2 hunks)components/transloadit/sources/common/base.mjs
(1 hunks)components/transloadit/sources/new-assembly-completed/new-assembly-completed.mjs
(1 hunks)components/transloadit/sources/new-assembly-completed/test-event.mjs
(1 hunks)components/transloadit/sources/new-assembly-error/new-assembly-error.mjs
(1 hunks)components/transloadit/sources/new-assembly-error/test-event.mjs
(1 hunks)components/transloadit/transloadit.app.mjs
(1 hunks)
🧰 Additional context used
🪛 GitHub Check: Lint Code Base
components/transloadit/actions/create-assembly/create-assembly.mjs
[warning] 13-13:
Component prop info must have a label. See https://pipedream.com/docs/components/guidelines/#props
[warning] 13-13:
Component prop info must have a description. See https://pipedream.com/docs/components/guidelines/#props
🔇 Additional comments (12)
common/constants.mjs (1)
1-1
: Introduce a pagination limit constant
DefiningLIMIT
in a single place avoids magic numbers and improves maintainability when handling paginated requests.components/transloadit/package.json (3)
3-3
: Bump package version
Updating the version to0.1.0
correctly reflects the new Transloadit integration release.
14-14
: Publish configuration
ThepublishConfig.access: "public"
setting is correctly placed for scoped public packages.
15-18
: Declare necessary dependencies
Adding@pipedream/platform
andtransloadit
aligns with the new components' requirements. Ensure these versions are compatible with the rest of the monorepo.components/transloadit/common/utils.mjs (2)
4-15
: Array handling logic is sound
The mapping and JSON parsing of string elements with graceful fallback is implemented correctly.
16-22
: String parsing fallback
Thetry/catch
aroundJSON.parse
for string inputs ensures invalid JSON doesn't break the flow. Good error handling here.components/transloadit/sources/new-assembly-error/test-event.mjs (1)
1-21
: Provide representative failure event payload
The default export JSON mirrors the Transloadit failure event schema and will facilitate accurate testing of the error source component.components/transloadit/sources/new-assembly-completed/test-event.mjs (1)
1-19
: Provide representative success event payload
The default export JSON matches the Transloadit completion event schema and supports testing of the completed-source component.components/transloadit/actions/cancel-assembly/cancel-assembly.mjs (1)
1-24
: Well-implemented action component for canceling Transloadit assemblies.The action is correctly structured with appropriate metadata and follows Pipedream component patterns. Good job including the documentation link in the description to help users understand the underlying API.
components/transloadit/actions/get-assembly-status/get-assembly-status.mjs (1)
1-23
: Clean implementation of the assembly status retrieval action.The component is well-structured and follows the established patterns for Pipedream actions. Good inclusion of the documentation link and a clear summary message for user feedback.
components/transloadit/sources/new-assembly-completed/new-assembly-completed.mjs (1)
1-22
: Well-structured source component extending the base implementation.The component correctly extends the common base functionality and provides specific implementations for event type filtering and summary formatting. Good use of the spread operator to inherit base methods while adding custom ones.
components/transloadit/transloadit.app.mjs (1)
15-16
: Pagination maths may skip pages
page * LIMIT
mixes “page number” with “offset”.
Pipedream’spage
argument starts at 0; Transloadit expects a page index (1-based). Multiplying byLIMIT
will jump by huge increments (e.g. page 2 →60
instead of3
). Usepage + 1
for the requested page index.- page: page * LIMIT, + page: page + 1,
components/transloadit/actions/create-assembly/create-assembly.mjs
Outdated
Show resolved
Hide resolved
components/transloadit/actions/create-assembly/create-assembly.mjs
Outdated
Show resolved
Hide resolved
components/transloadit/actions/create-assembly/create-assembly.mjs
Outdated
Show resolved
Hide resolved
components/transloadit/actions/create-assembly/create-assembly.mjs
Outdated
Show resolved
Hide resolved
components/transloadit/actions/create-assembly/create-assembly.mjs
Outdated
Show resolved
Hide resolved
@luancazarine This is failing one of the PR checks. Make sure to run eslint on all files before pushing changes. |
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.
Oops, I had assumed pageSize
was correct since you used it twice and pagesize
once, but looks like it's the other way around.
Co-authored-by: michelle0927 <[email protected]>
Co-authored-by: michelle0927 <[email protected]>
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.
LGTM!
Resolves #16556.
Summary by CodeRabbit