@worktables/n8n-nodes-worktables 12.2.15 → 12.2.17
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 +121 -133
- 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
|
@@ -962,20 +962,6 @@ class Worktables {
|
|
|
962
962
|
show: { operation: ['getGroup', 'listGroupItems'] },
|
|
963
963
|
},
|
|
964
964
|
},
|
|
965
|
-
{
|
|
966
|
-
displayName: 'Limit',
|
|
967
|
-
name: 'limit',
|
|
968
|
-
type: 'number',
|
|
969
|
-
typeOptions: {
|
|
970
|
-
minValue: 0,
|
|
971
|
-
},
|
|
972
|
-
default: 50,
|
|
973
|
-
description: 'Max number of results to return',
|
|
974
|
-
hint: 'If 0 is provided, all items will be returned',
|
|
975
|
-
displayOptions: {
|
|
976
|
-
show: { operation: ['listGroupItems'] },
|
|
977
|
-
},
|
|
978
|
-
},
|
|
979
965
|
{
|
|
980
966
|
displayName: 'Position Relative',
|
|
981
967
|
name: 'positionRelative',
|
|
@@ -1055,7 +1041,7 @@ class Worktables {
|
|
|
1055
1041
|
type: 'options',
|
|
1056
1042
|
typeOptions: {
|
|
1057
1043
|
loadOptionsDependsOn: ['boardId'],
|
|
1058
|
-
loadOptionsMethod: '
|
|
1044
|
+
loadOptionsMethod: 'getItemsOrSubitemsFromBoard',
|
|
1059
1045
|
},
|
|
1060
1046
|
default: '',
|
|
1061
1047
|
required: true,
|
|
@@ -1067,50 +1053,49 @@ class Worktables {
|
|
|
1067
1053
|
},
|
|
1068
1054
|
},
|
|
1069
1055
|
{
|
|
1070
|
-
displayName: '
|
|
1071
|
-
name: '
|
|
1072
|
-
type: '
|
|
1073
|
-
default:
|
|
1074
|
-
|
|
1075
|
-
description: 'Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
|
1056
|
+
displayName: 'Is Subitem',
|
|
1057
|
+
name: 'isSubitem',
|
|
1058
|
+
type: 'boolean',
|
|
1059
|
+
default: false,
|
|
1060
|
+
description: 'Whether a subitem',
|
|
1076
1061
|
displayOptions: {
|
|
1077
1062
|
show: {
|
|
1078
|
-
operation: ['getItem'
|
|
1063
|
+
operation: ['getItem'],
|
|
1079
1064
|
},
|
|
1080
1065
|
},
|
|
1081
1066
|
},
|
|
1082
1067
|
{
|
|
1083
|
-
displayName: 'Fetch
|
|
1084
|
-
name: '
|
|
1068
|
+
displayName: 'Fetch Subitems',
|
|
1069
|
+
name: 'fetchSubitems',
|
|
1085
1070
|
type: 'boolean',
|
|
1086
|
-
default:
|
|
1087
|
-
description: 'Whether to fetch
|
|
1071
|
+
default: false,
|
|
1072
|
+
description: 'Whether to fetch subitems',
|
|
1088
1073
|
displayOptions: {
|
|
1089
1074
|
show: {
|
|
1090
1075
|
operation: ['getItem'],
|
|
1076
|
+
isSubitem: [false],
|
|
1091
1077
|
},
|
|
1092
1078
|
},
|
|
1093
1079
|
},
|
|
1094
1080
|
{
|
|
1095
|
-
displayName: '
|
|
1096
|
-
name: '
|
|
1097
|
-
type: '
|
|
1098
|
-
default:
|
|
1099
|
-
|
|
1100
|
-
description: 'Comma-separated list of column IDs to fetch (e.g., text, number, date). Only used when "Fetch All Columns" is disabled.',
|
|
1081
|
+
displayName: 'Fetch Parent Item',
|
|
1082
|
+
name: 'fetchParentItems',
|
|
1083
|
+
type: 'boolean',
|
|
1084
|
+
default: false,
|
|
1085
|
+
description: 'Whether to fetch parent item',
|
|
1101
1086
|
displayOptions: {
|
|
1102
1087
|
show: {
|
|
1103
1088
|
operation: ['getItem'],
|
|
1104
|
-
|
|
1089
|
+
isSubitem: [true],
|
|
1105
1090
|
},
|
|
1106
1091
|
},
|
|
1107
1092
|
},
|
|
1108
1093
|
{
|
|
1109
|
-
displayName: '
|
|
1110
|
-
name: '
|
|
1094
|
+
displayName: 'Fetch All Columns',
|
|
1095
|
+
name: 'fetchAllColumns',
|
|
1111
1096
|
type: 'boolean',
|
|
1112
|
-
default:
|
|
1113
|
-
description: 'Whether
|
|
1097
|
+
default: true,
|
|
1098
|
+
description: 'Whether to fetch all columns or only specific ones',
|
|
1114
1099
|
displayOptions: {
|
|
1115
1100
|
show: {
|
|
1116
1101
|
operation: ['getItem'],
|
|
@@ -1118,28 +1103,29 @@ class Worktables {
|
|
|
1118
1103
|
},
|
|
1119
1104
|
},
|
|
1120
1105
|
{
|
|
1121
|
-
displayName: '
|
|
1122
|
-
name: '
|
|
1123
|
-
type: '
|
|
1124
|
-
default:
|
|
1125
|
-
|
|
1106
|
+
displayName: 'Column IDs',
|
|
1107
|
+
name: 'columnIds',
|
|
1108
|
+
type: 'string',
|
|
1109
|
+
default: '',
|
|
1110
|
+
required: false,
|
|
1111
|
+
description: 'Comma-separated list of column IDs to fetch (e.g., text, number, date). Only used when "Fetch All Columns" is disabled.',
|
|
1126
1112
|
displayOptions: {
|
|
1127
1113
|
show: {
|
|
1128
1114
|
operation: ['getItem'],
|
|
1129
|
-
|
|
1115
|
+
fetchAllColumns: [false],
|
|
1130
1116
|
},
|
|
1131
1117
|
},
|
|
1132
1118
|
},
|
|
1133
1119
|
{
|
|
1134
|
-
displayName: '
|
|
1135
|
-
name: '
|
|
1136
|
-
type: '
|
|
1137
|
-
default:
|
|
1138
|
-
|
|
1120
|
+
displayName: 'Item ID',
|
|
1121
|
+
name: 'itemId',
|
|
1122
|
+
type: 'string',
|
|
1123
|
+
default: '',
|
|
1124
|
+
required: true,
|
|
1125
|
+
description: 'Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
|
1139
1126
|
displayOptions: {
|
|
1140
1127
|
show: {
|
|
1141
|
-
operation: ['getItem'],
|
|
1142
|
-
isSubitem: [true],
|
|
1128
|
+
operation: ['getItem', 'deleteItem'],
|
|
1143
1129
|
},
|
|
1144
1130
|
},
|
|
1145
1131
|
},
|
|
@@ -2777,7 +2763,7 @@ class Worktables {
|
|
|
2777
2763
|
};
|
|
2778
2764
|
}
|
|
2779
2765
|
async execute() {
|
|
2780
|
-
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;
|
|
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;
|
|
2781
2767
|
const resource = this.getNodeParameter('resource', 0);
|
|
2782
2768
|
const operation = this.getNodeParameter('operation', 0);
|
|
2783
2769
|
const credentials = await this.getCredentials('WorktablesApi');
|
|
@@ -3517,8 +3503,14 @@ class Worktables {
|
|
|
3517
3503
|
column_values: {},
|
|
3518
3504
|
};
|
|
3519
3505
|
for (const col of columnValues) {
|
|
3520
|
-
if (col.type === 'subtasks'
|
|
3506
|
+
if (col.type === 'subtasks' ||
|
|
3507
|
+
col.type === 'formula' ||
|
|
3508
|
+
col.type === 'mirror' ||
|
|
3509
|
+
col.type === 'auto_number' ||
|
|
3510
|
+
col.type === 'creation_log' ||
|
|
3511
|
+
col.type === 'last_updated') {
|
|
3521
3512
|
continue;
|
|
3513
|
+
}
|
|
3522
3514
|
const formattedCol = {
|
|
3523
3515
|
type: col.type,
|
|
3524
3516
|
value: await (0, parseValue_1.parseValue)(col.value),
|
|
@@ -4406,15 +4398,7 @@ class Worktables {
|
|
|
4406
4398
|
}
|
|
4407
4399
|
case 'duplicateItem': {
|
|
4408
4400
|
console.log('Duplicate an item');
|
|
4409
|
-
const
|
|
4410
|
-
let itemId = '';
|
|
4411
|
-
let subitemId = '';
|
|
4412
|
-
if (isSubitem) {
|
|
4413
|
-
subitemId = this.getNodeParameter('subitemId', 0);
|
|
4414
|
-
}
|
|
4415
|
-
else {
|
|
4416
|
-
itemId = this.getNodeParameter('itemId', 0);
|
|
4417
|
-
}
|
|
4401
|
+
const itemId = this.getNodeParameter('itemId', 0);
|
|
4418
4402
|
const withUpdates = this.getNodeParameter('withUpdates', 0);
|
|
4419
4403
|
const boardId = this.getNodeParameter('boardId', 0);
|
|
4420
4404
|
if (!itemId || !boardId) {
|
|
@@ -4425,7 +4409,7 @@ class Worktables {
|
|
|
4425
4409
|
const mutation = `
|
|
4426
4410
|
mutation {
|
|
4427
4411
|
duplicate_item(
|
|
4428
|
-
item_id: ${itemId
|
|
4412
|
+
item_id: ${itemId},
|
|
4429
4413
|
board_id: ${boardId},
|
|
4430
4414
|
with_updates: ${withUpdates}
|
|
4431
4415
|
) { id }
|
|
@@ -4558,8 +4542,14 @@ class Worktables {
|
|
|
4558
4542
|
column_values: {},
|
|
4559
4543
|
};
|
|
4560
4544
|
for (const col of columnValues) {
|
|
4561
|
-
if (col.type === 'subtasks'
|
|
4545
|
+
if (col.type === 'subtasks' ||
|
|
4546
|
+
col.type === 'formula' ||
|
|
4547
|
+
col.type === 'mirror' ||
|
|
4548
|
+
col.type === 'auto_number' ||
|
|
4549
|
+
col.type === 'creation_log' ||
|
|
4550
|
+
col.type === 'last_updated') {
|
|
4562
4551
|
continue;
|
|
4552
|
+
}
|
|
4563
4553
|
const formattedCol = await (0, worktablesHelpers_1.formatColumnValue)(col);
|
|
4564
4554
|
if (formattedCol) {
|
|
4565
4555
|
formatted.column_values[col.id] = formattedCol;
|
|
@@ -5046,8 +5036,14 @@ class Worktables {
|
|
|
5046
5036
|
if (!fetchColumnValues)
|
|
5047
5037
|
return formatted;
|
|
5048
5038
|
for (const col of item.column_values || []) {
|
|
5049
|
-
if (col.type === 'subtasks'
|
|
5039
|
+
if (col.type === 'subtasks' ||
|
|
5040
|
+
col.type === 'formula' ||
|
|
5041
|
+
col.type === 'mirror' ||
|
|
5042
|
+
col.type === 'auto_number' ||
|
|
5043
|
+
col.type === 'creation_log' ||
|
|
5044
|
+
col.type === 'last_updated') {
|
|
5050
5045
|
continue;
|
|
5046
|
+
}
|
|
5051
5047
|
const formattedCol = {
|
|
5052
5048
|
type: col.type,
|
|
5053
5049
|
value: await (0, parseValue_1.parseValue)(col.value),
|
|
@@ -5120,84 +5116,62 @@ class Worktables {
|
|
|
5120
5116
|
case 'listGroupItems': {
|
|
5121
5117
|
const boardId = this.getNodeParameter('boardId', 0);
|
|
5122
5118
|
const groupId = this.getNodeParameter('groupId', 0);
|
|
5123
|
-
const limit = this.getNodeParameter('limit', 0);
|
|
5124
5119
|
if (!boardId || !groupId) {
|
|
5125
5120
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5126
5121
|
message: 'Board ID and Group ID are required.',
|
|
5127
5122
|
});
|
|
5128
5123
|
}
|
|
5129
|
-
const
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
boards (ids: [${boardId}]) {
|
|
5140
|
-
groups (ids: "${groupId}") {
|
|
5141
|
-
items_page(limit: ${currentLimit}${cursorParam}) {
|
|
5142
|
-
items {
|
|
5124
|
+
const query = `
|
|
5125
|
+
query {
|
|
5126
|
+
boards (ids: [${boardId}]) {
|
|
5127
|
+
groups (ids: "${groupId}") {
|
|
5128
|
+
items_page {
|
|
5129
|
+
items {
|
|
5130
|
+
id
|
|
5131
|
+
name
|
|
5132
|
+
url
|
|
5133
|
+
board {
|
|
5143
5134
|
id
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5135
|
+
}
|
|
5136
|
+
group {
|
|
5137
|
+
id
|
|
5138
|
+
title
|
|
5139
|
+
color
|
|
5140
|
+
position
|
|
5141
|
+
}
|
|
5142
|
+
column_values {
|
|
5143
|
+
id
|
|
5144
|
+
text
|
|
5145
|
+
value
|
|
5146
|
+
type
|
|
5147
|
+
... on BoardRelationValue {
|
|
5148
|
+
display_value
|
|
5149
|
+
linked_item_ids
|
|
5154
5150
|
}
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
type
|
|
5160
|
-
... on BoardRelationValue {
|
|
5161
|
-
display_value
|
|
5162
|
-
linked_item_ids
|
|
5163
|
-
}
|
|
5164
|
-
... on MirrorValue {
|
|
5165
|
-
display_value
|
|
5166
|
-
mirrored_items {
|
|
5167
|
-
linked_board_id
|
|
5168
|
-
}
|
|
5151
|
+
... on MirrorValue {
|
|
5152
|
+
display_value
|
|
5153
|
+
mirrored_items {
|
|
5154
|
+
linked_board_id
|
|
5169
5155
|
}
|
|
5170
5156
|
}
|
|
5171
|
-
created_at
|
|
5172
|
-
updated_at
|
|
5173
5157
|
}
|
|
5174
|
-
|
|
5158
|
+
created_at
|
|
5159
|
+
updated_at
|
|
5175
5160
|
}
|
|
5176
5161
|
}
|
|
5177
5162
|
}
|
|
5178
5163
|
}
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
}
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
allItems.push(...items);
|
|
5191
|
-
totalFetched += items.length;
|
|
5192
|
-
if (limit === 0) {
|
|
5193
|
-
hasMore = cursor !== null && items.length > 0;
|
|
5194
|
-
}
|
|
5195
|
-
else {
|
|
5196
|
-
hasMore = totalFetched < limit && cursor !== null && items.length > 0;
|
|
5197
|
-
}
|
|
5198
|
-
}
|
|
5199
|
-
const itemsToFormat = limit === 0 ? allItems : allItems.slice(0, limit);
|
|
5200
|
-
const formattedItems = await Promise.all(itemsToFormat.map(async (item) => {
|
|
5164
|
+
}
|
|
5165
|
+
`;
|
|
5166
|
+
const rawResponse = await this.helpers.request({
|
|
5167
|
+
method: 'POST',
|
|
5168
|
+
url: 'https://api.monday.com/v2',
|
|
5169
|
+
headers,
|
|
5170
|
+
body: { query },
|
|
5171
|
+
});
|
|
5172
|
+
const parsed = JSON.parse(rawResponse);
|
|
5173
|
+
const items = ((_20 = (_19 = (_18 = (_17 = (_16 = (_15 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _15 === void 0 ? void 0 : _15.boards) === null || _16 === void 0 ? void 0 : _16[0]) === null || _17 === void 0 ? void 0 : _17.groups) === null || _18 === void 0 ? void 0 : _18[0]) === null || _19 === void 0 ? void 0 : _19.items_page) === null || _20 === void 0 ? void 0 : _20.items) || [];
|
|
5174
|
+
const formattedItems = await Promise.all(items.map(async (item) => {
|
|
5201
5175
|
const columnValues = item.column_values || [];
|
|
5202
5176
|
const formatted = {
|
|
5203
5177
|
id: item.id,
|
|
@@ -5217,8 +5191,14 @@ class Worktables {
|
|
|
5217
5191
|
column_values: {},
|
|
5218
5192
|
};
|
|
5219
5193
|
for (const col of columnValues) {
|
|
5220
|
-
if (col.type === 'subtasks'
|
|
5194
|
+
if (col.type === 'subtasks' ||
|
|
5195
|
+
col.type === 'formula' ||
|
|
5196
|
+
col.type === 'mirror' ||
|
|
5197
|
+
col.type === 'auto_number' ||
|
|
5198
|
+
col.type === 'creation_log' ||
|
|
5199
|
+
col.type === 'last_updated') {
|
|
5221
5200
|
continue;
|
|
5201
|
+
}
|
|
5222
5202
|
const formattedCol = await (0, worktablesHelpers_1.formatColumnValue)(col);
|
|
5223
5203
|
if (formattedCol) {
|
|
5224
5204
|
formatted.column_values[col.id] = formattedCol;
|
|
@@ -5280,8 +5260,16 @@ class Worktables {
|
|
|
5280
5260
|
response = await (0, isErrorResponse_1.parseApiResponse)(response);
|
|
5281
5261
|
if (response.success) {
|
|
5282
5262
|
const parsed = JSON.parse(response.data);
|
|
5283
|
-
const updates = ((
|
|
5284
|
-
|
|
5263
|
+
const updates = ((_23 = (_22 = (_21 = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _21 === void 0 ? void 0 : _21.items) === null || _22 === void 0 ? void 0 : _22[0]) === null || _23 === void 0 ? void 0 : _23.updates) || [];
|
|
5264
|
+
const formattedUpdates = updates.map((update) => {
|
|
5265
|
+
const pinnedToTop = update.pinned_to_top || [];
|
|
5266
|
+
const isPinnedToTop = Array.isArray(pinnedToTop) && pinnedToTop.length > 0;
|
|
5267
|
+
return {
|
|
5268
|
+
...update,
|
|
5269
|
+
pinned_to_top: isPinnedToTop,
|
|
5270
|
+
};
|
|
5271
|
+
});
|
|
5272
|
+
return [formattedUpdates.map((update) => ({ json: update }))];
|
|
5285
5273
|
}
|
|
5286
5274
|
else {
|
|
5287
5275
|
const parsed = JSON.parse(response.data);
|
|
@@ -5337,7 +5325,7 @@ class Worktables {
|
|
|
5337
5325
|
console.log('variables:', variables);
|
|
5338
5326
|
response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
|
|
5339
5327
|
console.log('Create Update Result:', JSON.stringify(response, null, 2));
|
|
5340
|
-
const updateId = (
|
|
5328
|
+
const updateId = (_25 = (_24 = JSON.parse(response).data) === null || _24 === void 0 ? void 0 : _24.create_update) === null || _25 === void 0 ? void 0 : _25.id;
|
|
5341
5329
|
if (!updateId) {
|
|
5342
5330
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5343
5331
|
message: 'Error creating update: Update not created, no ID returned',
|
|
@@ -5643,7 +5631,7 @@ class Worktables {
|
|
|
5643
5631
|
body: { query },
|
|
5644
5632
|
json: true,
|
|
5645
5633
|
});
|
|
5646
|
-
const asset = (
|
|
5634
|
+
const asset = (_27 = (_26 = responseFile === null || responseFile === void 0 ? void 0 : responseFile.data) === null || _26 === void 0 ? void 0 : _26.assets) === null || _27 === void 0 ? void 0 : _27[0];
|
|
5647
5635
|
if (!(asset === null || asset === void 0 ? void 0 : asset.public_url)) {
|
|
5648
5636
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
5649
5637
|
message: 'Public URL not found for the given file ID.',
|