@activepieces/piece-google-drive 0.7.7 → 0.7.9
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 +7 -20
- package/src/index.js +108 -79
- package/src/index.d.ts +0 -6
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/action/add-permission.action.d.ts +0 -11
- package/src/lib/action/add-permission.action.d.ts.map +0 -1
- package/src/lib/action/add-permission.action.js +0 -77
- package/src/lib/action/add-permission.action.js.map +0 -1
- package/src/lib/action/create-new-folder.d.ts +0 -12
- package/src/lib/action/create-new-folder.d.ts.map +0 -1
- package/src/lib/action/create-new-folder.js +0 -37
- package/src/lib/action/create-new-folder.js.map +0 -1
- package/src/lib/action/create-new-text-file.d.ts +0 -14
- package/src/lib/action/create-new-text-file.d.ts.map +0 -1
- package/src/lib/action/create-new-text-file.js +0 -81
- package/src/lib/action/create-new-text-file.js.map +0 -1
- package/src/lib/action/delete-file.d.ts +0 -8
- package/src/lib/action/delete-file.d.ts.map +0 -1
- package/src/lib/action/delete-file.js +0 -34
- package/src/lib/action/delete-file.js.map +0 -1
- package/src/lib/action/delete-permission.action.d.ts +0 -9
- package/src/lib/action/delete-permission.action.d.ts.map +0 -1
- package/src/lib/action/delete-permission.action.js +0 -78
- package/src/lib/action/delete-permission.action.js.map +0 -1
- package/src/lib/action/duplicate-file.action.d.ts +0 -11
- package/src/lib/action/duplicate-file.action.d.ts.map +0 -1
- package/src/lib/action/duplicate-file.action.js +0 -77
- package/src/lib/action/duplicate-file.action.js.map +0 -1
- package/src/lib/action/get-file-by-id.d.ts +0 -8
- package/src/lib/action/get-file-by-id.d.ts.map +0 -1
- package/src/lib/action/get-file-by-id.js +0 -40
- package/src/lib/action/get-file-by-id.js.map +0 -1
- package/src/lib/action/list-files.action.d.ts +0 -11
- package/src/lib/action/list-files.action.d.ts.map +0 -1
- package/src/lib/action/list-files.action.js +0 -159
- package/src/lib/action/list-files.action.js.map +0 -1
- package/src/lib/action/move-file.d.ts +0 -12
- package/src/lib/action/move-file.d.ts.map +0 -1
- package/src/lib/action/move-file.js +0 -46
- package/src/lib/action/move-file.js.map +0 -1
- package/src/lib/action/read-file.d.ts +0 -8
- package/src/lib/action/read-file.d.ts.map +0 -1
- package/src/lib/action/read-file.js +0 -28
- package/src/lib/action/read-file.js.map +0 -1
- package/src/lib/action/save-file-as-pdf.action.d.ts +0 -10
- package/src/lib/action/save-file-as-pdf.action.d.ts.map +0 -1
- package/src/lib/action/save-file-as-pdf.action.js +0 -66
- package/src/lib/action/save-file-as-pdf.action.js.map +0 -1
- package/src/lib/action/search-folder-or-file.action.d.ts +0 -15
- package/src/lib/action/search-folder-or-file.action.d.ts.map +0 -1
- package/src/lib/action/search-folder-or-file.action.js +0 -114
- package/src/lib/action/search-folder-or-file.action.js.map +0 -1
- package/src/lib/action/send-to-trash.d.ts +0 -8
- package/src/lib/action/send-to-trash.d.ts.map +0 -1
- package/src/lib/action/send-to-trash.js +0 -38
- package/src/lib/action/send-to-trash.js.map +0 -1
- package/src/lib/action/set-public-access.d.ts +0 -8
- package/src/lib/action/set-public-access.d.ts.map +0 -1
- package/src/lib/action/set-public-access.js +0 -60
- package/src/lib/action/set-public-access.js.map +0 -1
- package/src/lib/action/upload-file.d.ts +0 -13
- package/src/lib/action/upload-file.d.ts.map +0 -1
- package/src/lib/action/upload-file.js +0 -61
- package/src/lib/action/upload-file.js.map +0 -1
- package/src/lib/auth.d.ts +0 -11
- package/src/lib/auth.d.ts.map +0 -1
- package/src/lib/auth.js +0 -86
- package/src/lib/auth.js.map +0 -1
- package/src/lib/common/get-file-content.d.ts +0 -4
- package/src/lib/common/get-file-content.d.ts.map +0 -1
- package/src/lib/common/get-file-content.js +0 -69
- package/src/lib/common/get-file-content.js.map +0 -1
- package/src/lib/common/index.d.ts +0 -23
- package/src/lib/common/index.d.ts.map +0 -1
- package/src/lib/common/index.js +0 -150
- package/src/lib/common/index.js.map +0 -1
- package/src/lib/triggers/new-file.d.ts +0 -43
- package/src/lib/triggers/new-file.d.ts.map +0 -1
- package/src/lib/triggers/new-file.js +0 -100
- package/src/lib/triggers/new-file.js.map +0 -1
- package/src/lib/triggers/new-folder.d.ts +0 -39
- package/src/lib/triggers/new-folder.d.ts.map +0 -1
- package/src/lib/triggers/new-folder.js +0 -64
- package/src/lib/triggers/new-folder.js.map +0 -1
package/src/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { googleDriveAuth, getAccessToken, GoogleDriveAuthValue, createGoogleClient } from './lib/auth';
|
|
2
|
-
export declare const googleDrive: import("@activepieces/pieces-framework").Piece<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
4
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
-
}>)[]>;
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
package/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEvG,eAAO,MAAM,WAAW;;;MA8CtB,CAAC"}
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAEwC;AAExC,+DAAwE;AACxE,iDAAqD;AACrD,8EAAmE;AACnE,sEAA4E;AAC5E,4EAAiF;AACjF,oFAAyE;AACzE,8EAAyE;AACzE,gEAAyE;AACzE,sEAAsE;AACtE,sDAAkD;AAClD,kFAAqE;AACrE,4FAAoF;AACpF,0DAAiE;AACjE,sDAAkD;AAClD,0DAAsD;AACtD,sEAAiE;AACjE,sDAAwD;AACxD,0DAAiE;AACjE,8DAAkE;AAClE,qCAAmF;AAEnF,mCAAuG;AAA9F,uGAAA,eAAe,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAwB,0GAAA,kBAAkB,OAAA;AAErE,QAAA,WAAW,GAAG,IAAA,8BAAW,EAAC;IACrC,uBAAuB,EAAE,OAAO;IAChC,OAAO,EAAE,sDAAsD;IAC/D,UAAU,EAAE,CAAC,sBAAa,CAAC,iBAAiB,CAAC;IAC7C,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,+BAA+B;IAC5C,OAAO,EAAE;QACP,WAAW;QACX,YAAY;QACZ,UAAU;QACV,cAAc;QACd,UAAU;QACV,YAAY;QACZ,YAAY;QACZ,WAAW;QACX,sBAAsB;QACtB,eAAe;QACf,UAAU;QACV,SAAS;KACV;IACD,QAAQ,EAAE,CAAC,kBAAO,EAAE,sBAAS,CAAC;IAC9B,OAAO,EAAE;QACP,8CAA0B;QAC1B,mDAA4B;QAC5B,mCAAqB;QACrB,oBAAQ;QACR,2CAA0B;QAC1B,wCAAoB;QACpB,sDAAuB;QACvB,2CAAmB;QACnB,uCAAa;QACb,qCAAa;QACb,2CAAgB;QAChB,mCAAe;QACf,0BAAc;QACd,mCAAqB;QACrB,oCAAoB;QACpB,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,qCAAqC;YACpD,IAAI,EAAE,sBAAe;YACrB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,UAAU,MAAM,IAAA,qBAAc,EAAC,IAA4B,CAAC,EAAE;iBAC9E,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,IAAI,EAAE,sBAAe;CACtB,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const addPermission: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
3
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}>)[], {
|
|
5
|
-
fileId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
user_email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
permission_name: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
-
include_team_drives: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
9
|
-
send_invitation_email: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
10
|
-
}>;
|
|
11
|
-
//# sourceMappingURL=add-permission.action.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-permission.action.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/add-permission.action.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;;;;;;;EAwExB,CAAC"}
|
|
@@ -1,77 +0,0 @@
|
|
|
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 auth_1 = require("../auth");
|
|
7
|
-
const googleapis_1 = require("googleapis");
|
|
8
|
-
const common_1 = require("../common");
|
|
9
|
-
exports.addPermission = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: 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
|
-
description: 'The email address of the user to update permissions for',
|
|
23
|
-
required: true,
|
|
24
|
-
}),
|
|
25
|
-
permission_name: pieces_framework_1.Property.StaticDropdown({
|
|
26
|
-
displayName: 'Role',
|
|
27
|
-
description: 'The role to grant to user. See more at: https://developers.google.com/drive/api/guides/ref-roles',
|
|
28
|
-
required: true,
|
|
29
|
-
options: {
|
|
30
|
-
options: [
|
|
31
|
-
{
|
|
32
|
-
label: 'Organizer',
|
|
33
|
-
value: 'organizer',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: 'File Organizer',
|
|
37
|
-
value: 'fileOrganizer',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
label: 'Writer',
|
|
41
|
-
value: 'writer',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
label: 'Commenter',
|
|
45
|
-
value: 'commenter',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
label: 'Reader',
|
|
49
|
-
value: 'reader',
|
|
50
|
-
},
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
}),
|
|
54
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
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, include_team_drives } = context.propsValue;
|
|
64
|
-
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
65
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
66
|
-
const permission = { 'type': 'user', 'role': permission_name, 'emailAddress': user_email };
|
|
67
|
-
const result = yield drive.permissions.create({
|
|
68
|
-
requestBody: permission,
|
|
69
|
-
fileId: fileId,
|
|
70
|
-
sendNotificationEmail: send_invitation_email,
|
|
71
|
-
supportsAllDrives: include_team_drives,
|
|
72
|
-
});
|
|
73
|
-
return result.data;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
//# sourceMappingURL=add-permission.action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-permission.action.js","sourceRoot":"","sources":["../../../../src/lib/action/add-permission.action.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAA8D;AAC9D,2CAAoC;AACpC,sCAAmC;AAEtB,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,sBAAe;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,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,KAAK,EAAE,WAAW;qBACrB;oBACD;wBACI,KAAK,EAAE,gBAAgB;wBACvB,KAAK,EAAE,eAAe;qBACzB;oBACD;wBACI,KAAK,EAAE,QAAQ;wBACf,KAAK,EAAE,QAAQ;qBAClB;oBACD;wBACI,KAAK,EAAE,WAAW;wBAClB,KAAK,EAAE,WAAW;qBACrB;oBACD;wBACI,KAAK,EAAE,QAAQ;wBACf,KAAK,EAAE,QAAQ;qBAClB;iBAEJ;aACA;SACJ,CAAC;QACF,mBAAmB,EAAE,eAAM,CAAC,UAAU,CAAC,mBAAmB;QAC1D,qBAAqB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACrC,WAAW,EAAE,uBAAuB;YACpC,WAAW,EAAE,iEAAiE;YAC9E,QAAQ,EAAE,IAAI;SACjB,CAAC;KACF;IAEE,GAAG,CAAC,OAAO;;YACb,MAAM,EAAC,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,qBAAqB,EAAC,mBAAmB,EAAC,GAAG,OAAO,CAAC,UAAU,CAAC;YAE5G,MAAM,UAAU,GAAG,MAAM,IAAA,yBAAkB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAE1D,MAAM,KAAK,GAAG,mBAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAEhE,MAAM,UAAU,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC;YAE3F,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC;gBAC1C,WAAW,EAAE,UAAU;gBACvB,MAAM,EAAE,MAAM;gBACd,qBAAqB,EAAE,qBAAqB;gBAC5C,iBAAiB,EAAE,mBAAmB;aACzC,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const googleDriveCreateNewFolder: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
3
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}>)[], {
|
|
5
|
-
folderName: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
parentFolder: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
7
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
8
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
-
}>)[]>;
|
|
10
|
-
include_team_drives: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
11
|
-
}>;
|
|
12
|
-
//# sourceMappingURL=create-new-folder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-new-folder.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/create-new-folder.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,0BAA0B;;;;;;;;;;EAgCrC,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.googleDriveCreateNewFolder = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const auth_1 = require("../auth");
|
|
7
|
-
const common_1 = require("../common");
|
|
8
|
-
const googleapis_1 = require("googleapis");
|
|
9
|
-
exports.googleDriveCreateNewFolder = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: auth_1.googleDriveAuth,
|
|
11
|
-
name: 'create_new_gdrive_folder',
|
|
12
|
-
description: 'Create a new empty folder in your Google Drive',
|
|
13
|
-
displayName: 'Create new folder',
|
|
14
|
-
props: {
|
|
15
|
-
folderName: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'Folder name',
|
|
17
|
-
description: 'The name of the new folder',
|
|
18
|
-
required: true,
|
|
19
|
-
}),
|
|
20
|
-
parentFolder: common_1.common.properties.parentFolder,
|
|
21
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
22
|
-
},
|
|
23
|
-
run(context) {
|
|
24
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
26
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
27
|
-
const response = yield drive.files.create({
|
|
28
|
-
requestBody: Object.assign({ mimeType: 'application/vnd.google-apps.folder', name: context.propsValue.folderName }, (context.propsValue.parentFolder
|
|
29
|
-
? { parents: [context.propsValue.parentFolder] }
|
|
30
|
-
: {})),
|
|
31
|
-
supportsAllDrives: context.propsValue.include_team_drives,
|
|
32
|
-
});
|
|
33
|
-
return response.data;
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=create-new-folder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-new-folder.js","sourceRoot":"","sources":["../../../../src/lib/action/create-new-folder.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAA8D;AAC9D,sCAAmC;AACnC,2CAAoC;AAEvB,QAAA,0BAA0B,GAAG,IAAA,+BAAY,EAAC;IACrD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,gDAAgD;IAC7D,WAAW,EAAE,mBAAmB;IAChC,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,YAAY,EAAE,eAAM,CAAC,UAAU,CAAC,YAAY;QAC5C,mBAAmB,EAAE,eAAM,CAAC,UAAU,CAAC,mBAAmB;KAC3D;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,UAAU,GAAG,MAAM,IAAA,yBAAkB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAE1D,MAAM,KAAK,GAAG,mBAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAEhE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;gBACxC,WAAW,kBACT,QAAQ,EAAE,oCAAoC,EAC9C,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU,IAChC,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY;oBACjC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;oBAChD,CAAC,CAAC,EAAE,CAAC,CACR;gBACD,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,mBAAmB;aAC1D,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const googleDriveCreateNewTextFile: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
3
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}>)[], {
|
|
5
|
-
fileName: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
text: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
7
|
-
fileType: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
-
parentFolder: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
10
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
-
}>)[]>;
|
|
12
|
-
include_team_drives: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
13
|
-
}>;
|
|
14
|
-
//# sourceMappingURL=create-new-text-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-new-text-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/create-new-text-file.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;EA8EvC,CAAC"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.googleDriveCreateNewTextFile = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const form_data_1 = tslib_1.__importDefault(require("form-data"));
|
|
8
|
-
const auth_1 = require("../auth");
|
|
9
|
-
const common_1 = require("../common");
|
|
10
|
-
exports.googleDriveCreateNewTextFile = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.googleDriveAuth,
|
|
12
|
-
name: 'create_new_gdrive_file',
|
|
13
|
-
description: 'Create a new text file in your Google Drive from text',
|
|
14
|
-
displayName: 'Create new file',
|
|
15
|
-
props: {
|
|
16
|
-
fileName: pieces_framework_1.Property.ShortText({
|
|
17
|
-
displayName: 'File name',
|
|
18
|
-
description: 'The name of the new text file',
|
|
19
|
-
required: true,
|
|
20
|
-
}),
|
|
21
|
-
text: pieces_framework_1.Property.LongText({
|
|
22
|
-
displayName: 'Text',
|
|
23
|
-
description: 'The text content to add to file',
|
|
24
|
-
required: true,
|
|
25
|
-
}),
|
|
26
|
-
fileType: pieces_framework_1.Property.StaticDropdown({
|
|
27
|
-
displayName: 'Content type',
|
|
28
|
-
description: 'Select file type',
|
|
29
|
-
required: true,
|
|
30
|
-
defaultValue: 'plain/text',
|
|
31
|
-
options: {
|
|
32
|
-
options: [
|
|
33
|
-
{
|
|
34
|
-
label: 'Text',
|
|
35
|
-
value: 'plain/text',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
label: 'CSV',
|
|
39
|
-
value: 'text/csv',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
label: 'XML',
|
|
43
|
-
value: 'text/xml',
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
}),
|
|
48
|
-
parentFolder: common_1.common.properties.parentFolder,
|
|
49
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
50
|
-
},
|
|
51
|
-
run(context) {
|
|
52
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
const meta = Object.assign({ mimeType: context.propsValue.fileType, name: context.propsValue.fileName }, (context.propsValue.parentFolder
|
|
54
|
-
? { parents: [context.propsValue.parentFolder] }
|
|
55
|
-
: {}));
|
|
56
|
-
const metaBuffer = Buffer.from(JSON.stringify(meta), 'utf-8');
|
|
57
|
-
const textBuffer = Buffer.from(context.propsValue.text, 'utf-8');
|
|
58
|
-
const form = new form_data_1.default();
|
|
59
|
-
form.append('Metadata', metaBuffer, { contentType: 'application/json' });
|
|
60
|
-
form.append('Media', textBuffer, {
|
|
61
|
-
contentType: context.propsValue.fileType,
|
|
62
|
-
});
|
|
63
|
-
const result = yield pieces_common_1.httpClient.sendRequest({
|
|
64
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
65
|
-
url: `https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart`,
|
|
66
|
-
body: form,
|
|
67
|
-
headers: Object.assign({}, form.getHeaders()),
|
|
68
|
-
queryParams: {
|
|
69
|
-
supportsAllDrives: String(context.propsValue.include_team_drives || false),
|
|
70
|
-
},
|
|
71
|
-
authentication: {
|
|
72
|
-
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
73
|
-
token: yield (0, auth_1.getAccessToken)(context.auth),
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
console.debug('File creation response', result);
|
|
77
|
-
return result.body;
|
|
78
|
-
});
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
//# sourceMappingURL=create-new-text-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-new-text-file.js","sourceRoot":"","sources":["../../../../src/lib/action/create-new-text-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,kEAAiC;AACjC,kCAA0D;AAC1D,sCAAmC;AAEtB,QAAA,4BAA4B,GAAG,IAAA,+BAAY,EAAC;IACvD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,uDAAuD;IACpE,WAAW,EAAE,iBAAiB;IAC9B,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,iCAAiC;YAC9C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAChC,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,kBAAkB;YAC/B,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,YAAY;YAC1B,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP;wB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C5E,IAAI,EAAE,IAAI;gBACV,OAAO,oBACF,IAAI,CAAC,UAAU,EAAE,CACrB;gBACD,WAAW,EAAE;oBACX,iBAAiB,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,mBAAmB,IAAI,KAAK,CAAC;iBAC3E;gBACD,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,MAAM,IAAA,qBAAc,EAAC,OAAO,CAAC,IAAI,CAAC;iBAC1C;aACF,CAAC,CAAC;YAEH,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;YAChD,OAAO,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const googleDriveDeleteFile: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
3
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}>)[], {
|
|
5
|
-
fileId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
include_team_drives: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
7
|
-
}>;
|
|
8
|
-
//# sourceMappingURL=delete-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/delete-file.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB;;;;;;EAyBhC,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.googleDriveDeleteFile = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const auth_1 = require("../auth");
|
|
7
|
-
const common_1 = require("../common");
|
|
8
|
-
const googleapis_1 = require("googleapis");
|
|
9
|
-
exports.googleDriveDeleteFile = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: auth_1.googleDriveAuth,
|
|
11
|
-
name: 'delete_gdrive_file',
|
|
12
|
-
description: 'Delete permanently a file from your Google Drive',
|
|
13
|
-
displayName: 'Delete file',
|
|
14
|
-
props: {
|
|
15
|
-
fileId: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'File ID',
|
|
17
|
-
description: 'The ID of the file to delete',
|
|
18
|
-
required: true,
|
|
19
|
-
}),
|
|
20
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
21
|
-
},
|
|
22
|
-
run(context) {
|
|
23
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
25
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
26
|
-
const response = yield drive.files.delete({
|
|
27
|
-
fileId: context.propsValue.fileId,
|
|
28
|
-
supportsAllDrives: context.propsValue.include_team_drives,
|
|
29
|
-
});
|
|
30
|
-
return response.data;
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
//# sourceMappingURL=delete-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete-file.js","sourceRoot":"","sources":["../../../../src/lib/action/delete-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAA8D;AAC9D,sCAAmC;AACnC,2CAAoC;AAEvB,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,kDAAkD;IAC/D,WAAW,EAAE,aAAa;IAC1B,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,mBAAmB,EAAE,eAAM,CAAC,UAAU,CAAC,mBAAmB;KAC3D;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,UAAU,GAAG,MAAM,IAAA,yBAAkB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAE1D,MAAM,KAAK,GAAG,mBAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAEhE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;gBACxC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM;gBACjC,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,mBAAmB;aAC1D,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const deletePermission: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
3
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}>)[], {
|
|
5
|
-
fileId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
user_email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
permission_name: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
-
}>;
|
|
9
|
-
//# sourceMappingURL=delete-permission.action.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete-permission.action.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/delete-permission.action.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB;;;;;;;EA2E3B,CAAC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
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 auth_1 = require("../auth");
|
|
7
|
-
const googleapis_1 = require("googleapis");
|
|
8
|
-
exports.deletePermission = (0, pieces_framework_1.createAction)({
|
|
9
|
-
auth: auth_1.googleDriveAuth,
|
|
10
|
-
name: 'delete_permissions',
|
|
11
|
-
description: 'Removes a role from an user for a file or folder',
|
|
12
|
-
displayName: 'Delete permissions',
|
|
13
|
-
props: {
|
|
14
|
-
fileId: pieces_framework_1.Property.ShortText({
|
|
15
|
-
displayName: 'File or Folder ID',
|
|
16
|
-
description: 'The ID of the file or folder to update permissions for',
|
|
17
|
-
required: true,
|
|
18
|
-
}),
|
|
19
|
-
user_email: pieces_framework_1.Property.ShortText({
|
|
20
|
-
displayName: 'User email',
|
|
21
|
-
description: 'The email address of the user to update permissions for',
|
|
22
|
-
required: true,
|
|
23
|
-
}),
|
|
24
|
-
permission_name: pieces_framework_1.Property.StaticDropdown({
|
|
25
|
-
displayName: 'Role',
|
|
26
|
-
description: 'The role to remove from user.',
|
|
27
|
-
required: true,
|
|
28
|
-
options: {
|
|
29
|
-
options: [
|
|
30
|
-
{
|
|
31
|
-
label: 'Organizer',
|
|
32
|
-
value: 'organizer',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
label: 'File Organizer',
|
|
36
|
-
value: 'fileOrganizer',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
label: 'Writer',
|
|
40
|
-
value: 'writer',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
label: 'Commenter',
|
|
44
|
-
value: 'commenter',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
label: 'Reader',
|
|
48
|
-
value: 'reader',
|
|
49
|
-
},
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
}),
|
|
53
|
-
},
|
|
54
|
-
run(context) {
|
|
55
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
const [fileId, user_email] = [context.propsValue.fileId, context.propsValue.user_email];
|
|
57
|
-
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
58
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
59
|
-
const response_permissions_list = yield drive.permissions.list({
|
|
60
|
-
fileId: fileId,
|
|
61
|
-
fields: 'permissions(id, emailAddress, role)',
|
|
62
|
-
});
|
|
63
|
-
if (response_permissions_list.data.permissions) {
|
|
64
|
-
for (const permission of response_permissions_list.data.permissions) {
|
|
65
|
-
if (permission.emailAddress === user_email && permission.role === context.propsValue.permission_name) {
|
|
66
|
-
yield drive.permissions.delete({
|
|
67
|
-
fileId: fileId,
|
|
68
|
-
permissionId: permission.id ? permission.id : '',
|
|
69
|
-
});
|
|
70
|
-
return { removed: true, message: 'Permission removed' };
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return { removed: false, message: 'Permission not found' };
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
//# sourceMappingURL=delete-permission.action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete-permission.action.js","sourceRoot":"","sources":["../../../../src/lib/action/delete-permission.action.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAA8D;AAC9D,2CAAoC;AAEvB,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,kDAAkD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CAAC;gBAC3D,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE,qCAAqC;aAEhD,CAAC,CAAC;YAEH,IAAI,yBAAyB,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gBAE7C,KAAK,MAAM,UAAU,IAAI,yBAAyB,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;oBAClE,IAAI,UAAU,CAAC,YAAY,KAAK,UAAU,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;wBACnG,MAAM,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC;4BAC3B,MAAM,EAAE,MAAM;4BACd,YAAY,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;yBACnD,CAAC,CAAC;wBACH,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,oBAAoB,EAAC,CAAC;oBAC1D,CAAC;gBACL,CAAC;YACL,CAAC;YAED,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAC,CAAC;QAE7D,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const duplicateFileAction: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
3
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}>)[], {
|
|
5
|
-
fileId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
folderId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
mimeType: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
9
|
-
include_team_drives: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
10
|
-
}>;
|
|
11
|
-
//# sourceMappingURL=duplicate-file.action.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"duplicate-file.action.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/duplicate-file.action.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,mBAAmB;;;;;;;;;EAwE9B,CAAC"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.duplicateFileAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const googleapis_1 = require("googleapis");
|
|
7
|
-
const auth_1 = require("../auth");
|
|
8
|
-
const common_1 = require("../common");
|
|
9
|
-
exports.duplicateFileAction = (0, pieces_framework_1.createAction)({
|
|
10
|
-
displayName: 'Duplicate File',
|
|
11
|
-
auth: auth_1.googleDriveAuth,
|
|
12
|
-
name: 'duplicate_file',
|
|
13
|
-
description: 'Duplicate a file from Google Drive. Returns the new file ID.',
|
|
14
|
-
props: {
|
|
15
|
-
fileId: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'File ID',
|
|
17
|
-
description: 'The ID of the file to duplicate',
|
|
18
|
-
required: true,
|
|
19
|
-
}),
|
|
20
|
-
name: pieces_framework_1.Property.ShortText({
|
|
21
|
-
displayName: 'Name',
|
|
22
|
-
description: 'The name of the new file',
|
|
23
|
-
required: true,
|
|
24
|
-
}),
|
|
25
|
-
folderId: pieces_framework_1.Property.ShortText({
|
|
26
|
-
displayName: 'Folder ID',
|
|
27
|
-
description: 'The ID of the folder where the file will be duplicated',
|
|
28
|
-
required: true,
|
|
29
|
-
}),
|
|
30
|
-
mimeType: pieces_framework_1.Property.StaticDropdown({
|
|
31
|
-
displayName: 'Duplicate as',
|
|
32
|
-
description: 'If left unselected the file will be duplicated as it is',
|
|
33
|
-
required: false,
|
|
34
|
-
options: {
|
|
35
|
-
options: [
|
|
36
|
-
{
|
|
37
|
-
label: 'Google Sheets',
|
|
38
|
-
value: 'application/vnd.google-apps.spreadsheet',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
label: 'Google Docs',
|
|
42
|
-
value: 'application/vnd.google-apps.document',
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
}),
|
|
47
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
48
|
-
},
|
|
49
|
-
run(context) {
|
|
50
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
52
|
-
const fileId = context.propsValue.fileId;
|
|
53
|
-
const nameForNewFile = context.propsValue.name;
|
|
54
|
-
const parentFolderId = context.propsValue.folderId;
|
|
55
|
-
const mimeType = context.propsValue.mimeType;
|
|
56
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
57
|
-
const requestBody = {
|
|
58
|
-
name: nameForNewFile,
|
|
59
|
-
parents: [parentFolderId],
|
|
60
|
-
};
|
|
61
|
-
if (mimeType) {
|
|
62
|
-
requestBody.mimeType = mimeType;
|
|
63
|
-
}
|
|
64
|
-
const response = yield drive.files.copy({
|
|
65
|
-
fileId,
|
|
66
|
-
auth: authClient,
|
|
67
|
-
requestBody,
|
|
68
|
-
supportsAllDrives: context.propsValue.include_team_drives,
|
|
69
|
-
});
|
|
70
|
-
if (response.status !== 200) {
|
|
71
|
-
throw new Error('Error duplicating file');
|
|
72
|
-
}
|
|
73
|
-
return response.data;
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
//# sourceMappingURL=duplicate-file.action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"duplicate-file.action.js","sourceRoot":"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G,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;YAC/C,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;YACnD,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;YAE7C,MAAM,KAAK,GAAG,mBAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAEhE,MAAM,WAAW,GAAQ;gBACvB,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,CAAC,cAAc,CAAC;aAC1B,CAAC;YAEF,IAAI,QAAQ,EAAE,CAAC;gBACb,WAAW,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAClC,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;gBACtC,MAAM;gBACN,IAAI,EAAE,UAAU;gBAChB,WAAW;gBACX,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,mBAAmB;aAC1D,CAAC,CAAC;YAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;YAC5C,CAAC;YAED,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const googleDriveGetResourceById: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
3
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}>)[], {
|
|
5
|
-
id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
include_team_drives: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
7
|
-
}>;
|
|
8
|
-
//# sourceMappingURL=get-file-by-id.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-by-id.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/get-file-by-id.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,0BAA0B;;;;;;EA4BrC,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.googleDriveGetResourceById = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const auth_1 = require("../auth");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const googleapis_1 = require("googleapis");
|
|
8
|
-
const common_1 = require("../common");
|
|
9
|
-
exports.googleDriveGetResourceById = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: auth_1.googleDriveAuth,
|
|
11
|
-
name: 'get-file-or-folder-by-id',
|
|
12
|
-
displayName: 'Get File Information',
|
|
13
|
-
description: 'Get a file folder for files/sub-folders',
|
|
14
|
-
props: {
|
|
15
|
-
id: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'File / Folder Id',
|
|
17
|
-
description: 'The Id of the file/folder to search for.',
|
|
18
|
-
required: true,
|
|
19
|
-
}),
|
|
20
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
21
|
-
},
|
|
22
|
-
run(context) {
|
|
23
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
25
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
26
|
-
const response = yield drive.files.get({
|
|
27
|
-
fileId: context.propsValue.id,
|
|
28
|
-
supportsAllDrives: context.propsValue.include_team_drives,
|
|
29
|
-
});
|
|
30
|
-
if (response.data) {
|
|
31
|
-
return response.data;
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
console.log('The specified ID corresponds to a folder. Returning null.');
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
//# sourceMappingURL=get-file-by-id.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-by-id.js","sourceRoot":"","sources":["../../../../src/lib/action/get-file-by-id.ts"],"names":[],"mappings":";;;;AAAA,kCAA8D;AAC9D,qEAAwE;AACxE,2CAAoC;AACpC,sCAAmC;AAEtB,QAAA,0BAA0B,GAAG,IAAA,+BAAY,EAAC;IACrD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,yCAAyC;IACtD,KAAK,EAAE;QACL,EAAE,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EAAE,0CAA0C;YACvD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,mBAAmB,EAAE,eAAM,CAAC,UAAU,CAAC,mBAAmB;KAC3D;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,UAAU,GAAG,MAAM,IAAA,yBAAkB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC1D,MAAM,KAAK,GAAG,mBAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAChE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;gBACrC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE;gBAC7B,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,mBAAmB;aAC1D,CAAC,CAAC;YAEH,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAClB,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;gBACzE,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const googleDriveListFiles: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
3
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}>)[], {
|
|
5
|
-
folderId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
include_team_drives: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
7
|
-
includeTrashed: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
8
|
-
depthLevel: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
9
|
-
downloadFiles: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
10
|
-
}>;
|
|
11
|
-
//# sourceMappingURL=list-files.action.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-files.action.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/list-files.action.ts"],"names":[],"mappings":"AA2GA,eAAO,MAAM,oBAAoB;;;;;;;;;EAsG/B,CAAC"}
|