@worktables/n8n-nodes-worktables 12.2.23 → 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,37 +4384,22 @@ 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
|
-
let colValueStr = '';
|
|
4395
|
-
try {
|
|
4396
|
-
if (colValue.value) {
|
|
4397
|
-
const parsedValue = JSON.parse(colValue.value);
|
|
4398
|
-
if (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.label) {
|
|
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
|
-
}
|
|
4405
|
-
}
|
|
4406
|
-
catch {
|
|
4407
|
-
colValueStr = colValue.value || '';
|
|
4408
|
-
}
|
|
4394
|
+
let colText = (colValue.text || '').trim();
|
|
4409
4395
|
const searchValue = identifierValue.trim().toLowerCase();
|
|
4410
|
-
const colTextLower =
|
|
4411
|
-
|
|
4412
|
-
matches = colTextLower === searchValue || colValueStrLower === searchValue;
|
|
4396
|
+
const colTextLower = colText.toLowerCase();
|
|
4397
|
+
matches = colTextLower === searchValue;
|
|
4413
4398
|
if (matches) {
|
|
4414
|
-
console.log(`✓ Match found! Subitem ${subitem.id} - Column ${identifierColumn}: text="${colText}",
|
|
4399
|
+
console.log(`✓ Match found! Subitem ${subitem.id} - Column ${identifierColumn}: text="${colText}", search="${identifierValue}"`);
|
|
4415
4400
|
}
|
|
4416
|
-
else if (colText
|
|
4417
|
-
console.log(`✗ No match - Subitem ${subitem.id} - Column ${identifierColumn}: text="${colText}",
|
|
4401
|
+
else if (colText) {
|
|
4402
|
+
console.log(`✗ No match - Subitem ${subitem.id} - Column ${identifierColumn}: text="${colText}", search="${identifierValue}"`);
|
|
4418
4403
|
}
|
|
4419
4404
|
}
|
|
4420
4405
|
else {
|
|
@@ -4436,37 +4421,22 @@ class Worktables {
|
|
|
4436
4421
|
for (const item of items) {
|
|
4437
4422
|
let matches = false;
|
|
4438
4423
|
if (isNameColumn) {
|
|
4439
|
-
|
|
4440
|
-
|
|
4424
|
+
const searchValue = identifierValue.trim().toLowerCase();
|
|
4425
|
+
const itemName = (item.name || '').trim().toLowerCase();
|
|
4426
|
+
matches = itemName === searchValue;
|
|
4441
4427
|
}
|
|
4442
4428
|
else {
|
|
4443
|
-
const colValue = (
|
|
4429
|
+
const colValue = (_1 = item.column_values) === null || _1 === void 0 ? void 0 : _1.find((cv) => cv.id === identifierColumn);
|
|
4444
4430
|
if (colValue) {
|
|
4445
|
-
let colText = colValue.text || '';
|
|
4446
|
-
let colValueStr = '';
|
|
4447
|
-
try {
|
|
4448
|
-
if (colValue.value) {
|
|
4449
|
-
const parsedValue = JSON.parse(colValue.value);
|
|
4450
|
-
if (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.label) {
|
|
4451
|
-
colValueStr = parsedValue.label;
|
|
4452
|
-
}
|
|
4453
|
-
else {
|
|
4454
|
-
colValueStr = (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.text) || (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.value) || String(parsedValue);
|
|
4455
|
-
}
|
|
4456
|
-
}
|
|
4457
|
-
}
|
|
4458
|
-
catch {
|
|
4459
|
-
colValueStr = colValue.value || '';
|
|
4460
|
-
}
|
|
4431
|
+
let colText = (colValue.text || '').trim();
|
|
4461
4432
|
const searchValue = identifierValue.trim().toLowerCase();
|
|
4462
|
-
const colTextLower =
|
|
4463
|
-
|
|
4464
|
-
matches = colTextLower === searchValue || colValueStrLower === searchValue;
|
|
4433
|
+
const colTextLower = colText.toLowerCase();
|
|
4434
|
+
matches = colTextLower === searchValue;
|
|
4465
4435
|
if (matches) {
|
|
4466
|
-
console.log(`✓ Match found! Item ${item.id} - Column ${identifierColumn}: text="${colText}",
|
|
4436
|
+
console.log(`✓ Match found! Item ${item.id} - Column ${identifierColumn}: text="${colText}", search="${identifierValue}"`);
|
|
4467
4437
|
}
|
|
4468
|
-
else if (colText
|
|
4469
|
-
console.log(`✗ No match - Item ${item.id} - Column ${identifierColumn}: text="${colText}",
|
|
4438
|
+
else if (colText) {
|
|
4439
|
+
console.log(`✗ No match - Item ${item.id} - Column ${identifierColumn}: text="${colText}", search="${identifierValue}"`);
|
|
4470
4440
|
}
|
|
4471
4441
|
}
|
|
4472
4442
|
else {
|
|
@@ -4514,7 +4484,7 @@ class Worktables {
|
|
|
4514
4484
|
id: itemData.id,
|
|
4515
4485
|
url: itemData.url || '',
|
|
4516
4486
|
operation: 'update',
|
|
4517
|
-
board_id: ((
|
|
4487
|
+
board_id: ((_2 = itemData.board) === null || _2 === void 0 ? void 0 : _2.id) || boardId,
|
|
4518
4488
|
column_values: column_values_object,
|
|
4519
4489
|
};
|
|
4520
4490
|
itemUpdated = true;
|
|
@@ -4597,8 +4567,8 @@ class Worktables {
|
|
|
4597
4567
|
});
|
|
4598
4568
|
}
|
|
4599
4569
|
const itemData = isSubitem && parentId
|
|
4600
|
-
? (
|
|
4601
|
-
: (
|
|
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;
|
|
4602
4572
|
if (!itemData || !itemData.id) {
|
|
4603
4573
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
4604
4574
|
message: `Error creating ${isSubitem ? 'subitem' : 'item'}: No item data returned`,
|
|
@@ -4609,7 +4579,7 @@ class Worktables {
|
|
|
4609
4579
|
name: itemData.name || itemName,
|
|
4610
4580
|
url: itemData.url || '',
|
|
4611
4581
|
operation: 'create',
|
|
4612
|
-
board_id: ((
|
|
4582
|
+
board_id: ((_5 = itemData.board) === null || _5 === void 0 ? void 0 : _5.id) || boardId,
|
|
4613
4583
|
column_values: column_values_object,
|
|
4614
4584
|
};
|
|
4615
4585
|
if (isSubitem && parentId) {
|
|
@@ -4748,7 +4718,7 @@ class Worktables {
|
|
|
4748
4718
|
body: { query },
|
|
4749
4719
|
});
|
|
4750
4720
|
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
4751
|
-
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;
|
|
4752
4722
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4753
4723
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4754
4724
|
allItems = allItems.concat(items);
|
|
@@ -4828,7 +4798,7 @@ class Worktables {
|
|
|
4828
4798
|
const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
|
|
4829
4799
|
const logicalOperator = this.getNodeParameter('logicalOperator', 0);
|
|
4830
4800
|
let rulesArray = [];
|
|
4831
|
-
if (((
|
|
4801
|
+
if (((_9 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _9 === void 0 ? void 0 : _9.length) > 0) {
|
|
4832
4802
|
rulesArray = filterRules.rule.map((rule) => {
|
|
4833
4803
|
let formattedValue;
|
|
4834
4804
|
if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
|
|
@@ -4872,7 +4842,7 @@ class Worktables {
|
|
|
4872
4842
|
});
|
|
4873
4843
|
}
|
|
4874
4844
|
const orderByArray = [];
|
|
4875
|
-
if (((
|
|
4845
|
+
if (((_10 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _10 === void 0 ? void 0 : _10.length) > 0) {
|
|
4876
4846
|
sortOptions.sortBy.forEach((sort) => {
|
|
4877
4847
|
orderByArray.push(`{
|
|
4878
4848
|
column_id: "${sort.columnId}",
|
|
@@ -4918,7 +4888,7 @@ class Worktables {
|
|
|
4918
4888
|
body: { query },
|
|
4919
4889
|
});
|
|
4920
4890
|
const parsed = JSON.parse(rawResponse);
|
|
4921
|
-
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) || [];
|
|
4922
4892
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
4923
4893
|
const formatted = {
|
|
4924
4894
|
id: item.id,
|
|
@@ -4952,7 +4922,7 @@ class Worktables {
|
|
|
4952
4922
|
const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
|
|
4953
4923
|
const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
|
|
4954
4924
|
let rulesArray = [];
|
|
4955
|
-
if (((
|
|
4925
|
+
if (((_15 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _15 === void 0 ? void 0 : _15.length) > 0) {
|
|
4956
4926
|
console.log('Processing filter rules:', advancedFilterRules.rule);
|
|
4957
4927
|
rulesArray = advancedFilterRules.rule.map((rule) => {
|
|
4958
4928
|
let formattedValue;
|
|
@@ -5168,7 +5138,7 @@ class Worktables {
|
|
|
5168
5138
|
});
|
|
5169
5139
|
}
|
|
5170
5140
|
const orderByArray = [];
|
|
5171
|
-
if (((
|
|
5141
|
+
if (((_16 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _16 === void 0 ? void 0 : _16.length) > 0) {
|
|
5172
5142
|
advancedSortOptions.sortBy.forEach((sort) => {
|
|
5173
5143
|
orderByArray.push(`{
|
|
5174
5144
|
column_id: "${sort.columnId}",
|
|
@@ -5240,7 +5210,7 @@ class Worktables {
|
|
|
5240
5210
|
body: { query: testQuery },
|
|
5241
5211
|
});
|
|
5242
5212
|
const testParsed = JSON.parse(testResponse);
|
|
5243
|
-
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) || [];
|
|
5244
5214
|
console.log('Test - Items in board (no filters):', testItems.length);
|
|
5245
5215
|
if (testItems.length > 0) {
|
|
5246
5216
|
console.log('Sample item column values:', testItems[0].column_values);
|
|
@@ -5252,7 +5222,7 @@ class Worktables {
|
|
|
5252
5222
|
body: { query },
|
|
5253
5223
|
});
|
|
5254
5224
|
const parsed = JSON.parse(rawResponse);
|
|
5255
|
-
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;
|
|
5256
5226
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5257
5227
|
const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
|
|
5258
5228
|
const hasMore = nextCursor ? true : false;
|
|
@@ -5410,7 +5380,7 @@ class Worktables {
|
|
|
5410
5380
|
body: { query },
|
|
5411
5381
|
});
|
|
5412
5382
|
const parsed = JSON.parse(rawResponse);
|
|
5413
|
-
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) || [];
|
|
5414
5384
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5415
5385
|
const columnValues = item.column_values || [];
|
|
5416
5386
|
const formatted = {
|
|
@@ -5500,7 +5470,7 @@ class Worktables {
|
|
|
5500
5470
|
response = await (0, isErrorResponse_1.parseApiResponse)(response);
|
|
5501
5471
|
if (response.success) {
|
|
5502
5472
|
const parsed = JSON.parse(response.data);
|
|
5503
|
-
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) || [];
|
|
5504
5474
|
const formattedUpdates = updates.map((update) => {
|
|
5505
5475
|
const pinnedToTop = update.pinned_to_top || [];
|
|
5506
5476
|
const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
|
|
@@ -5565,7 +5535,7 @@ class Worktables {
|
|
|
5565
5535
|
console.log('variables:', variables);
|
|
5566
5536
|
response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
|
|
5567
5537
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
5568
|
-
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;
|
|
5569
5539
|
if (!updateId) {
|
|
5570
5540
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5571
5541
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -5871,7 +5841,7 @@ class Worktables {
|
|
|
5871
5841
|
body: { query },
|
|
5872
5842
|
json: true,
|
|
5873
5843
|
});
|
|
5874
|
-
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];
|
|
5875
5845
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
5876
5846
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5877
5847
|
message: 'Public URL not found for the given file ID.',
|