@worktables/n8n-nodes-worktables 12.2.9 → 12.2.11
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,53 @@ class Worktables {
|
|
|
1092
1092
|
},
|
|
1093
1093
|
},
|
|
1094
1094
|
{
|
|
1095
|
-
displayName: 'Additional Options',
|
|
1096
|
-
name: '
|
|
1097
|
-
type: '
|
|
1098
|
-
default:
|
|
1095
|
+
displayName: '─ Additional Options ─',
|
|
1096
|
+
name: 'additionalOptionsHeader',
|
|
1097
|
+
type: 'notice',
|
|
1098
|
+
default: '',
|
|
1099
1099
|
displayOptions: {
|
|
1100
1100
|
show: {
|
|
1101
1101
|
operation: ['getItem'],
|
|
1102
1102
|
},
|
|
1103
1103
|
},
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
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
|
-
],
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
displayName: 'Is Subitem',
|
|
1107
|
+
name: 'isSubitem',
|
|
1108
|
+
type: 'boolean',
|
|
1109
|
+
default: false,
|
|
1110
|
+
description: 'Whether a subitem',
|
|
1111
|
+
displayOptions: {
|
|
1112
|
+
show: {
|
|
1113
|
+
operation: ['getItem'],
|
|
1141
1114
|
},
|
|
1142
|
-
|
|
1115
|
+
},
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
displayName: 'Fetch Subitems',
|
|
1119
|
+
name: 'fetchSubitems',
|
|
1120
|
+
type: 'boolean',
|
|
1121
|
+
default: false,
|
|
1122
|
+
description: 'Whether to fetch subitems',
|
|
1123
|
+
displayOptions: {
|
|
1124
|
+
show: {
|
|
1125
|
+
operation: ['getItem'],
|
|
1126
|
+
isSubitem: [false],
|
|
1127
|
+
},
|
|
1128
|
+
},
|
|
1129
|
+
},
|
|
1130
|
+
{
|
|
1131
|
+
displayName: 'Fetch Parent Item',
|
|
1132
|
+
name: 'fetchParentItems',
|
|
1133
|
+
type: 'boolean',
|
|
1134
|
+
default: false,
|
|
1135
|
+
description: 'Whether to fetch parent item',
|
|
1136
|
+
displayOptions: {
|
|
1137
|
+
show: {
|
|
1138
|
+
operation: ['getItem'],
|
|
1139
|
+
isSubitem: [true],
|
|
1140
|
+
},
|
|
1141
|
+
},
|
|
1143
1142
|
},
|
|
1144
1143
|
{
|
|
1145
1144
|
displayName: 'With Updates',
|
|
@@ -2775,7 +2774,7 @@ class Worktables {
|
|
|
2775
2774
|
};
|
|
2776
2775
|
}
|
|
2777
2776
|
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
|
|
2777
|
+
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
2778
|
const resource = this.getNodeParameter('resource', 0);
|
|
2780
2779
|
const operation = this.getNodeParameter('operation', 0);
|
|
2781
2780
|
const credentials = await this.getCredentials('WorktablesApi');
|
|
@@ -3390,10 +3389,9 @@ class Worktables {
|
|
|
3390
3389
|
const columnIds = fetchAllColumns
|
|
3391
3390
|
? ''
|
|
3392
3391
|
: this.getNodeParameter('columnIds', 0, false) || '';
|
|
3393
|
-
const
|
|
3394
|
-
const
|
|
3395
|
-
const
|
|
3396
|
-
const fetchParentItem = isSubitem && (((_c = additionalOptions.options) === null || _c === void 0 ? void 0 : _c.fetchParentItems) || false);
|
|
3392
|
+
const isSubitem = this.getNodeParameter('isSubitem', 0);
|
|
3393
|
+
const fetchSubitems = !isSubitem && this.getNodeParameter('fetchSubitems', 0);
|
|
3394
|
+
const fetchParentItem = isSubitem && this.getNodeParameter('fetchParentItems', 0);
|
|
3397
3395
|
let queryColumnValues = '';
|
|
3398
3396
|
if (fetchAllColumns) {
|
|
3399
3397
|
queryColumnValues = `
|
|
@@ -3496,7 +3494,7 @@ class Worktables {
|
|
|
3496
3494
|
body: { query },
|
|
3497
3495
|
});
|
|
3498
3496
|
const parsed = JSON.parse(rawResponse);
|
|
3499
|
-
const items = (
|
|
3497
|
+
const items = (_a = parsed.data) === null || _a === void 0 ? void 0 : _a.items;
|
|
3500
3498
|
const item = items === null || items === void 0 ? void 0 : items[0];
|
|
3501
3499
|
if (!item || !items || items.length === 0) {
|
|
3502
3500
|
return [[]];
|
|
@@ -3643,7 +3641,7 @@ class Worktables {
|
|
|
3643
3641
|
headers,
|
|
3644
3642
|
body: { query: mutation },
|
|
3645
3643
|
});
|
|
3646
|
-
const existingIds = ((
|
|
3644
|
+
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
3645
|
console.log('Existing IDs:', existingIds);
|
|
3648
3646
|
const newIds = columnValue.split(',').map((id) => id.trim());
|
|
3649
3647
|
const mergedIds = Array.from(new Set([...existingIds, ...newIds]));
|
|
@@ -3683,8 +3681,8 @@ class Worktables {
|
|
|
3683
3681
|
break;
|
|
3684
3682
|
case 'timeline':
|
|
3685
3683
|
column_values_object[columnId] = {
|
|
3686
|
-
from: (
|
|
3687
|
-
to: (
|
|
3684
|
+
from: (_h = col.startDate) === null || _h === void 0 ? void 0 : _h.split('T')[0],
|
|
3685
|
+
to: (_j = col.endDate) === null || _j === void 0 ? void 0 : _j.split('T')[0],
|
|
3688
3686
|
};
|
|
3689
3687
|
break;
|
|
3690
3688
|
case 'checkbox':
|
|
@@ -3705,7 +3703,7 @@ class Worktables {
|
|
|
3705
3703
|
};
|
|
3706
3704
|
break;
|
|
3707
3705
|
case 'dropdown':
|
|
3708
|
-
const dropdownLabels = (
|
|
3706
|
+
const dropdownLabels = (_k = col.dropdownValue) === null || _k === void 0 ? void 0 : _k.split(',').map((label) => label.trim()).filter(Boolean);
|
|
3709
3707
|
if (dropdownLabels === null || dropdownLabels === void 0 ? void 0 : dropdownLabels.length) {
|
|
3710
3708
|
column_values_object[columnId] = { labels: dropdownLabels };
|
|
3711
3709
|
}
|
|
@@ -3738,8 +3736,8 @@ class Worktables {
|
|
|
3738
3736
|
break;
|
|
3739
3737
|
case 'phone':
|
|
3740
3738
|
column_values_object[columnId] = {
|
|
3741
|
-
phone: `${(
|
|
3742
|
-
countryShortName: ((
|
|
3739
|
+
phone: `${(_l = col.countryCode) === null || _l === void 0 ? void 0 : _l.split(' ')[0]}${col.phoneValue || ''}`.replace(/[^\d+]/g, ''),
|
|
3740
|
+
countryShortName: ((_m = col.countryCode) === null || _m === void 0 ? void 0 : _m.split(' ')[1]) || '',
|
|
3743
3741
|
};
|
|
3744
3742
|
break;
|
|
3745
3743
|
case 'fileLink':
|
|
@@ -3772,7 +3770,7 @@ class Worktables {
|
|
|
3772
3770
|
});
|
|
3773
3771
|
try {
|
|
3774
3772
|
const buttonValue = JSON.parse(buttonResponse).data.items[0].column_values[0].value;
|
|
3775
|
-
const clicks = ((
|
|
3773
|
+
const clicks = ((_o = JSON.parse(buttonValue)) === null || _o === void 0 ? void 0 : _o.clicks) || 0;
|
|
3776
3774
|
column_values_object[columnId] = {
|
|
3777
3775
|
clicks: clicks + 1,
|
|
3778
3776
|
changed_at: new Date().toISOString(),
|
|
@@ -3942,8 +3940,8 @@ class Worktables {
|
|
|
3942
3940
|
break;
|
|
3943
3941
|
case 'timeline':
|
|
3944
3942
|
{
|
|
3945
|
-
const from = ((
|
|
3946
|
-
const to = ((
|
|
3943
|
+
const from = ((_p = col.startDate) === null || _p === void 0 ? void 0 : _p.split('T')[0]) || '';
|
|
3944
|
+
const to = ((_q = col.endDate) === null || _q === void 0 ? void 0 : _q.split('T')[0]) || '';
|
|
3947
3945
|
column_values_object[columnId] = { from, to };
|
|
3948
3946
|
}
|
|
3949
3947
|
break;
|
|
@@ -3981,8 +3979,8 @@ class Worktables {
|
|
|
3981
3979
|
break;
|
|
3982
3980
|
case 'phone':
|
|
3983
3981
|
column_values_object[columnId] = {
|
|
3984
|
-
phone: `${(
|
|
3985
|
-
countryShortName: ((
|
|
3982
|
+
phone: `${(_r = col.countryCode) === null || _r === void 0 ? void 0 : _r.split(' ')[0]}${col.phoneValue || ''}`.replace(/[^\d+]/g, ''),
|
|
3983
|
+
countryShortName: ((_s = col.countryCode) === null || _s === void 0 ? void 0 : _s.split(' ')[1]) || '',
|
|
3986
3984
|
};
|
|
3987
3985
|
break;
|
|
3988
3986
|
case 'file':
|
|
@@ -3998,7 +3996,7 @@ class Worktables {
|
|
|
3998
3996
|
break;
|
|
3999
3997
|
case 'dropdown':
|
|
4000
3998
|
{
|
|
4001
|
-
const labels = (
|
|
3999
|
+
const labels = (_t = col.dropdownValue) === null || _t === void 0 ? void 0 : _t.split(',').map((t) => t.trim()).filter((t) => t);
|
|
4002
4000
|
if (labels && labels.length) {
|
|
4003
4001
|
column_values_object[columnId] = { labels };
|
|
4004
4002
|
}
|
|
@@ -4121,7 +4119,7 @@ class Worktables {
|
|
|
4121
4119
|
});
|
|
4122
4120
|
}
|
|
4123
4121
|
const parsedResponse = JSON.parse(responseRaw);
|
|
4124
|
-
const itemData = ((
|
|
4122
|
+
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
4123
|
const formattedResponse = {
|
|
4126
4124
|
id: itemData.id,
|
|
4127
4125
|
name: itemName,
|
|
@@ -4268,7 +4266,7 @@ class Worktables {
|
|
|
4268
4266
|
};
|
|
4269
4267
|
break;
|
|
4270
4268
|
case 'file':
|
|
4271
|
-
if ((
|
|
4269
|
+
if ((_w = col.fileLinks) === null || _w === void 0 ? void 0 : _w.file) {
|
|
4272
4270
|
column_values_object[columnId] = { files: col.fileLinks.file };
|
|
4273
4271
|
}
|
|
4274
4272
|
break;
|
|
@@ -4523,7 +4521,7 @@ class Worktables {
|
|
|
4523
4521
|
body: { query },
|
|
4524
4522
|
});
|
|
4525
4523
|
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
4526
|
-
const itemsPage = (
|
|
4524
|
+
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
4525
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4528
4526
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4529
4527
|
allItems = allItems.concat(items);
|
|
@@ -4597,7 +4595,7 @@ class Worktables {
|
|
|
4597
4595
|
const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
|
|
4598
4596
|
const logicalOperator = this.getNodeParameter('logicalOperator', 0);
|
|
4599
4597
|
let rulesArray = [];
|
|
4600
|
-
if (((
|
|
4598
|
+
if (((_0 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _0 === void 0 ? void 0 : _0.length) > 0) {
|
|
4601
4599
|
rulesArray = filterRules.rule.map((rule) => {
|
|
4602
4600
|
let formattedValue;
|
|
4603
4601
|
if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
|
|
@@ -4641,7 +4639,7 @@ class Worktables {
|
|
|
4641
4639
|
});
|
|
4642
4640
|
}
|
|
4643
4641
|
const orderByArray = [];
|
|
4644
|
-
if (((
|
|
4642
|
+
if (((_1 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _1 === void 0 ? void 0 : _1.length) > 0) {
|
|
4645
4643
|
sortOptions.sortBy.forEach((sort) => {
|
|
4646
4644
|
orderByArray.push(`{
|
|
4647
4645
|
column_id: "${sort.columnId}",
|
|
@@ -4687,7 +4685,7 @@ class Worktables {
|
|
|
4687
4685
|
body: { query },
|
|
4688
4686
|
});
|
|
4689
4687
|
const parsed = JSON.parse(rawResponse);
|
|
4690
|
-
const items = ((
|
|
4688
|
+
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
4689
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
4692
4690
|
const formatted = {
|
|
4693
4691
|
id: item.id,
|
|
@@ -4721,7 +4719,7 @@ class Worktables {
|
|
|
4721
4719
|
const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
|
|
4722
4720
|
const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
|
|
4723
4721
|
let rulesArray = [];
|
|
4724
|
-
if (((
|
|
4722
|
+
if (((_6 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _6 === void 0 ? void 0 : _6.length) > 0) {
|
|
4725
4723
|
console.log('Processing filter rules:', advancedFilterRules.rule);
|
|
4726
4724
|
rulesArray = advancedFilterRules.rule.map((rule) => {
|
|
4727
4725
|
let formattedValue;
|
|
@@ -4937,7 +4935,7 @@ class Worktables {
|
|
|
4937
4935
|
});
|
|
4938
4936
|
}
|
|
4939
4937
|
const orderByArray = [];
|
|
4940
|
-
if (((
|
|
4938
|
+
if (((_7 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _7 === void 0 ? void 0 : _7.length) > 0) {
|
|
4941
4939
|
advancedSortOptions.sortBy.forEach((sort) => {
|
|
4942
4940
|
orderByArray.push(`{
|
|
4943
4941
|
column_id: "${sort.columnId}",
|
|
@@ -5009,7 +5007,7 @@ class Worktables {
|
|
|
5009
5007
|
body: { query: testQuery },
|
|
5010
5008
|
});
|
|
5011
5009
|
const testParsed = JSON.parse(testResponse);
|
|
5012
|
-
const testItems = ((
|
|
5010
|
+
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
5011
|
console.log('Test - Items in board (no filters):', testItems.length);
|
|
5014
5012
|
if (testItems.length > 0) {
|
|
5015
5013
|
console.log('Sample item column values:', testItems[0].column_values);
|
|
@@ -5021,7 +5019,7 @@ class Worktables {
|
|
|
5021
5019
|
body: { query },
|
|
5022
5020
|
});
|
|
5023
5021
|
const parsed = JSON.parse(rawResponse);
|
|
5024
|
-
const itemsPage = (
|
|
5022
|
+
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
5023
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5026
5024
|
const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
|
|
5027
5025
|
const hasMore = nextCursor ? true : false;
|
|
@@ -5173,7 +5171,7 @@ class Worktables {
|
|
|
5173
5171
|
body: { query },
|
|
5174
5172
|
});
|
|
5175
5173
|
const parsed = JSON.parse(rawResponse);
|
|
5176
|
-
const items = ((
|
|
5174
|
+
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
5175
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5178
5176
|
const columnValues = item.column_values || [];
|
|
5179
5177
|
const formatted = {
|
|
@@ -5257,7 +5255,7 @@ class Worktables {
|
|
|
5257
5255
|
response = await (0, isErrorResponse_1.parseApiResponse)(response);
|
|
5258
5256
|
if (response.success) {
|
|
5259
5257
|
const parsed = JSON.parse(response.data);
|
|
5260
|
-
const updates = ((
|
|
5258
|
+
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
5259
|
return [updates.map((update) => ({ json: update }))];
|
|
5262
5260
|
}
|
|
5263
5261
|
else {
|
|
@@ -5314,7 +5312,7 @@ class Worktables {
|
|
|
5314
5312
|
console.log('variables:', variables);
|
|
5315
5313
|
response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
|
|
5316
5314
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
5317
|
-
const updateId = (
|
|
5315
|
+
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
5316
|
if (!updateId) {
|
|
5319
5317
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5320
5318
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -5620,7 +5618,7 @@ class Worktables {
|
|
|
5620
5618
|
body: { query },
|
|
5621
5619
|
json: true,
|
|
5622
5620
|
});
|
|
5623
|
-
const asset = (
|
|
5621
|
+
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
5622
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
5625
5623
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5626
5624
|
message: 'Public URL not found for the given file ID.',
|