@divyacon/piece-google-drive 0.0.0-stage → 0.1.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/LICENSE.MIT-AP +24 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +155 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/action/add-permission.action.d.ts +11 -0
- package/dist/lib/action/add-permission.action.d.ts.map +1 -0
- package/dist/lib/action/add-permission.action.js +83 -0
- package/dist/lib/action/add-permission.action.js.map +1 -0
- package/dist/lib/action/create-new-folder.d.ts +12 -0
- package/dist/lib/action/create-new-folder.d.ts.map +1 -0
- package/dist/lib/action/create-new-folder.js +43 -0
- package/dist/lib/action/create-new-folder.js.map +1 -0
- package/dist/lib/action/create-new-text-file.d.ts +14 -0
- package/dist/lib/action/create-new-text-file.d.ts.map +1 -0
- package/dist/lib/action/create-new-text-file.js +81 -0
- package/dist/lib/action/create-new-text-file.js.map +1 -0
- package/dist/lib/action/delete-file.d.ts +8 -0
- package/dist/lib/action/delete-file.d.ts.map +1 -0
- package/dist/lib/action/delete-file.js +38 -0
- package/dist/lib/action/delete-file.js.map +1 -0
- package/dist/lib/action/delete-permission.action.d.ts +9 -0
- package/dist/lib/action/delete-permission.action.d.ts.map +1 -0
- package/dist/lib/action/delete-permission.action.js +84 -0
- package/dist/lib/action/delete-permission.action.js.map +1 -0
- package/dist/lib/action/drive-copy-file.d.ts +10 -0
- package/dist/lib/action/drive-copy-file.d.ts.map +1 -0
- package/dist/lib/action/drive-copy-file.js +84 -0
- package/dist/lib/action/drive-copy-file.js.map +1 -0
- package/dist/lib/action/drive-create-comment.d.ts +8 -0
- package/dist/lib/action/drive-create-comment.d.ts.map +1 -0
- package/dist/lib/action/drive-create-comment.js +60 -0
- package/dist/lib/action/drive-create-comment.js.map +1 -0
- package/dist/lib/action/drive-create-file-from-text.d.ts +10 -0
- package/dist/lib/action/drive-create-file-from-text.d.ts.map +1 -0
- package/dist/lib/action/drive-create-file-from-text.js +91 -0
- package/dist/lib/action/drive-create-file-from-text.js.map +1 -0
- package/dist/lib/action/drive-create-folder.d.ts +8 -0
- package/dist/lib/action/drive-create-folder.d.ts.map +1 -0
- package/dist/lib/action/drive-create-folder.js +48 -0
- package/dist/lib/action/drive-create-folder.js.map +1 -0
- package/dist/lib/action/drive-create-reply.d.ts +10 -0
- package/dist/lib/action/drive-create-reply.d.ts.map +1 -0
- package/dist/lib/action/drive-create-reply.js +81 -0
- package/dist/lib/action/drive-create-reply.js.map +1 -0
- package/dist/lib/action/drive-create-shared-drive.d.ts +7 -0
- package/dist/lib/action/drive-create-shared-drive.d.ts.map +1 -0
- package/dist/lib/action/drive-create-shared-drive.js +53 -0
- package/dist/lib/action/drive-create-shared-drive.js.map +1 -0
- package/dist/lib/action/drive-delete-file.d.ts +7 -0
- package/dist/lib/action/drive-delete-file.d.ts.map +1 -0
- package/dist/lib/action/drive-delete-file.js +39 -0
- package/dist/lib/action/drive-delete-file.js.map +1 -0
- package/dist/lib/action/drive-delete-reply.d.ts +9 -0
- package/dist/lib/action/drive-delete-reply.d.ts.map +1 -0
- package/dist/lib/action/drive-delete-reply.js +64 -0
- package/dist/lib/action/drive-delete-reply.js.map +1 -0
- package/dist/lib/action/drive-delete-shared-drive.d.ts +7 -0
- package/dist/lib/action/drive-delete-shared-drive.d.ts.map +1 -0
- package/dist/lib/action/drive-delete-shared-drive.js +55 -0
- package/dist/lib/action/drive-delete-shared-drive.js.map +1 -0
- package/dist/lib/action/drive-download-file.d.ts +8 -0
- package/dist/lib/action/drive-download-file.d.ts.map +1 -0
- package/dist/lib/action/drive-download-file.js +37 -0
- package/dist/lib/action/drive-download-file.js.map +1 -0
- package/dist/lib/action/drive-empty-trash.d.ts +7 -0
- package/dist/lib/action/drive-empty-trash.d.ts.map +1 -0
- package/dist/lib/action/drive-empty-trash.js +47 -0
- package/dist/lib/action/drive-empty-trash.js.map +1 -0
- package/dist/lib/action/drive-export-workspace-file.d.ts +8 -0
- package/dist/lib/action/drive-export-workspace-file.d.ts.map +1 -0
- package/dist/lib/action/drive-export-workspace-file.js +116 -0
- package/dist/lib/action/drive-export-workspace-file.js.map +1 -0
- package/dist/lib/action/drive-get-about.d.ts +5 -0
- package/dist/lib/action/drive-get-about.d.ts.map +1 -0
- package/dist/lib/action/drive-get-about.js +43 -0
- package/dist/lib/action/drive-get-about.js.map +1 -0
- package/dist/lib/action/drive-get-file.d.ts +7 -0
- package/dist/lib/action/drive-get-file.d.ts.map +1 -0
- package/dist/lib/action/drive-get-file.js +46 -0
- package/dist/lib/action/drive-get-file.js.map +1 -0
- package/dist/lib/action/drive-get-reply.d.ts +9 -0
- package/dist/lib/action/drive-get-reply.d.ts.map +1 -0
- package/dist/lib/action/drive-get-reply.js +66 -0
- package/dist/lib/action/drive-get-reply.js.map +1 -0
- package/dist/lib/action/drive-get-shared-drive.d.ts +7 -0
- package/dist/lib/action/drive-get-shared-drive.d.ts.map +1 -0
- package/dist/lib/action/drive-get-shared-drive.js +52 -0
- package/dist/lib/action/drive-get-shared-drive.js.map +1 -0
- package/dist/lib/action/drive-list-comments.d.ts +7 -0
- package/dist/lib/action/drive-list-comments.d.ts.map +1 -0
- package/dist/lib/action/drive-list-comments.js +60 -0
- package/dist/lib/action/drive-list-comments.js.map +1 -0
- package/dist/lib/action/drive-list-files.d.ts +11 -0
- package/dist/lib/action/drive-list-files.d.ts.map +1 -0
- package/dist/lib/action/drive-list-files.js +174 -0
- package/dist/lib/action/drive-list-files.js.map +1 -0
- package/dist/lib/action/drive-list-permissions.d.ts +7 -0
- package/dist/lib/action/drive-list-permissions.d.ts.map +1 -0
- package/dist/lib/action/drive-list-permissions.js +59 -0
- package/dist/lib/action/drive-list-permissions.js.map +1 -0
- package/dist/lib/action/drive-list-replies.d.ts +8 -0
- package/dist/lib/action/drive-list-replies.d.ts.map +1 -0
- package/dist/lib/action/drive-list-replies.js +65 -0
- package/dist/lib/action/drive-list-replies.js.map +1 -0
- package/dist/lib/action/drive-list-shared-drives.d.ts +8 -0
- package/dist/lib/action/drive-list-shared-drives.d.ts.map +1 -0
- package/dist/lib/action/drive-list-shared-drives.js +60 -0
- package/dist/lib/action/drive-list-shared-drives.js.map +1 -0
- package/dist/lib/action/drive-move-file.d.ts +8 -0
- package/dist/lib/action/drive-move-file.d.ts.map +1 -0
- package/dist/lib/action/drive-move-file.js +57 -0
- package/dist/lib/action/drive-move-file.js.map +1 -0
- package/dist/lib/action/drive-remove-permission.d.ts +9 -0
- package/dist/lib/action/drive-remove-permission.d.ts.map +1 -0
- package/dist/lib/action/drive-remove-permission.js +75 -0
- package/dist/lib/action/drive-remove-permission.js.map +1 -0
- package/dist/lib/action/drive-replace-file-content.d.ts +9 -0
- package/dist/lib/action/drive-replace-file-content.d.ts.map +1 -0
- package/dist/lib/action/drive-replace-file-content.js +67 -0
- package/dist/lib/action/drive-replace-file-content.js.map +1 -0
- package/dist/lib/action/drive-save-file-as-pdf.d.ts +9 -0
- package/dist/lib/action/drive-save-file-as-pdf.d.ts.map +1 -0
- package/dist/lib/action/drive-save-file-as-pdf.js +73 -0
- package/dist/lib/action/drive-save-file-as-pdf.js.map +1 -0
- package/dist/lib/action/drive-search-files.d.ts +12 -0
- package/dist/lib/action/drive-search-files.d.ts.map +1 -0
- package/dist/lib/action/drive-search-files.js +130 -0
- package/dist/lib/action/drive-search-files.js.map +1 -0
- package/dist/lib/action/drive-set-public-access.d.ts +8 -0
- package/dist/lib/action/drive-set-public-access.d.ts.map +1 -0
- package/dist/lib/action/drive-set-public-access.js +71 -0
- package/dist/lib/action/drive-set-public-access.js.map +1 -0
- package/dist/lib/action/drive-share-file.d.ts +10 -0
- package/dist/lib/action/drive-share-file.d.ts.map +1 -0
- package/dist/lib/action/drive-share-file.js +69 -0
- package/dist/lib/action/drive-share-file.js.map +1 -0
- package/dist/lib/action/drive-trash-file.d.ts +7 -0
- package/dist/lib/action/drive-trash-file.d.ts.map +1 -0
- package/dist/lib/action/drive-trash-file.js +45 -0
- package/dist/lib/action/drive-trash-file.js.map +1 -0
- package/dist/lib/action/drive-untrash-file.d.ts +7 -0
- package/dist/lib/action/drive-untrash-file.d.ts.map +1 -0
- package/dist/lib/action/drive-untrash-file.js +54 -0
- package/dist/lib/action/drive-untrash-file.js.map +1 -0
- package/dist/lib/action/drive-update-file-metadata.d.ts +10 -0
- package/dist/lib/action/drive-update-file-metadata.d.ts.map +1 -0
- package/dist/lib/action/drive-update-file-metadata.js +79 -0
- package/dist/lib/action/drive-update-file-metadata.js.map +1 -0
- package/dist/lib/action/drive-update-permission.d.ts +9 -0
- package/dist/lib/action/drive-update-permission.d.ts.map +1 -0
- package/dist/lib/action/drive-update-permission.js +93 -0
- package/dist/lib/action/drive-update-permission.js.map +1 -0
- package/dist/lib/action/drive-update-reply.d.ts +10 -0
- package/dist/lib/action/drive-update-reply.d.ts.map +1 -0
- package/dist/lib/action/drive-update-reply.js +72 -0
- package/dist/lib/action/drive-update-reply.js.map +1 -0
- package/dist/lib/action/drive-update-shared-drive.d.ts +8 -0
- package/dist/lib/action/drive-update-shared-drive.d.ts.map +1 -0
- package/dist/lib/action/drive-update-shared-drive.js +62 -0
- package/dist/lib/action/drive-update-shared-drive.js.map +1 -0
- package/dist/lib/action/drive-upload-file.d.ts +9 -0
- package/dist/lib/action/drive-upload-file.d.ts.map +1 -0
- package/dist/lib/action/drive-upload-file.js +71 -0
- package/dist/lib/action/drive-upload-file.js.map +1 -0
- package/dist/lib/action/drive-upload-from-url.d.ts +10 -0
- package/dist/lib/action/drive-upload-from-url.d.ts.map +1 -0
- package/dist/lib/action/drive-upload-from-url.js +90 -0
- package/dist/lib/action/drive-upload-from-url.js.map +1 -0
- package/dist/lib/action/duplicate-file.action.d.ts +11 -0
- package/dist/lib/action/duplicate-file.action.d.ts.map +1 -0
- package/dist/lib/action/duplicate-file.action.js +83 -0
- package/dist/lib/action/duplicate-file.action.js.map +1 -0
- package/dist/lib/action/get-file-by-id.d.ts +8 -0
- package/dist/lib/action/get-file-by-id.d.ts.map +1 -0
- package/dist/lib/action/get-file-by-id.js +45 -0
- package/dist/lib/action/get-file-by-id.js.map +1 -0
- package/dist/lib/action/list-files.action.d.ts +11 -0
- package/dist/lib/action/list-files.action.d.ts.map +1 -0
- package/dist/lib/action/list-files.action.js +165 -0
- package/dist/lib/action/list-files.action.js.map +1 -0
- package/dist/lib/action/move-file.d.ts +12 -0
- package/dist/lib/action/move-file.d.ts.map +1 -0
- package/dist/lib/action/move-file.js +52 -0
- package/dist/lib/action/move-file.js.map +1 -0
- package/dist/lib/action/read-file.d.ts +8 -0
- package/dist/lib/action/read-file.d.ts.map +1 -0
- package/dist/lib/action/read-file.js +34 -0
- package/dist/lib/action/read-file.js.map +1 -0
- package/dist/lib/action/save-file-as-pdf.action.d.ts +10 -0
- package/dist/lib/action/save-file-as-pdf.action.d.ts.map +1 -0
- package/dist/lib/action/save-file-as-pdf.action.js +72 -0
- package/dist/lib/action/save-file-as-pdf.action.js.map +1 -0
- package/dist/lib/action/search-folder-or-file.action.d.ts +15 -0
- package/dist/lib/action/search-folder-or-file.action.d.ts.map +1 -0
- package/dist/lib/action/search-folder-or-file.action.js +119 -0
- package/dist/lib/action/search-folder-or-file.action.js.map +1 -0
- package/dist/lib/action/send-to-trash.d.ts +8 -0
- package/dist/lib/action/send-to-trash.d.ts.map +1 -0
- package/dist/lib/action/send-to-trash.js +44 -0
- package/dist/lib/action/send-to-trash.js.map +1 -0
- package/dist/lib/action/set-public-access.d.ts +8 -0
- package/dist/lib/action/set-public-access.d.ts.map +1 -0
- package/dist/lib/action/set-public-access.js +66 -0
- package/dist/lib/action/set-public-access.js.map +1 -0
- package/dist/lib/action/upload-file.d.ts +13 -0
- package/dist/lib/action/upload-file.d.ts.map +1 -0
- package/dist/lib/action/upload-file.js +58 -0
- package/dist/lib/action/upload-file.js.map +1 -0
- package/dist/lib/auth.d.ts +11 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +87 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/common/get-file-content.d.ts +4 -0
- package/dist/lib/common/get-file-content.d.ts.map +1 -0
- package/dist/lib/common/get-file-content.js +69 -0
- package/dist/lib/common/get-file-content.js.map +1 -0
- package/dist/lib/common/index.d.ts +23 -0
- package/dist/lib/common/index.d.ts.map +1 -0
- package/dist/lib/common/index.js +152 -0
- package/dist/lib/common/index.js.map +1 -0
- package/dist/lib/output-schemas.d.ts +53 -0
- package/dist/lib/output-schemas.d.ts.map +1 -0
- package/dist/lib/output-schemas.js +2022 -0
- package/dist/lib/output-schemas.js.map +1 -0
- package/dist/lib/triggers/new-file.d.ts +43 -0
- package/dist/lib/triggers/new-file.d.ts.map +1 -0
- package/dist/lib/triggers/new-file.js +107 -0
- package/dist/lib/triggers/new-file.js.map +1 -0
- package/dist/lib/triggers/new-folder.d.ts +39 -0
- package/dist/lib/triggers/new-folder.d.ts.map +1 -0
- package/dist/lib/triggers/new-folder.js +71 -0
- package/dist/lib/triggers/new-folder.js.map +1 -0
- package/package.json +49 -3
- package/src/index.ts +149 -0
- package/src/lib/action/add-permission.action.ts +82 -0
- package/src/lib/action/create-new-folder.ts +42 -0
- package/src/lib/action/create-new-text-file.ts +80 -0
- package/src/lib/action/delete-file.ts +33 -0
- package/src/lib/action/delete-permission.action.ts +84 -0
- package/src/lib/action/drive-copy-file.ts +86 -0
- package/src/lib/action/drive-create-comment.ts +61 -0
- package/src/lib/action/drive-create-file-from-text.ts +99 -0
- package/src/lib/action/drive-create-folder.ts +49 -0
- package/src/lib/action/drive-create-reply.ts +84 -0
- package/src/lib/action/drive-create-shared-drive.ts +52 -0
- package/src/lib/action/drive-delete-file.ts +36 -0
- package/src/lib/action/drive-delete-reply.ts +65 -0
- package/src/lib/action/drive-delete-shared-drive.ts +57 -0
- package/src/lib/action/drive-download-file.ts +38 -0
- package/src/lib/action/drive-empty-trash.ts +47 -0
- package/src/lib/action/drive-export-workspace-file.ts +129 -0
- package/src/lib/action/drive-get-about.ts +40 -0
- package/src/lib/action/drive-get-file.ts +40 -0
- package/src/lib/action/drive-get-reply.ts +67 -0
- package/src/lib/action/drive-get-shared-drive.ts +52 -0
- package/src/lib/action/drive-list-comments.ts +61 -0
- package/src/lib/action/drive-list-files.ts +238 -0
- package/src/lib/action/drive-list-permissions.ts +60 -0
- package/src/lib/action/drive-list-replies.ts +66 -0
- package/src/lib/action/drive-list-shared-drives.ts +59 -0
- package/src/lib/action/drive-move-file.ts +56 -0
- package/src/lib/action/drive-remove-permission.ts +75 -0
- package/src/lib/action/drive-replace-file-content.ts +71 -0
- package/src/lib/action/drive-save-file-as-pdf.ts +80 -0
- package/src/lib/action/drive-search-files.ts +127 -0
- package/src/lib/action/drive-set-public-access.ts +75 -0
- package/src/lib/action/drive-share-file.ts +69 -0
- package/src/lib/action/drive-trash-file.ts +41 -0
- package/src/lib/action/drive-untrash-file.ts +54 -0
- package/src/lib/action/drive-update-file-metadata.ts +82 -0
- package/src/lib/action/drive-update-permission.ts +100 -0
- package/src/lib/action/drive-update-reply.ts +73 -0
- package/src/lib/action/drive-update-shared-drive.ts +63 -0
- package/src/lib/action/drive-upload-file.ts +80 -0
- package/src/lib/action/drive-upload-from-url.ts +107 -0
- package/src/lib/action/duplicate-file.action.ts +82 -0
- package/src/lib/action/get-file-by-id.ts +37 -0
- package/src/lib/action/list-files.action.ts +214 -0
- package/src/lib/action/move-file.ts +48 -0
- package/src/lib/action/read-file.ts +28 -0
- package/src/lib/action/save-file-as-pdf.action.ts +76 -0
- package/src/lib/action/search-folder-or-file.action.ts +112 -0
- package/src/lib/action/send-to-trash.ts +38 -0
- package/src/lib/action/set-public-access.ts +68 -0
- package/src/lib/action/upload-file.ts +55 -0
- package/src/lib/auth.ts +79 -0
- package/src/lib/common/get-file-content.ts +109 -0
- package/src/lib/common/index.ts +182 -0
- package/src/lib/output-schemas.ts +2070 -0
- package/src/lib/triggers/new-file.ts +119 -0
- package/src/lib/triggers/new-folder.ts +78 -0
- package/README.md +0 -3
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.driveSetPublicAccess = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/google-drive/src/lib/action/drive-set-public-access.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const drive_1 = require("@googleapis/drive");
|
|
10
|
+
const get_file_content_1 = require("../common/get-file-content");
|
|
11
|
+
const output_schemas_1 = require("../output-schemas");
|
|
12
|
+
exports.driveSetPublicAccess = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.googleDriveAuth,
|
|
14
|
+
name: 'drive_set_public_access',
|
|
15
|
+
displayName: 'Set Public Access',
|
|
16
|
+
description: 'Make a Drive file or folder accessible to anyone with the link.',
|
|
17
|
+
audience: 'ai',
|
|
18
|
+
aiMetadata: {
|
|
19
|
+
description: 'Makes a file or folder accessible to anyone with the link at the chosen role and returns its shareable view/download URL. Use to publish a resource publicly; to share with a named person instead use drive_share_file. Each call adds a new anyone-with-link permission.',
|
|
20
|
+
idempotent: false,
|
|
21
|
+
},
|
|
22
|
+
outputSchema: output_schemas_1.driveSetPublicAccessOutputSchema,
|
|
23
|
+
props: {
|
|
24
|
+
file_id: pieces_framework_1.Property.ShortText({
|
|
25
|
+
displayName: 'File or Folder ID',
|
|
26
|
+
description: 'The ID of the file or folder to make public. Resolve it via drive_search_files or drive_get_file.',
|
|
27
|
+
required: true,
|
|
28
|
+
}),
|
|
29
|
+
role: pieces_framework_1.Property.StaticDropdown({
|
|
30
|
+
displayName: 'Role',
|
|
31
|
+
description: 'The role to assign for public access.',
|
|
32
|
+
options: {
|
|
33
|
+
options: [
|
|
34
|
+
{ label: 'Reader', value: 'reader' },
|
|
35
|
+
{ label: 'Commenter', value: 'commenter' },
|
|
36
|
+
{ label: 'Editor', value: 'writer' },
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
defaultValue: 'reader',
|
|
40
|
+
required: true,
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
run(context) {
|
|
44
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
46
|
+
const fileId = context.propsValue.file_id;
|
|
47
|
+
const role = context.propsValue.role;
|
|
48
|
+
const drive = (0, drive_1.drive)({ version: 'v3', auth: authClient });
|
|
49
|
+
const permission = {
|
|
50
|
+
role,
|
|
51
|
+
type: 'anyone',
|
|
52
|
+
};
|
|
53
|
+
const res = yield drive.permissions.create({
|
|
54
|
+
fileId: fileId,
|
|
55
|
+
requestBody: permission,
|
|
56
|
+
supportsAllDrives: true,
|
|
57
|
+
});
|
|
58
|
+
const file = yield drive.files.get({
|
|
59
|
+
fileId: fileId,
|
|
60
|
+
fields: 'name,mimeType,webContentLink,webViewLink',
|
|
61
|
+
supportsAllDrives: true,
|
|
62
|
+
});
|
|
63
|
+
if (file.data.mimeType === 'application/vnd.google-apps.folder') {
|
|
64
|
+
return Object.assign(Object.assign({}, res.data), { webViewLink: file.data.webViewLink, downloadUrl: null });
|
|
65
|
+
}
|
|
66
|
+
const content = yield (0, get_file_content_1.downloadFileFromDrive)(context.auth, context.files, fileId, file.data.name);
|
|
67
|
+
return Object.assign(Object.assign({}, res.data), { downloadUrl: content });
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=drive-set-public-access.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-set-public-access.js","sourceRoot":"","sources":["../../../src/lib/action/drive-set-public-access.ts"],"names":[],"mappings":";;;;AAAA,qHAAqH;AACrH,qEAAqE;AACrE,gEAAmE;AACnE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AU,GAAG;gBACjB,IAAI;gBACJ,IAAI,EAAE,QAAQ;aACf,CAAC;YACF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC;gBACzC,MAAM,EAAE,MAAM;gBACd,WAAW,EAAE,UAAU;gBACvB,iBAAiB,EAAE,IAAI;aACxB,CAAC,CAAC;YAEH,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;gBACjC,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE,0CAA0C;gBAClD,iBAAiB,EAAE,IAAI;aACxB,CAAC,CAAC;YAEH,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,KAAK,oCAAoC,EAAE,CAAC;gBAChE,uCAAY,GAAG,CAAC,IAAI,KAAE,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,IAAG;YAChF,CAAC;YAED,MAAM,OAAO,GAAG,MAAM,IAAA,wCAAqB,EACzC,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,KAAK,EACb,MAAM,EACN,IAAI,CAAC,IAAI,CAAC,IAAK,CAChB,CAAC;YACF,uCAAY,GAAG,CAAC,IAAI,KAAE,WAAW,EAAE,OAAO,IAAG;QAC/C,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const driveShareFile: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
file_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
user_email: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
role: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
+
send_invitation_email: import("@agnocon/pieces-framework").CheckboxProperty<true>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=drive-share-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-share-file.d.ts","sourceRoot":"","sources":["../../../src/lib/action/drive-share-file.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc;;;;;;;;EA+DzB,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.driveShareFile = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/google-drive/src/lib/action/drive-share-file.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const drive_1 = require("@googleapis/drive");
|
|
10
|
+
const output_schemas_1 = require("../output-schemas");
|
|
11
|
+
exports.driveShareFile = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.googleDriveAuth,
|
|
13
|
+
name: 'drive_share_file',
|
|
14
|
+
displayName: 'Share File with User',
|
|
15
|
+
description: 'Grant a role on a Drive file or folder to a user by email.',
|
|
16
|
+
audience: 'ai',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: 'Grants a role to a user (by email) on a file or folder, optionally emailing them. Use to share with a specific person; to share with anyone-with-the-link use drive_set_public_access, and to change an existing collaborator\'s role use drive_update_permission. Each call creates a new permission grant.',
|
|
19
|
+
idempotent: false,
|
|
20
|
+
},
|
|
21
|
+
outputSchema: output_schemas_1.driveShareFileOutputSchema,
|
|
22
|
+
props: {
|
|
23
|
+
file_id: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'File or Folder ID',
|
|
25
|
+
description: 'The ID of the file or folder to share. Resolve it via drive_search_files or drive_get_file.',
|
|
26
|
+
required: true,
|
|
27
|
+
}),
|
|
28
|
+
user_email: pieces_framework_1.Property.ShortText({
|
|
29
|
+
displayName: 'User Email',
|
|
30
|
+
description: 'The email address of the user to grant access to.',
|
|
31
|
+
required: true,
|
|
32
|
+
}),
|
|
33
|
+
role: pieces_framework_1.Property.StaticDropdown({
|
|
34
|
+
displayName: 'Role',
|
|
35
|
+
description: 'The role to grant to the user. See https://developers.google.com/drive/api/guides/ref-roles',
|
|
36
|
+
required: true,
|
|
37
|
+
options: {
|
|
38
|
+
options: [
|
|
39
|
+
{ label: 'Organizer', value: 'organizer' },
|
|
40
|
+
{ label: 'File Organizer', value: 'fileOrganizer' },
|
|
41
|
+
{ label: 'Writer', value: 'writer' },
|
|
42
|
+
{ label: 'Commenter', value: 'commenter' },
|
|
43
|
+
{ label: 'Reader', value: 'reader' },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
send_invitation_email: pieces_framework_1.Property.Checkbox({
|
|
48
|
+
displayName: 'Send Invitation Email',
|
|
49
|
+
description: 'Send an email to the user to notify them of the new permission.',
|
|
50
|
+
required: true,
|
|
51
|
+
}),
|
|
52
|
+
},
|
|
53
|
+
run(context) {
|
|
54
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const { file_id, user_email, role, send_invitation_email } = context.propsValue;
|
|
56
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
57
|
+
const drive = (0, drive_1.drive)({ version: 'v3', auth: authClient });
|
|
58
|
+
const permission = { type: 'user', role: role, emailAddress: user_email };
|
|
59
|
+
const result = yield drive.permissions.create({
|
|
60
|
+
requestBody: permission,
|
|
61
|
+
fileId: file_id,
|
|
62
|
+
sendNotificationEmail: send_invitation_email,
|
|
63
|
+
supportsAllDrives: true,
|
|
64
|
+
});
|
|
65
|
+
return result.data;
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=drive-share-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-share-file.js","sourceRoot":"","sources":["../../../src/lib/action/drive-share-file.ts"],"names":[],"mappings":";;;;AAAA,8GAA8G;AAC9G,qEAAqE;AACrE,gEAAmE;AACnE,kCAA8D;AAC9D,6CAAyD;AACzD,sDAA+D;AAElD,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,4DAA4D;IACzE,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE;QACV,WAAW,EACT,8SAA8S;QAChT,UAAU,EAAE,KAAK;KAClB;IACD,YAAY,EAAE,2CAA0B;IACxC,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,mBAAmB;YAChC,WAAW,EACT,6FAA6F;YAC/F,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC5B,WAAW,EAAE,MAAM;YACnB,WAAW,EACT,6FAA6F;YAC/F,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;oBAC1C,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,EAAE;oBACnD,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;oBACpC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;oBAC1C,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;iBACrC;aACF;SACF,CAAC;QACF,qBAAqB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACvC,WAAW,EAAE,uBAAuB;YACpC,WAAW,EAAE,iEAAiE;YAC9E,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEhF,MAAM,UAAU,GAAG,MAAM,IAAA,yBAAkB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAE1D,MAAM,KAAK,GAAG,IAAA,aAAW,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAE/D,MAAM,UAAU,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;YAE1E,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC;gBAC5C,WAAW,EAAE,UAAU;gBACvB,MAAM,EAAE,OAAO;gBACf,qBAAqB,EAAE,qBAAqB;gBAC5C,iBAAiB,EAAE,IAAI;aACxB,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const driveTrashFile: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
file_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=drive-trash-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-trash-file.d.ts","sourceRoot":"","sources":["../../../src/lib/action/drive-trash-file.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc;;;;;EAmCzB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.driveTrashFile = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/google-drive/src/lib/action/drive-trash-file.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const drive_1 = require("@googleapis/drive");
|
|
10
|
+
const output_schemas_1 = require("../output-schemas");
|
|
11
|
+
exports.driveTrashFile = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.googleDriveAuth,
|
|
13
|
+
name: 'drive_trash_file',
|
|
14
|
+
displayName: 'Trash File',
|
|
15
|
+
description: 'Move a Drive file to the trash by ID (reversible deletion).',
|
|
16
|
+
audience: 'ai',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: 'Moves a file to the trash by ID — a reversible deletion restorable from Drive. Use for safe removal; for irreversible removal use drive_delete_file, and to restore use drive_untrash_file. Safe to retry — re-trashing leaves it trashed.',
|
|
19
|
+
idempotent: true,
|
|
20
|
+
},
|
|
21
|
+
outputSchema: output_schemas_1.driveTrashFileOutputSchema,
|
|
22
|
+
props: {
|
|
23
|
+
file_id: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'File ID',
|
|
25
|
+
description: 'The ID of the file to trash. Resolve it via drive_search_files or drive_get_file.',
|
|
26
|
+
required: true,
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
run(context) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
32
|
+
const drive = (0, drive_1.drive)({ version: 'v3', auth: authClient });
|
|
33
|
+
const body_value = {
|
|
34
|
+
trashed: true,
|
|
35
|
+
};
|
|
36
|
+
const response = yield drive.files.update({
|
|
37
|
+
fileId: context.propsValue.file_id,
|
|
38
|
+
supportsAllDrives: true,
|
|
39
|
+
requestBody: body_value,
|
|
40
|
+
});
|
|
41
|
+
return response.data;
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=drive-trash-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-trash-file.js","sourceRoot":"","sources":["../../../src/lib/action/drive-trash-file.ts"],"names":[],"mappings":";;;;AAAA,8GAA8G;AAC9G,qEAAqE;AACrE,gEAAmE;AACnE,kCAA8D;AAC9D,6CAAyD;AACzD,sDAA+D;AAElD,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,6DAA6D;IAC1E,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE;QACV,WAAW,EACT,4OAA4O;QAC9O,UAAU,EAAE,IAAI;KACjB;IACD,YAAY,EAAE,2CAA0B;IACxC,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EACT,mFAAmF;YACrF,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,UAAU,GAAG,MAAM,IAAA,yBAAkB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAE1D,MAAM,KAAK,GAAG,IAAA,aAAW,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAC/D,MAAM,UAAU,GAAG;gBACjB,OAAO,EAAE,IAAI;aACd,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;gBACxC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO;gBAClC,iBAAiB,EAAE,IAAI;gBACvB,WAAW,EAAE,UAAU;aACxB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const driveUntrashFile: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
file_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=drive-untrash-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-untrash-file.d.ts","sourceRoot":"","sources":["../../../src/lib/action/drive-untrash-file.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB;;;;;EAgD3B,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.driveUntrashFile = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/google-drive/src/lib/action/drive-untrash-file.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const drive_1 = require("@googleapis/drive");
|
|
10
|
+
const output_schemas_1 = require("../output-schemas");
|
|
11
|
+
exports.driveUntrashFile = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.googleDriveAuth,
|
|
13
|
+
name: 'drive_untrash_file',
|
|
14
|
+
displayName: 'Restore File from Trash',
|
|
15
|
+
description: 'Restore a trashed Drive file by ID back to its original location.',
|
|
16
|
+
audience: 'ai',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: 'Restores a trashed file by ID back to its original location. Use to undo a `drive_trash_file`; to permanently purge instead use `drive_empty_trash` or `drive_delete_file`. Safe to retry — re-restoring an active file is a no-op.',
|
|
19
|
+
idempotent: true,
|
|
20
|
+
},
|
|
21
|
+
outputSchema: output_schemas_1.driveUntrashFileOutputSchema,
|
|
22
|
+
props: {
|
|
23
|
+
file_id: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'File ID',
|
|
25
|
+
description: 'The ID of the trashed file to restore. Resolve it via drive_search_files or drive_get_file.',
|
|
26
|
+
required: true,
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
run(context) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const { file_id } = context.propsValue;
|
|
32
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
33
|
+
const drive = (0, drive_1.drive)({ version: 'v3', auth: authClient });
|
|
34
|
+
try {
|
|
35
|
+
const response = yield drive.files.update({
|
|
36
|
+
fileId: file_id,
|
|
37
|
+
supportsAllDrives: true,
|
|
38
|
+
requestBody: { trashed: false },
|
|
39
|
+
});
|
|
40
|
+
return response.data;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (error.code === 404) {
|
|
44
|
+
throw new Error(`File not found (ID: ${file_id}). Resolve a valid ID via drive_search_files or drive_get_file.`);
|
|
45
|
+
}
|
|
46
|
+
if (error.code === 403) {
|
|
47
|
+
throw new Error(`Permission denied restoring file ${file_id}. You may lack permission to restore this resource.`);
|
|
48
|
+
}
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=drive-untrash-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-untrash-file.js","sourceRoot":"","sources":["../../../src/lib/action/drive-untrash-file.ts"],"names":[],"mappings":";;;;AAAA,gHAAgH;AAChH,qEAAqE;AACrE,gEAAmE;AACnE,kCAA8D;AAC9D,6CAAyD;AACzD,sDAAiE;AAEpD,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,mEAAmE;IAChF,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE;QACV,WAAW,EACT,qOAAqO;QACvO,UAAU,EAAE,IAAI;KACjB;IACD,YAAY,EAAE,6CAA4B;IAC1C,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EACT,6FAA6F;YAC/F,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEvC,MAAM,UAAU,GAAG,MAAM,IAAA,yBAAkB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC1D,MAAM,KAAK,GAAG,IAAA,aAAW,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAE/D,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;oBACxC,MAAM,EAAE,OAAO;oBACf,iBAAiB,EAAE,IAAI;oBACvB,WAAW,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;iBAChC,CAAC,CAAC;gBAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBACvB,MAAM,IAAI,KAAK,CACb,uBAAuB,OAAO,iEAAiE,CAChG,CAAC;gBACJ,CAAC;gBACD,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBACvB,MAAM,IAAI,KAAK,CACb,oCAAoC,OAAO,qDAAqD,CACjG,CAAC;gBACJ,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const driveUpdateFileMetadata: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
file_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
name: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
description: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
starred: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=drive-update-file-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-update-file-metadata.d.ts","sourceRoot":"","sources":["../../../src/lib/action/drive-update-file-metadata.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,uBAAuB;;;;;;;;EA4ElC,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.driveUpdateFileMetadata = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/google-drive/src/lib/action/drive-update-file-metadata.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const drive_1 = require("@googleapis/drive");
|
|
10
|
+
const output_schemas_1 = require("../output-schemas");
|
|
11
|
+
exports.driveUpdateFileMetadata = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.googleDriveAuth,
|
|
13
|
+
name: 'drive_update_file_metadata',
|
|
14
|
+
displayName: 'Update File Metadata (Rename)',
|
|
15
|
+
description: "Rename a Drive file/folder or update its description or starred flag (metadata only).",
|
|
16
|
+
audience: 'ai',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: "Renames a file/folder or updates its description or starred flag via a metadata-only PATCH. Use to rename or annotate a resource; this never changes the file's location — to re-parent use `drive_move_file`, and to replace the file's bytes use `drive_replace_file_content`. Safe to retry — re-applying the same values is a no-op.",
|
|
19
|
+
idempotent: true,
|
|
20
|
+
},
|
|
21
|
+
outputSchema: output_schemas_1.driveUpdateFileMetadataOutputSchema,
|
|
22
|
+
props: {
|
|
23
|
+
file_id: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'File or Folder ID',
|
|
25
|
+
description: 'The ID of the file or folder to update. Resolve it via `drive_search_files` or `drive_get_file`.',
|
|
26
|
+
required: true,
|
|
27
|
+
}),
|
|
28
|
+
name: pieces_framework_1.Property.ShortText({
|
|
29
|
+
displayName: 'New Name',
|
|
30
|
+
description: 'A new name for the file or folder. Leave empty to keep the current name.',
|
|
31
|
+
required: false,
|
|
32
|
+
}),
|
|
33
|
+
description: pieces_framework_1.Property.ShortText({
|
|
34
|
+
displayName: 'Description',
|
|
35
|
+
description: 'A new description for the file or folder. Leave empty to keep the current description.',
|
|
36
|
+
required: false,
|
|
37
|
+
}),
|
|
38
|
+
starred: pieces_framework_1.Property.Checkbox({
|
|
39
|
+
displayName: 'Starred',
|
|
40
|
+
description: 'Whether to mark the file or folder as starred.',
|
|
41
|
+
required: false,
|
|
42
|
+
}),
|
|
43
|
+
},
|
|
44
|
+
run(context) {
|
|
45
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const { file_id, name, description, starred } = context.propsValue;
|
|
47
|
+
const requestBody = {};
|
|
48
|
+
if (name !== undefined && name !== null && name !== '') {
|
|
49
|
+
requestBody.name = name;
|
|
50
|
+
}
|
|
51
|
+
if (description !== undefined && description !== null) {
|
|
52
|
+
requestBody.description = description;
|
|
53
|
+
}
|
|
54
|
+
if (starred !== undefined && starred !== null) {
|
|
55
|
+
requestBody.starred = starred;
|
|
56
|
+
}
|
|
57
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
58
|
+
const drive = (0, drive_1.drive)({ version: 'v3', auth: authClient });
|
|
59
|
+
try {
|
|
60
|
+
const response = yield drive.files.update({
|
|
61
|
+
fileId: file_id,
|
|
62
|
+
supportsAllDrives: true,
|
|
63
|
+
requestBody,
|
|
64
|
+
});
|
|
65
|
+
return response.data;
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
if (error.code === 404) {
|
|
69
|
+
throw new Error(`File or folder not found (ID: ${file_id}). Resolve a valid ID via drive_search_files or drive_get_file.`);
|
|
70
|
+
}
|
|
71
|
+
if (error.code === 403) {
|
|
72
|
+
throw new Error(`Permission denied updating file ${file_id}. You may lack edit permission on this resource.`);
|
|
73
|
+
}
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=drive-update-file-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-update-file-metadata.js","sourceRoot":"","sources":["../../../src/lib/action/drive-update-file-metadata.ts"],"names":[],"mappings":";;;;AAAA,wHAAwH;AACxH,qEAAqE;AACrE,gEAAmE;AACnE,kCAA8D;AAC9D,6CAAyD;AACzD,sDAAwE;AAE3D,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,+BAA+B;IAC5C,WAAW,EACT,uFAAuF;IACzF,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE;QACV,WAAW,EACT,0UAA0U;QAC5U,UAAU,EAAE,IAAI;KACjB;IACD,YAAY,EAAE,oDAAmC;IACjD,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,mBAAmB;YAChC,WAAW,EACT,kGAAkG;YACpG,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,0EAA0E;YACvF,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,wFAAwF;YACrG,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,gDAAgD;YAC7D,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,W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AAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const driveUpdatePermission: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
file_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
user_email: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
new_role: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=drive-update-permission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-update-permission.d.ts","sourceRoot":"","sources":["../../../src/lib/action/drive-update-permission.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,qBAAqB;;;;;;;EA8FhC,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.driveUpdatePermission = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/google-drive/src/lib/action/drive-update-permission.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const drive_1 = require("@googleapis/drive");
|
|
10
|
+
const output_schemas_1 = require("../output-schemas");
|
|
11
|
+
exports.driveUpdatePermission = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.googleDriveAuth,
|
|
13
|
+
name: 'drive_update_permission',
|
|
14
|
+
displayName: 'Update Permission Role',
|
|
15
|
+
description: 'Change an existing collaborator\'s role on a Drive file or folder.',
|
|
16
|
+
audience: 'ai',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: 'Changes an existing collaborator\'s role in place (e.g. reader to writer), resolving the permission by their email internally. Use to upgrade or downgrade access without unsharing; to grant net-new access use drive_share_file. If the user has no existing grant it is a no-op (it never silently creates one). Safe to retry.',
|
|
19
|
+
idempotent: true,
|
|
20
|
+
},
|
|
21
|
+
outputSchema: output_schemas_1.driveUpdatePermissionOutputSchema,
|
|
22
|
+
props: {
|
|
23
|
+
file_id: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'File or Folder ID',
|
|
25
|
+
description: 'The ID of the file or folder whose permission to update. Resolve it via drive_search_files or drive_get_file.',
|
|
26
|
+
required: true,
|
|
27
|
+
}),
|
|
28
|
+
user_email: pieces_framework_1.Property.ShortText({
|
|
29
|
+
displayName: 'User Email',
|
|
30
|
+
description: 'The email address of the collaborator whose role to change. The existing permission is matched by this email; list current grants via drive_list_permissions.',
|
|
31
|
+
required: true,
|
|
32
|
+
}),
|
|
33
|
+
new_role: pieces_framework_1.Property.StaticDropdown({
|
|
34
|
+
displayName: 'New Role',
|
|
35
|
+
description: 'The role to set for the user. See https://developers.google.com/drive/api/guides/ref-roles',
|
|
36
|
+
required: true,
|
|
37
|
+
options: {
|
|
38
|
+
options: [
|
|
39
|
+
{ label: 'Organizer', value: 'organizer' },
|
|
40
|
+
{ label: 'File Organizer', value: 'fileOrganizer' },
|
|
41
|
+
{ label: 'Writer', value: 'writer' },
|
|
42
|
+
{ label: 'Commenter', value: 'commenter' },
|
|
43
|
+
{ label: 'Reader', value: 'reader' },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
run(context) {
|
|
49
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
var _a;
|
|
51
|
+
const { file_id, user_email, new_role } = context.propsValue;
|
|
52
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
53
|
+
const drive = (0, drive_1.drive)({ version: 'v3', auth: authClient });
|
|
54
|
+
try {
|
|
55
|
+
const response_permissions_list = yield drive.permissions.list({
|
|
56
|
+
fileId: file_id,
|
|
57
|
+
fields: 'permissions(id,emailAddress,role)',
|
|
58
|
+
supportsAllDrives: true,
|
|
59
|
+
});
|
|
60
|
+
const permissions = (_a = response_permissions_list.data.permissions) !== null && _a !== void 0 ? _a : [];
|
|
61
|
+
// Resolve the permission by email only (first match, deterministic).
|
|
62
|
+
// Never get-or-create: if no grant exists, report not-found, do not create one.
|
|
63
|
+
const match = permissions.find((permission) => permission.emailAddress === user_email);
|
|
64
|
+
if (!match || !match.id) {
|
|
65
|
+
return {
|
|
66
|
+
updated: false,
|
|
67
|
+
message: `No existing permission found for ${user_email}. Use drive_share_file to grant new access.`,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const result = yield drive.permissions.update({
|
|
71
|
+
fileId: file_id,
|
|
72
|
+
permissionId: match.id,
|
|
73
|
+
requestBody: { role: new_role },
|
|
74
|
+
supportsAllDrives: true,
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
updated: true,
|
|
78
|
+
permission: result.data,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
if (error.code === 404) {
|
|
83
|
+
throw new Error(`File or folder not found (ID: ${file_id}). Resolve a valid ID via drive_search_files or drive_get_file.`);
|
|
84
|
+
}
|
|
85
|
+
if (error.code === 403) {
|
|
86
|
+
throw new Error(`Permission denied updating the role on file ${file_id}. You may lack permission to manage sharing on this resource.`);
|
|
87
|
+
}
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=drive-update-permission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-update-permission.js","sourceRoot":"","sources":["../../../src/lib/action/drive-update-permission.ts"],"names":[],"mappings":";;;;AAAA,qHAAqH;AACrH,qEAAqE;AACrE,gEAAmE;AACnE,kCAA8D;AAC9D,6CAAyD;AACzD,sDAAsE;AAEzD,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,wBAAwB;IACrC,WAAW,EAAE,oEAAoE;IACjF,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE;QACV,WAAW,EACT,oUAAoU;QACtU,UAAU,EAAE,IAAI;KACjB;IACD,YAAY,EAAE,kDAAiC;IAC/C,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,mBAAmB;YAChC,WAAW,EACT,+GAA+G;YACjH,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EACT,+JAA+J;YACjK,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAChC,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,4FAA4F;YACzG,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;oBAC1C,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,EAAE;oBACnD,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;oBACpC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;oBAC1C,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;iBACrC;aACF;SACF,CAAC;KACH;IACK,GAAG,CAAC,OA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AC;gBACpB,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBACvB,MAAM,IAAI,KAAK,CACb,iCAAiC,OAAO,iEAAiE,CAC1G,CAAC;gBACJ,CAAC;gBACD,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBACvB,MAAM,IAAI,KAAK,CACb,+CAA+C,OAAO,+DAA+D,CACtH,CAAC;gBACJ,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const driveUpdateReply: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
file_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
comment_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
reply_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
8
|
+
content: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=drive-update-reply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-update-reply.d.ts","sourceRoot":"","sources":["../../../src/lib/action/drive-update-reply.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB;;;;;;;;EAmE3B,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.driveUpdateReply = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/google-drive/src/lib/action/drive-update-reply.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const drive_1 = require("@googleapis/drive");
|
|
10
|
+
const output_schemas_1 = require("../output-schemas");
|
|
11
|
+
exports.driveUpdateReply = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.googleDriveAuth,
|
|
13
|
+
name: 'drive_update_reply',
|
|
14
|
+
displayName: 'Update Reply',
|
|
15
|
+
description: 'Edit the text of an existing reply on a Drive comment.',
|
|
16
|
+
audience: 'ai',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: 'Edits the text of an existing reply by ID (resolve via drive_list_replies). Use to correct or revise a reply you control; to add a new reply instead use drive_create_reply. Safe to retry — re-applying the same content is a no-op.',
|
|
19
|
+
idempotent: true,
|
|
20
|
+
},
|
|
21
|
+
outputSchema: output_schemas_1.driveUpdateReplyOutputSchema,
|
|
22
|
+
props: {
|
|
23
|
+
file_id: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'File ID',
|
|
25
|
+
description: 'The ID of the file the comment belongs to. Resolve it via drive_search_files or drive_get_file.',
|
|
26
|
+
required: true,
|
|
27
|
+
}),
|
|
28
|
+
comment_id: pieces_framework_1.Property.ShortText({
|
|
29
|
+
displayName: 'Comment ID',
|
|
30
|
+
description: 'The ID of the parent comment. Resolve it via drive_list_comments.',
|
|
31
|
+
required: true,
|
|
32
|
+
}),
|
|
33
|
+
reply_id: pieces_framework_1.Property.ShortText({
|
|
34
|
+
displayName: 'Reply ID',
|
|
35
|
+
description: 'The ID of the reply to update. Resolve it via drive_list_replies.',
|
|
36
|
+
required: true,
|
|
37
|
+
}),
|
|
38
|
+
content: pieces_framework_1.Property.LongText({
|
|
39
|
+
displayName: 'Content',
|
|
40
|
+
description: 'The new plain-text content for the reply.',
|
|
41
|
+
required: true,
|
|
42
|
+
}),
|
|
43
|
+
},
|
|
44
|
+
run(context) {
|
|
45
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const { file_id, comment_id, reply_id, content } = context.propsValue;
|
|
47
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
48
|
+
const drive = (0, drive_1.drive)({ version: 'v3', auth: authClient });
|
|
49
|
+
try {
|
|
50
|
+
// The Drive replies endpoints require a fields parameter or the API returns 400.
|
|
51
|
+
const response = yield drive.replies.update({
|
|
52
|
+
fileId: file_id,
|
|
53
|
+
commentId: comment_id,
|
|
54
|
+
replyId: reply_id,
|
|
55
|
+
fields: '*',
|
|
56
|
+
requestBody: { content },
|
|
57
|
+
});
|
|
58
|
+
return response.data;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (error.code === 404) {
|
|
62
|
+
throw new Error(`File, comment, or reply not found (file ID: ${file_id}, comment ID: ${comment_id}, reply ID: ${reply_id}). Resolve the reply ID via drive_list_replies.`);
|
|
63
|
+
}
|
|
64
|
+
if (error.code === 403) {
|
|
65
|
+
throw new Error(`Permission denied updating reply ${reply_id} on file ${file_id}. You can only edit your own replies.`);
|
|
66
|
+
}
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=drive-update-reply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-update-reply.js","sourceRoot":"","sources":["../../../src/lib/action/drive-update-reply.ts"],"names":[],"mappings":";;;;AAAA,gHAAgH;AAChH,qEAAqE;AACrE,gEAAmE;AACnE,kCAA8D;AAC9D,6CAAyD;AACzD,sDAAiE;AAEpD,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,cAAc;IA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AE,OAAO,EAAE;iBACzB,CAAC,CAAC;gBAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBACvB,MAAM,IAAI,KAAK,CACb,+CAA+C,OAAO,iBAAiB,UAAU,eAAe,QAAQ,iDAAiD,CAC1J,CAAC;gBACJ,CAAC;gBACD,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBACvB,MAAM,IAAI,KAAK,CACb,oCAAoC,QAAQ,YAAY,OAAO,uCAAuC,CACvG,CAAC;gBACJ,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const driveUpdateSharedDrive: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
drive_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
name: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=drive-update-shared-drive.d.ts.map
|