@pipedream/trello 0.3.2 → 0.3.5

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-via-url/add-attachment-to-card-via-url.mjs +73 -0
  2. package/actions/add-checklist/add-checklist.mjs +68 -0
  3. package/actions/add-comment/add-comment.mjs +55 -0
  4. package/actions/add-existing-label-to-card/add-existing-label-to-card.mjs +48 -0
  5. package/actions/add-file-as-attachment-via-url/add-file-as-attachment-via-url.mjs +72 -0
  6. package/actions/add-image-attachment/add-image-attachment.mjs +75 -0
  7. package/actions/add-label-to-card/add-label-to-card.mjs +55 -0
  8. package/actions/add-member-to-card/add-member-to-card.mjs +48 -0
  9. package/actions/archive-card/archive-card.mjs +37 -0
  10. package/actions/close-board/close-board.mjs +25 -0
  11. package/actions/common.js +21 -0
  12. package/actions/complete-checklist-item/complete-checklist-item.mjs +49 -0
  13. package/actions/copy-board/copy-board.mjs +174 -0
  14. package/actions/create-board/create-board.mjs +175 -0
  15. package/actions/create-card/create-card.mjs +195 -0
  16. package/actions/create-checklist/create-checklist.mjs +66 -0
  17. package/actions/create-checklist-item/create-checklist-item.mjs +67 -0
  18. package/actions/create-comment-on-card/create-comment-on-card.mjs +42 -0
  19. package/actions/create-label/create-label.mjs +73 -0
  20. package/actions/create-list/create-list.mjs +67 -0
  21. package/actions/delete-checklist/delete-checklist.mjs +46 -0
  22. package/actions/find-labels/find-labels.mjs +44 -0
  23. package/actions/find-list/find-list.mjs +49 -0
  24. package/actions/get-card/get-card.mjs +37 -0
  25. package/actions/get-list/get-list.mjs +32 -0
  26. package/actions/move-card-to-list/move-card-to-list.mjs +53 -0
  27. package/actions/remove-label-from-card/remove-label-from-card.mjs +47 -0
  28. package/actions/rename-list/rename-list.mjs +47 -0
  29. package/actions/search-boards/search-boards.mjs +57 -0
  30. package/actions/search-cards/search-cards.mjs +59 -0
  31. package/actions/search-checklists/search-checklists.mjs +110 -0
  32. package/actions/search-members/search-members.mjs +61 -0
  33. package/actions/update-card/update-card.mjs +165 -0
  34. package/common/events.js +138 -0
  35. package/common/fields.js +50 -0
  36. package/package.json +23 -19
  37. package/sources/board-based.mjs +27 -0
  38. package/sources/card-archived/card-archived.mjs +54 -0
  39. package/sources/card-due-date-reminder/card-due-date-reminder.mjs +80 -0
  40. package/sources/card-moved/card-moved.mjs +84 -0
  41. package/sources/card-updates/card-updates.mjs +60 -0
  42. package/sources/common-polling.mjs +16 -0
  43. package/sources/common-webhook.mjs +90 -0
  44. package/sources/common.js +34 -0
  45. package/sources/custom-webhook-events/custom-webhook-events.mjs +110 -0
  46. package/sources/new-activity/new-activity.mjs +64 -0
  47. package/sources/new-attachment/new-attachment.mjs +60 -0
  48. package/sources/new-board/new-board.mjs +29 -0
  49. package/sources/new-card/new-card.mjs +58 -0
  50. package/sources/new-checklist/new-checklist.mjs +29 -0
  51. package/sources/new-comment-added-to-card/new-comment-added-to-card.mjs +94 -0
  52. package/sources/new-label/new-label.mjs +41 -0
  53. package/sources/new-label-added-to-card/new-label-added-to-card.mjs +138 -0
  54. package/sources/new-list/new-list.mjs +29 -0
  55. package/sources/new-member-on-card/new-member-on-card.mjs +38 -0
  56. package/sources/new-notification/new-notification.mjs +50 -0
  57. package/trello.app.js +647 -145
  58. package/sources/card-archived/card-archived.js +0 -75
  59. package/sources/card-due-date-reminder/card-due-date-reminder.js +0 -65
  60. package/sources/card-moved/card-moved.js +0 -84
  61. package/sources/card-updates/card-updates.js +0 -77
  62. package/sources/custom-webhook-events/custom-webhook-events.js +0 -72
  63. package/sources/new-board/new-board.js +0 -62
  64. package/sources/new-card/new-card.js +0 -77
  65. package/sources/new-checklist/new-checklist.js +0 -74
  66. package/sources/new-comment-added-to-card/new-comment-added-to-card.js +0 -86
  67. package/sources/new-label/new-label.js +0 -73
  68. package/sources/new-label-added-to-card/new-labels-added-to-card.js +0 -85
  69. package/sources/new-list/new-list.js +0 -74
  70. package/sources/new-member-on-card/new-member-on-card.js +0 -75
  71. package/sources/new-notification/new-notification.js +0 -45
