-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Google Drive - new files shared drive polling trigger #15997
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 updates version numbers in the Google Drive component files and adds a new property. In the Changes
Sequence Diagram(s)sequenceDiagram
participant U as User/Component
participant NS as NewFilesSharedDrive
participant API as Google Drive API
U->>NS: Trigger deploy
NS->>API: Request initial page token & file info
API-->>NS: Return token and initial file data
NS->>NS: Initialize component and emit recent files
loop Polling Process
NS->>API: Poll for changed files (using current token)
API-->>NS: Return changes and updated token
NS->>NS: Process changed files and update token
NS->>U: Emit new file events
end
Possibly related PRs
Suggested reviewers
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_drive/sources/new-files-instant/new-files-instant.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_drive/sources/new-files-shared-drive/new-files-shared-drive.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
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:
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 (
|
2160786
to
59d447c
Compare
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: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
components/google_drive/package.json
(1 hunks)components/google_drive/sources/new-files-instant/new-files-instant.mjs
(1 hunks)components/google_drive/sources/new-files-shared-drive/new-files-shared-drive.mjs
(1 hunks)
🧰 Additional context used
🪛 GitHub Check: Lint Code Base
components/google_drive/sources/new-files-instant/new-files-instant.mjs
[warning] 18-18:
Component prop alert must have a label. See https://pipedream.com/docs/components/guidelines/#props
[warning] 18-18:
Component prop alert must have a description. See https://pipedream.com/docs/components/guidelines/#props
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
🔇 Additional comments (8)
components/google_drive/package.json (1)
3-3
: Version bump is appropriate for the new feature.The version increment from 0.8.10 to 0.8.11 aligns with the addition of the new shared drive polling functionality.
components/google_drive/sources/new-files-instant/new-files-instant.mjs (2)
13-13
: Version increment matches package.json update.The version bump from 0.1.11 to 0.1.12 correctly reflects the addition of the new alert property.
18-24
: Good implementation of user guidance for shared drives.The alert provides clear guidance about the limitations of using this trigger with shared drives and directs users to the more appropriate "New Files (Shared Drive)" trigger. This improves user experience by setting appropriate expectations.
🧰 Tools
🪛 GitHub Check: Lint Code Base
[warning] 18-18:
Component prop alert must have a label. See https://pipedream.com/docs/components/guidelines/#props
[warning] 18-18:
Component prop alert must have a description. See https://pipedream.com/docs/components/guidelines/#propscomponents/google_drive/sources/new-files-shared-drive/new-files-shared-drive.mjs (5)
6-12
: Good implementation of shared drive polling source.The component is correctly structured with a unique key, descriptive name, and appropriate description that clearly explains its purpose.
13-33
: Props configuration is well-defined and reuses existing components.The props configuration effectively:
- Connects to the Google Drive app
- Configures the database for state persistence
- Provides a customizable polling interval with default value
- Requires selection of a shared drive
- Reuses the folders prop from the instant trigger for consistency
Good practice in reusing the existing component's folder definition to maintain consistency.
34-44
: Deploy hook implementation is efficient.The deploy hook properly:
- Initializes the page token for change tracking
- Sets the initial file creation timestamp
- Reuses the sourceComponent's deploy hook for emitting recent files
Smart approach to reuse the existing deploy hook from the instant source component.
45-45
: Effective method inheritance.Reusing methods from the instant source component promotes code reusability and consistency across components.
46-61
: Well-implemented polling mechanism.The run method effectively:
- Retrieves the stored page token
- Gets the drive ID
- Streams changed files efficiently
- Processes changes for each page
- Updates the page token for the next run
The implementation addresses the PR objective of improving detection reliability for shared drives.
alert: { | ||
type: "alert", | ||
content: "For shared drives, prefer to use [New Files (Shared Drive)](https://pipedream.com/apps/google-drive/triggers/new-files-shared-drive) instead. \ | ||
It provides a more reliable way to track changes using polling. \ | ||
Shared drive notifications may be delayed or incomplete, as they don't immediately reflect all changes made by other users. \ | ||
For more details, see [Google's documentation](https://developers.google.com/drive/api/guides/about-changes#track_shared_drives).", | ||
}, |
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.
Add missing label and description for the alert prop.
The alert prop is missing the required label and description properties according to component guidelines.
alert: {
type: "alert",
+ label: "Shared Drive Notice",
+ description: "Important information about using this trigger with shared drives",
content: "For shared drives, prefer to use [New Files (Shared Drive)](https://pipedream.com/apps/google-drive/triggers/new-files-shared-drive) instead. \
It provides a more reliable way to track changes using polling. \
Shared drive notifications may be delayed or incomplete, as they don't immediately reflect all changes made by other users. \
For more details, see [Google's documentation](https://developers.google.com/drive/api/guides/about-changes#track_shared_drives).",
},
📝 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.
alert: { | |
type: "alert", | |
content: "For shared drives, prefer to use [New Files (Shared Drive)](https://pipedream.com/apps/google-drive/triggers/new-files-shared-drive) instead. \ | |
It provides a more reliable way to track changes using polling. \ | |
Shared drive notifications may be delayed or incomplete, as they don't immediately reflect all changes made by other users. \ | |
For more details, see [Google's documentation](https://developers.google.com/drive/api/guides/about-changes#track_shared_drives).", | |
}, | |
alert: { | |
type: "alert", | |
label: "Shared Drive Notice", | |
description: "Important information about using this trigger with shared drives", | |
content: "For shared drives, prefer to use [New Files (Shared Drive)](https://pipedream.com/apps/google-drive/triggers/new-files-shared-drive) instead. \ | |
It provides a more reliable way to track changes using polling. \ | |
Shared drive notifications may be delayed or incomplete, as they don't immediately reflect all changes made by other users. \ | |
For more details, see [Google's documentation](https://developers.google.com/drive/api/guides/about-changes#track_shared_drives).", | |
}, |
🧰 Tools
🪛 GitHub Check: Lint Code Base
[warning] 18-18:
Component prop alert must have a label. See https://pipedream.com/docs/components/guidelines/#props
[warning] 18-18:
Component prop alert must have a description. See https://pipedream.com/docs/components/guidelines/#props
description: "Select a [Shared Drive](https://support.google.com/a/users/answer/9310351) from this list", | ||
optional: false, | ||
}, | ||
folders: sourceComponent.props.folders, |
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.
💡 Verification agent
🧩 Analysis chain
Verify method compatibility.
While reusing methods and props from the instant source is efficient, ensure that all methods required by this component are properly defined in the sourceComponent.
Also applies to: 45-45
🏁 Script executed:
#!/bin/bash
# Check for required methods in the sourceComponent
# Look for methods referenced in this file
echo "Methods referenced in new-files-shared-drive.mjs:"
methods=$(grep -o '_[a-zA-Z]*' components/google_drive/sources/new-files-shared-drive/new-files-shared-drive.mjs | sort | uniq)
echo "$methods"
# Check if these methods exist in the source component
echo -e "\nVerifying methods exist in source component:"
for method in $methods; do
echo -n "$method: "
if grep -q "$method" components/google_drive/sources/new-files-instant/new-files-instant.mjs; then
echo "Found"
else
echo "NOT FOUND - This might be a problem"
fi
done
# Check for getDriveId method which is used but might be from googleDrive
echo -e "\nChecking for getDriveId method:"
if grep -q "getDriveId" components/google_drive/sources/new-files-instant/new-files-instant.mjs; then
echo "getDriveId: Found in source component"
else
echo "getDriveId: Not found in source component, checking if it exists in app file"
if grep -q "getDriveId" components/google_drive/google_drive.app.mjs; then
echo "getDriveId: Found in google_drive.app.mjs"
else
echo "getDriveId: NOT FOUND - This might be a problem"
fi
fi
Length of output: 2671
Action: Verify and Fix Missing Method Definitions
The verification indicates that several methods referenced in the new shared drive component from the instant source—specifically _INTERVAL
, _POLLING
, _SOURCE
, and _TIMER
—are not found in components/google_drive/sources/new-files-instant/new-files-instant.mjs
. Although methods like _drive
, _getPageToken
, and getDriveId
are present, these missing methods could lead to runtime issues if the shared drive component relies on them.
- Review Dependency: Confirm whether the missing methods are intended to be provided by a different source or if they were accidentally omitted from the instant source.
- Implementation or Refactoring: If they should be available, update
new-files-instant.mjs
with the necessary definitions. Otherwise, adjust the shared drive component to remove or handle these method calls appropriately. - Documentation: Consider adding comments or documentation to clarify the intended method flow, especially if some methods are moved or overridden elsewhere.
WHY
This PR introduces a new polling source for new files in shared drives, ensuring more reliable detection of new files compared to relying solely on Google's notifications. While normal drives benefit from immediate notifications, in shared drives, for new files created by another user they will be delayed until the user accesses the file manually.
Summary by CodeRabbit
Chores
New Features