@worktables/n8n-nodes-worktables 12.2.23 → 12.2.25
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.
|
@@ -37,6 +37,7 @@ class Worktables {
|
|
|
37
37
|
baseURL: 'https://api.monday.com/v2',
|
|
38
38
|
headers: {
|
|
39
39
|
'Content-Type': 'application/json',
|
|
40
|
+
'API-Version': '2025-01',
|
|
40
41
|
},
|
|
41
42
|
},
|
|
42
43
|
codex: {
|
|
@@ -2214,6 +2215,7 @@ class Worktables {
|
|
|
2214
2215
|
headers: {
|
|
2215
2216
|
Authorization: `Bearer ${apiKey}`,
|
|
2216
2217
|
'Content-Type': 'application/json',
|
|
2218
|
+
'API-Version': '2025-01',
|
|
2217
2219
|
},
|
|
2218
2220
|
body: JSON.stringify({
|
|
2219
2221
|
query: `{ workspaces (limit: ${limit}, page: ${page}) { id name } }`,
|
|
@@ -2276,6 +2278,7 @@ class Worktables {
|
|
|
2276
2278
|
headers: {
|
|
2277
2279
|
Authorization: `Bearer ${apiKey}`,
|
|
2278
2280
|
'Content-Type': 'application/json',
|
|
2281
|
+
'API-Version': '2025-01',
|
|
2279
2282
|
},
|
|
2280
2283
|
body: currentQuery,
|
|
2281
2284
|
});
|
|
@@ -2624,6 +2627,7 @@ class Worktables {
|
|
|
2624
2627
|
headers: {
|
|
2625
2628
|
Authorization: `Bearer ${apiKey}`,
|
|
2626
2629
|
'Content-Type': 'application/json',
|
|
2630
|
+
'API-Version': '2025-01',
|
|
2627
2631
|
},
|
|
2628
2632
|
body: {
|
|
2629
2633
|
query: `{ folders (limit: ${limit}, page: ${page}, workspace_ids: ${workspaceId}) { id name } }`,
|
|
@@ -2660,6 +2664,7 @@ class Worktables {
|
|
|
2660
2664
|
headers: {
|
|
2661
2665
|
Authorization: `Bearer ${apiKey}`,
|
|
2662
2666
|
'Content-Type': 'application/json',
|
|
2667
|
+
'API-Version': '2025-01',
|
|
2663
2668
|
},
|
|
2664
2669
|
body: {
|
|
2665
2670
|
query: `{ users (limit: ${limit}, page: ${page}) { id name } }`,
|
|
@@ -2809,7 +2814,7 @@ class Worktables {
|
|
|
2809
2814
|
};
|
|
2810
2815
|
}
|
|
2811
2816
|
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
|
|
2817
|
+
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
2818
|
const resource = this.getNodeParameter('resource', 0);
|
|
2814
2819
|
const operation = this.getNodeParameter('operation', 0);
|
|
2815
2820
|
const credentials = await this.getCredentials('WorktablesApi');
|
|
@@ -2821,6 +2826,7 @@ class Worktables {
|
|
|
2821
2826
|
const headers = {
|
|
2822
2827
|
Authorization: `Bearer ${apiKey}`,
|
|
2823
2828
|
'Content-Type': 'application/json',
|
|
2829
|
+
'API-Version': '2025-01',
|
|
2824
2830
|
};
|
|
2825
2831
|
switch (resource) {
|
|
2826
2832
|
case 'board': {
|
|
@@ -4384,37 +4390,22 @@ class Worktables {
|
|
|
4384
4390
|
for (const subitem of item.subitems) {
|
|
4385
4391
|
let matches = false;
|
|
4386
4392
|
if (isNameColumn) {
|
|
4387
|
-
|
|
4388
|
-
|
|
4393
|
+
const searchValue = identifierValue.trim().toLowerCase();
|
|
4394
|
+
const subitemName = (subitem.name || '').trim().toLowerCase();
|
|
4395
|
+
matches = subitemName === searchValue;
|
|
4389
4396
|
}
|
|
4390
4397
|
else {
|
|
4391
|
-
const colValue = (
|
|
4398
|
+
const colValue = (_0 = subitem.column_values) === null || _0 === void 0 ? void 0 : _0.find((cv) => cv.id === identifierColumn);
|
|
4392
4399
|
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
|
-
}
|
|
4400
|
+
let colText = (colValue.text || '').trim();
|
|
4409
4401
|
const searchValue = identifierValue.trim().toLowerCase();
|
|
4410
|
-
const colTextLower =
|
|
4411
|
-
|
|
4412
|
-
matches = colTextLower === searchValue || colValueStrLower === searchValue;
|
|
4402
|
+
const colTextLower = colText.toLowerCase();
|
|
4403
|
+
matches = colTextLower === searchValue;
|
|
4413
4404
|
if (matches) {
|
|
4414
|
-
console.log(`✓ Match found! Subitem ${subitem.id} - Column ${identifierColumn}: text="${colText}",
|
|
4405
|
+
console.log(`✓ Match found! Subitem ${subitem.id} - Column ${identifierColumn}: text="${colText}", search="${identifierValue}"`);
|
|
4415
4406
|
}
|
|
4416
|
-
else if (colText
|
|
4417
|
-
console.log(`✗ No match - Subitem ${subitem.id} - Column ${identifierColumn}: text="${colText}",
|
|
4407
|
+
else if (colText) {
|
|
4408
|
+
console.log(`✗ No match - Subitem ${subitem.id} - Column ${identifierColumn}: text="${colText}", search="${identifierValue}"`);
|
|
4418
4409
|
}
|
|
4419
4410
|
}
|
|
4420
4411
|
else {
|
|
@@ -4436,37 +4427,22 @@ class Worktables {
|
|
|
4436
4427
|
for (const item of items) {
|
|
4437
4428
|
let matches = false;
|
|
4438
4429
|
if (isNameColumn) {
|
|
4439
|
-
|
|
4440
|
-
|
|
4430
|
+
const searchValue = identifierValue.trim().toLowerCase();
|
|
4431
|
+
const itemName = (item.name || '').trim().toLowerCase();
|
|
4432
|
+
matches = itemName === searchValue;
|
|
4441
4433
|
}
|
|
4442
4434
|
else {
|
|
4443
|
-
const colValue = (
|
|
4435
|
+
const colValue = (_1 = item.column_values) === null || _1 === void 0 ? void 0 : _1.find((cv) => cv.id === identifierColumn);
|
|
4444
4436
|
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
|
-
}
|
|
4437
|
+
let colText = (colValue.text || '').trim();
|
|
4461
4438
|
const searchValue = identifierValue.trim().toLowerCase();
|
|
4462
|
-
const colTextLower =
|
|
4463
|
-
|
|
4464
|
-
matches = colTextLower === searchValue || colValueStrLower === searchValue;
|
|
4439
|
+
const colTextLower = colText.toLowerCase();
|
|
4440
|
+
matches = colTextLower === searchValue;
|
|
4465
4441
|
if (matches) {
|
|
4466
|
-
console.log(`✓ Match found! Item ${item.id} - Column ${identifierColumn}: text="${colText}",
|
|
4442
|
+
console.log(`✓ Match found! Item ${item.id} - Column ${identifierColumn}: text="${colText}", search="${identifierValue}"`);
|
|
4467
4443
|
}
|
|
4468
|
-
else if (colText
|
|
4469
|
-
console.log(`✗ No match - Item ${item.id} - Column ${identifierColumn}: text="${colText}",
|
|
4444
|
+
else if (colText) {
|
|
4445
|
+
console.log(`✗ No match - Item ${item.id} - Column ${identifierColumn}: text="${colText}", search="${identifierValue}"`);
|
|
4470
4446
|
}
|
|
4471
4447
|
}
|
|
4472
4448
|
else {
|
|
@@ -4514,7 +4490,7 @@ class Worktables {
|
|
|
4514
4490
|
id: itemData.id,
|
|
4515
4491
|
url: itemData.url || '',
|
|
4516
4492
|
operation: 'update',
|
|
4517
|
-
board_id: ((
|
|
4493
|
+
board_id: ((_2 = itemData.board) === null || _2 === void 0 ? void 0 : _2.id) || boardId,
|
|
4518
4494
|
column_values: column_values_object,
|
|
4519
4495
|
};
|
|
4520
4496
|
itemUpdated = true;
|
|
@@ -4597,8 +4573,8 @@ class Worktables {
|
|
|
4597
4573
|
});
|
|
4598
4574
|
}
|
|
4599
4575
|
const itemData = isSubitem && parentId
|
|
4600
|
-
? (
|
|
4601
|
-
: (
|
|
4576
|
+
? (_3 = responseData.data) === null || _3 === void 0 ? void 0 : _3.create_subitem
|
|
4577
|
+
: (_4 = responseData.data) === null || _4 === void 0 ? void 0 : _4.create_item;
|
|
4602
4578
|
if (!itemData || !itemData.id) {
|
|
4603
4579
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
4604
4580
|
message: `Error creating ${isSubitem ? 'subitem' : 'item'}: No item data returned`,
|
|
@@ -4609,7 +4585,7 @@ class Worktables {
|
|
|
4609
4585
|
name: itemData.name || itemName,
|
|
4610
4586
|
url: itemData.url || '',
|
|
4611
4587
|
operation: 'create',
|
|
4612
|
-
board_id: ((
|
|
4588
|
+
board_id: ((_5 = itemData.board) === null || _5 === void 0 ? void 0 : _5.id) || boardId,
|
|
4613
4589
|
column_values: column_values_object,
|
|
4614
4590
|
};
|
|
4615
4591
|
if (isSubitem && parentId) {
|
|
@@ -4748,7 +4724,7 @@ class Worktables {
|
|
|
4748
4724
|
body: { query },
|
|
4749
4725
|
});
|
|
4750
4726
|
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
4751
|
-
const itemsPage = (
|
|
4727
|
+
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
4728
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4753
4729
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4754
4730
|
allItems = allItems.concat(items);
|
|
@@ -4828,7 +4804,7 @@ class Worktables {
|
|
|
4828
4804
|
const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
|
|
4829
4805
|
const logicalOperator = this.getNodeParameter('logicalOperator', 0);
|
|
4830
4806
|
let rulesArray = [];
|
|
4831
|
-
if (((
|
|
4807
|
+
if (((_9 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _9 === void 0 ? void 0 : _9.length) > 0) {
|
|
4832
4808
|
rulesArray = filterRules.rule.map((rule) => {
|
|
4833
4809
|
let formattedValue;
|
|
4834
4810
|
if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
|
|
@@ -4872,7 +4848,7 @@ class Worktables {
|
|
|
4872
4848
|
});
|
|
4873
4849
|
}
|
|
4874
4850
|
const orderByArray = [];
|
|
4875
|
-
if (((
|
|
4851
|
+
if (((_10 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _10 === void 0 ? void 0 : _10.length) > 0) {
|
|
4876
4852
|
sortOptions.sortBy.forEach((sort) => {
|
|
4877
4853
|
orderByArray.push(`{
|
|
4878
4854
|
column_id: "${sort.columnId}",
|
|
@@ -4918,7 +4894,7 @@ class Worktables {
|
|
|
4918
4894
|
body: { query },
|
|
4919
4895
|
});
|
|
4920
4896
|
const parsed = JSON.parse(rawResponse);
|
|
4921
|
-
const items = ((
|
|
4897
|
+
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
4898
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
4923
4899
|
const formatted = {
|
|
4924
4900
|
id: item.id,
|
|
@@ -4952,7 +4928,7 @@ class Worktables {
|
|
|
4952
4928
|
const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
|
|
4953
4929
|
const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
|
|
4954
4930
|
let rulesArray = [];
|
|
4955
|
-
if (((
|
|
4931
|
+
if (((_15 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _15 === void 0 ? void 0 : _15.length) > 0) {
|
|
4956
4932
|
console.log('Processing filter rules:', advancedFilterRules.rule);
|
|
4957
4933
|
rulesArray = advancedFilterRules.rule.map((rule) => {
|
|
4958
4934
|
let formattedValue;
|
|
@@ -5168,7 +5144,7 @@ class Worktables {
|
|
|
5168
5144
|
});
|
|
5169
5145
|
}
|
|
5170
5146
|
const orderByArray = [];
|
|
5171
|
-
if (((
|
|
5147
|
+
if (((_16 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _16 === void 0 ? void 0 : _16.length) > 0) {
|
|
5172
5148
|
advancedSortOptions.sortBy.forEach((sort) => {
|
|
5173
5149
|
orderByArray.push(`{
|
|
5174
5150
|
column_id: "${sort.columnId}",
|
|
@@ -5240,7 +5216,7 @@ class Worktables {
|
|
|
5240
5216
|
body: { query: testQuery },
|
|
5241
5217
|
});
|
|
5242
5218
|
const testParsed = JSON.parse(testResponse);
|
|
5243
|
-
const testItems = ((
|
|
5219
|
+
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
5220
|
console.log('Test - Items in board (no filters):', testItems.length);
|
|
5245
5221
|
if (testItems.length > 0) {
|
|
5246
5222
|
console.log('Sample item column values:', testItems[0].column_values);
|
|
@@ -5252,7 +5228,7 @@ class Worktables {
|
|
|
5252
5228
|
body: { query },
|
|
5253
5229
|
});
|
|
5254
5230
|
const parsed = JSON.parse(rawResponse);
|
|
5255
|
-
const itemsPage = (
|
|
5231
|
+
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
5232
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5257
5233
|
const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
|
|
5258
5234
|
const hasMore = nextCursor ? true : false;
|
|
@@ -5343,6 +5319,7 @@ class Worktables {
|
|
|
5343
5319
|
const uploadFile = await axios_1.default.post('https://api.monday.com/v2/file', form, {
|
|
5344
5320
|
headers: {
|
|
5345
5321
|
Authorization: headers.Authorization,
|
|
5322
|
+
'API-Version': '2025-01',
|
|
5346
5323
|
...form.getHeaders(),
|
|
5347
5324
|
},
|
|
5348
5325
|
maxContentLength: Infinity,
|
|
@@ -5410,7 +5387,7 @@ class Worktables {
|
|
|
5410
5387
|
body: { query },
|
|
5411
5388
|
});
|
|
5412
5389
|
const parsed = JSON.parse(rawResponse);
|
|
5413
|
-
const items = ((
|
|
5390
|
+
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
5391
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5415
5392
|
const columnValues = item.column_values || [];
|
|
5416
5393
|
const formatted = {
|
|
@@ -5500,7 +5477,7 @@ class Worktables {
|
|
|
5500
5477
|
response = await (0, isErrorResponse_1.parseApiResponse)(response);
|
|
5501
5478
|
if (response.success) {
|
|
5502
5479
|
const parsed = JSON.parse(response.data);
|
|
5503
|
-
const updates = ((
|
|
5480
|
+
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
5481
|
const formattedUpdates = updates.map((update) => {
|
|
5505
5482
|
const pinnedToTop = update.pinned_to_top || [];
|
|
5506
5483
|
const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
|
|
@@ -5565,7 +5542,7 @@ class Worktables {
|
|
|
5565
5542
|
console.log('variables:', variables);
|
|
5566
5543
|
response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
|
|
5567
5544
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
5568
|
-
const updateId = (
|
|
5545
|
+
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
5546
|
if (!updateId) {
|
|
5570
5547
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5571
5548
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -5599,6 +5576,7 @@ class Worktables {
|
|
|
5599
5576
|
const uploadResponse = await axios_1.default.post('https://api.monday.com/v2/file', form, {
|
|
5600
5577
|
headers: {
|
|
5601
5578
|
Authorization: headers.Authorization,
|
|
5579
|
+
'API-Version': '2025-01',
|
|
5602
5580
|
...form.getHeaders(),
|
|
5603
5581
|
},
|
|
5604
5582
|
maxContentLength: Infinity,
|
|
@@ -5660,6 +5638,7 @@ class Worktables {
|
|
|
5660
5638
|
const uploadResponse = await axios_1.default.post('https://api.monday.com/v2/file', form, {
|
|
5661
5639
|
headers: {
|
|
5662
5640
|
Authorization: headers.Authorization,
|
|
5641
|
+
'API-Version': '2025-01',
|
|
5663
5642
|
...form.getHeaders(),
|
|
5664
5643
|
},
|
|
5665
5644
|
maxContentLength: Infinity,
|
|
@@ -5723,6 +5702,7 @@ class Worktables {
|
|
|
5723
5702
|
const uploadResponse = await axios_1.default.post('https://api.monday.com/v2/file', form, {
|
|
5724
5703
|
headers: {
|
|
5725
5704
|
Authorization: headers.Authorization,
|
|
5705
|
+
'API-Version': '2025-01',
|
|
5726
5706
|
...form.getHeaders(),
|
|
5727
5707
|
},
|
|
5728
5708
|
maxContentLength: Infinity,
|
|
@@ -5871,7 +5851,7 @@ class Worktables {
|
|
|
5871
5851
|
body: { query },
|
|
5872
5852
|
json: true,
|
|
5873
5853
|
});
|
|
5874
|
-
const asset = (
|
|
5854
|
+
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
5855
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
5876
5856
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5877
5857
|
message: 'Public URL not found for the given file ID.',
|