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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
name: "Share File or Folder",
description:
"Add a [sharing permission](https://support.google.com/drive/answer/7166529) to the sharing preferences of a file or folder and provide a sharing URL. [See the documentation](https://developers.google.com/drive/api/v3/reference/permissions/create)",
version: "0.2.2",
version: "0.2.3",
type: "action",
props: {
googleDrive,
Expand Down
2 changes: 1 addition & 1 deletion components/google_drive/actions/copy-file/copy-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-copy-file",
name: "Copy File",
description: "Create a copy of the specified file. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/copy) for more information",
version: "0.1.9",
version: "0.1.10",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "google_drive-create-file-from-template",
name: "Create New File From Template",
description: "Create a new Google Docs file from a template. Optionally include placeholders in the template document that will get replaced from this action. [See documentation](https://www.npmjs.com/package/google-docs-mustaches)",
version: "0.1.9",
version: "0.1.10",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "google_drive-create-file-from-text",
name: "Create New File From Text",
description: "Create a new file from plain text. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
version: "0.2.2",
version: "0.2.3",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
key: "google_drive-create-folder",
name: "Create Folder",
description: "Create a new empty folder. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
version: "0.1.10",
version: "0.1.11",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-create-shared-drive",
name: "Create Shared Drive",
description: "Create a new shared drive. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/create) for more information",
version: "0.1.10",
version: "0.1.11",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
name: "Delete File",
description:
"Permanently delete a file or folder without moving it to the trash. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/delete) for more information",
version: "0.1.10",
version: "0.1.11",
type: "action",
props: {
googleDrive,
infoAlert: {

Check warning on line 12 in components/google_drive/actions/delete-file/delete-file.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

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

Check warning on line 12 in components/google_drive/actions/delete-file/delete-file.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoAlert must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "warning",
content: "This action will **permanently** delete a file. If you want to move it to the trash instead, use the **[Move File to Trash](https://pipedream.com/apps/google-drive/actions/move-file-to-trash)** action.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-delete-shared-drive",
name: "Delete Shared Drive",
description: "Delete a shared drive without any content. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/delete) for more information",
version: "0.1.9",
version: "0.1.10",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
key: "google_drive-download-file",
name: "Download File",
description: "Download a file. [See the documentation](https://developers.google.com/drive/api/v3/manage-downloads) for more information",
version: "0.1.12",
version: "0.1.13",
type: "action",
props: {
googleDrive,
Expand Down
2 changes: 1 addition & 1 deletion components/google_drive/actions/find-file/find-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "google_drive-find-file",
name: "Find File",
description: "Search for a specific file by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
version: "0.1.9",
version: "0.1.10",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "google_drive-find-folder",
name: "Find Folder",
description: "Search for a specific folder by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
version: "0.1.9",
version: "0.1.10",
type: "action",
props: {
googleDrive,
Expand Down
2 changes: 1 addition & 1 deletion components/google_drive/actions/find-forms/find-forms.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
key: "google_drive-find-forms",
name: "Find Forms",
description: "List Google Form documents or search for a Form by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
version: "0.0.10",
version: "0.0.11",
type: "action",
props: {
googleDrive,
Expand All @@ -29,13 +29,13 @@
description: "The ID of the parent folder which contains the file. If not specified, it will list files from the drive's top-level folder.",
optional: true,
},
queryAlert: {

Check warning on line 32 in components/google_drive/actions/find-forms/find-forms.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

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

Check warning on line 32 in components/google_drive/actions/find-forms/find-forms.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop queryAlert must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "If no query or search name is specified, all forms in the selected drive/folder will be returned.",
},
...commonSearchQuery.props,
searchQuery: {

Check warning on line 38 in components/google_drive/actions/find-forms/find-forms.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop searchQuery must have a label. See https://pipedream.com/docs/components/guidelines/#props
...commonSearchQuery.props.searchQuery,
description:
"Search for a file with a query. [See the documentation](https://developers.google.com/drive/api/guides/ref-search-terms) for more information. If specified, `Search Name` and `Parent Folder` will be ignored.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
key: "google_drive-find-spreadsheets",
name: "Find Spreadsheets",
description: "Search for a specific spreadsheet by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
version: "0.1.9",
version: "0.1.10",
type: "action",
props: {
googleDrive,
Expand All @@ -29,13 +29,13 @@
description: "The ID of the parent folder which contains the file. If not specified, it will list files from the drive's top-level folder.",
optional: true,
},
queryAlert: {

Check warning on line 32 in components/google_drive/actions/find-spreadsheets/find-spreadsheets.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

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

Check warning on line 32 in components/google_drive/actions/find-spreadsheets/find-spreadsheets.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop queryAlert must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "If no query or search name is specified, all spreadsheets in the selected drive/folder will be returned.",
},
...commonSearchQuery.props,
searchQuery: {

Check warning on line 38 in components/google_drive/actions/find-spreadsheets/find-spreadsheets.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop searchQuery must have a label. See https://pipedream.com/docs/components/guidelines/#props
...commonSearchQuery.props.searchQuery,
description:
"Search for a file with a query. [See the documentation](https://developers.google.com/drive/api/guides/ref-search-terms) for more information. If specified, `Search Name` and `Parent Folder` will be ignored.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
key: "google_drive-get-file-by-id",
name: "Get File By ID",
description: "Get info on a specific file. [See the documentation](https://developers.google.com/drive/api/reference/rest/v3/files/get) for more information",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
googleDrive,
Expand All @@ -16,7 +16,7 @@
],
optional: true,
},
fileIdTip: {

Check warning on line 19 in components/google_drive/actions/get-file-by-id/get-file-by-id.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

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

Check warning on line 19 in components/google_drive/actions/get-file-by-id/get-file-by-id.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop fileIdTip must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "You can use actions such as **Find File** or **List Files** to obtain a file ID, and use its value here.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {
key: "google_drive-get-folder-id-for-path",
name: "Get Folder ID for a Path",
description: "Retrieve a folderId for a path. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
version: "0.1.11",
version: "0.1.12",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-get-shared-drive",
name: "Get Shared Drive",
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",
version: "0.1.9",
version: "0.1.10",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-list-access-proposals",
name: "List Access Proposals",
description: "List access proposals for a file or folder. [See the documentation](https://developers.google.com/workspace/drive/api/reference/rest/v3/accessproposals/list)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
googleDrive,
Expand Down
2 changes: 1 addition & 1 deletion components/google_drive/actions/list-files/list-files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "google_drive-list-files",
name: "List Files",
description: "List files from a specific folder. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/list) for more information",
version: "0.1.13",
version: "0.1.14",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "google_drive-move-file-to-trash",
name: "Move File to Trash",
description: "Move a file or folder to trash. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
version: "0.1.9",
version: "0.1.10",
type: "action",
props: {
googleDrive,
Expand Down
2 changes: 1 addition & 1 deletion components/google_drive/actions/move-file/move-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-move-file",
name: "Move File",
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",
version: "0.1.9",
version: "0.1.10",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "google_drive-resolve-access-proposal",
name: "Resolve Access Proposals",
description: "Accept or deny a request for access to a file or folder in Google Drive. [See the documentation](https://developers.google.com/workspace/drive/api/reference/rest/v3/accessproposals/resolve)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-search-shared-drives",
name: "Search for Shared Drives",
description: "Search for shared drives with query options. [See the documentation](https://developers.google.com/drive/api/v3/search-shareddrives) for more information",
version: "0.1.10",
version: "0.1.11",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "google_drive-update-file",
name: "Update File",
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",
version: "2.0.1",
version: "2.0.2",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-update-shared-drive",
name: "Update Shared Drive",
description: "Update an existing shared drive. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/update) for more information",
version: "0.1.9",
version: "0.1.10",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {
key: "google_drive-upload-file",
name: "Upload File",
description: "Upload a file to Google Drive. [See the documentation](https://developers.google.com/drive/api/v3/manage-uploads) for more information",
version: "2.0.2",
version: "2.0.3",
type: "action",
props: {
googleDrive,
Expand Down
14 changes: 10 additions & 4 deletions components/google_drive/common/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,17 @@ function truncatePath(pathArr) {
*/
function buildFilePaths(files = [], folders = []) {
const folderIdToFolder = folders.reduce((acc, cur) => {
acc[cur.id] = cur;
if (cur?.id) {
acc[cur.id] = cur;
}
return acc;
}, {});
const paths = {};
// Recursive function that returns an array of file `id`s representing the path to a file if
// requisite parent folders are available (in `file.parents`) to the requesting user, or an array
// containing the file ID otherwise
const pathToFile = (file) => {
if (!file) {
if (!file?.id) {
// unretrieved folder or root folder
return [];
}
Expand All @@ -139,7 +141,9 @@ function buildFilePaths(files = [], folders = []) {
];
};
files.forEach((file) => {
paths[file.id] = pathToFile(file);
if (file?.id) {
paths[file.id] = pathToFile(file);
}
});
return paths;
}
Expand All @@ -154,7 +158,9 @@ function buildFilePaths(files = [], folders = []) {
*/
function buildFileNamePaths(files = [], folders = []) {
const fileIdToFile = files.concat(folders).reduce((acc, cur) => {
acc[cur.id] = cur;
if (cur?.id) {
acc[cur.id] = cur;
}
return acc;
}, {});
const fileIdToPath = buildFilePaths(files, folders);
Expand Down
54 changes: 31 additions & 23 deletions components/google_drive/google_drive.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,18 @@ export default {
return [];
}
let parentFolders = await Promise.all(
file.parents.map((parentId) => this.getFile(parentId, {
(file.parents || []).map((parentId) => this.getFile(parentId, {
fields: "id,name",
})),
);
return parentFolders.map(({
id, name,
}) => ({
value: id,
label: name,
}));
return parentFolders
.filter((folder) => folder?.id)
.map(({
id, name,
}) => ({
value: id,
label: name,
}));
},
},
updateTypes: {
Expand Down Expand Up @@ -475,7 +477,7 @@ export default {
},
async _listDriveOptions(pageToken, myDrive = true) {
const {
drives,
drives = [],
nextPageToken,
} = await this.listDrivesInPage(pageToken);

Expand All @@ -493,10 +495,12 @@ export default {
]
: [];
for (const d of drives) {
options.push({
label: d.name,
value: d.id,
});
if (d?.id) {
options.push({
label: d.name,
value: d.id,
});
}
}
return {
options,
Expand Down Expand Up @@ -546,16 +550,18 @@ export default {
*/
async listFilesOptions(pageToken, extraOpts = {}) {
const {
files,
files = [],
nextPageToken,
} = await this.listFilesInPage(
pageToken,
extraOpts,
);
const options = files.map((file) => ({
label: file.name,
value: file.id,
}));
const options = files
.filter((file) => file?.id)
.map((file) => ({
label: file.name,
value: file.id,
}));
return {
options,
context: {
Expand Down Expand Up @@ -611,19 +617,21 @@ export default {
opts,
);
const [
{ files: folders },
{ files: folders = [] },
{
files, nextPageToken,
files = [], nextPageToken,
},
] = await Promise.all([
foldersPromise,
filesPromise,
]);
const filePaths = this.getFilePaths(files, folders);
const options = files.map((file) => ({
label: filePaths[file.id],
value: file.id,
}));
const options = files
.filter((file) => file?.id)
.map((file) => ({
label: filePaths[file.id],
value: file.id,
}));
return {
options,
context: {
Expand Down
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": "1.0.3",
"version": "1.0.4",
"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 @@ -27,7 +27,7 @@ export default {
key: "google_drive-changes-to-specific-files-shared-drive",
name: "Changes to Specific Files (Shared Drive)",
description: "Watches for changes to specific files in a shared drive, emitting an event when a change is made to one of those files",
version: "0.2.6",
version: "0.2.7",
type: "source",
// Dedupe events based on the "x-goog-message-number" header for the target channel:
// https://developers.google.com/drive/api/v3/push#making-watch-requests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
key: "google_drive-changes-to-specific-files",
name: "Changes to Specific Files",
description: "Watches for changes to specific files, emitting an event when a change is made to one of those files. To watch for changes to [shared drive](https://support.google.com/a/users/answer/9310351) files, use the **Changes to Specific Files (Shared Drive)** source instead.",
version: "0.2.6",
version: "0.2.7",
type: "source",
// Dedupe events based on the "x-goog-message-number" header for the target channel:
// https://developers.google.com/drive/api/v3/push#making-watch-requests
Expand Down
Loading
Loading