@skillful-ai/piece-clickup-extended 0.1.2 → 0.1.3

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": "@skillful-ai/piece-clickup-extended",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -4,6 +4,7 @@ export declare const createClickupTaskAttachment: import("@activepieces/pieces-f
4
4
  folder_id: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, false> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, true>;
5
5
  list_id: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, false> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, true>;
6
6
  task_id: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
7
- file: import("@activepieces/pieces-framework").FileProperty<true>;
7
+ file: import("@activepieces/pieces-framework").FileProperty<false>;
8
+ file_url: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
9
  file_name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
10
  }>;
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createClickupTaskAttachment = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const axios_1 = tslib_1.__importDefault(require("axios"));
7
7
  const common_1 = require("../../common");
8
8
  const __1 = require("../../../");
9
9
  exports.createClickupTaskAttachment = (0, pieces_framework_1.createAction)({
10
10
  auth: __1.clickupAuth,
11
11
  name: 'create_task_attachment',
12
- description: 'Uploads a file attachment to a ClickUp task',
12
+ description: 'Uploads a file attachment to a ClickUp task. Accepts either a direct file upload or a URL to download the file from.',
13
13
  displayName: 'Create Task Attachment',
14
14
  props: {
15
15
  workspace_id: common_1.clickupCommon.workspace_id(),
@@ -19,8 +19,13 @@ exports.createClickupTaskAttachment = (0, pieces_framework_1.createAction)({
19
19
  task_id: common_1.clickupCommon.task_id(),
20
20
  file: pieces_framework_1.Property.File({
21
21
  displayName: 'File',
22
- description: 'The file to attach to the task (e.g. screenshot, document)',
23
- required: true,
22
+ description: 'The file to attach (binary upload or URL). When called by an agent, provide the image/file URL.',
23
+ required: false,
24
+ }),
25
+ file_url: pieces_framework_1.Property.ShortText({
26
+ displayName: 'File URL',
27
+ description: 'URL to download the file from (alternative to File property). Use this when you have a direct URL to the image or document.',
28
+ required: false,
24
29
  }),
25
30
  file_name: pieces_framework_1.Property.ShortText({
26
31
  displayName: 'File Name',
@@ -30,20 +35,36 @@ exports.createClickupTaskAttachment = (0, pieces_framework_1.createAction)({
30
35
  },
31
36
  run(context) {
32
37
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
- const { task_id, file, file_name } = context.propsValue;
38
+ const { task_id, file, file_url, file_name } = context.propsValue;
34
39
  const accessToken = context.auth;
40
+ let fileBuffer;
41
+ if (file && file.data) {
42
+ // Option 1: File was provided directly (or auto-downloaded by engine from URL)
43
+ fileBuffer = file.data;
44
+ }
45
+ else if (file_url) {
46
+ // Option 2: Download from explicit URL
47
+ const downloadResponse = yield axios_1.default.get(file_url, {
48
+ responseType: 'arraybuffer',
49
+ timeout: 30000,
50
+ });
51
+ fileBuffer = Buffer.from(downloadResponse.data);
52
+ }
53
+ else {
54
+ throw new Error('Either a file or a file_url must be provided to create an attachment.');
55
+ }
56
+ // Build multipart form data manually for axios
57
+ // Using FormData with Blob — axios handles Content-Type automatically
35
58
  const formData = new FormData();
36
- const blob = new Blob([file.data], {});
59
+ const blob = new Blob([fileBuffer]);
37
60
  formData.append('attachment', blob, file_name);
38
- const response = yield pieces_common_1.httpClient.sendRequest({
39
- method: pieces_common_1.HttpMethod.POST,
40
- url: `https://api.clickup.com/api/v2/task/${task_id}/attachment`,
61
+ const response = yield axios_1.default.post(`https://api.clickup.com/api/v2/task/${task_id}/attachment`, formData, {
41
62
  headers: {
42
63
  Authorization: accessToken,
43
64
  },
44
- body: formData,
65
+ timeout: 60000,
45
66
  });
46
- return response.body;
67
+ return response.data;
47
68
  });
48
69
  },
49
70
  });
@@ -1 +1 @@
1
- {"version":3,"file":"create-task-attachment.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/custom/clickup-extended/src/lib/actions/attachments/create-task-attachment.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAGqC;AACrC,yCAA6C;AAC7C,iCAAwC;AAE3B,QAAA,2BAA2B,GAAG,IAAA,+BAAY,EAAC;IACtD,IAAI,EAAE,eAAW;IACjB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,6CAA6C;IAC1D,WAAW,EAAE,wBAAwB;IACrC,KAAK,EAAE;QACL,YAAY,EAAE,sBAAa,CAAC,YAAY,EAAE;QAC1C,QAAQ,EAAE,sBAAa,CAAC,QAAQ,EAAE;QAClC,SAAS,EAAE,sBAAa,CAAC,SAAS,EAAE;QACpC,OAAO,EAAE,sBAAa,CAAC,OAAO,EAAE;QAChC,OAAO,EAAE,sBAAa,CAAC,OAAO,EAAE;QAChC,IAAI,EAAE,2BAAQ,CAAC,IAAI,CAAC;YAClB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,WAAW;YACxB,WAAW,EACT,6EAA6E;YAC/E,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACxD,MAAM,WAAW,GAAI,OAAO,CAAC,IAAe,CAAC;YAE7C,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;YACvC,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;YAE/C,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,uCAAuC,OAAO,aAAa;gBAChE,OAAO,EAAE;oBACP,aAAa,EAAE,WAAW;iBAC3B;gBACD,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"create-task-attachment.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/custom/clickup-extended/src/lib/actions/attachments/create-task-attachment.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,0DAA0B;AAC1B,yCAA6C;AAC7C,iCAAwC;AAE3B,QAAA,2BAA2B,GAAG,IAAA,+BAAY,EAAC;IACtD,IAAI,EAAE,eAAW;IACjB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EACT,sHAAsH;IACxH,WAAW,EAAE,wBAAwB;IACrC,KAAK,EAAE;QACL,YAAY,EAAE,sBAAa,CAAC,YAAY,EAAE;QAC1C,QAAQ,EAAE,sBAAa,CAAC,QAAQ,EAAE;QAClC,SAAS,EAAE,sBAAa,CAAC,SAAS,EAAE;QACpC,OAAO,EAAE,sBAAa,CAAC,OAAO,EAAE;QAChC,OAAO,EAAE,sBAAa,CAAC,OAAO,EAAE;QAChC,IAAI,EAAE,2BAAQ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