@worktables/n8n-nodes-worktables 12.60.0 → 12.60.1
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.
|
@@ -3502,7 +3502,7 @@ class Worktables {
|
|
|
3502
3502
|
};
|
|
3503
3503
|
}
|
|
3504
3504
|
async execute() {
|
|
3505
|
-
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;
|
|
3505
|
+
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, _55, _56, _57, _58, _59, _60, _61;
|
|
3506
3506
|
const resource = this.getNodeParameter('resource', 0);
|
|
3507
3507
|
const operation = this.getNodeParameter('operation', 0);
|
|
3508
3508
|
console.log('Testing... v1.0.29');
|
|
@@ -4637,19 +4637,62 @@ class Worktables {
|
|
|
4637
4637
|
column_values: "${escapedColumnValues}"
|
|
4638
4638
|
) {
|
|
4639
4639
|
id
|
|
4640
|
+
name
|
|
4640
4641
|
url
|
|
4641
4642
|
board {
|
|
4642
4643
|
id
|
|
4643
4644
|
}
|
|
4645
|
+
column_values {
|
|
4646
|
+
id
|
|
4647
|
+
text
|
|
4648
|
+
type
|
|
4649
|
+
value
|
|
4650
|
+
... on BoardRelationValue {
|
|
4651
|
+
display_value
|
|
4652
|
+
linked_item_ids
|
|
4653
|
+
}
|
|
4654
|
+
... on MirrorValue {
|
|
4655
|
+
display_value
|
|
4656
|
+
mirrored_items {
|
|
4657
|
+
linked_board_id
|
|
4658
|
+
}
|
|
4659
|
+
}
|
|
4660
|
+
... on DependencyValue {
|
|
4661
|
+
display_value
|
|
4662
|
+
linked_item_ids
|
|
4663
|
+
linked_items {
|
|
4664
|
+
id
|
|
4665
|
+
name
|
|
4666
|
+
}
|
|
4667
|
+
}
|
|
4668
|
+
}
|
|
4644
4669
|
}
|
|
4645
4670
|
}`;
|
|
4646
4671
|
console.log('Generated Mutation:', mutation);
|
|
4647
|
-
|
|
4672
|
+
const updateResponseRaw = await this.helpers.request({
|
|
4648
4673
|
method: 'POST',
|
|
4649
4674
|
url: 'https://api.monday.com/v2',
|
|
4650
4675
|
headers,
|
|
4651
4676
|
body: { query: mutation },
|
|
4652
4677
|
});
|
|
4678
|
+
const parsedUpdate = JSON.parse(updateResponseRaw);
|
|
4679
|
+
const parsedUpdateData = (_q = parsedUpdate === null || parsedUpdate === void 0 ? void 0 : parsedUpdate.data) === null || _q === void 0 ? void 0 : _q.change_multiple_column_values;
|
|
4680
|
+
const formattedUpdateResponse = {
|
|
4681
|
+
id: parsedUpdateData === null || parsedUpdateData === void 0 ? void 0 : parsedUpdateData.id,
|
|
4682
|
+
name: parsedUpdateData === null || parsedUpdateData === void 0 ? void 0 : parsedUpdateData.name,
|
|
4683
|
+
url: parsedUpdateData === null || parsedUpdateData === void 0 ? void 0 : parsedUpdateData.url,
|
|
4684
|
+
board: (_r = parsedUpdateData === null || parsedUpdateData === void 0 ? void 0 : parsedUpdateData.board) === null || _r === void 0 ? void 0 : _r.id,
|
|
4685
|
+
column_values: {},
|
|
4686
|
+
};
|
|
4687
|
+
if ((_s = parsedUpdateData === null || parsedUpdateData === void 0 ? void 0 : parsedUpdateData.column_values) === null || _s === void 0 ? void 0 : _s.length) {
|
|
4688
|
+
for (const col of parsedUpdateData.column_values) {
|
|
4689
|
+
const formattedCol = await (0, worktablesHelpers_1.formatColumnValue)(col);
|
|
4690
|
+
if (formattedCol) {
|
|
4691
|
+
formattedUpdateResponse.column_values[col.id] = formattedCol;
|
|
4692
|
+
}
|
|
4693
|
+
}
|
|
4694
|
+
}
|
|
4695
|
+
response = JSON.stringify(formattedUpdateResponse);
|
|
4653
4696
|
break;
|
|
4654
4697
|
}
|
|
4655
4698
|
case 'createItem': {
|
|
@@ -4772,8 +4815,8 @@ class Worktables {
|
|
|
4772
4815
|
break;
|
|
4773
4816
|
case 'timeline':
|
|
4774
4817
|
{
|
|
4775
|
-
const from = ((
|
|
4776
|
-
const to = ((
|
|
4818
|
+
const from = ((_t = col.startDate) === null || _t === void 0 ? void 0 : _t.split('T')[0]) || '';
|
|
4819
|
+
const to = ((_u = col.endDate) === null || _u === void 0 ? void 0 : _u.split('T')[0]) || '';
|
|
4777
4820
|
column_values_object[columnId] = { from, to };
|
|
4778
4821
|
}
|
|
4779
4822
|
break;
|
|
@@ -4811,8 +4854,8 @@ class Worktables {
|
|
|
4811
4854
|
break;
|
|
4812
4855
|
case 'phone':
|
|
4813
4856
|
column_values_object[columnId] = {
|
|
4814
|
-
phone: `${(
|
|
4815
|
-
countryShortName: ((
|
|
4857
|
+
phone: `${(_v = col.countryCode) === null || _v === void 0 ? void 0 : _v.split(' ')[0]}${col.phoneValue || ''}`.replace(/[^\d+]/g, ''),
|
|
4858
|
+
countryShortName: ((_w = col.countryCode) === null || _w === void 0 ? void 0 : _w.split(' ')[1]) || '',
|
|
4816
4859
|
};
|
|
4817
4860
|
break;
|
|
4818
4861
|
case 'file':
|
|
@@ -4828,7 +4871,7 @@ class Worktables {
|
|
|
4828
4871
|
break;
|
|
4829
4872
|
case 'dropdown':
|
|
4830
4873
|
{
|
|
4831
|
-
const labels = (
|
|
4874
|
+
const labels = (_x = col.dropdownValue) === null || _x === void 0 ? void 0 : _x.split(',').map((t) => t.trim()).filter((t) => t);
|
|
4832
4875
|
if (labels && labels.length) {
|
|
4833
4876
|
column_values_object[columnId] = { labels };
|
|
4834
4877
|
}
|
|
@@ -4915,8 +4958,25 @@ class Worktables {
|
|
|
4915
4958
|
id
|
|
4916
4959
|
text
|
|
4917
4960
|
type
|
|
4918
|
-
|
|
4919
4961
|
value
|
|
4962
|
+
... on BoardRelationValue {
|
|
4963
|
+
display_value
|
|
4964
|
+
linked_item_ids
|
|
4965
|
+
}
|
|
4966
|
+
... on MirrorValue {
|
|
4967
|
+
display_value
|
|
4968
|
+
mirrored_items {
|
|
4969
|
+
linked_board_id
|
|
4970
|
+
}
|
|
4971
|
+
}
|
|
4972
|
+
... on DependencyValue {
|
|
4973
|
+
display_value
|
|
4974
|
+
linked_item_ids
|
|
4975
|
+
linked_items {
|
|
4976
|
+
id
|
|
4977
|
+
name
|
|
4978
|
+
}
|
|
4979
|
+
}
|
|
4920
4980
|
}}
|
|
4921
4981
|
}`
|
|
4922
4982
|
: `mutation {
|
|
@@ -4934,7 +4994,24 @@ class Worktables {
|
|
|
4934
4994
|
text
|
|
4935
4995
|
type
|
|
4936
4996
|
value
|
|
4937
|
-
|
|
4997
|
+
... on BoardRelationValue {
|
|
4998
|
+
display_value
|
|
4999
|
+
linked_item_ids
|
|
5000
|
+
}
|
|
5001
|
+
... on MirrorValue {
|
|
5002
|
+
display_value
|
|
5003
|
+
mirrored_items {
|
|
5004
|
+
linked_board_id
|
|
5005
|
+
}
|
|
5006
|
+
}
|
|
5007
|
+
... on DependencyValue {
|
|
5008
|
+
display_value
|
|
5009
|
+
linked_item_ids
|
|
5010
|
+
linked_items {
|
|
5011
|
+
id
|
|
5012
|
+
name
|
|
5013
|
+
}
|
|
5014
|
+
}
|
|
4938
5015
|
}}
|
|
4939
5016
|
}`;
|
|
4940
5017
|
console.log('Mutation:', mutation);
|
|
@@ -4974,15 +5051,55 @@ class Worktables {
|
|
|
4974
5051
|
}
|
|
4975
5052
|
}
|
|
4976
5053
|
const parsedResponse = JSON.parse(responseRaw);
|
|
4977
|
-
const itemData = ((
|
|
5054
|
+
const itemData = ((_y = parsedResponse.data) === null || _y === void 0 ? void 0 : _y.create_item) || ((_z = parsedResponse.data) === null || _z === void 0 ? void 0 : _z.create_subitem);
|
|
5055
|
+
const createdItemId = itemData.id;
|
|
5056
|
+
const fetchItemQuery = `{
|
|
5057
|
+
items(ids: ["${createdItemId}"]) {
|
|
5058
|
+
id
|
|
5059
|
+
name
|
|
5060
|
+
url
|
|
5061
|
+
board { id }
|
|
5062
|
+
column_values {
|
|
5063
|
+
id
|
|
5064
|
+
text
|
|
5065
|
+
value
|
|
5066
|
+
type
|
|
5067
|
+
... on BoardRelationValue {
|
|
5068
|
+
display_value
|
|
5069
|
+
linked_item_ids
|
|
5070
|
+
}
|
|
5071
|
+
... on MirrorValue {
|
|
5072
|
+
display_value
|
|
5073
|
+
mirrored_items {
|
|
5074
|
+
linked_board_id
|
|
5075
|
+
}
|
|
5076
|
+
}
|
|
5077
|
+
... on DependencyValue {
|
|
5078
|
+
display_value
|
|
5079
|
+
linked_item_ids
|
|
5080
|
+
linked_items {
|
|
5081
|
+
id
|
|
5082
|
+
name
|
|
5083
|
+
}
|
|
5084
|
+
}
|
|
5085
|
+
}
|
|
5086
|
+
}
|
|
5087
|
+
}`;
|
|
5088
|
+
const fetchResponse = await this.helpers.request({
|
|
5089
|
+
method: 'POST',
|
|
5090
|
+
url: 'https://api.monday.com/v2',
|
|
5091
|
+
headers,
|
|
5092
|
+
body: { query: fetchItemQuery },
|
|
5093
|
+
});
|
|
5094
|
+
const fetchedItem = ((_2 = (_1 = (_0 = JSON.parse(fetchResponse)) === null || _0 === void 0 ? void 0 : _0.data) === null || _1 === void 0 ? void 0 : _1.items) === null || _2 === void 0 ? void 0 : _2[0]) || itemData;
|
|
4978
5095
|
const formattedResponse = {
|
|
4979
|
-
id:
|
|
4980
|
-
name: itemName,
|
|
4981
|
-
url:
|
|
4982
|
-
board: itemData.board.id,
|
|
5096
|
+
id: fetchedItem.id,
|
|
5097
|
+
name: (_3 = fetchedItem.name) !== null && _3 !== void 0 ? _3 : itemName,
|
|
5098
|
+
url: fetchedItem.url,
|
|
5099
|
+
board: (_5 = (_4 = fetchedItem.board) === null || _4 === void 0 ? void 0 : _4.id) !== null && _5 !== void 0 ? _5 : (_6 = itemData.board) === null || _6 === void 0 ? void 0 : _6.id,
|
|
4983
5100
|
column_values: {},
|
|
4984
5101
|
};
|
|
4985
|
-
for (const col of
|
|
5102
|
+
for (const col of fetchedItem.column_values || []) {
|
|
4986
5103
|
const formattedCol = await (0, worktablesHelpers_1.formatColumnValue)(col);
|
|
4987
5104
|
if (formattedCol) {
|
|
4988
5105
|
formattedResponse.column_values[col.id] = formattedCol;
|
|
@@ -5037,9 +5154,9 @@ class Worktables {
|
|
|
5037
5154
|
body: { query: discoverQuery },
|
|
5038
5155
|
});
|
|
5039
5156
|
const discoverData = JSON.parse(discoverResponse);
|
|
5040
|
-
const items = ((
|
|
5157
|
+
const items = ((_10 = (_9 = (_8 = (_7 = discoverData === null || discoverData === void 0 ? void 0 : discoverData.data) === null || _7 === void 0 ? void 0 : _7.boards) === null || _8 === void 0 ? void 0 : _8[0]) === null || _9 === void 0 ? void 0 : _9.items_page) === null || _10 === void 0 ? void 0 : _10.items) || [];
|
|
5041
5158
|
if (items.length > 0 && items[0].subitems && items[0].subitems.length > 0) {
|
|
5042
|
-
searchBoardId = ((
|
|
5159
|
+
searchBoardId = ((_11 = items[0].subitems[0].board) === null || _11 === void 0 ? void 0 : _11.id) || boardId;
|
|
5043
5160
|
console.log(`Discovered subitem board ID: ${searchBoardId}`);
|
|
5044
5161
|
}
|
|
5045
5162
|
}
|
|
@@ -5064,7 +5181,7 @@ class Worktables {
|
|
|
5064
5181
|
body: { query: columnTypeQuery },
|
|
5065
5182
|
});
|
|
5066
5183
|
const columnTypeData = JSON.parse(columnTypeResponse);
|
|
5067
|
-
const columns = ((
|
|
5184
|
+
const columns = ((_14 = (_13 = (_12 = columnTypeData === null || columnTypeData === void 0 ? void 0 : columnTypeData.data) === null || _12 === void 0 ? void 0 : _12.boards) === null || _13 === void 0 ? void 0 : _13[0]) === null || _14 === void 0 ? void 0 : _14.columns) || [];
|
|
5068
5185
|
if (columns.length > 0) {
|
|
5069
5186
|
columnType = columns[0].type;
|
|
5070
5187
|
console.log(`Column type detected: ${columnType}`);
|
|
@@ -5123,7 +5240,7 @@ class Worktables {
|
|
|
5123
5240
|
body: { query: parentQuery },
|
|
5124
5241
|
});
|
|
5125
5242
|
const searchData = JSON.parse(searchResponse);
|
|
5126
|
-
const items = ((
|
|
5243
|
+
const items = ((_15 = searchData === null || searchData === void 0 ? void 0 : searchData.data) === null || _15 === void 0 ? void 0 : _15.items) || [];
|
|
5127
5244
|
if (items.length > 0 && items[0].subitems) {
|
|
5128
5245
|
const subitems = items[0].subitems;
|
|
5129
5246
|
console.log(`🔍 Searching subitems of parent ${parentId}, found ${subitems.length} subitem(s)`);
|
|
@@ -5135,7 +5252,7 @@ class Worktables {
|
|
|
5135
5252
|
matches = subitemName === searchValue;
|
|
5136
5253
|
}
|
|
5137
5254
|
else {
|
|
5138
|
-
const colValue = (
|
|
5255
|
+
const colValue = (_16 = subitem.column_values) === null || _16 === void 0 ? void 0 : _16.find((cv) => cv.id === identifierColumn);
|
|
5139
5256
|
if (colValue) {
|
|
5140
5257
|
const isBoardRelation = colValue.type === 'board_relation' || colValue.type === 'mirror';
|
|
5141
5258
|
const isStatusColumn = colValue.type === 'status';
|
|
@@ -5153,7 +5270,7 @@ class Worktables {
|
|
|
5153
5270
|
}
|
|
5154
5271
|
if (matches) {
|
|
5155
5272
|
foundItemId = subitem.id;
|
|
5156
|
-
foundItemBoardId = ((
|
|
5273
|
+
foundItemBoardId = ((_17 = subitem.board) === null || _17 === void 0 ? void 0 : _17.id) || null;
|
|
5157
5274
|
console.log(`✓ Found subitem with ID: ${foundItemId}, board_id: ${foundItemBoardId}`);
|
|
5158
5275
|
break;
|
|
5159
5276
|
}
|
|
@@ -5210,7 +5327,7 @@ class Worktables {
|
|
|
5210
5327
|
body: { query },
|
|
5211
5328
|
});
|
|
5212
5329
|
const searchData = JSON.parse(searchResponse);
|
|
5213
|
-
const itemsPage = (
|
|
5330
|
+
const itemsPage = (_20 = (_19 = (_18 = searchData === null || searchData === void 0 ? void 0 : searchData.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;
|
|
5214
5331
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5215
5332
|
console.log(`🔍 Optimized search found ${items.length} item(s) matching identifier`);
|
|
5216
5333
|
for (const item of items) {
|
|
@@ -5221,7 +5338,7 @@ class Worktables {
|
|
|
5221
5338
|
matches = itemName === searchValue;
|
|
5222
5339
|
}
|
|
5223
5340
|
else {
|
|
5224
|
-
const colValue = (
|
|
5341
|
+
const colValue = (_21 = item.column_values) === null || _21 === void 0 ? void 0 : _21.find((cv) => cv.id === identifierColumn);
|
|
5225
5342
|
if (colValue) {
|
|
5226
5343
|
const isBoardRelation = colValue.type === 'board_relation' || colValue.type === 'mirror';
|
|
5227
5344
|
const isStatusColumn = colValue.type === 'status';
|
|
@@ -5294,7 +5411,7 @@ class Worktables {
|
|
|
5294
5411
|
id: itemData.id,
|
|
5295
5412
|
url: itemData.url || '',
|
|
5296
5413
|
operation: 'update',
|
|
5297
|
-
board_id: ((
|
|
5414
|
+
board_id: ((_22 = itemData.board) === null || _22 === void 0 ? void 0 : _22.id) || boardId,
|
|
5298
5415
|
column_values: column_values_object,
|
|
5299
5416
|
};
|
|
5300
5417
|
itemUpdated = true;
|
|
@@ -5390,8 +5507,8 @@ class Worktables {
|
|
|
5390
5507
|
});
|
|
5391
5508
|
}
|
|
5392
5509
|
const itemData = isSubitem && parentId
|
|
5393
|
-
? (
|
|
5394
|
-
: (
|
|
5510
|
+
? (_23 = responseData.data) === null || _23 === void 0 ? void 0 : _23.create_subitem
|
|
5511
|
+
: (_24 = responseData.data) === null || _24 === void 0 ? void 0 : _24.create_item;
|
|
5395
5512
|
if (!itemData || !itemData.id) {
|
|
5396
5513
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5397
5514
|
message: `Error creating ${isSubitem ? 'subitem' : 'item'}: No item data returned`,
|
|
@@ -5402,7 +5519,7 @@ class Worktables {
|
|
|
5402
5519
|
name: itemData.name || itemName,
|
|
5403
5520
|
url: itemData.url || '',
|
|
5404
5521
|
operation: 'create',
|
|
5405
|
-
board_id: ((
|
|
5522
|
+
board_id: ((_25 = itemData.board) === null || _25 === void 0 ? void 0 : _25.id) || boardId,
|
|
5406
5523
|
column_values: column_values_object,
|
|
5407
5524
|
};
|
|
5408
5525
|
if (isSubitem && parentId) {
|
|
@@ -5444,12 +5561,12 @@ class Worktables {
|
|
|
5444
5561
|
if (itemParsed.errors) {
|
|
5445
5562
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: JSON.stringify(itemParsed.errors) });
|
|
5446
5563
|
}
|
|
5447
|
-
const items = ((
|
|
5564
|
+
const items = ((_26 = itemParsed === null || itemParsed === void 0 ? void 0 : itemParsed.data) === null || _26 === void 0 ? void 0 : _26.items) || [];
|
|
5448
5565
|
if (items.length === 0) {
|
|
5449
5566
|
return [[{ json: { item_id: itemId, activity_logs: [] } }]];
|
|
5450
5567
|
}
|
|
5451
5568
|
const item = items[0];
|
|
5452
|
-
const boardId = (
|
|
5569
|
+
const boardId = (_27 = item.board) === null || _27 === void 0 ? void 0 : _27.id;
|
|
5453
5570
|
if (!boardId) {
|
|
5454
5571
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'Could not retrieve board ID for the item.' });
|
|
5455
5572
|
}
|
|
@@ -5501,7 +5618,7 @@ class Worktables {
|
|
|
5501
5618
|
if (parsed.errors) {
|
|
5502
5619
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: JSON.stringify(parsed.errors) });
|
|
5503
5620
|
}
|
|
5504
|
-
const boards = ((
|
|
5621
|
+
const boards = ((_28 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _28 === void 0 ? void 0 : _28.boards) || [];
|
|
5505
5622
|
const logs = boards.length > 0 ? (boards[0].activity_logs || []) : [];
|
|
5506
5623
|
allLogs = allLogs.concat(logs);
|
|
5507
5624
|
if (logs.length < pageLimit) {
|
|
@@ -5717,7 +5834,7 @@ class Worktables {
|
|
|
5717
5834
|
body: { query },
|
|
5718
5835
|
});
|
|
5719
5836
|
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
5720
|
-
const itemsPage = (
|
|
5837
|
+
const itemsPage = (_31 = (_30 = (_29 = parsed === null || parsed === void 0 ? void 0 : parsed.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;
|
|
5721
5838
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5722
5839
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
5723
5840
|
allItems = allItems.concat(items);
|
|
@@ -5798,7 +5915,7 @@ class Worktables {
|
|
|
5798
5915
|
const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
|
|
5799
5916
|
const logicalOperator = this.getNodeParameter('logicalOperator', 0);
|
|
5800
5917
|
let rulesArray = [];
|
|
5801
|
-
if (((
|
|
5918
|
+
if (((_32 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _32 === void 0 ? void 0 : _32.length) > 0) {
|
|
5802
5919
|
rulesArray = filterRules.rule.map((rule) => {
|
|
5803
5920
|
let formattedValue;
|
|
5804
5921
|
if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
|
|
@@ -5842,7 +5959,7 @@ class Worktables {
|
|
|
5842
5959
|
});
|
|
5843
5960
|
}
|
|
5844
5961
|
const orderByArray = [];
|
|
5845
|
-
if (((
|
|
5962
|
+
if (((_33 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _33 === void 0 ? void 0 : _33.length) > 0) {
|
|
5846
5963
|
sortOptions.sortBy.forEach((sort) => {
|
|
5847
5964
|
orderByArray.push(`{
|
|
5848
5965
|
column_id: "${sort.columnId}",
|
|
@@ -5946,7 +6063,7 @@ class Worktables {
|
|
|
5946
6063
|
body: { query },
|
|
5947
6064
|
});
|
|
5948
6065
|
const parsed = JSON.parse(rawResponse);
|
|
5949
|
-
const items = ((
|
|
6066
|
+
const items = ((_37 = (_36 = (_35 = (_34 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _34 === void 0 ? void 0 : _34.boards) === null || _35 === void 0 ? void 0 : _35[0]) === null || _36 === void 0 ? void 0 : _36.items_page) === null || _37 === void 0 ? void 0 : _37.items) || [];
|
|
5950
6067
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5951
6068
|
const formatted = {
|
|
5952
6069
|
id: item.id,
|
|
@@ -5980,7 +6097,7 @@ class Worktables {
|
|
|
5980
6097
|
const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
|
|
5981
6098
|
const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
|
|
5982
6099
|
let rulesArray = [];
|
|
5983
|
-
if (((
|
|
6100
|
+
if (((_38 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _38 === void 0 ? void 0 : _38.length) > 0) {
|
|
5984
6101
|
console.log('Processing filter rules:', advancedFilterRules.rule);
|
|
5985
6102
|
rulesArray = advancedFilterRules.rule.map((rule) => {
|
|
5986
6103
|
let formattedValue;
|
|
@@ -6196,7 +6313,7 @@ class Worktables {
|
|
|
6196
6313
|
});
|
|
6197
6314
|
}
|
|
6198
6315
|
const orderByArray = [];
|
|
6199
|
-
if (((
|
|
6316
|
+
if (((_39 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _39 === void 0 ? void 0 : _39.length) > 0) {
|
|
6200
6317
|
advancedSortOptions.sortBy.forEach((sort) => {
|
|
6201
6318
|
orderByArray.push(`{
|
|
6202
6319
|
column_id: "${sort.columnId}",
|
|
@@ -6286,7 +6403,7 @@ class Worktables {
|
|
|
6286
6403
|
body: { query: testQuery },
|
|
6287
6404
|
});
|
|
6288
6405
|
const testParsed = JSON.parse(testResponse);
|
|
6289
|
-
const testItems = ((
|
|
6406
|
+
const testItems = ((_43 = (_42 = (_41 = (_40 = testParsed === null || testParsed === void 0 ? void 0 : testParsed.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) === null || _43 === void 0 ? void 0 : _43.items) || [];
|
|
6290
6407
|
console.log('Test - Items in board (no filters):', testItems.length);
|
|
6291
6408
|
if (testItems.length > 0) {
|
|
6292
6409
|
console.log('Sample item column values:', testItems[0].column_values);
|
|
@@ -6298,7 +6415,7 @@ class Worktables {
|
|
|
6298
6415
|
body: { query },
|
|
6299
6416
|
});
|
|
6300
6417
|
const parsed = JSON.parse(rawResponse);
|
|
6301
|
-
const itemsPage = (
|
|
6418
|
+
const itemsPage = (_46 = (_45 = (_44 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _44 === void 0 ? void 0 : _44.boards) === null || _45 === void 0 ? void 0 : _45[0]) === null || _46 === void 0 ? void 0 : _46.items_page;
|
|
6302
6419
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
6303
6420
|
const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
|
|
6304
6421
|
const hasMore = nextCursor ? true : false;
|
|
@@ -6527,7 +6644,7 @@ class Worktables {
|
|
|
6527
6644
|
body: { query },
|
|
6528
6645
|
});
|
|
6529
6646
|
const parsed = JSON.parse(rawResponse);
|
|
6530
|
-
const itemsPage = (
|
|
6647
|
+
const itemsPage = (_51 = (_50 = (_49 = (_48 = (_47 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _47 === void 0 ? void 0 : _47.boards) === null || _48 === void 0 ? void 0 : _48[0]) === null || _49 === void 0 ? void 0 : _49.groups) === null || _50 === void 0 ? void 0 : _50[0]) === null || _51 === void 0 ? void 0 : _51.items_page;
|
|
6531
6648
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
6532
6649
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
6533
6650
|
allItems = allItems.concat(items);
|
|
@@ -6661,7 +6778,7 @@ class Worktables {
|
|
|
6661
6778
|
}
|
|
6662
6779
|
}
|
|
6663
6780
|
const parsed = JSON.parse(parsedResponse.data);
|
|
6664
|
-
const updates = ((
|
|
6781
|
+
const updates = ((_54 = (_53 = (_52 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _52 === void 0 ? void 0 : _52.items) === null || _53 === void 0 ? void 0 : _53[0]) === null || _54 === void 0 ? void 0 : _54.updates) || [];
|
|
6665
6782
|
if (updates.length === 0) {
|
|
6666
6783
|
break;
|
|
6667
6784
|
}
|
|
@@ -6742,7 +6859,7 @@ class Worktables {
|
|
|
6742
6859
|
console.log('variables:', variables);
|
|
6743
6860
|
response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
|
|
6744
6861
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
6745
|
-
const updateId = (
|
|
6862
|
+
const updateId = (_56 = (_55 = JSON.parse(response).data) === null || _55 === void 0 ? void 0 : _55.create_update) === null || _56 === void 0 ? void 0 : _56.id;
|
|
6746
6863
|
if (!updateId) {
|
|
6747
6864
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
6748
6865
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -7142,7 +7259,7 @@ class Worktables {
|
|
|
7142
7259
|
body: { query },
|
|
7143
7260
|
json: true,
|
|
7144
7261
|
});
|
|
7145
|
-
const asset = (
|
|
7262
|
+
const asset = (_58 = (_57 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _57 === void 0 ? void 0 : _57.assets) === null || _58 === void 0 ? void 0 : _58[0];
|
|
7146
7263
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
7147
7264
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
7148
7265
|
message: 'Public URL not found for the given file ID.',
|
|
@@ -7203,7 +7320,7 @@ class Worktables {
|
|
|
7203
7320
|
body: { query: currentQuery },
|
|
7204
7321
|
});
|
|
7205
7322
|
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
7206
|
-
const itemsPage = (
|
|
7323
|
+
const itemsPage = (_61 = (_60 = (_59 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _59 === void 0 ? void 0 : _59.boards) === null || _60 === void 0 ? void 0 : _60[0]) === null || _61 === void 0 ? void 0 : _61.items_page;
|
|
7207
7324
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
7208
7325
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
7209
7326
|
allData = allData.concat(items);
|