@activepieces/piece-google-drive 0.7.0 → 0.7.1
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,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-google-drive",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"types": "./src/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@activepieces/pieces-common": "0.12.0",
|
|
8
8
|
"@activepieces/pieces-framework": "0.26.0",
|
|
9
|
-
"@activepieces/shared": "0.
|
|
9
|
+
"@activepieces/shared": "0.43.0",
|
|
10
10
|
"dayjs": "1.11.9",
|
|
11
11
|
"form-data": "4.0.4",
|
|
12
12
|
"googleapis": "129.0.0",
|
|
@@ -3,5 +3,6 @@ export declare const setPublicAccess: import("@activepieces/pieces-framework").I
|
|
|
3
3
|
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
4
|
}>)[], {
|
|
5
5
|
fileId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
role: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
6
7
|
}>;
|
|
7
8
|
//# sourceMappingURL=set-public-access.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-public-access.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/set-public-access.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"set-public-access.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/set-public-access.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe;;;;;;EA0D1B,CAAC"}
|
|
@@ -17,14 +17,28 @@ exports.setPublicAccess = (0, pieces_framework_1.createAction)({
|
|
|
17
17
|
description: 'The ID of the file or folder to update permissions for',
|
|
18
18
|
required: true,
|
|
19
19
|
}),
|
|
20
|
+
role: pieces_framework_1.Property.StaticDropdown({
|
|
21
|
+
displayName: 'Role',
|
|
22
|
+
description: 'The role to assign for public access',
|
|
23
|
+
options: {
|
|
24
|
+
options: [
|
|
25
|
+
{ label: 'Reader', value: 'reader' },
|
|
26
|
+
{ label: 'Commenter', value: 'commenter' },
|
|
27
|
+
{ label: 'Editor', value: 'writer' },
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
defaultValue: 'reader',
|
|
31
|
+
required: true,
|
|
32
|
+
}),
|
|
20
33
|
},
|
|
21
34
|
run(context) {
|
|
22
35
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
36
|
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
24
37
|
const fileId = context.propsValue.fileId;
|
|
38
|
+
const role = context.propsValue.role;
|
|
25
39
|
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
26
40
|
const permission = {
|
|
27
|
-
role
|
|
41
|
+
role,
|
|
28
42
|
type: 'anyone',
|
|
29
43
|
};
|
|
30
44
|
const res = yield drive.permissions.create({
|
|
@@ -33,8 +47,11 @@ exports.setPublicAccess = (0, pieces_framework_1.createAction)({
|
|
|
33
47
|
});
|
|
34
48
|
const file = yield drive.files.get({
|
|
35
49
|
fileId: fileId,
|
|
36
|
-
fields: 'name,webContentLink',
|
|
50
|
+
fields: 'name,mimeType,webContentLink,webViewLink',
|
|
37
51
|
});
|
|
52
|
+
if (file.data.mimeType === 'application/vnd.google-apps.folder') {
|
|
53
|
+
return Object.assign(Object.assign({}, res.data), { webViewLink: file.data.webViewLink, downloadUrl: null });
|
|
54
|
+
}
|
|
38
55
|
const content = yield (0, get_file_content_1.downloadFileFromDrive)(context.auth, context.files, fileId, file.data.name);
|
|
39
56
|
return Object.assign(Object.assign({}, res.data), { downloadUrl: content });
|
|
40
57
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-public-access.js","sourceRoot":"","sources":["../../../../src/lib/action/set-public-access.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAA8D;AAC9D,2CAAoC;AACpC,iEAAmE;AAEtD,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,wCAAwC;IACrD,WAAW,EAAE,mBAAmB;IAChC,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,wDAAwD;YACrE,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,UAAU,GAAG,MAAM,IAAA,yBAAkB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAE1D,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"set-public-access.js","sourceRoot":"","sources":["../../../../src/lib/action/set-public-access.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAA8D;AAC9D,2CAAoC;AACpC,iEAAmE;AAEtD,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,wCAAwC;IACrD,WAAW,EAAE,mBAAmB;IAChC,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,wDAAwD;YACrE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC5B,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,sCAAsC;YACnD,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;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