@worktables/n8n-nodes-worktables 12.2.22 → 12.2.24
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.
|
@@ -2809,7 +2809,7 @@ class Worktables {
|
|
|
2809
2809
|
};
|
|
2810
2810
|
}
|
|
2811
2811
|
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, _33, _34, _35, _36
|
|
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, _33, _34, _35, _36;
|
|
2813
2813
|
const resource = this.getNodeParameter('resource', 0);
|
|
2814
2814
|
const operation = this.getNodeParameter('operation', 0);
|
|
2815
2815
|
const credentials = await this.getCredentials('WorktablesApi');
|
|
@@ -4384,36 +4384,31 @@ class Worktables {
|
|
|
4384
4384
|
for (const subitem of item.subitems) {
|
|
4385
4385
|
let matches = false;
|
|
4386
4386
|
if (isNameColumn) {
|
|
4387
|
-
|
|
4388
|
-
|
|
4387
|
+
const searchValue = identifierValue.trim().toLowerCase();
|
|
4388
|
+
const subitemName = (subitem.name || '').trim().toLowerCase();
|
|
4389
|
+
matches = subitemName === searchValue;
|
|
4389
4390
|
}
|
|
4390
4391
|
else {
|
|
4391
|
-
const colValue = (
|
|
4392
|
+
const colValue = (_0 = subitem.column_values) === null || _0 === void 0 ? void 0 : _0.find((cv) => cv.id === identifierColumn);
|
|
4392
4393
|
if (colValue) {
|
|
4393
|
-
let colText = colValue.text || '';
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
colValueStr = parsedValue.label;
|
|
4400
|
-
}
|
|
4401
|
-
else {
|
|
4402
|
-
colValueStr = (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.text) || (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.value) || String(parsedValue);
|
|
4403
|
-
}
|
|
4404
|
-
}
|
|
4394
|
+
let colText = (colValue.text || '').trim();
|
|
4395
|
+
const searchValue = identifierValue.trim().toLowerCase();
|
|
4396
|
+
const colTextLower = colText.toLowerCase();
|
|
4397
|
+
matches = colTextLower === searchValue;
|
|
4398
|
+
if (matches) {
|
|
4399
|
+
console.log(`✓ Match found! Subitem ${subitem.id} - Column ${identifierColumn}: text="${colText}", search="${identifierValue}"`);
|
|
4405
4400
|
}
|
|
4406
|
-
|
|
4407
|
-
|
|
4401
|
+
else if (colText) {
|
|
4402
|
+
console.log(`✗ No match - Subitem ${subitem.id} - Column ${identifierColumn}: text="${colText}", search="${identifierValue}"`);
|
|
4408
4403
|
}
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
matches = colTextLower === searchValue || colValueStrLower === searchValue;
|
|
4404
|
+
}
|
|
4405
|
+
else {
|
|
4406
|
+
console.log(`⚠ Subitem ${subitem.id} - Column ${identifierColumn} not found in column_values`);
|
|
4413
4407
|
}
|
|
4414
4408
|
}
|
|
4415
4409
|
if (matches) {
|
|
4416
4410
|
foundItemId = subitem.id;
|
|
4411
|
+
console.log(`Found subitem with ID: ${foundItemId}`);
|
|
4417
4412
|
break;
|
|
4418
4413
|
}
|
|
4419
4414
|
}
|
|
@@ -4426,36 +4421,31 @@ class Worktables {
|
|
|
4426
4421
|
for (const item of items) {
|
|
4427
4422
|
let matches = false;
|
|
4428
4423
|
if (isNameColumn) {
|
|
4429
|
-
|
|
4430
|
-
|
|
4424
|
+
const searchValue = identifierValue.trim().toLowerCase();
|
|
4425
|
+
const itemName = (item.name || '').trim().toLowerCase();
|
|
4426
|
+
matches = itemName === searchValue;
|
|
4431
4427
|
}
|
|
4432
4428
|
else {
|
|
4433
|
-
const colValue = (
|
|
4429
|
+
const colValue = (_1 = item.column_values) === null || _1 === void 0 ? void 0 : _1.find((cv) => cv.id === identifierColumn);
|
|
4434
4430
|
if (colValue) {
|
|
4435
|
-
let colText = colValue.text || '';
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
colValueStr = parsedValue.label;
|
|
4442
|
-
}
|
|
4443
|
-
else {
|
|
4444
|
-
colValueStr = (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.text) || (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.value) || String(parsedValue);
|
|
4445
|
-
}
|
|
4446
|
-
}
|
|
4431
|
+
let colText = (colValue.text || '').trim();
|
|
4432
|
+
const searchValue = identifierValue.trim().toLowerCase();
|
|
4433
|
+
const colTextLower = colText.toLowerCase();
|
|
4434
|
+
matches = colTextLower === searchValue;
|
|
4435
|
+
if (matches) {
|
|
4436
|
+
console.log(`✓ Match found! Item ${item.id} - Column ${identifierColumn}: text="${colText}", search="${identifierValue}"`);
|
|
4447
4437
|
}
|
|
4448
|
-
|
|
4449
|
-
|
|
4438
|
+
else if (colText) {
|
|
4439
|
+
console.log(`✗ No match - Item ${item.id} - Column ${identifierColumn}: text="${colText}", search="${identifierValue}"`);
|
|
4450
4440
|
}
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
matches = colTextLower === searchValue || colValueStrLower === searchValue;
|
|
4441
|
+
}
|
|
4442
|
+
else {
|
|
4443
|
+
console.log(`⚠ Item ${item.id} - Column ${identifierColumn} not found in column_values`);
|
|
4455
4444
|
}
|
|
4456
4445
|
}
|
|
4457
4446
|
if (matches) {
|
|
4458
4447
|
foundItemId = item.id;
|
|
4448
|
+
console.log(`Found item with ID: ${foundItemId}`);
|
|
4459
4449
|
break;
|
|
4460
4450
|
}
|
|
4461
4451
|
}
|
|
@@ -4494,7 +4484,7 @@ class Worktables {
|
|
|
4494
4484
|
id: itemData.id,
|
|
4495
4485
|
url: itemData.url || '',
|
|
4496
4486
|
operation: 'update',
|
|
4497
|
-
board_id: ((
|
|
4487
|
+
board_id: ((_2 = itemData.board) === null || _2 === void 0 ? void 0 : _2.id) || boardId,
|
|
4498
4488
|
column_values: column_values_object,
|
|
4499
4489
|
};
|
|
4500
4490
|
itemUpdated = true;
|
|
@@ -4577,8 +4567,8 @@ class Worktables {
|
|
|
4577
4567
|
});
|
|
4578
4568
|
}
|
|
4579
4569
|
const itemData = isSubitem && parentId
|
|
4580
|
-
? (
|
|
4581
|
-
: (
|
|
4570
|
+
? (_3 = responseData.data) === null || _3 === void 0 ? void 0 : _3.create_subitem
|
|
4571
|
+
: (_4 = responseData.data) === null || _4 === void 0 ? void 0 : _4.create_item;
|
|
4582
4572
|
if (!itemData || !itemData.id) {
|
|
4583
4573
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
4584
4574
|
message: `Error creating ${isSubitem ? 'subitem' : 'item'}: No item data returned`,
|
|
@@ -4589,7 +4579,7 @@ class Worktables {
|
|
|
4589
4579
|
name: itemData.name || itemName,
|
|
4590
4580
|
url: itemData.url || '',
|
|
4591
4581
|
operation: 'create',
|
|
4592
|
-
board_id: ((
|
|
4582
|
+
board_id: ((_5 = itemData.board) === null || _5 === void 0 ? void 0 : _5.id) || boardId,
|
|
4593
4583
|
column_values: column_values_object,
|
|
4594
4584
|
};
|
|
4595
4585
|
if (isSubitem && parentId) {
|
|
@@ -4728,7 +4718,7 @@ class Worktables {
|
|
|
4728
4718
|
body: { query },
|
|
4729
4719
|
});
|
|
4730
4720
|
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
4731
|
-
const itemsPage = (
|
|
4721
|
+
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;
|
|
4732
4722
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4733
4723
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4734
4724
|
allItems = allItems.concat(items);
|
|
@@ -4808,7 +4798,7 @@ class Worktables {
|
|
|
4808
4798
|
const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
|
|
4809
4799
|
const logicalOperator = this.getNodeParameter('logicalOperator', 0);
|
|
4810
4800
|
let rulesArray = [];
|
|
4811
|
-
if (((
|
|
4801
|
+
if (((_9 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _9 === void 0 ? void 0 : _9.length) > 0) {
|
|
4812
4802
|
rulesArray = filterRules.rule.map((rule) => {
|
|
4813
4803
|
let formattedValue;
|
|
4814
4804
|
if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
|
|
@@ -4852,7 +4842,7 @@ class Worktables {
|
|
|
4852
4842
|
});
|
|
4853
4843
|
}
|
|
4854
4844
|
const orderByArray = [];
|
|
4855
|
-
if (((
|
|
4845
|
+
if (((_10 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _10 === void 0 ? void 0 : _10.length) > 0) {
|
|
4856
4846
|
sortOptions.sortBy.forEach((sort) => {
|
|
4857
4847
|
orderByArray.push(`{
|
|
4858
4848
|
column_id: "${sort.columnId}",
|
|
@@ -4898,7 +4888,7 @@ class Worktables {
|
|
|
4898
4888
|
body: { query },
|
|
4899
4889
|
});
|
|
4900
4890
|
const parsed = JSON.parse(rawResponse);
|
|
4901
|
-
const items = ((
|
|
4891
|
+
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) || [];
|
|
4902
4892
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
4903
4893
|
const formatted = {
|
|
4904
4894
|
id: item.id,
|
|
@@ -4932,7 +4922,7 @@ class Worktables {
|
|
|
4932
4922
|
const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
|
|
4933
4923
|
const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
|
|
4934
4924
|
let rulesArray = [];
|
|
4935
|
-
if (((
|
|
4925
|
+
if (((_15 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _15 === void 0 ? void 0 : _15.length) > 0) {
|
|
4936
4926
|
console.log('Processing filter rules:', advancedFilterRules.rule);
|
|
4937
4927
|
rulesArray = advancedFilterRules.rule.map((rule) => {
|
|
4938
4928
|
let formattedValue;
|
|
@@ -5148,7 +5138,7 @@ class Worktables {
|
|
|
5148
5138
|
});
|
|
5149
5139
|
}
|
|
5150
5140
|
const orderByArray = [];
|
|
5151
|
-
if (((
|
|
5141
|
+
if (((_16 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _16 === void 0 ? void 0 : _16.length) > 0) {
|
|
5152
5142
|
advancedSortOptions.sortBy.forEach((sort) => {
|
|
5153
5143
|
orderByArray.push(`{
|
|
5154
5144
|
column_id: "${sort.columnId}",
|
|
@@ -5220,7 +5210,7 @@ class Worktables {
|
|
|
5220
5210
|
body: { query: testQuery },
|
|
5221
5211
|
});
|
|
5222
5212
|
const testParsed = JSON.parse(testResponse);
|
|
5223
|
-
const testItems = ((
|
|
5213
|
+
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) || [];
|
|
5224
5214
|
console.log('Test - Items in board (no filters):', testItems.length);
|
|
5225
5215
|
if (testItems.length > 0) {
|
|
5226
5216
|
console.log('Sample item column values:', testItems[0].column_values);
|
|
@@ -5232,7 +5222,7 @@ class Worktables {
|
|
|
5232
5222
|
body: { query },
|
|
5233
5223
|
});
|
|
5234
5224
|
const parsed = JSON.parse(rawResponse);
|
|
5235
|
-
const itemsPage = (
|
|
5225
|
+
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;
|
|
5236
5226
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5237
5227
|
const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
|
|
5238
5228
|
const hasMore = nextCursor ? true : false;
|
|
@@ -5390,7 +5380,7 @@ class Worktables {
|
|
|
5390
5380
|
body: { query },
|
|
5391
5381
|
});
|
|
5392
5382
|
const parsed = JSON.parse(rawResponse);
|
|
5393
|
-
const items = ((
|
|
5383
|
+
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) || [];
|
|
5394
5384
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5395
5385
|
const columnValues = item.column_values || [];
|
|
5396
5386
|
const formatted = {
|
|
@@ -5480,7 +5470,7 @@ class Worktables {
|
|
|
5480
5470
|
response = await (0, isErrorResponse_1.parseApiResponse)(response);
|
|
5481
5471
|
if (response.success) {
|
|
5482
5472
|
const parsed = JSON.parse(response.data);
|
|
5483
|
-
const updates = ((
|
|
5473
|
+
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) || [];
|
|
5484
5474
|
const formattedUpdates = updates.map((update) => {
|
|
5485
5475
|
const pinnedToTop = update.pinned_to_top || [];
|
|
5486
5476
|
const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
|
|
@@ -5545,7 +5535,7 @@ class Worktables {
|
|
|
5545
5535
|
console.log('variables:', variables);
|
|
5546
5536
|
response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
|
|
5547
5537
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
5548
|
-
const updateId = (
|
|
5538
|
+
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;
|
|
5549
5539
|
if (!updateId) {
|
|
5550
5540
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5551
5541
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -5851,7 +5841,7 @@ class Worktables {
|
|
|
5851
5841
|
body: { query },
|
|
5852
5842
|
json: true,
|
|
5853
5843
|
});
|
|
5854
|
-
const asset = (
|
|
5844
|
+
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];
|
|
5855
5845
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
5856
5846
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5857
5847
|
message: 'Public URL not found for the given file ID.',
|