@pipedream/google_drive 1.11.0 → 1.12.1
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.
- package/actions/create-text-file/create-text-file.mjs +102 -0
- package/actions/get-file/get-file.mjs +48 -0
- package/actions/get-user-details/get-user-details.mjs +34 -0
- package/actions/list-permissions/list-permissions.mjs +46 -0
- package/actions/list-shared-drives/list-shared-drives.mjs +52 -0
- package/actions/remove-sharing/remove-sharing.mjs +50 -0
- package/actions/search-files/search-files.mjs +82 -0
- package/actions/share-file/share-file.mjs +86 -0
- package/actions/trash-file/trash-file.mjs +41 -0
- package/google_drive.app.mjs +9 -0
- package/package.json +1 -1
- package/sources/changes-to-files-in-drive/changes-to-files-in-drive.mjs +1 -3
- package/sources/changes-to-specific-files-shared-drive/changes-to-specific-files-shared-drive.mjs +1 -3
- package/sources/common-webhook.mjs +4 -5
- package/sources/new-files-instant/new-files-instant.mjs +1 -1
- package/sources/new-files-instant-polling/new-files-instant-polling.mjs +5 -7
- package/sources/new-files-shared-drive/new-files-shared-drive.mjs +5 -6
- package/sources/new-or-modified-comments/new-or-modified-comments.mjs +1 -1
- package/sources/new-or-modified-files/new-or-modified-files.mjs +1 -3
- package/sources/new-or-modified-files-polling/new-or-modified-files-polling.mjs +5 -7
- package/sources/new-or-modified-folders/new-or-modified-folders.mjs +1 -1
- package/sources/new-or-modified-folders-polling/new-or-modified-folders-polling.mjs +5 -7
- package/sources/new-spreadsheet-polling/new-spreadsheet-polling.mjs +5 -7
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Readable } from "stream";
|
|
2
|
+
import googleDrive from "../../google_drive.app.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "google_drive-create-text-file",
|
|
6
|
+
name: "Create Text File",
|
|
7
|
+
description:
|
|
8
|
+
"Create a new Google Doc from text content in Google Drive."
|
|
9
|
+
+ " The file is created as a Google Docs document, which can be viewed and edited in the browser."
|
|
10
|
+
+ " Use this when the user asks to create a document, write a file, or save text to Drive."
|
|
11
|
+
+ " To place the file in a specific folder, pass the `parentId` — use **Search Files** with"
|
|
12
|
+
+ " `mimeType = 'application/vnd.google-apps.folder'` to find the folder ID first."
|
|
13
|
+
+ " Supported content formats: plain text, Markdown, HTML, Rich Text, CSV."
|
|
14
|
+
+ " [See the documentation](https://developers.google.com/drive/api/v3/reference/files/create)",
|
|
15
|
+
version: "0.0.1",
|
|
16
|
+
type: "action",
|
|
17
|
+
annotations: {
|
|
18
|
+
destructiveHint: false,
|
|
19
|
+
openWorldHint: true,
|
|
20
|
+
readOnlyHint: false,
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
googleDrive,
|
|
24
|
+
name: {
|
|
25
|
+
type: "string",
|
|
26
|
+
label: "File Name",
|
|
27
|
+
description: "The name of the new file (e.g., 'Meeting Notes', 'Project Plan').",
|
|
28
|
+
},
|
|
29
|
+
content: {
|
|
30
|
+
type: "string",
|
|
31
|
+
label: "Content",
|
|
32
|
+
description: "The text content of the file.",
|
|
33
|
+
optional: true,
|
|
34
|
+
default: "",
|
|
35
|
+
},
|
|
36
|
+
mimeType: {
|
|
37
|
+
type: "string",
|
|
38
|
+
label: "Content Format",
|
|
39
|
+
description:
|
|
40
|
+
"The format of the content being provided. Defaults to plain text.",
|
|
41
|
+
optional: true,
|
|
42
|
+
default: "text/plain",
|
|
43
|
+
options: [
|
|
44
|
+
{
|
|
45
|
+
value: "text/plain",
|
|
46
|
+
label: "Plain Text",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
value: "text/markdown",
|
|
50
|
+
label: "Markdown",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
value: "text/html",
|
|
54
|
+
label: "HTML",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
value: "application/rtf",
|
|
58
|
+
label: "Rich Text",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
value: "text/csv",
|
|
62
|
+
label: "CSV",
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
parentId: {
|
|
67
|
+
type: "string",
|
|
68
|
+
label: "Parent Folder ID",
|
|
69
|
+
description:
|
|
70
|
+
"The ID of the folder to create the file in."
|
|
71
|
+
+ " Use **Search Files** with `mimeType = 'application/vnd.google-apps.folder'` to find folder IDs."
|
|
72
|
+
+ " Omit to create in the root of My Drive.",
|
|
73
|
+
optional: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
async run({ $ }) {
|
|
77
|
+
const file = Readable.from([
|
|
78
|
+
this.content,
|
|
79
|
+
]);
|
|
80
|
+
const drive = this.googleDrive.drive();
|
|
81
|
+
|
|
82
|
+
const { data: resp } = await drive.files.create({
|
|
83
|
+
supportsAllDrives: true,
|
|
84
|
+
media: {
|
|
85
|
+
mimeType: this.mimeType,
|
|
86
|
+
body: file,
|
|
87
|
+
},
|
|
88
|
+
requestBody: {
|
|
89
|
+
name: this.name,
|
|
90
|
+
mimeType: "application/vnd.google-apps.document",
|
|
91
|
+
parents: this.parentId
|
|
92
|
+
? [
|
|
93
|
+
this.parentId,
|
|
94
|
+
]
|
|
95
|
+
: undefined,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
$.export("$summary", `Created file: ${resp.name} (${resp.id})`);
|
|
100
|
+
return resp;
|
|
101
|
+
},
|
|
102
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import googleDrive from "../../google_drive.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "google_drive-get-file",
|
|
5
|
+
name: "Get File",
|
|
6
|
+
description:
|
|
7
|
+
"Get full metadata for a file or folder by its ID."
|
|
8
|
+
+ " Returns name, MIME type, size, parent folders, sharing permissions, web links, creation/modification dates, and more."
|
|
9
|
+
+ " Use **Search Files** first to find the file ID if you only have the file name."
|
|
10
|
+
+ " By default returns all fields. Pass specific field names to `fields` to reduce the response size."
|
|
11
|
+
+ "\n\nCommon fields: `id`, `name`, `mimeType`, `size`, `parents`, `webViewLink`, `webContentLink`,"
|
|
12
|
+
+ " `createdTime`, `modifiedTime`, `owners`, `permissions`, `description`, `trashed`."
|
|
13
|
+
+ " [See the documentation](https://developers.google.com/drive/api/v3/reference/files/get)",
|
|
14
|
+
version: "0.0.1",
|
|
15
|
+
type: "action",
|
|
16
|
+
annotations: {
|
|
17
|
+
destructiveHint: false,
|
|
18
|
+
openWorldHint: true,
|
|
19
|
+
readOnlyHint: true,
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
googleDrive,
|
|
23
|
+
fileId: {
|
|
24
|
+
type: "string",
|
|
25
|
+
label: "File ID",
|
|
26
|
+
description:
|
|
27
|
+
"The ID of the file or folder to retrieve."
|
|
28
|
+
+ " Use **Search Files** to find the file ID by name.",
|
|
29
|
+
},
|
|
30
|
+
fields: {
|
|
31
|
+
type: "string",
|
|
32
|
+
label: "Fields",
|
|
33
|
+
description:
|
|
34
|
+
"Comma-separated list of fields to include in the response."
|
|
35
|
+
+ " Example: `id,name,mimeType,webViewLink,parents,permissions`."
|
|
36
|
+
+ " Omit to return all fields.",
|
|
37
|
+
optional: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
async run({ $ }) {
|
|
41
|
+
const response = await this.googleDrive.getFile(this.fileId, {
|
|
42
|
+
fields: this.fields || "*",
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
$.export("$summary", `Retrieved file: ${response.name}`);
|
|
46
|
+
return response;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import googleDrive from "../../google_drive.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "google_drive-get-user-details",
|
|
5
|
+
name: "Get User Details",
|
|
6
|
+
description:
|
|
7
|
+
"Retrieve the authenticated user's Google Drive identity and storage quota."
|
|
8
|
+
+ " Returns display name, email address, permission ID, and storage usage/limits."
|
|
9
|
+
+ " Use this tool when the user asks 'who am I?' or needs their identity for owner-based queries."
|
|
10
|
+
+ " When the user says 'my files' or 'my documents', call this first to get the owner email,"
|
|
11
|
+
+ " then pass it to **Search Files** with a query like `'user@example.com' in owners`."
|
|
12
|
+
+ " [See the documentation](https://developers.google.com/drive/api/v3/reference/about/get)",
|
|
13
|
+
version: "0.0.1",
|
|
14
|
+
type: "action",
|
|
15
|
+
annotations: {
|
|
16
|
+
destructiveHint: false,
|
|
17
|
+
openWorldHint: true,
|
|
18
|
+
readOnlyHint: true,
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
googleDrive,
|
|
22
|
+
},
|
|
23
|
+
async run({ $ }) {
|
|
24
|
+
const about = await this.googleDrive.getAbout("user,storageQuota");
|
|
25
|
+
|
|
26
|
+
const name =
|
|
27
|
+
about?.user?.displayName
|
|
28
|
+
|| about?.user?.emailAddress
|
|
29
|
+
|| about?.user?.permissionId;
|
|
30
|
+
$.export("$summary", `Retrieved Google Drive user: ${name}`);
|
|
31
|
+
|
|
32
|
+
return about;
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import googleDrive from "../../google_drive.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "google_drive-list-permissions",
|
|
5
|
+
name: "List Permissions",
|
|
6
|
+
description:
|
|
7
|
+
"List sharing permissions on a file or folder in Google Drive."
|
|
8
|
+
+ " Returns each permission's ID, type (user/group/domain/anyone), role (owner/writer/commenter/reader), and email address."
|
|
9
|
+
+ " Use **Search Files** first to find the file ID by name."
|
|
10
|
+
+ " Use this tool when the user asks 'who has access to this file?' or needs to audit sharing."
|
|
11
|
+
+ " Pass permission IDs from this response to **Remove Sharing** to revoke access."
|
|
12
|
+
+ " [See the documentation](https://developers.google.com/drive/api/v3/reference/permissions/list)",
|
|
13
|
+
version: "0.0.1",
|
|
14
|
+
type: "action",
|
|
15
|
+
annotations: {
|
|
16
|
+
destructiveHint: false,
|
|
17
|
+
openWorldHint: true,
|
|
18
|
+
readOnlyHint: true,
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
googleDrive,
|
|
22
|
+
fileId: {
|
|
23
|
+
type: "string",
|
|
24
|
+
label: "File ID",
|
|
25
|
+
description:
|
|
26
|
+
"The ID of the file or folder to list permissions for."
|
|
27
|
+
+ " Use **Search Files** to find the file ID by name.",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
async run({ $ }) {
|
|
31
|
+
const allPermissions = [];
|
|
32
|
+
let pageToken;
|
|
33
|
+
do {
|
|
34
|
+
const {
|
|
35
|
+
permissions = [], nextPageToken,
|
|
36
|
+
} = await this.googleDrive.listPermissions(pageToken, this.fileId);
|
|
37
|
+
allPermissions.push(...permissions);
|
|
38
|
+
pageToken = nextPageToken;
|
|
39
|
+
} while (pageToken);
|
|
40
|
+
|
|
41
|
+
$.export("$summary", `Found ${allPermissions.length} permission${allPermissions.length === 1
|
|
42
|
+
? ""
|
|
43
|
+
: "s"}`);
|
|
44
|
+
return allPermissions;
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import googleDrive from "../../google_drive.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "google_drive-list-shared-drives",
|
|
5
|
+
name: "List Shared Drives",
|
|
6
|
+
description:
|
|
7
|
+
"List shared drives accessible to the authenticated user."
|
|
8
|
+
+ " Returns drive IDs, names, and metadata for each shared drive."
|
|
9
|
+
+ " Use this when the user asks about their shared drives or needs to scope a search to a specific drive."
|
|
10
|
+
+ " Pass a drive ID to **Search Files** `driveId` parameter to search within a specific shared drive."
|
|
11
|
+
+ " Optionally filter by name using the `query` parameter (e.g., `name contains 'Engineering'`)."
|
|
12
|
+
+ " [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/list)",
|
|
13
|
+
version: "0.0.1",
|
|
14
|
+
type: "action",
|
|
15
|
+
annotations: {
|
|
16
|
+
destructiveHint: false,
|
|
17
|
+
openWorldHint: true,
|
|
18
|
+
readOnlyHint: true,
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
googleDrive,
|
|
22
|
+
query: {
|
|
23
|
+
type: "string",
|
|
24
|
+
label: "Query",
|
|
25
|
+
description:
|
|
26
|
+
"Optional. Filter shared drives by name."
|
|
27
|
+
+ " Example: `name contains 'Marketing'`."
|
|
28
|
+
+ " Omit to list all shared drives.",
|
|
29
|
+
optional: true,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
async run({ $ }) {
|
|
33
|
+
const allDrives = [];
|
|
34
|
+
let pageToken;
|
|
35
|
+
do {
|
|
36
|
+
const {
|
|
37
|
+
drives = [], nextPageToken,
|
|
38
|
+
} = await this.googleDrive.searchDrives({
|
|
39
|
+
q: this.query,
|
|
40
|
+
pageToken,
|
|
41
|
+
pageSize: 100,
|
|
42
|
+
});
|
|
43
|
+
allDrives.push(...drives);
|
|
44
|
+
pageToken = nextPageToken;
|
|
45
|
+
} while (pageToken);
|
|
46
|
+
|
|
47
|
+
$.export("$summary", `Found ${allDrives.length} shared drive${allDrives.length === 1
|
|
48
|
+
? ""
|
|
49
|
+
: "s"}`);
|
|
50
|
+
return allDrives;
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import googleDrive from "../../google_drive.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "google_drive-remove-sharing",
|
|
5
|
+
name: "Remove Sharing",
|
|
6
|
+
description:
|
|
7
|
+
"Remove a sharing permission from a file or folder in Google Drive."
|
|
8
|
+
+ " This revokes access for the specified permission."
|
|
9
|
+
+ " Use **List Permissions** first to find the permission ID to remove."
|
|
10
|
+
+ " The owner permission cannot be removed."
|
|
11
|
+
+ " Use **Search Files** to find the file ID by name if needed."
|
|
12
|
+
+ " [See the documentation](https://developers.google.com/drive/api/v3/reference/permissions/delete)",
|
|
13
|
+
version: "0.0.1",
|
|
14
|
+
type: "action",
|
|
15
|
+
annotations: {
|
|
16
|
+
destructiveHint: true,
|
|
17
|
+
openWorldHint: true,
|
|
18
|
+
readOnlyHint: false,
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
googleDrive,
|
|
22
|
+
fileId: {
|
|
23
|
+
type: "string",
|
|
24
|
+
label: "File ID",
|
|
25
|
+
description:
|
|
26
|
+
"The ID of the file or folder to remove the sharing permission from."
|
|
27
|
+
+ " Use **Search Files** to find the file ID by name.",
|
|
28
|
+
},
|
|
29
|
+
permissionId: {
|
|
30
|
+
type: "string",
|
|
31
|
+
label: "Permission ID",
|
|
32
|
+
description:
|
|
33
|
+
"The ID of the permission to remove."
|
|
34
|
+
+ " Use **List Permissions** to find the permission ID.",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
async run({ $ }) {
|
|
38
|
+
await this.googleDrive.deletePermission({
|
|
39
|
+
fileId: this.fileId,
|
|
40
|
+
permissionId: this.permissionId,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
$.export("$summary", `Removed permission ${this.permissionId} from file ${this.fileId}`);
|
|
44
|
+
return {
|
|
45
|
+
success: true,
|
|
46
|
+
fileId: this.fileId,
|
|
47
|
+
permissionId: this.permissionId,
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { getListFilesOpts } from "../../common/utils.mjs";
|
|
2
|
+
import googleDrive from "../../google_drive.app.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "google_drive-search-files",
|
|
6
|
+
name: "Search Files",
|
|
7
|
+
description:
|
|
8
|
+
"Search for files and folders in Google Drive using the Drive query language."
|
|
9
|
+
+ " This is the primary tool for finding files, folders, spreadsheets, forms, and any other Drive item."
|
|
10
|
+
+ " Returns matching files with their IDs, names, MIME types, and parent folder IDs."
|
|
11
|
+
+ "\n\n**Query syntax** — pass a Drive search query string. Examples:"
|
|
12
|
+
+ "\n- Find by name: `name contains 'Budget'`"
|
|
13
|
+
+ "\n- Exact name match: `name = 'Q4 Report'`"
|
|
14
|
+
+ "\n- Folders only: `mimeType = 'application/vnd.google-apps.folder'`"
|
|
15
|
+
+ "\n- Google Docs: `mimeType = 'application/vnd.google-apps.document'`"
|
|
16
|
+
+ "\n- Spreadsheets: `mimeType = 'application/vnd.google-apps.spreadsheet'`"
|
|
17
|
+
+ "\n- Files in a folder: `'FOLDER_ID' in parents`"
|
|
18
|
+
+ "\n- Not trashed: `trashed = false`"
|
|
19
|
+
+ "\n- Modified after date: `modifiedTime > '2024-01-01T00:00:00'`"
|
|
20
|
+
+ "\n- Combine with AND: `name contains 'Report' and mimeType = 'application/vnd.google-apps.document'`"
|
|
21
|
+
+ "\n- Owner filter: `'user@example.com' in owners`"
|
|
22
|
+
+ "\n\nWhen the user says 'my files', use **Get User Details** first to get the owner email."
|
|
23
|
+
+ " To scope to a shared drive, pass the `driveId` from **List Shared Drives**."
|
|
24
|
+
+ " [See the documentation](https://developers.google.com/drive/api/v3/search-files)",
|
|
25
|
+
version: "0.0.1",
|
|
26
|
+
type: "action",
|
|
27
|
+
annotations: {
|
|
28
|
+
destructiveHint: false,
|
|
29
|
+
openWorldHint: true,
|
|
30
|
+
readOnlyHint: true,
|
|
31
|
+
},
|
|
32
|
+
props: {
|
|
33
|
+
googleDrive,
|
|
34
|
+
query: {
|
|
35
|
+
type: "string",
|
|
36
|
+
label: "Query",
|
|
37
|
+
description:
|
|
38
|
+
"A Drive search query string. See the tool description for syntax examples."
|
|
39
|
+
+ " Common queries: `name contains 'keyword'`, `mimeType = 'application/vnd.google-apps.folder'`,"
|
|
40
|
+
+ " `'FOLDER_ID' in parents`, `trashed = false`.",
|
|
41
|
+
},
|
|
42
|
+
driveId: {
|
|
43
|
+
type: "string",
|
|
44
|
+
label: "Drive ID",
|
|
45
|
+
description:
|
|
46
|
+
"Optional. Scope the search to a specific shared drive."
|
|
47
|
+
+ " Use **List Shared Drives** to find available drive IDs."
|
|
48
|
+
+ " Omit to search My Drive.",
|
|
49
|
+
optional: true,
|
|
50
|
+
},
|
|
51
|
+
includeItemsFromAllDrives: {
|
|
52
|
+
type: "boolean",
|
|
53
|
+
label: "Include Items From All Drives",
|
|
54
|
+
description:
|
|
55
|
+
"If true, include results from all drives (My Drive and shared drives)."
|
|
56
|
+
+ " Defaults to false.",
|
|
57
|
+
optional: true,
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
async run({ $ }) {
|
|
62
|
+
const opts = getListFilesOpts(this.driveId, {
|
|
63
|
+
q: this.query,
|
|
64
|
+
includeItemsFromAllDrives: this.includeItemsFromAllDrives,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const allFiles = [];
|
|
68
|
+
let pageToken;
|
|
69
|
+
do {
|
|
70
|
+
const {
|
|
71
|
+
files, nextPageToken,
|
|
72
|
+
} = await this.googleDrive.listFilesInPage(pageToken, opts);
|
|
73
|
+
allFiles.push(...files);
|
|
74
|
+
pageToken = nextPageToken;
|
|
75
|
+
} while (pageToken);
|
|
76
|
+
|
|
77
|
+
$.export("$summary", `Found ${allFiles.length} file${allFiles.length === 1
|
|
78
|
+
? ""
|
|
79
|
+
: "s"} matching query "${this.query}"`);
|
|
80
|
+
return allFiles;
|
|
81
|
+
},
|
|
82
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import googleDrive from "../../google_drive.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "google_drive-share-file",
|
|
5
|
+
name: "Share File",
|
|
6
|
+
description:
|
|
7
|
+
"Share a file or folder in Google Drive by creating a sharing permission."
|
|
8
|
+
+ " Supports sharing with a specific user, a group, an entire domain, or anyone with the link."
|
|
9
|
+
+ " Use **Search Files** first to find the file ID by name."
|
|
10
|
+
+ "\n\n**Sharing types:**"
|
|
11
|
+
+ "\n- `user` — share with a specific person (requires `emailAddress`)"
|
|
12
|
+
+ "\n- `group` — share with a Google Group (requires `emailAddress`)"
|
|
13
|
+
+ "\n- `domain` — share with everyone in a Google Workspace domain (requires `domain`)"
|
|
14
|
+
+ "\n- `anyone` — share with anyone who has the link (no email/domain needed)"
|
|
15
|
+
+ "\n\n**Roles:** `reader` (view only), `commenter` (can comment), `writer` (can edit)."
|
|
16
|
+
+ " Use **List Permissions** to see existing sharing on a file."
|
|
17
|
+
+ " [See the documentation](https://developers.google.com/drive/api/v3/reference/permissions/create)",
|
|
18
|
+
version: "0.0.1",
|
|
19
|
+
type: "action",
|
|
20
|
+
annotations: {
|
|
21
|
+
destructiveHint: false,
|
|
22
|
+
openWorldHint: true,
|
|
23
|
+
readOnlyHint: false,
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
googleDrive,
|
|
27
|
+
fileId: {
|
|
28
|
+
type: "string",
|
|
29
|
+
label: "File ID",
|
|
30
|
+
description:
|
|
31
|
+
"The ID of the file or folder to share."
|
|
32
|
+
+ " Use **Search Files** to find the file ID by name.",
|
|
33
|
+
},
|
|
34
|
+
type: {
|
|
35
|
+
type: "string",
|
|
36
|
+
label: "Type",
|
|
37
|
+
description:
|
|
38
|
+
"The type of grantee: `user`, `group`, `domain`, or `anyone`.",
|
|
39
|
+
options: [
|
|
40
|
+
"user",
|
|
41
|
+
"group",
|
|
42
|
+
"domain",
|
|
43
|
+
"anyone",
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
role: {
|
|
47
|
+
type: "string",
|
|
48
|
+
label: "Role",
|
|
49
|
+
description:
|
|
50
|
+
"The access level to grant: `reader` (view), `commenter` (comment), or `writer` (edit).",
|
|
51
|
+
options: [
|
|
52
|
+
"reader",
|
|
53
|
+
"commenter",
|
|
54
|
+
"writer",
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
emailAddress: {
|
|
58
|
+
type: "string",
|
|
59
|
+
label: "Email Address",
|
|
60
|
+
description:
|
|
61
|
+
"The email address of the user or group to share with."
|
|
62
|
+
+ " Required when type is `user` or `group`. Ignored for `domain` and `anyone`.",
|
|
63
|
+
optional: true,
|
|
64
|
+
},
|
|
65
|
+
domain: {
|
|
66
|
+
type: "string",
|
|
67
|
+
label: "Domain",
|
|
68
|
+
description:
|
|
69
|
+
"The Google Workspace domain to share with (e.g., `example.com`)."
|
|
70
|
+
+ " Required when type is `domain`. Ignored for other types.",
|
|
71
|
+
optional: true,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
async run({ $ }) {
|
|
75
|
+
const resp = await this.googleDrive.createPermission(this.fileId, {
|
|
76
|
+
role: this.role,
|
|
77
|
+
type: this.type,
|
|
78
|
+
emailAddress: this.emailAddress,
|
|
79
|
+
domain: this.domain,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const target = this.emailAddress || this.domain || this.type;
|
|
83
|
+
$.export("$summary", `Shared file with ${target} as ${this.role}`);
|
|
84
|
+
return resp;
|
|
85
|
+
},
|
|
86
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import googleDrive from "../../google_drive.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "google_drive-trash-file",
|
|
5
|
+
name: "Trash File",
|
|
6
|
+
description:
|
|
7
|
+
"Move a file or folder to the trash in Google Drive."
|
|
8
|
+
+ " This is a reversible operation — the file can be restored from trash within 30 days."
|
|
9
|
+
+ " Use **Search Files** first to find the file ID by name."
|
|
10
|
+
+ " Use this instead of permanent deletion as the safer default."
|
|
11
|
+
+ " To find trashed files, use **Search Files** with `trashed = true`."
|
|
12
|
+
+ " [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update)",
|
|
13
|
+
version: "0.0.1",
|
|
14
|
+
type: "action",
|
|
15
|
+
annotations: {
|
|
16
|
+
destructiveHint: true,
|
|
17
|
+
openWorldHint: true,
|
|
18
|
+
readOnlyHint: false,
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
googleDrive,
|
|
22
|
+
fileId: {
|
|
23
|
+
type: "string",
|
|
24
|
+
label: "File ID",
|
|
25
|
+
description:
|
|
26
|
+
"The ID of the file or folder to move to trash."
|
|
27
|
+
+ " Use **Search Files** to find the file ID by name.",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
async run({ $ }) {
|
|
31
|
+
const resp = await this.googleDrive.updateFile(this.fileId, {
|
|
32
|
+
requestBody: {
|
|
33
|
+
trashed: true,
|
|
34
|
+
},
|
|
35
|
+
fields: "*",
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
$.export("$summary", `Moved to trash: ${resp.name} (${resp.id})`);
|
|
39
|
+
return resp;
|
|
40
|
+
},
|
|
41
|
+
};
|
package/google_drive.app.mjs
CHANGED
|
@@ -156,6 +156,15 @@ export default {
|
|
|
156
156
|
optional: true,
|
|
157
157
|
default: false,
|
|
158
158
|
},
|
|
159
|
+
changesPageSize: {
|
|
160
|
+
type: "integer",
|
|
161
|
+
label: "Changes Page Size",
|
|
162
|
+
description: "Maximum number of changes to fetch per API call (1-1000). Lower values reduce memory usage and the risk of execution timeouts or out-of-memory errors on active drives.",
|
|
163
|
+
min: 1,
|
|
164
|
+
max: 1000,
|
|
165
|
+
default: 100,
|
|
166
|
+
optional: true,
|
|
167
|
+
},
|
|
159
168
|
filePath: {
|
|
160
169
|
type: "string",
|
|
161
170
|
label: "File Path or URL",
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@ export default {
|
|
|
14
14
|
key: "google_drive-changes-to-files-in-drive",
|
|
15
15
|
name: "Changes to Files in Drive",
|
|
16
16
|
description: "Emit new event when a change is made to one of the specified files. [See the documentation](https://developers.google.com/drive/api/v3/reference/changes/watch)",
|
|
17
|
-
version: "0.0.
|
|
17
|
+
version: "0.0.11",
|
|
18
18
|
type: "source",
|
|
19
19
|
dedupe: "unique",
|
|
20
20
|
props: {
|
|
@@ -132,8 +132,6 @@ export default {
|
|
|
132
132
|
},
|
|
133
133
|
async processChanges(changedFiles, headers) {
|
|
134
134
|
console.log(`Processing ${changedFiles.length} changed files`);
|
|
135
|
-
console.log(`Changed files: ${JSON.stringify(changedFiles, null, 2)}!!!`);
|
|
136
|
-
console.log(`Files: ${this.files}!!!`);
|
|
137
135
|
|
|
138
136
|
const filteredFiles = this.checkMinimumInterval(changedFiles);
|
|
139
137
|
for (const file of filteredFiles) {
|
package/sources/changes-to-specific-files-shared-drive/changes-to-specific-files-shared-drive.mjs
CHANGED
|
@@ -29,7 +29,7 @@ export default {
|
|
|
29
29
|
key: "google_drive-changes-to-specific-files-shared-drive",
|
|
30
30
|
name: "Changes to Specific Files (Shared Drive)",
|
|
31
31
|
description: "Watches for changes to specific files in a shared drive, emitting an event when a change is made to one of those files",
|
|
32
|
-
version: "0.3.
|
|
32
|
+
version: "0.3.11",
|
|
33
33
|
type: "source",
|
|
34
34
|
// Dedupe events based on the "x-goog-message-number" header for the target channel:
|
|
35
35
|
// https://developers.google.com/drive/api/v3/push#making-watch-requests
|
|
@@ -137,8 +137,6 @@ export default {
|
|
|
137
137
|
},
|
|
138
138
|
async processChanges(changedFiles, headers) {
|
|
139
139
|
console.log(`Processing ${changedFiles.length} changed files`);
|
|
140
|
-
console.log(`Changed files: ${JSON.stringify(changedFiles, null, 2)}!!!`);
|
|
141
|
-
console.log(`Files: ${this.files}!!!`);
|
|
142
140
|
|
|
143
141
|
const filteredFiles = this.checkMinimumInterval(changedFiles);
|
|
144
142
|
for (const file of filteredFiles) {
|
|
@@ -33,11 +33,10 @@ export default {
|
|
|
33
33
|
hidden: true,
|
|
34
34
|
},
|
|
35
35
|
changesPageSize: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
optional: true,
|
|
36
|
+
propDefinition: [
|
|
37
|
+
googleDrive,
|
|
38
|
+
"changesPageSize",
|
|
39
|
+
],
|
|
41
40
|
},
|
|
42
41
|
},
|
|
43
42
|
hooks: {
|
|
@@ -11,7 +11,7 @@ export default {
|
|
|
11
11
|
key: "google_drive-new-files-instant",
|
|
12
12
|
name: "New Files (Instant)",
|
|
13
13
|
description: "Emit new event when a new file is added in your linked Google Drive",
|
|
14
|
-
version: "0.2.
|
|
14
|
+
version: "0.2.11",
|
|
15
15
|
type: "source",
|
|
16
16
|
dedupe: "unique",
|
|
17
17
|
props: {
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
key: "google_drive-new-files-instant-polling",
|
|
9
9
|
name: "New Files (Polling)",
|
|
10
10
|
description: "Emit new event when a new file is added in your linked Google Drive",
|
|
11
|
-
version: "0.0.
|
|
11
|
+
version: "0.0.9",
|
|
12
12
|
type: "source",
|
|
13
13
|
dedupe: "unique",
|
|
14
14
|
props: {
|
|
@@ -46,11 +46,10 @@ export default {
|
|
|
46
46
|
default: [],
|
|
47
47
|
},
|
|
48
48
|
changesPageSize: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
optional: true,
|
|
49
|
+
propDefinition: [
|
|
50
|
+
googleDrive,
|
|
51
|
+
"changesPageSize",
|
|
52
|
+
],
|
|
54
53
|
},
|
|
55
54
|
},
|
|
56
55
|
hooks: {
|
|
@@ -151,7 +150,6 @@ export default {
|
|
|
151
150
|
this.googleDrive.listChanges(pageToken, driveId, this.changesPageSize);
|
|
152
151
|
|
|
153
152
|
for await (const changedFilesPage of changedFilesStream) {
|
|
154
|
-
console.log("Changed files page:", changedFilesPage);
|
|
155
153
|
const {
|
|
156
154
|
changedFiles,
|
|
157
155
|
nextPageToken,
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
key: "google_drive-new-files-shared-drive",
|
|
8
8
|
name: "New Files (Shared Drive)",
|
|
9
9
|
description: "Emit new event when a new file is added in your shared Google Drive",
|
|
10
|
-
version: "0.1.
|
|
10
|
+
version: "0.1.11",
|
|
11
11
|
type: "source",
|
|
12
12
|
dedupe: "unique",
|
|
13
13
|
props: {
|
|
@@ -50,11 +50,10 @@ export default {
|
|
|
50
50
|
optional: true,
|
|
51
51
|
},
|
|
52
52
|
changesPageSize: {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
optional: true,
|
|
53
|
+
propDefinition: [
|
|
54
|
+
googleDrive,
|
|
55
|
+
"changesPageSize",
|
|
56
|
+
],
|
|
58
57
|
},
|
|
59
58
|
},
|
|
60
59
|
hooks: {
|
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
name: "New or Modified Comments (Instant)",
|
|
19
19
|
description:
|
|
20
20
|
"Emit new event when a comment is created or modified in the selected file",
|
|
21
|
-
version: "1.0.
|
|
21
|
+
version: "1.0.20",
|
|
22
22
|
type: "source",
|
|
23
23
|
// Dedupe events based on the "x-goog-message-number" header for the target channel:
|
|
24
24
|
// https://developers.google.com/drive/api/v3/push#making-watch-requests
|
|
@@ -26,7 +26,7 @@ export default {
|
|
|
26
26
|
key: "google_drive-new-or-modified-files",
|
|
27
27
|
name: "New or Modified Files (Instant)",
|
|
28
28
|
description: "Emit new event when a file in the selected Drive is created, modified or trashed.",
|
|
29
|
-
version: "0.4.
|
|
29
|
+
version: "0.4.11",
|
|
30
30
|
type: "source",
|
|
31
31
|
// Dedupe events based on the "x-goog-message-number" header for the target channel:
|
|
32
32
|
// https://developers.google.com/drive/api/v3/push#making-watch-requests
|
|
@@ -155,8 +155,6 @@ export default {
|
|
|
155
155
|
fields: "parents",
|
|
156
156
|
})).parents;
|
|
157
157
|
|
|
158
|
-
console.log(file); // see what file was processed
|
|
159
|
-
|
|
160
158
|
if (!this.shouldProcess(file)) {
|
|
161
159
|
console.log(`Skipping file ${file.name}`);
|
|
162
160
|
continue;
|
|
@@ -9,7 +9,7 @@ export default {
|
|
|
9
9
|
key: "google_drive-new-or-modified-files-polling",
|
|
10
10
|
name: "New or Modified Files (Polling)",
|
|
11
11
|
description: "Emit new event when a file in the selected Drive is created, modified or trashed. [See the documentation](https://developers.google.com/drive/api/v3/reference/changes/list)",
|
|
12
|
-
version: "0.0.
|
|
12
|
+
version: "0.0.11",
|
|
13
13
|
type: "source",
|
|
14
14
|
dedupe: "unique",
|
|
15
15
|
props: {
|
|
@@ -67,11 +67,10 @@ export default {
|
|
|
67
67
|
optional: true,
|
|
68
68
|
},
|
|
69
69
|
changesPageSize: {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
optional: true,
|
|
70
|
+
propDefinition: [
|
|
71
|
+
googleDrive,
|
|
72
|
+
"changesPageSize",
|
|
73
|
+
],
|
|
75
74
|
},
|
|
76
75
|
},
|
|
77
76
|
hooks: {
|
|
@@ -189,7 +188,6 @@ export default {
|
|
|
189
188
|
this.googleDrive.listChanges(pageToken, driveId, this.changesPageSize);
|
|
190
189
|
|
|
191
190
|
for await (const changedFilesPage of changedFilesStream) {
|
|
192
|
-
console.log("Changed files page:", changedFilesPage);
|
|
193
191
|
const {
|
|
194
192
|
changedFiles,
|
|
195
193
|
nextPageToken,
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
key: "google_drive-new-or-modified-folders",
|
|
22
22
|
name: "New or Modified Folders (Instant)",
|
|
23
23
|
description: "Emit new event when a folder is created or modified in the selected Drive",
|
|
24
|
-
version: "0.2.
|
|
24
|
+
version: "0.2.14",
|
|
25
25
|
type: "source",
|
|
26
26
|
// Dedupe events based on the "x-goog-message-number" header for the target channel:
|
|
27
27
|
// https://developers.google.com/drive/api/v3/push#making-watch-requests
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
key: "google_drive-new-or-modified-folders-polling",
|
|
13
13
|
name: "New or Modified Folders (Polling)",
|
|
14
14
|
description: "Emit new event when a folder is created or modified in the selected Drive",
|
|
15
|
-
version: "0.0.
|
|
15
|
+
version: "0.0.10",
|
|
16
16
|
type: "source",
|
|
17
17
|
dedupe: "unique",
|
|
18
18
|
props: {
|
|
@@ -51,11 +51,10 @@ export default {
|
|
|
51
51
|
optional: true,
|
|
52
52
|
},
|
|
53
53
|
changesPageSize: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
optional: true,
|
|
54
|
+
propDefinition: [
|
|
55
|
+
googleDrive,
|
|
56
|
+
"changesPageSize",
|
|
57
|
+
],
|
|
59
58
|
},
|
|
60
59
|
},
|
|
61
60
|
hooks: {
|
|
@@ -192,7 +191,6 @@ export default {
|
|
|
192
191
|
this.googleDrive.listChanges(pageToken, driveId, this.changesPageSize);
|
|
193
192
|
|
|
194
193
|
for await (const changedFilesPage of changedFilesStream) {
|
|
195
|
-
console.log("Changed files page:", changedFilesPage);
|
|
196
194
|
const {
|
|
197
195
|
changedFiles,
|
|
198
196
|
nextPageToken,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
key: "google_drive-new-spreadsheet-polling",
|
|
9
9
|
name: "New Spreadsheet (Polling)",
|
|
10
10
|
description: "Emit new event when a new spreadsheet is created in a drive.",
|
|
11
|
-
version: "0.0.
|
|
11
|
+
version: "0.0.9",
|
|
12
12
|
type: "source",
|
|
13
13
|
dedupe: "unique",
|
|
14
14
|
props: {
|
|
@@ -45,11 +45,10 @@ export default {
|
|
|
45
45
|
optional: true,
|
|
46
46
|
},
|
|
47
47
|
changesPageSize: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
optional: true,
|
|
48
|
+
propDefinition: [
|
|
49
|
+
googleDrive,
|
|
50
|
+
"changesPageSize",
|
|
51
|
+
],
|
|
53
52
|
},
|
|
54
53
|
},
|
|
55
54
|
hooks: {
|
|
@@ -149,7 +148,6 @@ export default {
|
|
|
149
148
|
this.googleDrive.listChanges(pageToken, driveId, this.changesPageSize);
|
|
150
149
|
|
|
151
150
|
for await (const changedFilesPage of changedFilesStream) {
|
|
152
|
-
console.log("Changed files page:", changedFilesPage);
|
|
153
151
|
const {
|
|
154
152
|
changedFiles,
|
|
155
153
|
nextPageToken,
|