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