@pipedream/monday 0.4.0 → 0.6.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.
@@ -0,0 +1,92 @@
1
+ import monday from "../../monday.app.mjs";
2
+
3
+ export default {
4
+ props: {
5
+ columns: {
6
+ propDefinition: [
7
+ monday,
8
+ "column",
9
+ (c) => ({
10
+ boardId: c.boardId,
11
+ }),
12
+ ],
13
+ type: "string[]",
14
+ description: "Select columns to fill",
15
+ reloadProps: true,
16
+ },
17
+ },
18
+ async additionalProps() {
19
+ const props = {};
20
+ if (!this.columns) {
21
+ return props;
22
+ }
23
+ for (const column of this.columns) {
24
+ let description;
25
+ if (column === "status") {
26
+ description = "Value for status. [Status Index Value Map](https://view.monday.com/1073554546-ad9f20a427a16e67ded630108994c11b?r=use1)";
27
+ } else if (column === "person") {
28
+ description = "The ID of the person/user to add to item";
29
+ } else if (column === "date4") {
30
+ description = "Enter date of item in YYYY-MM-DD format. Eg. `2022-09-02`";
31
+ } else {
32
+ 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.`;
33
+ }
34
+ props[column] = {
35
+ type: "string",
36
+ label: column,
37
+ description,
38
+ };
39
+ }
40
+ return props;
41
+ },
42
+ methods: {
43
+ getEmailValue(value) {
44
+ let email = value;
45
+ if (typeof value === "string") {
46
+ try {
47
+ email = JSON.parse(value);
48
+ } catch {
49
+ email = {
50
+ text: value,
51
+ email: value,
52
+ };
53
+ }
54
+ }
55
+ return email;
56
+ },
57
+ },
58
+ async run({ $ }) {
59
+ const columnValues = {};
60
+ if (this.columns?.length > 0) {
61
+ for (const column of this.columns) {
62
+ if (column === "email") {
63
+ columnValues[column] = this.getEmailValue(this[column]);
64
+ continue;
65
+ }
66
+ columnValues[column] = this[column];
67
+ }
68
+ }
69
+ const {
70
+ data,
71
+ errors,
72
+ error_message: errorMessage,
73
+ } =
74
+ await this.sendRequest({
75
+ columnValues,
76
+ });
77
+
78
+ if (errors) {
79
+ throw new Error(`Failed to create item: ${errors[0].message}`);
80
+ }
81
+
82
+ if (errorMessage) {
83
+ throw new Error(`Failed to create item: ${errorMessage}`);
84
+ }
85
+
86
+ const itemId = this.getItemId(data);
87
+
88
+ $.export("$summary", `Successfully created a new item with ID: ${itemId}`);
89
+
90
+ return itemId;
91
+ },
92
+ };
@@ -6,7 +6,7 @@ export default {
6
6
  name: "Create Board",
7
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.4",
9
+ version: "0.0.6",
10
10
  props: {
11
11
  monday,
12
12
  boardName: {
@@ -21,16 +21,19 @@ export default {
21
21
  "boardKind",
22
22
  ],
23
23
  },
24
- folderId: {
24
+ workspaceId: {
25
25
  propDefinition: [
26
26
  monday,
27
- "folderId",
27
+ "workspaceId",
28
28
  ],
29
29
  },
30
- workspaceId: {
30
+ folderId: {
31
31
  propDefinition: [
32
32
  monday,
33
- "workspaceId",
33
+ "folderId",
34
+ (c) => ({
35
+ workspaceId: c.workspaceId,
36
+ }),
34
37
  ],
35
38
  },
36
39
  templateId: {
@@ -6,7 +6,7 @@ export default {
6
6
  name: "Create Column",
7
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.4",
9
+ version: "0.0.6",
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 documentation](https://api.developer.monday.com/docs/groups-queries#create-a-group)",
7
7
  type: "action",
8
- version: "0.0.5",
8
+ version: "0.0.7",
9
9
  props: {
10
10
  monday,
11
11
  boardId: {
@@ -1,12 +1,14 @@
1
- import utils from "../../common/utils.mjs";
2
1
  import monday from "../../monday.app.mjs";
2
+ import commonCreateItem from "../common/common-create-item.mjs";
3
+ import utils from "../../common/utils.mjs";
3
4
 
4
5
  export default {
6
+ ...commonCreateItem,
5
7
  key: "monday-create-item",
6
8
  name: "Create Item",
7
9
  description: "Creates an item. [See the documentation](https://api.developer.monday.com/docs/items-queries#create-an-item)",
8
10
  type: "action",
9
- version: "0.0.7",
11
+ version: "0.0.9",
10
12
  props: {
11
13
  monday,
12
14
  boardId: {
@@ -30,101 +32,27 @@ export default {
30
32
  "itemName",
31
33
  ],
32
34
  },
33
- columns: {
34
- propDefinition: [
35
- monday,
36
- "column",
37
- (c) => ({
38
- boardId: c.boardId,
39
- }),
40
- ],
41
- type: "string[]",
42
- description: "Select columns to fill",
43
- reloadProps: true,
44
- },
45
35
  createLabels: {
46
36
  propDefinition: [
47
37
  monday,
48
38
  "itemCreateLabels",
49
39
  ],
50
40
  },
51
- },
52
- async additionalProps() {
53
- const props = {};
54
- if (!this.columns) {
55
- return props;
56
- }
57
- for (const column of this.columns) {
58
- let description;
59
- if (column === "status") {
60
- description = "Value for status. [Status Index Value Map](https://view.monday.com/1073554546-ad9f20a427a16e67ded630108994c11b?r=use1)";
61
- } else if (column === "person") {
62
- description = "The ID of the person/user to add to item";
63
- } else if (column === "date4") {
64
- description = "Enter date of item in YYYY-MM-DD format. Eg. `2022-09-02`";
65
- } else {
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
- }
68
- props[column] = {
69
- type: "string",
70
- label: column,
71
- description,
72
- };
73
- }
74
- return props;
41
+ ...commonCreateItem.props,
75
42
  },
76
43
  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
- },
92
- async run({ $ }) {
93
- const columnValues = {};
94
- if (this.columns?.length > 0) {
95
- for (const column of this.columns) {
96
- if (column === "email") {
97
- columnValues[column] = this.getEmailValue(this[column]);
98
- continue;
99
- }
100
- columnValues[column] = this[column];
101
- }
102
- }
103
- const {
104
- data,
105
- errors,
106
- error_message: errorMessage,
107
- } =
108
- await this.monday.createItem({
44
+ ...commonCreateItem.methods,
45
+ sendRequest({ columnValues }) {
46
+ return this.monday.createItem({
109
47
  boardId: +this.boardId,
110
48
  groupId: utils.emptyStrToUndefined(this.groupId),
111
49
  itemName: utils.emptyStrToUndefined(this.itemName),
112
50
  columnValues: utils.strinfied(columnValues),
113
51
  createLabels: utils.emptyStrToUndefined(this.createLabels),
114
52
  });
115
-
116
- if (errors) {
117
- throw new Error(`Failed to create item: ${errors[0].message}`);
118
- }
119
-
120
- if (errorMessage) {
121
- throw new Error(`Failed to create item: ${errorMessage}`);
122
- }
123
-
124
- const { id: itemId } = data.create_item;
125
-
126
- $.export("$summary", `Successfully created a new item with ID: ${itemId}`);
127
-
128
- return itemId;
53
+ },
54
+ getItemId(data) {
55
+ return data.create_item.id;
56
+ },
129
57
  },
130
58
  };
@@ -0,0 +1,60 @@
1
+ import utils from "../../common/utils.mjs";
2
+ import monday from "../../monday.app.mjs";
3
+ import commonCreateItem from "../common/common-create-item.mjs";
4
+
5
+ export default {
6
+ ...commonCreateItem,
7
+ key: "monday-create-subitem",
8
+ name: "Create Subitem",
9
+ description: "Creates a subitem. [See the documentation](https://developer.monday.com/api-reference/docs/introduction-to-graphql#mondaycom-schema)",
10
+ type: "action",
11
+ version: "0.0.1",
12
+ props: {
13
+ monday,
14
+ boardId: {
15
+ propDefinition: [
16
+ monday,
17
+ "boardId",
18
+ ],
19
+ },
20
+ parentItemId: {
21
+ propDefinition: [
22
+ monday,
23
+ "itemId",
24
+ ({ boardId }) => ({
25
+ boardId: +boardId,
26
+ }),
27
+ ],
28
+ optional: false,
29
+ description: "The parent item's unique identifier",
30
+ },
31
+ itemName: {
32
+ propDefinition: [
33
+ monday,
34
+ "itemName",
35
+ ],
36
+ description: "The new subitem's name",
37
+ },
38
+ createLabels: {
39
+ propDefinition: [
40
+ monday,
41
+ "itemCreateLabels",
42
+ ],
43
+ },
44
+ ...commonCreateItem.props,
45
+ },
46
+ methods: {
47
+ ...commonCreateItem.methods,
48
+ sendRequest({ columnValues }) {
49
+ return this.monday.createSubItem({
50
+ parentItemId: utils.emptyStrToUndefined(this.parentItemId),
51
+ itemName: utils.emptyStrToUndefined(this.itemName),
52
+ columnValues: utils.strinfied(columnValues),
53
+ createLabels: utils.emptyStrToUndefined(this.createLabels),
54
+ });
55
+ },
56
+ getItemId(data) {
57
+ return data.create_subitem.id;
58
+ },
59
+ },
60
+ };
@@ -6,7 +6,7 @@ export default {
6
6
  name: "Create an Update",
7
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.6",
9
+ version: "0.0.8",
10
10
  props: {
11
11
  monday,
12
12
  updateBody: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "monday-get-column-values",
6
6
  name: "Get Column Values",
7
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",
8
+ version: "0.0.3",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "monday-get-items-by-column-value",
6
6
  name: "Get Items By Column Value",
7
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",
8
+ version: "0.0.3",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -36,7 +36,20 @@ export default {
36
36
  throw new Error(response.errors[0].message);
37
37
  }
38
38
 
39
- const { data: { items_by_column_values: items } } = response;
39
+ const { data: { items_page_by_column_values: pageItems } } = response;
40
+ const { items } = pageItems;
41
+ let cursor = pageItems?.cursor;
42
+ while (cursor) {
43
+ const {
44
+ data: {
45
+ cursor: nextCursor, items_page_by_column_values: { items: nextItems },
46
+ },
47
+ } = await this.monday.getItemsByColumnValue({
48
+ cursor,
49
+ });
50
+ items.push(...nextItems);
51
+ cursor = nextCursor;
52
+ }
40
53
 
41
54
  $.export("$summary", `Successfully retrieved ${items.length} item${items.length === 1
42
55
  ? ""
@@ -5,12 +5,13 @@ export default {
5
5
  key: "monday-update-column-values",
6
6
  name: "Update Column Values",
7
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",
8
+ version: "0.0.3",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
12
12
  boardId: {
13
13
  ...common.props.boardId,
14
+ description: "The board's unique identifier. See the [Column types reference](https://developer.monday.com/api-reference/docs/column-types-reference) to find the proper data structures for supported column types.",
14
15
  reloadProps: true,
15
16
  },
16
17
  itemId: {
@@ -54,8 +55,8 @@ export default {
54
55
  columnValues: JSON.stringify(columnValues),
55
56
  });
56
57
 
57
- if (response.errors) {
58
- throw new Error(response.errors[0].message);
58
+ if (response.error_message) {
59
+ throw new Error(`${response.error_message} ${JSON.stringify(response.error_data)}`);
59
60
  }
60
61
 
61
62
  const { data: { change_multiple_column_values: item } } = response;
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Update Item Name",
6
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.6",
8
+ version: "0.0.8",
9
9
  props: {
10
10
  monday,
11
11
  boardId: {
@@ -3,9 +3,9 @@ export default {
3
3
  mutation createBoard (
4
4
  $boardName: String!
5
5
  $boardKind: BoardKind!
6
- $folderId: Int
7
- $workspaceId: Int
8
- $templateId: Int
6
+ $folderId: ID
7
+ $workspaceId: ID
8
+ $templateId: ID
9
9
  ) {
10
10
  create_board (
11
11
  board_name: $boardName
@@ -20,7 +20,7 @@ export default {
20
20
  `,
21
21
  createGroup: `
22
22
  mutation createGroup (
23
- $boardId: Int!
23
+ $boardId: ID!
24
24
  $groupName: String!
25
25
  ) {
26
26
  create_group (
@@ -33,8 +33,8 @@ export default {
33
33
  `,
34
34
  createItem: `
35
35
  mutation createItem (
36
- $itemName: String
37
- $boardId: Int!
36
+ $itemName: String!
37
+ $boardId: ID!
38
38
  $groupId: String
39
39
  $columnValues: JSON
40
40
  $createLabels: Boolean
@@ -50,11 +50,28 @@ export default {
50
50
  }
51
51
  }
52
52
  `,
53
+ createSubItem: `
54
+ mutation createSubItem (
55
+ $itemName: String!
56
+ $parentItemId: ID!
57
+ $columnValues: JSON
58
+ $createLabels: Boolean
59
+ ) {
60
+ create_subitem (
61
+ item_name: $itemName
62
+ parent_item_id: $parentItemId
63
+ column_values: $columnValues
64
+ create_labels_if_missing: $createLabels
65
+ ) {
66
+ id
67
+ }
68
+ }
69
+ `,
53
70
  createUpdate: `
54
71
  mutation createUpdate (
55
72
  $updateBody: String!
56
- $itemId: Int
57
- $parentId: Int
73
+ $itemId: ID
74
+ $parentId: ID
58
75
  ) {
59
76
  create_update (
60
77
  body: $updateBody
@@ -67,8 +84,8 @@ export default {
67
84
  `,
68
85
  updateItemName: `
69
86
  mutation updateItemName (
70
- $boardId: Int!
71
- $itemId: Int!
87
+ $boardId: ID!
88
+ $itemId: ID!
72
89
  $columnValues: JSON!
73
90
  ) {
74
91
  change_multiple_column_values (
@@ -82,7 +99,7 @@ export default {
82
99
  `,
83
100
  createWebhook: `
84
101
  mutation createWebhook (
85
- $boardId: Int!
102
+ $boardId: ID!
86
103
  $url: String!
87
104
  $event: WebhookEventType!
88
105
  $config: JSON
@@ -100,7 +117,7 @@ export default {
100
117
  `,
101
118
  deleteWebhook: `
102
119
  mutation deleteWebhook (
103
- $id: Int!
120
+ $id: ID!
104
121
  ) {
105
122
  delete_webhook(
106
123
  id: $id
@@ -112,7 +129,7 @@ export default {
112
129
  `,
113
130
  createColumn: `
114
131
  mutation createColumn (
115
- $boardId: Int!
132
+ $boardId: ID!
116
133
  $title: String!
117
134
  $columnType: ColumnType!
118
135
  $defaults: JSON
@@ -131,8 +148,8 @@ export default {
131
148
  `,
132
149
  updateColumnValues: `
133
150
  mutation updateItem (
134
- $boardId: Int!
135
- $itemId: Int!
151
+ $boardId: ID!
152
+ $itemId: ID!
136
153
  $columnValues: JSON!
137
154
  ) {
138
155
  change_multiple_column_values (
@@ -14,6 +14,22 @@ export default {
14
14
  }
15
15
  }
16
16
  `,
17
+ listWorkspaces: `
18
+ query {
19
+ workspaces {
20
+ id
21
+ name
22
+ }
23
+ }
24
+ `,
25
+ listFolders: `
26
+ query ($workspaceId: [ID]) {
27
+ folders (workspace_ids: $workspaceId) {
28
+ id
29
+ name
30
+ }
31
+ }
32
+ `,
17
33
  listWorkspacesBoards: `
18
34
  query {
19
35
  boards (
@@ -29,7 +45,7 @@ export default {
29
45
  }
30
46
  `,
31
47
  listGroupsBoards: `
32
- query listGroups ($boardId: Int!) {
48
+ query listGroups ($boardId: ID!) {
33
49
  boards (ids: [$boardId]) {
34
50
  groups {
35
51
  id
@@ -39,11 +55,23 @@ export default {
39
55
  }
40
56
  `,
41
57
  listItemsBoard: `
42
- query listItems ($boardId: Int!) {
58
+ query listItems ($boardId: ID!) {
43
59
  boards (ids: [$boardId]) {
44
- items (
45
- newest_first: true
46
- ) {
60
+ items_page (query_params: {order_by:[{ column_id: "__creation_log__", direction: desc }]}) {
61
+ cursor
62
+ items {
63
+ id
64
+ name
65
+ }
66
+ }
67
+ }
68
+ }
69
+ `,
70
+ listItemsNextPage: `
71
+ query listItems ($cursor: String!) {
72
+ next_items_page (cursor: $cursor) {
73
+ cursor
74
+ items {
47
75
  id
48
76
  name
49
77
  }
@@ -52,7 +80,7 @@ export default {
52
80
  `,
53
81
  listUpdatesBoard: `
54
82
  query listUpdates (
55
- $boardId: Int!,
83
+ $boardId: ID!,
56
84
  $page: Int = 1
57
85
  ) {
58
86
  boards (ids: [$boardId]) {
@@ -66,7 +94,7 @@ export default {
66
94
  }
67
95
  `,
68
96
  listColumns: `
69
- query listColumns ($boardId: Int!) {
97
+ query listColumns ($boardId: ID!) {
70
98
  boards (ids: [$boardId]) {
71
99
  columns {
72
100
  id
@@ -87,7 +115,7 @@ export default {
87
115
  }
88
116
  `,
89
117
  getItem: `
90
- query getItem ($id: Int!) {
118
+ query getItem ($id: ID!) {
91
119
  items (ids: [$id]) {
92
120
  id
93
121
  name
@@ -112,7 +140,7 @@ export default {
112
140
  }
113
141
  `,
114
142
  getBoard: `
115
- query getBoard($id: Int!) {
143
+ query getBoard($id: ID!) {
116
144
  boards (ids: [$id]) {
117
145
  id
118
146
  name
@@ -124,8 +152,10 @@ export default {
124
152
  groups {
125
153
  id
126
154
  }
127
- items {
128
- id
155
+ items_page {
156
+ items {
157
+ id
158
+ }
129
159
  }
130
160
  owner {
131
161
  id
@@ -141,7 +171,7 @@ export default {
141
171
  }
142
172
  `,
143
173
  getUser: `
144
- query getUser($id: Int!) {
174
+ query getUser($id: ID!) {
145
175
  users (ids: [$id]) {
146
176
  id
147
177
  name
@@ -178,7 +208,7 @@ export default {
178
208
  }
179
209
  `,
180
210
  getColumnValues: `
181
- query getItem ($itemId: Int!, $columnIds: [String!]) {
211
+ query getItem ($itemId: ID!, $columnIds: [String!]) {
182
212
  items (ids: [$itemId]){
183
213
  id
184
214
  name
@@ -191,14 +221,17 @@ export default {
191
221
  }
192
222
  `,
193
223
  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 {
224
+ query ($boardId: ID!, $columnId: String!, $columnValue: String!){
225
+ items_page_by_column_values (board_id: $boardId, columns: [{column_id: $columnId, column_values: [$columnValue]}]) {
226
+ cursor
227
+ items {
199
228
  id
200
- value
201
- text
229
+ name
230
+ column_values {
231
+ id
232
+ value
233
+ text
234
+ }
202
235
  }
203
236
  }
204
237
  }
package/monday.app.mjs CHANGED
@@ -36,6 +36,11 @@ export default {
36
36
  label: "Folder ID",
37
37
  description: "Board folder ID",
38
38
  optional: true,
39
+ async options({ workspaceId }) {
40
+ return this.listFolderOptions({
41
+ workspaceId,
42
+ });
43
+ },
39
44
  },
40
45
  workspaceId: {
41
46
  type: "integer",
@@ -95,9 +100,12 @@ export default {
95
100
  label: "Item ID",
96
101
  description: "The item's unique identifier",
97
102
  optional: true,
98
- async options({ boardId }) {
103
+ async options({
104
+ boardId, prevContext,
105
+ }) {
99
106
  return this.listItemsOptions({
100
107
  boardId,
108
+ cursor: prevContext.cursor,
101
109
  });
102
110
  },
103
111
  },
@@ -215,6 +223,14 @@ export default {
215
223
  },
216
224
  });
217
225
  },
226
+ async createSubItem(variables) {
227
+ return this.makeRequest({
228
+ query: mutations.createSubItem,
229
+ options: {
230
+ variables,
231
+ },
232
+ });
233
+ },
218
234
  async createUpdate(variables) {
219
235
  return this.makeRequest({
220
236
  query: mutations.createUpdate,
@@ -239,17 +255,40 @@ export default {
239
255
  },
240
256
  });
241
257
  },
242
- async listItemsBoard(variables) {
258
+ async listItemsBoard({
259
+ cursor, ...variables
260
+ }) {
261
+ const query = cursor
262
+ ? queries.listItemsNextPage
263
+ : queries.listItemsBoard;
264
+ const options = cursor
265
+ ? {
266
+ variables: cursor,
267
+ }
268
+ : {
269
+ variables,
270
+ };
243
271
  return this.makeRequest({
244
- query: queries.listItemsBoard,
272
+ query,
273
+ options,
274
+ });
275
+ },
276
+ async listUpdatesBoard(variables) {
277
+ return this.makeRequest({
278
+ query: queries.listUpdatesBoard,
245
279
  options: {
246
280
  variables,
247
281
  },
248
282
  });
249
283
  },
250
- async listUpdatesBoard(variables) {
284
+ async listWorkspaces() {
251
285
  return this.makeRequest({
252
- query: queries.listUpdatesBoard,
286
+ query: queries.listWorkspaces,
287
+ });
288
+ },
289
+ async listFolders(variables) {
290
+ return this.makeRequest({
291
+ query: queries.listFolders,
253
292
  options: {
254
293
  variables,
255
294
  },
@@ -294,12 +333,22 @@ export default {
294
333
  },
295
334
  });
296
335
  },
297
- async getItemsByColumnValue(variables) {
298
- return this.makeRequest({
299
- query: queries.getItemsByColumnValue,
300
- options: {
336
+ async getItemsByColumnValue({
337
+ cursor, ...variables
338
+ }) {
339
+ const query = cursor
340
+ ? queries.listItemsNextPage
341
+ : queries.getItemsByColumnValue;
342
+ const options = cursor
343
+ ? {
344
+ variables: cursor,
345
+ }
346
+ : {
301
347
  variables,
302
- },
348
+ };
349
+ return this.makeRequest({
350
+ query,
351
+ options,
303
352
  });
304
353
  },
305
354
  async updateColumnValues(variables) {
@@ -335,12 +384,34 @@ export default {
335
384
  value: id,
336
385
  }));
337
386
  },
387
+ async listFolderOptions(variables) {
388
+ const {
389
+ data, errors, error_message: errorMessage,
390
+ } = await this.listFolders(variables);
391
+
392
+ if (errors) {
393
+ throw new Error(`Error listing folders: ${errors[0].message}`);
394
+ }
395
+
396
+ if (errorMessage) {
397
+ throw new Error(`Failed to list folders: ${errorMessage}`);
398
+ }
399
+
400
+ const { folders } = data;
401
+ return folders
402
+ .map(({
403
+ id, name,
404
+ }) => ({
405
+ label: name,
406
+ value: +id,
407
+ }));
408
+ },
338
409
  async listWorkspacesOptions() {
339
410
  const {
340
411
  data,
341
412
  errors,
342
413
  error_message: errorMessage,
343
- } = await this.listWorkspacesBoards();
414
+ } = await this.listWorkspaces();
344
415
 
345
416
  if (errors) {
346
417
  throw new Error(`Error listing workspaces: ${errors[0].message}`);
@@ -350,13 +421,12 @@ export default {
350
421
  throw new Error(`Failed to list workspaces: ${errorMessage}`);
351
422
  }
352
423
 
353
- const { boards } = data;
424
+ const { workspaces } = data;
354
425
  const options =
355
- boards
356
- .filter(({ workspace }) => workspace)
357
- .map(({ workspace }) => ({
426
+ workspaces
427
+ .map((workspace) => ({
358
428
  label: workspace.name,
359
- value: workspace.id,
429
+ value: +workspace.id,
360
430
  }));
361
431
  return uniqBy(options, "value");
362
432
  },
@@ -403,16 +473,20 @@ export default {
403
473
  }
404
474
 
405
475
  const { boards } = data;
406
- const options =
407
- flatMap(boards, ({ items }) =>
408
- map(items, ({
409
- id, name,
410
- }) =>
411
- ({
412
- value: id,
413
- label: name,
414
- })));
415
- return options;
476
+ const items = boards[0].items_page.items;
477
+ const cursor = boards[0].items_page.cursor;
478
+ const options = items.map(({
479
+ id, name,
480
+ }) => ({
481
+ value: id,
482
+ label: name,
483
+ }));
484
+ return {
485
+ options,
486
+ context: {
487
+ cursor,
488
+ },
489
+ };
416
490
  },
417
491
  async listUpdatesOptions(variables) {
418
492
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/monday",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Pipedream Monday Components",
5
5
  "main": "monday.app.mjs",
6
6
  "keywords": [
@@ -14,7 +14,7 @@
14
14
  "access": "public"
15
15
  },
16
16
  "dependencies": {
17
- "@pipedream/platform": "^1.2.0",
17
+ "@pipedream/platform": "^1.6.0",
18
18
  "lodash.flatmap": "^4.5.0",
19
19
  "lodash.map": "^4.6.0",
20
20
  "lodash.uniqby": "^4.7.0",
@@ -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.4",
9
+ version: "0.0.6",
10
10
  dedupe: "unique",
11
11
  hooks: {
12
12
  ...common.hooks,
@@ -65,7 +65,7 @@ export default {
65
65
  };
66
66
  },
67
67
  async commonDeploy() {
68
- const { items } = (await this.monday.listItemsBoard({
68
+ const { items_page: { items } } = (await this.monday.listItemsBoard({
69
69
  boardId: +this.boardId,
70
70
  })).data.boards[0];
71
71
  for (const item of items.slice(-25).reverse()) {
@@ -76,7 +76,9 @@ export default {
76
76
  const meta = this.generateMeta({
77
77
  item,
78
78
  });
79
- this.$emit(itemData, meta);
79
+ this.$emit({
80
+ item: itemData,
81
+ }, meta);
80
82
  }
81
83
  },
82
84
  },
@@ -6,7 +6,7 @@ export default {
6
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.4",
9
+ version: "0.0.6",
10
10
  dedupe: "unique",
11
11
  hooks: {
12
12
  ...common.hooks,
@@ -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.5",
9
+ version: "0.0.7",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  ...common.props,
@@ -6,7 +6,7 @@ export default {
6
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.4",
9
+ version: "0.0.6",
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.3",
9
+ version: "0.0.5",
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.3",
9
+ version: "0.0.5",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  ...common.props,
@@ -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.5",
9
+ version: "0.0.7",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -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.4",
9
+ version: "0.0.6",
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.3",
9
+ version: "0.0.6",
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.3",
9
+ version: "0.0.5",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  ...common.props,