@pipedream/monday 0.3.8 → 0.4.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/common/column-values.mjs +32 -0
- package/actions/create-board/create-board.mjs +2 -2
- package/actions/create-column/create-column.mjs +2 -2
- package/actions/create-group/create-group.mjs +2 -2
- package/actions/create-item/create-item.mjs +23 -3
- package/actions/create-update/create-update.mjs +2 -2
- package/actions/get-column-values/get-column-values.mjs +56 -0
- package/actions/get-items-by-column-value/get-items-by-column-value.mjs +47 -0
- package/actions/update-column-values/update-column-values.mjs +69 -0
- package/actions/update-item-name/update-item-name.mjs +2 -2
- package/common/mutations.mjs +21 -0
- package/common/queries.mjs +26 -0
- package/monday.app.mjs +24 -0
- package/package.json +1 -1
- package/sources/column-value-updated/column-value-updated.mjs +1 -1
- package/sources/name-updated/name-updated.mjs +1 -1
- package/sources/new-board/new-board.mjs +1 -1
- package/sources/new-item/new-item.mjs +1 -1
- package/sources/new-subitem/new-subitem.mjs +1 -1
- package/sources/new-subitem-update/new-subitem-update.mjs +1 -1
- package/sources/new-user/new-user.mjs +1 -1
- package/sources/specific-column-updated/specific-column-updated.mjs +1 -1
- package/sources/subitem-column-value-updated/subitem-column-value-updated.mjs +1 -1
- package/sources/subitem-name-updated/subitem-name-updated.mjs +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import monday from "../../monday.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
props: {
|
|
5
|
+
monday,
|
|
6
|
+
boardId: {
|
|
7
|
+
propDefinition: [
|
|
8
|
+
monday,
|
|
9
|
+
"boardId",
|
|
10
|
+
],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
methods: {
|
|
14
|
+
async getColumns(boardId) {
|
|
15
|
+
const columns = await this.monday.listColumns({
|
|
16
|
+
boardId: +boardId,
|
|
17
|
+
});
|
|
18
|
+
return columns.filter(({ id }) => id !== "name");
|
|
19
|
+
},
|
|
20
|
+
formatColumnValues(items) {
|
|
21
|
+
for (const item of items) {
|
|
22
|
+
item.column_values = item.column_values.map(({
|
|
23
|
+
id, value, text,
|
|
24
|
+
}) => ({
|
|
25
|
+
id,
|
|
26
|
+
value: text || value,
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
return items;
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -4,9 +4,9 @@ import monday from "../../monday.app.mjs";
|
|
|
4
4
|
export default {
|
|
5
5
|
key: "monday-create-board",
|
|
6
6
|
name: "Create Board",
|
|
7
|
-
description: "Creates a new board. [See the
|
|
7
|
+
description: "Creates a new board. [See the documentation](https://api.developer.monday.com/docs/boards#create-a-board)",
|
|
8
8
|
type: "action",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.4",
|
|
10
10
|
props: {
|
|
11
11
|
monday,
|
|
12
12
|
boardName: {
|
|
@@ -4,9 +4,9 @@ import monday from "../../monday.app.mjs";
|
|
|
4
4
|
export default {
|
|
5
5
|
key: "monday-create-column",
|
|
6
6
|
name: "Create Column",
|
|
7
|
-
description: "Creates a column. [See the
|
|
7
|
+
description: "Creates a column. [See the documentation](https://developer.monday.com/api-reference/docs/columns-queries-1)",
|
|
8
8
|
type: "action",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.4",
|
|
10
10
|
props: {
|
|
11
11
|
monday,
|
|
12
12
|
boardId: {
|
|
@@ -3,9 +3,9 @@ import monday from "../../monday.app.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
key: "monday-create-group",
|
|
5
5
|
name: "Create Group",
|
|
6
|
-
description: "Creates a new group in a specific board. [See the
|
|
6
|
+
description: "Creates a new group in a specific board. [See the documentation](https://api.developer.monday.com/docs/groups-queries#create-a-group)",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.5",
|
|
9
9
|
props: {
|
|
10
10
|
monday,
|
|
11
11
|
boardId: {
|
|
@@ -4,9 +4,9 @@ import monday from "../../monday.app.mjs";
|
|
|
4
4
|
export default {
|
|
5
5
|
key: "monday-create-item",
|
|
6
6
|
name: "Create Item",
|
|
7
|
-
description: "Creates an item. [See the
|
|
7
|
+
description: "Creates an item. [See the documentation](https://api.developer.monday.com/docs/items-queries#create-an-item)",
|
|
8
8
|
type: "action",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.7",
|
|
10
10
|
props: {
|
|
11
11
|
monday,
|
|
12
12
|
boardId: {
|
|
@@ -63,7 +63,7 @@ export default {
|
|
|
63
63
|
} else if (column === "date4") {
|
|
64
64
|
description = "Enter date of item in YYYY-MM-DD format. Eg. `2022-09-02`";
|
|
65
65
|
} else {
|
|
66
|
-
description = `Value for column ${column}
|
|
66
|
+
description = `Value for column ${column}. See the [Column Type Reference](https://developer.monday.com/api-reference/docs/column-types-reference) to learn more about entering column type values.`;
|
|
67
67
|
}
|
|
68
68
|
props[column] = {
|
|
69
69
|
type: "string",
|
|
@@ -73,10 +73,30 @@ export default {
|
|
|
73
73
|
}
|
|
74
74
|
return props;
|
|
75
75
|
},
|
|
76
|
+
methods: {
|
|
77
|
+
getEmailValue(value) {
|
|
78
|
+
let email = value;
|
|
79
|
+
if (typeof value === "string") {
|
|
80
|
+
try {
|
|
81
|
+
email = JSON.parse(value);
|
|
82
|
+
} catch {
|
|
83
|
+
email = {
|
|
84
|
+
text: value,
|
|
85
|
+
email: value,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return email;
|
|
90
|
+
},
|
|
91
|
+
},
|
|
76
92
|
async run({ $ }) {
|
|
77
93
|
const columnValues = {};
|
|
78
94
|
if (this.columns?.length > 0) {
|
|
79
95
|
for (const column of this.columns) {
|
|
96
|
+
if (column === "email") {
|
|
97
|
+
columnValues[column] = this.getEmailValue(this[column]);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
80
100
|
columnValues[column] = this[column];
|
|
81
101
|
}
|
|
82
102
|
}
|
|
@@ -4,9 +4,9 @@ import monday from "../../monday.app.mjs";
|
|
|
4
4
|
export default {
|
|
5
5
|
key: "monday-create-update",
|
|
6
6
|
name: "Create an Update",
|
|
7
|
-
description: "Creates a new update. [See the
|
|
7
|
+
description: "Creates a new update. [See the documentation](https://api.developer.monday.com/docs/updates-queries#create-an-update)",
|
|
8
8
|
type: "action",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.6",
|
|
10
10
|
props: {
|
|
11
11
|
monday,
|
|
12
12
|
updateBody: {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import common from "../common/column-values.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "monday-get-column-values",
|
|
6
|
+
name: "Get Column Values",
|
|
7
|
+
description: "Return values of a specific column or columns for a board item. [See the documentation](https://developer.monday.com/api-reference/docs/column-values-v2)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
...common.props,
|
|
12
|
+
itemId: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
common.props.monday,
|
|
15
|
+
"itemId",
|
|
16
|
+
({ boardId }) => ({
|
|
17
|
+
boardId: +boardId,
|
|
18
|
+
}),
|
|
19
|
+
],
|
|
20
|
+
optional: false,
|
|
21
|
+
},
|
|
22
|
+
columnIds: {
|
|
23
|
+
propDefinition: [
|
|
24
|
+
common.props.monday,
|
|
25
|
+
"column",
|
|
26
|
+
(c) => ({
|
|
27
|
+
boardId: c.boardId,
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
type: "string[]",
|
|
31
|
+
label: "Columns",
|
|
32
|
+
description: "Return data from the specified column(s)",
|
|
33
|
+
optional: true,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
async run({ $ }) {
|
|
37
|
+
let columnIds = this.columnIds;
|
|
38
|
+
if (!columnIds?.length) {
|
|
39
|
+
const columns = await this.getColumns(this.boardId);
|
|
40
|
+
columnIds = columns.map(({ id }) => id);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const response = await this.monday.getColumnValues({
|
|
44
|
+
itemId: +this.itemId,
|
|
45
|
+
columnIds: columnIds,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
if (response.errors) {
|
|
49
|
+
throw new Error(response.errors[0].message);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
$.export("$summary", `Successfully retrieved column values for item with ID ${this.itemId}.`);
|
|
53
|
+
|
|
54
|
+
return this.formatColumnValues(response.data.items);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import common from "../common/column-values.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "monday-get-items-by-column-value",
|
|
6
|
+
name: "Get Items By Column Value",
|
|
7
|
+
description: "Searches a column for items matching a value. [See the documentation](https://developer.monday.com/api-reference/docs/items-page-by-column-values)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
...common.props,
|
|
12
|
+
columnId: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
common.props.monday,
|
|
15
|
+
"column",
|
|
16
|
+
(c) => ({
|
|
17
|
+
boardId: c.boardId,
|
|
18
|
+
}),
|
|
19
|
+
],
|
|
20
|
+
description: "The column to search",
|
|
21
|
+
},
|
|
22
|
+
value: {
|
|
23
|
+
type: "string",
|
|
24
|
+
label: "Value",
|
|
25
|
+
description: "The value to serach for. [See documentation](https://developer.monday.com/api-reference/docs/items-by-column-values#supported-limited-support-and-unsupported-columns) for additional information about column values.",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
async run({ $ }) {
|
|
29
|
+
const response = await this.monday.getItemsByColumnValue({
|
|
30
|
+
boardId: +this.boardId,
|
|
31
|
+
columnId: this.columnId,
|
|
32
|
+
columnValue: this.value,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (response.errors) {
|
|
36
|
+
throw new Error(response.errors[0].message);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const { data: { items_by_column_values: items } } = response;
|
|
40
|
+
|
|
41
|
+
$.export("$summary", `Successfully retrieved ${items.length} item${items.length === 1
|
|
42
|
+
? ""
|
|
43
|
+
: "s"}.`);
|
|
44
|
+
|
|
45
|
+
return this.formatColumnValues(items);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import common from "../common/column-values.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "monday-update-column-values",
|
|
6
|
+
name: "Update Column Values",
|
|
7
|
+
description: "Update multiple column values of an item. [See the documentation](https://developer.monday.com/api-reference/docs/columns#change-multiple-column-values)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
...common.props,
|
|
12
|
+
boardId: {
|
|
13
|
+
...common.props.boardId,
|
|
14
|
+
reloadProps: true,
|
|
15
|
+
},
|
|
16
|
+
itemId: {
|
|
17
|
+
propDefinition: [
|
|
18
|
+
common.props.monday,
|
|
19
|
+
"itemId",
|
|
20
|
+
({ boardId }) => ({
|
|
21
|
+
boardId: +boardId,
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
24
|
+
optional: false,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
async additionalProps() {
|
|
28
|
+
const props = {};
|
|
29
|
+
if (this.boardId) {
|
|
30
|
+
const columns = await this.getColumns(this.boardId);
|
|
31
|
+
for (const column of columns) {
|
|
32
|
+
props[column.id] = {
|
|
33
|
+
type: "string",
|
|
34
|
+
label: column.title,
|
|
35
|
+
description: `The value for column ${column.title}`,
|
|
36
|
+
optional: true,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return props;
|
|
41
|
+
},
|
|
42
|
+
async run({ $ }) {
|
|
43
|
+
const columns = await this.getColumns(this.boardId);
|
|
44
|
+
const columnValues = {};
|
|
45
|
+
for (const column of columns) {
|
|
46
|
+
if (this[column.id]) {
|
|
47
|
+
columnValues[column.id] = this[column.id];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const response = await this.monday.updateColumnValues({
|
|
52
|
+
boardId: +this.boardId,
|
|
53
|
+
itemId: +this.itemId,
|
|
54
|
+
columnValues: JSON.stringify(columnValues),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
if (response.errors) {
|
|
58
|
+
throw new Error(response.errors[0].message);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const { data: { change_multiple_column_values: item } } = response;
|
|
62
|
+
|
|
63
|
+
$.export("$summary", `Successfully updated item with ID ${item.id}.`);
|
|
64
|
+
|
|
65
|
+
return this.formatColumnValues([
|
|
66
|
+
item,
|
|
67
|
+
]);
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -3,9 +3,9 @@ import monday from "../../monday.app.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
key: "monday-update-item-name",
|
|
5
5
|
name: "Update Item Name",
|
|
6
|
-
description: "Update an item's name. [See the
|
|
6
|
+
description: "Update an item's name. [See the documentation](https://api.developer.monday.com/docs/item-name)",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.6",
|
|
9
9
|
props: {
|
|
10
10
|
monday,
|
|
11
11
|
boardId: {
|
package/common/mutations.mjs
CHANGED
|
@@ -129,4 +129,25 @@ export default {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
`,
|
|
132
|
+
updateColumnValues: `
|
|
133
|
+
mutation updateItem (
|
|
134
|
+
$boardId: Int!
|
|
135
|
+
$itemId: Int!
|
|
136
|
+
$columnValues: JSON!
|
|
137
|
+
) {
|
|
138
|
+
change_multiple_column_values (
|
|
139
|
+
board_id: $boardId
|
|
140
|
+
item_id: $itemId
|
|
141
|
+
column_values: $columnValues
|
|
142
|
+
) {
|
|
143
|
+
id
|
|
144
|
+
name
|
|
145
|
+
column_values {
|
|
146
|
+
id
|
|
147
|
+
value
|
|
148
|
+
text
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
`,
|
|
132
153
|
};
|
package/common/queries.mjs
CHANGED
|
@@ -177,4 +177,30 @@ export default {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
`,
|
|
180
|
+
getColumnValues: `
|
|
181
|
+
query getItem ($itemId: Int!, $columnIds: [String!]) {
|
|
182
|
+
items (ids: [$itemId]){
|
|
183
|
+
id
|
|
184
|
+
name
|
|
185
|
+
column_values (ids: $columnIds){
|
|
186
|
+
id
|
|
187
|
+
value
|
|
188
|
+
text
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
`,
|
|
193
|
+
getItemsByColumnValue: `
|
|
194
|
+
query ($boardId: Int!, $columnId: String!, $columnValue: String!){
|
|
195
|
+
items_by_column_values (board_id: $boardId, column_id: $columnId, column_value: $columnValue) {
|
|
196
|
+
id
|
|
197
|
+
name
|
|
198
|
+
column_values {
|
|
199
|
+
id
|
|
200
|
+
value
|
|
201
|
+
text
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
`,
|
|
180
206
|
};
|
package/monday.app.mjs
CHANGED
|
@@ -286,6 +286,30 @@ export default {
|
|
|
286
286
|
});
|
|
287
287
|
return data?.users;
|
|
288
288
|
},
|
|
289
|
+
async getColumnValues(variables) {
|
|
290
|
+
return this.makeRequest({
|
|
291
|
+
query: queries.getColumnValues,
|
|
292
|
+
options: {
|
|
293
|
+
variables,
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
},
|
|
297
|
+
async getItemsByColumnValue(variables) {
|
|
298
|
+
return this.makeRequest({
|
|
299
|
+
query: queries.getItemsByColumnValue,
|
|
300
|
+
options: {
|
|
301
|
+
variables,
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
},
|
|
305
|
+
async updateColumnValues(variables) {
|
|
306
|
+
return this.makeRequest({
|
|
307
|
+
query: mutations.updateColumnValues,
|
|
308
|
+
options: {
|
|
309
|
+
variables,
|
|
310
|
+
},
|
|
311
|
+
});
|
|
312
|
+
},
|
|
289
313
|
async listBoardsOptions(variables) {
|
|
290
314
|
const {
|
|
291
315
|
data,
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
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.
|
|
9
|
+
version: "0.0.4",
|
|
10
10
|
dedupe: "unique",
|
|
11
11
|
hooks: {
|
|
12
12
|
...common.hooks,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
name: "New Sub-Item (Instant)",
|
|
7
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
8
|
type: "source",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.3",
|
|
10
10
|
dedupe: "unique",
|
|
11
11
|
props: {
|
|
12
12
|
...common.props,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
name: "New Sub-Item Update (Instant)",
|
|
7
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
8
|
type: "source",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.3",
|
|
10
10
|
dedupe: "unique",
|
|
11
11
|
props: {
|
|
12
12
|
...common.props,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
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.
|
|
9
|
+
version: "0.0.4",
|
|
10
10
|
dedupe: "unique",
|
|
11
11
|
hooks: {
|
|
12
12
|
...common.hooks,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
name: "New Sub-Item Column Value Updated (Instant)",
|
|
7
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
8
|
type: "source",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.3",
|
|
10
10
|
dedupe: "unique",
|
|
11
11
|
props: {
|
|
12
12
|
...common.props,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
name: "New Sub-Item Name Updated (Instant)",
|
|
7
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
8
|
type: "source",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.3",
|
|
10
10
|
dedupe: "unique",
|
|
11
11
|
props: {
|
|
12
12
|
...common.props,
|