@transcend-io/mcp-server-dsr 0.3.20 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1060 @@
1
+ import { PaginationSchema, TranscendGraphQLBase, createListResult, createToolResult, defineTool, groupBy, z } from "@transcend-io/mcp-server-base";
2
+ import { RequestAction, ScopeName } from "@transcend-io/privacy-types";
3
+ //#region src/tools/dsr_analyze.ts
4
+ const analyzeDsrSchema = z.object({ days: z.coerce.number().optional().describe("Filter analysis to requests within N days (default: 30). Only analyzes from the 100 most recent requests.") });
5
+ function createDsrAnalyzeTool(clients) {
6
+ const graphql = clients.graphql;
7
+ return defineTool({
8
+ name: "dsr_analyze",
9
+ description: "Summarize the 100 most recent DSRs: counts by type and status, completion rate, and a configurable recent-days window (default 30). For full-fleet analytics, page through dsr_list and aggregate yourself.",
10
+ category: "DSR Automation",
11
+ readOnly: true,
12
+ annotations: {
13
+ readOnlyHint: true,
14
+ destructiveHint: false,
15
+ idempotentHint: true
16
+ },
17
+ zodSchema: analyzeDsrSchema,
18
+ handler: async ({ days }) => {
19
+ const result = await graphql.listRequests({ first: 100 });
20
+ const requests = result.nodes;
21
+ const periodDays = days ?? 30;
22
+ const cutoffDate = /* @__PURE__ */ new Date(Date.now() - periodDays * 24 * 60 * 60 * 1e3);
23
+ const recentRequests = requests.filter((r) => new Date(r.createdAt) > cutoffDate);
24
+ const completedRequests = requests.filter((r) => r.status === "COMPLETED");
25
+ const pendingRequests = requests.filter((r) => [
26
+ "REQUEST_MADE",
27
+ "ENRICHING",
28
+ "ON_HOLD",
29
+ "WAITING",
30
+ "COMPILING",
31
+ "APPROVING",
32
+ "DELAYED",
33
+ "SECONDARY",
34
+ "SECONDARY_APPROVING"
35
+ ].includes(r.status));
36
+ return createToolResult(true, {
37
+ summary: {
38
+ analyzedRequests: requests.length,
39
+ totalRequestsInSystem: result.totalCount,
40
+ recentRequests: recentRequests.length,
41
+ completedRequests: completedRequests.length,
42
+ pendingRequests: pendingRequests.length,
43
+ completionRate: requests.length > 0 ? Math.round(completedRequests.length / requests.length * 100) : 0
44
+ },
45
+ breakdown: {
46
+ byType: groupBy(requests, "type"),
47
+ byStatus: groupBy(requests, "status"),
48
+ recentByType: groupBy(recentRequests, "type"),
49
+ recentByStatus: groupBy(recentRequests, "status")
50
+ },
51
+ period: {
52
+ days: periodDays,
53
+ startDate: cutoffDate.toISOString(),
54
+ endDate: (/* @__PURE__ */ new Date()).toISOString()
55
+ },
56
+ limitation: (result.totalCount || 0) > 100 ? `This analysis is based on the 100 most recent requests out of ${result.totalCount} total. For complete analysis, use dsr_list with pagination to fetch all requests.` : void 0
57
+ });
58
+ }
59
+ });
60
+ }
61
+ //#endregion
62
+ //#region src/tools/dsr_cancel.ts
63
+ const cancelDsrSchema = z.object({
64
+ requestId: z.string().describe("ID of the DSR to cancel"),
65
+ reason: z.string().optional().describe("Reason for cancellation (optional)")
66
+ });
67
+ function createDsrCancelTool(clients) {
68
+ const graphql = clients.graphql;
69
+ return defineTool({
70
+ name: "dsr_cancel",
71
+ description: "Cancel a Data Subject Request",
72
+ category: "DSR Automation",
73
+ readOnly: false,
74
+ confirmationHint: "Cancels the specified request permanently",
75
+ annotations: {
76
+ readOnlyHint: false,
77
+ destructiveHint: true,
78
+ idempotentHint: false
79
+ },
80
+ zodSchema: cancelDsrSchema,
81
+ handler: async ({ requestId, reason }) => {
82
+ const input = { requestId };
83
+ if (reason) input.subject = reason;
84
+ return createToolResult(true, {
85
+ request: (await graphql.cancelRequest(input)).request,
86
+ message: "DSR canceled successfully"
87
+ });
88
+ }
89
+ });
90
+ }
91
+ //#endregion
92
+ //#region src/tools/dsr_download_keys.ts
93
+ const downloadKeysSchema = z.object({ requestId: z.string().describe("ID of the completed DSR") });
94
+ function createDsrDownloadKeysTool(clients) {
95
+ const { rest } = clients;
96
+ return defineTool({
97
+ name: "dsr_download_keys",
98
+ description: "Get download keys for a completed Data Subject Request. These keys can be used to download the DSR results.",
99
+ category: "DSR Automation",
100
+ readOnly: true,
101
+ annotations: {
102
+ readOnlyHint: true,
103
+ destructiveHint: false,
104
+ idempotentHint: true
105
+ },
106
+ zodSchema: downloadKeysSchema,
107
+ handler: async ({ requestId }) => {
108
+ const keys = await rest.getDSRDownloadKeys(requestId);
109
+ return createToolResult(true, {
110
+ downloadKeys: keys,
111
+ count: keys.length
112
+ });
113
+ }
114
+ });
115
+ }
116
+ //#endregion
117
+ //#region src/tools/dsr_enrich_identifiers.ts
118
+ const enrichIdentifiersSchema = z.object({
119
+ requestId: z.string().describe("ID of the DSR to enrich"),
120
+ identifiers: z.record(z.string(), z.string()).describe("Key-value pairs of identifier names and values to add")
121
+ });
122
+ function createDsrEnrichIdentifiersTool(clients) {
123
+ const { rest } = clients;
124
+ return defineTool({
125
+ name: "dsr_enrich_identifiers",
126
+ description: "Enrich a Data Subject Request with additional identifiers during preflight processing",
127
+ category: "DSR Automation",
128
+ readOnly: false,
129
+ confirmationHint: "Adds identifiers to the DSR during preflight",
130
+ annotations: {
131
+ readOnlyHint: false,
132
+ destructiveHint: false,
133
+ idempotentHint: false
134
+ },
135
+ zodSchema: enrichIdentifiersSchema,
136
+ handler: async ({ requestId, identifiers }) => {
137
+ return createToolResult(true, {
138
+ ...await rest.enrichIdentifiers({
139
+ requestId,
140
+ identifiers
141
+ }),
142
+ message: "Identifiers enriched successfully"
143
+ });
144
+ }
145
+ });
146
+ }
147
+ //#endregion
148
+ //#region src/tools/dsr_get_details.ts
149
+ const getDetailsSchema = z.object({ requestId: z.string().describe("ID of the DSR to retrieve") });
150
+ function createDsrGetDetailsTool(clients) {
151
+ const graphql = clients.graphql;
152
+ return defineTool({
153
+ name: "dsr_get_details",
154
+ description: "Get detailed information about a specific Data Subject Request",
155
+ category: "DSR Automation",
156
+ readOnly: true,
157
+ annotations: {
158
+ readOnlyHint: true,
159
+ destructiveHint: false,
160
+ idempotentHint: true
161
+ },
162
+ zodSchema: getDetailsSchema,
163
+ handler: async ({ requestId }) => {
164
+ return createToolResult(true, await graphql.getRequest(requestId));
165
+ }
166
+ });
167
+ }
168
+ //#endregion
169
+ //#region src/tools/dsr_list.ts
170
+ function createDsrListTool(clients) {
171
+ const graphql = clients.graphql;
172
+ return defineTool({
173
+ name: "dsr_list",
174
+ description: "List all Data Subject Requests. Use cursor pagination to retrieve all results (max 100 per page). Note: Server-side date filtering is not available - filter results client-side if needed.",
175
+ category: "DSR Automation",
176
+ readOnly: true,
177
+ annotations: {
178
+ readOnlyHint: true,
179
+ destructiveHint: false,
180
+ idempotentHint: true
181
+ },
182
+ zodSchema: PaginationSchema,
183
+ handler: async ({ limit, cursor }) => {
184
+ const result = await graphql.listRequests({
185
+ first: limit,
186
+ after: cursor
187
+ });
188
+ return createListResult(result.nodes, {
189
+ totalCount: result.totalCount,
190
+ hasNextPage: result.pageInfo?.hasNextPage,
191
+ cursor: result.pageInfo?.endCursor,
192
+ paginationNote: result.pageInfo?.hasNextPage ? "More results available. Pass the cursor value to fetch the next page." : "No more results."
193
+ });
194
+ }
195
+ });
196
+ }
197
+ //#endregion
198
+ //#region src/tools/dsr_list_identifiers.ts
199
+ const listIdentifiersSchema = z.object({ requestId: z.string().describe("ID of the DSR") }).merge(PaginationSchema);
200
+ function createDsrListIdentifiersTool(clients) {
201
+ const { rest } = clients;
202
+ return defineTool({
203
+ name: "dsr_list_identifiers",
204
+ description: "List all identifiers attached to a Data Subject Request",
205
+ category: "DSR Automation",
206
+ readOnly: true,
207
+ annotations: {
208
+ readOnlyHint: true,
209
+ destructiveHint: false,
210
+ idempotentHint: true
211
+ },
212
+ zodSchema: listIdentifiersSchema,
213
+ handler: async ({ requestId }) => {
214
+ return createListResult(await rest.listRequestIdentifiers(requestId));
215
+ }
216
+ });
217
+ }
218
+ //#endregion
219
+ //#region src/tools/dsr_poll_status.ts
220
+ const pollStatusSchema = z.object({ requestId: z.string().describe("ID of the DSR to check") });
221
+ function createDsrPollStatusTool(clients) {
222
+ const { rest } = clients;
223
+ return defineTool({
224
+ name: "dsr_poll_status",
225
+ description: "Poll the current status of a Data Subject Request",
226
+ category: "DSR Automation",
227
+ readOnly: true,
228
+ annotations: {
229
+ readOnlyHint: true,
230
+ destructiveHint: false,
231
+ idempotentHint: true
232
+ },
233
+ zodSchema: pollStatusSchema,
234
+ handler: async ({ requestId }) => {
235
+ return createToolResult(true, await rest.getDSRStatus(requestId));
236
+ }
237
+ });
238
+ }
239
+ //#endregion
240
+ //#region src/tools/dsr_respond_access.ts
241
+ const respondAccessSchema = z.object({
242
+ requestId: z.string().describe("ID of the DSR"),
243
+ dataSiloId: z.string().describe("ID of the data silo responding"),
244
+ profiles: z.array(z.record(z.string(), z.unknown())).optional().describe("Array of profile data objects to return")
245
+ });
246
+ function createDsrRespondAccessTool(clients) {
247
+ const { rest } = clients;
248
+ return defineTool({
249
+ name: "dsr_respond_access",
250
+ description: "Respond to an ACCESS request by uploading user data",
251
+ category: "DSR Automation",
252
+ readOnly: false,
253
+ confirmationHint: "Uploads access response data for the DSR",
254
+ annotations: {
255
+ readOnlyHint: false,
256
+ destructiveHint: false,
257
+ idempotentHint: false
258
+ },
259
+ zodSchema: respondAccessSchema,
260
+ handler: async ({ requestId, dataSiloId, profiles }) => {
261
+ return createToolResult(true, {
262
+ ...await rest.respondToAccess({
263
+ requestId,
264
+ dataSiloId,
265
+ profiles
266
+ }),
267
+ message: "Access response submitted successfully"
268
+ });
269
+ }
270
+ });
271
+ }
272
+ //#endregion
273
+ //#region src/tools/dsr_respond_erasure.ts
274
+ const respondErasureSchema = z.object({
275
+ requestId: z.string().describe("ID of the DSR"),
276
+ dataSiloId: z.string().describe("ID of the data silo that completed erasure"),
277
+ profileIds: z.array(z.string()).optional().describe("IDs of profiles that were erased (optional)")
278
+ });
279
+ function createDsrRespondErasureTool(clients) {
280
+ const { rest } = clients;
281
+ return defineTool({
282
+ name: "dsr_respond_erasure",
283
+ description: "Confirm that data erasure has been completed for a data silo",
284
+ category: "DSR Automation",
285
+ readOnly: false,
286
+ confirmationHint: "Confirms erasure completion for the data silo",
287
+ annotations: {
288
+ readOnlyHint: false,
289
+ destructiveHint: false,
290
+ idempotentHint: true
291
+ },
292
+ zodSchema: respondErasureSchema,
293
+ handler: async ({ requestId, dataSiloId, profileIds }) => {
294
+ return createToolResult(true, {
295
+ ...await rest.confirmErasure({
296
+ requestId,
297
+ dataSiloId,
298
+ profileIds
299
+ }),
300
+ message: "Erasure confirmation submitted successfully"
301
+ });
302
+ }
303
+ });
304
+ }
305
+ //#endregion
306
+ //#region src/tools/dsr_submit.ts
307
+ const submitDsrSchema = z.object({
308
+ type: z.nativeEnum(RequestAction).describe("Type of DSR request"),
309
+ email: z.string().describe("Email address of the data subject"),
310
+ subjectType: z.string().describe("Type of data subject (e.g., customer, employee, prospect). Required by the Transcend API."),
311
+ coreIdentifier: z.string().optional().describe("Core identifier for the data subject (defaults to email if not provided)"),
312
+ name: z.string().optional().describe("Name of the data subject (optional)"),
313
+ locale: z.string().optional().describe("Locale for communications (e.g., en-US)"),
314
+ isSilent: z.boolean().optional().describe("Whether to suppress email notifications")
315
+ });
316
+ function createDsrSubmitTool(clients) {
317
+ const { rest } = clients;
318
+ return defineTool({
319
+ name: "dsr_submit",
320
+ description: "Submit a Data Subject Request as the data subject (public DSR API; e.g. Privacy Center flow). Supports ACCESS, ERASURE, RECTIFICATION, etc. coreIdentifier defaults to email. Use dsr_submit_on_behalf when an admin is filing on behalf of a data subject.",
321
+ category: "DSR Automation",
322
+ readOnly: false,
323
+ confirmationHint: "Creates a new data subject request",
324
+ annotations: {
325
+ readOnlyHint: false,
326
+ destructiveHint: false,
327
+ idempotentHint: false
328
+ },
329
+ zodSchema: submitDsrSchema,
330
+ handler: async ({ type, email, subjectType, coreIdentifier, name, locale, isSilent }) => {
331
+ return createToolResult(true, {
332
+ request: await rest.submitDSR({
333
+ type,
334
+ email,
335
+ subjectType,
336
+ coreIdentifier,
337
+ name,
338
+ locale,
339
+ isSilent
340
+ }),
341
+ message: `DSR of type ${type} submitted successfully`
342
+ });
343
+ }
344
+ });
345
+ }
346
+ //#endregion
347
+ //#region src/tools/dsr_submit_on_behalf.ts
348
+ const submitDsrOnBehalfSchema = z.object({
349
+ type: z.nativeEnum(RequestAction).describe("Type of DSR request"),
350
+ email: z.string().describe("Email address of the data subject"),
351
+ subjectType: z.string().describe("Type of data subject (e.g., customer, employee). Required by the Transcend API."),
352
+ coreIdentifier: z.string().optional().describe("Core identifier for the data subject (optional)"),
353
+ locale: z.string().optional().describe("Locale for communications (e.g., en-US)"),
354
+ isSilent: z.boolean().optional().describe("Whether to suppress email notifications")
355
+ });
356
+ function createDsrSubmitOnBehalfTool(clients) {
357
+ const graphql = clients.graphql;
358
+ return defineTool({
359
+ name: "dsr_submit_on_behalf",
360
+ description: "Submit a Data Subject Request as an admin on behalf of a data subject (admin-dashboard flow). Use dsr_submit when the data subject is submitting their own.",
361
+ category: "DSR Automation",
362
+ readOnly: false,
363
+ confirmationHint: "Creates a new data subject request on behalf of a data subject",
364
+ annotations: {
365
+ readOnlyHint: false,
366
+ destructiveHint: false,
367
+ idempotentHint: false
368
+ },
369
+ zodSchema: submitDsrOnBehalfSchema,
370
+ handler: async ({ type, email, subjectType, coreIdentifier, locale, isSilent }) => {
371
+ const result = await graphql.employeeMakeDataSubjectRequest({
372
+ type,
373
+ email,
374
+ subjectType,
375
+ coreIdentifier,
376
+ locale,
377
+ isSilent
378
+ });
379
+ return createToolResult(true, {
380
+ request: result.request,
381
+ clientMutationId: result.clientMutationId,
382
+ message: `DSR of type ${type} submitted on behalf of data subject`
383
+ });
384
+ }
385
+ });
386
+ }
387
+ //#endregion
388
+ //#region src/tools/index.ts
389
+ function getDSRTools(clients) {
390
+ return [
391
+ createDsrSubmitTool(clients),
392
+ createDsrPollStatusTool(clients),
393
+ createDsrListTool(clients),
394
+ createDsrGetDetailsTool(clients),
395
+ createDsrDownloadKeysTool(clients),
396
+ createDsrListIdentifiersTool(clients),
397
+ createDsrEnrichIdentifiersTool(clients),
398
+ createDsrRespondAccessTool(clients),
399
+ createDsrRespondErasureTool(clients),
400
+ createDsrCancelTool(clients),
401
+ createDsrSubmitOnBehalfTool(clients),
402
+ createDsrAnalyzeTool(clients)
403
+ ];
404
+ }
405
+ //#endregion
406
+ //#region src/scopes.ts
407
+ /** OAuth scopes required for DSR MCP tools (offline_access added by base). */
408
+ const DSR_OAUTH_SCOPES = [
409
+ ScopeName.ViewRequests,
410
+ ScopeName.ViewAssignedRequests,
411
+ ScopeName.MakeDataSubjectRequest,
412
+ ScopeName.ManageAssignedRequests,
413
+ ScopeName.ViewRequestCompilation,
414
+ ScopeName.ManageRequestCompilation
415
+ ];
416
+ //#endregion
417
+ //#region src/__generated__/gql.ts
418
+ const documents = {
419
+ "\n query DsrListRequests($first: Int, $after: String) {\n requests(first: $first, after: $after) {\n nodes {\n id\n type\n status\n createdAt\n updatedAt\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n": {
420
+ "kind": "Document",
421
+ "definitions": [{
422
+ "kind": "OperationDefinition",
423
+ "operation": "query",
424
+ "name": {
425
+ "kind": "Name",
426
+ "value": "DsrListRequests"
427
+ },
428
+ "variableDefinitions": [{
429
+ "kind": "VariableDefinition",
430
+ "variable": {
431
+ "kind": "Variable",
432
+ "name": {
433
+ "kind": "Name",
434
+ "value": "first"
435
+ }
436
+ },
437
+ "type": {
438
+ "kind": "NamedType",
439
+ "name": {
440
+ "kind": "Name",
441
+ "value": "Int"
442
+ }
443
+ }
444
+ }, {
445
+ "kind": "VariableDefinition",
446
+ "variable": {
447
+ "kind": "Variable",
448
+ "name": {
449
+ "kind": "Name",
450
+ "value": "after"
451
+ }
452
+ },
453
+ "type": {
454
+ "kind": "NamedType",
455
+ "name": {
456
+ "kind": "Name",
457
+ "value": "String"
458
+ }
459
+ }
460
+ }],
461
+ "selectionSet": {
462
+ "kind": "SelectionSet",
463
+ "selections": [{
464
+ "kind": "Field",
465
+ "name": {
466
+ "kind": "Name",
467
+ "value": "requests"
468
+ },
469
+ "arguments": [{
470
+ "kind": "Argument",
471
+ "name": {
472
+ "kind": "Name",
473
+ "value": "first"
474
+ },
475
+ "value": {
476
+ "kind": "Variable",
477
+ "name": {
478
+ "kind": "Name",
479
+ "value": "first"
480
+ }
481
+ }
482
+ }, {
483
+ "kind": "Argument",
484
+ "name": {
485
+ "kind": "Name",
486
+ "value": "after"
487
+ },
488
+ "value": {
489
+ "kind": "Variable",
490
+ "name": {
491
+ "kind": "Name",
492
+ "value": "after"
493
+ }
494
+ }
495
+ }],
496
+ "selectionSet": {
497
+ "kind": "SelectionSet",
498
+ "selections": [
499
+ {
500
+ "kind": "Field",
501
+ "name": {
502
+ "kind": "Name",
503
+ "value": "nodes"
504
+ },
505
+ "selectionSet": {
506
+ "kind": "SelectionSet",
507
+ "selections": [
508
+ {
509
+ "kind": "Field",
510
+ "name": {
511
+ "kind": "Name",
512
+ "value": "id"
513
+ }
514
+ },
515
+ {
516
+ "kind": "Field",
517
+ "name": {
518
+ "kind": "Name",
519
+ "value": "type"
520
+ }
521
+ },
522
+ {
523
+ "kind": "Field",
524
+ "name": {
525
+ "kind": "Name",
526
+ "value": "status"
527
+ }
528
+ },
529
+ {
530
+ "kind": "Field",
531
+ "name": {
532
+ "kind": "Name",
533
+ "value": "createdAt"
534
+ }
535
+ },
536
+ {
537
+ "kind": "Field",
538
+ "name": {
539
+ "kind": "Name",
540
+ "value": "updatedAt"
541
+ }
542
+ }
543
+ ]
544
+ }
545
+ },
546
+ {
547
+ "kind": "Field",
548
+ "name": {
549
+ "kind": "Name",
550
+ "value": "pageInfo"
551
+ },
552
+ "selectionSet": {
553
+ "kind": "SelectionSet",
554
+ "selections": [{
555
+ "kind": "Field",
556
+ "name": {
557
+ "kind": "Name",
558
+ "value": "hasNextPage"
559
+ }
560
+ }, {
561
+ "kind": "Field",
562
+ "name": {
563
+ "kind": "Name",
564
+ "value": "endCursor"
565
+ }
566
+ }]
567
+ }
568
+ },
569
+ {
570
+ "kind": "Field",
571
+ "name": {
572
+ "kind": "Name",
573
+ "value": "totalCount"
574
+ }
575
+ }
576
+ ]
577
+ }
578
+ }]
579
+ }
580
+ }]
581
+ },
582
+ "\n query DsrGetRequest($id: ID!) {\n request(id: $id) {\n id\n type\n status\n createdAt\n updatedAt\n daysRemaining\n link\n locale\n isSilent\n }\n }\n": {
583
+ "kind": "Document",
584
+ "definitions": [{
585
+ "kind": "OperationDefinition",
586
+ "operation": "query",
587
+ "name": {
588
+ "kind": "Name",
589
+ "value": "DsrGetRequest"
590
+ },
591
+ "variableDefinitions": [{
592
+ "kind": "VariableDefinition",
593
+ "variable": {
594
+ "kind": "Variable",
595
+ "name": {
596
+ "kind": "Name",
597
+ "value": "id"
598
+ }
599
+ },
600
+ "type": {
601
+ "kind": "NonNullType",
602
+ "type": {
603
+ "kind": "NamedType",
604
+ "name": {
605
+ "kind": "Name",
606
+ "value": "ID"
607
+ }
608
+ }
609
+ }
610
+ }],
611
+ "selectionSet": {
612
+ "kind": "SelectionSet",
613
+ "selections": [{
614
+ "kind": "Field",
615
+ "name": {
616
+ "kind": "Name",
617
+ "value": "request"
618
+ },
619
+ "arguments": [{
620
+ "kind": "Argument",
621
+ "name": {
622
+ "kind": "Name",
623
+ "value": "id"
624
+ },
625
+ "value": {
626
+ "kind": "Variable",
627
+ "name": {
628
+ "kind": "Name",
629
+ "value": "id"
630
+ }
631
+ }
632
+ }],
633
+ "selectionSet": {
634
+ "kind": "SelectionSet",
635
+ "selections": [
636
+ {
637
+ "kind": "Field",
638
+ "name": {
639
+ "kind": "Name",
640
+ "value": "id"
641
+ }
642
+ },
643
+ {
644
+ "kind": "Field",
645
+ "name": {
646
+ "kind": "Name",
647
+ "value": "type"
648
+ }
649
+ },
650
+ {
651
+ "kind": "Field",
652
+ "name": {
653
+ "kind": "Name",
654
+ "value": "status"
655
+ }
656
+ },
657
+ {
658
+ "kind": "Field",
659
+ "name": {
660
+ "kind": "Name",
661
+ "value": "createdAt"
662
+ }
663
+ },
664
+ {
665
+ "kind": "Field",
666
+ "name": {
667
+ "kind": "Name",
668
+ "value": "updatedAt"
669
+ }
670
+ },
671
+ {
672
+ "kind": "Field",
673
+ "name": {
674
+ "kind": "Name",
675
+ "value": "daysRemaining"
676
+ }
677
+ },
678
+ {
679
+ "kind": "Field",
680
+ "name": {
681
+ "kind": "Name",
682
+ "value": "link"
683
+ }
684
+ },
685
+ {
686
+ "kind": "Field",
687
+ "name": {
688
+ "kind": "Name",
689
+ "value": "locale"
690
+ }
691
+ },
692
+ {
693
+ "kind": "Field",
694
+ "name": {
695
+ "kind": "Name",
696
+ "value": "isSilent"
697
+ }
698
+ }
699
+ ]
700
+ }
701
+ }]
702
+ }
703
+ }]
704
+ },
705
+ "\n mutation DsrEmployeeMakeRequest($input: EmployeeRequestInput!) {\n employeeMakeDataSubjectRequest(input: $input) {\n clientMutationId\n request {\n id\n type\n status\n createdAt\n updatedAt\n }\n }\n }\n": {
706
+ "kind": "Document",
707
+ "definitions": [{
708
+ "kind": "OperationDefinition",
709
+ "operation": "mutation",
710
+ "name": {
711
+ "kind": "Name",
712
+ "value": "DsrEmployeeMakeRequest"
713
+ },
714
+ "variableDefinitions": [{
715
+ "kind": "VariableDefinition",
716
+ "variable": {
717
+ "kind": "Variable",
718
+ "name": {
719
+ "kind": "Name",
720
+ "value": "input"
721
+ }
722
+ },
723
+ "type": {
724
+ "kind": "NonNullType",
725
+ "type": {
726
+ "kind": "NamedType",
727
+ "name": {
728
+ "kind": "Name",
729
+ "value": "EmployeeRequestInput"
730
+ }
731
+ }
732
+ }
733
+ }],
734
+ "selectionSet": {
735
+ "kind": "SelectionSet",
736
+ "selections": [{
737
+ "kind": "Field",
738
+ "name": {
739
+ "kind": "Name",
740
+ "value": "employeeMakeDataSubjectRequest"
741
+ },
742
+ "arguments": [{
743
+ "kind": "Argument",
744
+ "name": {
745
+ "kind": "Name",
746
+ "value": "input"
747
+ },
748
+ "value": {
749
+ "kind": "Variable",
750
+ "name": {
751
+ "kind": "Name",
752
+ "value": "input"
753
+ }
754
+ }
755
+ }],
756
+ "selectionSet": {
757
+ "kind": "SelectionSet",
758
+ "selections": [{
759
+ "kind": "Field",
760
+ "name": {
761
+ "kind": "Name",
762
+ "value": "clientMutationId"
763
+ }
764
+ }, {
765
+ "kind": "Field",
766
+ "name": {
767
+ "kind": "Name",
768
+ "value": "request"
769
+ },
770
+ "selectionSet": {
771
+ "kind": "SelectionSet",
772
+ "selections": [
773
+ {
774
+ "kind": "Field",
775
+ "name": {
776
+ "kind": "Name",
777
+ "value": "id"
778
+ }
779
+ },
780
+ {
781
+ "kind": "Field",
782
+ "name": {
783
+ "kind": "Name",
784
+ "value": "type"
785
+ }
786
+ },
787
+ {
788
+ "kind": "Field",
789
+ "name": {
790
+ "kind": "Name",
791
+ "value": "status"
792
+ }
793
+ },
794
+ {
795
+ "kind": "Field",
796
+ "name": {
797
+ "kind": "Name",
798
+ "value": "createdAt"
799
+ }
800
+ },
801
+ {
802
+ "kind": "Field",
803
+ "name": {
804
+ "kind": "Name",
805
+ "value": "updatedAt"
806
+ }
807
+ }
808
+ ]
809
+ }
810
+ }]
811
+ }
812
+ }]
813
+ }
814
+ }]
815
+ },
816
+ "\n mutation DsrCancel($input: CommunicationInput!) {\n cancelRequest(input: $input) {\n clientMutationId\n request {\n id\n type\n status\n createdAt\n updatedAt\n }\n }\n }\n": {
817
+ "kind": "Document",
818
+ "definitions": [{
819
+ "kind": "OperationDefinition",
820
+ "operation": "mutation",
821
+ "name": {
822
+ "kind": "Name",
823
+ "value": "DsrCancel"
824
+ },
825
+ "variableDefinitions": [{
826
+ "kind": "VariableDefinition",
827
+ "variable": {
828
+ "kind": "Variable",
829
+ "name": {
830
+ "kind": "Name",
831
+ "value": "input"
832
+ }
833
+ },
834
+ "type": {
835
+ "kind": "NonNullType",
836
+ "type": {
837
+ "kind": "NamedType",
838
+ "name": {
839
+ "kind": "Name",
840
+ "value": "CommunicationInput"
841
+ }
842
+ }
843
+ }
844
+ }],
845
+ "selectionSet": {
846
+ "kind": "SelectionSet",
847
+ "selections": [{
848
+ "kind": "Field",
849
+ "name": {
850
+ "kind": "Name",
851
+ "value": "cancelRequest"
852
+ },
853
+ "arguments": [{
854
+ "kind": "Argument",
855
+ "name": {
856
+ "kind": "Name",
857
+ "value": "input"
858
+ },
859
+ "value": {
860
+ "kind": "Variable",
861
+ "name": {
862
+ "kind": "Name",
863
+ "value": "input"
864
+ }
865
+ }
866
+ }],
867
+ "selectionSet": {
868
+ "kind": "SelectionSet",
869
+ "selections": [{
870
+ "kind": "Field",
871
+ "name": {
872
+ "kind": "Name",
873
+ "value": "clientMutationId"
874
+ }
875
+ }, {
876
+ "kind": "Field",
877
+ "name": {
878
+ "kind": "Name",
879
+ "value": "request"
880
+ },
881
+ "selectionSet": {
882
+ "kind": "SelectionSet",
883
+ "selections": [
884
+ {
885
+ "kind": "Field",
886
+ "name": {
887
+ "kind": "Name",
888
+ "value": "id"
889
+ }
890
+ },
891
+ {
892
+ "kind": "Field",
893
+ "name": {
894
+ "kind": "Name",
895
+ "value": "type"
896
+ }
897
+ },
898
+ {
899
+ "kind": "Field",
900
+ "name": {
901
+ "kind": "Name",
902
+ "value": "status"
903
+ }
904
+ },
905
+ {
906
+ "kind": "Field",
907
+ "name": {
908
+ "kind": "Name",
909
+ "value": "createdAt"
910
+ }
911
+ },
912
+ {
913
+ "kind": "Field",
914
+ "name": {
915
+ "kind": "Name",
916
+ "value": "updatedAt"
917
+ }
918
+ }
919
+ ]
920
+ }
921
+ }]
922
+ }
923
+ }]
924
+ }
925
+ }]
926
+ }
927
+ };
928
+ function graphql(source) {
929
+ return documents[source] ?? {};
930
+ }
931
+ //#endregion
932
+ //#region src/graphql.ts
933
+ const ListRequestsDoc = graphql(`
934
+ query DsrListRequests($first: Int, $after: String) {
935
+ requests(first: $first, after: $after) {
936
+ nodes {
937
+ id
938
+ type
939
+ status
940
+ createdAt
941
+ updatedAt
942
+ }
943
+ pageInfo {
944
+ hasNextPage
945
+ endCursor
946
+ }
947
+ totalCount
948
+ }
949
+ }
950
+ `);
951
+ const GetRequestDoc = graphql(`
952
+ query DsrGetRequest($id: ID!) {
953
+ request(id: $id) {
954
+ id
955
+ type
956
+ status
957
+ createdAt
958
+ updatedAt
959
+ daysRemaining
960
+ link
961
+ locale
962
+ isSilent
963
+ }
964
+ }
965
+ `);
966
+ const EmployeeMakeDataSubjectRequestDoc = graphql(`
967
+ mutation DsrEmployeeMakeRequest($input: EmployeeRequestInput!) {
968
+ employeeMakeDataSubjectRequest(input: $input) {
969
+ clientMutationId
970
+ request {
971
+ id
972
+ type
973
+ status
974
+ createdAt
975
+ updatedAt
976
+ }
977
+ }
978
+ }
979
+ `);
980
+ const CancelRequestDoc = graphql(`
981
+ mutation DsrCancel($input: CommunicationInput!) {
982
+ cancelRequest(input: $input) {
983
+ clientMutationId
984
+ request {
985
+ id
986
+ type
987
+ status
988
+ createdAt
989
+ updatedAt
990
+ }
991
+ }
992
+ }
993
+ `);
994
+ var DSRMixin = class extends TranscendGraphQLBase {
995
+ async listRequests(options) {
996
+ const data = await this.makeRequest(ListRequestsDoc, {
997
+ first: Math.min(options?.first ?? 50, 100),
998
+ after: options?.after ?? null
999
+ });
1000
+ return {
1001
+ nodes: data.requests.nodes.map((node) => ({
1002
+ id: node.id,
1003
+ type: node.type,
1004
+ status: node.status,
1005
+ createdAt: node.createdAt,
1006
+ updatedAt: node.updatedAt
1007
+ })),
1008
+ pageInfo: {
1009
+ hasNextPage: data.requests.pageInfo.hasNextPage,
1010
+ hasPreviousPage: false,
1011
+ endCursor: data.requests.pageInfo.endCursor ?? void 0
1012
+ },
1013
+ totalCount: data.requests.totalCount
1014
+ };
1015
+ }
1016
+ async getRequest(id) {
1017
+ const r = (await this.makeRequest(GetRequestDoc, { id })).request;
1018
+ return {
1019
+ id: r.id,
1020
+ type: r.type,
1021
+ status: r.status,
1022
+ createdAt: r.createdAt,
1023
+ updatedAt: r.updatedAt,
1024
+ daysRemaining: r.daysRemaining ?? void 0,
1025
+ link: r.link,
1026
+ locale: r.locale,
1027
+ isSilent: r.isSilent
1028
+ };
1029
+ }
1030
+ async employeeMakeDataSubjectRequest(input) {
1031
+ const payload = (await this.makeRequest(EmployeeMakeDataSubjectRequestDoc, { input })).employeeMakeDataSubjectRequest;
1032
+ return {
1033
+ request: {
1034
+ id: payload.request.id,
1035
+ type: payload.request.type,
1036
+ status: payload.request.status,
1037
+ createdAt: payload.request.createdAt,
1038
+ updatedAt: payload.request.updatedAt
1039
+ },
1040
+ clientMutationId: payload.clientMutationId ?? void 0
1041
+ };
1042
+ }
1043
+ async cancelRequest(input) {
1044
+ const payload = (await this.makeRequest(CancelRequestDoc, { input })).cancelRequest;
1045
+ return {
1046
+ request: {
1047
+ id: payload.request.id,
1048
+ type: payload.request.type,
1049
+ status: payload.request.status,
1050
+ createdAt: payload.request.createdAt,
1051
+ updatedAt: payload.request.updatedAt
1052
+ },
1053
+ clientMutationId: payload.clientMutationId ?? void 0
1054
+ };
1055
+ }
1056
+ };
1057
+ //#endregion
1058
+ export { submitDsrSchema as a, pollStatusSchema as c, enrichIdentifiersSchema as d, downloadKeysSchema as f, submitDsrOnBehalfSchema as i, listIdentifiersSchema as l, analyzeDsrSchema as m, DSR_OAUTH_SCOPES as n, respondErasureSchema as o, cancelDsrSchema as p, getDSRTools as r, respondAccessSchema as s, DSRMixin as t, getDetailsSchema as u };
1059
+
1060
+ //# sourceMappingURL=graphql-DUMlDtdi.mjs.map