@worktables/n8n-nodes-worktables 12.16.0 → 12.19.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.
@@ -3178,7 +3178,7 @@ class Worktables {
3178
3178
  };
3179
3179
  }
3180
3180
  async execute() {
3181
- 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, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54;
3181
+ 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, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47;
3182
3182
  const resource = this.getNodeParameter('resource', 0);
3183
3183
  const operation = this.getNodeParameter('operation', 0);
3184
3184
  const credentials = await this.getCredentials('WorktablesApi');
@@ -4558,162 +4558,19 @@ class Worktables {
4558
4558
  const groupName = this.getNodeParameter('groupName', 0, '');
4559
4559
  const raw = this.getNodeParameter('columnValues', 0);
4560
4560
  const columnValues = raw.column;
4561
- let column_values_object = {};
4562
4561
  console.log('Column Values:', JSON.stringify(raw, null, 2));
4563
- if ((columnValues === null || columnValues === void 0 ? void 0 : columnValues.length) > 0) {
4564
- const columnTypeResponse = await this.helpers.request({
4565
- method: 'POST',
4566
- url: 'https://api.monday.com/v2',
4567
- headers: {
4568
- Authorization: `Bearer ${apiKey}`,
4569
- 'Content-Type': 'application/json',
4570
- },
4571
- body: {
4572
- query: `query {
4573
- boards(ids: ${boardId}) {
4574
- columns {
4575
- id
4576
- type
4577
- }
4578
- }
4579
- }`,
4580
- },
4581
- });
4582
- const columnsType = JSON.parse(columnTypeResponse).data.boards[0].columns;
4583
- for (const col of columnValues) {
4584
- const columnId = col.columnId;
4585
- const columnDef = columnsType.find((c) => c.id === columnId);
4586
- const type = columnDef === null || columnDef === void 0 ? void 0 : columnDef.type;
4587
- if (!type || type === 'text' || type === 'simple' || col.columnType === 'simple') {
4588
- console.log('Processing text/simple column:', col);
4589
- if (col.columnValue !== undefined) {
4590
- const value = col.columnValue;
4591
- if (typeof value === 'string' && type === 'file') {
4592
- const links = value.split(',').map((item) => {
4593
- const [link, ...nameParts] = item.trim().split(/\s+/);
4594
- return {
4595
- fileType: 'LINK',
4596
- linkToFile: link,
4597
- name: nameParts.join(' '),
4598
- };
4599
- });
4600
- column_values_object[columnId] = { files: links };
4601
- }
4602
- else if (typeof value === 'string') {
4603
- column_values_object[columnId] = value;
4604
- }
4605
- else {
4606
- column_values_object[columnId] = value;
4607
- }
4608
- }
4609
- continue;
4610
- }
4611
- else if (col.columnType === 'objectValue') {
4612
- console.log('Processing objectValue for column:', columnId);
4613
- try {
4614
- const parsedValue = JSON.parse(col.objectValue || '{}');
4615
- column_values_object[columnId] = parsedValue;
4616
- }
4617
- catch (error) {
4618
- throw new n8n_workflow_1.NodeApiError(this.getNode(), {
4619
- message: `Invalid JSON format for column ${columnId}: ${error.message}`,
4620
- });
4621
- }
4622
- continue;
4623
- }
4624
- switch (type) {
4625
- case 'checkbox':
4626
- column_values_object[columnId] = col.checkboxValue ? { checked: 'true' } : { checked: 'false' };
4627
- break;
4628
- case 'status':
4629
- column_values_object[columnId] = { label: col.statusLabel || 'Working on it' };
4630
- break;
4631
- case 'location':
4632
- column_values_object[columnId] = {
4633
- lat: col.latitude || '0',
4634
- lng: col.longitude || '0',
4635
- address: col.address || '',
4636
- };
4637
- break;
4638
- case 'dropdown':
4639
- column_values_object[columnId] = { label: col.dropdownValue || '' };
4640
- break;
4641
- case 'people':
4642
- if (col.peopleValue) {
4643
- const peopleIds = Array.isArray(col.peopleValue) ? col.peopleValue : [col.peopleValue];
4644
- column_values_object[columnId] = { personsAndTeams: peopleIds.map(id => ({ id, kind: 'person' })) };
4645
- }
4646
- break;
4647
- case 'team':
4648
- if (col.teamsValue) {
4649
- const teamIds = Array.isArray(col.teamsValue) ? col.teamsValue : [col.teamsValue];
4650
- column_values_object[columnId] = { personsAndTeams: teamIds.map(id => ({ id, kind: 'team' })) };
4651
- }
4652
- break;
4653
- case 'timeline':
4654
- column_values_object[columnId] = {
4655
- from: col.startDate || '',
4656
- to: col.endDate || '',
4657
- };
4658
- break;
4659
- case 'date':
4660
- column_values_object[columnId] = { date: col.dateValue || '' };
4661
- break;
4662
- case 'email':
4663
- column_values_object[columnId] = {
4664
- email: col.emailValue || '',
4665
- text: col.emailText || '',
4666
- };
4667
- break;
4668
- case 'link':
4669
- column_values_object[columnId] = {
4670
- url: col.url || '',
4671
- text: col.linkText || '',
4672
- };
4673
- break;
4674
- case 'phone':
4675
- column_values_object[columnId] = {
4676
- phone: col.phoneValue || '',
4677
- countryShortName: col.countryCode || 'US',
4678
- };
4679
- break;
4680
- case 'file':
4681
- if ((_w = col.fileLinks) === null || _w === void 0 ? void 0 : _w.file) {
4682
- column_values_object[columnId] = { files: col.fileLinks.file };
4683
- }
4684
- break;
4685
- default:
4686
- if (col.columnValue !== undefined) {
4687
- column_values_object[columnId] = col.columnValue;
4688
- }
4689
- }
4690
- }
4691
- }
4562
+ const column_values_object = await (0, worktablesHelpers_1.processColumnValues)(this, columnValues, boardId, apiKey);
4692
4563
  let mutation;
4693
4564
  let formatted;
4694
4565
  let itemUpdated = false;
4695
4566
  let foundItemId = null;
4696
4567
  let foundItemBoardId = null;
4697
4568
  if (identifierValue && identifierValue.trim() !== '' && identifierColumn && identifierColumn.trim() !== '') {
4698
- console.log('═══════════════════════════════════════════════════════════');
4699
- console.log('🔍 STARTING SEARCH FOR ITEM/SUBITEM');
4700
- console.log('═══════════════════════════════════════════════════════════');
4701
- console.log('📋 Search Parameters:');
4702
- console.log(' - identifierColumn (raw):', JSON.stringify(identifierColumn));
4703
- console.log(' - identifierColumn (trimmed):', JSON.stringify(identifierColumn.trim()));
4704
- console.log(' - identifierValue (raw):', JSON.stringify(identifierValue));
4705
- console.log(' - identifierValue (trimmed):', JSON.stringify(identifierValue.trim()));
4706
- console.log(' - isSubitem:', isSubitem);
4707
- console.log(' - boardId:', boardId);
4708
- console.log('═══════════════════════════════════════════════════════════');
4569
+ console.log('Searching for item/subitem with identifier column:', identifierColumn, 'value:', identifierValue, 'isSubitem:', isSubitem);
4709
4570
  const parentId = this.getNodeParameter('parentId', 0, false);
4710
- console.log(' - parentId:', parentId || '(not provided)');
4711
4571
  const isNameColumn = identifierColumn === 'name' || identifierColumn.toLowerCase() === 'name';
4712
- console.log(' - isNameColumn:', isNameColumn);
4713
4572
  let searchBoardId = boardId;
4714
- console.log(' - Initial searchBoardId:', searchBoardId);
4715
4573
  if (isSubitem && !parentId) {
4716
- console.log(' - Discovering subitem board...');
4717
4574
  try {
4718
4575
  const discoverQuery = `query {
4719
4576
  boards(ids: [${boardId}]) {
@@ -4735,23 +4592,18 @@ class Worktables {
4735
4592
  body: { query: discoverQuery },
4736
4593
  });
4737
4594
  const discoverData = JSON.parse(discoverResponse);
4738
- const items = ((_0 = (_z = (_y = (_x = discoverData === null || discoverData === void 0 ? void 0 : discoverData.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) === null || _0 === void 0 ? void 0 : _0.items) || [];
4595
+ const items = ((_z = (_y = (_x = (_w = discoverData === null || discoverData === void 0 ? void 0 : discoverData.data) === null || _w === void 0 ? void 0 : _w.boards) === null || _x === void 0 ? void 0 : _x[0]) === null || _y === void 0 ? void 0 : _y.items_page) === null || _z === void 0 ? void 0 : _z.items) || [];
4739
4596
  if (items.length > 0 && items[0].subitems && items[0].subitems.length > 0) {
4740
- searchBoardId = ((_1 = items[0].subitems[0].board) === null || _1 === void 0 ? void 0 : _1.id) || boardId;
4741
- console.log(`Discovered subitem board ID: ${searchBoardId}`);
4742
- }
4743
- else {
4744
- console.log(` ⚠ No subitems found to discover board, using main board: ${boardId}`);
4597
+ searchBoardId = ((_0 = items[0].subitems[0].board) === null || _0 === void 0 ? void 0 : _0.id) || boardId;
4598
+ console.log(`Discovered subitem board ID: ${searchBoardId}`);
4745
4599
  }
4746
4600
  }
4747
4601
  catch (error) {
4748
- console.log('Could not discover subitem board, using main board:', error);
4602
+ console.log('Could not discover subitem board, using main board:', error);
4749
4603
  }
4750
4604
  }
4751
- console.log(' - Final searchBoardId:', searchBoardId);
4752
4605
  let columnType = null;
4753
4606
  if (!isNameColumn) {
4754
- console.log(' - Fetching column type for:', identifierColumn);
4755
4607
  try {
4756
4608
  const columnTypeQuery = `query {
4757
4609
  boards(ids: [${searchBoardId}]) {
@@ -4767,31 +4619,20 @@ class Worktables {
4767
4619
  body: { query: columnTypeQuery },
4768
4620
  });
4769
4621
  const columnTypeData = JSON.parse(columnTypeResponse);
4770
- const columns = ((_4 = (_3 = (_2 = columnTypeData === null || columnTypeData === void 0 ? void 0 : columnTypeData.data) === null || _2 === void 0 ? void 0 : _2.boards) === null || _3 === void 0 ? void 0 : _3[0]) === null || _4 === void 0 ? void 0 : _4.columns) || [];
4622
+ const columns = ((_3 = (_2 = (_1 = columnTypeData === null || columnTypeData === void 0 ? void 0 : columnTypeData.data) === null || _1 === void 0 ? void 0 : _1.boards) === null || _2 === void 0 ? void 0 : _2[0]) === null || _3 === void 0 ? void 0 : _3.columns) || [];
4771
4623
  if (columns.length > 0) {
4772
4624
  columnType = columns[0].type;
4773
- console.log(`Column type detected: ${columnType}`);
4774
- }
4775
- else {
4776
- console.log(` ⚠ Column not found in board ${searchBoardId}`);
4625
+ console.log(`Column type detected: ${columnType}`);
4777
4626
  }
4778
4627
  }
4779
4628
  catch (error) {
4780
- console.log('Could not fetch column type, using default operator:', error);
4629
+ console.log('Could not fetch column type, using default operator:', error);
4781
4630
  }
4782
4631
  }
4783
- else {
4784
- console.log(' - Skipping column type fetch (isNameColumn=true)');
4785
- }
4786
4632
  const searchColumnId = isNameColumn ? 'name' : identifierColumn;
4787
4633
  const operator = columnType === 'status' ? 'contains_terms' : 'contains_text';
4788
4634
  const limit = 100;
4789
- console.log(' - searchColumnId:', searchColumnId);
4790
- console.log(' - operator:', operator);
4791
- console.log(' - limit:', limit);
4792
- console.log('═══════════════════════════════════════════════════════════');
4793
4635
  if (isSubitem && parentId) {
4794
- console.log('🔍 Searching subitems with parentId:', parentId);
4795
4636
  const parentQuery = `query {
4796
4637
  items(ids: [${parentId}]) {
4797
4638
  id
@@ -4831,23 +4672,19 @@ class Worktables {
4831
4672
  body: { query: parentQuery },
4832
4673
  });
4833
4674
  const searchData = JSON.parse(searchResponse);
4834
- const items = ((_5 = searchData === null || searchData === void 0 ? void 0 : searchData.data) === null || _5 === void 0 ? void 0 : _5.items) || [];
4835
- console.log(` - Parent query response: ${items.length} parent item(s) found`);
4675
+ const items = ((_4 = searchData === null || searchData === void 0 ? void 0 : searchData.data) === null || _4 === void 0 ? void 0 : _4.items) || [];
4836
4676
  if (items.length > 0 && items[0].subitems) {
4837
4677
  const subitems = items[0].subitems;
4838
- console.log(` - Found ${subitems.length} subitem(s) to check`);
4839
- for (let i = 0; i < subitems.length; i++) {
4840
- const subitem = subitems[i];
4841
- console.log(` - Checking subitem ${i + 1}/${subitems.length}: ID=${subitem.id}, name="${subitem.name}"`);
4678
+ console.log(`🔍 Searching subitems of parent ${parentId}, found ${subitems.length} subitem(s)`);
4679
+ for (const subitem of subitems) {
4842
4680
  let matches = false;
4843
4681
  if (isNameColumn) {
4844
4682
  const searchValue = identifierValue.trim().toLowerCase();
4845
4683
  const subitemName = (subitem.name || '').trim().toLowerCase();
4846
4684
  matches = subitemName === searchValue;
4847
- console.log(` - Name comparison: "${subitemName}" === "${searchValue}" = ${matches}`);
4848
4685
  }
4849
4686
  else {
4850
- const colValue = (_6 = subitem.column_values) === null || _6 === void 0 ? void 0 : _6.find((cv) => cv.id === identifierColumn);
4687
+ const colValue = (_5 = subitem.column_values) === null || _5 === void 0 ? void 0 : _5.find((cv) => cv.id === identifierColumn);
4851
4688
  if (colValue) {
4852
4689
  const isBoardRelation = colValue.type === 'board_relation' || colValue.type === 'mirror';
4853
4690
  const isStatusColumn = colValue.type === 'status';
@@ -4855,57 +4692,25 @@ class Worktables {
4855
4692
  ? (colValue.display_value || '').trim()
4856
4693
  : (colValue.text || '').trim();
4857
4694
  const searchValue = identifierValue.trim().toLowerCase();
4858
- console.log(` - Column type: ${colValue.type}`);
4859
- console.log(` - Column value found: "${compareValue}" (length: ${compareValue.length}, raw: ${JSON.stringify(compareValue)})`);
4860
- console.log(` - Search value: "${identifierValue}" (length: ${identifierValue.trim().length}, trimmed: "${identifierValue.trim()}", raw: ${JSON.stringify(identifierValue)})`);
4861
- const trimmedCompare = compareValue.trim().toLowerCase();
4862
- const trimmedSearch = searchValue.trim();
4863
- matches = trimmedCompare === trimmedSearch;
4864
- console.log(` - Trimmed compare: "${trimmedCompare}" === "${trimmedSearch}" = ${matches}`);
4695
+ matches = compareValue.toLowerCase() === searchValue;
4865
4696
  if (isStatusColumn && !matches) {
4866
- const normalizedCompare = trimmedCompare.replace(/\s+/g, ' ').trim();
4867
- const normalizedSearch = trimmedSearch.replace(/\s+/g, ' ').trim();
4697
+ const normalizedCompare = compareValue.toLowerCase().replace(/\s+/g, ' ').trim();
4698
+ const normalizedSearch = searchValue.replace(/\s+/g, ' ').trim();
4868
4699
  matches = normalizedCompare === normalizedSearch;
4869
- console.log(` - Normalized compare: "${normalizedCompare}" === "${normalizedSearch}" = ${matches}`);
4870
- if (!matches) {
4871
- matches = normalizedCompare.includes(normalizedSearch) || normalizedSearch.includes(normalizedCompare);
4872
- console.log(` - Contains check: "${normalizedCompare}".includes("${normalizedSearch}") OR "${normalizedSearch}".includes("${normalizedCompare}") = ${matches}`);
4873
- }
4874
- if (!matches) {
4875
- console.log(` ❌ Status column comparison failed for subitem ${subitem.id}`);
4876
- }
4877
4700
  }
4878
- if (!matches) {
4879
- console.log(` ❌ No match for subitem ${subitem.id}, column type: ${colValue.type}`);
4880
- }
4881
- }
4882
- else {
4883
- console.log(` ⚠ Column value not found for subitem ${subitem.id}, identifierColumn: ${identifierColumn}`);
4884
- console.log(` - Available column_values:`, ((_7 = subitem.column_values) === null || _7 === void 0 ? void 0 : _7.map((cv) => cv.id).join(', ')) || 'none');
4885
4701
  }
4886
4702
  }
4887
4703
  if (matches) {
4888
4704
  foundItemId = subitem.id;
4889
- foundItemBoardId = ((_8 = subitem.board) === null || _8 === void 0 ? void 0 : _8.id) || null;
4890
- console.log(` ✓✓✓ MATCH FOUND! Subitem ID: ${foundItemId}, board_id: ${foundItemBoardId}`);
4705
+ foundItemBoardId = ((_6 = subitem.board) === null || _6 === void 0 ? void 0 : _6.id) || null;
4706
+ console.log(`✓ Found subitem with ID: ${foundItemId}, board_id: ${foundItemBoardId}`);
4891
4707
  break;
4892
4708
  }
4893
- else {
4894
- console.log(` ✗ No match for subitem ${subitem.id}`);
4895
- }
4896
4709
  }
4897
4710
  }
4898
4711
  }
4899
4712
  else {
4900
- let useExactSearch = (columnType === 'text' || isNameColumn) && columnType !== 'status';
4901
- console.log('🔍 Searching items (not subitems)');
4902
- console.log(' - useExactSearch:', useExactSearch);
4903
- console.log(' - columnType:', columnType);
4904
- console.log(' - isNameColumn:', isNameColumn);
4905
- let items = [];
4906
- if (useExactSearch) {
4907
- console.log(' - Attempting exact search with is_equal operator...');
4908
- const query = `{
4713
+ const query = `{
4909
4714
  boards(ids: [${searchBoardId}]) {
4910
4715
  items_page (
4911
4716
  limit: ${limit},
@@ -4913,7 +4718,7 @@ class Worktables {
4913
4718
  rules: [{
4914
4719
  column_id: "${searchColumnId}",
4915
4720
  compare_value: "${identifierValue}",
4916
- operator: is_equal
4721
+ operator: ${operator}
4917
4722
  }]
4918
4723
  }
4919
4724
  ) {
@@ -4943,80 +4748,26 @@ class Worktables {
4943
4748
  }
4944
4749
  }
4945
4750
  }`;
4946
- try {
4947
- const searchResponse = await this.helpers.request({
4948
- method: 'POST',
4949
- url: 'https://api.monday.com/v2',
4950
- headers,
4951
- body: { query },
4952
- });
4953
- const searchData = JSON.parse(searchResponse);
4954
- const itemsPage = (_11 = (_10 = (_9 = searchData === null || searchData === void 0 ? void 0 : searchData.data) === null || _9 === void 0 ? void 0 : _9.boards) === null || _10 === void 0 ? void 0 : _10[0]) === null || _11 === void 0 ? void 0 : _11.items_page;
4955
- items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
4956
- console.log(` ✓ Exact search (is_equal) found ${items.length} item(s)`);
4957
- }
4958
- catch (error) {
4959
- console.log(' ❌ Exact search failed, falling back to fetch all:', error);
4960
- useExactSearch = false;
4961
- }
4962
- }
4963
- if (!useExactSearch || items.length === 0) {
4964
- console.log(' - Fetching all items from board for exact matching...');
4965
- const query = `{
4966
- boards(ids: [${searchBoardId}]) {
4967
- items_page(limit: ${limit}) {
4968
- items {
4969
- name
4970
- id
4971
- url
4972
- column_values(ids: "${identifierColumn}") {
4973
- id
4974
- text
4975
- type
4976
- column {
4977
- id
4978
- }
4979
- ... on BoardRelationValue {
4980
- display_value
4981
- }
4982
- ... on MirrorValue {
4983
- display_value
4984
- }
4985
- ... on StatusValue {
4986
- text
4987
- index
4988
- }
4989
- }
4990
- }
4991
- }
4992
- }
4993
- }`;
4994
- const searchResponse = await this.helpers.request({
4995
- method: 'POST',
4996
- url: 'https://api.monday.com/v2',
4997
- headers,
4998
- body: { query },
4999
- });
5000
- const searchData = JSON.parse(searchResponse);
5001
- const itemsPage = (_14 = (_13 = (_12 = searchData === null || searchData === void 0 ? void 0 : searchData.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;
5002
- items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
5003
- console.log(` ✓ Fetched ${items.length} item(s) from board for exact matching`);
5004
- }
5005
- console.log(` - Starting exact comparison on ${items.length} item(s)...`);
5006
- for (let i = 0; i < items.length; i++) {
5007
- const item = items[i];
5008
- console.log(` - Checking item ${i + 1}/${items.length}: ID=${item.id}, name="${item.name}"`);
4751
+ console.log('✅✅✅ Query: ', query);
4752
+ const searchResponse = await this.helpers.request({
4753
+ method: 'POST',
4754
+ url: 'https://api.monday.com/v2',
4755
+ headers,
4756
+ body: { query },
4757
+ });
4758
+ const searchData = JSON.parse(searchResponse);
4759
+ const itemsPage = (_9 = (_8 = (_7 = searchData === null || searchData === void 0 ? void 0 : searchData.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;
4760
+ const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
4761
+ console.log(`🔍 Optimized search found ${items.length} item(s) matching identifier`);
4762
+ for (const item of items) {
5009
4763
  let matches = false;
5010
4764
  if (isNameColumn) {
5011
4765
  const searchValue = identifierValue.trim().toLowerCase();
5012
4766
  const itemName = (item.name || '').trim().toLowerCase();
5013
4767
  matches = itemName === searchValue;
5014
- console.log(` - Name comparison: "${itemName}" === "${searchValue}" = ${matches}`);
5015
4768
  }
5016
4769
  else {
5017
- console.log(` - Looking for column with ID: "${identifierColumn}"`);
5018
- console.log(` - Available column_values IDs:`, ((_15 = item.column_values) === null || _15 === void 0 ? void 0 : _15.map((cv) => `${cv.id} (type: ${cv.type})`).join(', ')) || 'none');
5019
- const colValue = (_16 = item.column_values) === null || _16 === void 0 ? void 0 : _16.find((cv) => cv.id === identifierColumn);
4770
+ const colValue = (_10 = item.column_values) === null || _10 === void 0 ? void 0 : _10.find((cv) => cv.id === identifierColumn);
5020
4771
  if (colValue) {
5021
4772
  const isBoardRelation = colValue.type === 'board_relation' || colValue.type === 'mirror';
5022
4773
  const isStatusColumn = colValue.type === 'status';
@@ -5024,95 +4775,41 @@ class Worktables {
5024
4775
  ? (colValue.display_value || '').trim()
5025
4776
  : (colValue.text || '').trim();
5026
4777
  const searchValue = identifierValue.trim().toLowerCase();
5027
- console.log(` - Found column: ID="${colValue.id}", type="${colValue.type}"`);
5028
- console.log(` - Column value found: "${compareValue}" (length: ${compareValue.length}, raw: ${JSON.stringify(compareValue)})`);
5029
- console.log(` - Search value: "${identifierValue}" (length: ${identifierValue.trim().length}, trimmed: "${identifierValue.trim()}", raw: ${JSON.stringify(identifierValue)})`);
5030
- const trimmedCompare = compareValue.trim().toLowerCase();
5031
- const trimmedSearch = searchValue.trim();
5032
- matches = trimmedCompare === trimmedSearch;
5033
- console.log(` - Trimmed compare: "${trimmedCompare}" === "${trimmedSearch}" = ${matches}`);
5034
- if (!matches && isStatusColumn) {
5035
- const normalizedCompare = trimmedCompare.replace(/\s+/g, ' ').trim();
5036
- const normalizedSearch = trimmedSearch.replace(/\s+/g, ' ').trim();
4778
+ matches = compareValue.toLowerCase() === searchValue;
4779
+ if (isStatusColumn && !matches) {
4780
+ const normalizedCompare = compareValue.toLowerCase().replace(/\s+/g, ' ').trim();
4781
+ const normalizedSearch = searchValue.replace(/\s+/g, ' ').trim();
5037
4782
  matches = normalizedCompare === normalizedSearch;
5038
- console.log(` - Normalized compare: "${normalizedCompare}" === "${normalizedSearch}" = ${matches}`);
5039
- if (!matches) {
5040
- matches = normalizedCompare.includes(normalizedSearch) || normalizedSearch.includes(normalizedCompare);
5041
- console.log(` - Contains check: "${normalizedCompare}".includes("${normalizedSearch}") OR "${normalizedSearch}".includes("${normalizedCompare}") = ${matches}`);
5042
- }
5043
- }
5044
- if (matches) {
5045
- console.log(` ✓✓✓ MATCH FOUND! Item ${item.id}, column type: ${colValue.type}, value: "${compareValue}"`);
5046
- }
5047
- else {
5048
- console.log(` ❌ No match: item ${item.id}, column type: ${colValue.type}, compareValue: "${compareValue}", searchValue: "${identifierValue}"`);
5049
4783
  }
5050
4784
  }
5051
- else {
5052
- console.log(` ⚠⚠⚠ Column value not found for item ${item.id}`);
5053
- console.log(` - Looking for column ID: "${identifierColumn}"`);
5054
- console.log(` - Available column_values:`, ((_17 = item.column_values) === null || _17 === void 0 ? void 0 : _17.map((cv) => `ID:${cv.id} (type:${cv.type}, text:"${cv.text || 'N/A'}")`).join(' | ')) || 'none');
5055
- console.log(` - This means the identifierColumn "${identifierColumn}" does not match any column ID in this item!`);
5056
- }
5057
4785
  }
4786
+ console.log('✅✅✅ Matches: ', matches);
4787
+ console.log('✅✅✅ Item: ', item);
4788
+ console.log('✅✅✅ Identifier Column: ', identifierColumn);
4789
+ console.log('✅✅✅ Identifier Value: ', identifierValue);
4790
+ console.log('✅✅✅ Is Subitem: ', isSubitem);
4791
+ console.log('✅✅✅ Search Board ID: ', searchBoardId);
4792
+ console.log('✅✅✅ Found Item ID: ', foundItemId);
4793
+ console.log('✅✅✅ Found Item Board ID: ', foundItemBoardId);
5058
4794
  if (matches) {
5059
4795
  foundItemId = item.id;
5060
4796
  if (isSubitem) {
5061
4797
  foundItemBoardId = searchBoardId;
5062
- console.log(` ✓✓✓ Found matching ${isSubitem ? 'subitem' : 'item'} with ID: ${foundItemId}, board_id: ${foundItemBoardId}`);
4798
+ console.log(`✓ Found subitem with ID: ${foundItemId}, board_id: ${foundItemBoardId}`);
5063
4799
  }
5064
4800
  else {
5065
- console.log(` ✓✓✓ Found matching item with ID: ${foundItemId}`);
4801
+ console.log(`✓ Found item with ID: ${foundItemId}`);
5066
4802
  }
5067
4803
  break;
5068
4804
  }
5069
- else {
5070
- console.log(` ✗ No match for item ${item.id}`);
5071
- }
5072
- }
5073
- if (!foundItemId) {
5074
- console.log(` ❌❌❌ No exact match found for identifier column "${identifierColumn}" with value "${identifierValue}"`);
5075
- const uniqueValues = new Set();
5076
- items.forEach((item) => {
5077
- var _a;
5078
- if (!isNameColumn) {
5079
- const colValue = (_a = item.column_values) === null || _a === void 0 ? void 0 : _a.find((cv) => cv.id === identifierColumn);
5080
- if (colValue) {
5081
- const isBoardRelation = colValue.type === 'board_relation' || colValue.type === 'mirror';
5082
- const value = isBoardRelation
5083
- ? (colValue.display_value || '').trim()
5084
- : (colValue.text || '').trim();
5085
- if (value) {
5086
- uniqueValues.add(value);
5087
- }
5088
- }
5089
- }
5090
- });
5091
- if (uniqueValues.size > 0) {
5092
- console.log(` 📊 Debug: Found ${uniqueValues.size} unique value(s) in column "${identifierColumn}":`);
5093
- Array.from(uniqueValues).sort().forEach((val, idx) => {
5094
- console.log(` ${idx + 1}. "${val}" (length: ${val.length}, raw: ${JSON.stringify(val)})`);
5095
- });
5096
- console.log(` 🔍 Searching for: "${identifierValue.trim()}" (length: ${identifierValue.trim().length}, raw: ${JSON.stringify(identifierValue)})`);
5097
- }
5098
4805
  }
5099
4806
  }
5100
- console.log('═══════════════════════════════════════════════════════════');
5101
- console.log('📊 SEARCH RESULT:');
5102
- console.log(' - foundItemId:', foundItemId || 'null (not found)');
5103
- console.log(' - foundItemBoardId:', foundItemBoardId || 'null');
5104
- console.log('═══════════════════════════════════════════════════════════');
5105
4807
  if (foundItemId) {
5106
- console.log(`🔄 Found existing ${isSubitem ? 'subitem' : 'item'}, updating:`, foundItemId);
4808
+ console.log(`Found existing ${isSubitem ? 'subitem' : 'item'}, updating:`, foundItemId);
5107
4809
  const escapedColumnValues = (0, worktablesHelpers_1.escapeGraphQLJSONString)(column_values_object);
5108
4810
  const updateBoardId = (isSubitem && foundItemBoardId) ? foundItemBoardId : boardId;
5109
- console.log('═══════════════════════════════════════════════════════════');
5110
- console.log('🔄 UPDATE OPERATION:');
5111
- console.log(' - updateBoardId:', updateBoardId);
5112
- console.log(' - foundItemId:', foundItemId);
5113
- console.log(' - column_values_object:', JSON.stringify(column_values_object, null, 2));
5114
4811
  if (isSubitem && !foundItemBoardId) {
5115
- console.log(` ⚠ Warning: Subitem board_id not found, using main board_id ${boardId}. This may cause errors.`);
4812
+ console.log(`⚠ Warning: Subitem board_id not found, using main board_id ${boardId}. This may cause errors.`);
5116
4813
  }
5117
4814
  mutation = `mutation {
5118
4815
  change_multiple_column_values(
@@ -5128,8 +4825,7 @@ class Worktables {
5128
4825
  }
5129
4826
  }
5130
4827
  }`;
5131
- console.log(' - Generated Update Mutation:', mutation);
5132
- console.log(' - Sending update request...');
4828
+ console.log('Generated Update Mutation:', mutation);
5133
4829
  response = await this.helpers.request({
5134
4830
  method: 'POST',
5135
4831
  url: 'https://api.monday.com/v2',
@@ -5137,7 +4833,6 @@ class Worktables {
5137
4833
  body: { query: mutation },
5138
4834
  });
5139
4835
  const responseData = JSON.parse(response);
5140
- console.log(' - Update response received:', JSON.stringify(responseData, null, 2));
5141
4836
  if (!responseData.errors && responseData.data && responseData.data.change_multiple_column_values) {
5142
4837
  const itemData = responseData.data.change_multiple_column_values;
5143
4838
  if (itemData && itemData.id) {
@@ -5145,28 +4840,30 @@ class Worktables {
5145
4840
  id: itemData.id,
5146
4841
  url: itemData.url || '',
5147
4842
  operation: 'update',
5148
- board_id: ((_18 = itemData.board) === null || _18 === void 0 ? void 0 : _18.id) || boardId,
4843
+ board_id: ((_11 = itemData.board) === null || _11 === void 0 ? void 0 : _11.id) || boardId,
5149
4844
  column_values: column_values_object,
5150
4845
  };
5151
4846
  itemUpdated = true;
5152
- console.log(` ✓✓✓ Successfully updated ${isSubitem ? 'subitem' : 'item'}:`, itemData.id);
5153
- console.log('═══════════════════════════════════════════════════════════');
4847
+ console.log(`Successfully updated ${isSubitem ? 'subitem' : 'item'}:`, itemData.id);
5154
4848
  }
5155
4849
  else {
5156
- console.log(` ❌ Update response missing item data, will create new ${isSubitem ? 'subitem' : 'item'} instead`);
5157
- console.log(' - itemData:', JSON.stringify(itemData, null, 2));
5158
- itemUpdated = false;
4850
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), {
4851
+ message: `Item found (ID: ${foundItemId}) but update failed: Update response missing item data.`,
4852
+ });
5159
4853
  }
5160
4854
  }
5161
4855
  else {
5162
4856
  if (responseData.errors) {
5163
- console.log(' ❌ Error updating item:', JSON.stringify(responseData.errors, null, 2));
4857
+ const errorMessage = responseData.errors.map((err) => err.message || JSON.stringify(err)).join('; ');
4858
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), {
4859
+ message: `Item found (ID: ${foundItemId}) but update failed: ${errorMessage}`,
4860
+ });
5164
4861
  }
5165
4862
  else {
5166
- console.log(' ❌ Update response missing data, will create new item instead');
5167
- console.log(' - responseData.data:', JSON.stringify(responseData.data, null, 2));
4863
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), {
4864
+ message: `Item found (ID: ${foundItemId}) but update failed: Update response missing data.`,
4865
+ });
5168
4866
  }
5169
- itemUpdated = false;
5170
4867
  }
5171
4868
  }
5172
4869
  else {
@@ -5178,15 +4875,11 @@ class Worktables {
5178
4875
  }
5179
4876
  }
5180
4877
  else {
5181
- console.log('═══════════════════════════════════════════════════════════');
5182
- console.log('ℹ️ No identifier provided, will create new item');
5183
- console.log('═══════════════════════════════════════════════════════════');
4878
+ console.log('No identifier provided, will create new item');
5184
4879
  itemUpdated = false;
5185
4880
  }
5186
4881
  if (!itemUpdated) {
5187
- console.log('═══════════════════════════════════════════════════════════');
5188
- console.log(`➕ CREATING NEW ${isSubitem ? 'SUBITEM' : 'ITEM'}:`, itemName);
5189
- console.log('═══════════════════════════════════════════════════════════');
4882
+ console.log(`Creating new ${isSubitem ? 'subitem' : 'item'}:`, itemName);
5190
4883
  const parentId = this.getNodeParameter('parentId', 0, false);
5191
4884
  if (isSubitem && !parentId) {
5192
4885
  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
@@ -5230,8 +4923,6 @@ class Worktables {
5230
4923
  }
5231
4924
  }`;
5232
4925
  }
5233
- console.log(' - Generated Create Mutation:', mutation);
5234
- console.log(' - Sending create request...');
5235
4926
  response = await this.helpers.request({
5236
4927
  method: 'POST',
5237
4928
  url: 'https://api.monday.com/v2',
@@ -5239,30 +4930,25 @@ class Worktables {
5239
4930
  body: { query: mutation },
5240
4931
  });
5241
4932
  const responseData = JSON.parse(response);
5242
- console.log(' - Create response received:', JSON.stringify(responseData, null, 2));
5243
4933
  if (responseData.errors) {
5244
- console.log(' ❌ Error creating item:', JSON.stringify(responseData.errors, null, 2));
5245
4934
  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
5246
4935
  message: `Error creating ${isSubitem ? 'subitem' : 'item'}: ${JSON.stringify(responseData.errors)}`,
5247
4936
  });
5248
4937
  }
5249
4938
  const itemData = isSubitem && parentId
5250
- ? (_19 = responseData.data) === null || _19 === void 0 ? void 0 : _19.create_subitem
5251
- : (_20 = responseData.data) === null || _20 === void 0 ? void 0 : _20.create_item;
4939
+ ? (_12 = responseData.data) === null || _12 === void 0 ? void 0 : _12.create_subitem
4940
+ : (_13 = responseData.data) === null || _13 === void 0 ? void 0 : _13.create_item;
5252
4941
  if (!itemData || !itemData.id) {
5253
- console.log(' ❌ No item data returned in response');
5254
4942
  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
5255
4943
  message: `Error creating ${isSubitem ? 'subitem' : 'item'}: No item data returned`,
5256
4944
  });
5257
4945
  }
5258
- console.log(` ✓✓✓ Successfully created ${isSubitem ? 'subitem' : 'item'}:`, itemData.id);
5259
- console.log('═══════════════════════════════════════════════════════════');
5260
4946
  formatted = {
5261
4947
  id: itemData.id,
5262
4948
  name: itemData.name || itemName,
5263
4949
  url: itemData.url || '',
5264
4950
  operation: 'create',
5265
- board_id: ((_21 = itemData.board) === null || _21 === void 0 ? void 0 : _21.id) || boardId,
4951
+ board_id: ((_14 = itemData.board) === null || _14 === void 0 ? void 0 : _14.id) || boardId,
5266
4952
  column_values: column_values_object,
5267
4953
  };
5268
4954
  if (isSubitem && parentId) {
@@ -5303,12 +4989,12 @@ class Worktables {
5303
4989
  if (itemParsed.errors) {
5304
4990
  throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: JSON.stringify(itemParsed.errors) });
5305
4991
  }
5306
- const items = ((_22 = itemParsed === null || itemParsed === void 0 ? void 0 : itemParsed.data) === null || _22 === void 0 ? void 0 : _22.items) || [];
4992
+ const items = ((_15 = itemParsed === null || itemParsed === void 0 ? void 0 : itemParsed.data) === null || _15 === void 0 ? void 0 : _15.items) || [];
5307
4993
  if (items.length === 0) {
5308
4994
  return [[{ json: { item_id: itemId, activity_logs: [] } }]];
5309
4995
  }
5310
4996
  const item = items[0];
5311
- const boardId = (_23 = item.board) === null || _23 === void 0 ? void 0 : _23.id;
4997
+ const boardId = (_16 = item.board) === null || _16 === void 0 ? void 0 : _16.id;
5312
4998
  if (!boardId) {
5313
4999
  throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'Could not retrieve board ID for the item.' });
5314
5000
  }
@@ -5346,7 +5032,7 @@ class Worktables {
5346
5032
  if (parsed.errors) {
5347
5033
  throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: JSON.stringify(parsed.errors) });
5348
5034
  }
5349
- const boards = ((_24 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _24 === void 0 ? void 0 : _24.boards) || [];
5035
+ const boards = ((_17 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _17 === void 0 ? void 0 : _17.boards) || [];
5350
5036
  const activityLogs = boards.length > 0 ? (boards[0].activity_logs || []) : [];
5351
5037
  const formatted = {
5352
5038
  item_id: item.id,
@@ -5505,7 +5191,7 @@ class Worktables {
5505
5191
  body: { query },
5506
5192
  });
5507
5193
  const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
5508
- const itemsPage = (_27 = (_26 = (_25 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _25 === void 0 ? void 0 : _25.boards) === null || _26 === void 0 ? void 0 : _26[0]) === null || _27 === void 0 ? void 0 : _27.items_page;
5194
+ const itemsPage = (_20 = (_19 = (_18 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _18 === void 0 ? void 0 : _18.boards) === null || _19 === void 0 ? void 0 : _19[0]) === null || _20 === void 0 ? void 0 : _20.items_page;
5509
5195
  const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
5510
5196
  cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
5511
5197
  allItems = allItems.concat(items);
@@ -5584,7 +5270,7 @@ class Worktables {
5584
5270
  const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
5585
5271
  const logicalOperator = this.getNodeParameter('logicalOperator', 0);
5586
5272
  let rulesArray = [];
5587
- if (((_28 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _28 === void 0 ? void 0 : _28.length) > 0) {
5273
+ if (((_21 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _21 === void 0 ? void 0 : _21.length) > 0) {
5588
5274
  rulesArray = filterRules.rule.map((rule) => {
5589
5275
  let formattedValue;
5590
5276
  if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
@@ -5628,7 +5314,7 @@ class Worktables {
5628
5314
  });
5629
5315
  }
5630
5316
  const orderByArray = [];
5631
- if (((_29 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _29 === void 0 ? void 0 : _29.length) > 0) {
5317
+ if (((_22 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _22 === void 0 ? void 0 : _22.length) > 0) {
5632
5318
  sortOptions.sortBy.forEach((sort) => {
5633
5319
  orderByArray.push(`{
5634
5320
  column_id: "${sort.columnId}",
@@ -5684,7 +5370,7 @@ class Worktables {
5684
5370
  body: { query },
5685
5371
  });
5686
5372
  const parsed = JSON.parse(rawResponse);
5687
- const items = ((_33 = (_32 = (_31 = (_30 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _30 === void 0 ? void 0 : _30.boards) === null || _31 === void 0 ? void 0 : _31[0]) === null || _32 === void 0 ? void 0 : _32.items_page) === null || _33 === void 0 ? void 0 : _33.items) || [];
5373
+ const items = ((_26 = (_25 = (_24 = (_23 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _23 === void 0 ? void 0 : _23.boards) === null || _24 === void 0 ? void 0 : _24[0]) === null || _25 === void 0 ? void 0 : _25.items_page) === null || _26 === void 0 ? void 0 : _26.items) || [];
5688
5374
  const formattedItems = await Promise.all(items.map(async (item) => {
5689
5375
  const formatted = {
5690
5376
  id: item.id,
@@ -5718,7 +5404,7 @@ class Worktables {
5718
5404
  const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
5719
5405
  const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
5720
5406
  let rulesArray = [];
5721
- if (((_34 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _34 === void 0 ? void 0 : _34.length) > 0) {
5407
+ if (((_27 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _27 === void 0 ? void 0 : _27.length) > 0) {
5722
5408
  console.log('Processing filter rules:', advancedFilterRules.rule);
5723
5409
  rulesArray = advancedFilterRules.rule.map((rule) => {
5724
5410
  let formattedValue;
@@ -5934,7 +5620,7 @@ class Worktables {
5934
5620
  });
5935
5621
  }
5936
5622
  const orderByArray = [];
5937
- if (((_35 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _35 === void 0 ? void 0 : _35.length) > 0) {
5623
+ if (((_28 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _28 === void 0 ? void 0 : _28.length) > 0) {
5938
5624
  advancedSortOptions.sortBy.forEach((sort) => {
5939
5625
  orderByArray.push(`{
5940
5626
  column_id: "${sort.columnId}",
@@ -6016,7 +5702,7 @@ class Worktables {
6016
5702
  body: { query: testQuery },
6017
5703
  });
6018
5704
  const testParsed = JSON.parse(testResponse);
6019
- const testItems = ((_39 = (_38 = (_37 = (_36 = testParsed === null || testParsed === void 0 ? void 0 : testParsed.data) === null || _36 === void 0 ? void 0 : _36.boards) === null || _37 === void 0 ? void 0 : _37[0]) === null || _38 === void 0 ? void 0 : _38.items_page) === null || _39 === void 0 ? void 0 : _39.items) || [];
5705
+ const testItems = ((_32 = (_31 = (_30 = (_29 = testParsed === null || testParsed === void 0 ? void 0 : testParsed.data) === null || _29 === void 0 ? void 0 : _29.boards) === null || _30 === void 0 ? void 0 : _30[0]) === null || _31 === void 0 ? void 0 : _31.items_page) === null || _32 === void 0 ? void 0 : _32.items) || [];
6020
5706
  console.log('Test - Items in board (no filters):', testItems.length);
6021
5707
  if (testItems.length > 0) {
6022
5708
  console.log('Sample item column values:', testItems[0].column_values);
@@ -6028,7 +5714,7 @@ class Worktables {
6028
5714
  body: { query },
6029
5715
  });
6030
5716
  const parsed = JSON.parse(rawResponse);
6031
- const itemsPage = (_42 = (_41 = (_40 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _40 === void 0 ? void 0 : _40.boards) === null || _41 === void 0 ? void 0 : _41[0]) === null || _42 === void 0 ? void 0 : _42.items_page;
5717
+ const itemsPage = (_35 = (_34 = (_33 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _33 === void 0 ? void 0 : _33.boards) === null || _34 === void 0 ? void 0 : _34[0]) === null || _35 === void 0 ? void 0 : _35.items_page;
6032
5718
  const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
6033
5719
  const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
6034
5720
  const hasMore = nextCursor ? true : false;
@@ -6210,7 +5896,7 @@ class Worktables {
6210
5896
  body: { query },
6211
5897
  });
6212
5898
  const parsed = JSON.parse(rawResponse);
6213
- const itemsPage = (_47 = (_46 = (_45 = (_44 = (_43 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _43 === void 0 ? void 0 : _43.boards) === null || _44 === void 0 ? void 0 : _44[0]) === null || _45 === void 0 ? void 0 : _45.groups) === null || _46 === void 0 ? void 0 : _46[0]) === null || _47 === void 0 ? void 0 : _47.items_page;
5899
+ const itemsPage = (_40 = (_39 = (_38 = (_37 = (_36 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _36 === void 0 ? void 0 : _36.boards) === null || _37 === void 0 ? void 0 : _37[0]) === null || _38 === void 0 ? void 0 : _38.groups) === null || _39 === void 0 ? void 0 : _39[0]) === null || _40 === void 0 ? void 0 : _40.items_page;
6214
5900
  const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
6215
5901
  cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
6216
5902
  allItems = allItems.concat(items);
@@ -6307,7 +5993,7 @@ class Worktables {
6307
5993
  response = await (0, isErrorResponse_1.parseApiResponse)(response);
6308
5994
  if (response.success) {
6309
5995
  const parsed = JSON.parse(response.data);
6310
- const updates = ((_50 = (_49 = (_48 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _48 === void 0 ? void 0 : _48.items) === null || _49 === void 0 ? void 0 : _49[0]) === null || _50 === void 0 ? void 0 : _50.updates) || [];
5996
+ const updates = ((_43 = (_42 = (_41 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _41 === void 0 ? void 0 : _41.items) === null || _42 === void 0 ? void 0 : _42[0]) === null || _43 === void 0 ? void 0 : _43.updates) || [];
6311
5997
  const formattedUpdates = updates.map((update) => {
6312
5998
  const pinnedToTop = update.pinned_to_top || [];
6313
5999
  const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
@@ -6372,7 +6058,7 @@ class Worktables {
6372
6058
  console.log('variables:', variables);
6373
6059
  response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
6374
6060
  console.log('Create Update Result:', JSON.stringify(response, null, 2));
6375
- const updateId = (_52 = (_51 = JSON.parse(response).data) === null || _51 === void 0 ? void 0 : _51.create_update) === null || _52 === void 0 ? void 0 : _52.id;
6061
+ const updateId = (_45 = (_44 = JSON.parse(response).data) === null || _44 === void 0 ? void 0 : _44.create_update) === null || _45 === void 0 ? void 0 : _45.id;
6376
6062
  if (!updateId) {
6377
6063
  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
6378
6064
  message: 'Error creating update: Update not created, no ID returned',
@@ -6681,7 +6367,7 @@ class Worktables {
6681
6367
  body: { query },
6682
6368
  json: true,
6683
6369
  });
6684
- const asset = (_54 = (_53 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _53 === void 0 ? void 0 : _53.assets) === null || _54 === void 0 ? void 0 : _54[0];
6370
+ const asset = (_47 = (_46 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _46 === void 0 ? void 0 : _46.assets) === null || _47 === void 0 ? void 0 : _47[0];
6685
6371
  if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
6686
6372
  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
6687
6373
  message: 'Public URL not found for the given file ID.',