@worktables/n8n-nodes-worktables 12.2.18 → 12.2.20
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.
|
@@ -2809,7 +2809,7 @@ class Worktables {
|
|
|
2809
2809
|
};
|
|
2810
2810
|
}
|
|
2811
2811
|
async execute() {
|
|
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;
|
|
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, _32, _33, _34, _35, _36, _37, _38;
|
|
2813
2813
|
const resource = this.getNodeParameter('resource', 0);
|
|
2814
2814
|
const operation = this.getNodeParameter('operation', 0);
|
|
2815
2815
|
const credentials = await this.getCredentials('WorktablesApi');
|
|
@@ -4325,26 +4325,48 @@ class Worktables {
|
|
|
4325
4325
|
let itemUpdated = false;
|
|
4326
4326
|
let foundItemId = null;
|
|
4327
4327
|
if (identifierValue && identifierValue.trim() !== '' && identifierColumn && identifierColumn.trim() !== '') {
|
|
4328
|
-
console.log('Searching for item with identifier column:', identifierColumn, 'value:', identifierValue);
|
|
4328
|
+
console.log('Searching for item/subitem with identifier column:', identifierColumn, 'value:', identifierValue, 'isSubitem:', isSubitem);
|
|
4329
4329
|
let cursor = null;
|
|
4330
4330
|
let hasMore = true;
|
|
4331
4331
|
while (hasMore && !foundItemId) {
|
|
4332
4332
|
const cursorParam = cursor ? `, cursor: "${cursor}"` : '';
|
|
4333
|
-
const searchQuery =
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
column_values(ids: ["${identifierColumn}"]) {
|
|
4333
|
+
const searchQuery = isSubitem
|
|
4334
|
+
? `query {
|
|
4335
|
+
boards(ids: [${boardId}]) {
|
|
4336
|
+
items_page(limit: 100${cursorParam}) {
|
|
4337
|
+
items {
|
|
4339
4338
|
id
|
|
4340
|
-
|
|
4341
|
-
|
|
4339
|
+
name
|
|
4340
|
+
subitems {
|
|
4341
|
+
id
|
|
4342
|
+
name
|
|
4343
|
+
column_values(ids: ["${identifierColumn}"]) {
|
|
4344
|
+
id
|
|
4345
|
+
text
|
|
4346
|
+
value
|
|
4347
|
+
}
|
|
4348
|
+
}
|
|
4342
4349
|
}
|
|
4350
|
+
cursor
|
|
4343
4351
|
}
|
|
4344
|
-
cursor
|
|
4345
4352
|
}
|
|
4346
|
-
}
|
|
4347
|
-
|
|
4353
|
+
}`
|
|
4354
|
+
: `query {
|
|
4355
|
+
boards(ids: [${boardId}]) {
|
|
4356
|
+
items_page(limit: 100${cursorParam}) {
|
|
4357
|
+
items {
|
|
4358
|
+
id
|
|
4359
|
+
name
|
|
4360
|
+
column_values(ids: ["${identifierColumn}"]) {
|
|
4361
|
+
id
|
|
4362
|
+
text
|
|
4363
|
+
value
|
|
4364
|
+
}
|
|
4365
|
+
}
|
|
4366
|
+
cursor
|
|
4367
|
+
}
|
|
4368
|
+
}
|
|
4369
|
+
}`;
|
|
4348
4370
|
const searchResponse = await this.helpers.request({
|
|
4349
4371
|
method: 'POST',
|
|
4350
4372
|
url: 'https://api.monday.com/v2',
|
|
@@ -4355,22 +4377,70 @@ class Worktables {
|
|
|
4355
4377
|
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
4378
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4357
4379
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4380
|
+
const isNameColumn = identifierColumn === 'name' || identifierColumn.toLowerCase() === 'name';
|
|
4381
|
+
if (isSubitem) {
|
|
4382
|
+
for (const item of items) {
|
|
4383
|
+
if (item.subitems && Array.isArray(item.subitems)) {
|
|
4384
|
+
for (const subitem of item.subitems) {
|
|
4385
|
+
let matches = false;
|
|
4386
|
+
if (isNameColumn) {
|
|
4387
|
+
matches = subitem.name === identifierValue ||
|
|
4388
|
+
((_0 = subitem.name) === null || _0 === void 0 ? void 0 : _0.trim()) === identifierValue.trim();
|
|
4389
|
+
}
|
|
4390
|
+
else {
|
|
4391
|
+
const colValue = (_1 = subitem.column_values) === null || _1 === void 0 ? void 0 : _1.find((cv) => cv.id === identifierColumn);
|
|
4392
|
+
if (colValue) {
|
|
4393
|
+
let colText = colValue.text || '';
|
|
4394
|
+
let colValueStr = '';
|
|
4395
|
+
try {
|
|
4396
|
+
if (colValue.value) {
|
|
4397
|
+
const parsedValue = JSON.parse(colValue.value);
|
|
4398
|
+
colValueStr = (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.text) || (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.value) || String(parsedValue);
|
|
4399
|
+
}
|
|
4400
|
+
}
|
|
4401
|
+
catch {
|
|
4402
|
+
colValueStr = colValue.value || '';
|
|
4403
|
+
}
|
|
4404
|
+
matches = colText === identifierValue || colValueStr === identifierValue ||
|
|
4405
|
+
colText.trim() === identifierValue.trim() || colValueStr.trim() === identifierValue.trim();
|
|
4406
|
+
}
|
|
4407
|
+
}
|
|
4408
|
+
if (matches) {
|
|
4409
|
+
foundItemId = subitem.id;
|
|
4410
|
+
break;
|
|
4411
|
+
}
|
|
4367
4412
|
}
|
|
4413
|
+
if (foundItemId)
|
|
4414
|
+
break;
|
|
4368
4415
|
}
|
|
4369
|
-
|
|
4370
|
-
|
|
4416
|
+
}
|
|
4417
|
+
}
|
|
4418
|
+
else {
|
|
4419
|
+
for (const item of items) {
|
|
4420
|
+
let matches = false;
|
|
4421
|
+
if (isNameColumn) {
|
|
4422
|
+
matches = item.name === identifierValue ||
|
|
4423
|
+
((_2 = item.name) === null || _2 === void 0 ? void 0 : _2.trim()) === identifierValue.trim();
|
|
4424
|
+
}
|
|
4425
|
+
else {
|
|
4426
|
+
const colValue = (_3 = item.column_values) === null || _3 === void 0 ? void 0 : _3.find((cv) => cv.id === identifierColumn);
|
|
4427
|
+
if (colValue) {
|
|
4428
|
+
let colText = colValue.text || '';
|
|
4429
|
+
let colValueStr = '';
|
|
4430
|
+
try {
|
|
4431
|
+
if (colValue.value) {
|
|
4432
|
+
const parsedValue = JSON.parse(colValue.value);
|
|
4433
|
+
colValueStr = (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.text) || (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.value) || String(parsedValue);
|
|
4434
|
+
}
|
|
4435
|
+
}
|
|
4436
|
+
catch {
|
|
4437
|
+
colValueStr = colValue.value || '';
|
|
4438
|
+
}
|
|
4439
|
+
matches = colText === identifierValue || colValueStr === identifierValue ||
|
|
4440
|
+
colText.trim() === identifierValue.trim() || colValueStr.trim() === identifierValue.trim();
|
|
4441
|
+
}
|
|
4371
4442
|
}
|
|
4372
|
-
if (
|
|
4373
|
-
colText.trim() === identifierValue.trim() || colValueStr.trim() === identifierValue.trim()) {
|
|
4443
|
+
if (matches) {
|
|
4374
4444
|
foundItemId = item.id;
|
|
4375
4445
|
break;
|
|
4376
4446
|
}
|
|
@@ -4379,7 +4449,7 @@ class Worktables {
|
|
|
4379
4449
|
hasMore = cursor !== null && items.length > 0 && !foundItemId;
|
|
4380
4450
|
}
|
|
4381
4451
|
if (foundItemId) {
|
|
4382
|
-
console.log(
|
|
4452
|
+
console.log(`Found existing ${isSubitem ? 'subitem' : 'item'}, updating:`, foundItemId);
|
|
4383
4453
|
const escapedColumnValues = (0, worktablesHelpers_1.escapeGraphQLJSONString)(column_values_object);
|
|
4384
4454
|
mutation = `mutation {
|
|
4385
4455
|
change_multiple_column_values(
|
|
@@ -4408,28 +4478,43 @@ class Worktables {
|
|
|
4408
4478
|
if (itemData && itemData.id) {
|
|
4409
4479
|
formatted = {
|
|
4410
4480
|
id: itemData.id,
|
|
4411
|
-
url: itemData.url,
|
|
4481
|
+
url: itemData.url || '',
|
|
4412
4482
|
operation: 'update',
|
|
4413
|
-
board_id: itemData.board.id,
|
|
4483
|
+
board_id: ((_4 = itemData.board) === null || _4 === void 0 ? void 0 : _4.id) || boardId,
|
|
4414
4484
|
column_values: column_values_object,
|
|
4415
4485
|
};
|
|
4416
4486
|
itemUpdated = true;
|
|
4487
|
+
console.log(`Successfully updated ${isSubitem ? 'subitem' : 'item'}:`, itemData.id);
|
|
4488
|
+
}
|
|
4489
|
+
else {
|
|
4490
|
+
console.log(`Update response missing item data, will create new ${isSubitem ? 'subitem' : 'item'} instead`);
|
|
4491
|
+
itemUpdated = false;
|
|
4417
4492
|
}
|
|
4418
4493
|
}
|
|
4419
|
-
|
|
4420
|
-
|
|
4494
|
+
else {
|
|
4495
|
+
if (responseData.errors) {
|
|
4496
|
+
console.log('Error updating item:', JSON.stringify(responseData.errors));
|
|
4497
|
+
}
|
|
4498
|
+
else {
|
|
4499
|
+
console.log('Update response missing data, will create new item instead');
|
|
4500
|
+
}
|
|
4501
|
+
itemUpdated = false;
|
|
4421
4502
|
}
|
|
4422
4503
|
}
|
|
4423
4504
|
else {
|
|
4424
|
-
console.log('Item not found with identifier value, will create new item');
|
|
4505
|
+
console.log(`${isSubitem ? 'Subitem' : 'Item'} not found with identifier value "${identifierValue}", will create new ${isSubitem ? 'subitem' : 'item'}`);
|
|
4506
|
+
itemUpdated = false;
|
|
4425
4507
|
}
|
|
4426
4508
|
}
|
|
4509
|
+
else {
|
|
4510
|
+
console.log('No identifier provided, will create new item');
|
|
4511
|
+
itemUpdated = false;
|
|
4512
|
+
}
|
|
4427
4513
|
if (!itemUpdated) {
|
|
4428
|
-
console.log(
|
|
4514
|
+
console.log(`Creating new ${isSubitem ? 'subitem' : 'item'}:`, itemName);
|
|
4429
4515
|
const parentId = this.getNodeParameter('parentId', 0, false);
|
|
4430
4516
|
const escapedItemName = (0, worktablesHelpers_1.escapeGraphQLString)(itemName);
|
|
4431
4517
|
const escapedColumnValues = (0, worktablesHelpers_1.escapeGraphQLJSONString)(column_values_object);
|
|
4432
|
-
const escapedGroupName = groupName ? (0, worktablesHelpers_1.escapeGraphQLString)(groupName) : '';
|
|
4433
4518
|
if (isSubitem && parentId) {
|
|
4434
4519
|
mutation = `mutation {
|
|
4435
4520
|
create_subitem(
|
|
@@ -4447,11 +4532,12 @@ class Worktables {
|
|
|
4447
4532
|
}`;
|
|
4448
4533
|
}
|
|
4449
4534
|
else {
|
|
4450
|
-
const
|
|
4535
|
+
const finalGroupId = groupName || 'topics';
|
|
4536
|
+
const escapedFinalGroupId = (0, worktablesHelpers_1.escapeGraphQLString)(finalGroupId);
|
|
4451
4537
|
mutation = `mutation {
|
|
4452
4538
|
create_item(
|
|
4453
4539
|
board_id: ${boardId},
|
|
4454
|
-
${
|
|
4540
|
+
group_id: "${escapedFinalGroupId}",
|
|
4455
4541
|
item_name: "${escapedItemName}",
|
|
4456
4542
|
column_values: "${escapedColumnValues}"
|
|
4457
4543
|
) {
|
|
@@ -4471,15 +4557,25 @@ class Worktables {
|
|
|
4471
4557
|
body: { query: mutation },
|
|
4472
4558
|
});
|
|
4473
4559
|
const responseData = JSON.parse(response);
|
|
4560
|
+
if (responseData.errors) {
|
|
4561
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
4562
|
+
message: `Error creating ${isSubitem ? 'subitem' : 'item'}: ${JSON.stringify(responseData.errors)}`,
|
|
4563
|
+
});
|
|
4564
|
+
}
|
|
4474
4565
|
const itemData = isSubitem && parentId
|
|
4475
|
-
? responseData.data.create_subitem
|
|
4476
|
-
: responseData.data.create_item;
|
|
4566
|
+
? (_5 = responseData.data) === null || _5 === void 0 ? void 0 : _5.create_subitem
|
|
4567
|
+
: (_6 = responseData.data) === null || _6 === void 0 ? void 0 : _6.create_item;
|
|
4568
|
+
if (!itemData || !itemData.id) {
|
|
4569
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
4570
|
+
message: `Error creating ${isSubitem ? 'subitem' : 'item'}: No item data returned`,
|
|
4571
|
+
});
|
|
4572
|
+
}
|
|
4477
4573
|
formatted = {
|
|
4478
4574
|
id: itemData.id,
|
|
4479
|
-
name: itemData.name,
|
|
4480
|
-
url: itemData.url,
|
|
4575
|
+
name: itemData.name || itemName,
|
|
4576
|
+
url: itemData.url || '',
|
|
4481
4577
|
operation: 'create',
|
|
4482
|
-
board_id: itemData.board.id,
|
|
4578
|
+
board_id: ((_7 = itemData.board) === null || _7 === void 0 ? void 0 : _7.id) || boardId,
|
|
4483
4579
|
column_values: column_values_object,
|
|
4484
4580
|
};
|
|
4485
4581
|
if (isSubitem && parentId) {
|
|
@@ -4618,7 +4714,7 @@ class Worktables {
|
|
|
4618
4714
|
body: { query },
|
|
4619
4715
|
});
|
|
4620
4716
|
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
4621
|
-
const itemsPage = (
|
|
4717
|
+
const itemsPage = (_10 = (_9 = (_8 = parsed === null || parsed === void 0 ? void 0 : parsed.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;
|
|
4622
4718
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4623
4719
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
4624
4720
|
allItems = allItems.concat(items);
|
|
@@ -4698,7 +4794,7 @@ class Worktables {
|
|
|
4698
4794
|
const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
|
|
4699
4795
|
const logicalOperator = this.getNodeParameter('logicalOperator', 0);
|
|
4700
4796
|
let rulesArray = [];
|
|
4701
|
-
if (((
|
|
4797
|
+
if (((_11 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _11 === void 0 ? void 0 : _11.length) > 0) {
|
|
4702
4798
|
rulesArray = filterRules.rule.map((rule) => {
|
|
4703
4799
|
let formattedValue;
|
|
4704
4800
|
if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
|
|
@@ -4742,7 +4838,7 @@ class Worktables {
|
|
|
4742
4838
|
});
|
|
4743
4839
|
}
|
|
4744
4840
|
const orderByArray = [];
|
|
4745
|
-
if (((
|
|
4841
|
+
if (((_12 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _12 === void 0 ? void 0 : _12.length) > 0) {
|
|
4746
4842
|
sortOptions.sortBy.forEach((sort) => {
|
|
4747
4843
|
orderByArray.push(`{
|
|
4748
4844
|
column_id: "${sort.columnId}",
|
|
@@ -4788,7 +4884,7 @@ class Worktables {
|
|
|
4788
4884
|
body: { query },
|
|
4789
4885
|
});
|
|
4790
4886
|
const parsed = JSON.parse(rawResponse);
|
|
4791
|
-
const items = ((
|
|
4887
|
+
const items = ((_16 = (_15 = (_14 = (_13 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _13 === void 0 ? void 0 : _13.boards) === null || _14 === void 0 ? void 0 : _14[0]) === null || _15 === void 0 ? void 0 : _15.items_page) === null || _16 === void 0 ? void 0 : _16.items) || [];
|
|
4792
4888
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
4793
4889
|
const formatted = {
|
|
4794
4890
|
id: item.id,
|
|
@@ -4822,7 +4918,7 @@ class Worktables {
|
|
|
4822
4918
|
const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
|
|
4823
4919
|
const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
|
|
4824
4920
|
let rulesArray = [];
|
|
4825
|
-
if (((
|
|
4921
|
+
if (((_17 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _17 === void 0 ? void 0 : _17.length) > 0) {
|
|
4826
4922
|
console.log('Processing filter rules:', advancedFilterRules.rule);
|
|
4827
4923
|
rulesArray = advancedFilterRules.rule.map((rule) => {
|
|
4828
4924
|
let formattedValue;
|
|
@@ -5038,7 +5134,7 @@ class Worktables {
|
|
|
5038
5134
|
});
|
|
5039
5135
|
}
|
|
5040
5136
|
const orderByArray = [];
|
|
5041
|
-
if (((
|
|
5137
|
+
if (((_18 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _18 === void 0 ? void 0 : _18.length) > 0) {
|
|
5042
5138
|
advancedSortOptions.sortBy.forEach((sort) => {
|
|
5043
5139
|
orderByArray.push(`{
|
|
5044
5140
|
column_id: "${sort.columnId}",
|
|
@@ -5110,7 +5206,7 @@ class Worktables {
|
|
|
5110
5206
|
body: { query: testQuery },
|
|
5111
5207
|
});
|
|
5112
5208
|
const testParsed = JSON.parse(testResponse);
|
|
5113
|
-
const testItems = ((
|
|
5209
|
+
const testItems = ((_22 = (_21 = (_20 = (_19 = testParsed === null || testParsed === void 0 ? void 0 : testParsed.data) === null || _19 === void 0 ? void 0 : _19.boards) === null || _20 === void 0 ? void 0 : _20[0]) === null || _21 === void 0 ? void 0 : _21.items_page) === null || _22 === void 0 ? void 0 : _22.items) || [];
|
|
5114
5210
|
console.log('Test - Items in board (no filters):', testItems.length);
|
|
5115
5211
|
if (testItems.length > 0) {
|
|
5116
5212
|
console.log('Sample item column values:', testItems[0].column_values);
|
|
@@ -5122,7 +5218,7 @@ class Worktables {
|
|
|
5122
5218
|
body: { query },
|
|
5123
5219
|
});
|
|
5124
5220
|
const parsed = JSON.parse(rawResponse);
|
|
5125
|
-
const itemsPage = (
|
|
5221
|
+
const itemsPage = (_25 = (_24 = (_23 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _23 === void 0 ? void 0 : _23.boards) === null || _24 === void 0 ? void 0 : _24[0]) === null || _25 === void 0 ? void 0 : _25.items_page;
|
|
5126
5222
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5127
5223
|
const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
|
|
5128
5224
|
const hasMore = nextCursor ? true : false;
|
|
@@ -5280,7 +5376,7 @@ class Worktables {
|
|
|
5280
5376
|
body: { query },
|
|
5281
5377
|
});
|
|
5282
5378
|
const parsed = JSON.parse(rawResponse);
|
|
5283
|
-
const items = ((
|
|
5379
|
+
const items = ((_31 = (_30 = (_29 = (_28 = (_27 = (_26 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _26 === void 0 ? void 0 : _26.boards) === null || _27 === void 0 ? void 0 : _27[0]) === null || _28 === void 0 ? void 0 : _28.groups) === null || _29 === void 0 ? void 0 : _29[0]) === null || _30 === void 0 ? void 0 : _30.items_page) === null || _31 === void 0 ? void 0 : _31.items) || [];
|
|
5284
5380
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5285
5381
|
const columnValues = item.column_values || [];
|
|
5286
5382
|
const formatted = {
|
|
@@ -5370,7 +5466,7 @@ class Worktables {
|
|
|
5370
5466
|
response = await (0, isErrorResponse_1.parseApiResponse)(response);
|
|
5371
5467
|
if (response.success) {
|
|
5372
5468
|
const parsed = JSON.parse(response.data);
|
|
5373
|
-
const updates = ((
|
|
5469
|
+
const updates = ((_34 = (_33 = (_32 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _32 === void 0 ? void 0 : _32.items) === null || _33 === void 0 ? void 0 : _33[0]) === null || _34 === void 0 ? void 0 : _34.updates) || [];
|
|
5374
5470
|
const formattedUpdates = updates.map((update) => {
|
|
5375
5471
|
const pinnedToTop = update.pinned_to_top || [];
|
|
5376
5472
|
const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
|
|
@@ -5435,7 +5531,7 @@ class Worktables {
|
|
|
5435
5531
|
console.log('variables:', variables);
|
|
5436
5532
|
response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
|
|
5437
5533
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
5438
|
-
const updateId = (
|
|
5534
|
+
const updateId = (_36 = (_35 = JSON.parse(response).data) === null || _35 === void 0 ? void 0 : _35.create_update) === null || _36 === void 0 ? void 0 : _36.id;
|
|
5439
5535
|
if (!updateId) {
|
|
5440
5536
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5441
5537
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -5741,7 +5837,7 @@ class Worktables {
|
|
|
5741
5837
|
body: { query },
|
|
5742
5838
|
json: true,
|
|
5743
5839
|
});
|
|
5744
|
-
const asset = (
|
|
5840
|
+
const asset = (_38 = (_37 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _37 === void 0 ? void 0 : _37.assets) === null || _38 === void 0 ? void 0 : _38[0];
|
|
5745
5841
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
5746
5842
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5747
5843
|
message: 'Public URL not found for the given file ID.',
|