@prismatic-io/components-ms-planner 0.0.0-stage → 0.0.1

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.
@@ -0,0 +1,2576 @@
1
+ let _prismatic_io_spectral = require("@prismatic-io/spectral");
2
+ let _prismatic_io_spectral_http = require("@prismatic-io/spectral/http");
3
+ let node_crypto = require("node:crypto");
4
+ //#region src/utils/clean.ts
5
+ const cleanStringInput = (value) => value ? _prismatic_io_spectral.util.types.toString(value) : void 0;
6
+ const cleanOptionalNumber = (value) => value === void 0 || value === null || value === "" ? void 0 : _prismatic_io_spectral.util.types.toNumber(value);
7
+ const cleanStringList = (value) => {
8
+ if (!value) return void 0;
9
+ const list = (Array.isArray(value) ? value : [value]).map((entry) => _prismatic_io_spectral.util.types.toString(entry)).filter(Boolean);
10
+ return list.length ? list : void 0;
11
+ };
12
+ const cleanCategoryLabels = (value) => {
13
+ const labels = _prismatic_io_spectral.util.types.keyValPairListToObject(value ?? [], _prismatic_io_spectral.util.types.toString);
14
+ return Object.keys(labels).length ? labels : void 0;
15
+ };
16
+ const cleanChecklistItems = (value) => {
17
+ const items = (value ?? []).map(({ key, value: checked }) => ({
18
+ title: _prismatic_io_spectral.util.types.toString(key),
19
+ isChecked: _prismatic_io_spectral.util.types.toBool(checked)
20
+ }));
21
+ return items.length ? items : void 0;
22
+ };
23
+ const cleanReferences = (value) => {
24
+ const references = (value ?? []).map(({ key, value: alias }) => ({
25
+ url: _prismatic_io_spectral.util.types.toString(key),
26
+ alias: _prismatic_io_spectral.util.types.toString(alias)
27
+ }));
28
+ return references.length ? references : void 0;
29
+ };
30
+ //#endregion
31
+ //#region ../../packages/ms-utils/dist/connections/OAuth2AuthorizationCodeConnection.js
32
+ const _getMicrosoftOAuth2AuthorizationCodeConnection = ({ key, defaultScopes, comments, additionalInputs }) => (0, _prismatic_io_spectral.oauth2Connection)({
33
+ key,
34
+ display: {
35
+ label: "OAuth 2.0 Authorization Code",
36
+ description: "Authenticates actions in all Microsoft's Graph API services."
37
+ },
38
+ oauth2Type: _prismatic_io_spectral.OAuth2Type.AuthorizationCode,
39
+ inputs: (0, _prismatic_io_spectral.templateConnectionInputs)(Object.assign({
40
+ baseUrl: {
41
+ label: "Base URL",
42
+ placeholder: "https://graph.microsoft.com",
43
+ example: "https://graph.microsoft.com",
44
+ default: "https://graph.microsoft.com",
45
+ type: "string",
46
+ required: true,
47
+ shown: true,
48
+ comments: (comments === null || comments === void 0 ? void 0 : comments.baseUrl) || "The base URL for the Microsoft Graph API. Depending on your cloud environment, you can choose the correct one [here](https://learn.microsoft.com/en-us/graph/deployments#microsoft-graph-and-graph-explorer-service-root-endpoints)."
49
+ },
50
+ tenantUrl: {
51
+ label: "Tenant URL",
52
+ type: "string",
53
+ required: true,
54
+ shown: true,
55
+ comments: (comments === null || comments === void 0 ? void 0 : comments.tenantUrl) || "The tenant URL for the Microsoft Graph API. This is the URL of the tenant that you are connecting to. You can find this in the Azure portal or [here](https://learn.microsoft.com/en-us/entra/identity-platform/authentication-national-cloud#microsoft-entra-authentication-endpoints).",
56
+ example: "login.microsoftonline.com/common",
57
+ default: "login.microsoftonline.com/common",
58
+ placeholder: "login.microsoftonline.com/common"
59
+ },
60
+ scopes: {
61
+ label: "Scopes",
62
+ placeholder: "Scopes",
63
+ type: "string",
64
+ required: false,
65
+ shown: true,
66
+ comments: (comments === null || comments === void 0 ? void 0 : comments.scopes) || "Microsoft Graph API permission scopes are set on the OAuth application.",
67
+ default: defaultScopes || "offline_access"
68
+ },
69
+ clientId: {
70
+ label: "Client ID",
71
+ placeholder: "Client ID",
72
+ type: "string",
73
+ required: true,
74
+ shown: true,
75
+ comments: (comments === null || comments === void 0 ? void 0 : comments.clientId) || "Client Id of your Azure application.",
76
+ example: "11111111-2222-3333-4444-555555555555"
77
+ },
78
+ clientSecret: {
79
+ label: "Client secret value",
80
+ placeholder: "Client secret value",
81
+ type: "password",
82
+ required: true,
83
+ shown: true,
84
+ comments: (comments === null || comments === void 0 ? void 0 : comments.clientSecret) || "Client Secret generated under 'Certificates & Secrets' in your Azure application.",
85
+ example: "11111111-2222-3333-4444-555555555555"
86
+ },
87
+ extraParameters: {
88
+ label: "Additional Authorization Parameters",
89
+ type: "string",
90
+ required: false,
91
+ shown: true,
92
+ example: "prompt=consent",
93
+ placeholder: "Enter additional parameters for the authorization URL.",
94
+ comments: (comments === null || comments === void 0 ? void 0 : comments.extraParameters) || "Query string parameters to append to the OAuth authorization URL. Common parameters include `prompt=consent` to force the consent screen or `login_hint=user@example.com` to pre-fill the login email."
95
+ }
96
+ }, additionalInputs || {}), {
97
+ authorizeUrl: {
98
+ label: "Authorize URL",
99
+ placeholder: "Authorize URL",
100
+ type: "template",
101
+ required: true,
102
+ shown: false,
103
+ comments: (comments === null || comments === void 0 ? void 0 : comments.authorizeUrl) || "The OAuth 2.0 Authorization URL for Microsoft's Graph API.",
104
+ example: "login.microsoftonline.com/common",
105
+ templateValue: "https://{{#tenantUrl}}/oauth2/v2.0/authorize?{{#extraParameters}}"
106
+ },
107
+ tokenUrl: {
108
+ label: "Token URL",
109
+ placeholder: "Token URL",
110
+ type: "template",
111
+ required: true,
112
+ shown: false,
113
+ comments: (comments === null || comments === void 0 ? void 0 : comments.tokenUrl) || "The OAuth 2.0 Token URL for Microsoft's Graph API.",
114
+ example: "login.microsoftonline.com/common",
115
+ templateValue: "https://{{#tenantUrl}}/oauth2/v2.0/token"
116
+ }
117
+ }, _prismatic_io_spectral.OAuth2Type.AuthorizationCode)
118
+ });
119
+ const getMicrosoftOAuth2AuthorizationCodeConnection = _getMicrosoftOAuth2AuthorizationCodeConnection;
120
+ //#endregion
121
+ //#region ../../packages/ms-utils/dist/connections/OAuth2ClientCredentialsConnection.js
122
+ const _getMicrosoftOAuth2ClientCredentialsConnection = ({ key, defaultScopes, comments, additionalInputs }) => (0, _prismatic_io_spectral.oauth2Connection)({
123
+ key,
124
+ oauth2Type: _prismatic_io_spectral.OAuth2Type.ClientCredentials,
125
+ display: {
126
+ label: "OAuth 2.0 Client Credentials",
127
+ description: "Authenticates actions in all Microsoft's Graph API services."
128
+ },
129
+ inputs: (0, _prismatic_io_spectral.templateConnectionInputs)(Object.assign({
130
+ baseUrl: {
131
+ label: "Base URL",
132
+ placeholder: "https://graph.microsoft.com",
133
+ example: "https://graph.microsoft.com",
134
+ default: "https://graph.microsoft.com",
135
+ type: "string",
136
+ required: true,
137
+ shown: true,
138
+ comments: "The base URL for the Microsoft Graph API. Depending on your cloud environment, you can choose the correct one [here](https://learn.microsoft.com/en-us/graph/deployments#microsoft-graph-and-graph-explorer-service-root-endpoints)."
139
+ },
140
+ entraIdEndpoint: {
141
+ label: "Microsoft Entra ID Endpoint",
142
+ type: "string",
143
+ required: true,
144
+ shown: true,
145
+ comments: "The Microsoft Entra ID endpoint for the Microsoft Graph API. You can find this in the Azure portal or [here](https://learn.microsoft.com/en-us/graph/deployments#app-registration-and-token-service-root-endpoints).",
146
+ example: "https://login.microsoftonline.com",
147
+ default: "https://login.microsoftonline.com",
148
+ placeholder: "https://login.microsoftonline.com"
149
+ },
150
+ tenant: {
151
+ label: "Tenant",
152
+ type: "string",
153
+ required: true,
154
+ shown: true,
155
+ comments: (comments === null || comments === void 0 ? void 0 : comments.tenantId) || "The tenant ID or name for the Microsoft Graph API. This is the ID or name of the tenant that you are connecting to.",
156
+ example: "11111111-2222-3333-4444-555555555555",
157
+ placeholder: "11111111-2222-3333-4444-555555555555"
158
+ },
159
+ clientId: {
160
+ label: "Client ID",
161
+ placeholder: "Client ID",
162
+ type: "string",
163
+ required: true,
164
+ shown: true,
165
+ comments: (comments === null || comments === void 0 ? void 0 : comments.clientId) || "Client Id of your Azure application.",
166
+ example: "11111111-2222-3333-4444-555555555555"
167
+ },
168
+ clientSecret: {
169
+ label: "Client Secret",
170
+ placeholder: "Client Secret",
171
+ type: "password",
172
+ required: true,
173
+ shown: true,
174
+ comments: (comments === null || comments === void 0 ? void 0 : comments.clientSecret) || "Client Secret generated under 'Certificates & Secrets' in your Azure application.",
175
+ example: "11111111-2222-3333-4444-555555555555"
176
+ },
177
+ scopes: {
178
+ label: "Scopes",
179
+ placeholder: "https://graph.microsoft.com/.default",
180
+ type: "string",
181
+ required: false,
182
+ shown: true,
183
+ comments: (comments === null || comments === void 0 ? void 0 : comments.scopes) || "Microsoft Graph API Scopes.",
184
+ default: defaultScopes || "https://graph.microsoft.com/.default"
185
+ }
186
+ }, additionalInputs || {}), { tokenUrl: {
187
+ label: "Token URL",
188
+ placeholder: "Token URL",
189
+ type: "template",
190
+ required: true,
191
+ shown: false,
192
+ comments: (comments === null || comments === void 0 ? void 0 : comments.tokenUrl) || "Provide a tenant specific OAuth 2.0 token endpoint.",
193
+ templateValue: "{{#entraIdEndpoint}}/{{#tenant}}/oauth2/v2.0/token"
194
+ } }, _prismatic_io_spectral.OAuth2Type.ClientCredentials)
195
+ });
196
+ const getMicrosoftOAuth2ClientCredentialsConnection = _getMicrosoftOAuth2ClientCredentialsConnection;
197
+ //#endregion
198
+ //#region ../../packages/ms-utils/dist/connections/index.js
199
+ var ConnectionKeys;
200
+ (function(ConnectionKeys) {
201
+ ConnectionKeys["SharedOauth"] = "oauth";
202
+ ConnectionKeys["SharepointTemplatedOauth"] = "sharepointTemplatedOauth";
203
+ ConnectionKeys["MsExcelOauth"] = "ms-excel-oauth";
204
+ ConnectionKeys["OauthClientCredentials"] = "oauthClientCredentials";
205
+ ConnectionKeys["CertificateCredentials"] = "certificateCredentials";
206
+ })(ConnectionKeys || (ConnectionKeys = {}));
207
+ //#endregion
208
+ //#region src/connections/oauthClientCredentials.ts
209
+ const oauthClientCredentials = getMicrosoftOAuth2ClientCredentialsConnection({
210
+ key: "oauthClientCredentials",
211
+ additionalInputs: { userId: {
212
+ label: "User ID",
213
+ placeholder: "Enter User ID",
214
+ type: "string",
215
+ required: true,
216
+ shown: true,
217
+ example: "48d31887-5fad-4d73-a9f5-3c356e68a038",
218
+ comments: "Object ID or user principal name of the user whose Planner data is accessed, found in the Microsoft Entra admin center under Users. Required because a client credentials token has no signed-in user, so every /me path is rewritten to /users/{User ID}."
219
+ } },
220
+ comments: { tenantId: "Tenant ID or primary domain, found on the Overview page of the Microsoft Entra admin center. A client credentials token cannot be issued against the 'common' endpoint, so a specific tenant is required here." }
221
+ });
222
+ //#endregion
223
+ //#region src/constants.ts
224
+ const GRAPH_BASE_URL = "https://graph.microsoft.com";
225
+ const GRAPH_API_VERSION = "v1.0";
226
+ const SCOPES_FOR_AUTHORIZATION_CODE_FLOW = "https://graph.microsoft.com/Tasks.ReadWrite https://graph.microsoft.com/User.Read https://graph.microsoft.com/User.ReadBasic.All offline_access";
227
+ const LOOK_BACK_DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
228
+ const CONFLICT_STATUSES = [409, 412];
229
+ const ODATA_TYPE = {
230
+ assignment: "#microsoft.graph.plannerAssignment",
231
+ checklistItem: "#microsoft.graph.plannerChecklistItem",
232
+ externalReference: "#microsoft.graph.plannerExternalReference"
233
+ };
234
+ const PLANNER_ENDPOINTS = {
235
+ PLANS: "/planner/plans",
236
+ PLAN: (planId) => `/planner/plans/${planId}`,
237
+ PLAN_DETAILS: (planId) => `/planner/plans/${planId}/details`,
238
+ PLAN_BUCKETS: (planId) => `/planner/plans/${planId}/buckets`,
239
+ PLAN_TASKS: (planId) => `/planner/plans/${planId}/tasks`,
240
+ GROUP_PLANS: (groupId) => `/groups/${groupId}/planner/plans`,
241
+ USER_PLANS: "/me/planner/plans",
242
+ BUCKETS: "/planner/buckets",
243
+ BUCKET: (bucketId) => `/planner/buckets/${bucketId}`,
244
+ BUCKET_TASKS: (bucketId) => `/planner/buckets/${bucketId}/tasks`,
245
+ TASKS: "/planner/tasks",
246
+ TASK: (taskId) => `/planner/tasks/${taskId}`,
247
+ TASK_DETAILS: (taskId) => `/planner/tasks/${taskId}/details`,
248
+ USER_TASKS: "/me/planner/tasks",
249
+ GROUPS: "/groups",
250
+ MEMBER_OF_GROUPS: "/me/memberOf/microsoft.graph.group",
251
+ USERS: "/users"
252
+ };
253
+ //#endregion
254
+ //#region src/connections/index.ts
255
+ var connections_default = [getMicrosoftOAuth2AuthorizationCodeConnection({
256
+ key: "templatedOauth",
257
+ defaultScopes: SCOPES_FOR_AUTHORIZATION_CODE_FLOW,
258
+ comments: { scopes: "Space-separated Microsoft Graph scopes. Tasks.ReadWrite covers all Planner reads and writes and offline_access is required to receive a refresh token. Add Group.Read.All to list every group in the tenant rather than only the groups the signed-in user belongs to." }
259
+ }), oauthClientCredentials];
260
+ //#endregion
261
+ //#region src/utils/connection.ts
262
+ const isClientCredentials = (connection) => connection.key === oauthClientCredentials.key;
263
+ const computeEndpointBasedOnConnection = (connection, endpoint) => {
264
+ if (!isClientCredentials(connection)) return endpoint;
265
+ const userId = _prismatic_io_spectral.util.types.toString(connection.fields.userId);
266
+ if (!userId) throw new _prismatic_io_spectral.ConnectionError(connection, "The client credentials connection requires a User ID, because a token issued without a signed-in user cannot resolve /me paths.");
267
+ return endpoint.replace(/^\/me(?=\/|$)/, `/users/${userId}`);
268
+ };
269
+ const graphBaseUrl = (connection) => `${_prismatic_io_spectral.util.types.toString(connection.fields.baseUrl) || "https://graph.microsoft.com"}/${GRAPH_API_VERSION}`;
270
+ const validateConnection = (connection) => {
271
+ if (!connection?.token?.access_token) throw new _prismatic_io_spectral.ConnectionError(connection, "No access token was found on the connection. Reauthorize the Microsoft Planner connection and try again.");
272
+ };
273
+ //#endregion
274
+ //#region src/utils/etag.ts
275
+ const statusOf = (error) => error?.response?.status;
276
+ const isConflict = (error) => CONFLICT_STATUSES.includes(statusOf(error) ?? 0);
277
+ const writeWithEtag = async (client, path, providedEtag, write) => {
278
+ if (providedEtag) return write(providedEtag);
279
+ let lastError;
280
+ for (let attempt = 0; attempt <= 2; attempt += 1) {
281
+ const etag = await resolveEtag(client, path);
282
+ try {
283
+ return await write(etag);
284
+ } catch (error) {
285
+ if (!isConflict(error)) throw error;
286
+ lastError = error;
287
+ }
288
+ }
289
+ throw new Error(`Microsoft Planner reported a version conflict on ${path} after 3 attempts. The resource is being modified concurrently by another client.`, { cause: lastError });
290
+ };
291
+ const patchWithEtag = async (client, path, body, providedEtag) => writeWithEtag(client, path, providedEtag, async (etag) => {
292
+ const { data } = await client.patch(path, body, { headers: {
293
+ "If-Match": etag,
294
+ "Content-Type": "application/json",
295
+ Prefer: "return=representation"
296
+ } });
297
+ return data;
298
+ });
299
+ const deleteWithEtag = async (client, path, providedEtag) => {
300
+ await writeWithEtag(client, path, providedEtag, async (etag) => {
301
+ await client.delete(path, { headers: { "If-Match": etag } });
302
+ });
303
+ };
304
+ const resolveEtag = async (client, path) => {
305
+ const { data } = await client.get(path);
306
+ const etag = data["@odata.etag"];
307
+ if (!etag) throw new Error(`Microsoft Planner did not return an @odata.etag for ${path}. An etag is required to modify or delete this resource.`);
308
+ return etag;
309
+ };
310
+ //#endregion
311
+ //#region src/utils/openTypes.ts
312
+ const buildAssignments = (assignTo = [], unassign = []) => {
313
+ const assignments = {};
314
+ for (const userId of assignTo) assignments[userId] = {
315
+ "@odata.type": ODATA_TYPE.assignment,
316
+ orderHint: " !"
317
+ };
318
+ for (const userId of unassign) assignments[userId] = null;
319
+ return assignments;
320
+ };
321
+ const buildAppliedCategories = (applied = [], removed = []) => {
322
+ const categories = {};
323
+ for (const category of applied) categories[category] = true;
324
+ for (const category of removed) categories[category] = false;
325
+ return categories;
326
+ };
327
+ const buildChecklist = (add = [], update = [], removeIds = []) => {
328
+ const checklist = {};
329
+ for (const item of add) checklist[(0, node_crypto.randomUUID)()] = {
330
+ "@odata.type": ODATA_TYPE.checklistItem,
331
+ title: item.title,
332
+ isChecked: item.isChecked ?? false
333
+ };
334
+ for (const item of update) {
335
+ const entry = { "@odata.type": ODATA_TYPE.checklistItem };
336
+ if (item.title !== void 0) entry.title = item.title;
337
+ if (item.isChecked !== void 0) entry.isChecked = item.isChecked;
338
+ checklist[item.id] = entry;
339
+ }
340
+ for (const id of removeIds) checklist[id] = null;
341
+ return checklist;
342
+ };
343
+ const buildReferences = (add = [], removeUrls = []) => {
344
+ const references = {};
345
+ for (const reference of add) {
346
+ const entry = {
347
+ "@odata.type": ODATA_TYPE.externalReference,
348
+ previewPriority: " !"
349
+ };
350
+ if (reference.alias) entry.alias = reference.alias;
351
+ if (reference.type) entry.type = reference.type;
352
+ references[encodeReferenceKey(reference.url)] = entry;
353
+ }
354
+ for (const url of removeUrls) references[encodeReferenceKey(url)] = null;
355
+ return references;
356
+ };
357
+ const compact = (body) => Object.fromEntries(Object.entries(body).filter(([, value]) => value !== void 0));
358
+ const encodeReferenceKey = (url) => url.replace(/%/g, "%25").replace(/\./g, "%2E").replace(/:/g, "%3A").replace(/@/g, "%40").replace(/#/g, "%23");
359
+ //#endregion
360
+ //#region src/utils/polling.ts
361
+ const resolvePlannerTaskChanges = (data) => {
362
+ return ((data ?? { created: [] }).created ?? []).map((record) => ({
363
+ changeType: "created",
364
+ record
365
+ }));
366
+ };
367
+ const newestCreatedDateTime = (tasks) => {
368
+ let newest;
369
+ for (const { createdDateTime } of tasks) {
370
+ if (!createdDateTime) continue;
371
+ const created = Date.parse(createdDateTime);
372
+ if (!Number.isNaN(created) && (newest === void 0 || created > newest)) newest = created;
373
+ }
374
+ return newest === void 0 ? void 0 : new Date(newest).toISOString();
375
+ };
376
+ const latestCreatedDateTime = (tasks, current) => {
377
+ const newest = newestCreatedDateTime(tasks);
378
+ const currentDate = new Date(current);
379
+ return newest && new Date(newest) > currentDate ? newest : currentDate.toISOString();
380
+ };
381
+ const lookBackDateClean = (value) => {
382
+ const str = _prismatic_io_spectral.util.types.toString(value).trim();
383
+ if (!str) return "";
384
+ if (!LOOK_BACK_DATE_PATTERN.test(str)) throw new Error("Look-back Date must be in YYYY-MM-DD format.");
385
+ const parts = str.split("-");
386
+ const year = _prismatic_io_spectral.util.types.toNumber(parts[0]);
387
+ const month = _prismatic_io_spectral.util.types.toNumber(parts[1]);
388
+ const day = _prismatic_io_spectral.util.types.toNumber(parts[2]);
389
+ const parsed = new Date(Date.UTC(year, month - 1, day));
390
+ if (parsed.getUTCFullYear() !== year || parsed.getUTCMonth() !== month - 1 || parsed.getUTCDate() !== day) throw new Error(`Look-back Date "${str}" is not a valid calendar date.`);
391
+ if (parsed.getTime() > Date.now()) throw new Error("Look-back Date cannot be a future date.");
392
+ return str;
393
+ };
394
+ //#endregion
395
+ //#region src/utils/pagination.ts
396
+ const fetchAllPlanner = async (client, endpoint) => {
397
+ const results = [];
398
+ let nextLink;
399
+ let context;
400
+ let pages = 0;
401
+ do {
402
+ const { data } = await client.get(nextLink || endpoint);
403
+ context ??= data["@odata.context"];
404
+ results.push(...data.value ?? []);
405
+ nextLink = data["@odata.nextLink"];
406
+ pages += 1;
407
+ } while (nextLink && pages < 100);
408
+ return {
409
+ "@odata.context": context,
410
+ value: results,
411
+ truncated: Boolean(nextLink)
412
+ };
413
+ };
414
+ const fetchAllDirectory = async (client, endpoint, params = {}) => {
415
+ const results = [];
416
+ let nextLink;
417
+ let context;
418
+ let pages = 0;
419
+ do {
420
+ const { data } = await client.get(nextLink || endpoint, nextLink ? void 0 : { params });
421
+ context ??= data["@odata.context"];
422
+ results.push(...data.value ?? []);
423
+ nextLink = data["@odata.nextLink"];
424
+ pages += 1;
425
+ } while (nextLink && pages < 100);
426
+ return {
427
+ "@odata.context": context,
428
+ value: results
429
+ };
430
+ };
431
+ const fetchTasksCreatedSince = async (client, endpoint, since) => {
432
+ const { value, truncated } = await fetchAllPlanner(client, endpoint);
433
+ const sinceDate = since ? new Date(since) : void 0;
434
+ const created = value.filter((record) => {
435
+ if (!sinceDate || !record.createdDateTime) return false;
436
+ return new Date(record.createdDateTime) > sinceDate;
437
+ });
438
+ return {
439
+ fetched: value.length,
440
+ created,
441
+ newestCreatedDateTime: newestCreatedDateTime(value),
442
+ truncated
443
+ };
444
+ };
445
+ //#endregion
446
+ //#region src/client.ts
447
+ const createClient = (connection, debug = false) => {
448
+ validateConnection(connection);
449
+ return (0, _prismatic_io_spectral_http.createClient)({
450
+ baseUrl: graphBaseUrl(connection),
451
+ headers: {
452
+ Authorization: `Bearer ${_prismatic_io_spectral.util.types.toString(connection.token?.access_token)}`,
453
+ Accept: "application/json",
454
+ "Content-Type": "application/json"
455
+ },
456
+ debug,
457
+ responseType: "json"
458
+ });
459
+ };
460
+ //#endregion
461
+ //#region src/examplePayloads.ts
462
+ const PLAN_ID = "xqQg5FS2LkCp935s-FIFm2QAFkHM";
463
+ const BUCKET_ID = "hsOf2dhOJkqyYYZEtdzDe2QAIUCR";
464
+ const TASK_ID = "01gzSlKkIUSUl6DF_EilrmQAKDhh";
465
+ const GROUP_ID = "ebf3b108-5234-4e22-b93d-656d7dae5874";
466
+ const USER_ID = "fbab97d0-4932-4511-b675-204639209557";
467
+ const identitySet = {
468
+ application: {
469
+ displayName: null,
470
+ id: "09abbdfd-ed23-44ee-a2d9-a627aa1c90f3"
471
+ },
472
+ user: {
473
+ displayName: null,
474
+ id: USER_ID
475
+ }
476
+ };
477
+ const plan = {
478
+ "@odata.etag": "W/\"JzEtUGxhbiAgQEBAQEBAQEBAQEBAQEBAWCc=\"",
479
+ id: PLAN_ID,
480
+ title: "Q3 Marketing Launch",
481
+ owner: GROUP_ID,
482
+ createdDateTime: "2024-01-08T16:22:41.3466667Z",
483
+ createdBy: identitySet,
484
+ container: {
485
+ containerId: GROUP_ID,
486
+ type: "group",
487
+ url: `https://graph.microsoft.com/v1.0/groups/${GROUP_ID}`
488
+ }
489
+ };
490
+ const bucket = {
491
+ "@odata.etag": "W/\"JzEtQnVja2V0QEBAQEBAQEBAQEBAQEBAQEBAWCc=\"",
492
+ id: BUCKET_ID,
493
+ name: "In Review",
494
+ planId: PLAN_ID,
495
+ orderHint: "85752723360752+"
496
+ };
497
+ const task = {
498
+ "@odata.etag": "W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"",
499
+ id: TASK_ID,
500
+ planId: PLAN_ID,
501
+ bucketId: BUCKET_ID,
502
+ title: "Update the client list",
503
+ orderHint: "8586633654432719852",
504
+ assigneePriority: "8586633654432719852",
505
+ percentComplete: 50,
506
+ priority: 5,
507
+ startDateTime: "2024-01-15T12:00:00Z",
508
+ dueDateTime: "2024-01-22T12:00:00Z",
509
+ createdDateTime: "2024-01-09T09:12:03.1533333Z",
510
+ completedDateTime: null,
511
+ completedBy: null,
512
+ hasDescription: true,
513
+ previewType: "automatic",
514
+ referenceCount: 1,
515
+ checklistItemCount: 2,
516
+ activeChecklistItemCount: 1,
517
+ conversationThreadId: null,
518
+ createdBy: identitySet,
519
+ appliedCategories: { category3: true },
520
+ assignments: { [USER_ID]: {
521
+ "@odata.type": "#microsoft.graph.plannerAssignment",
522
+ assignedDateTime: "2024-01-09T09:14:11.2Z",
523
+ orderHint: "8586633654432719852P(",
524
+ assignedBy: identitySet
525
+ } }
526
+ };
527
+ const completedTask = {
528
+ ...task,
529
+ "@odata.etag": "W/\"JzItVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"",
530
+ percentComplete: 100,
531
+ completedDateTime: "2024-01-20T15:40:22.7Z",
532
+ completedBy: identitySet
533
+ };
534
+ const planDetails = {
535
+ "@odata.etag": "W/\"JzEtUGxhbkRldGFpbHNAQEBAQEBAQEBAQEBAQEBARCc=\"",
536
+ id: PLAN_ID,
537
+ sharedWith: { [USER_ID]: true },
538
+ categoryDescriptions: {
539
+ category1: "Blocked",
540
+ category2: "Needs Review",
541
+ category3: "Customer Facing",
542
+ category4: null,
543
+ category5: null,
544
+ category6: null,
545
+ category7: null,
546
+ category8: null,
547
+ category9: null,
548
+ category10: null,
549
+ category11: null,
550
+ category12: null,
551
+ category13: null,
552
+ category14: null,
553
+ category15: null,
554
+ category16: null,
555
+ category17: null,
556
+ category18: null,
557
+ category19: null,
558
+ category20: null,
559
+ category21: null,
560
+ category22: null,
561
+ category23: null,
562
+ category24: null,
563
+ category25: null
564
+ }
565
+ };
566
+ const taskDetails = {
567
+ "@odata.etag": "W/\"JzEtVGFza0RldGFpbHNAQEBAQEBAQEBAQEBAQEBARCc=\"",
568
+ id: TASK_ID,
569
+ description: "Confirm every contact before the launch.",
570
+ previewType: "description",
571
+ references: { "https%3A//example%2Ecom/spec": {
572
+ "@odata.type": "#microsoft.graph.plannerExternalReference",
573
+ alias: "Launch specification",
574
+ type: "Other",
575
+ previewPriority: "8586633654432719852",
576
+ lastModifiedDateTime: "2024-01-09T09:20:44.1Z",
577
+ lastModifiedBy: identitySet
578
+ } },
579
+ checklist: {
580
+ "95e27074-6c4a-447a-aa24-9d718a0b86fa": {
581
+ "@odata.type": "#microsoft.graph.plannerChecklistItem",
582
+ title: "Confirm the mailing address",
583
+ isChecked: true,
584
+ orderHint: "8586633654432719852",
585
+ lastModifiedDateTime: "2024-01-09T09:21:02.4Z",
586
+ lastModifiedBy: identitySet
587
+ },
588
+ "d280ed1a-9f6b-4f9c-a962-fb4d00dc50ff": {
589
+ "@odata.type": "#microsoft.graph.plannerChecklistItem",
590
+ title: "Verify the contact owner",
591
+ isChecked: false,
592
+ orderHint: "8586633654432719853",
593
+ lastModifiedDateTime: "2024-01-09T09:21:15.9Z",
594
+ lastModifiedBy: identitySet
595
+ }
596
+ }
597
+ };
598
+ const planCollectionContext = "https://graph.microsoft.com/v1.0/$metadata#planner/plans";
599
+ const bucketCollectionContext = "https://graph.microsoft.com/v1.0/$metadata#planner/buckets";
600
+ const taskCollectionContext = "https://graph.microsoft.com/v1.0/$metadata#planner/tasks";
601
+ const listPlansInGroupExamplePayload = { data: {
602
+ "@odata.context": planCollectionContext,
603
+ value: [plan],
604
+ truncated: false
605
+ } };
606
+ const listPlansForUserExamplePayload = { data: {
607
+ "@odata.context": planCollectionContext,
608
+ value: [plan],
609
+ truncated: false
610
+ } };
611
+ const getPlanExamplePayload = { data: plan };
612
+ const createPlanExamplePayload = { data: plan };
613
+ const updatePlanExamplePayload = { data: {
614
+ ...plan,
615
+ "@odata.etag": "W/\"JzItUGxhbiAgQEBAQEBAQEBAQEBAQEBAWCc=\"",
616
+ title: "Q3 Marketing Launch (Revised)"
617
+ } };
618
+ const deletePlanExamplePayload = { data: {
619
+ success: true,
620
+ id: PLAN_ID,
621
+ message: "Plan deleted successfully"
622
+ } };
623
+ const getPlanDetailsExamplePayload = { data: planDetails };
624
+ const updatePlanDetailsExamplePayload = { data: planDetails };
625
+ const listBucketsInPlanExamplePayload = { data: {
626
+ "@odata.context": bucketCollectionContext,
627
+ value: [bucket],
628
+ truncated: false
629
+ } };
630
+ const getBucketExamplePayload = { data: bucket };
631
+ const createBucketExamplePayload = { data: bucket };
632
+ const updateBucketExamplePayload = { data: {
633
+ ...bucket,
634
+ "@odata.etag": "W/\"JzItQnVja2V0QEBAQEBAQEBAQEBAQEBAQEBAWCc=\"",
635
+ name: "Ready to Ship"
636
+ } };
637
+ const deleteBucketExamplePayload = { data: {
638
+ success: true,
639
+ id: BUCKET_ID,
640
+ message: "Bucket deleted successfully"
641
+ } };
642
+ const listTasksInPlanExamplePayload = { data: {
643
+ "@odata.context": taskCollectionContext,
644
+ value: [task],
645
+ truncated: false
646
+ } };
647
+ const listTasksInBucketExamplePayload = { data: {
648
+ "@odata.context": taskCollectionContext,
649
+ value: [task],
650
+ truncated: false
651
+ } };
652
+ const listTasksForUserExamplePayload = { data: {
653
+ "@odata.context": taskCollectionContext,
654
+ value: [task],
655
+ truncated: false
656
+ } };
657
+ const getTaskExamplePayload = { data: task };
658
+ const createTaskExamplePayload = { data: {
659
+ task,
660
+ details: taskDetails
661
+ } };
662
+ const updateTaskExamplePayload = { data: {
663
+ ...task,
664
+ "@odata.etag": "W/\"JzItVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"",
665
+ title: "Update the client list before launch"
666
+ } };
667
+ const deleteTaskExamplePayload = { data: {
668
+ success: true,
669
+ id: TASK_ID,
670
+ message: "Task deleted successfully"
671
+ } };
672
+ const getTaskDetailsExamplePayload = { data: taskDetails };
673
+ const updateTaskDetailsExamplePayload = { data: taskDetails };
674
+ const completeTaskExamplePayload = { data: completedTask };
675
+ const assignTaskExamplePayload = { data: {
676
+ ...task,
677
+ "@odata.etag": "W/\"JzItVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\""
678
+ } };
679
+ const moveTaskToBucketExamplePayload = { data: {
680
+ ...task,
681
+ "@odata.etag": "W/\"JzItVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"",
682
+ bucketId: "vNZfhYs0GkWQ2Bo0R0h3upcAG5rB"
683
+ } };
684
+ const rawRequestExamplePayload = { data: {
685
+ "@odata.context": planCollectionContext,
686
+ value: [plan]
687
+ } };
688
+ const selectPlanExamplePayload = { result: [{
689
+ label: "Q3 Marketing Launch",
690
+ key: PLAN_ID
691
+ }] };
692
+ const selectBucketExamplePayload = { result: [{
693
+ label: "In Review",
694
+ key: BUCKET_ID
695
+ }] };
696
+ const selectTaskExamplePayload = { result: [{
697
+ label: "Update the client list",
698
+ key: TASK_ID
699
+ }] };
700
+ const selectGroupExamplePayload = { result: [{
701
+ label: "Marketing",
702
+ key: GROUP_ID
703
+ }] };
704
+ const selectUserExamplePayload = { result: [{
705
+ label: "Jane Smith",
706
+ key: USER_ID
707
+ }] };
708
+ const pollChangesTriggerExamplePayload = {
709
+ payload: {
710
+ headers: {},
711
+ queryParameters: {},
712
+ rawBody: { data: null },
713
+ body: { data: { created: [task] } },
714
+ pathFragment: "",
715
+ webhookUrls: {},
716
+ webhookApiKeys: {},
717
+ invokeUrl: "",
718
+ executionId: "SW5zdGFuY2VFeGVjdXRpb25SZXN1bHQ6ZjMwZjk4NDgtNzk1Ny00ZTBmLTk5NzMtMTU5NzZlNzAwZjA5",
719
+ customer: {
720
+ id: "Q3VzdG9tZXI6ZTU5YQ==",
721
+ externalId: "abc-123",
722
+ name: "Contoso"
723
+ },
724
+ instance: {
725
+ id: "SW5zdGFuY2U6NTU1",
726
+ name: "Contoso Planner Sync"
727
+ },
728
+ user: {
729
+ id: "VXNlcjo3ODk=",
730
+ email: "jane@example.com",
731
+ name: "Jane Smith",
732
+ externalId: "user-789"
733
+ },
734
+ integration: {
735
+ id: "SW50ZWdyYXRpb246MTIz",
736
+ name: "Planner Task Sync",
737
+ versionSequenceId: "SW50ZWdyYXRpb25WZXJzaW9uOjQ1Ng==",
738
+ externalVersion: "1.0.0"
739
+ },
740
+ flow: {
741
+ id: "SW50ZWdyYXRpb25GbG93Ojk5OQ==",
742
+ name: "New Tasks",
743
+ stableId: "new-tasks"
744
+ },
745
+ startedAt: "2024-01-22T14:05:00.000Z",
746
+ globalDebug: false
747
+ },
748
+ polledNoChanges: false
749
+ };
750
+ //#endregion
751
+ //#region src/outputSchemas/common.ts
752
+ const identitySchema = {
753
+ type: "object",
754
+ properties: {
755
+ displayName: { type: ["string", "null"] },
756
+ id: { type: "string" },
757
+ tenantId: { type: "string" },
758
+ thumbnails: { type: "object" }
759
+ }
760
+ };
761
+ const identitySetSchema = {
762
+ type: "object",
763
+ properties: {
764
+ application: identitySchema,
765
+ applicationInstance: identitySchema,
766
+ conversation: identitySchema,
767
+ conversationIdentityType: identitySchema,
768
+ device: identitySchema,
769
+ encrypted: identitySchema,
770
+ onPremises: identitySchema,
771
+ guest: identitySchema,
772
+ phone: identitySchema,
773
+ user: identitySchema
774
+ }
775
+ };
776
+ const deleteResultSchema = {
777
+ type: "object",
778
+ properties: {
779
+ success: {
780
+ type: "boolean",
781
+ enum: [true]
782
+ },
783
+ id: { type: "string" },
784
+ message: { type: "string" }
785
+ },
786
+ required: [
787
+ "success",
788
+ "id",
789
+ "message"
790
+ ]
791
+ };
792
+ //#endregion
793
+ //#region src/outputSchemas/buckets.ts
794
+ const plannerBucketSchema = {
795
+ type: "object",
796
+ properties: {
797
+ "@odata.etag": { type: "string" },
798
+ id: { type: "string" },
799
+ name: { type: "string" },
800
+ orderHint: { type: "string" },
801
+ planId: { type: "string" }
802
+ },
803
+ required: ["id"]
804
+ };
805
+ const listBucketsInPlanOutputSchema = {
806
+ type: "object",
807
+ properties: {
808
+ "@odata.context": { type: "string" },
809
+ value: {
810
+ type: "array",
811
+ items: plannerBucketSchema
812
+ },
813
+ truncated: { type: "boolean" }
814
+ },
815
+ required: ["value", "truncated"]
816
+ };
817
+ const getBucketOutputSchema = plannerBucketSchema;
818
+ const createBucketOutputSchema = plannerBucketSchema;
819
+ const updateBucketOutputSchema = plannerBucketSchema;
820
+ const deleteBucketOutputSchema = deleteResultSchema;
821
+ //#endregion
822
+ //#region src/outputSchemas/plans.ts
823
+ const plannerPlanSchema = {
824
+ type: "object",
825
+ properties: {
826
+ "@odata.etag": { type: "string" },
827
+ id: { type: "string" },
828
+ title: { type: "string" },
829
+ owner: { type: "string" },
830
+ container: {
831
+ type: "object",
832
+ properties: {
833
+ containerId: { type: "string" },
834
+ type: { type: "string" },
835
+ url: { type: "string" }
836
+ }
837
+ },
838
+ createdBy: identitySetSchema,
839
+ createdDateTime: {
840
+ type: "string",
841
+ format: "date-time"
842
+ }
843
+ },
844
+ required: ["id"]
845
+ };
846
+ const plannerPlanCollectionSchema = {
847
+ type: "object",
848
+ properties: {
849
+ "@odata.context": { type: "string" },
850
+ value: {
851
+ type: "array",
852
+ items: plannerPlanSchema
853
+ },
854
+ truncated: { type: "boolean" }
855
+ },
856
+ required: ["value", "truncated"]
857
+ };
858
+ const listPlansInGroupOutputSchema = plannerPlanCollectionSchema;
859
+ const listPlansForUserOutputSchema = plannerPlanCollectionSchema;
860
+ const getPlanOutputSchema = plannerPlanSchema;
861
+ const createPlanOutputSchema = plannerPlanSchema;
862
+ const updatePlanOutputSchema = plannerPlanSchema;
863
+ const plannerPlanDetailsSchema = {
864
+ type: "object",
865
+ properties: {
866
+ "@odata.etag": { type: "string" },
867
+ id: { type: "string" },
868
+ categoryDescriptions: {
869
+ type: "object",
870
+ properties: {
871
+ category1: { type: ["string", "null"] },
872
+ category2: { type: ["string", "null"] },
873
+ category3: { type: ["string", "null"] },
874
+ category4: { type: ["string", "null"] },
875
+ category5: { type: ["string", "null"] },
876
+ category6: { type: ["string", "null"] },
877
+ category7: { type: ["string", "null"] },
878
+ category8: { type: ["string", "null"] },
879
+ category9: { type: ["string", "null"] },
880
+ category10: { type: ["string", "null"] },
881
+ category11: { type: ["string", "null"] },
882
+ category12: { type: ["string", "null"] },
883
+ category13: { type: ["string", "null"] },
884
+ category14: { type: ["string", "null"] },
885
+ category15: { type: ["string", "null"] },
886
+ category16: { type: ["string", "null"] },
887
+ category17: { type: ["string", "null"] },
888
+ category18: { type: ["string", "null"] },
889
+ category19: { type: ["string", "null"] },
890
+ category20: { type: ["string", "null"] },
891
+ category21: { type: ["string", "null"] },
892
+ category22: { type: ["string", "null"] },
893
+ category23: { type: ["string", "null"] },
894
+ category24: { type: ["string", "null"] },
895
+ category25: { type: ["string", "null"] }
896
+ }
897
+ },
898
+ sharedWith: {
899
+ type: "object",
900
+ additionalProperties: { type: "boolean" }
901
+ }
902
+ },
903
+ required: ["id"]
904
+ };
905
+ const getPlanDetailsOutputSchema = plannerPlanDetailsSchema;
906
+ const updatePlanDetailsOutputSchema = plannerPlanDetailsSchema;
907
+ const deletePlanOutputSchema = deleteResultSchema;
908
+ //#endregion
909
+ //#region src/outputSchemas/tasks.ts
910
+ const plannerAssignmentSchema = {
911
+ type: "object",
912
+ properties: {
913
+ "@odata.type": { type: "string" },
914
+ assignedBy: identitySetSchema,
915
+ assignedDateTime: {
916
+ type: "string",
917
+ format: "date-time"
918
+ },
919
+ orderHint: { type: "string" }
920
+ }
921
+ };
922
+ const plannerTaskSchema = {
923
+ type: "object",
924
+ properties: {
925
+ "@odata.etag": { type: "string" },
926
+ id: { type: "string" },
927
+ title: { type: "string" },
928
+ planId: { type: "string" },
929
+ bucketId: { type: "string" },
930
+ orderHint: { type: "string" },
931
+ assigneePriority: { type: "string" },
932
+ percentComplete: { type: "integer" },
933
+ priority: { type: "integer" },
934
+ previewType: {
935
+ type: "string",
936
+ enum: [
937
+ "automatic",
938
+ "noPreview",
939
+ "checklist",
940
+ "description",
941
+ "reference"
942
+ ]
943
+ },
944
+ hasDescription: { type: "boolean" },
945
+ activeChecklistItemCount: { type: "integer" },
946
+ checklistItemCount: { type: "integer" },
947
+ referenceCount: { type: "integer" },
948
+ conversationThreadId: { type: ["string", "null"] },
949
+ startDateTime: {
950
+ type: ["string", "null"],
951
+ format: "date-time"
952
+ },
953
+ dueDateTime: {
954
+ type: ["string", "null"],
955
+ format: "date-time"
956
+ },
957
+ completedDateTime: {
958
+ type: ["string", "null"],
959
+ format: "date-time"
960
+ },
961
+ createdDateTime: {
962
+ type: "string",
963
+ format: "date-time"
964
+ },
965
+ createdBy: identitySetSchema,
966
+ completedBy: {
967
+ ...identitySetSchema,
968
+ type: ["object", "null"]
969
+ },
970
+ appliedCategories: {
971
+ type: "object",
972
+ properties: {
973
+ category1: { type: "boolean" },
974
+ category2: { type: "boolean" },
975
+ category3: { type: "boolean" },
976
+ category4: { type: "boolean" },
977
+ category5: { type: "boolean" },
978
+ category6: { type: "boolean" }
979
+ },
980
+ additionalProperties: { type: "boolean" }
981
+ },
982
+ assignments: {
983
+ type: "object",
984
+ additionalProperties: plannerAssignmentSchema
985
+ }
986
+ },
987
+ required: ["id"]
988
+ };
989
+ const plannerTaskCollectionSchema = {
990
+ type: "object",
991
+ properties: {
992
+ "@odata.context": { type: "string" },
993
+ value: {
994
+ type: "array",
995
+ items: plannerTaskSchema
996
+ },
997
+ truncated: { type: "boolean" }
998
+ },
999
+ required: ["value", "truncated"]
1000
+ };
1001
+ const plannerTaskDetailsSchema = {
1002
+ type: "object",
1003
+ properties: {
1004
+ "@odata.etag": { type: "string" },
1005
+ id: { type: "string" },
1006
+ description: { type: "string" },
1007
+ previewType: {
1008
+ type: "string",
1009
+ enum: [
1010
+ "automatic",
1011
+ "noPreview",
1012
+ "checklist",
1013
+ "description",
1014
+ "reference"
1015
+ ]
1016
+ },
1017
+ checklist: {
1018
+ type: "object",
1019
+ additionalProperties: {
1020
+ type: "object",
1021
+ properties: {
1022
+ "@odata.type": { type: "string" },
1023
+ title: { type: "string" },
1024
+ isChecked: { type: "boolean" },
1025
+ orderHint: { type: "string" },
1026
+ lastModifiedBy: identitySetSchema,
1027
+ lastModifiedDateTime: {
1028
+ type: "string",
1029
+ format: "date-time"
1030
+ }
1031
+ }
1032
+ }
1033
+ },
1034
+ references: {
1035
+ type: "object",
1036
+ additionalProperties: {
1037
+ type: "object",
1038
+ properties: {
1039
+ "@odata.type": { type: "string" },
1040
+ alias: { type: "string" },
1041
+ type: {
1042
+ type: "string",
1043
+ enum: [
1044
+ "PowerPoint",
1045
+ "Word",
1046
+ "Excel",
1047
+ "Other"
1048
+ ]
1049
+ },
1050
+ previewPriority: { type: "string" },
1051
+ lastModifiedBy: identitySetSchema,
1052
+ lastModifiedDateTime: {
1053
+ type: "string",
1054
+ format: "date-time"
1055
+ }
1056
+ }
1057
+ }
1058
+ }
1059
+ },
1060
+ required: ["id"]
1061
+ };
1062
+ const listTasksInPlanOutputSchema = plannerTaskCollectionSchema;
1063
+ const listTasksInBucketOutputSchema = plannerTaskCollectionSchema;
1064
+ const listTasksForUserOutputSchema = plannerTaskCollectionSchema;
1065
+ const getTaskOutputSchema = plannerTaskSchema;
1066
+ const updateTaskOutputSchema = plannerTaskSchema;
1067
+ const completeTaskOutputSchema = plannerTaskSchema;
1068
+ const assignTaskOutputSchema = plannerTaskSchema;
1069
+ const moveTaskToBucketOutputSchema = plannerTaskSchema;
1070
+ const getTaskDetailsOutputSchema = plannerTaskDetailsSchema;
1071
+ const updateTaskDetailsOutputSchema = plannerTaskDetailsSchema;
1072
+ const createTaskOutputSchema = {
1073
+ type: "object",
1074
+ properties: {
1075
+ task: plannerTaskSchema,
1076
+ details: {
1077
+ ...plannerTaskDetailsSchema,
1078
+ type: ["object", "null"]
1079
+ }
1080
+ },
1081
+ required: ["task", "details"]
1082
+ };
1083
+ const deleteTaskOutputSchema = deleteResultSchema;
1084
+ //#endregion
1085
+ //#region src/inputs/common.ts
1086
+ const connectionInput = (0, _prismatic_io_spectral.input)({
1087
+ label: "Connection",
1088
+ type: "connection",
1089
+ required: true,
1090
+ comments: "The Microsoft Planner connection to use."
1091
+ });
1092
+ const etagInput = (0, _prismatic_io_spectral.input)({
1093
+ label: "ETag",
1094
+ type: "string",
1095
+ required: false,
1096
+ example: "W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"",
1097
+ placeholder: "Enter an ETag",
1098
+ comments: "The last known ETag of the resource being changed. Leave blank to let the action read the current ETag before writing. Supply a value to make the change conditional on that exact version, which fails with a conflict if the resource changed.",
1099
+ clean: cleanStringInput
1100
+ });
1101
+ const groupIdInput = (0, _prismatic_io_spectral.input)({
1102
+ label: "Group ID",
1103
+ type: "string",
1104
+ required: false,
1105
+ dataSource: "selectGroup",
1106
+ example: "ebf3b108-5234-4e22-b93d-656d7dae5874",
1107
+ placeholder: "Enter a group ID",
1108
+ comments: "The Microsoft 365 group whose plans populate the Plan ID dropdown. Only Microsoft 365 groups can hold Planner plans. Leave blank to list the plans shared with the connection's user instead.",
1109
+ clean: cleanStringInput
1110
+ });
1111
+ const planIdInput = (0, _prismatic_io_spectral.input)({
1112
+ label: "Plan ID",
1113
+ type: "string",
1114
+ required: true,
1115
+ dataSource: "selectPlan",
1116
+ example: "xqQg5FS2LkCp935s-FIFm2QAFkHM",
1117
+ placeholder: "Enter a plan ID",
1118
+ comments: "The unique identifier of the plan.",
1119
+ clean: _prismatic_io_spectral.util.types.toString
1120
+ });
1121
+ const bucketIdInput = (0, _prismatic_io_spectral.input)({
1122
+ label: "Bucket ID",
1123
+ type: "string",
1124
+ required: true,
1125
+ dataSource: "selectBucket",
1126
+ example: "hsOf2dhOJkqyYYZEtdzDe2QAIUCR",
1127
+ placeholder: "Enter a bucket ID",
1128
+ comments: "The unique identifier of the bucket.",
1129
+ clean: _prismatic_io_spectral.util.types.toString
1130
+ });
1131
+ const bucketIdOptionalInput = (0, _prismatic_io_spectral.input)({
1132
+ ...bucketIdInput,
1133
+ required: false,
1134
+ comments: "The unique identifier of the bucket. Leave blank to leave the task in its current bucket.",
1135
+ clean: cleanStringInput
1136
+ });
1137
+ const taskIdInput = (0, _prismatic_io_spectral.input)({
1138
+ label: "Task ID",
1139
+ type: "string",
1140
+ required: true,
1141
+ dataSource: "selectTask",
1142
+ example: "01gzSlKkIUSUl6DF_EilrmQAKDhh",
1143
+ placeholder: "Enter a task ID",
1144
+ comments: "The unique identifier of the task.",
1145
+ clean: _prismatic_io_spectral.util.types.toString
1146
+ });
1147
+ //#endregion
1148
+ //#region src/inputs/buckets.ts
1149
+ const bucketNameInput = (0, _prismatic_io_spectral.input)({
1150
+ label: "Name",
1151
+ type: "string",
1152
+ required: true,
1153
+ example: "In Review",
1154
+ placeholder: "Enter a bucket name",
1155
+ comments: "The name of the bucket, shown as a column heading on the plan's board.",
1156
+ clean: _prismatic_io_spectral.util.types.toString
1157
+ });
1158
+ const createBucketInputs = {
1159
+ connection: connectionInput,
1160
+ groupId: groupIdInput,
1161
+ planId: planIdInput,
1162
+ name: bucketNameInput
1163
+ };
1164
+ const deleteBucketInputs = {
1165
+ connection: connectionInput,
1166
+ groupId: groupIdInput,
1167
+ planId: planIdInput,
1168
+ bucketId: bucketIdInput,
1169
+ etag: etagInput
1170
+ };
1171
+ const getBucketInputs = {
1172
+ connection: connectionInput,
1173
+ groupId: groupIdInput,
1174
+ planId: planIdInput,
1175
+ bucketId: bucketIdInput
1176
+ };
1177
+ const listBucketsInPlanInputs = {
1178
+ connection: connectionInput,
1179
+ groupId: groupIdInput,
1180
+ planId: planIdInput
1181
+ };
1182
+ const updateBucketInputs = {
1183
+ connection: connectionInput,
1184
+ groupId: groupIdInput,
1185
+ planId: planIdInput,
1186
+ bucketId: bucketIdInput,
1187
+ name: bucketNameInput,
1188
+ etag: etagInput
1189
+ };
1190
+ //#endregion
1191
+ //#region src/inputs/dataSources.ts
1192
+ const selectBucketInputs = {
1193
+ connection: connectionInput,
1194
+ planId: {
1195
+ ...planIdInput,
1196
+ dataSource: void 0
1197
+ }
1198
+ };
1199
+ const selectGroupInputs = { connection: connectionInput };
1200
+ const selectPlanInputs = {
1201
+ connection: connectionInput,
1202
+ groupId: {
1203
+ ...groupIdInput,
1204
+ dataSource: void 0
1205
+ }
1206
+ };
1207
+ const selectTaskInputs = {
1208
+ connection: connectionInput,
1209
+ planId: {
1210
+ ...planIdInput,
1211
+ dataSource: void 0
1212
+ }
1213
+ };
1214
+ const selectUserInputs = { connection: connectionInput };
1215
+ //#endregion
1216
+ //#region src/inputs/misc.ts
1217
+ const { debugRequest: _debugRequest, ...httpRequestInputs } = _prismatic_io_spectral_http.inputs;
1218
+ const rawRequestInputs = {
1219
+ connection: connectionInput,
1220
+ ...httpRequestInputs,
1221
+ url: {
1222
+ ...httpRequestInputs.url,
1223
+ comments: "The path of the Microsoft Graph endpoint to call (e.g., `/planner/plans`). The base URL `https://graph.microsoft.com/v1.0` is added automatically. Planner endpoints that modify or delete a resource require an `If-Match` header carrying the resource's current ETag.",
1224
+ example: "/planner/plans"
1225
+ }
1226
+ };
1227
+ //#endregion
1228
+ //#region src/inputs/plans.ts
1229
+ const planTitleInput = (0, _prismatic_io_spectral.input)({
1230
+ label: "Title",
1231
+ type: "string",
1232
+ required: true,
1233
+ example: "Q3 Marketing Launch",
1234
+ placeholder: "Enter a plan title",
1235
+ comments: "The title of the plan, shown wherever the plan is listed.",
1236
+ clean: _prismatic_io_spectral.util.types.toString
1237
+ });
1238
+ const containerGroupIdInput = (0, _prismatic_io_spectral.input)({
1239
+ ...groupIdInput,
1240
+ required: true,
1241
+ placeholder: "Enter a group ID",
1242
+ comments: "The Microsoft 365 group that holds the plan. Only Microsoft 365 groups can contain Planner plans.",
1243
+ clean: _prismatic_io_spectral.util.types.toString
1244
+ });
1245
+ const categoryLabelsInput = (0, _prismatic_io_spectral.input)({
1246
+ label: "Category Labels",
1247
+ type: "string",
1248
+ required: false,
1249
+ collection: "keyvaluelist",
1250
+ example: "{\"category1\": \"Blocked\"}",
1251
+ placeholder: "Enter a category key and its label",
1252
+ comments: "Labels for the plan's colored categories, keyed by category1 through category25. Only the categories listed here change; leave a category out to keep its current label.",
1253
+ clean: cleanCategoryLabels
1254
+ });
1255
+ const planSharingInput = (0, _prismatic_io_spectral.structuredObjectInput)({
1256
+ label: "Sharing",
1257
+ required: false,
1258
+ comments: "Users to add to or remove from the shared-with list.",
1259
+ inputs: {
1260
+ shareWith: (0, _prismatic_io_spectral.input)({
1261
+ label: "Share With",
1262
+ type: "string",
1263
+ required: false,
1264
+ collection: "valuelist",
1265
+ dataSource: "selectUser",
1266
+ example: "[\"48d31887-5fad-4d73-a9f5-3c356e68a038\"]",
1267
+ placeholder: "Select users to share with",
1268
+ comments: "Users to add to the plan's shared-with list, identified by object ID. For a plan contained by a Microsoft 365 group, managing group membership is usually preferable to sharing individually.",
1269
+ clean: cleanStringList
1270
+ }),
1271
+ unshareWith: (0, _prismatic_io_spectral.input)({
1272
+ label: "Unshare With",
1273
+ type: "string",
1274
+ required: false,
1275
+ collection: "valuelist",
1276
+ dataSource: "selectUser",
1277
+ example: "[\"48d31887-5fad-4d73-a9f5-3c356e68a038\"]",
1278
+ placeholder: "Select users to remove",
1279
+ comments: "Users to remove from the plan's shared-with list, identified by object ID.",
1280
+ clean: cleanStringList
1281
+ })
1282
+ }
1283
+ });
1284
+ const planDetailsEtagInput = (0, _prismatic_io_spectral.input)({
1285
+ ...etagInput,
1286
+ label: "Plan Details ETag",
1287
+ example: "W/\"JzEtUGxhbkRldGFpbHMgQEBAQEBAQEBAQEBAQEBARCc=\"",
1288
+ placeholder: "Enter a plan details ETag",
1289
+ comments: "The last known ETag of the plan details. Plan details carry their own ETag, separate from the plan's, so a plan ETag cannot be used here. Leave blank to read the current value before writing."
1290
+ });
1291
+ const createPlanInputs = {
1292
+ connection: connectionInput,
1293
+ groupId: containerGroupIdInput,
1294
+ title: planTitleInput
1295
+ };
1296
+ const deletePlanInputs = {
1297
+ connection: connectionInput,
1298
+ groupId: groupIdInput,
1299
+ planId: planIdInput,
1300
+ etag: etagInput
1301
+ };
1302
+ const getPlanInputs = {
1303
+ connection: connectionInput,
1304
+ groupId: groupIdInput,
1305
+ planId: planIdInput
1306
+ };
1307
+ const getPlanDetailsInputs = {
1308
+ connection: connectionInput,
1309
+ groupId: groupIdInput,
1310
+ planId: planIdInput
1311
+ };
1312
+ const listPlansForUserInputs = { connection: connectionInput };
1313
+ const listPlansInGroupInputs = {
1314
+ connection: connectionInput,
1315
+ groupId: containerGroupIdInput
1316
+ };
1317
+ const updatePlanInputs = {
1318
+ connection: connectionInput,
1319
+ groupId: groupIdInput,
1320
+ planId: planIdInput,
1321
+ title: planTitleInput,
1322
+ etag: etagInput
1323
+ };
1324
+ const updatePlanDetailsInputs = {
1325
+ connection: connectionInput,
1326
+ groupId: groupIdInput,
1327
+ planId: planIdInput,
1328
+ categoryDescriptions: categoryLabelsInput,
1329
+ sharing: planSharingInput,
1330
+ etag: planDetailsEtagInput
1331
+ };
1332
+ //#endregion
1333
+ //#region src/inputs/tasks.ts
1334
+ const categoryModel = Array.from({ length: 25 }, (_, index) => ({
1335
+ label: `Category ${index + 1}`,
1336
+ value: `category${index + 1}`
1337
+ }));
1338
+ const taskTitleInput = (0, _prismatic_io_spectral.input)({
1339
+ label: "Title",
1340
+ type: "string",
1341
+ required: true,
1342
+ example: "Update the client list",
1343
+ placeholder: "Enter a task title",
1344
+ comments: "The title of the task, shown on its card in the Planner board.",
1345
+ clean: _prismatic_io_spectral.util.types.toString
1346
+ });
1347
+ const taskTitleOptionalInput = (0, _prismatic_io_spectral.input)({
1348
+ ...taskTitleInput,
1349
+ required: false,
1350
+ placeholder: "Enter a new task title",
1351
+ comments: "A new title for the task. Leave blank to keep the current title.",
1352
+ clean: cleanStringInput
1353
+ });
1354
+ const taskScheduleInput = (0, _prismatic_io_spectral.structuredObjectInput)({
1355
+ label: "Schedule",
1356
+ required: false,
1357
+ comments: "Start and due timestamps.",
1358
+ inputs: {
1359
+ startDateTime: (0, _prismatic_io_spectral.input)({
1360
+ label: "Start At",
1361
+ type: "string",
1362
+ required: false,
1363
+ example: "2024-01-15T12:00:00Z",
1364
+ placeholder: "Enter a start timestamp (ISO 8601)",
1365
+ comments: "The timestamp the task starts, in ISO 8601 format.",
1366
+ clean: cleanStringInput
1367
+ }),
1368
+ dueDateTime: (0, _prismatic_io_spectral.input)({
1369
+ label: "Due At",
1370
+ type: "string",
1371
+ required: false,
1372
+ example: "2024-01-22T12:00:00Z",
1373
+ placeholder: "Enter a due timestamp (ISO 8601)",
1374
+ comments: "The timestamp the task is due, in ISO 8601 format.",
1375
+ clean: cleanStringInput
1376
+ })
1377
+ }
1378
+ });
1379
+ const percentCompleteInput = (0, _prismatic_io_spectral.input)({
1380
+ label: "Percent Complete",
1381
+ type: "string",
1382
+ required: false,
1383
+ example: "50",
1384
+ placeholder: "Enter a value from 0 to 100",
1385
+ comments: "How complete the task is, from 0 to 100. Planner has no separate completed flag: setting this to 100 completes the task, and the service fills in who completed it and when.",
1386
+ clean: cleanOptionalNumber
1387
+ });
1388
+ const priorityInput = (0, _prismatic_io_spectral.input)({
1389
+ label: "Priority",
1390
+ type: "string",
1391
+ required: false,
1392
+ example: "5",
1393
+ placeholder: "Select a priority",
1394
+ model: [
1395
+ {
1396
+ label: "Urgent",
1397
+ value: "1"
1398
+ },
1399
+ {
1400
+ label: "Important",
1401
+ value: "3"
1402
+ },
1403
+ {
1404
+ label: "Medium",
1405
+ value: "5"
1406
+ },
1407
+ {
1408
+ label: "Low",
1409
+ value: "9"
1410
+ }
1411
+ ],
1412
+ comments: "The priority of the task. Planner stores priority as a number from 0 to 10 and displays it in four bands, so these four values are the ones the Planner interface itself uses.",
1413
+ clean: cleanOptionalNumber
1414
+ });
1415
+ const taskCategoriesInput = (0, _prismatic_io_spectral.structuredObjectInput)({
1416
+ label: "Categories",
1417
+ required: false,
1418
+ comments: "Colored categories to apply or remove.",
1419
+ inputs: {
1420
+ applyCategories: (0, _prismatic_io_spectral.input)({
1421
+ label: "Apply",
1422
+ type: "string",
1423
+ required: false,
1424
+ collection: "valuelist",
1425
+ model: categoryModel,
1426
+ placeholder: "Select categories to apply",
1427
+ comments: "Colored categories to apply to the task. The label shown for each category is configured on the plan.",
1428
+ clean: cleanStringList
1429
+ }),
1430
+ removeCategories: (0, _prismatic_io_spectral.input)({
1431
+ label: "Remove",
1432
+ type: "string",
1433
+ required: false,
1434
+ collection: "valuelist",
1435
+ model: categoryModel,
1436
+ placeholder: "Select categories to remove",
1437
+ comments: "Colored categories to remove from the task.",
1438
+ clean: cleanStringList
1439
+ })
1440
+ }
1441
+ });
1442
+ const taskAssignmentInput = (0, _prismatic_io_spectral.structuredObjectInput)({
1443
+ label: "Assignment",
1444
+ required: false,
1445
+ comments: "Users to assign or unassign.",
1446
+ inputs: {
1447
+ assignTo: (0, _prismatic_io_spectral.input)({
1448
+ label: "Assign To",
1449
+ type: "string",
1450
+ required: false,
1451
+ collection: "valuelist",
1452
+ dataSource: "selectUser",
1453
+ example: "[\"48d31887-5fad-4d73-a9f5-3c356e68a038\"]",
1454
+ placeholder: "Select users to assign",
1455
+ comments: "Users to assign to the task, identified by object ID. Existing assignees that are not listed here are left in place.",
1456
+ clean: cleanStringList
1457
+ }),
1458
+ unassign: (0, _prismatic_io_spectral.input)({
1459
+ label: "Unassign",
1460
+ type: "string",
1461
+ required: false,
1462
+ collection: "valuelist",
1463
+ dataSource: "selectUser",
1464
+ example: "[\"48d31887-5fad-4d73-a9f5-3c356e68a038\"]",
1465
+ placeholder: "Select users to unassign",
1466
+ comments: "Users to remove from the task, identified by object ID.",
1467
+ clean: cleanStringList
1468
+ })
1469
+ }
1470
+ });
1471
+ const conversationThreadIdInput = (0, _prismatic_io_spectral.input)({
1472
+ label: "Conversation Thread ID",
1473
+ type: "string",
1474
+ required: false,
1475
+ example: "AAQkADMxYWM1NzYzLWEwZTYtNDI0NC1hMTIzLTk4NzY1NDMyMTBhYg==",
1476
+ placeholder: "Enter a conversation thread ID",
1477
+ comments: "The identifier of the group conversation thread associated with the task.",
1478
+ clean: cleanStringInput
1479
+ });
1480
+ const descriptionInput = (0, _prismatic_io_spectral.input)({
1481
+ label: "Description",
1482
+ type: "text",
1483
+ required: false,
1484
+ example: "Confirm every contact before the launch.",
1485
+ placeholder: "Enter a task description",
1486
+ comments: "The description of the task. Descriptions live on the task's details resource rather than the task itself, so setting one is a separate write.",
1487
+ clean: cleanStringInput
1488
+ });
1489
+ const previewTypeInput = (0, _prismatic_io_spectral.input)({
1490
+ label: "Preview Type",
1491
+ type: "string",
1492
+ required: false,
1493
+ example: "description",
1494
+ placeholder: "Select a preview type",
1495
+ model: [
1496
+ {
1497
+ label: "Automatic",
1498
+ value: "automatic"
1499
+ },
1500
+ {
1501
+ label: "No Preview",
1502
+ value: "noPreview"
1503
+ },
1504
+ {
1505
+ label: "Checklist",
1506
+ value: "checklist"
1507
+ },
1508
+ {
1509
+ label: "Description",
1510
+ value: "description"
1511
+ },
1512
+ {
1513
+ label: "Reference",
1514
+ value: "reference"
1515
+ }
1516
+ ],
1517
+ comments: "Which part of the task details is shown on the task's card in the Planner board.",
1518
+ clean: cleanStringInput
1519
+ });
1520
+ const checklistInput = (0, _prismatic_io_spectral.structuredObjectInput)({
1521
+ label: "Checklist",
1522
+ required: false,
1523
+ comments: "Checklist items to add or remove.",
1524
+ inputs: {
1525
+ addItems: (0, _prismatic_io_spectral.input)({
1526
+ label: "Add Items",
1527
+ type: "string",
1528
+ required: false,
1529
+ collection: "keyvaluelist",
1530
+ example: "{\"Confirm the mailing address\": \"false\"}",
1531
+ placeholder: "Enter an item title and true or false",
1532
+ comments: "Checklist items to add, where the key is the item title and the value is true if the item starts checked.",
1533
+ clean: cleanChecklistItems
1534
+ }),
1535
+ removeItemIds: (0, _prismatic_io_spectral.input)({
1536
+ label: "Remove Items",
1537
+ type: "string",
1538
+ required: false,
1539
+ collection: "valuelist",
1540
+ example: "[\"95e27074-6c4a-447a-aa24-9d718a0b86fa\"]",
1541
+ placeholder: "Enter a checklist item ID",
1542
+ comments: "Identifiers of checklist items to remove. Use the Get Task Details action to read the current item identifiers.",
1543
+ clean: cleanStringList
1544
+ })
1545
+ }
1546
+ });
1547
+ const referencesInput = (0, _prismatic_io_spectral.structuredObjectInput)({
1548
+ label: "Links",
1549
+ required: false,
1550
+ comments: "External links to attach or remove.",
1551
+ inputs: {
1552
+ addReferences: (0, _prismatic_io_spectral.input)({
1553
+ label: "Add",
1554
+ type: "string",
1555
+ required: false,
1556
+ collection: "keyvaluelist",
1557
+ example: "{\"https://example.com/spec\": \"Specification\"}",
1558
+ placeholder: "Enter a URL and a display name",
1559
+ comments: "External links to attach to the task, where the key is the URL and the value is the display name shown in Planner.",
1560
+ clean: cleanReferences
1561
+ }),
1562
+ removeReferenceUrls: (0, _prismatic_io_spectral.input)({
1563
+ label: "Remove",
1564
+ type: "string",
1565
+ required: false,
1566
+ collection: "valuelist",
1567
+ example: "[\"https://example.com/spec\"]",
1568
+ placeholder: "Enter a URL to remove",
1569
+ comments: "URLs of external links to remove from the task.",
1570
+ clean: cleanStringList
1571
+ })
1572
+ }
1573
+ });
1574
+ const taskDetailsEtagInput = (0, _prismatic_io_spectral.input)({
1575
+ ...etagInput,
1576
+ label: "Task Details ETag",
1577
+ example: "W/\"JzEtVGFza0RldGFpbHMgQEBAQEBAQEBAQEBAQEBARCc=\"",
1578
+ placeholder: "Enter a task details ETag",
1579
+ comments: "The last known ETag of the task details. Task details carry their own ETag, separate from the task's, so a task ETag cannot be used here. Leave blank to read the current value before writing."
1580
+ });
1581
+ const assignTaskInputs = {
1582
+ connection: connectionInput,
1583
+ groupId: groupIdInput,
1584
+ planId: planIdInput,
1585
+ taskId: taskIdInput,
1586
+ assignment: {
1587
+ ...taskAssignmentInput,
1588
+ comments: "Users to assign or unassign. At least one of Assign To or Unassign is required."
1589
+ },
1590
+ etag: etagInput
1591
+ };
1592
+ const completeTaskInputs = {
1593
+ connection: connectionInput,
1594
+ groupId: groupIdInput,
1595
+ planId: planIdInput,
1596
+ taskId: taskIdInput,
1597
+ etag: etagInput
1598
+ };
1599
+ const createTaskInputs = {
1600
+ connection: connectionInput,
1601
+ groupId: groupIdInput,
1602
+ planId: planIdInput,
1603
+ title: taskTitleInput,
1604
+ bucketId: {
1605
+ ...bucketIdOptionalInput,
1606
+ comments: "The unique identifier of the bucket to create the task in. Leave blank to create the task without assigning it to a bucket."
1607
+ },
1608
+ assignment: taskAssignmentInput,
1609
+ schedule: taskScheduleInput,
1610
+ priority: priorityInput,
1611
+ percentComplete: percentCompleteInput,
1612
+ categories: taskCategoriesInput,
1613
+ description: descriptionInput
1614
+ };
1615
+ const deleteTaskInputs = {
1616
+ connection: connectionInput,
1617
+ groupId: groupIdInput,
1618
+ planId: planIdInput,
1619
+ taskId: taskIdInput,
1620
+ etag: etagInput
1621
+ };
1622
+ const getTaskInputs = {
1623
+ connection: connectionInput,
1624
+ groupId: groupIdInput,
1625
+ planId: planIdInput,
1626
+ taskId: taskIdInput
1627
+ };
1628
+ const getTaskDetailsInputs = {
1629
+ connection: connectionInput,
1630
+ groupId: groupIdInput,
1631
+ planId: planIdInput,
1632
+ taskId: taskIdInput
1633
+ };
1634
+ const listTasksForUserInputs = { connection: connectionInput };
1635
+ const listTasksInBucketInputs = {
1636
+ connection: connectionInput,
1637
+ groupId: groupIdInput,
1638
+ planId: planIdInput,
1639
+ bucketId: bucketIdInput
1640
+ };
1641
+ const listTasksInPlanInputs = {
1642
+ connection: connectionInput,
1643
+ groupId: groupIdInput,
1644
+ planId: planIdInput
1645
+ };
1646
+ const moveTaskToBucketInputs = {
1647
+ connection: connectionInput,
1648
+ groupId: groupIdInput,
1649
+ planId: planIdInput,
1650
+ taskId: taskIdInput,
1651
+ bucketId: bucketIdInput,
1652
+ etag: etagInput
1653
+ };
1654
+ const updateTaskInputs = {
1655
+ connection: connectionInput,
1656
+ groupId: groupIdInput,
1657
+ planId: planIdInput,
1658
+ taskId: taskIdInput,
1659
+ title: taskTitleOptionalInput,
1660
+ bucketId: bucketIdOptionalInput,
1661
+ assignment: taskAssignmentInput,
1662
+ schedule: taskScheduleInput,
1663
+ priority: priorityInput,
1664
+ percentComplete: percentCompleteInput,
1665
+ categories: taskCategoriesInput,
1666
+ conversationThreadId: conversationThreadIdInput,
1667
+ etag: etagInput
1668
+ };
1669
+ const updateTaskDetailsInputs = {
1670
+ connection: connectionInput,
1671
+ groupId: groupIdInput,
1672
+ planId: planIdInput,
1673
+ taskId: taskIdInput,
1674
+ description: descriptionInput,
1675
+ checklist: checklistInput,
1676
+ references: referencesInput,
1677
+ previewType: previewTypeInput,
1678
+ etag: taskDetailsEtagInput
1679
+ };
1680
+ const pollChangesTriggerInputs = {
1681
+ connection: connectionInput,
1682
+ groupId: groupIdInput,
1683
+ planId: planIdInput,
1684
+ lookBackDate: (0, _prismatic_io_spectral.input)({
1685
+ label: "Look-back Date",
1686
+ placeholder: "Enter look-back date (YYYY-MM-DD)",
1687
+ type: "string",
1688
+ required: false,
1689
+ comments: "The date the initial sync starts from, in YYYY-MM-DD format. Cannot be a future date. Leave empty to start from the first recurrence with no backfill. When set, the initial sync seeds each task created on or after this date once.",
1690
+ example: "2026-01-01",
1691
+ clean: lookBackDateClean
1692
+ })
1693
+ };
1694
+ //#endregion
1695
+ //#region src/actions/buckets/createBucket.ts
1696
+ const createBucket = (0, _prismatic_io_spectral.action)({
1697
+ display: {
1698
+ label: "Create Bucket",
1699
+ description: "Create a bucket in a plan."
1700
+ },
1701
+ inputs: createBucketInputs,
1702
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
1703
+ type: "actionOutput",
1704
+ schema: createBucketOutputSchema
1705
+ }),
1706
+ performSafety: "notAllowed",
1707
+ perform: async (context, { connection, planId, name }) => {
1708
+ const { data } = await createClient(connection, context.debug.enabled).post(PLANNER_ENDPOINTS.BUCKETS, {
1709
+ name,
1710
+ planId,
1711
+ orderHint: " !"
1712
+ });
1713
+ return { data };
1714
+ },
1715
+ examplePerform: async (_context, { planId, name }) => ({ data: {
1716
+ ...createBucketExamplePayload.data,
1717
+ name,
1718
+ planId
1719
+ } }),
1720
+ examplePayload: createBucketExamplePayload
1721
+ });
1722
+ //#endregion
1723
+ //#region src/actions/buckets/deleteBucket.ts
1724
+ const deleteBucket = (0, _prismatic_io_spectral.action)({
1725
+ display: {
1726
+ label: "Delete Bucket",
1727
+ description: "Delete a bucket and the tasks it contains."
1728
+ },
1729
+ inputs: deleteBucketInputs,
1730
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
1731
+ type: "actionOutput",
1732
+ schema: deleteBucketOutputSchema
1733
+ }),
1734
+ performSafety: "notAllowed",
1735
+ perform: async (context, { connection, bucketId, etag }) => {
1736
+ await deleteWithEtag(createClient(connection, context.debug.enabled), PLANNER_ENDPOINTS.BUCKET(bucketId), etag);
1737
+ return { data: {
1738
+ success: true,
1739
+ id: bucketId,
1740
+ message: "Bucket deleted successfully"
1741
+ } };
1742
+ },
1743
+ examplePerform: async () => deleteBucketExamplePayload,
1744
+ examplePayload: deleteBucketExamplePayload
1745
+ });
1746
+ //#endregion
1747
+ //#region src/actions/buckets/getBucket.ts
1748
+ const getBucket = (0, _prismatic_io_spectral.action)({
1749
+ display: {
1750
+ label: "Get Bucket",
1751
+ description: "Retrieve a single bucket by its ID."
1752
+ },
1753
+ inputs: getBucketInputs,
1754
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
1755
+ type: "actionOutput",
1756
+ schema: getBucketOutputSchema
1757
+ }),
1758
+ performSafety: "safe",
1759
+ perform: async (context, { connection, bucketId }) => {
1760
+ const { data } = await createClient(connection, context.debug.enabled).get(PLANNER_ENDPOINTS.BUCKET(bucketId));
1761
+ return { data };
1762
+ },
1763
+ examplePayload: getBucketExamplePayload
1764
+ });
1765
+ //#endregion
1766
+ //#region src/actions/buckets/index.ts
1767
+ var buckets_default = {
1768
+ listBucketsInPlan: (0, _prismatic_io_spectral.action)({
1769
+ display: {
1770
+ label: "List Buckets in Plan",
1771
+ description: "List every bucket in a plan."
1772
+ },
1773
+ inputs: listBucketsInPlanInputs,
1774
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
1775
+ type: "actionOutput",
1776
+ schema: listBucketsInPlanOutputSchema
1777
+ }),
1778
+ performSafety: "notAllowed",
1779
+ perform: async (context, { connection, planId }) => {
1780
+ return { data: await fetchAllPlanner(createClient(connection, context.debug.enabled), PLANNER_ENDPOINTS.PLAN_BUCKETS(planId)) };
1781
+ },
1782
+ examplePerform: async (_context, { planId }) => ({ data: {
1783
+ ...listBucketsInPlanExamplePayload.data,
1784
+ value: listBucketsInPlanExamplePayload.data.value.map((bucket) => ({
1785
+ ...bucket,
1786
+ planId
1787
+ }))
1788
+ } }),
1789
+ examplePayload: listBucketsInPlanExamplePayload
1790
+ }),
1791
+ getBucket,
1792
+ createBucket,
1793
+ updateBucket: (0, _prismatic_io_spectral.action)({
1794
+ display: {
1795
+ label: "Update Bucket",
1796
+ description: "Rename a bucket. A bucket cannot be moved to a different plan."
1797
+ },
1798
+ inputs: updateBucketInputs,
1799
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
1800
+ type: "actionOutput",
1801
+ schema: updateBucketOutputSchema
1802
+ }),
1803
+ performSafety: "notAllowed",
1804
+ perform: async (context, { connection, bucketId, name, etag }) => {
1805
+ return { data: await patchWithEtag(createClient(connection, context.debug.enabled), PLANNER_ENDPOINTS.BUCKET(bucketId), { name }, etag) };
1806
+ },
1807
+ examplePerform: async (_context, { name }) => ({ data: {
1808
+ ...updateBucketExamplePayload.data,
1809
+ name
1810
+ } }),
1811
+ examplePayload: updateBucketExamplePayload
1812
+ }),
1813
+ deleteBucket
1814
+ };
1815
+ //#endregion
1816
+ //#region src/actions/misc/index.ts
1817
+ var misc_default = { rawRequest: (0, _prismatic_io_spectral.action)({
1818
+ display: {
1819
+ label: "Raw Request",
1820
+ description: "Send a raw HTTP request to the Microsoft Graph API."
1821
+ },
1822
+ inputs: rawRequestInputs,
1823
+ performSafety: "notAllowed",
1824
+ perform: async (context, { connection, ...params }) => {
1825
+ validateConnection(connection);
1826
+ const { data } = await (0, _prismatic_io_spectral_http.sendRawRequest)(graphBaseUrl(connection), {
1827
+ ...params,
1828
+ debugRequest: context.debug.enabled,
1829
+ headers: [
1830
+ {
1831
+ key: "Accept",
1832
+ value: "application/json"
1833
+ },
1834
+ {
1835
+ key: "Content-Type",
1836
+ value: "application/json"
1837
+ },
1838
+ ...params.headers
1839
+ ]
1840
+ }, { Authorization: `Bearer ${_prismatic_io_spectral.util.types.toString(connection.token?.access_token)}` });
1841
+ return { data };
1842
+ },
1843
+ examplePayload: rawRequestExamplePayload
1844
+ }) };
1845
+ //#endregion
1846
+ //#region src/actions/plans/createPlan.ts
1847
+ const createPlan = (0, _prismatic_io_spectral.action)({
1848
+ display: {
1849
+ label: "Create Plan",
1850
+ description: "Create a plan inside a Microsoft 365 group. The caller must already be a member of that group; creating a group does not add its creator as a member, which is a common cause of a permissions error here."
1851
+ },
1852
+ inputs: createPlanInputs,
1853
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
1854
+ type: "actionOutput",
1855
+ schema: createPlanOutputSchema
1856
+ }),
1857
+ performSafety: "notAllowed",
1858
+ perform: async (context, { connection, groupId, title }) => {
1859
+ const { data } = await createClient(connection, context.debug.enabled).post(PLANNER_ENDPOINTS.PLANS, {
1860
+ container: {
1861
+ containerId: groupId,
1862
+ type: "group"
1863
+ },
1864
+ title
1865
+ });
1866
+ return { data };
1867
+ },
1868
+ examplePerform: async (_context, { groupId, title }) => ({ data: {
1869
+ ...createPlanExamplePayload.data,
1870
+ title,
1871
+ owner: groupId,
1872
+ container: {
1873
+ ...createPlanExamplePayload.data.container,
1874
+ containerId: groupId,
1875
+ url: `${GRAPH_BASE_URL}/${GRAPH_API_VERSION}/groups/${groupId}`
1876
+ }
1877
+ } }),
1878
+ examplePayload: createPlanExamplePayload
1879
+ });
1880
+ //#endregion
1881
+ //#region src/actions/plans/deletePlan.ts
1882
+ const deletePlan = (0, _prismatic_io_spectral.action)({
1883
+ display: {
1884
+ label: "Delete Plan",
1885
+ description: "Delete a plan and everything it contains."
1886
+ },
1887
+ inputs: deletePlanInputs,
1888
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
1889
+ type: "actionOutput",
1890
+ schema: deletePlanOutputSchema
1891
+ }),
1892
+ performSafety: "notAllowed",
1893
+ perform: async (context, { connection, planId, etag }) => {
1894
+ await deleteWithEtag(createClient(connection, context.debug.enabled), PLANNER_ENDPOINTS.PLAN(planId), etag);
1895
+ return { data: {
1896
+ success: true,
1897
+ id: planId,
1898
+ message: "Plan deleted successfully"
1899
+ } };
1900
+ },
1901
+ examplePerform: async () => deletePlanExamplePayload,
1902
+ examplePayload: deletePlanExamplePayload
1903
+ });
1904
+ //#endregion
1905
+ //#region src/actions/plans/getPlan.ts
1906
+ const getPlan = (0, _prismatic_io_spectral.action)({
1907
+ display: {
1908
+ label: "Get Plan",
1909
+ description: "Retrieve a single plan by its ID."
1910
+ },
1911
+ inputs: getPlanInputs,
1912
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
1913
+ type: "actionOutput",
1914
+ schema: getPlanOutputSchema
1915
+ }),
1916
+ performSafety: "safe",
1917
+ perform: async (context, { connection, planId }) => {
1918
+ const { data } = await createClient(connection, context.debug.enabled).get(PLANNER_ENDPOINTS.PLAN(planId));
1919
+ return { data };
1920
+ },
1921
+ examplePayload: getPlanExamplePayload
1922
+ });
1923
+ //#endregion
1924
+ //#region src/actions/plans/getPlanDetails.ts
1925
+ const getPlanDetails = (0, _prismatic_io_spectral.action)({
1926
+ display: {
1927
+ label: "Get Plan Details",
1928
+ description: "Retrieve a plan's category labels and shared-with list."
1929
+ },
1930
+ inputs: getPlanDetailsInputs,
1931
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
1932
+ type: "actionOutput",
1933
+ schema: getPlanDetailsOutputSchema
1934
+ }),
1935
+ performSafety: "safe",
1936
+ perform: async (context, { connection, planId }) => {
1937
+ const { data } = await createClient(connection, context.debug.enabled).get(PLANNER_ENDPOINTS.PLAN_DETAILS(planId));
1938
+ return { data };
1939
+ },
1940
+ examplePayload: getPlanDetailsExamplePayload
1941
+ });
1942
+ //#endregion
1943
+ //#region src/actions/plans/listPlansForUser.ts
1944
+ const listPlansForUser = (0, _prismatic_io_spectral.action)({
1945
+ display: {
1946
+ label: "List Plans for User",
1947
+ description: "List the plans shared with the user."
1948
+ },
1949
+ inputs: listPlansForUserInputs,
1950
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
1951
+ type: "actionOutput",
1952
+ schema: listPlansForUserOutputSchema
1953
+ }),
1954
+ performSafety: "notAllowed",
1955
+ perform: async (context, { connection }) => {
1956
+ return { data: await fetchAllPlanner(createClient(connection, context.debug.enabled), computeEndpointBasedOnConnection(connection, PLANNER_ENDPOINTS.USER_PLANS)) };
1957
+ },
1958
+ examplePerform: async () => listPlansForUserExamplePayload,
1959
+ examplePayload: listPlansForUserExamplePayload
1960
+ });
1961
+ //#endregion
1962
+ //#region src/actions/plans/index.ts
1963
+ var plans_default = {
1964
+ listPlansInGroup: (0, _prismatic_io_spectral.action)({
1965
+ display: {
1966
+ label: "List Plans in Group",
1967
+ description: "List every plan contained by a Microsoft 365 group."
1968
+ },
1969
+ inputs: listPlansInGroupInputs,
1970
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
1971
+ type: "actionOutput",
1972
+ schema: listPlansInGroupOutputSchema
1973
+ }),
1974
+ performSafety: "notAllowed",
1975
+ perform: async (context, { connection, groupId }) => {
1976
+ return { data: await fetchAllPlanner(createClient(connection, context.debug.enabled), PLANNER_ENDPOINTS.GROUP_PLANS(groupId)) };
1977
+ },
1978
+ examplePerform: async (_context, { groupId }) => ({ data: {
1979
+ ...listPlansInGroupExamplePayload.data,
1980
+ value: listPlansInGroupExamplePayload.data.value.map((plan) => ({
1981
+ ...plan,
1982
+ owner: groupId,
1983
+ container: {
1984
+ ...plan.container,
1985
+ containerId: groupId,
1986
+ url: `${GRAPH_BASE_URL}/${GRAPH_API_VERSION}/groups/${groupId}`
1987
+ }
1988
+ }))
1989
+ } }),
1990
+ examplePayload: listPlansInGroupExamplePayload
1991
+ }),
1992
+ listPlansForUser,
1993
+ getPlan,
1994
+ createPlan,
1995
+ updatePlan: (0, _prismatic_io_spectral.action)({
1996
+ display: {
1997
+ label: "Update Plan",
1998
+ description: "Rename a plan. The title is the only property a plan allows changing."
1999
+ },
2000
+ inputs: updatePlanInputs,
2001
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2002
+ type: "actionOutput",
2003
+ schema: updatePlanOutputSchema
2004
+ }),
2005
+ performSafety: "notAllowed",
2006
+ perform: async (context, { connection, planId, title, etag }) => {
2007
+ return { data: await patchWithEtag(createClient(connection, context.debug.enabled), PLANNER_ENDPOINTS.PLAN(planId), { title }, etag) };
2008
+ },
2009
+ examplePerform: async (_context, { title }) => ({ data: {
2010
+ ...updatePlanExamplePayload.data,
2011
+ title
2012
+ } }),
2013
+ examplePayload: updatePlanExamplePayload
2014
+ }),
2015
+ deletePlan,
2016
+ getPlanDetails,
2017
+ updatePlanDetails: (0, _prismatic_io_spectral.action)({
2018
+ display: {
2019
+ label: "Update Plan Details",
2020
+ description: "Set a plan's category labels and adjust who it is shared with."
2021
+ },
2022
+ inputs: updatePlanDetailsInputs,
2023
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2024
+ type: "actionOutput",
2025
+ schema: updatePlanDetailsOutputSchema
2026
+ }),
2027
+ performSafety: "notAllowed",
2028
+ perform: async (context, { connection, planId, categoryDescriptions, sharing, etag }) => {
2029
+ const client = createClient(connection, context.debug.enabled);
2030
+ const sharedWith = {};
2031
+ for (const userId of sharing?.shareWith ?? []) sharedWith[userId] = true;
2032
+ for (const userId of sharing?.unshareWith ?? []) sharedWith[userId] = false;
2033
+ const body = compact({
2034
+ categoryDescriptions: Object.keys(categoryDescriptions ?? {}).length ? categoryDescriptions : void 0,
2035
+ sharedWith: Object.keys(sharedWith).length ? sharedWith : void 0
2036
+ });
2037
+ return { data: await patchWithEtag(client, PLANNER_ENDPOINTS.PLAN_DETAILS(planId), body, etag) };
2038
+ },
2039
+ examplePerform: async (_context, { categoryDescriptions, sharing }) => {
2040
+ const sharedWith = { ...updatePlanDetailsExamplePayload.data.sharedWith };
2041
+ for (const userId of sharing?.shareWith ?? []) sharedWith[userId] = true;
2042
+ for (const userId of sharing?.unshareWith ?? []) delete sharedWith[userId];
2043
+ return { data: {
2044
+ ...updatePlanDetailsExamplePayload.data,
2045
+ categoryDescriptions: {
2046
+ ...updatePlanDetailsExamplePayload.data.categoryDescriptions,
2047
+ ...categoryDescriptions
2048
+ },
2049
+ sharedWith
2050
+ } };
2051
+ },
2052
+ examplePayload: updatePlanDetailsExamplePayload
2053
+ })
2054
+ };
2055
+ //#endregion
2056
+ //#region src/actions/tasks/assignTask.ts
2057
+ const assignTask = (0, _prismatic_io_spectral.action)({
2058
+ display: {
2059
+ label: "Assign Task",
2060
+ description: "Add or remove the users assigned to a task."
2061
+ },
2062
+ inputs: assignTaskInputs,
2063
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2064
+ type: "actionOutput",
2065
+ schema: assignTaskOutputSchema
2066
+ }),
2067
+ performSafety: "notAllowed",
2068
+ perform: async (context, { connection, taskId, assignment, etag }) => {
2069
+ const client = createClient(connection, context.debug.enabled);
2070
+ const assignments = buildAssignments(assignment?.assignTo, assignment?.unassign);
2071
+ if (!Object.keys(assignments).length) throw new Error("Select at least one user to assign or unassign before running the Assign Task action.");
2072
+ return { data: await patchWithEtag(client, PLANNER_ENDPOINTS.TASK(taskId), { assignments }, etag) };
2073
+ },
2074
+ examplePerform: async (_context, { assignment }) => {
2075
+ const exampleAssignments = assignTaskExamplePayload.data.assignments ?? {};
2076
+ const exampleEntry = Object.values(exampleAssignments)[0];
2077
+ const assignments = { ...exampleAssignments };
2078
+ for (const userId of assignment?.assignTo ?? []) assignments[userId] = exampleEntry;
2079
+ for (const userId of assignment?.unassign ?? []) delete assignments[userId];
2080
+ return { data: {
2081
+ ...assignTaskExamplePayload.data,
2082
+ assignments
2083
+ } };
2084
+ },
2085
+ examplePayload: assignTaskExamplePayload
2086
+ });
2087
+ //#endregion
2088
+ //#region src/actions/tasks/completeTask.ts
2089
+ const completeTask = (0, _prismatic_io_spectral.action)({
2090
+ display: {
2091
+ label: "Complete Task",
2092
+ description: "Mark a task as complete."
2093
+ },
2094
+ inputs: completeTaskInputs,
2095
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2096
+ type: "actionOutput",
2097
+ schema: completeTaskOutputSchema
2098
+ }),
2099
+ performSafety: "notAllowed",
2100
+ perform: async (context, { connection, taskId, etag }) => {
2101
+ return { data: await patchWithEtag(createClient(connection, context.debug.enabled), PLANNER_ENDPOINTS.TASK(taskId), { percentComplete: 100 }, etag) };
2102
+ },
2103
+ examplePerform: async () => completeTaskExamplePayload,
2104
+ examplePayload: completeTaskExamplePayload
2105
+ });
2106
+ //#endregion
2107
+ //#region src/actions/tasks/createTask.ts
2108
+ const createTask = (0, _prismatic_io_spectral.action)({
2109
+ display: {
2110
+ label: "Create Task",
2111
+ description: "Create a task in a plan. Supplying a description performs a second write, because a task's description is stored on its details resource and cannot be set when the task is created."
2112
+ },
2113
+ inputs: createTaskInputs,
2114
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2115
+ type: "actionOutput",
2116
+ schema: createTaskOutputSchema
2117
+ }),
2118
+ performSafety: "notAllowed",
2119
+ perform: async (context, { connection, planId, bucketId, title, assignment, schedule, priority, percentComplete, categories, description }) => {
2120
+ const client = createClient(connection, context.debug.enabled);
2121
+ const assignments = buildAssignments(assignment?.assignTo, assignment?.unassign);
2122
+ const appliedCategories = buildAppliedCategories(categories?.applyCategories, categories?.removeCategories);
2123
+ const body = compact({
2124
+ planId,
2125
+ title,
2126
+ bucketId,
2127
+ priority,
2128
+ percentComplete,
2129
+ startDateTime: schedule?.startDateTime,
2130
+ dueDateTime: schedule?.dueDateTime,
2131
+ assignments: Object.keys(assignments).length ? assignments : void 0,
2132
+ appliedCategories: Object.keys(appliedCategories).length ? appliedCategories : void 0
2133
+ });
2134
+ const { data: task } = await client.post(PLANNER_ENDPOINTS.TASKS, body);
2135
+ if (!description) return { data: {
2136
+ task,
2137
+ details: null
2138
+ } };
2139
+ return { data: {
2140
+ task,
2141
+ details: await patchWithEtag(client, PLANNER_ENDPOINTS.TASK_DETAILS(task.id), { description })
2142
+ } };
2143
+ },
2144
+ examplePerform: async (_context, { planId, bucketId, title, schedule, priority, percentComplete, categories, description }) => {
2145
+ const exampleTask = createTaskExamplePayload.data.task;
2146
+ const appliedCategories = { ...exampleTask.appliedCategories };
2147
+ for (const category of categories?.applyCategories ?? []) appliedCategories[category] = true;
2148
+ for (const category of categories?.removeCategories ?? []) delete appliedCategories[category];
2149
+ const task = {
2150
+ ...exampleTask,
2151
+ planId,
2152
+ title,
2153
+ bucketId: bucketId ?? exampleTask.bucketId,
2154
+ priority: priority ?? exampleTask.priority,
2155
+ percentComplete: percentComplete ?? exampleTask.percentComplete,
2156
+ startDateTime: schedule?.startDateTime ?? exampleTask.startDateTime,
2157
+ dueDateTime: schedule?.dueDateTime ?? exampleTask.dueDateTime,
2158
+ appliedCategories,
2159
+ hasDescription: Boolean(description)
2160
+ };
2161
+ if (!description) return { data: {
2162
+ task,
2163
+ details: null
2164
+ } };
2165
+ return { data: {
2166
+ task,
2167
+ details: {
2168
+ ...createTaskExamplePayload.data.details,
2169
+ description
2170
+ }
2171
+ } };
2172
+ },
2173
+ examplePayload: createTaskExamplePayload
2174
+ });
2175
+ //#endregion
2176
+ //#region src/actions/tasks/deleteTask.ts
2177
+ const deleteTask = (0, _prismatic_io_spectral.action)({
2178
+ display: {
2179
+ label: "Delete Task",
2180
+ description: "Delete a task."
2181
+ },
2182
+ inputs: deleteTaskInputs,
2183
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2184
+ type: "actionOutput",
2185
+ schema: deleteTaskOutputSchema
2186
+ }),
2187
+ performSafety: "notAllowed",
2188
+ perform: async (context, { connection, taskId, etag }) => {
2189
+ await deleteWithEtag(createClient(connection, context.debug.enabled), PLANNER_ENDPOINTS.TASK(taskId), etag);
2190
+ return { data: {
2191
+ success: true,
2192
+ id: taskId,
2193
+ message: "Task deleted successfully"
2194
+ } };
2195
+ },
2196
+ examplePerform: async () => deleteTaskExamplePayload,
2197
+ examplePayload: deleteTaskExamplePayload
2198
+ });
2199
+ //#endregion
2200
+ //#region src/actions/tasks/getTask.ts
2201
+ const getTask = (0, _prismatic_io_spectral.action)({
2202
+ display: {
2203
+ label: "Get Task",
2204
+ description: "Retrieve a single task by its ID."
2205
+ },
2206
+ inputs: getTaskInputs,
2207
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2208
+ type: "actionOutput",
2209
+ schema: getTaskOutputSchema
2210
+ }),
2211
+ performSafety: "safe",
2212
+ perform: async (context, { connection, taskId }) => {
2213
+ const { data } = await createClient(connection, context.debug.enabled).get(PLANNER_ENDPOINTS.TASK(taskId));
2214
+ return { data };
2215
+ },
2216
+ examplePayload: getTaskExamplePayload
2217
+ });
2218
+ //#endregion
2219
+ //#region src/actions/tasks/getTaskDetails.ts
2220
+ const getTaskDetails = (0, _prismatic_io_spectral.action)({
2221
+ display: {
2222
+ label: "Get Task Details",
2223
+ description: "Retrieve a task's description, checklist, and links."
2224
+ },
2225
+ inputs: getTaskDetailsInputs,
2226
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2227
+ type: "actionOutput",
2228
+ schema: getTaskDetailsOutputSchema
2229
+ }),
2230
+ performSafety: "safe",
2231
+ perform: async (context, { connection, taskId }) => {
2232
+ const { data } = await createClient(connection, context.debug.enabled).get(PLANNER_ENDPOINTS.TASK_DETAILS(taskId));
2233
+ return { data };
2234
+ },
2235
+ examplePayload: getTaskDetailsExamplePayload
2236
+ });
2237
+ //#endregion
2238
+ //#region src/actions/tasks/listTasksForUser.ts
2239
+ const listTasksForUser = (0, _prismatic_io_spectral.action)({
2240
+ display: {
2241
+ label: "List Tasks for User",
2242
+ description: "List every task assigned to the user, across every plan."
2243
+ },
2244
+ inputs: listTasksForUserInputs,
2245
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2246
+ type: "actionOutput",
2247
+ schema: listTasksForUserOutputSchema
2248
+ }),
2249
+ performSafety: "notAllowed",
2250
+ perform: async (context, { connection }) => {
2251
+ return { data: await fetchAllPlanner(createClient(connection, context.debug.enabled), computeEndpointBasedOnConnection(connection, PLANNER_ENDPOINTS.USER_TASKS)) };
2252
+ },
2253
+ examplePerform: async () => listTasksForUserExamplePayload,
2254
+ examplePayload: listTasksForUserExamplePayload
2255
+ });
2256
+ //#endregion
2257
+ //#region src/actions/tasks/listTasksInBucket.ts
2258
+ const listTasksInBucket = (0, _prismatic_io_spectral.action)({
2259
+ display: {
2260
+ label: "List Tasks in Bucket",
2261
+ description: "List every task in a single bucket."
2262
+ },
2263
+ inputs: listTasksInBucketInputs,
2264
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2265
+ type: "actionOutput",
2266
+ schema: listTasksInBucketOutputSchema
2267
+ }),
2268
+ performSafety: "notAllowed",
2269
+ perform: async (context, { connection, bucketId }) => {
2270
+ return { data: await fetchAllPlanner(createClient(connection, context.debug.enabled), PLANNER_ENDPOINTS.BUCKET_TASKS(bucketId)) };
2271
+ },
2272
+ examplePerform: async (_context, { planId, bucketId }) => ({ data: {
2273
+ ...listTasksInBucketExamplePayload.data,
2274
+ value: listTasksInBucketExamplePayload.data.value.map((task) => ({
2275
+ ...task,
2276
+ planId,
2277
+ bucketId
2278
+ }))
2279
+ } }),
2280
+ examplePayload: listTasksInBucketExamplePayload
2281
+ });
2282
+ //#endregion
2283
+ //#region src/actions/tasks/listTasksInPlan.ts
2284
+ const listTasksInPlan = (0, _prismatic_io_spectral.action)({
2285
+ display: {
2286
+ label: "List Tasks in Plan",
2287
+ description: "List every task in a plan, across all of its buckets."
2288
+ },
2289
+ inputs: listTasksInPlanInputs,
2290
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2291
+ type: "actionOutput",
2292
+ schema: listTasksInPlanOutputSchema
2293
+ }),
2294
+ performSafety: "notAllowed",
2295
+ perform: async (context, { connection, planId }) => {
2296
+ return { data: await fetchAllPlanner(createClient(connection, context.debug.enabled), PLANNER_ENDPOINTS.PLAN_TASKS(planId)) };
2297
+ },
2298
+ examplePerform: async (_context, { planId }) => ({ data: {
2299
+ ...listTasksInPlanExamplePayload.data,
2300
+ value: listTasksInPlanExamplePayload.data.value.map((task) => ({
2301
+ ...task,
2302
+ planId
2303
+ }))
2304
+ } }),
2305
+ examplePayload: listTasksInPlanExamplePayload
2306
+ });
2307
+ //#endregion
2308
+ //#region src/actions/tasks/moveTaskToBucket.ts
2309
+ const moveTaskToBucket = (0, _prismatic_io_spectral.action)({
2310
+ display: {
2311
+ label: "Move Task to Bucket",
2312
+ description: "Move a task into a different bucket. The destination bucket must belong to the same plan as the task."
2313
+ },
2314
+ inputs: moveTaskToBucketInputs,
2315
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2316
+ type: "actionOutput",
2317
+ schema: moveTaskToBucketOutputSchema
2318
+ }),
2319
+ performSafety: "notAllowed",
2320
+ perform: async (context, { connection, taskId, bucketId, etag }) => {
2321
+ return { data: await patchWithEtag(createClient(connection, context.debug.enabled), PLANNER_ENDPOINTS.TASK(taskId), { bucketId }, etag) };
2322
+ },
2323
+ examplePerform: async (_context, { bucketId }) => ({ data: {
2324
+ ...moveTaskToBucketExamplePayload.data,
2325
+ bucketId
2326
+ } }),
2327
+ examplePayload: moveTaskToBucketExamplePayload
2328
+ });
2329
+ //#endregion
2330
+ //#region src/actions/tasks/index.ts
2331
+ var tasks_default = {
2332
+ listTasksInPlan,
2333
+ listTasksInBucket,
2334
+ listTasksForUser,
2335
+ getTask,
2336
+ createTask,
2337
+ updateTask: (0, _prismatic_io_spectral.action)({
2338
+ display: {
2339
+ label: "Update Task",
2340
+ description: "Update a task's properties. Only the fields supplied are changed; everything else keeps its current value."
2341
+ },
2342
+ inputs: updateTaskInputs,
2343
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2344
+ type: "actionOutput",
2345
+ schema: updateTaskOutputSchema
2346
+ }),
2347
+ performSafety: "notAllowed",
2348
+ perform: async (context, { connection, taskId, title, bucketId, assignment, schedule, priority, percentComplete, categories, conversationThreadId, etag }) => {
2349
+ const client = createClient(connection, context.debug.enabled);
2350
+ const assignments = buildAssignments(assignment?.assignTo, assignment?.unassign);
2351
+ const appliedCategories = buildAppliedCategories(categories?.applyCategories, categories?.removeCategories);
2352
+ const body = compact({
2353
+ title,
2354
+ bucketId,
2355
+ priority,
2356
+ percentComplete,
2357
+ conversationThreadId,
2358
+ startDateTime: schedule?.startDateTime,
2359
+ dueDateTime: schedule?.dueDateTime,
2360
+ assignments: Object.keys(assignments).length ? assignments : void 0,
2361
+ appliedCategories: Object.keys(appliedCategories).length ? appliedCategories : void 0
2362
+ });
2363
+ return { data: await patchWithEtag(client, PLANNER_ENDPOINTS.TASK(taskId), body, etag) };
2364
+ },
2365
+ examplePerform: async (_context, { title, bucketId, schedule, priority, percentComplete, categories, conversationThreadId }) => {
2366
+ const exampleTask = updateTaskExamplePayload.data;
2367
+ const appliedCategories = { ...exampleTask.appliedCategories };
2368
+ for (const category of categories?.applyCategories ?? []) appliedCategories[category] = true;
2369
+ for (const category of categories?.removeCategories ?? []) delete appliedCategories[category];
2370
+ return { data: {
2371
+ ...exampleTask,
2372
+ title: title ?? exampleTask.title,
2373
+ bucketId: bucketId ?? exampleTask.bucketId,
2374
+ priority: priority ?? exampleTask.priority,
2375
+ percentComplete: percentComplete ?? exampleTask.percentComplete,
2376
+ startDateTime: schedule?.startDateTime ?? exampleTask.startDateTime,
2377
+ dueDateTime: schedule?.dueDateTime ?? exampleTask.dueDateTime,
2378
+ conversationThreadId: conversationThreadId ?? exampleTask.conversationThreadId,
2379
+ appliedCategories
2380
+ } };
2381
+ },
2382
+ examplePayload: updateTaskExamplePayload
2383
+ }),
2384
+ deleteTask,
2385
+ getTaskDetails,
2386
+ updateTaskDetails: (0, _prismatic_io_spectral.action)({
2387
+ display: {
2388
+ label: "Update Task Details",
2389
+ description: "Set a task's description, checklist items, and external links."
2390
+ },
2391
+ inputs: updateTaskDetailsInputs,
2392
+ outputSchema: (0, _prismatic_io_spectral.outputSchema)({
2393
+ type: "actionOutput",
2394
+ schema: updateTaskDetailsOutputSchema
2395
+ }),
2396
+ performSafety: "notAllowed",
2397
+ perform: async (context, { connection, taskId, description, checklist, references, previewType, etag }) => {
2398
+ const client = createClient(connection, context.debug.enabled);
2399
+ const checklistBody = buildChecklist(checklist?.addItems, [], checklist?.removeItemIds);
2400
+ const referencesBody = buildReferences(references?.addReferences, references?.removeReferenceUrls);
2401
+ const body = compact({
2402
+ description,
2403
+ previewType,
2404
+ checklist: Object.keys(checklistBody).length ? checklistBody : void 0,
2405
+ references: Object.keys(referencesBody).length ? referencesBody : void 0
2406
+ });
2407
+ return { data: await patchWithEtag(client, PLANNER_ENDPOINTS.TASK_DETAILS(taskId), body, etag) };
2408
+ },
2409
+ examplePerform: async (_context, { description, previewType }) => ({ data: {
2410
+ ...updateTaskDetailsExamplePayload.data,
2411
+ description: description ?? updateTaskDetailsExamplePayload.data.description,
2412
+ previewType: previewType ?? updateTaskDetailsExamplePayload.data.previewType
2413
+ } }),
2414
+ examplePayload: updateTaskDetailsExamplePayload
2415
+ }),
2416
+ completeTask,
2417
+ assignTask,
2418
+ moveTaskToBucket
2419
+ };
2420
+ //#endregion
2421
+ //#region src/actions/index.ts
2422
+ var actions_default = {
2423
+ ...plans_default,
2424
+ ...buckets_default,
2425
+ ...tasks_default,
2426
+ ...misc_default
2427
+ };
2428
+ //#endregion
2429
+ //#region src/dataSources/selectBucket.ts
2430
+ const selectBucket = (0, _prismatic_io_spectral.dataSource)({
2431
+ display: {
2432
+ label: "Select Bucket",
2433
+ description: "Select a bucket from a plan."
2434
+ },
2435
+ inputs: selectBucketInputs,
2436
+ perform: async (_context, { connection, planId }) => {
2437
+ const { value } = await fetchAllPlanner(createClient(connection, false), PLANNER_ENDPOINTS.PLAN_BUCKETS(planId));
2438
+ return { result: value.map((bucket) => ({
2439
+ label: _prismatic_io_spectral.util.types.toString(bucket.name),
2440
+ key: _prismatic_io_spectral.util.types.toString(bucket.id)
2441
+ })) };
2442
+ },
2443
+ dataSourceType: "picklist",
2444
+ examplePayload: selectBucketExamplePayload
2445
+ });
2446
+ //#endregion
2447
+ //#region src/dataSources/index.ts
2448
+ var dataSources_default = {
2449
+ selectGroup: (0, _prismatic_io_spectral.dataSource)({
2450
+ display: {
2451
+ label: "Select Group",
2452
+ description: "Select a Microsoft 365 group that can contain plans."
2453
+ },
2454
+ inputs: selectGroupInputs,
2455
+ perform: async (_context, { connection }) => {
2456
+ const client = createClient(connection, false);
2457
+ const { value } = isClientCredentials(connection) ? await fetchAllDirectory(client, PLANNER_ENDPOINTS.GROUPS, {
2458
+ $filter: "groupTypes/any(c:c eq 'Unified')",
2459
+ $select: "id,displayName",
2460
+ $top: 999
2461
+ }) : await fetchAllDirectory(client, PLANNER_ENDPOINTS.MEMBER_OF_GROUPS, {
2462
+ $select: "id,displayName",
2463
+ $top: 999
2464
+ });
2465
+ return { result: value.map((group) => ({
2466
+ label: _prismatic_io_spectral.util.types.toString(group.displayName),
2467
+ key: _prismatic_io_spectral.util.types.toString(group.id)
2468
+ })) };
2469
+ },
2470
+ dataSourceType: "picklist",
2471
+ examplePayload: selectGroupExamplePayload
2472
+ }),
2473
+ selectPlan: (0, _prismatic_io_spectral.dataSource)({
2474
+ display: {
2475
+ label: "Select Plan",
2476
+ description: "Select a plan from a group, or from the plans shared with the user."
2477
+ },
2478
+ inputs: selectPlanInputs,
2479
+ perform: async (_context, { connection, groupId }) => {
2480
+ const { value } = await fetchAllPlanner(createClient(connection, false), groupId ? PLANNER_ENDPOINTS.GROUP_PLANS(groupId) : computeEndpointBasedOnConnection(connection, PLANNER_ENDPOINTS.USER_PLANS));
2481
+ return { result: value.map((plan) => ({
2482
+ label: _prismatic_io_spectral.util.types.toString(plan.title),
2483
+ key: _prismatic_io_spectral.util.types.toString(plan.id)
2484
+ })) };
2485
+ },
2486
+ dataSourceType: "picklist",
2487
+ examplePayload: selectPlanExamplePayload
2488
+ }),
2489
+ selectBucket,
2490
+ selectTask: (0, _prismatic_io_spectral.dataSource)({
2491
+ display: {
2492
+ label: "Select Task",
2493
+ description: "Select a task from a plan."
2494
+ },
2495
+ inputs: selectTaskInputs,
2496
+ perform: async (_context, { connection, planId }) => {
2497
+ const { value } = await fetchAllPlanner(createClient(connection, false), PLANNER_ENDPOINTS.PLAN_TASKS(planId));
2498
+ return { result: value.map((task) => ({
2499
+ label: _prismatic_io_spectral.util.types.toString(task.title),
2500
+ key: _prismatic_io_spectral.util.types.toString(task.id)
2501
+ })) };
2502
+ },
2503
+ dataSourceType: "picklist",
2504
+ examplePayload: selectTaskExamplePayload
2505
+ }),
2506
+ selectUser: (0, _prismatic_io_spectral.dataSource)({
2507
+ display: {
2508
+ label: "Select User",
2509
+ description: "Select a user to assign work to."
2510
+ },
2511
+ inputs: selectUserInputs,
2512
+ perform: async (_context, { connection }) => {
2513
+ const { value } = await fetchAllDirectory(createClient(connection, false), PLANNER_ENDPOINTS.USERS, {
2514
+ $select: "id,displayName,mail",
2515
+ $top: 999
2516
+ });
2517
+ return { result: value.map((user) => ({
2518
+ label: _prismatic_io_spectral.util.types.toString(user.displayName || user.mail),
2519
+ key: _prismatic_io_spectral.util.types.toString(user.id)
2520
+ })) };
2521
+ },
2522
+ dataSourceType: "picklist",
2523
+ examplePayload: selectUserExamplePayload
2524
+ })
2525
+ };
2526
+ //#endregion
2527
+ //#region src/triggers/index.ts
2528
+ var triggers_default = { pollChangesTrigger: (0, _prismatic_io_spectral.pollingTrigger)({
2529
+ display: {
2530
+ label: "New Tasks",
2531
+ description: "Retrieves existing and newly created tasks for a specified Microsoft Planner plan. Load history once, check for new tasks on a schedule, or both."
2532
+ },
2533
+ inputs: pollChangesTriggerInputs,
2534
+ triggerResolverSupport: "valid",
2535
+ batchConfig: { batchSize: 50 },
2536
+ triggerResolver: { resolveItems: (_context, { payload }) => resolvePlannerTaskChanges(payload.body.data) },
2537
+ perform: async (context, payload, { connection, planId, lookBackDate }) => {
2538
+ const lastPolledAt = context.polling.getState()?.lastPolledAt ?? (lookBackDate ? (/* @__PURE__ */ new Date(Date.parse(lookBackDate) - 1)).toISOString() : void 0);
2539
+ const { fetched, created, newestCreatedDateTime, truncated } = await fetchTasksCreatedSince(createClient(connection, context.debug.enabled), PLANNER_ENDPOINTS.PLAN_TASKS(planId), lastPolledAt);
2540
+ if (truncated) throw new Error(`Plan ${planId} has more tasks than the 100-page limit allows in one poll. Planner exposes no filter or ordering to resume a truncated walk, so no tasks were emitted and the polling cursor was not advanced.`);
2541
+ const nextCursor = lastPolledAt ? latestCreatedDateTime(created, lastPolledAt) : newestCreatedDateTime ?? (/* @__PURE__ */ new Date()).toISOString();
2542
+ context.polling.setState({ lastPolledAt: nextCursor });
2543
+ if (context.debug.enabled) context.logger.debug(lastPolledAt ? `Polled plan ${planId}: ${fetched} tasks fetched, ${created.length} created since ${lastPolledAt}` : `Polled plan ${planId}: ${fetched} tasks fetched, cursor seeded at ${nextCursor}`);
2544
+ return {
2545
+ payload: {
2546
+ ...payload,
2547
+ body: { data: { created } }
2548
+ },
2549
+ polledNoChanges: created.length === 0
2550
+ };
2551
+ },
2552
+ examplePayload: pollChangesTriggerExamplePayload
2553
+ }) };
2554
+ //#endregion
2555
+ //#region src/index.ts
2556
+ var src_default = (0, _prismatic_io_spectral.component)({
2557
+ key: "ms-planner",
2558
+ public: true,
2559
+ documentationUrl: "https://prismatic.io/docs/components/ms-planner/",
2560
+ display: {
2561
+ label: "Microsoft Planner",
2562
+ description: "Manage plans, buckets, tasks, and task details in Microsoft Planner.",
2563
+ iconPath: "icon.png",
2564
+ category: "Application Connectors"
2565
+ },
2566
+ hooks: { error: _prismatic_io_spectral_http.handleErrors },
2567
+ actions: actions_default,
2568
+ triggers: triggers_default,
2569
+ dataSources: dataSources_default,
2570
+ connections: connections_default
2571
+ });
2572
+ //#endregion
2573
+ //#region npm-dist/.entry.ts
2574
+ var _entry_default = (0, _prismatic_io_spectral.callableComponent)(src_default);
2575
+ //#endregion
2576
+ module.exports = _entry_default;