@worktables/n8n-nodes-worktables 11.34.0 → 11.35.0
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.
|
@@ -9,6 +9,7 @@ const isErrorResponse_1 = require("../../utils/isErrorResponse");
|
|
|
9
9
|
const form_data_1 = __importDefault(require("form-data"));
|
|
10
10
|
const axios_1 = __importDefault(require("axios"));
|
|
11
11
|
const parseValue_1 = require("../../utils/parseValue");
|
|
12
|
+
const country_codes_json_1 = __importDefault(require("../../utils/country_codes.json"));
|
|
12
13
|
class Worktables {
|
|
13
14
|
constructor() {
|
|
14
15
|
this.description = {
|
|
@@ -1158,6 +1159,7 @@ class Worktables {
|
|
|
1158
1159
|
{ name: 'Location', value: 'location' },
|
|
1159
1160
|
{ name: 'Link', value: 'link' },
|
|
1160
1161
|
{ name: 'Email', value: 'email' },
|
|
1162
|
+
{ name: 'Phone', value: 'phone' },
|
|
1161
1163
|
{ name: 'Timeline', value: 'timeline' },
|
|
1162
1164
|
],
|
|
1163
1165
|
default: 'simple',
|
|
@@ -1285,6 +1287,19 @@ class Worktables {
|
|
|
1285
1287
|
},
|
|
1286
1288
|
},
|
|
1287
1289
|
},
|
|
1290
|
+
{
|
|
1291
|
+
displayName: 'Country Code',
|
|
1292
|
+
name: 'countryCode',
|
|
1293
|
+
type: 'options',
|
|
1294
|
+
options: country_codes_json_1.default,
|
|
1295
|
+
default: '1',
|
|
1296
|
+
description: 'Select the country code for the phone number',
|
|
1297
|
+
displayOptions: {
|
|
1298
|
+
show: {
|
|
1299
|
+
columnType: ['phone'],
|
|
1300
|
+
},
|
|
1301
|
+
},
|
|
1302
|
+
},
|
|
1288
1303
|
{
|
|
1289
1304
|
displayName: 'Phone',
|
|
1290
1305
|
name: 'phoneValue',
|
|
@@ -2452,7 +2467,7 @@ class Worktables {
|
|
|
2452
2467
|
};
|
|
2453
2468
|
}
|
|
2454
2469
|
async execute() {
|
|
2455
|
-
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;
|
|
2470
|
+
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;
|
|
2456
2471
|
const resource = this.getNodeParameter('resource', 0);
|
|
2457
2472
|
const operation = this.getNodeParameter('operation', 0);
|
|
2458
2473
|
const credentials = await this.getCredentials('WorktablesApi');
|
|
@@ -3370,6 +3385,12 @@ class Worktables {
|
|
|
3370
3385
|
url: col.url || '',
|
|
3371
3386
|
};
|
|
3372
3387
|
break;
|
|
3388
|
+
case 'phone':
|
|
3389
|
+
column_values_object[columnId] = {
|
|
3390
|
+
phone: `${(_k = col.countryCode) === null || _k === void 0 ? void 0 : _k.split(' ')[0]}${col.phoneValue || ''}`,
|
|
3391
|
+
countryShortName: ((_l = col.countryCode) === null || _l === void 0 ? void 0 : _l.split(' ')[1]) || '',
|
|
3392
|
+
};
|
|
3393
|
+
break;
|
|
3373
3394
|
case 'objectValue':
|
|
3374
3395
|
if (col.columnValue) {
|
|
3375
3396
|
try {
|
|
@@ -3536,8 +3557,8 @@ class Worktables {
|
|
|
3536
3557
|
break;
|
|
3537
3558
|
case 'timeline':
|
|
3538
3559
|
{
|
|
3539
|
-
const from = ((
|
|
3540
|
-
const to = ((
|
|
3560
|
+
const from = ((_m = col.startDate) === null || _m === void 0 ? void 0 : _m.split('T')[0]) || '';
|
|
3561
|
+
const to = ((_o = col.endDate) === null || _o === void 0 ? void 0 : _o.split('T')[0]) || '';
|
|
3541
3562
|
column_values_object[columnId] = { from, to };
|
|
3542
3563
|
}
|
|
3543
3564
|
break;
|
|
@@ -3573,9 +3594,15 @@ class Worktables {
|
|
|
3573
3594
|
};
|
|
3574
3595
|
}
|
|
3575
3596
|
break;
|
|
3597
|
+
case 'phone':
|
|
3598
|
+
column_values_object[columnId] = {
|
|
3599
|
+
phone: `${(_p = col.countryCode) === null || _p === void 0 ? void 0 : _p.split(' ')[0]}${col.phoneValue || ''}`,
|
|
3600
|
+
countryShortName: ((_q = col.countryCode) === null || _q === void 0 ? void 0 : _q.split(' ')[1]) || '',
|
|
3601
|
+
};
|
|
3602
|
+
break;
|
|
3576
3603
|
case 'dropdown':
|
|
3577
3604
|
{
|
|
3578
|
-
const labels = (
|
|
3605
|
+
const labels = (_r = col.dropdownValue) === null || _r === void 0 ? void 0 : _r.split(',').map((t) => t.trim()).filter((t) => t);
|
|
3579
3606
|
if (labels && labels.length) {
|
|
3580
3607
|
column_values_object[columnId] = { labels };
|
|
3581
3608
|
}
|
|
@@ -3701,7 +3728,7 @@ class Worktables {
|
|
|
3701
3728
|
}
|
|
3702
3729
|
const parsedResponse = JSON.parse(responseRaw);
|
|
3703
3730
|
console.log('Parsed Response:', parsedResponse);
|
|
3704
|
-
const itemData = ((
|
|
3731
|
+
const itemData = ((_s = parsedResponse.data) === null || _s === void 0 ? void 0 : _s.create_item) || ((_t = parsedResponse.data) === null || _t === void 0 ? void 0 : _t.create_subitem);
|
|
3705
3732
|
const formattedResponse = {
|
|
3706
3733
|
id: itemData.id,
|
|
3707
3734
|
name: itemName,
|
|
@@ -3847,7 +3874,7 @@ class Worktables {
|
|
|
3847
3874
|
const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
|
|
3848
3875
|
const logicalOperator = this.getNodeParameter('logicalOperator', 0);
|
|
3849
3876
|
let rulesArray = [];
|
|
3850
|
-
if (((
|
|
3877
|
+
if (((_u = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _u === void 0 ? void 0 : _u.length) > 0) {
|
|
3851
3878
|
rulesArray = filterRules.rule.map((rule) => {
|
|
3852
3879
|
let formattedValue;
|
|
3853
3880
|
if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
|
|
@@ -3891,7 +3918,7 @@ class Worktables {
|
|
|
3891
3918
|
});
|
|
3892
3919
|
}
|
|
3893
3920
|
const orderByArray = [];
|
|
3894
|
-
if (((
|
|
3921
|
+
if (((_v = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _v === void 0 ? void 0 : _v.length) > 0) {
|
|
3895
3922
|
sortOptions.sortBy.forEach((sort) => {
|
|
3896
3923
|
orderByArray.push(`{
|
|
3897
3924
|
column_id: "${sort.columnId}",
|
|
@@ -3935,7 +3962,7 @@ class Worktables {
|
|
|
3935
3962
|
body: { query },
|
|
3936
3963
|
});
|
|
3937
3964
|
const parsed = JSON.parse(rawResponse);
|
|
3938
|
-
const items = ((
|
|
3965
|
+
const items = ((_z = (_y = (_x = (_w = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _w === void 0 ? void 0 : _w.boards) === null || _x === void 0 ? void 0 : _x[0]) === null || _y === void 0 ? void 0 : _y.items_page) === null || _z === void 0 ? void 0 : _z.items) || [];
|
|
3939
3966
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
3940
3967
|
const formatted = {
|
|
3941
3968
|
id: item.id,
|
|
@@ -4073,7 +4100,7 @@ class Worktables {
|
|
|
4073
4100
|
body: { query },
|
|
4074
4101
|
});
|
|
4075
4102
|
const parsed = JSON.parse(rawResponse);
|
|
4076
|
-
const items = ((
|
|
4103
|
+
const items = ((_5 = (_4 = (_3 = (_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.groups) === 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) || [];
|
|
4077
4104
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
4078
4105
|
const formatted = {
|
|
4079
4106
|
id: item.id,
|
|
@@ -4197,7 +4224,7 @@ class Worktables {
|
|
|
4197
4224
|
body: { query: mutation },
|
|
4198
4225
|
});
|
|
4199
4226
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
4200
|
-
const updateId = (
|
|
4227
|
+
const updateId = (_7 = (_6 = JSON.parse(response).data) === null || _6 === void 0 ? void 0 : _6.create_update) === null || _7 === void 0 ? void 0 : _7.id;
|
|
4201
4228
|
if (!updateId) {
|
|
4202
4229
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
4203
4230
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -4517,7 +4544,7 @@ class Worktables {
|
|
|
4517
4544
|
body: { query },
|
|
4518
4545
|
json: true,
|
|
4519
4546
|
});
|
|
4520
|
-
const asset = (
|
|
4547
|
+
const asset = (_9 = (_8 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _8 === void 0 ? void 0 : _8.assets) === null || _9 === void 0 ? void 0 : _9[0];
|
|
4521
4548
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
4522
4549
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
4523
4550
|
message: 'Public URL not found for the given file ID.',
|