@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.
- package/actions/add-attachment-to-card-via-url/add-attachment-to-card-via-url.mjs +73 -0
- package/actions/add-checklist/add-checklist.mjs +68 -0
- package/actions/add-comment/add-comment.mjs +55 -0
- package/actions/add-existing-label-to-card/add-existing-label-to-card.mjs +48 -0
- package/actions/add-file-as-attachment-via-url/add-file-as-attachment-via-url.mjs +72 -0
- package/actions/add-image-attachment/add-image-attachment.mjs +75 -0
- package/actions/add-label-to-card/add-label-to-card.mjs +55 -0
- package/actions/add-member-to-card/add-member-to-card.mjs +48 -0
- package/actions/archive-card/archive-card.mjs +37 -0
- package/actions/close-board/close-board.mjs +25 -0
- package/actions/common.js +21 -0
- package/actions/complete-checklist-item/complete-checklist-item.mjs +49 -0
- package/actions/copy-board/copy-board.mjs +174 -0
- package/actions/create-board/create-board.mjs +175 -0
- package/actions/create-card/create-card.mjs +195 -0
- package/actions/create-checklist/create-checklist.mjs +66 -0
- package/actions/create-checklist-item/create-checklist-item.mjs +67 -0
- package/actions/create-comment-on-card/create-comment-on-card.mjs +42 -0
- package/actions/create-label/create-label.mjs +73 -0
- package/actions/create-list/create-list.mjs +67 -0
- package/actions/delete-checklist/delete-checklist.mjs +46 -0
- package/actions/find-labels/find-labels.mjs +44 -0
- package/actions/find-list/find-list.mjs +49 -0
- package/actions/get-card/get-card.mjs +37 -0
- package/actions/get-list/get-list.mjs +32 -0
- package/actions/move-card-to-list/move-card-to-list.mjs +53 -0
- package/actions/remove-label-from-card/remove-label-from-card.mjs +47 -0
- package/actions/rename-list/rename-list.mjs +47 -0
- package/actions/search-boards/search-boards.mjs +57 -0
- package/actions/search-cards/search-cards.mjs +59 -0
- package/actions/search-checklists/search-checklists.mjs +110 -0
- package/actions/search-members/search-members.mjs +61 -0
- package/actions/update-card/update-card.mjs +165 -0
- package/common/events.js +138 -0
- package/common/fields.js +50 -0
- package/package.json +23 -19
- package/sources/board-based.mjs +27 -0
- package/sources/card-archived/card-archived.mjs +54 -0
- package/sources/card-due-date-reminder/card-due-date-reminder.mjs +80 -0
- package/sources/card-moved/card-moved.mjs +84 -0
- package/sources/card-updates/card-updates.mjs +60 -0
- package/sources/common-polling.mjs +16 -0
- package/sources/common-webhook.mjs +90 -0
- package/sources/common.js +34 -0
- package/sources/custom-webhook-events/custom-webhook-events.mjs +110 -0
- package/sources/new-activity/new-activity.mjs +64 -0
- package/sources/new-attachment/new-attachment.mjs +60 -0
- package/sources/new-board/new-board.mjs +29 -0
- package/sources/new-card/new-card.mjs +58 -0
- package/sources/new-checklist/new-checklist.mjs +29 -0
- package/sources/new-comment-added-to-card/new-comment-added-to-card.mjs +94 -0
- package/sources/new-label/new-label.mjs +41 -0
- package/sources/new-label-added-to-card/new-label-added-to-card.mjs +138 -0
- package/sources/new-list/new-list.mjs +29 -0
- package/sources/new-member-on-card/new-member-on-card.mjs +38 -0
- package/sources/new-notification/new-notification.mjs +50 -0
- package/trello.app.js +647 -145
- package/sources/card-archived/card-archived.js +0 -75
- package/sources/card-due-date-reminder/card-due-date-reminder.js +0 -65
- package/sources/card-moved/card-moved.js +0 -84
- package/sources/card-updates/card-updates.js +0 -77
- package/sources/custom-webhook-events/custom-webhook-events.js +0 -72
- package/sources/new-board/new-board.js +0 -62
- package/sources/new-card/new-card.js +0 -77
- package/sources/new-checklist/new-checklist.js +0 -74
- package/sources/new-comment-added-to-card/new-comment-added-to-card.js +0 -86
- package/sources/new-label/new-label.js +0 -73
- package/sources/new-label-added-to-card/new-labels-added-to-card.js +0 -85
- package/sources/new-list/new-list.js +0 -74
- package/sources/new-member-on-card/new-member-on-card.js +0 -75
- package/sources/new-notification/new-notification.js +0 -45
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import common from "../board-based.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "trello-new-checklist",
|
|
6
|
+
name: "New Checklist (Instant)",
|
|
7
|
+
description: "Emit new event for each new checklist added to a board.",
|
|
8
|
+
version: "0.0.8",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
async getSampleEvents() {
|
|
14
|
+
const checklists = await this.trello.listBoardChecklists(this.board);
|
|
15
|
+
return {
|
|
16
|
+
sampleEvents: checklists,
|
|
17
|
+
sortField: "id",
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
isCorrectEventType(event) {
|
|
21
|
+
const eventType = event.body?.action?.type;
|
|
22
|
+
return eventType === "addChecklistToCard";
|
|
23
|
+
},
|
|
24
|
+
async getResult(event) {
|
|
25
|
+
const checklistId = event.body?.action?.data?.checklist?.id;
|
|
26
|
+
return this.trello.getChecklist(checklistId);
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import common from "../common-webhook.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "trello-new-comment-added-to-card",
|
|
6
|
+
name: "New Comment Added to Card (Instant)",
|
|
7
|
+
description: "Emit new event for each new comment added to a card.",
|
|
8
|
+
version: "0.0.8",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
props: {
|
|
12
|
+
...common.props,
|
|
13
|
+
board: {
|
|
14
|
+
propDefinition: [
|
|
15
|
+
common.props.trello,
|
|
16
|
+
"board",
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
cards: {
|
|
20
|
+
propDefinition: [
|
|
21
|
+
common.props.trello,
|
|
22
|
+
"cards",
|
|
23
|
+
(c) => ({
|
|
24
|
+
board: c.board,
|
|
25
|
+
}),
|
|
26
|
+
],
|
|
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._setComment(action?.data?.text);
|
|
40
|
+
this.emitEvent(action);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
methods: {
|
|
45
|
+
...common.methods,
|
|
46
|
+
async getSampleEvents() {
|
|
47
|
+
const cards = this.cards && this.cards.length > 0
|
|
48
|
+
? this.cards
|
|
49
|
+
: (await this.trello.getCards(this.board)).map((card) => card.id);
|
|
50
|
+
const actions = [];
|
|
51
|
+
for (const card of cards) {
|
|
52
|
+
const activities = await this.trello.getCardActivity(card, "commentCard");
|
|
53
|
+
actions.push(...activities);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
sampleEvents: actions,
|
|
57
|
+
sortField: "date",
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
_getComment() {
|
|
61
|
+
return this.db.get("comment");
|
|
62
|
+
},
|
|
63
|
+
_setComment(comment) {
|
|
64
|
+
this.db.set("comment", comment);
|
|
65
|
+
},
|
|
66
|
+
isCorrectEventType(event) {
|
|
67
|
+
const eventType = event.body?.action?.type;
|
|
68
|
+
return eventType === "commentCard";
|
|
69
|
+
},
|
|
70
|
+
async getResult(event) {
|
|
71
|
+
const cardId = event.body?.action?.data?.card?.id;
|
|
72
|
+
const comment = event.body?.action?.data?.text;
|
|
73
|
+
/** Record comment to use in generateMeta() */
|
|
74
|
+
this._setComment(comment);
|
|
75
|
+
return this.trello.getCard(cardId);
|
|
76
|
+
},
|
|
77
|
+
isRelevant({ result: card }) {
|
|
78
|
+
return (
|
|
79
|
+
(!this.board || this.board === card.idBoard) &&
|
|
80
|
+
(!this.cards || this.cards.length === 0 || this.cards.includes(card.id))
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
generateMeta({
|
|
84
|
+
id, dateLastActivity,
|
|
85
|
+
}) {
|
|
86
|
+
const comment = this._getComment();
|
|
87
|
+
return {
|
|
88
|
+
id: `${id}${dateLastActivity}`,
|
|
89
|
+
summary: comment,
|
|
90
|
+
ts: Date.parse(dateLastActivity),
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import common from "../board-based.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "trello-new-label",
|
|
6
|
+
name: "New Label (Instant)",
|
|
7
|
+
description: "Emit new event for each new label added to a board.",
|
|
8
|
+
version: "0.0.8",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
async getSampleEvents() {
|
|
14
|
+
const labels = await this.trello.findLabel(this.board);
|
|
15
|
+
return {
|
|
16
|
+
sampleEvents: labels,
|
|
17
|
+
sortField: "id",
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
isCorrectEventType(event) {
|
|
21
|
+
const eventType = event.body?.action?.type;
|
|
22
|
+
return eventType === "createLabel";
|
|
23
|
+
},
|
|
24
|
+
async getResult(event) {
|
|
25
|
+
const labelId = event.body?.action?.data?.label?.id;
|
|
26
|
+
return this.trello.getLabel(labelId);
|
|
27
|
+
},
|
|
28
|
+
generateMeta({
|
|
29
|
+
id, name, color: summary,
|
|
30
|
+
}) {
|
|
31
|
+
summary += name
|
|
32
|
+
? ` - ${name}`
|
|
33
|
+
: "";
|
|
34
|
+
return {
|
|
35
|
+
id,
|
|
36
|
+
summary,
|
|
37
|
+
ts: Date.now(),
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import common from "../common-webhook.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "trello-new-label-added-to-card",
|
|
6
|
+
name: "New Label Added To Card (Instant)",
|
|
7
|
+
description: "Emit new event for each label added to a card.",
|
|
8
|
+
version: "0.0.8",
|
|
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
|
+
cards: {
|
|
28
|
+
propDefinition: [
|
|
29
|
+
common.props.trello,
|
|
30
|
+
"cards",
|
|
31
|
+
(c) => ({
|
|
32
|
+
board: c.board,
|
|
33
|
+
}),
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
hooks: {
|
|
38
|
+
...common.hooks,
|
|
39
|
+
async deploy() {
|
|
40
|
+
if (this.cards && this.cards.length > 0) {
|
|
41
|
+
await this.emitLabelsFromCardIds(this.cards);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (this.lists && this.lists.length > 0) {
|
|
45
|
+
for (const listId of this.lists) {
|
|
46
|
+
const cards = await this.trello.getCardsInList(listId);
|
|
47
|
+
await this.emitLabelsFromCards(cards);
|
|
48
|
+
}
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const cards = await this.trello.getCards(this.board);
|
|
52
|
+
await this.emitLabelsFromCards(cards);
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
methods: {
|
|
56
|
+
...common.methods,
|
|
57
|
+
async emitLabelsFromCards(cards) {
|
|
58
|
+
for (const card of cards) {
|
|
59
|
+
const labelIds = card.idLabels;
|
|
60
|
+
for (const labelId of labelIds) {
|
|
61
|
+
const label = await this.trello.getLabel(labelId);
|
|
62
|
+
let summary = label.color;
|
|
63
|
+
summary += label.name
|
|
64
|
+
? ` - ${label.name}`
|
|
65
|
+
: "";
|
|
66
|
+
summary += `; added to ${card.name}`;
|
|
67
|
+
this.$emit(card, {
|
|
68
|
+
id: `${labelId}${card.id}`,
|
|
69
|
+
summary,
|
|
70
|
+
ts: Date.now(),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
async emitLabelsFromCardIds(cardIds) {
|
|
76
|
+
const cards = [];
|
|
77
|
+
for (const id of cardIds) {
|
|
78
|
+
const card = await this.trello.getCard(id);
|
|
79
|
+
cards.push(card);
|
|
80
|
+
}
|
|
81
|
+
await this.emitLabelsFromCards(cards);
|
|
82
|
+
},
|
|
83
|
+
_getLabelName() {
|
|
84
|
+
return this.db.get("labelName");
|
|
85
|
+
},
|
|
86
|
+
_setLabelName(labelName) {
|
|
87
|
+
this.db.set("labelName", labelName);
|
|
88
|
+
},
|
|
89
|
+
_getLabelColor() {
|
|
90
|
+
return this.db.get("labelColor");
|
|
91
|
+
},
|
|
92
|
+
_setLabelColor(labelColor) {
|
|
93
|
+
this.db.set("labelColor", labelColor);
|
|
94
|
+
},
|
|
95
|
+
isCorrectEventType(event) {
|
|
96
|
+
const eventType = event.body?.action?.type;
|
|
97
|
+
return eventType === "addLabelToCard";
|
|
98
|
+
},
|
|
99
|
+
async getResult(event) {
|
|
100
|
+
const cardId = event.body?.action?.data?.card?.id;
|
|
101
|
+
const labelName = event.body?.action?.data?.label?.name;
|
|
102
|
+
const labelColor = event.body?.action?.data?.label?.color;
|
|
103
|
+
/** Record labelName & labelColor to use in generateMeta() */
|
|
104
|
+
this._setLabelName(labelName);
|
|
105
|
+
this._setLabelColor(labelColor);
|
|
106
|
+
return this.trello.getCard(cardId);
|
|
107
|
+
},
|
|
108
|
+
isRelevant({ result: card }) {
|
|
109
|
+
return (
|
|
110
|
+
(!this.board || this.board === card.idBoard) &&
|
|
111
|
+
(!this.lists ||
|
|
112
|
+
this.lists.length === 0 ||
|
|
113
|
+
this.lists.includes(card.idList)) &&
|
|
114
|
+
(!this.cards || this.cards.length === 0 || this.cards.includes(card.id))
|
|
115
|
+
);
|
|
116
|
+
},
|
|
117
|
+
generateMeta({
|
|
118
|
+
id, name,
|
|
119
|
+
}) {
|
|
120
|
+
const labelName = this._getLabelName();
|
|
121
|
+
const labelColor = this._getLabelColor();
|
|
122
|
+
let summary = labelColor;
|
|
123
|
+
summary += labelName
|
|
124
|
+
? ` - ${labelName}`
|
|
125
|
+
: "";
|
|
126
|
+
summary += `; added to ${name}`;
|
|
127
|
+
return {
|
|
128
|
+
id,
|
|
129
|
+
summary,
|
|
130
|
+
ts: Date.now(),
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
emitEvent(card, labelName, labelColor) {
|
|
134
|
+
const meta = this.generateMeta(card, labelName, labelColor);
|
|
135
|
+
this.$emit(card, meta);
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import common from "../board-based.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "trello-new-list",
|
|
6
|
+
name: "New List (Instant)",
|
|
7
|
+
description: "Emit new event for each new list added to a board.",
|
|
8
|
+
version: "0.0.8",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
async getSampleEvents() {
|
|
14
|
+
const lists = await this.trello.getLists(this.board);
|
|
15
|
+
return {
|
|
16
|
+
sampleEvents: lists,
|
|
17
|
+
sortField: "id",
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
isCorrectEventType(event) {
|
|
21
|
+
const eventType = event.body?.action?.type;
|
|
22
|
+
return eventType === "createList";
|
|
23
|
+
},
|
|
24
|
+
async getResult(event) {
|
|
25
|
+
const listId = event.body?.action?.data?.list?.id;
|
|
26
|
+
return await this.trello.getList(listId);
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import common from "../board-based.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "trello-new-member-on-card",
|
|
6
|
+
name: "New Member on Card (Instant)",
|
|
7
|
+
description: "Emit new event for each card joined by the authenticated Trello user.",
|
|
8
|
+
version: "0.0.9",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
async getSampleEvents() {
|
|
14
|
+
const cards = await this.trello.getMemberCards("me");
|
|
15
|
+
return {
|
|
16
|
+
sampleEvents: cards,
|
|
17
|
+
sortField: "dateLastActivity",
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
isCorrectEventType(event) {
|
|
21
|
+
const eventType = event.body?.action?.type;
|
|
22
|
+
return eventType === "addMemberToCard";
|
|
23
|
+
},
|
|
24
|
+
async getResult(event) {
|
|
25
|
+
const cardId = event.body?.action?.data?.card?.id;
|
|
26
|
+
return this.trello.getCard(cardId);
|
|
27
|
+
},
|
|
28
|
+
generateMeta({
|
|
29
|
+
id, name: summary, dateLastActivity,
|
|
30
|
+
}) {
|
|
31
|
+
return {
|
|
32
|
+
id: `${id}${dateLastActivity}`,
|
|
33
|
+
summary,
|
|
34
|
+
ts: Date.now(),
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import common from "../common-polling.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "trello-new-notification",
|
|
6
|
+
name: "New Notification",
|
|
7
|
+
description:
|
|
8
|
+
"Emit new event for each new Trello notification for the authenticated user.",
|
|
9
|
+
version: "0.0.6",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
methods: {
|
|
13
|
+
...common.methods,
|
|
14
|
+
_getLastNotificationId() {
|
|
15
|
+
return this.db.get("lastNotificationId") || null;
|
|
16
|
+
},
|
|
17
|
+
_setLastNotificationId(lastNotificationId) {
|
|
18
|
+
this.db.set("lastNotificationId", lastNotificationId);
|
|
19
|
+
},
|
|
20
|
+
generateMeta({
|
|
21
|
+
id, type, date, data,
|
|
22
|
+
}) {
|
|
23
|
+
return {
|
|
24
|
+
id,
|
|
25
|
+
summary: `${type} : ${data.card.name}`,
|
|
26
|
+
ts: Date.parse(date),
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
async run() {
|
|
31
|
+
const since = this._getLastNotificationId();
|
|
32
|
+
const params = {
|
|
33
|
+
since,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const notifications = await this.trello.getNotifications("me", params);
|
|
37
|
+
|
|
38
|
+
const { length: notificationCount = 0 } = notifications;
|
|
39
|
+
if (notificationCount <= 0) {
|
|
40
|
+
console.log("No notifications to process");
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const { id } = notifications[notificationCount - 1];
|
|
44
|
+
this._setLastNotificationId(id);
|
|
45
|
+
|
|
46
|
+
for (const notification of notifications) {
|
|
47
|
+
this.emitEvent(notification);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
};
|