@activepieces/piece-google-drive 0.7.8 → 0.7.10
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 -79
- 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 -39
- 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 -83
- 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 -36
- 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 -80
- 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 -79
- 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 -42
- 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 -161
- 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 -48
- 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 -30
- 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 -68
- 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 -116
- 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 -40
- 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 -62
- 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 -63
- 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 -103
- 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 -67
- 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;;;;;;;;;EA0ExB,CAAC"}
|
|
@@ -1,79 +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
|
-
audience: 'both',
|
|
14
|
-
aiMetadata: { description: 'Grants a specified role (reader, commenter, writer, fileOrganizer, or organizer) on a Drive file or folder to a user identified by email, optionally sending a notification email. Use to share a resource with a person. Requires the file/folder ID and target email. Not idempotent: each call creates a new permission grant.', idempotent: false },
|
|
15
|
-
displayName: 'Update permissions',
|
|
16
|
-
props: {
|
|
17
|
-
fileId: pieces_framework_1.Property.ShortText({
|
|
18
|
-
displayName: 'File or Folder ID',
|
|
19
|
-
description: 'The ID of the file or folder to update permissions for',
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
user_email: pieces_framework_1.Property.ShortText({
|
|
23
|
-
displayName: 'User email',
|
|
24
|
-
description: 'The email address of the user to update permissions for',
|
|
25
|
-
required: true,
|
|
26
|
-
}),
|
|
27
|
-
permission_name: pieces_framework_1.Property.StaticDropdown({
|
|
28
|
-
displayName: 'Role',
|
|
29
|
-
description: 'The role to grant to user. See more at: https://developers.google.com/drive/api/guides/ref-roles',
|
|
30
|
-
required: true,
|
|
31
|
-
options: {
|
|
32
|
-
options: [
|
|
33
|
-
{
|
|
34
|
-
label: 'Organizer',
|
|
35
|
-
value: 'organizer',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
label: 'File Organizer',
|
|
39
|
-
value: 'fileOrganizer',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
label: 'Writer',
|
|
43
|
-
value: 'writer',
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
label: 'Commenter',
|
|
47
|
-
value: 'commenter',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
label: 'Reader',
|
|
51
|
-
value: 'reader',
|
|
52
|
-
},
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
}),
|
|
56
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
57
|
-
send_invitation_email: pieces_framework_1.Property.Checkbox({
|
|
58
|
-
displayName: 'Send invitation email',
|
|
59
|
-
description: 'Send an email to the user to notify them of the new permissions',
|
|
60
|
-
required: true,
|
|
61
|
-
}),
|
|
62
|
-
},
|
|
63
|
-
run(context) {
|
|
64
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
const { fileId, user_email, permission_name, send_invitation_email, include_team_drives } = context.propsValue;
|
|
66
|
-
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
67
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
68
|
-
const permission = { 'type': 'user', 'role': permission_name, 'emailAddress': user_email };
|
|
69
|
-
const result = yield drive.permissions.create({
|
|
70
|
-
requestBody: permission,
|
|
71
|
-
fileId: fileId,
|
|
72
|
-
sendNotificationEmail: send_invitation_email,
|
|
73
|
-
supportsAllDrives: include_team_drives,
|
|
74
|
-
});
|
|
75
|
-
return result.data;
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
//# 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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,mUAAmU,EAAE,UAAU,EAAE,KAAK,EAAE;IACnX,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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AAqB,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;;;;;;;;;;EAkCrC,CAAC"}
|
|
@@ -1,39 +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
|
-
audience: 'both',
|
|
14
|
-
aiMetadata: { description: 'Creates a new empty folder in Google Drive, optionally nested under a parent folder. Use to set up a destination before uploading or moving files. Not idempotent: each call creates a distinct folder even with the same name (Drive permits duplicate folder names).', idempotent: false },
|
|
15
|
-
displayName: 'Create new folder',
|
|
16
|
-
props: {
|
|
17
|
-
folderName: pieces_framework_1.Property.ShortText({
|
|
18
|
-
displayName: 'Folder name',
|
|
19
|
-
description: 'The name of the new folder',
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
parentFolder: common_1.common.properties.parentFolder,
|
|
23
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
24
|
-
},
|
|
25
|
-
run(context) {
|
|
26
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
28
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
29
|
-
const response = yield drive.files.create({
|
|
30
|
-
requestBody: Object.assign({ mimeType: 'application/vnd.google-apps.folder', name: context.propsValue.folderName }, (context.propsValue.parentFolder
|
|
31
|
-
? { parents: [context.propsValue.parentFolder] }
|
|
32
|
-
: {})),
|
|
33
|
-
supportsAllDrives: context.propsValue.include_team_drives,
|
|
34
|
-
});
|
|
35
|
-
return response.data;
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
//# sourceMappingURL=create-new-folder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-new-folder.js","source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AC,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;;;;;;;;;;;;EAgFvC,CAAC"}
|
|
@@ -1,83 +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
|
-
audience: 'both',
|
|
15
|
-
aiMetadata: { description: 'Creates a new file in Google Drive from inline text content as plain text, CSV, or XML, optionally inside a parent folder. Use when an agent has generated text it needs to persist as a Drive file. Not idempotent: each call creates a new file.', idempotent: false },
|
|
16
|
-
displayName: 'Create new file',
|
|
17
|
-
props: {
|
|
18
|
-
fileName: pieces_framework_1.Property.ShortText({
|
|
19
|
-
displayName: 'File name',
|
|
20
|
-
description: 'The name of the new text file',
|
|
21
|
-
required: true,
|
|
22
|
-
}),
|
|
23
|
-
text: pieces_framework_1.Property.LongText({
|
|
24
|
-
displayName: 'Text',
|
|
25
|
-
description: 'The text content to add to file',
|
|
26
|
-
required: true,
|
|
27
|
-
}),
|
|
28
|
-
fileType: pieces_framework_1.Property.StaticDropdown({
|
|
29
|
-
displayName: 'Content type',
|
|
30
|
-
description: 'Select file type',
|
|
31
|
-
required: true,
|
|
32
|
-
defaultValue: 'plain/text',
|
|
33
|
-
options: {
|
|
34
|
-
options: [
|
|
35
|
-
{
|
|
36
|
-
label: 'Text',
|
|
37
|
-
value: 'plain/text',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
label: 'CSV',
|
|
41
|
-
value: 'text/csv',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
label: 'XML',
|
|
45
|
-
value: 'text/xml',
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
}),
|
|
50
|
-
parentFolder: common_1.common.properties.parentFolder,
|
|
51
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
52
|
-
},
|
|
53
|
-
run(context) {
|
|
54
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const meta = Object.assign({ mimeType: context.propsValue.fileType, name: context.propsValue.fileName }, (context.propsValue.parentFolder
|
|
56
|
-
? { parents: [context.propsValue.parentFolder] }
|
|
57
|
-
: {}));
|
|
58
|
-
const metaBuffer = Buffer.from(JSON.stringify(meta), 'utf-8');
|
|
59
|
-
const textBuffer = Buffer.from(context.propsValue.text, 'utf-8');
|
|
60
|
-
const form = new form_data_1.default();
|
|
61
|
-
form.append('Metadata', metaBuffer, { contentType: 'application/json' });
|
|
62
|
-
form.append('Media', textBuffer, {
|
|
63
|
-
contentType: context.propsValue.fileType,
|
|
64
|
-
});
|
|
65
|
-
const result = yield pieces_common_1.httpClient.sendRequest({
|
|
66
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
67
|
-
url: `https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart`,
|
|
68
|
-
body: form,
|
|
69
|
-
headers: Object.assign({}, form.getHeaders()),
|
|
70
|
-
queryParams: {
|
|
71
|
-
supportsAllDrives: String(context.propsValue.include_team_drives || false),
|
|
72
|
-
},
|
|
73
|
-
authentication: {
|
|
74
|
-
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
75
|
-
token: yield (0, auth_1.getAccessToken)(context.auth),
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
console.debug('File creation response', result);
|
|
79
|
-
return result.body;
|
|
80
|
-
});
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
//# 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,qEA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C;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;;;;;;EA2BhC,CAAC"}
|
|
@@ -1,36 +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
|
-
audience: 'both',
|
|
14
|
-
aiMetadata: { description: 'Permanently deletes a file from Google Drive by its ID, bypassing the trash and making it unrecoverable. Use only when permanent removal is intended; prefer Trash file for reversible deletion. Requires the file ID. Not idempotent: a repeat call fails because the file no longer exists.', idempotent: false },
|
|
15
|
-
displayName: 'Delete file',
|
|
16
|
-
props: {
|
|
17
|
-
fileId: pieces_framework_1.Property.ShortText({
|
|
18
|
-
displayName: 'File ID',
|
|
19
|
-
description: 'The ID of the file to delete',
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
23
|
-
},
|
|
24
|
-
run(context) {
|
|
25
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
27
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
28
|
-
const response = yield drive.files.delete({
|
|
29
|
-
fileId: context.propsValue.fileId,
|
|
30
|
-
supportsAllDrives: context.propsValue.include_team_drives,
|
|
31
|
-
});
|
|
32
|
-
return response.data;
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
//# 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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,+RAA+R,EAAE,UAAU,EAAE,KAAK,EAAE;IAC/U,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;;;;;;;EA6E3B,CAAC"}
|
|
@@ -1,80 +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
|
-
audience: 'both',
|
|
13
|
-
aiMetadata: { description: 'Revokes a specific role from a user (matched by email and role) on a Drive file or folder. Use to unshare or downgrade access for someone. Requires the file/folder ID, the user email, and the role to remove. Idempotent: if no matching permission exists, the call is a no-op.', idempotent: true },
|
|
14
|
-
displayName: 'Delete permissions',
|
|
15
|
-
props: {
|
|
16
|
-
fileId: pieces_framework_1.Property.ShortText({
|
|
17
|
-
displayName: 'File or Folder ID',
|
|
18
|
-
description: 'The ID of the file or folder to update permissions for',
|
|
19
|
-
required: true,
|
|
20
|
-
}),
|
|
21
|
-
user_email: pieces_framework_1.Property.ShortText({
|
|
22
|
-
displayName: 'User 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 = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
60
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
61
|
-
const response_permissions_list = yield drive.permissions.list({
|
|
62
|
-
fileId: fileId,
|
|
63
|
-
fields: 'permissions(id, emailAddress, role)',
|
|
64
|
-
});
|
|
65
|
-
if (response_permissions_list.data.permissions) {
|
|
66
|
-
for (const permission of response_permissions_list.data.permissions) {
|
|
67
|
-
if (permission.emailAddress === user_email && permission.role === context.propsValue.permission_name) {
|
|
68
|
-
yield drive.permissions.delete({
|
|
69
|
-
fileId: fileId,
|
|
70
|
-
permissionId: permission.id ? permission.id : '',
|
|
71
|
-
});
|
|
72
|
-
return { removed: true, message: 'Permission removed' };
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return { removed: false, message: 'Permission not found' };
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
//# 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,kDA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AE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAEhE,MAAM,yBAAyB,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,IAAI,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;;;;;;;;;EA0E9B,CAAC"}
|
|
@@ -1,79 +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
|
-
audience: 'both',
|
|
15
|
-
aiMetadata: { description: 'Copies an existing Drive file into a target folder under a new name, optionally converting it to a Google Sheet or Google Doc. Use to clone a file or create an editable Google-format copy. Requires the source file ID and destination folder ID. Not idempotent: each call creates a new copy.', idempotent: false },
|
|
16
|
-
props: {
|
|
17
|
-
fileId: pieces_framework_1.Property.ShortText({
|
|
18
|
-
displayName: 'File ID',
|
|
19
|
-
description: 'The ID of the file to duplicate',
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
name: pieces_framework_1.Property.ShortText({
|
|
23
|
-
displayName: 'Name',
|
|
24
|
-
description: 'The name of the new file',
|
|
25
|
-
required: true,
|
|
26
|
-
}),
|
|
27
|
-
folderId: pieces_framework_1.Property.ShortText({
|
|
28
|
-
displayName: 'Folder ID',
|
|
29
|
-
description: 'The ID of the folder where the file will be duplicated',
|
|
30
|
-
required: true,
|
|
31
|
-
}),
|
|
32
|
-
mimeType: pieces_framework_1.Property.StaticDropdown({
|
|
33
|
-
displayName: 'Duplicate as',
|
|
34
|
-
description: 'If left unselected the file will be duplicated as it is',
|
|
35
|
-
required: false,
|
|
36
|
-
options: {
|
|
37
|
-
options: [
|
|
38
|
-
{
|
|
39
|
-
label: 'Google Sheets',
|
|
40
|
-
value: 'application/vnd.google-apps.spreadsheet',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
label: 'Google Docs',
|
|
44
|
-
value: 'application/vnd.google-apps.document',
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
}),
|
|
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 authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
54
|
-
const fileId = context.propsValue.fileId;
|
|
55
|
-
const nameForNewFile = context.propsValue.name;
|
|
56
|
-
const parentFolderId = context.propsValue.folderId;
|
|
57
|
-
const mimeType = context.propsValue.mimeType;
|
|
58
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
59
|
-
const requestBody = {
|
|
60
|
-
name: nameForNewFile,
|
|
61
|
-
parents: [parentFolderId],
|
|
62
|
-
};
|
|
63
|
-
if (mimeType) {
|
|
64
|
-
requestBody.mimeType = mimeType;
|
|
65
|
-
}
|
|
66
|
-
const response = yield drive.files.copy({
|
|
67
|
-
fileId,
|
|
68
|
-
auth: authClient,
|
|
69
|
-
requestBody,
|
|
70
|
-
supportsAllDrives: context.propsValue.include_team_drives,
|
|
71
|
-
});
|
|
72
|
-
if (response.status !== 200) {
|
|
73
|
-
throw new Error('Error duplicating file');
|
|
74
|
-
}
|
|
75
|
-
return response.data;
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
//# sourceMappingURL=duplicate-file.action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"duplicate-file.action.js","sourceRoot":"","sources":["../../../../src/lib/action/duplicate-file.action.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,2CAAoC;AACpC,kCAA8D;AAC9D,sCAAmC;AAEtB,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,WAAW,EAAE,gBAAgB;IAC7B,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,8DAA8D;IAC3E,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,mSAAmS,EAAE,UAAU,EAAE,KAAK,EAAE;IACnV,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,iCAAiC;YAC9C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,wDAAwD;YACrE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAChC,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,yDAAyD;YACtE,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP;wBACE,KAAK,EAAE,e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@@ -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;;;;;;EA8BrC,CAAC"}
|
|
@@ -1,42 +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
|
-
audience: 'both',
|
|
15
|
-
aiMetadata: { description: 'Fetches metadata for a single file or folder in Google Drive by its exact ID (name, MIME type, parents, etc.). Use when an agent already has a file/folder ID and needs its details. Read-only and idempotent. Requires the resource ID, not a name or path.', idempotent: true },
|
|
16
|
-
props: {
|
|
17
|
-
id: pieces_framework_1.Property.ShortText({
|
|
18
|
-
displayName: 'File / Folder Id',
|
|
19
|
-
description: 'The Id of the file/folder to search for.',
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
23
|
-
},
|
|
24
|
-
run(context) {
|
|
25
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
27
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
28
|
-
const response = yield drive.files.get({
|
|
29
|
-
fileId: context.propsValue.id,
|
|
30
|
-
supportsAllDrives: context.propsValue.include_team_drives,
|
|
31
|
-
});
|
|
32
|
-
if (response.data) {
|
|
33
|
-
return response.data;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
console.log('The specified ID corresponds to a folder. Returning null.');
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
//# 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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,8PAA8P,EAAE,UAAU,EAAE,IAAI,EAAE;IAC7S,KAAK,EAAE;QACL,EAAE,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,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