@worktables/n8n-nodes-worktables 12.2.12 → 12.2.13
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.
|
@@ -1095,7 +1095,10 @@ class Worktables {
|
|
|
1095
1095
|
displayName: 'Additional Options',
|
|
1096
1096
|
name: 'additionalOptions',
|
|
1097
1097
|
type: 'fixedCollection',
|
|
1098
|
-
|
|
1098
|
+
typeOptions: {
|
|
1099
|
+
multipleValues: true,
|
|
1100
|
+
},
|
|
1101
|
+
default: [],
|
|
1099
1102
|
displayOptions: {
|
|
1100
1103
|
show: {
|
|
1101
1104
|
operation: ['getItem'],
|
|
@@ -2775,7 +2778,7 @@ class Worktables {
|
|
|
2775
2778
|
};
|
|
2776
2779
|
}
|
|
2777
2780
|
async execute() {
|
|
2778
|
-
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
|
|
2781
|
+
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;
|
|
2779
2782
|
const resource = this.getNodeParameter('resource', 0);
|
|
2780
2783
|
const operation = this.getNodeParameter('operation', 0);
|
|
2781
2784
|
const credentials = await this.getCredentials('WorktablesApi');
|
|
@@ -3390,10 +3393,11 @@ class Worktables {
|
|
|
3390
3393
|
const columnIds = fetchAllColumns
|
|
3391
3394
|
? ''
|
|
3392
3395
|
: this.getNodeParameter('columnIds', 0, false) || '';
|
|
3393
|
-
const
|
|
3394
|
-
const
|
|
3395
|
-
const
|
|
3396
|
-
const
|
|
3396
|
+
const additionalOptionsArray = this.getNodeParameter('additionalOptions', 0, []);
|
|
3397
|
+
const options = additionalOptionsArray.length > 0 ? additionalOptionsArray[0].options || {} : {};
|
|
3398
|
+
const isSubitem = options.isSubitem || false;
|
|
3399
|
+
const fetchSubitems = !isSubitem && (options.fetchSubitems || false);
|
|
3400
|
+
const fetchParentItem = isSubitem && (options.fetchParentItems || false);
|
|
3397
3401
|
let queryColumnValues = '';
|
|
3398
3402
|
if (fetchAllColumns) {
|
|
3399
3403
|
queryColumnValues = `
|
|
@@ -3496,7 +3500,7 @@ class Worktables {
|
|
|
3496
3500
|
body: { query },
|
|
3497
3501
|
});
|
|
3498
3502
|
const parsed = JSON.parse(rawResponse);
|
|
3499
|
-
const items = (
|
|
3503
|
+
const items = (_a = parsed.data) === null || _a === void 0 ? void 0 : _a.items;
|
|
3500
3504
|
const item = items === null || items === void 0 ? void 0 : items[0];
|
|
3501
3505
|
if (!item || !items || items.length === 0) {
|
|
3502
3506
|
return [[]];
|
|
@@ -3643,7 +3647,7 @@ class Worktables {
|
|
|
3643
3647
|
headers,
|
|
3644
3648
|
body: { query: mutation },
|
|
3645
3649
|
});
|
|
3646
|
-
const existingIds = ((
|
|
3650
|
+
const existingIds = ((_g = (_f = (_e = (_d = (_c = (_b = JSON.parse(itemConnectionResponse)) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.items) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.column_values) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.linked_item_ids) || [];
|
|
3647
3651
|
console.log('Existing IDs:', existingIds);
|
|
3648
3652
|
const newIds = columnValue.split(',').map((id) => id.trim());
|
|
3649
3653
|
const mergedIds = Array.from(new Set([...existingIds, ...newIds]));
|
|
@@ -3683,8 +3687,8 @@ class Worktables {
|
|
|
3683
3687
|
break;
|
|
3684
3688
|
case 'timeline':
|
|
3685
3689
|
column_values_object[columnId] = {
|
|
3686
|
-
from: (
|
|
3687
|
-
to: (
|
|
3690
|
+
from: (_h = col.startDate) === null || _h === void 0 ? void 0 : _h.split('T')[0],
|
|
3691
|
+
to: (_j = col.endDate) === null || _j === void 0 ? void 0 : _j.split('T')[0],
|
|
3688
3692
|
};
|
|
3689
3693
|
break;
|
|
3690
3694
|
case 'checkbox':
|
|
@@ -3705,7 +3709,7 @@ class Worktables {
|
|
|
3705
3709
|
};
|
|
3706
3710
|
break;
|
|
3707
3711
|
case 'dropdown':
|
|
3708
|
-
const dropdownLabels = (
|
|
3712
|
+
const dropdownLabels = (_k = col.dropdownValue) === null || _k === void 0 ? void 0 : _k.split(',').map((label) => label.trim()).filter(Boolean);
|
|
3709
3713
|
if (dropdownLabels === null || dropdownLabels === void 0 ? void 0 : dropdownLabels.length) {
|
|
3710
3714
|
column_values_object[columnId] = { labels: dropdownLabels };
|
|
3711
3715
|
}
|
|
@@ -3738,8 +3742,8 @@ class Worktables {
|
|
|
3738
3742
|
break;
|
|
3739
3743
|
case 'phone':
|
|
3740
3744
|
column_values_object[columnId] = {
|
|
3741
|
-
phone: `${(
|
|
3742
|
-
countryShortName: ((
|
|
3745
|
+
phone: `${(_l = col.countryCode) === null || _l === void 0 ? void 0 : _l.split(' ')[0]}${col.phoneValue || ''}`.replace(/[^\d+]/g, ''),
|
|
3746
|
+
countryShortName: ((_m = col.countryCode) === null || _m === void 0 ? void 0 : _m.split(' ')[1]) || '',
|
|
3743
3747
|
};
|
|
3744
3748
|
break;
|
|
3745
3749
|
case 'fileLink':
|
|
@@ -3772,7 +3776,7 @@ class Worktables {
|
|
|
3772
3776
|
});
|
|
3773
3777
|
try {
|
|
3774
3778
|
const buttonValue = JSON.parse(buttonResponse).data.items[0].column_values[0].value;
|
|
3775
|
-
const clicks = ((
|
|
3779
|
+
const clicks = ((_o = JSON.parse(buttonValue)) === null || _o === void 0 ? void 0 : _o.clicks) || 0;
|
|
3776
3780
|
column_values_object[columnId] = {
|
|
3777
3781
|
clicks: clicks + 1,
|
|
3778
3782
|
changed_at: new Date().toISOString(),
|
|
@@ -3942,8 +3946,8 @@ class Worktables {
|
|
|
3942
3946
|
break;
|
|
3943
3947
|
case 'timeline':
|
|
3944
3948
|
{
|
|
3945
|
-
const from = ((
|
|
3946
|
-
const to = ((
|
|
3949
|
+
const from = ((_p = col.startDate) === null || _p === void 0 ? void 0 : _p.split('T')[0]) || '';
|
|
3950
|
+
const to = ((_q = col.endDate) === null || _q === void 0 ? void 0 : _q.split('T')[0]) || '';
|
|
3947
3951
|
column_values_object[columnId] = { from, to };
|
|
3948
3952
|
}
|
|
3949
3953
|
break;
|
|
@@ -3981,8 +3985,8 @@ class Worktables {
|
|
|
3981
3985
|
break;
|
|
3982
3986
|
case 'phone':
|
|
3983
3987
|
column_values_object[columnId] = {
|
|
3984
|
-
phone: `${(
|
|
3985
|
-
countryShortName: ((
|
|
3988
|
+
phone: `${(_r = col.countryCode) === null || _r === void 0 ? void 0 : _r.split(' ')[0]}${col.phoneValue || ''}`.replace(/[^\d+]/g, ''),
|
|
3989
|
+
countryShortName: ((_s = col.countryCode) === null || _s === void 0 ? void 0 : _s.split(' ')[1]) || '',
|
|
3986
3990
|
};
|
|
3987
3991
|
break;
|
|
3988
3992
|
case 'file':
|
|
@@ -3998,7 +4002,7 @@ class Worktables {
|
|
|
3998
4002
|
break;
|
|
3999
4003
|
case 'dropdown':
|
|
4000
4004
|
{
|
|
4001
|
-
const labels = (
|
|
4005
|
+
const labels = (_t = col.dropdownValue) === null || _t === void 0 ? void 0 : _t.split(',').map((t) => t.trim()).filter((t) => t);
|
|
4002
4006
|
if (labels && labels.length) {
|
|
4003
4007
|
column_values_object[columnId] = { labels };
|
|
4004
4008
|
}
|
|
@@ -4121,7 +4125,7 @@ class Worktables {
|
|
|
4121
4125
|
});
|
|
4122
4126
|
}
|
|
4123
4127
|
const parsedResponse = JSON.parse(responseRaw);
|
|
4124
|
-
const itemData = ((
|
|
4128
|
+
const itemData = ((_u = parsedResponse.data) === null || _u === void 0 ? void 0 : _u.create_item) || ((_v = parsedResponse.data) === null || _v === void 0 ? void 0 : _v.create_subitem);
|
|
4125
4129
|
const formattedResponse = {
|
|
4126
4130
|
id: itemData.id,
|
|
4127
4131
|
name: itemName,
|
|
@@ -4268,7 +4272,7 @@ class Worktables {
|
|
|
4268
4272
|
};
|
|
4269
4273
|
break;
|
|
4270
4274
|
case 'file':
|
|
4271
|
-
if ((
|
|
4275
|
+
if ((_w = col.fileLinks) === null || _w === void 0 ? void 0 : _w.file) {
|
|
4272
4276
|
column_values_object[columnId] = { files: col.fileLinks.file };
|
|
4273
4277
|
}
|
|
4274
4278
|
break;
|
|
@@ -4523,7 +4527,7 @@ class Worktables {
|
|
|
4523
4527
|
body: { query },
|
|
4524
4528
|
});
|
|
4525
4529
|
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
4526
|
-
const itemsPage = (
|
|
4530
|
+
const itemsPage = (_z = (_y = (_x = parsed === null || parsed === void 0 ? void 0 : parsed.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;
|
|
4527
4531
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4528
4532
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4529
4533
|
allItems = allItems.concat(items);
|
|
@@ -4597,7 +4601,7 @@ class Worktables {
|
|
|
4597
4601
|
const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
|
|
4598
4602
|
const logicalOperator = this.getNodeParameter('logicalOperator', 0);
|
|
4599
4603
|
let rulesArray = [];
|
|
4600
|
-
if (((
|
|
4604
|
+
if (((_0 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _0 === void 0 ? void 0 : _0.length) > 0) {
|
|
4601
4605
|
rulesArray = filterRules.rule.map((rule) => {
|
|
4602
4606
|
let formattedValue;
|
|
4603
4607
|
if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
|
|
@@ -4641,7 +4645,7 @@ class Worktables {
|
|
|
4641
4645
|
});
|
|
4642
4646
|
}
|
|
4643
4647
|
const orderByArray = [];
|
|
4644
|
-
if (((
|
|
4648
|
+
if (((_1 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _1 === void 0 ? void 0 : _1.length) > 0) {
|
|
4645
4649
|
sortOptions.sortBy.forEach((sort) => {
|
|
4646
4650
|
orderByArray.push(`{
|
|
4647
4651
|
column_id: "${sort.columnId}",
|
|
@@ -4687,7 +4691,7 @@ class Worktables {
|
|
|
4687
4691
|
body: { query },
|
|
4688
4692
|
});
|
|
4689
4693
|
const parsed = JSON.parse(rawResponse);
|
|
4690
|
-
const items = ((
|
|
4694
|
+
const items = ((_5 = (_4 = (_3 = (_2 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _2 === void 0 ? void 0 : _2.boards) === null || _3 === void 0 ? void 0 : _3[0]) === null || _4 === void 0 ? void 0 : _4.items_page) === null || _5 === void 0 ? void 0 : _5.items) || [];
|
|
4691
4695
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
4692
4696
|
const formatted = {
|
|
4693
4697
|
id: item.id,
|
|
@@ -4721,7 +4725,7 @@ class Worktables {
|
|
|
4721
4725
|
const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
|
|
4722
4726
|
const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
|
|
4723
4727
|
let rulesArray = [];
|
|
4724
|
-
if (((
|
|
4728
|
+
if (((_6 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _6 === void 0 ? void 0 : _6.length) > 0) {
|
|
4725
4729
|
console.log('Processing filter rules:', advancedFilterRules.rule);
|
|
4726
4730
|
rulesArray = advancedFilterRules.rule.map((rule) => {
|
|
4727
4731
|
let formattedValue;
|
|
@@ -4937,7 +4941,7 @@ class Worktables {
|
|
|
4937
4941
|
});
|
|
4938
4942
|
}
|
|
4939
4943
|
const orderByArray = [];
|
|
4940
|
-
if (((
|
|
4944
|
+
if (((_7 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _7 === void 0 ? void 0 : _7.length) > 0) {
|
|
4941
4945
|
advancedSortOptions.sortBy.forEach((sort) => {
|
|
4942
4946
|
orderByArray.push(`{
|
|
4943
4947
|
column_id: "${sort.columnId}",
|
|
@@ -5009,7 +5013,7 @@ class Worktables {
|
|
|
5009
5013
|
body: { query: testQuery },
|
|
5010
5014
|
});
|
|
5011
5015
|
const testParsed = JSON.parse(testResponse);
|
|
5012
|
-
const testItems = ((
|
|
5016
|
+
const testItems = ((_11 = (_10 = (_9 = (_8 = testParsed === null || testParsed === void 0 ? void 0 : testParsed.data) === null || _8 === void 0 ? void 0 : _8.boards) === null || _9 === void 0 ? void 0 : _9[0]) === null || _10 === void 0 ? void 0 : _10.items_page) === null || _11 === void 0 ? void 0 : _11.items) || [];
|
|
5013
5017
|
console.log('Test - Items in board (no filters):', testItems.length);
|
|
5014
5018
|
if (testItems.length > 0) {
|
|
5015
5019
|
console.log('Sample item column values:', testItems[0].column_values);
|
|
@@ -5021,7 +5025,7 @@ class Worktables {
|
|
|
5021
5025
|
body: { query },
|
|
5022
5026
|
});
|
|
5023
5027
|
const parsed = JSON.parse(rawResponse);
|
|
5024
|
-
const itemsPage = (
|
|
5028
|
+
const itemsPage = (_14 = (_13 = (_12 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _12 === void 0 ? void 0 : _12.boards) === null || _13 === void 0 ? void 0 : _13[0]) === null || _14 === void 0 ? void 0 : _14.items_page;
|
|
5025
5029
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5026
5030
|
const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
|
|
5027
5031
|
const hasMore = nextCursor ? true : false;
|
|
@@ -5173,7 +5177,7 @@ class Worktables {
|
|
|
5173
5177
|
body: { query },
|
|
5174
5178
|
});
|
|
5175
5179
|
const parsed = JSON.parse(rawResponse);
|
|
5176
|
-
const items = ((
|
|
5180
|
+
const items = ((_20 = (_19 = (_18 = (_17 = (_16 = (_15 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _15 === void 0 ? void 0 : _15.boards) === null || _16 === void 0 ? void 0 : _16[0]) === null || _17 === void 0 ? void 0 : _17.groups) === 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) || [];
|
|
5177
5181
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5178
5182
|
const columnValues = item.column_values || [];
|
|
5179
5183
|
const formatted = {
|
|
@@ -5257,7 +5261,7 @@ class Worktables {
|
|
|
5257
5261
|
response = await (0, isErrorResponse_1.parseApiResponse)(response);
|
|
5258
5262
|
if (response.success) {
|
|
5259
5263
|
const parsed = JSON.parse(response.data);
|
|
5260
|
-
const updates = ((
|
|
5264
|
+
const updates = ((_23 = (_22 = (_21 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _21 === void 0 ? void 0 : _21.items) === null || _22 === void 0 ? void 0 : _22[0]) === null || _23 === void 0 ? void 0 : _23.updates) || [];
|
|
5261
5265
|
return [updates.map((update) => ({ json: update }))];
|
|
5262
5266
|
}
|
|
5263
5267
|
else {
|
|
@@ -5314,7 +5318,7 @@ class Worktables {
|
|
|
5314
5318
|
console.log('variables:', variables);
|
|
5315
5319
|
response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
|
|
5316
5320
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
5317
|
-
const updateId = (
|
|
5321
|
+
const updateId = (_25 = (_24 = JSON.parse(response).data) === null || _24 === void 0 ? void 0 : _24.create_update) === null || _25 === void 0 ? void 0 : _25.id;
|
|
5318
5322
|
if (!updateId) {
|
|
5319
5323
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5320
5324
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -5620,7 +5624,7 @@ class Worktables {
|
|
|
5620
5624
|
body: { query },
|
|
5621
5625
|
json: true,
|
|
5622
5626
|
});
|
|
5623
|
-
const asset = (
|
|
5627
|
+
const asset = (_27 = (_26 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _26 === void 0 ? void 0 : _26.assets) === null || _27 === void 0 ? void 0 : _27[0];
|
|
5624
5628
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
5625
5629
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5626
5630
|
message: 'Public URL not found for the given file ID.',
|