@worktables/n8n-nodes-worktables 12.2.17 → 12.2.19

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.
@@ -627,6 +627,19 @@ class Worktables {
627
627
  },
628
628
  },
629
629
  },
630
+ {
631
+ displayName: 'Is Subitem?',
632
+ name: 'isSubitem',
633
+ type: 'boolean',
634
+ default: false,
635
+ description: 'Whether the item is a subitem',
636
+ displayOptions: {
637
+ show: {
638
+ resource: ['item'],
639
+ operation: ['createItem', 'createOrUpdateItem'],
640
+ },
641
+ },
642
+ },
630
643
  {
631
644
  displayName: 'Board to Duplicate',
632
645
  name: 'boardId',
@@ -995,11 +1008,27 @@ class Worktables {
995
1008
  },
996
1009
  },
997
1010
  {
998
- displayName: 'Item ID (Optional)',
1011
+ displayName: 'Identifier Column',
1012
+ name: 'identifierColumn',
1013
+ type: 'options',
1014
+ typeOptions: {
1015
+ loadOptionsDependsOn: ['boardId'],
1016
+ loadOptionsMethod: 'getColumnsItems',
1017
+ },
1018
+ default: '',
1019
+ description: 'Select the column to use as identifier for finding/updating items. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
1020
+ displayOptions: {
1021
+ show: {
1022
+ operation: ['createOrUpdateItem'],
1023
+ },
1024
+ },
1025
+ },
1026
+ {
1027
+ displayName: 'Identifier Value',
999
1028
  name: 'itemIdOptional',
1000
1029
  type: 'string',
1001
1030
  default: '',
1002
- description: 'Item ID to update. If left empty, a new item will be created. If provided, the existing item will be updated.',
1031
+ description: 'Value in the identifier column to find the item. If left empty, a new item will be created. If provided, the existing item with matching identifier value will be updated.',
1003
1032
  displayOptions: {
1004
1033
  show: {
1005
1034
  operation: ['createOrUpdateItem'],
@@ -1141,6 +1170,18 @@ class Worktables {
1141
1170
  },
1142
1171
  },
1143
1172
  },
1173
+ {
1174
+ displayName: 'For item creation',
1175
+ name: 'forItemCreation',
1176
+ type: 'notice',
1177
+ default: '',
1178
+ displayOptions: {
1179
+ show: {
1180
+ resource: ['item'],
1181
+ operation: ['createOrUpdateItem'],
1182
+ },
1183
+ },
1184
+ },
1144
1185
  {
1145
1186
  displayName: 'Item Name',
1146
1187
  name: 'itemName',
@@ -1155,15 +1196,20 @@ class Worktables {
1155
1196
  },
1156
1197
  },
1157
1198
  {
1158
- displayName: 'Is Subitem?',
1159
- name: 'isSubitem',
1160
- type: 'boolean',
1161
- default: false,
1162
- description: 'Whether the item is a subitem',
1199
+ displayName: 'Group Name',
1200
+ name: 'groupName',
1201
+ type: 'options',
1202
+ typeOptions: {
1203
+ loadOptionsDependsOn: ['boardId'],
1204
+ loadOptionsMethod: 'getGroupsFromBoard',
1205
+ },
1206
+ default: '',
1207
+ description: 'Select the group where the item will be created. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
1163
1208
  displayOptions: {
1164
1209
  show: {
1165
1210
  resource: ['item'],
1166
- operation: ['createItem', 'createOrUpdateItem'],
1211
+ operation: ['createOrUpdateItem'],
1212
+ isSubitem: [false],
1167
1213
  },
1168
1214
  },
1169
1215
  },
@@ -2763,7 +2809,7 @@ class Worktables {
2763
2809
  };
2764
2810
  }
