@worktables/n8n-nodes-worktables 10.20.73 → 10.30.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.
@@ -1,13 +1,7 @@
1
1
  import { INodeType, INodeTypeDescription, ILoadOptionsFunctions, INodePropertyOptions, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
- import { getBoardSearchList, getColumnsItems, getItemSearchList } from './GenericFunctions';
3
2
  export declare class Worktables implements INodeType {
4
3
  description: INodeTypeDescription;
5
4
  methods: {
6
- listSearch: {
7
- getItemSearchList: typeof getItemSearchList;
8
- getBoardSearchList: typeof getBoardSearchList;
9
- getColumnsItems: typeof getColumnsItems;
10
- };
11
5
  loadOptions: {
12
6
  getWorkspaces(): Promise<{
13
7
  name: string;
@@ -25,6 +19,7 @@ export declare class Worktables implements INodeType {
25
19
  getColumnsFromBoard(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
26
20
  getSubscribersFromBoard(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
27
21
  getSubitems(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
22
+ getColumnsItems(this: ILoadOptionsFunctions): Promise<any>;
28
23
  getFolders(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
29
24
  getUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
30
25
  getTeams(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Worktables = void 0;
4
4
  const n8n_workflow_1 = require("n8n-workflow");
5
5
  const isErrorResponse_1 = require("../../utils/isErrorResponse");
6
- const GenericFunctions_1 = require("./GenericFunctions");
7
- const ItemOperations_1 = require("./ItemOperations");
8
6
  class Worktables {
9
7
  constructor() {
10
8
  this.description = {
@@ -55,8 +53,6 @@ class Worktables {
55
53
  required: true,
56
54
  description: 'Select the category of actions to perform',
57
55
  },
58
- ...ItemOperations_1.itemOperations,
59
- ...ItemOperations_1.itemFields,
60
56
  {
61
57
  displayName: 'Operation',
62
58
  name: 'operation',
@@ -161,6 +157,82 @@ class Worktables {
161
157
  show: { resource: ['query'] },
162
158
  },
163
159
  },
160
+ {
161
+ displayName: 'Operation',
162
+ name: 'operation',
163
+ type: 'options',
164
+ noDataExpression: true,
165
+ options: [
166
+ {
167
+ name: 'Get an Item',
168
+ value: 'getItem',
169
+ description: 'Retrieve details of a specific item',
170
+ action: 'Get an item',
171
+ },
172
+ {
173
+ name: 'Create an Item',
174
+ value: 'createItem',
175
+ description: 'Create an item in a board',
176
+ action: 'Create an item',
177
+ },
178
+ {
179
+ name: 'Update Column Values of an Item',
180
+ value: 'updateItem',
181
+ action: 'Update column values of an item',
182
+ },
183
+ {
184
+ name: 'Delete an Item',
185
+ value: 'deleteItem',
186
+ description: 'Delete an item from a board',
187
+ action: 'Delete an item',
188
+ },
189
+ {
190
+ name: 'Duplicate an Item',
191
+ value: 'duplicateItem',
192
+ description: 'Duplicate an existing item',
193
+ action: 'Duplicate an item',
194
+ },
195
+ {
196
+ name: 'List Items in a Board',
197
+ value: 'listBoardItems',
198
+ description: 'List all items in a board',
199
+ action: 'List items in a board',
200
+ },
201
+ {
202
+ name: 'List Items in a Group',
203
+ value: 'listGroupItems',
204
+ description: 'List all items in a group',
205
+ action: 'List items in a group',
206
+ },
207
+ {
208
+ name: 'Search Items by Filter',
209
+ value: 'searchItems',
210
+ description: 'Search items in a board using a filter',
211
+ action: 'Search items by filter',
212
+ },
213
+ {
214
+ name: 'List Item Subscribers',
215
+ value: 'listItemSubscribers',
216
+ description: 'List all subscribers of an item',
217
+ action: 'List item subscribers',
218
+ },
219
+ {
220
+ name: 'Upload a File to an Item Column',
221
+ value: 'uploadItemFile',
222
+ action: 'Upload a file to an item column',
223
+ },
224
+ {
225
+ name: 'Download Files From an Item Column',
226
+ value: 'downloadFilesFromItem',
227
+ action: 'Download files from an item column',
228
+ },
229
+ ],
230
+ default: 'createItem',
231
+ required: true,
232
+ displayOptions: {
233
+ show: { resource: ['item'] },
234
+ },
235
+ },
164
236
  {
165
237
  displayName: 'Operation',
166
238
  name: 'operation',
@@ -360,10 +432,12 @@ class Worktables {
360
432
  'addBoardSubscribers',
361
433
  'removeBoardSubscribers',
362
434
  'createItem',
435
+ 'updateItem',
363
436
  'duplicateItem',
364
437
  'searchItems',
365
438
  'uploadItemFile',
366
439
  'listUpdates',
440
+ 'createUpdate',
367
441
  ],
368
442
  },
369
443
  },
@@ -467,6 +541,7 @@ class Worktables {
467
541
  operation: [
468
542
  'getBoard',
469
543
  'createSubitem',
544
+ 'updateItem',
470
545
  'uploadFile',
471
546
  'listBoardGroups',
472
547
  'createGroup',
@@ -477,6 +552,7 @@ class Worktables {
477
552
  'addBoardSubscribers',
478
553
  'removeBoardSubscribers',
479
554
  'listUpdates',
555
+ 'createUpdate',
480
556
  ],
481
557
  },
482
558
  },
@@ -756,20 +832,7 @@ class Worktables {
756
832
  description: 'Select an item from the selected board. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
757
833
  displayOptions: {
758
834
  show: {
759
- operation: ['createSubitem', 'uploadFile', 'listUpdates'],
760
- },
761
- },
762
- },
763
- {
764
- displayName: 'Item',
765
- name: 'itemId',
766
- type: 'string',
767
- default: '',
768
- required: true,
769
- description: 'Select an item from the selected board. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
770
- displayOptions: {
771
- show: {
772
- operation: ['createUpdate'],
835
+ operation: ['updateItem', 'createSubitem', 'uploadFile', 'listUpdates', 'createUpdate'],
773
836
  },
774
837
  },
775
838
  },
@@ -901,6 +964,44 @@ class Worktables {
901
964
  default: '',
902
965
  description: 'If this is a subitem, specify the ID of the parent item. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
903
966
  },
967
+ {
968
+ displayName: 'Column Values',
969
+ name: 'columnValues',
970
+ type: 'fixedCollection',
971
+ typeOptions: { multipleValues: true },
972
+ default: [],
973
+ displayOptions: {
974
+ show: {
975
+ resource: ['item', 'subitem'],
976
+ operation: ['createItem', 'updateItem', 'createSubitem'],
977
+ },
978
+ },
979
+ options: [
980
+ {
981
+ displayName: 'Column Value',
982
+ name: 'columnValue',
983
+ values: [
984
+ {
985
+ displayName: 'Column',
986
+ name: 'columnId',
987
+ type: 'options',
988
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
989
+ typeOptions: {
990
+ loadOptionsDependsOn: ['boardId'],
991
+ loadOptionsMethod: 'getColumnsItems',
992
+ },
993
+ default: '',
994
+ },
995
+ {
996
+ displayName: 'New Value',
997
+ name: 'newValue',
998
+ type: 'string',
999
+ default: '',
1000
+ },
1001
+ ],
1002
+ },
1003
+ ],
1004
+ },
904
1005
  {
905
1006
  displayName: 'Column Values',
906
1007
  name: 'columnValuesUploadFile',
@@ -915,78 +1016,25 @@ class Worktables {
915
1016
  },
916
1017
  options: [
917
1018
  {
918
- displayName: 'Column Values',
919
- name: 'columnValues',
920
- type: 'fixedCollection',
921
- typeOptions: {
922
- multipleValues: true,
923
- },
924
- default: [],
925
- options: [
1019
+ displayName: 'Column Value',
1020
+ name: 'columnValuesUploadFile',
1021
+ values: [
926
1022
  {
927
- displayName: 'Value',
928
- name: 'value',
929
- values: [
930
- {
931
- displayName: 'Mode',
932
- name: 'mode',
933
- type: 'options',
934
- default: 'fromList',
935
- options: [
936
- {
937
- name: 'From list',
938
- value: 'fromList',
939
- },
940
- {
941
- name: 'Custom',
942
- value: 'custom',
943
- },
944
- ],
945
- },
946
- {
947
- displayName: 'Column',
948
- name: 'columnId',
949
- type: 'options',
950
- typeOptions: {
951
- loadOptionsDependsOn: ['boardId'],
952
- loadOptionsMethod: 'getColumnsItems',
953
- },
954
- displayOptions: {
955
- show: {
956
- mode: ['fromList'],
957
- },
958
- },
959
- default: '',
960
- },
961
- {
962
- displayName: 'Custom Column ID',
963
- name: 'customColumnId',
964
- type: 'string',
965
- displayOptions: {
966
- show: {
967
- mode: ['custom'],
968
- },
969
- },
970
- default: '',
971
- },
972
- {
973
- displayName: 'Custom Type',
974
- name: 'customType',
975
- type: 'string',
976
- displayOptions: {
977
- show: {
978
- mode: ['custom'],
979
- },
980
- },
981
- default: '',
982
- },
983
- {
984
- displayName: 'New Value',
985
- name: 'newValue',
986
- type: 'string',
987
- default: '',
988
- },
989
- ],
1023
+ displayName: 'Column',
1024
+ name: 'columnId',
1025
+ type: 'options',
1026
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
1027
+ typeOptions: {
1028
+ loadOptionsMethod: 'getColumnsFromBoard',
1029
+ },
1030
+ default: '',
1031
+ },
1032
+ {
1033
+ displayName: 'File Name',
1034
+ name: 'fileName',
1035
+ type: 'string',
1036
+ required: true,
1037
+ default: '',
990
1038
  },
991
1039
  ],
992
1040
  },
@@ -1308,7 +1356,6 @@ class Worktables {
1308
1356
  ],
1309
1357
  };
1310
1358
  this.methods = {
1311
- listSearch: { getItemSearchList: GenericFunctions_1.getItemSearchList, getBoardSearchList: GenericFunctions_1.getBoardSearchList, getColumnsItems: GenericFunctions_1.getColumnsItems },
1312
1359
  loadOptions: {
1313
1360
  async getWorkspaces() {
1314
1361
  const credentials = await this.getCredentials('WorktablesApi');
@@ -1428,9 +1475,8 @@ class Worktables {
1428
1475
  },
1429
1476
  async getGroupsFromBoard() {
1430
1477
  console.log('Getting Groups');
1431
- const boardId = this.getNodeParameter('boardId');
1432
- console.log('Board ID -> Groups: ', boardId === null || boardId === void 0 ? void 0 : boardId.value);
1433
- if (!(boardId === null || boardId === void 0 ? void 0 : boardId.value)) {
1478
+ const boardId = this.getCurrentNodeParameter('boardId');
1479
+ if (!boardId) {
1434
1480
  throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'Board ID is required.' });
1435
1481
  }
1436
1482
  const credentials = await this.getCredentials('WorktablesApi');
@@ -1446,7 +1492,7 @@ class Worktables {
1446
1492
  'Content-Type': 'application/json',
1447
1493
  },
1448
1494
  body: {
1449
- query: `query { boards(ids: ${boardId === null || boardId === void 0 ? void 0 : boardId.value} ) { groups { id title color position archived deleted} } }`,
1495
+ query: `query { boards(ids: ${boardId} ) { groups { id title color position archived deleted} } }`,
1450
1496
  },
1451
1497
  });
1452
1498
  const parsedResponse = JSON.parse(response);
@@ -1684,6 +1730,60 @@ class Worktables {
1684
1730
  value: subitem.id,
1685
1731
  }));
1686
1732
  },
1733
+ async getColumnsItems() {
1734
+ const boardId = this.getCurrentNodeParameter('boardId');
1735
+ const credentials = await this.getCredentials('WorktablesApi');
1736
+ const apiKey = credentials === null || credentials === void 0 ? void 0 : credentials.apiKey;
1737
+ const response = await this.helpers.request({
1738
+ method: 'POST',
1739
+ url: 'https://api.monday.com/v2',
1740
+ headers: {
1741
+ Authorization: `Bearer ${apiKey}`,
1742
+ 'Content-Type': 'application/json',
1743
+ },
1744
+ body: JSON.stringify({
1745
+ query: `query {
1746
+ boards(ids: ${boardId}) {
1747
+ columns {
1748
+ id
1749
+ title
1750
+ type
1751
+ }
1752
+ items_page {
1753
+ items {
1754
+ subitems {
1755
+ board {
1756
+ columns {
1757
+ id
1758
+ title
1759
+ type
1760
+ }
1761
+ }
1762
+ }
1763
+ }
1764
+ }
1765
+ }
1766
+ }`,
1767
+ }),
1768
+ });
1769
+ const parsedResponse = JSON.parse(response);
1770
+ return parsedResponse.data.boards[0].columns
1771
+ .filter((column) => column.type !== 'subitem' &&
1772
+ column.type !== 'auto_number' &&
1773
+ column.type !== 'button' &&
1774
+ column.type !== 'creation_log' &&
1775
+ column.type !== 'formula' &&
1776
+ column.type !== 'item_id' &&
1777
+ column.type !== 'last_updated' &&
1778
+ column.type !== 'progress' &&
1779
+ column.type !== 'subtasks')
1780
+ .map((column) => {
1781
+ return {
1782
+ name: column.title,
1783
+ value: column.id,
1784
+ };
1785
+ });
1786
+ },
1687
1787
  async getFolders() {
1688
1788
  const workspaceId = this.getNodeParameter('workspace');
1689
1789
  const credentials = await this.getCredentials('WorktablesApi');
@@ -3311,12 +3411,11 @@ class Worktables {
3311
3411
  }
3312
3412
  break;
3313
3413
  }
3314
- case 'updateValue': {
3315
- }
3316
3414
  default:
3317
3415
  throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: `Unsupported resource: ${resource}` });
3318
3416
  }
3319
3417
  response = await (0, isErrorResponse_1.parseApiResponse)(response);
3418
+ console.log('Response res: ', JSON.stringify(response, null, 2));
3320
3419
  if (response.success) {
3321
3420
  const parsed = JSON.parse(response.data);
3322
3421
  console.log('Parsed res: ', parsed);