@pipedream/monday 0.3.6 → 0.3.8

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.
@@ -1,12 +1,12 @@
1
- import monday from "../../monday.app.mjs";
2
1
  import utils from "../../common/utils.mjs";
2
+ import monday from "../../monday.app.mjs";
3
3
 
4
4
  export default {
5
5
  key: "monday-create-board",
6
6
  name: "Create Board",
7
7
  description: "Creates a new board. [See the docs here](https://api.developer.monday.com/docs/boards#create-a-board)",
8
8
  type: "action",
9
- version: "0.0.1",
9
+ version: "0.0.3",
10
10
  props: {
11
11
  monday,
12
12
  boardName: {
@@ -6,7 +6,7 @@ export default {
6
6
  name: "Create Column",
7
7
  description: "Creates a column. [See the docs here](https://developer.monday.com/api-reference/docs/columns-queries-1)",
8
8
  type: "action",
9
- version: "0.0.1",
9
+ version: "0.0.3",
10
10
  props: {
11
11
  monday,
12
12
  boardId: {
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Create Group",
6
6
  description: "Creates a new group in a specific board. [See the docs here](https://api.developer.monday.com/docs/groups-queries#create-a-group)",
7
7
  type: "action",
8
- version: "0.0.2",
8
+ version: "0.0.4",
9
9
  props: {
10
10
  monday,
11
11
  boardId: {
@@ -1,12 +1,12 @@
1
- import monday from "../../monday.app.mjs";
2
1
  import utils from "../../common/utils.mjs";
2
+ import monday from "../../monday.app.mjs";
3
3
 
4
4
  export default {
5
5
  key: "monday-create-item",
6
6
  name: "Create Item",
7
7
  description: "Creates an item. [See the docs here](https://api.developer.monday.com/docs/items-queries#create-an-item)",
8
8
  type: "action",
9
- version: "0.0.3",
9
+ version: "0.0.5",
10
10
  props: {
11
11
  monday,
12
12
  boardId: {
@@ -1,12 +1,12 @@
1
- import monday from "../../monday.app.mjs";
2
1
  import utils from "../../common/utils.mjs";
2
+ import monday from "../../monday.app.mjs";
3
3
 
4
4
  export default {
5
5
  key: "monday-create-update",
6
6
  name: "Create an Update",
7
7
  description: "Creates a new update. [See the docs here](https://api.developer.monday.com/docs/updates-queries#create-an-update)",
8
8
  type: "action",
9
- version: "0.0.3",
9
+ version: "0.0.5",
10
10
  props: {
11
11
  monday,
12
12
  updateBody: {
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Update Item Name",
6
6
  description: "Update an item's name. [See the docs here](https://api.developer.monday.com/docs/item-name)",
7
7
  type: "action",
8
- version: "0.0.3",
8
+ version: "0.0.5",
9
9
  props: {
10
10
  monday,
11
11
  boardId: {
@@ -136,7 +136,13 @@ const COLUMN_TYPE_OPTIONS = [
136
136
  },
137
137
  ];
138
138
 
139
+ const BOARD_TYPE = {
140
+ BOARD: "board",
141
+ SUB_ITEMS_BOARD: "sub_items_board",
142
+ };
143
+
139
144
  export default {
140
145
  BOARD_KIND_OPTIONS,
141
146
  COLUMN_TYPE_OPTIONS,
147
+ BOARD_TYPE,
142
148
  };
@@ -10,6 +10,7 @@ export default {
10
10
  ) {
11
11
  id
12
12
  name
13
+ type
13
14
  }
14
15
  }
15
16
  `,
package/monday.app.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import mondaySdk from "monday-sdk-js";
2
- import uniqBy from "lodash.uniqby";
3
- import map from "lodash.map";
4
1
  import flatMap from "lodash.flatmap";
2
+ import map from "lodash.map";
3
+ import uniqBy from "lodash.uniqby";
4
+ import mondaySdk from "monday-sdk-js";
5
5
  import constants from "./common/constants.mjs";
6
6
  import mutations from "./common/mutations.mjs";
7
7
  import queries from "./common/queries.mjs";
@@ -303,6 +303,7 @@ export default {
303
303
 
304
304
  const { boards } = data;
305
305
  return boards
306
+ .filter(({ type }) => type !== constants.BOARD_TYPE.SUB_ITEMS_BOARD)
306
307
  .map(({
307
308
  id, name,
308
309
  }) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/monday",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Pipedream Monday Components",
5
5
  "main": "monday.app.mjs",
6
6
  "keywords": [
@@ -3,11 +3,17 @@ import common from "../common/common-webhook.mjs";
3
3
  export default {
4
4
  ...common,
5
5
  key: "monday-column-value-updated",
6
- name: "Column Value Updated",
6
+ name: "New Column Value Updated (Instant)",
7
7
  description: "Emit new event when a column value is updated on a board in Monday. For changes to Name, use the Name Updated Trigger.",
8
8
  type: "source",
9
- version: "0.0.1",
9
+ version: "0.0.3",
10
10
  dedupe: "unique",
11
+ hooks: {
12
+ ...common.hooks,
13
+ async deploy() {
14
+ await this.commonDeploy();
15
+ },
16
+ },
11
17
  methods: {
12
18
  ...common.methods,
13
19
  getWebhookArgs() {
@@ -16,18 +16,6 @@ export default {
16
16
  },
17
17
  },
18
18
  hooks: {
19
- async deploy() {
20
- const { items } = (await this.monday.listItemsBoard({
21
- boardId: +this.boardId,
22
- })).data.boards[0];
23
- for (const item of items.slice(-25).reverse()) {
24
- const itemData = await this.monday.getItem({
25
- id: +item.id,
26
- });
27
- const meta = this.generateMeta(item);
28
- this.$emit(itemData, meta);
29
- }
30
- },
31
19
  async activate() {
32
20
  const args = this.getWebhookArgs();
33
21
  const { data } = await this.monday.createWebhook({
@@ -37,18 +25,21 @@ export default {
37
25
  });
38
26
  const hookId = data?.create_webhook?.id;
39
27
  if (!hookId) {
40
- throw new Error ("Failed to establish webhook");
28
+ throw new Error (this.getWebhookCreationError());
41
29
  }
42
30
  this._setHookId(data.create_webhook.id);
43
31
  },
44
32
  async deactivate() {
45
33
  const hookId = this._getHookId();
46
- await this.monday.deleteWebhook({
47
- id: hookId,
34
+ return this.monday.deleteWebhook({
35
+ id: +hookId,
48
36
  });
49
37
  },
50
38
  },
51
39
  methods: {
40
+ getWebhookCreationError() {
41
+ return "Failed to establish webhook";
42
+ },
52
43
  _getHookId() {
53
44
  return this.db.get("hookId");
54
45
  },
@@ -58,24 +49,46 @@ export default {
58
49
  getWebhookArgs() {
59
50
  throw new Error("getEventType is not implemented");
60
51
  },
61
- generateMeta(item) {
52
+ getSummary({ item }) {
53
+ return item.name;
54
+ },
55
+ generateMeta({
56
+ item, event,
57
+ }) {
62
58
  return {
63
- id: `${item.id}_${item.updated_at}`,
64
- summary: item.name,
59
+ id: `${item.id}_${item.updated_at || item.changedAt}`,
60
+ summary: this.getSummary({
61
+ item,
62
+ event,
63
+ }),
65
64
  ts: Date.parse(item.updated_at),
66
65
  };
67
66
  },
67
+ async commonDeploy() {
68
+ const { items } = (await this.monday.listItemsBoard({
69
+ boardId: +this.boardId,
70
+ })).data.boards[0];
71
+ for (const item of items.slice(-25).reverse()) {
72
+ const itemData = await this.monday.getItem({
73
+ id: +item.id,
74
+ });
75
+
76
+ const meta = this.generateMeta({
77
+ item,
78
+ });
79
+ this.$emit(itemData, meta);
80
+ }
81
+ },
68
82
  },
69
83
  async run(event) {
70
84
  const { body } = event;
71
85
 
72
86
  // verify the webhook
73
87
  if (body?.challenge) {
74
- await this.http.respond({
88
+ return this.http.respond({
75
89
  status: 200,
76
90
  body,
77
91
  });
78
- return;
79
92
  }
80
93
 
81
94
  const itemId = body?.event?.pulseId;
@@ -83,11 +96,17 @@ export default {
83
96
  return;
84
97
  }
85
98
 
86
- const updatedItem = await this.monday.getItem({
99
+ const item = await this.monday.getItem({
87
100
  id: itemId,
88
101
  });
89
102
 
90
- const meta = this.generateMeta(updatedItem);
91
- this.$emit(updatedItem, meta);
103
+ const meta = this.generateMeta({
104
+ item,
105
+ event: body.event,
106
+ });
107
+ this.$emit({
108
+ ...body,
109
+ item,
110
+ }, meta);
92
111
  },
93
112
  };
@@ -3,11 +3,17 @@ import common from "../common/common-webhook.mjs";
3
3
  export default {
4
4
  ...common,
5
5
  key: "monday-name-updated",
6
- name: "Name Updated",
6
+ name: "New Name Updated (Instant)",
7
7
  description: "Emit new event when an item's Name is updated on a board in Monday.",
8
8
  type: "source",
9
- version: "0.0.1",
9
+ version: "0.0.3",
10
10
  dedupe: "unique",
11
+ hooks: {
12
+ ...common.hooks,
13
+ async deploy() {
14
+ await this.commonDeploy();
15
+ },
16
+ },
11
17
  methods: {
12
18
  ...common.methods,
13
19
  getWebhookArgs() {
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Board",
7
7
  description: "Emit new event when a new board is created in Monday.",
8
8
  type: "source",
9
- version: "0.0.2",
9
+ version: "0.0.4",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  ...common.props,
@@ -3,11 +3,17 @@ import common from "../common/common-webhook.mjs";
3
3
  export default {
4
4
  ...common,
5
5
  key: "monday-new-item",
6
- name: "New Item",
6
+ name: "New Item (Instant)",
7
7
  description: "Emit new event when a new item is added to a board in Monday.",
8
8
  type: "source",
9
- version: "0.0.1",
9
+ version: "0.0.3",
10
10
  dedupe: "unique",
11
+ hooks: {
12
+ ...common.hooks,
13
+ async deploy() {
14
+ await this.commonDeploy();
15
+ },
16
+ },
11
17
  methods: {
12
18
  ...common.methods,
13
19
  getWebhookArgs() {
@@ -0,0 +1,34 @@
1
+ import common from "../common/common-webhook.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "monday-new-subitem",
6
+ name: "New Sub-Item (Instant)",
7
+ description: "Emit new event when a sub-item is created. To create this trigger, you need to have at least one subitem previously created on your board.",
8
+ type: "source",
9
+ version: "0.0.2",
10
+ dedupe: "unique",
11
+ props: {
12
+ ...common.props,
13
+ boardId: {
14
+ propDefinition: [
15
+ common.props.monday,
16
+ "boardId",
17
+ ],
18
+ },
19
+ },
20
+ methods: {
21
+ ...common.methods,
22
+ getWebhookCreationError() {
23
+ return "Failed to establish webhook. To create this trigger, you need to have at least one subitem previously created on your board.";
24
+ },
25
+ getWebhookArgs() {
26
+ return {
27
+ event: "create_subitem",
28
+ };
29
+ },
30
+ getSummary({ event: { pulseId } }) {
31
+ return `New sub-item with id ${pulseId} was created.`;
32
+ },
33
+ },
34
+ };
@@ -0,0 +1,34 @@
1
+ import common from "../common/common-webhook.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "monday-new-subitem-update",
6
+ name: "New Sub-Item Update (Instant)",
7
+ description: "Emit new event when an update is posted in sub-items. To create this trigger, you need to have at least one subitem previously created on your board.",
8
+ type: "source",
9
+ version: "0.0.2",
10
+ dedupe: "unique",
11
+ props: {
12
+ ...common.props,
13
+ boardId: {
14
+ propDefinition: [
15
+ common.props.monday,
16
+ "boardId",
17
+ ],
18
+ },
19
+ },
20
+ methods: {
21
+ ...common.methods,
22
+ getWebhookCreationError() {
23
+ return "Failed to establish webhook. To create this trigger, you need to have at least one subitem previously created on your board.";
24
+ },
25
+ getWebhookArgs() {
26
+ return {
27
+ event: "create_subitem_update",
28
+ };
29
+ },
30
+ getSummary({ event: { pulseId } }) {
31
+ return `New update with id ${pulseId} was created.`;
32
+ },
33
+ },
34
+ };
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New User",
7
7
  description: "Emit new event when a new user is created in Monday.",
8
8
  type: "source",
9
- version: "0.0.2",
9
+ version: "0.0.4",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -3,11 +3,17 @@ import common from "../common/common-webhook.mjs";
3
3
  export default {
4
4
  ...common,
5
5
  key: "monday-specific-column-updated",
6
- name: "Specific Column Updated",
6
+ name: "New Specific Column Updated (Instant)",
7
7
  description: "Emit new event when a value in the specified column is updated on a board in Monday. For changes to Name, use the Name Updated Trigger.",
8
8
  type: "source",
9
- version: "0.0.1",
9
+ version: "0.0.3",
10
10
  dedupe: "unique",
11
+ hooks: {
12
+ ...common.hooks,
13
+ async deploy() {
14
+ await this.commonDeploy();
15
+ },
16
+ },
11
17
  props: {
12
18
  ...common.props,
13
19
  column: {
@@ -0,0 +1,39 @@
1
+ import common from "../common/common-webhook.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "monday-subitem-column-value-updated",
6
+ name: "New Sub-Item Column Value Updated (Instant)",
7
+ description: "Emit new event when any sub-item column changes. To create this trigger, you need to have at least one subitem previously created on your board.",
8
+ type: "source",
9
+ version: "0.0.2",
10
+ dedupe: "unique",
11
+ props: {
12
+ ...common.props,
13
+ boardId: {
14
+ propDefinition: [
15
+ common.props.monday,
16
+ "boardId",
17
+ ],
18
+ },
19
+ },
20
+ methods: {
21
+ ...common.methods,
22
+ getWebhookCreationError() {
23
+ return "Failed to establish webhook. To create this trigger, you need to have at least one subitem previously created on your board.";
24
+ },
25
+ getWebhookArgs() {
26
+ return {
27
+ event: "change_subitem_column_value",
28
+ };
29
+ },
30
+ getSummary({
31
+ event: {
32
+ columnId,
33
+ pulseId,
34
+ },
35
+ }) {
36
+ return `The column ${columnId} of sub-item with id ${pulseId} was changed.`;
37
+ },
38
+ },
39
+ };
@@ -0,0 +1,34 @@
1
+ import common from "../common/common-webhook.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "monday-subitem-name-updated",
6
+ name: "New Sub-Item Name Updated (Instant)",
7
+ description: "Emit new event when a sub-item name changes. To create this trigger, you need to have at least one subitem previously created on your board.",
8
+ type: "source",
9
+ version: "0.0.2",
10
+ dedupe: "unique",
11
+ props: {
12
+ ...common.props,
13
+ boardId: {
14
+ propDefinition: [
15
+ common.props.monday,
16
+ "boardId",
17
+ ],
18
+ },
19
+ },
20
+ methods: {
21
+ ...common.methods,
22
+ getWebhookCreationError() {
23
+ return "Failed to establish webhook. To create this trigger, you need to have at least one subitem previously created on your board.";
24
+ },
25
+ getWebhookArgs() {
26
+ return {
27
+ event: "change_subitem_name",
28
+ };
29
+ },
30
+ getSummary({ event: { pulseId } }) {
31
+ return `The name of sub-item with id ${pulseId} was changed.`;
32
+ },
33
+ },
34
+ };