@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.
- package/actions/add-attachment-to-card/add-attachment-to-card.mjs +29 -58
- package/actions/add-checklist/add-checklist.mjs +9 -19
- package/actions/add-comment/add-comment.mjs +4 -5
- package/actions/add-existing-label-to-card/add-existing-label-to-card.mjs +9 -19
- package/actions/add-member-to-card/add-member-to-card.mjs +9 -19
- package/actions/archive-card/archive-card.mjs +5 -6
- package/actions/{common.mjs → common/common.mjs} +1 -1
- package/actions/complete-checklist-item/complete-checklist-item.mjs +4 -14
- package/actions/create-board/create-board.mjs +10 -47
- package/actions/create-card/create-card.mjs +45 -65
- package/actions/create-checklist-item/create-checklist-item.mjs +4 -14
- package/actions/create-label/create-label.mjs +5 -18
- package/actions/create-list/create-list.mjs +4 -12
- package/actions/delete-checklist/delete-checklist.mjs +8 -18
- package/actions/find-labels/find-labels.mjs +2 -3
- package/actions/find-list/find-list.mjs +2 -2
- package/actions/get-card/get-card.mjs +2 -2
- package/actions/get-list/get-list.mjs +1 -1
- package/actions/move-card-to-list/move-card-to-list.mjs +2 -2
- package/actions/remove-label-from-card/remove-label-from-card.mjs +9 -18
- package/actions/rename-list/rename-list.mjs +2 -2
- package/actions/search-boards/search-boards.mjs +10 -8
- package/actions/search-cards/search-cards.mjs +11 -8
- package/actions/search-checklists/search-checklists.mjs +56 -75
- package/actions/search-members/search-members.mjs +13 -23
- package/actions/update-card/update-card.mjs +22 -21
- package/common/constants.mjs +128 -0
- package/common/fields.mjs +1 -0
- package/package.json +3 -2
- package/sources/card-archived/card-archived.mjs +16 -28
- package/sources/card-archived/test-event.mjs +64 -0
- package/sources/card-due-date-reminder/card-due-date-reminder.mjs +111 -33
- package/sources/card-due-date-reminder/test-event.mjs +75 -0
- package/sources/card-moved/card-moved.mjs +20 -23
- package/sources/card-moved/test-event.mjs +78 -0
- package/sources/card-updates/card-updates.mjs +20 -27
- package/sources/card-updates/test-event.mjs +86 -0
- package/sources/common/actions.mjs +206 -0
- package/sources/common/common-board-based.mjs +12 -7
- package/sources/common/common-webhook.mjs +27 -16
- package/sources/common/common.mjs +5 -2
- package/sources/custom-webhook-events/custom-webhook-events.mjs +17 -48
- package/sources/new-activity/new-activity.mjs +22 -31
- package/sources/new-attachment/new-attachment.mjs +40 -49
- package/sources/new-attachment/test-event.mjs +69 -0
- package/sources/new-board/new-board.mjs +18 -11
- package/sources/new-board/test-event.mjs +100 -0
- package/sources/new-card/new-card.mjs +20 -27
- package/sources/new-card/test-event.mjs +79 -0
- package/sources/new-checklist/new-checklist.mjs +39 -22
- package/sources/new-checklist/test-event.mjs +22 -0
- package/sources/new-comment-added-to-card/new-comment-added-to-card.mjs +38 -44
- package/sources/new-comment-added-to-card/test-event.mjs +298 -0
- package/sources/new-label/new-label.mjs +13 -14
- package/sources/new-label/test-event.mjs +7 -0
- package/sources/new-label-added-to-card/new-label-added-to-card.mjs +23 -24
- package/sources/new-label-added-to-card/test-event.mjs +85 -0
- package/sources/new-member-on-card/new-member-on-card.mjs +17 -26
- package/sources/new-member-on-card/test-event.mjs +83 -0
- package/sources/new-notification/new-notification.mjs +3 -12
- package/trello.app.mjs +211 -33
- package/actions/close-board/close-board.mjs +0 -31
- package/actions/create-checklist/create-checklist.mjs +0 -78
- package/actions/create-comment-on-card/create-comment-on-card.mjs +0 -59
- package/sources/new-list/new-list.mjs +0 -33
@@ -1,11 +1,12 @@
|
|
1
1
|
import common from "../common/common-webhook.mjs";
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
2
3
|
|
3
4
|
export default {
|
4
5
|
...common,
|
5
6
|
key: "trello-new-comment-added-to-card",
|
6
7
|
name: "New Comment Added to Card (Instant)",
|
7
8
|
description: "Emit new event for each new comment added to a card.",
|
8
|
-
version: "0.2.
|
9
|
+
version: "0.2.1",
|
9
10
|
type: "source",
|
10
11
|
dedupe: "unique",
|
11
12
|
props: {
|
@@ -16,49 +17,45 @@ export default {
|
|
16
17
|
"board",
|
17
18
|
],
|
18
19
|
},
|
20
|
+
list: {
|
21
|
+
propDefinition: [
|
22
|
+
common.props.app,
|
23
|
+
"lists",
|
24
|
+
(c) => ({
|
25
|
+
board: c.board,
|
26
|
+
}),
|
27
|
+
],
|
28
|
+
type: "string",
|
29
|
+
label: "List",
|
30
|
+
description: "If specified, events will only be emitted when a comment is added to a card in the specified list",
|
31
|
+
},
|
19
32
|
cards: {
|
20
33
|
propDefinition: [
|
21
34
|
common.props.app,
|
22
35
|
"cards",
|
23
36
|
(c) => ({
|
24
37
|
board: c.board,
|
38
|
+
list: c.list,
|
25
39
|
}),
|
26
40
|
],
|
27
|
-
|
28
|
-
},
|
29
|
-
hooks: {
|
30
|
-
...common.hooks,
|
31
|
-
async deploy() {
|
32
|
-
const {
|
33
|
-
sampleEvents, sortField,
|
34
|
-
} = await this.getSampleEvents();
|
35
|
-
sampleEvents.sort((a, b) => (Date.parse(a[sortField]) > Date.parse(b[sortField]))
|
36
|
-
? 1
|
37
|
-
: -1);
|
38
|
-
for (const action of sampleEvents.slice(-25)) {
|
39
|
-
this.emitEvent(action);
|
40
|
-
}
|
41
|
+
description: "If specified, events will only be emitted when a comment is added to one of the specified cards",
|
41
42
|
},
|
42
43
|
},
|
43
44
|
methods: {
|
44
45
|
...common.methods,
|
45
|
-
getCardActivity({
|
46
|
-
cardId, ...args
|
47
|
-
} = {}) {
|
48
|
-
return this.app._makeRequest({
|
49
|
-
path: `/cards/${cardId}/actions`,
|
50
|
-
...args,
|
51
|
-
});
|
52
|
-
},
|
53
46
|
async getSampleEvents() {
|
54
|
-
const cards = this.cards
|
47
|
+
const cards = this.cards?.length
|
55
48
|
? this.cards
|
56
|
-
:
|
57
|
-
|
58
|
-
|
49
|
+
: this.list
|
50
|
+
? (await this.app.getCardsInList({
|
51
|
+
listId: this.list,
|
52
|
+
})).map((card) => card.id)
|
53
|
+
: (await this.app.getCards({
|
54
|
+
boardId: this.board,
|
55
|
+
})).map((card) => card.id);
|
59
56
|
const actions = [];
|
60
57
|
for (const card of cards) {
|
61
|
-
const activities = await this.getCardActivity({
|
58
|
+
const activities = await this.app.getCardActivity({
|
62
59
|
cardId: card,
|
63
60
|
params: {
|
64
61
|
filter: "commentCard",
|
@@ -69,37 +66,33 @@ export default {
|
|
69
66
|
actions.push(await this.getResult(activity));
|
70
67
|
}
|
71
68
|
}
|
72
|
-
return
|
73
|
-
|
74
|
-
|
75
|
-
|
69
|
+
return actions;
|
70
|
+
},
|
71
|
+
getSortField() {
|
72
|
+
return "date";
|
76
73
|
},
|
77
|
-
isCorrectEventType(
|
78
|
-
|
79
|
-
return eventType === "commentCard";
|
74
|
+
isCorrectEventType({ type }) {
|
75
|
+
return type === "commentCard";
|
80
76
|
},
|
81
|
-
async getResult(
|
82
|
-
const cardId = event?.body?.action?.data?.card?.id ??
|
83
|
-
event?.data?.card?.id;
|
77
|
+
async getResult(action) {
|
84
78
|
const card = await this.app.getCard({
|
85
|
-
cardId,
|
79
|
+
cardId: action?.data?.card?.id,
|
86
80
|
});
|
87
|
-
const memberId = event?.body?.action?.idMemberCreator ??
|
88
|
-
event.idMemberCreator;
|
89
81
|
const member = await this.app.getMember({
|
90
|
-
memberId,
|
82
|
+
memberId: action?.idMemberCreator,
|
91
83
|
});
|
92
84
|
|
93
85
|
return {
|
94
86
|
member,
|
95
87
|
card,
|
96
|
-
event:
|
88
|
+
event: action,
|
97
89
|
};
|
98
90
|
},
|
99
91
|
isRelevant({ result: { card } }) {
|
100
92
|
return (
|
101
93
|
(!this.board || this.board === card.idBoard) &&
|
102
|
-
(!this.
|
94
|
+
(!this.lists || this.list === card.idList) &&
|
95
|
+
(!this.cards?.length || this.cards.includes(card.id))
|
103
96
|
);
|
104
97
|
},
|
105
98
|
generateMeta({ event }) {
|
@@ -110,4 +103,5 @@ export default {
|
|
110
103
|
};
|
111
104
|
},
|
112
105
|
},
|
106
|
+
sampleEmit,
|
113
107
|
};
|
@@ -0,0 +1,298 @@
|
|
1
|
+
export default {
|
2
|
+
"member": {
|
3
|
+
"id": "5df149d4fa80be39e64c9a43",
|
4
|
+
"aaId": "5df149cf8998970e5b435642",
|
5
|
+
"activityBlocked": false,
|
6
|
+
"avatarHash": "5590d4f06fc7d09fc98b242248c9003e",
|
7
|
+
"avatarUrl": "https://trello-members.s3.amazonaws.com/5df149d4fa80be39e64c9a43/5590d4f06fc7d09fc98b242248c9003e",
|
8
|
+
"bio": "",
|
9
|
+
"bioData": null,
|
10
|
+
"confirmed": true,
|
11
|
+
"fullName": "Michelle Bergeron",
|
12
|
+
"idEnterprise": null,
|
13
|
+
"idEnterprisesDeactivated": [],
|
14
|
+
"idMemberReferrer": null,
|
15
|
+
"idPremOrgsAdmin": [],
|
16
|
+
"initials": "MB",
|
17
|
+
"memberType": "normal",
|
18
|
+
"nonPublic": {},
|
19
|
+
"nonPublicAvailable": true,
|
20
|
+
"products": [],
|
21
|
+
"url": "https://trello.com/michellebergeron6",
|
22
|
+
"username": "michellebergeron6",
|
23
|
+
"status": "disconnected",
|
24
|
+
"aaBlockSyncUntil": null,
|
25
|
+
"aaEmail": null,
|
26
|
+
"aaEnrolledDate": null,
|
27
|
+
"avatarSource": "none",
|
28
|
+
"credentialsRemovedCount": 0,
|
29
|
+
"dateLastImpression": "2024-10-01T19:54:58.087Z",
|
30
|
+
"dateLastActive": "2024-10-01T19:55:05.070Z",
|
31
|
+
"domainClaimed": null,
|
32
|
+
"email": null,
|
33
|
+
"gravatarHash": "010b11df3bb34c405912830655ee130c",
|
34
|
+
"idBoards": [
|
35
|
+
"5df14a131c0e51155e68ea62",
|
36
|
+
],
|
37
|
+
"idOrganizations": [
|
38
|
+
"6047c17c2f558003144e04d7"
|
39
|
+
],
|
40
|
+
"idEnterprisesAdmin": [],
|
41
|
+
"limits": {
|
42
|
+
"boards": {
|
43
|
+
"totalPerMember": {
|
44
|
+
"status": "ok",
|
45
|
+
"disableAt": 4500,
|
46
|
+
"warnAt": 3600
|
47
|
+
}
|
48
|
+
},
|
49
|
+
"orgs": {
|
50
|
+
"totalPerMember": {
|
51
|
+
"status": "ok",
|
52
|
+
"disableAt": 850,
|
53
|
+
"warnAt": 680
|
54
|
+
}
|
55
|
+
}
|
56
|
+
},
|
57
|
+
"loginTypes": null,
|
58
|
+
"marketingOptIn": {
|
59
|
+
"optedIn": true,
|
60
|
+
"date": "2019-12-11T19:56:05.741Z"
|
61
|
+
},
|
62
|
+
"messagesDismissed": [
|
63
|
+
{
|
64
|
+
"_id": "6082199aab18525bdcbe18f5",
|
65
|
+
"name": "team-join-cta-banner-6047c17c2f558003144e04d7",
|
66
|
+
"count": 5,
|
67
|
+
"lastDismissed": "2021-04-23T00:49:31.975Z"
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"_id": "6082199a190169402dc6130f",
|
71
|
+
"name": "team-join-cta-banner-6047c17c2f558003144e04d7",
|
72
|
+
"count": 1,
|
73
|
+
"lastDismissed": "2021-04-23T00:49:30.689Z"
|
74
|
+
}
|
75
|
+
],
|
76
|
+
"nodeId": "ari:cloud:trello::user/5df149d4fa80be39e64c9a43",
|
77
|
+
"oneTimeMessagesDismissed": [
|
78
|
+
"create-first-board",
|
79
|
+
"close-menu-of-first-board",
|
80
|
+
"nusku.views-switcher-upsell-default-open",
|
81
|
+
"teamify-post-migration",
|
82
|
+
"ack-new-feature-ButlerOnBoardsV2-1619852400000",
|
83
|
+
"workspace-nav-enabled",
|
84
|
+
"workspace-nav-spotlight",
|
85
|
+
"team-template-picker-6047c17c2f558003144e04d7",
|
86
|
+
"free-trial-banner-confetti-6047c17c2f558003144e04d7",
|
87
|
+
"team-table-views-switcher-new-pill",
|
88
|
+
"timeline-view-suggestion-6047c17c2f558003144e04d7",
|
89
|
+
"calendar-view-suggestion-6047c17c2f558003144e04d7",
|
90
|
+
"free-trial-banner-6047c17c2f558003144e04d7",
|
91
|
+
"workspace-user-limit-banner",
|
92
|
+
"atlassian-intelligence-admin-6047c17c2f558003144e04d7",
|
93
|
+
"your-items-on-home"
|
94
|
+
],
|
95
|
+
"sessionType": null,
|
96
|
+
"prefs": {
|
97
|
+
"sendSummaries": true,
|
98
|
+
"minutesBetweenSummaries": 60,
|
99
|
+
"minutesBeforeDeadlineToNotify": 60,
|
100
|
+
"colorBlind": false,
|
101
|
+
"locale": "en-US",
|
102
|
+
"privacy": {
|
103
|
+
"fullName": "public",
|
104
|
+
"avatar": "public"
|
105
|
+
}
|
106
|
+
},
|
107
|
+
"trophies": [],
|
108
|
+
"uploadedAvatarHash": null,
|
109
|
+
"uploadedAvatarUrl": null,
|
110
|
+
"premiumFeatures": [],
|
111
|
+
"isAaMastered": true,
|
112
|
+
"ixUpdate": "151"
|
113
|
+
},
|
114
|
+
"card": {
|
115
|
+
"id": "61818a303e545129af23695d",
|
116
|
+
"badges": {
|
117
|
+
"attachmentsByType": {
|
118
|
+
"trello": {
|
119
|
+
"board": 0,
|
120
|
+
"card": 2
|
121
|
+
}
|
122
|
+
},
|
123
|
+
"externalSource": null,
|
124
|
+
"location": false,
|
125
|
+
"votes": 0,
|
126
|
+
"viewingMemberVoted": false,
|
127
|
+
"subscribed": true,
|
128
|
+
"fogbugz": "",
|
129
|
+
"checkItems": 1,
|
130
|
+
"checkItemsChecked": 1,
|
131
|
+
"checkItemsEarliestDue": null,
|
132
|
+
"comments": 2,
|
133
|
+
"attachments": 3,
|
134
|
+
"description": false,
|
135
|
+
"due": "2024-10-01T19:20:00.000Z",
|
136
|
+
"dueComplete": false,
|
137
|
+
"start": null,
|
138
|
+
"lastUpdatedByAi": false
|
139
|
+
},
|
140
|
+
"checkItemStates": [
|
141
|
+
{
|
142
|
+
"idCheckItem": "6181a5f18e239e6aff9799a4",
|
143
|
+
"state": "complete"
|
144
|
+
}
|
145
|
+
],
|
146
|
+
"closed": false,
|
147
|
+
"dueComplete": false,
|
148
|
+
"dateLastActivity": "2024-10-01T20:12:35.627Z",
|
149
|
+
"desc": "",
|
150
|
+
"descData": {
|
151
|
+
"emoji": {}
|
152
|
+
},
|
153
|
+
"due": "2024-10-01T19:20:00.000Z",
|
154
|
+
"dueReminder": -1,
|
155
|
+
"email": null,
|
156
|
+
"idBoard": "5f4d7be6c45c22583f75fa02",
|
157
|
+
"idChecklists": [
|
158
|
+
"6181a5ef401ae66c357732b4"
|
159
|
+
],
|
160
|
+
"idList": "5f4d7f78bdd7ce4d2d25fdda",
|
161
|
+
"idMembers": [],
|
162
|
+
"idMembersVoted": [],
|
163
|
+
"idShort": 68,
|
164
|
+
"idAttachmentCover": "62c884dce32d46579ecfd5f0",
|
165
|
+
"labels": [],
|
166
|
+
"idLabels": [],
|
167
|
+
"manualCoverAttachment": false,
|
168
|
+
"name": "sfsfdsfd",
|
169
|
+
"pinned": false,
|
170
|
+
"pos": 131071,
|
171
|
+
"shortLink": "QVLahShU",
|
172
|
+
"shortUrl": "https://trello.com/c/QVLahShU",
|
173
|
+
"start": null,
|
174
|
+
"subscribed": true,
|
175
|
+
"url": "https://trello.com/c/QVLahShU/68-sfsfdsfd",
|
176
|
+
"cover": {
|
177
|
+
"idAttachment": "62c884dce32d46579ecfd5f0",
|
178
|
+
"color": null,
|
179
|
+
"idUploadedBackground": null,
|
180
|
+
"size": "normal",
|
181
|
+
"brightness": "dark",
|
182
|
+
"scaled": [
|
183
|
+
{
|
184
|
+
"id": "62c884dde32d46579ecfd5ff",
|
185
|
+
"_id": "62c884dde32d46579ecfd5ff",
|
186
|
+
"scaled": false,
|
187
|
+
"url": "",
|
188
|
+
"bytes": 1649,
|
189
|
+
"height": 50,
|
190
|
+
"width": 70
|
191
|
+
},
|
192
|
+
{
|
193
|
+
"id": "62c884dde32d46579ecfd601",
|
194
|
+
"_id": "62c884dde32d46579ecfd601",
|
195
|
+
"scaled": true,
|
196
|
+
"url": "",
|
197
|
+
"bytes": 4508,
|
198
|
+
"height": 98,
|
199
|
+
"width": 150
|
200
|
+
},
|
201
|
+
{
|
202
|
+
"id": "62c884dde32d46579ecfd600",
|
203
|
+
"_id": "62c884dde32d46579ecfd600",
|
204
|
+
"scaled": false,
|
205
|
+
"url": "",
|
206
|
+
"bytes": 9598,
|
207
|
+
"height": 150,
|
208
|
+
"width": 250
|
209
|
+
},
|
210
|
+
{
|
211
|
+
"id": "62c884dde32d46579ecfd602",
|
212
|
+
"_id": "62c884dde32d46579ecfd602",
|
213
|
+
"scaled": true,
|
214
|
+
"url": "",
|
215
|
+
"bytes": 13736,
|
216
|
+
"height": 195,
|
217
|
+
"width": 300
|
218
|
+
},
|
219
|
+
{
|
220
|
+
"id": "62c884dde32d46579ecfd603",
|
221
|
+
"_id": "62c884dde32d46579ecfd603",
|
222
|
+
"scaled": true,
|
223
|
+
"url": "",
|
224
|
+
"bytes": 20289,
|
225
|
+
"height": 260,
|
226
|
+
"width": 400
|
227
|
+
},
|
228
|
+
{
|
229
|
+
"id": "62c884dde32d46579ecfd604",
|
230
|
+
"_id": "62c884dde32d46579ecfd604",
|
231
|
+
"scaled": false,
|
232
|
+
"url": "",
|
233
|
+
"bytes": 18820,
|
234
|
+
"height": 260,
|
235
|
+
"width": 400
|
236
|
+
}
|
237
|
+
],
|
238
|
+
"edgeColor": "#bbac9c",
|
239
|
+
"idPlugin": null
|
240
|
+
},
|
241
|
+
"isTemplate": false,
|
242
|
+
"cardRole": null
|
243
|
+
},
|
244
|
+
"event": {
|
245
|
+
"id": "66fc17543e3458edb8b3070d",
|
246
|
+
"idMemberCreator": "5df149d4fa80be39e64c9a43",
|
247
|
+
"data": {
|
248
|
+
"text": "hello world",
|
249
|
+
"textData": {
|
250
|
+
"emoji": {}
|
251
|
+
},
|
252
|
+
"card": {
|
253
|
+
"id": "61818a303e545129af23695d",
|
254
|
+
"name": "card",
|
255
|
+
"idShort": 68,
|
256
|
+
"shortLink": "QVLahShU"
|
257
|
+
},
|
258
|
+
"board": {
|
259
|
+
"id": "5f4d7be6c45c22583f75fa02",
|
260
|
+
"name": "Board",
|
261
|
+
"shortLink": "tiA9sOeK"
|
262
|
+
},
|
263
|
+
"list": {
|
264
|
+
"id": "5f4d7f78bdd7ce4d2d25fdda",
|
265
|
+
"name": "List"
|
266
|
+
}
|
267
|
+
},
|
268
|
+
"appCreator": null,
|
269
|
+
"type": "commentCard",
|
270
|
+
"date": "2024-10-01T15:37:56.522Z",
|
271
|
+
"limits": {
|
272
|
+
"reactions": {
|
273
|
+
"perAction": {
|
274
|
+
"status": "ok",
|
275
|
+
"disableAt": 900,
|
276
|
+
"warnAt": 720
|
277
|
+
},
|
278
|
+
"uniquePerAction": {
|
279
|
+
"status": "ok",
|
280
|
+
"disableAt": 17,
|
281
|
+
"warnAt": 14
|
282
|
+
}
|
283
|
+
}
|
284
|
+
},
|
285
|
+
"memberCreator": {
|
286
|
+
"id": "5df149d4fa80be39e64c9a43",
|
287
|
+
"activityBlocked": false,
|
288
|
+
"avatarHash": "5590d4f06fc7d09fc98b242248c9003e",
|
289
|
+
"avatarUrl": "",
|
290
|
+
"fullName": "",
|
291
|
+
"idMemberReferrer": null,
|
292
|
+
"initials": "",
|
293
|
+
"nonPublic": {},
|
294
|
+
"nonPublicAvailable": true,
|
295
|
+
"username": ""
|
296
|
+
}
|
297
|
+
}
|
298
|
+
}
|
@@ -1,32 +1,30 @@
|
|
1
1
|
import common from "../common/common-board-based.mjs";
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
2
3
|
|
3
4
|
export default {
|
4
5
|
...common,
|
5
6
|
key: "trello-new-label",
|
6
|
-
name: "New Label (Instant)",
|
7
|
+
name: "New Label Created (Instant)",
|
7
8
|
description: "Emit new event for each new label added to a board.",
|
8
|
-
version: "0.1.
|
9
|
+
version: "0.1.1",
|
9
10
|
type: "source",
|
10
11
|
dedupe: "unique",
|
11
12
|
methods: {
|
12
13
|
...common.methods,
|
13
|
-
|
14
|
-
|
14
|
+
getSampleEvents() {
|
15
|
+
return this.app.findLabel({
|
15
16
|
boardId: this.board,
|
16
17
|
});
|
17
|
-
return {
|
18
|
-
sampleEvents: labels,
|
19
|
-
sortField: "id",
|
20
|
-
};
|
21
18
|
},
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
getSortField() {
|
20
|
+
return "id";
|
21
|
+
},
|
22
|
+
isCorrectEventType({ type }) {
|
23
|
+
return type === "createLabel";
|
25
24
|
},
|
26
|
-
|
27
|
-
const labelId = event.body?.action?.data?.label?.id;
|
25
|
+
getResult({ data }) {
|
28
26
|
return this.app.getLabel({
|
29
|
-
labelId,
|
27
|
+
labelId: data?.label?.id,
|
30
28
|
});
|
31
29
|
},
|
32
30
|
generateMeta({
|
@@ -42,4 +40,5 @@ export default {
|
|
42
40
|
};
|
43
41
|
},
|
44
42
|
},
|
43
|
+
sampleEmit,
|
45
44
|
};
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import common from "../common/common-webhook.mjs";
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
2
3
|
|
3
4
|
export default {
|
4
5
|
...common,
|
5
6
|
key: "trello-new-label-added-to-card",
|
6
7
|
name: "New Label Added To Card (Instant)",
|
7
8
|
description: "Emit new event for each label added to a card.",
|
8
|
-
version: "0.1.
|
9
|
+
version: "0.1.1",
|
9
10
|
type: "source",
|
10
11
|
props: {
|
11
12
|
...common.props,
|
@@ -15,7 +16,7 @@ export default {
|
|
15
16
|
"board",
|
16
17
|
],
|
17
18
|
},
|
18
|
-
|
19
|
+
list: {
|
19
20
|
propDefinition: [
|
20
21
|
common.props.app,
|
21
22
|
"lists",
|
@@ -23,6 +24,9 @@ export default {
|
|
23
24
|
board: c.board,
|
24
25
|
}),
|
25
26
|
],
|
27
|
+
type: "string",
|
28
|
+
label: "List",
|
29
|
+
description: "If specified, events will only be emitted when a label is added to a card in the specified lists",
|
26
30
|
},
|
27
31
|
cards: {
|
28
32
|
propDefinition: [
|
@@ -30,24 +34,24 @@ export default {
|
|
30
34
|
"cards",
|
31
35
|
(c) => ({
|
32
36
|
board: c.board,
|
37
|
+
list: c.list,
|
33
38
|
}),
|
34
39
|
],
|
40
|
+
description: "If specified, events will only be emitted when a label is added to one of the specified cards",
|
35
41
|
},
|
36
42
|
},
|
37
43
|
hooks: {
|
38
44
|
...common.hooks,
|
39
45
|
async deploy() {
|
40
|
-
if (this.cards
|
46
|
+
if (this.cards?.length) {
|
41
47
|
await this.emitLabelsFromCardIds(this.cards);
|
42
48
|
return;
|
43
49
|
}
|
44
|
-
if (this.
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
await this.emitLabelsFromCards(cards);
|
50
|
-
}
|
50
|
+
if (this.list) {
|
51
|
+
const cards = await this.app.getCardsInList({
|
52
|
+
listId: this.list,
|
53
|
+
});
|
54
|
+
await this.emitLabelsFromCards(cards);
|
51
55
|
return;
|
52
56
|
}
|
53
57
|
const cards = await this.app.getCards({
|
@@ -100,28 +104,22 @@ export default {
|
|
100
104
|
_setLabelColor(labelColor) {
|
101
105
|
this.db.set("labelColor", labelColor);
|
102
106
|
},
|
103
|
-
isCorrectEventType(
|
104
|
-
|
105
|
-
return eventType === "addLabelToCard";
|
107
|
+
isCorrectEventType({ type }) {
|
108
|
+
return type === "addLabelToCard";
|
106
109
|
},
|
107
|
-
|
108
|
-
const cardId = event.body?.action?.data?.card?.id;
|
109
|
-
const labelName = event.body?.action?.data?.label?.name;
|
110
|
-
const labelColor = event.body?.action?.data?.label?.color;
|
110
|
+
getResult({ data }) {
|
111
111
|
/** Record labelName & labelColor to use in generateMeta() */
|
112
|
-
this._setLabelName(
|
113
|
-
this._setLabelColor(
|
112
|
+
this._setLabelName(data?.label?.name);
|
113
|
+
this._setLabelColor(data?.label?.color);
|
114
114
|
return this.app.getCard({
|
115
|
-
cardId,
|
115
|
+
cardId: data?.card?.id,
|
116
116
|
});
|
117
117
|
},
|
118
118
|
isRelevant({ result: card }) {
|
119
119
|
return (
|
120
120
|
(!this.board || this.board === card.idBoard) &&
|
121
|
-
(!this.
|
122
|
-
|
123
|
-
this.lists.includes(card.idList)) &&
|
124
|
-
(!this.cards || this.cards.length === 0 || this.cards.includes(card.id))
|
121
|
+
(!this.list || this.list === card.idList) &&
|
122
|
+
(!this.cards?.length || this.cards.includes(card.id))
|
125
123
|
);
|
126
124
|
},
|
127
125
|
generateMeta({
|
@@ -145,4 +143,5 @@ export default {
|
|
145
143
|
this.$emit(card, meta);
|
146
144
|
},
|
147
145
|
},
|
146
|
+
sampleEmit,
|
148
147
|
};
|
@@ -0,0 +1,85 @@
|
|
1
|
+
export default {
|
2
|
+
"id": "620eb14ebda9570d72fddead",
|
3
|
+
"badges": {
|
4
|
+
"attachmentsByType": {
|
5
|
+
"trello": {
|
6
|
+
"board": 0,
|
7
|
+
"card": 0
|
8
|
+
}
|
9
|
+
},
|
10
|
+
"externalSource": null,
|
11
|
+
"location": false,
|
12
|
+
"votes": 0,
|
13
|
+
"viewingMemberVoted": false,
|
14
|
+
"subscribed": false,
|
15
|
+
"fogbugz": "",
|
16
|
+
"checkItems": 1,
|
17
|
+
"checkItemsChecked": 1,
|
18
|
+
"checkItemsEarliestDue": null,
|
19
|
+
"comments": 3,
|
20
|
+
"attachments": 1,
|
21
|
+
"description": false,
|
22
|
+
"due": "2021-05-10T21:50:00.000Z",
|
23
|
+
"dueComplete": false,
|
24
|
+
"start": null,
|
25
|
+
"lastUpdatedByAi": false
|
26
|
+
},
|
27
|
+
"checkItemStates": [
|
28
|
+
{
|
29
|
+
"idCheckItem": "620eb14fbda9570d72fde031",
|
30
|
+
"state": "complete"
|
31
|
+
}
|
32
|
+
],
|
33
|
+
"closed": false,
|
34
|
+
"dueComplete": false,
|
35
|
+
"dateLastActivity": "2024-09-30T16:31:35.215Z",
|
36
|
+
"desc": "",
|
37
|
+
"descData": {
|
38
|
+
"emoji": {}
|
39
|
+
},
|
40
|
+
"due": "2021-05-10T21:50:00.000Z",
|
41
|
+
"dueReminder": null,
|
42
|
+
"email": null,
|
43
|
+
"idBoard": "5f4d7be6c45c22583f75fa02",
|
44
|
+
"idChecklists": [
|
45
|
+
"620eb14fbda9570d72fde030"
|
46
|
+
],
|
47
|
+
"idList": "5f4d7f78bdd7ce4d2d25fdda",
|
48
|
+
"idMembers": [],
|
49
|
+
"idMembersVoted": [],
|
50
|
+
"idShort": 85,
|
51
|
+
"idAttachmentCover": "620eb14ebda9570d72fdded7",
|
52
|
+
"labels": [
|
53
|
+
{
|
54
|
+
"id": "5f4d7be6cdabcf46c027c792",
|
55
|
+
"idBoard": "5f4d7be6c45c22583f75fa02",
|
56
|
+
"idOrganization": "6047c17c2f558003144e04d7",
|
57
|
+
"name": "green label",
|
58
|
+
"nodeId": "ari:cloud:trello::label/workspace/6047c17c2f558003144e04d7/5f4d7be6cdabcf46c027c792",
|
59
|
+
"color": "green",
|
60
|
+
"uses": 9
|
61
|
+
},
|
62
|
+
],
|
63
|
+
"idLabels": [
|
64
|
+
"5f4d7be6cdabcf46c027c792",
|
65
|
+
],
|
66
|
+
"manualCoverAttachment": false,
|
67
|
+
"name": "new card",
|
68
|
+
"pinned": false,
|
69
|
+
"pos": 360447,
|
70
|
+
"shortLink": "dho6bOdR",
|
71
|
+
"shortUrl": "https://trello.com/c/dho6bOdR",
|
72
|
+
"start": null,
|
73
|
+
"subscribed": false,
|
74
|
+
"url": "https://trello.com/c/dho6bOdR/85-new-card",
|
75
|
+
"cover": {
|
76
|
+
"idAttachment": "620eb14ebda9570d72fdded7",
|
77
|
+
"color": null,
|
78
|
+
"idUploadedBackground": null,
|
79
|
+
"size": "normal",
|
80
|
+
"brightness": "dark",
|
81
|
+
"idPlugin": null
|
82
|
+
},
|
83
|
+
"isTemplate": false,
|
84
|
+
"cardRole": null
|
85
|
+
}
|