@worktables/n8n-nodes-worktables 12.2.15 → 12.2.16

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.
@@ -962,20 +962,6 @@ class Worktables {
962
962
  show: { operation: ['getGroup', 'listGroupItems'] },
963
963
  },
964
964
  },
965
- {
966
- displayName: 'Limit',
967
- name: 'limit',
968
- type: 'number',
969
- typeOptions: {
970
- minValue: 0,
971
- },
972
- default: 50,
973
- description: 'Max number of results to return',
974
- hint: 'If 0 is provided, all items will be returned',
975
- displayOptions: {
976
- show: { operation: ['listGroupItems'] },
977
- },
978
- },
979
965
  {
980
966
  displayName: 'Position Relative',
981
967
  name: 'positionRelative',
@@ -1067,50 +1053,49 @@ class Worktables {
1067
1053
  },
1068
1054
  },
1069
1055
  {
1070
- displayName: 'Item ID',
1071
- name: 'itemId',
1072
- type: 'string',
1073
- default: '',
1074
- required: true,
1075
- description: 'Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
1056
+ displayName: 'Is Subitem',
1057
+ name: 'isSubitem',
1058
+ type: 'boolean',
1059
+ default: false,
1060
+ description: 'Whether a subitem',
1076
1061
  displayOptions: {
1077
1062
  show: {
1078
- operation: ['getItem', 'deleteItem'],
1063
+ operation: ['getItem'],
1079
1064
  },
1080
1065
  },
1081
1066
  },
1082
1067
  {
1083
- displayName: 'Fetch All Columns',
1084
- name: 'fetchAllColumns',
1068
+ displayName: 'Fetch Subitems',
1069
+ name: 'fetchSubitems',
1085
1070
  type: 'boolean',
1086
- default: true,
1087
- description: 'Whether to fetch all columns or only specific ones',
1071
+ default: false,
1072
+ description: 'Whether to fetch subitems',
1088
1073
  displayOptions: {
1089
1074
  show: {
1090
1075
  operation: ['getItem'],
1076
+ isSubitem: [false],
1091
1077
  },
1092
1078
  },
1093
1079
  },
1094
1080
  {
1095
- displayName: 'Column IDs',
1096
- name: 'columnIds',
1097
- type: 'string',
1098
- default: '',
1099
- required: false,
1100
- description: 'Comma-separated list of column IDs to fetch (e.g., text, number, date). Only used when "Fetch All Columns" is disabled.',
1081
+ displayName: 'Fetch Parent Item',
1082
+ name: 'fetchParentItems',
1083
+ type: 'boolean',
1084
+ default: false,
1085
+ description: 'Whether to fetch parent item',
1101
1086
  displayOptions: {
1102
1087
  show: {
1103
1088
  operation: ['getItem'],
1104
- fetchAllColumns: [false],
1089
+ isSubitem: [true],
1105
1090
  },
1106
1091
  },
1107
1092
  },
