@blickwerk/n8n-nodes-microsoft-planner 1.4.0 → 1.6.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/LICENSE.md +1 -1
- package/README.md +233 -30
- package/dist/credentials/MicrosoftPlannerOAuth2Api.credentials.d.ts +2 -2
- package/dist/credentials/MicrosoftPlannerOAuth2Api.credentials.js +11 -29
- package/dist/credentials/MicrosoftPlannerOAuth2Api.credentials.js.map +1 -0
- package/dist/nodes/MicrosoftPlanner/BucketDescription.d.ts +3 -0
- package/dist/nodes/MicrosoftPlanner/BucketDescription.js +180 -0
- package/dist/nodes/MicrosoftPlanner/BucketDescription.js.map +1 -0
- package/dist/nodes/MicrosoftPlanner/CommentDescription.d.ts +3 -0
- package/dist/nodes/MicrosoftPlanner/CommentDescription.js +156 -0
- package/dist/nodes/MicrosoftPlanner/CommentDescription.js.map +1 -0
- package/dist/nodes/MicrosoftPlanner/GenericFunctions.d.ts +19 -6
- package/dist/nodes/MicrosoftPlanner/GenericFunctions.js +251 -34
- package/dist/nodes/MicrosoftPlanner/GenericFunctions.js.map +1 -0
- package/dist/nodes/MicrosoftPlanner/MicrosoftPlanner.node.d.ts +6 -7
- package/dist/nodes/MicrosoftPlanner/MicrosoftPlanner.node.js +118 -279
- package/dist/nodes/MicrosoftPlanner/MicrosoftPlanner.node.js.map +1 -0
- package/dist/nodes/MicrosoftPlanner/MicrosoftPlanner.node.json +18 -0
- package/dist/nodes/MicrosoftPlanner/PlanDescription.d.ts +3 -0
- package/dist/nodes/MicrosoftPlanner/PlanDescription.js +435 -0
- package/dist/nodes/MicrosoftPlanner/PlanDescription.js.map +1 -0
- package/dist/nodes/MicrosoftPlanner/SharedFields.d.ts +10 -0
- package/dist/nodes/MicrosoftPlanner/SharedFields.js +316 -0
- package/dist/nodes/MicrosoftPlanner/SharedFields.js.map +1 -0
- package/dist/nodes/MicrosoftPlanner/TaskDescription.d.ts +1 -1
- package/dist/nodes/MicrosoftPlanner/TaskDescription.js +271 -177
- package/dist/nodes/MicrosoftPlanner/TaskDescription.js.map +1 -0
- package/dist/nodes/MicrosoftPlanner/actions/bucket.d.ts +2 -0
- package/dist/nodes/MicrosoftPlanner/actions/bucket.js +72 -0
- package/dist/nodes/MicrosoftPlanner/actions/bucket.js.map +1 -0
- package/dist/nodes/MicrosoftPlanner/actions/comment.d.ts +2 -0
- package/dist/nodes/MicrosoftPlanner/actions/comment.js +100 -0
- package/dist/nodes/MicrosoftPlanner/actions/comment.js.map +1 -0
- package/dist/nodes/MicrosoftPlanner/actions/plan.d.ts +4 -0
- package/dist/nodes/MicrosoftPlanner/actions/plan.js +116 -0
- package/dist/nodes/MicrosoftPlanner/actions/plan.js.map +1 -0
- package/dist/nodes/MicrosoftPlanner/actions/task.d.ts +4 -0
- package/dist/nodes/MicrosoftPlanner/actions/task.js +392 -0
- package/dist/nodes/MicrosoftPlanner/actions/task.js.map +1 -0
- package/dist/package.json +60 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +22 -20
|
@@ -4,21 +4,32 @@ exports.MicrosoftPlanner = void 0;
|
|
|
4
4
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
5
|
const GenericFunctions_1 = require("./GenericFunctions");
|
|
6
6
|
const TaskDescription_1 = require("./TaskDescription");
|
|
7
|
+
const PlanDescription_1 = require("./PlanDescription");
|
|
8
|
+
const BucketDescription_1 = require("./BucketDescription");
|
|
9
|
+
const CommentDescription_1 = require("./CommentDescription");
|
|
10
|
+
const task_1 = require("./actions/task");
|
|
11
|
+
const plan_1 = require("./actions/plan");
|
|
12
|
+
const bucket_1 = require("./actions/bucket");
|
|
13
|
+
const comment_1 = require("./actions/comment");
|
|
14
|
+
function matchesFilter(name, filter) {
|
|
15
|
+
return !filter || name.toLowerCase().includes(filter.toLowerCase());
|
|
16
|
+
}
|
|
7
17
|
class MicrosoftPlanner {
|
|
8
18
|
constructor() {
|
|
9
19
|
this.description = {
|
|
10
20
|
displayName: 'Microsoft Planner',
|
|
11
21
|
name: 'microsoftPlanner',
|
|
12
|
-
icon: 'file:planner.svg',
|
|
22
|
+
icon: { light: 'file:planner.svg', dark: 'file:planner.svg' },
|
|
13
23
|
group: ['transform'],
|
|
14
24
|
version: 1,
|
|
15
25
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
16
|
-
description: '
|
|
26
|
+
description: 'Manage plans, buckets, tasks and comments in Microsoft Planner',
|
|
17
27
|
defaults: {
|
|
18
28
|
name: 'Microsoft Planner',
|
|
19
29
|
},
|
|
20
|
-
|
|
21
|
-
|
|
30
|
+
usableAsTool: true,
|
|
31
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
32
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
22
33
|
credentials: [
|
|
23
34
|
{
|
|
24
35
|
name: 'microsoftPlannerOAuth2Api',
|
|
@@ -32,6 +43,18 @@ class MicrosoftPlanner {
|
|
|
32
43
|
type: 'options',
|
|
33
44
|
noDataExpression: true,
|
|
34
45
|
options: [
|
|
46
|
+
{
|
|
47
|
+
name: 'Bucket',
|
|
48
|
+
value: 'bucket',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Comment',
|
|
52
|
+
value: 'comment',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'Plan',
|
|
56
|
+
value: 'plan',
|
|
57
|
+
},
|
|
35
58
|
{
|
|
36
59
|
name: 'Task',
|
|
37
60
|
value: 'task',
|
|
@@ -41,76 +64,85 @@ class MicrosoftPlanner {
|
|
|
41
64
|
},
|
|
42
65
|
...TaskDescription_1.taskOperations,
|
|
43
66
|
...TaskDescription_1.taskFields,
|
|
67
|
+
...PlanDescription_1.planOperations,
|
|
68
|
+
...PlanDescription_1.planFields,
|
|
69
|
+
...BucketDescription_1.bucketOperations,
|
|
70
|
+
...BucketDescription_1.bucketFields,
|
|
71
|
+
...CommentDescription_1.commentOperations,
|
|
72
|
+
...CommentDescription_1.commentFields,
|
|
44
73
|
],
|
|
45
74
|
};
|
|
46
75
|
this.methods = {
|
|
47
76
|
listSearch: {
|
|
48
|
-
async getBuckets() {
|
|
77
|
+
async getBuckets(filter) {
|
|
78
|
+
const planId = this.getCurrentNodeParameter('planId');
|
|
79
|
+
if (!planId) {
|
|
80
|
+
return { results: [] };
|
|
81
|
+
}
|
|
49
82
|
try {
|
|
50
|
-
const planId = this.getNodeParameter('planId', 0);
|
|
51
|
-
if (!planId) {
|
|
52
|
-
return { results: [] };
|
|
53
|
-
}
|
|
54
83
|
const buckets = await GenericFunctions_1.microsoftApiRequestAllItems.call(this, 'value', 'GET', `/planner/plans/${planId}/buckets`);
|
|
55
|
-
if (!buckets || buckets.length === 0) {
|
|
56
|
-
return { results: [] };
|
|
57
|
-
}
|
|
58
84
|
return {
|
|
59
|
-
results: buckets
|
|
85
|
+
results: buckets
|
|
86
|
+
.map((bucket) => ({
|
|
60
87
|
name: bucket.name || bucket.id,
|
|
61
88
|
value: bucket.id,
|
|
62
|
-
}))
|
|
89
|
+
}))
|
|
90
|
+
.filter((bucket) => matchesFilter(bucket.name, filter)),
|
|
63
91
|
};
|
|
64
92
|
}
|
|
65
|
-
catch
|
|
66
|
-
console.error('Error loading buckets:', error);
|
|
93
|
+
catch {
|
|
67
94
|
return { results: [] };
|
|
68
95
|
}
|
|
69
96
|
},
|
|
70
|
-
async
|
|
97
|
+
async getGroups(filter) {
|
|
71
98
|
try {
|
|
72
|
-
const
|
|
73
|
-
// Try to get bucketId - might be undefined or an object
|
|
74
|
-
let bucketIdValue = '';
|
|
75
|
-
try {
|
|
76
|
-
const bucketId = this.getNodeParameter('bucketId', 0);
|
|
77
|
-
if (typeof bucketId === 'string') {
|
|
78
|
-
bucketIdValue = bucketId;
|
|
79
|
-
}
|
|
80
|
-
else if (bucketId && typeof bucketId === 'object' && 'value' in bucketId) {
|
|
81
|
-
bucketIdValue = bucketId.value;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
// bucketId might not exist yet, that's ok
|
|
86
|
-
}
|
|
87
|
-
let endpoint = '';
|
|
88
|
-
if (bucketIdValue) {
|
|
89
|
-
endpoint = `/planner/buckets/${bucketIdValue}/tasks`;
|
|
90
|
-
}
|
|
91
|
-
else if (planId) {
|
|
92
|
-
endpoint = `/planner/plans/${planId}/tasks`;
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
return { results: [] };
|
|
96
|
-
}
|
|
97
|
-
const tasks = await GenericFunctions_1.microsoftApiRequestAllItems.call(this, 'value', 'GET', endpoint);
|
|
98
|
-
if (!tasks || tasks.length === 0) {
|
|
99
|
-
return { results: [] };
|
|
100
|
-
}
|
|
99
|
+
const groups = await GenericFunctions_1.microsoftApiRequestAllItems.call(this, 'value', 'GET', '/me/memberOf/$/microsoft.graph.group', {}, { $select: 'id,displayName,groupTypes' });
|
|
101
100
|
return {
|
|
102
|
-
results:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
results: groups
|
|
102
|
+
.filter((group) => { var _a; return (_a = group.groupTypes) === null || _a === void 0 ? void 0 : _a.includes('Unified'); })
|
|
103
|
+
.map((group) => ({
|
|
104
|
+
name: group.displayName || group.id,
|
|
105
|
+
value: group.id,
|
|
106
|
+
}))
|
|
107
|
+
.filter((group) => matchesFilter(group.name, filter))
|
|
108
|
+
.sort((a, b) => a.name.localeCompare(b.name)),
|
|
106
109
|
};
|
|
107
110
|
}
|
|
108
|
-
catch
|
|
109
|
-
console.error('Error loading tasks:', error);
|
|
111
|
+
catch {
|
|
110
112
|
return { results: [] };
|
|
111
113
|
}
|
|
112
114
|
},
|
|
113
115
|
},
|
|
116
|
+
loadOptions: {
|
|
117
|
+
async getCategories() {
|
|
118
|
+
var _a;
|
|
119
|
+
let descriptions = {};
|
|
120
|
+
try {
|
|
121
|
+
let planId = this.getCurrentNodeParameter('planId');
|
|
122
|
+
if (!planId) {
|
|
123
|
+
const taskId = this.getCurrentNodeParameter('taskId', { extractValue: true });
|
|
124
|
+
if (taskId) {
|
|
125
|
+
const task = await GenericFunctions_1.microsoftApiRequest.call(this, 'GET', `/planner/tasks/${taskId}`, {}, { $select: 'planId' });
|
|
126
|
+
planId = task.planId;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (planId) {
|
|
130
|
+
const details = await GenericFunctions_1.microsoftApiRequest.call(this, 'GET', `/planner/plans/${planId}/details`);
|
|
131
|
+
descriptions = (_a = details.categoryDescriptions) !== null && _a !== void 0 ? _a : {};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
}
|
|
136
|
+
return Object.keys(GenericFunctions_1.CATEGORY_COLORS).map((category) => {
|
|
137
|
+
const label = descriptions[category];
|
|
138
|
+
const color = GenericFunctions_1.CATEGORY_COLORS[category];
|
|
139
|
+
return {
|
|
140
|
+
name: label ? `${label} (${color})` : `${color} (${category})`,
|
|
141
|
+
value: category,
|
|
142
|
+
};
|
|
143
|
+
});
|
|
144
|
+
},
|
|
145
|
+
},
|
|
114
146
|
};
|
|
115
147
|
}
|
|
116
148
|
async execute() {
|
|
@@ -118,244 +150,51 @@ class MicrosoftPlanner {
|
|
|
118
150
|
const returnData = [];
|
|
119
151
|
const resource = this.getNodeParameter('resource', 0);
|
|
120
152
|
const operation = this.getNodeParameter('operation', 0);
|
|
153
|
+
const userCache = new Map();
|
|
121
154
|
for (let i = 0; i < items.length; i++) {
|
|
122
155
|
try {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (additionalFields.priority !== undefined) {
|
|
141
|
-
body.priority = additionalFields.priority;
|
|
142
|
-
}
|
|
143
|
-
const formattedDueDateTime = (0, GenericFunctions_1.formatDateTime)(additionalFields.dueDateTime);
|
|
144
|
-
if (formattedDueDateTime) {
|
|
145
|
-
body.dueDateTime = formattedDueDateTime;
|
|
146
|
-
}
|
|
147
|
-
const formattedStartDateTime = (0, GenericFunctions_1.formatDateTime)(additionalFields.startDateTime);
|
|
148
|
-
if (formattedStartDateTime) {
|
|
149
|
-
body.startDateTime = formattedStartDateTime;
|
|
150
|
-
}
|
|
151
|
-
if (additionalFields.percentComplete !== undefined) {
|
|
152
|
-
body.percentComplete = additionalFields.percentComplete;
|
|
153
|
-
}
|
|
154
|
-
// Handle assignments
|
|
155
|
-
if (additionalFields.assignments) {
|
|
156
|
-
const emails = (0, GenericFunctions_1.parseAssignments)(additionalFields.assignments);
|
|
157
|
-
const userIds = [];
|
|
158
|
-
for (const email of emails) {
|
|
159
|
-
const userId = await GenericFunctions_1.getUserIdByEmail.call(this, email);
|
|
160
|
-
if (userId) {
|
|
161
|
-
userIds.push(userId);
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
console.warn(`Could not find user ID for email: ${email}`);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
if (userIds.length > 0) {
|
|
168
|
-
body.assignments = (0, GenericFunctions_1.createAssignmentsObject)(userIds);
|
|
169
|
-
}
|
|
170
|
-
else if (emails.length > 0) {
|
|
171
|
-
console.warn('No valid user IDs found for assignment. Check if User.Read.All permission is granted.');
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
const responseData = await GenericFunctions_1.microsoftApiRequest.call(this, 'POST', '/planner/tasks', body);
|
|
175
|
-
// Add description if provided
|
|
176
|
-
if (additionalFields.description) {
|
|
177
|
-
const details = await GenericFunctions_1.microsoftApiRequest.call(this, 'GET', `/planner/tasks/${responseData.id}/details`);
|
|
178
|
-
const eTag = (0, GenericFunctions_1.cleanETag)(details['@odata.etag']);
|
|
179
|
-
await GenericFunctions_1.microsoftApiRequest.call(this, 'PATCH', `/planner/tasks/${responseData.id}/details`, {
|
|
180
|
-
description: additionalFields.description,
|
|
181
|
-
}, {}, undefined, {
|
|
182
|
-
'If-Match': eTag,
|
|
183
|
-
});
|
|
184
|
-
responseData.description = additionalFields.description;
|
|
185
|
-
}
|
|
186
|
-
returnData.push(responseData);
|
|
187
|
-
}
|
|
188
|
-
// ----------------------------------
|
|
189
|
-
// task:get
|
|
190
|
-
// ----------------------------------
|
|
191
|
-
if (operation === 'get') {
|
|
192
|
-
const taskIdParam = this.getNodeParameter('taskId', i);
|
|
193
|
-
const taskId = typeof taskIdParam === 'string' ? taskIdParam : taskIdParam.value;
|
|
194
|
-
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
195
|
-
const responseData = await GenericFunctions_1.microsoftApiRequest.call(this, 'GET', `/planner/tasks/${taskId}`);
|
|
196
|
-
if (additionalFields.includeDetails) {
|
|
197
|
-
const details = await GenericFunctions_1.microsoftApiRequest.call(this, 'GET', `/planner/tasks/${taskId}/details`);
|
|
198
|
-
responseData.details = details;
|
|
199
|
-
}
|
|
200
|
-
returnData.push(responseData);
|
|
201
|
-
}
|
|
202
|
-
// ----------------------------------
|
|
203
|
-
// task:getAll
|
|
204
|
-
// ----------------------------------
|
|
205
|
-
if (operation === 'getAll') {
|
|
206
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
207
|
-
const filterBy = this.getNodeParameter('filterBy', i);
|
|
208
|
-
const planId = this.getNodeParameter('planId', i);
|
|
209
|
-
let endpoint = '';
|
|
210
|
-
if (filterBy === 'plan') {
|
|
211
|
-
endpoint = `/planner/plans/${planId}/tasks`;
|
|
212
|
-
}
|
|
213
|
-
else if (filterBy === 'bucket') {
|
|
214
|
-
const bucketIdParam = this.getNodeParameter('bucketId', i);
|
|
215
|
-
const bucketIdValue = typeof bucketIdParam === 'string'
|
|
216
|
-
? bucketIdParam
|
|
217
|
-
: bucketIdParam.value;
|
|
218
|
-
endpoint = `/planner/buckets/${bucketIdValue}/tasks`;
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You must specify either a Plan ID or Bucket ID to retrieve tasks', { itemIndex: i });
|
|
222
|
-
}
|
|
223
|
-
if (returnAll) {
|
|
224
|
-
const responseData = await GenericFunctions_1.microsoftApiRequestAllItems.call(this, 'value', 'GET', endpoint);
|
|
225
|
-
returnData.push(...responseData);
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
const limit = this.getNodeParameter('limit', i);
|
|
229
|
-
const responseData = await GenericFunctions_1.microsoftApiRequest.call(this, 'GET', endpoint, {}, {
|
|
230
|
-
$top: limit,
|
|
231
|
-
});
|
|
232
|
-
returnData.push(...responseData.value);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
// ----------------------------------
|
|
236
|
-
// task:update
|
|
237
|
-
// ----------------------------------
|
|
238
|
-
if (operation === 'update') {
|
|
239
|
-
const taskIdParam = this.getNodeParameter('taskId', i);
|
|
240
|
-
const taskId = typeof taskIdParam === 'string' ? taskIdParam : taskIdParam.value;
|
|
241
|
-
const updateFields = this.getNodeParameter('updateFields', i);
|
|
242
|
-
// Get current task to retrieve eTag
|
|
243
|
-
const currentTask = await GenericFunctions_1.microsoftApiRequest.call(this, 'GET', `/planner/tasks/${taskId}`);
|
|
244
|
-
const eTag = (0, GenericFunctions_1.cleanETag)(currentTask['@odata.etag']);
|
|
245
|
-
const body = {};
|
|
246
|
-
if (updateFields.title) {
|
|
247
|
-
body.title = updateFields.title;
|
|
248
|
-
}
|
|
249
|
-
if (updateFields.priority !== undefined) {
|
|
250
|
-
body.priority = updateFields.priority;
|
|
251
|
-
}
|
|
252
|
-
const formattedDueDateTime = (0, GenericFunctions_1.formatDateTime)(updateFields.dueDateTime);
|
|
253
|
-
if (formattedDueDateTime) {
|
|
254
|
-
body.dueDateTime = formattedDueDateTime;
|
|
255
|
-
}
|
|
256
|
-
const formattedStartDateTime = (0, GenericFunctions_1.formatDateTime)(updateFields.startDateTime);
|
|
257
|
-
if (formattedStartDateTime) {
|
|
258
|
-
body.startDateTime = formattedStartDateTime;
|
|
259
|
-
}
|
|
260
|
-
if (updateFields.percentComplete !== undefined) {
|
|
261
|
-
body.percentComplete = updateFields.percentComplete;
|
|
262
|
-
}
|
|
263
|
-
if (updateFields.bucketId) {
|
|
264
|
-
body.bucketId = updateFields.bucketId;
|
|
265
|
-
}
|
|
266
|
-
// Handle assignments
|
|
267
|
-
if (updateFields.assignments) {
|
|
268
|
-
const emails = (0, GenericFunctions_1.parseAssignments)(updateFields.assignments);
|
|
269
|
-
const userIds = [];
|
|
270
|
-
for (const email of emails) {
|
|
271
|
-
const userId = await GenericFunctions_1.getUserIdByEmail.call(this, email);
|
|
272
|
-
if (userId) {
|
|
273
|
-
userIds.push(userId);
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
console.warn(`Could not find user ID for email: ${email}`);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
if (userIds.length > 0) {
|
|
280
|
-
body.assignments = (0, GenericFunctions_1.createAssignmentsObject)(userIds);
|
|
281
|
-
}
|
|
282
|
-
else if (emails.length > 0) {
|
|
283
|
-
console.warn('No valid user IDs found for assignment. Check if User.Read.All permission is granted.');
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
// Only send PATCH request if there are fields to update (excluding description)
|
|
287
|
-
if (Object.keys(body).length > 0) {
|
|
288
|
-
await GenericFunctions_1.microsoftApiRequest.call(this, 'PATCH', `/planner/tasks/${taskId}`, body, {}, undefined, {
|
|
289
|
-
'If-Match': eTag,
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
// Update description if provided
|
|
293
|
-
if (updateFields.description) {
|
|
294
|
-
const details = await GenericFunctions_1.microsoftApiRequest.call(this, 'GET', `/planner/tasks/${taskId}/details`);
|
|
295
|
-
const detailsETag = (0, GenericFunctions_1.cleanETag)(details['@odata.etag']);
|
|
296
|
-
await GenericFunctions_1.microsoftApiRequest.call(this, 'PATCH', `/planner/tasks/${taskId}/details`, {
|
|
297
|
-
description: updateFields.description,
|
|
298
|
-
}, {}, undefined, {
|
|
299
|
-
'If-Match': detailsETag,
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
// Fetch updated task to return complete data
|
|
303
|
-
const responseData = await GenericFunctions_1.microsoftApiRequest.call(this, 'GET', `/planner/tasks/${taskId}`);
|
|
304
|
-
returnData.push(responseData);
|
|
305
|
-
}
|
|
306
|
-
// ----------------------------------
|
|
307
|
-
// task:delete
|
|
308
|
-
// ----------------------------------
|
|
309
|
-
if (operation === 'delete') {
|
|
310
|
-
const taskIdParam = this.getNodeParameter('taskId', i);
|
|
311
|
-
const taskId = typeof taskIdParam === 'string' ? taskIdParam : taskIdParam.value;
|
|
312
|
-
// Get current task to retrieve eTag
|
|
313
|
-
const currentTask = await GenericFunctions_1.microsoftApiRequest.call(this, 'GET', `/planner/tasks/${taskId}`);
|
|
314
|
-
const eTag = (0, GenericFunctions_1.cleanETag)(currentTask['@odata.etag']);
|
|
315
|
-
await GenericFunctions_1.microsoftApiRequest.call(this, 'DELETE', `/planner/tasks/${taskId}`, {}, {}, undefined, {
|
|
316
|
-
'If-Match': eTag,
|
|
317
|
-
});
|
|
318
|
-
returnData.push({ success: true, taskId });
|
|
319
|
-
}
|
|
320
|
-
// ----------------------------------
|
|
321
|
-
// task:getFiles
|
|
322
|
-
// ----------------------------------
|
|
323
|
-
if (operation === 'getFiles') {
|
|
324
|
-
const taskIdParam = this.getNodeParameter('taskId', i);
|
|
325
|
-
const taskId = typeof taskIdParam === 'string' ? taskIdParam : taskIdParam.value;
|
|
326
|
-
// Get task details
|
|
327
|
-
const details = await GenericFunctions_1.microsoftApiRequest.call(this, 'GET', `/planner/tasks/${taskId}/details`);
|
|
328
|
-
const references = details.references || {};
|
|
329
|
-
const files = Object.keys(references).map((encodedUrl) => {
|
|
330
|
-
// Decode the URL
|
|
331
|
-
const url = decodeURIComponent(encodedUrl);
|
|
332
|
-
return {
|
|
333
|
-
url,
|
|
334
|
-
alias: references[encodedUrl].alias,
|
|
335
|
-
type: references[encodedUrl].type,
|
|
336
|
-
previewPriority: references[encodedUrl].previewPriority,
|
|
337
|
-
lastModifiedDateTime: references[encodedUrl].lastModifiedDateTime,
|
|
338
|
-
lastModifiedBy: references[encodedUrl].lastModifiedBy,
|
|
339
|
-
};
|
|
156
|
+
let responseData;
|
|
157
|
+
switch (resource) {
|
|
158
|
+
case 'task':
|
|
159
|
+
responseData = await task_1.executeTask.call(this, operation, i, userCache);
|
|
160
|
+
break;
|
|
161
|
+
case 'plan':
|
|
162
|
+
responseData = await plan_1.executePlan.call(this, operation, i, userCache);
|
|
163
|
+
break;
|
|
164
|
+
case 'bucket':
|
|
165
|
+
responseData = await bucket_1.executeBucket.call(this, operation, i);
|
|
166
|
+
break;
|
|
167
|
+
case 'comment':
|
|
168
|
+
responseData = await comment_1.executeComment.call(this, operation, i);
|
|
169
|
+
break;
|
|
170
|
+
default:
|
|
171
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unsupported resource "${resource}"`, {
|
|
172
|
+
itemIndex: i,
|
|
340
173
|
});
|
|
341
|
-
returnData.push({
|
|
342
|
-
taskId,
|
|
343
|
-
fileCount: files.length,
|
|
344
|
-
files,
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
174
|
}
|
|
175
|
+
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
|
|
176
|
+
returnData.push(...executionData);
|
|
348
177
|
}
|
|
349
178
|
catch (error) {
|
|
350
179
|
if (this.continueOnFail()) {
|
|
351
|
-
|
|
352
|
-
|
|
180
|
+
returnData.push({
|
|
181
|
+
json: { error: error.message },
|
|
182
|
+
pairedItem: { item: i },
|
|
183
|
+
});
|
|
353
184
|
continue;
|
|
354
185
|
}
|
|
355
|
-
|
|
186
|
+
const context = error.context;
|
|
187
|
+
if (context && context.itemIndex === undefined) {
|
|
188
|
+
context.itemIndex = i;
|
|
189
|
+
}
|
|
190
|
+
if (error instanceof n8n_workflow_1.NodeApiError) {
|
|
191
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
192
|
+
}
|
|
193
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
|
|
356
194
|
}
|
|
357
195
|
}
|
|
358
|
-
return [
|
|
196
|
+
return [returnData];
|
|
359
197
|
}
|
|
360
198
|
}
|
|
361
199
|
exports.MicrosoftPlanner = MicrosoftPlanner;
|
|
200
|
+
//# sourceMappingURL=MicrosoftPlanner.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MicrosoftPlanner.node.js","sourceRoot":"","sources":["../../../nodes/MicrosoftPlanner/MicrosoftPlanner.node.ts"],"names":[],"mappings":";;;AAWA,+CAAqF;AAErF,yDAI4B;AAC5B,uDAA+D;AAC/D,uDAA+D;AAC/D,2DAAqE;AACrE,6DAAwE;AACxE,yCAA6C;AAC7C,yCAA6C;AAC7C,6CAAiD;AACjD,+CAAmD;AAEnD,SAAS,aAAa,CAAC,IAAY,EAAE,MAAe;IACnD,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AACrE,CAAC;AAED,MAAa,gBAAgB;IAA7B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,mBAAmB;YAChC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,kBAAkB,EAAE;YAC7D,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,gEAAgE;YAC7E,QAAQ,EAAE;gBACT,IAAI,EAAE,mBAAmB;aACzB;YACD,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAA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
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://github.com/blickwerk/n8n-nodes-microsoft-planner?tab=readme-ov-file#credentials"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://github.com/blickwerk/n8n-nodes-microsoft-planner?tab=readme-ov-file"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|