Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/google_drive/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/google_drive",
"version": "0.8.10",
"version": "0.8.11",
"description": "Pipedream Google_drive Components",
"main": "google_drive.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@
key: "google_drive-new-files-instant",
name: "New Files (Instant)",
description: "Emit new event when a new file is added in your linked Google Drive",
version: "0.1.11",
version: "0.1.12",
type: "source",
dedupe: "unique",
props: {
...common.props,
alert: {

Check warning on line 18 in components/google_drive/sources/new-files-instant/new-files-instant.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop alert must have a label. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 18 in components/google_drive/sources/new-files-instant/new-files-instant.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop alert must have a description. See https://pipedream.com/docs/components/guidelines/#props
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).",
},
Comment on lines +18 to +24
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

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.

Suggested change
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

folders: {
type: "string[]",
label: "Folders",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import googleDrive from "../../google_drive.app.mjs";
import sourceComponent from "../new-files-instant/new-files-instant.mjs";
import sampleEmit from "../new-files-instant/test-event.mjs";
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";

export default {
key: "google_drive-new-files-shared-drive",
name: "New Files (Shared Drive)",
description: "Emit new event when a new file is added in your shared Google Drive",
version: "0.0.1",
type: "source",
dedupe: "unique",
props: {
googleDrive,
db: "$.service.db",
timer: {
label: "Polling interval",
description: "Interval to poll the Google Drive API for new files",
type: "$.interface.timer",
default: {
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
},
},
drive: {
propDefinition: [
googleDrive,
"sharedDrive",
],
description: "Select a [Shared Drive](https://support.google.com/a/users/answer/9310351) from this list",
optional: false,
},
folders: sourceComponent.props.folders,
Copy link
Contributor

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.

},
hooks: {
async deploy() {
// Get initial page token for change tracking
const startPageToken = await this.googleDrive.getPageToken(this.getDriveId());
this._setPageToken(startPageToken);
this._setLastFileCreatedTime(Date.now());

// Emit the most recent files
await sourceComponent.hooks.deploy.bind(this)();
},
},
methods: sourceComponent.methods,
async run() {
const pageToken = this._getPageToken();

const driveId = this.getDriveId();
const changedFilesStream = this.googleDrive.listChanges(pageToken, driveId);
for await (const changedFilesPage of changedFilesStream) {
const { nextPageToken } = changedFilesPage;

// Process all the changed files retrieved from the current page
await this.processChanges();

// After successfully processing the changed files, we store the page
// token of the next page
this._setPageToken(nextPageToken);
}
},
sampleEmit,
};
Loading