@worktables/n8n-nodes-worktables 12.2.10 → 12.2.12
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.
|
@@ -1092,42 +1092,54 @@ class Worktables {
|
|
|
1092
1092
|
},
|
|
1093
1093
|
},
|
|
1094
1094
|
{
|
|
1095
|
-
displayName: '
|
|
1096
|
-
name: '
|
|
1097
|
-
type: '
|
|
1098
|
-
default:
|
|
1099
|
-
description: 'Whether a subitem',
|
|
1100
|
-
displayOptions: {
|
|
1101
|
-
show: {
|
|
1102
|
-
operation: ['getItem'],
|
|
1103
|
-
},
|
|
1104
|
-
},
|
|
1105
|
-
},
|
|
1106
|
-
{
|
|
1107
|
-
displayName: 'Fetch Subitems',
|
|
1108
|
-
name: 'fetchSubitems',
|
|
1109
|
-
type: 'boolean',
|
|
1110
|
-
default: false,
|
|
1111
|
-
description: 'Whether to fetch subitems',
|
|
1095
|
+
displayName: 'Additional Options',
|
|
1096
|
+
name: 'additionalOptions',
|
|
1097
|
+
type: 'fixedCollection',
|
|
1098
|
+
default: {},
|
|
1112
1099
|
displayOptions: {
|
|
1113
1100
|
show: {
|
|
1114
1101
|
operation: ['getItem'],
|
|
1115
|
-
isSubitem: [false],
|
|
1116
1102
|
},
|
|
1117
1103
|
},
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1104
|
+
options: [
|
|
1105
|
+
{
|
|
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',
|
|
1115
|
+
},
|
|
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
|
+
},
|
|
1127
|
+
},
|
|
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
|
+
],
|
|
1129
1141
|
},
|
|
1130
|
-
|
|
1142
|
+
],
|
|
1131
1143
|
},
|
|
1132
1144
|
{
|
|
1133
1145
|
displayName: 'With Updates',
|
|
@@ -2763,7 +2775,7 @@ class Worktables {
|
|
|
2763
2775
|
};
|
|
2764
2776
|
}
|
|
2765
2777
|
async execute() {
|
|
2766
|
-
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;
|
|
2767
2779
|
const resource = this.getNodeParameter('resource', 0);
|
|
2768
2780
|
const operation = this.getNodeParameter('operation', 0);
|
|
2769
2781
|
const credentials = await this.getCredentials('WorktablesApi');
|
|
@@ -3378,9 +3390,10 @@ class Worktables {
|
|
|
3378
3390
|
const columnIds = fetchAllColumns
|
|
3379
3391
|
? ''
|
|
3380
3392
|
: this.getNodeParameter('columnIds', 0, false) || '';
|
|
3381
|
-
const
|
|
3382
|
-
const
|
|
3383
|
-
const
|
|
3393
|
+
const additionalOptions = this.getNodeParameter('additionalOptions', 0, {});
|
|
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);
|
|
3384
3397
|
let queryColumnValues = '';
|
|
3385
3398
|
if (fetchAllColumns) {
|
|
3386
3399
|
queryColumnValues = `
|
|
@@ -3483,7 +3496,7 @@ class Worktables {
|
|
|
3483
3496
|
body: { query },
|
|
3484
3497
|
});
|
|
3485
3498
|
const parsed = JSON.parse(rawResponse);
|
|
3486
|
-
const items = (
|
|
3499
|
+
const items = (_d = parsed.data) === null || _d === void 0 ? void 0 : _d.items;
|
|
3487
3500
|
const item = items === null || items === void 0 ? void 0 : items[0];
|
|
3488
3501
|
if (!item || !items || items.length === 0) {
|
|
3489
3502
|
return [[]];
|
|
@@ -3630,7 +3643,7 @@ class Worktables {
|
|
|
3630
3643
|
headers,
|
|
3631
3644
|
body: { query: mutation },
|
|
3632
3645
|
});
|
|
3633
|
-
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) || [];
|
|
3634
3647
|
console.log('Existing IDs:', existingIds);
|
|
3635
3648
|
const newIds = columnValue.split(',').map((id) => id.trim());
|
|
3636
3649
|
const mergedIds = Array.from(new Set([...existingIds, ...newIds]));
|
|
@@ -3670,8 +3683,8 @@ class Worktables {
|
|
|
3670
3683
|
break;
|
|
3671
3684
|
case 'timeline':
|
|
3672
3685
|
column_values_object[columnId] = {
|
|
3673
|
-
from: (
|
|
3674
|
-
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],
|
|
3675
3688
|
};
|
|
3676
3689
|
break;
|
|
3677
3690
|
case 'checkbox':
|
|
@@ -3692,7 +3705,7 @@ class Worktables {
|
|
|
3692
3705
|
};
|
|
3693
3706
|
break;
|
|
3694
3707
|
case 'dropdown':
|
|
3695
|
-
const dropdownLabels = (
|
|
3708
|
+
const dropdownLabels = (_o = col.dropdownValue) === null || _o === void 0 ? void 0 : _o.split(',').map((label) => label.trim()).filter(Boolean);
|
|
3696
3709
|
if (dropdownLabels === null || dropdownLabels === void 0 ? void 0 : dropdownLabels.length) {
|
|
3697
3710
|
column_values_object[columnId] = { labels: dropdownLabels };
|
|
3698
3711
|
}
|
|
@@ -3725,8 +3738,8 @@ class Worktables {
|
|
|
3725
3738
|
break;
|
|
3726
3739
|
case 'phone':
|
|
3727
3740
|
column_values_object[columnId] = {
|
|
3728
|
-
phone: `${(
|
|
3729
|
-
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]) || '',
|
|
3730
3743
|
};
|
|
3731
3744
|
break;
|
|
3732
3745
|
case 'fileLink':
|
|
@@ -3759,7 +3772,7 @@ class Worktables {
|
|
|
3759
3772
|
});
|
|
3760
3773
|
try {
|
|
3761
3774
|
const buttonValue = JSON.parse(buttonResponse).data.items[0].column_values[0].value;
|
|
3762
|
-
const clicks = ((
|
|
3775
|
+
const clicks = ((_r = JSON.parse(buttonValue)) === null || _r === void 0 ? void 0 : _r.clicks) || 0;
|
|
3763
3776
|
column_values_object[columnId] = {
|
|
3764
3777
|
clicks: clicks + 1,
|
|
3765
3778
|
changed_at: new Date().toISOString(),
|
|
@@ -3929,8 +3942,8 @@ class Worktables {
|
|
|
3929
3942
|
break;
|
|
3930
3943
|
case 'timeline':
|
|
3931
3944
|
{
|
|
3932
|
-
const from = ((
|
|
3933
|
-
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]) || '';
|
|
3934
3947
|
column_values_object[columnId] = { from, to };
|
|
3935
3948
|
}
|
|
3936
3949
|
break;
|
|
@@ -3968,8 +3981,8 @@ class Worktables {
|
|
|
3968
3981
|
break;
|
|
3969
3982
|
case 'phone':
|
|
3970
3983
|
column_values_object[columnId] = {
|
|
3971
|
-
phone: `${(
|
|
3972
|
-
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]) || '',
|
|
3973
3986
|
};
|
|
3974
3987
|
break;
|
|
3975
3988
|
case 'file':
|
|
@@ -3985,7 +3998,7 @@ class Worktables {
|
|
|
3985
3998
|
break;
|
|
3986
3999
|
case 'dropdown':
|
|
3987
4000
|
{
|
|
3988
|
-
const labels = (
|
|
4001
|
+
const labels = (_w = col.dropdownValue) === null || _w === void 0 ? void 0 : _w.split(',').map((t) => t.trim()).filter((t) => t);
|
|
3989
4002
|
if (labels && labels.length) {
|
|
3990
4003
|
column_values_object[columnId] = { labels };
|
|
3991
4004
|
}
|
|
@@ -4108,7 +4121,7 @@ class Worktables {
|
|
|
4108
4121
|
});
|
|
4109
4122
|
}
|
|
4110
4123
|
const parsedResponse = JSON.parse(responseRaw);
|
|
4111
|
-
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);
|
|
4112
4125
|
const formattedResponse = {
|
|
4113
4126
|
id: itemData.id,
|
|
4114
4127
|
name: itemName,
|
|
@@ -4255,7 +4268,7 @@ class Worktables {
|
|
|
4255
4268
|
};
|
|
4256
4269
|
break;
|
|
4257
4270
|
case 'file':
|
|
4258
|
-
if ((
|
|
4271
|
+
if ((_z = col.fileLinks) === null || _z === void 0 ? void 0 : _z.file) {
|
|
4259
4272
|
column_values_object[columnId] = { files: col.fileLinks.file };
|
|
4260
4273
|
}
|
|
4261
4274
|
break;
|
|
@@ -4510,7 +4523,7 @@ class Worktables {
|
|
|
4510
4523
|
body: { query },
|
|
4511
4524
|
});
|
|
4512
4525
|
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
4513
|
-
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;
|
|
4514
4527
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4515
4528
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4516
4529
|
allItems = allItems.concat(items);
|
|
@@ -4584,7 +4597,7 @@ class Worktables {
|
|
|
4584
4597
|
const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
|
|
4585
4598
|
const logicalOperator = this.getNodeParameter('logicalOperator', 0);
|
|
4586
4599
|
let rulesArray = [];
|
|
4587
|
-
if (((
|
|
4600
|
+
if (((_3 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _3 === void 0 ? void 0 : _3.length) > 0) {
|
|
4588
4601
|
rulesArray = filterRules.rule.map((rule) => {
|
|
4589
4602
|
let formattedValue;
|
|
4590
4603
|
if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
|
|
@@ -4628,7 +4641,7 @@ class Worktables {
|
|
|
4628
4641
|
});
|
|
4629
4642
|
}
|
|
4630
4643
|
const orderByArray = [];
|
|
4631
|
-
if (((
|
|
4644
|
+
if (((_4 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _4 === void 0 ? void 0 : _4.length) > 0) {
|
|
4632
4645
|
sortOptions.sortBy.forEach((sort) => {
|
|
4633
4646
|
orderByArray.push(`{
|
|
4634
4647
|
column_id: "${sort.columnId}",
|
|
@@ -4674,7 +4687,7 @@ class Worktables {
|
|
|
4674
4687
|
body: { query },
|
|
4675
4688
|
});
|
|
4676
4689
|
const parsed = JSON.parse(rawResponse);
|
|
4677
|
-
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) || [];
|
|
4678
4691
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
4679
4692
|
const formatted = {
|
|
4680
4693
|
id: item.id,
|
|
@@ -4708,7 +4721,7 @@ class Worktables {
|
|
|
4708
4721
|
const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
|
|
4709
4722
|
const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
|
|
4710
4723
|
let rulesArray = [];
|
|
4711
|
-
if (((
|
|
4724
|
+
if (((_9 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _9 === void 0 ? void 0 : _9.length) > 0) {
|
|
4712
4725
|
console.log('Processing filter rules:', advancedFilterRules.rule);
|
|
4713
4726
|
rulesArray = advancedFilterRules.rule.map((rule) => {
|
|
4714
4727
|
let formattedValue;
|
|
@@ -4924,7 +4937,7 @@ class Worktables {
|
|
|
4924
4937
|
});
|
|
4925
4938
|
}
|
|
4926
4939
|
const orderByArray = [];
|
|
4927
|
-
if (((
|
|
4940
|
+
if (((_10 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _10 === void 0 ? void 0 : _10.length) > 0) {
|
|
4928
4941
|
advancedSortOptions.sortBy.forEach((sort) => {
|
|
4929
4942
|
orderByArray.push(`{
|
|
4930
4943
|
column_id: "${sort.columnId}",
|
|
@@ -4996,7 +5009,7 @@ class Worktables {
|
|
|
4996
5009
|
body: { query: testQuery },
|
|
4997
5010
|
});
|
|
4998
5011
|
const testParsed = JSON.parse(testResponse);
|
|
4999
|
-
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) || [];
|
|
5000
5013
|
console.log('Test - Items in board (no filters):', testItems.length);
|
|
5001
5014
|
if (testItems.length > 0) {
|
|
5002
5015
|
console.log('Sample item column values:', testItems[0].column_values);
|
|
@@ -5008,7 +5021,7 @@ class Worktables {
|
|
|
5008
5021
|
body: { query },
|
|
5009
5022
|
});
|
|
5010
5023
|
const parsed = JSON.parse(rawResponse);
|
|
5011
|
-
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;
|
|
5012
5025
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5013
5026
|
const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
|
|
5014
5027
|
const hasMore = nextCursor ? true : false;
|
|
@@ -5160,7 +5173,7 @@ class Worktables {
|
|
|
5160
5173
|
body: { query },
|
|
5161
5174
|
});
|
|
5162
5175
|
const parsed = JSON.parse(rawResponse);
|
|
5163
|
-
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) || [];
|
|
5164
5177
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5165
5178
|
const columnValues = item.column_values || [];
|
|
5166
5179
|
const formatted = {
|
|
@@ -5244,7 +5257,7 @@ class Worktables {
|
|
|
5244
5257
|
response = await (0, isErrorResponse_1.parseApiResponse)(response);
|
|
5245
5258
|
if (response.success) {
|
|
5246
5259
|
const parsed = JSON.parse(response.data);
|
|
5247
|
-
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) || [];
|
|
5248
5261
|
return [updates.map((update) => ({ json: update }))];
|
|
5249
5262
|
}
|
|
5250
5263
|
else {
|
|
@@ -5301,7 +5314,7 @@ class Worktables {
|
|
|
5301
5314
|
console.log('variables:', variables);
|
|
5302
5315
|
response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
|
|
5303
5316
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
5304
|
-
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;
|
|
5305
5318
|
if (!updateId) {
|
|
5306
5319
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5307
5320
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -5607,7 +5620,7 @@ class Worktables {
|
|
|
5607
5620
|
body: { query },
|
|
5608
5621
|
json: true,
|
|
5609
5622
|
});
|
|
5610
|
-
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];
|
|
5611
5624
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
5612
5625
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5613
5626
|
message: 'Public URL not found for the given file ID.',
|