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