1108
1093
  {
1109
- displayName: 'Is Subitem',
1110
- name: 'isSubitem',
1094
+ displayName: 'Fetch All Columns',
1095
+ name: 'fetchAllColumns',
1111
1096
  type: 'boolean',
1112
- default: false,
1113
- description: 'Whether a subitem',
1097
+ default: true,
1098
+ description: 'Whether to fetch all columns or only specific ones',
1114
1099
  displayOptions: {
1115
1100
  show: {
1116
1101
  operation: ['getItem'],
@@ -1118,28 +1103,29 @@ class Worktables {
1118
1103
  },
1119
1104
  },
1120
1105
  {
1121
- displayName: 'Fetch Subitems',
1122
- name: 'fetchSubitems',
1123
- type: 'boolean',
1124
- default: false,
1125
- description: 'Whether to fetch subitems',
1106
+ displayName: 'Column IDs',
1107
+ name: 'columnIds',
1108
+ type: 'string',
1109
+ default: '',
1110
+ required: false,
1111
+ description: 'Comma-separated list of column IDs to fetch (e.g., text, number, date). Only used when "Fetch All Columns" is disabled.',
1126
1112
  displayOptions: {
1127
1113
  show: {
1128
1114
  operation: ['getItem'],
1129
- isSubitem: [false],
1115
+ fetchAllColumns: [false],
1130
1116
  },
1131
1117
  },
1132
1118
  },
1133
1119
  {
1134
- displayName: 'Fetch Parent Item',
1135
- name: 'fetchParentItems',
1136
- type: 'boolean',
1137
- default: false,
1138
- description: 'Whether to fetch parent item',
1120
+ displayName: 'Item ID',
1121
+ name: 'itemId',
1122
+ type: 'string',
1123
+ default: '',
1124
+ required: true,
1125
+ description: 'Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
1139
1126
  displayOptions: {
1140
1127
  show: {
1141
- operation: ['getItem'],
1142
- isSubitem: [true],
1128
+ operation: ['getItem', 'deleteItem'],
1143
1129
  },
1144
1130
  },
1145
1131
  },
@@ -2777,7 +2763,7 @@ class Worktables {
2777
2763
  };
2778
2764
  }
2779
2765
  async execute() {
2780
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26;
2766
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27;
2781
2767
  const resource = this.getNodeParameter('resource', 0);
2782
2768
  const operation = this.getNodeParameter('operation', 0);
2783
2769
  const credentials = await this.getCredentials('WorktablesApi');
@@ -5120,84 +5106,62 @@ class Worktables {
5120
5106
  case 'listGroupItems': {
5121
5107
  const boardId = this.getNodeParameter('boardId', 0);
5122
5108
  const groupId = this.getNodeParameter('groupId', 0);
5123
- const limit = this.getNodeParameter('limit', 0);
5124
5109
  if (!boardId || !groupId) {
5125
5110
  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
5126
5111
  message: 'Board ID and Group ID are required.',
5127
5112
  });
5128
5113
  }
5129
- const allItems = [];
5130
- let cursor = null;
5131
- const queryLimit = limit === 0 ? 100 : limit;
5132
- let hasMore = true;
5133
- let totalFetched = 0;
5134
- while (hasMore) {
5135
- const cursorParam = cursor ? `, cursor: "${cursor}"` : '';
5136
- const currentLimit = limit === 0 ? 100 : Math.min(queryLimit - totalFetched, 100);
5137
- const query = `
5138
- query {
5139
- boards (ids: [${boardId}]) {
5140
- groups (ids: "${groupId}") {
5141
- items_page(limit: ${currentLimit}${cursorParam}) {
5142
- items {
5114
+ const query = `
5115
+ query {
5116
+ boards (ids: [${boardId}]) {
5117
+ groups (ids: "${groupId}") {
5118
+ items_page {
5119
+ items {
5120
+ id
5121
+ name
5122
+ url
5123
+ board {
5143
5124
  id
5144
- name
5145
- url
5146
- board {
5147
- id
5148
- }
5149
- group {
5150
- id
5151
- title
5152
- color
5153
- position
5125
+ }
5126
+ group {
5127
+ id
5128
+ title
5129
+ color
5130
+ position
5131
+ }
5132
+ column_values {
5133
+ id
5134
+ text
5135
+ value
5136
+ type
5137
+ ... on BoardRelationValue {
5138
+ display_value
5139
+ linked_item_ids
5154
5140
  }
5155
- column_values {
5156
- id
5157
- text
5158
- value
5159
- type
5160
- ... on BoardRelationValue {
5161
- display_value
5162
- linked_item_ids
5163
- }
5164
- ... on MirrorValue {
5165
- display_value
5166
- mirrored_items {
5167
- linked_board_id
5168
- }
5141
+ ... on MirrorValue {
5142
+ display_value
5143
+ mirrored_items {
5144
+ linked_board_id
5169
5145
  }
5170
5146
  }
5171
- created_at
5172
- updated_at
5173
5147
  }
5174
- cursor
5148
+ created_at
5149
+ updated_at
5175
5150
  }
5176
5151
  }
5177
5152
  }
5178
5153
  }
5179
- `;
5180
- const rawResponse = await this.helpers.request({
5181
- method: 'POST',
5182
- url: 'https://api.monday.com/v2',
5183
- headers,
5184
- body: { query },
5185
- });
5186
- const parsed = JSON.parse(rawResponse);
5187
- const itemsPage = (_19 = (_18 = (_17 = (_16 = (_15 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _15 === void 0 ? void 0 : _15.boards) === null || _16 === void 0 ? void 0 : _16[0]) === null || _17 === void 0 ? void 0 : _17.groups) === null || _18 === void 0 ? void 0 : _18[0]) === null || _19 === void 0 ? void 0 : _19.items_page;
5188
- const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
5189
- cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
5190
- allItems.push(...items);
5191
- totalFetched += items.length;
5192
- if (limit === 0) {
5193
- hasMore = cursor !== null && items.length > 0;
5194
- }
5195
- else {
5196
- hasMore = totalFetched < limit && cursor !== null && items.length > 0;
5197
- }
5198
- }
5199
- const itemsToFormat = limit === 0 ? allItems : allItems.slice(0, limit);
5200
- const formattedItems = await Promise.all(itemsToFormat.map(async (item) => {
5154
+ }
5155
+ `;
5156
+ const rawResponse = await this.helpers.request({
5157
+ method: 'POST',
5158
+ url: 'https://api.monday.com/v2',
5159
+ headers,
5160
+ body: { query },
5161
+ });
5162
+ const parsed = JSON.parse(rawResponse);
5163
+ const items = ((_20 = (_19 = (_18 = (_17 = (_16 = (_15 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _15 === void 0 ? void 0 : _15.boards) === null || _16 === void 0 ? void 0 : _16[0]) === null || _17 === void 0 ? void 0 : _17.groups) === null || _18 === void 0 ? void 0 : _18[0]) === null || _19 === void 0 ? void 0 : _19.items_page) === null || _20 === void 0 ? void 0 : _20.items) || [];
5164
+ const formattedItems = await Promise.all(items.map(async (item) => {
5201
5165
  const columnValues = item.column_values || [];
5202
5166
  const formatted = {
5203
5167
  id: item.id,
@@ -5280,8 +5244,16 @@ class Worktables {
5280
5244
  response = await (0, isErrorResponse_1.parseApiResponse)(response);
5281
5245
  if (response.success) {
5282
5246
  const parsed = JSON.parse(response.data);
5283
- const updates = ((_22 = (_21 = (_20 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _20 === void 0 ? void 0 : _20.items) === null || _21 === void 0 ? void 0 : _21[0]) === null || _22 === void 0 ? void 0 : _22.updates) || [];
5284
- return [updates.map((update) => ({ json: update }))];
5247
+ const updates = ((_23 = (_22 = (_21 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _21 === void 0 ? void 0 : _21.items) === null || _22 === void 0 ? void 0 : _22[0]) === null || _23 === void 0 ? void 0 : _23.updates) || [];
5248
+ const formattedUpdates = updates.map((update) => {
5249
+ const pinnedToTop = update.pinned_to_top || [];
5250
+ const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
5251
+ return {
5252
+ ...update,
5253
+ pinned_to_top: isPinnedToTop,
5254
+ };
5255
+ });
5256
+ return [formattedUpdates.map((update) => ({ json: update }))];
5285
5257
  }
5286
5258
  else {
5287
5259
  const parsed = JSON.parse(response.data);
@@ -5337,7 +5309,7 @@ class Worktables {
5337
5309
  console.log('variables:', variables);
5338
5310
  response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
5339
5311
  console.log('Create Update Result:', JSON.stringify(response, null, 2));
5340
- const updateId = (_24 = (_23 = JSON.parse(response).data) === null || _23 === void 0 ? void 0 : _23.create_update) === null || _24 === void 0 ? void 0 : _24.id;
5312
+ const updateId = (_25 = (_24 = JSON.parse(response).data) === null || _24 === void 0 ? void 0 : _24.create_update) === null || _25 === void 0 ? void 0 : _25.id;
5341
5313
  if (!updateId) {
5342
5314
  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
5343
5315
  message: 'Error creating update: Update not created, no ID returned',
@@ -5643,7 +5615,7 @@ class Worktables {
5643
5615
  body: { query },
5644
5616
  json: true,
5645
5617
  });
5646
- const asset = (_26 = (_25 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _25 === void 0 ? void 0 : _25.assets) === null || _26 === void 0 ? void 0 : _26[0];
5618
+ const asset = (_27 = (_26 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _26 === void 0 ? void 0 : _26.assets) === null || _27 === void 0 ? void 0 : _27[0];
5647
5619
  if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
5648
5620
  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
5649
5621
  message: 'Public URL not found for the given file ID.',