@activepieces/piece-google-drive 0.5.5 → 0.5.6

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,19 +1,21 @@
1
1
  {
2
2
  "name": "@activepieces/piece-google-drive",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "dependencies": {
5
5
  "@sinclair/typebox": "0.26.8",
6
- "axios": "^1.6.0",
6
+ "axios": "^1.6.3",
7
7
  "dayjs": "1.11.9",
8
8
  "form-data": "4.0.0",
9
+ "googleapis": "129.0.0",
10
+ "googleapis-common": "7.0.1",
9
11
  "is-base64": "1.1.0",
10
12
  "lodash": "4.17.21",
11
13
  "mime-types": "2.1.35",
12
14
  "nanoid": "3.3.6",
13
15
  "semver": "7.5.4",
14
16
  "@activepieces/pieces-common": "0.2.5",
15
- "@activepieces/pieces-framework": "0.7.4",
16
- "@activepieces/shared": "0.10.44",
17
+ "@activepieces/pieces-framework": "0.7.5",
18
+ "@activepieces/shared": "0.10.48",
17
19
  "tslib": "1.14.1"
18
20
  },
19
21
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -9,6 +9,7 @@ const new_file_1 = require("./lib/triggers/new-file");
9
9
  const new_folder_1 = require("./lib/triggers/new-folder");
10
10
  const read_file_1 = require("./lib/action/read-file");
11
11
  const list_files_action_1 = require("./lib/action/list-files.action");
12
+ const search_folder_action_1 = require("./lib/action/search-folder.action");
12
13
  exports.googleDriveAuth = pieces_framework_1.PieceAuth.OAuth2({
13
14
  description: "",
14
15
  authUrl: "https://accounts.google.com/o/oauth2/auth",
@@ -17,9 +18,9 @@ exports.googleDriveAuth = pieces_framework_1.PieceAuth.OAuth2({
17
18
  scope: ["https://www.googleapis.com/auth/drive"]
18
19
  });
19
20
  exports.googleDrive = (0, pieces_framework_1.createPiece)({
20
- minimumSupportedRelease: '0.5.0',
21
+ minimumSupportedRelease: '0.5.6',
21
22
  logoUrl: 'https://cdn.activepieces.com/pieces/google-drive.png',
22
- actions: [create_new_folder_1.googleDriveCreateNewFolder, create_new_text_file_1.googleDriveCreateNewTextFile, upload_file_1.googleDriveUploadFile, read_file_1.readFile, list_files_action_1.googleDriveListFiles],
23
+ actions: [create_new_folder_1.googleDriveCreateNewFolder, create_new_text_file_1.googleDriveCreateNewTextFile, upload_file_1.googleDriveUploadFile, read_file_1.readFile, list_files_action_1.googleDriveListFiles, search_folder_action_1.googleDriveSearchFolder],
23
24
  displayName: "Google Drive",
24
25
  authors: ['kanarelo', 'BastienMe', 'MoShizzle', 'Armangiau', 'vitalini', 'pfernandez98'],
25
26
  triggers: [new_file_1.newFile, new_folder_1.newFolder],
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/google-drive/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AAExE,sEAA4E;AAC5E,4EAAiF;AACjF,0DAAiE;AACjE,sDAAkD;AAClD,0DAAsD;AACtD,sDAAkD;AAClD,sEAAsE;AAEzD,QAAA,eAAe,GAAG,4BAAS,CAAC,MAAM,CAAC;IAC5C,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,2CAA2C;IACpD,QAAQ,EAAE,qCAAqC;IAC/C,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,CAAC,uCAAuC,CAAC;CACnD,CAAC,CAAA;AAEW,QAAA,WAAW,GAAG,IAAA,8BAAW,EAAC;IACtC,uBAAuB,EAAE,OAAO;IAC7B,OAAO,EAAE,sDAAsD;IAClE,OAAO,EAAE,CAAC,8CAA0B,EAAE,mDAA4B,EAAE,mCAAqB,EAAE,oBAAQ,EAAE,wCAAoB,CAAC;IAC1H,WAAW,EAAE,cAAc;IAC3B,OAAO,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,CAAC;IACxF,QAAQ,EAAE,CAAC,kBAAO,EAAE,sBAAS,CAAC;IAC3B,IAAI,EAAE,uBAAe;CACxB,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/google-drive/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AAExE,sEAA4E;AAC5E,4EAAiF;AACjF,0DAAiE;AACjE,sDAAkD;AAClD,0DAAsD;AACtD,sDAAkD;AAClD,sEAAsE;AACtE,4EAA4E;AAE/D,QAAA,eAAe,GAAG,4BAAS,CAAC,MAAM,CAAC;IAC5C,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,2CAA2C;IACpD,QAAQ,EAAE,qCAAqC;IAC/C,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,CAAC,uCAAuC,CAAC;CACnD,CAAC,CAAA;AAEW,QAAA,WAAW,GAAG,IAAA,8BAAW,EAAC;IACtC,uBAAuB,EAAE,OAAO;IAC7B,OAAO,EAAE,sDAAsD;IAClE,OAAO,EAAE,CAAC,8CAA0B,EAAE,mDAA4B,EAAE,mCAAqB,EAAE,oBAAQ,EAAE,wCAAoB,EAAE,8CAAuB,CAAC;IACnJ,WAAW,EAAE,cAAc;IAC3B,OAAO,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,CAAC;IACxF,QAAQ,EAAE,CAAC,kBAAO,EAAE,sBAAS,CAAC;IAC3B,IAAI,EAAE,uBAAe;CACxB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const googleDriveSearchFolder: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<true, import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ query: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ }>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.googleDriveSearchFolder = void 0;
4
+ const tslib_1 = require("tslib");
5
+ /* eslint-disable @typescript-eslint/no-explicit-any */
6
+ const index_1 = require("../../index");
7
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
8
+ const googleapis_1 = require("googleapis");
9
+ const googleapis_common_1 = require("googleapis-common");
10
+ exports.googleDriveSearchFolder = (0, pieces_framework_1.createAction)({
11
+ auth: index_1.googleDriveAuth,
12
+ name: 'search-folder',
13
+ displayName: 'Search folder',
14
+ description: 'Search folder from a Google Drive folder',
15
+ props: {
16
+ query: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Name',
18
+ description: 'Name to search for',
19
+ required: true,
20
+ }),
21
+ },
22
+ run(context) {
23
+ var _a;
24
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
25
+ const authClient = new googleapis_common_1.OAuth2Client();
26
+ authClient.setCredentials(context.auth);
27
+ const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
28
+ const query = `name contains '${context.propsValue.query}' and mimeType='application/vnd.google-apps.folder'`;
29
+ const response = yield drive.files.list({
30
+ q: query,
31
+ fields: 'files(id, name)'
32
+ });
33
+ if (response.status !== 200) {
34
+ console.error(response);
35
+ throw new Error('Error searching folder');
36
+ }
37
+ const folders = (_a = response.data.files) !== null && _a !== void 0 ? _a : [];
38
+ if (folders.length > 0) {
39
+ return folders;
40
+ }
41
+ else {
42
+ console.log('Folder not found');
43
+ return [];
44
+ }
45
+ });
46
+ }
47
+ });
48
+ //# sourceMappingURL=search-folder.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-folder.action.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/google-drive/src/lib/action/search-folder.action.ts"],"names":[],"mappings":";;;;AAAA,uDAAuD;AACvD,uCAA8C;AAC9C,qEAAwE;AACxE,2CAAoC;AACpC,yDAAiD;AAEpC,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,uBAAe;IACrB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,0CAA0C;IACvD,KAAK,EAAE;QACH,KAAK,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