@pipedream/trello 0.3.14 → 0.4.1

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 (71) hide show
  1. package/actions/add-attachment-to-card/add-attachment-to-card.mjs +131 -0
  2. package/actions/add-checklist/add-checklist.mjs +50 -42
  3. package/actions/add-comment/add-comment.mjs +44 -35
  4. package/actions/add-existing-label-to-card/add-existing-label-to-card.mjs +19 -14
  5. package/actions/add-member-to-card/add-member-to-card.mjs +19 -14
  6. package/actions/archive-card/archive-card.mjs +15 -10
  7. package/actions/{common.mjs → common/common.mjs} +2 -2
  8. package/actions/complete-checklist-item/complete-checklist-item.mjs +51 -31
  9. package/actions/create-board/create-board.mjs +86 -88
  10. package/actions/create-card/create-card.mjs +102 -53
  11. package/actions/create-checklist-item/create-checklist-item.mjs +54 -39
  12. package/actions/create-label/create-label.mjs +38 -50
  13. package/actions/create-list/create-list.mjs +43 -42
  14. package/actions/delete-checklist/delete-checklist.mjs +17 -14
  15. package/actions/find-labels/find-labels.mjs +14 -12
  16. package/actions/find-list/find-list.mjs +13 -10
  17. package/actions/get-card/get-card.mjs +13 -9
  18. package/actions/get-list/get-list.mjs +29 -15
  19. package/actions/move-card-to-list/move-card-to-list.mjs +17 -13
  20. package/actions/remove-label-from-card/remove-label-from-card.mjs +20 -13
  21. package/actions/rename-list/rename-list.mjs +24 -10
  22. package/actions/search-boards/search-boards.mjs +22 -18
  23. package/actions/search-cards/search-cards.mjs +23 -18
  24. package/actions/search-checklists/search-checklists.mjs +96 -59
  25. package/actions/search-members/search-members.mjs +44 -34
  26. package/actions/update-card/update-card.mjs +68 -50
  27. package/common/constants.mjs +128 -0
  28. package/common/fields.mjs +1 -0
  29. package/package.json +5 -3
  30. package/sources/card-archived/card-archived.mjs +22 -18
  31. package/sources/card-archived/test-event.mjs +64 -0
  32. package/sources/card-due-date-reminder/card-due-date-reminder.mjs +118 -39
  33. package/sources/card-due-date-reminder/test-event.mjs +75 -0
  34. package/sources/card-moved/card-moved.mjs +30 -27
  35. package/sources/card-moved/test-event.mjs +78 -0
  36. package/sources/card-updates/card-updates.mjs +29 -27
  37. package/sources/card-updates/test-event.mjs +86 -0
  38. package/sources/common/actions.mjs +206 -0
  39. package/sources/common/common-board-based.mjs +16 -9
  40. package/sources/common/common-webhook.mjs +86 -32
  41. package/sources/common/common.mjs +7 -4
  42. package/sources/custom-webhook-events/custom-webhook-events.mjs +37 -49
  43. package/sources/new-activity/new-activity.mjs +25 -32
  44. package/sources/new-attachment/new-attachment.mjs +42 -35
  45. package/sources/new-attachment/test-event.mjs +69 -0
  46. package/sources/new-board/new-board.mjs +21 -12
  47. package/sources/new-board/test-event.mjs +100 -0
  48. package/sources/new-card/new-card.mjs +29 -27
  49. package/sources/new-card/test-event.mjs +79 -0
  50. package/sources/new-checklist/new-checklist.mjs +42 -13
  51. package/sources/new-checklist/test-event.mjs +22 -0
  52. package/sources/new-comment-added-to-card/new-comment-added-to-card.mjs +49 -34
  53. package/sources/new-comment-added-to-card/test-event.mjs +298 -0
  54. package/sources/new-label/new-label.mjs +17 -14
  55. package/sources/new-label/test-event.mjs +7 -0
  56. package/sources/new-label-added-to-card/new-label-added-to-card.mjs +38 -29
  57. package/sources/new-label-added-to-card/test-event.mjs +85 -0
  58. package/sources/new-member-on-card/new-member-on-card.mjs +21 -18
  59. package/sources/new-member-on-card/test-event.mjs +83 -0
  60. package/sources/new-notification/new-notification.mjs +8 -7
  61. package/trello.app.mjs +454 -494
  62. package/actions/add-attachment-to-card-via-url/add-attachment-to-card-via-url.mjs +0 -73
  63. package/actions/add-file-as-attachment-via-url/add-file-as-attachment-via-url.mjs +0 -72
  64. package/actions/add-image-attachment/add-image-attachment.mjs +0 -75
  65. package/actions/add-label-to-card/add-label-to-card.mjs +0 -55
  66. package/actions/close-board/close-board.mjs +0 -25
  67. package/actions/copy-board/copy-board.mjs +0 -174
  68. package/actions/create-checklist/create-checklist.mjs +0 -66
  69. package/actions/create-comment-on-card/create-comment-on-card.mjs +0 -42
  70. package/sources/new-list/new-list.mjs +0 -29
  71. /package/{common → sources/common}/events.mjs +0 -0
