@pipedream/trello 0.4.0 → 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 (65) hide show
  1. package/actions/add-attachment-to-card/add-attachment-to-card.mjs +34 -27
  2. package/actions/add-checklist/add-checklist.mjs +9 -19
  3. package/actions/add-comment/add-comment.mjs +4 -5
  4. package/actions/add-existing-label-to-card/add-existing-label-to-card.mjs +9 -19
  5. package/actions/add-member-to-card/add-member-to-card.mjs +9 -19
  6. package/actions/archive-card/archive-card.mjs +5 -6
  7. package/actions/{common.mjs → common/common.mjs} +1 -1
  8. package/actions/complete-checklist-item/complete-checklist-item.mjs +4 -14
  9. package/actions/create-board/create-board.mjs +10 -47
  10. package/actions/create-card/create-card.mjs +52 -47
  11. package/actions/create-checklist-item/create-checklist-item.mjs +4 -14
  12. package/actions/create-label/create-label.mjs +5 -18
  13. package/actions/create-list/create-list.mjs +4 -12
  14. package/actions/delete-checklist/delete-checklist.mjs +8 -18
  15. package/actions/find-labels/find-labels.mjs +2 -3
  16. package/actions/find-list/find-list.mjs +2 -2
  17. package/actions/get-card/get-card.mjs +2 -2
  18. package/actions/get-list/get-list.mjs +1 -1
  19. package/actions/move-card-to-list/move-card-to-list.mjs +2 -2
  20. package/actions/remove-label-from-card/remove-label-from-card.mjs +9 -18
  21. package/actions/rename-list/rename-list.mjs +2 -2
  22. package/actions/search-boards/search-boards.mjs +10 -8
  23. package/actions/search-cards/search-cards.mjs +11 -8
  24. package/actions/search-checklists/search-checklists.mjs +56 -75
  25. package/actions/search-members/search-members.mjs +13 -23
  26. package/actions/update-card/update-card.mjs +22 -21
  27. package/common/constants.mjs +128 -0
  28. package/common/fields.mjs +1 -0
  29. package/package.json +2 -1
  30. package/sources/card-archived/card-archived.mjs +16 -28
  31. package/sources/card-archived/test-event.mjs +64 -0
  32. package/sources/card-due-date-reminder/card-due-date-reminder.mjs +111 -33
  33. package/sources/card-due-date-reminder/test-event.mjs +75 -0
  34. package/sources/card-moved/card-moved.mjs +20 -23
  35. package/sources/card-moved/test-event.mjs +78 -0
  36. package/sources/card-updates/card-updates.mjs +20 -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 +12 -7
  40. package/sources/common/common-webhook.mjs +27 -16
  41. package/sources/common/common.mjs +5 -2
  42. package/sources/custom-webhook-events/custom-webhook-events.mjs +17 -48
  43. package/sources/new-activity/new-activity.mjs +22 -31
  44. package/sources/new-attachment/new-attachment.mjs +40 -49
  45. package/sources/new-attachment/test-event.mjs +69 -0
  46. package/sources/new-board/new-board.mjs +18 -11
  47. package/sources/new-board/test-event.mjs +100 -0
  48. package/sources/new-card/new-card.mjs +20 -27
  49. package/sources/new-card/test-event.mjs +79 -0
  50. package/sources/new-checklist/new-checklist.mjs +39 -22
  51. package/sources/new-checklist/test-event.mjs +22 -0
  52. package/sources/new-comment-added-to-card/new-comment-added-to-card.mjs +38 -44
  53. package/sources/new-comment-added-to-card/test-event.mjs +298 -0
  54. package/sources/new-label/new-label.mjs +13 -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 +23 -24
  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 +17 -26
  59. package/sources/new-member-on-card/test-event.mjs +83 -0
  60. package/sources/new-notification/new-notification.mjs +3 -12
  61. package/trello.app.mjs +211 -33
  62. package/actions/close-board/close-board.mjs +0 -31
  63. package/actions/create-checklist/create-checklist.mjs +0 -78
  64. package/actions/create-comment-on-card/create-comment-on-card.mjs +0 -59
  65. package/sources/new-list/new-list.mjs +0 -33
@@ -1,26 +1,25 @@
1
1
  import { ConfigurationError } from "@pipedream/platform";
2
2
  import fs from "fs";
3
3
  import FormData from "form-data";
4
- import common from "../common.mjs";
4
+ import app from "../../trello.app.mjs";
5
5
 
