@worktables/n8n-nodes-worktables 12.2.16 → 12.2.18
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.
- package/dist/nodes/Worktables/Worktables.node.js +199 -73
- package/dist/nodes/Worktables/Worktables.node.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/worktablesHelpers.js +6 -1
- package/dist/utils/worktablesHelpers.js.map +1 -1
- package/package.json +1 -1
|
@@ -627,6 +627,19 @@ class Worktables {
|
|
|
627
627
|
},
|
|
628
628
|
},
|
|
629
629
|
},
|
|
630
|
+
{
|
|
631
|
+
displayName: 'Is Subitem?',
|
|
632
|
+
name: 'isSubitem',
|
|
633
|
+
type: 'boolean',
|
|
634
|
+
default: false,
|
|
635
|
+
description: 'Whether the item is a subitem',
|
|
636
|
+
displayOptions: {
|
|
637
|
+
show: {
|
|
638
|
+
resource: ['item'],
|
|
639
|
+
operation: ['createItem', 'createOrUpdateItem'],
|
|
640
|
+
},
|
|
641
|
+
},
|
|
642
|
+
},
|
|
630
643
|
{
|
|
631
644
|
displayName: 'Board to Duplicate',
|
|
632
645
|
name: 'boardId',
|
|
@@ -995,11 +1008,27 @@ class Worktables {
|
|
|
995
1008
|
},
|
|
996
1009
|
},
|
|
997
1010
|
{
|
|
998
|
-
displayName: '
|
|
1011
|
+
displayName: 'Identifier Column',
|
|
1012
|
+
name: 'identifierColumn',
|
|
1013
|
+
type: 'options',
|
|
1014
|
+
typeOptions: {
|
|
1015
|
+
loadOptionsDependsOn: ['boardId'],
|
|
1016
|
+
loadOptionsMethod: 'getColumnsItems',
|
|
1017
|
+
},
|
|
1018
|
+
default: '',
|
|
1019
|
+
description: 'Select the column to use as identifier for finding/updating items. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
|
1020
|
+
displayOptions: {
|
|
1021
|
+
show: {
|
|
1022
|
+
operation: ['createOrUpdateItem'],
|
|
1023
|
+
},
|
|
1024
|
+
},
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
displayName: 'Identifier Value',
|
|
999
1028
|
name: 'itemIdOptional',
|
|
1000
1029
|
type: 'string',
|
|
1001
1030
|
default: '',
|
|
1002
|
-
description: '
|
|
1031
|
+
description: 'Value in the identifier column to find the item. If left empty, a new item will be created. If provided, the existing item with matching identifier value will be updated.',
|
|
1003
1032
|
displayOptions: {
|
|
1004
1033
|
show: {
|
|
1005
1034
|
operation: ['createOrUpdateItem'],
|
|
@@ -1041,7 +1070,7 @@ class Worktables {
|
|
|
1041
1070
|
type: 'options',
|
|
1042
1071
|
typeOptions: {
|
|
1043
1072
|
loadOptionsDependsOn: ['boardId'],
|
|
1044
|
-
loadOptionsMethod: '
|
|
1073
|
+
loadOptionsMethod: 'getItemsOrSubitemsFromBoard',
|
|
1045
1074
|
},
|
|
1046
1075
|
default: '',
|
|
1047
1076
|
required: true,
|
|
@@ -1141,6 +1170,18 @@ class Worktables {
|
|
|
1141
1170
|
},
|
|
1142
1171
|
},
|
|
1143
1172
|
},
|
|
1173
|
+
{
|
|
1174
|
+
displayName: 'For item creation',
|
|
1175
|
+
name: 'forItemCreation',
|
|
1176
|
+
type: 'notice',
|
|
1177
|
+
default: '',
|
|
1178
|
+
displayOptions: {
|
|
1179
|
+
show: {
|
|
1180
|
+
resource: ['item'],
|
|
1181
|
+
operation: ['createOrUpdateItem'],
|
|
1182
|
+
},
|
|
1183
|
+
},
|
|
1184
|
+
},
|
|
1144
1185
|
{
|
|
1145
1186
|
displayName: 'Item Name',
|
|
1146
1187
|
name: 'itemName',
|
|
@@ -1155,15 +1196,20 @@ class Worktables {
|
|
|
1155
1196
|
},
|
|
1156
1197
|
},
|
|
1157
1198
|
{
|
|
1158
|
-
displayName: '
|
|
1159
|
-
name: '
|
|
1160
|
-
type: '
|
|
1161
|
-
|
|
1162
|
-
|
|
1199
|
+
displayName: 'Group Name',
|
|
1200
|
+
name: 'groupName',
|
|
1201
|
+
type: 'options',
|
|
1202
|
+
typeOptions: {
|
|
1203
|
+
loadOptionsDependsOn: ['boardId'],
|
|
1204
|
+
loadOptionsMethod: 'getGroupsFromBoard',
|
|
1205
|
+
},
|
|
1206
|
+
default: '',
|
|
1207
|
+
description: 'Select the group where the item will be created. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
|
1163
1208
|
displayOptions: {
|
|
1164
1209
|
show: {
|
|
1165
1210
|
resource: ['item'],
|
|
1166
|
-
operation: ['
|
|
1211
|
+
operation: ['createOrUpdateItem'],
|
|
1212
|
+
isSubitem: [false],
|
|
1167
1213
|
},
|
|
1168
1214
|
},
|
|
1169
1215
|
},
|
|
@@ -2763,7 +2809,7 @@ class Worktables {
|
|
|
2763
2809
|
};
|
|
2764
2810
|
}
|
|
2765
2811
|
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;
|
|
2812
|
+
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, _31;
|
|
2767
2813
|
const resource = this.getNodeParameter('resource', 0);
|
|
2768
2814
|
const operation = this.getNodeParameter('operation', 0);
|
|
2769
2815
|
const credentials = await this.getCredentials('WorktablesApi');
|
|
@@ -3503,8 +3549,14 @@ class Worktables {
|
|
|
3503
3549
|
column_values: {},
|
|
3504
3550
|
};
|
|
3505
3551
|
for (const col of columnValues) {
|
|
3506
|
-
if (col.type === 'subtasks'
|
|
3552
|
+
if (col.type === 'subtasks' ||
|
|
3553
|
+
col.type === 'formula' ||
|
|
3554
|
+
col.type === 'mirror' ||
|
|
3555
|
+
col.type === 'auto_number' ||
|
|
3556
|
+
col.type === 'creation_log' ||
|
|
3557
|
+
col.type === 'last_updated') {
|
|
3507
3558
|
continue;
|
|
3559
|
+
}
|
|
3508
3560
|
const formattedCol = {
|
|
3509
3561
|
type: col.type,
|
|
3510
3562
|
value: await (0, parseValue_1.parseValue)(col.value),
|
|
@@ -4132,7 +4184,9 @@ class Worktables {
|
|
|
4132
4184
|
const itemName = this.getNodeParameter('itemName', 0);
|
|
4133
4185
|
const boardId = this.getNodeParameter('boardId', 0);
|
|
4134
4186
|
const isSubitem = this.getNodeParameter('isSubitem', 0);
|
|
4135
|
-
const
|
|
4187
|
+
const identifierColumn = this.getNodeParameter('identifierColumn', 0, '');
|
|
4188
|
+
const identifierValue = this.getNodeParameter('itemIdOptional', 0, false);
|
|
4189
|
+
const groupName = this.getNodeParameter('groupName', 0, '');
|
|
4136
4190
|
const raw = this.getNodeParameter('columnValues', 0);
|
|
4137
4191
|
const columnValues = raw.column;
|
|
4138
4192
|
let column_values_object = {};
|
|
@@ -4269,46 +4323,105 @@ class Worktables {
|
|
|
4269
4323
|
let mutation;
|
|
4270
4324
|
let formatted;
|
|
4271
4325
|
let itemUpdated = false;
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4326
|
+
let foundItemId = null;
|
|
4327
|
+
if (identifierValue && identifierValue.trim() !== '' && identifierColumn && identifierColumn.trim() !== '') {
|
|
4328
|
+
console.log('Searching for item with identifier column:', identifierColumn, 'value:', identifierValue);
|
|
4329
|
+
let cursor = null;
|
|
4330
|
+
let hasMore = true;
|
|
4331
|
+
while (hasMore && !foundItemId) {
|
|
4332
|
+
const cursorParam = cursor ? `, cursor: "${cursor}"` : '';
|
|
4333
|
+
const searchQuery = `query {
|
|
4334
|
+
boards(ids: [${boardId}]) {
|
|
4335
|
+
items_page(limit: 100${cursorParam}) {
|
|
4336
|
+
items {
|
|
4337
|
+
id
|
|
4338
|
+
column_values(ids: ["${identifierColumn}"]) {
|
|
4339
|
+
id
|
|
4340
|
+
text
|
|
4341
|
+
value
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
cursor
|
|
4345
|
+
}
|
|
4346
|
+
}
|
|
4347
|
+
}`;
|
|
4348
|
+
const searchResponse = await this.helpers.request({
|
|
4349
|
+
method: 'POST',
|
|
4350
|
+
url: 'https://api.monday.com/v2',
|
|
4351
|
+
headers,
|
|
4352
|
+
body: { query: searchQuery },
|
|
4353
|
+
});
|
|
4354
|
+
const searchData = JSON.parse(searchResponse);
|
|
4355
|
+
const itemsPage = (_z = (_y = (_x = searchData === null || searchData === void 0 ? void 0 : searchData.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;
|
|
4356
|
+
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4357
|
+
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4358
|
+
for (const item of items) {
|
|
4359
|
+
const colValue = (_0 = item.column_values) === null || _0 === void 0 ? void 0 : _0.find((cv) => cv.id === identifierColumn);
|
|
4360
|
+
if (colValue) {
|
|
4361
|
+
let colText = colValue.text || '';
|
|
4362
|
+
let colValueStr = '';
|
|
4363
|
+
try {
|
|
4364
|
+
if (colValue.value) {
|
|
4365
|
+
const parsedValue = JSON.parse(colValue.value);
|
|
4366
|
+
colValueStr = (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.text) || (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.value) || String(parsedValue);
|
|
4367
|
+
}
|
|
4368
|
+
}
|
|
4369
|
+
catch {
|
|
4370
|
+
colValueStr = colValue.value || '';
|
|
4371
|
+
}
|
|
4372
|
+
if (colText === identifierValue || colValueStr === identifierValue ||
|
|
4373
|
+
colText.trim() === identifierValue.trim() || colValueStr.trim() === identifierValue.trim()) {
|
|
4374
|
+
foundItemId = item.id;
|
|
4375
|
+
break;
|
|
4376
|
+
}
|
|
4377
|
+
}
|
|
4378
|
+
}
|
|
4379
|
+
hasMore = cursor !== null && items.length > 0 && !foundItemId;
|
|
4380
|
+
}
|
|
4381
|
+
if (foundItemId) {
|
|
4382
|
+
console.log('Found existing item, updating:', foundItemId);
|
|
4383
|
+
const escapedColumnValues = (0, worktablesHelpers_1.escapeGraphQLJSONString)(column_values_object);
|
|
4384
|
+
mutation = `mutation {
|
|
4385
|
+
change_multiple_column_values(
|
|
4386
|
+
create_labels_if_missing: true,
|
|
4387
|
+
board_id: ${boardId},
|
|
4388
|
+
item_id: "${foundItemId}",
|
|
4389
|
+
column_values: "${escapedColumnValues}"
|
|
4390
|
+
) {
|
|
4285
4391
|
id
|
|
4392
|
+
url
|
|
4393
|
+
board {
|
|
4394
|
+
id
|
|
4395
|
+
}
|
|
4286
4396
|
}
|
|
4287
|
-
}
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4397
|
+
}`;
|
|
4398
|
+
console.log('Generated Update Mutation:', mutation);
|
|
4399
|
+
response = await this.helpers.request({
|
|
4400
|
+
method: 'POST',
|
|
4401
|
+
url: 'https://api.monday.com/v2',
|
|
4402
|
+
headers,
|
|
4403
|
+
body: { query: mutation },
|
|
4404
|
+
});
|
|
4405
|
+
const responseData = JSON.parse(response);
|
|
4406
|
+
if (!responseData.errors && responseData.data && responseData.data.change_multiple_column_values) {
|
|
4407
|
+
const itemData = responseData.data.change_multiple_column_values;
|
|
4408
|
+
if (itemData && itemData.id) {
|
|
4409
|
+
formatted = {
|
|
4410
|
+
id: itemData.id,
|
|
4411
|
+
url: itemData.url,
|
|
4412
|
+
operation: 'update',
|
|
4413
|
+
board_id: itemData.board.id,
|
|
4414
|
+
column_values: column_values_object,
|
|
4415
|
+
};
|
|
4416
|
+
itemUpdated = true;
|
|
4417
|
+
}
|
|
4418
|
+
}
|
|
4419
|
+
if (!itemUpdated) {
|
|
4420
|
+
console.log('Error updating item, creating new item instead');
|
|
4308
4421
|
}
|
|
4309
4422
|
}
|
|
4310
|
-
|
|
4311
|
-
console.log('Item not found
|
|
4423
|
+
else {
|
|
4424
|
+
console.log('Item not found with identifier value, will create new item');
|
|
4312
4425
|
}
|
|
4313
4426
|
}
|
|
4314
4427
|
if (!itemUpdated) {
|
|
@@ -4316,6 +4429,7 @@ class Worktables {
|
|
|
4316
4429
|
const parentId = this.getNodeParameter('parentId', 0, false);
|
|
4317
4430
|
const escapedItemName = (0, worktablesHelpers_1.escapeGraphQLString)(itemName);
|
|
4318
4431
|
const escapedColumnValues = (0, worktablesHelpers_1.escapeGraphQLJSONString)(column_values_object);
|
|
4432
|
+
const escapedGroupName = groupName ? (0, worktablesHelpers_1.escapeGraphQLString)(groupName) : '';
|
|
4319
4433
|
if (isSubitem && parentId) {
|
|
4320
4434
|
mutation = `mutation {
|
|
4321
4435
|
create_subitem(
|
|
@@ -4333,9 +4447,11 @@ class Worktables {
|
|
|
4333
4447
|
}`;
|
|
4334
4448
|
}
|
|
4335
4449
|
else {
|
|
4450
|
+
const groupIdParam = groupName ? `group_id: "${escapedGroupName}",` : '';
|
|
4336
4451
|
mutation = `mutation {
|
|
4337
4452
|
create_item(
|
|
4338
4453
|
board_id: ${boardId},
|
|
4454
|
+
${groupIdParam}
|
|
4339
4455
|
item_name: "${escapedItemName}",
|
|
4340
4456
|
column_values: "${escapedColumnValues}"
|
|
4341
4457
|
) {
|
|
@@ -4392,15 +4508,7 @@ class Worktables {
|
|
|
4392
4508
|
}
|
|
4393
4509
|
case 'duplicateItem': {
|
|
4394
4510
|
console.log('Duplicate an item');
|
|
4395
|
-
const
|
|
4396
|
-
let itemId = '';
|
|
4397
|
-
let subitemId = '';
|
|
4398
|
-
if (isSubitem) {
|
|
4399
|
-
subitemId = this.getNodeParameter('subitemId', 0);
|
|
4400
|
-
}
|
|
4401
|
-
else {
|
|
4402
|
-
itemId = this.getNodeParameter('itemId', 0);
|
|
4403
|
-
}
|
|
4511
|
+
const itemId = this.getNodeParameter('itemId', 0);
|
|
4404
4512
|
const withUpdates = this.getNodeParameter('withUpdates', 0);
|
|
4405
4513
|
const boardId = this.getNodeParameter('boardId', 0);
|
|
4406
4514
|
if (!itemId || !boardId) {
|
|
@@ -4411,7 +4519,7 @@ class Worktables {
|
|
|
4411
4519
|
const mutation = `
|
|
4412
4520
|
mutation {
|
|
4413
4521
|
duplicate_item(
|
|
4414
|
-
item_id: ${itemId
|
|
4522
|
+
item_id: ${itemId},
|
|
4415
4523
|
board_id: ${boardId},
|
|
4416
4524
|
with_updates: ${withUpdates}
|
|
4417
4525
|
) { id }
|
|
@@ -4510,7 +4618,7 @@ class Worktables {
|
|
|
4510
4618
|
body: { query },
|
|
4511
4619
|
});
|
|
4512
4620
|
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
4513
|
-
const itemsPage = (
|
|
4621
|
+
const itemsPage = (_3 = (_2 = (_1 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _1 === void 0 ? void 0 : _1.boards) === null || _2 === void 0 ? void 0 : _2[0]) === null || _3 === void 0 ? void 0 : _3.items_page;
|
|
4514
4622
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4515
4623
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4516
4624
|
allItems = allItems.concat(items);
|
|
@@ -4544,8 +4652,14 @@ class Worktables {
|
|
|
4544
4652
|
column_values: {},
|
|
4545
4653
|
};
|
|
4546
4654
|
for (const col of columnValues) {
|
|
4547
|
-
if (col.type === 'subtasks'
|
|
4655
|
+
if (col.type === 'subtasks' ||
|
|
4656
|
+
col.type === 'formula' ||
|
|
4657
|
+
col.type === 'mirror' ||
|
|
4658
|
+
col.type === 'auto_number' ||
|
|
4659
|
+
col.type === 'creation_log' ||
|
|
4660
|
+
col.type === 'last_updated') {
|
|
4548
4661
|
continue;
|
|
4662
|
+
}
|
|
4549
4663
|
const formattedCol = await (0, worktablesHelpers_1.formatColumnValue)(col);
|
|
4550
4664
|
if (formattedCol) {
|
|
4551
4665
|
formatted.column_values[col.id] = formattedCol;
|
|
@@ -4584,7 +4698,7 @@ class Worktables {
|
|
|
4584
4698
|
const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
|
|
4585
4699
|
const logicalOperator = this.getNodeParameter('logicalOperator', 0);
|
|
4586
4700
|
let rulesArray = [];
|
|
4587
|
-
if (((
|
|
4701
|
+
if (((_4 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _4 === void 0 ? void 0 : _4.length) > 0) {
|
|
4588
4702
|
rulesArray = filterRules.rule.map((rule) => {
|
|
4589
4703
|
let formattedValue;
|
|
4590
4704
|
if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
|
|
@@ -4628,7 +4742,7 @@ class Worktables {
|
|
|
4628
4742
|
});
|
|
4629
4743
|
}
|
|
4630
4744
|
const orderByArray = [];
|
|
4631
|
-
if (((
|
|
4745
|
+
if (((_5 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _5 === void 0 ? void 0 : _5.length) > 0) {
|
|
4632
4746
|
sortOptions.sortBy.forEach((sort) => {
|
|
4633
4747
|
orderByArray.push(`{
|
|
4634
4748
|
column_id: "${sort.columnId}",
|
|
@@ -4674,7 +4788,7 @@ class Worktables {
|
|
|
4674
4788
|
body: { query },
|
|
4675
4789
|
});
|
|
4676
4790
|
const parsed = JSON.parse(rawResponse);
|
|
4677
|
-
const items = ((
|
|
4791
|
+
const items = ((_9 = (_8 = (_7 = (_6 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _6 === void 0 ? void 0 : _6.boards) === null || _7 === void 0 ? void 0 : _7[0]) === null || _8 === void 0 ? void 0 : _8.items_page) === null || _9 === void 0 ? void 0 : _9.items) || [];
|
|
4678
4792
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
4679
4793
|
const formatted = {
|
|
4680
4794
|
id: item.id,
|
|
@@ -4708,7 +4822,7 @@ class Worktables {
|
|
|
4708
4822
|
const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
|
|
4709
4823
|
const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
|
|
4710
4824
|
let rulesArray = [];
|
|
4711
|
-
if (((
|
|
4825
|
+
if (((_10 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _10 === void 0 ? void 0 : _10.length) > 0) {
|
|
4712
4826
|
console.log('Processing filter rules:', advancedFilterRules.rule);
|
|
4713
4827
|
rulesArray = advancedFilterRules.rule.map((rule) => {
|
|
4714
4828
|
let formattedValue;
|
|
@@ -4924,7 +5038,7 @@ class Worktables {
|
|
|
4924
5038
|
});
|
|
4925
5039
|
}
|
|
4926
5040
|
const orderByArray = [];
|
|
4927
|
-
if (((
|
|
5041
|
+
if (((_11 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _11 === void 0 ? void 0 : _11.length) > 0) {
|
|
4928
5042
|
advancedSortOptions.sortBy.forEach((sort) => {
|
|
4929
5043
|
orderByArray.push(`{
|
|
4930
5044
|
column_id: "${sort.columnId}",
|
|
@@ -4996,7 +5110,7 @@ class Worktables {
|
|
|
4996
5110
|
body: { query: testQuery },
|
|
4997
5111
|
});
|
|
4998
5112
|
const testParsed = JSON.parse(testResponse);
|
|
4999
|
-
const testItems = ((
|
|
5113
|
+
const testItems = ((_15 = (_14 = (_13 = (_12 = testParsed === null || testParsed === void 0 ? void 0 : testParsed.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) === null || _15 === void 0 ? void 0 : _15.items) || [];
|
|
5000
5114
|
console.log('Test - Items in board (no filters):', testItems.length);
|
|
5001
5115
|
if (testItems.length > 0) {
|
|
5002
5116
|
console.log('Sample item column values:', testItems[0].column_values);
|
|
@@ -5008,7 +5122,7 @@ class Worktables {
|
|
|
5008
5122
|
body: { query },
|
|
5009
5123
|
});
|
|
5010
5124
|
const parsed = JSON.parse(rawResponse);
|
|
5011
|
-
const itemsPage = (
|
|
5125
|
+
const itemsPage = (_18 = (_17 = (_16 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _16 === void 0 ? void 0 : _16.boards) === null || _17 === void 0 ? void 0 : _17[0]) === null || _18 === void 0 ? void 0 : _18.items_page;
|
|
5012
5126
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5013
5127
|
const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
|
|
5014
5128
|
const hasMore = nextCursor ? true : false;
|
|
@@ -5032,8 +5146,14 @@ class Worktables {
|
|
|
5032
5146
|
if (!fetchColumnValues)
|
|
5033
5147
|
return formatted;
|
|
5034
5148
|
for (const col of item.column_values || []) {
|
|
5035
|
-
if (col.type === 'subtasks'
|
|
5149
|
+
if (col.type === 'subtasks' ||
|
|
5150
|
+
col.type === 'formula' ||
|
|
5151
|
+
col.type === 'mirror' ||
|
|
5152
|
+
col.type === 'auto_number' ||
|
|
5153
|
+
col.type === 'creation_log' ||
|
|
5154
|
+
col.type === 'last_updated') {
|
|
5036
5155
|
continue;
|
|
5156
|
+
}
|
|
5037
5157
|
const formattedCol = {
|
|
5038
5158
|
type: col.type,
|
|
5039
5159
|
value: await (0, parseValue_1.parseValue)(col.value),
|
|
@@ -5160,7 +5280,7 @@ class Worktables {
|
|
|
5160
5280
|
body: { query },
|
|
5161
5281
|
});
|
|
5162
5282
|
const parsed = JSON.parse(rawResponse);
|
|
5163
|
-
const items = ((
|
|
5283
|
+
const items = ((_24 = (_23 = (_22 = (_21 = (_20 = (_19 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _19 === void 0 ? void 0 : _19.boards) === null || _20 === void 0 ? void 0 : _20[0]) === null || _21 === void 0 ? void 0 : _21.groups) === null || _22 === void 0 ? void 0 : _22[0]) === null || _23 === void 0 ? void 0 : _23.items_page) === null || _24 === void 0 ? void 0 : _24.items) || [];
|
|
5164
5284
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5165
5285
|
const columnValues = item.column_values || [];
|
|
5166
5286
|
const formatted = {
|
|
@@ -5181,8 +5301,14 @@ class Worktables {
|
|
|
5181
5301
|
column_values: {},
|
|
5182
5302
|
};
|
|
5183
5303
|
for (const col of columnValues) {
|
|
5184
|
-
if (col.type === 'subtasks'
|
|
5304
|
+
if (col.type === 'subtasks' ||
|
|
5305
|
+
col.type === 'formula' ||
|
|
5306
|
+
col.type === 'mirror' ||
|
|
5307
|
+
col.type === 'auto_number' ||
|
|
5308
|
+
col.type === 'creation_log' ||
|
|
5309
|
+
col.type === 'last_updated') {
|
|
5185
5310
|
continue;
|
|
5311
|
+
}
|
|
5186
5312
|
const formattedCol = await (0, worktablesHelpers_1.formatColumnValue)(col);
|
|
5187
5313
|
if (formattedCol) {
|
|
5188
5314
|
formatted.column_values[col.id] = formattedCol;
|
|
@@ -5244,7 +5370,7 @@ class Worktables {
|
|
|
5244
5370
|
response = await (0, isErrorResponse_1.parseApiResponse)(response);
|
|
5245
5371
|
if (response.success) {
|
|
5246
5372
|
const parsed = JSON.parse(response.data);
|
|
5247
|
-
const updates = ((
|
|
5373
|
+
const updates = ((_27 = (_26 = (_25 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _25 === void 0 ? void 0 : _25.items) === null || _26 === void 0 ? void 0 : _26[0]) === null || _27 === void 0 ? void 0 : _27.updates) || [];
|
|
5248
5374
|
const formattedUpdates = updates.map((update) => {
|
|
5249
5375
|
const pinnedToTop = update.pinned_to_top || [];
|
|
5250
5376
|
const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
|
|
@@ -5309,7 +5435,7 @@ class Worktables {
|
|
|
5309
5435
|
console.log('variables:', variables);
|
|
5310
5436
|
response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
|
|
5311
5437
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
5312
|
-
const updateId = (
|
|
5438
|
+
const updateId = (_29 = (_28 = JSON.parse(response).data) === null || _28 === void 0 ? void 0 : _28.create_update) === null || _29 === void 0 ? void 0 : _29.id;
|
|
5313
5439
|
if (!updateId) {
|
|
5314
5440
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5315
5441
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -5615,7 +5741,7 @@ class Worktables {
|
|
|
5615
5741
|
body: { query },
|
|
5616
5742
|
json: true,
|
|
5617
5743
|
});
|
|
5618
|
-
const asset = (
|
|
5744
|
+
const asset = (_31 = (_30 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _30 === void 0 ? void 0 : _30.assets) === null || _31 === void 0 ? void 0 : _31[0];
|
|
5619
5745
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
5620
5746
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5621
5747
|
message: 'Public URL not found for the given file ID.',
|