@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.
Files changed (85) hide show
  1. package/package.json +7 -20
  2. package/src/index.js +108 -79
  3. package/src/index.d.ts +0 -6
  4. package/src/index.d.ts.map +0 -1
  5. package/src/index.js.map +0 -1
  6. package/src/lib/action/add-permission.action.d.ts +0 -11
  7. package/src/lib/action/add-permission.action.d.ts.map +0 -1
  8. package/src/lib/action/add-permission.action.js +0 -79
  9. package/src/lib/action/add-permission.action.js.map +0 -1
  10. package/src/lib/action/create-new-folder.d.ts +0 -12
  11. package/src/lib/action/create-new-folder.d.ts.map +0 -1
  12. package/src/lib/action/create-new-folder.js +0 -39
  13. package/src/lib/action/create-new-folder.js.map +0 -1
  14. package/src/lib/action/create-new-text-file.d.ts +0 -14
  15. package/src/lib/action/create-new-text-file.d.ts.map +0 -1
  16. package/src/lib/action/create-new-text-file.js +0 -83
  17. package/src/lib/action/create-new-text-file.js.map +0 -1
  18. package/src/lib/action/delete-file.d.ts +0 -8
  19. package/src/lib/action/delete-file.d.ts.map +0 -1
  20. package/src/lib/action/delete-file.js +0 -36
  21. package/src/lib/action/delete-file.js.map +0 -1
  22. package/src/lib/action/delete-permission.action.d.ts +0 -9
  23. package/src/lib/action/delete-permission.action.d.ts.map +0 -1
  24. package/src/lib/action/delete-permission.action.js +0 -80
  25. package/src/lib/action/delete-permission.action.js.map +0 -1
  26. package/src/lib/action/duplicate-file.action.d.ts +0 -11
  27. package/src/lib/action/duplicate-file.action.d.ts.map +0 -1
  28. package/src/lib/action/duplicate-file.action.js +0 -79
  29. package/src/lib/action/duplicate-file.action.js.map +0 -1
  30. package/src/lib/action/get-file-by-id.d.ts +0 -8
  31. package/src/lib/action/get-file-by-id.d.ts.map +0 -1
  32. package/src/lib/action/get-file-by-id.js +0 -42
  33. package/src/lib/action/get-file-by-id.js.map +0 -1
  34. package/src/lib/action/list-files.action.d.ts +0 -11
  35. package/src/lib/action/list-files.action.d.ts.map +0 -1
  36. package/src/lib/action/list-files.action.js +0 -161
  37. package/src/lib/action/list-files.action.js.map +0 -1
  38. package/src/lib/action/move-file.d.ts +0 -12
  39. package/src/lib/action/move-file.d.ts.map +0 -1
  40. package/src/lib/action/move-file.js +0 -48
  41. package/src/lib/action/move-file.js.map +0 -1
  42. package/src/lib/action/read-file.d.ts +0 -8
  43. package/src/lib/action/read-file.d.ts.map +0 -1
  44. package/src/lib/action/read-file.js +0 -30
  45. package/src/lib/action/read-file.js.map +0 -1
  46. package/src/lib/action/save-file-as-pdf.action.d.ts +0 -10
  47. package/src/lib/action/save-file-as-pdf.action.d.ts.map +0 -1
  48. package/src/lib/action/save-file-as-pdf.action.js +0 -68
  49. package/src/lib/action/save-file-as-pdf.action.js.map +0 -1
  50. package/src/lib/action/search-folder-or-file.action.d.ts +0 -15
  51. package/src/lib/action/search-folder-or-file.action.d.ts.map +0 -1
  52. package/src/lib/action/search-folder-or-file.action.js +0 -116
  53. package/src/lib/action/search-folder-or-file.action.js.map +0 -1
  54. package/src/lib/action/send-to-trash.d.ts +0 -8
  55. package/src/lib/action/send-to-trash.d.ts.map +0 -1
  56. package/src/lib/action/send-to-trash.js +0 -40
  57. package/src/lib/action/send-to-trash.js.map +0 -1
  58. package/src/lib/action/set-public-access.d.ts +0 -8
  59. package/src/lib/action/set-public-access.d.ts.map +0 -1
  60. package/src/lib/action/set-public-access.js +0 -62
  61. package/src/lib/action/set-public-access.js.map +0 -1
  62. package/src/lib/action/upload-file.d.ts +0 -13
  63. package/src/lib/action/upload-file.d.ts.map +0 -1
  64. package/src/lib/action/upload-file.js +0 -63
  65. package/src/lib/action/upload-file.js.map +0 -1
  66. package/src/lib/auth.d.ts +0 -11
  67. package/src/lib/auth.d.ts.map +0 -1
  68. package/src/lib/auth.js +0 -86
  69. package/src/lib/auth.js.map +0 -1
  70. package/src/lib/common/get-file-content.d.ts +0 -4
  71. package/src/lib/common/get-file-content.d.ts.map +0 -1
  72. package/src/lib/common/get-file-content.js +0 -69
  73. package/src/lib/common/get-file-content.js.map +0 -1
  74. package/src/lib/common/index.d.ts +0 -23
  75. package/src/lib/common/index.d.ts.map +0 -1
  76. package/src/lib/common/index.js +0 -150
  77. package/src/lib/common/index.js.map +0 -1
  78. package/src/lib/triggers/new-file.d.ts +0 -43
  79. package/src/lib/triggers/new-file.d.ts.map +0 -1
  80. package/src/lib/triggers/new-file.js +0 -103
  81. package/src/lib/triggers/new-file.js.map +0 -1
  82. package/src/lib/triggers/new-folder.d.ts +0 -39
  83. package/src/lib/triggers/new-folder.d.ts.map +0 -1
  84. package/src/lib/triggers/new-folder.js +0 -67
  85. package/src/lib/triggers/new-folder.js.map +0 -1
