@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
@@ -1,23 +1,23 @@
1
- import common from "../common.mjs";
1
+ import common from "../common/common.mjs";
2
2
 
3
3
  export default {
4
4
  ...common,
5
5
  key: "trello-rename-list",
6
6
  name: "Rename List",
7
- description: "Renames an existing list. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-lists/#api-lists-id-put)",
8
- version: "0.0.3",
7
+ description: "Renames an existing list. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-lists/#api-lists-id-put).",
8
+ version: "0.1.1",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
12
12
  board: {
13
13
  propDefinition: [
14
- common.props.trello,
14
+ common.props.app,
15
15
  "board",
16
16
  ],
17
17
  },
18
18
  listId: {
19
19
  propDefinition: [
20
- common.props.trello,
20
+ common.props.app,
21
21
  "lists",
22
22
  (c) => ({
23
23
  board: c.board,
@@ -30,18 +30,32 @@ export default {
30
30
  },
31
31
  name: {
32
32
  propDefinition: [
33
- common.props.trello,
33
+ common.props.app,
34
34
  "name",
35
35
  ],
36
36
  description: "The new name of the list",
37
37
  optional: false,
38
38
  },
39
39
  },
40
+ methods: {
41
+ renameList({
42
+ listId, ...args
43
+ } = {}) {
44
+ return this.app.put({
45
+ path: `/lists/${listId}`,
46
+ ...args,
47
+ });
48
+ },
49
+ },
40
50
  async run({ $ }) {
41
- const res = await this.trello.renameList(this.listId, {
42
- name: this.name,
43
- }, $);
44
- $.export("$summary", `Successfully renamed list to ${this.name}`);
51
+ const res = await this.renameList({
52
+ $,
53
+ listId: this.listId,
54
+ data: {
55
+ name: this.name,
56
+ },
57
+ });
58
+ $.export("$summary", `Successfully renamed list to \`${this.name}\`.`);
45
59
  return res;
46
60
  },
47
61
  };
@@ -1,56 +1,60 @@
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-boards",
6
5
  name: "Search Boards",
7
- description: "Searches for boards matching the specified query. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-search/#api-search-get)",
8
- version: "0.2.4",
6
+ description: "Searches for boards matching the specified query. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-search/#api-search-get).",
7
+ version: "0.3.1",
9
8
  type: "action",
10
9
  props: {
11
- ...common.props,
10
+ app,
12
11
  query: {
13
12
  propDefinition: [
14
- common.props.trello,
13
+ app,
15
14
  "query",
16
15
  ],
17
16
  },
18
17
  idOrganizations: {
19
18
  propDefinition: [
20
- common.props.trello,
19
+ app,
21
20
  "idOrganizations",
22
21
  ],
23
22
  description: "Specify the organizations to search for boards in",
24
23
  },
25
24
  partial: {
26
25
  propDefinition: [
27
- common.props.trello,
26
+ app,
28
27
  "partial",
29
28
  ],
29
+ optional: true,
30
30
  },
31
31
  boardFields: {
32
32
  propDefinition: [
33
- common.props.trello,
33
+ app,
34
34
  "boardFields",
35
35
  ],
36
+ optional: true,
36
37
  },
37
38
  boardsLimit: {
38
39
  type: "integer",
39
40
  label: "Boards Limit",
40
41
  description: "The maximum number of boards to return.",
41
42
  default: 10,
43
+ optional: true,
42
44
  },
43
45
  },
44
46
  async run({ $ }) {
45
- const opts = {
46
- query: this.query,
47
- idOrganizations: this.idOrganizations,
48
- modelTypes: "boards",
49
- board_fields: this.boardFields.join(","),
50
- boards_limit: this.boardsLimit,
51
- partial: this.partial,
52
- };
53
- const { boards } = await this.trello.searchBoards(opts, $);
47
+ const { boards } = await this.app.search({
48
+ $,
49
+ params: {
50
+ query: this.query,
51
+ idOrganizations: this.idOrganizations?.join(","),
52
+ modelTypes: "boards",
53
+ board_fields: this.boardFields.join(","),
54
+ boards_limit: this.boardsLimit,
55
+ partial: this.partial,
56
+ },
57
+ });
54
58
  $.export("$summary", `Successfully retrieved ${boards.length} board(s)`);
55
59
  return boards;
56
60
  },
@@ -1,58 +1,63 @@
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
- description: "Searches for cards matching the specified query. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-search/#api-search-get)",
8
- version: "0.1.4",
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).",
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.trello,
13
+ app,
15
14
  "query",
16
15
  ],
17
16
  },
18
17
  idBoards: {
19
18
  propDefinition: [
20
- common.props.trello,
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.trello,
29
+ app,
30
30
  "partial",
31
31
  ],
32
+ optional: true,
32
33
  },
