@pipedream/google_drive 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@ export default {
11
11
  key: "google_drive-upload-file",
12
12
  name: "Upload File",
13
13
  description: "Upload a file to Google Drive. [See the documentation](https://developers.google.com/drive/api/v3/manage-uploads) for more information",
14
- version: "0.1.7",
14
+ version: "0.1.8",
15
15
  type: "action",
16
16
  props: {
17
17
  googleDrive,
@@ -104,7 +104,7 @@ export default {
104
104
  const file = await getFileStream({
105
105
  $,
106
106
  fileUrl,
107
- filePath: filePath.includes("tmp/")
107
+ filePath: filePath?.startsWith("/tmp/")
108
108
  ? filePath
109
109
  : `/tmp/${filePath}`,
110
110
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_drive",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "Pipedream Google_drive Components",
5
5
  "main": "google_drive.app.mjs",
6
6
  "keywords": [
@@ -16,27 +16,32 @@ export default {
16
16
  key: "google_drive-new-or-modified-comments",
17
17
  name: "New or Modified Comments (Instant)",
18
18
  description:
19
- "Emit new event when a file comment is created or modified in the selected Drive",
20
- version: "0.1.8",
19
+ "Emit new event when a comment is created or modified in the selected file",
20
+ version: "1.0.0",
21
21
  type: "source",
22
22
  // Dedupe events based on the "x-goog-message-number" header for the target channel:
23
23
  // https://developers.google.com/drive/api/v3/push#making-watch-requests
24
24
  dedupe: "unique",
25
+ props: {
26
+ ...common.props,
27
+ fileId: {
28
+ propDefinition: [
29
+ common.props.googleDrive,
30
+ "fileId",
31
+ (c) => ({
32
+ drive: c.drive,
33
+ }),
34
+ ],
35
+ description: "The file to watch for comments",
36
+ },
37
+ },
25
38
  hooks: {
26
39
  async deploy() {
27
- const daysAgo = new Date();
28
- daysAgo.setDate(daysAgo.getDate() - 30);
29
- const timeString = daysAgo.toISOString();
30
-
31
- const args = this.getListFilesOpts({
32
- q: `mimeType != "application/vnd.google-apps.folder" and modifiedTime > "${timeString}" and trashed = false`,
33
- fields: "files",
34
- pageSize: 5,
35
- });
36
-
37
- const { files } = await this.googleDrive.listFilesInPage(null, args);
38
-
39
- await this.processChanges(files);
40
+ await this.processChanges([
41
+ {
42
+ id: this.fileId,
43
+ },
44
+ ]);
40
45
  },
41
46
  async activate() {
42
47
  await common.hooks.activate.bind(this)();
@@ -99,6 +104,9 @@ export default {
99
104
  },
100
105
  async processChanges(changedFiles, headers) {
101
106
  const changes = this.getChanges(headers);
107
+ if (changedFiles?.length) {
108
+ changedFiles = changedFiles.filter(({ id }) => id === this.fileId);
109
+ }
102
110
 
103
111
  for (const file of changedFiles) {
104
112
  const lastCommentTimeForFile = this._getLastCommentTimeForFile(file.id);
@@ -116,7 +124,6 @@ export default {
116
124
 
117
125
  const eventToEmit = {
118
126
  comment,
119
- file,
120
127
  ...changes,
121
128
  };
122
129
  const meta = this.generateMeta(comment, headers);