@@ -0,0 +1,131 @@
1
+ import { ConfigurationError } from "@pipedream/platform";
2
+ import fs from "fs";
3
+ import FormData from "form-data";
4
+ import app from "../../trello.app.mjs";
5
+
6
+ export default {
7
+ key: "trello-add-attachment-to-card",
8
+ name: "Add Attachment To Card",
9
+ description: "Adds a file attachment on a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-post)",
10
+ version: "0.0.2",
11
+ type: "action",
12
+ props: {
13
+ app,
14
+ board: {
15
+ propDefinition: [
16
+ app,
17
+ "board",
18
+ ],
19
+ },
20
+ cardId: {
21
+ propDefinition: [
22
+ app,
23
+ "cards",
24
+ (c) => ({
25
+ board: c.board,
26
+ }),
27
+ ],
28
+ type: "string",
29
+ label: "Card",
30
+ description: "The ID of the Card to add the Attachment to",
31
+ optional: false,
32
+ },
33
+ name: {
34
+ propDefinition: [
35
+ app,
36
+ "name",
37
+ ],
38
+ },
39
+ fileType: {
40
+ propDefinition: [
41
+ app,
42
+ "fileType",
43
+ ],
44
+ reloadProps: true,
45
+ },
46
+ url: {
47
+ propDefinition: [
48
+ app,
49
+ "url",
50
+ ],
51
+ hidden: true,
52
+ },
53
+ file: {
54
+ propDefinition: [
55
+ app,
56
+ "file",
57
+ ],
58
+ hidden: true,
59
+ },
60
+ mimeType: {
61
+ propDefinition: [
62
+ app,
63
+ "mimeType",
64
+ ],
65
+ hidden: true,
66
+ },
67
+ setCover: {
68
+ type: "boolean",
69
+ label: "Set Cover?",
70
+ description: "Determines whether to use the new attachment as a cover for the Card",
71
+ default: false,
72
+ optional: true,
73
+ },
74
+ },
75
+ async additionalProps(props) {
76
+ const attachmentIsPath = this.fileType === "path";
77
+ const attachmentIsUrl = this.fileType === "url";
78
+ props.file.hidden = !attachmentIsPath;
79
+ props.mimeType.hidden = !attachmentIsPath;
80
+ props.url.hidden = !attachmentIsUrl;
81
+
82
+ return {};
83
+ },
84
+ async run({ $ }) {
85
+ const {
86
+ cardId,
87
+ name,
88
+ url,
89
+ mimeType,
90
+ setCover,
91
+ file,
92
+ } = this;
93
+
94
+ let response;
95
+ const params = {
96
+ name,
97
+ mimeType,
98
+ setCover,
99
+ };
100
+
101
+ if (file && !file?.startsWith("/tmp")) {
102
+ throw new ConfigurationError("The file path must be in the `/tmp` directory");
103
+ }
104
+
105
+ if (file) {
106
+ const form = new FormData();
107
+ form.append("file", fs.createReadStream(file));
108
+
109
+ response = await this.app.addAttachmentToCard({
110
+ $,
111
+ cardId,
112
+ params,
113
+ headers: form.getHeaders(),
114
+ data: form,
115
+ });
116
+
117
+ } else {
118
+ response = await this.app.addAttachmentToCard({
119
+ $,
120
+ cardId,
121
+ params: {
122
+ ...params,
123
+ url,
124
+ },
125
+ });
126
+ }
127
+
128
+ $.export("$summary", `Successfully added attachement to card ${cardId}`);
129
+ return response;
130
+ },
131
+ };
@@ -1,68 +1,76 @@
1
- // legacy_hash_id: a_WYieM3
2
- import { axios } from "@pipedream/platform";
1
+ import app from "../../trello.app.mjs";
3
2
 
