@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
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
const trello = require("../../trello.app.js");
|
|
2
|
-
const get = require("lodash.get");
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
key: "trello-card-archived",
|
|
6
|
-
name: "Card Archived",
|
|
7
|
-
description: "Emits an event for each card archived.",
|
|
8
|
-
version: "0.0.4",
|
|
9
|
-
props: {
|
|
10
|
-
db: "$.service.db",
|
|
11
|
-
http: "$.interface.http",
|
|
12
|
-
trello,
|
|
13
|
-
boardId: { propDefinition: [trello, "boardId"] },
|
|
14
|
-
listIds: {
|
|
15
|
-
propDefinition: [trello, "listIds", (c) => ({ boardId: c.boardId })],
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
hooks: {
|
|
19
|
-
async activate() {
|
|
20
|
-
let modelId = this.boardId;
|
|
21
|
-
if (!this.boardId) {
|
|
22
|
-
const member = await this.trello.getMember("me");
|
|
23
|
-
modelId = member.id;
|
|
24
|
-
}
|
|
25
|
-
const { id } = await this.trello.createHook({
|
|
26
|
-
id: modelId,
|
|
27
|
-
endpoint: this.http.endpoint,
|
|
28
|
-
});
|
|
29
|
-
this.db.set("hookId", id);
|
|
30
|
-
this.db.set("boardId", this.boardId);
|
|
31
|
-
this.db.set("listIds", this.listIds);
|
|
32
|
-
},
|
|
33
|
-
async deactivate() {
|
|
34
|
-
console.log(this.db.get("hookId"));
|
|
35
|
-
await this.trello.deleteHook({
|
|
36
|
-
hookId: this.db.get("hookId"),
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
async run(event) {
|
|
41
|
-
// validate signature
|
|
42
|
-
if (
|
|
43
|
-
!this.trello.verifyTrelloWebhookRequest(
|
|
44
|
-
event,
|
|
45
|
-
this.http.endpoint
|
|
46
|
-
)
|
|
47
|
-
) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const body = get(event, "body");
|
|
52
|
-
if (!body) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const eventTranslationKey = get(body, "action.display.translationKey");
|
|
57
|
-
if (eventTranslationKey !== "action_archived_card") {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const cardId = get(body, "action.data.card.id");
|
|
62
|
-
const boardId = this.db.get("boardId");
|
|
63
|
-
const listIds = this.db.get("listIds");
|
|
64
|
-
const card = await this.trello.getCard(cardId);
|
|
65
|
-
|
|
66
|
-
if (boardId && boardId !== card.idBoard) return;
|
|
67
|
-
if (listIds && listIds.length > 0 && !listIds.includes(card.idList)) return;
|
|
68
|
-
|
|
69
|
-
this.$emit(card, {
|
|
70
|
-
id: card.id,
|
|
71
|
-
summary: card.name,
|
|
72
|
-
ts: Date.now(),
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
const trello = require("../../trello.app.js");
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
key: "trello-card-due-date-reminder",
|
|
5
|
-
name: "Card Due Date Reminder",
|
|
6
|
-
description: "Emits an event at a specified time before a card is due.",
|
|
7
|
-
version: "0.0.2",
|
|
8
|
-
dedupe: "unique",
|
|
9
|
-
props: {
|
|
10
|
-
trello,
|
|
11
|
-
boardId: { propDefinition: [trello, "boardId"] },
|
|
12
|
-
timeBefore: {
|
|
13
|
-
type: "integer",
|
|
14
|
-
label: "Time Before",
|
|
15
|
-
description: "How far before the due time the event should trigger.",
|
|
16
|
-
default: 5,
|
|
17
|
-
},
|
|
18
|
-
timeBeforeUnit: {
|
|
19
|
-
type: "string",
|
|
20
|
-
label: "Time Before (Unit)",
|
|
21
|
-
description: "Unit of time for Time Before.",
|
|
22
|
-
async options() {
|
|
23
|
-
return [
|
|
24
|
-
{ label: "Minutes", value: 60000 },
|
|
25
|
-
{ label: "Hours", value: 3600000 },
|
|
26
|
-
{ label: "Days", value: 86400000 },
|
|
27
|
-
{ label: "Weeks", value: 604800000 },
|
|
28
|
-
];
|
|
29
|
-
},
|
|
30
|
-
default: "Minutes",
|
|
31
|
-
},
|
|
32
|
-
db: "$.service.db",
|
|
33
|
-
timer: {
|
|
34
|
-
type: "$.interface.timer",
|
|
35
|
-
default: {
|
|
36
|
-
intervalSeconds: 60 * 15,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
async run(event) {
|
|
42
|
-
const cards = [];
|
|
43
|
-
let results = [];
|
|
44
|
-
let due, notifyAt;
|
|
45
|
-
const boardId = this.boardId ? this.boardId : "me";
|
|
46
|
-
const now = new Date();
|
|
47
|
-
|
|
48
|
-
results = await this.trello.getCards(boardId);
|
|
49
|
-
for (const card of results) {
|
|
50
|
-
if (card.due) {
|
|
51
|
-
due = new Date(card.due);
|
|
52
|
-
notifyAt = new Date(
|
|
53
|
-
due.getTime() - this.timeBefore * this.timeBeforeUnit
|
|
54
|
-
);
|
|
55
|
-
if (notifyAt.getTime() <= now.getTime()) {
|
|
56
|
-
this.$emit(card, {
|
|
57
|
-
id: card.id,
|
|
58
|
-
summary: card.name,
|
|
59
|
-
ts: Date.now(),
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
const trello = require("../../trello.app.js");
|
|
2
|
-
const get = require("lodash.get");
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
key: "trello-card-moved",
|
|
6
|
-
name: "Card Moved (Instant)",
|
|
7
|
-
description: "Emits an event each time a card is moved to a list.",
|
|
8
|
-
version: "0.0.3",
|
|
9
|
-
props: {
|
|
10
|
-
db: "$.service.db",
|
|
11
|
-
http: "$.interface.http",
|
|
12
|
-
trello,
|
|
13
|
-
boardId: { propDefinition: [trello, "boardId"] },
|
|
14
|
-
listIds: {
|
|
15
|
-
propDefinition: [trello, "listIds", (c) => ({ boardId: c.boardId })],
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
hooks: {
|
|
19
|
-
async activate() {
|
|
20
|
-
let modelId = this.boardId;
|
|
21
|
-
if (!this.boardId) {
|
|
22
|
-
const member = await this.trello.getMember("me");
|
|
23
|
-
modelId = member.id;
|
|
24
|
-
}
|
|
25
|
-
const { id } = await this.trello.createHook({
|
|
26
|
-
id: modelId,
|
|
27
|
-
endpoint: this.http.endpoint,
|
|
28
|
-
});
|
|
29
|
-
this.db.set("hookId", id);
|
|
30
|
-
this.db.set("boardId", this.boardId);
|
|
31
|
-
this.db.set("listIds", this.listIds);
|
|
32
|
-
},
|
|
33
|
-
async deactivate() {
|
|
34
|
-
console.log(this.db.get("hookId"));
|
|
35
|
-
await this.trello.deleteHook({
|
|
36
|
-
hookId: this.db.get("hookId"),
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
async run(event) {
|
|
41
|
-
// validate signature
|
|
42
|
-
if (
|
|
43
|
-
!this.trello.verifyTrelloWebhookRequest(
|
|
44
|
-
event,
|
|
45
|
-
this.http.endpoint
|
|
46
|
-
)
|
|
47
|
-
) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const body = get(event, "body");
|
|
52
|
-
if (!body) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const eventTranslationKey = get(body, "action.display.translationKey");
|
|
57
|
-
if (eventTranslationKey !== "action_move_card_from_list_to_list") {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const cardId = get(body, "action.data.card.id");
|
|
62
|
-
const listAfter = get(body, "action.data.listAfter.name");
|
|
63
|
-
const listIdAfter = get(body, "action.data.listAfter.id");
|
|
64
|
-
const listIdBefore = get(body, "action.data.listBefore.id");
|
|
65
|
-
const boardId = this.db.get("boardId");
|
|
66
|
-
const listIds = this.db.get("listIds");
|
|
67
|
-
const card = await this.trello.getCard(cardId);
|
|
68
|
-
|
|
69
|
-
if (boardId && boardId !== card.idBoard) return;
|
|
70
|
-
if (
|
|
71
|
-
listIds &&
|
|
72
|
-
listIds.length > 0 &&
|
|
73
|
-
!listIds.includes(listIdBefore) &&
|
|
74
|
-
!listIds.includes(listIdAfter)
|
|
75
|
-
)
|
|
76
|
-
return;
|
|
77
|
-
|
|
78
|
-
this.$emit(card, {
|
|
79
|
-
id: card.id,
|
|
80
|
-
summary: `${card.name} - moved to ${listAfter}`,
|
|
81
|
-
ts: Date.now(),
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
const trello = require("../../trello.app.js");
|
|
2
|
-
const get = require("lodash.get");
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
key: "trello-card-updates",
|
|
6
|
-
name: "Card Updates (Instant)",
|
|
7
|
-
description: "Emits an event for each update to a Trello card.",
|
|
8
|
-
version: "0.0.3",
|
|
9
|
-
props: {
|
|
10
|
-
trello,
|
|
11
|
-
boardId: { propDefinition: [trello, "boardId"] },
|
|
12
|
-
cardIds: {
|
|
13
|
-
propDefinition: [trello, "cardIds", (c) => ({ boardId: c.boardId })],
|
|
14
|
-
},
|
|
15
|
-
db: "$.service.db",
|
|
16
|
-
http: "$.interface.http",
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
hooks: {
|
|
20
|
-
async activate() {
|
|
21
|
-
let modelId = this.boardId;
|
|
22
|
-
if (!this.boardId) {
|
|
23
|
-
const member = await this.trello.getMember("me");
|
|
24
|
-
modelId = member.id;
|
|
25
|
-
}
|
|
26
|
-
const { id } = await this.trello.createHook({
|
|
27
|
-
id: modelId,
|
|
28
|
-
endpoint: this.http.endpoint,
|
|
29
|
-
});
|
|
30
|
-
this.db.set("hookId", id);
|
|
31
|
-
this.db.set("boardId", this.boardId);
|
|
32
|
-
this.db.set("cardIds", this.cardIds);
|
|
33
|
-
},
|
|
34
|
-
async deactivate() {
|
|
35
|
-
console.log(this.db.get("hookId"));
|
|
36
|
-
await this.trello.deleteHook({
|
|
37
|
-
hookId: this.db.get("hookId"),
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
async run(event) {
|
|
43
|
-
// validate signature
|
|
44
|
-
if (
|
|
45
|
-
!this.trello.verifyTrelloWebhookRequest(
|
|
46
|
-
event,
|
|
47
|
-
this.http.endpoint
|
|
48
|
-
)
|
|
49
|
-
) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const body = get(event, "body");
|
|
54
|
-
if (!body) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const eventType = get(body, "action.type");
|
|
59
|
-
if (eventType !== "updateCard") {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const cardId = get(body, "action.data.card.id");
|
|
64
|
-
const boardId = this.db.get("boardId");
|
|
65
|
-
const cardIds = this.db.get("cardIds");
|
|
66
|
-
const card = await this.trello.getCard(cardId);
|
|
67
|
-
|
|
68
|
-
if (boardId && boardId !== card.idBoard) return;
|
|
69
|
-
if (cardIds && cardIds.length > 0 && !cardIds.includes(card.id)) return;
|
|
70
|
-
|
|
71
|
-
this.$emit(card, {
|
|
72
|
-
id: card.id,
|
|
73
|
-
summary: card.name,
|
|
74
|
-
ts: Date.now(),
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
const trello = require("../../trello.app.js");
|
|
2
|
-
const get = require("lodash.get");
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
key: "trello-custom-webhook-events",
|
|
6
|
-
name: "Custom Webhook Events",
|
|
7
|
-
description: "Emit events for activity matching a board, event types, lists and/or cards.",
|
|
8
|
-
version: "0.0.3",
|
|
9
|
-
props: {
|
|
10
|
-
db: "$.service.db",
|
|
11
|
-
http: "$.interface.http",
|
|
12
|
-
trello,
|
|
13
|
-
boardId: { propDefinition: [trello, "boardId"] },
|
|
14
|
-
eventTypes: { propDefinition: [trello, "eventTypes"] },
|
|
15
|
-
listIds: {
|
|
16
|
-
propDefinition: [trello, "listIds", (c) => ({ boardId: c.boardId })],
|
|
17
|
-
},
|
|
18
|
-
cardIds: {
|
|
19
|
-
propDefinition: [trello, "cardIds", (c) => ({ boardId: c.boardId })],
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
hooks: {
|
|
23
|
-
async activate() {
|
|
24
|
-
console.log(`board: ${this.boardId}`);
|
|
25
|
-
const { id } = await this.trello.createHook({
|
|
26
|
-
id: this.boardId,
|
|
27
|
-
endpoint: this.http.endpoint,
|
|
28
|
-
});
|
|
29
|
-
this.db.set("hookId", id);
|
|
30
|
-
this.db.set("eventTypes", this.eventTypes);
|
|
31
|
-
this.db.set("listIds", this.listIds);
|
|
32
|
-
this.db.set("cardIds", this.cardIds);
|
|
33
|
-
},
|
|
34
|
-
async deactivate() {
|
|
35
|
-
console.log(this.db.get("hookId"));
|
|
36
|
-
await this.trello.deleteHook({
|
|
37
|
-
hookId: this.db.get("hookId"),
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
async run(event) {
|
|
42
|
-
// validate signature
|
|
43
|
-
if (
|
|
44
|
-
!this.trello.verifyTrelloWebhookRequest(
|
|
45
|
-
event,
|
|
46
|
-
this.http.endpoint
|
|
47
|
-
)
|
|
48
|
-
) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const body = get(event, "body");
|
|
53
|
-
if (!body) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const eventTypes = this.db.get("eventTypes");
|
|
57
|
-
const listIds = this.db.get("listIds");
|
|
58
|
-
const cardIds = this.db.get("cardIds");
|
|
59
|
-
|
|
60
|
-
const eventType = get(body, "action.type");
|
|
61
|
-
const listId = get(body, "action.data.list.id");
|
|
62
|
-
const cardId = get(body, "action.data.card.id");
|
|
63
|
-
|
|
64
|
-
if (eventTypes && eventTypes.length > 0 && !eventTypes.includes(eventType)) return;
|
|
65
|
-
if (listIds && listIds.length > 0 && !listIds.includes(card.idList)) return;
|
|
66
|
-
if (cardIds && cardIds.length > 0 && !cardIds.includes(card.id)) return;
|
|
67
|
-
|
|
68
|
-
this.$emit(body, {
|
|
69
|
-
summary: eventType,
|
|
70
|
-
});
|
|
71
|
-
},
|
|
72
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
const trello = require("../../trello.app.js");
|
|
2
|
-
const get = require("lodash.get");
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
key: "trello-new-board",
|
|
6
|
-
name: "New Board (Instant)",
|
|
7
|
-
description: "Emits an event for each new board added.",
|
|
8
|
-
version: "0.0.4",
|
|
9
|
-
dedupe: "unique",
|
|
10
|
-
props: {
|
|
11
|
-
trello,
|
|
12
|
-
db: "$.service.db",
|
|
13
|
-
http: "$.interface.http",
|
|
14
|
-
},
|
|
15
|
-
hooks: {
|
|
16
|
-
async activate() {
|
|
17
|
-
const member = await this.trello.getMember("me");
|
|
18
|
-
const { id } = await this.trello.createHook({
|
|
19
|
-
id: member.id,
|
|
20
|
-
endpoint: this.http.endpoint,
|
|
21
|
-
});
|
|
22
|
-
this.db.set("hookId", id);
|
|
23
|
-
},
|
|
24
|
-
async deactivate() {
|
|
25
|
-
console.log(this.db.get("hookId"));
|
|
26
|
-
await this.trello.deleteHook({
|
|
27
|
-
hookId: this.db.get("hookId"),
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
async run(event) {
|
|
33
|
-
// validate signature
|
|
34
|
-
if (
|
|
35
|
-
!this.trello.verifyTrelloWebhookRequest(
|
|
36
|
-
event,
|
|
37
|
-
this.http.endpoint
|
|
38
|
-
)
|
|
39
|
-
) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const body = get(event, "body");
|
|
44
|
-
if (!body) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const eventType = get(body, "action.type");
|
|
49
|
-
if (eventType !== "createBoard") {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const boardId = get(body, "action.data.board.id");
|
|
54
|
-
const board = await this.trello.getBoard(boardId);
|
|
55
|
-
|
|
56
|
-
this.$emit(board, {
|
|
57
|
-
id: board.id,
|
|
58
|
-
summary: board.name,
|
|
59
|
-
ts: Date.now(),
|
|
60
|
-
});
|
|
61
|
-
},
|
|
62
|
-
};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
const trello = require("../../trello.app.js");
|
|
2
|
-
const get = require("lodash.get");
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
key: "trello-new-card",
|
|
6
|
-
name: "New Card (Instant)",
|
|
7
|
-
description: "Emits an event for each new Trello card on a board.",
|
|
8
|
-
version: "0.0.3",
|
|
9
|
-
dedupe: "unique",
|
|
10
|
-
props: {
|
|
11
|
-
trello,
|
|
12
|
-
boardId: { propDefinition: [trello, "boardId"] },
|
|
13
|
-
listIds: {
|
|
14
|
-
propDefinition: [trello, "listIds", (c) => ({ boardId: c.boardId })],
|
|
15
|
-
},
|
|
16
|
-
db: "$.service.db",
|
|
17
|
-
http: "$.interface.http",
|
|
18
|
-
},
|
|
19
|
-
hooks: {
|
|
20
|
-
async activate() {
|
|
21
|
-
let modelId = this.boardId;
|
|
22
|
-
if (!this.boardId) {
|
|
23
|
-
const member = await this.trello.getMember("me");
|
|
24
|
-
modelId = member.id;
|
|
25
|
-
}
|
|
26
|
-
const { id } = await this.trello.createHook({
|
|
27
|
-
id: modelId,
|
|
28
|
-
endpoint: this.http.endpoint,
|
|
29
|
-
});
|
|
30
|
-
this.db.set("hookId", id);
|
|
31
|
-
this.db.set("boardId", this.boardId);
|
|
32
|
-
this.db.set("listIds", this.listIds);
|
|
33
|
-
},
|
|
34
|
-
async deactivate() {
|
|
35
|
-
console.log(this.db.get("hookId"));
|
|
36
|
-
await this.trello.deleteHook({
|
|
37
|
-
hookId: this.db.get("hookId"),
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
async run(event) {
|
|
43
|
-
// validate signature
|
|
44
|
-
if (
|
|
45
|
-
!this.trello.verifyTrelloWebhookRequest(
|
|
46
|
-
event,
|
|
47
|
-
this.http.endpoint
|
|
48
|
-
)
|
|
49
|
-
) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const body = get(event, "body");
|
|
54
|
-
if (!body) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const eventType = get(body, "action.type");
|
|
59
|
-
if (eventType !== "createCard") {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const cardId = get(body, "action.data.card.id");
|
|
64
|
-
const boardId = this.db.get("boardId");
|
|
65
|
-
const listIds = this.db.get("listIds");
|
|
66
|
-
const card = await this.trello.getCard(cardId);
|
|
67
|
-
|
|
68
|
-
if (boardId && boardId !== card.idBoard) return;
|
|
69
|
-
if (listIds && listIds.length > 0 && !listIds.includes(card.idList)) return;
|
|
70
|
-
|
|
71
|
-
this.$emit(card, {
|
|
72
|
-
id: card.id,
|
|
73
|
-
summary: card.name,
|
|
74
|
-
ts: Date.now(),
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
const trello = require("../../trello.app.js");
|
|
2
|
-
const get = require("lodash.get");
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
key: "trello-new-checklist",
|
|
6
|
-
name: "New Checklist (Instant)",
|
|
7
|
-
description: "Emits an event for each new checklist added to a board.",
|
|
8
|
-
version: "0.0.3",
|
|
9
|
-
dedupe: "unique",
|
|
10
|
-
props: {
|
|
11
|
-
trello,
|
|
12
|
-
boardId: { propDefinition: [trello, "boardId"] },
|
|
13
|
-
db: "$.service.db",
|
|
14
|
-
http: "$.interface.http",
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
hooks: {
|
|
18
|
-
async activate() {
|
|
19
|
-
let modelId = this.boardId;
|
|
20
|
-
if (!this.boardId) {
|
|
21
|
-
const member = await this.trello.getMember("me");
|
|
22
|
-
modelId = member.id;
|
|
23
|
-
}
|
|
24
|
-
const { id } = await this.trello.createHook({
|
|
25
|
-
id: modelId,
|
|
26
|
-
endpoint: this.http.endpoint,
|
|
27
|
-
});
|
|
28
|
-
this.db.set("hookId", id);
|
|
29
|
-
this.db.set("boardId", this.boardId);
|
|
30
|
-
},
|
|
31
|
-
async deactivate() {
|
|
32
|
-
console.log(this.db.get("hookId"));
|
|
33
|
-
await this.trello.deleteHook({
|
|
34
|
-
hookId: this.db.get("hookId"),
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
async run(event) {
|
|
40
|
-
// validate signature
|
|
41
|
-
if (
|
|
42
|
-
!this.trello.verifyTrelloWebhookRequest(
|
|
43
|
-
event,
|
|
44
|
-
this.http.endpoint
|
|
45
|
-
)
|
|
46
|
-
) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const body = get(event, "body");
|
|
51
|
-
if (!body) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const eventType = get(body, "action.type");
|
|
56
|
-
if (eventType !== "addChecklistToCard") {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const boardId = this.db.get("boardId");
|
|
61
|
-
const checklistId = get(body, "action.data.checklist.id");
|
|
62
|
-
const checklist = await this.trello.getChecklist(checklistId);
|
|
63
|
-
|
|
64
|
-
if (boardId && boardId !== checklist.idBoard) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
this.$emit(checklist, {
|
|
69
|
-
id: checklist.id,
|
|
70
|
-
summary: checklist.name,
|
|
71
|
-
ts: Date.now(),
|
|
72
|
-
});
|
|
73
|
-
},
|
|
74
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
const trello = require("../../trello.app.js");
|
|
2
|
-
const get = require("lodash.get");
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
key: "trello-new-comment-added-to-card",
|
|
6
|
-
name: "New Comment Added to Card (Instant)",
|
|
7
|
-
description: "Emits an event for each new comment added to a card.",
|
|
8
|
-
version: "0.0.3",
|
|
9
|
-
dedupe: "unique",
|
|
10
|
-
props: {
|
|
11
|
-
trello,
|
|
12
|
-
boardId: { propDefinition: [trello, "boardId"] },
|
|
13
|
-
cardIds: {
|
|
14
|
-
propDefinition: [trello, "cardIds", (c) => ({ boardId: c.boardId })],
|
|
15
|
-
},
|
|
16
|
-
db: "$.service.db",
|
|
17
|
-
http: "$.interface.http",
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
hooks: {
|
|
21
|
-
async activate() {
|
|
22
|
-
let modelId = this.boardId;
|
|
23
|
-
if (!this.boardId) {
|
|
24
|
-
const member = await this.trello.getMember("me");
|
|
25
|
-
modelId = member.id;
|
|
26
|
-
}
|
|
27
|
-
const { id } = await this.trello.createHook({
|
|
28
|
-
id: modelId,
|
|
29
|
-
endpoint: this.http.endpoint,
|
|
30
|
-
});
|
|
31
|
-
this.db.set("hookId", id);
|
|
32
|
-
this.db.set("boardId", this.boardId);
|
|
33
|
-
this.db.set("cardIds", this.cardIds);
|
|
34
|
-
},
|
|
35
|
-
async deactivate() {
|
|
36
|
-
console.log(this.db.get("hookId"));
|
|
37
|
-
await this.trello.deleteHook({
|
|
38
|
-
hookId: this.db.get("hookId"),
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
async run(event) {
|
|
44
|
-
// validate signature
|
|
45
|
-
if (
|
|
46
|
-
!this.trello.verifyTrelloWebhookRequest(
|
|
47
|
-
event,
|
|
48
|
-
this.http.endpoint
|
|
49
|
-
)
|
|
50
|
-
) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const body = get(event, "body");
|
|
55
|
-
if (!body) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const eventType = get(body, "action.type");
|
|
60
|
-
if (eventType !== "commentCard") {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const cardId = get(body, "action.data.card.id");
|
|
65
|
-
const boardId = this.db.get("boardId");
|
|
66
|
-
const cardIds = this.db.get("cardIds");
|
|
67
|
-
const comment = get(body, "action.data.text");
|
|
68
|
-
card = await this.trello.getCard(cardId);
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
(boardId && boardId !== card.idBoard) ||
|
|
72
|
-
(cardIds && cardIds.length > 0 && !cardIds.includes(card.id))
|
|
73
|
-
) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (boardId && boardId !== card.idBoard) return;
|
|
78
|
-
if (cardIds && cardIds.length > 0 && !cardIds.includes(card.id)) return;
|
|
79
|
-
|
|
80
|
-
this.$emit(card, {
|
|
81
|
-
id: card.id,
|
|
82
|
-
summary: comment,
|
|
83
|
-
ts: Date.now(),
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
};
|