@activepieces/piece-google-drive 0.5.10 → 0.5.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activepieces/piece-google-drive",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
4
4
  "dependencies": {
5
5
  "@sinclair/typebox": "0.26.8",
6
6
  "axios": "^1.6.3",
@@ -16,7 +16,7 @@
16
16
  "@activepieces/pieces-common": "0.2.5",
17
17
  "@activepieces/pieces-framework": "0.7.10",
18
18
  "@activepieces/shared": "0.10.59",
19
- "tslib": "2.6.1"
19
+ "tslib": "1.14.1"
20
20
  },
21
21
  "main": "./src/index.js",
22
22
  "type": "commonjs"
package/src/index.js CHANGED
@@ -12,6 +12,8 @@ const list_files_action_1 = require("./lib/action/list-files.action");
12
12
  const search_folder_action_1 = require("./lib/action/search-folder.action");
13
13
  const duplicate_file_action_1 = require("./lib/action/duplicate-file.action");
14
14
  const save_file_as_pdf_action_1 = require("./lib/action/save-file-as-pdf.action");
15
+ const add_permission_action_1 = require("./lib/action/add-permission.action");
16
+ const delete_permission_action_1 = require("./lib/action/delete-permission.action");
15
17
  exports.googleDriveAuth = pieces_framework_1.PieceAuth.OAuth2({
16
18
  description: "",
17
19
  authUrl: "https://accounts.google.com/o/oauth2/auth",
@@ -25,7 +27,7 @@ exports.googleDrive = (0, pieces_framework_1.createPiece)({
25
27
  displayName: "Google Drive",
26
28
  authors: ['kanarelo', 'BastienMe', 'MoShizzle', 'Armangiau', 'vitalini', 'PFernandez98'],
27
29
  triggers: [new_file_1.newFile, new_folder_1.newFolder],
28
- actions: [create_new_folder_1.googleDriveCreateNewFolder, create_new_text_file_1.googleDriveCreateNewTextFile, upload_file_1.googleDriveUploadFile, read_file_1.readFile, list_files_action_1.googleDriveListFiles, search_folder_action_1.googleDriveSearchFolder, duplicate_file_action_1.duplicateFileAction, save_file_as_pdf_action_1.saveFileAsPdf],
30
+ actions: [create_new_folder_1.googleDriveCreateNewFolder, create_new_text_file_1.googleDriveCreateNewTextFile, upload_file_1.googleDriveUploadFile, read_file_1.readFile, list_files_action_1.googleDriveListFiles, search_folder_action_1.googleDriveSearchFolder, duplicate_file_action_1.duplicateFileAction, save_file_as_pdf_action_1.saveFileAsPdf, add_permission_action_1.addPermission, delete_permission_action_1.deletePermission],
29
31
  auth: exports.googleDriveAuth,
30
32
  });
31
33
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/google-drive/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AAExE,sEAA4E;AAC5E,4EAAiF;AACjF,0DAAiE;AACjE,sDAAkD;AAClD,0DAAsD;AACtD,sDAAkD;AAClD,sEAAsE;AACtE,4EAA4E;AAC5E,8EAAyE;AACzE,kFAAqE;AAExD,QAAA,eAAe,GAAG,4BAAS,CAAC,MAAM,CAAC;IAC5C,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,2CAA2C;IACpD,QAAQ,EAAE,qCAAqC;IAC/C,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,CAAC,uCAAuC,CAAC;CACnD,CAAC,CAAA;AAEW,QAAA,WAAW,GAAG,IAAA,8BAAW,EAAC;IACtC,uBAAuB,EAAE,OAAO;IAC7B,OAAO,EAAE,sDAAsD;IAClE,WAAW,EAAE,cAAc;IAC3B,OAAO,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,CAAC;IACxF,QAAQ,EAAE,CAAC,kBAAO,EAAE,sBAAS,CAAC;IAC9B,OAAO,EAAE,CAAC,8CAA0B,EAAE,mDAA4B,EAAE,mCAAqB,EAAE,oBAAQ,EAAE,wCAAoB,EAAE,8CAAuB,EAAE,2CAAmB,EAAE,uCAAa,CAAC;IACpL,IAAI,EAAE,uBAAe;CACxB,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/google-drive/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AAExE,sEAA4E;AAC5E,4EAAiF;AACjF,0DAAiE;AACjE,sDAAkD;AAClD,0DAAsD;AACtD,sDAAkD;AAClD,sEAAsE;AACtE,4EAA4E;AAC5E,8EAAyE;AACzE,kFAAqE;AACrE,8EAAmE;AACnE,oFAAyE;AAE5D,QAAA,eAAe,GAAG,4BAAS,CAAC,MAAM,CAAC;IAC5C,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,2CAA2C;IACpD,QAAQ,EAAE,qCAAqC;IAC/C,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,CAAC,uCAAuC,CAAC;CACnD,CAAC,CAAA;AAEW,QAAA,WAAW,GAAG,IAAA,8BAAW,EAAC;IACtC,uBAAuB,EAAE,OAAO;IAC7B,OAAO,EAAE,sDAAsD;IAClE,WAAW,EAAE,cAAc;IAC3B,OAAO,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,CAAC;IACxF,QAAQ,EAAE,CAAC,kBAAO,EAAE,sBAAS,CAAC;IAC9B,OAAO,EAAE,CAAC,8CAA0B,EAAE,mDAA4B,EAAE,mCAAqB,EAAE,oBAAQ,EAAE,wCAAoB,EAAE,8CAAuB,EAAE,2CAAmB,EAAE,uCAAa,EAAE,qCAAa,EAAE,2CAAgB,CAAC;IACrN,IAAI,EAAE,uBAAe;CACxB,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const addPermission: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<true, import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ fileId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ user_email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ permission_name: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
5
+ send_invitation_email: import("@activepieces/pieces-framework").CheckboxProperty<true>;
6
+ }>;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addPermission = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const __1 = require("../../");
7
+ const googleapis_1 = require("googleapis");
8
+ const googleapis_common_1 = require("googleapis-common");
9
+ exports.addPermission = (0, pieces_framework_1.createAction)({
10
+ auth: __1.googleDriveAuth,
11
+ name: 'update_permissions',
12
+ description: 'Update permissions for a file or folder',
13
+ displayName: 'Update permissions',
14
+ props: {
15
+ fileId: pieces_framework_1.Property.ShortText({
16
+ displayName: 'File or Folder ID',
17
+ description: 'The ID of the file or folder to update permissions for',
18
+ required: true,
19
+ }),
20
+ user_email: pieces_framework_1.Property.ShortText({
21
+ displayName: 'User email',
22
+ validators: [pieces_framework_1.Validators.email],
23
+ description: 'The email address of the user to update permissions for',
24
+ required: true,
25
+ }),
26
+ permission_name: pieces_framework_1.Property.StaticDropdown({
27
+ displayName: 'Role',
28
+ description: 'The role to grant to user. See more at: https://developers.google.com/drive/api/guides/ref-roles',
29
+ required: true,
30
+ options: {
31
+ options: [
32
+ {
33
+ label: 'Organizer',
34
+ value: 'organizer',
35
+ },
36
+ {
37
+ label: 'File Organizer',
38
+ value: 'fileOrganizer',
39
+ },
40
+ {
41
+ label: 'Writer',
42
+ value: 'writer',
43
+ },
44
+ {
45
+ label: 'Commenter',
46
+ value: 'commenter',
47
+ },
48
+ {
49
+ label: 'Reader',
50
+ value: 'reader',
51
+ },
52
+ ]
53
+ }
54
+ }),
55
+ send_invitation_email: pieces_framework_1.Property.Checkbox({
56
+ displayName: 'Send invitation email',
57
+ description: 'Send an email to the user to notify them of the new permissions',
58
+ required: true,
59
+ }),
60
+ },
61
+ run(context) {
62
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
63
+ const [fileId, user_email, permission_name, send_invitation_email] = [context.propsValue.fileId, context.propsValue.user_email, context.propsValue.permission_name, context.propsValue.send_invitation_email];
64
+ const authClient = new googleapis_common_1.OAuth2Client();
65
+ authClient.setCredentials(context.auth);
66
+ const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
67
+ const permission = { 'type': 'user', 'role': permission_name, 'emailAddress': user_email };
68
+ const result = yield drive.permissions.create({
69
+ requestBody: permission,
70
+ fileId: fileId,
71
+ sendNotificationEmail: send_invitation_email
72
+ });
73
+ return result.data;
74
+ });
75
+ }
76
+ });
77
+ //# sourceMappingURL=add-permission.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-permission.action.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/google-drive/src/lib/action/add-permission.action.ts"],"names":[],"mappings":";;;;AAAA,qEAAoF;AACpF,8BAAyC;AACzC,2CAAoC;AACpC,yDAAiD;AAEpC,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,mBAAe;IACrB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,yCAAyC;IACtD,WAAW,EAAE,oBAAoB;IACjC,KAAK,EAAE;QACH,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,wDAAwD;YACrE,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,YAAY;YACzB,UAAU,EAAE,CAAC,6BAAU,CAAC,KAAK,CAAC;YAC9B,WAAW,EAAE,yDAAyD;YACtE,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,eAAe,EAAG,2BAAQ,CAAC,cAAc,CAAC;YACtC,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,kGAAkG;YAC/G,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACT,OAAO,EAAE;oBACL;wBACI,KAAK,EAAE,WAAW;wBAClB,KA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,IAAI,CAAC;QACvB,CAAC;KAAA;CACJ,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const deletePermission: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<true, import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ fileId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ user_email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ permission_name: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
5
+ }>;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deletePermission = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const __1 = require("../../");
7
+ const googleapis_1 = require("googleapis");
8
+ const googleapis_common_1 = require("googleapis-common");
9
+ exports.deletePermission = (0, pieces_framework_1.createAction)({
10
+ auth: __1.googleDriveAuth,
11
+ name: 'delete_permissions',
12
+ description: 'Removes a role from an user for a file or folder',
13
+ displayName: 'Delete permissions',
14
+ props: {
15
+ fileId: pieces_framework_1.Property.ShortText({
16
+ displayName: 'File or Folder ID',
17
+ description: 'The ID of the file or folder to update permissions for',
18
+ required: true,
19
+ }),
20
+ user_email: pieces_framework_1.Property.ShortText({
21
+ displayName: 'User email',
22
+ validators: [pieces_framework_1.Validators.email],
23
+ description: 'The email address of the user to update permissions for',
24
+ required: true,
25
+ }),
26
+ permission_name: pieces_framework_1.Property.StaticDropdown({
27
+ displayName: 'Role',
28
+ description: 'The role to remove from user.',
29
+ required: true,
30
+ options: {
31
+ options: [
32
+ {
33
+ label: 'Organizer',
34
+ value: 'organizer',
35
+ },
36
+ {
37
+ label: 'File Organizer',
38
+ value: 'fileOrganizer',
39
+ },
40
+ {
41
+ label: 'Writer',
42
+ value: 'writer',
43
+ },
44
+ {
45
+ label: 'Commenter',
46
+ value: 'commenter',
47
+ },
48
+ {
49
+ label: 'Reader',
50
+ value: 'reader',
51
+ },
52
+ ]
53
+ }
54
+ }),
55
+ },
56
+ run(context) {
57
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
58
+ const [fileId, user_email] = [context.propsValue.fileId, context.propsValue.user_email];
59
+ const authClient = new googleapis_common_1.OAuth2Client();
60
+ authClient.setCredentials(context.auth);
61
+ const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
62
+ const response_permissions_list = yield drive.permissions.list({
63
+ fileId: fileId,
64
+ fields: 'permissions(id, emailAddress, role)',
65
+ });
66
+ if (response_permissions_list.data.permissions) {
67
+ for (const permission of response_permissions_list.data.permissions) {
68
+ if (permission.emailAddress === user_email && permission.role === context.propsValue.permission_name) {
69
+ yield drive.permissions.delete({
70
+ fileId: fileId,
71
+ permissionId: permission.id ? permission.id : '',
72
+ });
73
+ return { removed: true, message: 'Permission removed' };
74
+ }
75
+ }
76
+ }
77
+ return { removed: false, message: 'Permission not found' };
78
+ });
79
+ }
80
+ });
81
+ //# sourceMappingURL=delete-permission.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-permission.action.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/google-drive/src/lib/action/delete-permission.action.ts"],"names":[],"mappings":";;;;AAAA,qEAAoF;AACpF,8BAAyC;AACzC,2CAAoC;AACpC,yDAAiD;AAEpC,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,mBAAe;IACrB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,kDAAkD;IAC/D,WAAW,EAAE,oBAAoB;IACjC,KAAK,EAAE;QACH,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,wDAAwD;YACrE,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,YAAY;YACzB,UAAU,EAAE,CAAC,6BAAU,CAAC,KAAK,C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