@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
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.googleDriveListFiles = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const auth_1 = require("../auth");
|
|
7
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
8
|
-
const querystring_1 = tslib_1.__importDefault(require("querystring"));
|
|
9
|
-
const common_1 = require("../common");
|
|
10
|
-
const get_file_content_1 = require("../common/get-file-content");
|
|
11
|
-
function getFilesRecursively(auth_2, folderId_1, maxLevel_1, includeTrashed_1, includeTeamDrives_1) {
|
|
12
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* (auth, folderId, maxLevel, includeTrashed, includeTeamDrives, currentLevel = 0) {
|
|
13
|
-
const files = [];
|
|
14
|
-
if (currentLevel > maxLevel) {
|
|
15
|
-
return files;
|
|
16
|
-
}
|
|
17
|
-
const accessToken = yield (0, auth_1.getAccessToken)(auth);
|
|
18
|
-
let q = `'${folderId}' in parents`;
|
|
19
|
-
if (!includeTrashed) {
|
|
20
|
-
q += ' and trashed=false';
|
|
21
|
-
}
|
|
22
|
-
const params = {
|
|
23
|
-
q: q,
|
|
24
|
-
fields: 'nextPageToken,files(id,kind,mimeType,name,trashed,parents)',
|
|
25
|
-
supportsAllDrives: 'true',
|
|
26
|
-
includeItemsFromAllDrives: includeTeamDrives ? 'true' : 'false',
|
|
27
|
-
corpora: includeTeamDrives ? 'allDrives' : 'user',
|
|
28
|
-
pageSize: '1000',
|
|
29
|
-
};
|
|
30
|
-
let response = yield pieces_common_1.httpClient.sendRequest({
|
|
31
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
32
|
-
url: `https://www.googleapis.com/drive/v3/files?${querystring_1.default.stringify(params)}`,
|
|
33
|
-
headers: {
|
|
34
|
-
Authorization: `Bearer ${accessToken}`,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
// Add files from current level
|
|
38
|
-
for (const file of response.body.files) {
|
|
39
|
-
files.push({
|
|
40
|
-
file,
|
|
41
|
-
level: currentLevel,
|
|
42
|
-
parentFolder: folderId
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
// Handle pagination for current level
|
|
46
|
-
while (response.body.nextPageToken) {
|
|
47
|
-
params.pageToken = response.body.nextPageToken;
|
|
48
|
-
response = yield pieces_common_1.httpClient.sendRequest({
|
|
49
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
50
|
-
url: `https://www.googleapis.com/drive/v3/files?${querystring_1.default.stringify(params)}`,
|
|
51
|
-
headers: {
|
|
52
|
-
Authorization: `Bearer ${accessToken}`,
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
for (const file of response.body.files) {
|
|
56
|
-
files.push({
|
|
57
|
-
file,
|
|
58
|
-
level: currentLevel,
|
|
59
|
-
parentFolder: folderId
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
// If we haven't reached max level, recursively get files from subfolders
|
|
64
|
-
if (currentLevel + 1 < maxLevel) {
|
|
65
|
-
const subfolders = files.filter(f => f.file.mimeType === 'application/vnd.google-apps.folder');
|
|
66
|
-
for (const subfolder of subfolders) {
|
|
67
|
-
const subfolderFiles = yield getFilesRecursively(auth, subfolder.file.id, maxLevel, includeTrashed, includeTeamDrives, currentLevel + 1);
|
|
68
|
-
files.push(...subfolderFiles);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return files;
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
exports.googleDriveListFiles = (0, pieces_framework_1.createAction)({
|
|
75
|
-
auth: auth_1.googleDriveAuth,
|
|
76
|
-
name: 'list-files',
|
|
77
|
-
displayName: 'List files',
|
|
78
|
-
description: 'List files from a Google Drive folder',
|
|
79
|
-
props: {
|
|
80
|
-
folderId: pieces_framework_1.Property.ShortText({
|
|
81
|
-
displayName: 'Folder ID',
|
|
82
|
-
description: 'Folder ID coming from | New Folder -> id | (or any other source)',
|
|
83
|
-
required: true,
|
|
84
|
-
}),
|
|
85
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
86
|
-
includeTrashed: pieces_framework_1.Property.Checkbox({
|
|
87
|
-
displayName: 'Include Trashed',
|
|
88
|
-
description: 'Include new files that have been trashed.',
|
|
89
|
-
required: false,
|
|
90
|
-
defaultValue: false
|
|
91
|
-
}),
|
|
92
|
-
depthLevel: pieces_framework_1.Property.Number({
|
|
93
|
-
displayName: 'Depth Level',
|
|
94
|
-
description: 'How many levels deep to search for files. 1 = current folder only, 2 = current + next level, etc.',
|
|
95
|
-
required: false,
|
|
96
|
-
defaultValue: 1
|
|
97
|
-
}),
|
|
98
|
-
downloadFiles: pieces_framework_1.Property.Checkbox({
|
|
99
|
-
displayName: 'Download Files',
|
|
100
|
-
description: 'Download all file contents in a list',
|
|
101
|
-
required: false,
|
|
102
|
-
defaultValue: false
|
|
103
|
-
}),
|
|
104
|
-
},
|
|
105
|
-
run(context) {
|
|
106
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
var _a, _b;
|
|
108
|
-
const result = {
|
|
109
|
-
type: 'drive#fileList',
|
|
110
|
-
incompleteSearch: false,
|
|
111
|
-
files: [],
|
|
112
|
-
};
|
|
113
|
-
const depthLevel = context.propsValue.depthLevel || 1;
|
|
114
|
-
// Get files recursively based on depth level
|
|
115
|
-
const filesWithLevel = yield getFilesRecursively(context.auth, context.propsValue.folderId, depthLevel, (_a = context.propsValue.includeTrashed) !== null && _a !== void 0 ? _a : false, (_b = context.propsValue.include_team_drives) !== null && _b !== void 0 ? _b : false);
|
|
116
|
-
// Extract just the file objects for backward compatibility
|
|
117
|
-
result.files = filesWithLevel.map(f => f.file);
|
|
118
|
-
// If downloadFiles is enabled, download each file and add URLs to array
|
|
119
|
-
if (context.propsValue.downloadFiles) {
|
|
120
|
-
const downloadedFiles = [];
|
|
121
|
-
const extensionMap = {
|
|
122
|
-
'application/pdf': '.pdf',
|
|
123
|
-
'image/jpeg': '.jpg',
|
|
124
|
-
'image/png': '.png',
|
|
125
|
-
'image/tiff': '.tiff',
|
|
126
|
-
'text/plain': '.txt',
|
|
127
|
-
'text/csv': '.csv',
|
|
128
|
-
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': '.docx',
|
|
129
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': '.xlsx'
|
|
130
|
-
};
|
|
131
|
-
for (const fileWithLevel of filesWithLevel) {
|
|
132
|
-
const file = fileWithLevel.file;
|
|
133
|
-
// Skip folders when downloading
|
|
134
|
-
if (file.mimeType === 'application/vnd.google-apps.folder') {
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
let safeName = file.name;
|
|
138
|
-
const correctExtension = extensionMap[file.mimeType];
|
|
139
|
-
if (correctExtension && !safeName.toLowerCase().endsWith(correctExtension)) {
|
|
140
|
-
// Check for the .jpeg edge case before appending .jpg
|
|
141
|
-
if (!(file.mimeType === 'image/jpeg' && safeName.toLowerCase().endsWith('.jpeg'))) {
|
|
142
|
-
safeName = safeName + correctExtension;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
try {
|
|
146
|
-
const fileUrl = yield (0, get_file_content_1.downloadFileFromDrive)(context.auth, context.files, file.id, safeName);
|
|
147
|
-
downloadedFiles.push(fileUrl);
|
|
148
|
-
}
|
|
149
|
-
catch (error) {
|
|
150
|
-
console.warn(`Failed to download file ${file.name}: ${error instanceof Error ? error.message : 'Download failed'}`);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
result.downloadedFiles = downloadedFiles;
|
|
154
|
-
}
|
|
155
|
-
return result;
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
//# sourceMappingURL=list-files.action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-files.action.js","sourceRoot":"","sources":["../../../../src/lib/action/list-files.action.ts"],"names":[],"mappings":";;;;AAAA,+DAAqE;AACrE,kCAA0D;AAC1D,qEAAwE;AACxE,sEAAsC;AACtC,sCAAmC;AACnC,iEAAmE;AAenE,SAAe,mBAAmB;iEAChC,IAAS,EACT,QAAgB,EAChB,QAAgB,EAChB,cAAuB,EACvB,iBAA0B,EAC1B,YAAY,GAAG,CAAC;QAEhB,MAAM,KAAK,GAAoB,EAAE,CAAC;QAElC,IAAI,YAAY,GAAG,QAAQ,EAAE,CAAC;YAC5B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,IAAA,qBAAc,EAAC,IAAI,CAAC,CAAC;QAE/C,IAAI,CAAC,GAAG,IAAI,QAAQ,cAAc,CAAC;QACnC,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,CAAC,IAAI,oBAAoB,CAAC;QAC5B,CAAC;QAED,MAAM,MAAM,GAA2B;YACrC,CAAC,EAAE,CAAC;YACJ,MAAM,EAAE,4DAA4D;YACpE,iBAAiB,EAAE,MAAM;YACzB,yBAAyB,EAAE,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;YAC/D,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM;YACjD,QAAQ,EAAE,MAAM;SACjB,CAAC;QAEF,IAAI,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;YAC1C,MAAM,EAAE,0BAAU,CAAC,GAAG;YACtB,GAAG,EAAE,6CAA6C,qBAAW,CAAC,SAAS,CAAC,MAAM,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Y,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;4BAChF,QAAQ,GAAG,QAAQ,GAAG,gBAAgB,CAAC;wBAC3C,CAAC;oBACL,CAAC;oBAED,IAAI,CAAC;wBACH,MAAM,OAAO,GAAG,MAAM,IAAA,wCAAqB,EACzC,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,KAAK,EACb,IAAI,CAAC,EAAE,EACP,QAAQ,CACT,CAAC;wBACF,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBAChC,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,OAAO,CAAC,IAAI,CAAC,2BAA2B,IAAI,CAAC,IAAI,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC;oBACtH,CAAC;gBACH,CAAC;gBACD,MAAM,CAAC,eAAe,GAAG,eAAe,CAAC;YAC3C,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const moveFileAction: 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
|
-
folderId: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
8
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
9
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
-
}>)[]>;
|
|
11
|
-
}>;
|
|
12
|
-
//# sourceMappingURL=move-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"move-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/move-file.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc;;;;;;;;;;EAsCzB,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.moveFileAction = 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 common_1 = require("../common");
|
|
8
|
-
const googleapis_1 = require("googleapis");
|
|
9
|
-
exports.moveFileAction = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: auth_1.googleDriveAuth,
|
|
11
|
-
name: 'google-drive-move-file',
|
|
12
|
-
displayName: 'Move File',
|
|
13
|
-
description: 'Moves a file from one folder to another.',
|
|
14
|
-
props: {
|
|
15
|
-
fileId: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'File ID',
|
|
17
|
-
description: 'You can use **Search Folder/File** action to retrieve ID.',
|
|
18
|
-
required: true,
|
|
19
|
-
}),
|
|
20
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
21
|
-
folderId: common_1.common.properties.parentFolder,
|
|
22
|
-
},
|
|
23
|
-
run(context) {
|
|
24
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
var _a;
|
|
26
|
-
const fileId = context.propsValue.fileId;
|
|
27
|
-
const folderId = context.propsValue.folderId;
|
|
28
|
-
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
29
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
30
|
-
const file = yield drive.files.get({
|
|
31
|
-
fileId,
|
|
32
|
-
supportsAllDrives: context.propsValue.include_team_drives,
|
|
33
|
-
fields: 'id,parents',
|
|
34
|
-
});
|
|
35
|
-
const response = yield drive.files.update({
|
|
36
|
-
fileId: fileId,
|
|
37
|
-
fields: '*',
|
|
38
|
-
removeParents: (_a = file.data.parents) === null || _a === void 0 ? void 0 : _a.join(','),
|
|
39
|
-
addParents: folderId,
|
|
40
|
-
supportsAllDrives: context.propsValue.include_team_drives,
|
|
41
|
-
});
|
|
42
|
-
return response.data;
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
//# sourceMappingURL=move-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"move-file.js","sourceRoot":"","sources":["../../../../src/lib/action/move-file.ts"],"names":[],"mappings":";;;;AAAA,kCAA8D;AAC9D,qEAAwE;AACxE,sCAAmC;AACnC,2CAAoC;AAEvB,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,0CAA0C;IACvD,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,2DAA2D;YACxE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,mBAAmB,EAAE,eAAM,CAAC,UAAU,CAAC,mBAAmB;QAC1D,QAAQ,EAAE,eAAM,CAAC,UAAU,CAAC,YAAY;KACzC;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;YACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;YAE7C,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,IAAI,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;gBACjC,MAAM;gBACN,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,mBAAmB;gBACzD,MAAM,EAAE,YAAY;aACrB,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;gBACxC,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE,GAAG;gBACX,aAAa,EAAE,MAAA,IAAI,CAAC,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC,GAAG,CAAC;gBAC3C,UAAU,EAAE,QAAQ;gBACpB,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,mBAAmB;aAC1D,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const readFile: 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
|
-
fileName: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
-
}>;
|
|
8
|
-
//# sourceMappingURL=read-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/read-file.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ;;;;;;EAmBnB,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readFile = 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 get_file_content_1 = require("../common/get-file-content");
|
|
8
|
-
exports.readFile = (0, pieces_framework_1.createAction)({
|
|
9
|
-
auth: auth_1.googleDriveAuth,
|
|
10
|
-
name: 'read-file',
|
|
11
|
-
displayName: 'Read File Content',
|
|
12
|
-
description: 'Read a selected file from google drive file',
|
|
13
|
-
props: {
|
|
14
|
-
fileId: pieces_framework_1.Property.ShortText({
|
|
15
|
-
displayName: 'File ID',
|
|
16
|
-
description: 'File ID coming from | New File -> id |',
|
|
17
|
-
required: true,
|
|
18
|
-
}),
|
|
19
|
-
fileName: pieces_framework_1.Property.ShortText({
|
|
20
|
-
displayName: 'Destination File name',
|
|
21
|
-
required: false,
|
|
22
|
-
}),
|
|
23
|
-
},
|
|
24
|
-
run: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, files }) {
|
|
25
|
-
return (0, get_file_content_1.downloadFileFromDrive)(auth, files, propsValue.fileId, propsValue.fileName);
|
|
26
|
-
}),
|
|
27
|
-
});
|
|
28
|
-
//# sourceMappingURL=read-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read-file.js","sourceRoot":"","sources":["../../../../src/lib/action/read-file.ts"],"names":[],"mappings":";;;;AAAA,kCAA0C;AAC1C,qEAAwE;AACxE,iEAAmE;AAEtD,QAAA,QAAQ,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,6CAA6C;IAC1D,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACD,GAAG,EAAE,KAAoC,EAAE,oDAA/B,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE;QACrC,OAAO,IAAA,wCAAqB,EAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;IACnF,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const saveFileAsPdf: 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
|
-
documentId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
folderId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
include_team_drives: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=save-file-as-pdf.action.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"save-file-as-pdf.action.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/save-file-as-pdf.action.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,aAAa;;;;;;;;EA+DxB,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.saveFileAsPdf = void 0;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const auth_1 = require("../auth");
|
|
7
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
8
|
-
const googleapis_1 = require("googleapis");
|
|
9
|
-
const stream_1 = require("stream");
|
|
10
|
-
const common_1 = require("../common");
|
|
11
|
-
exports.saveFileAsPdf = (0, pieces_framework_1.createAction)({
|
|
12
|
-
displayName: 'Save Document as PDF',
|
|
13
|
-
auth: auth_1.googleDriveAuth,
|
|
14
|
-
name: 'save_file_as_pdf',
|
|
15
|
-
description: 'Save a document as PDF in a Google Drive folder',
|
|
16
|
-
props: {
|
|
17
|
-
documentId: pieces_framework_1.Property.ShortText({
|
|
18
|
-
displayName: 'Document ID',
|
|
19
|
-
description: 'The ID of the document to export',
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
folderId: pieces_framework_1.Property.ShortText({
|
|
23
|
-
displayName: 'Folder ID',
|
|
24
|
-
description: 'The ID of the folder where the file will be exported',
|
|
25
|
-
required: true,
|
|
26
|
-
}),
|
|
27
|
-
name: pieces_framework_1.Property.ShortText({
|
|
28
|
-
displayName: 'Name',
|
|
29
|
-
description: 'The name of the new file (do not include the extension)',
|
|
30
|
-
required: true,
|
|
31
|
-
}),
|
|
32
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
33
|
-
},
|
|
34
|
-
run(context) {
|
|
35
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
37
|
-
const documentId = context.propsValue.documentId;
|
|
38
|
-
const folderId = context.propsValue.folderId;
|
|
39
|
-
const nameForNewFile = context.propsValue.name;
|
|
40
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
41
|
-
const result = yield drive.files.export({
|
|
42
|
-
fileId: documentId,
|
|
43
|
-
mimeType: 'application/pdf',
|
|
44
|
-
}, {
|
|
45
|
-
responseType: 'arraybuffer',
|
|
46
|
-
});
|
|
47
|
-
const requestBody = {
|
|
48
|
-
name: nameForNewFile + '.pdf',
|
|
49
|
-
parents: [folderId],
|
|
50
|
-
};
|
|
51
|
-
const templateBuffer = Buffer.from(result.data, 'base64');
|
|
52
|
-
const stream = new stream_1.Stream.PassThrough().end(templateBuffer);
|
|
53
|
-
const media = {
|
|
54
|
-
mimeType: 'application/pdf',
|
|
55
|
-
body: stream,
|
|
56
|
-
};
|
|
57
|
-
const file = yield drive.files.create({
|
|
58
|
-
requestBody,
|
|
59
|
-
media: media,
|
|
60
|
-
supportsAllDrives: context.propsValue.include_team_drives,
|
|
61
|
-
});
|
|
62
|
-
return file.data;
|
|
63
|
-
});
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
//# sourceMappingURL=save-file-as-pdf.action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"save-file-as-pdf.action.js","sourceRoot":"","sources":["../../../../src/lib/action/save-file-as-pdf.action.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;;AAEvD,kCAA8D;AAC9D,qEAAwE;AACxE,2CAAoC;AACpC,mCAAgC;AAChC,sCAAmC;AAEtB,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,WAAW,EAAE,sBAAsB;IACnC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,iDAAiD;IAC9D,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,E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AAK,GAAG;gBACZ,QAAQ,EAAE,iBAAiB;gBAC3B,IAAI,EAAE,MAAM;aACb,CAAC;YAEF,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;gBACpC,WAAW;gBACX,KAAK,EAAE,KAAK;gBACZ,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,mBAAmB;aAC1D,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const googleDriveSearchFolder: 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
|
-
queryTerm: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
6
|
-
operator: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
7
|
-
query: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
9
|
-
parentFolder: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
10
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
11
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
-
}>)[]>;
|
|
13
|
-
include_team_drives: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
14
|
-
}>;
|
|
15
|
-
//# sourceMappingURL=search-folder-or-file.action.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-folder-or-file.action.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/search-folder-or-file.action.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;EAuGlC,CAAC"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.googleDriveSearchFolder = 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.googleDriveSearchFolder = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: auth_1.googleDriveAuth,
|
|
11
|
-
name: 'search-folder',
|
|
12
|
-
displayName: 'Search',
|
|
13
|
-
description: 'Search a Google Drive folder for files/sub-folders',
|
|
14
|
-
props: {
|
|
15
|
-
queryTerm: pieces_framework_1.Property.StaticDropdown({
|
|
16
|
-
displayName: 'Query Term',
|
|
17
|
-
description: 'The Query term or field of file/folder to search upon.',
|
|
18
|
-
defaultValue: 'name',
|
|
19
|
-
options: {
|
|
20
|
-
options: [
|
|
21
|
-
{ label: 'File name', value: 'name' },
|
|
22
|
-
{ label: 'Full text search', value: 'fullText' },
|
|
23
|
-
{ label: 'Content type', value: 'mimeType' },
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
required: true,
|
|
27
|
-
}),
|
|
28
|
-
operator: pieces_framework_1.Property.StaticDropdown({
|
|
29
|
-
displayName: 'Operator',
|
|
30
|
-
description: 'The operator to create criteria.',
|
|
31
|
-
required: true,
|
|
32
|
-
options: {
|
|
33
|
-
options: [
|
|
34
|
-
{ label: 'Contains', value: 'contains' },
|
|
35
|
-
{ label: 'Equals', value: '=' },
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
defaultValue: 'contains',
|
|
39
|
-
}),
|
|
40
|
-
query: pieces_framework_1.Property.ShortText({
|
|
41
|
-
displayName: 'Value',
|
|
42
|
-
description: 'Value of the field of file/folder to search for.',
|
|
43
|
-
required: true,
|
|
44
|
-
}),
|
|
45
|
-
type: pieces_framework_1.Property.StaticDropdown({
|
|
46
|
-
displayName: 'File Type',
|
|
47
|
-
description: '(Optional) Choose between files and folders.',
|
|
48
|
-
required: false,
|
|
49
|
-
options: {
|
|
50
|
-
options: [
|
|
51
|
-
{ label: 'All', value: 'all' },
|
|
52
|
-
{ label: 'Files', value: 'file' },
|
|
53
|
-
{ label: 'Folders', value: 'folder' },
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
defaultValue: 'all',
|
|
57
|
-
}),
|
|
58
|
-
parentFolder: common_1.common.properties.parentFolder,
|
|
59
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
60
|
-
},
|
|
61
|
-
run(context) {
|
|
62
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
var _a, _b, _c, _d, _e;
|
|
64
|
-
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
65
|
-
const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
|
|
66
|
-
const operator = (_a = context.propsValue.operator) !== null && _a !== void 0 ? _a : 'contains';
|
|
67
|
-
const queryTerm = (_b = context.propsValue.queryTerm) !== null && _b !== void 0 ? _b : 'name';
|
|
68
|
-
let finalQuery = `${queryTerm} ${operator} '${context.propsValue.query}'`;
|
|
69
|
-
if (context.propsValue.parentFolder) {
|
|
70
|
-
finalQuery = `${finalQuery} and '${context.propsValue.parentFolder}' in parents`;
|
|
71
|
-
}
|
|
72
|
-
const type = (_c = context.propsValue.type) !== null && _c !== void 0 ? _c : 'all';
|
|
73
|
-
switch (type) {
|
|
74
|
-
case 'file':
|
|
75
|
-
finalQuery = `${finalQuery} and mimeType!='application/vnd.google-apps.folder'`;
|
|
76
|
-
break;
|
|
77
|
-
case 'folder':
|
|
78
|
-
finalQuery = `${finalQuery} and mimeType='application/vnd.google-apps.folder'`;
|
|
79
|
-
break;
|
|
80
|
-
default:
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
const allFiles = [];
|
|
84
|
-
let pageToken = undefined;
|
|
85
|
-
do {
|
|
86
|
-
const listParams = {
|
|
87
|
-
q: finalQuery,
|
|
88
|
-
fields: 'nextPageToken, files(id, name, mimeType, createdTime, modifiedTime)',
|
|
89
|
-
includeItemsFromAllDrives: context.propsValue.include_team_drives,
|
|
90
|
-
supportsAllDrives: true,
|
|
91
|
-
corpora: context.propsValue.include_team_drives ? 'allDrives' : 'user',
|
|
92
|
-
pageSize: 1000,
|
|
93
|
-
};
|
|
94
|
-
if (pageToken)
|
|
95
|
-
listParams.pageToken = pageToken;
|
|
96
|
-
const response = yield drive.files.list(listParams);
|
|
97
|
-
if (response.status !== 200) {
|
|
98
|
-
console.error(response);
|
|
99
|
-
throw new Error('Error searching for the file/folder');
|
|
100
|
-
}
|
|
101
|
-
allFiles.push(...((_d = response.data.files) !== null && _d !== void 0 ? _d : []));
|
|
102
|
-
pageToken = (_e = response.data.nextPageToken) !== null && _e !== void 0 ? _e : undefined;
|
|
103
|
-
} while (pageToken);
|
|
104
|
-
if (allFiles.length > 0) {
|
|
105
|
-
return allFiles;
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
console.log('Resource not found');
|
|
109
|
-
return [];
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
//# sourceMappingURL=search-folder-or-file.action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-folder-or-file.action.js","sourceRoot":"","sources":["../../../../src/lib/action/search-folder-or-file.action.ts"],"names":[],"mappings":";;;;AAAA,kCAA8D;AAC9D,qEAAwE;AACxE,2CAAoC;AACpC,sCAAmC;AAEtB,QAAA,uBAAuB,GAAG,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SAAS,CAAC;YAC9C,GAAG,CAAC;gBACF,MAAM,UAAU,GAAwB;oBACtC,CAAC,EAAE,UAAU;oBACb,MAAM,EAAE,qEAAqE;oBAC7E,yBAAyB,EAAE,OAAO,CAAC,UAAU,CAAC,mBAAmB;oBACjE,iBAAiB,EAAE,IAAI;oBACvB,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM;oBACtE,QAAQ,EAAE,IAAI;iBACf,CAAC;gBACF,IAAI,SAAS;oBAAE,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC;gBAChD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBACpD,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;oBAC5B,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;oBACxB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;gBACzD,CAAC;gBACD,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,MAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,CAAC;gBAC9C,SAAS,GAAG,MAAA,QAAQ,CAAC,IAAI,CAAC,aAAa,mCAAI,SAAS,CAAC;YACvD,CAAC,QAAQ,SAAS,EAAE;YAEpB,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACxB,OAAO,QAAQ,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;gBAClC,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const googleDriveTrashFile: 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=send-to-trash.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-to-trash.d.ts","sourceRoot":"","sources":["../../../../src/lib/action/send-to-trash.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB;;;;;;EA4B/B,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.googleDriveTrashFile = 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.googleDriveTrashFile = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: auth_1.googleDriveAuth,
|
|
11
|
-
name: 'trash_gdrive_file',
|
|
12
|
-
description: 'Move a file to the trash in your Google Drive',
|
|
13
|
-
displayName: 'Trash file',
|
|
14
|
-
props: {
|
|
15
|
-
fileId: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'File ID',
|
|
17
|
-
description: 'The ID of the file to trash',
|
|
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 body_value = {
|
|
27
|
-
trashed: true,
|
|
28
|
-
};
|
|
29
|
-
const response = yield drive.files.update({
|
|
30
|
-
fileId: context.propsValue.fileId,
|
|
31
|
-
supportsAllDrives: context.propsValue.include_team_drives,
|
|
32
|
-
requestBody: body_value,
|
|
33
|
-
});
|
|
34
|
-
return response.data;
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=send-to-trash.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-to-trash.js","sourceRoot":"","sources":["../../../../src/lib/action/send-to-trash.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAA8D;AAC9D,sCAAmC;AACnC,2CAAoC;AAEvB,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,+CAA+C;IAC5D,WAAW,EAAE,YAAY;IACzB,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,6BAA6B;YAC1C,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;YAChE,MAAM,UAAU,GAAG;gBACjB,OAAO,EAAE,IAAI;aACd,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;gBACxC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM;gBACjC,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,mBAAmB;gBACzD,WAAW,EAAE,UAAU;aACxB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const setPublicAccess: 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
|
-
role: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
7
|
-
}>;
|
|
8
|
-
//# sourceMappingURL=set-public-access.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|