@transcend-io/mcp-server-assessment 0.3.20 → 0.4.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,3204 @@
1
+ import { PaginationSchema, TranscendGraphQLBase, createListResult, createToolResult, defineTool, z } from "@transcend-io/mcp-server-base";
2
+ import { AssessmentFormStatus, AssessmentFormTemplateStatus, ScopeName } from "@transcend-io/privacy-types";
3
+ //#region src/tools/assessments_add_section.ts
4
+ const AddSectionSchema = z.object({
5
+ templateId: z.string().describe("ID of the assessment form template to add the section to"),
6
+ title: z.string().describe("Title of the new section"),
7
+ questions: z.array(z.record(z.string(), z.unknown())).optional().describe("Array of question objects: [{title, type, subType?, description?, placeholder?, isRequired?, referenceId?, answerOptions?: [{value}], allowSelectOther?, requireRiskEvaluation?}]")
8
+ });
9
+ function createAssessmentsAddSectionTool(clients) {
10
+ const graphql = clients.graphql;
11
+ return defineTool({
12
+ name: "assessments_add_section",
13
+ description: "Add a new section (with optional inline questions) to an existing assessment form template. Useful for building templates incrementally or adding sections to imported templates. Same auto-corrections as assessments_create_template apply to questions.",
14
+ category: "Assessments",
15
+ readOnly: false,
16
+ confirmationHint: "Adds a section to the assessment template",
17
+ annotations: {
18
+ readOnlyHint: false,
19
+ destructiveHint: false,
20
+ idempotentHint: false
21
+ },
22
+ zodSchema: AddSectionSchema,
23
+ handler: async ({ templateId, title, questions }) => {
24
+ return createToolResult(true, {
25
+ section: await graphql.createAssessmentSection({
26
+ assessmentFormTemplateId: templateId,
27
+ title,
28
+ questions
29
+ }),
30
+ message: `Section "${title}" added to template successfully`
31
+ });
32
+ }
33
+ });
34
+ }
35
+ //#endregion
36
+ //#region src/tools/assessments_answer_question.ts
37
+ const AnswerQuestionValueSchema = z.object({
38
+ value: z.string().describe("The free-text answer content to record for the question."),
39
+ isUserCreated: z.boolean().describe("True when this value is newly authored by the caller (rather than an existing option). Use true for free-text answers.")
40
+ });
41
+ const AnswerQuestionSchema = z.object({
42
+ assessmentQuestionId: z.string().describe("ID of the assessment question to answer"),
43
+ assessmentAnswerIds: z.array(z.string()).optional().describe("IDs of existing answer options to select (for SINGLE_SELECT/MULTI_SELECT questions)"),
44
+ assessmentAnswerValues: z.array(AnswerQuestionValueSchema).optional().describe("Free-text answer values to create and select (for text questions). Each item: {value: string, isUserCreated: boolean}")
45
+ });
46
+ function createAssessmentsAnswerQuestionTool(clients) {
47
+ const graphql = clients.graphql;
48
+ return defineTool({
49
+ name: "assessments_answer_question",
50
+ description: "Answer an assessment question by selecting existing answer options or providing free-text values. For SINGLE_SELECT/MULTI_SELECT questions, provide assessmentAnswerIds from the answerOptions. For SHORT_ANSWER_TEXT/LONG_ANSWER_TEXT, provide assessmentAnswerValues with {value, isUserCreated: true}.",
51
+ category: "Assessments",
52
+ readOnly: false,
53
+ confirmationHint: "Records answer to the assessment question",
54
+ annotations: {
55
+ readOnlyHint: false,
56
+ destructiveHint: false,
57
+ idempotentHint: true
58
+ },
59
+ zodSchema: AnswerQuestionSchema,
60
+ handler: async ({ assessmentQuestionId, assessmentAnswerIds, assessmentAnswerValues }) => {
61
+ const input = { assessmentQuestionId };
62
+ if (assessmentAnswerIds) input.assessmentAnswerIds = assessmentAnswerIds;
63
+ if (assessmentAnswerValues) input.assessmentAnswerValues = assessmentAnswerValues;
64
+ return createToolResult(true, {
65
+ selectedAnswers: await graphql.selectAssessmentQuestionAnswers(input),
66
+ message: "Assessment question answered successfully"
67
+ });
68
+ }
69
+ });
70
+ }
71
+ //#endregion
72
+ //#region src/helpers/buildAssessmentLinks.ts
73
+ /**
74
+ * Build the canonical admin-dashboard deep link for an assessment.
75
+ *
76
+ * Always points at `/assessments/forms/:id/response`, mirroring the
77
+ * dashboard's own "View Responses" row action. The fillable
78
+ * `/assessments/forms/:id/view` route is intentionally not emitted —
79
+ * it only resolves for the form's assignee, which the MCP can't verify.
80
+ */
81
+ function buildAssessmentLinks({ dashboardUrl, assessmentFormId }) {
82
+ return { url: `${dashboardUrl.replace(/\/$/, "")}/assessments/forms/${assessmentFormId}/response` };
83
+ }
84
+ /** Build a link to the assessment-group page (for group-level tools). */
85
+ function buildAssessmentGroupUrl(dashboardUrl, assessmentGroupId) {
86
+ return `${dashboardUrl.replace(/\/$/, "")}/assessments/groups/${assessmentGroupId}`;
87
+ }
88
+ //#endregion
89
+ //#region src/tools/_helpers.ts
90
+ /**
91
+ * Resolves a template_id to an assessment group ID by searching through all groups.
92
+ * Returns either the group ID or an error result.
93
+ */
94
+ async function resolveTemplateToGroupId(graphql, templateId) {
95
+ const matchingGroups = (await graphql.listAssessmentGroups({ first: 100 })).nodes.filter((g) => g.assessmentFormTemplate?.id === templateId);
96
+ if (matchingGroups.length === 0) return { error: createToolResult(false, void 0, `No assessment group found for template_id "${templateId}". Use assessments_list_groups to see available groups.`) };
97
+ if (matchingGroups.length > 1) return { error: createToolResult(false, void 0, `Multiple assessment groups found for template_id "${templateId}" (group IDs: ${matchingGroups.map((g) => g.id).join(", ")}). Please specify assessment_group_id explicitly. Use assessments_list_groups to find available groups.`) };
98
+ return { groupId: matchingGroups[0].id };
99
+ }
100
+ //#endregion
101
+ //#region src/tools/assessments_create.ts
102
+ const CreateAssessmentSchema = z.object({
103
+ title: z.string().describe("Title of the assessment"),
104
+ assessmentGroupId: z.string().optional().describe("ID of the assessment group to create the assessment in (preferred). Use assessments_list_groups to find available groups."),
105
+ templateId: z.string().optional().describe("ID of the assessment template. If assessmentGroupId is not provided, the first group using this template will be used."),
106
+ assigneeIds: z.array(z.string()).optional().describe("Array of user IDs to assign the assessment to")
107
+ });
108
+ function createAssessmentsCreateTool(clients) {
109
+ const graphql = clients.graphql;
110
+ const { dashboardUrl } = clients;
111
+ return defineTool({
112
+ name: "assessments_create",
113
+ description: "Create a new privacy assessment within an assessment group. Assessment groups are linked to templates. You can provide either an assessmentGroupId directly, or a templateId to auto-resolve the first matching group. Use assessments_list_groups to find available groups. The response includes a `url` field with the canonical admin-dashboard link — surface that to the user verbatim and do not construct assessment URLs from raw IDs.",
114
+ category: "Assessments",
115
+ readOnly: false,
116
+ confirmationHint: "Creates a new privacy assessment",
117
+ annotations: {
118
+ readOnlyHint: false,
119
+ destructiveHint: false,
120
+ idempotentHint: false
121
+ },
122
+ zodSchema: CreateAssessmentSchema,
123
+ handler: async ({ title, assessmentGroupId, templateId, assigneeIds }) => {
124
+ let resolvedAssessmentGroupId = assessmentGroupId;
125
+ if (!resolvedAssessmentGroupId && templateId) {
126
+ const resolved = await resolveTemplateToGroupId(graphql, templateId);
127
+ if ("error" in resolved) return resolved.error;
128
+ resolvedAssessmentGroupId = resolved.groupId;
129
+ }
130
+ if (!resolvedAssessmentGroupId) return createToolResult(false, void 0, "Either assessmentGroupId or templateId must be provided. Use assessments_list_groups to find available groups.");
131
+ const result = await graphql.createAssessment({
132
+ title,
133
+ assessmentGroupId: resolvedAssessmentGroupId,
134
+ assigneeIds
135
+ });
136
+ const links = buildAssessmentLinks({
137
+ dashboardUrl,
138
+ assessmentFormId: result.id
139
+ });
140
+ return createToolResult(true, {
141
+ assessment: {
142
+ ...result,
143
+ ...links
144
+ },
145
+ ...links,
146
+ message: `Assessment "${title}" created successfully. Open it at ${links.url}`
147
+ });
148
+ }
149
+ });
150
+ }
151
+ //#endregion
152
+ //#region src/tools/assessments_create_group.ts
153
+ const CreateGroupSchema = z.object({
154
+ title: z.string().describe("Title of the assessment group"),
155
+ templateId: z.string().describe("ID of the assessment template to link this group to"),
156
+ description: z.string().optional().describe("Description of the assessment group (optional)"),
157
+ reviewerIds: z.array(z.string()).optional().describe("IDs of users assigned to review new assessments in this group (optional)")
158
+ });
159
+ function createAssessmentsCreateGroupTool(clients) {
160
+ const graphql = clients.graphql;
161
+ const { dashboardUrl } = clients;
162
+ return defineTool({
163
+ name: "assessments_create_group",
164
+ description: "Create a new assessment group linked to a template. Assessment groups are containers for assessments. The response includes a `groupUrl` field with the canonical admin-dashboard link to the group — surface that to the user verbatim.",
165
+ category: "Assessments",
166
+ readOnly: false,
167
+ confirmationHint: "Creates a new assessment group",
168
+ annotations: {
169
+ readOnlyHint: false,
170
+ destructiveHint: false,
171
+ idempotentHint: false
172
+ },
173
+ zodSchema: CreateGroupSchema,
174
+ handler: async ({ title, templateId, description, reviewerIds }) => {
175
+ const result = await graphql.createAssessmentGroup({
176
+ title,
177
+ assessmentFormTemplateId: templateId,
178
+ description,
179
+ reviewerIds
180
+ });
181
+ const groupUrl = buildAssessmentGroupUrl(dashboardUrl, result.id);
182
+ return createToolResult(true, {
183
+ assessmentGroup: {
184
+ ...result,
185
+ groupUrl
186
+ },
187
+ groupUrl,
188
+ message: `Assessment group "${title}" created successfully. View it at ${groupUrl}`
189
+ });
190
+ }
191
+ });
192
+ }
193
+ //#endregion
194
+ //#region src/tools/assessments_create_template.ts
195
+ const CreateTemplateSchema = z.object({
196
+ title: z.string().describe("Title of the assessment form template"),
197
+ description: z.string().optional().describe("Description of the template"),
198
+ status: z.nativeEnum(AssessmentFormTemplateStatus).optional().describe("Template status: DRAFT or PUBLISHED (default: DRAFT)"),
199
+ sections: z.array(z.record(z.string(), z.unknown())).optional().describe("Array of section objects with title and optional questions array")
200
+ });
201
+ function createAssessmentsCreateTemplateTool(clients) {
202
+ const graphql = clients.graphql;
203
+ return defineTool({
204
+ name: "assessments_create_template",
205
+ description: "Create a new assessment form template with sections and questions inline. This is the \"import\" side of the JSON import/export workflow. You can provide the full template structure (sections with questions and answer options) in a single call. Question types: LONG_ANSWER_TEXT, SHORT_ANSWER_TEXT, SINGLE_SELECT, MULTI_SELECT, FILE. SubTypes: NONE, CUSTOM, USER, TEAM, DATA_SUB_CATEGORY, HAS_PERSONAL_DATA, ATTRIBUTE_KEY, SENSITIVE_CATEGORY. Auto-corrections: referenceId is auto-generated as UUID if missing or not UUID format; subType is auto-set to CUSTOM when allowSelectOther is true; requireRiskEvaluation is ignored when no riskFrameworkId is provided.",
206
+ category: "Assessments",
207
+ readOnly: false,
208
+ confirmationHint: "Creates a new assessment form template",
209
+ annotations: {
210
+ readOnlyHint: false,
211
+ destructiveHint: false,
212
+ idempotentHint: false
213
+ },
214
+ zodSchema: CreateTemplateSchema,
215
+ handler: async ({ title, description, status, sections }) => {
216
+ const input = {
217
+ title,
218
+ description,
219
+ status: status ?? "DRAFT",
220
+ sections
221
+ };
222
+ return createToolResult(true, {
223
+ template: await graphql.createAssessmentFormTemplate(input),
224
+ message: `Assessment template "${title}" created successfully`
225
+ });
226
+ }
227
+ });
228
+ }
229
+ //#endregion
230
+ //#region src/tools/assessments_export_template.ts
231
+ const ExportTemplateSchema = z.object({ templateId: z.string().describe("ID of the assessment form template to export") });
232
+ function createAssessmentsExportTemplateTool(clients) {
233
+ const graphql = clients.graphql;
234
+ return defineTool({
235
+ name: "assessments_export_template",
236
+ description: "Export a full assessment form template as JSON, including all sections, questions, answer options, and configuration. This is the \"export\" side of the JSON import/export workflow. The output can be used as input for assessments_create_template to recreate the template elsewhere.",
237
+ category: "Assessments",
238
+ readOnly: true,
239
+ annotations: {
240
+ readOnlyHint: true,
241
+ destructiveHint: false,
242
+ idempotentHint: true
243
+ },
244
+ zodSchema: ExportTemplateSchema,
245
+ handler: async ({ templateId }) => {
246
+ const template = await graphql.getAssessmentFormTemplate(templateId);
247
+ return createToolResult(true, {
248
+ _exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
249
+ _format: "transcend-assessment-template-v1",
250
+ template: {
251
+ title: template.title,
252
+ description: template.description,
253
+ status: template.status,
254
+ sections: template.sections.map((section) => ({
255
+ title: section.title,
256
+ questions: section.questions.map((q) => ({
257
+ title: q.title,
258
+ type: q.type,
259
+ subType: q.subType,
260
+ description: q.description,
261
+ placeholder: q.placeholder,
262
+ isRequired: q.isRequired,
263
+ referenceId: q.referenceId,
264
+ allowSelectOther: q.allowSelectOther,
265
+ requireRiskEvaluation: q.requireRiskEvaluation,
266
+ answerOptions: q.answerOptions.map((opt) => ({ value: opt.value }))
267
+ }))
268
+ }))
269
+ },
270
+ _raw: template
271
+ });
272
+ }
273
+ });
274
+ }
275
+ //#endregion
276
+ //#region src/tools/assessments_get.ts
277
+ const GetAssessmentSchema = z.object({
278
+ assessmentId: z.string().describe("ID of the assessment to retrieve"),
279
+ assessmentName: z.string().optional().describe("Optional human-readable name (e.g. title) for the tool call in chat; not sent to the API.")
280
+ });
281
+ function createAssessmentsGetTool(clients) {
282
+ const graphql = clients.graphql;
283
+ const { dashboardUrl } = clients;
284
+ return defineTool({
285
+ name: "assessments_get",
286
+ description: "Get detailed information about a specific assessment including questions and responses. The response includes a `url` field with the canonical admin-dashboard link — surface that to the user verbatim and do not construct assessment URLs from raw IDs.",
287
+ category: "Assessments",
288
+ readOnly: true,
289
+ annotations: {
290
+ readOnlyHint: true,
291
+ destructiveHint: false,
292
+ idempotentHint: true
293
+ },
294
+ zodSchema: GetAssessmentSchema,
295
+ handler: async ({ assessmentId }) => {
296
+ const result = await graphql.getAssessment(assessmentId);
297
+ const links = buildAssessmentLinks({
298
+ dashboardUrl,
299
+ assessmentFormId: result.id
300
+ });
301
+ return createToolResult(true, {
302
+ ...result,
303
+ ...links
304
+ });
305
+ }
306
+ });
307
+ }
308
+ //#endregion
309
+ //#region src/tools/assessments_list.ts
310
+ const AssessmentStatusEnum = z.nativeEnum(AssessmentFormStatus);
311
+ const ListAssessmentsSchema = z.object({ status: AssessmentStatusEnum.optional().describe("Filter by assessment status") }).merge(PaginationSchema);
312
+ function createAssessmentsListTool(clients) {
313
+ const graphql = clients.graphql;
314
+ const { dashboardUrl } = clients;
315
+ return defineTool({
316
+ name: "assessments_list",
317
+ description: "List all privacy assessments in your organization. Supports filtering by status. Each row includes a `url` field with the canonical admin-dashboard link for that assessment — surface those to the user verbatim and do not construct assessment URLs from raw IDs. Note: Cursor pagination is not supported (max 100 results).",
318
+ category: "Assessments",
319
+ readOnly: true,
320
+ annotations: {
321
+ readOnlyHint: true,
322
+ destructiveHint: false,
323
+ idempotentHint: true
324
+ },
325
+ zodSchema: ListAssessmentsSchema,
326
+ handler: async ({ status, limit, cursor }) => {
327
+ const result = await graphql.listAssessments({
328
+ first: limit,
329
+ after: cursor,
330
+ filterBy: status ? { statuses: [status] } : void 0
331
+ });
332
+ return createListResult(result.nodes.map((node) => ({
333
+ ...node,
334
+ ...buildAssessmentLinks({
335
+ dashboardUrl,
336
+ assessmentFormId: node.id
337
+ })
338
+ })), {
339
+ totalCount: result.totalCount,
340
+ hasNextPage: result.pageInfo?.hasNextPage
341
+ });
342
+ }
343
+ });
344
+ }
345
+ //#endregion
346
+ //#region src/tools/assessments_list_groups.ts
347
+ const ListGroupsSchema = PaginationSchema;
348
+ function createAssessmentsListGroupsTool(clients) {
349
+ const graphql = clients.graphql;
350
+ const { dashboardUrl } = clients;
351
+ return defineTool({
352
+ name: "assessments_list_groups",
353
+ description: "List all assessment groups. Groups are containers for assessments and are linked to templates. Use this to find the right group ID for creating assessments. Each row includes a `groupUrl` field with the canonical admin-dashboard link — surface those to the user verbatim.",
354
+ category: "Assessments",
355
+ readOnly: true,
356
+ annotations: {
357
+ readOnlyHint: true,
358
+ destructiveHint: false,
359
+ idempotentHint: true
360
+ },
361
+ zodSchema: ListGroupsSchema,
362
+ handler: async ({ limit, cursor }) => {
363
+ const result = await graphql.listAssessmentGroups({
364
+ first: limit,
365
+ after: cursor
366
+ });
367
+ return createListResult(result.nodes.map((node) => ({
368
+ ...node,
369
+ groupUrl: buildAssessmentGroupUrl(dashboardUrl, node.id)
370
+ })), {
371
+ totalCount: result.totalCount,
372
+ hasNextPage: result.pageInfo?.hasNextPage
373
+ });
374
+ }
375
+ });
376
+ }
377
+ //#endregion
378
+ //#region src/tools/assessments_list_templates.ts
379
+ const ListTemplatesSchema = PaginationSchema;
380
+ function createAssessmentsListTemplatesTool(clients) {
381
+ const graphql = clients.graphql;
382
+ return defineTool({
383
+ name: "assessments_list_templates",
384
+ description: "List all available assessment templates. Note: Cursor pagination is not supported by the Transcend API for templates - use limit to control results (max 100).",
385
+ category: "Assessments",
386
+ readOnly: true,
387
+ annotations: {
388
+ readOnlyHint: true,
389
+ destructiveHint: false,
390
+ idempotentHint: true
391
+ },
392
+ zodSchema: ListTemplatesSchema,
393
+ handler: async ({ limit, cursor }) => {
394
+ const result = await graphql.listAssessmentTemplates({
395
+ first: limit,
396
+ after: cursor
397
+ });
398
+ return createListResult(result.nodes, {
399
+ totalCount: result.totalCount,
400
+ hasNextPage: result.pageInfo?.hasNextPage
401
+ });
402
+ }
403
+ });
404
+ }
405
+ //#endregion
406
+ //#region src/tools/assessments_prefill.ts
407
+ const PrefillSchema = z.object({
408
+ title: z.string().describe("Title for the new assessment form"),
409
+ templateId: z.string().optional().describe("Template ID to create the form from. Will auto-resolve to the first matching assessment group."),
410
+ assessmentGroupId: z.string().optional().describe("Assessment group ID (alternative to templateId)"),
411
+ answers: z.record(z.string(), z.union([z.string(), z.array(z.string())])).describe("Map of answers keyed by question title or referenceId. Values should be strings for text/single-select, or arrays of strings for multi-select."),
412
+ assigneeIds: z.array(z.string()).optional().describe("Internal user IDs to assign the form to (optional)"),
413
+ assigneeEmails: z.array(z.string()).optional().describe("External email addresses to assign the form to (optional)"),
414
+ reviewerIds: z.array(z.string()).optional().describe("User IDs to set as reviewers (optional)"),
415
+ submitForReview: z.boolean().optional().describe("Whether to automatically submit the form for review after prefilling (default: false)")
416
+ });
417
+ function createAssessmentsPrefillTool(clients) {
418
+ const graphql = clients.graphql;
419
+ return defineTool({
420
+ name: "assessments_prefill",
421
+ description: "Convenience tool: Create a new assessment form, AI-prefill all the answers, and assign it to a reviewer. Combines: create form → get questions → answer each question → assign reviewers → optionally submit for review. Provide answers as a map of {questionTitle: answer} or {referenceId: answer}. For SINGLE_SELECT/MULTI_SELECT, the answer should match the exact text of the answer option(s). For text questions, provide the free-text answer string. For multi-select, provide an array of answer option values.",
422
+ category: "Assessments",
423
+ readOnly: false,
424
+ confirmationHint: "Creates assessment, prefills answers, assigns reviewers",
425
+ annotations: {
426
+ readOnlyHint: false,
427
+ destructiveHint: false,
428
+ idempotentHint: false
429
+ },
430
+ zodSchema: PrefillSchema,
431
+ handler: async ({ answers, title, assessmentGroupId, templateId, assigneeIds, assigneeEmails, reviewerIds, submitForReview }) => {
432
+ let resolvedAssessmentGroupId = assessmentGroupId;
433
+ if (!resolvedAssessmentGroupId && templateId) {
434
+ const resolved = await resolveTemplateToGroupId(graphql, templateId);
435
+ if ("error" in resolved) return resolved.error;
436
+ resolvedAssessmentGroupId = resolved.groupId;
437
+ }
438
+ if (!resolvedAssessmentGroupId) return createToolResult(false, void 0, "Either templateId or assessmentGroupId is required.");
439
+ const assessmentId = (await graphql.createAssessment({
440
+ title,
441
+ assessmentGroupId: resolvedAssessmentGroupId
442
+ })).id;
443
+ const fullForm = await graphql.getAssessment(assessmentId);
444
+ if (!fullForm.sections || fullForm.sections.length === 0) return createToolResult(true, {
445
+ assessment: fullForm,
446
+ message: "Assessment created but has no sections/questions to prefill.",
447
+ answersApplied: 0
448
+ });
449
+ const results = [];
450
+ let answersApplied = 0;
451
+ let answersSkipped = 0;
452
+ for (const section of fullForm.sections) {
453
+ if (!section.questions) continue;
454
+ for (const question of section.questions) {
455
+ const answerKey = Object.keys(answers).find((key) => key === question.referenceId || key.toLowerCase() === (question.title || "").toLowerCase() || key === question.id);
456
+ if (!answerKey) {
457
+ results.push({
458
+ question: question.title || question.id,
459
+ status: "skipped"
460
+ });
461
+ answersSkipped++;
462
+ continue;
463
+ }
464
+ const answerValue = answers[answerKey];
465
+ if (answerValue === void 0) {
466
+ results.push({
467
+ question: question.title || question.id,
468
+ status: "skipped"
469
+ });
470
+ answersSkipped++;
471
+ continue;
472
+ }
473
+ try {
474
+ const qType = (question.type || "").toUpperCase();
475
+ if (qType === "SINGLE_SELECT" || qType === "MULTI_SELECT") {
476
+ const answerValues = Array.isArray(answerValue) ? answerValue : [answerValue];
477
+ const matchedIds = [];
478
+ for (const val of answerValues) {
479
+ const matchedOption = (question.answerOptions || []).find((opt) => opt.value.toLowerCase() === val.toLowerCase());
480
+ if (matchedOption) matchedIds.push(matchedOption.id);
481
+ }
482
+ if (matchedIds.length > 0) {
483
+ await graphql.selectAssessmentQuestionAnswers({
484
+ assessmentQuestionId: question.id,
485
+ assessmentAnswerIds: matchedIds
486
+ });
487
+ answersApplied++;
488
+ results.push({
489
+ question: question.title || question.id,
490
+ status: "answered",
491
+ answer: answerValues.join(", ")
492
+ });
493
+ } else {
494
+ await graphql.selectAssessmentQuestionAnswers({
495
+ assessmentQuestionId: question.id,
496
+ assessmentAnswerValues: answerValues.map((v) => ({
497
+ value: v,
498
+ isUserCreated: true
499
+ }))
500
+ });
501
+ answersApplied++;
502
+ results.push({
503
+ question: question.title || question.id,
504
+ status: "answered (custom value)",
505
+ answer: answerValues.join(", ")
506
+ });
507
+ }
508
+ } else {
509
+ const textValue = Array.isArray(answerValue) ? answerValue.join("\n") : answerValue;
510
+ await graphql.selectAssessmentQuestionAnswers({
511
+ assessmentQuestionId: question.id,
512
+ assessmentAnswerValues: [{
513
+ value: textValue,
514
+ isUserCreated: true
515
+ }]
516
+ });
517
+ answersApplied++;
518
+ results.push({
519
+ question: question.title || question.id,
520
+ status: "answered",
521
+ answer: textValue.length > 100 ? textValue.substring(0, 100) + "..." : textValue
522
+ });
523
+ }
524
+ } catch (err) {
525
+ results.push({
526
+ question: question.title || question.id,
527
+ status: `error: ${err instanceof Error ? err.message : String(err)}`
528
+ });
529
+ }
530
+ }
531
+ }
532
+ let assignmentResult = null;
533
+ if (assigneeIds || assigneeEmails) assignmentResult = await graphql.updateAssessmentFormAssignees({
534
+ id: assessmentId,
535
+ assigneeIds,
536
+ externalAssigneeEmails: assigneeEmails
537
+ });
538
+ if (reviewerIds) await graphql.updateAssessment({
539
+ id: assessmentId,
540
+ reviewerIds
541
+ });
542
+ let submitResult = null;
543
+ if (submitForReview) {
544
+ const sectionIds = fullForm.sections.map((s) => s.id);
545
+ if (sectionIds.length > 0) submitResult = await graphql.submitAssessmentForReview({
546
+ id: assessmentId,
547
+ assessmentSectionIds: sectionIds
548
+ });
549
+ }
550
+ return createToolResult(true, {
551
+ assessmentId,
552
+ title,
553
+ answersApplied,
554
+ answersSkipped,
555
+ totalQuestions: results.length,
556
+ results,
557
+ assignment: assignmentResult ? {
558
+ status: assignmentResult.status,
559
+ message: "Assignees updated"
560
+ } : null,
561
+ submittedForReview: !!submitResult,
562
+ message: `Assessment "${title}" created and prefilled with ${answersApplied}/${results.length} answers. ` + (assignmentResult ? `Assigned to reviewers. ` : "") + (submitResult ? "Submitted for review." : "Ready for manual submission.")
563
+ });
564
+ }
565
+ });
566
+ }
567
+ //#endregion
568
+ //#region src/tools/assessments_submit_response.ts
569
+ const SubmitResponseSchema = z.object({
570
+ assessmentId: z.string().describe("ID of the assessment to submit for review"),
571
+ assessmentSectionIds: z.array(z.string()).describe("Array of section IDs to submit for review. Required by the API.")
572
+ });
573
+ function createAssessmentsSubmitResponseTool(clients) {
574
+ const graphql = clients.graphql;
575
+ const { dashboardUrl } = clients;
576
+ return defineTool({
577
+ name: "assessments_submit_response",
578
+ description: "Submit an assessment form for review. Optionally specify which sections to submit. This transitions the assessment toward the IN_REVIEW status. The response includes a `url` field pointing at the assessment-group page where reviewers can find the submitted form — surface that to the user verbatim and do not construct assessment URLs from raw IDs.",
579
+ category: "Assessments",
580
+ readOnly: false,
581
+ confirmationHint: "Submits assessment for review — cannot be undone",
582
+ annotations: {
583
+ readOnlyHint: false,
584
+ destructiveHint: true,
585
+ idempotentHint: false
586
+ },
587
+ zodSchema: SubmitResponseSchema,
588
+ handler: async ({ assessmentId, assessmentSectionIds }) => {
589
+ const result = await graphql.submitAssessmentForReview({
590
+ id: assessmentId,
591
+ assessmentSectionIds
592
+ });
593
+ const links = buildAssessmentLinks({
594
+ dashboardUrl,
595
+ assessmentFormId: result.id
596
+ });
597
+ return createToolResult(true, {
598
+ assessment: {
599
+ ...result,
600
+ ...links
601
+ },
602
+ ...links,
603
+ message: `Assessment submitted for review successfully. View it at ${links.url}`
604
+ });
605
+ }
606
+ });
607
+ }
608
+ //#endregion
609
+ //#region src/tools/assessments_update.ts
610
+ const UpdateAssessmentSchema = z.object({
611
+ assessmentId: z.string().describe("ID of the assessment to update"),
612
+ title: z.string().optional().describe("New title for the assessment"),
613
+ description: z.string().optional().describe("New description"),
614
+ reviewerIds: z.array(z.string()).optional().describe("IDs of users assigned to review this assessment"),
615
+ dueDate: z.string().optional().describe("New due date (ISO format)"),
616
+ status: AssessmentStatusEnum.optional().describe("New status")
617
+ });
618
+ function createAssessmentsUpdateTool(clients) {
619
+ const graphql = clients.graphql;
620
+ const { dashboardUrl } = clients;
621
+ return defineTool({
622
+ name: "assessments_update",
623
+ description: "Update an existing assessment. The response includes a `url` field with the canonical admin-dashboard link — surface that to the user verbatim and do not construct assessment URLs from raw IDs.",
624
+ category: "Assessments",
625
+ readOnly: false,
626
+ confirmationHint: "Updates the assessment",
627
+ annotations: {
628
+ readOnlyHint: false,
629
+ destructiveHint: false,
630
+ idempotentHint: true
631
+ },
632
+ zodSchema: UpdateAssessmentSchema,
633
+ handler: async ({ assessmentId, title, description, reviewerIds, dueDate, status }) => {
634
+ const result = await graphql.updateAssessment({
635
+ id: assessmentId,
636
+ title,
637
+ description,
638
+ reviewerIds,
639
+ dueDate,
640
+ status
641
+ });
642
+ const links = buildAssessmentLinks({
643
+ dashboardUrl,
644
+ assessmentFormId: result.id
645
+ });
646
+ return createToolResult(true, {
647
+ assessment: {
648
+ ...result,
649
+ ...links
650
+ },
651
+ ...links,
652
+ message: `Assessment updated successfully. View it at ${links.url}`
653
+ });
654
+ }
655
+ });
656
+ }
657
+ //#endregion
658
+ //#region src/tools/assessments_update_assignees.ts
659
+ const UpdateAssigneesSchema = z.object({
660
+ assessmentId: z.string().describe("ID of the assessment form to update assignees for"),
661
+ assigneeIds: z.array(z.string()).optional().describe("Array of internal user IDs to assign to the assessment"),
662
+ externalAssigneeEmails: z.array(z.string()).optional().describe("Array of external email addresses to assign to the assessment")
663
+ });
664
+ function createAssessmentsUpdateAssigneesTool(clients) {
665
+ const graphql = clients.graphql;
666
+ return defineTool({
667
+ name: "assessments_update_assignees",
668
+ description: "Assign internal users (by ID) or external users (by email) to an assessment form. This also transitions DRAFT assessments to SHARED status.",
669
+ category: "Assessments",
670
+ readOnly: false,
671
+ confirmationHint: "Assigns users to the assessment form",
672
+ annotations: {
673
+ readOnlyHint: false,
674
+ destructiveHint: false,
675
+ idempotentHint: true
676
+ },
677
+ zodSchema: UpdateAssigneesSchema,
678
+ handler: async ({ assessmentId, assigneeIds, externalAssigneeEmails }) => {
679
+ const result = await graphql.updateAssessmentFormAssignees({
680
+ id: assessmentId,
681
+ assigneeIds,
682
+ externalAssigneeEmails
683
+ });
684
+ return createToolResult(true, {
685
+ assessment: result,
686
+ message: `Assessment assignees updated successfully. Status: ${result.status}`
687
+ });
688
+ }
689
+ });
690
+ }
691
+ //#endregion
692
+ //#region src/tools/index.ts
693
+ function getAssessmentTools(clients) {
694
+ return [
695
+ createAssessmentsListTool(clients),
696
+ createAssessmentsGetTool(clients),
697
+ createAssessmentsCreateTool(clients),
698
+ createAssessmentsCreateGroupTool(clients),
699
+ createAssessmentsListGroupsTool(clients),
700
+ createAssessmentsUpdateTool(clients),
701
+ createAssessmentsListTemplatesTool(clients),
702
+ createAssessmentsUpdateAssigneesTool(clients),
703
+ createAssessmentsAnswerQuestionTool(clients),
704
+ createAssessmentsSubmitResponseTool(clients),
705
+ createAssessmentsCreateTemplateTool(clients),
706
+ createAssessmentsAddSectionTool(clients),
707
+ createAssessmentsExportTemplateTool(clients),
708
+ createAssessmentsPrefillTool(clients)
709
+ ];
710
+ }
711
+ //#endregion
712
+ //#region src/scopes.ts
713
+ /** OAuth scopes required for Assessment MCP tools (offline_access added by base). */
714
+ const ASSESSMENT_OAUTH_SCOPES = [
715
+ ScopeName.ViewAssessments,
716
+ ScopeName.ViewAssignedAssessments,
717
+ ScopeName.ManageAssessments,
718
+ ScopeName.ManageAssignedAssessments
719
+ ];
720
+ //#endregion
721
+ //#region src/__generated__/gql.ts
722
+ const documents = {
723
+ "\n query AssessmentsList($first: Int, $filterBy: AssessmentFormFiltersInput) {\n assessmentForms(first: $first, filterBy: $filterBy) {\n nodes {\n id\n title\n status\n createdAt\n assessmentGroup {\n id\n }\n }\n totalCount\n }\n }\n": {
724
+ "kind": "Document",
725
+ "definitions": [{
726
+ "kind": "OperationDefinition",
727
+ "operation": "query",
728
+ "name": {
729
+ "kind": "Name",
730
+ "value": "AssessmentsList"
731
+ },
732
+ "variableDefinitions": [{
733
+ "kind": "VariableDefinition",
734
+ "variable": {
735
+ "kind": "Variable",
736
+ "name": {
737
+ "kind": "Name",
738
+ "value": "first"
739
+ }
740
+ },
741
+ "type": {
742
+ "kind": "NamedType",
743
+ "name": {
744
+ "kind": "Name",
745
+ "value": "Int"
746
+ }
747
+ }
748
+ }, {
749
+ "kind": "VariableDefinition",
750
+ "variable": {
751
+ "kind": "Variable",
752
+ "name": {
753
+ "kind": "Name",
754
+ "value": "filterBy"
755
+ }
756
+ },
757
+ "type": {
758
+ "kind": "NamedType",
759
+ "name": {
760
+ "kind": "Name",
761
+ "value": "AssessmentFormFiltersInput"
762
+ }
763
+ }
764
+ }],
765
+ "selectionSet": {
766
+ "kind": "SelectionSet",
767
+ "selections": [{
768
+ "kind": "Field",
769
+ "name": {
770
+ "kind": "Name",
771
+ "value": "assessmentForms"
772
+ },
773
+ "arguments": [{
774
+ "kind": "Argument",
775
+ "name": {
776
+ "kind": "Name",
777
+ "value": "first"
778
+ },
779
+ "value": {
780
+ "kind": "Variable",
781
+ "name": {
782
+ "kind": "Name",
783
+ "value": "first"
784
+ }
785
+ }
786
+ }, {
787
+ "kind": "Argument",
788
+ "name": {
789
+ "kind": "Name",
790
+ "value": "filterBy"
791
+ },
792
+ "value": {
793
+ "kind": "Variable",
794
+ "name": {
795
+ "kind": "Name",
796
+ "value": "filterBy"
797
+ }
798
+ }
799
+ }],
800
+ "selectionSet": {
801
+ "kind": "SelectionSet",
802
+ "selections": [{
803
+ "kind": "Field",
804
+ "name": {
805
+ "kind": "Name",
806
+ "value": "nodes"
807
+ },
808
+ "selectionSet": {
809
+ "kind": "SelectionSet",
810
+ "selections": [
811
+ {
812
+ "kind": "Field",
813
+ "name": {
814
+ "kind": "Name",
815
+ "value": "id"
816
+ }
817
+ },
818
+ {
819
+ "kind": "Field",
820
+ "name": {
821
+ "kind": "Name",
822
+ "value": "title"
823
+ }
824
+ },
825
+ {
826
+ "kind": "Field",
827
+ "name": {
828
+ "kind": "Name",
829
+ "value": "status"
830
+ }
831
+ },
832
+ {
833
+ "kind": "Field",
834
+ "name": {
835
+ "kind": "Name",
836
+ "value": "createdAt"
837
+ }
838
+ },
839
+ {
840
+ "kind": "Field",
841
+ "name": {
842
+ "kind": "Name",
843
+ "value": "assessmentGroup"
844
+ },
845
+ "selectionSet": {
846
+ "kind": "SelectionSet",
847
+ "selections": [{
848
+ "kind": "Field",
849
+ "name": {
850
+ "kind": "Name",
851
+ "value": "id"
852
+ }
853
+ }]
854
+ }
855
+ }
856
+ ]
857
+ }
858
+ }, {
859
+ "kind": "Field",
860
+ "name": {
861
+ "kind": "Name",
862
+ "value": "totalCount"
863
+ }
864
+ }]
865
+ }
866
+ }]
867
+ }
868
+ }]
869
+ },
870
+ "\n query AssessmentsGet($ids: [ID!]!) {\n assessmentForms(first: 1, filterBy: { ids: $ids }) {\n nodes {\n id\n title\n status\n dueDate\n submittedAt\n createdAt\n updatedAt\n assessmentGroup {\n id\n }\n sections {\n id\n title\n index\n status\n questions {\n id\n title\n index\n type\n subType\n description\n isRequired\n placeholder\n answerOptions {\n id\n index\n value\n }\n selectedAnswers {\n id\n index\n value\n }\n }\n }\n }\n }\n }\n": {
871
+ "kind": "Document",
872
+ "definitions": [{
873
+ "kind": "OperationDefinition",
874
+ "operation": "query",
875
+ "name": {
876
+ "kind": "Name",
877
+ "value": "AssessmentsGet"
878
+ },
879
+ "variableDefinitions": [{
880
+ "kind": "VariableDefinition",
881
+ "variable": {
882
+ "kind": "Variable",
883
+ "name": {
884
+ "kind": "Name",
885
+ "value": "ids"
886
+ }
887
+ },
888
+ "type": {
889
+ "kind": "NonNullType",
890
+ "type": {
891
+ "kind": "ListType",
892
+ "type": {
893
+ "kind": "NonNullType",
894
+ "type": {
895
+ "kind": "NamedType",
896
+ "name": {
897
+ "kind": "Name",
898
+ "value": "ID"
899
+ }
900
+ }
901
+ }
902
+ }
903
+ }
904
+ }],
905
+ "selectionSet": {
906
+ "kind": "SelectionSet",
907
+ "selections": [{
908
+ "kind": "Field",
909
+ "name": {
910
+ "kind": "Name",
911
+ "value": "assessmentForms"
912
+ },
913
+ "arguments": [{
914
+ "kind": "Argument",
915
+ "name": {
916
+ "kind": "Name",
917
+ "value": "first"
918
+ },
919
+ "value": {
920
+ "kind": "IntValue",
921
+ "value": "1"
922
+ }
923
+ }, {
924
+ "kind": "Argument",
925
+ "name": {
926
+ "kind": "Name",
927
+ "value": "filterBy"
928
+ },
929
+ "value": {
930
+ "kind": "ObjectValue",
931
+ "fields": [{
932
+ "kind": "ObjectField",
933
+ "name": {
934
+ "kind": "Name",
935
+ "value": "ids"
936
+ },
937
+ "value": {
938
+ "kind": "Variable",
939
+ "name": {
940
+ "kind": "Name",
941
+ "value": "ids"
942
+ }
943
+ }
944
+ }]
945
+ }
946
+ }],
947
+ "selectionSet": {
948
+ "kind": "SelectionSet",
949
+ "selections": [{
950
+ "kind": "Field",
951
+ "name": {
952
+ "kind": "Name",
953
+ "value": "nodes"
954
+ },
955
+ "selectionSet": {
956
+ "kind": "SelectionSet",
957
+ "selections": [
958
+ {
959
+ "kind": "Field",
960
+ "name": {
961
+ "kind": "Name",
962
+ "value": "id"
963
+ }
964
+ },
965
+ {
966
+ "kind": "Field",
967
+ "name": {
968
+ "kind": "Name",
969
+ "value": "title"
970
+ }
971
+ },
972
+ {
973
+ "kind": "Field",
974
+ "name": {
975
+ "kind": "Name",
976
+ "value": "status"
977
+ }
978
+ },
979
+ {
980
+ "kind": "Field",
981
+ "name": {
982
+ "kind": "Name",
983
+ "value": "dueDate"
984
+ }
985
+ },
986
+ {
987
+ "kind": "Field",
988
+ "name": {
989
+ "kind": "Name",
990
+ "value": "submittedAt"
991
+ }
992
+ },
993
+ {
994
+ "kind": "Field",
995
+ "name": {
996
+ "kind": "Name",
997
+ "value": "createdAt"
998
+ }
999
+ },
1000
+ {
1001
+ "kind": "Field",
1002
+ "name": {
1003
+ "kind": "Name",
1004
+ "value": "updatedAt"
1005
+ }
1006
+ },
1007
+ {
1008
+ "kind": "Field",
1009
+ "name": {
1010
+ "kind": "Name",
1011
+ "value": "assessmentGroup"
1012
+ },
1013
+ "selectionSet": {
1014
+ "kind": "SelectionSet",
1015
+ "selections": [{
1016
+ "kind": "Field",
1017
+ "name": {
1018
+ "kind": "Name",
1019
+ "value": "id"
1020
+ }
1021
+ }]
1022
+ }
1023
+ },
1024
+ {
1025
+ "kind": "Field",
1026
+ "name": {
1027
+ "kind": "Name",
1028
+ "value": "sections"
1029
+ },
1030
+ "selectionSet": {
1031
+ "kind": "SelectionSet",
1032
+ "selections": [
1033
+ {
1034
+ "kind": "Field",
1035
+ "name": {
1036
+ "kind": "Name",
1037
+ "value": "id"
1038
+ }
1039
+ },
1040
+ {
1041
+ "kind": "Field",
1042
+ "name": {
1043
+ "kind": "Name",
1044
+ "value": "title"
1045
+ }
1046
+ },
1047
+ {
1048
+ "kind": "Field",
1049
+ "name": {
1050
+ "kind": "Name",
1051
+ "value": "index"
1052
+ }
1053
+ },
1054
+ {
1055
+ "kind": "Field",
1056
+ "name": {
1057
+ "kind": "Name",
1058
+ "value": "status"
1059
+ }
1060
+ },
1061
+ {
1062
+ "kind": "Field",
1063
+ "name": {
1064
+ "kind": "Name",
1065
+ "value": "questions"
1066
+ },
1067
+ "selectionSet": {
1068
+ "kind": "SelectionSet",
1069
+ "selections": [
1070
+ {
1071
+ "kind": "Field",
1072
+ "name": {
1073
+ "kind": "Name",
1074
+ "value": "id"
1075
+ }
1076
+ },
1077
+ {
1078
+ "kind": "Field",
1079
+ "name": {
1080
+ "kind": "Name",
1081
+ "value": "title"
1082
+ }
1083
+ },
1084
+ {
1085
+ "kind": "Field",
1086
+ "name": {
1087
+ "kind": "Name",
1088
+ "value": "index"
1089
+ }
1090
+ },
1091
+ {
1092
+ "kind": "Field",
1093
+ "name": {
1094
+ "kind": "Name",
1095
+ "value": "type"
1096
+ }
1097
+ },
1098
+ {
1099
+ "kind": "Field",
1100
+ "name": {
1101
+ "kind": "Name",
1102
+ "value": "subType"
1103
+ }
1104
+ },
1105
+ {
1106
+ "kind": "Field",
1107
+ "name": {
1108
+ "kind": "Name",
1109
+ "value": "description"
1110
+ }
1111
+ },
1112
+ {
1113
+ "kind": "Field",
1114
+ "name": {
1115
+ "kind": "Name",
1116
+ "value": "isRequired"
1117
+ }
1118
+ },
1119
+ {
1120
+ "kind": "Field",
1121
+ "name": {
1122
+ "kind": "Name",
1123
+ "value": "placeholder"
1124
+ }
1125
+ },
1126
+ {
1127
+ "kind": "Field",
1128
+ "name": {
1129
+ "kind": "Name",
1130
+ "value": "answerOptions"
1131
+ },
1132
+ "selectionSet": {
1133
+ "kind": "SelectionSet",
1134
+ "selections": [
1135
+ {
1136
+ "kind": "Field",
1137
+ "name": {
1138
+ "kind": "Name",
1139
+ "value": "id"
1140
+ }
1141
+ },
1142
+ {
1143
+ "kind": "Field",
1144
+ "name": {
1145
+ "kind": "Name",
1146
+ "value": "index"
1147
+ }
1148
+ },
1149
+ {
1150
+ "kind": "Field",
1151
+ "name": {
1152
+ "kind": "Name",
1153
+ "value": "value"
1154
+ }
1155
+ }
1156
+ ]
1157
+ }
1158
+ },
1159
+ {
1160
+ "kind": "Field",
1161
+ "name": {
1162
+ "kind": "Name",
1163
+ "value": "selectedAnswers"
1164
+ },
1165
+ "selectionSet": {
1166
+ "kind": "SelectionSet",
1167
+ "selections": [
1168
+ {
1169
+ "kind": "Field",
1170
+ "name": {
1171
+ "kind": "Name",
1172
+ "value": "id"
1173
+ }
1174
+ },
1175
+ {
1176
+ "kind": "Field",
1177
+ "name": {
1178
+ "kind": "Name",
1179
+ "value": "index"
1180
+ }
1181
+ },
1182
+ {
1183
+ "kind": "Field",
1184
+ "name": {
1185
+ "kind": "Name",
1186
+ "value": "value"
1187
+ }
1188
+ }
1189
+ ]
1190
+ }
1191
+ }
1192
+ ]
1193
+ }
1194
+ }
1195
+ ]
1196
+ }
1197
+ }
1198
+ ]
1199
+ }
1200
+ }]
1201
+ }
1202
+ }]
1203
+ }
1204
+ }]
1205
+ },
1206
+ "\n mutation AssessmentsSelectAnswers($input: SelectAssessmentQuestionAnswerInput!) {\n selectAssessmentQuestionAnswers(input: $input) {\n selectedAnswers {\n id\n index\n value\n }\n }\n }\n": {
1207
+ "kind": "Document",
1208
+ "definitions": [{
1209
+ "kind": "OperationDefinition",
1210
+ "operation": "mutation",
1211
+ "name": {
1212
+ "kind": "Name",
1213
+ "value": "AssessmentsSelectAnswers"
1214
+ },
1215
+ "variableDefinitions": [{
1216
+ "kind": "VariableDefinition",
1217
+ "variable": {
1218
+ "kind": "Variable",
1219
+ "name": {
1220
+ "kind": "Name",
1221
+ "value": "input"
1222
+ }
1223
+ },
1224
+ "type": {
1225
+ "kind": "NonNullType",
1226
+ "type": {
1227
+ "kind": "NamedType",
1228
+ "name": {
1229
+ "kind": "Name",
1230
+ "value": "SelectAssessmentQuestionAnswerInput"
1231
+ }
1232
+ }
1233
+ }
1234
+ }],
1235
+ "selectionSet": {
1236
+ "kind": "SelectionSet",
1237
+ "selections": [{
1238
+ "kind": "Field",
1239
+ "name": {
1240
+ "kind": "Name",
1241
+ "value": "selectAssessmentQuestionAnswers"
1242
+ },
1243
+ "arguments": [{
1244
+ "kind": "Argument",
1245
+ "name": {
1246
+ "kind": "Name",
1247
+ "value": "input"
1248
+ },
1249
+ "value": {
1250
+ "kind": "Variable",
1251
+ "name": {
1252
+ "kind": "Name",
1253
+ "value": "input"
1254
+ }
1255
+ }
1256
+ }],
1257
+ "selectionSet": {
1258
+ "kind": "SelectionSet",
1259
+ "selections": [{
1260
+ "kind": "Field",
1261
+ "name": {
1262
+ "kind": "Name",
1263
+ "value": "selectedAnswers"
1264
+ },
1265
+ "selectionSet": {
1266
+ "kind": "SelectionSet",
1267
+ "selections": [
1268
+ {
1269
+ "kind": "Field",
1270
+ "name": {
1271
+ "kind": "Name",
1272
+ "value": "id"
1273
+ }
1274
+ },
1275
+ {
1276
+ "kind": "Field",
1277
+ "name": {
1278
+ "kind": "Name",
1279
+ "value": "index"
1280
+ }
1281
+ },
1282
+ {
1283
+ "kind": "Field",
1284
+ "name": {
1285
+ "kind": "Name",
1286
+ "value": "value"
1287
+ }
1288
+ }
1289
+ ]
1290
+ }
1291
+ }]
1292
+ }
1293
+ }]
1294
+ }
1295
+ }]
1296
+ },
1297
+ "\n mutation AssessmentsUpdateAssignees($input: UpdateAssessmentFormAssigneesInput!) {\n updateAssessmentFormAssignees(input: $input) {\n assessmentForm {\n id\n title\n status\n }\n }\n }\n": {
1298
+ "kind": "Document",
1299
+ "definitions": [{
1300
+ "kind": "OperationDefinition",
1301
+ "operation": "mutation",
1302
+ "name": {
1303
+ "kind": "Name",
1304
+ "value": "AssessmentsUpdateAssignees"
1305
+ },
1306
+ "variableDefinitions": [{
1307
+ "kind": "VariableDefinition",
1308
+ "variable": {
1309
+ "kind": "Variable",
1310
+ "name": {
1311
+ "kind": "Name",
1312
+ "value": "input"
1313
+ }
1314
+ },
1315
+ "type": {
1316
+ "kind": "NonNullType",
1317
+ "type": {
1318
+ "kind": "NamedType",
1319
+ "name": {
1320
+ "kind": "Name",
1321
+ "value": "UpdateAssessmentFormAssigneesInput"
1322
+ }
1323
+ }
1324
+ }
1325
+ }],
1326
+ "selectionSet": {
1327
+ "kind": "SelectionSet",
1328
+ "selections": [{
1329
+ "kind": "Field",
1330
+ "name": {
1331
+ "kind": "Name",
1332
+ "value": "updateAssessmentFormAssignees"
1333
+ },
1334
+ "arguments": [{
1335
+ "kind": "Argument",
1336
+ "name": {
1337
+ "kind": "Name",
1338
+ "value": "input"
1339
+ },
1340
+ "value": {
1341
+ "kind": "Variable",
1342
+ "name": {
1343
+ "kind": "Name",
1344
+ "value": "input"
1345
+ }
1346
+ }
1347
+ }],
1348
+ "selectionSet": {
1349
+ "kind": "SelectionSet",
1350
+ "selections": [{
1351
+ "kind": "Field",
1352
+ "name": {
1353
+ "kind": "Name",
1354
+ "value": "assessmentForm"
1355
+ },
1356
+ "selectionSet": {
1357
+ "kind": "SelectionSet",
1358
+ "selections": [
1359
+ {
1360
+ "kind": "Field",
1361
+ "name": {
1362
+ "kind": "Name",
1363
+ "value": "id"
1364
+ }
1365
+ },
1366
+ {
1367
+ "kind": "Field",
1368
+ "name": {
1369
+ "kind": "Name",
1370
+ "value": "title"
1371
+ }
1372
+ },
1373
+ {
1374
+ "kind": "Field",
1375
+ "name": {
1376
+ "kind": "Name",
1377
+ "value": "status"
1378
+ }
1379
+ }
1380
+ ]
1381
+ }
1382
+ }]
1383
+ }
1384
+ }]
1385
+ }
1386
+ }]
1387
+ },
1388
+ "\n query AssessmentsListGroups($first: Int) {\n assessmentGroups(first: $first) {\n nodes {\n id\n title\n assessmentFormTemplate {\n id\n title\n }\n }\n totalCount\n }\n }\n": {
1389
+ "kind": "Document",
1390
+ "definitions": [{
1391
+ "kind": "OperationDefinition",
1392
+ "operation": "query",
1393
+ "name": {
1394
+ "kind": "Name",
1395
+ "value": "AssessmentsListGroups"
1396
+ },
1397
+ "variableDefinitions": [{
1398
+ "kind": "VariableDefinition",
1399
+ "variable": {
1400
+ "kind": "Variable",
1401
+ "name": {
1402
+ "kind": "Name",
1403
+ "value": "first"
1404
+ }
1405
+ },
1406
+ "type": {
1407
+ "kind": "NamedType",
1408
+ "name": {
1409
+ "kind": "Name",
1410
+ "value": "Int"
1411
+ }
1412
+ }
1413
+ }],
1414
+ "selectionSet": {
1415
+ "kind": "SelectionSet",
1416
+ "selections": [{
1417
+ "kind": "Field",
1418
+ "name": {
1419
+ "kind": "Name",
1420
+ "value": "assessmentGroups"
1421
+ },
1422
+ "arguments": [{
1423
+ "kind": "Argument",
1424
+ "name": {
1425
+ "kind": "Name",
1426
+ "value": "first"
1427
+ },
1428
+ "value": {
1429
+ "kind": "Variable",
1430
+ "name": {
1431
+ "kind": "Name",
1432
+ "value": "first"
1433
+ }
1434
+ }
1435
+ }],
1436
+ "selectionSet": {
1437
+ "kind": "SelectionSet",
1438
+ "selections": [{
1439
+ "kind": "Field",
1440
+ "name": {
1441
+ "kind": "Name",
1442
+ "value": "nodes"
1443
+ },
1444
+ "selectionSet": {
1445
+ "kind": "SelectionSet",
1446
+ "selections": [
1447
+ {
1448
+ "kind": "Field",
1449
+ "name": {
1450
+ "kind": "Name",
1451
+ "value": "id"
1452
+ }
1453
+ },
1454
+ {
1455
+ "kind": "Field",
1456
+ "name": {
1457
+ "kind": "Name",
1458
+ "value": "title"
1459
+ }
1460
+ },
1461
+ {
1462
+ "kind": "Field",
1463
+ "name": {
1464
+ "kind": "Name",
1465
+ "value": "assessmentFormTemplate"
1466
+ },
1467
+ "selectionSet": {
1468
+ "kind": "SelectionSet",
1469
+ "selections": [{
1470
+ "kind": "Field",
1471
+ "name": {
1472
+ "kind": "Name",
1473
+ "value": "id"
1474
+ }
1475
+ }, {
1476
+ "kind": "Field",
1477
+ "name": {
1478
+ "kind": "Name",
1479
+ "value": "title"
1480
+ }
1481
+ }]
1482
+ }
1483
+ }
1484
+ ]
1485
+ }
1486
+ }, {
1487
+ "kind": "Field",
1488
+ "name": {
1489
+ "kind": "Name",
1490
+ "value": "totalCount"
1491
+ }
1492
+ }]
1493
+ }
1494
+ }]
1495
+ }
1496
+ }]
1497
+ },
1498
+ "\n mutation AssessmentsCreateGroup($input: CreateAssessmentGroupInput!) {\n createAssessmentGroup(input: $input) {\n assessmentGroup {\n id\n title\n }\n }\n }\n": {
1499
+ "kind": "Document",
1500
+ "definitions": [{
1501
+ "kind": "OperationDefinition",
1502
+ "operation": "mutation",
1503
+ "name": {
1504
+ "kind": "Name",
1505
+ "value": "AssessmentsCreateGroup"
1506
+ },
1507
+ "variableDefinitions": [{
1508
+ "kind": "VariableDefinition",
1509
+ "variable": {
1510
+ "kind": "Variable",
1511
+ "name": {
1512
+ "kind": "Name",
1513
+ "value": "input"
1514
+ }
1515
+ },
1516
+ "type": {
1517
+ "kind": "NonNullType",
1518
+ "type": {
1519
+ "kind": "NamedType",
1520
+ "name": {
1521
+ "kind": "Name",
1522
+ "value": "CreateAssessmentGroupInput"
1523
+ }
1524
+ }
1525
+ }
1526
+ }],
1527
+ "selectionSet": {
1528
+ "kind": "SelectionSet",
1529
+ "selections": [{
1530
+ "kind": "Field",
1531
+ "name": {
1532
+ "kind": "Name",
1533
+ "value": "createAssessmentGroup"
1534
+ },
1535
+ "arguments": [{
1536
+ "kind": "Argument",
1537
+ "name": {
1538
+ "kind": "Name",
1539
+ "value": "input"
1540
+ },
1541
+ "value": {
1542
+ "kind": "Variable",
1543
+ "name": {
1544
+ "kind": "Name",
1545
+ "value": "input"
1546
+ }
1547
+ }
1548
+ }],
1549
+ "selectionSet": {
1550
+ "kind": "SelectionSet",
1551
+ "selections": [{
1552
+ "kind": "Field",
1553
+ "name": {
1554
+ "kind": "Name",
1555
+ "value": "assessmentGroup"
1556
+ },
1557
+ "selectionSet": {
1558
+ "kind": "SelectionSet",
1559
+ "selections": [{
1560
+ "kind": "Field",
1561
+ "name": {
1562
+ "kind": "Name",
1563
+ "value": "id"
1564
+ }
1565
+ }, {
1566
+ "kind": "Field",
1567
+ "name": {
1568
+ "kind": "Name",
1569
+ "value": "title"
1570
+ }
1571
+ }]
1572
+ }
1573
+ }]
1574
+ }
1575
+ }]
1576
+ }
1577
+ }]
1578
+ },
1579
+ "\n mutation AssessmentsCreate($input: CreateAssessmentFormsInput!) {\n createAssessmentForms(input: $input) {\n assessmentForms {\n id\n title\n status\n createdAt\n }\n }\n }\n": {
1580
+ "kind": "Document",
1581
+ "definitions": [{
1582
+ "kind": "OperationDefinition",
1583
+ "operation": "mutation",
1584
+ "name": {
1585
+ "kind": "Name",
1586
+ "value": "AssessmentsCreate"
1587
+ },
1588
+ "variableDefinitions": [{
1589
+ "kind": "VariableDefinition",
1590
+ "variable": {
1591
+ "kind": "Variable",
1592
+ "name": {
1593
+ "kind": "Name",
1594
+ "value": "input"
1595
+ }
1596
+ },
1597
+ "type": {
1598
+ "kind": "NonNullType",
1599
+ "type": {
1600
+ "kind": "NamedType",
1601
+ "name": {
1602
+ "kind": "Name",
1603
+ "value": "CreateAssessmentFormsInput"
1604
+ }
1605
+ }
1606
+ }
1607
+ }],
1608
+ "selectionSet": {
1609
+ "kind": "SelectionSet",
1610
+ "selections": [{
1611
+ "kind": "Field",
1612
+ "name": {
1613
+ "kind": "Name",
1614
+ "value": "createAssessmentForms"
1615
+ },
1616
+ "arguments": [{
1617
+ "kind": "Argument",
1618
+ "name": {
1619
+ "kind": "Name",
1620
+ "value": "input"
1621
+ },
1622
+ "value": {
1623
+ "kind": "Variable",
1624
+ "name": {
1625
+ "kind": "Name",
1626
+ "value": "input"
1627
+ }
1628
+ }
1629
+ }],
1630
+ "selectionSet": {
1631
+ "kind": "SelectionSet",
1632
+ "selections": [{
1633
+ "kind": "Field",
1634
+ "name": {
1635
+ "kind": "Name",
1636
+ "value": "assessmentForms"
1637
+ },
1638
+ "selectionSet": {
1639
+ "kind": "SelectionSet",
1640
+ "selections": [
1641
+ {
1642
+ "kind": "Field",
1643
+ "name": {
1644
+ "kind": "Name",
1645
+ "value": "id"
1646
+ }
1647
+ },
1648
+ {
1649
+ "kind": "Field",
1650
+ "name": {
1651
+ "kind": "Name",
1652
+ "value": "title"
1653
+ }
1654
+ },
1655
+ {
1656
+ "kind": "Field",
1657
+ "name": {
1658
+ "kind": "Name",
1659
+ "value": "status"
1660
+ }
1661
+ },
1662
+ {
1663
+ "kind": "Field",
1664
+ "name": {
1665
+ "kind": "Name",
1666
+ "value": "createdAt"
1667
+ }
1668
+ }
1669
+ ]
1670
+ }
1671
+ }]
1672
+ }
1673
+ }]
1674
+ }
1675
+ }]
1676
+ },
1677
+ "\n mutation AssessmentsUpdate($input: UpdateAssessmentFormInput!) {\n updateAssessmentForm(input: $input) {\n assessmentForm {\n id\n title\n description\n status\n dueDate\n updatedAt\n assessmentGroup {\n id\n }\n }\n }\n }\n": {
1678
+ "kind": "Document",
1679
+ "definitions": [{
1680
+ "kind": "OperationDefinition",
1681
+ "operation": "mutation",
1682
+ "name": {
1683
+ "kind": "Name",
1684
+ "value": "AssessmentsUpdate"
1685
+ },
1686
+ "variableDefinitions": [{
1687
+ "kind": "VariableDefinition",
1688
+ "variable": {
1689
+ "kind": "Variable",
1690
+ "name": {
1691
+ "kind": "Name",
1692
+ "value": "input"
1693
+ }
1694
+ },
1695
+ "type": {
1696
+ "kind": "NonNullType",
1697
+ "type": {
1698
+ "kind": "NamedType",
1699
+ "name": {
1700
+ "kind": "Name",
1701
+ "value": "UpdateAssessmentFormInput"
1702
+ }
1703
+ }
1704
+ }
1705
+ }],
1706
+ "selectionSet": {
1707
+ "kind": "SelectionSet",
1708
+ "selections": [{
1709
+ "kind": "Field",
1710
+ "name": {
1711
+ "kind": "Name",
1712
+ "value": "updateAssessmentForm"
1713
+ },
1714
+ "arguments": [{
1715
+ "kind": "Argument",
1716
+ "name": {
1717
+ "kind": "Name",
1718
+ "value": "input"
1719
+ },
1720
+ "value": {
1721
+ "kind": "Variable",
1722
+ "name": {
1723
+ "kind": "Name",
1724
+ "value": "input"
1725
+ }
1726
+ }
1727
+ }],
1728
+ "selectionSet": {
1729
+ "kind": "SelectionSet",
1730
+ "selections": [{
1731
+ "kind": "Field",
1732
+ "name": {
1733
+ "kind": "Name",
1734
+ "value": "assessmentForm"
1735
+ },
1736
+ "selectionSet": {
1737
+ "kind": "SelectionSet",
1738
+ "selections": [
1739
+ {
1740
+ "kind": "Field",
1741
+ "name": {
1742
+ "kind": "Name",
1743
+ "value": "id"
1744
+ }
1745
+ },
1746
+ {
1747
+ "kind": "Field",
1748
+ "name": {
1749
+ "kind": "Name",
1750
+ "value": "title"
1751
+ }
1752
+ },
1753
+ {
1754
+ "kind": "Field",
1755
+ "name": {
1756
+ "kind": "Name",
1757
+ "value": "description"
1758
+ }
1759
+ },
1760
+ {
1761
+ "kind": "Field",
1762
+ "name": {
1763
+ "kind": "Name",
1764
+ "value": "status"
1765
+ }
1766
+ },
1767
+ {
1768
+ "kind": "Field",
1769
+ "name": {
1770
+ "kind": "Name",
1771
+ "value": "dueDate"
1772
+ }
1773
+ },
1774
+ {
1775
+ "kind": "Field",
1776
+ "name": {
1777
+ "kind": "Name",
1778
+ "value": "updatedAt"
1779
+ }
1780
+ },
1781
+ {
1782
+ "kind": "Field",
1783
+ "name": {
1784
+ "kind": "Name",
1785
+ "value": "assessmentGroup"
1786
+ },
1787
+ "selectionSet": {
1788
+ "kind": "SelectionSet",
1789
+ "selections": [{
1790
+ "kind": "Field",
1791
+ "name": {
1792
+ "kind": "Name",
1793
+ "value": "id"
1794
+ }
1795
+ }]
1796
+ }
1797
+ }
1798
+ ]
1799
+ }
1800
+ }]
1801
+ }
1802
+ }]
1803
+ }
1804
+ }]
1805
+ },
1806
+ "\n query AssessmentsListTemplates($first: Int) {\n assessmentFormTemplates(first: $first) {\n nodes {\n id\n title\n description\n }\n totalCount\n }\n }\n": {
1807
+ "kind": "Document",
1808
+ "definitions": [{
1809
+ "kind": "OperationDefinition",
1810
+ "operation": "query",
1811
+ "name": {
1812
+ "kind": "Name",
1813
+ "value": "AssessmentsListTemplates"
1814
+ },
1815
+ "variableDefinitions": [{
1816
+ "kind": "VariableDefinition",
1817
+ "variable": {
1818
+ "kind": "Variable",
1819
+ "name": {
1820
+ "kind": "Name",
1821
+ "value": "first"
1822
+ }
1823
+ },
1824
+ "type": {
1825
+ "kind": "NamedType",
1826
+ "name": {
1827
+ "kind": "Name",
1828
+ "value": "Int"
1829
+ }
1830
+ }
1831
+ }],
1832
+ "selectionSet": {
1833
+ "kind": "SelectionSet",
1834
+ "selections": [{
1835
+ "kind": "Field",
1836
+ "name": {
1837
+ "kind": "Name",
1838
+ "value": "assessmentFormTemplates"
1839
+ },
1840
+ "arguments": [{
1841
+ "kind": "Argument",
1842
+ "name": {
1843
+ "kind": "Name",
1844
+ "value": "first"
1845
+ },
1846
+ "value": {
1847
+ "kind": "Variable",
1848
+ "name": {
1849
+ "kind": "Name",
1850
+ "value": "first"
1851
+ }
1852
+ }
1853
+ }],
1854
+ "selectionSet": {
1855
+ "kind": "SelectionSet",
1856
+ "selections": [{
1857
+ "kind": "Field",
1858
+ "name": {
1859
+ "kind": "Name",
1860
+ "value": "nodes"
1861
+ },
1862
+ "selectionSet": {
1863
+ "kind": "SelectionSet",
1864
+ "selections": [
1865
+ {
1866
+ "kind": "Field",
1867
+ "name": {
1868
+ "kind": "Name",
1869
+ "value": "id"
1870
+ }
1871
+ },
1872
+ {
1873
+ "kind": "Field",
1874
+ "name": {
1875
+ "kind": "Name",
1876
+ "value": "title"
1877
+ }
1878
+ },
1879
+ {
1880
+ "kind": "Field",
1881
+ "name": {
1882
+ "kind": "Name",
1883
+ "value": "description"
1884
+ }
1885
+ }
1886
+ ]
1887
+ }
1888
+ }, {
1889
+ "kind": "Field",
1890
+ "name": {
1891
+ "kind": "Name",
1892
+ "value": "totalCount"
1893
+ }
1894
+ }]
1895
+ }
1896
+ }]
1897
+ }
1898
+ }]
1899
+ },
1900
+ "\n mutation AssessmentsSubmitForReview($input: SubmitAssessmentFormForReviewInput!) {\n submitAssessmentFormForReview(input: $input) {\n clientMutationId\n }\n }\n": {
1901
+ "kind": "Document",
1902
+ "definitions": [{
1903
+ "kind": "OperationDefinition",
1904
+ "operation": "mutation",
1905
+ "name": {
1906
+ "kind": "Name",
1907
+ "value": "AssessmentsSubmitForReview"
1908
+ },
1909
+ "variableDefinitions": [{
1910
+ "kind": "VariableDefinition",
1911
+ "variable": {
1912
+ "kind": "Variable",
1913
+ "name": {
1914
+ "kind": "Name",
1915
+ "value": "input"
1916
+ }
1917
+ },
1918
+ "type": {
1919
+ "kind": "NonNullType",
1920
+ "type": {
1921
+ "kind": "NamedType",
1922
+ "name": {
1923
+ "kind": "Name",
1924
+ "value": "SubmitAssessmentFormForReviewInput"
1925
+ }
1926
+ }
1927
+ }
1928
+ }],
1929
+ "selectionSet": {
1930
+ "kind": "SelectionSet",
1931
+ "selections": [{
1932
+ "kind": "Field",
1933
+ "name": {
1934
+ "kind": "Name",
1935
+ "value": "submitAssessmentFormForReview"
1936
+ },
1937
+ "arguments": [{
1938
+ "kind": "Argument",
1939
+ "name": {
1940
+ "kind": "Name",
1941
+ "value": "input"
1942
+ },
1943
+ "value": {
1944
+ "kind": "Variable",
1945
+ "name": {
1946
+ "kind": "Name",
1947
+ "value": "input"
1948
+ }
1949
+ }
1950
+ }],
1951
+ "selectionSet": {
1952
+ "kind": "SelectionSet",
1953
+ "selections": [{
1954
+ "kind": "Field",
1955
+ "name": {
1956
+ "kind": "Name",
1957
+ "value": "clientMutationId"
1958
+ }
1959
+ }]
1960
+ }
1961
+ }]
1962
+ }
1963
+ }]
1964
+ },
1965
+ "\n mutation AssessmentsCreateTemplate($input: CreateAssessmentFormTemplateInput!) {\n createAssessmentFormTemplate(input: $input) {\n assessmentFormTemplate {\n id\n title\n status\n sections {\n id\n title\n index\n questions {\n id\n title\n index\n type\n subType\n referenceId\n }\n }\n }\n }\n }\n": {
1966
+ "kind": "Document",
1967
+ "definitions": [{
1968
+ "kind": "OperationDefinition",
1969
+ "operation": "mutation",
1970
+ "name": {
1971
+ "kind": "Name",
1972
+ "value": "AssessmentsCreateTemplate"
1973
+ },
1974
+ "variableDefinitions": [{
1975
+ "kind": "VariableDefinition",
1976
+ "variable": {
1977
+ "kind": "Variable",
1978
+ "name": {
1979
+ "kind": "Name",
1980
+ "value": "input"
1981
+ }
1982
+ },
1983
+ "type": {
1984
+ "kind": "NonNullType",
1985
+ "type": {
1986
+ "kind": "NamedType",
1987
+ "name": {
1988
+ "kind": "Name",
1989
+ "value": "CreateAssessmentFormTemplateInput"
1990
+ }
1991
+ }
1992
+ }
1993
+ }],
1994
+ "selectionSet": {
1995
+ "kind": "SelectionSet",
1996
+ "selections": [{
1997
+ "kind": "Field",
1998
+ "name": {
1999
+ "kind": "Name",
2000
+ "value": "createAssessmentFormTemplate"
2001
+ },
2002
+ "arguments": [{
2003
+ "kind": "Argument",
2004
+ "name": {
2005
+ "kind": "Name",
2006
+ "value": "input"
2007
+ },
2008
+ "value": {
2009
+ "kind": "Variable",
2010
+ "name": {
2011
+ "kind": "Name",
2012
+ "value": "input"
2013
+ }
2014
+ }
2015
+ }],
2016
+ "selectionSet": {
2017
+ "kind": "SelectionSet",
2018
+ "selections": [{
2019
+ "kind": "Field",
2020
+ "name": {
2021
+ "kind": "Name",
2022
+ "value": "assessmentFormTemplate"
2023
+ },
2024
+ "selectionSet": {
2025
+ "kind": "SelectionSet",
2026
+ "selections": [
2027
+ {
2028
+ "kind": "Field",
2029
+ "name": {
2030
+ "kind": "Name",
2031
+ "value": "id"
2032
+ }
2033
+ },
2034
+ {
2035
+ "kind": "Field",
2036
+ "name": {
2037
+ "kind": "Name",
2038
+ "value": "title"
2039
+ }
2040
+ },
2041
+ {
2042
+ "kind": "Field",
2043
+ "name": {
2044
+ "kind": "Name",
2045
+ "value": "status"
2046
+ }
2047
+ },
2048
+ {
2049
+ "kind": "Field",
2050
+ "name": {
2051
+ "kind": "Name",
2052
+ "value": "sections"
2053
+ },
2054
+ "selectionSet": {
2055
+ "kind": "SelectionSet",
2056
+ "selections": [
2057
+ {
2058
+ "kind": "Field",
2059
+ "name": {
2060
+ "kind": "Name",
2061
+ "value": "id"
2062
+ }
2063
+ },
2064
+ {
2065
+ "kind": "Field",
2066
+ "name": {
2067
+ "kind": "Name",
2068
+ "value": "title"
2069
+ }
2070
+ },
2071
+ {
2072
+ "kind": "Field",
2073
+ "name": {
2074
+ "kind": "Name",
2075
+ "value": "index"
2076
+ }
2077
+ },
2078
+ {
2079
+ "kind": "Field",
2080
+ "name": {
2081
+ "kind": "Name",
2082
+ "value": "questions"
2083
+ },
2084
+ "selectionSet": {
2085
+ "kind": "SelectionSet",
2086
+ "selections": [
2087
+ {
2088
+ "kind": "Field",
2089
+ "name": {
2090
+ "kind": "Name",
2091
+ "value": "id"
2092
+ }
2093
+ },
2094
+ {
2095
+ "kind": "Field",
2096
+ "name": {
2097
+ "kind": "Name",
2098
+ "value": "title"
2099
+ }
2100
+ },
2101
+ {
2102
+ "kind": "Field",
2103
+ "name": {
2104
+ "kind": "Name",
2105
+ "value": "index"
2106
+ }
2107
+ },
2108
+ {
2109
+ "kind": "Field",
2110
+ "name": {
2111
+ "kind": "Name",
2112
+ "value": "type"
2113
+ }
2114
+ },
2115
+ {
2116
+ "kind": "Field",
2117
+ "name": {
2118
+ "kind": "Name",
2119
+ "value": "subType"
2120
+ }
2121
+ },
2122
+ {
2123
+ "kind": "Field",
2124
+ "name": {
2125
+ "kind": "Name",
2126
+ "value": "referenceId"
2127
+ }
2128
+ }
2129
+ ]
2130
+ }
2131
+ }
2132
+ ]
2133
+ }
2134
+ }
2135
+ ]
2136
+ }
2137
+ }]
2138
+ }
2139
+ }]
2140
+ }
2141
+ }]
2142
+ },
2143
+ "\n mutation AssessmentsCreateSection($input: CreateAssessmentSectionInput!) {\n createAssessmentSection(input: $input) {\n assessmentSection {\n id\n title\n index\n questions {\n id\n title\n index\n type\n subType\n referenceId\n }\n }\n }\n }\n": {
2144
+ "kind": "Document",
2145
+ "definitions": [{
2146
+ "kind": "OperationDefinition",
2147
+ "operation": "mutation",
2148
+ "name": {
2149
+ "kind": "Name",
2150
+ "value": "AssessmentsCreateSection"
2151
+ },
2152
+ "variableDefinitions": [{
2153
+ "kind": "VariableDefinition",
2154
+ "variable": {
2155
+ "kind": "Variable",
2156
+ "name": {
2157
+ "kind": "Name",
2158
+ "value": "input"
2159
+ }
2160
+ },
2161
+ "type": {
2162
+ "kind": "NonNullType",
2163
+ "type": {
2164
+ "kind": "NamedType",
2165
+ "name": {
2166
+ "kind": "Name",
2167
+ "value": "CreateAssessmentSectionInput"
2168
+ }
2169
+ }
2170
+ }
2171
+ }],
2172
+ "selectionSet": {
2173
+ "kind": "SelectionSet",
2174
+ "selections": [{
2175
+ "kind": "Field",
2176
+ "name": {
2177
+ "kind": "Name",
2178
+ "value": "createAssessmentSection"
2179
+ },
2180
+ "arguments": [{
2181
+ "kind": "Argument",
2182
+ "name": {
2183
+ "kind": "Name",
2184
+ "value": "input"
2185
+ },
2186
+ "value": {
2187
+ "kind": "Variable",
2188
+ "name": {
2189
+ "kind": "Name",
2190
+ "value": "input"
2191
+ }
2192
+ }
2193
+ }],
2194
+ "selectionSet": {
2195
+ "kind": "SelectionSet",
2196
+ "selections": [{
2197
+ "kind": "Field",
2198
+ "name": {
2199
+ "kind": "Name",
2200
+ "value": "assessmentSection"
2201
+ },
2202
+ "selectionSet": {
2203
+ "kind": "SelectionSet",
2204
+ "selections": [
2205
+ {
2206
+ "kind": "Field",
2207
+ "name": {
2208
+ "kind": "Name",
2209
+ "value": "id"
2210
+ }
2211
+ },
2212
+ {
2213
+ "kind": "Field",
2214
+ "name": {
2215
+ "kind": "Name",
2216
+ "value": "title"
2217
+ }
2218
+ },
2219
+ {
2220
+ "kind": "Field",
2221
+ "name": {
2222
+ "kind": "Name",
2223
+ "value": "index"
2224
+ }
2225
+ },
2226
+ {
2227
+ "kind": "Field",
2228
+ "name": {
2229
+ "kind": "Name",
2230
+ "value": "questions"
2231
+ },
2232
+ "selectionSet": {
2233
+ "kind": "SelectionSet",
2234
+ "selections": [
2235
+ {
2236
+ "kind": "Field",
2237
+ "name": {
2238
+ "kind": "Name",
2239
+ "value": "id"
2240
+ }
2241
+ },
2242
+ {
2243
+ "kind": "Field",
2244
+ "name": {
2245
+ "kind": "Name",
2246
+ "value": "title"
2247
+ }
2248
+ },
2249
+ {
2250
+ "kind": "Field",
2251
+ "name": {
2252
+ "kind": "Name",
2253
+ "value": "index"
2254
+ }
2255
+ },
2256
+ {
2257
+ "kind": "Field",
2258
+ "name": {
2259
+ "kind": "Name",
2260
+ "value": "type"
2261
+ }
2262
+ },
2263
+ {
2264
+ "kind": "Field",
2265
+ "name": {
2266
+ "kind": "Name",
2267
+ "value": "subType"
2268
+ }
2269
+ },
2270
+ {
2271
+ "kind": "Field",
2272
+ "name": {
2273
+ "kind": "Name",
2274
+ "value": "referenceId"
2275
+ }
2276
+ }
2277
+ ]
2278
+ }
2279
+ }
2280
+ ]
2281
+ }
2282
+ }]
2283
+ }
2284
+ }]
2285
+ }
2286
+ }]
2287
+ },
2288
+ "\n mutation AssessmentsCreateQuestions($input: [CreateAssessmentQuestionInput!]!) {\n createAssessmentQuestions(input: $input) {\n assessmentQuestions {\n id\n title\n index\n type\n subType\n referenceId\n }\n }\n }\n": {
2289
+ "kind": "Document",
2290
+ "definitions": [{
2291
+ "kind": "OperationDefinition",
2292
+ "operation": "mutation",
2293
+ "name": {
2294
+ "kind": "Name",
2295
+ "value": "AssessmentsCreateQuestions"
2296
+ },
2297
+ "variableDefinitions": [{
2298
+ "kind": "VariableDefinition",
2299
+ "variable": {
2300
+ "kind": "Variable",
2301
+ "name": {
2302
+ "kind": "Name",
2303
+ "value": "input"
2304
+ }
2305
+ },
2306
+ "type": {
2307
+ "kind": "NonNullType",
2308
+ "type": {
2309
+ "kind": "ListType",
2310
+ "type": {
2311
+ "kind": "NonNullType",
2312
+ "type": {
2313
+ "kind": "NamedType",
2314
+ "name": {
2315
+ "kind": "Name",
2316
+ "value": "CreateAssessmentQuestionInput"
2317
+ }
2318
+ }
2319
+ }
2320
+ }
2321
+ }
2322
+ }],
2323
+ "selectionSet": {
2324
+ "kind": "SelectionSet",
2325
+ "selections": [{
2326
+ "kind": "Field",
2327
+ "name": {
2328
+ "kind": "Name",
2329
+ "value": "createAssessmentQuestions"
2330
+ },
2331
+ "arguments": [{
2332
+ "kind": "Argument",
2333
+ "name": {
2334
+ "kind": "Name",
2335
+ "value": "input"
2336
+ },
2337
+ "value": {
2338
+ "kind": "Variable",
2339
+ "name": {
2340
+ "kind": "Name",
2341
+ "value": "input"
2342
+ }
2343
+ }
2344
+ }],
2345
+ "selectionSet": {
2346
+ "kind": "SelectionSet",
2347
+ "selections": [{
2348
+ "kind": "Field",
2349
+ "name": {
2350
+ "kind": "Name",
2351
+ "value": "assessmentQuestions"
2352
+ },
2353
+ "selectionSet": {
2354
+ "kind": "SelectionSet",
2355
+ "selections": [
2356
+ {
2357
+ "kind": "Field",
2358
+ "name": {
2359
+ "kind": "Name",
2360
+ "value": "id"
2361
+ }
2362
+ },
2363
+ {
2364
+ "kind": "Field",
2365
+ "name": {
2366
+ "kind": "Name",
2367
+ "value": "title"
2368
+ }
2369
+ },
2370
+ {
2371
+ "kind": "Field",
2372
+ "name": {
2373
+ "kind": "Name",
2374
+ "value": "index"
2375
+ }
2376
+ },
2377
+ {
2378
+ "kind": "Field",
2379
+ "name": {
2380
+ "kind": "Name",
2381
+ "value": "type"
2382
+ }
2383
+ },
2384
+ {
2385
+ "kind": "Field",
2386
+ "name": {
2387
+ "kind": "Name",
2388
+ "value": "subType"
2389
+ }
2390
+ },
2391
+ {
2392
+ "kind": "Field",
2393
+ "name": {
2394
+ "kind": "Name",
2395
+ "value": "referenceId"
2396
+ }
2397
+ }
2398
+ ]
2399
+ }
2400
+ }]
2401
+ }
2402
+ }]
2403
+ }
2404
+ }]
2405
+ },
2406
+ "\n query AssessmentsGetTemplate($ids: [ID!]) {\n assessmentFormTemplates(first: 1, filterBy: { ids: $ids }) {\n nodes {\n id\n title\n description\n status\n source\n createdAt\n updatedAt\n sections {\n id\n title\n index\n questions {\n id\n title\n index\n type\n subType\n description\n placeholder\n isRequired\n referenceId\n allowSelectOther\n requireRiskEvaluation\n answerOptions {\n id\n index\n value\n }\n }\n }\n }\n }\n }\n": {
2407
+ "kind": "Document",
2408
+ "definitions": [{
2409
+ "kind": "OperationDefinition",
2410
+ "operation": "query",
2411
+ "name": {
2412
+ "kind": "Name",
2413
+ "value": "AssessmentsGetTemplate"
2414
+ },
2415
+ "variableDefinitions": [{
2416
+ "kind": "VariableDefinition",
2417
+ "variable": {
2418
+ "kind": "Variable",
2419
+ "name": {
2420
+ "kind": "Name",
2421
+ "value": "ids"
2422
+ }
2423
+ },
2424
+ "type": {
2425
+ "kind": "ListType",
2426
+ "type": {
2427
+ "kind": "NonNullType",
2428
+ "type": {
2429
+ "kind": "NamedType",
2430
+ "name": {
2431
+ "kind": "Name",
2432
+ "value": "ID"
2433
+ }
2434
+ }
2435
+ }
2436
+ }
2437
+ }],
2438
+ "selectionSet": {
2439
+ "kind": "SelectionSet",
2440
+ "selections": [{
2441
+ "kind": "Field",
2442
+ "name": {
2443
+ "kind": "Name",
2444
+ "value": "assessmentFormTemplates"
2445
+ },
2446
+ "arguments": [{
2447
+ "kind": "Argument",
2448
+ "name": {
2449
+ "kind": "Name",
2450
+ "value": "first"
2451
+ },
2452
+ "value": {
2453
+ "kind": "IntValue",
2454
+ "value": "1"
2455
+ }
2456
+ }, {
2457
+ "kind": "Argument",
2458
+ "name": {
2459
+ "kind": "Name",
2460
+ "value": "filterBy"
2461
+ },
2462
+ "value": {
2463
+ "kind": "ObjectValue",
2464
+ "fields": [{
2465
+ "kind": "ObjectField",
2466
+ "name": {
2467
+ "kind": "Name",
2468
+ "value": "ids"
2469
+ },
2470
+ "value": {
2471
+ "kind": "Variable",
2472
+ "name": {
2473
+ "kind": "Name",
2474
+ "value": "ids"
2475
+ }
2476
+ }
2477
+ }]
2478
+ }
2479
+ }],
2480
+ "selectionSet": {
2481
+ "kind": "SelectionSet",
2482
+ "selections": [{
2483
+ "kind": "Field",
2484
+ "name": {
2485
+ "kind": "Name",
2486
+ "value": "nodes"
2487
+ },
2488
+ "selectionSet": {
2489
+ "kind": "SelectionSet",
2490
+ "selections": [
2491
+ {
2492
+ "kind": "Field",
2493
+ "name": {
2494
+ "kind": "Name",
2495
+ "value": "id"
2496
+ }
2497
+ },
2498
+ {
2499
+ "kind": "Field",
2500
+ "name": {
2501
+ "kind": "Name",
2502
+ "value": "title"
2503
+ }
2504
+ },
2505
+ {
2506
+ "kind": "Field",
2507
+ "name": {
2508
+ "kind": "Name",
2509
+ "value": "description"
2510
+ }
2511
+ },
2512
+ {
2513
+ "kind": "Field",
2514
+ "name": {
2515
+ "kind": "Name",
2516
+ "value": "status"
2517
+ }
2518
+ },
2519
+ {
2520
+ "kind": "Field",
2521
+ "name": {
2522
+ "kind": "Name",
2523
+ "value": "source"
2524
+ }
2525
+ },
2526
+ {
2527
+ "kind": "Field",
2528
+ "name": {
2529
+ "kind": "Name",
2530
+ "value": "createdAt"
2531
+ }
2532
+ },
2533
+ {
2534
+ "kind": "Field",
2535
+ "name": {
2536
+ "kind": "Name",
2537
+ "value": "updatedAt"
2538
+ }
2539
+ },
2540
+ {
2541
+ "kind": "Field",
2542
+ "name": {
2543
+ "kind": "Name",
2544
+ "value": "sections"
2545
+ },
2546
+ "selectionSet": {
2547
+ "kind": "SelectionSet",
2548
+ "selections": [
2549
+ {
2550
+ "kind": "Field",
2551
+ "name": {
2552
+ "kind": "Name",
2553
+ "value": "id"
2554
+ }
2555
+ },
2556
+ {
2557
+ "kind": "Field",
2558
+ "name": {
2559
+ "kind": "Name",
2560
+ "value": "title"
2561
+ }
2562
+ },
2563
+ {
2564
+ "kind": "Field",
2565
+ "name": {
2566
+ "kind": "Name",
2567
+ "value": "index"
2568
+ }
2569
+ },
2570
+ {
2571
+ "kind": "Field",
2572
+ "name": {
2573
+ "kind": "Name",
2574
+ "value": "questions"
2575
+ },
2576
+ "selectionSet": {
2577
+ "kind": "SelectionSet",
2578
+ "selections": [
2579
+ {
2580
+ "kind": "Field",
2581
+ "name": {
2582
+ "kind": "Name",
2583
+ "value": "id"
2584
+ }
2585
+ },
2586
+ {
2587
+ "kind": "Field",
2588
+ "name": {
2589
+ "kind": "Name",
2590
+ "value": "title"
2591
+ }
2592
+ },
2593
+ {
2594
+ "kind": "Field",
2595
+ "name": {
2596
+ "kind": "Name",
2597
+ "value": "index"
2598
+ }
2599
+ },
2600
+ {
2601
+ "kind": "Field",
2602
+ "name": {
2603
+ "kind": "Name",
2604
+ "value": "type"
2605
+ }
2606
+ },
2607
+ {
2608
+ "kind": "Field",
2609
+ "name": {
2610
+ "kind": "Name",
2611
+ "value": "subType"
2612
+ }
2613
+ },
2614
+ {
2615
+ "kind": "Field",
2616
+ "name": {
2617
+ "kind": "Name",
2618
+ "value": "description"
2619
+ }
2620
+ },
2621
+ {
2622
+ "kind": "Field",
2623
+ "name": {
2624
+ "kind": "Name",
2625
+ "value": "placeholder"
2626
+ }
2627
+ },
2628
+ {
2629
+ "kind": "Field",
2630
+ "name": {
2631
+ "kind": "Name",
2632
+ "value": "isRequired"
2633
+ }
2634
+ },
2635
+ {
2636
+ "kind": "Field",
2637
+ "name": {
2638
+ "kind": "Name",
2639
+ "value": "referenceId"
2640
+ }
2641
+ },
2642
+ {
2643
+ "kind": "Field",
2644
+ "name": {
2645
+ "kind": "Name",
2646
+ "value": "allowSelectOther"
2647
+ }
2648
+ },
2649
+ {
2650
+ "kind": "Field",
2651
+ "name": {
2652
+ "kind": "Name",
2653
+ "value": "requireRiskEvaluation"
2654
+ }
2655
+ },
2656
+ {
2657
+ "kind": "Field",
2658
+ "name": {
2659
+ "kind": "Name",
2660
+ "value": "answerOptions"
2661
+ },
2662
+ "selectionSet": {
2663
+ "kind": "SelectionSet",
2664
+ "selections": [
2665
+ {
2666
+ "kind": "Field",
2667
+ "name": {
2668
+ "kind": "Name",
2669
+ "value": "id"
2670
+ }
2671
+ },
2672
+ {
2673
+ "kind": "Field",
2674
+ "name": {
2675
+ "kind": "Name",
2676
+ "value": "index"
2677
+ }
2678
+ },
2679
+ {
2680
+ "kind": "Field",
2681
+ "name": {
2682
+ "kind": "Name",
2683
+ "value": "value"
2684
+ }
2685
+ }
2686
+ ]
2687
+ }
2688
+ }
2689
+ ]
2690
+ }
2691
+ }
2692
+ ]
2693
+ }
2694
+ }
2695
+ ]
2696
+ }
2697
+ }]
2698
+ }
2699
+ }]
2700
+ }
2701
+ }]
2702
+ }
2703
+ };
2704
+ function graphql(source) {
2705
+ return documents[source] ?? {};
2706
+ }
2707
+ //#endregion
2708
+ //#region src/graphql.ts
2709
+ const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
2710
+ function generateUUID() {
2711
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
2712
+ const r = Math.random() * 16 | 0;
2713
+ return (c === "x" ? r : r & 3 | 8).toString(16);
2714
+ });
2715
+ }
2716
+ function normalizeQuestion(q) {
2717
+ let { referenceId, subType, allowSelectOther, requireRiskEvaluation } = q;
2718
+ if (!referenceId || !UUID_RE.test(referenceId)) referenceId = generateUUID();
2719
+ if (allowSelectOther && (!subType || subType === "NONE")) subType = "CUSTOM";
2720
+ if (requireRiskEvaluation && !q.riskFrameworkId) requireRiskEvaluation = false;
2721
+ return {
2722
+ title: q.title,
2723
+ type: q.type,
2724
+ subType: subType || "NONE",
2725
+ placeholder: q.placeholder || "",
2726
+ description: q.description || "",
2727
+ isRequired: q.isRequired ?? false,
2728
+ referenceId,
2729
+ answerOptions: q.answerOptions || [],
2730
+ allowSelectOther: allowSelectOther ?? false,
2731
+ requireRiskEvaluation: requireRiskEvaluation ?? false,
2732
+ ...q.riskLogic && { riskLogic: q.riskLogic },
2733
+ ...q.riskCategoryIds && { riskCategoryIds: q.riskCategoryIds },
2734
+ ...q.riskFrameworkId && { riskFrameworkId: q.riskFrameworkId },
2735
+ ...q.displayLogic && { displayLogic: q.displayLogic }
2736
+ };
2737
+ }
2738
+ const ListAssessmentsDoc = graphql(`
2739
+ query AssessmentsList($first: Int, $filterBy: AssessmentFormFiltersInput) {
2740
+ assessmentForms(first: $first, filterBy: $filterBy) {
2741
+ nodes {
2742
+ id
2743
+ title
2744
+ status
2745
+ createdAt
2746
+ assessmentGroup {
2747
+ id
2748
+ }
2749
+ }
2750
+ totalCount
2751
+ }
2752
+ }
2753
+ `);
2754
+ const GetAssessmentDoc = graphql(`
2755
+ query AssessmentsGet($ids: [ID!]!) {
2756
+ assessmentForms(first: 1, filterBy: { ids: $ids }) {
2757
+ nodes {
2758
+ id
2759
+ title
2760
+ status
2761
+ dueDate
2762
+ submittedAt
2763
+ createdAt
2764
+ updatedAt
2765
+ assessmentGroup {
2766
+ id
2767
+ }
2768
+ sections {
2769
+ id
2770
+ title
2771
+ index
2772
+ status
2773
+ questions {
2774
+ id
2775
+ title
2776
+ index
2777
+ type
2778
+ subType
2779
+ description
2780
+ isRequired
2781
+ placeholder
2782
+ answerOptions {
2783
+ id
2784
+ index
2785
+ value
2786
+ }
2787
+ selectedAnswers {
2788
+ id
2789
+ index
2790
+ value
2791
+ }
2792
+ }
2793
+ }
2794
+ }
2795
+ }
2796
+ }
2797
+ `);
2798
+ const SelectAssessmentQuestionAnswersDoc = graphql(`
2799
+ mutation AssessmentsSelectAnswers($input: SelectAssessmentQuestionAnswerInput!) {
2800
+ selectAssessmentQuestionAnswers(input: $input) {
2801
+ selectedAnswers {
2802
+ id
2803
+ index
2804
+ value
2805
+ }
2806
+ }
2807
+ }
2808
+ `);
2809
+ const UpdateAssessmentFormAssigneesDoc = graphql(`
2810
+ mutation AssessmentsUpdateAssignees($input: UpdateAssessmentFormAssigneesInput!) {
2811
+ updateAssessmentFormAssignees(input: $input) {
2812
+ assessmentForm {
2813
+ id
2814
+ title
2815
+ status
2816
+ }
2817
+ }
2818
+ }
2819
+ `);
2820
+ const ListAssessmentGroupsDoc = graphql(`
2821
+ query AssessmentsListGroups($first: Int) {
2822
+ assessmentGroups(first: $first) {
2823
+ nodes {
2824
+ id
2825
+ title
2826
+ assessmentFormTemplate {
2827
+ id
2828
+ title
2829
+ }
2830
+ }
2831
+ totalCount
2832
+ }
2833
+ }
2834
+ `);
2835
+ const CreateAssessmentGroupDoc = graphql(`
2836
+ mutation AssessmentsCreateGroup($input: CreateAssessmentGroupInput!) {
2837
+ createAssessmentGroup(input: $input) {
2838
+ assessmentGroup {
2839
+ id
2840
+ title
2841
+ }
2842
+ }
2843
+ }
2844
+ `);
2845
+ const CreateAssessmentFormsDoc = graphql(`
2846
+ mutation AssessmentsCreate($input: CreateAssessmentFormsInput!) {
2847
+ createAssessmentForms(input: $input) {
2848
+ assessmentForms {
2849
+ id
2850
+ title
2851
+ status
2852
+ createdAt
2853
+ }
2854
+ }
2855
+ }
2856
+ `);
2857
+ const UpdateAssessmentFormDoc = graphql(`
2858
+ mutation AssessmentsUpdate($input: UpdateAssessmentFormInput!) {
2859
+ updateAssessmentForm(input: $input) {
2860
+ assessmentForm {
2861
+ id
2862
+ title
2863
+ description
2864
+ status
2865
+ dueDate
2866
+ updatedAt
2867
+ assessmentGroup {
2868
+ id
2869
+ }
2870
+ }
2871
+ }
2872
+ }
2873
+ `);
2874
+ const ListAssessmentTemplatesDoc = graphql(`
2875
+ query AssessmentsListTemplates($first: Int) {
2876
+ assessmentFormTemplates(first: $first) {
2877
+ nodes {
2878
+ id
2879
+ title
2880
+ description
2881
+ }
2882
+ totalCount
2883
+ }
2884
+ }
2885
+ `);
2886
+ const SubmitAssessmentForReviewDoc = graphql(`
2887
+ mutation AssessmentsSubmitForReview($input: SubmitAssessmentFormForReviewInput!) {
2888
+ submitAssessmentFormForReview(input: $input) {
2889
+ clientMutationId
2890
+ }
2891
+ }
2892
+ `);
2893
+ const CreateAssessmentFormTemplateDoc = graphql(`
2894
+ mutation AssessmentsCreateTemplate($input: CreateAssessmentFormTemplateInput!) {
2895
+ createAssessmentFormTemplate(input: $input) {
2896
+ assessmentFormTemplate {
2897
+ id
2898
+ title
2899
+ status
2900
+ sections {
2901
+ id
2902
+ title
2903
+ index
2904
+ questions {
2905
+ id
2906
+ title
2907
+ index
2908
+ type
2909
+ subType
2910
+ referenceId
2911
+ }
2912
+ }
2913
+ }
2914
+ }
2915
+ }
2916
+ `);
2917
+ const CreateAssessmentSectionDoc = graphql(`
2918
+ mutation AssessmentsCreateSection($input: CreateAssessmentSectionInput!) {
2919
+ createAssessmentSection(input: $input) {
2920
+ assessmentSection {
2921
+ id
2922
+ title
2923
+ index
2924
+ questions {
2925
+ id
2926
+ title
2927
+ index
2928
+ type
2929
+ subType
2930
+ referenceId
2931
+ }
2932
+ }
2933
+ }
2934
+ }
2935
+ `);
2936
+ const CreateAssessmentQuestionsDoc = graphql(`
2937
+ mutation AssessmentsCreateQuestions($input: [CreateAssessmentQuestionInput!]!) {
2938
+ createAssessmentQuestions(input: $input) {
2939
+ assessmentQuestions {
2940
+ id
2941
+ title
2942
+ index
2943
+ type
2944
+ subType
2945
+ referenceId
2946
+ }
2947
+ }
2948
+ }
2949
+ `);
2950
+ const GetAssessmentFormTemplateDoc = graphql(`
2951
+ query AssessmentsGetTemplate($ids: [ID!]) {
2952
+ assessmentFormTemplates(first: 1, filterBy: { ids: $ids }) {
2953
+ nodes {
2954
+ id
2955
+ title
2956
+ description
2957
+ status
2958
+ source
2959
+ createdAt
2960
+ updatedAt
2961
+ sections {
2962
+ id
2963
+ title
2964
+ index
2965
+ questions {
2966
+ id
2967
+ title
2968
+ index
2969
+ type
2970
+ subType
2971
+ description
2972
+ placeholder
2973
+ isRequired
2974
+ referenceId
2975
+ allowSelectOther
2976
+ requireRiskEvaluation
2977
+ answerOptions {
2978
+ id
2979
+ index
2980
+ value
2981
+ }
2982
+ }
2983
+ }
2984
+ }
2985
+ }
2986
+ }
2987
+ `);
2988
+ var AssessmentsMixin = class extends TranscendGraphQLBase {
2989
+ async listAssessments(options) {
2990
+ const data = await this.makeRequest(ListAssessmentsDoc, {
2991
+ first: Math.min(options?.first ?? 50, 100),
2992
+ filterBy: options?.filterBy?.statuses ? { statuses: options.filterBy.statuses } : null
2993
+ });
2994
+ return {
2995
+ nodes: data.assessmentForms.nodes.map((node) => ({
2996
+ id: node.id,
2997
+ title: node.title,
2998
+ status: node.status,
2999
+ createdAt: node.createdAt,
3000
+ assessmentGroupId: node.assessmentGroup?.id
3001
+ })),
3002
+ pageInfo: {
3003
+ hasNextPage: data.assessmentForms.nodes.length < data.assessmentForms.totalCount,
3004
+ hasPreviousPage: false
3005
+ },
3006
+ totalCount: data.assessmentForms.totalCount
3007
+ };
3008
+ }
3009
+ async getAssessment(id) {
3010
+ const node = (await this.makeRequest(GetAssessmentDoc, { ids: [id] })).assessmentForms.nodes[0];
3011
+ if (!node) throw new Error(`Assessment with id ${id} not found`);
3012
+ return {
3013
+ id: node.id,
3014
+ title: node.title,
3015
+ status: node.status,
3016
+ dueDate: node.dueDate ?? void 0,
3017
+ submittedAt: node.submittedAt ?? void 0,
3018
+ createdAt: node.createdAt,
3019
+ updatedAt: node.updatedAt ?? void 0,
3020
+ assessmentGroupId: node.assessmentGroup?.id,
3021
+ sections: node.sections?.map((section) => ({
3022
+ id: section.id,
3023
+ title: section.title ?? void 0,
3024
+ index: section.index ?? void 0,
3025
+ status: section.status ?? void 0,
3026
+ questions: section.questions?.map((q) => ({
3027
+ id: q.id,
3028
+ title: q.title ?? void 0,
3029
+ index: q.index ?? void 0,
3030
+ type: q.type,
3031
+ subType: q.subType ?? void 0,
3032
+ description: q.description ?? void 0,
3033
+ isRequired: q.isRequired ?? void 0,
3034
+ placeholder: q.placeholder ?? void 0,
3035
+ answerOptions: q.answerOptions?.map((a) => ({
3036
+ id: a.id,
3037
+ index: a.index,
3038
+ value: a.value
3039
+ })),
3040
+ selectedAnswers: q.selectedAnswers?.map((a) => ({
3041
+ id: a.id,
3042
+ index: a.index,
3043
+ value: a.value
3044
+ }))
3045
+ }))
3046
+ }))
3047
+ };
3048
+ }
3049
+ async selectAssessmentQuestionAnswers(input) {
3050
+ return (await this.makeRequest(SelectAssessmentQuestionAnswersDoc, { input })).selectAssessmentQuestionAnswers.selectedAnswers;
3051
+ }
3052
+ async updateAssessmentFormAssignees(input) {
3053
+ return (await this.makeRequest(UpdateAssessmentFormAssigneesDoc, { input })).updateAssessmentFormAssignees.assessmentForm;
3054
+ }
3055
+ async listAssessmentGroups(options) {
3056
+ const data = await this.makeRequest(ListAssessmentGroupsDoc, { first: Math.min(options?.first ?? 50, 100) });
3057
+ return {
3058
+ nodes: data.assessmentGroups.nodes.map((node) => ({
3059
+ id: node.id,
3060
+ title: node.title,
3061
+ assessmentFormTemplate: node.assessmentFormTemplate ? {
3062
+ id: node.assessmentFormTemplate.id,
3063
+ title: node.assessmentFormTemplate.title
3064
+ } : void 0
3065
+ })),
3066
+ pageInfo: {
3067
+ hasNextPage: data.assessmentGroups.nodes.length < data.assessmentGroups.totalCount,
3068
+ hasPreviousPage: false
3069
+ },
3070
+ totalCount: data.assessmentGroups.totalCount
3071
+ };
3072
+ }
3073
+ async createAssessmentGroup(input) {
3074
+ return (await this.makeRequest(CreateAssessmentGroupDoc, { input })).createAssessmentGroup.assessmentGroup;
3075
+ }
3076
+ async createAssessment(input) {
3077
+ const batchInput = { assessmentForms: [{
3078
+ title: input.title,
3079
+ assessmentGroupId: input.assessmentGroupId,
3080
+ ...input.assigneeIds && { assigneeIds: input.assigneeIds }
3081
+ }] };
3082
+ const created = (await this.makeRequest(CreateAssessmentFormsDoc, { input: batchInput })).createAssessmentForms.assessmentForms[0];
3083
+ if (!created) throw new Error("createAssessmentForms returned an empty array");
3084
+ return {
3085
+ id: created.id,
3086
+ title: created.title,
3087
+ status: created.status,
3088
+ createdAt: created.createdAt,
3089
+ assessmentGroupId: input.assessmentGroupId
3090
+ };
3091
+ }
3092
+ async updateAssessment(input) {
3093
+ const form = (await this.makeRequest(UpdateAssessmentFormDoc, { input })).updateAssessmentForm.assessmentForm;
3094
+ return {
3095
+ id: form.id,
3096
+ title: form.title,
3097
+ description: form.description ?? void 0,
3098
+ status: form.status,
3099
+ dueDate: form.dueDate ?? void 0,
3100
+ updatedAt: form.updatedAt ?? void 0,
3101
+ createdAt: "",
3102
+ assessmentGroupId: form.assessmentGroup?.id
3103
+ };
3104
+ }
3105
+ async listAssessmentTemplates(options) {
3106
+ const data = await this.makeRequest(ListAssessmentTemplatesDoc, { first: Math.min(options?.first ?? 50, 100) });
3107
+ return {
3108
+ nodes: data.assessmentFormTemplates.nodes.map((t) => ({
3109
+ id: t.id,
3110
+ title: t.title,
3111
+ description: t.description ?? void 0,
3112
+ version: "1.0.0",
3113
+ isActive: true,
3114
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
3115
+ })),
3116
+ pageInfo: {
3117
+ hasNextPage: data.assessmentFormTemplates.nodes.length < data.assessmentFormTemplates.totalCount,
3118
+ hasPreviousPage: false
3119
+ },
3120
+ totalCount: data.assessmentFormTemplates.totalCount
3121
+ };
3122
+ }
3123
+ async submitAssessmentForReview(input) {
3124
+ await this.makeRequest(SubmitAssessmentForReviewDoc, { input });
3125
+ return this.getAssessment(input.id);
3126
+ }
3127
+ async createAssessmentFormTemplate(input) {
3128
+ const gqlInput = {
3129
+ title: input.title,
3130
+ description: input.description || "",
3131
+ status: input.status || "DRAFT",
3132
+ source: input.source || "MANUAL"
3133
+ };
3134
+ if (input.sections) gqlInput.sections = input.sections.map((s) => ({
3135
+ title: s.title,
3136
+ questions: s.questions?.map(normalizeQuestion) || []
3137
+ }));
3138
+ return (await this.makeRequest(CreateAssessmentFormTemplateDoc, { input: gqlInput })).createAssessmentFormTemplate.assessmentFormTemplate;
3139
+ }
3140
+ async createAssessmentSection(input) {
3141
+ const gqlInput = {
3142
+ assessmentFormTemplateId: input.assessmentFormTemplateId,
3143
+ title: input.title
3144
+ };
3145
+ if (input.questions) gqlInput.questions = input.questions.map(normalizeQuestion);
3146
+ return (await this.makeRequest(CreateAssessmentSectionDoc, { input: gqlInput })).createAssessmentSection.assessmentSection;
3147
+ }
3148
+ async createAssessmentQuestions(assessmentSectionId, questions) {
3149
+ const input = questions.map((q) => ({
3150
+ title: q.title,
3151
+ type: q.type,
3152
+ subType: q.subType || "NONE",
3153
+ placeholder: q.placeholder || "",
3154
+ description: q.description || "",
3155
+ isRequired: q.isRequired ?? false,
3156
+ referenceId: q.referenceId,
3157
+ assessmentSectionId,
3158
+ answerOptions: q.answerOptions || [],
3159
+ allowSelectOther: q.allowSelectOther ?? false,
3160
+ requireRiskEvaluation: q.requireRiskEvaluation ?? false
3161
+ }));
3162
+ return (await this.makeRequest(CreateAssessmentQuestionsDoc, { input })).createAssessmentQuestions.assessmentQuestions;
3163
+ }
3164
+ async getAssessmentFormTemplate(templateId) {
3165
+ const node = (await this.makeRequest(GetAssessmentFormTemplateDoc, { ids: [templateId] })).assessmentFormTemplates.nodes[0];
3166
+ if (!node) throw new Error(`Assessment template with id ${templateId} not found`);
3167
+ return {
3168
+ id: node.id,
3169
+ title: node.title,
3170
+ description: node.description ?? "",
3171
+ status: node.status,
3172
+ source: node.source,
3173
+ createdAt: node.createdAt,
3174
+ updatedAt: node.updatedAt ?? "",
3175
+ sections: (node.sections ?? []).map((s) => ({
3176
+ id: s.id,
3177
+ title: s.title ?? "",
3178
+ index: s.index ?? 0,
3179
+ questions: (s.questions ?? []).map((q) => ({
3180
+ id: q.id,
3181
+ title: q.title ?? "",
3182
+ index: q.index ?? 0,
3183
+ type: q.type,
3184
+ subType: q.subType ?? "",
3185
+ description: q.description ?? "",
3186
+ placeholder: q.placeholder ?? "",
3187
+ isRequired: q.isRequired ?? false,
3188
+ referenceId: q.referenceId ?? "",
3189
+ allowSelectOther: q.allowSelectOther ?? false,
3190
+ requireRiskEvaluation: q.requireRiskEvaluation ?? false,
3191
+ answerOptions: (q.answerOptions ?? []).map((a) => ({
3192
+ id: a.id,
3193
+ index: a.index,
3194
+ value: a.value
3195
+ }))
3196
+ }))
3197
+ }))
3198
+ };
3199
+ }
3200
+ };
3201
+ //#endregion
3202
+ export { buildAssessmentGroupUrl as _, UpdateAssessmentSchema as a, AnswerQuestionValueSchema as b, ListTemplatesSchema as c, ListAssessmentsSchema as d, GetAssessmentSchema as f, CreateAssessmentSchema as g, CreateGroupSchema as h, UpdateAssigneesSchema as i, ListGroupsSchema as l, CreateTemplateSchema as m, ASSESSMENT_OAUTH_SCOPES as n, SubmitResponseSchema as o, ExportTemplateSchema as p, getAssessmentTools as r, PrefillSchema as s, AssessmentsMixin as t, AssessmentStatusEnum as u, buildAssessmentLinks as v, AddSectionSchema as x, AnswerQuestionSchema as y };
3203
+
3204
+ //# sourceMappingURL=graphql-DGk8vCRP.mjs.map