@@ -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;;;;;;;;;EAwG/B,CAAC"}
@@ -1,161 +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
- audience: 'both',
80
- aiMetadata: { description: 'Lists files and subfolders inside a given Drive folder, with optional recursion to a chosen depth and optional download of each file\'s content. Use to enumerate the contents of a known folder ID. Read-only and idempotent. Requires the folder ID, not a name.', idempotent: true },
81
- props: {
82
- folderId: pieces_framework_1.Property.ShortText({
83
- displayName: 'Folder ID',
84
- description: 'Folder ID coming from | New Folder -> id | (or any other source)',
85
- required: true,
86
- }),
87
- include_team_drives: common_1.common.properties.include_team_drives,
88
- includeTrashed: pieces_framework_1.Property.Checkbox({
89
- displayName: 'Include Trashed',
90
- description: 'Include new files that have been trashed.',
91
- required: false,
92
- defaultValue: false
93
- }),
94
- depthLevel: pieces_framework_1.Property.Number({
95
- displayName: 'Depth Level',
96
- description: 'How many levels deep to search for files. 1 = current folder only, 2 = current + next level, etc.',
97
- required: false,
98
- defaultValue: 1
99
- }),
100
- downloadFiles: pieces_framework_1.Property.Checkbox({
101
- displayName: 'Download Files',
102
- description: 'Download all file contents in a list',
103
- required: false,
104
- defaultValue: false
105
- }),
106
- },
107
- run(context) {
108
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
109
- var _a, _b;
110
- const result = {
111
- type: 'drive#fileList',
112
- incompleteSearch: false,
113
- files: [],
114
- };
115
- const depthLevel = context.propsValue.depthLevel || 1;
116
- // Get files recursively based on depth level
117
- 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);
118
- // Extract just the file objects for backward compatibility
119
- result.files = filesWithLevel.map(f => f.file);
120
- // If downloadFiles is enabled, download each file and add URLs to array
121
- if (context.propsValue.downloadFiles) {
122
- const downloadedFiles = [];
123
- const extensionMap = {
124
- 'application/pdf': '.pdf',
125
- 'image/jpeg': '.jpg',
126
- 'image/png': '.png',
127
- 'image/tiff': '.tiff',
128
- 'text/plain': '.txt',
129
- 'text/csv': '.csv',
130
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': '.docx',
131
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': '.xlsx'
132
- };
133
- for (const fileWithLevel of filesWithLevel) {
134
- const file = fileWithLevel.file;
135
- // Skip folders when downloading
136
- if (file.mimeType === 'application/vnd.google-apps.folder') {
137
- continue;
138
- }
139
- let safeName = file.name;
140
- const correctExtension = extensionMap[file.mimeType];
141
- if (correctExtension && !safeName.toLowerCase().endsWith(correctExtension)) {
142
- // Check for the .jpeg edge case before appending .jpg
143
- if (!(file.mimeType === 'image/jpeg' && safeName.toLowerCase().endsWith('.jpeg'))) {
144
- safeName = safeName + correctExtension;
145
- }
146
- }
147
- try {
148
- const fileUrl = yield (0, get_file_content_1.downloadFileFromDrive)(context.auth, context.files, file.id, safeName);
149
- downloadedFiles.push(fileUrl);
150
- }
151
- catch (error) {
152
- console.warn(`Failed to download file ${file.name}: ${error instanceof Error ? error.message : 'Download failed'}`);
153
- }
154
- }
155
- result.downloadedFiles = downloadedFiles;
156
- }
157
- return result;
158
- });
159
- }
160
- });
161
- //# 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;AAC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B,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;;;;;;;;;;EAwCzB,CAAC"}
@@ -1,48 +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
- audience: 'both',
15
- aiMetadata: { description: 'Relocates a Drive file to a target folder, detaching it from its current parents and attaching it to the new one. Use to reorganize a file once you know its ID and the destination folder ID. Idempotent: repeating with the same destination leaves the file in the same folder.', idempotent: true },
16
- props: {
17
- fileId: pieces_framework_1.Property.ShortText({
18
- displayName: 'File ID',
19
- description: 'You can use **Search Folder/File** action to retrieve ID.',
20
- required: true,
21
- }),
22
- include_team_drives: common_1.common.properties.include_team_drives,
23
- folderId: common_1.common.properties.parentFolder,
24
- },
25
- run(context) {
26
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
27
- var _a;
28
- const fileId = context.propsValue.fileId;
29
- const folderId = context.propsValue.folderId;
30
- const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
31
- const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
32
- const file = yield drive.files.get({
33
- fileId,
34
- supportsAllDrives: context.propsValue.include_team_drives,
35
- fields: 'id,parents',
36
- });
37
- const response = yield drive.files.update({
38
- fileId: fileId,
39
- fields: '*',
40
- removeParents: (_a = file.data.parents) === null || _a === void 0 ? void 0 : _a.join(','),
41
- addParents: folderId,
42
- supportsAllDrives: context.propsValue.include_team_drives,
43
- });
44
- return response.data;
45
- });
46
- },
47
- });
48
- //# 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":";;;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,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;;;;;;EAqBnB,CAAC"}
@@ -1,30 +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
- audience: 'both',
14
- aiMetadata: { description: 'Downloads the content of a Drive file by its file ID and returns it as a usable file reference. Use to retrieve a file an agent already knows the ID of (e.g. from a trigger or search). Read-only and idempotent. Requires the exact file ID, not a name.', idempotent: true },
15
- props: {
16
- fileId: pieces_framework_1.Property.ShortText({
17
- displayName: 'File ID',
18
- description: 'File ID coming from | New File -> id |',
19
- required: true,
20
- }),
21
- fileName: pieces_framework_1.Property.ShortText({
22
- displayName: 'Destination File name',
23
- required: false,
24
- }),
25
- },
26
- run: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, files }) {
27
- return (0, get_file_content_1.downloadFileFromDrive)(auth, files, propsValue.fileId, propsValue.fileName);
28
- }),
29
- });
30
- //# 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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,4PAA4P,EAAE,UAAU,EAAE,IAAI,EAAE;IAC3S,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;;;;;;;;EAiExB,CAAC"}
@@ -1,68 +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
- audience: 'both',
17
- aiMetadata: { description: 'Exports a Google document to PDF and saves it as a new file in a target Drive folder. Use to produce a PDF rendition of a Google Doc/Sheet/Slides for sharing or archival. Requires the source document ID and destination folder ID. Not idempotent: each call creates a new PDF file.', idempotent: false },
18
- props: {
19
- documentId: pieces_framework_1.Property.ShortText({
20
- displayName: 'Document ID',
21
- description: 'The ID of the document to export',
22
- required: true,
23
- }),
24
- folderId: pieces_framework_1.Property.ShortText({
25
- displayName: 'Folder ID',
26
- description: 'The ID of the folder where the file will be exported',
27
- required: true,
28
- }),
29
- name: pieces_framework_1.Property.ShortText({
30
- displayName: 'Name',
31
- description: 'The name of the new file (do not include the extension)',
32
- required: true,
33
- }),
34
- include_team_drives: common_1.common.properties.include_team_drives,
35
- },
36
- run(context) {
37
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
- const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
39
- const documentId = context.propsValue.documentId;
40
- const folderId = context.propsValue.folderId;
41
- const nameForNewFile = context.propsValue.name;
42
- const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
43
- const result = yield drive.files.export({
44
- fileId: documentId,
45
- mimeType: 'application/pdf',
46
- }, {
47
- responseType: 'arraybuffer',
48
- });
49
- const requestBody = {
50
- name: nameForNewFile + '.pdf',
51
- parents: [folderId],
52
- };
53
- const templateBuffer = Buffer.from(result.data, 'base64');
54
- const stream = new stream_1.Stream.PassThrough().end(templateBuffer);
55
- const media = {
56
- mimeType: 'application/pdf',
57
- body: stream,
58
- };
59
- const file = yield drive.files.create({
60
- requestBody,
61
- media: media,
62
- supportsAllDrives: context.propsValue.include_team_drives,
63
- });
64
- return file.data;
65
- });
66
- },
67
- });
68
- //# 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,QAAQ,EAAE,MAAM;IAChB,UAAU,E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MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAW,EAAE,QAAQ,CAAC,CAAC;YAEjE,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAE5D,MAAM,KAAK,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;;;;;;;;;;;;;EAyGlC,CAAC"}
@@ -1,116 +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
- audience: 'both',
15
- aiMetadata: { description: 'Searches Google Drive for files or folders matching a name, full-text, or MIME-type query, optionally scoped to a parent folder and filtered to files or folders only. Use to resolve a file/folder ID from a human-readable name before acting on it. Read-only and idempotent.', idempotent: true },
16
- props: {
17
- queryTerm: pieces_framework_1.Property.StaticDropdown({
18
- displayName: 'Query Term',
19
- description: 'The Query term or field of file/folder to search upon.',
20
- defaultValue: 'name',
21
- options: {
22
- options: [
23
- { label: 'File name', value: 'name' },
24
- { label: 'Full text search', value: 'fullText' },
25
- { label: 'Content type', value: 'mimeType' },
26
- ],
27
- },
28
- required: true,
29
- }),
30
- operator: pieces_framework_1.Property.StaticDropdown({
31
- displayName: 'Operator',
32
- description: 'The operator to create criteria.',
33
- required: true,
34
- options: {
35
- options: [
36
- { label: 'Contains', value: 'contains' },
37
- { label: 'Equals', value: '=' },
38
- ],
39
- },
40
- defaultValue: 'contains',
41
- }),
42
- query: pieces_framework_1.Property.ShortText({
43
- displayName: 'Value',
44
- description: 'Value of the field of file/folder to search for.',
45
- required: true,
46
- }),
47
- type: pieces_framework_1.Property.StaticDropdown({
48
- displayName: 'File Type',
49
- description: '(Optional) Choose between files and folders.',
50
- required: false,
51
- options: {
52
- options: [
53
- { label: 'All', value: 'all' },
54
- { label: 'Files', value: 'file' },
55
- { label: 'Folders', value: 'folder' },
56
- ],
57
- },
58
- defaultValue: 'all',
59
- }),
60
- parentFolder: common_1.common.properties.parentFolder,
61
- include_team_drives: common_1.common.properties.include_team_drives,
62
- },
63
- run(context) {
64
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
65
- var _a, _b, _c, _d, _e;
66
- const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
67
- const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
68
- const operator = (_a = context.propsValue.operator) !== null && _a !== void 0 ? _a : 'contains';
69
- const queryTerm = (_b = context.propsValue.queryTerm) !== null && _b !== void 0 ? _b : 'name';
70
- let finalQuery = `${queryTerm} ${operator} '${context.propsValue.query}'`;
71
- if (context.propsValue.parentFolder) {
72
- finalQuery = `${finalQuery} and '${context.propsValue.parentFolder}' in parents`;
73
- }
74
- const type = (_c = context.propsValue.type) !== null && _c !== void 0 ? _c : 'all';
75
- switch (type) {
76
- case 'file':
77
- finalQuery = `${finalQuery} and mimeType!='application/vnd.google-apps.folder'`;
78
- break;
79
- case 'folder':
80
- finalQuery = `${finalQuery} and mimeType='application/vnd.google-apps.folder'`;
81
- break;
82
- default:
83
- break;
84
- }
85
- const allFiles = [];
86
- let pageToken = undefined;
87
- do {
88
- const listParams = {
89
- q: finalQuery,
90
- fields: 'nextPageToken, files(id, name, mimeType, createdTime, modifiedTime)',
91
- includeItemsFromAllDrives: context.propsValue.include_team_drives,
92
- supportsAllDrives: true,
93
- corpora: context.propsValue.include_team_drives ? 'allDrives' : 'user',
94
- pageSize: 1000,
95
- };
96
- if (pageToken)
97
- listParams.pageToken = pageToken;
98
- const response = yield drive.files.list(listParams);
99
- if (response.status !== 200) {
100
- console.error(response);
101
- throw new Error('Error searching for the file/folder');
102
- }
103
- allFiles.push(...((_d = response.data.files) !== null && _d !== void 0 ? _d : []));
104
- pageToken = (_e = response.data.nextPageToken) !== null && _e !== void 0 ? _e : undefined;
105
- } while (pageToken);
106
- if (allFiles.length > 0) {
107
- return allFiles;
108
- }
109
- else {
110
- console.log('Resource not found');
111
- return [];
112
- }
113
- });
114
- },
115
- });
116
- //# 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,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,QAAQ;IACrB,WAAW,EAAE,oDAAoD;IACjE,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,kRAAkR,EAAE,UAAU,EAAE,IAAI,EAAE;IACjU,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACjC,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,wDAAwD;YACrE,YAAY,EAAE,MAAM;YACpB,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE;oBACrC,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,UAAU,EAAE;oBAChD,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU,EAAE;iBAC7C;aACF;YACD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAChC,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAA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A,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;;;;;;EA8B/B,CAAC"}
@@ -1,40 +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
- audience: 'both',
14
- aiMetadata: { description: 'Moves a Drive file to the trash by its ID, a reversible deletion that can be restored from Drive. Use for safe removal instead of permanent deletion. Requires the file ID. Idempotent: re-trashing an already-trashed file leaves it in the same state.', idempotent: true },
15
- displayName: 'Trash file',
16
- props: {
17
- fileId: pieces_framework_1.Property.ShortText({
18
- displayName: 'File ID',
19
- description: 'The ID of the file to trash',
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 body_value = {
29
- trashed: true,
30
- };
31
- const response = yield drive.files.update({
32
- fileId: context.propsValue.fileId,
33
- supportsAllDrives: context.propsValue.include_team_drives,
34
- requestBody: body_value,
35
- });
36
- return response.data;
37
- });
38
- },
39
- });
40
- //# 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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,0PAA0P,EAAE,UAAU,EAAE,IAAI,EAAE;IACzS,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;;;;;;EA4D1B,CAAC"}