@pipedream/google_drive 0.7.2 → 0.8.0
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/add-file-sharing-preference/add-file-sharing-preference.mjs +30 -8
- package/actions/copy-file/copy-file.mjs +2 -2
- package/actions/create-file-from-template/create-file-from-template.mjs +3 -3
- package/actions/create-file-from-text/create-file-from-text.mjs +3 -2
- package/actions/create-folder/create-folder.mjs +3 -2
- package/actions/create-shared-drive/create-shared-drive.mjs +1 -2
- package/actions/delete-file/delete-file.mjs +10 -3
- package/actions/delete-shared-drive/delete-shared-drive.mjs +7 -5
- package/actions/download-file/download-file.mjs +11 -6
- package/actions/find-file/find-file.mjs +8 -10
- package/actions/find-folder/find-folder.mjs +2 -2
- package/actions/find-forms/find-forms.mjs +22 -18
- package/actions/find-spreadsheets/find-spreadsheets.mjs +21 -18
- package/actions/get-file-by-id/common-file-fields.mjs +293 -0
- package/actions/get-file-by-id/get-file-by-id.mjs +56 -0
- package/actions/get-folder-id-for-path/get-folder-id-for-path.mjs +1 -1
- package/actions/get-shared-drive/get-shared-drive.mjs +8 -8
- package/actions/list-files/list-files.mjs +3 -3
- package/actions/move-file/move-file.mjs +2 -2
- package/actions/move-file-to-trash/move-file-to-trash.mjs +7 -2
- package/actions/search-shared-drives/search-shared-drives.mjs +1 -1
- package/actions/update-file/update-file.mjs +9 -7
- package/actions/update-shared-drive/update-shared-drive.mjs +11 -11
- package/actions/upload-file/upload-file.mjs +12 -4
- package/common/commonSearchQuery.mjs +48 -0
- package/common/constants.mjs +27 -22
- package/google_drive.app.mjs +41 -16
- package/package.json +1 -1
- package/sources/changes-to-specific-files/changes-to-specific-files.mjs +2 -3
- package/sources/changes-to-specific-files-shared-drive/changes-to-specific-files-shared-drive.mjs +1 -1
- package/sources/new-files-instant/new-files-instant.mjs +1 -1
- 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 -1
- package/sources/new-or-modified-folders/new-or-modified-folders.mjs +1 -1
- package/sources/new-shared-drive/new-shared-drive.mjs +1 -1
- package/sources/new-spreadsheet/new-spreadsheet.mjs +1 -1
- package/actions/create-file/create-file.mjs +0 -242
- package/actions/replace-file/replace-file.mjs +0 -134
@@ -0,0 +1,293 @@
|
|
1
|
+
/* eslint-disable max-len */
|
2
|
+
export const FILE_FIELD_OPTIONS = [
|
3
|
+
{
|
4
|
+
label:
|
5
|
+
"\"kind\" - Identifies what kind of resource this is. Value: the fixed string \"drive#file\".",
|
6
|
+
value: "kind",
|
7
|
+
},
|
8
|
+
{
|
9
|
+
label:
|
10
|
+
"\"driveId\" - ID of the shared drive the file resides in. Only populated for items in shared drives.",
|
11
|
+
value: "driveId",
|
12
|
+
},
|
13
|
+
{
|
14
|
+
label:
|
15
|
+
"\"fileExtension\" - The final component of fullFileExtension. This is only available for files with binary content in Google Drive.",
|
16
|
+
value: "fileExtension",
|
17
|
+
},
|
18
|
+
{
|
19
|
+
label:
|
20
|
+
"\"copyRequiresWriterPermission\" - Whether the options to copy, print, or download this file, should be disabled for readers and commenters.",
|
21
|
+
value: "copyRequiresWriterPermission",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
label:
|
25
|
+
"\"md5Checksum\" - The MD5 checksum for the content of the file. This is only applicable to files with binary content in Google Drive.",
|
26
|
+
value: "md5Checksum",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
label:
|
30
|
+
"\"contentHints\" - Additional information about the content of the file. These fields are never populated in responses.",
|
31
|
+
value: "contentHints",
|
32
|
+
},
|
33
|
+
{
|
34
|
+
label:
|
35
|
+
"\"writersCanShare\" - Whether users with only writer permission can modify the file's permissions. Not populated for items in shared drives.",
|
36
|
+
value: "writersCanShare",
|
37
|
+
},
|
38
|
+
{
|
39
|
+
label: "\"viewedByMe\" - Whether the file has been viewed by this user.",
|
40
|
+
value: "viewedByMe",
|
41
|
+
},
|
42
|
+
{
|
43
|
+
label:
|
44
|
+
"\"mimeType\" - The MIME type of the file. Google Drive attempts to automatically detect an appropriate value from uploaded content, if no value is provided.",
|
45
|
+
value: "mimeType",
|
46
|
+
},
|
47
|
+
{
|
48
|
+
label:
|
49
|
+
"\"exportLinks\" - Links for exporting Docs Editors files to specific formats.",
|
50
|
+
value: "exportLinks",
|
51
|
+
},
|
52
|
+
{
|
53
|
+
label:
|
54
|
+
"\"parents\" - The IDs of the parent folders which contain the file.",
|
55
|
+
value: "parents",
|
56
|
+
},
|
57
|
+
{
|
58
|
+
label:
|
59
|
+
"\"thumbnailLink\" - A short-lived link to the file's thumbnail, if available.",
|
60
|
+
value: "thumbnailLink",
|
61
|
+
},
|
62
|
+
{
|
63
|
+
label: "\"iconLink\" - A static, unauthenticated link to the file's icon.",
|
64
|
+
value: "iconLink",
|
65
|
+
},
|
66
|
+
{
|
67
|
+
label:
|
68
|
+
"\"shared\" - Whether the file has been shared. Not populated for items in shared drives.",
|
69
|
+
value: "shared",
|
70
|
+
},
|
71
|
+
{
|
72
|
+
label: "\"lastModifyingUser\" - The last user to modify the file.",
|
73
|
+
value: "lastModifyingUser",
|
74
|
+
},
|
75
|
+
{
|
76
|
+
label:
|
77
|
+
"\"owners\" - The owner of this file. Only certain legacy files may have more than one owner. This field isn't populated for items in shared drives.",
|
78
|
+
value: "owners",
|
79
|
+
},
|
80
|
+
{
|
81
|
+
label:
|
82
|
+
"\"headRevisionId\" - The ID of the file's head revision. This is currently only available for files with binary content in Google Drive.",
|
83
|
+
value: "headRevisionId",
|
84
|
+
},
|
85
|
+
{
|
86
|
+
label:
|
87
|
+
"\"sharingUser\" - The user who shared the file with the requesting user, if applicable.",
|
88
|
+
value: "sharingUser",
|
89
|
+
},
|
90
|
+
{
|
91
|
+
label:
|
92
|
+
"\"webViewLink\" - A link for opening the file in a relevant Google editor or viewer in a browser.",
|
93
|
+
value: "webViewLink",
|
94
|
+
},
|
95
|
+
{
|
96
|
+
label:
|
97
|
+
"\"webContentLink\" - A link for downloading the content of the file in a browser. This is only available for files with binary content in Google Drive.",
|
98
|
+
value: "webContentLink",
|
99
|
+
},
|
100
|
+
{
|
101
|
+
label:
|
102
|
+
"\"size\" - Size in bytes of blobs and first party editor files. Won't be populated for files that have no size, like shortcuts and folders.",
|
103
|
+
value: "size",
|
104
|
+
},
|
105
|
+
{
|
106
|
+
label:
|
107
|
+
"\"permissions\" - The full list of permissions for the file. This is only available if the requesting user can share the file.",
|
108
|
+
value: "permissions",
|
109
|
+
},
|
110
|
+
{
|
111
|
+
label:
|
112
|
+
"\"hasThumbnail\" - Whether this file has a thumbnail. This does not indicate whether the requesting app has access to the thumbnail.",
|
113
|
+
value: "hasThumbnail",
|
114
|
+
},
|
115
|
+
{
|
116
|
+
label: "\"spaces\" - The list of spaces which contain the file.",
|
117
|
+
value: "spaces",
|
118
|
+
},
|
119
|
+
{
|
120
|
+
label:
|
121
|
+
"\"folderColorRgb\" - The color for a folder or a shortcut to a folder as an RGB hex string.",
|
122
|
+
value: "folderColorRgb",
|
123
|
+
},
|
124
|
+
{
|
125
|
+
label: "\"id\" - The ID of the file.",
|
126
|
+
value: "id",
|
127
|
+
},
|
128
|
+
{
|
129
|
+
label:
|
130
|
+
"\"name\" - The name of the file. This is not necessarily unique within a folder.",
|
131
|
+
value: "name",
|
132
|
+
},
|
133
|
+
{
|
134
|
+
label: "\"description\" - A short description of the file.",
|
135
|
+
value: "description",
|
136
|
+
},
|
137
|
+
{
|
138
|
+
label: "\"starred\" - Whether the user has starred the file.",
|
139
|
+
value: "starred",
|
140
|
+
},
|
141
|
+
{
|
142
|
+
label:
|
143
|
+
"\"trashed\" - Whether the file has been trashed, either explicitly or from a trashed parent folder.",
|
144
|
+
value: "trashed",
|
145
|
+
},
|
146
|
+
{
|
147
|
+
label:
|
148
|
+
"\"explicitlyTrashed\" - Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder.",
|
149
|
+
value: "explicitlyTrashed",
|
150
|
+
},
|
151
|
+
{
|
152
|
+
label:
|
153
|
+
"\"createdTime\" - The time at which the file was created (RFC 3339 date-time).",
|
154
|
+
value: "createdTime",
|
155
|
+
},
|
156
|
+
{
|
157
|
+
label:
|
158
|
+
"\"modifiedTime\" - The last time the file was modified by anyone (RFC 3339 date-time).",
|
159
|
+
value: "modifiedTime",
|
160
|
+
},
|
161
|
+
{
|
162
|
+
label:
|
163
|
+
"\"modifiedByMeTime\" - The last time the file was modified by the user (RFC 3339 date-time).",
|
164
|
+
value: "modifiedByMeTime",
|
165
|
+
},
|
166
|
+
{
|
167
|
+
label:
|
168
|
+
"\"viewedByMeTime\" - The last time the file was viewed by the user (RFC 3339 date-time).",
|
169
|
+
value: "viewedByMeTime",
|
170
|
+
},
|
171
|
+
{
|
172
|
+
label:
|
173
|
+
"\"sharedWithMeTime\" - The time at which the file was shared with the user, if applicable (RFC 3339 date-time).",
|
174
|
+
value: "sharedWithMeTime",
|
175
|
+
},
|
176
|
+
{
|
177
|
+
label:
|
178
|
+
"\"quotaBytesUsed\" - The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.",
|
179
|
+
value: "quotaBytesUsed",
|
180
|
+
},
|
181
|
+
{
|
182
|
+
label:
|
183
|
+
"\"version\" - A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the user.",
|
184
|
+
value: "version",
|
185
|
+
},
|
186
|
+
{
|
187
|
+
label:
|
188
|
+
"\"originalFilename\" - The original filename of the uploaded content if available, or else the original value of the name field. This is only available for files with binary content in Google Drive.",
|
189
|
+
value: "originalFilename",
|
190
|
+
},
|
191
|
+
{
|
192
|
+
label:
|
193
|
+
"\"ownedByMe\" - Whether the user owns the file. Not populated for items in shared drives.",
|
194
|
+
value: "ownedByMe",
|
195
|
+
},
|
196
|
+
{
|
197
|
+
label:
|
198
|
+
"\"fullFileExtension\" - The full file extension extracted from the name field. May contain multiple concatenated extensions, such as \"tar.gz\". This is only available for files with binary content in Google Drive.",
|
199
|
+
value: "fullFileExtension",
|
200
|
+
},
|
201
|
+
{
|
202
|
+
label:
|
203
|
+
"\"properties\" - A collection of arbitrary key-value pairs which are visible to all apps.Entries with null values are cleared in update and copy requests.",
|
204
|
+
value: "properties",
|
205
|
+
},
|
206
|
+
{
|
207
|
+
label:
|
208
|
+
"\"appProperties\" - A collection of arbitrary key-value pairs which are private to the requesting app.",
|
209
|
+
value: "appProperties",
|
210
|
+
},
|
211
|
+
{
|
212
|
+
label:
|
213
|
+
"\"isAppAuthorized\" - Whether the file was created or opened by the requesting app.",
|
214
|
+
value: "isAppAuthorized",
|
215
|
+
},
|
216
|
+
{
|
217
|
+
label:
|
218
|
+
"\"capabilities\" - Capabilities the current user has on this file. Each capability corresponds to a fine-grained action that a user may take.",
|
219
|
+
value: "capabilities",
|
220
|
+
},
|
221
|
+
{
|
222
|
+
label:
|
223
|
+
"\"hasAugmentedPermissions\" - Whether there are permissions directly on this file. This field is only populated for items in shared drives.",
|
224
|
+
value: "hasAugmentedPermissions",
|
225
|
+
},
|
226
|
+
{
|
227
|
+
label:
|
228
|
+
"\"trashingUser\" - If the file has been explicitly trashed, the user who trashed it. Only populated for items in shared drives.",
|
229
|
+
value: "trashingUser",
|
230
|
+
},
|
231
|
+
{
|
232
|
+
label:
|
233
|
+
"\"thumbnailVersion\" - The thumbnail version for use in thumbnail cache invalidation.",
|
234
|
+
value: "thumbnailVersion",
|
235
|
+
},
|
236
|
+
{
|
237
|
+
label:
|
238
|
+
"\"trashedTime\" - The time that the item was trashed (RFC 3339 date-time). Only populated for items in shared drives.",
|
239
|
+
value: "trashedTime",
|
240
|
+
},
|
241
|
+
{
|
242
|
+
label: "\"modifiedByMe\" - Whether the file has been modified by this user.",
|
243
|
+
value: "modifiedByMe",
|
244
|
+
},
|
245
|
+
{
|
246
|
+
label:
|
247
|
+
"\"permissionIds\" - files.list of permission IDs for users with access to this file.",
|
248
|
+
value: "permissionIds",
|
249
|
+
},
|
250
|
+
{
|
251
|
+
label:
|
252
|
+
"\"imageMediaMetadata\" - Additional metadata about image media, if available.",
|
253
|
+
value: "imageMediaMetadata",
|
254
|
+
},
|
255
|
+
{
|
256
|
+
label:
|
257
|
+
"\"videoMediaMetadata\" - Additional metadata about video media. This may not be available immediately upon upload.",
|
258
|
+
value: "videoMediaMetadata",
|
259
|
+
},
|
260
|
+
{
|
261
|
+
label:
|
262
|
+
"\"shortcutDetails\" - Shortcut file details. Only populated for shortcut files.",
|
263
|
+
value: "shortcutDetails",
|
264
|
+
},
|
265
|
+
{
|
266
|
+
label:
|
267
|
+
"\"contentRestrictions\" - Restrictions for accessing the content of the file. Only populated if such a restriction exists.",
|
268
|
+
value: "contentRestrictions",
|
269
|
+
},
|
270
|
+
{
|
271
|
+
label: "\"resourceKey\" - A key needed to access the item via a shared link.",
|
272
|
+
value: "resourceKey",
|
273
|
+
},
|
274
|
+
{
|
275
|
+
label:
|
276
|
+
"\"linkShareMetadata\" - LinkShare related details. Contains details about the link URLs that clients are using to refer to this item.",
|
277
|
+
value: "linkShareMetadata",
|
278
|
+
},
|
279
|
+
{
|
280
|
+
label: "\"labelInfo\" - An overview of the labels on the file.",
|
281
|
+
value: "labelInfo",
|
282
|
+
},
|
283
|
+
{
|
284
|
+
label:
|
285
|
+
"\"sha1Checksum\" - The SHA1 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive.",
|
286
|
+
value: "sha1Checksum",
|
287
|
+
},
|
288
|
+
{
|
289
|
+
label:
|
290
|
+
"\"sha256Checksum\" - The SHA256 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive.",
|
291
|
+
value: "sha256Checksum",
|
292
|
+
},
|
293
|
+
];
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import googleDrive from "../../google_drive.app.mjs";
|
2
|
+
import { FILE_FIELD_OPTIONS } from "./common-file-fields.mjs";
|
3
|
+
|
4
|
+
export default {
|
5
|
+
key: "google_drive-get-file-by-id",
|
6
|
+
name: "Get File By ID",
|
7
|
+
description: "Get info on a specific file. [See the documentation](https://developers.google.com/drive/api/reference/rest/v3/files/get) for more information",
|
8
|
+
version: "0.0.2",
|
9
|
+
type: "action",
|
10
|
+
props: {
|
11
|
+
googleDrive,
|
12
|
+
drive: {
|
13
|
+
propDefinition: [
|
14
|
+
googleDrive,
|
15
|
+
"watchedDrive",
|
16
|
+
],
|
17
|
+
optional: true,
|
18
|
+
},
|
19
|
+
fileIdTip: {
|
20
|
+
type: "alert",
|
21
|
+
alertType: "info",
|
22
|
+
content: "You can use actions such as **Find File** or **List Files** to obtain a file ID, and use its value here.",
|
23
|
+
},
|
24
|
+
fileId: {
|
25
|
+
propDefinition: [
|
26
|
+
googleDrive,
|
27
|
+
"fileId",
|
28
|
+
(c) => ({
|
29
|
+
drive: c.drive,
|
30
|
+
}),
|
31
|
+
],
|
32
|
+
description: "The file to obtain info for. You can select a file or use a file ID from a previous step.",
|
33
|
+
},
|
34
|
+
fields: {
|
35
|
+
type: "string[]",
|
36
|
+
label: "Fields",
|
37
|
+
description: "Customize the fields to obtain for the file. [See the documentation](https://developers.google.com/drive/api/reference/rest/v3/files) for more information.",
|
38
|
+
optional: true,
|
39
|
+
options: FILE_FIELD_OPTIONS,
|
40
|
+
},
|
41
|
+
},
|
42
|
+
async run({ $ }) {
|
43
|
+
const {
|
44
|
+
googleDrive, fileId, fields,
|
45
|
+
} = this;
|
46
|
+
const strFields = typeof fields === "string"
|
47
|
+
? fields
|
48
|
+
: fields?.join();
|
49
|
+
const response = await googleDrive.getFile(fileId, {
|
50
|
+
fields: strFields,
|
51
|
+
});
|
52
|
+
|
53
|
+
$.export("$summary", "Successfully fetched file info");
|
54
|
+
return response;
|
55
|
+
},
|
56
|
+
};
|
@@ -12,7 +12,7 @@ export default {
|
|
12
12
|
key: "google_drive-get-folder-id-for-path",
|
13
13
|
name: "Get Folder ID for a Path",
|
14
14
|
description: "Retrieve a folderId for a path. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
|
15
|
-
version: "0.1.
|
15
|
+
version: "0.1.7",
|
16
16
|
type: "action",
|
17
17
|
props: {
|
18
18
|
googleDrive,
|
@@ -3,19 +3,16 @@ import googleDrive from "../../google_drive.app.mjs";
|
|
3
3
|
export default {
|
4
4
|
key: "google_drive-get-shared-drive",
|
5
5
|
name: "Get Shared Drive",
|
6
|
-
description: "Get
|
7
|
-
version: "0.1.
|
6
|
+
description: "Get metadata for one or all shared drives. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/get) for more information",
|
7
|
+
version: "0.1.5",
|
8
8
|
type: "action",
|
9
9
|
props: {
|
10
10
|
googleDrive,
|
11
11
|
drive: {
|
12
12
|
propDefinition: [
|
13
13
|
googleDrive,
|
14
|
-
"
|
14
|
+
"sharedDrive",
|
15
15
|
],
|
16
|
-
description:
|
17
|
-
"Select a [shared drive](https://support.google.com/a/users/answer/9310351).",
|
18
|
-
default: "",
|
19
16
|
},
|
20
17
|
useDomainAdminAccess: {
|
21
18
|
propDefinition: [
|
@@ -26,12 +23,15 @@ export default {
|
|
26
23
|
},
|
27
24
|
async run({ $ }) {
|
28
25
|
const resp = await this.googleDrive.getSharedDrive(
|
29
|
-
this.
|
26
|
+
this.drive ?? null,
|
30
27
|
{
|
31
28
|
useDomainAdminAccess: this.useDomainAdminAccess,
|
32
29
|
},
|
33
30
|
);
|
34
|
-
|
31
|
+
const summary = resp.drives
|
32
|
+
? `${resp.drives.length} shared drives`
|
33
|
+
: `the shared drive "${resp.name}"`;
|
34
|
+
$.export("$summary", `Successfully fetched ${summary}`);
|
35
35
|
return resp;
|
36
36
|
},
|
37
37
|
};
|
@@ -5,7 +5,7 @@ export default {
|
|
5
5
|
key: "google_drive-list-files",
|
6
6
|
name: "List Files",
|
7
7
|
description: "List files from a specific folder. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/list) for more information",
|
8
|
-
version: "0.1.
|
8
|
+
version: "0.1.9",
|
9
9
|
type: "action",
|
10
10
|
props: {
|
11
11
|
googleDrive,
|
@@ -31,7 +31,7 @@ export default {
|
|
31
31
|
fields: {
|
32
32
|
type: "string",
|
33
33
|
label: "Fields",
|
34
|
-
description: "The
|
34
|
+
description: "The fields you want included in the response [(see the documentation for available fields)](https://developers.google.com/drive/api/reference/rest/v3/files). If not specified, the response includes a default set of fields specific to this method. For development you can use the special value `*` to return all fields, but you'll achieve greater performance by only selecting the fields you need.\n\n**eg:** `files(id,mimeType,name,webContentLink,webViewLink)`",
|
35
35
|
optional: true,
|
36
36
|
},
|
37
37
|
filterText: {
|
@@ -44,7 +44,7 @@ export default {
|
|
44
44
|
trashed: {
|
45
45
|
label: "Trashed",
|
46
46
|
type: "boolean",
|
47
|
-
description: "
|
47
|
+
description: "If `true`, list **only** trashed files. If `false`, list **only** non-trashed files. Keep it empty to include both.",
|
48
48
|
optional: true,
|
49
49
|
},
|
50
50
|
},
|
@@ -3,8 +3,8 @@ import googleDrive from "../../google_drive.app.mjs";
|
|
3
3
|
export default {
|
4
4
|
key: "google_drive-move-file",
|
5
5
|
name: "Move File",
|
6
|
-
description: "Move a file from one folder to another. [See the
|
7
|
-
version: "0.1.
|
6
|
+
description: "Move a file from one folder to another. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
|
7
|
+
version: "0.1.5",
|
8
8
|
type: "action",
|
9
9
|
props: {
|
10
10
|
googleDrive,
|
@@ -4,11 +4,16 @@ import { GOOGLE_DRIVE_FOLDER_MIME_TYPE } from "../../common/constants.mjs";
|
|
4
4
|
export default {
|
5
5
|
key: "google_drive-move-file-to-trash",
|
6
6
|
name: "Move File to Trash",
|
7
|
-
description: "Move a file or folder to trash. [See the
|
8
|
-
version: "0.1.
|
7
|
+
description: "Move a file or folder to trash. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
|
8
|
+
version: "0.1.5",
|
9
9
|
type: "action",
|
10
10
|
props: {
|
11
11
|
googleDrive,
|
12
|
+
infoAlert: {
|
13
|
+
type: "alert",
|
14
|
+
alertType: "info",
|
15
|
+
content: "If you want to **permanently** delete a file instead, use the **[Move File to Trash](https://pipedream.com/apps/google-drive/actions/delete-file)** action.",
|
16
|
+
},
|
12
17
|
drive: {
|
13
18
|
propDefinition: [
|
14
19
|
googleDrive,
|
@@ -4,7 +4,7 @@ export default {
|
|
4
4
|
key: "google_drive-search-shared-drives",
|
5
5
|
name: "Search for Shared Drives",
|
6
6
|
description: "Search for shared drives with query options. [See the documentation](https://developers.google.com/drive/api/v3/search-shareddrives) for more information",
|
7
|
-
version: "0.1.
|
7
|
+
version: "0.1.6",
|
8
8
|
type: "action",
|
9
9
|
props: {
|
10
10
|
googleDrive,
|
@@ -7,17 +7,21 @@ import {
|
|
7
7
|
export default {
|
8
8
|
key: "google_drive-update-file",
|
9
9
|
name: "Update File",
|
10
|
-
description: "Update a file's metadata and/or content. [See the
|
11
|
-
version: "0.1.
|
10
|
+
description: "Update a file's metadata and/or content. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
|
11
|
+
version: "0.1.5",
|
12
12
|
type: "action",
|
13
13
|
props: {
|
14
14
|
googleDrive,
|
15
|
+
requiredPropsAlert: {
|
16
|
+
type: "alert",
|
17
|
+
alertType: "info",
|
18
|
+
content: "Either `File URL` and `File Path` should be specified.",
|
19
|
+
},
|
15
20
|
drive: {
|
16
21
|
propDefinition: [
|
17
22
|
googleDrive,
|
18
23
|
"watchedDrive",
|
19
24
|
],
|
20
|
-
|
21
25
|
optional: true,
|
22
26
|
},
|
23
27
|
fileId: {
|
@@ -104,12 +108,10 @@ export default {
|
|
104
108
|
},
|
105
109
|
advanced: {
|
106
110
|
type: "object",
|
107
|
-
label: "
|
111
|
+
label: "Additional Options",
|
108
112
|
optional: true,
|
109
113
|
description: toSingleLineString(`
|
110
|
-
|
111
|
-
(https://developers.google.com/drive/api/v3/reference/files/update#request-body) for a list
|
112
|
-
of supported properties.
|
114
|
+
Any additional parameters to pass in the request. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update#request-body) for all available parameters.
|
113
115
|
`),
|
114
116
|
},
|
115
117
|
},
|
@@ -3,8 +3,8 @@ import googleDrive from "../../google_drive.app.mjs";
|
|
3
3
|
export default {
|
4
4
|
key: "google_drive-update-shared-drive",
|
5
5
|
name: "Update Shared Drive",
|
6
|
-
description: "Update an existing shared drive. [See the
|
7
|
-
version: "0.1.
|
6
|
+
description: "Update an existing shared drive. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/update) for more information",
|
7
|
+
version: "0.1.5",
|
8
8
|
type: "action",
|
9
9
|
props: {
|
10
10
|
googleDrive,
|
@@ -16,6 +16,7 @@ export default {
|
|
16
16
|
description:
|
17
17
|
"Select a [shared drive](https://support.google.com/a/users/answer/9310351) to update",
|
18
18
|
default: "",
|
19
|
+
optional: false,
|
19
20
|
},
|
20
21
|
useDomainAdminAccess: {
|
21
22
|
propDefinition: [
|
@@ -23,25 +24,24 @@ export default {
|
|
23
24
|
"useDomainAdminAccess",
|
24
25
|
],
|
25
26
|
},
|
27
|
+
themeId: {
|
28
|
+
propDefinition: [
|
29
|
+
googleDrive,
|
30
|
+
"themeId",
|
31
|
+
],
|
32
|
+
},
|
26
33
|
backgroundImageLink: {
|
27
34
|
type: "string",
|
28
35
|
label: "Background Image Link",
|
29
36
|
description:
|
30
|
-
"A link to the new background image for the shared drive. Cannot be set if `Theme ID` is
|
37
|
+
"A link to the new background image for the shared drive. Cannot be set if `Theme ID` is used (it already sets the background image).",
|
31
38
|
optional: true,
|
32
39
|
},
|
33
40
|
colorRgb: {
|
34
41
|
type: "string",
|
35
42
|
label: "Color",
|
36
43
|
description:
|
37
|
-
"The new color of this shared drive as an RGB hex string. Cannot be set if `Theme ID` is
|
38
|
-
optional: true,
|
39
|
-
},
|
40
|
-
themeId: {
|
41
|
-
type: "string",
|
42
|
-
label: "Theme ID",
|
43
|
-
description:
|
44
|
-
"The ID of the theme from which the background image and color will be set. Cannot be set if `Color` or `Background Image Link` is set in the same request.",
|
44
|
+
"The new color of this shared drive as an RGB hex string. Cannot be set if `Theme ID` is used (it already sets the color).",
|
45
45
|
optional: true,
|
46
46
|
},
|
47
47
|
restrictions: {
|
@@ -5,15 +5,21 @@ import {
|
|
5
5
|
omitEmptyStringValues,
|
6
6
|
} from "../../common/utils.mjs";
|
7
7
|
import { GOOGLE_DRIVE_UPLOAD_TYPE_MULTIPART } from "../../common/constants.mjs";
|
8
|
+
import { ConfigurationError } from "@pipedream/platform";
|
8
9
|
|
9
10
|
export default {
|
10
11
|
key: "google_drive-upload-file",
|
11
12
|
name: "Upload File",
|
12
|
-
description: "
|
13
|
-
version: "0.1.
|
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
15
|
type: "action",
|
15
16
|
props: {
|
16
17
|
googleDrive,
|
18
|
+
infoAlert: {
|
19
|
+
type: "alert",
|
20
|
+
alertType: "info",
|
21
|
+
content: "Either `File URL` and `File Path` should be specified.",
|
22
|
+
},
|
17
23
|
drive: {
|
18
24
|
propDefinition: [
|
19
25
|
googleDrive,
|
@@ -89,7 +95,7 @@ export default {
|
|
89
95
|
} = this;
|
90
96
|
let { uploadType } = this;
|
91
97
|
if (!fileUrl && !filePath) {
|
92
|
-
throw new
|
98
|
+
throw new ConfigurationError("Either `File URL` and `File Path` should be specified.");
|
93
99
|
}
|
94
100
|
const driveId = this.googleDrive.getDriveId(this.drive);
|
95
101
|
|
@@ -98,7 +104,9 @@ export default {
|
|
98
104
|
const file = await getFileStream({
|
99
105
|
$,
|
100
106
|
fileUrl,
|
101
|
-
filePath
|
107
|
+
filePath: filePath.includes("tmp/")
|
108
|
+
? filePath
|
109
|
+
: `/tmp/${filePath}`,
|
102
110
|
});
|
103
111
|
console.log(`Upload type: ${uploadType}.`);
|
104
112
|
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { ConfigurationError } from "@pipedream/platform";
|
2
|
+
import googleDrive from "../google_drive.app.mjs";
|
3
|
+
|
4
|
+
export default {
|
5
|
+
methods: {
|
6
|
+
getQuery(type, folderId) {
|
7
|
+
const {
|
8
|
+
searchQuery, nameSearchTerm,
|
9
|
+
} = this;
|
10
|
+
if (!searchQuery && !nameSearchTerm && !type) {
|
11
|
+
throw new ConfigurationError("You must specify a search query or name.");
|
12
|
+
}
|
13
|
+
let q = type
|
14
|
+
? `mimeType = 'application/vnd.google-apps.${type}'`
|
15
|
+
: "";
|
16
|
+
if (searchQuery) {
|
17
|
+
q = (!q || searchQuery.includes(q))
|
18
|
+
? searchQuery
|
19
|
+
: `${q} and ${searchQuery}`;
|
20
|
+
} else {
|
21
|
+
if (nameSearchTerm) {
|
22
|
+
const nameQuery = `name contains '${nameSearchTerm}'`;
|
23
|
+
q = q
|
24
|
+
? `${q} and ${nameQuery}`
|
25
|
+
: nameQuery;
|
26
|
+
}
|
27
|
+
if (folderId) {
|
28
|
+
q = `${q} and "${folderId}" in parents`;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
return q.trim();
|
32
|
+
},
|
33
|
+
},
|
34
|
+
props: {
|
35
|
+
nameSearchTerm: {
|
36
|
+
propDefinition: [
|
37
|
+
googleDrive,
|
38
|
+
"fileNameSearchTerm",
|
39
|
+
],
|
40
|
+
},
|
41
|
+
searchQuery: {
|
42
|
+
propDefinition: [
|
43
|
+
googleDrive,
|
44
|
+
"searchQuery",
|
45
|
+
],
|
46
|
+
},
|
47
|
+
},
|
48
|
+
};
|