33
34
  cardFields: {
34
35
  propDefinition: [
35
- common.props.trello,
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({ $ }) {
47
- const opts = {
48
- query: this.query,
49
- idBoards: this.idBoards,
50
- modelTypes: "cards",
51
- card_fields: this.cardFields,
52
- cards_limit: this.cardsLimit,
53
- partial: this.partial,
54
- };
55
- const { cards } = await this.trello.searchCards(opts, $);
50
+ const { cards } = await this.app.search({
51
+ $,
52
+ params: {
53
+ query: this.query,
54
+ idBoards: this.idBoards,
55
+ modelTypes: "cards",
56
+ card_fields: this.cardFields,
57
+ cards_limit: this.cardsLimit,
58
+ partial: this.partial,
59
+ },
60
+ });
56
61
  $.export("$summary", `Successfully retrieved ${cards.length} card(s)`);
57
62
  return cards;
58
63
  },
@@ -1,110 +1,147 @@
1
- // legacy_hash_id: a_1WiqM5
2
- import { axios } from "@pipedream/platform";
1
+ import app from "../../trello.app.mjs";
3
2
 
4
3
  export default {
5
4
  key: "trello-search-checklists",
6
- name: "Find Checklist",
7
- description: "Find a checklist on a particular board or card by name.",
8
- version: "0.1.3",
5
+ name: "Search Checklists",
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.1",
9
8
  type: "action",
10
9
  props: {
11
- trello: {
12
- type: "app",
13
- app: "trello",
14
- },
10
+ app,
15
11
  type: {
16
12
  type: "string",
13
+ label: "Type",
17
14
  description: "Whether to search boards or cards for the checklist.",
18
15
  options: [
19
16
  "board",
20
17
  "card",
21
18
  ],
19
+ reloadProps: true,
20
+ },
21
+ boardId: {
22
+ propDefinition: [
23
+ app,
24
+ "board",
25
+ ],
26
+ hidden: true,
22
27
  },
23
- id: {
28
+ cardId: {
29
+ propDefinition: [
30
+ app,
31
+ "cards",
32
+ (c) => ({
33
+ board: c.boardId,
34
+ }),
35
+ ],
24
36
  type: "string",
25
- description: "The ID of the board or card.",
37
+ label: "Card ID",
38
+ description: "The ID of the card",
39
+ hidden: true,
26
40
  },
27
41
  query: {
28
42
  type: "string",
29
- description: "The query to search for.",
43
+ label: "Query",
44
+ description: "The query to search for",
30
45
  },
31
46
  checkItems: {
32
47
  type: "string",
33
- description: "all or none",
48
+ label: "Check Items",
49
+ description: "Whether to display checklist items in the result. Select `all` or `none`.",
34
50
  optional: true,
35
51
  options: [
36
52
  "all",
37
53
  "none",
38
54
  ],
55
+ reloadProps: true,
56
+ hidden: true,
39
57
  },
40
- checkItem_fields: {
41
- type: "string",
58
+ checkItemFields: {
59
+ type: "string[]",
42
60
  label: "CheckItem Fields",
43
- description: "all or a comma-separated list of: name, nameData, pos, state, type",
44
- optional: true,
45
- },
46
- filter: {
47
- type: "string",
48
- description: "all or none",
49
- optional: true,
61
+ description: "Fields to include in the results. `all` or a list of: `name`, `nameData`, `pos`, `state`, `type`",
50
62
  options: [
51
63
  "all",
52
- "none",
64
+ "name",
65
+ "nameData",
66
+ "pos",
67
+ "state",
68
+ "type",
53
69
  ],
70
+ optional: true,
71
+ hidden: true,
54
72
  },
55
73
  fields: {
56
- type: "string",
57
- description: "all or a comma-separated list of: idBoard, idCard, name, pos",
74
+ type: "string[]",
75
+ label: "Fields",
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
+ ],
58
84
  optional: true,
85
+ hidden: true,
59
86
  },
60
87
  },
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;
95
+
96
+ props.checkItemFields.hidden = !(this.checkItems === "all");
97
+
98
+ return {};
99
+ },
61
100
  async run({ $ }) {
62
- let type = this.type;
63
- let id = this.id;
64
- let query = this.query;
65
- const trelloParams = [
66
- "checkItems",
67
- "checkItem_fields",
68
- "filter",
69
- "fields",
70
- ];
71
- let p = this;
101
+ const {
102
+ app,
103
+ type,
104
+ boardId,
105
+ cardId,
106
+ query,
107
+ checkItems,
108
+ checkItemFields,
109
+ fields,
110
+ } = this;
111
+
72
112
  let checklists = null;
73
113
  let matches = [];
74
114
 
75
- const queryString = trelloParams.filter((param) => p[param]).map((param) => `${param}=${p[param]}`)
76
- .join("&");
77
-
78
- if (type == "board") {
79
- checklists = await axios($, {
80
- url: `https://api.trello.com/1/boards/${id}/checklists?${queryString}`,
81
- method: "GET",
82
- }, {
83
- token: {
84
- key: this.trello.$auth.oauth_access_token,
85
- secret: this.trello.$auth.oauth_refresh_token,
86
- },
87
- oauthSignerUri: this.trello.$auth.oauth_signer_uri,
115
+ if (type === "board") {
116
+ checklists = await app.listBoardChecklists({
117
+ $,
118
+ boardId,
88
119
  });
89
- } else if (type == "card") {
90
- checklists = await axios($, {
91
- url: `https://api.trello.com/1/cards/${id}/checklists?${queryString}`,
92
- method: "GET",
93
- }, {
94
- token: {
95
- key: this.trello.$auth.oauth_access_token,
96
- secret: this.trello.$auth.oauth_refresh_token,
120
+
121
+ } else if (type === "card") {
122
+ checklists = await app.listCardChecklists({
123
+ $,
124
+ cardId,
125
+ params: {
126
+ checkItems,
127
+ checkItem_fields: checkItemFields?.length && checkItemFields.join(),
128
+ fields: fields?.length && fields.join(),
97
129
  },
98
- oauthSignerUri: this.trello.$auth.oauth_signer_uri,
99
130
  });
100
131
  }
132
+
101
133
  if (checklists) {
102
- checklists.forEach(function(checklist) {
103
- if (checklist.name.includes(query))
134
+ checklists.forEach((checklist) => {
135
+ if (checklist.name?.toLowerCase().includes(query.toLowerCase()))
104
136
  matches.push(checklist);
105
137
  });
106
138
  }
107
139
 
140
+ if (matches?.length) {
141
+ $.export("$summary", `Found ${matches.length} matching checklist${matches.length === 1
142
+ ? ""
143
+ : "s"}`);
144
+ }
108
145
  return matches;
109
146
  },
110
147
  };
@@ -1,61 +1,71 @@
1
- // legacy_hash_id: a_8KiV84
2
- import { axios } from "@pipedream/platform";
1
+ import app from "../../trello.app.mjs";
3
2
 
4
3
  export default {
5
4
  key: "trello-search-members",
6
5
  name: "Search Members",
7
- description: "Search for Trello members.",
8
- version: "0.1.3",
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.1",
9
8
  type: "action",
10
9
  props: {
11
- trello: {
12
- type: "app",
13
- app: "trello",
14
- },
10
+ app,
15
11
  query: {
16
12
  type: "string",
13
+ label: "Search Query",
17
14
  description: "Search query 1 to 16384 characters long",
18
15
  },
19
- limit: {
20
- type: "integer",
21
- description: "The maximum number of results to return. Maximum of 20.",
22
- optional: true,
23
- },
24
16
  idBoard: {
25
- type: "string",
17
+ label: "Board ID",
18
+ description: "The ID of the board to search for members.",
26
19
  optional: true,
20
+ propDefinition: [
21
+ app,
22
+ "board",
23
+ ],
27
24
  },
28
25
  idOrganization: {
29
26
  type: "string",
27
+ label: "Organization ID",
28
+ description: "The ID of the organization to search for members.",
30
29
  optional: true,
30
+ propDefinition: [
31
+ app,
32
+ "idOrganizations",
33
+ ],
31
34
  },
32
- onlyOrgMembers: {
33
- type: "boolean",
35
+ limit: {
36
+ type: "integer",
37
+ label: "Limit",
38
+ description: "The maximum number of results to return. Maximum of 20.",
34
39
  optional: true,
35
40
  },
36
41
  },
37
42
  async run({ $ }) {
38
- const trelloParams = [
39
- "query",
40
- "limit",
41
- "idBoard",
42
- "idOrganization",
43
- "onlyOrgMembers",
44
- ];
45
- let p = this;
43
+ const {
44
+ query,
45
+ limit,
46
+ idBoard,
47
+ idOrganization,
48
+ } = this;
46
49
 
47
- const queryString = trelloParams.filter((param) => p[param]).map((param) => `${param}=${p[param]}`)
48
- .join("&");
50
+ const onlyOrgMembers = idBoard || idOrganization;
49
51
 
50
- return await axios($, {
51
- url: `https://api.trello.com/1/search/members?${queryString}`,
52
- method: "GET",
53
- }, {
54
- token: {
55
- key: this.trello.$auth.oauth_access_token,
56
- secret: this.trello.$auth.oauth_refresh_token,
52
+ const response = await this.app.searchMembers({
53
+ $,
54
+ params: {
55
+ query,
56
+ limit,
57
+ idBoard,
58
+ idOrganization,
59
+ onlyOrgMembers,
57
60
  },
58
- oauthSignerUri: this.trello.$auth.oauth_signer_uri,
59
61
  });
62
+
63
+ if (response?.length) {
64
+ $.export("$summary", `Successfully found ${response.length} member${response.length === 1
65
+ ? ""
66
+ : "s"}`);
67
+ }
68
+
69
+ return response;
60
70
  },
61
71
  };