@activepieces/piece-google-drive 0.5.8 → 0.5.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activepieces/piece-google-drive",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "dependencies": {
5
5
  "@sinclair/typebox": "0.26.8",
6
6
  "axios": "^1.6.3",
@@ -14,9 +14,9 @@
14
14
  "nanoid": "3.3.6",
15
15
  "semver": "7.5.4",
16
16
  "@activepieces/pieces-common": "0.2.5",
17
- "@activepieces/pieces-framework": "0.7.7",
18
- "@activepieces/shared": "0.10.54",
19
- "tslib": "1.14.1"
17
+ "@activepieces/pieces-framework": "0.7.9",
18
+ "@activepieces/shared": "0.10.57",
19
+ "tslib": "2.6.1"
20
20
  },
21
21
  "main": "./src/index.js",
22
22
  "type": "commonjs"
@@ -2,29 +2,29 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.duplicateFileAction = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const index_1 = require("../../index");
6
5
  const pieces_framework_1 = require("@activepieces/pieces-framework");
7
6
  const googleapis_1 = require("googleapis");
8
7
  const googleapis_common_1 = require("googleapis-common");
8
+ const index_1 = require("../../index");
9
9
  exports.duplicateFileAction = (0, pieces_framework_1.createAction)({
10
- displayName: "Duplicate File",
10
+ displayName: 'Duplicate File',
11
11
  auth: index_1.googleDriveAuth,
12
- name: "duplicate_file",
13
- description: "Duplicate a file from Google Drive. Returns the new file ID.",
12
+ name: 'duplicate_file',
13
+ description: 'Duplicate a file from Google Drive. Returns the new file ID.',
14
14
  props: {
15
15
  fileId: pieces_framework_1.Property.ShortText({
16
- displayName: "File ID",
17
- description: "The ID of the file to duplicate",
16
+ displayName: 'File ID',
17
+ description: 'The ID of the file to duplicate',
18
18
  required: true,
19
19
  }),
20
20
  name: pieces_framework_1.Property.ShortText({
21
- displayName: "Name",
22
- description: "The name of the new file",
21
+ displayName: 'Name',
22
+ description: 'The name of the new file',
23
23
  required: true,
24
24
  }),
25
25
  folderId: pieces_framework_1.Property.ShortText({
26
- displayName: "Folder ID",
27
- description: "The ID of the folder where the file will be duplicated",
26
+ displayName: 'Folder ID',
27
+ description: 'The ID of the folder where the file will be duplicated',
28
28
  required: true,
29
29
  }),
30
30
  },
@@ -34,20 +34,18 @@ exports.duplicateFileAction = (0, pieces_framework_1.createAction)({
34
34
  authClient.setCredentials(context.auth);
35
35
  const fileId = context.propsValue.fileId;
36
36
  const nameForNewFile = context.propsValue.name;
37
+ const parentFolderId = context.propsValue.folderId;
37
38
  const drive = googleapis_1.google.drive({ version: 'v3', auth: authClient });
38
- const response = yield drive.files.copy({ fileId, auth: authClient });
39
+ const response = yield drive.files.copy({
40
+ fileId,
41
+ auth: authClient,
42
+ requestBody: { name: nameForNewFile, parents: [parentFolderId] },
43
+ });
39
44
  if (response.status !== 200) {
40
45
  console.error(response);
41
46
  throw new Error('Error duplicating file');
42
47
  }
43
- const newFileId = response.data.id;
44
- const body = { 'name': nameForNewFile };
45
- drive.files.update;
46
- const respUpdate = yield drive.files.update({
47
- fileId: String(newFileId),
48
- requestBody: body,
49
- });
50
- return respUpdate.data;
48
+ return response.data;
51
49
  });
52
50
  },
53
51
  });
@@ -1 +1 @@
1
- {"version":3,"file":"duplicate-file.action.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/google-drive/src/lib/action/duplicate-file.action.ts"],"names":[],"mappings":";;;;AAAA,uCAA8C;AAC9C,qEAAwE;AACxE,2CAAoC;AACpC,yDAAiD;AAEpC,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC5C,WAAW,EAAE,gBAAgB;IAC7B,IAAI,EAAE,uBAAe;IACrB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,8DAA8D;IAC3E,KAAK,EAAE;QACH,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,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MAAM,EAAE,MAAM,CAAC,SAAS,CAAC;gBACzB,WAAW,EAAE,IAAI;aACpB,CAAC,CAAC;YAEH,OAAO,UAAU,CAAC,IAAI,CAAC;QAC3B,CAAC;KAAA;CACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"duplicate-file.action.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/google-drive/src/lib/action/duplicate-file.action.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,2CAAoC;AACpC,yDAAiD;AACjD,uCAA8C;AAEjC,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,WAAW,EAAE,gBAAgB;IAC7B,IAAI,EAAE,uBAAe;IACrB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,8DAA8D;IAC3E,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;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,UAAU,GAAG,IAAI,gCAAY,EAAE,CAAC;YACtC,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAExC,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;YACzC,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;YAC/C,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;YAEnD,MAAM,KAAK,GAA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