@pipedream/trello 0.3.2 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/actions/add-attachment-to-card-via-url/add-attachment-to-card-via-url.mjs +73 -0
  2. package/actions/add-checklist/add-checklist.mjs +68 -0
  3. package/actions/add-comment/add-comment.mjs +55 -0
  4. package/actions/add-existing-label-to-card/add-existing-label-to-card.mjs +48 -0
  5. package/actions/add-file-as-attachment-via-url/add-file-as-attachment-via-url.mjs +72 -0
  6. package/actions/add-image-attachment/add-image-attachment.mjs +75 -0
  7. package/actions/add-label-to-card/add-label-to-card.mjs +55 -0
  8. package/actions/add-member-to-card/add-member-to-card.mjs +48 -0
  9. package/actions/archive-card/archive-card.mjs +37 -0
  10. package/actions/close-board/close-board.mjs +25 -0
  11. package/actions/common.js +21 -0
  12. package/actions/complete-checklist-item/complete-checklist-item.mjs +49 -0
  13. package/actions/copy-board/copy-board.mjs +174 -0
  14. package/actions/create-board/create-board.mjs +175 -0
  15. package/actions/create-card/create-card.mjs +195 -0
  16. package/actions/create-checklist/create-checklist.mjs +66 -0
  17. package/actions/create-checklist-item/create-checklist-item.mjs +67 -0
  18. package/actions/create-comment-on-card/create-comment-on-card.mjs +42 -0
  19. package/actions/create-label/create-label.mjs +73 -0
  20. package/actions/create-list/create-list.mjs +67 -0
  21. package/actions/delete-checklist/delete-checklist.mjs +46 -0
  22. package/actions/find-labels/find-labels.mjs +44 -0
  23. package/actions/find-list/find-list.mjs +49 -0
  24. package/actions/get-card/get-card.mjs +37 -0
  25. package/actions/get-list/get-list.mjs +32 -0
  26. package/actions/move-card-to-list/move-card-to-list.mjs +53 -0
  27. package/actions/remove-label-from-card/remove-label-from-card.mjs +47 -0
  28. package/actions/rename-list/rename-list.mjs +47 -0
  29. package/actions/search-boards/search-boards.mjs +57 -0
  30. package/actions/search-cards/search-cards.mjs +59 -0
  31. package/actions/search-checklists/search-checklists.mjs +110 -0
  32. package/actions/search-members/search-members.mjs +61 -0
  33. package/actions/update-card/update-card.mjs +165 -0
  34. package/common/events.js +138 -0
  35. package/common/fields.js +50 -0
  36. package/package.json +23 -19
  37. package/sources/board-based.mjs +27 -0
  38. package/sources/card-archived/card-archived.mjs +54 -0
  39. package/sources/card-due-date-reminder/card-due-date-reminder.mjs +80 -0
  40. package/sources/card-moved/card-moved.mjs +84 -0
  41. package/sources/card-updates/card-updates.mjs +60 -0
  42. package/sources/common-polling.mjs +16 -0
  43. package/sources/common-webhook.mjs +90 -0
  44. package/sources/common.js +34 -0
  45. package/sources/custom-webhook-events/custom-webhook-events.mjs +110 -0
  46. package/sources/new-activity/new-activity.mjs +64 -0
  47. package/sources/new-attachment/new-attachment.mjs +60 -0
  48. package/sources/new-board/new-board.mjs +29 -0
  49. package/sources/new-card/new-card.mjs +58 -0
  50. package/sources/new-checklist/new-checklist.mjs +29 -0
  51. package/sources/new-comment-added-to-card/new-comment-added-to-card.mjs +94 -0
  52. package/sources/new-label/new-label.mjs +41 -0
  53. package/sources/new-label-added-to-card/new-label-added-to-card.mjs +138 -0
  54. package/sources/new-list/new-list.mjs +29 -0
  55. package/sources/new-member-on-card/new-member-on-card.mjs +38 -0
  56. package/sources/new-notification/new-notification.mjs +50 -0
  57. package/trello.app.js +647 -145
  58. package/sources/card-archived/card-archived.js +0 -75
  59. package/sources/card-due-date-reminder/card-due-date-reminder.js +0 -65
  60. package/sources/card-moved/card-moved.js +0 -84
  61. package/sources/card-updates/card-updates.js +0 -77
  62. package/sources/custom-webhook-events/custom-webhook-events.js +0 -72
  63. package/sources/new-board/new-board.js +0 -62
  64. package/sources/new-card/new-card.js +0 -77
  65. package/sources/new-checklist/new-checklist.js +0 -74
  66. package/sources/new-comment-added-to-card/new-comment-added-to-card.js +0 -86
  67. package/sources/new-label/new-label.js +0 -73
  68. package/sources/new-label-added-to-card/new-labels-added-to-card.js +0 -85
  69. package/sources/new-list/new-list.js +0 -74
  70. package/sources/new-member-on-card/new-member-on-card.js +0 -75
  71. package/sources/new-notification/new-notification.js +0 -45