6
6
  export default {
7
- ...common,
8
7
  key: "trello-add-attachment-to-card",
9
8
  name: "Add Attachment To Card",
10
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)",
11
- version: "0.0.1",
10
+ version: "0.0.2",
12
11
  type: "action",
13
12
  props: {
14
- ...common.props,
13
+ app,
15
14
  board: {
16
15
  propDefinition: [
17
- common.props.app,
16
+ app,
18
17
  "board",
19
18
  ],
20
19
  },
21
20
  cardId: {
22
21
  propDefinition: [
23
- common.props.app,
22
+ app,
24
23
  "cards",
25
24
  (c) => ({
26
25
  board: c.board,
@@ -33,49 +32,57 @@ export default {
33
32
  },
34
33
  name: {
35
34
  propDefinition: [
36
- common.props.app,
35
+ app,
37
36
  "name",
38
37
  ],
39
38
  },
40
- url: {
39
+ fileType: {
41
40
  propDefinition: [
42
- common.props.app,
43
- "url",
41
+ app,
42
+ "fileType",
44
43
  ],
44
+ reloadProps: true,
45
45
  },
46
- mimeType: {
46
+ url: {
47
47
  propDefinition: [
48
- common.props.app,
49
- "mimeType",
48
+ app,
49
+ "url",
50
50
  ],
51
+ hidden: true,
51
52
  },
52
53
  file: {
53
54
  propDefinition: [
54
- common.props.app,
55
+ app,
55
56
  "file",
56
57
  ],
58
+ hidden: true,
59
+ },
60
+ mimeType: {
61
+ propDefinition: [
62
+ app,
63
+ "mimeType",
64
+ ],
65
+ hidden: true,
57
66
  },
58
67
  setCover: {
59
68
  type: "boolean",
60
69
  label: "Set Cover?",
61
70
  description: "Determines whether to use the new attachment as a cover for the Card",
62
71
  default: false,
72
+ optional: true,
63
73
  },
64
74
  },
65
- methods: {
66
- ...common.methods,
67
- addAttachmentToCard({
68
- cardId, ...args
69
- } = {}) {
70
- return this.app.post({
71
- path: `/cards/${cardId}/attachments`,
72
- ...args,
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 {};
75
83
  },
76
84
  async run({ $ }) {
77
85
  const {
78
- addAttachmentToCard,
79
86
  cardId,
80
87
  name,
81
88
  url,
@@ -99,7 +106,7 @@ export default {
99
106
  const form = new FormData();
100
107
  form.append("file", fs.createReadStream(file));
101
108
 
102
- response = await addAttachmentToCard({
109
+ response = await this.app.addAttachmentToCard({
103
110
  $,
104
111
  cardId,
105
112
  params,
@@ -108,7 +115,7 @@ export default {
108
115
  });
109
116
 
110
117
  } else {
111
- response = await addAttachmentToCard({
118
+ response = await this.app.addAttachmentToCard({
112
119
  $,
113
120
  cardId,
114
121
  params: {
@@ -2,9 +2,9 @@ import app from "../../trello.app.mjs";
2
2
 
3
3
  export default {
4
4
  key: "trello-add-checklist",
5
- name: "Create a Checklist",
5
+ name: "Add Checklist",
6
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.0",
7
+ version: "0.2.1",
8
8
  type: "action",
9
9
  props: {
10
10
  app,
@@ -42,34 +42,24 @@ export default {
42
42
  board: boardId,
43
43
  }),
44
44
  ],
45
+ label: "Copy from Checklist",
45
46
  },
46
47
  pos: {
47
- type: "string",
48
- label: "Position",
49
- description: "The position of the checklist on the card. One of: top, bottom, or a positive number.",
50
- optional: true,
51
- },
52
- },
53
- methods: {
54
- addChecklist({
55
- cardId, ...args
56
- } = {}) {
57
- return this.app.post({
58
- path: `/cards/${cardId}/checklists`,
59
- ...args,
60
- });
48
+ propDefinition: [
49
+ app,
50
+ "pos",
51
+ ],
61
52
  },
62
53
  },
63
54
  async run({ $ }) {
64
55
  const {
65
- addChecklist,
66
56
  cardId,
67
57
  name,
68
58
  idChecklistSource,
69
59
  pos,
70
60
  } = this;
71
61
 
72
- const response = await addChecklist({
62
+ const response = await this.app.addChecklist({
73
63
  $,
74
64
  cardId,
75
65
  params: {
@@ -79,7 +69,7 @@ export default {
79
69
  },
80
70
  });
81
71
 
82
- $.export("$summary", "Successfully added checklist.");
72
+ $.export("$summary", `Successfully added checklist with ID: ${response.id}`);
83
73
 
84
74
  return response;
85
75
  },
@@ -2,9 +2,9 @@ import app from "../../trello.app.mjs";
2
2
 
3
3
  export default {
4
4
  key: "trello-add-comment",
5
- name: "Create a Comment",
5
+ name: "Add Comment",
6
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.0",
7
+ version: "0.2.1",
8
8
  type: "action",
9
9
  props: {
10
10
  app,
@@ -45,12 +45,11 @@ export default {
45
45
  },
46
46
  async run({ $ }) {
47
47
  const {
48
- addComment,
49
48
  cardId,
50
49
  text,
51
50
  } = this;
52
51
 
53
- const response = await addComment({
52
+ const response = await this.app.addComment({
54
53
  $,
55
54
  cardId,
56
55
  params: {
@@ -58,7 +57,7 @@ export default {
58
57
  },
59
58
  });
60
59
 
61
- $.export("$summary", "Successfully added comment.");
60
+ $.export("$summary", `Successfully added comment with ID: ${response.id}`);
62
61
 
63
62
  return response;
64
63
  },
@@ -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
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).",
8
- version: "0.1.0",
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.app,
13
+ app,
15
14
  "board",
16
15
  ],
17
16
  },
18
17
  cardId: {
19
18
  propDefinition: [
20
- common.props.app,
19
+ app,
21
20
  "cards",
22
21
  (c) => ({
23
22
  board: c.board,
@@ -30,27 +29,18 @@ export default {
30
29
  },
31
30
  value: {
32
31
  propDefinition: [
33
- common.props.app,
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
- methods: {
42
- ...common.methods,
43
- addExistingLabelToCard({
44
- cardId, ...args
45
- } = {}) {
46
- return this.app.post({
47
- path: `/cards/${cardId}/idLabels`,
48
- ...args,
49
- });
50
- },
51
- },
52
42
  async run({ $ }) {
53
- const res = await this.addExistingLabelToCard({
43
+ const res = await this.app.addExistingLabelToCard({
54
44
  $,
55
45
  cardId: this.cardId,
56
46
  params: {
@@ -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
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).",
8
- version: "0.2.0",
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.app,
13
+ app,
15
14
  "board",
16
15
  ],
17
16
  },
18
17
  cardId: {
19
18
  propDefinition: [
20
- common.props.app,
19
+ app,
21
20
  "cards",
22
21
  (c) => ({
23
22
  board: c.board,
@@ -30,27 +29,18 @@ export default {
30
29
  },
31
30
  value: {
32
31
  propDefinition: [
33
- common.props.app,
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
- methods: {
42
- ...common.methods,
43
- addMemberToCard({
44
- cardId, ...args
45
- } = {}) {
46
- return this.app.post({
47
- path: `/cards/${cardId}/idMembers`,
48
- ...args,
49
- });
50
- },
51
- },
52
42
  async run({ $ }) {
53
- const res = await this.addMemberToCard({
43
+ const res = await this.app.addMemberToCard({
54
44
  $,
55
45
  cardId: this.cardId,
56
46
  params: {
@@ -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
6
  description: "Archives a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put).",
8
- version: "0.2.0",
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.app,
13
+ app,
15
14
  "board",
16
15
  ],
17
16
  },
18
17
  cardId: {
19
18
  propDefinition: [
20
- common.props.app,
19
+ app,
21
20
  "cards",
22
21
  (c) => ({
23
22
  board: c.board,
@@ -1,4 +1,4 @@
1
- import app from "../trello.app.mjs";
1
+ import app from "../../trello.app.mjs";
2
2
 
3
3
  export default {
4
4
  props: {
@@ -4,7 +4,7 @@ export default {
4
4
  key: "trello-complete-checklist-item",
5
5
  name: "Complete a Checklist Item",
6
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.0",
7
+ version: "0.2.1",
8
8
  type: "action",
9
9
  props: {
10
10
  app,
@@ -20,6 +20,7 @@ export default {
20
20
  "cards",
21
21
  (c) => ({
22
22
  board: c.board,
23
+ checklistCardsOnly: true,
23
24
  }),
24
25
  ],
25
26
  type: "string",
@@ -46,24 +47,13 @@ export default {
46
47
  ],
47
48
  },
48
49
  },
49
- methods: {
50
- completeChecklistItem({
51
- cardId, checklistItemId, ...args
52
- } = {}) {
53
- return this.app.put({
54
- path: `/cards/${cardId}/checkItem/${checklistItemId}`,
55
- ...args,
56
- });
57
- },
58
- },
59
50
  async run({ $ }) {
60
51
  const {
61
- completeChecklistItem,
62
52
  cardId,
63
53
  checklistItemId,
64
54
  } = this;
65
55
 
66
- const response = await completeChecklistItem({
56
+ const response = await this.app.completeChecklistItem({
67
57
  $,
68
58
  cardId,
69
59
  checklistItemId,
@@ -72,7 +62,7 @@ export default {
72
62
  },
73
63
  });
74
64
 
75
- $.export("$summary", "Successfully completed checklist item.");
65
+ $.export("$summary", `Successfully completed checklist item with ID: ${checklistItemId}`);
76
66
 
77
67
  return response;
78
68
  },
@@ -1,10 +1,11 @@
1
1
  import app from "../../trello.app.mjs";
2
+ import constants from "../../common/constants.mjs";
2
3
 
3
4
  export default {
4
5
  key: "trello-create-board",
5
6
  name: "Create a Board",
6
- description: "Creates a new Trello board. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-post).",
7
- version: "0.2.0",
7
+ description: "Create a new Trello board or copy from an existing one. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-post).",
8
+ version: "0.2.1",
8
9
  type: "action",
9
10
  props: {
10
11
  app,
@@ -65,60 +66,35 @@ export default {
65
66
  label: "Power-Ups",
66
67
  description: "The Power-Ups that should be enabled on the new board. One of: `all`, `calendar`, `cardAging`, `recap`, `voting`.",
67
68
  optional: true,
68
- options: [
69
- "all",
70
- "calendar",
71
- "cardAging",
72
- "recap",
73
- "voting",
74
- ],
69
+ options: constants.POWER_UPS,
75
70
  },
76
71
  prefsPermissionLevel: {
77
72
  type: "string",
78
73
  description: "The permissions level of the board. One of: org, private, public.",
79
74
  label: "Prefs Permission Level",
80
75
  optional: true,
81
- options: [
82
- "org",
83
- "private",
84
- "public",
85
- ],
76
+ options: constants.PREFS_PERMISSION_LEVELS,
86
77
  },
87
78
  prefsVoting: {
88
79
  type: "string",
89
80
  label: "Prefs Voting",
90
81
  description: "Who can vote on this board. One of disabled, members, observers, org, public.",
91
82
  optional: true,
92
- options: [
93
- "disabled",
94
- "members",
95
- "observers",
96
- "org",
97
- "public",
98
- ],
83
+ options: constants.PREFS_VOTING,
99
84
  },
100
85
  prefsComments: {
101
86
  type: "string",
102
87
  label: "Prefs Comments",
103
88
  description: "Who can comment on cards on this board. One of: disabled, members, observers, org, public.",
104
89
  optional: true,
105
- options: [
106
- "disabled",
107
- "members",
108
- "observers",
109
- "org",
110
- "public",
111
- ],
90
+ options: constants.PREFS_COMMENTS,
112
91
  },
113
92
  prefsInvitations: {
114
93
  type: "string",
115
94
  label: "Prefs Invitations",
116
95
  description: "Determines what types of members can invite users to join. One of: admins, members.",
117
96
  optional: true,
118
- options: [
119
- "admins",
120
- "members",
121
- ],
97
+ options: constants.PREFS_INVITATIONS,
122
98
  },
123
99
  prefsSelfJoin: {
124
100
  type: "boolean",
@@ -137,27 +113,14 @@ export default {
137
113
  label: "Prefs Background",
138
114
  description: "The id of a custom background or one of: `blue`, `orange`, `green`, `red`, `purple`, `pink`, `lime`, `sky`, `grey`.",
139
115
  optional: true,
140
- options: [
141
- "blue",
142
- "orange",
143
- "green",
144
- "red",
145
- "purple",
146
- "pink",
147
- "lime",
148
- "sky",
149
- "grey",
150
- ],
116
+ options: constants.PREFS_BACKGROUNDS,
151
117
  },
152
118
  prefsCardAging: {
153
119
  type: "string",
154
120
  label: "Prefs Card Aging",
155
121
  description: "Determines the type of card aging that should take place on the board if card aging is enabled. One of: pirate, regular.",
156
122
  optional: true,
157
- options: [
158
- "pirate",
159
- "regular",
160
- ],
123
+ options: constants.PREFS_CARD_AGING,
161
124
  },
162
125
  },
163
126
  async run({ $ }) {