@pipedream/monday 0.4.0 → 0.5.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.
@@ -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.5",
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.5",
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.6",
9
9
  props: {
10
10
  monday,
11
11
  boardId: {
@@ -6,7 +6,7 @@ export default {
6
6
  name: "Create Item",
7
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.7",
9
+ version: "0.0.8",
10
10
  props: {
11
11
  monday,
12
12
  boardId: {
@@ -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.7",
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.2",
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.2",
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.2",
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.7",
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
@@ -53,8 +53,8 @@ export default {
53
53
  createUpdate: `
54
54
  mutation createUpdate (
55
55
  $updateBody: String!
56
- $itemId: Int
57
- $parentId: Int
56
+ $itemId: ID
57
+ $parentId: ID
58
58
  ) {
59
59
  create_update (
60
60
  body: $updateBody
@@ -67,8 +67,8 @@ export default {
67
67
  `,
68
68
  updateItemName: `
69
69
  mutation updateItemName (
70
- $boardId: Int!
71
- $itemId: Int!
70
+ $boardId: ID!
71
+ $itemId: ID!
72
72
  $columnValues: JSON!
73
73
  ) {
74
74
  change_multiple_column_values (
@@ -82,7 +82,7 @@ export default {
82
82
  `,
83
83
  createWebhook: `
84
84
  mutation createWebhook (
85
- $boardId: Int!
85
+ $boardId: ID!
86
86
  $url: String!
87
87
  $event: WebhookEventType!
88
88
  $config: JSON
@@ -100,7 +100,7 @@ export default {
100
100
  `,
101
101
  deleteWebhook: `
102
102
  mutation deleteWebhook (
103
- $id: Int!
103
+ $id: ID!
104
104
  ) {
105
105
  delete_webhook(
106
106
  id: $id
@@ -112,7 +112,7 @@ export default {
112
112
  `,
113
113
  createColumn: `
114
114
  mutation createColumn (
115
- $boardId: Int!
115
+ $boardId: ID!
116
116
  $title: String!
117
117
  $columnType: ColumnType!
118
118
  $defaults: JSON
@@ -131,8 +131,8 @@ export default {
131
131
  `,
132
132
  updateColumnValues: `
133
133
  mutation updateItem (
134
- $boardId: Int!
135
- $itemId: Int!
134
+ $boardId: ID!
135
+ $itemId: ID!
136
136
  $columnValues: JSON!
137
137
  ) {
138
138
  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
  },
@@ -239,17 +247,40 @@ export default {
239
247
  },
240
248
  });
241
249
  },
242
- async listItemsBoard(variables) {
250
+ async listItemsBoard({
251
+ cursor, ...variables
252
+ }) {
253
+ const query = cursor
254
+ ? queries.listItemsNextPage
255
+ : queries.listItemsBoard;
256
+ const options = cursor
257
+ ? {
258
+ variables: cursor,
259
+ }
260
+ : {
261
+ variables,
262
+ };
263
+ return this.makeRequest({
264
+ query,
265
+ options,
266
+ });
267
+ },
268
+ async listUpdatesBoard(variables) {
243
269
  return this.makeRequest({
244
- query: queries.listItemsBoard,
270
+ query: queries.listUpdatesBoard,
245
271
  options: {
246
272
  variables,
247
273
  },
248
274
  });
249
275
  },
250
- async listUpdatesBoard(variables) {
276
+ async listWorkspaces() {
251
277
  return this.makeRequest({
252
- query: queries.listUpdatesBoard,
278
+ query: queries.listWorkspaces,
279
+ });
280
+ },
281
+ async listFolders(variables) {
282
+ return this.makeRequest({
283
+ query: queries.listFolders,
253
284
  options: {
254
285
  variables,
255
286
  },
@@ -294,12 +325,22 @@ export default {
294
325
  },
295
326
  });
296
327
  },
297
- async getItemsByColumnValue(variables) {
298
- return this.makeRequest({
299
- query: queries.getItemsByColumnValue,
300
- options: {
328
+ async getItemsByColumnValue({
329
+ cursor, ...variables
330
+ }) {
331
+ const query = cursor
332
+ ? queries.listItemsNextPage
333
+ : queries.getItemsByColumnValue;
334
+ const options = cursor
335
+ ? {
336
+ variables: cursor,
337
+ }
338
+ : {
301
339
  variables,
302
- },
340
+ };
341
+ return this.makeRequest({
342
+ query,
343
+ options,
303
344
  });
304
345
  },
305
346
  async updateColumnValues(variables) {
@@ -335,12 +376,34 @@ export default {
335
376
  value: id,
336
377
  }));
337
378
  },
379
+ async listFolderOptions(variables) {
380
+ const {
381
+ data, errors, error_message: errorMessage,
382
+ } = await this.listFolders(variables);
383
+
384
+ if (errors) {
385
+ throw new Error(`Error listing folders: ${errors[0].message}`);
386
+ }
387
+
388
+ if (errorMessage) {
389
+ throw new Error(`Failed to list folders: ${errorMessage}`);
390
+ }
391
+
392
+ const { folders } = data;
393
+ return folders
394
+ .map(({
395
+ id, name,
396
+ }) => ({
397
+ label: name,
398
+ value: +id,
399
+ }));
400
+ },
338
401
  async listWorkspacesOptions() {
339
402
  const {
340
403
  data,
341
404
  errors,
342
405
  error_message: errorMessage,
343
- } = await this.listWorkspacesBoards();
406
+ } = await this.listWorkspaces();
344
407
 
345
408
  if (errors) {
346
409
  throw new Error(`Error listing workspaces: ${errors[0].message}`);
@@ -350,13 +413,12 @@ export default {
350
413
  throw new Error(`Failed to list workspaces: ${errorMessage}`);
351
414
  }
352
415
 
353
- const { boards } = data;
416
+ const { workspaces } = data;
354
417
  const options =
355
- boards
356
- .filter(({ workspace }) => workspace)
357
- .map(({ workspace }) => ({
418
+ workspaces
419
+ .map((workspace) => ({
358
420
  label: workspace.name,
359
- value: workspace.id,
421
+ value: +workspace.id,
360
422
  }));
361
423
  return uniqBy(options, "value");
362
424
  },
@@ -403,16 +465,20 @@ export default {
403
465
  }
404
466
 
405
467
  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;
468
+ const items = boards[0].items_page.items;
469
+ const cursor = boards[0].items_page.cursor;
470
+ const options = items.map(({
471
+ id, name,
472
+ }) => ({
473
+ value: id,
474
+ label: name,
475
+ }));
476
+ return {
477
+ options,
478
+ context: {
479
+ cursor,
480
+ },
481
+ };
416
482
  },
417
483
  async listUpdatesOptions(variables) {
418
484
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/monday",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Pipedream Monday Components",
5
5
  "main": "monday.app.mjs",
6
6
  "keywords": [
@@ -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.5",
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.5",
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.6",
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.5",
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.4",
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.4",
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.6",
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.5",
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.4",
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.4",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  ...common.props,