4
3
  export default {
5
4
  key: "trello-add-checklist",
6
- name: "Create a Checklist",
7
- description: "Adds a new checklist to a card.",
8
- version: "0.1.3",
5
+ name: "Add Checklist",
6
+ description: "Adds a new checklist to a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-checklists-post).",
7
+ version: "0.2.1",
9
8
  type: "action",
10
9
  props: {
11
- trello: {
12
- type: "app",
13
- app: "trello",
10
+ app,
11
+ boardId: {
12
+ propDefinition: [
13
+ app,
14
+ "board",
15
+ ],
14
16
  },
15
- id: {
17
+ cardId: {
16
18
  type: "string",
19
+ label: "Card ID",
17
20
  description: "The ID of the card.",
21
+ optional: false,
22
+ propDefinition: [
23
+ app,
24
+ "cards",
25
+ ({ boardId }) => ({
26
+ board: boardId,
27
+ }),
28
+ ],
18
29
  },
19
30
  name: {
20
31
  type: "string",
32
+ label: "Checklist Name",
21
33
  description: "The name of the checklist.",
22
34
  optional: true,
23
35
  },
24
36
  idChecklistSource: {
25
- type: "string",
26
- description: "The ID of a source checklist to copy into the new one.",
27
37
  optional: true,
38
+ propDefinition: [
39
+ app,
40
+ "checklist",
41
+ ({ boardId }) => ({
42
+ board: boardId,
43
+ }),
44
+ ],
45
+ label: "Copy from Checklist",
28
46
  },
29
47
  pos: {
30
- type: "string",
31
- description: "The position of the checklist on the card. One of: top, bottom, or a positive number.",
32
- optional: true,
48
+ propDefinition: [
49
+ app,
50
+ "pos",
51
+ ],
33
52
  },
34
53
  },
35
54
  async run({ $ }) {
36
- const oauthSignerUri = this.trello.$auth.oauth_signer_uri;
37
-
38
- let id = this.id;
39
- const trelloParams = [
40
- "name",
41
- "idChecklistSource",
42
- "pos",
43
- ];
44
- let p = this;
45
-
46
- const queryString = trelloParams.filter((param) => p[param]).map((param) => `${param}=${p[param]}`)
47
- .join("&");
48
-
49
- const config = {
50
- url: `https://api.trello.com/1/cards/${id}/checklists?${queryString}`,
51
- method: "POST",
52
- data: "",
53
- };
55
+ const {
56
+ cardId,
57
+ name,
58
+ idChecklistSource,
59
+ pos,
60
+ } = this;
54
61
 
55
- const token = {
56
- key: this.trello.$auth.oauth_access_token,
57
- secret: this.trello.$auth.oauth_refresh_token,
58
- };
62
+ const response = await this.app.addChecklist({
63
+ $,
64
+ cardId,
65
+ params: {
66
+ name,
67
+ idChecklistSource,
68
+ pos,
69
+ },
70
+ });
59
71
 
60
- const signConfig = {
61
- token,
62
- oauthSignerUri,
63
- };
72
+ $.export("$summary", `Successfully added checklist with ID: ${response.id}`);
64
73
 
65
- const resp = await axios($, config, signConfig);
66
- return resp;
74
+ return response;
67
75
  },
68
76
  };
@@ -1,55 +1,64 @@
1
- // legacy_hash_id: a_Xzi26w
2
- import { axios } from "@pipedream/platform";
1
+ import app from "../../trello.app.mjs";
3
2
 
4
3
  export default {
5
4
  key: "trello-add-comment",
6
- name: "Create a Comment",
7
- description: "Create a new comment on a specific card.",
8
- version: "0.1.3",
5
+ name: "Add Comment",
6
+ description: "Create a new comment on a specific card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-actions-comments-post).",
7
+ version: "0.2.1",
9
8
  type: "action",
10
9
  props: {
11
- trello: {
12
- type: "app",
13
- app: "trello",
10
+ app,
11
+ boardId: {
12
+ propDefinition: [
13
+ app,
14
+ "board",
15
+ ],
14
16
  },
15
- id: {
17
+ cardId: {
16
18
  type: "string",
19
+ label: "Card ID",
17
20
  description: "The ID of the card.",
21
+ optional: false,
22
+ propDefinition: [
23
+ app,
24
+ "cards",
25
+ ({ boardId }) => ({
26
+ board: boardId,
27
+ }),
28
+ ],
18
29
  },
19
30
  text: {
20
31
  type: "string",
32
+ label: "Comment",
21
33
  description: "The comment to add.",
22
34
  },
23
35
  },
36
+ methods: {
37
+ addComment({
38
+ cardId, ...args
39
+ } = {}) {
40
+ return this.app.post({
41
+ path: `/cards/${cardId}/actions/comments`,
42
+ ...args,
43
+ });
44
+ },
45
+ },
24
46
  async run({ $ }) {
25
- const oauthSignerUri = this.trello.$auth.oauth_signer_uri;
26
-
27
- let id = this.id;
28
- const trelloParams = [
29
- "text",
30
- ];
31
- let p = this;
32
-
33
- const queryString = trelloParams.filter((param) => p[param]).map((param) => `${param}=${p[param]}`)
34
- .join("&");
35
-
36
- const config = {
37
- url: `https://api.trello.com/1/cards/${id}/actions/comments?${queryString}`,
38
- method: "POST",
39
- data: "",
40
- };
47
+ const {
48
+ cardId,
49
+ text,
50
+ } = this;
41
51
 
42
- const token = {
43
- key: this.trello.$auth.oauth_access_token,
44
- secret: this.trello.$auth.oauth_refresh_token,
45
- };
52
+ const response = await this.app.addComment({
53
+ $,
54
+ cardId,
55
+ params: {
56
+ text,
57
+ },
58
+ });
46
59
 
47
- const signConfig = {
48
- token,
49
- oauthSignerUri,
50
- };
60
+ $.export("$summary", `Successfully added comment with ID: ${response.id}`);
51
61
 
52
- const resp = await axios($, config, signConfig);
53
- return resp;
62
+ return response;
54
63
  },
55
64
  };
@@ -1,23 +1,22 @@
1
- import common from "../common.mjs";
1
+ import app from "../../trello.app.mjs";
2
2
 
3
3
  export default {
4
- ...common,
5
4
  key: "trello-add-existing-label-to-card",
6
5
  name: "Add Existing Label to Card",
7
- description: "Adds an existing label to the specified card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idlabels-post)",
8
- version: "0.0.3",
6
+ description: "Adds an existing label to the specified card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idlabels-post).",
7
+ version: "0.1.1",
9
8
  type: "action",
10
9
  props: {
11
- ...common.props,
10
+ app,
12
11
  board: {
13
12
  propDefinition: [
14
- common.props.trello,
13
+ app,
15
14
  "board",
16
15
  ],
17
16
  },
18
- idCard: {
17
+ cardId: {
19
18
  propDefinition: [
20
- common.props.trello,
19
+ app,
21
20
  "cards",
22
21
  (c) => ({
23
22
  board: c.board,
@@ -28,21 +27,27 @@ export default {
28
27
  description: "The ID of the Card to add the Label to",
29
28
  optional: false,
30
29
  },
31
- idLabel: {
30
+ value: {
32
31
  propDefinition: [
33
- common.props.trello,
32
+ app,
34
33
  "label",
35
34
  (c) => ({
36
35
  board: c.board,
36
+ card: c.cardId,
37
+ excludeCardLabels: true,
37
38
  }),
38
39
  ],
39
40
  },
40
41
  },
41
42
  async run({ $ }) {
42
- const res = await this.trello.addExistingLabelToCard(this.idCard, {
43
- value: this.idLabel,
44
- }, $);
45
- $.export("$summary", `Successfully added label ${this.idLabel} to card ${this.idCard}`);
43
+ const res = await this.app.addExistingLabelToCard({
44
+ $,
45
+ cardId: this.cardId,
46
+ params: {
47
+ value: this.value,
48
+ },
49
+ });
50
+ $.export("$summary", `Successfully added label and returned \`${res.length}\` labels added.`);
46
51
  return res;
47
52
  },
48
53
  };
@@ -1,23 +1,22 @@
1
- import common from "../common.mjs";
1
+ import app from "../../trello.app.mjs";
2
2
 
3
3
  export default {
4
- ...common,
5
4
  key: "trello-add-member-to-card",
6
5
  name: "Add Member to Card",
7
- description: "Adds a member to the specified card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idmembers-post)",
8
- version: "0.1.4",
6
+ description: "Adds a member to the specified card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idmembers-post).",
7
+ version: "0.2.1",
9
8
  type: "action",
10
9
  props: {
11
- ...common.props,
10
+ app,
12
11
  board: {
13
12
  propDefinition: [
14
- common.props.trello,
13
+ app,
15
14
  "board",
16
15
  ],
17
16
  },
18
- idCard: {
17
+ cardId: {
19
18
  propDefinition: [
20
- common.props.trello,
19
+ app,
21
20
  "cards",
22
21
  (c) => ({
23
22
  board: c.board,
@@ -28,21 +27,27 @@ export default {
28
27
  description: "The ID of the Card to add the Member to",
29
28
  optional: false,
30
29
  },
31
- idMember: {
30
+ value: {
32
31
  propDefinition: [
33
- common.props.trello,
32
+ app,
34
33
  "member",
35
34
  (c) => ({
36
35
  board: c.board,
36
+ card: c.cardId,
37
+ excludeCardMembers: true,
37
38
  }),
38
39
  ],
39
40
  },
40
41
  },
41
42
  async run({ $ }) {
42
- const res = await this.trello.addMemberToCard(this.idCard, {
43
- value: this.idMember,
44
- }, $);
45
- $.export("$summary", `Successfully added member ${res[0].fullName} to card ${this.idCard}`);
43
+ const res = await this.app.addMemberToCard({
44
+ $,
45
+ cardId: this.cardId,
46
+ params: {
47
+ value: this.value,
48
+ },
49
+ });
50
+ $.export("$summary", `Successfully added member ${res[0].fullName} to card ${this.cardId}`);
46
51
  return res;
47
52
  },
48
53
  };
@@ -1,23 +1,22 @@
1
- import common from "../common.mjs";
1
+ import app from "../../trello.app.mjs";
2
2
 
3
3
  export default {
4
- ...common,
5
4
  key: "trello-archive-card",
6
5
  name: "Archive Card",
7
- description: "Archives a card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put)",
8
- version: "0.1.4",
6
+ description: "Archives a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put).",
7
+ version: "0.2.1",
9
8
  type: "action",
10
9
  props: {
11
- ...common.props,
10
+ app,
12
11
  board: {
13
12
  propDefinition: [
14
- common.props.trello,
13
+ app,
15
14
  "board",
16
15
  ],
17
16
  },
18
- idCard: {
17
+ cardId: {
19
18
  propDefinition: [
20
- common.props.trello,
19
+ app,
21
20
  "cards",
22
21
  (c) => ({
23
22
  board: c.board,
@@ -30,8 +29,14 @@ export default {
30
29
  },
31
30
  },
32
31
  async run({ $ }) {
33
- const res = await this.trello.archiveCard(this.idCard, $);
34
- $.export("$summary", `Successfully archived card ${this.idCard}`);
32
+ const res = await this.app.updateCard({
33
+ $,
34
+ cardId: this.cardId,
35
+ data: {
36
+ closed: true,
37
+ },
38
+ });
39
+ $.export("$summary", `Successfully archived card ${this.cardId}`);
35
40
  return res;
36
41
  },
37
42
  };
@@ -1,8 +1,8 @@
1
- import trello from "../trello.app.mjs";
1
+ import app from "../../trello.app.mjs";
2
2
 
3
3
  export default {
4
4
  props: {
5
- trello,
5
+ app,
6
6
  },
7
7
  methods: {
8
8
  /**
@@ -1,49 +1,69 @@
1
- // legacy_hash_id: a_EViowW
2
- import { axios } from "@pipedream/platform";
1
+ import app from "../../trello.app.mjs";
3
2
 
4
3
  export default {
5
4
  key: "trello-complete-checklist-item",
6
5
  name: "Complete a Checklist Item",
7
- description: "Completes an existing checklist item in a card.",
8
- version: "0.1.3",
6
+ description: "Completes an existing checklist item in a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-checkitem-idcheckitem-put).",
7
+ version: "0.2.1",
9
8
  type: "action",
10
9
  props: {
11
- trello: {
12
- type: "app",
13
- app: "trello",
10
+ app,
11
+ board: {
12
+ propDefinition: [
13
+ app,
14
+ "board",
15
+ ],
14
16
  },
15
- id: {
17
+ cardId: {
18
+ propDefinition: [
19
+ app,
20
+ "cards",
21
+ (c) => ({
22
+ board: c.board,
23
+ checklistCardsOnly: true,
24
+ }),
25
+ ],
16
26
  type: "string",
27
+ label: "Card ID",
17
28
  description: "The ID of the card.",
29
+ optional: false,
18
30
  },
19
- idCheckItem: {
20
- type: "string",
21
- description: "The ID of the checklist item to complete.",
31
+ checklistId: {
32
+ propDefinition: [
33
+ app,
34
+ "checklist",
35
+ ({ cardId }) => ({
36
+ card: cardId,
37
+ }),
38
+ ],
39
+ },
40
+ checklistItemId: {
41
+ propDefinition: [
42
+ app,
43
+ "checklistItemId",
44
+ ({ checklistId }) => ({
45
+ checklistId,
46
+ }),
47
+ ],
22
48
  },
23
49
  },
24
50
  async run({ $ }) {
25
- const oauthSignerUri = this.trello.$auth.oauth_signer_uri;
26
-
27
- let id = this.id;
28
- let idCheckItem = this.idCheckItem;
29
-
30
- const config = {
31
- url: `https://api.trello.com/1/cards/${id}/checkItem/${idCheckItem}?state=complete`,
32
- method: "PUT",
33
- data: "",
34
- };
51
+ const {
52
+ cardId,
53
+ checklistItemId,
54
+ } = this;
35
55
 
36
- const token = {
37
- key: this.trello.$auth.oauth_access_token,
38
- secret: this.trello.$auth.oauth_refresh_token,
39
- };
56
+ const response = await this.app.completeChecklistItem({
57
+ $,
58
+ cardId,
59
+ checklistItemId,
60
+ params: {
61
+ state: "complete",
62
+ },
63
+ });
40
64
 
41
- const signConfig = {
42
- token,
43
- oauthSignerUri,
44
- };
65
+ $.export("$summary", `Successfully completed checklist item with ID: ${checklistItemId}`);
45
66
 
46
- const resp = await axios($, config, signConfig);
47
- return resp;
67
+ return response;
48
68
  },
49
69
  };