@worktables/n8n-nodes-worktables 10.20.74 → 10.30.1

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',
@@ -359,11 +431,11 @@ class Worktables {
359
431
  'listBoardSubscribers',
360
432
  'addBoardSubscribers',
361
433
  'removeBoardSubscribers',
362
- 'createItem',
363
434
  'duplicateItem',
364
435
  'searchItems',
365
436
  'uploadItemFile',
366
437
  'listUpdates',
438
+ 'createUpdate',
367
439
  ],
368
440
  },
369
441
  },
@@ -467,6 +539,7 @@ class Worktables {
467
539
  operation: [
468
540
  'getBoard',
469
541
  'createSubitem',
542
+ 'updateItem',
470
543
  'uploadFile',
471
544
  'listBoardGroups',
472
545
  'createGroup',
@@ -477,6 +550,7 @@ class Worktables {
477
550
  'addBoardSubscribers',
478
551
  'removeBoardSubscribers',
479
552
  'listUpdates',
553
+ 'createUpdate',
480
554
  ],
481
555
  },
482
556
  },
@@ -756,20 +830,7 @@ class Worktables {
756
830
  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
831
  displayOptions: {
758
832
  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'],
833
+ operation: ['updateItem', 'createSubitem', 'uploadFile', 'listUpdates', 'createUpdate'],
773
834
  },
774
835
  },
775
836
  },
@@ -779,14 +840,13 @@ class Worktables {
779
840
  type: 'options',
780
841
  typeOptions: {
781
842
  loadOptionsMethod: 'getBoards',
782
- loadOptionsDependsOn: ['workspace'],
783
843
  },
784
844
  default: '',
785
845
  required: true,
786
846
  description: 'Select a Monday board. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
787
847
  displayOptions: {
788
848
  show: {
789
- operation: ['createItem', 'duplicateItem', 'searchItems', 'uploadItemFile'],
849
+ operation: ['duplicateItem', 'searchItems', 'uploadItemFile'],
790
850
  },
791
851
  },
792
852
  },
@@ -901,6 +961,44 @@ class Worktables {
901
961
  default: '',
902
962
  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
963
  },
