-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - google_appsheet #15509
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis pull request removes a .gitignore file and introduces several new modules for the Google AppSheet component. New action modules for adding, updating, deleting, and retrieving rows have been added along with a common base module and a utility for parsing objects. Additionally, the legacy TypeScript app module has been replaced with a new JavaScript module that defines API communication methods. The package configuration has also been updated to reflect these changes. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant A as Action Module
participant B as Common Base Module
participant App as AppSheet App Module
participant API as AppSheet API
U->>A: Trigger action (e.g., add row)
A->>B: Invoke run method & get action details
B->>App: Call _makeRequest/post with action data
App->>API: Send POST request with payload
API-->>App: Return API response
App-->>B: Pass response and summary
B-->>A: Return formatted summary
A-->>U: Display action outcome
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
Actions - Add Row - Update Row - Delete Row
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 @luancazarine lgtm! Ready for QA!
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: 4
🧹 Nitpick comments (6)
components/google_appsheet/common/utils.mjs (1)
1-24: LGTM! Consider handling additional edge cases.The implementation correctly handles basic JSON parsing with proper error handling. Consider adding protection against:
- Circular references
- Deeply nested objects
- Invalid types within arrays
export const parseObject = (obj) => { if (!obj) return undefined; + const MAX_DEPTH = 100; + const seen = new WeakSet(); + + const parseWithDepth = (value, depth = 0) => { + if (depth > MAX_DEPTH) return value; + if (typeof value === 'object' && value !== null) { + if (seen.has(value)) return '[Circular]'; + seen.add(value); + } - if (Array.isArray(obj)) { - return obj.map((item) => { - if (typeof item === "string") { + if (Array.isArray(value)) { + return value.map((item) => { + if (typeof item !== "string" && typeof item !== "object") return item; try { - return JSON.parse(item); + return typeof item === "string" + ? parseWithDepth(JSON.parse(item), depth + 1) + : parseWithDepth(item, depth + 1); } catch (e) { return item; } - } - return item; - }); - } - if (typeof obj === "string") { - try { - return JSON.parse(obj); - } catch (e) { - return obj; + }); + } + if (typeof value === "string") { + try { + return parseWithDepth(JSON.parse(value), depth + 1); + } catch (e) { + return value; + } } + return value; } - return obj; + return parseWithDepth(obj); };components/google_appsheet/actions/common/base.mjs (1)
42-42: Remove console.log statement.Production code should not contain console.log statements. Consider using proper logging mechanisms or remove if not needed.
- console.log("response: ", response);components/google_appsheet/actions/delete-row/delete-row.mjs (1)
32-32: Fix typo in success message.The success message contains a grammatical error.
- return `${response.Rows.length} successfully delete!`; + return `${response.Rows.length} row(s) successfully deleted!`;components/google_appsheet/google_appsheet.app.mjs (1)
19-21: Consider adding input validation for tableName.The
_baseUrlmethod should validate the tableName parameter to prevent potential issues with undefined or empty values.Add validation:
_baseUrl(tableName) { + if (!tableName?.trim()) { + throw new Error("Table name is required"); + } return `https://api.appsheet.com/api/v2/apps/${this.$auth.app_id}/tables/${encodeURIComponent(tableName)}/Action`; },components/google_appsheet/actions/get-rows/get-rows.mjs (1)
41-43: Improve response handling in getSummary.The
getSummarymethod could be more descriptive and handle edge cases better.Enhance the summary message:
getSummary(response) { - return `Successfully retrieved ${ response.length || 0} rows`; + const count = response.length || 0; + return `Successfully retrieved ${count} row${count === 1 ? '' : 's'}${count === 0 ? ' (no matching records found)' : ''}`; }components/google_appsheet/package.json (1)
15-17: Consider adding peer dependencies.Since this is a Pipedream component, consider adding
@pipedream/typesas a peer dependency for better TypeScript support.Add peer dependencies:
"dependencies": { "@pipedream/platform": "^3.0.3" - } + }, + "peerDependencies": { + "@pipedream/types": "^2.1.0" + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (10)
components/google_appsheet/.gitignore(0 hunks)components/google_appsheet/actions/add-row/add-row.mjs(1 hunks)components/google_appsheet/actions/common/base.mjs(1 hunks)components/google_appsheet/actions/delete-row/delete-row.mjs(1 hunks)components/google_appsheet/actions/get-rows/get-rows.mjs(1 hunks)components/google_appsheet/actions/update-row/update-row.mjs(1 hunks)components/google_appsheet/app/google_appsheet.app.ts(0 hunks)components/google_appsheet/common/utils.mjs(1 hunks)components/google_appsheet/google_appsheet.app.mjs(1 hunks)components/google_appsheet/package.json(1 hunks)
💤 Files with no reviewable changes (2)
- components/google_appsheet/app/google_appsheet.app.ts
- components/google_appsheet/.gitignore
🧰 Additional context used
🪛 GitHub Check: Lint Code Base
components/google_appsheet/actions/update-row/update-row.mjs
[warning] 12-12:
Component prop alert must have a label. See https://pipedream.com/docs/components/guidelines/#props
[warning] 12-12:
Component prop alert must have a description. See https://pipedream.com/docs/components/guidelines/#props
components/google_appsheet/actions/delete-row/delete-row.mjs
[warning] 12-12:
Component prop alert must have a label. See https://pipedream.com/docs/components/guidelines/#props
[warning] 12-12:
Component prop alert must have a description. See https://pipedream.com/docs/components/guidelines/#props
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
🔇 Additional comments (2)
components/google_appsheet/actions/add-row/add-row.mjs (1)
1-19: LGTM! Well-structured component with clear documentation.The implementation follows component patterns with proper versioning, documentation links, and clear method implementations.
components/google_appsheet/package.json (1)
3-3: Version bump follows semver.The version increment from 0.0.3 to 0.1.0 appropriately reflects the addition of new features.
|
/approve |
Resolves #15159.
Summary by CodeRabbit
New Features
• Introduced robust Google AppSheet integration enabling seamless actions to add, update, delete, and retrieve rows with clear feedback.
• Refined API interactions ensure faster, more reliable communication with the AppSheet service.
Chores
• Updated the system version and dependencies to bolster stability and compatibility, ensuring a smoother overall experience.