@worktables/n8n-nodes-worktables 12.2.19 → 12.2.21
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.
|
@@ -1023,6 +1023,27 @@ class Worktables {
|
|
|
1023
1023
|
},
|
|
1024
1024
|
},
|
|
1025
1025
|
},
|
|
1026
|
+
{
|
|
1027
|
+
displayName: 'Operator',
|
|
1028
|
+
name: 'identifierOperator',
|
|
1029
|
+
type: 'options',
|
|
1030
|
+
options: [
|
|
1031
|
+
{ name: 'Equals', value: 'equals' },
|
|
1032
|
+
{ name: 'Any Of', value: 'any_of' },
|
|
1033
|
+
{ name: 'Not Any Of', value: 'not_any_of' },
|
|
1034
|
+
{ name: 'Contains Text', value: 'contains_text' },
|
|
1035
|
+
{ name: 'Does Not Contain Text', value: 'not_contains_text' },
|
|
1036
|
+
{ name: 'Starts With', value: 'starts_with' },
|
|
1037
|
+
{ name: 'Ends With', value: 'ends_with' },
|
|
1038
|
+
],
|
|
1039
|
+
default: 'equals',
|
|
1040
|
+
description: 'The condition for value comparison',
|
|
1041
|
+
displayOptions: {
|
|
1042
|
+
show: {
|
|
1043
|
+
operation: ['createOrUpdateItem'],
|
|
1044
|
+
},
|
|
1045
|
+
},
|
|
1046
|
+
},
|
|
1026
1047
|
{
|
|
1027
1048
|
displayName: 'Identifier Value',
|
|
1028
1049
|
name: 'itemIdOptional',
|
|
@@ -2809,7 +2830,7 @@ class Worktables {
|
|
|
2809
2830
|
};
|
|
2810
2831
|
}
|
|
2811
2832
|
async execute() {
|
|
2812
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32;
|
|
2833
|
+
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;
|
|
2813
2834
|
const resource = this.getNodeParameter('resource', 0);
|
|
2814
2835
|
const operation = this.getNodeParameter('operation', 0);
|
|
2815
2836
|
const credentials = await this.getCredentials('WorktablesApi');
|
|
@@ -4325,7 +4346,8 @@ class Worktables {
|
|
|
4325
4346
|
let itemUpdated = false;
|
|
4326
4347
|
let foundItemId = null;
|
|
4327
4348
|
if (identifierValue && identifierValue.trim() !== '' && identifierColumn && identifierColumn.trim() !== '') {
|
|
4328
|
-
|
|
4349
|
+
const identifierOperator = this.getNodeParameter('identifierOperator', 0, 'equals');
|
|
4350
|
+
console.log('Searching for item/subitem with identifier column:', identifierColumn, 'value:', identifierValue, 'operator:', identifierOperator, 'isSubitem:', isSubitem);
|
|
4329
4351
|
let cursor = null;
|
|
4330
4352
|
let hasMore = true;
|
|
4331
4353
|
while (hasMore && !foundItemId) {
|
|
@@ -4336,8 +4358,10 @@ class Worktables {
|
|
|
4336
4358
|
items_page(limit: 100${cursorParam}) {
|
|
4337
4359
|
items {
|
|
4338
4360
|
id
|
|
4361
|
+
name
|
|
4339
4362
|
subitems {
|
|
4340
4363
|
id
|
|
4364
|
+
name
|
|
4341
4365
|
column_values(ids: ["${identifierColumn}"]) {
|
|
4342
4366
|
id
|
|
4343
4367
|
text
|
|
@@ -4354,6 +4378,7 @@ class Worktables {
|
|
|
4354
4378
|
items_page(limit: 100${cursorParam}) {
|
|
4355
4379
|
items {
|
|
4356
4380
|
id
|
|
4381
|
+
name
|
|
4357
4382
|
column_values(ids: ["${identifierColumn}"]) {
|
|
4358
4383
|
id
|
|
4359
4384
|
text
|
|
@@ -4374,29 +4399,83 @@ class Worktables {
|
|
|
4374
4399
|
const itemsPage = (_z = (_y = (_x = searchData === null || searchData === void 0 ? void 0 : searchData.data) === null || _x === void 0 ? void 0 : _x.boards) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.items_page;
|
|
4375
4400
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4376
4401
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4402
|
+
const compareValues = (colValue, identifierValue, operator) => {
|
|
4403
|
+
let colText = colValue.text || '';
|
|
4404
|
+
let colValueStr = '';
|
|
4405
|
+
try {
|
|
4406
|
+
if (colValue.value) {
|
|
4407
|
+
const parsedValue = JSON.parse(colValue.value);
|
|
4408
|
+
if (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.label) {
|
|
4409
|
+
colValueStr = parsedValue.label;
|
|
4410
|
+
}
|
|
4411
|
+
else {
|
|
4412
|
+
colValueStr = (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.text) || (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.value) || String(parsedValue);
|
|
4413
|
+
}
|
|
4414
|
+
}
|
|
4415
|
+
}
|
|
4416
|
+
catch {
|
|
4417
|
+
colValueStr = colValue.value || '';
|
|
4418
|
+
}
|
|
4419
|
+
const searchValue = identifierValue.trim().toLowerCase();
|
|
4420
|
+
const colTextLower = colText.trim().toLowerCase();
|
|
4421
|
+
const colValueStrLower = colValueStr.trim().toLowerCase();
|
|
4422
|
+
switch (operator) {
|
|
4423
|
+
case 'equals':
|
|
4424
|
+
return colTextLower === searchValue || colValueStrLower === searchValue;
|
|
4425
|
+
case 'any_of':
|
|
4426
|
+
const values = identifierValue.split(',').map(v => v.trim().toLowerCase());
|
|
4427
|
+
return values.includes(colTextLower) || values.includes(colValueStrLower);
|
|
4428
|
+
case 'not_any_of':
|
|
4429
|
+
const notValues = identifierValue.split(',').map(v => v.trim().toLowerCase());
|
|
4430
|
+
return !notValues.includes(colTextLower) && !notValues.includes(colValueStrLower);
|
|
4431
|
+
case 'contains_text':
|
|
4432
|
+
return colTextLower.includes(searchValue) || colValueStrLower.includes(searchValue);
|
|
4433
|
+
case 'not_contains_text':
|
|
4434
|
+
return !colTextLower.includes(searchValue) && !colValueStrLower.includes(searchValue);
|
|
4435
|
+
case 'starts_with':
|
|
4436
|
+
return colTextLower.startsWith(searchValue) || colValueStrLower.startsWith(searchValue);
|
|
4437
|
+
case 'ends_with':
|
|
4438
|
+
return colTextLower.endsWith(searchValue) || colValueStrLower.endsWith(searchValue);
|
|
4439
|
+
default:
|
|
4440
|
+
return colTextLower === searchValue || colValueStrLower === searchValue;
|
|
4441
|
+
}
|
|
4442
|
+
};
|
|
4443
|
+
const isNameColumn = identifierColumn === 'name' || identifierColumn.toLowerCase() === 'name';
|
|
4377
4444
|
if (isSubitem) {
|
|
4378
4445
|
for (const item of items) {
|
|
4379
4446
|
if (item.subitems && Array.isArray(item.subitems)) {
|
|
4380
4447
|
for (const subitem of item.subitems) {
|
|
4381
|
-
|
|
4382
|
-
if (
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4448
|
+
let matches = false;
|
|
4449
|
+
if (isNameColumn) {
|
|
4450
|
+
const subitemName = (subitem.name || '').trim().toLowerCase();
|
|
4451
|
+
const searchValue = identifierValue.trim().toLowerCase();
|
|
4452
|
+
switch (identifierOperator) {
|
|
4453
|
+
case 'equals':
|
|
4454
|
+
matches = subitemName === searchValue;
|
|
4455
|
+
break;
|
|
4456
|
+
case 'contains_text':
|
|
4457
|
+
matches = subitemName.includes(searchValue);
|
|
4458
|
+
break;
|
|
4459
|
+
case 'starts_with':
|
|
4460
|
+
matches = subitemName.startsWith(searchValue);
|
|
4461
|
+
break;
|
|
4462
|
+
case 'ends_with':
|
|
4463
|
+
matches = subitemName.endsWith(searchValue);
|
|
4464
|
+
break;
|
|
4465
|
+
default:
|
|
4466
|
+
matches = subitemName === searchValue;
|
|
4393
4467
|
}
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4468
|
+
}
|
|
4469
|
+
else {
|
|
4470
|
+
const colValue = (_0 = subitem.column_values) === null || _0 === void 0 ? void 0 : _0.find((cv) => cv.id === identifierColumn);
|
|
4471
|
+
if (colValue) {
|
|
4472
|
+
matches = compareValues(colValue, identifierValue, identifierOperator);
|
|
4398
4473
|
}
|
|
4399
4474
|
}
|
|
4475
|
+
if (matches) {
|
|
4476
|
+
foundItemId = subitem.id;
|
|
4477
|
+
break;
|
|
4478
|
+
}
|
|
4400
4479
|
}
|
|
4401
4480
|
if (foundItemId)
|
|
4402
4481
|
break;
|
|
@@ -4405,25 +4484,37 @@ class Worktables {
|
|
|
4405
4484
|
}
|
|
4406
4485
|
else {
|
|
4407
4486
|
for (const item of items) {
|
|
4408
|
-
|
|
4409
|
-
if (
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4487
|
+
let matches = false;
|
|
4488
|
+
if (isNameColumn) {
|
|
4489
|
+
const itemName = (item.name || '').trim().toLowerCase();
|
|
4490
|
+
const searchValue = identifierValue.trim().toLowerCase();
|
|
4491
|
+
switch (identifierOperator) {
|
|
4492
|
+
case 'equals':
|
|
4493
|
+
matches = itemName === searchValue;
|
|
4494
|
+
break;
|
|
4495
|
+
case 'contains_text':
|
|
4496
|
+
matches = itemName.includes(searchValue);
|
|
4497
|
+
break;
|
|
4498
|
+
case 'starts_with':
|
|
4499
|
+
matches = itemName.startsWith(searchValue);
|
|
4500
|
+
break;
|
|
4501
|
+
case 'ends_with':
|
|
4502
|
+
matches = itemName.endsWith(searchValue);
|
|
4503
|
+
break;
|
|
4504
|
+
default:
|
|
4505
|
+
matches = itemName === searchValue;
|
|
4420
4506
|
}
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4507
|
+
}
|
|
4508
|
+
else {
|
|
4509
|
+
const colValue = (_1 = item.column_values) === null || _1 === void 0 ? void 0 : _1.find((cv) => cv.id === identifierColumn);
|
|
4510
|
+
if (colValue) {
|
|
4511
|
+
matches = compareValues(colValue, identifierValue, identifierOperator);
|
|
4425
4512
|
}
|
|
4426
4513
|
}
|
|
4514
|
+
if (matches) {
|
|
4515
|
+
foundItemId = item.id;
|
|
4516
|
+
break;
|
|
4517
|
+
}
|
|
4427
4518
|
}
|
|
4428
4519
|
}
|
|
4429
4520
|
hasMore = cursor !== null && items.length > 0 && !foundItemId;
|
|
@@ -4458,22 +4549,38 @@ class Worktables {
|
|
|
4458
4549
|
if (itemData && itemData.id) {
|
|
4459
4550
|
formatted = {
|
|
4460
4551
|
id: itemData.id,
|
|
4461
|
-
url: itemData.url,
|
|
4552
|
+
url: itemData.url || '',
|
|
4462
4553
|
operation: 'update',
|
|
4463
|
-
board_id: itemData.board.id,
|
|
4554
|
+
board_id: ((_2 = itemData.board) === null || _2 === void 0 ? void 0 : _2.id) || boardId,
|
|
4464
4555
|
column_values: column_values_object,
|
|
4465
4556
|
};
|
|
4466
4557
|
itemUpdated = true;
|
|
4558
|
+
console.log(`Successfully updated ${isSubitem ? 'subitem' : 'item'}:`, itemData.id);
|
|
4559
|
+
}
|
|
4560
|
+
else {
|
|
4561
|
+
console.log(`Update response missing item data, will create new ${isSubitem ? 'subitem' : 'item'} instead`);
|
|
4562
|
+
itemUpdated = false;
|
|
4467
4563
|
}
|
|
4468
4564
|
}
|
|
4469
|
-
|
|
4470
|
-
|
|
4565
|
+
else {
|
|
4566
|
+
if (responseData.errors) {
|
|
4567
|
+
console.log('Error updating item:', JSON.stringify(responseData.errors));
|
|
4568
|
+
}
|
|
4569
|
+
else {
|
|
4570
|
+
console.log('Update response missing data, will create new item instead');
|
|
4571
|
+
}
|
|
4572
|
+
itemUpdated = false;
|
|
4471
4573
|
}
|
|
4472
4574
|
}
|
|
4473
4575
|
else {
|
|
4474
|
-
console.log(`${isSubitem ? 'Subitem' : 'Item'} not found with identifier value, will create new ${isSubitem ? 'subitem' : 'item'}`);
|
|
4576
|
+
console.log(`${isSubitem ? 'Subitem' : 'Item'} not found with identifier value "${identifierValue}", will create new ${isSubitem ? 'subitem' : 'item'}`);
|
|
4577
|
+
itemUpdated = false;
|
|
4475
4578
|
}
|
|
4476
4579
|
}
|
|
4580
|
+
else {
|
|
4581
|
+
console.log('No identifier provided, will create new item');
|
|
4582
|
+
itemUpdated = false;
|
|
4583
|
+
}
|
|
4477
4584
|
if (!itemUpdated) {
|
|
4478
4585
|
console.log(`Creating new ${isSubitem ? 'subitem' : 'item'}:`, itemName);
|
|
4479
4586
|
const parentId = this.getNodeParameter('parentId', 0, false);
|
|
@@ -4521,15 +4628,25 @@ class Worktables {
|
|
|
4521
4628
|
body: { query: mutation },
|
|
4522
4629
|
});
|
|
4523
4630
|
const responseData = JSON.parse(response);
|
|
4631
|
+
if (responseData.errors) {
|
|
4632
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
4633
|
+
message: `Error creating ${isSubitem ? 'subitem' : 'item'}: ${JSON.stringify(responseData.errors)}`,
|
|
4634
|
+
});
|
|
4635
|
+
}
|
|
4524
4636
|
const itemData = isSubitem && parentId
|
|
4525
|
-
? responseData.data.create_subitem
|
|
4526
|
-
: responseData.data.create_item;
|
|
4637
|
+
? (_3 = responseData.data) === null || _3 === void 0 ? void 0 : _3.create_subitem
|
|
4638
|
+
: (_4 = responseData.data) === null || _4 === void 0 ? void 0 : _4.create_item;
|
|
4639
|
+
if (!itemData || !itemData.id) {
|
|
4640
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
4641
|
+
message: `Error creating ${isSubitem ? 'subitem' : 'item'}: No item data returned`,
|
|
4642
|
+
});
|
|
4643
|
+
}
|
|
4527
4644
|
formatted = {
|
|
4528
4645
|
id: itemData.id,
|
|
4529
|
-
name: itemData.name,
|
|
4530
|
-
url: itemData.url,
|
|
4646
|
+
name: itemData.name || itemName,
|
|
4647
|
+
url: itemData.url || '',
|
|
4531
4648
|
operation: 'create',
|
|
4532
|
-
board_id: itemData.board.id,
|
|
4649
|
+
board_id: ((_5 = itemData.board) === null || _5 === void 0 ? void 0 : _5.id) || boardId,
|
|
4533
4650
|
column_values: column_values_object,
|
|
4534
4651
|
};
|
|
4535
4652
|
if (isSubitem && parentId) {
|
|
@@ -4668,7 +4785,7 @@ class Worktables {
|
|
|
4668
4785
|
body: { query },
|
|
4669
4786
|
});
|
|
4670
4787
|
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
4671
|
-
const itemsPage = (
|
|
4788
|
+
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;
|
|
4672
4789
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4673
4790
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4674
4791
|
allItems = allItems.concat(items);
|
|
@@ -4748,7 +4865,7 @@ class Worktables {
|
|
|
4748
4865
|
const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
|
|
4749
4866
|
const logicalOperator = this.getNodeParameter('logicalOperator', 0);
|
|
4750
4867
|
let rulesArray = [];
|
|
4751
|
-
if (((
|
|
4868
|
+
if (((_9 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _9 === void 0 ? void 0 : _9.length) > 0) {
|
|
4752
4869
|
rulesArray = filterRules.rule.map((rule) => {
|
|
4753
4870
|
let formattedValue;
|
|
4754
4871
|
if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
|
|
@@ -4792,7 +4909,7 @@ class Worktables {
|
|
|
4792
4909
|
});
|
|
4793
4910
|
}
|
|
4794
4911
|
const orderByArray = [];
|
|
4795
|
-
if (((
|
|
4912
|
+
if (((_10 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _10 === void 0 ? void 0 : _10.length) > 0) {
|
|
4796
4913
|
sortOptions.sortBy.forEach((sort) => {
|
|
4797
4914
|
orderByArray.push(`{
|
|
4798
4915
|
column_id: "${sort.columnId}",
|
|
@@ -4838,7 +4955,7 @@ class Worktables {
|
|
|
4838
4955
|
body: { query },
|
|
4839
4956
|
});
|
|
4840
4957
|
const parsed = JSON.parse(rawResponse);
|
|
4841
|
-
const items = ((
|
|
4958
|
+
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) || [];
|
|
4842
4959
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
4843
4960
|
const formatted = {
|
|
4844
4961
|
id: item.id,
|
|
@@ -4872,7 +4989,7 @@ class Worktables {
|
|
|
4872
4989
|
const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
|
|
4873
4990
|
const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
|
|
4874
4991
|
let rulesArray = [];
|
|
4875
|
-
if (((
|
|
4992
|
+
if (((_15 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _15 === void 0 ? void 0 : _15.length) > 0) {
|
|
4876
4993
|
console.log('Processing filter rules:', advancedFilterRules.rule);
|
|
4877
4994
|
rulesArray = advancedFilterRules.rule.map((rule) => {
|
|
4878
4995
|
let formattedValue;
|
|
@@ -5088,7 +5205,7 @@ class Worktables {
|
|
|
5088
5205
|
});
|
|
5089
5206
|
}
|
|
5090
5207
|
const orderByArray = [];
|
|
5091
|
-
if (((
|
|
5208
|
+
if (((_16 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _16 === void 0 ? void 0 : _16.length) > 0) {
|
|
5092
5209
|
advancedSortOptions.sortBy.forEach((sort) => {
|
|
5093
5210
|
orderByArray.push(`{
|
|
5094
5211
|
column_id: "${sort.columnId}",
|
|
@@ -5160,7 +5277,7 @@ class Worktables {
|
|
|
5160
5277
|
body: { query: testQuery },
|
|
5161
5278
|
});
|
|
5162
5279
|
const testParsed = JSON.parse(testResponse);
|
|
5163
|
-
const testItems = ((
|
|
5280
|
+
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) || [];
|
|
5164
5281
|
console.log('Test - Items in board (no filters):', testItems.length);
|
|
5165
5282
|
if (testItems.length > 0) {
|
|
5166
5283
|
console.log('Sample item column values:', testItems[0].column_values);
|
|
@@ -5172,7 +5289,7 @@ class Worktables {
|
|
|
5172
5289
|
body: { query },
|
|
5173
5290
|
});
|
|
5174
5291
|
const parsed = JSON.parse(rawResponse);
|
|
5175
|
-
const itemsPage = (
|
|
5292
|
+
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;
|
|
5176
5293
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5177
5294
|
const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
|
|
5178
5295
|
const hasMore = nextCursor ? true : false;
|
|
@@ -5330,7 +5447,7 @@ class Worktables {
|
|
|
5330
5447
|
body: { query },
|
|
5331
5448
|
});
|
|
5332
5449
|
const parsed = JSON.parse(rawResponse);
|
|
5333
|
-
const items = ((
|
|
5450
|
+
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) || [];
|
|
5334
5451
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5335
5452
|
const columnValues = item.column_values || [];
|
|
5336
5453
|
const formatted = {
|
|
@@ -5420,7 +5537,7 @@ class Worktables {
|
|
|
5420
5537
|
response = await (0, isErrorResponse_1.parseApiResponse)(response);
|
|
5421
5538
|
if (response.success) {
|
|
5422
5539
|
const parsed = JSON.parse(response.data);
|
|
5423
|
-
const updates = ((
|
|
5540
|
+
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) || [];
|
|
5424
5541
|
const formattedUpdates = updates.map((update) => {
|
|
5425
5542
|
const pinnedToTop = update.pinned_to_top || [];
|
|
5426
5543
|
const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
|
|
@@ -5485,7 +5602,7 @@ class Worktables {
|
|
|
5485
5602
|
console.log('variables:', variables);
|
|
5486
5603
|
response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
|
|
5487
5604
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
5488
|
-
const updateId = (
|
|
5605
|
+
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;
|
|
5489
5606
|
if (!updateId) {
|
|
5490
5607
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5491
5608
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -5791,7 +5908,7 @@ class Worktables {
|
|
|
5791
5908
|
body: { query },
|
|
5792
5909
|
json: true,
|
|
5793
5910
|
});
|
|
5794
|
-
const asset = (
|
|
5911
|
+
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];
|
|
5795
5912
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
5796
5913
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5797
5914
|
message: 'Public URL not found for the given file ID.',
|