964
+ {
965
+ displayName: 'Column Values',
966
+ name: 'columnValues',
967
+ type: 'fixedCollection',
968
+ typeOptions: { multipleValues: true },
969
+ default: [],
970
+ displayOptions: {
971
+ show: {
972
+ resource: ['item', 'subitem'],
973
+ operation: ['createItem', 'updateItem', 'createSubitem'],
974
+ },
975
+ },
976
+ options: [
977
+ {
978
+ displayName: 'Column Value',
979
+ name: 'columnValue',
980
+ values: [
981
+ {
982
+ displayName: 'Column',
983
+ name: 'columnId',
984
+ type: 'options',
985
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
986
+ typeOptions: {
987
+ loadOptionsDependsOn: ['boardId'],
988
+ loadOptionsMethod: 'getColumnsItems',
989
+ },
990
+ default: '',
991
+ },
992
+ {
993
+ displayName: 'New Value',
994
+ name: 'newValue',
995
+ type: 'string',
996
+ default: '',
997
+ },
998
+ ],
999
+ },
1000
+ ],
1001
+ },
904
1002
  {
905
1003
  displayName: 'Column Values',
906
1004
  name: 'columnValuesUploadFile',
@@ -915,78 +1013,25 @@ class Worktables {
915
1013
  },
916
1014
  options: [
917
1015
  {
918
- displayName: 'Column Values',
919
- name: 'columnValues',
920
- type: 'fixedCollection',
921
- typeOptions: {
922
- multipleValues: true,
923
- },
924
- default: [],
925
- options: [
1016
+ displayName: 'Column Value',
1017
+ name: 'columnValuesUploadFile',
1018
+ values: [
926
1019
  {
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
- ],
1020
+ displayName: 'Column',
1021
+ name: 'columnId',
1022
+ type: 'options',
1023
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
1024
+ typeOptions: {
1025
+ loadOptionsMethod: 'getColumnsFromBoard',
1026
+ },
1027
+ default: '',
1028
+ },
1029
+ {
1030
+ displayName: 'File Name',
1031
+ name: 'fileName',
1032
+ type: 'string',
1033
+ required: true,
1034
+ default: '',
990
1035
  },
991
1036
  ],
992
1037
  },
@@ -1308,7 +1353,6 @@ class Worktables {
1308
1353
  ],
1309
1354
  };
1310
1355
  this.methods = {
1311
- listSearch: { getItemSearchList: GenericFunctions_1.getItemSearchList, getBoardSearchList: GenericFunctions_1.getBoardSearchList, getColumnsItems: GenericFunctions_1.getColumnsItems },
1312
1356
  loadOptions: {
1313
1357
  async getWorkspaces() {
1314
1358
  const credentials = await this.getCredentials('WorktablesApi');
@@ -1362,8 +1406,7 @@ class Worktables {
1362
1406
  const allBoards = [];
1363
1407
  let page = 1;
1364
1408
  let hasMore = true;
1365
- const queryLimit = limit === 0 || !limit ? 100 : limit;
1366
- const workspaceFilter = workspaceId === '-1' ? 'workspace_ids: [null]' : `workspace_ids: [${workspaceId}]`;
1409
+ const queryLimit = 100;
1367
1410
  const orderByFilter = orderBy === 'none' || !orderBy ? '' : `, order_by: ${orderBy}`;
1368
1411
  const boardKindFilter = boardKind === 'all' || !boardKind ? '' : `, board_kind: ${boardKind}`;
1369
1412
  const query = JSON.stringify({
@@ -1371,7 +1414,6 @@ class Worktables {
1371
1414
  boards(
1372
1415
  limit: ${queryLimit},
1373
1416
  page: ${page},
1374
- ${workspaceFilter},
1375
1417
  state: ${state ? state : 'active'}
1376
1418
  ${orderByFilter}
1377
1419
  ${boardKindFilter}
@@ -1389,7 +1431,6 @@ class Worktables {
1389
1431
  boards(
1390
1432
  limit: ${queryLimit},
1391
1433
  page: ${page},
1392
- ${workspaceFilter},
1393
1434
  state: ${state ? state : 'active'}
1394
1435
  ${orderByFilter}
1395
1436
  ${boardKindFilter}
@@ -1428,9 +1469,8 @@ class Worktables {
1428
1469
  },
1429
1470
  async getGroupsFromBoard() {
1430
1471
  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)) {
1472
+ const boardId = this.getCurrentNodeParameter('boardId');
1473
+ if (!boardId) {
1434
1474
  throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'Board ID is required.' });
1435
1475
  }
1436
1476
  const credentials = await this.getCredentials('WorktablesApi');
@@ -1446,7 +1486,7 @@ class Worktables {
1446
1486
  'Content-Type': 'application/json',
1447
1487
  },
1448
1488
  body: {
1449
- query: `query { boards(ids: ${boardId === null || boardId === void 0 ? void 0 : boardId.value} ) { groups { id title color position archived deleted} } }`,
1489
+ query: `query { boards(ids: ${boardId} ) { groups { id title color position archived deleted} } }`,
1450
1490
  },
1451
1491
  });
1452
1492
  const parsedResponse = JSON.parse(response);
@@ -1684,6 +1724,60 @@ class Worktables {
1684
1724
  value: subitem.id,
1685
1725
  }));
1686
1726
  },
1727
+ async getColumnsItems() {
1728
+ const boardId = this.getCurrentNodeParameter('boardId');
1729
+ const credentials = await this.getCredentials('WorktablesApi');
1730
+ const apiKey = credentials === null || credentials === void 0 ? void 0 : credentials.apiKey;
1731
+ const response = await this.helpers.request({
1732
+ method: 'POST',
1733
+ url: 'https://api.monday.com/v2',
1734
+ headers: {
1735
+ Authorization: `Bearer ${apiKey}`,
1736
+ 'Content-Type': 'application/json',
1737
+ },
1738
+ body: JSON.stringify({
1739
+ query: `query {
1740
+ boards(ids: ${boardId}) {
1741
+ columns {
1742
+ id
1743
+ title
1744
+ type
1745
+ }
1746
+ items_page {
1747
+ items {
1748
+ subitems {
1749
+ board {
1750
+ columns {
1751
+ id
1752
+ title
1753
+ type
1754
+ }
1755
+ }
1756
+ }
1757
+ }
1758
+ }
1759
+ }
1760
+ }`,
1761
+ }),
1762
+ });
1763
+ const parsedResponse = JSON.parse(response);
1764
+ return parsedResponse.data.boards[0].columns
1765
+ .filter((column) => column.type !== 'subitem' &&
1766
+ column.type !== 'auto_number' &&
1767
+ column.type !== 'button' &&
1768
+ column.type !== 'creation_log' &&
1769
+ column.type !== 'formula' &&
1770
+ column.type !== 'item_id' &&
1771
+ column.type !== 'last_updated' &&
1772
+ column.type !== 'progress' &&
1773
+ column.type !== 'subtasks')
1774
+ .map((column) => {
1775
+ return {
1776
+ name: column.title,
1777
+ value: column.id,
1778
+ };
1779
+ });
1780
+ },
1687
1781
  async getFolders() {
1688
1782
  const workspaceId = this.getNodeParameter('workspace');
1689
1783
  const credentials = await this.getCredentials('WorktablesApi');
@@ -3311,12 +3405,11 @@ class Worktables {
3311
3405
  }
3312
3406
  break;
3313
3407
  }
3314
- case 'updateValue': {
3315
- }
3316
3408
  default:
3317
3409
  throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: `Unsupported resource: ${resource}` });
3318
3410
  }
3319
3411
  response = await (0, isErrorResponse_1.parseApiResponse)(response);
3412
+ console.log('Response res: ', JSON.stringify(response, null, 2));
3320
3413
  if (response.success) {
3321
3414
  const parsed = JSON.parse(response.data);
3322
3415
  console.log('Parsed res: ', parsed);