@pipedream/trello 0.4.0 → 1.0.0

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 +29 -58
  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 +45 -65
  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 +3 -2
  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,46 +1,49 @@
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-search-cards",
6
5
  name: "Search Cards",
7
6
  description: "Searches for cards matching the specified query. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-search/#api-search-get).",
8
- version: "0.2.0",
7
+ version: "0.2.1",
9
8
  type: "action",
10
9
  props: {
11
- ...common.props,
10
+ app,
12
11
  query: {
13
12
  propDefinition: [
14
- common.props.app,
13
+ app,
15
14
  "query",
16
15
  ],
17
16
  },
18
17
  idBoards: {
19
18
  propDefinition: [
20
- common.props.app,
19
+ app,
21
20
  "board",
22
21
  ],
23
22
  type: "string[]",
24
23
  label: "Boards",
25
24
  description: "The IDs of boards to search for cards in",
25
+ optional: true,
26
26
  },
27
27
  partial: {
28
28
  propDefinition: [
29
- common.props.app,
29
+ app,
30
30
  "partial",
31
31
  ],
32
+ optional: true,
32
33
  },
33
34
  cardFields: {
34
35
  propDefinition: [
35
- common.props.app,
36
+ app,
36
37
  "cardFields",
37
38
  ],
39
+ optional: true,
38
40
  },
39
41
  cardsLimit: {
40
42
  type: "integer",
41
43
  label: "Cards Limit",
42
44
  description: "The maximum number of cards to return.",
43
45
  default: 10,
46
+ optional: true,
44
47
  },
45
48
  },
