-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New Components - google_slides #17812
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?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
WalkthroughThis update introduces comprehensive CRUD (Create, Read, Update, Delete) actions for Google Slides presentations, slides, and page elements. New modules enable creating and deleting slides, shapes, images, and inserting text. The core app logic is refactored to centralize batch update operations and expose new methods for manipulating slide content. Version bumps and new constants support these enhancements. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action
participant GoogleSlidesApp
participant GoogleSlidesAPI
User->>Action: Initiate CRUD operation (e.g., create slide, insert text)
Action->>GoogleSlidesApp: Call corresponding method (e.g., createSlide, insertText)
GoogleSlidesApp->>GoogleSlidesAPI: Send batchUpdate or direct API request
GoogleSlidesAPI-->>GoogleSlidesApp: Return API response
GoogleSlidesApp-->>Action: Return processed response
Action-->>User: Provide summary and results
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes 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/google_slides/actions/create-page-element/create-page-element.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/google_slides/actions/find-presentation/find-presentation.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/google_slides/actions/delete-slide/delete-slide.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
✨ Finishing Touches
🧪 Generate unit tests
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: 6
🧹 Nitpick comments (9)
components/google_slides/actions/create-presentation/create-presentation.mjs (1)
7-7
: Version bump looks correct – please sync changelogThe increment to
0.0.3
aligns with the other action bumps in this PR. Just make sure the public changelog / marketplace description is updated so users understand what changed.components/google_slides/actions/merge-data/merge-data.mjs (1)
7-7
: Patch bump to0.0.2
Looks fine; just double-check that any new placeholder-handling features introduced elsewhere are reflected in the docs for this action.
components/google_slides/common/constants.mjs (1)
1-143
: Comprehensive shape types definition looks good.The extensive list of shape types covers all major categories (basic shapes, arrows, flowchart symbols, callouts, etc.) and follows consistent naming conventions. This centralized approach will ensure consistency across actions that create shapes.
Consider adding JSDoc documentation to describe the purpose and usage:
+/** + * Supported shape types for Google Slides page elements + * @see https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/requests#ShapeType + */ export const SHAPE_TYPES = [components/google_slides/actions/insert-text/insert-text.mjs (1)
37-47
: Consider adding validation for the text parameter.While the text parameter is required, consider adding length validation or format checks to provide better user experience.
text: { type: "string", label: "Text", description: "The text to insert", + validate: (value) => { + if (!value?.trim()) { + throw new Error("Text cannot be empty or contain only whitespace"); + } + return true; + }, },components/google_slides/actions/create-image/create-image.mjs (1)
26-30
: Add URL validation for the image parameter.Consider validating that the URL is accessible and points to a valid image format to prevent API errors.
url: { type: "string", label: "URL", description: "The URL of the image to insert", + validate: (value) => { + try { + new URL(value); + return true; + } catch { + throw new Error("Please provide a valid URL"); + } + }, },components/google_slides/actions/delete-slide/delete-slide.mjs (1)
27-31
: Consider adding confirmation for destructive operation.While the implementation is correct, consider adding a confirmation step or warning for this destructive operation to prevent accidental slide deletion.
async run({ $ }) { + // Note: This is a destructive operation that cannot be undone const response = await this.googleSlides.deleteObject(this.presentationId, this.slideId); $.export("$summary", `Successfully deleted slide with ID: ${this.slideId}`); return response.data; },
Alternatively, consider adding a confirmation prop:
props: { googleSlides, presentationId: { /* existing */ }, slideId: { /* existing */ }, + confirm: { + type: "boolean", + label: "Confirm Deletion", + description: "Confirm that you want to permanently delete this slide", + default: false, + }, },components/google_slides/actions/create-page-element/create-page-element.mjs (1)
57-70
: Consider usingnumber
type for translation properties.While translation values are often whole numbers, the Google Slides API accepts decimal values for precise positioning. Consider changing to
number
type for flexibility.translateX: { - type: "integer", + type: "number", label: "Translate X", - description: "The translation of the shape on the x-axis", + description: "The translation of the shape on the x-axis in points (1/72 of an inch)", default: 0, optional: true, }, translateY: { - type: "integer", + type: "number", label: "Translate Y", - description: "The translation of the shape on the y-axis", + description: "The translation of the shape on the y-axis in points (1/72 of an inch)", default: 0, optional: true, },components/google_slides/actions/create-slide/create-slide.mjs (1)
42-43
: Add null-safe response parsing.While the error handling is good, the response parsing could be more defensive against unexpected API response structures.
- $.export("$summary", `Successfully created slide with ID: ${response.data.replies[0].createSlide.objectId}`); + const objectId = response.data?.replies?.[0]?.createSlide?.objectId; + if (!objectId) { + throw new ConfigurationError("Unexpected API response: slide ID not found"); + } + $.export("$summary", `Successfully created slide with ID: ${objectId}`);components/google_slides/google_slides.app.mjs (1)
137-146
: Consider adding JSDoc documentation for thedeleteObject
method.The
deleteObject
method name is generic and could benefit from documentation explaining that it can delete both slides and page elements.+ /** + * Deletes an object (slide or page element) from a presentation + * @param {string} presentationId - The ID of the presentation + * @param {string} objectId - The ID of the object to delete (can be a slide ID or page element ID) + * @returns {Promise} The API response + */ deleteObject(presentationId, objectId) {
📜 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 (14)
components/google_slides/actions/create-image/create-image.mjs
(1 hunks)components/google_slides/actions/create-page-element/create-page-element.mjs
(1 hunks)components/google_slides/actions/create-presentation/create-presentation.mjs
(1 hunks)components/google_slides/actions/create-slide/create-slide.mjs
(1 hunks)components/google_slides/actions/delete-page-element/delete-page-element.mjs
(1 hunks)components/google_slides/actions/delete-slide/delete-slide.mjs
(1 hunks)components/google_slides/actions/find-presentation/find-presentation.mjs
(1 hunks)components/google_slides/actions/insert-text/insert-text.mjs
(1 hunks)components/google_slides/actions/merge-data/merge-data.mjs
(1 hunks)components/google_slides/actions/refresh-chart/refresh-chart.mjs
(1 hunks)components/google_slides/common/constants.mjs
(1 hunks)components/google_slides/google_slides.app.mjs
(3 hunks)components/google_slides/package.json
(2 hunks)components/google_slides/sources/new-presentation/new-presentation.mjs
(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
components/google_slides/package.json (1)
Learnt from: jcortes
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.
components/google_slides/actions/create-image/create-image.mjs (1)
Learnt from: js07
PR: #17375
File: components/tinypng/actions/compress-image/compress-image.mjs:18-23
Timestamp: 2025-07-01T17:01:46.327Z
Learning: In TinyPNG compress-image action (components/tinypng/actions/compress-image/compress-image.mjs), the syncDir property uses accessMode: "read" because this action only reads input files and returns API responses without writing files to /tmp, unlike other TinyPNG actions that save processed files to disk.
🧬 Code Graph Analysis (5)
components/google_slides/actions/insert-text/insert-text.mjs (6)
components/google_slides/actions/create-image/create-image.mjs (1)
response
(71-93)components/google_slides/actions/create-slide/create-slide.mjs (1)
response
(36-41)components/google_slides/actions/create-page-element/create-page-element.mjs (1)
response
(73-95)components/google_slides/actions/delete-page-element/delete-page-element.mjs (1)
response
(38-38)components/google_slides/actions/delete-slide/delete-slide.mjs (1)
response
(28-28)components/google_slides/actions/merge-data/merge-data.mjs (1)
response
(96-104)
components/google_slides/actions/create-page-element/create-page-element.mjs (2)
components/google_slides/common/constants.mjs (2)
SHAPE_TYPES
(1-143)SHAPE_TYPES
(1-143)components/google_slides/actions/create-image/create-image.mjs (1)
response
(71-93)
components/google_slides/actions/create-slide/create-slide.mjs (5)
components/google_slides/actions/create-image/create-image.mjs (1)
response
(71-93)components/google_slides/actions/create-page-element/create-page-element.mjs (1)
response
(73-95)components/google_slides/actions/delete-page-element/delete-page-element.mjs (1)
response
(38-38)components/google_slides/actions/delete-slide/delete-slide.mjs (1)
response
(28-28)components/google_slides/actions/insert-text/insert-text.mjs (1)
response
(50-54)
components/google_slides/actions/delete-slide/delete-slide.mjs (1)
components/google_slides/actions/delete-page-element/delete-page-element.mjs (1)
response
(38-38)
components/google_slides/actions/delete-page-element/delete-page-element.mjs (1)
components/google_slides/actions/delete-slide/delete-slide.mjs (1)
response
(28-28)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: pnpm publish
- GitHub Check: Lint Code Base
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
🔇 Additional comments (12)
components/google_slides/actions/find-presentation/find-presentation.mjs (1)
7-7
: Consistent versioning – goodThe
0.0.3
bump keeps this action in lock-step with the rest of the Google Slides package. No further action required.components/google_slides/actions/refresh-chart/refresh-chart.mjs (1)
7-7
: Version update acknowledged
0.0.3
matches the coordinated release. Confirm that the underlying refactor tobatchUpdate()
is already covered in tests so this action still works as expected.components/google_slides/sources/new-presentation/new-presentation.mjs (1)
9-9
: Minor bump to0.0.4
OKSource version leads the pack by one patch – makes sense given the additional logic extensions. Ensure downstream automation (e.g., import paths in templates) tolerates mixed patch versions.
components/google_slides/package.json (2)
3-3
: Appropriate version bump for new features.The minor version bump from 0.1.1 to 0.2.0 correctly reflects the addition of new CRUD functionality for Google Slides.
15-15
: Verify @pipedream/platform v3.1.0 Breaking ChangesWe scanned the codebase for
@pipedream/platform
usage and found multiple sources importing
DEFAULT_POLLING_SOURCE_TIMER_INTERVAL
. This major bump (0.x → 3.x) could rename, remove or alter that export or default polling behavior.Please confirm in the v3.1.0 changelog or source that:
•
DEFAULT_POLLING_SOURCE_TIMER_INTERVAL
is still exported and behaves as before
• No other exports or method signatures you rely on have changedKey files to check:
- components/uservoice/sources/new-nps-ratings/new-nps-ratings.js
- components/stack_exchange/sources/new-question-for-keywords/new-question-for-keywords.js
- components/stack_exchange/sources/new-answers-from-users/new-answers-from-users.js
- components/stack_exchange/sources/new-answers-for-questions/new-answers-for-questions.js
- components/here/sources/weather-for-zip/weather-for-zip.js
- components/hacker_news/sources/new-stories-by-keyword/new-stories-by-keyword.js
- components/hacker_news/sources/new-comments-by-keyword/new-comments-by-keyword.js
If anything has changed, update imports or replace usages accordingly before merging.
components/google_slides/actions/insert-text/insert-text.mjs (2)
26-35
: Good use of textOnly filter for shape selection.The
textOnly: true
parameter in the shapeId prop definition is excellent for preventing users from selecting non-text shapes, which would cause API errors.
49-57
: Proper API integration and response handling.The method call to
insertText
and response handling follow the established patterns. The summary export provides useful feedback to users.components/google_slides/actions/create-image/create-image.mjs (2)
31-68
: Well-designed transformation properties with sensible defaults.The dimension and transformation properties provide comprehensive control over image placement. The default values (scale: 1, translate: 0) are appropriate and the descriptions clearly explain the points measurement system.
70-96
: Proper API integration and response handling.The object structure correctly matches the Google Slides API requirements, and the response handling appropriately extracts the object ID from the nested reply structure.
components/google_slides/actions/delete-slide/delete-slide.mjs (1)
11-25
: Proper prop dependency structure.The slideId prop correctly depends on presentationId, ensuring slides are loaded dynamically based on the selected presentation.
components/google_slides/actions/create-slide/create-slide.mjs (1)
34-47
: Good error handling implementation!The try-catch block with ConfigurationError provides clear feedback to users about potential permission issues.
components/google_slides/google_slides.app.mjs (1)
78-96
: Excellent refactoring with the centralizedbatchUpdate
method!The introduction of
batchUpdate
as a central method for API calls is a great architectural decision. It reduces code duplication and makes the codebase more maintainable.
Resolves #17404
Summary by CodeRabbit
New Features
Improvements
Chores