@worktables/n8n-nodes-worktables 12.2.27 → 12.2.29

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.
@@ -20,6 +20,8 @@ export declare class Worktables implements INodeType {
20
20
  getSubscribersFromBoard(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
21
21
  getSubitems(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
22
22
  getColumnsItems(this: ILoadOptionsFunctions): Promise<any>;
23
+ getColumnsItemsForIdentifier(this: ILoadOptionsFunctions): Promise<any>;
24
+ getColumnsItemsForCreateOrUpdate(this: ILoadOptionsFunctions): Promise<any>;
23
25
  getFolders(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
24
26
  getUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
25
27
  getTeams(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
@@ -1014,7 +1014,7 @@ class Worktables {
1014
1014
  type: 'options',
1015
1015
  typeOptions: {
1016
1016
  loadOptionsDependsOn: ['boardId'],
1017
- loadOptionsMethod: 'getColumnsItems',
1017
+ loadOptionsMethod: 'getColumnsItemsForIdentifier',
1018
1018
  },
1019
1019
  default: '',
1020
1020
  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>.',
@@ -1257,8 +1257,8 @@ class Worktables {
1257
1257
  name: 'columnId',
1258
1258
  type: 'options',
1259
1259
  typeOptions: {
1260
- loadOptionsDependsOn: ['boardId'],
1261
- loadOptionsMethod: 'getColumnsItems',
1260
+ loadOptionsDependsOn: ['boardId', 'isSubitem'],
1261
+ loadOptionsMethod: 'getColumnsItemsForCreateOrUpdate',
1262
1262
  },
1263
1263
  default: '',
1264
1264
  },
@@ -2607,6 +2607,218 @@ class Worktables {
2607
2607
  };
2608
2608
  });
2609
2609
  },
2610
+ async getColumnsItemsForIdentifier() {
2611
+ const boardId = this.getCurrentNodeParameter('boardId');
2612
+ const credentials = await this.getCredentials('WorktablesApi');
2613
+ const apiKey = credentials === null || credentials === void 0 ? void 0 : credentials.apiKey;
2614
+ const response = await this.helpers.request({
2615
+ method: 'POST',
2616
+ url: 'https://api.monday.com/v2',
2617
+ headers: {
2618
+ Authorization: `Bearer ${apiKey}`,
2619
+ 'Content-Type': 'application/json',
2620
+ },
2621
+ body: JSON.stringify({
2622
+ query: `query {
2623
+ boards(ids: ${boardId}) {
2624
+ columns {
2625
+ id
2626
+ title
2627
+ type
2628
+ }
2629
+ items_page {
2630
+ items {
2631
+ subitems {
2632
+ board {
2633
+ columns {
2634
+ id
2635
+ title
2636
+ type
2637
+ }
2638
+ }
2639
+ }
2640
+ }
2641
+ }
2642
+ }
2643
+ }`,
2644
+ }),
2645
+ });
2646
+ const parsedResponse = JSON.parse(response);
2647
+ return parsedResponse.data.boards[0].columns
2648
+ .filter((column) => column.type !== 'subitem' &&
2649
+ column.type !== 'auto_number' &&
2650
+ column.type !== 'creation_log' &&
2651
+ column.type !== 'formula' &&
2652
+ column.type !== 'item_id' &&
2653
+ column.type !== 'last_updated' &&
2654
+ column.type !== 'progress' &&
2655
+ column.type !== 'mirror' &&
2656
+ column.type !== 'subtasks' &&
2657
+ column.type !== 'file' &&
2658
+ column.type !== 'button')
2659
+ .map((column) => {
2660
+ return {
2661
+ name: column.title,
2662
+ value: column.id,
2663
+ };
2664
+ });
2665
+ },
2666
+ async getColumnsItemsForCreateOrUpdate() {
2667
+ var _a, _b, _c, _d, _e;
2668
+ const boardId = this.getCurrentNodeParameter('boardId');
2669
+ const isSubitem = this.getCurrentNodeParameter('isSubitem') || false;
2670
+ const credentials = await this.getCredentials('WorktablesApi');
2671
+ const apiKey = credentials === null || credentials === void 0 ? void 0 : credentials.apiKey;
2672
+ if (isSubitem) {
2673
+ let parentId = null;
2674
+ try {
2675
+ parentId = this.getCurrentNodeParameter('parentId');
2676
+ }
2677
+ catch (e) {
2678
+ }
2679
+ let subitemBoardColumns = [];
2680
+ if (parentId) {
2681
+ const response = await this.helpers.request({
2682
+ method: 'POST',
2683
+ url: 'https://api.monday.com/v2',
2684
+ headers: {
2685
+ Authorization: `Bearer ${apiKey}`,
2686
+ 'Content-Type': 'application/json',
2687
+ 'API-Version': '2025-01',
2688
+ },
2689
+ body: JSON.stringify({
2690
+ query: `query {
2691
+ items(ids: [${parentId}]) {
2692
+ subitems {
2693
+ board {
2694
+ id
2695
+ columns {
2696
+ id
2697
+ title
2698
+ type
2699
+ }
2700
+ }
2701
+ }
2702
+ }
2703
+ }`,
2704
+ }),
2705
+ });
2706
+ const parsedResponse = JSON.parse(response);
2707
+ const items = ((_a = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.data) === null || _a === void 0 ? void 0 : _a.items) || [];
2708
+ if (items.length > 0 && items[0].subitems && items[0].subitems.length > 0) {
2709
+ const subitem = items[0].subitems[0];
2710
+ if (subitem.board && subitem.board.columns) {
2711
+ subitemBoardColumns = subitem.board.columns;
2712
+ }
2713
+ }
2714
+ }
2715
+ if (subitemBoardColumns.length === 0) {
2716
+ const response = await this.helpers.request({
2717
+ method: 'POST',
2718
+ url: 'https://api.monday.com/v2',
2719
+ headers: {
2720
+ Authorization: `Bearer ${apiKey}`,
2721
+ 'Content-Type': 'application/json',
2722
+ 'API-Version': '2025-01',
2723
+ },
2724
+ body: JSON.stringify({
2725
+ query: `query {
2726
+ boards(ids: ${boardId}) {
2727
+ items_page(limit: 25) {
2728
+ items {
2729
+ subitems {
2730
+ board {
2731
+ id
2732
+ columns {
2733
+ id
2734
+ title
2735
+ type
2736
+ }
2737
+ }
2738
+ }
2739
+ }
2740
+ }
2741
+ }
2742
+ }`,
2743
+ }),
2744
+ });
2745
+ const parsedResponse = JSON.parse(response);
2746
+ const items = ((_e = (_d = (_c = (_b = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.data) === null || _b === void 0 ? void 0 : _b.boards) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.items_page) === null || _e === void 0 ? void 0 : _e.items) || [];
2747
+ for (const item of items) {
2748
+ if (item.subitems && item.subitems.length > 0) {
2749
+ const subitem = item.subitems[0];
2750
+ if (subitem.board && subitem.board.columns) {
2751
+ subitemBoardColumns = subitem.board.columns;
2752
+ break;
2753
+ }
2754
+ }
2755
+ }
2756
+ }
2757
+ if (subitemBoardColumns.length === 0) {
2758
+ console.log('No subitems found in board, cannot load subitem columns');
2759
+ return [];
2760
+ }
2761
+ return subitemBoardColumns
2762
+ .filter((column) => column.type !== 'subitem' &&
2763
+ column.type !== 'auto_number' &&
2764
+ column.type !== 'creation_log' &&
2765
+ column.type !== 'formula' &&
2766
+ column.type !== 'item_id' &&
2767
+ column.type !== 'last_updated' &&
2768
+ column.type !== 'progress' &&
2769
+ column.type !== 'mirror' &&
2770
+ column.type !== 'subtasks' &&
2771
+ column.type !== 'file' &&
2772
+ column.type !== 'button')
2773
+ .map((column) => {
2774
+ return {
2775
+ name: column.title,
2776
+ value: column.id,
2777
+ };
2778
+ });
2779
+ }
2780
+ else {
2781
+ const response = await this.helpers.request({
2782
+ method: 'POST',
2783
+ url: 'https://api.monday.com/v2',
2784
+ headers: {
2785
+ Authorization: `Bearer ${apiKey}`,
2786
+ 'Content-Type': 'application/json',
2787
+ 'API-Version': '2025-01',
2788
+ },
2789
+ body: JSON.stringify({
2790
+ query: `query {
2791
+ boards(ids: ${boardId}) {
2792
+ columns {
2793
+ id
2794
+ title
2795
+ type
2796
+ }
2797
+ }
2798
+ }`,
2799
+ }),
2800
+ });
2801
+ const parsedResponse = JSON.parse(response);
2802
+ return parsedResponse.data.boards[0].columns
2803
+ .filter((column) => column.type !== 'subitem' &&
2804
+ column.type !== 'auto_number' &&
2805
+ column.type !== 'creation_log' &&
2806
+ column.type !== 'formula' &&
2807
+ column.type !== 'item_id' &&
2808
+ column.type !== 'last_updated' &&
2809
+ column.type !== 'progress' &&
2810
+ column.type !== 'mirror' &&
2811
+ column.type !== 'subtasks' &&
2812
+ column.type !== 'file' &&
2813
+ column.type !== 'button')
2814
+ .map((column) => {
2815
+ return {
2816
+ name: column.title,
2817
+ value: column.id,
2818
+ };
2819
+ });
2820
+ }
2821
+ },
2610
2822
  async getFolders() {
2611
2823
  const workspaceId = this.getNodeParameter('workspace');
2612
2824
  const credentials = await this.getCredentials('WorktablesApi');
@@ -2814,7 +3026,7 @@ class Worktables {
2814
3026
  };
2815
3027
  }
2816
3028
  async execute() {
2817
- 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;
3029
+ 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;
2818
3030
  const resource = this.getNodeParameter('resource', 0);
2819
3031
  const operation = this.getNodeParameter('operation', 0);
2820
3032
  const credentials = await this.getCredentials('WorktablesApi');
@@ -4331,12 +4543,36 @@ class Worktables {
4331
4543
  let foundItemId = null;
4332
4544
  if (identifierValue && identifierValue.trim() !== '' && identifierColumn && identifierColumn.trim() !== '') {
4333
4545
  console.log('Searching for item/subitem with identifier column:', identifierColumn, 'value:', identifierValue, 'isSubitem:', isSubitem);
4546
+ const parentId = this.getNodeParameter('parentId', 0, false);
4334
4547
  let cursor = null;
4335
4548
  let hasMore = true;
4336
4549
  while (hasMore && !foundItemId) {
4337
4550
  const cursorParam = cursor ? `, cursor: "${cursor}"` : '';
4338
- const searchQuery = isSubitem
4551
+ const searchQuery = isSubitem && parentId
4339
4552
  ? `query {
4553
+ items(ids: [${parentId}]) {
4554
+ id
4555
+ name
4556
+ subitems {
4557
+ id
4558
+ name
4559
+ column_values(ids: ["${identifierColumn}"]) {
4560
+ id
4561
+ text
4562
+ value
4563
+ type
4564
+ ... on BoardRelationValue {
4565
+ display_value
4566
+ }
4567
+ ... on MirrorValue {
4568
+ display_value
4569
+ }
4570
+ }
4571
+ }
4572
+ }
4573
+ }`
4574
+ : isSubitem
4575
+ ? `query {
4340
4576
  boards(ids: [${boardId}]) {
4341
4577
  items_page(limit: 100${cursorParam}) {
4342
4578
  items {
@@ -4363,7 +4599,7 @@ class Worktables {
4363
4599
  }
4364
4600
  }
4365
4601
  }`
4366
- : `query {
4602
+ : `query {
4367
4603
  boards(ids: [${boardId}]) {
4368
4604
  items_page(limit: 100${cursorParam}) {
4369
4605
  items {
@@ -4393,9 +4629,24 @@ class Worktables {
4393
4629
  body: { query: searchQuery },
4394
4630
  });
4395
4631
  const searchData = JSON.parse(searchResponse);
4396
- 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;
4397
- const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
4398
- cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
4632
+ let items = [];
4633
+ let nextCursor = null;
4634
+ if (isSubitem && parentId) {
4635
+ items = ((_x = searchData === null || searchData === void 0 ? void 0 : searchData.data) === null || _x === void 0 ? void 0 : _x.items) || [];
4636
+ hasMore = false;
4637
+ console.log(`🔍 Searching subitems of parent ${parentId}, found ${items.length} parent item(s)`);
4638
+ if (items.length > 0 && items[0].subitems) {
4639
+ console.log(`🔍 Parent item has ${items[0].subitems.length} subitem(s)`);
4640
+ }
4641
+ }
4642
+ else {
4643
+ const itemsPage = (_0 = (_z = (_y = searchData === null || searchData === void 0 ? void 0 : searchData.data) === null || _y === void 0 ? void 0 : _y.boards) === null || _z === void 0 ? void 0 : _z[0]) === null || _0 === void 0 ? void 0 : _0.items_page;
4644
+ items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
4645
+ nextCursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
4646
+ hasMore = nextCursor !== null && items.length > 0 && !foundItemId;
4647
+ console.log(`🔍 Searching in board, found ${items.length} item(s)`);
4648
+ }
4649
+ cursor = nextCursor;
4399
4650
  const isNameColumn = identifierColumn === 'name' || identifierColumn.toLowerCase() === 'name';
4400
4651
  if (isSubitem) {
4401
4652
  for (const item of items) {
@@ -4408,7 +4659,7 @@ class Worktables {
4408
4659
  matches = subitemName === searchValue;
4409
4660
  }
4410
4661
  else {
4411
- const colValue = (_0 = subitem.column_values) === null || _0 === void 0 ? void 0 : _0.find((cv) => cv.id === identifierColumn);
4662
+ const colValue = (_1 = subitem.column_values) === null || _1 === void 0 ? void 0 : _1.find((cv) => cv.id === identifierColumn);
4412
4663
  if (colValue) {
4413
4664
  const isBoardRelation = colValue.type === 'board_relation';
4414
4665
  const compareValue = isBoardRelation
@@ -4448,7 +4699,7 @@ class Worktables {
4448
4699
  matches = itemName === searchValue;
4449
4700
  }
4450
4701
  else {
4451
- const colValue = (_1 = item.column_values) === null || _1 === void 0 ? void 0 : _1.find((cv) => cv.id === identifierColumn);
4702
+ const colValue = (_2 = item.column_values) === null || _2 === void 0 ? void 0 : _2.find((cv) => cv.id === identifierColumn);
4452
4703
  if (colValue) {
4453
4704
  const isBoardRelation = colValue.type === 'board_relation';
4454
4705
  const compareValue = isBoardRelation
@@ -4513,7 +4764,7 @@ class Worktables {
4513
4764
  id: itemData.id,
4514
4765
  url: itemData.url || '',
4515
4766
  operation: 'update',
4516
- board_id: ((_2 = itemData.board) === null || _2 === void 0 ? void 0 : _2.id) || boardId,
4767
+ board_id: ((_3 = itemData.board) === null || _3 === void 0 ? void 0 : _3.id) || boardId,
4517
4768
  column_values: column_values_object,
4518
4769
  };
4519
4770
  itemUpdated = true;
@@ -4535,7 +4786,10 @@ class Worktables {
4535
4786
  }
4536
4787
  }
4537
4788
  else {
4538
- console.log(`${isSubitem ? 'Subitem' : 'Item'} not found with identifier value "${identifierValue}", will create new ${isSubitem ? 'subitem' : 'item'}`);
4789
+ console.log(`❌ ${isSubitem ? 'Subitem' : 'Item'} not found with identifier column "${identifierColumn}" and value "${identifierValue}", will create new ${isSubitem ? 'subitem' : 'item'}`);
4790
+ if (isSubitem && parentId) {
4791
+ console.log(` Parent ID: ${parentId}`);
4792
+ }
4539
4793
  itemUpdated = false;
4540
4794
  }
4541
4795
  }
@@ -4546,6 +4800,11 @@ class Worktables {
4546
4800
  if (!itemUpdated) {
4547
4801
  console.log(`Creating new ${isSubitem ? 'subitem' : 'item'}:`, itemName);
4548
4802
  const parentId = this.getNodeParameter('parentId', 0, false);
4803
+ if (isSubitem && !parentId) {
4804
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), {
4805
+ message: 'Parent Item is required when creating a subitem. Please select a parent item.',
4806
+ });
4807
+ }
4549
4808
  const escapedItemName = (0, worktablesHelpers_1.escapeGraphQLString)(itemName);
4550
4809
  const escapedColumnValues = (0, worktablesHelpers_1.escapeGraphQLJSONString)(column_values_object);
4551
4810
  if (isSubitem && parentId) {
@@ -4596,8 +4855,8 @@ class Worktables {
4596
4855
  });
4597
4856
  }
4598
4857
  const itemData = isSubitem && parentId
4599
- ? (_3 = responseData.data) === null || _3 === void 0 ? void 0 : _3.create_subitem
4600
- : (_4 = responseData.data) === null || _4 === void 0 ? void 0 : _4.create_item;
4858
+ ? (_4 = responseData.data) === null || _4 === void 0 ? void 0 : _4.create_subitem
4859
+ : (_5 = responseData.data) === null || _5 === void 0 ? void 0 : _5.create_item;
4601
4860
  if (!itemData || !itemData.id) {
4602
4861
  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
4603
4862
  message: `Error creating ${isSubitem ? 'subitem' : 'item'}: No item data returned`,
@@ -4608,7 +4867,7 @@ class Worktables {
4608
4867
  name: itemData.name || itemName,
4609
4868
  url: itemData.url || '',
4610
4869
  operation: 'create',
4611
- board_id: ((_5 = itemData.board) === null || _5 === void 0 ? void 0 : _5.id) || boardId,
4870
+ board_id: ((_6 = itemData.board) === null || _6 === void 0 ? void 0 : _6.id) || boardId,
4612
4871
  column_values: column_values_object,
4613
4872
  };
4614
4873
  if (isSubitem && parentId) {
@@ -4747,7 +5006,7 @@ class Worktables {
4747
5006
  body: { query },
4748
5007
  });
4749
5008
  const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
4750
- const itemsPage = (_8 = (_7 = (_6 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _6 === void 0 ? void 0 : _6.boards) === null || _7 === void 0 ? void 0 : _7[0]) === null || _8 === void 0 ? void 0 : _8.items_page;
5009
+ const itemsPage = (_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;
4751
5010
  const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
4752
5011
  cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
4753
5012
  allItems = allItems.concat(items);
@@ -4826,7 +5085,7 @@ class Worktables {
4826
5085
  const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
4827
5086
  const logicalOperator = this.getNodeParameter('logicalOperator', 0);
4828
5087
  let rulesArray = [];
4829
- if (((_9 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _9 === void 0 ? void 0 : _9.length) > 0) {
5088
+ if (((_10 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _10 === void 0 ? void 0 : _10.length) > 0) {
4830
5089
  rulesArray = filterRules.rule.map((rule) => {
4831
5090
  let formattedValue;
4832
5091
  if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
@@ -4870,7 +5129,7 @@ class Worktables {
4870
5129
  });
4871
5130
  }
4872
5131
  const orderByArray = [];
4873
- if (((_10 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _10 === void 0 ? void 0 : _10.length) > 0) {
5132
+ if (((_11 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _11 === void 0 ? void 0 : _11.length) > 0) {
4874
5133
  sortOptions.sortBy.forEach((sort) => {
4875
5134
  orderByArray.push(`{
4876
5135
  column_id: "${sort.columnId}",
@@ -4926,7 +5185,7 @@ class Worktables {
4926
5185
  body: { query },
4927
5186
  });
4928
5187
  const parsed = JSON.parse(rawResponse);
4929
- const items = ((_14 = (_13 = (_12 = (_11 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _11 === void 0 ? void 0 : _11.boards) === null || _12 === void 0 ? void 0 : _12[0]) === null || _13 === void 0 ? void 0 : _13.items_page) === null || _14 === void 0 ? void 0 : _14.items) || [];
5188
+ const items = ((_15 = (_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) === null || _15 === void 0 ? void 0 : _15.items) || [];
4930
5189
  const formattedItems = await Promise.all(items.map(async (item) => {
4931
5190
  const formatted = {
4932
5191
  id: item.id,
@@ -4960,7 +5219,7 @@ class Worktables {
4960
5219
  const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
4961
5220
  const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
4962
5221
  let rulesArray = [];
4963
- if (((_15 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _15 === void 0 ? void 0 : _15.length) > 0) {
5222
+ if (((_16 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _16 === void 0 ? void 0 : _16.length) > 0) {
4964
5223
  console.log('Processing filter rules:', advancedFilterRules.rule);
4965
5224
  rulesArray = advancedFilterRules.rule.map((rule) => {
4966
5225
  let formattedValue;
@@ -5176,7 +5435,7 @@ class Worktables {
5176
5435
  });
5177
5436
  }
5178
5437
  const orderByArray = [];
5179
- if (((_16 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _16 === void 0 ? void 0 : _16.length) > 0) {
5438
+ if (((_17 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _17 === void 0 ? void 0 : _17.length) > 0) {
5180
5439
  advancedSortOptions.sortBy.forEach((sort) => {
5181
5440
  orderByArray.push(`{
5182
5441
  column_id: "${sort.columnId}",
@@ -5258,7 +5517,7 @@ class Worktables {
5258
5517
  body: { query: testQuery },
5259
5518
  });
5260
5519
  const testParsed = JSON.parse(testResponse);
5261
- const testItems = ((_20 = (_19 = (_18 = (_17 = testParsed === null || testParsed === void 0 ? void 0 : testParsed.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) === null || _20 === void 0 ? void 0 : _20.items) || [];
5520
+ const testItems = ((_21 = (_20 = (_19 = (_18 = testParsed === null || testParsed === void 0 ? void 0 : testParsed.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) === null || _21 === void 0 ? void 0 : _21.items) || [];
5262
5521
  console.log('Test - Items in board (no filters):', testItems.length);
5263
5522
  if (testItems.length > 0) {
5264
5523
  console.log('Sample item column values:', testItems[0].column_values);
@@ -5270,7 +5529,7 @@ class Worktables {
5270
5529
  body: { query },
5271
5530
  });
5272
5531
  const parsed = JSON.parse(rawResponse);
5273
- const itemsPage = (_23 = (_22 = (_21 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _21 === void 0 ? void 0 : _21.boards) === null || _22 === void 0 ? void 0 : _22[0]) === null || _23 === void 0 ? void 0 : _23.items_page;
5532
+ const itemsPage = (_24 = (_23 = (_22 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _22 === void 0 ? void 0 : _22.boards) === null || _23 === void 0 ? void 0 : _23[0]) === null || _24 === void 0 ? void 0 : _24.items_page;
5274
5533
  const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
5275
5534
  const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
5276
5535
  const hasMore = nextCursor ? true : false;
@@ -5434,7 +5693,7 @@ class Worktables {
5434
5693
  body: { query },
5435
5694
  });
5436
5695
  const parsed = JSON.parse(rawResponse);
5437
- const items = ((_29 = (_28 = (_27 = (_26 = (_25 = (_24 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _24 === void 0 ? void 0 : _24.boards) === null || _25 === void 0 ? void 0 : _25[0]) === null || _26 === void 0 ? void 0 : _26.groups) === null || _27 === void 0 ? void 0 : _27[0]) === null || _28 === void 0 ? void 0 : _28.items_page) === null || _29 === void 0 ? void 0 : _29.items) || [];
5696
+ const items = ((_30 = (_29 = (_28 = (_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.groups) === null || _28 === void 0 ? void 0 : _28[0]) === null || _29 === void 0 ? void 0 : _29.items_page) === null || _30 === void 0 ? void 0 : _30.items) || [];
5438
5697
  const formattedItems = await Promise.all(items.map(async (item) => {
5439
5698
  const columnValues = item.column_values || [];
5440
5699
  const formatted = {
@@ -5523,7 +5782,7 @@ class Worktables {
5523
5782
  response = await (0, isErrorResponse_1.parseApiResponse)(response);
5524
5783
  if (response.success) {
5525
5784
  const parsed = JSON.parse(response.data);
5526
- const updates = ((_32 = (_31 = (_30 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _30 === void 0 ? void 0 : _30.items) === null || _31 === void 0 ? void 0 : _31[0]) === null || _32 === void 0 ? void 0 : _32.updates) || [];
5785
+ const updates = ((_33 = (_32 = (_31 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _31 === void 0 ? void 0 : _31.items) === null || _32 === void 0 ? void 0 : _32[0]) === null || _33 === void 0 ? void 0 : _33.updates) || [];
5527
5786
  const formattedUpdates = updates.map((update) => {
5528
5787
  const pinnedToTop = update.pinned_to_top || [];
5529
5788
  const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
@@ -5588,7 +5847,7 @@ class Worktables {
5588
5847
  console.log('variables:', variables);
5589
5848
  response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
5590
5849
  console.log('Create Update Result:', JSON.stringify(response, null, 2));
5591
- const updateId = (_34 = (_33 = JSON.parse(response).data) === null || _33 === void 0 ? void 0 : _33.create_update) === null || _34 === void 0 ? void 0 : _34.id;
5850
+ const updateId = (_35 = (_34 = JSON.parse(response).data) === null || _34 === void 0 ? void 0 : _34.create_update) === null || _35 === void 0 ? void 0 : _35.id;
5592
5851
  if (!updateId) {
5593
5852
  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
5594
5853
  message: 'Error creating update: Update not created, no ID returned',
@@ -5897,7 +6156,7 @@ class Worktables {
5897
6156
  body: { query },
5898
6157
  json: true,
5899
6158
  });
5900
- const asset = (_36 = (_35 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _35 === void 0 ? void 0 : _35.assets) === null || _36 === void 0 ? void 0 : _36[0];
6159
+ const asset = (_37 = (_36 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _36 === void 0 ? void 0 : _36.assets) === null || _37 === void 0 ? void 0 : _37[0];
5901
6160
  if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
5902
6161
  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
5903
6162
  message: 'Public URL not found for the given file ID.',