2765
2811
  async execute() {
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;
2812
+ 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, _28, _29, _30, _31, _32;
2767
2813
  const resource = this.getNodeParameter('resource', 0);
2768
2814
  const operation = this.getNodeParameter('operation', 0);
2769
2815
  const credentials = await this.getCredentials('WorktablesApi');
@@ -4138,7 +4184,9 @@ class Worktables {
4138
4184
  const itemName = this.getNodeParameter('itemName', 0);
4139
4185
  const boardId = this.getNodeParameter('boardId', 0);
4140
4186
  const isSubitem = this.getNodeParameter('isSubitem', 0);
4141
- const itemIdOptional = this.getNodeParameter('itemIdOptional', 0, false);
4187
+ const identifierColumn = this.getNodeParameter('identifierColumn', 0, '');
4188
+ const identifierValue = this.getNodeParameter('itemIdOptional', 0, false);
4189
+ const groupName = this.getNodeParameter('groupName', 0, '');
4142
4190
  const raw = this.getNodeParameter('columnValues', 0);
4143
4191
  const columnValues = raw.column;
4144
4192
  let column_values_object = {};
@@ -4275,50 +4323,159 @@ class Worktables {
4275
4323
  let mutation;
4276
4324
  let formatted;
4277
4325
  let itemUpdated = false;
4278
- if (itemIdOptional && itemIdOptional.trim() !== '') {
4279
- console.log('Attempting to update existing item:', itemIdOptional);
4280
- const escapedColumnValues = (0, worktablesHelpers_1.escapeGraphQLJSONString)(column_values_object);
4281
- mutation = `mutation {
4282
- change_multiple_column_values(
4283
- create_labels_if_missing: true,
4284
- board_id: ${boardId},
4285
- item_id: "${itemIdOptional}",
4286
- column_values: "${escapedColumnValues}"
4287
- ) {
4288
- id
4289
- url
4290
- board {
4326
+ let foundItemId = null;
4327
+ if (identifierValue && identifierValue.trim() !== '' && identifierColumn && identifierColumn.trim() !== '') {
4328
+ console.log('Searching for item/subitem with identifier column:', identifierColumn, 'value:', identifierValue, 'isSubitem:', isSubitem);
4329
+ let cursor = null;
4330
+ let hasMore = true;
4331
+ while (hasMore && !foundItemId) {
4332
+ const cursorParam = cursor ? `, cursor: "${cursor}"` : '';
4333
+ const searchQuery = isSubitem
4334
+ ? `query {
4335
+ boards(ids: [${boardId}]) {
4336
+ items_page(limit: 100${cursorParam}) {
4337
+ items {
4338
+ id
4339
+ subitems {
4340
+ id
4341
+ column_values(ids: ["${identifierColumn}"]) {
4342
+ id
4343
+ text
4344
+ value
4345
+ }
4346
+ }
4347
+ }
4348
+ cursor
4349
+ }
4350
+ }
4351
+ }`
4352
+ : `query {
4353
+ boards(ids: [${boardId}]) {
4354
+ items_page(limit: 100${cursorParam}) {
4355
+ items {
4356
+ id
4357
+ column_values(ids: ["${identifierColumn}"]) {
4358
+ id
4359
+ text
4360
+ value
4361
+ }
4362
+ }
4363
+ cursor
4364
+ }
4365
+ }
4366
+ }`;
4367
+ const searchResponse = await this.helpers.request({
4368
+ method: 'POST',
4369
+ url: 'https://api.monday.com/v2',
4370
+ headers,
4371
+ body: { query: searchQuery },
4372
+ });
4373
+ const searchData = JSON.parse(searchResponse);
4374
+ const itemsPage = (_z = (_y = (_x = searchData === null || searchData === void 0 ? void 0 : searchData.data) === null || _x === void 0 ? void 0 : _x.boards) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.items_page;
4375
+ const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
4376
+ cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
4377
+ if (isSubitem) {
4378
+ for (const item of items) {
4379
+ if (item.subitems && Array.isArray(item.subitems)) {
4380
+ for (const subitem of item.subitems) {
4381
+ const colValue = (_0 = subitem.column_values) === null || _0 === void 0 ? void 0 : _0.find((cv) => cv.id === identifierColumn);
4382
+ if (colValue) {
4383
+ let colText = colValue.text || '';
4384
+ let colValueStr = '';
4385
+ try {
4386
+ if (colValue.value) {
4387
+ const parsedValue = JSON.parse(colValue.value);
4388
+ colValueStr = (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.text) || (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.value) || String(parsedValue);
4389
+ }
4390
+ }
4391
+ catch {
4392
+ colValueStr = colValue.value || '';
4393
+ }
4394
+ if (colText === identifierValue || colValueStr === identifierValue ||
4395
+ colText.trim() === identifierValue.trim() || colValueStr.trim() === identifierValue.trim()) {
4396
+ foundItemId = subitem.id;
4397
+ break;
4398
+ }
4399
+ }
4400
+ }
4401
+ if (foundItemId)
4402
+ break;
4403
+ }
4404
+ }
4405
+ }
4406
+ else {
4407
+ for (const item of items) {
4408
+ const colValue = (_1 = item.column_values) === null || _1 === void 0 ? void 0 : _1.find((cv) => cv.id === identifierColumn);
4409
+ if (colValue) {
4410
+ let colText = colValue.text || '';
4411
+ let colValueStr = '';
4412
+ try {
4413
+ if (colValue.value) {
4414
+ const parsedValue = JSON.parse(colValue.value);
4415
+ colValueStr = (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.text) || (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.value) || String(parsedValue);
4416
+ }
4417
+ }
4418
+ catch {
4419
+ colValueStr = colValue.value || '';
4420
+ }
4421
+ if (colText === identifierValue || colValueStr === identifierValue ||
4422
+ colText.trim() === identifierValue.trim() || colValueStr.trim() === identifierValue.trim()) {
4423
+ foundItemId = item.id;
4424
+ break;
4425
+ }
4426
+ }
4427
+ }
4428
+ }
4429
+ hasMore = cursor !== null && items.length > 0 && !foundItemId;
4430
+ }
4431
+ if (foundItemId) {
4432
+ console.log(`Found existing ${isSubitem ? 'subitem' : 'item'}, updating:`, foundItemId);
4433
+ const escapedColumnValues = (0, worktablesHelpers_1.escapeGraphQLJSONString)(column_values_object);
4434
+ mutation = `mutation {
4435
+ change_multiple_column_values(
4436
+ create_labels_if_missing: true,
4437
+ board_id: ${boardId},
4438
+ item_id: "${foundItemId}",
4439
+ column_values: "${escapedColumnValues}"
4440
+ ) {
4291
4441
  id
4442
+ url
4443
+ board {
4444
+ id
4445
+ }
4292
4446
  }
4293
- }
4294
- }`;
4295
- console.log('Generated Update Mutation:', mutation);
4296
- response = await this.helpers.request({
4297
- method: 'POST',
4298
- url: 'https://api.monday.com/v2',
4299
- headers,
4300
- body: { query: mutation },
4301
- });
4302
- const responseData = JSON.parse(response);
4303
- if (!responseData.errors && responseData.data && responseData.data.change_multiple_column_values) {
4304
- const itemData = responseData.data.change_multiple_column_values;
4305
- if (itemData && itemData.id) {
4306
- formatted = {
4307
- id: itemData.id,
4308
- url: itemData.url,
4309
- operation: 'update',
4310
- board_id: itemData.board.id,
4311
- column_values: column_values_object,
4312
- };
4313
- itemUpdated = true;
4447
+ }`;
4448
+ console.log('Generated Update Mutation:', mutation);
4449
+ response = await this.helpers.request({
4450
+ method: 'POST',
4451
+ url: 'https://api.monday.com/v2',
4452
+ headers,
4453
+ body: { query: mutation },
4454
+ });
4455
+ const responseData = JSON.parse(response);
4456
+ if (!responseData.errors && responseData.data && responseData.data.change_multiple_column_values) {
4457
+ const itemData = responseData.data.change_multiple_column_values;
4458
+ if (itemData && itemData.id) {
4459
+ formatted = {
4460
+ id: itemData.id,
4461
+ url: itemData.url,
4462
+ operation: 'update',
4463
+ board_id: itemData.board.id,
4464
+ column_values: column_values_object,
4465
+ };
4466
+ itemUpdated = true;
4467
+ }
4468
+ }
4469
+ if (!itemUpdated) {
4470
+ console.log(`Error updating ${isSubitem ? 'subitem' : 'item'}, creating new ${isSubitem ? 'subitem' : 'item'} instead`);
4314
4471
  }
4315
4472
  }
4316
- if (!itemUpdated) {
4317
- console.log('Item not found or error occurred, creating new item instead');
4473
+ else {
4474
+ console.log(`${isSubitem ? 'Subitem' : 'Item'} not found with identifier value, will create new ${isSubitem ? 'subitem' : 'item'}`);
4318
4475
  }
4319
4476
  }
4320
4477
  if (!itemUpdated) {
4321
- console.log('Creating new item:', itemName);
4478
+ console.log(`Creating new ${isSubitem ? 'subitem' : 'item'}:`, itemName);
4322
4479
  const parentId = this.getNodeParameter('parentId', 0, false);
4323
4480
  const escapedItemName = (0, worktablesHelpers_1.escapeGraphQLString)(itemName);
4324
4481
  const escapedColumnValues = (0, worktablesHelpers_1.escapeGraphQLJSONString)(column_values_object);
@@ -4339,9 +4496,12 @@ class Worktables {
4339
4496
  }`;
4340
4497
  }
4341
4498
  else {
4499
+ const finalGroupId = groupName || 'topics';
4500
+ const escapedFinalGroupId = (0, worktablesHelpers_1.escapeGraphQLString)(finalGroupId);
4342
4501
  mutation = `mutation {
4343
4502
  create_item(
4344
4503
  board_id: ${boardId},
4504
+ group_id: "${escapedFinalGroupId}",
4345
4505
  item_name: "${escapedItemName}",
4346
4506
  column_values: "${escapedColumnValues}"
4347
4507
  ) {
@@ -4508,7 +4668,7 @@ class Worktables {
4508
4668
  body: { query },
4509
4669
  });
4510
4670
  const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
4511
- const itemsPage = (_z = (_y = (_x = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _x === void 0 ? void 0 : _x.boards) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.items_page;
4671
+ const itemsPage = (_4 = (_3 = (_2 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _2 === void 0 ? void 0 : _2.boards) === null || _3 === void 0 ? void 0 : _3[0]) === null || _4 === void 0 ? void 0 : _4.items_page;
4512
4672
  const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
4513
4673
  cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
4514
4674
  allItems = allItems.concat(items);
@@ -4588,7 +4748,7 @@ class Worktables {
4588
4748
  const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
4589
4749
  const logicalOperator = this.getNodeParameter('logicalOperator', 0);
4590
4750
  let rulesArray = [];
4591
- if (((_0 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _0 === void 0 ? void 0 : _0.length) > 0) {
4751
+ if (((_5 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _5 === void 0 ? void 0 : _5.length) > 0) {
4592
4752
  rulesArray = filterRules.rule.map((rule) => {
4593
4753
  let formattedValue;
4594
4754
  if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
@@ -4632,7 +4792,7 @@ class Worktables {
4632
4792
  });
4633
4793
  }
4634
4794
  const orderByArray = [];
4635
- if (((_1 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _1 === void 0 ? void 0 : _1.length) > 0) {
4795
+ if (((_6 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _6 === void 0 ? void 0 : _6.length) > 0) {
4636
4796
  sortOptions.sortBy.forEach((sort) => {
4637
4797
  orderByArray.push(`{
4638
4798
  column_id: "${sort.columnId}",
@@ -4678,7 +4838,7 @@ class Worktables {
4678
4838
  body: { query },
4679
4839
  });
4680
4840
  const parsed = JSON.parse(rawResponse);
4681
- const items = ((_5 = (_4 = (_3 = (_2 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _2 === void 0 ? void 0 : _2.boards) === null || _3 === void 0 ? void 0 : _3[0]) === null || _4 === void 0 ? void 0 : _4.items_page) === null || _5 === void 0 ? void 0 : _5.items) || [];
4841
+ const items = ((_10 = (_9 = (_8 = (_7 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _7 === void 0 ? void 0 : _7.boards) === null || _8 === void 0 ? void 0 : _8[0]) === null || _9 === void 0 ? void 0 : _9.items_page) === null || _10 === void 0 ? void 0 : _10.items) || [];
4682
4842
  const formattedItems = await Promise.all(items.map(async (item) => {
4683
4843
  const formatted = {
4684
4844
  id: item.id,
@@ -4712,7 +4872,7 @@ class Worktables {
4712
4872
  const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
4713
4873
  const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
4714
4874
  let rulesArray = [];
4715
- if (((_6 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _6 === void 0 ? void 0 : _6.length) > 0) {
4875
+ if (((_11 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _11 === void 0 ? void 0 : _11.length) > 0) {
4716
4876
  console.log('Processing filter rules:', advancedFilterRules.rule);
4717
4877
  rulesArray = advancedFilterRules.rule.map((rule) => {
4718
4878
  let formattedValue;
@@ -4928,7 +5088,7 @@ class Worktables {
4928
5088
  });
4929
5089
  }
4930
5090
  const orderByArray = [];
4931
- if (((_7 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _7 === void 0 ? void 0 : _7.length) > 0) {
5091
+ if (((_12 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _12 === void 0 ? void 0 : _12.length) > 0) {
4932
5092
  advancedSortOptions.sortBy.forEach((sort) => {
4933
5093
  orderByArray.push(`{
4934
5094
  column_id: "${sort.columnId}",
@@ -5000,7 +5160,7 @@ class Worktables {
5000
5160
  body: { query: testQuery },
5001
5161
  });
5002
5162
  const testParsed = JSON.parse(testResponse);
5003
- const testItems = ((_11 = (_10 = (_9 = (_8 = testParsed === null || testParsed === void 0 ? void 0 : testParsed.data) === null || _8 === void 0 ? void 0 : _8.boards) === null || _9 === void 0 ? void 0 : _9[0]) === null || _10 === void 0 ? void 0 : _10.items_page) === null || _11 === void 0 ? void 0 : _11.items) || [];
5163
+ const testItems = ((_16 = (_15 = (_14 = (_13 = testParsed === null || testParsed === void 0 ? void 0 : testParsed.data) === null || _13 === void 0 ? void 0 : _13.boards) === null || _14 === void 0 ? void 0 : _14[0]) === null || _15 === void 0 ? void 0 : _15.items_page) === null || _16 === void 0 ? void 0 : _16.items) || [];
5004
5164
  console.log('Test - Items in board (no filters):', testItems.length);
5005
5165
  if (testItems.length > 0) {
5006
5166
  console.log('Sample item column values:', testItems[0].column_values);
@@ -5012,7 +5172,7 @@ class Worktables {
5012
5172
  body: { query },
5013
5173
  });
5014
5174
  const parsed = JSON.parse(rawResponse);
5015
- const itemsPage = (_14 = (_13 = (_12 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _12 === void 0 ? void 0 : _12.boards) === null || _13 === void 0 ? void 0 : _13[0]) === null || _14 === void 0 ? void 0 : _14.items_page;
5175
+ const itemsPage = (_19 = (_18 = (_17 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _17 === void 0 ? void 0 : _17.boards) === null || _18 === void 0 ? void 0 : _18[0]) === null || _19 === void 0 ? void 0 : _19.items_page;
5016
5176
  const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
5017
5177
  const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
5018
5178
  const hasMore = nextCursor ? true : false;
@@ -5170,7 +5330,7 @@ class Worktables {
5170
5330
  body: { query },
5171
5331
  });
5172
5332
  const parsed = JSON.parse(rawResponse);
5173
- 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) || [];
5333
+ const items = ((_25 = (_24 = (_23 = (_22 = (_21 = (_20 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _20 === void 0 ? void 0 : _20.boards) === null || _21 === void 0 ? void 0 : _21[0]) === null || _22 === void 0 ? void 0 : _22.groups) === null || _23 === void 0 ? void 0 : _23[0]) === null || _24 === void 0 ? void 0 : _24.items_page) === null || _25 === void 0 ? void 0 : _25.items) || [];
5174
5334
  const formattedItems = await Promise.all(items.map(async (item) => {
5175
5335
  const columnValues = item.column_values || [];
5176
5336
  const formatted = {
@@ -5260,7 +5420,7 @@ class Worktables {
5260
5420
  response = await (0, isErrorResponse_1.parseApiResponse)(response);
5261
5421
  if (response.success) {
5262
5422
  const parsed = JSON.parse(response.data);
5263
- 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) || [];
5423
+ const updates = ((_28 = (_27 = (_26 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _26 === void 0 ? void 0 : _26.items) === null || _27 === void 0 ? void 0 : _27[0]) === null || _28 === void 0 ? void 0 : _28.updates) || [];
5264
5424
  const formattedUpdates = updates.map((update) => {
5265
5425
  const pinnedToTop = update.pinned_to_top || [];
5266
5426
  const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
@@ -5325,7 +5485,7 @@ class Worktables {
5325
5485
  console.log('variables:', variables);
5326
5486
  response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
5327
5487
  console.log('Create Update Result:', JSON.stringify(response, null, 2));
5328
- 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;
5488
+ const updateId = (_30 = (_29 = JSON.parse(response).data) === null || _29 === void 0 ? void 0 : _29.create_update) === null || _30 === void 0 ? void 0 : _30.id;
5329
5489
  if (!updateId) {
5330
5490
  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
5331
5491
  message: 'Error creating update: Update not created, no ID returned',
@@ -5631,7 +5791,7 @@ class Worktables {
5631
5791
  body: { query },
5632
5792
  json: true,
5633
5793
  });
5634
- 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];
5794
+ const asset = (_32 = (_31 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _31 === void 0 ? void 0 : _31.assets) === null || _32 === void 0 ? void 0 : _32[0];
5635
5795
  if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
5636
5796
  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
5637
5797
  message: 'Public URL not found for the given file ID.',