@@ -1,73 +0,0 @@
1
- const trello = require("../../trello.app.js");
2
- const get = require("lodash.get");
3
-
4
- module.exports = {
5
- key: "trello-new-label",
6
- name: "New Label (Instant)",
7
- description: "Emits an event for each new label 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 !== "createLabel") {
57
- return;
58
- }
59
- const boardId = this.db.get("boardId");
60
- const labelId = get(body, "action.data.label.id");
61
- const label = await this.trello.getLabel(labelId);
62
-
63
- if (boardId && boardId !== label.idBoard) {
64
- return;
65
- }
66
-
67
- this.$emit(label, {
68
- id: label.id,
69
- summary: label.name ? `${label.color} - ${label.name}` : `${label.color}`,
70
- ts: Date.now(),
71
- });
72
- },
73
- };
@@ -1,85 +0,0 @@
1
- const trello = require("../../trello.app.js");
2
- const get = require("lodash.get");
3
-
4
- module.exports = {
5
- key: "trello-new-label-added-to-card",
6
- name: "New Label Added To Card (Instant)",
7
- description: "Emits an event for each label added to a card.",
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
- cardIds: {
18
- propDefinition: [trello, "cardIds", (c) => ({ boardId: c.boardId })],
19
- },
20
- },
21
- hooks: {
22
- async activate() {
23
- let modelId = this.boardId;
24
- if (!this.boardId) {
25
- const member = await this.trello.getMember("me");
26
- modelId = member.id;
27
- }
28
- const { id } = await this.trello.createHook({
29
- id: modelId,
30
- endpoint: this.http.endpoint,
31
- });
32
- this.db.set("hookId", id);
33
- this.db.set("boardId", this.boardId);
34
- this.db.set("listIds", this.listIds);
35
- this.db.set("cardIds", this.cardIds);
36
- },
37
- async deactivate() {
38
- console.log(this.db.get("hookId"));
39
- await this.trello.deleteHook({
40
- hookId: this.db.get("hookId"),
41
- });
42
- },
43
- },
44
- async run(event) {
45
- // validate signature
46
- if (
47
- !this.trello.verifyTrelloWebhookRequest(
48
- event,
49
- this.http.endpoint
50
- )
51
- ) {
52
- return;
53
- }
54
-
55
- const body = get(event, "body");
56
- if (!body) {
57
- return;
58
- }
59
-
60
- const eventType = get(body, "action.type");
61
- if (eventType !== "addLabelToCard") {
62
- return;
63
- }
64
-
65
- const cardId = get(body, "action.data.card.id");
66
- const labelName = get(body, "action.data.label.name");
67
- const labelColor = get(body, "action.data.label.color");
68
- const boardId = this.db.get("boardId");
69
- const listIds = this.db.get("listIds");
70
- const cardIds = this.db.get("cardIds");
71
- const card = await this.trello.getCard(cardId);
72
-
73
- if (boardId && boardId !== card.idBoard) return;
74
- if (listIds && listIds.length > 0 && !listIds.includes(card.idList)) return;
75
- if (cardIds && cardIds.length > 0 && !cardIds.includes(card.id)) return;
76
-
77
- this.$emit(card, {
78
- id: card.id,
79
- summary: labelName
80
- ? `${labelColor} - ${labelName}; added to ${card.name}`
81
- : `${labelColor}; added to ${card.name}`,
82
- ts: Date.now(),
83
- });
84
- },
85
- };
@@ -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-list",
6
- name: "New List (Instant)",
7
- description: "Emits an event for each new list 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 !== "createList") {
57
- return;
58
- }
59
-
60
- const boardId = this.db.get("boardId");
61
- const listId = get(body, "action.data.list.id");
62
- const list = await this.trello.getList(listId);
63
-
64
- if (boardId && boardId !== list.idBoard) {
65
- return;
66
- }
67
-
68
- this.$emit(list, {
69
- id: list.id,
70
- summary: list.name,
71
- ts: Date.now(),
72
- });
73
- },
74
- };
@@ -1,75 +0,0 @@
1
- const trello = require("../../trello.app.js");
2
- const get = require("lodash.get");
3
-
4
- module.exports = {
5
- key: "trello-new-member-on-card",
6
- name: "New Member on Card (Instant)",
7
- description:
8
- "Emits an event for each card joined by the authenticated Trello user.",
9
- version: "0.0.4",
10
- dedupe: "unique",
11
- props: {
12
- trello,
13
- boardId: { propDefinition: [trello, "boardId"] },
14
- db: "$.service.db",
15
- http: "$.interface.http",
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
- },
32
- async deactivate() {
33
- console.log(this.db.get("hookId"));
34
- await this.trello.deleteHook({
35
- hookId: this.db.get("hookId"),
36
- });
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 eventType = get(body, "action.type");
57
- if (eventType !== "addMemberToCard") {
58
- return;
59
- }
60
-
61
- const boardId = this.db.get("boardId");
62
- const cardId = get(body, "action.data.card.id");
63
- const card = await this.trello.getCard(cardId);
64
-
65
- if (boardId && boardId !== card.idBoard) {
66
- return;
67
- }
68
-
69
- this.$emit(card, {
70
- id: card.id,
71
- summary: card.name,
72
- ts: Date.now(),
73
- });
74
- },
75
- };
@@ -1,45 +0,0 @@
1
- const trello = require("../../trello.app.js");
2
-
3
- module.exports = {
4
- key: "trello-new-notification",
5
- name: "New Notification",
6
- description:
7
- "Emits an event for each new Trello notification for the authenticated user.",
8
- version: "0.0.3",
9
- dedupe: "unique",
10
- props: {
11
- trello,
12
- db: "$.service.db",
13
- timer: {
14
- type: "$.interface.timer",
15
- default: {
16
- intervalSeconds: 60 * 15,
17
- },
18
- },
19
- },
20
-
21
- async run(event) {
22
- let notificationDate;
23
- const since = this.db.get("lastNotificationId") || null;
24
- const params = {
25
- since,
26
- };
27
-
28
- const notifications = await this.trello.getNotifications("me", params);
29
-
30
- if (notifications.length > 0)
31
- this.db.set(
32
- "lastNotificationId",
33
- notifications[notifications.length - 1].id
34
- );
35
-
36
- for (const notification of notifications) {
37
- notificationDate = new Date(notification.date);
38
- this.$emit(notification, {
39
- id: notification.id,
40
- summary: `${notification.type} : ${notification.data.card.name}`,
41
- ts: notificationDate.getTime(),
42
- });
43
- }
44
- },
45
- };