@worktables/n8n-nodes-worktables 12.15.0 → 12.17.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.
- package/dist/nodes/Worktables/Worktables.node.js +62 -348
- 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.d.ts +30 -0
- package/dist/utils/worktablesHelpers.js +138 -1
- package/dist/utils/worktablesHelpers.js.map +1 -1
- package/package.json +1 -1
|
@@ -3178,7 +3178,7 @@ class Worktables {
|
|
|
3178
3178
|
};
|
|
3179
3179
|
}
|
|
3180
3180
|
async execute() {
|
|
3181
|
-
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, _39, _40, _41, _42, _43, _44, _45, _46, _47
|
|
3181
|
+
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, _39, _40, _41, _42, _43, _44, _45, _46, _47;
|
|
3182
3182
|
const resource = this.getNodeParameter('resource', 0);
|
|
3183
3183
|
const operation = this.getNodeParameter('operation', 0);
|
|
3184
3184
|
const credentials = await this.getCredentials('WorktablesApi');
|
|
@@ -4558,160 +4558,19 @@ class Worktables {
|
|
|
4558
4558
|
const groupName = this.getNodeParameter('groupName', 0, '');
|
|
4559
4559
|
const raw = this.getNodeParameter('columnValues', 0);
|
|
4560
4560
|
const columnValues = raw.column;
|
|
4561
|
-
let column_values_object = {};
|
|
4562
4561
|
console.log('Column Values:', JSON.stringify(raw, null, 2));
|
|
4563
|
-
|
|
4564
|
-
const columnTypeResponse = await this.helpers.request({
|
|
4565
|
-
method: 'POST',
|
|
4566
|
-
url: 'https://api.monday.com/v2',
|
|
4567
|
-
headers: {
|
|
4568
|
-
Authorization: `Bearer ${apiKey}`,
|
|
4569
|
-
'Content-Type': 'application/json',
|
|
4570
|
-
},
|
|
4571
|
-
body: {
|
|
4572
|
-
query: `query {
|
|
4573
|
-
boards(ids: ${boardId}) {
|
|
4574
|
-
columns {
|
|
4575
|
-
id
|
|
4576
|
-
type
|
|
4577
|
-
}
|
|
4578
|
-
}
|
|
4579
|
-
}`,
|
|
4580
|
-
},
|
|
4581
|
-
});
|
|
4582
|
-
const columnsType = JSON.parse(columnTypeResponse).data.boards[0].columns;
|
|
4583
|
-
for (const col of columnValues) {
|
|
4584
|
-
const columnId = col.columnId;
|
|
4585
|
-
const columnDef = columnsType.find((c) => c.id === columnId);
|
|
4586
|
-
const type = columnDef === null || columnDef === void 0 ? void 0 : columnDef.type;
|
|
4587
|
-
if (!type || type === 'text' || type === 'simple' || col.columnType === 'simple') {
|
|
4588
|
-
console.log('Processing text/simple column:', col);
|
|
4589
|
-
if (col.columnValue !== undefined) {
|
|
4590
|
-
const value = col.columnValue;
|
|
4591
|
-
if (typeof value === 'string' && type === 'file') {
|
|
4592
|
-
const links = value.split(',').map((item) => {
|
|
4593
|
-
const [link, ...nameParts] = item.trim().split(/\s+/);
|
|
4594
|
-
return {
|
|
4595
|
-
fileType: 'LINK',
|
|
4596
|
-
linkToFile: link,
|
|
4597
|
-
name: nameParts.join(' '),
|
|
4598
|
-
};
|
|
4599
|
-
});
|
|
4600
|
-
column_values_object[columnId] = { files: links };
|
|
4601
|
-
}
|
|
4602
|
-
else if (typeof value === 'string') {
|
|
4603
|
-
column_values_object[columnId] = value;
|
|
4604
|
-
}
|
|
4605
|
-
else {
|
|
4606
|
-
column_values_object[columnId] = value;
|
|
4607
|
-
}
|
|
4608
|
-
}
|
|
4609
|
-
continue;
|
|
4610
|
-
}
|
|
4611
|
-
else if (col.columnType === 'objectValue') {
|
|
4612
|
-
console.log('Processing objectValue for column:', columnId);
|
|
4613
|
-
try {
|
|
4614
|
-
const parsedValue = JSON.parse(col.objectValue || '{}');
|
|
4615
|
-
column_values_object[columnId] = parsedValue;
|
|
4616
|
-
}
|
|
4617
|
-
catch (error) {
|
|
4618
|
-
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
4619
|
-
message: `Invalid JSON format for column ${columnId}: ${error.message}`,
|
|
4620
|
-
});
|
|
4621
|
-
}
|
|
4622
|
-
continue;
|
|
4623
|
-
}
|
|
4624
|
-
switch (type) {
|
|
4625
|
-
case 'checkbox':
|
|
4626
|
-
column_values_object[columnId] = col.checkboxValue ? { checked: 'true' } : { checked: 'false' };
|
|
4627
|
-
break;
|
|
4628
|
-
case 'status':
|
|
4629
|
-
column_values_object[columnId] = { label: col.statusLabel || 'Working on it' };
|
|
4630
|
-
break;
|
|
4631
|
-
case 'location':
|
|
4632
|
-
column_values_object[columnId] = {
|
|
4633
|
-
lat: col.latitude || '0',
|
|
4634
|
-
lng: col.longitude || '0',
|
|
4635
|
-
address: col.address || '',
|
|
4636
|
-
};
|
|
4637
|
-
break;
|
|
4638
|
-
case 'dropdown':
|
|
4639
|
-
column_values_object[columnId] = { label: col.dropdownValue || '' };
|
|
4640
|
-
break;
|
|
4641
|
-
case 'people':
|
|
4642
|
-
if (col.peopleValue) {
|
|
4643
|
-
const peopleIds = Array.isArray(col.peopleValue) ? col.peopleValue : [col.peopleValue];
|
|
4644
|
-
column_values_object[columnId] = { personsAndTeams: peopleIds.map(id => ({ id, kind: 'person' })) };
|
|
4645
|
-
}
|
|
4646
|
-
break;
|
|
4647
|
-
case 'team':
|
|
4648
|
-
if (col.teamsValue) {
|
|
4649
|
-
const teamIds = Array.isArray(col.teamsValue) ? col.teamsValue : [col.teamsValue];
|
|
4650
|
-
column_values_object[columnId] = { personsAndTeams: teamIds.map(id => ({ id, kind: 'team' })) };
|
|
4651
|
-
}
|
|
4652
|
-
break;
|
|
4653
|
-
case 'timeline':
|
|
4654
|
-
column_values_object[columnId] = {
|
|
4655
|
-
from: col.startDate || '',
|
|
4656
|
-
to: col.endDate || '',
|
|
4657
|
-
};
|
|
4658
|
-
break;
|
|
4659
|
-
case 'date':
|
|
4660
|
-
column_values_object[columnId] = { date: col.dateValue || '' };
|
|
4661
|
-
break;
|
|
4662
|
-
case 'email':
|
|
4663
|
-
column_values_object[columnId] = {
|
|
4664
|
-
email: col.emailValue || '',
|
|
4665
|
-
text: col.emailText || '',
|
|
4666
|
-
};
|
|
4667
|
-
break;
|
|
4668
|
-
case 'link':
|
|
4669
|
-
column_values_object[columnId] = {
|
|
4670
|
-
url: col.url || '',
|
|
4671
|
-
text: col.linkText || '',
|
|
4672
|
-
};
|
|
4673
|
-
break;
|
|
4674
|
-
case 'phone':
|
|
4675
|
-
column_values_object[columnId] = {
|
|
4676
|
-
phone: col.phoneValue || '',
|
|
4677
|
-
countryShortName: col.countryCode || 'US',
|
|
4678
|
-
};
|
|
4679
|
-
break;
|
|
4680
|
-
case 'file':
|
|
4681
|
-
if ((_w = col.fileLinks) === null || _w === void 0 ? void 0 : _w.file) {
|
|
4682
|
-
column_values_object[columnId] = { files: col.fileLinks.file };
|
|
4683
|
-
}
|
|
4684
|
-
break;
|
|
4685
|
-
default:
|
|
4686
|
-
if (col.columnValue !== undefined) {
|
|
4687
|
-
column_values_object[columnId] = col.columnValue;
|
|
4688
|
-
}
|
|
4689
|
-
}
|
|
4690
|
-
}
|
|
4691
|
-
}
|
|
4562
|
+
const column_values_object = await (0, worktablesHelpers_1.processColumnValues)(this, columnValues, boardId, apiKey);
|
|
4692
4563
|
let mutation;
|
|
4693
4564
|
let formatted;
|
|
4694
4565
|
let itemUpdated = false;
|
|
4695
4566
|
let foundItemId = null;
|
|
4696
4567
|
let foundItemBoardId = null;
|
|
4697
4568
|
if (identifierValue && identifierValue.trim() !== '' && identifierColumn && identifierColumn.trim() !== '') {
|
|
4698
|
-
console.log('
|
|
4699
|
-
console.log('🔍 STARTING SEARCH FOR ITEM/SUBITEM');
|
|
4700
|
-
console.log('═══════════════════════════════════════════════════════════');
|
|
4701
|
-
console.log('📋 Search Parameters:');
|
|
4702
|
-
console.log(' - identifierColumn:', identifierColumn);
|
|
4703
|
-
console.log(' - identifierValue:', identifierValue);
|
|
4704
|
-
console.log(' - isSubitem:', isSubitem);
|
|
4705
|
-
console.log(' - boardId:', boardId);
|
|
4706
|
-
console.log('═══════════════════════════════════════════════════════════');
|
|
4569
|
+
console.log('Searching for item/subitem with identifier column:', identifierColumn, 'value:', identifierValue, 'isSubitem:', isSubitem);
|
|
4707
4570
|
const parentId = this.getNodeParameter('parentId', 0, false);
|
|
4708
|
-
console.log(' - parentId:', parentId || '(not provided)');
|
|
4709
4571
|
const isNameColumn = identifierColumn === 'name' || identifierColumn.toLowerCase() === 'name';
|
|
4710
|
-
console.log(' - isNameColumn:', isNameColumn);
|
|
4711
4572
|
let searchBoardId = boardId;
|
|
4712
|
-
console.log(' - Initial searchBoardId:', searchBoardId);
|
|
4713
4573
|
if (isSubitem && !parentId) {
|
|
4714
|
-
console.log(' - Discovering subitem board...');
|
|
4715
4574
|
try {
|
|
4716
4575
|
const discoverQuery = `query {
|
|
4717
4576
|
boards(ids: [${boardId}]) {
|
|
@@ -4733,23 +4592,18 @@ class Worktables {
|
|
|
4733
4592
|
body: { query: discoverQuery },
|
|
4734
4593
|
});
|
|
4735
4594
|
const discoverData = JSON.parse(discoverResponse);
|
|
4736
|
-
const items = ((
|
|
4595
|
+
const items = ((_z = (_y = (_x = (_w = discoverData === null || discoverData === void 0 ? void 0 : discoverData.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) || [];
|
|
4737
4596
|
if (items.length > 0 && items[0].subitems && items[0].subitems.length > 0) {
|
|
4738
|
-
searchBoardId = ((
|
|
4739
|
-
console.log(`
|
|
4740
|
-
}
|
|
4741
|
-
else {
|
|
4742
|
-
console.log(` ⚠ No subitems found to discover board, using main board: ${boardId}`);
|
|
4597
|
+
searchBoardId = ((_0 = items[0].subitems[0].board) === null || _0 === void 0 ? void 0 : _0.id) || boardId;
|
|
4598
|
+
console.log(`Discovered subitem board ID: ${searchBoardId}`);
|
|
4743
4599
|
}
|
|
4744
4600
|
}
|
|
4745
4601
|
catch (error) {
|
|
4746
|
-
console.log('
|
|
4602
|
+
console.log('Could not discover subitem board, using main board:', error);
|
|
4747
4603
|
}
|
|
4748
4604
|
}
|
|
4749
|
-
console.log(' - Final searchBoardId:', searchBoardId);
|
|
4750
4605
|
let columnType = null;
|
|
4751
4606
|
if (!isNameColumn) {
|
|
4752
|
-
console.log(' - Fetching column type for:', identifierColumn);
|
|
4753
4607
|
try {
|
|
4754
4608
|
const columnTypeQuery = `query {
|
|
4755
4609
|
boards(ids: [${searchBoardId}]) {
|
|
@@ -4765,31 +4619,20 @@ class Worktables {
|
|
|
4765
4619
|
body: { query: columnTypeQuery },
|
|
4766
4620
|
});
|
|
4767
4621
|
const columnTypeData = JSON.parse(columnTypeResponse);
|
|
4768
|
-
const columns = ((
|
|
4622
|
+
const columns = ((_3 = (_2 = (_1 = columnTypeData === null || columnTypeData === void 0 ? void 0 : columnTypeData.data) === null || _1 === void 0 ? void 0 : _1.boards) === null || _2 === void 0 ? void 0 : _2[0]) === null || _3 === void 0 ? void 0 : _3.columns) || [];
|
|
4769
4623
|
if (columns.length > 0) {
|
|
4770
4624
|
columnType = columns[0].type;
|
|
4771
|
-
console.log(`
|
|
4772
|
-
}
|
|
4773
|
-
else {
|
|
4774
|
-
console.log(` ⚠ Column not found in board ${searchBoardId}`);
|
|
4625
|
+
console.log(`Column type detected: ${columnType}`);
|
|
4775
4626
|
}
|
|
4776
4627
|
}
|
|
4777
4628
|
catch (error) {
|
|
4778
|
-
console.log('
|
|
4629
|
+
console.log('Could not fetch column type, using default operator:', error);
|
|
4779
4630
|
}
|
|
4780
4631
|
}
|
|
4781
|
-
else {
|
|
4782
|
-
console.log(' - Skipping column type fetch (isNameColumn=true)');
|
|
4783
|
-
}
|
|
4784
4632
|
const searchColumnId = isNameColumn ? 'name' : identifierColumn;
|
|
4785
4633
|
const operator = columnType === 'status' ? 'contains_terms' : 'contains_text';
|
|
4786
4634
|
const limit = 100;
|
|
4787
|
-
console.log(' - searchColumnId:', searchColumnId);
|
|
4788
|
-
console.log(' - operator:', operator);
|
|
4789
|
-
console.log(' - limit:', limit);
|
|
4790
|
-
console.log('═══════════════════════════════════════════════════════════');
|
|
4791
4635
|
if (isSubitem && parentId) {
|
|
4792
|
-
console.log('🔍 Searching subitems with parentId:', parentId);
|
|
4793
4636
|
const parentQuery = `query {
|
|
4794
4637
|
items(ids: [${parentId}]) {
|
|
4795
4638
|
id
|
|
@@ -4829,23 +4672,19 @@ class Worktables {
|
|
|
4829
4672
|
body: { query: parentQuery },
|
|
4830
4673
|
});
|
|
4831
4674
|
const searchData = JSON.parse(searchResponse);
|
|
4832
|
-
const items = ((
|
|
4833
|
-
console.log(` - Parent query response: ${items.length} parent item(s) found`);
|
|
4675
|
+
const items = ((_4 = searchData === null || searchData === void 0 ? void 0 : searchData.data) === null || _4 === void 0 ? void 0 : _4.items) || [];
|
|
4834
4676
|
if (items.length > 0 && items[0].subitems) {
|
|
4835
4677
|
const subitems = items[0].subitems;
|
|
4836
|
-
console.log(
|
|
4837
|
-
for (
|
|
4838
|
-
const subitem = subitems[i];
|
|
4839
|
-
console.log(` - Checking subitem ${i + 1}/${subitems.length}: ID=${subitem.id}, name="${subitem.name}"`);
|
|
4678
|
+
console.log(`🔍 Searching subitems of parent ${parentId}, found ${subitems.length} subitem(s)`);
|
|
4679
|
+
for (const subitem of subitems) {
|
|
4840
4680
|
let matches = false;
|
|
4841
4681
|
if (isNameColumn) {
|
|
4842
4682
|
const searchValue = identifierValue.trim().toLowerCase();
|
|
4843
4683
|
const subitemName = (subitem.name || '').trim().toLowerCase();
|
|
4844
4684
|
matches = subitemName === searchValue;
|
|
4845
|
-
console.log(` - Name comparison: "${subitemName}" === "${searchValue}" = ${matches}`);
|
|
4846
4685
|
}
|
|
4847
4686
|
else {
|
|
4848
|
-
const colValue = (
|
|
4687
|
+
const colValue = (_5 = subitem.column_values) === null || _5 === void 0 ? void 0 : _5.find((cv) => cv.id === identifierColumn);
|
|
4849
4688
|
if (colValue) {
|
|
4850
4689
|
const isBoardRelation = colValue.type === 'board_relation' || colValue.type === 'mirror';
|
|
4851
4690
|
const isStatusColumn = colValue.type === 'status';
|
|
@@ -4853,51 +4692,25 @@ class Worktables {
|
|
|
4853
4692
|
? (colValue.display_value || '').trim()
|
|
4854
4693
|
: (colValue.text || '').trim();
|
|
4855
4694
|
const searchValue = identifierValue.trim().toLowerCase();
|
|
4856
|
-
console.log(` - Column type: ${colValue.type}`);
|
|
4857
|
-
console.log(` - Column value found: "${compareValue}"`);
|
|
4858
|
-
console.log(` - Search value: "${identifierValue}"`);
|
|
4859
4695
|
matches = compareValue.toLowerCase() === searchValue;
|
|
4860
|
-
console.log(` - Initial match: ${matches}`);
|
|
4861
4696
|
if (isStatusColumn && !matches) {
|
|
4862
4697
|
const normalizedCompare = compareValue.toLowerCase().replace(/\s+/g, ' ').trim();
|
|
4863
4698
|
const normalizedSearch = searchValue.replace(/\s+/g, ' ').trim();
|
|
4864
4699
|
matches = normalizedCompare === normalizedSearch;
|
|
4865
|
-
console.log(` - Normalized compare: "${normalizedCompare}" === "${normalizedSearch}" = ${matches}`);
|
|
4866
|
-
if (!matches) {
|
|
4867
|
-
console.log(` ❌ Status column comparison failed for subitem ${subitem.id}`);
|
|
4868
|
-
}
|
|
4869
|
-
}
|
|
4870
|
-
if (!matches) {
|
|
4871
|
-
console.log(` ❌ No match for subitem ${subitem.id}, column type: ${colValue.type}`);
|
|
4872
4700
|
}
|
|
4873
4701
|
}
|
|
4874
|
-
else {
|
|
4875
|
-
console.log(` ⚠ Column value not found for subitem ${subitem.id}, identifierColumn: ${identifierColumn}`);
|
|
4876
|
-
console.log(` - Available column_values:`, ((_7 = subitem.column_values) === null || _7 === void 0 ? void 0 : _7.map((cv) => cv.id).join(', ')) || 'none');
|
|
4877
|
-
}
|
|
4878
4702
|
}
|
|
4879
4703
|
if (matches) {
|
|
4880
4704
|
foundItemId = subitem.id;
|
|
4881
|
-
foundItemBoardId = ((
|
|
4882
|
-
console.log(
|
|
4705
|
+
foundItemBoardId = ((_6 = subitem.board) === null || _6 === void 0 ? void 0 : _6.id) || null;
|
|
4706
|
+
console.log(`✓ Found subitem with ID: ${foundItemId}, board_id: ${foundItemBoardId}`);
|
|
4883
4707
|
break;
|
|
4884
4708
|
}
|
|
4885
|
-
else {
|
|
4886
|
-
console.log(` ✗ No match for subitem ${subitem.id}`);
|
|
4887
|
-
}
|
|
4888
4709
|
}
|
|
4889
4710
|
}
|
|
4890
4711
|
}
|
|
4891
4712
|
else {
|
|
4892
|
-
|
|
4893
|
-
console.log('🔍 Searching items (not subitems)');
|
|
4894
|
-
console.log(' - useExactSearch:', useExactSearch);
|
|
4895
|
-
console.log(' - columnType:', columnType);
|
|
4896
|
-
console.log(' - isNameColumn:', isNameColumn);
|
|
4897
|
-
let items = [];
|
|
4898
|
-
if (useExactSearch) {
|
|
4899
|
-
console.log(' - Attempting exact search with is_equal operator...');
|
|
4900
|
-
const query = `{
|
|
4713
|
+
const query = `{
|
|
4901
4714
|
boards(ids: [${searchBoardId}]) {
|
|
4902
4715
|
items_page (
|
|
4903
4716
|
limit: ${limit},
|
|
@@ -4905,7 +4718,7 @@ class Worktables {
|
|
|
4905
4718
|
rules: [{
|
|
4906
4719
|
column_id: "${searchColumnId}",
|
|
4907
4720
|
compare_value: "${identifierValue}",
|
|
4908
|
-
operator:
|
|
4721
|
+
operator: ${operator}
|
|
4909
4722
|
}]
|
|
4910
4723
|
}
|
|
4911
4724
|
) {
|
|
@@ -4935,78 +4748,26 @@ class Worktables {
|
|
|
4935
4748
|
}
|
|
4936
4749
|
}
|
|
4937
4750
|
}`;
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
catch (error) {
|
|
4951
|
-
console.log(' ❌ Exact search failed, falling back to fetch all:', error);
|
|
4952
|
-
useExactSearch = false;
|
|
4953
|
-
}
|
|
4954
|
-
}
|
|
4955
|
-
if (!useExactSearch || items.length === 0) {
|
|
4956
|
-
console.log(' - Fetching all items from board for exact matching...');
|
|
4957
|
-
const query = `{
|
|
4958
|
-
boards(ids: [${searchBoardId}]) {
|
|
4959
|
-
items_page(limit: ${limit}) {
|
|
4960
|
-
items {
|
|
4961
|
-
name
|
|
4962
|
-
id
|
|
4963
|
-
url
|
|
4964
|
-
column_values(ids: "${identifierColumn}") {
|
|
4965
|
-
id
|
|
4966
|
-
text
|
|
4967
|
-
type
|
|
4968
|
-
column {
|
|
4969
|
-
id
|
|
4970
|
-
}
|
|
4971
|
-
... on BoardRelationValue {
|
|
4972
|
-
display_value
|
|
4973
|
-
}
|
|
4974
|
-
... on MirrorValue {
|
|
4975
|
-
display_value
|
|
4976
|
-
}
|
|
4977
|
-
... on StatusValue {
|
|
4978
|
-
text
|
|
4979
|
-
index
|
|
4980
|
-
}
|
|
4981
|
-
}
|
|
4982
|
-
}
|
|
4983
|
-
}
|
|
4984
|
-
}
|
|
4985
|
-
}`;
|
|
4986
|
-
const searchResponse = await this.helpers.request({
|
|
4987
|
-
method: 'POST',
|
|
4988
|
-
url: 'https://api.monday.com/v2',
|
|
4989
|
-
headers,
|
|
4990
|
-
body: { query },
|
|
4991
|
-
});
|
|
4992
|
-
const searchData = JSON.parse(searchResponse);
|
|
4993
|
-
const itemsPage = (_14 = (_13 = (_12 = searchData === null || searchData === void 0 ? void 0 : searchData.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;
|
|
4994
|
-
items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4995
|
-
console.log(` ✓ Fetched ${items.length} item(s) from board for exact matching`);
|
|
4996
|
-
}
|
|
4997
|
-
console.log(` - Starting exact comparison on ${items.length} item(s)...`);
|
|
4998
|
-
for (let i = 0; i < items.length; i++) {
|
|
4999
|
-
const item = items[i];
|
|
5000
|
-
console.log(` - Checking item ${i + 1}/${items.length}: ID=${item.id}, name="${item.name}"`);
|
|
4751
|
+
console.log('✅✅✅ Query: ', query);
|
|
4752
|
+
const searchResponse = await this.helpers.request({
|
|
4753
|
+
method: 'POST',
|
|
4754
|
+
url: 'https://api.monday.com/v2',
|
|
4755
|
+
headers,
|
|
4756
|
+
body: { query },
|
|
4757
|
+
});
|
|
4758
|
+
const searchData = JSON.parse(searchResponse);
|
|
4759
|
+
const itemsPage = (_9 = (_8 = (_7 = searchData === null || searchData === void 0 ? void 0 : searchData.data) === null || _7 === void 0 ? void 0 : _7.boards) === null || _8 === void 0 ? void 0 : _8[0]) === null || _9 === void 0 ? void 0 : _9.items_page;
|
|
4760
|
+
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
4761
|
+
console.log(`🔍 Optimized search found ${items.length} item(s) matching identifier`);
|
|
4762
|
+
for (const item of items) {
|
|
5001
4763
|
let matches = false;
|
|
5002
4764
|
if (isNameColumn) {
|
|
5003
4765
|
const searchValue = identifierValue.trim().toLowerCase();
|
|
5004
4766
|
const itemName = (item.name || '').trim().toLowerCase();
|
|
5005
4767
|
matches = itemName === searchValue;
|
|
5006
|
-
console.log(` - Name comparison: "${itemName}" === "${searchValue}" = ${matches}`);
|
|
5007
4768
|
}
|
|
5008
4769
|
else {
|
|
5009
|
-
const colValue = (
|
|
4770
|
+
const colValue = (_10 = item.column_values) === null || _10 === void 0 ? void 0 : _10.find((cv) => cv.id === identifierColumn);
|
|
5010
4771
|
if (colValue) {
|
|
5011
4772
|
const isBoardRelation = colValue.type === 'board_relation' || colValue.type === 'mirror';
|
|
5012
4773
|
const isStatusColumn = colValue.type === 'status';
|
|
@@ -5014,64 +4775,33 @@ class Worktables {
|
|
|
5014
4775
|
? (colValue.display_value || '').trim()
|
|
5015
4776
|
: (colValue.text || '').trim();
|
|
5016
4777
|
const searchValue = identifierValue.trim().toLowerCase();
|
|
5017
|
-
console.log(` - Column type: ${colValue.type}`);
|
|
5018
|
-
console.log(` - Column value found: "${compareValue}"`);
|
|
5019
|
-
console.log(` - Search value: "${identifierValue}"`);
|
|
5020
4778
|
matches = compareValue.toLowerCase() === searchValue;
|
|
5021
|
-
|
|
5022
|
-
if (!matches && isStatusColumn) {
|
|
4779
|
+
if (isStatusColumn && !matches) {
|
|
5023
4780
|
const normalizedCompare = compareValue.toLowerCase().replace(/\s+/g, ' ').trim();
|
|
5024
4781
|
const normalizedSearch = searchValue.replace(/\s+/g, ' ').trim();
|
|
5025
4782
|
matches = normalizedCompare === normalizedSearch;
|
|
5026
|
-
console.log(` - Normalized compare: "${normalizedCompare}" === "${normalizedSearch}" = ${matches}`);
|
|
5027
|
-
}
|
|
5028
|
-
if (matches) {
|
|
5029
|
-
console.log(` ✓✓✓ MATCH FOUND! Item ${item.id}, column type: ${colValue.type}, value: "${compareValue}"`);
|
|
5030
|
-
}
|
|
5031
|
-
else {
|
|
5032
|
-
console.log(` ❌ No match: item ${item.id}, column type: ${colValue.type}, compareValue: "${compareValue}", searchValue: "${identifierValue}"`);
|
|
5033
4783
|
}
|
|
5034
4784
|
}
|
|
5035
|
-
else {
|
|
5036
|
-
console.log(` ⚠ Column value not found for item ${item.id}, identifierColumn: ${identifierColumn}`);
|
|
5037
|
-
console.log(` - Available column_values:`, ((_16 = item.column_values) === null || _16 === void 0 ? void 0 : _16.map((cv) => cv.id).join(', ')) || 'none');
|
|
5038
|
-
}
|
|
5039
4785
|
}
|
|
5040
4786
|
if (matches) {
|
|
5041
4787
|
foundItemId = item.id;
|
|
5042
4788
|
if (isSubitem) {
|
|
5043
4789
|
foundItemBoardId = searchBoardId;
|
|
5044
|
-
console.log(
|
|
4790
|
+
console.log(`✓ Found subitem with ID: ${foundItemId}, board_id: ${foundItemBoardId}`);
|
|
5045
4791
|
}
|
|
5046
4792
|
else {
|
|
5047
|
-
console.log(
|
|
4793
|
+
console.log(`✓ Found item with ID: ${foundItemId}`);
|
|
5048
4794
|
}
|
|
5049
4795
|
break;
|
|
5050
4796
|
}
|
|
5051
|
-
else {
|
|
5052
|
-
console.log(` ✗ No match for item ${item.id}`);
|
|
5053
|
-
}
|
|
5054
|
-
}
|
|
5055
|
-
if (!foundItemId) {
|
|
5056
|
-
console.log(` ❌❌❌ No exact match found for identifier column "${identifierColumn}" with value "${identifierValue}"`);
|
|
5057
4797
|
}
|
|
5058
4798
|
}
|
|
5059
|
-
console.log('═══════════════════════════════════════════════════════════');
|
|
5060
|
-
console.log('📊 SEARCH RESULT:');
|
|
5061
|
-
console.log(' - foundItemId:', foundItemId || 'null (not found)');
|
|
5062
|
-
console.log(' - foundItemBoardId:', foundItemBoardId || 'null');
|
|
5063
|
-
console.log('═══════════════════════════════════════════════════════════');
|
|
5064
4799
|
if (foundItemId) {
|
|
5065
|
-
console.log(
|
|
4800
|
+
console.log(`Found existing ${isSubitem ? 'subitem' : 'item'}, updating:`, foundItemId);
|
|
5066
4801
|
const escapedColumnValues = (0, worktablesHelpers_1.escapeGraphQLJSONString)(column_values_object);
|
|
5067
4802
|
const updateBoardId = (isSubitem && foundItemBoardId) ? foundItemBoardId : boardId;
|
|
5068
|
-
console.log('═══════════════════════════════════════════════════════════');
|
|
5069
|
-
console.log('🔄 UPDATE OPERATION:');
|
|
5070
|
-
console.log(' - updateBoardId:', updateBoardId);
|
|
5071
|
-
console.log(' - foundItemId:', foundItemId);
|
|
5072
|
-
console.log(' - column_values_object:', JSON.stringify(column_values_object, null, 2));
|
|
5073
4803
|
if (isSubitem && !foundItemBoardId) {
|
|
5074
|
-
console.log(
|
|
4804
|
+
console.log(`⚠ Warning: Subitem board_id not found, using main board_id ${boardId}. This may cause errors.`);
|
|
5075
4805
|
}
|
|
5076
4806
|
mutation = `mutation {
|
|
5077
4807
|
change_multiple_column_values(
|
|
@@ -5087,8 +4817,7 @@ class Worktables {
|
|
|
5087
4817
|
}
|
|
5088
4818
|
}
|
|
5089
4819
|
}`;
|
|
5090
|
-
console.log('
|
|
5091
|
-
console.log(' - Sending update request...');
|
|
4820
|
+
console.log('Generated Update Mutation:', mutation);
|
|
5092
4821
|
response = await this.helpers.request({
|
|
5093
4822
|
method: 'POST',
|
|
5094
4823
|
url: 'https://api.monday.com/v2',
|
|
@@ -5096,7 +4825,6 @@ class Worktables {
|
|
|
5096
4825
|
body: { query: mutation },
|
|
5097
4826
|
});
|
|
5098
4827
|
const responseData = JSON.parse(response);
|
|
5099
|
-
console.log(' - Update response received:', JSON.stringify(responseData, null, 2));
|
|
5100
4828
|
if (!responseData.errors && responseData.data && responseData.data.change_multiple_column_values) {
|
|
5101
4829
|
const itemData = responseData.data.change_multiple_column_values;
|
|
5102
4830
|
if (itemData && itemData.id) {
|
|
@@ -5104,26 +4832,23 @@ class Worktables {
|
|
|
5104
4832
|
id: itemData.id,
|
|
5105
4833
|
url: itemData.url || '',
|
|
5106
4834
|
operation: 'update',
|
|
5107
|
-
board_id: ((
|
|
4835
|
+
board_id: ((_11 = itemData.board) === null || _11 === void 0 ? void 0 : _11.id) || boardId,
|
|
5108
4836
|
column_values: column_values_object,
|
|
5109
4837
|
};
|
|
5110
4838
|
itemUpdated = true;
|
|
5111
|
-
console.log(`
|
|
5112
|
-
console.log('═══════════════════════════════════════════════════════════');
|
|
4839
|
+
console.log(`Successfully updated ${isSubitem ? 'subitem' : 'item'}:`, itemData.id);
|
|
5113
4840
|
}
|
|
5114
4841
|
else {
|
|
5115
|
-
console.log(`
|
|
5116
|
-
console.log(' - itemData:', JSON.stringify(itemData, null, 2));
|
|
4842
|
+
console.log(`Update response missing item data, will create new ${isSubitem ? 'subitem' : 'item'} instead`);
|
|
5117
4843
|
itemUpdated = false;
|
|
5118
4844
|
}
|
|
5119
4845
|
}
|
|
5120
4846
|
else {
|
|
5121
4847
|
if (responseData.errors) {
|
|
5122
|
-
console.log('
|
|
4848
|
+
console.log('Error updating item:', JSON.stringify(responseData.errors));
|
|
5123
4849
|
}
|
|
5124
4850
|
else {
|
|
5125
|
-
console.log('
|
|
5126
|
-
console.log(' - responseData.data:', JSON.stringify(responseData.data, null, 2));
|
|
4851
|
+
console.log('Update response missing data, will create new item instead');
|
|
5127
4852
|
}
|
|
5128
4853
|
itemUpdated = false;
|
|
5129
4854
|
}
|
|
@@ -5137,15 +4862,11 @@ class Worktables {
|
|
|
5137
4862
|
}
|
|
5138
4863
|
}
|
|
5139
4864
|
else {
|
|
5140
|
-
console.log('
|
|
5141
|
-
console.log('ℹ️ No identifier provided, will create new item');
|
|
5142
|
-
console.log('═══════════════════════════════════════════════════════════');
|
|
4865
|
+
console.log('No identifier provided, will create new item');
|
|
5143
4866
|
itemUpdated = false;
|
|
5144
4867
|
}
|
|
5145
4868
|
if (!itemUpdated) {
|
|
5146
|
-
console.log('
|
|
5147
|
-
console.log(`➕ CREATING NEW ${isSubitem ? 'SUBITEM' : 'ITEM'}:`, itemName);
|
|
5148
|
-
console.log('═══════════════════════════════════════════════════════════');
|
|
4869
|
+
console.log(`Creating new ${isSubitem ? 'subitem' : 'item'}:`, itemName);
|
|
5149
4870
|
const parentId = this.getNodeParameter('parentId', 0, false);
|
|
5150
4871
|
if (isSubitem && !parentId) {
|
|
5151
4872
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
@@ -5189,8 +4910,6 @@ class Worktables {
|
|
|
5189
4910
|
}
|
|
5190
4911
|
}`;
|
|
5191
4912
|
}
|
|
5192
|
-
console.log(' - Generated Create Mutation:', mutation);
|
|
5193
|
-
console.log(' - Sending create request...');
|
|
5194
4913
|
response = await this.helpers.request({
|
|
5195
4914
|
method: 'POST',
|
|
5196
4915
|
url: 'https://api.monday.com/v2',
|
|
@@ -5198,30 +4917,25 @@ class Worktables {
|
|
|
5198
4917
|
body: { query: mutation },
|
|
5199
4918
|
});
|
|
5200
4919
|
const responseData = JSON.parse(response);
|
|
5201
|
-
console.log(' - Create response received:', JSON.stringify(responseData, null, 2));
|
|
5202
4920
|
if (responseData.errors) {
|
|
5203
|
-
console.log(' ❌ Error creating item:', JSON.stringify(responseData.errors, null, 2));
|
|
5204
4921
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5205
4922
|
message: `Error creating ${isSubitem ? 'subitem' : 'item'}: ${JSON.stringify(responseData.errors)}`,
|
|
5206
4923
|
});
|
|
5207
4924
|
}
|
|
5208
4925
|
const itemData = isSubitem && parentId
|
|
5209
|
-
? (
|
|
5210
|
-
: (
|
|
4926
|
+
? (_12 = responseData.data) === null || _12 === void 0 ? void 0 : _12.create_subitem
|
|
4927
|
+
: (_13 = responseData.data) === null || _13 === void 0 ? void 0 : _13.create_item;
|
|
5211
4928
|
if (!itemData || !itemData.id) {
|
|
5212
|
-
console.log(' ❌ No item data returned in response');
|
|
5213
4929
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5214
4930
|
message: `Error creating ${isSubitem ? 'subitem' : 'item'}: No item data returned`,
|
|
5215
4931
|
});
|
|
5216
4932
|
}
|
|
5217
|
-
console.log(` ✓✓✓ Successfully created ${isSubitem ? 'subitem' : 'item'}:`, itemData.id);
|
|
5218
|
-
console.log('═══════════════════════════════════════════════════════════');
|
|
5219
4933
|
formatted = {
|
|
5220
4934
|
id: itemData.id,
|
|
5221
4935
|
name: itemData.name || itemName,
|
|
5222
4936
|
url: itemData.url || '',
|
|
5223
4937
|
operation: 'create',
|
|
5224
|
-
board_id: ((
|
|
4938
|
+
board_id: ((_14 = itemData.board) === null || _14 === void 0 ? void 0 : _14.id) || boardId,
|
|
5225
4939
|
column_values: column_values_object,
|
|
5226
4940
|
};
|
|
5227
4941
|
if (isSubitem && parentId) {
|
|
@@ -5262,12 +4976,12 @@ class Worktables {
|
|
|
5262
4976
|
if (itemParsed.errors) {
|
|
5263
4977
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: JSON.stringify(itemParsed.errors) });
|
|
5264
4978
|
}
|
|
5265
|
-
const items = ((
|
|
4979
|
+
const items = ((_15 = itemParsed === null || itemParsed === void 0 ? void 0 : itemParsed.data) === null || _15 === void 0 ? void 0 : _15.items) || [];
|
|
5266
4980
|
if (items.length === 0) {
|
|
5267
4981
|
return [[{ json: { item_id: itemId, activity_logs: [] } }]];
|
|
5268
4982
|
}
|
|
5269
4983
|
const item = items[0];
|
|
5270
|
-
const boardId = (
|
|
4984
|
+
const boardId = (_16 = item.board) === null || _16 === void 0 ? void 0 : _16.id;
|
|
5271
4985
|
if (!boardId) {
|
|
5272
4986
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'Could not retrieve board ID for the item.' });
|
|
5273
4987
|
}
|
|
@@ -5305,7 +5019,7 @@ class Worktables {
|
|
|
5305
5019
|
if (parsed.errors) {
|
|
5306
5020
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: JSON.stringify(parsed.errors) });
|
|
5307
5021
|
}
|
|
5308
|
-
const boards = ((
|
|
5022
|
+
const boards = ((_17 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _17 === void 0 ? void 0 : _17.boards) || [];
|
|
5309
5023
|
const activityLogs = boards.length > 0 ? (boards[0].activity_logs || []) : [];
|
|
5310
5024
|
const formatted = {
|
|
5311
5025
|
item_id: item.id,
|
|
@@ -5464,7 +5178,7 @@ class Worktables {
|
|
|
5464
5178
|
body: { query },
|
|
5465
5179
|
});
|
|
5466
5180
|
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
5467
|
-
const itemsPage = (
|
|
5181
|
+
const itemsPage = (_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.items_page;
|
|
5468
5182
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5469
5183
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
5470
5184
|
allItems = allItems.concat(items);
|
|
@@ -5543,7 +5257,7 @@ class Worktables {
|
|
|
5543
5257
|
const sortOptions = this.getNodeParameter('sortOptions', 0, { sortBy: [] });
|
|
5544
5258
|
const logicalOperator = this.getNodeParameter('logicalOperator', 0);
|
|
5545
5259
|
let rulesArray = [];
|
|
5546
|
-
if (((
|
|
5260
|
+
if (((_21 = filterRules === null || filterRules === void 0 ? void 0 : filterRules.rule) === null || _21 === void 0 ? void 0 : _21.length) > 0) {
|
|
5547
5261
|
rulesArray = filterRules.rule.map((rule) => {
|
|
5548
5262
|
let formattedValue;
|
|
5549
5263
|
if (['is_empty', 'is_not_empty'].includes(rule.operator)) {
|
|
@@ -5587,7 +5301,7 @@ class Worktables {
|
|
|
5587
5301
|
});
|
|
5588
5302
|
}
|
|
5589
5303
|
const orderByArray = [];
|
|
5590
|
-
if (((
|
|
5304
|
+
if (((_22 = sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sortBy) === null || _22 === void 0 ? void 0 : _22.length) > 0) {
|
|
5591
5305
|
sortOptions.sortBy.forEach((sort) => {
|
|
5592
5306
|
orderByArray.push(`{
|
|
5593
5307
|
column_id: "${sort.columnId}",
|
|
@@ -5643,7 +5357,7 @@ class Worktables {
|
|
|
5643
5357
|
body: { query },
|
|
5644
5358
|
});
|
|
5645
5359
|
const parsed = JSON.parse(rawResponse);
|
|
5646
|
-
const items = ((
|
|
5360
|
+
const items = ((_26 = (_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) === null || _26 === void 0 ? void 0 : _26.items) || [];
|
|
5647
5361
|
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5648
5362
|
const formatted = {
|
|
5649
5363
|
id: item.id,
|
|
@@ -5677,7 +5391,7 @@ class Worktables {
|
|
|
5677
5391
|
const advancedSortOptions = this.getNodeParameter('advancedSortOptions', 0, { sortBy: [] });
|
|
5678
5392
|
const logicalOperator = this.getNodeParameter('logicalOperatorAdvanced', 0);
|
|
5679
5393
|
let rulesArray = [];
|
|
5680
|
-
if (((
|
|
5394
|
+
if (((_27 = advancedFilterRules === null || advancedFilterRules === void 0 ? void 0 : advancedFilterRules.rule) === null || _27 === void 0 ? void 0 : _27.length) > 0) {
|
|
5681
5395
|
console.log('Processing filter rules:', advancedFilterRules.rule);
|
|
5682
5396
|
rulesArray = advancedFilterRules.rule.map((rule) => {
|
|
5683
5397
|
let formattedValue;
|
|
@@ -5893,7 +5607,7 @@ class Worktables {
|
|
|
5893
5607
|
});
|
|
5894
5608
|
}
|
|
5895
5609
|
const orderByArray = [];
|
|
5896
|
-
if (((
|
|
5610
|
+
if (((_28 = advancedSortOptions === null || advancedSortOptions === void 0 ? void 0 : advancedSortOptions.sortBy) === null || _28 === void 0 ? void 0 : _28.length) > 0) {
|
|
5897
5611
|
advancedSortOptions.sortBy.forEach((sort) => {
|
|
5898
5612
|
orderByArray.push(`{
|
|
5899
5613
|
column_id: "${sort.columnId}",
|
|
@@ -5975,7 +5689,7 @@ class Worktables {
|
|
|
5975
5689
|
body: { query: testQuery },
|
|
5976
5690
|
});
|
|
5977
5691
|
const testParsed = JSON.parse(testResponse);
|
|
5978
|
-
const testItems = ((
|
|
5692
|
+
const testItems = ((_32 = (_31 = (_30 = (_29 = testParsed === null || testParsed === void 0 ? void 0 : testParsed.data) === null || _29 === void 0 ? void 0 : _29.boards) === null || _30 === void 0 ? void 0 : _30[0]) === null || _31 === void 0 ? void 0 : _31.items_page) === null || _32 === void 0 ? void 0 : _32.items) || [];
|
|
5979
5693
|
console.log('Test - Items in board (no filters):', testItems.length);
|
|
5980
5694
|
if (testItems.length > 0) {
|
|
5981
5695
|
console.log('Sample item column values:', testItems[0].column_values);
|
|
@@ -5987,7 +5701,7 @@ class Worktables {
|
|
|
5987
5701
|
body: { query },
|
|
5988
5702
|
});
|
|
5989
5703
|
const parsed = JSON.parse(rawResponse);
|
|
5990
|
-
const itemsPage = (
|
|
5704
|
+
const itemsPage = (_35 = (_34 = (_33 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _33 === void 0 ? void 0 : _33.boards) === null || _34 === void 0 ? void 0 : _34[0]) === null || _35 === void 0 ? void 0 : _35.items_page;
|
|
5991
5705
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
5992
5706
|
const nextCursor = itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor;
|
|
5993
5707
|
const hasMore = nextCursor ? true : false;
|
|
@@ -6169,7 +5883,7 @@ class Worktables {
|
|
|
6169
5883
|
body: { query },
|
|
6170
5884
|
});
|
|
6171
5885
|
const parsed = JSON.parse(rawResponse);
|
|
6172
|
-
const itemsPage = (
|
|
5886
|
+
const itemsPage = (_40 = (_39 = (_38 = (_37 = (_36 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _36 === void 0 ? void 0 : _36.boards) === null || _37 === void 0 ? void 0 : _37[0]) === null || _38 === void 0 ? void 0 : _38.groups) === null || _39 === void 0 ? void 0 : _39[0]) === null || _40 === void 0 ? void 0 : _40.items_page;
|
|
6173
5887
|
const items = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.items) || [];
|
|
6174
5888
|
cursor = (itemsPage === null || itemsPage === void 0 ? void 0 : itemsPage.cursor) || null;
|
|
6175
5889
|
allItems = allItems.concat(items);
|
|
@@ -6266,7 +5980,7 @@ class Worktables {
|
|
|
6266
5980
|
response = await (0, isErrorResponse_1.parseApiResponse)(response);
|
|
6267
5981
|
if (response.success) {
|
|
6268
5982
|
const parsed = JSON.parse(response.data);
|
|
6269
|
-
const updates = ((
|
|
5983
|
+
const updates = ((_43 = (_42 = (_41 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _41 === void 0 ? void 0 : _41.items) === null || _42 === void 0 ? void 0 : _42[0]) === null || _43 === void 0 ? void 0 : _43.updates) || [];
|
|
6270
5984
|
const formattedUpdates = updates.map((update) => {
|
|
6271
5985
|
const pinnedToTop = update.pinned_to_top || [];
|
|
6272
5986
|
const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
|
|
@@ -6331,7 +6045,7 @@ class Worktables {
|
|
|
6331
6045
|
console.log('variables:', variables);
|
|
6332
6046
|
response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
|
|
6333
6047
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
6334
|
-
const updateId = (
|
|
6048
|
+
const updateId = (_45 = (_44 = JSON.parse(response).data) === null || _44 === void 0 ? void 0 : _44.create_update) === null || _45 === void 0 ? void 0 : _45.id;
|
|
6335
6049
|
if (!updateId) {
|
|
6336
6050
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
6337
6051
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -6640,7 +6354,7 @@ class Worktables {
|
|
|
6640
6354
|
body: { query },
|
|
6641
6355
|
json: true,
|
|
6642
6356
|
});
|
|
6643
|
-
const asset = (
|
|
6357
|
+
const asset = (_47 = (_46 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _46 === void 0 ? void 0 : _46.assets) === null || _47 === void 0 ? void 0 : _47[0];
|
|
6644
6358
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
6645
6359
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
6646
6360
|
message: 'Public URL not found for the given file ID.',
|