@worktables/n8n-nodes-worktables-staging 1.0.14 → 1.0.16
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.
|
@@ -139,10 +139,10 @@ class Worktables {
|
|
|
139
139
|
action: 'Duplicate a board',
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
|
-
name: 'List
|
|
142
|
+
name: 'List Activity Logs',
|
|
143
143
|
value: 'listBoardActivityLogs',
|
|
144
|
-
description: 'Retrieve activity logs of a board',
|
|
145
|
-
action: 'List
|
|
144
|
+
description: 'Retrieve activity logs of a board with optional filters',
|
|
145
|
+
action: 'List activity logs',
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
148
|
name: 'List Board Subscribers',
|
|
@@ -278,10 +278,9 @@ class Worktables {
|
|
|
278
278
|
noDataExpression: true,
|
|
279
279
|
options: [
|
|
280
280
|
{
|
|
281
|
-
name: 'List',
|
|
281
|
+
name: 'List Updates in an Item',
|
|
282
282
|
value: 'listUpdates',
|
|
283
|
-
|
|
284
|
-
action: 'Get an update',
|
|
283
|
+
action: 'List updates in an item',
|
|
285
284
|
},
|
|
286
285
|
{
|
|
287
286
|
name: 'Create',
|
|
@@ -966,6 +965,52 @@ class Worktables {
|
|
|
966
965
|
show: { operation: ['listBoardActivityLogs', 'getItemActivityLogs'] },
|
|
967
966
|
},
|
|
968
967
|
},
|
|
968
|
+
{
|
|
969
|
+
displayName: 'Item IDs',
|
|
970
|
+
name: 'itemIds',
|
|
971
|
+
type: 'string',
|
|
972
|
+
default: '',
|
|
973
|
+
placeholder: '123456789, 987654321',
|
|
974
|
+
description: 'Comma-separated list of item IDs to filter activity logs',
|
|
975
|
+
displayOptions: {
|
|
976
|
+
show: { operation: ['listBoardActivityLogs'] },
|
|
977
|
+
},
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
displayName: 'Column IDs',
|
|
981
|
+
name: 'columnIdsFilter',
|
|
982
|
+
type: 'string',
|
|
983
|
+
default: '',
|
|
984
|
+
placeholder: 'status, person, date',
|
|
985
|
+
description: 'Comma-separated list of column IDs to filter activity logs',
|
|
986
|
+
displayOptions: {
|
|
987
|
+
show: { operation: ['listBoardActivityLogs'] },
|
|
988
|
+
},
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
displayName: 'Group IDs',
|
|
992
|
+
name: 'groupIdsFilter',
|
|
993
|
+
type: 'string',
|
|
994
|
+
default: '',
|
|
995
|
+
placeholder: 'new_group, topics',
|
|
996
|
+
description: 'Comma-separated list of group IDs to filter activity logs',
|
|
997
|
+
displayOptions: {
|
|
998
|
+
show: { operation: ['listBoardActivityLogs'] },
|
|
999
|
+
},
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
displayName: 'User IDs',
|
|
1003
|
+
name: 'userIdsFilter',
|
|
1004
|
+
type: 'multiOptions',
|
|
1005
|
+
typeOptions: {
|
|
1006
|
+
loadOptionsMethod: 'getUsers',
|
|
1007
|
+
},
|
|
1008
|
+
default: [],
|
|
1009
|
+
description: 'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
|
1010
|
+
displayOptions: {
|
|
1011
|
+
show: { operation: ['listBoardActivityLogs'] },
|
|
1012
|
+
},
|
|
1013
|
+
},
|
|
969
1014
|
{
|
|
970
1015
|
displayName: 'Archived',
|
|
971
1016
|
name: 'archiveGroup',
|
|
@@ -1118,6 +1163,45 @@ class Worktables {
|
|
|
1118
1163
|
},
|
|
1119
1164
|
},
|
|
1120
1165
|
},
|
|
1166
|
+
{
|
|
1167
|
+
displayName: 'Limit',
|
|
1168
|
+
name: 'limit',
|
|
1169
|
+
type: 'number',
|
|
1170
|
+
default: 50,
|
|
1171
|
+
description: 'Max number of results to return',
|
|
1172
|
+
displayOptions: {
|
|
1173
|
+
show: {
|
|
1174
|
+
operation: ['listUpdates'],
|
|
1175
|
+
},
|
|
1176
|
+
},
|
|
1177
|
+
typeOptions: {
|
|
1178
|
+
minValue: 0,
|
|
1179
|
+
},
|
|
1180
|
+
},
|
|
1181
|
+
{
|
|
1182
|
+
displayName: 'From Date',
|
|
1183
|
+
name: 'fromDate',
|
|
1184
|
+
type: 'dateTime',
|
|
1185
|
+
default: '',
|
|
1186
|
+
description: 'Filter updates created on or after this date',
|
|
1187
|
+
displayOptions: {
|
|
1188
|
+
show: {
|
|
1189
|
+
operation: ['listUpdates'],
|
|
1190
|
+
},
|
|
1191
|
+
},
|
|
1192
|
+
},
|
|
1193
|
+
{
|
|
1194
|
+
displayName: 'To Date',
|
|
1195
|
+
name: 'toDate',
|
|
1196
|
+
type: 'dateTime',
|
|
1197
|
+
default: '',
|
|
1198
|
+
description: 'Filter updates created on or before this date',
|
|
1199
|
+
displayOptions: {
|
|
1200
|
+
show: {
|
|
1201
|
+
operation: ['listUpdates'],
|
|
1202
|
+
},
|
|
1203
|
+
},
|
|
1204
|
+
},
|
|
1121
1205
|
{
|
|
1122
1206
|
displayName: 'Board',
|
|
1123
1207
|
name: 'boardId',
|
|
@@ -1722,7 +1806,7 @@ class Worktables {
|
|
|
1722
1806
|
description: 'Whether to fetch column values',
|
|
1723
1807
|
displayOptions: {
|
|
1724
1808
|
show: {
|
|
1725
|
-
operation: ['searchItems'
|
|
1809
|
+
operation: ['searchItems'],
|
|
1726
1810
|
},
|
|
1727
1811
|
},
|
|
1728
1812
|
},
|
|
@@ -1734,7 +1818,7 @@ class Worktables {
|
|
|
1734
1818
|
description: 'When true, returns all columns; otherwise, only specified Column IDs',
|
|
1735
1819
|
displayOptions: {
|
|
1736
1820
|
show: {
|
|
1737
|
-
operation: ['searchItems'
|
|
1821
|
+
operation: ['searchItems'],
|
|
1738
1822
|
fetchColumnValues: [true],
|
|
1739
1823
|
},
|
|
1740
1824
|
},
|
|
@@ -1748,12 +1832,38 @@ class Worktables {
|
|
|
1748
1832
|
description: 'Comma-separated column IDs to fetch. Leave empty to fetch all columns.',
|
|
1749
1833
|
displayOptions: {
|
|
1750
1834
|
show: {
|
|
1751
|
-
operation: ['searchItems'
|
|
1835
|
+
operation: ['searchItems'],
|
|
1752
1836
|
fetchColumnValues: [true],
|
|
1753
1837
|
fetchAllColumns: [false],
|
|
1754
1838
|
},
|
|
1755
1839
|
},
|
|
1756
1840
|
},
|
|
1841
|
+
{
|
|
1842
|
+
displayName: 'Fetch All Columns',
|
|
1843
|
+
name: 'fetchAllColumns',
|
|
1844
|
+
type: 'boolean',
|
|
1845
|
+
default: true,
|
|
1846
|
+
description: 'When true, returns all columns; otherwise, only specified Column IDs',
|
|
1847
|
+
displayOptions: {
|
|
1848
|
+
show: {
|
|
1849
|
+
operation: ['listBoardItems', 'listGroupItems'],
|
|
1850
|
+
},
|
|
1851
|
+
},
|
|
1852
|
+
},
|
|
1853
|
+
{
|
|
1854
|
+
displayName: 'Column IDs',
|
|
1855
|
+
name: 'columnIds',
|
|
1856
|
+
type: 'string',
|
|
1857
|
+
default: '',
|
|
1858
|
+
placeholder: 'status,owner,date',
|
|
1859
|
+
description: 'Comma-separated column IDs to fetch. Leave empty to fetch all columns.',
|
|
1860
|
+
displayOptions: {
|
|
1861
|
+
show: {
|
|
1862
|
+
operation: ['listBoardItems', 'listGroupItems'],
|
|
1863
|
+
fetchAllColumns: [false],
|
|
1864
|
+
},
|
|
1865
|
+
},
|
|
1866
|
+
},
|
|
1757
1867
|
{
|
|
1758
1868
|
displayName: 'Limit',
|
|
1759
1869
|
name: 'limit',
|
|
@@ -3748,14 +3858,46 @@ class Worktables {
|
|
|
3748
3858
|
}
|
|
3749
3859
|
case 'listBoardActivityLogs': {
|
|
3750
3860
|
const boardId = this.getNodeParameter('boardId', 0);
|
|
3751
|
-
const from = this.getNodeParameter('from', 0);
|
|
3752
|
-
const to = this.getNodeParameter('to', 0);
|
|
3753
|
-
|
|
3754
|
-
|
|
3861
|
+
const from = this.getNodeParameter('from', 0, '');
|
|
3862
|
+
const to = this.getNodeParameter('to', 0, '');
|
|
3863
|
+
const itemIdsRaw = this.getNodeParameter('itemIds', 0, '');
|
|
3864
|
+
const columnIdsRaw = this.getNodeParameter('columnIdsFilter', 0, '');
|
|
3865
|
+
const groupIdsRaw = this.getNodeParameter('groupIdsFilter', 0, '');
|
|
3866
|
+
const userIdsFilter = this.getNodeParameter('userIdsFilter', 0, []);
|
|
3867
|
+
const params = [];
|
|
3868
|
+
if (from) {
|
|
3869
|
+
params.push(`from: "${from}Z"`);
|
|
3870
|
+
}
|
|
3871
|
+
if (to) {
|
|
3872
|
+
params.push(`to: "${to}Z"`);
|
|
3873
|
+
}
|
|
3874
|
+
if (itemIdsRaw && itemIdsRaw.trim()) {
|
|
3875
|
+
const itemIds = itemIdsRaw.split(',').map(id => `"${id.trim()}"`).filter(id => id !== '""');
|
|
3876
|
+
if (itemIds.length > 0) {
|
|
3877
|
+
params.push(`item_ids: [${itemIds.join(', ')}]`);
|
|
3878
|
+
}
|
|
3879
|
+
}
|
|
3880
|
+
if (columnIdsRaw && columnIdsRaw.trim()) {
|
|
3881
|
+
const columnIds = columnIdsRaw.split(',').map(id => `"${id.trim()}"`).filter(id => id !== '""');
|
|
3882
|
+
if (columnIds.length > 0) {
|
|
3883
|
+
params.push(`column_ids: [${columnIds.join(', ')}]`);
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
if (groupIdsRaw && groupIdsRaw.trim()) {
|
|
3887
|
+
const groupIds = groupIdsRaw.split(',').map(id => `"${id.trim()}"`).filter(id => id !== '""');
|
|
3888
|
+
if (groupIds.length > 0) {
|
|
3889
|
+
params.push(`group_ids: [${groupIds.join(', ')}]`);
|
|
3890
|
+
}
|
|
3891
|
+
}
|
|
3892
|
+
if (userIdsFilter && userIdsFilter.length > 0) {
|
|
3893
|
+
const userIds = userIdsFilter.map(id => `"${id}"`);
|
|
3894
|
+
params.push(`user_ids: [${userIds.join(', ')}]`);
|
|
3895
|
+
}
|
|
3896
|
+
const paramsString = params.length > 0 ? `(${params.join(', ')})` : '';
|
|
3755
3897
|
const query = `
|
|
3756
3898
|
query {
|
|
3757
3899
|
boards(ids: [${boardId}]) {
|
|
3758
|
-
activity_logs
|
|
3900
|
+
activity_logs${paramsString} {
|
|
3759
3901
|
id
|
|
3760
3902
|
user_id
|
|
3761
3903
|
entity
|
|
@@ -3765,8 +3907,8 @@ class Worktables {
|
|
|
3765
3907
|
}
|
|
3766
3908
|
}
|
|
3767
3909
|
}
|
|
3768
|
-
|
|
3769
|
-
console.log('Query: ', query);
|
|
3910
|
+
`;
|
|
3911
|
+
console.log('Activity Logs Query: ', query);
|
|
3770
3912
|
response = await this.helpers.request({
|
|
3771
3913
|
method: 'POST',
|
|
3772
3914
|
url: 'https://api.monday.com/v2',
|
|
@@ -5278,17 +5420,46 @@ class Worktables {
|
|
|
5278
5420
|
console.log('List items in a board');
|
|
5279
5421
|
const boardId = this.getNodeParameter('boardId', 0);
|
|
5280
5422
|
const limit = this.getNodeParameter('limit', 0);
|
|
5281
|
-
const fetchColumnValues = this.getNodeParameter('fetchColumnValues', 0, false);
|
|
5282
5423
|
const fetchAllColumns = this.getNodeParameter('fetchAllColumns', 0, true);
|
|
5283
5424
|
const columnIdsRaw = this.getNodeParameter('columnIds', 0, '');
|
|
5284
5425
|
if (!boardId) {
|
|
5285
5426
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'Board ID is required.' });
|
|
5286
5427
|
}
|
|
5287
5428
|
let queryColumnValues = '';
|
|
5288
|
-
if (
|
|
5289
|
-
|
|
5429
|
+
if (fetchAllColumns) {
|
|
5430
|
+
queryColumnValues = `
|
|
5431
|
+
column_values {
|
|
5432
|
+
id
|
|
5433
|
+
text
|
|
5434
|
+
value
|
|
5435
|
+
type
|
|
5436
|
+
... on BoardRelationValue {
|
|
5437
|
+
display_value
|
|
5438
|
+
linked_item_ids
|
|
5439
|
+
}
|
|
5440
|
+
... on MirrorValue {
|
|
5441
|
+
display_value
|
|
5442
|
+
mirrored_items {
|
|
5443
|
+
linked_board_id
|
|
5444
|
+
}
|
|
5445
|
+
}
|
|
5446
|
+
... on DependencyValue {
|
|
5447
|
+
display_value
|
|
5448
|
+
linked_item_ids
|
|
5449
|
+
linked_items {
|
|
5450
|
+
id
|
|
5451
|
+
name
|
|
5452
|
+
}
|
|
5453
|
+
}
|
|
5454
|
+
}
|
|
5455
|
+
`;
|
|
5456
|
+
}
|
|
5457
|
+
else if (columnIdsRaw && columnIdsRaw.trim()) {
|
|
5458
|
+
const specificColumnIds = columnIdsRaw.split(',').map(id => id.trim()).filter(id => id);
|
|
5459
|
+
if (specificColumnIds.length > 0) {
|
|
5460
|
+
const columnIdsString = specificColumnIds.map(id => `"${id}"`).join(', ');
|
|
5290
5461
|
queryColumnValues = `
|
|
5291
|
-
column_values {
|
|
5462
|
+
column_values(ids: [${columnIdsString}]) {
|
|
5292
5463
|
id
|
|
5293
5464
|
text
|
|
5294
5465
|
value
|
|
@@ -5314,40 +5485,8 @@ class Worktables {
|
|
|
5314
5485
|
}
|
|
5315
5486
|
`;
|
|
5316
5487
|
}
|
|
5317
|
-
else if (columnIdsRaw && columnIdsRaw.trim()) {
|
|
5318
|
-
const specificColumnIds = columnIdsRaw.split(',').map(id => id.trim()).filter(id => id);
|
|
5319
|
-
if (specificColumnIds.length > 0) {
|
|
5320
|
-
const columnIdsString = specificColumnIds.map(id => `"${id}"`).join(', ');
|
|
5321
|
-
queryColumnValues = `
|
|
5322
|
-
column_values(ids: [${columnIdsString}]) {
|
|
5323
|
-
id
|
|
5324
|
-
text
|
|
5325
|
-
value
|
|
5326
|
-
type
|
|
5327
|
-
... on BoardRelationValue {
|
|
5328
|
-
display_value
|
|
5329
|
-
linked_item_ids
|
|
5330
|
-
}
|
|
5331
|
-
... on MirrorValue {
|
|
5332
|
-
display_value
|
|
5333
|
-
mirrored_items {
|
|
5334
|
-
linked_board_id
|
|
5335
|
-
}
|
|
5336
|
-
}
|
|
5337
|
-
... on DependencyValue {
|
|
5338
|
-
display_value
|
|
5339
|
-
linked_item_ids
|
|
5340
|
-
linked_items {
|
|
5341
|
-
id
|
|
5342
|
-
name
|
|
5343
|
-
}
|
|
5344
|
-
}
|
|
5345
|
-
}
|
|
5346
|
-
`;
|
|
5347
|
-
}
|
|
5348
|
-
}
|
|
5349
5488
|
}
|
|
5350
|
-
const querySubitems =
|
|
5489
|
+
const querySubitems = `
|
|
5351
5490
|
subitems {
|
|
5352
5491
|
id
|
|
5353
5492
|
name
|
|
@@ -5359,7 +5498,7 @@ class Worktables {
|
|
|
5359
5498
|
updated_at
|
|
5360
5499
|
${queryColumnValues}
|
|
5361
5500
|
}
|
|
5362
|
-
|
|
5501
|
+
`;
|
|
5363
5502
|
let allItems = [];
|
|
5364
5503
|
let cursor = null;
|
|
5365
5504
|
const pageLimit = 100;
|
|
@@ -5438,24 +5577,22 @@ class Worktables {
|
|
|
5438
5577
|
color: item.group.color,
|
|
5439
5578
|
position: item.group.position,
|
|
5440
5579
|
} : undefined,
|
|
5441
|
-
column_values:
|
|
5580
|
+
column_values: {},
|
|
5442
5581
|
};
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
formatted.column_values[col.id] = formattedCol;
|
|
5455
|
-
}
|
|
5582
|
+
for (const col of columnValues) {
|
|
5583
|
+
if (col.type === 'subtasks' ||
|
|
5584
|
+
col.type === 'formula' ||
|
|
5585
|
+
col.type === 'auto_number' ||
|
|
5586
|
+
col.type === 'creation_log' ||
|
|
5587
|
+
col.type === 'last_updated') {
|
|
5588
|
+
continue;
|
|
5589
|
+
}
|
|
5590
|
+
const formattedCol = await (0, worktablesHelpers_1.formatColumnValue)(col);
|
|
5591
|
+
if (formattedCol) {
|
|
5592
|
+
formatted.column_values[col.id] = formattedCol;
|
|
5456
5593
|
}
|
|
5457
5594
|
}
|
|
5458
|
-
if (
|
|
5595
|
+
if (item.subitems && Array.isArray(item.subitems)) {
|
|
5459
5596
|
formatted.subitems = await Promise.all(item.subitems.map(async (subitem) => {
|
|
5460
5597
|
const subFormatted = {
|
|
5461
5598
|
id: subitem.id,
|
|
@@ -6102,7 +6239,6 @@ class Worktables {
|
|
|
6102
6239
|
const boardId = this.getNodeParameter('boardId', 0);
|
|
6103
6240
|
const groupId = this.getNodeParameter('groupId', 0);
|
|
6104
6241
|
const limit = this.getNodeParameter('limit', 0);
|
|
6105
|
-
const fetchColumnValues = this.getNodeParameter('fetchColumnValues', 0, false);
|
|
6106
6242
|
const fetchAllColumns = this.getNodeParameter('fetchAllColumns', 0, true);
|
|
6107
6243
|
const columnIdsRaw = this.getNodeParameter('columnIds', 0, '');
|
|
6108
6244
|
if (!boardId || !groupId) {
|
|
@@ -6111,10 +6247,40 @@ class Worktables {
|
|
|
6111
6247
|
});
|
|
6112
6248
|
}
|
|
6113
6249
|
let queryColumnValues = '';
|
|
6114
|
-
if (
|
|
6115
|
-
|
|
6250
|
+
if (fetchAllColumns) {
|
|
6251
|
+
queryColumnValues = `
|
|
6252
|
+
column_values {
|
|
6253
|
+
id
|
|
6254
|
+
text
|
|
6255
|
+
value
|
|
6256
|
+
type
|
|
6257
|
+
... on BoardRelationValue {
|
|
6258
|
+
display_value
|
|
6259
|
+
linked_item_ids
|
|
6260
|
+
}
|
|
6261
|
+
... on MirrorValue {
|
|
6262
|
+
display_value
|
|
6263
|
+
mirrored_items {
|
|
6264
|
+
linked_board_id
|
|
6265
|
+
}
|
|
6266
|
+
}
|
|
6267
|
+
... on DependencyValue {
|
|
6268
|
+
display_value
|
|
6269
|
+
linked_item_ids
|
|
6270
|
+
linked_items {
|
|
6271
|
+
id
|
|
6272
|
+
name
|
|
6273
|
+
}
|
|
6274
|
+
}
|
|
6275
|
+
}
|
|
6276
|
+
`;
|
|
6277
|
+
}
|
|
6278
|
+
else if (columnIdsRaw && columnIdsRaw.trim()) {
|
|
6279
|
+
const specificColumnIds = columnIdsRaw.split(',').map(id => id.trim()).filter(id => id);
|
|
6280
|
+
if (specificColumnIds.length > 0) {
|
|
6281
|
+
const columnIdsString = specificColumnIds.map(id => `"${id}"`).join(', ');
|
|
6116
6282
|
queryColumnValues = `
|
|
6117
|
-
column_values {
|
|
6283
|
+
column_values(ids: [${columnIdsString}]) {
|
|
6118
6284
|
id
|
|
6119
6285
|
text
|
|
6120
6286
|
value
|
|
@@ -6140,38 +6306,6 @@ class Worktables {
|
|
|
6140
6306
|
}
|
|
6141
6307
|
`;
|
|
6142
6308
|
}
|
|
6143
|
-
else if (columnIdsRaw && columnIdsRaw.trim()) {
|
|
6144
|
-
const specificColumnIds = columnIdsRaw.split(',').map(id => id.trim()).filter(id => id);
|
|
6145
|
-
if (specificColumnIds.length > 0) {
|
|
6146
|
-
const columnIdsString = specificColumnIds.map(id => `"${id}"`).join(', ');
|
|
6147
|
-
queryColumnValues = `
|
|
6148
|
-
column_values(ids: [${columnIdsString}]) {
|
|
6149
|
-
id
|
|
6150
|
-
text
|
|
6151
|
-
value
|
|
6152
|
-
type
|
|
6153
|
-
... on BoardRelationValue {
|
|
6154
|
-
display_value
|
|
6155
|
-
linked_item_ids
|
|
6156
|
-
}
|
|
6157
|
-
... on MirrorValue {
|
|
6158
|
-
display_value
|
|
6159
|
-
mirrored_items {
|
|
6160
|
-
linked_board_id
|
|
6161
|
-
}
|
|
6162
|
-
}
|
|
6163
|
-
... on DependencyValue {
|
|
6164
|
-
display_value
|
|
6165
|
-
linked_item_ids
|
|
6166
|
-
linked_items {
|
|
6167
|
-
id
|
|
6168
|
-
name
|
|
6169
|
-
}
|
|
6170
|
-
}
|
|
6171
|
-
}
|
|
6172
|
-
`;
|
|
6173
|
-
}
|
|
6174
|
-
}
|
|
6175
6309
|
}
|
|
6176
6310
|
let allItems = [];
|
|
6177
6311
|
let cursor = null;
|
|
@@ -6247,21 +6381,19 @@ class Worktables {
|
|
|
6247
6381
|
color: item.group.color,
|
|
6248
6382
|
position: item.group.position,
|
|
6249
6383
|
} : undefined,
|
|
6250
|
-
column_values:
|
|
6384
|
+
column_values: {},
|
|
6251
6385
|
};
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
formatted.column_values[col.id] = formattedCol;
|
|
6264
|
-
}
|
|
6386
|
+
for (const col of columnValues) {
|
|
6387
|
+
if (col.type === 'subtasks' ||
|
|
6388
|
+
col.type === 'formula' ||
|
|
6389
|
+
col.type === 'auto_number' ||
|
|
6390
|
+
col.type === 'creation_log' ||
|
|
6391
|
+
col.type === 'last_updated') {
|
|
6392
|
+
continue;
|
|
6393
|
+
}
|
|
6394
|
+
const formattedCol = await (0, worktablesHelpers_1.formatColumnValue)(col);
|
|
6395
|
+
if (formattedCol) {
|
|
6396
|
+
formatted.column_values[col.id] = formattedCol;
|
|
6265
6397
|
}
|
|
6266
6398
|
}
|
|
6267
6399
|
return formatted;
|
|
@@ -6279,81 +6411,117 @@ class Worktables {
|
|
|
6279
6411
|
switch (operation) {
|
|
6280
6412
|
case 'listUpdates': {
|
|
6281
6413
|
const itemId = this.getNodeParameter('itemId', 0);
|
|
6282
|
-
const
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6414
|
+
const limit = this.getNodeParameter('limit', 0, 25);
|
|
6415
|
+
const fromDate = this.getNodeParameter('fromDate', 0, '');
|
|
6416
|
+
const toDate = this.getNodeParameter('toDate', 0, '');
|
|
6417
|
+
const updatesParams = [];
|
|
6418
|
+
if (limit > 0) {
|
|
6419
|
+
updatesParams.push(`limit: ${limit}`);
|
|
6420
|
+
}
|
|
6421
|
+
let allUpdates = [];
|
|
6422
|
+
let page = 1;
|
|
6423
|
+
const pageLimit = limit === 0 ? 100 : limit;
|
|
6424
|
+
do {
|
|
6425
|
+
const currentParams = [...updatesParams];
|
|
6426
|
+
if (limit === 0) {
|
|
6427
|
+
currentParams.push(`limit: ${pageLimit}`);
|
|
6428
|
+
currentParams.push(`page: ${page}`);
|
|
6429
|
+
}
|
|
6430
|
+
const paramsString = currentParams.length > 0 ? `(${currentParams.join(', ')})` : '';
|
|
6431
|
+
const query = `
|
|
6432
|
+
query {
|
|
6433
|
+
items (ids: [${itemId}]) {
|
|
6434
|
+
updates${paramsString} {
|
|
6435
|
+
id
|
|
6436
|
+
text_body
|
|
6437
|
+
created_at
|
|
6438
|
+
updated_at
|
|
6439
|
+
creator {
|
|
6440
|
+
id
|
|
6441
|
+
name
|
|
6442
|
+
}
|
|
6443
|
+
assets {
|
|
6444
|
+
name
|
|
6445
|
+
public_url
|
|
6446
|
+
file_size
|
|
6447
|
+
}
|
|
6448
|
+
replies {
|
|
6449
|
+
text_body
|
|
6450
|
+
created_at
|
|
6451
|
+
creator {
|
|
6452
|
+
name
|
|
6453
|
+
}
|
|
6454
|
+
}
|
|
6455
|
+
pinned_to_top {
|
|
6456
|
+
item_id
|
|
6457
|
+
}
|
|
6304
6458
|
}
|
|
6305
6459
|
}
|
|
6306
|
-
pinned_to_top {
|
|
6307
|
-
item_id
|
|
6308
|
-
}
|
|
6309
|
-
}
|
|
6310
|
-
}
|
|
6311
6460
|
}
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
body: { query },
|
|
6319
|
-
});
|
|
6320
|
-
response = await (0, isErrorResponse_1.parseApiResponse)(response);
|
|
6321
|
-
if (response.success) {
|
|
6322
|
-
const parsed = JSON.parse(response.data);
|
|
6323
|
-
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) || [];
|
|
6324
|
-
const formattedUpdates = updates.map((update) => {
|
|
6325
|
-
const pinnedToTop = update.pinned_to_top || [];
|
|
6326
|
-
const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
|
|
6327
|
-
return {
|
|
6328
|
-
...update,
|
|
6329
|
-
pinned_to_top: isPinnedToTop,
|
|
6330
|
-
};
|
|
6461
|
+
`;
|
|
6462
|
+
const rawResponse = await this.helpers.request({
|
|
6463
|
+
method: 'POST',
|
|
6464
|
+
url: 'https://api.monday.com/v2',
|
|
6465
|
+
headers,
|
|
6466
|
+
body: { query },
|
|
6331
6467
|
});
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6468
|
+
const parsedResponse = await (0, isErrorResponse_1.parseApiResponse)(rawResponse);
|
|
6469
|
+
if (!parsedResponse.success) {
|
|
6470
|
+
const parsed = JSON.parse(parsedResponse.data);
|
|
6471
|
+
const firstError = parsed.errors || { message: 'Unknown error' };
|
|
6472
|
+
const errorData = Array.isArray(firstError) ? firstError[0] : firstError;
|
|
6473
|
+
const continueOnFail = this.continueOnFail();
|
|
6474
|
+
if (continueOnFail) {
|
|
6475
|
+
return [[{
|
|
6476
|
+
json: {
|
|
6477
|
+
error: {
|
|
6478
|
+
message: errorData.message || 'Unknown error',
|
|
6479
|
+
details: errorData,
|
|
6480
|
+
}
|
|
6345
6481
|
}
|
|
6346
|
-
}
|
|
6347
|
-
|
|
6482
|
+
}]];
|
|
6483
|
+
}
|
|
6484
|
+
else {
|
|
6485
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
6486
|
+
message: errorData.message || 'Failed to list updates',
|
|
6487
|
+
});
|
|
6488
|
+
}
|
|
6348
6489
|
}
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6490
|
+
const parsed = JSON.parse(parsedResponse.data);
|
|
6491
|
+
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) || [];
|
|
6492
|
+
if (updates.length === 0) {
|
|
6493
|
+
break;
|
|
6494
|
+
}
|
|
6495
|
+
allUpdates = allUpdates.concat(updates);
|
|
6496
|
+
page++;
|
|
6497
|
+
if (limit > 0 || updates.length < pageLimit) {
|
|
6498
|
+
break;
|
|
6355
6499
|
}
|
|
6500
|
+
} while (limit === 0);
|
|
6501
|
+
let filteredUpdates = allUpdates;
|
|
6502
|
+
if (fromDate) {
|
|
6503
|
+
const fromDateTime = new Date(fromDate).getTime();
|
|
6504
|
+
filteredUpdates = filteredUpdates.filter((update) => {
|
|
6505
|
+
const updateDate = new Date(update.created_at).getTime();
|
|
6506
|
+
return updateDate >= fromDateTime;
|
|
6507
|
+
});
|
|
6356
6508
|
}
|
|
6509
|
+
if (toDate) {
|
|
6510
|
+
const toDateTime = new Date(toDate).getTime();
|
|
6511
|
+
filteredUpdates = filteredUpdates.filter((update) => {
|
|
6512
|
+
const updateDate = new Date(update.created_at).getTime();
|
|
6513
|
+
return updateDate <= toDateTime;
|
|
6514
|
+
});
|
|
6515
|
+
}
|
|
6516
|
+
const formattedUpdates = filteredUpdates.map((update) => {
|
|
6517
|
+
const pinnedToTop = update.pinned_to_top || [];
|
|
6518
|
+
const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
|
|
6519
|
+
return {
|
|
6520
|
+
...update,
|
|
6521
|
+
pinned_to_top: isPinnedToTop,
|
|
6522
|
+
};
|
|
6523
|
+
});
|
|
6524
|
+
return [formattedUpdates.map((update) => ({ json: update }))];
|
|
6357
6525
|
}
|
|
6358
6526
|
case 'createUpdate': {
|
|
6359
6527
|
const items = this.getInputData();
|