@worktables/n8n-nodes-worktables 12.2.28 → 12.2.30
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.
|
@@ -1013,7 +1013,7 @@ class Worktables {
|
|
|
1013
1013
|
name: 'identifierColumn',
|
|
1014
1014
|
type: 'options',
|
|
1015
1015
|
typeOptions: {
|
|
1016
|
-
loadOptionsDependsOn: ['boardId'],
|
|
1016
|
+
loadOptionsDependsOn: ['boardId', 'isSubitem'],
|
|
1017
1017
|
loadOptionsMethod: 'getColumnsItemsForIdentifier',
|
|
1018
1018
|
},
|
|
1019
1019
|
default: '',
|
|
@@ -2608,28 +2608,71 @@ class Worktables {
|
|
|
2608
2608
|
});
|
|
2609
2609
|
},
|
|
2610
2610
|
async getColumnsItemsForIdentifier() {
|
|
2611
|
+
var _a, _b, _c, _d, _e;
|
|
2611
2612
|
const boardId = this.getCurrentNodeParameter('boardId');
|
|
2613
|
+
const isSubitem = this.getCurrentNodeParameter('isSubitem') || false;
|
|
2612
2614
|
const credentials = await this.getCredentials('WorktablesApi');
|
|
2613
2615
|
const apiKey = credentials === null || credentials === void 0 ? void 0 : credentials.apiKey;
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
}
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2616
|
+
if (isSubitem) {
|
|
2617
|
+
let parentId = null;
|
|
2618
|
+
try {
|
|
2619
|
+
parentId = this.getCurrentNodeParameter('parentId');
|
|
2620
|
+
}
|
|
2621
|
+
catch (e) {
|
|
2622
|
+
}
|
|
2623
|
+
let subitemBoardColumns = [];
|
|
2624
|
+
if (parentId) {
|
|
2625
|
+
const response = await this.helpers.request({
|
|
2626
|
+
method: 'POST',
|
|
2627
|
+
url: 'https://api.monday.com/v2',
|
|
2628
|
+
headers: {
|
|
2629
|
+
Authorization: `Bearer ${apiKey}`,
|
|
2630
|
+
'Content-Type': 'application/json',
|
|
2631
|
+
'API-Version': '2025-01',
|
|
2632
|
+
},
|
|
2633
|
+
body: JSON.stringify({
|
|
2634
|
+
query: `query {
|
|
2635
|
+
items(ids: [${parentId}]) {
|
|
2636
|
+
subitems {
|
|
2637
|
+
board {
|
|
2638
|
+
id
|
|
2639
|
+
columns {
|
|
2640
|
+
id
|
|
2641
|
+
title
|
|
2642
|
+
type
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2628
2645
|
}
|
|
2629
|
-
|
|
2646
|
+
}
|
|
2647
|
+
}`,
|
|
2648
|
+
}),
|
|
2649
|
+
});
|
|
2650
|
+
const parsedResponse = JSON.parse(response);
|
|
2651
|
+
const items = ((_a = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.data) === null || _a === void 0 ? void 0 : _a.items) || [];
|
|
2652
|
+
if (items.length > 0 && items[0].subitems && items[0].subitems.length > 0) {
|
|
2653
|
+
const subitem = items[0].subitems[0];
|
|
2654
|
+
if (subitem.board && subitem.board.columns) {
|
|
2655
|
+
subitemBoardColumns = subitem.board.columns;
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
}
|
|
2659
|
+
if (subitemBoardColumns.length === 0) {
|
|
2660
|
+
const response = await this.helpers.request({
|
|
2661
|
+
method: 'POST',
|
|
2662
|
+
url: 'https://api.monday.com/v2',
|
|
2663
|
+
headers: {
|
|
2664
|
+
Authorization: `Bearer ${apiKey}`,
|
|
2665
|
+
'Content-Type': 'application/json',
|
|
2666
|
+
'API-Version': '2025-01',
|
|
2667
|
+
},
|
|
2668
|
+
body: JSON.stringify({
|
|
2669
|
+
query: `query {
|
|
2670
|
+
boards(ids: ${boardId}) {
|
|
2671
|
+
items_page(limit: 25) {
|
|
2630
2672
|
items {
|
|
2631
2673
|
subitems {
|
|
2632
2674
|
board {
|
|
2675
|
+
id
|
|
2633
2676
|
columns {
|
|
2634
2677
|
id
|
|
2635
2678
|
title
|
|
@@ -2641,27 +2684,84 @@ class Worktables {
|
|
|
2641
2684
|
}
|
|
2642
2685
|
}
|
|
2643
2686
|
}`,
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2687
|
+
}),
|
|
2688
|
+
});
|
|
2689
|
+
const parsedResponse = JSON.parse(response);
|
|
2690
|
+
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) || [];
|
|
2691
|
+
for (const item of items) {
|
|
2692
|
+
if (item.subitems && item.subitems.length > 0) {
|
|
2693
|
+
const subitem = item.subitems[0];
|
|
2694
|
+
if (subitem.board && subitem.board.columns) {
|
|
2695
|
+
subitemBoardColumns = subitem.board.columns;
|
|
2696
|
+
break;
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
if (subitemBoardColumns.length === 0) {
|
|
2702
|
+
console.log('No subitems found in board, cannot load subitem columns for identifier');
|
|
2703
|
+
return [];
|
|
2704
|
+
}
|
|
2705
|
+
return subitemBoardColumns
|
|
2706
|
+
.filter((column) => column.type !== 'subitem' &&
|
|
2707
|
+
column.type !== 'auto_number' &&
|
|
2708
|
+
column.type !== 'creation_log' &&
|
|
2709
|
+
column.type !== 'formula' &&
|
|
2710
|
+
column.type !== 'item_id' &&
|
|
2711
|
+
column.type !== 'last_updated' &&
|
|
2712
|
+
column.type !== 'progress' &&
|
|
2713
|
+
column.type !== 'mirror' &&
|
|
2714
|
+
column.type !== 'subtasks' &&
|
|
2715
|
+
column.type !== 'file' &&
|
|
2716
|
+
column.type !== 'button')
|
|
2717
|
+
.map((column) => {
|
|
2718
|
+
return {
|
|
2719
|
+
name: column.title,
|
|
2720
|
+
value: column.id,
|
|
2721
|
+
};
|
|
2722
|
+
});
|
|
2723
|
+
}
|
|
2724
|
+
else {
|
|
2725
|
+
const response = await this.helpers.request({
|
|
2726
|
+
method: 'POST',
|
|
2727
|
+
url: 'https://api.monday.com/v2',
|
|
2728
|
+
headers: {
|
|
2729
|
+
Authorization: `Bearer ${apiKey}`,
|
|
2730
|
+
'Content-Type': 'application/json',
|
|
2731
|
+
'API-Version': '2025-01',
|
|
2732
|
+
},
|
|
2733
|
+
body: JSON.stringify({
|
|
2734
|
+
query: `query {
|
|
2735
|
+
boards(ids: ${boardId}) {
|
|
2736
|
+
columns {
|
|
2737
|
+
id
|
|
2738
|
+
title
|
|
2739
|
+
type
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
}`,
|
|
2743
|
+
}),
|
|
2744
|
+
});
|
|
2745
|
+
const parsedResponse = JSON.parse(response);
|
|
2746
|
+
return parsedResponse.data.boards[0].columns
|
|
2747
|
+
.filter((column) => column.type !== 'subitem' &&
|
|
2748
|
+
column.type !== 'auto_number' &&
|
|
2749
|
+
column.type !== 'creation_log' &&
|
|
2750
|
+
column.type !== 'formula' &&
|
|
2751
|
+
column.type !== 'item_id' &&
|
|
2752
|
+
column.type !== 'last_updated' &&
|
|
2753
|
+
column.type !== 'progress' &&
|
|
2754
|
+
column.type !== 'mirror' &&
|
|
2755
|
+
column.type !== 'subtasks' &&
|
|
2756
|
+
column.type !== 'file' &&
|
|
2757
|
+
column.type !== 'button')
|
|
2758
|
+
.map((column) => {
|
|
2759
|
+
return {
|
|
2760
|
+
name: column.title,
|
|
2761
|
+
value: column.id,
|
|
2762
|
+
};
|
|
2763
|
+
});
|
|
2764
|
+
}
|
|
2665
2765
|
},
|
|
2666
2766
|
async getColumnsItemsForCreateOrUpdate() {
|
|
2667
2767
|
var _a, _b, _c, _d, _e;
|
|
@@ -3026,7 +3126,7 @@ class Worktables {
|
|
|
3026
3126
|
};
|
|
3027
3127
|
}
|
|
3028
3128
|
async execute() {
|
|
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;
|
|
3129
|
+
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;
|
|
3030
3130
|
const resource = this.getNodeParameter('resource', 0);
|
|
3031
3131
|
const operation = this.getNodeParameter('operation', 0);
|
|
3032
3132
|
const credentials = await this.getCredentials('WorktablesApi');
|
|
@@ -4543,12 +4643,36 @@ class Worktables {
|
|
|
4543
4643
|
let foundItemId = null;
|
|
4544
4644
|
if (identifierValue && identifierValue.trim() !== '' && identifierColumn && identifierColumn.trim() !== '') {
|
|
4545
4645
|
console.log('Searching for item/subitem with identifier column:', identifierColumn, 'value:', identifierValue, 'isSubitem:', isSubitem);
|
|
4646
|
+
const parentId = this.getNodeParameter('parentId', 0, false);
|
|
4546
4647
|
let cursor = null;
|
|
4547
4648
|
let hasMore = true;
|
|
4548
4649
|
while (hasMore && !foundItemId) {
|
|
4549
4650
|
const cursorParam = cursor ? `, cursor: "${cursor}"` : '';
|
|
4550
|
-
const searchQuery = isSubitem
|
|
4651
|
+
const searchQuery = isSubitem && parentId
|
|
4551
4652
|
? `query {
|
|
4653
|
+
items(ids: [${parentId}]) {
|
|
4654
|
+
id
|
|
4655
|
+
name
|
|
4656
|
+
subitems {
|
|
4657
|
+
id
|
|
4658
|
+
name
|
|
4659
|
+
column_values(ids: ["${identifierColumn}"]) {
|
|
4660
|
+
id
|
|
4661
|
+
text
|
|
4662
|
+
value
|
|
4663
|
+
type
|
|
4664
|
+
... on BoardRelationValue {
|
|
4665
|
+
display_value
|
|
4666
|
+
}
|
|
4667
|
+
... on MirrorValue {
|
|
4668
|
+
display_value
|
|
4669
|
+
}
|
|
4670
|
+
}
|
|
4671
|
+
}
|
|
4672
|
+
}
|
|
4673
|
+
}`
|
|
4674
|
+
: isSubitem
|
|
4675
|
+
? `query {
|
|
4552
4676
|
boards(ids: [${boardId}]) {
|
|
4553
4677
|
items_page(limit: 100${cursorParam}) {
|
|
4554
4678
|
items {
|
|
@@ -4575,7 +4699,7 @@ class Worktables {
|
|
|
4575
4699
|
}
|
|
4576
4700
|
}
|
|
4577
4701
|
}`
|
|
4578
|
-
|
|
4702
|
+
: `query {
|
|
4579
4703
|
boards(ids: [${boardId}]) {
|
|
4580
4704
|
items_page(limit: 100${cursorParam}) {
|
|
4581
4705
|
items {
|
|
@@ -4605,9 +4729,24 @@ class Worktables {
|
|
|
4605
4729
|
body: { query: searchQuery },
|
|
4606
4730
|
});
|
|
4607
4731
|
const searchData = JSON.parse(searchResponse);
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4732
|
+
let items = [];
|
|
4733
|
+
let nextCursor = null;
|
|
4734
|
+
if (isSubitem && parentId) {
|
|
4735
|
+
items = ((_x = searchData === null || searchData === void 0 ? void 0 : searchData.data) === null || _x === void 0 ? void 0 : _x.items) || [];
|
|
4736
|
+
hasMore = false;
|
|
4737
|
+
console.log(`🔍 Searching subitems of parent ${parentId}, found ${items.length} parent item(s)`);
|
|
4738
|
+
if (items.length > 0 && items[0].subitems) {
|
|
4739
|
+
console.log(`🔍 Parent item has ${items[0].subitems.length} subitem(s)`);
|
|
4740
|
+
}
|
|
4741
|
+
}
|
|
4742
|
+
else {
|
|
4743
|
+
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;
|
|
4744
|
+
items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4745
|
+
nextCursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4746
|
+
hasMore = nextCursor !== null && items.length > 0 && !foundItemId;
|
|
4747
|
+
console.log(`🔍 Searching in board, found ${items.length} item(s)`);
|
|
4748
|
+
}
|
|
4749
|
+
cursor = nextCursor;
|
|
4611
4750
|
const isNameColumn = identifierColumn === 'name' || identifierColumn.toLowerCase() === 'name';
|
|
4612
4751
|
if (isSubitem) {
|
|
4613
4752
|
for (const item of items) {
|
|
@@ -4620,7 +4759,7 @@ class Worktables {
|
|
|
4620
4759
|
matches = subitemName === searchValue;
|
|
4621
4760
|
}
|
|
4622
4761
|
else {
|
|
4623
|
-
const colValue = (
|
|
4762
|
+
const colValue = (_1 = subitem.column_values) === null || _1 === void 0 ? void 0 : _1.find((cv) => cv.id === identifierColumn);
|
|
4624
4763
|
if (colValue) {
|
|
4625
4764
|
const isBoardRelation = colValue.type === 'board_relation';
|
|
4626
4765
|
const compareValue = isBoardRelation
|
|
@@ -4660,7 +4799,7 @@ class Worktables {
|
|
|
4660
4799
|
matches = itemName === searchValue;
|
|
4661
4800
|
}
|
|
4662
4801
|
else {
|
|
4663
|
-
const colValue = (
|
|
4802
|
+
const colValue = (_2 = item.column_values) === null || _2 === void 0 ? void 0 : _2.find((cv) => cv.id === identifierColumn);
|
|
4664
4803
|
if (colValue) {
|
|
4665
4804
|
const isBoardRelation = colValue.type === 'board_relation';
|
|
4666
4805
|
const compareValue = isBoardRelation
|
|
@@ -4725,7 +4864,7 @@ class Worktables {
|
|
|
4725
4864
|
id: itemData.id,
|
|
4726
4865
|
url: itemData.url || '',
|
|
4727
4866
|
operation: 'update',
|
|
4728
|
-
board_id: ((
|
|
4867
|
+
board_id: ((_3 = itemData.board) === null || _3 === void 0 ? void 0 : _3.id) || boardId,
|
|
4729
4868
|
column_values: column_values_object,
|
|
4730
4869
|
};
|
|
4731
4870
|
itemUpdated = true;
|
|
@@ -4747,7 +4886,10 @@ class Worktables {
|
|
|
4747
4886
|
}
|
|
4748
4887
|
}
|
|
4749
4888
|
else {
|
|
4750
|
-
console.log(
|
|
4889
|
+
console.log(`❌ ${isSubitem ? 'Subitem' : 'Item'} not found with identifier column "${identifierColumn}" and value "${identifierValue}", will create new ${isSubitem ? 'subitem' : 'item'}`);
|
|
4890
|
+
if (isSubitem && parentId) {
|
|
4891
|
+
console.log(` Parent ID: ${parentId}`);
|
|
4892
|
+
}
|
|
4751
4893
|
itemUpdated = false;
|
|
4752
4894
|
}
|
|
4753
4895
|
}
|
|
@@ -4813,8 +4955,8 @@ class Worktables {
|
|
|
4813
4955
|
});
|
|
4814
4956
|
}
|
|
4815
4957
|
const itemData = isSubitem && parentId
|
|
4816
|
-
? (
|
|
4817
|
-
: (
|
|
4958
|
+
? (_4 = responseData.data) === null || _4 === void 0 ? void 0 : _4.create_subitem
|
|
4959
|
+
: (_5 = responseData.data) === null || _5 === void 0 ? void 0 : _5.create_item;
|
|
4818
4960
|
if (!itemData || !itemData.id) {
|
|
4819
4961
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
4820
4962
|
message: `Error creating ${isSubitem ? 'subitem' : 'item'}: No item data returned`,
|
|
@@ -4825,7 +4967,7 @@ class Worktables {
|
|
|
4825
4967
|
name: itemData.name || itemName,
|
|
4826
4968
|
url: itemData.url || '',
|
|
4827
4969
|
operation: 'create',
|
|
4828
|
-
board_id: ((
|
|
4970
|
+
board_id: ((_6 = itemData.board) === null || _6 === void 0 ? void 0 : _6.id) || boardId,
|
|
4829
4971
|
column_values: column_values_object,
|
|
4830
4972
|
};
|
|
4831
4973
|
if (isSubitem && parentId) {
|
|
@@ -4964,7 +5106,7 @@ class Worktables {
|
|
|
4964
5106
|
body: { query },
|
|
4965
5107
|
});
|
|
4966
5108
|
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
4967
|
-
const itemsPage = (
|
|
5109
|
+
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;
|
|
4968
5110
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4969
5111
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4970
5112
|
allItems = allItems.concat(items);
|
|
@@ -5043,7 +5185,7 @@ class Worktables {
|
|
|
5043
5185
|
const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
|
|
5044
5186
|
const logicalOperator = this.getNodeParameter('logicalOperator', 0);
|
|
5045
5187
|
let rulesArray = [];
|
|
5046
|
-
if (((
|
|
5188
|
+
if (((_10 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _10 === void 0 ? void 0 : _10.length) > 0) {
|
|
5047
5189
|
rulesArray = filterRules.rule.map((rule) => {
|
|
5048
5190
|
let formattedValue;
|
|
5049
5191
|
if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
|
|
@@ -5087,7 +5229,7 @@ class Worktables {
|
|
|
5087
5229
|
});
|
|
5088
5230
|
}
|
|
5089
5231
|
const orderByArray = [];
|
|
5090
|
-
if (((
|
|
5232
|
+
if (((_11 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _11 === void 0 ? void 0 : _11.length) > 0) {
|
|
5091
5233
|
sortOptions.sortBy.forEach((sort) => {
|
|
5092
5234
|
orderByArray.push(`{
|
|
5093
5235
|
column_id: "${sort.columnId}",
|
|
@@ -5143,7 +5285,7 @@ class Worktables {
|
|
|
5143
5285
|
body: { query },
|
|
5144
5286
|
});
|
|
5145
5287
|
const parsed = JSON.parse(rawResponse);
|
|
5146
|
-
const items = ((
|
|
5288
|
+
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) || [];
|
|
5147
5289
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5148
5290
|
const formatted = {
|
|
5149
5291
|
id: item.id,
|
|
@@ -5177,7 +5319,7 @@ class Worktables {
|
|
|
5177
5319
|
const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
|
|
5178
5320
|
const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
|
|
5179
5321
|
let rulesArray = [];
|
|
5180
|
-
if (((
|
|
5322
|
+
if (((_16 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _16 === void 0 ? void 0 : _16.length) > 0) {
|
|
5181
5323
|
console.log('Processing filter rules:', advancedFilterRules.rule);
|
|
5182
5324
|
rulesArray = advancedFilterRules.rule.map((rule) => {
|
|
5183
5325
|
let formattedValue;
|
|
@@ -5393,7 +5535,7 @@ class Worktables {
|
|
|
5393
5535
|
});
|
|
5394
5536
|
}
|
|
5395
5537
|
const orderByArray = [];
|
|
5396
|
-
if (((
|
|
5538
|
+
if (((_17 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _17 === void 0 ? void 0 : _17.length) > 0) {
|
|
5397
5539
|
advancedSortOptions.sortBy.forEach((sort) => {
|
|
5398
5540
|
orderByArray.push(`{
|
|
5399
5541
|
column_id: "${sort.columnId}",
|
|
@@ -5475,7 +5617,7 @@ class Worktables {
|
|
|
5475
5617
|
body: { query: testQuery },
|
|
5476
5618
|
});
|
|
5477
5619
|
const testParsed = JSON.parse(testResponse);
|
|
5478
|
-
const testItems = ((
|
|
5620
|
+
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) || [];
|
|
5479
5621
|
console.log('Test - Items in board (no filters):', testItems.length);
|
|
5480
5622
|
if (testItems.length > 0) {
|
|
5481
5623
|
console.log('Sample item column values:', testItems[0].column_values);
|
|
@@ -5487,7 +5629,7 @@ class Worktables {
|
|
|
5487
5629
|
body: { query },
|
|
5488
5630
|
});
|
|
5489
5631
|
const parsed = JSON.parse(rawResponse);
|
|
5490
|
-
const itemsPage = (
|
|
5632
|
+
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;
|
|
5491
5633
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5492
5634
|
const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
|
|
5493
5635
|
const hasMore = nextCursor ? true : false;
|
|
@@ -5651,7 +5793,7 @@ class Worktables {
|
|
|
5651
5793
|
body: { query },
|
|
5652
5794
|
});
|
|
5653
5795
|
const parsed = JSON.parse(rawResponse);
|
|
5654
|
-
const items = ((_29 = (_28 = (_27 = (_26 = (_25 =
|
|
5796
|
+
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) || [];
|
|
5655
5797
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5656
5798
|
const columnValues = item.column_values || [];
|
|
5657
5799
|
const formatted = {
|
|
@@ -5740,7 +5882,7 @@ class Worktables {
|
|
|
5740
5882
|
response = await (0, isErrorResponse_1.parseApiResponse)(response);
|
|
5741
5883
|
if (response.success) {
|
|
5742
5884
|
const parsed = JSON.parse(response.data);
|
|
5743
|
-
const updates = ((
|
|
5885
|
+
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) || [];
|
|
5744
5886
|
const formattedUpdates = updates.map((update) => {
|
|
5745
5887
|
const pinnedToTop = update.pinned_to_top || [];
|
|
5746
5888
|
const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
|
|
@@ -5805,7 +5947,7 @@ class Worktables {
|
|
|
5805
5947
|
console.log('variables:', variables);
|
|
5806
5948
|
response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
|
|
5807
5949
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
5808
|
-
const updateId = (
|
|
5950
|
+
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;
|
|
5809
5951
|
if (!updateId) {
|
|
5810
5952
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5811
5953
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -6114,7 +6256,7 @@ class Worktables {
|
|
|
6114
6256
|
body: { query },
|
|
6115
6257
|
json: true,
|
|
6116
6258
|
});
|
|
6117
|
-
const asset = (
|
|
6259
|
+
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];
|
|
6118
6260
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
6119
6261
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
6120
6262
|
message: 'Public URL not found for the given file ID.',
|