46
49
  async run({ $ }) {
@@ -2,9 +2,9 @@ import app from "../../trello.app.mjs";
2
2
 
3
3
  export default {
4
4
  key: "trello-search-checklists",
5
- name: "Find Checklist",
5
+ name: "Search Checklists",
6
6
  description: "Find a checklist on a particular board or card by name. [See the documentation here](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-checklists-get) and [here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-checklists-get).",
7
- version: "0.2.0",
7
+ version: "0.2.1",
8
8
  type: "action",
9
9
  props: {
10
10
  app,
@@ -19,102 +19,83 @@ export default {
19
19
  reloadProps: true,
20
20
  },
21
21
  boardId: {
22
- type: "string",
23
- label: "Board ID",
24
- description: "The ID of the board.",
22
+ propDefinition: [
23
+ app,
24
+ "board",
25
+ ],
25
26
  hidden: true,
26
27
  },
27
28
  cardId: {
29
+ propDefinition: [
30
+ app,
31
+ "cards",
32
+ (c) => ({
33
+ board: c.boardId,
34
+ }),
35
+ ],
28
36
  type: "string",
29
37
  label: "Card ID",
30
- description: "The ID of the card.",
38
+ description: "The ID of the card",
31
39
  hidden: true,
32
40
  },
33
41
  query: {
34
42
  type: "string",
35
43
  label: "Query",
36
- description: "The query to search for.",
44
+ description: "The query to search for",
37
45
  },
38
46
  checkItems: {
39
47
  type: "string",
40
48
  label: "Check Items",
41
- description: "all or none",
49
+ description: "Whether to display checklist items in the result. Select `all` or `none`.",
42
50
  optional: true,
43
51
  options: [
44
52
  "all",
45
53
  "none",
46
54
  ],
55
+ reloadProps: true,
56
+ hidden: true,
47
57
  },
48
58
  checkItemFields: {
49
- type: "string",
59
+ type: "string[]",
50
60
  label: "CheckItem Fields",
51
- description: "all or a comma-separated list of: name, nameData, pos, state, type",
52
- optional: true,
53
- },
54
- filter: {
55
- type: "string",
56
- label: "Filter",
57
- description: "all or none",
58
- optional: true,
61
+ description: "Fields to include in the results. `all` or a list of: `name`, `nameData`, `pos`, `state`, `type`",
59
62
  options: [
60
63
  "all",
61
- "none",
64
+ "name",
65
+ "nameData",
66
+ "pos",
67
+ "state",
68
+ "type",
62
69
  ],
70
+ optional: true,
71
+ hidden: true,
63
72
  },
64
73
  fields: {
65
- type: "string",
74
+ type: "string[]",
66
75
  label: "Fields",
67
- description: "`all` or a comma-separated list of: `idBoard`, `idCard`, `name`, `pos`. Eg: `idBoard,idCard,name,pos`. Eg: `all`.",
76
+ description: "Fields to include in the results. `all` or a list of: `idBoard`, `idCard`, `name`, `pos`. Eg: `idBoard,idCard,name,pos`. Eg: `all`.",
77
+ options: [
78
+ "all",
79
+ "idBoard",
80
+ "idCard",
81
+ "name",
82
+ "pos",
83
+ ],
68
84
  optional: true,
85
+ hidden: true,
69
86
  },
70
87
  },
71
- additionalProps() {
72
- const { type } = this;
73
-
74
- const defaultProps = {
75
- boardId: {
76
- type: "string",
77
- label: "Board ID",
78
- description: "The ID of the board.",
79
- hidden: false,
80
- options: async () => {
81
- const boards = await this.app.getBoards();
82
- return boards
83
- .filter(({ closed }) => closed === false)
84
- .map(({
85
- id: value, name: label,
86
- }) => ({
87
- label,
88
- value,
89
- }));
90
- },
91
- },
92
- };
88
+ additionalProps(props) {
89
+ const isCardSearch = this.type === "card";
90
+ props.boardId.hidden = false;
91
+ props.cardId.hidden = !isCardSearch;
92
+ props.checkItems.hidden = !isCardSearch;
93
+ props.checkItemFields.hidden = !isCardSearch;
94
+ props.fields.hidden = !isCardSearch;
93
95
 
94
- if (type === "card") {
95
- return {
96
- ...defaultProps,
97
- cardId: {
98
- type: "string",
99
- label: "Card ID",
100
- description: "The ID of the card.",
101
- hidden: false,
102
- options: async () => {
103
- const cards = await this.app.getCards({
104
- boardId: this.boardId,
105
- });
106
- return cards.map(({
107
- id: value, name: label,
108
- }) => ({
109
- label,
110
- value,
111
- }));
112
- },
113
- },
114
- };
115
- }
96
+ props.checkItemFields.hidden = !(this.checkItems === "all");
116
97
 
117
- return defaultProps;
98
+ return {};
118
99
  },
119
100
  async run({ $ }) {
120
101
  const {
@@ -125,32 +106,27 @@ export default {
125
106
  query,
126
107
  checkItems,
127
108
  checkItemFields,
128
- filter,
129
109
  fields,
130
110
  } = this;
131
111
 
132
112
  let checklists = null;
133
113
  let matches = [];
134
114
 
135
- const params = {
136
- checkItems,
137
- checkItem_fields: checkItemFields,
138
- filter,
139
- fields,
140
- };
141
-
142
115
  if (type === "board") {
143
116
  checklists = await app.listBoardChecklists({
144
117
  $,
145
118
  boardId,
146
- params,
147
119
  });
148
120
 
149
121
  } else if (type === "card") {
150
122
  checklists = await app.listCardChecklists({
151
123
  $,
152
124
  cardId,
153
- params,
125
+ params: {
126
+ checkItems,
127
+ checkItem_fields: checkItemFields?.length && checkItemFields.join(),
128
+ fields: fields?.length && fields.join(),
129
+ },
154
130
  });
155
131
  }
156
132
 
@@ -161,6 +137,11 @@ export default {
161
137
  });
162
138
  }
163
139
 
140
+ if (matches?.length) {
141
+ $.export("$summary", `Found ${matches.length} matching checklist${matches.length === 1
142
+ ? ""
143
+ : "s"}`);
144
+ }
164
145
  return matches;
165
146
  },
166
147
  };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "trello-search-members",
5
5
  name: "Search Members",
6
6
  description: "Search for Trello members. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-search/#api-search-members-get).",
7
- version: "0.2.0",
7
+ version: "0.2.1",
8
8
  type: "action",
9
9
  props: {
10
10
  app,
@@ -13,12 +13,6 @@ export default {
13
13
  label: "Search Query",
14
14
  description: "Search query 1 to 16384 characters long",
15
15
  },
16
- limit: {
17
- type: "integer",
18
- label: "Limit",
19
- description: "The maximum number of results to return. Maximum of 20.",
20
- optional: true,
21
- },
22
16
  idBoard: {
23
17
  label: "Board ID",
24
18
  description: "The ID of the board to search for members.",
@@ -38,32 +32,24 @@ export default {
38
32
  "idOrganizations",
39
33
  ],
40
34
  },
41
- onlyOrgMembers: {
42
- type: "boolean",
43
- label: "Only Organization Members",
44
- description: "If true, only members of the organization will be returned.",
35
+ limit: {
36
+ type: "integer",
37
+ label: "Limit",
38
+ description: "The maximum number of results to return. Maximum of 20.",
45
39
  optional: true,
46
40
  },
47
41
  },
48
- methods: {
49
- searchMembers(args = {}) {
50
- return this.app._makeRequest({
51
- path: "/search/members",
52
- ...args,
53
- });
54
- },
55
- },
56
42
  async run({ $ }) {
57
43
  const {
58
- searchMembers,
59
44
  query,
60
45
  limit,
61
46
  idBoard,
62
47
  idOrganization,
63
- onlyOrgMembers,
64
48
  } = this;
65
49
 
66
- const response = await searchMembers({
50
+ const onlyOrgMembers = idBoard || idOrganization;
51
+
52
+ const response = await this.app.searchMembers({
67
53
  $,
68
54
  params: {
69
55
  query,
@@ -74,7 +60,11 @@ export default {
74
60
  },
75
61
  });
76
62
 
77
- $.export("$summary", "Successfully searched for members.");
63
+ if (response?.length) {
64
+ $.export("$summary", `Successfully found ${response.length} member${response.length === 1
65
+ ? ""
66
+ : "s"}`);
67
+ }
78
68
 
79
69
  return response;
80
70
  },
@@ -1,25 +1,24 @@
1
- import common from "../common.mjs";
1
+ import app from "../../trello.app.mjs";
2
2
  import pickBy from "lodash-es/pickBy.js";
3
3
  import pick from "lodash-es/pick.js";
4
4
 
5
5
  export default {
6
- ...common,
7
6
  key: "trello-update-card",
8
7
  name: "Update Card",
9
8
  description: "Updates a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put).",
10
- version: "0.2.0",
9
+ version: "0.2.1",
11
10
  type: "action",
12
11
  props: {
13
- ...common.props,
12
+ app,
14
13
  idBoard: {
15
14
  propDefinition: [
16
- common.props.app,
15
+ app,
17
16
  "board",
18
17
  ],
19
18
  },
20
19
  cardId: {
21
20
  propDefinition: [
22
- common.props.app,
21
+ app,
23
22
  "cards",
24
23
  (c) => ({
25
24
  board: c.idBoard,
@@ -32,14 +31,14 @@ export default {
32
31
  },
33
32
  name: {
34
33
  propDefinition: [
35
- common.props.app,
34
+ app,
36
35
  "name",
37
36
  ],
38
37
  description: "The new name for the card.",
39
38
  },
40
39
  desc: {
41
40
  propDefinition: [
42
- common.props.app,
41
+ app,
43
42
  "desc",
44
43
  ],
45
44
  description: "The new description for the card.",
@@ -49,10 +48,11 @@ export default {
49
48
  label: "Archived",
50
49
  description: "Whether to archive the card",
51
50
  default: false,
51
+ optional: true,
52
52
  },
53
53
  idMembers: {
54
54
  propDefinition: [
55
- common.props.app,
55
+ app,
56
56
  "member",
57
57
  (c) => ({
58
58
  board: c.idBoard,
@@ -65,7 +65,7 @@ export default {
65
65
  },
66
66
  idAttachmentCover: {
67
67
  propDefinition: [
68
- common.props.app,
68
+ app,
69
69
  "cardAttachmentId",
70
70
  ({ cardId }) => ({
71
71
  cardId,
@@ -77,7 +77,7 @@ export default {
77
77
  },
78
78
  idList: {
79
79
  propDefinition: [
80
- common.props.app,
80
+ app,
81
81
  "lists",
82
82
  (c) => ({
83
83
  board: c.idBoard,
@@ -89,7 +89,7 @@ export default {
89
89
  },
90
90
  idLabels: {
91
91
  propDefinition: [
92
- common.props.app,
92
+ app,
93
93
  "label",
94
94
  (c) => ({
95
95
  board: c.idBoard,
@@ -102,19 +102,20 @@ export default {
102
102
  },
103
103
  pos: {
104
104
  propDefinition: [
105
- common.props.app,
105
+ app,
106
106
  "pos",
107
107
  ],
108
+ description: "The position of the new card. `top`, `bottom`, or a positive float",
108
109
  },
109
110
  due: {
110
111
  propDefinition: [
111
- common.props.app,
112
+ app,
112
113
  "due",
113
114
  ],
114
115
  },
115
116
  dueComplete: {
116
117
  propDefinition: [
117
- common.props.app,
118
+ app,
118
119
  "dueComplete",
119
120
  ],
120
121
  description: "Whether the due date should be marked complete.",
@@ -123,30 +124,31 @@ export default {
123
124
  subscribed: {
124
125
  type: "boolean",
125
126
  label: "Subscribed",
126
- description: "Whether the member is should be subscribed to the card.",
127
+ description: "Whether the member should be subscribed to the card.",
127
128
  default: false,
129
+ optional: true,
128
130
  },
129
131
  address: {
130
132
  propDefinition: [
131
- common.props.app,
133
+ app,
132
134
  "address",
133
135
  ],
134
136
  },
135
137
  locationName: {
136
138
  propDefinition: [
137
- common.props.app,
139
+ app,
138
140
  "locationName",
139
141
  ],
140
142
  },
141
143
  coordinates: {
142
144
  propDefinition: [
143
- common.props.app,
145
+ app,
144
146
  "coordinates",
145
147
  ],
146
148
  },
147
149
  customFieldIds: {
148
150
  propDefinition: [
149
- common.props.app,
151
+ app,
150
152
  "customFieldIds",
151
153
  (c) => ({
152
154
  boardId: c.idBoard,
@@ -178,7 +180,6 @@ export default {
178
180
  return props;
179
181
  },
180
182
  methods: {
181
- ...common.methods,
182
183
  async getCustomFieldItems($) {
183
184
  const customFieldItems = [];
184
185
  for (const customFieldId of this.customFieldIds) {
@@ -0,0 +1,128 @@
1
+ const POSITIONS = [
2
+ "top",
3
+ "bottom",
4
+ ];
5
+
6
+ const CARD_FILTERS = [
7
+ "all",
8
+ "closed",
9
+ "none",
10
+ "open",
11
+ "visible",
12
+ ];
13
+
14
+ const LIST_FILTERS = [
15
+ "all",
16
+ "closed",
17
+ "none",
18
+ "open",
19
+ ];
20
+
21
+ const POWER_UPS = [
22
+ "all",
23
+ "calendar",
24
+ "cardAging",
25
+ "recap",
26
+ "voting",
27
+ ];
28
+
29
+ const PREFS_PERMISSION_LEVELS = [
30
+ "org",
31
+ "private",
32
+ "public",
33
+ ];
34
+
35
+ const PREFS_VOTING = [
36
+ "disabled",
37
+ "members",
38
+ "observers",
39
+ "org",
40
+ "public",
41
+ ];
42
+
43
+ const PREFS_COMMENTS = [
44
+ "disabled",
45
+ "members",
46
+ "observers",
47
+ "org",
48
+ "public",
49
+ ];
50
+
51
+ const PREFS_INVITATIONS = [
52
+ "admins",
53
+ "members",
54
+ ];
55
+
56
+ const PREFS_BACKGROUNDS = [
57
+ "blue",
58
+ "orange",
59
+ "green",
60
+ "red",
61
+ "purple",
62
+ "pink",
63
+ "lime",
64
+ "sky",
65
+ "grey",
66
+ ];
67
+
68
+ const PREFS_CARD_AGING = [
69
+ "pirate",
70
+ "regular",
71
+ ];
72
+
73
+ const LABEL_COLORS = [
74
+ "yellow",
75
+ "purple",
76
+ "blue",
77
+ "red",
78
+ "green",
79
+ "orange",
80
+ "black",
81
+ "sky",
82
+ "pink",
83
+ "lime",
84
+ "null",
85
+ ];
86
+
87
+ const NOTIFICATION_TIMES = [
88
+ "5 minutes",
89
+ "10 minutes",
90
+ "15 minutes",
91
+ "30 minutes",
92
+ "1 hour",
93
+ "2 hours",
94
+ "3 hours",
95
+ "6 hours",
96
+ "12 hours",
97
+ "1 day",
98
+ "2 days",
99
+ "3 days",
100
+ "1 week",
101
+ ];
102
+
103
+ const CARD_KEEP_FROM_SOURCE_PROPERTIES = [
104
+ "all",
105
+ "attachments",
106
+ "checklists",
107
+ "comments",
108
+ "due",
109
+ "labels",
110
+ "members",
111
+ "stickers",
112
+ ];
113
+
114
+ export default {
115
+ POSITIONS,
116
+ CARD_FILTERS,
117
+ LIST_FILTERS,
118
+ POWER_UPS,
119
+ PREFS_PERMISSION_LEVELS,
120
+ PREFS_VOTING,
121
+ PREFS_COMMENTS,
122
+ PREFS_INVITATIONS,
123
+ PREFS_BACKGROUNDS,
124
+ PREFS_CARD_AGING,
125
+ LABEL_COLORS,
126
+ NOTIFICATION_TIMES,
127
+ CARD_KEEP_FROM_SOURCE_PROPERTIES,
128
+ };
package/common/fields.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  export default {
2
2
  board: [
3
+ "all",
3
4
  "closed",
4
5
  "dateLastActivity",
5
6
  "dateLastView",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/trello",
3
- "version": "0.4.0",
3
+ "version": "1.0.0",
4
4
  "description": "Pipedream Trello Components",
5
5
  "main": "trello.app.mjs",
6
6
  "keywords": [
@@ -10,10 +10,11 @@
10
10
  "homepage": "https://pipedream.com/apps/trello",
11
11
  "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
12
  "dependencies": {
13
- "@pipedream/platform": "^3.0.1",
13
+ "@pipedream/platform": "^3.1.0",
14
14
  "crypto": "^1.0.1",
15
15
  "form-data": "^4.0.0",
16
16
  "lodash-es": "^4.17.21",
17
+ "mime": "^4.0.4",
17
18
  "ms": "^2.1.3"
18
19
  },
19
20
  "gitHead": "e12480b94cc03bed4808ebc6b13e7fdb3a1ba535",