@worktables/n8n-nodes-worktables 12.2.8 → 12.2.9
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.
|
@@ -1094,8 +1094,7 @@ class Worktables {
|
|
|
1094
1094
|
{
|
|
1095
1095
|
displayName: 'Additional Options',
|
|
1096
1096
|
name: 'additionalOptions',
|
|
1097
|
-
type: '
|
|
1098
|
-
placeholder: 'Add Option',
|
|
1097
|
+
type: 'fixedCollection',
|
|
1099
1098
|
default: {},
|
|
1100
1099
|
displayOptions: {
|
|
1101
1100
|
show: {
|
|
@@ -1104,35 +1103,41 @@ class Worktables {
|
|
|
1104
1103
|
},
|
|
1105
1104
|
options: [
|
|
1106
1105
|
{
|
|
1107
|
-
displayName: '
|
|
1108
|
-
name: '
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
type: 'boolean',
|
|
1117
|
-
default: false,
|
|
1118
|
-
description: 'Whether to fetch subitems',
|
|
1119
|
-
displayOptions: {
|
|
1120
|
-
show: {
|
|
1121
|
-
isSubitem: [false],
|
|
1106
|
+
displayName: 'Options',
|
|
1107
|
+
name: 'options',
|
|
1108
|
+
values: [
|
|
1109
|
+
{
|
|
1110
|
+
displayName: 'Is Subitem',
|
|
1111
|
+
name: 'isSubitem',
|
|
1112
|
+
type: 'boolean',
|
|
1113
|
+
default: false,
|
|
1114
|
+
description: 'Whether a subitem',
|
|
1122
1115
|
},
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1116
|
+
{
|
|
1117
|
+
displayName: 'Fetch Subitems',
|
|
1118
|
+
name: 'fetchSubitems',
|
|
1119
|
+
type: 'boolean',
|
|
1120
|
+
default: false,
|
|
1121
|
+
description: 'Whether to fetch subitems',
|
|
1122
|
+
displayOptions: {
|
|
1123
|
+
show: {
|
|
1124
|
+
isSubitem: [false],
|
|
1125
|
+
},
|
|
1126
|
+
},
|
|
1134
1127
|
},
|
|
1135
|
-
|
|
1128
|
+
{
|
|
1129
|
+
displayName: 'Fetch Parent Item',
|
|
1130
|
+
name: 'fetchParentItems',
|
|
1131
|
+
type: 'boolean',
|
|
1132
|
+
default: false,
|
|
1133
|
+
description: 'Whether to fetch parent item',
|
|
1134
|
+
displayOptions: {
|
|
1135
|
+
show: {
|
|
1136
|
+
isSubitem: [true],
|
|
1137
|
+
},
|
|
1138
|
+
},
|
|
1139
|
+
},
|
|
1140
|
+
],
|
|
1136
1141
|
},
|
|
1137
1142
|
],
|
|
1138
1143
|
},
|
|
@@ -2770,7 +2775,7 @@ class Worktables {
|
|
|
2770
2775
|
};
|
|
2771
2776
|
}
|
|
2772
2777
|
async execute() {
|
|
2773
|
-
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;
|
|
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, _28, _29, _30;
|
|
2774
2779
|
const resource = this.getNodeParameter('resource', 0);
|
|
2775
2780
|
const operation = this.getNodeParameter('operation', 0);
|
|
2776
2781
|
const credentials = await this.getCredentials('WorktablesApi');
|
|
@@ -3386,9 +3391,9 @@ class Worktables {
|
|
|
3386
3391
|
? ''
|
|
3387
3392
|
: this.getNodeParameter('columnIds', 0, false) || '';
|
|
3388
3393
|
const additionalOptions = this.getNodeParameter('additionalOptions', 0, {});
|
|
3389
|
-
const isSubitem = additionalOptions.isSubitem || false;
|
|
3390
|
-
const fetchSubitems = !isSubitem && (additionalOptions.fetchSubitems || false);
|
|
3391
|
-
const fetchParentItem = isSubitem && (additionalOptions.fetchParentItems || false);
|
|
3394
|
+
const isSubitem = ((_a = additionalOptions.options) === null || _a === void 0 ? void 0 : _a.isSubitem) || false;
|
|
3395
|
+
const fetchSubitems = !isSubitem && (((_b = additionalOptions.options) === null || _b === void 0 ? void 0 : _b.fetchSubitems) || false);
|
|
3396
|
+
const fetchParentItem = isSubitem && (((_c = additionalOptions.options) === null || _c === void 0 ? void 0 : _c.fetchParentItems) || false);
|
|
3392
3397
|
let queryColumnValues = '';
|
|
3393
3398
|
if (fetchAllColumns) {
|
|
3394
3399
|
queryColumnValues = `
|
|
@@ -3491,7 +3496,7 @@ class Worktables {
|
|
|
3491
3496
|
body: { query },
|
|
3492
3497
|
});
|
|
3493
3498
|
const parsed = JSON.parse(rawResponse);
|
|
3494
|
-
const items = (
|
|
3499
|
+
const items = (_d = parsed.data) === null || _d === void 0 ? void 0 : _d.items;
|
|
3495
3500
|
const item = items === null || items === void 0 ? void 0 : items[0];
|
|
3496
3501
|
if (!item || !items || items.length === 0) {
|
|
3497
3502
|
return [[]];
|
|
@@ -3638,7 +3643,7 @@ class Worktables {
|
|
|
3638
3643
|
headers,
|
|
3639
3644
|
body: { query: mutation },
|
|
3640
3645
|
});
|
|
3641
|
-
const existingIds = ((
|
|
3646
|
+
const existingIds = ((_k = (_j = (_h = (_g = (_f = (_e = JSON.parse(itemConnectionResponse)) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.items) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.column_values) === null || _j === void 0 ? void 0 : _j[0]) === null || _k === void 0 ? void 0 : _k.linked_item_ids) || [];
|
|
3642
3647
|
console.log('Existing IDs:', existingIds);
|
|
3643
3648
|
const newIds = columnValue.split(',').map((id) => id.trim());
|
|
3644
3649
|
const mergedIds = Array.from(new Set([...existingIds, ...newIds]));
|
|
@@ -3678,8 +3683,8 @@ class Worktables {
|
|
|
3678
3683
|
break;
|
|
3679
3684
|
case 'timeline':
|
|
3680
3685
|
column_values_object[columnId] = {
|
|
3681
|
-
from: (
|
|
3682
|
-
to: (
|
|
3686
|
+
from: (_l = col.startDate) === null || _l === void 0 ? void 0 : _l.split('T')[0],
|
|
3687
|
+
to: (_m = col.endDate) === null || _m === void 0 ? void 0 : _m.split('T')[0],
|
|
3683
3688
|
};
|
|
3684
3689
|
break;
|
|
3685
3690
|
case 'checkbox':
|
|
@@ -3700,7 +3705,7 @@ class Worktables {
|
|
|
3700
3705
|
};
|
|
3701
3706
|
break;
|
|
3702
3707
|
case 'dropdown':
|
|
3703
|
-
const dropdownLabels = (
|
|
3708
|
+
const dropdownLabels = (_o = col.dropdownValue) === null || _o === void 0 ? void 0 : _o.split(',').map((label) => label.trim()).filter(Boolean);
|
|
3704
3709
|
if (dropdownLabels === null || dropdownLabels === void 0 ? void 0 : dropdownLabels.length) {
|
|
3705
3710
|
column_values_object[columnId] = { labels: dropdownLabels };
|
|
3706
3711
|
}
|
|
@@ -3733,8 +3738,8 @@ class Worktables {
|
|
|
3733
3738
|
break;
|
|
3734
3739
|
case 'phone':
|
|
3735
3740
|
column_values_object[columnId] = {
|
|
3736
|
-
phone: `${(
|
|
3737
|
-
countryShortName: ((
|
|
3741
|
+
phone: `${(_p = col.countryCode) === null || _p === void 0 ? void 0 : _p.split(' ')[0]}${col.phoneValue || ''}`.replace(/[^\d+]/g, ''),
|
|
3742
|
+
countryShortName: ((_q = col.countryCode) === null || _q === void 0 ? void 0 : _q.split(' ')[1]) || '',
|
|
3738
3743
|
};
|
|
3739
3744
|
break;
|
|
3740
3745
|
case 'fileLink':
|
|
@@ -3767,7 +3772,7 @@ class Worktables {
|
|
|
3767
3772
|
});
|
|
3768
3773
|
try {
|
|
3769
3774
|
const buttonValue = JSON.parse(buttonResponse).data.items[0].column_values[0].value;
|
|
3770
|
-
const clicks = ((
|
|
3775
|
+
const clicks = ((_r = JSON.parse(buttonValue)) === null || _r === void 0 ? void 0 : _r.clicks) || 0;
|
|
3771
3776
|
column_values_object[columnId] = {
|
|
3772
3777
|
clicks: clicks + 1,
|
|
3773
3778
|
changed_at: new Date().toISOString(),
|
|
@@ -3937,8 +3942,8 @@ class Worktables {
|
|
|
3937
3942
|
break;
|
|
3938
3943
|
case 'timeline':
|
|
3939
3944
|
{
|
|
3940
|
-
const from = ((
|
|
3941
|
-
const to = ((
|
|
3945
|
+
const from = ((_s = col.startDate) === null || _s === void 0 ? void 0 : _s.split('T')[0]) || '';
|
|
3946
|
+
const to = ((_t = col.endDate) === null || _t === void 0 ? void 0 : _t.split('T')[0]) || '';
|
|
3942
3947
|
column_values_object[columnId] = { from, to };
|
|
3943
3948
|
}
|
|
3944
3949
|
break;
|
|
@@ -3976,8 +3981,8 @@ class Worktables {
|
|
|
3976
3981
|
break;
|
|
3977
3982
|
case 'phone':
|
|
3978
3983
|
column_values_object[columnId] = {
|
|
3979
|
-
phone: `${(
|
|
3980
|
-
countryShortName: ((
|
|
3984
|
+
phone: `${(_u = col.countryCode) === null || _u === void 0 ? void 0 : _u.split(' ')[0]}${col.phoneValue || ''}`.replace(/[^\d+]/g, ''),
|
|
3985
|
+
countryShortName: ((_v = col.countryCode) === null || _v === void 0 ? void 0 : _v.split(' ')[1]) || '',
|
|
3981
3986
|
};
|
|
3982
3987
|
break;
|
|
3983
3988
|
case 'file':
|
|
@@ -3993,7 +3998,7 @@ class Worktables {
|
|
|
3993
3998
|
break;
|
|
3994
3999
|
case 'dropdown':
|
|
3995
4000
|
{
|
|
3996
|
-
const labels = (
|
|
4001
|
+
const labels = (_w = col.dropdownValue) === null || _w === void 0 ? void 0 : _w.split(',').map((t) => t.trim()).filter((t) => t);
|
|
3997
4002
|
if (labels && labels.length) {
|
|
3998
4003
|
column_values_object[columnId] = { labels };
|
|
3999
4004
|
}
|
|
@@ -4116,7 +4121,7 @@ class Worktables {
|
|
|
4116
4121
|
});
|
|
4117
4122
|
}
|
|
4118
4123
|
const parsedResponse = JSON.parse(responseRaw);
|
|
4119
|
-
const itemData = ((
|
|
4124
|
+
const itemData = ((_x = parsedResponse.data) === null || _x === void 0 ? void 0 : _x.create_item) || ((_y = parsedResponse.data) === null || _y === void 0 ? void 0 : _y.create_subitem);
|
|
4120
4125
|
const formattedResponse = {
|
|
4121
4126
|
id: itemData.id,
|
|
4122
4127
|
name: itemName,
|
|
@@ -4263,7 +4268,7 @@ class Worktables {
|
|
|
4263
4268
|
};
|
|
4264
4269
|
break;
|
|
4265
4270
|
case 'file':
|
|
4266
|
-
if ((
|
|
4271
|
+
if ((_z = col.fileLinks) === null || _z === void 0 ? void 0 : _z.file) {
|
|
4267
4272
|
column_values_object[columnId] = { files: col.fileLinks.file };
|
|
4268
4273
|
}
|
|
4269
4274
|
break;
|
|
@@ -4518,7 +4523,7 @@ class Worktables {
|
|
|
4518
4523
|
body: { query },
|
|
4519
4524
|
});
|
|
4520
4525
|
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
4521
|
-
const itemsPage = (
|
|
4526
|
+
const itemsPage = (_2 = (_1 = (_0 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _0 === void 0 ? void 0 : _0.boards) === null || _1 === void 0 ? void 0 : _1[0]) === null || _2 === void 0 ? void 0 : _2.items_page;
|
|
4522
4527
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4523
4528
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4524
4529
|
allItems = allItems.concat(items);
|
|
@@ -4592,7 +4597,7 @@ class Worktables {
|
|
|
4592
4597
|
const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
|
|
4593
4598
|
const logicalOperator = this.getNodeParameter('logicalOperator', 0);
|
|
4594
4599
|
let rulesArray = [];
|
|
4595
|
-
if (((
|
|
4600
|
+
if (((_3 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _3 === void 0 ? void 0 : _3.length) > 0) {
|
|
4596
4601
|
rulesArray = filterRules.rule.map((rule) => {
|
|
4597
4602
|
let formattedValue;
|
|
4598
4603
|
if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
|
|
@@ -4636,7 +4641,7 @@ class Worktables {
|
|
|
4636
4641
|
});
|
|
4637
4642
|
}
|
|
4638
4643
|
const orderByArray = [];
|
|
4639
|
-
if (((
|
|
4644
|
+
if (((_4 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _4 === void 0 ? void 0 : _4.length) > 0) {
|
|
4640
4645
|
sortOptions.sortBy.forEach((sort) => {
|
|
4641
4646
|
orderByArray.push(`{
|
|
4642
4647
|
column_id: "${sort.columnId}",
|
|
@@ -4682,7 +4687,7 @@ class Worktables {
|
|
|
4682
4687
|
body: { query },
|
|
4683
4688
|
});
|
|
4684
4689
|
const parsed = JSON.parse(rawResponse);
|
|
4685
|
-
const items = ((
|
|
4690
|
+
const items = ((_8 = (_7 = (_6 = (_5 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _5 === void 0 ? void 0 : _5.boards) === null || _6 === void 0 ? void 0 : _6[0]) === null || _7 === void 0 ? void 0 : _7.items_page) === null || _8 === void 0 ? void 0 : _8.items) || [];
|
|
4686
4691
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
4687
4692
|
const formatted = {
|
|
4688
4693
|
id: item.id,
|
|
@@ -4716,7 +4721,7 @@ class Worktables {
|
|
|
4716
4721
|
const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
|
|
4717
4722
|
const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
|
|
4718
4723
|
let rulesArray = [];
|
|
4719
|
-
if (((
|
|
4724
|
+
if (((_9 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _9 === void 0 ? void 0 : _9.length) > 0) {
|
|
4720
4725
|
console.log('Processing filter rules:', advancedFilterRules.rule);
|
|
4721
4726
|
rulesArray = advancedFilterRules.rule.map((rule) => {
|
|
4722
4727
|
let formattedValue;
|
|
@@ -4932,7 +4937,7 @@ class Worktables {
|
|
|
4932
4937
|
});
|
|
4933
4938
|
}
|
|
4934
4939
|
const orderByArray = [];
|
|
4935
|
-
if (((
|
|
4940
|
+
if (((_10 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _10 === void 0 ? void 0 : _10.length) > 0) {
|
|
4936
4941
|
advancedSortOptions.sortBy.forEach((sort) => {
|
|
4937
4942
|
orderByArray.push(`{
|
|
4938
4943
|
column_id: "${sort.columnId}",
|
|
@@ -5004,7 +5009,7 @@ class Worktables {
|
|
|
5004
5009
|
body: { query: testQuery },
|
|
5005
5010
|
});
|
|
5006
5011
|
const testParsed = JSON.parse(testResponse);
|
|
5007
|
-
const testItems = ((
|
|
5012
|
+
const testItems = ((_14 = (_13 = (_12 = (_11 = testParsed === null || testParsed === void 0 ? void 0 : testParsed.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) || [];
|
|
5008
5013
|
console.log('Test - Items in board (no filters):', testItems.length);
|
|
5009
5014
|
if (testItems.length > 0) {
|
|
5010
5015
|
console.log('Sample item column values:', testItems[0].column_values);
|
|
@@ -5016,7 +5021,7 @@ class Worktables {
|
|
|
5016
5021
|
body: { query },
|
|
5017
5022
|
});
|
|
5018
5023
|
const parsed = JSON.parse(rawResponse);
|
|
5019
|
-
const itemsPage = (
|
|
5024
|
+
const itemsPage = (_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.items_page;
|
|
5020
5025
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5021
5026
|
const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
|
|
5022
5027
|
const hasMore = nextCursor ? true : false;
|
|
@@ -5168,7 +5173,7 @@ class Worktables {
|
|
|
5168
5173
|
body: { query },
|
|
5169
5174
|
});
|
|
5170
5175
|
const parsed = JSON.parse(rawResponse);
|
|
5171
|
-
const items = ((
|
|
5176
|
+
const items = ((_23 = (_22 = (_21 = (_20 = (_19 = (_18 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _18 === void 0 ? void 0 : _18.boards) === null || _19 === void 0 ? void 0 : _19[0]) === null || _20 === void 0 ? void 0 : _20.groups) === null || _21 === void 0 ? void 0 : _21[0]) === null || _22 === void 0 ? void 0 : _22.items_page) === null || _23 === void 0 ? void 0 : _23.items) || [];
|
|
5172
5177
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5173
5178
|
const columnValues = item.column_values || [];
|
|
5174
5179
|
const formatted = {
|
|
@@ -5252,7 +5257,7 @@ class Worktables {
|
|
|
5252
5257
|
response = await (0, isErrorResponse_1.parseApiResponse)(response);
|
|
5253
5258
|
if (response.success) {
|
|
5254
5259
|
const parsed = JSON.parse(response.data);
|
|
5255
|
-
const updates = ((
|
|
5260
|
+
const updates = ((_26 = (_25 = (_24 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _24 === void 0 ? void 0 : _24.items) === null || _25 === void 0 ? void 0 : _25[0]) === null || _26 === void 0 ? void 0 : _26.updates) || [];
|
|
5256
5261
|
return [updates.map((update) => ({ json: update }))];
|
|
5257
5262
|
}
|
|
5258
5263
|
else {
|
|
@@ -5309,7 +5314,7 @@ class Worktables {
|
|
|
5309
5314
|
console.log('variables:', variables);
|
|
5310
5315
|
response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
|
|
5311
5316
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
5312
|
-
const updateId = (
|
|
5317
|
+
const updateId = (_28 = (_27 = JSON.parse(response).data) === null || _27 === void 0 ? void 0 : _27.create_update) === null || _28 === void 0 ? void 0 : _28.id;
|
|
5313
5318
|
if (!updateId) {
|
|
5314
5319
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5315
5320
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -5615,7 +5620,7 @@ class Worktables {
|
|
|
5615
5620
|
body: { query },
|
|
5616
5621
|
json: true,
|
|
5617
5622
|
});
|
|
5618
|
-
const asset = (
|
|
5623
|
+
const asset = (_30 = (_29 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _29 === void 0 ? void 0 : _29.assets) === null || _30 === void 0 ? void 0 : _30[0];
|
|
5619
5624
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
5620
5625
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5621
5626
|
message: 'Public URL not found for the given file ID.',
|