@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-card-archived",
|
6
|
-
name: "Card Archived (Instant)",
|
7
|
+
name: "Card Archived (Instant)", /* eslint-disable-line pipedream/source-name */
|
7
8
|
description: "Emit new event for each card archived.",
|
8
|
-
version: "0.1.
|
9
|
+
version: "0.1.1",
|
9
10
|
type: "source",
|
10
11
|
props: {
|
11
12
|
...common.props,
|
@@ -16,7 +17,6 @@ export default {
|
|
16
17
|
],
|
17
18
|
},
|
18
19
|
lists: {
|
19
|
-
optional: true,
|
20
20
|
propDefinition: [
|
21
21
|
common.props.app,
|
22
22
|
"lists",
|
@@ -24,47 +24,35 @@ export default {
|
|
24
24
|
board: c.board,
|
25
25
|
}),
|
26
26
|
],
|
27
|
+
description: "If specified, events will only be emitted when a card in one of the selected lists is archived",
|
27
28
|
},
|
28
29
|
},
|
29
30
|
methods: {
|
30
31
|
...common.methods,
|
31
|
-
|
32
|
-
|
33
|
-
} = {}) {
|
34
|
-
return this.app._makeRequest({
|
35
|
-
path: `/boards/${boardId}/cards`,
|
36
|
-
...args,
|
37
|
-
});
|
38
|
-
},
|
39
|
-
async getSampleEvents() {
|
40
|
-
const cards = await this.getFilteredCards({
|
32
|
+
getSampleEvents() {
|
33
|
+
return this.app.getFilteredCards({
|
41
34
|
boardId: this.board,
|
42
|
-
|
43
|
-
filter: "closed",
|
44
|
-
},
|
35
|
+
filter: "closed",
|
45
36
|
});
|
46
|
-
return {
|
47
|
-
sampleEvents: cards,
|
48
|
-
sortField: "dateLastActivity",
|
49
|
-
};
|
50
37
|
},
|
51
|
-
|
52
|
-
|
53
|
-
|
38
|
+
getSortField() {
|
39
|
+
return "dateLastActivity";
|
40
|
+
},
|
41
|
+
isCorrectEventType({ display }) {
|
42
|
+
return display?.translationKey === "action_archived_card";
|
54
43
|
},
|
55
|
-
|
56
|
-
const cardId = event.body?.action?.data?.card?.id;
|
44
|
+
getResult({ data }) {
|
57
45
|
return this.app.getCard({
|
58
|
-
cardId,
|
46
|
+
cardId: data?.card?.id,
|
59
47
|
});
|
60
48
|
},
|
61
49
|
isRelevant({ result: card }) {
|
62
50
|
return (
|
63
51
|
(!this.board || this.board === card.idBoard) &&
|
64
|
-
(!this.lists ||
|
65
|
-
this.lists.length === 0 ||
|
52
|
+
(!this.lists?.length ||
|
66
53
|
this.lists.includes(card.idList))
|
67
54
|
);
|
68
55
|
},
|
69
56
|
},
|
57
|
+
sampleEmit,
|
70
58
|
};
|
@@ -0,0 +1,64 @@
|
|
1
|
+
export default {
|
2
|
+
"id": "5f4ee830046a92139596173a",
|
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": 0,
|
17
|
+
"checkItemsChecked": 0,
|
18
|
+
"checkItemsEarliestDue": null,
|
19
|
+
"comments": 0,
|
20
|
+
"attachments": 0,
|
21
|
+
"description": false,
|
22
|
+
"due": null,
|
23
|
+
"dueComplete": false,
|
24
|
+
"start": null,
|
25
|
+
"lastUpdatedByAi": false
|
26
|
+
},
|
27
|
+
"checkItemStates": [],
|
28
|
+
"closed": true,
|
29
|
+
"dueComplete": false,
|
30
|
+
"dateLastActivity": "2020-09-02T00:34:22.602Z",
|
31
|
+
"desc": "",
|
32
|
+
"descData": null,
|
33
|
+
"due": null,
|
34
|
+
"dueReminder": null,
|
35
|
+
"email": null,
|
36
|
+
"idBoard": "5f4d7be6c45c22583f75fa02",
|
37
|
+
"idChecklists": [],
|
38
|
+
"idList": "5f4d7f78bdd7ce4d2d25fdda",
|
39
|
+
"idMembers": [],
|
40
|
+
"idMembersVoted": [],
|
41
|
+
"idShort": 10,
|
42
|
+
"idAttachmentCover": null,
|
43
|
+
"labels": [],
|
44
|
+
"idLabels": [],
|
45
|
+
"manualCoverAttachment": false,
|
46
|
+
"name": "a new card",
|
47
|
+
"pinned": false,
|
48
|
+
"pos": 65535,
|
49
|
+
"shortLink": "eBapV0gL",
|
50
|
+
"shortUrl": "https://trello.com/c/eBapV0gL",
|
51
|
+
"start": null,
|
52
|
+
"subscribed": false,
|
53
|
+
"url": "https://trello.com/c/eBapV0gL/10-a-new-card",
|
54
|
+
"cover": {
|
55
|
+
"idAttachment": null,
|
56
|
+
"color": null,
|
57
|
+
"idUploadedBackground": null,
|
58
|
+
"size": "normal",
|
59
|
+
"brightness": "light",
|
60
|
+
"idPlugin": null
|
61
|
+
},
|
62
|
+
"isTemplate": false,
|
63
|
+
"cardRole": null
|
64
|
+
}
|
@@ -1,19 +1,24 @@
|
|
1
|
+
import taskScheduler from "../../../pipedream/sources/new-scheduled-tasks/new-scheduled-tasks.mjs";
|
2
|
+
import trello from "../../trello.app.mjs";
|
1
3
|
import ms from "ms";
|
2
|
-
import
|
4
|
+
import constants from "../../common/constants.mjs";
|
5
|
+
import sampleEmit from "./test-event.mjs";
|
3
6
|
|
4
7
|
export default {
|
5
|
-
...common,
|
6
8
|
key: "trello-card-due-date-reminder",
|
7
|
-
name: "Card Due Date Reminder",
|
9
|
+
name: "Card Due Date Reminder", /* eslint-disable-line pipedream/source-name */
|
8
10
|
description: "Emit new event at a specified time before a card is due.",
|
9
|
-
version: "0.1.
|
11
|
+
version: "0.1.1",
|
10
12
|
type: "source",
|
11
13
|
dedupe: "unique",
|
12
14
|
props: {
|
13
|
-
|
15
|
+
pipedream: taskScheduler.props.pipedream,
|
16
|
+
trello,
|
17
|
+
db: "$.service.db",
|
18
|
+
http: "$.interface.http",
|
14
19
|
board: {
|
15
20
|
propDefinition: [
|
16
|
-
|
21
|
+
trello,
|
17
22
|
"board",
|
18
23
|
],
|
19
24
|
},
|
@@ -22,25 +27,43 @@ export default {
|
|
22
27
|
label: "Time Before",
|
23
28
|
description: "How far before the due time the event should trigger. For example, `5 minutes`, `10 minutes`, `1 hour`.",
|
24
29
|
default: "5 minutes",
|
25
|
-
options:
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
"
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
30
|
+
options: constants.NOTIFICATION_TIMES,
|
31
|
+
reloadProps: true,
|
32
|
+
},
|
33
|
+
},
|
34
|
+
async additionalProps() {
|
35
|
+
const props = {};
|
36
|
+
if (this.timeBefore) {
|
37
|
+
props.timer = {
|
38
|
+
type: "$.interface.timer",
|
39
|
+
description: "Poll the API to schedule alerts for any newly created events",
|
40
|
+
default: {
|
41
|
+
intervalSeconds: ms(this.timeBefore) / 1000,
|
42
|
+
},
|
43
|
+
};
|
44
|
+
}
|
45
|
+
return props;
|
46
|
+
},
|
47
|
+
hooks: {
|
48
|
+
async deactivate() {
|
49
|
+
const ids = this._getScheduledEventIds();
|
50
|
+
if (!ids?.length) {
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
for (const id of ids) {
|
54
|
+
if (await this.deleteEvent({
|
55
|
+
body: {
|
56
|
+
id,
|
57
|
+
},
|
58
|
+
})) {
|
59
|
+
console.log("Cancelled scheduled event");
|
60
|
+
}
|
61
|
+
}
|
62
|
+
this._setScheduledEventIds();
|
40
63
|
},
|
41
64
|
},
|
42
65
|
methods: {
|
43
|
-
...
|
66
|
+
...taskScheduler.methods,
|
44
67
|
generateMeta({
|
45
68
|
id, name: summary,
|
46
69
|
}, now) {
|
@@ -50,32 +73,87 @@ export default {
|
|
50
73
|
ts: now,
|
51
74
|
};
|
52
75
|
},
|
76
|
+
_getScheduledEventIds() {
|
77
|
+
return this.db.get("scheduledEventIds");
|
78
|
+
},
|
79
|
+
_setScheduledEventIds(ids) {
|
80
|
+
this.db.set("scheduledEventIds", ids);
|
81
|
+
},
|
82
|
+
_getScheduledCardIds() {
|
83
|
+
return this.db.get("scheduledCardIds");
|
84
|
+
},
|
85
|
+
_setScheduledCardIds(ids) {
|
86
|
+
this.db.set("scheduledCardIds", ids);
|
87
|
+
},
|
88
|
+
_hasDeployed() {
|
89
|
+
const result = this.db.get("hasDeployed");
|
90
|
+
this.db.set("hasDeployed", true);
|
91
|
+
return result;
|
92
|
+
},
|
53
93
|
emitEvent(card, now) {
|
54
94
|
const meta = this.generateMeta(card, now);
|
55
95
|
this.$emit(card, meta);
|
56
96
|
},
|
57
97
|
},
|
58
98
|
async run(event) {
|
59
|
-
const boardId = this.board;
|
60
99
|
const now = event.timestamp * 1000;
|
61
100
|
|
62
|
-
|
63
|
-
if (!
|
64
|
-
|
101
|
+
// self subscribe only on the first time
|
102
|
+
if (!this._hasDeployed()) {
|
103
|
+
await this.selfSubscribe();
|
104
|
+
}
|
105
|
+
|
106
|
+
let scheduledEventIds = this._getScheduledEventIds() || [];
|
107
|
+
|
108
|
+
// incoming scheduled event
|
109
|
+
if (event.$channel === this.selfChannel()) {
|
110
|
+
const remainingScheduledEventIds = scheduledEventIds.filter((id) => id !== event["$id"]);
|
111
|
+
this._setScheduledEventIds(remainingScheduledEventIds);
|
112
|
+
this.emitEvent(event, now);
|
113
|
+
return;
|
65
114
|
}
|
66
115
|
|
67
|
-
|
68
|
-
|
116
|
+
// schedule new events
|
117
|
+
const scheduledCardIds = this._getScheduledCardIds() || {};
|
118
|
+
const cards = await this.trello.getCards({
|
119
|
+
boardId: this.board,
|
69
120
|
});
|
121
|
+
|
70
122
|
for (const card of cards) {
|
71
|
-
|
123
|
+
const dueDate = card.due
|
124
|
+
? new Date(card.due)
|
125
|
+
: null;
|
126
|
+
if (!dueDate || dueDate.getTime() < Date.now()) {
|
127
|
+
delete scheduledCardIds[card.id];
|
72
128
|
continue;
|
73
129
|
}
|
74
|
-
|
75
|
-
const
|
76
|
-
|
77
|
-
|
130
|
+
|
131
|
+
const later = new Date(dueDate.getTime() - ms(this.timeBefore));
|
132
|
+
|
133
|
+
if (scheduledCardIds[card.id]) {
|
134
|
+
// reschedule if card's due date has changed
|
135
|
+
if (card.due !== scheduledCardIds[card.id].dueDate) {
|
136
|
+
await this.deleteEvent({
|
137
|
+
body: {
|
138
|
+
id: scheduledCardIds[card.id].eventId,
|
139
|
+
},
|
140
|
+
});
|
141
|
+
scheduledEventIds = scheduledEventIds
|
142
|
+
.filter((id) => id !== scheduledCardIds[card.id].eventId);
|
143
|
+
} else {
|
144
|
+
continue;
|
145
|
+
}
|
78
146
|
}
|
147
|
+
|
148
|
+
const scheduledEventId = this.emitScheduleEvent(card, later);
|
149
|
+
scheduledEventIds.push(scheduledEventId);
|
150
|
+
scheduledCardIds[card.id] = {
|
151
|
+
eventId: scheduledEventId,
|
152
|
+
dueDate: card.due,
|
153
|
+
};
|
79
154
|
}
|
155
|
+
this._setScheduledEventIds(scheduledEventIds);
|
156
|
+
this._setScheduledCardIds(scheduledCardIds);
|
80
157
|
},
|
158
|
+
sampleEmit,
|
81
159
|
};
|
@@ -0,0 +1,75 @@
|
|
1
|
+
export default {
|
2
|
+
"id": "61818a303e545129af23695d",
|
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": true,
|
15
|
+
"fogbugz": "",
|
16
|
+
"checkItems": 1,
|
17
|
+
"checkItemsChecked": 1,
|
18
|
+
"checkItemsEarliestDue": null,
|
19
|
+
"comments": 2,
|
20
|
+
"attachments": 1,
|
21
|
+
"description": false,
|
22
|
+
"due": "2024-10-01T19:20:00.000Z",
|
23
|
+
"dueComplete": false,
|
24
|
+
"start": null,
|
25
|
+
"lastUpdatedByAi": false
|
26
|
+
},
|
27
|
+
"checkItemStates": [
|
28
|
+
{
|
29
|
+
"idCheckItem": "6181a5f18e239e6aff9799a4",
|
30
|
+
"state": "complete"
|
31
|
+
}
|
32
|
+
],
|
33
|
+
"closed": false,
|
34
|
+
"dueComplete": false,
|
35
|
+
"dateLastActivity": "2024-10-01T19:08:51.312Z",
|
36
|
+
"desc": "",
|
37
|
+
"descData": {
|
38
|
+
"emoji": {}
|
39
|
+
},
|
40
|
+
"due": "2024-10-01T19:20:00.000Z",
|
41
|
+
"dueReminder": -1,
|
42
|
+
"email": null,
|
43
|
+
"idBoard": "5f4d7be6c45c22583f75fa02",
|
44
|
+
"idChecklists": [
|
45
|
+
"6181a5ef401ae66c357732b4"
|
46
|
+
],
|
47
|
+
"idList": "5f4d7f78bdd7ce4d2d25fdda",
|
48
|
+
"idMembers": [],
|
49
|
+
"idMembersVoted": [],
|
50
|
+
"idShort": 68,
|
51
|
+
"idAttachmentCover": "62c884dce32d46579ecfd5f0",
|
52
|
+
"labels": [],
|
53
|
+
"idLabels": [],
|
54
|
+
"manualCoverAttachment": false,
|
55
|
+
"name": "test",
|
56
|
+
"pinned": false,
|
57
|
+
"pos": 131071,
|
58
|
+
"shortLink": "QVLahShU",
|
59
|
+
"shortUrl": "https://trello.com/c/QVLahShU",
|
60
|
+
"start": null,
|
61
|
+
"subscribed": true,
|
62
|
+
"url": "https://trello.com/c/QVLahShU/68-sfsfdsfd",
|
63
|
+
"cover": {
|
64
|
+
"idAttachment": "62c884dce32d46579ecfd5f0",
|
65
|
+
"color": null,
|
66
|
+
"idUploadedBackground": null,
|
67
|
+
"size": "normal",
|
68
|
+
"brightness": "dark",
|
69
|
+
"idPlugin": null
|
70
|
+
},
|
71
|
+
"isTemplate": false,
|
72
|
+
"cardRole": null,
|
73
|
+
"$channel": "self",
|
74
|
+
"$id": "62377726-40b9-41a8-85c7-b01f3f5f8fbe"
|
75
|
+
}
|
@@ -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-card-moved",
|
6
|
-
name: "Card Moved (Instant)",
|
7
|
+
name: "Card Moved (Instant)", /* eslint-disable-line pipedream/source-name */
|
7
8
|
description: "Emit new event each time a card is moved to a list.",
|
8
|
-
version: "0.1.
|
9
|
+
version: "0.1.1",
|
9
10
|
type: "source",
|
10
11
|
props: {
|
11
12
|
...common.props,
|
@@ -23,22 +24,23 @@ export default {
|
|
23
24
|
board: c.board,
|
24
25
|
}),
|
25
26
|
],
|
27
|
+
description: "If specified, events will only be emitted if a card is moved to or from one of the selected lists",
|
26
28
|
},
|
27
29
|
},
|
28
30
|
methods: {
|
29
31
|
...common.methods,
|
30
32
|
async getSampleEvents() {
|
31
|
-
const cards = this.lists
|
33
|
+
const cards = this.lists?.length > 0
|
32
34
|
? await this.app.getCardsInList({
|
33
35
|
listId: this.lists[0],
|
34
36
|
})
|
35
37
|
: await this.app.getCards({
|
36
38
|
boardId: this.board,
|
37
39
|
});
|
38
|
-
return
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
return cards;
|
41
|
+
},
|
42
|
+
getSortField() {
|
43
|
+
return "dateLastActivity";
|
42
44
|
},
|
43
45
|
_getListAfter() {
|
44
46
|
return this.db.get("listAfter");
|
@@ -46,37 +48,31 @@ export default {
|
|
46
48
|
_setListAfter(listAfter) {
|
47
49
|
this.db.set("listAfter", listAfter);
|
48
50
|
},
|
49
|
-
isCorrectEventType(
|
50
|
-
|
51
|
-
return eventTranslationKey === "action_move_card_from_list_to_list";
|
51
|
+
isCorrectEventType({ display }) {
|
52
|
+
return display?.translationKey === "action_move_card_from_list_to_list";
|
52
53
|
},
|
53
|
-
|
54
|
-
const cardId = event.body?.action?.data?.card?.id;
|
55
|
-
const listAfter = event.body?.action?.data?.listAfter?.name;
|
54
|
+
getResult({ data }) {
|
56
55
|
/** Record listAfter to use in generateMeta() */
|
57
|
-
this._setListAfter(listAfter);
|
56
|
+
this._setListAfter(data?.listAfter?.name);
|
58
57
|
return this.app.getCard({
|
59
|
-
cardId,
|
58
|
+
cardId: data?.card?.id,
|
60
59
|
});
|
61
60
|
},
|
62
61
|
isRelevant({
|
63
|
-
result: card,
|
62
|
+
result: card, action,
|
64
63
|
}) {
|
65
|
-
const listIdAfter = event.body?.action?.data?.listAfter?.id;
|
66
|
-
const listIdBefore = event.body?.action?.data?.listBefore?.id;
|
67
|
-
|
68
64
|
return (
|
69
65
|
(!this.board || this.board === card.idBoard) &&
|
70
|
-
(!this.lists ||
|
71
|
-
this.lists.
|
72
|
-
this.lists.includes(
|
73
|
-
this.lists.includes(listIdBefore))
|
66
|
+
(!this.lists?.length ||
|
67
|
+
this.lists.includes(action?.data?.listAfter?.id) ||
|
68
|
+
this.lists.includes(action?.data?.listBefore?.id))
|
74
69
|
);
|
75
70
|
},
|
76
71
|
generateMeta({
|
77
72
|
id, name,
|
78
73
|
}) {
|
79
74
|
const listAfter = this._getListAfter();
|
75
|
+
name = name || id;
|
80
76
|
const summary = listAfter
|
81
77
|
? `${name} - moved to ${listAfter}`
|
82
78
|
: name;
|
@@ -87,4 +83,5 @@ export default {
|
|
87
83
|
};
|
88
84
|
},
|
89
85
|
},
|
86
|
+
sampleEmit,
|
90
87
|
};
|
@@ -0,0 +1,78 @@
|
|
1
|
+
export default {
|
2
|
+
"id": "60836bac2ed2ef78f4cf850d",
|
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": true,
|
15
|
+
"fogbugz": "",
|
16
|
+
"checkItems": 1,
|
17
|
+
"checkItemsChecked": 0,
|
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
|
+
"closed": false,
|
29
|
+
"dueComplete": false,
|
30
|
+
"dateLastActivity": "2021-11-02T23:02:44.876Z",
|
31
|
+
"desc": "",
|
32
|
+
"descData": null,
|
33
|
+
"due": "2021-05-10T21:50:00.000Z",
|
34
|
+
"dueReminder": 1440,
|
35
|
+
"email": null,
|
36
|
+
"idBoard": "5f4d7be6c45c22583f75fa02",
|
37
|
+
"idChecklists": [
|
38
|
+
"608b2037ea7ac07da59c17be"
|
39
|
+
],
|
40
|
+
"idList": "5f4ec9f69028408fed04c0b1",
|
41
|
+
"idMembers": [],
|
42
|
+
"idMembersVoted": [],
|
43
|
+
"idShort": 54,
|
44
|
+
"idAttachmentCover": "6099aece406c0b7a97e71535",
|
45
|
+
"labels": [
|
46
|
+
{
|
47
|
+
"id": "608b2273586147300cc73046",
|
48
|
+
"idBoard": "5f4d7be6c45c22583f75fa02",
|
49
|
+
"idOrganization": "6047c17c2f558003144e04d7",
|
50
|
+
"name": "orange",
|
51
|
+
"nodeId": "ari:cloud:trello::label/workspace/6047c17c2f558003144e04d7/608b2273586147300cc73046",
|
52
|
+
"color": "orange",
|
53
|
+
"uses": 4
|
54
|
+
},
|
55
|
+
],
|
56
|
+
"idLabels": [
|
57
|
+
"608b2273586147300cc73046",
|
58
|
+
],
|
59
|
+
"manualCoverAttachment": false,
|
60
|
+
"name": "new card",
|
61
|
+
"pinned": false,
|
62
|
+
"pos": 655359,
|
63
|
+
"shortLink": "fo2GH2y2",
|
64
|
+
"shortUrl": "https://trello.com/c/fo2GH2y2",
|
65
|
+
"start": null,
|
66
|
+
"subscribed": true,
|
67
|
+
"url": "https://trello.com/c/fo2GH2y2/54-new-card",
|
68
|
+
"cover": {
|
69
|
+
"idAttachment": "6099aece406c0b7a97e71535",
|
70
|
+
"color": null,
|
71
|
+
"idUploadedBackground": null,
|
72
|
+
"size": "normal",
|
73
|
+
"brightness": "dark",
|
74
|
+
"idPlugin": null
|
75
|
+
},
|
76
|
+
"isTemplate": false,
|
77
|
+
"cardRole": null
|
78
|
+
}
|
@@ -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-card-updates",
|
6
|
-
name: "Card
|
7
|
+
name: "Card Updated (Instant)", /* eslint-disable-line pipedream/source-name */
|
7
8
|
description: "Emit new event for each update to a Trello card.",
|
8
|
-
version: "0.1.
|
9
|
+
version: "0.1.1",
|
9
10
|
type: "source",
|
10
11
|
props: {
|
11
12
|
...common.props,
|
@@ -24,58 +25,50 @@ export default {
|
|
24
25
|
}),
|
25
26
|
],
|
26
27
|
},
|
27
|
-
customFieldItems: {
|
28
|
-
propDefinition: [
|
29
|
-
common.props.app,
|
30
|
-
"customFieldItems",
|
31
|
-
],
|
32
|
-
},
|
33
28
|
},
|
34
29
|
methods: {
|
35
30
|
...common.methods,
|
36
31
|
async getSampleEvents() {
|
37
32
|
let cards = [];
|
38
|
-
|
33
|
+
const params = {
|
34
|
+
customFieldItems: true,
|
35
|
+
};
|
36
|
+
if (this.cards?.length > 0) {
|
39
37
|
for (const cardId of this.cards) {
|
40
38
|
const card = await this.app.getCard({
|
41
39
|
cardId,
|
42
|
-
params
|
43
|
-
customFieldItems: this.customFieldItems,
|
44
|
-
},
|
40
|
+
params,
|
45
41
|
});
|
46
42
|
cards.push(card);
|
47
43
|
}
|
48
44
|
} else {
|
49
45
|
cards = await this.app.getCards({
|
50
46
|
boardId: this.board,
|
51
|
-
params
|
52
|
-
customFieldItems: this.customFieldItems,
|
53
|
-
},
|
47
|
+
params,
|
54
48
|
});
|
55
49
|
}
|
56
|
-
return
|
57
|
-
|
58
|
-
|
59
|
-
|
50
|
+
return cards;
|
51
|
+
},
|
52
|
+
getSortField() {
|
53
|
+
return "dateLastActivity";
|
60
54
|
},
|
61
|
-
isCorrectEventType(
|
62
|
-
|
63
|
-
return eventType === "updateCard";
|
55
|
+
isCorrectEventType({ type }) {
|
56
|
+
return type === "updateCard";
|
64
57
|
},
|
65
|
-
|
66
|
-
const cardId = event.body?.action?.data?.card?.id;
|
58
|
+
getResult({ data }) {
|
67
59
|
return this.app.getCard({
|
68
|
-
cardId,
|
60
|
+
cardId: data?.card?.id,
|
69
61
|
params: {
|
70
|
-
customFieldItems:
|
62
|
+
customFieldItems: true,
|
71
63
|
},
|
72
64
|
});
|
73
65
|
},
|
74
66
|
isRelevant({ result: card }) {
|
75
67
|
return (
|
76
68
|
(!this.board || this.board === card.idBoard) &&
|
77
|
-
(!this.cards
|
69
|
+
(!this.cards?.length || this.cards.includes(card.id))
|
78
70
|
);
|
79
71
|
},
|
80
72
|
},
|
73
|
+
sampleEmit,
|
81
74
|
};
|