@@ -0,0 +1,110 @@
1
+ // legacy_hash_id: a_1WiqM5
2
+ import { axios } from "@pipedream/platform";
3
+
4
+ export default {
5
+ 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.1",
9
+ type: "action",
10
+ props: {
11
+ trello: {
12
+ type: "app",
13
+ app: "trello",
14
+ },
15
+ type: {
16
+ type: "string",
17
+ description: "Whether to search boards or cards for the checklist.",
18
+ options: [
19
+ "board",
20
+ "card",
21
+ ],
22
+ },
23
+ id: {
24
+ type: "string",
25
+ description: "The ID of the board or card.",
26
+ },
27
+ query: {
28
+ type: "string",
29
+ description: "The query to search for.",
30
+ },
31
+ checkItems: {
32
+ type: "string",
33
+ description: "all or none",
34
+ optional: true,
35
+ options: [
36
+ "all",
37
+ "none",
38
+ ],
39
+ },
40
+ checkItem_fields: {
41
+ type: "string",
42
+ 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,
50
+ options: [
51
+ "all",
52
+ "none",
53
+ ],
54
+ },
55
+ fields: {
56
+ type: "string",
57
+ description: "all or a comma-separated list of: idBoard, idCard, name, pos",
58
+ optional: true,
59
+ },
60
+ },
61
+ 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;
72
+ let checklists = null;
73
+ let matches = [];
74
+
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,
88
+ });
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,
97
+ },
98
+ oauthSignerUri: this.trello.$auth.oauth_signer_uri,
99
+ });
100
+ }
101
+ if (checklists) {
102
+ checklists.forEach(function(checklist) {
103
+ if (checklist.name.includes(query))
104
+ matches.push(checklist);
105
+ });
106
+ }
107
+
108
+ return matches;
109
+ },
110
+ };
@@ -0,0 +1,61 @@
1
+ // legacy_hash_id: a_8KiV84
2
+ import { axios } from "@pipedream/platform";
3
+
4
+ export default {
5
+ key: "trello-search-members",
6
+ name: "Search Members",
7
+ description: "Search for Trello members.",
8
+ version: "0.1.1",
9
+ type: "action",
10
+ props: {
11
+ trello: {
12
+ type: "app",
13
+ app: "trello",
14
+ },
15
+ query: {
16
+ type: "string",
17
+ description: "Search query 1 to 16384 characters long",
18
+ },
19
+ limit: {
20
+ type: "integer",
21
+ description: "The maximum number of results to return. Maximum of 20.",
22
+ optional: true,
23
+ },
24
+ idBoard: {
25
+ type: "string",
26
+ optional: true,
27
+ },
28
+ idOrganization: {
29
+ type: "string",
30
+ optional: true,
31
+ },
32
+ onlyOrgMembers: {
33
+ type: "boolean",
34
+ optional: true,
35
+ },
36
+ },
37
+ async run({ $ }) {
38
+ const trelloParams = [
39
+ "query",
40
+ "limit",
41
+ "idBoard",
42
+ "idOrganization",
43
+ "onlyOrgMembers",
44
+ ];
45
+ let p = this;
46
+
47
+ const queryString = trelloParams.filter((param) => p[param]).map((param) => `${param}=${p[param]}`)
48
+ .join("&");
49
+
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,
57
+ },
58
+ oauthSignerUri: this.trello.$auth.oauth_signer_uri,
59
+ });
60
+ },
61
+ };
@@ -0,0 +1,165 @@
1
+ import common from "../common.js";
2
+ import pickBy from "lodash/pickBy.js";
3
+ import pick from "lodash/pick.js";
4
+
5
+ export default {
6
+ ...common,
7
+ key: "trello-update-card",
8
+ name: "Update Card",
9
+ description: "Updates a card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put)",
10
+ version: "0.1.2",
11
+ type: "action",
12
+ props: {
13
+ ...common.props,
14
+ idBoard: {
15
+ propDefinition: [
16
+ common.props.trello,
17
+ "board",
18
+ ],
19
+ },
20
+ idCard: {
21
+ propDefinition: [
22
+ common.props.trello,
23
+ "cards",
24
+ (c) => ({
25
+ board: c.idBoard,
26
+ }),
27
+ ],
28
+ type: "string",
29
+ label: "Card",
30
+ description: "Specify the card to update",
31
+ optional: false,
32
+ },
33
+ name: {
34
+ propDefinition: [
35
+ common.props.trello,
36
+ "name",
37
+ ],
38
+ description: "The new name for the card.",
39
+ },
40
+ desc: {
41
+ propDefinition: [
42
+ common.props.trello,
43
+ "desc",
44
+ ],
45
+ description: "The new description for the card.",
46
+ },
47
+ closed: {
48
+ type: "boolean",
49
+ label: "Archived",
50
+ description: "Whether to archive the card",
51
+ default: false,
52
+ },
53
+ idMembers: {
54
+ propDefinition: [
55
+ common.props.trello,
56
+ "member",
57
+ (c) => ({
58
+ board: c.idBoard,
59
+ }),
60
+ ],
61
+ type: "string[]",
62
+ label: "Members",
63
+ description: "Change the members that are assigned to the card",
64
+ optional: true,
65
+ },
66
+ idAttachmentCover: {
67
+ type: "string",
68
+ label: "Cover",
69
+ description:
70
+ "Assign an attachment to be the cover image for the card",
71
+ optional: true,
72
+ },
73
+ idList: {
74
+ propDefinition: [
75
+ common.props.trello,
76
+ "lists",
77
+ (c) => ({
78
+ board: c.idBoard,
79
+ }),
80
+ ],
81
+ type: "string",
82
+ label: "List",
83
+ description: "Move the card to a particular list",
84
+ },
85
+ idLabels: {
86
+ propDefinition: [
87
+ common.props.trello,
88
+ "label",
89
+ (c) => ({
90
+ board: c.idBoard,
91
+ }),
92
+ ],
93
+ type: "string[]",
94
+ label: "Labels",
95
+ description: "Array of labelIDs to add to the card",
96
+ optional: true,
97
+ },
98
+ pos: {
99
+ propDefinition: [
100
+ common.props.trello,
101
+ "pos",
102
+ ],
103
+ },
104
+ due: {
105
+ propDefinition: [
106
+ common.props.trello,
107
+ "due",
108
+ ],
109
+ },
110
+ dueComplete: {
111
+ propDefinition: [
112
+ common.props.trello,
113
+ "dueComplete",
114
+ ],
115
+ description: "Whether the due date should be marked complete.",
116
+ default: false,
117
+ },
118
+ subscribed: {
119
+ type: "boolean",
120
+ label: "Subscribed",
121
+ description: "Whether the member is should be subscribed to the card.",
122
+ default: false,
123
+ },
124
+ address: {
125
+ propDefinition: [
126
+ common.props.trello,
127
+ "address",
128
+ ],
129
+ },
130
+ locationName: {
131
+ propDefinition: [
132
+ common.props.trello,
133
+ "locationName",
134
+ ],
135
+ },
136
+ coordinates: {
137
+ propDefinition: [
138
+ common.props.trello,
139
+ "coordinates",
140
+ ],
141
+ },
142
+ },
143
+ async run({ $ }) {
144
+ const opts = pickBy(pick(this, [
145
+ "name",
146
+ "desc",
147
+ "closed",
148
+ "idMembers",
149
+ "idAttachmentCover",
150
+ "idList",
151
+ "idLabels",
152
+ "idBoard",
153
+ "pos",
154
+ "due",
155
+ "dueComplete",
156
+ "subscribed",
157
+ "address",
158
+ "locationName",
159
+ "coordinates",
160
+ ]));
161
+ const res = await this.trello.updateCard(this.idCard, opts, $);
162
+ $.export("$summary", `Successfully updated card ${res.name}`);
163
+ return res;
164
+ },
165
+ };
@@ -0,0 +1,138 @@
1
+ module.exports = [
2
+ {
3
+ label: "Add Attachment To Card",
4
+ value: "addAttachmentToCard",
5
+ },
6
+ {
7
+ label: "Add Checklist To Card",
8
+ value: "addChecklistToCard",
9
+ },
10
+ {
11
+ label: "Add Label To Card",
12
+ value: "addLabelToCard",
13
+ },
14
+ {
15
+ label: "Add Member To Board",
16
+ value: "addMemberToBoard",
17
+ },
18
+ {
19
+ label: "Add Member To Card",
20
+ value: "addMemberToCard",
21
+ },
22
+ {
23
+ label: "Comment Card",
24
+ value: "commentCard",
25
+ },
26
+ {
27
+ label: "Convert To Card From Check Item",
28
+ value: "convertToCardFromCheckItem",
29
+ },
30
+ {
31
+ label: "Copy Card",
32
+ value: "copyCard",
33
+ },
34
+ {
35
+ label: "Create Card",
36
+ value: "createCard",
37
+ },
38
+ {
39
+ label: "Create Check Item",
40
+ value: "createCheckItem",
41
+ },
42
+ {
43
+ label: "Create Label",
44
+ value: "createLabel",
45
+ },
46
+ {
47
+ label: "Create List",
48
+ value: "createList",
49
+ },
50
+ {
51
+ label: "Delete Attachment From Card",
52
+ value: "deleteAttachmentFromCard",
53
+ },
54
+ {
55
+ label: "Delete Card",
56
+ value: "deleteCard",
57
+ },
58
+ {
59
+ label: "Delete Check Item",
60
+ value: "deleteCheckItem",
61
+ },
62
+ {
63
+ label: "Delete Comment",
64
+ value: "deleteComment",
65
+ },
66
+ {
67
+ label: "Delete Label",
68
+ value: "deleteLabel",
69
+ },
70
+ {
71
+ label: "Email Card",
72
+ value: "emailCard",
73
+ },
74
+ {
75
+ label: "Move Card From Board",
76
+ value: "moveCardFromBoard",
77
+ },
78
+ {
79
+ label: "Move Card To Board",
80
+ value: "moveCardToBoard",
81
+ },
82
+ {
83
+ label: "Move List From Board",
84
+ value: "moveListFromBoard",
85
+ },
86
+ {
87
+ label: "Move List To Board",
88
+ value: "moveListToBoard",
89
+ },
90
+ {
91
+ label: "Remove Checklist From Card",
92
+ value: "removeChecklistFromCard",
93
+ },
94
+ {
95
+ label: "Remove Label From Card",
96
+ value: "removeLabelFromCard",
97
+ },
98
+ {
99
+ label: "Remove Member From Board",
100
+ value: "removeMemberFromBoard",
101
+ },
102
+ {
103
+ label: "Remove Member From Card",
104
+ value: "removeMemberFromCard",
105
+ },
106
+ {
107
+ label: "Update Board",
108
+ value: "updateBoard",
109
+ },
110
+ {
111
+ label: "Update Card",
112
+ value: "updateCard",
113
+ },
114
+ {
115
+ label: "Update Check Item",
116
+ value: "updateCheckItem",
117
+ },
118
+ {
119
+ label: "Update Check Item State On Card",
120
+ value: "updateCheckItemStateOnCard",
121
+ },
122
+ {
123
+ label: "Update Checklist",
124
+ value: "updateChecklist",
125
+ },
126
+ {
127
+ label: "Update Comment",
128
+ value: "updateComment",
129
+ },
130
+ {
131
+ label: "Update Label",
132
+ value: "updateLabel",
133
+ },
134
+ {
135
+ label: "Update List",
136
+ value: "updateList",
137
+ },
138
+ ];
@@ -0,0 +1,50 @@
1
+ module.exports = {
2
+ board: [
3
+ "closed",
4
+ "dateLastActivity",
5
+ "dateLastView",
6
+ "desc",
7
+ "descData",
8
+ "idOrganization",
9
+ "invitations",
10
+ "invited",
11
+ "labelNames",
12
+ "memberships",
13
+ "name",
14
+ "pinned",
15
+ "powerUps",
16
+ "prefs",
17
+ "shortLink",
18
+ "shortUrl",
19
+ "starred",
20
+ "subscribed",
21
+ "url",
22
+ ],
23
+ card: [
24
+ "all",
25
+ "badges",
26
+ "checkItemStates",
27
+ "closed",
28
+ "dateLastActivity",
29
+ "desc",
30
+ "descData",
31
+ "due",
32
+ "email",
33
+ "idAttachmentCover",
34
+ "idBoard",
35
+ "idChecklists",
36
+ "idLabels",
37
+ "idList",
38
+ "idMembers",
39
+ "idMembersVoted",
40
+ "idShort",
41
+ "labels",
42
+ "manualCoverAttachment",
43
+ "name",
44
+ "pos",
45
+ "shortLink",
46
+ "shortUrl",
47
+ "subscribed",
48
+ "url",
49
+ ],
50
+ };
package/package.json CHANGED
@@ -1,20 +1,24 @@
1
1
  {
2
- "name": "@pipedream/trello",
3
- "version": "0.3.2",
4
- "description": "Pipedream Trello Components",
5
- "main": "trello.app.js",
6
- "keywords": [
7
- "pipedream",
8
- "trello"
9
- ],
10
- "homepage": "https://pipedream.com/apps/trello",
11
- "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
- "license": "MIT",
13
- "dependencies": {
14
- "axios": "^0.21.1"
15
- },
16
- "gitHead": "bf0e1cb3ad6da248c6125f9b512c59bfe35bf1fa",
17
- "publishConfig": {
18
- "access": "public"
19
- }
20
- }
2
+ "name": "@pipedream/trello",
3
+ "version": "0.3.5",
4
+ "description": "Pipedream Trello Components",
5
+ "main": "trello.app.js",
6
+ "keywords": [
7
+ "pipedream",
8
+ "trello"
9
+ ],
10
+ "homepage": "https://pipedream.com/apps/trello",
11
+ "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
+ "license": "MIT",
13
+ "dependencies": {
14
+ "@pipedream/platform": "^0.10.0",
15
+ "crypto": "^1.0.1",
16
+ "lodash.pick": "^4.4.0",
17
+ "lodash.pickby": "^4.6.0",
18
+ "mime": "^3.0.0"
19
+ },
20
+ "gitHead": "e12480b94cc03bed4808ebc6b13e7fdb3a1ba535",
21
+ "publishConfig": {
22
+ "access": "public"
23
+ }
24
+ }
@@ -0,0 +1,27 @@
1
+ /* eslint-disable pipedream/required-properties-key, pipedream/required-properties-name,
2
+ pipedream/required-properties-version, pipedream/required-properties-description,
3
+ pipedream/required-properties-type */
4
+ import base from "./common-webhook.mjs";
5
+
6
+ export default {
7
+ ...base,
8
+ props: {
9
+ ...base.props,
10
+ board: {
11
+ propDefinition: [
12
+ base.props.trello,
13
+ "board",
14
+ ],
15
+ },
16
+ },
17
+ methods: {
18
+ ...base.methods,
19
+ /**
20
+ * Default isRelevant for components that only filter the results by a specified board.
21
+ * @param {object} result - The result item obtained by the component.
22
+ */
23
+ isRelevant({ result }) {
24
+ return !this.board || this.board === result.idBoard;
25
+ },
26
+ },
27
+ };
@@ -0,0 +1,54 @@
1
+ import common from "../common-webhook.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "trello-card-archived",
6
+ name: "Card Archived (Instant)",
7
+ description: "Emit new event for each card archived.",
8
+ version: "0.0.9",
9
+ type: "source",
10
+ props: {
11
+ ...common.props,
12
+ board: {
13
+ propDefinition: [
14
+ common.props.trello,
15
+ "board",
16
+ ],
17
+ },
18
+ lists: {
19
+ propDefinition: [
20
+ common.props.trello,
21
+ "lists",
22
+ (c) => ({
23
+ board: c.board,
24
+ }),
25
+ ],
26
+ },
27
+ },
28
+ methods: {
29
+ ...common.methods,
30
+ async getSampleEvents() {
31
+ const cards = await this.trello.getFilteredCards(this.board, "closed");
32
+ return {
33
+ sampleEvents: cards,
34
+ sortField: "dateLastActivity",
35
+ };
36
+ },
37
+ isCorrectEventType(event) {
38
+ const eventTranslationKey = event.body?.action?.display?.translationKey;
39
+ return eventTranslationKey === "action_archived_card";
40
+ },
41
+ async getResult(event) {
42
+ const cardId = event.body?.action?.data?.card?.id;
43
+ return this.trello.getCard(cardId);
44
+ },
45
+ isRelevant({ result: card }) {
46
+ return (
47
+ (!this.board || this.board === card.idBoard) &&
48
+ (!this.lists ||
49
+ this.lists.length === 0 ||
50
+ this.lists.includes(card.idList))
51
+ );
52
+ },
53
+ },
54
+ };