@transcend-io/mcp-server-inventory 0.5.9 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2637 @@
1
+ import { EmptySchema, TranscendGraphQLBase, createListResult, createToolResult, defineTool, groupBy, z } from "@transcend-io/mcp-server-base";
2
+ import { DataCategoryType, DefaultPurposeSubCategoryType, ProcessingPurpose, ScopeName } from "@transcend-io/privacy-types";
3
+ //#region src/tools/inventory_analyze.ts
4
+ function createInventoryAnalyzeTool(clients) {
5
+ const graphql = clients.graphql;
6
+ return defineTool({
7
+ name: "inventory_analyze",
8
+ description: "Analyze your data inventory including data silos by type, vendor distribution, and data point coverage",
9
+ category: "Data Inventory",
10
+ readOnly: true,
11
+ annotations: {
12
+ readOnlyHint: true,
13
+ destructiveHint: false,
14
+ idempotentHint: true
15
+ },
16
+ zodSchema: EmptySchema,
17
+ handler: async (_args) => {
18
+ const [dataSilosResult, vendorsResult, identifiersResult, categoriesResult] = await Promise.all([
19
+ graphql.listDataSilos({ all: true }),
20
+ graphql.listVendors({ all: true }),
21
+ graphql.listIdentifiers({ all: true }),
22
+ graphql.listDataCategories({ all: true })
23
+ ]);
24
+ const dataSilos = dataSilosResult.nodes;
25
+ const vendors = vendorsResult.nodes;
26
+ const identifiers = identifiersResult.nodes;
27
+ const categories = categoriesResult.nodes;
28
+ const totalCategories = categories.length;
29
+ const liveDataSilos = dataSilos.filter((ds) => ds.isLive);
30
+ return createToolResult(true, {
31
+ summary: {
32
+ totalDataSilos: dataSilos.length,
33
+ liveDataSilos: liveDataSilos.length,
34
+ totalVendors: vendors.length,
35
+ totalIdentifiers: identifiers.length,
36
+ totalCategories
37
+ },
38
+ breakdown: {
39
+ dataSilosByType: groupBy(dataSilos, "type"),
40
+ dataSilosByOuterType: groupBy(dataSilos.filter((ds) => ds.outerType), "outerType")
41
+ },
42
+ topIdentifiers: identifiers.slice(0, 10).map((id) => ({
43
+ name: id.name,
44
+ type: id.type,
45
+ isRequired: id.isRequiredInForm
46
+ })),
47
+ topCategories: categories.slice(0, 10).map((cat) => ({
48
+ name: cat.name,
49
+ category: cat.category
50
+ })),
51
+ recommendations: [
52
+ dataSilos.length === 0 ? "Add data silos to map your data landscape" : null,
53
+ liveDataSilos.length < dataSilos.length ? `${dataSilos.length - liveDataSilos.length} data silos are not live - consider activating them` : null,
54
+ vendors.length === 0 ? "Add vendors to track third-party data processors" : null
55
+ ].filter(Boolean)
56
+ });
57
+ }
58
+ });
59
+ }
60
+ //#endregion
61
+ //#region src/tools/inventory_create_data_silo.ts
62
+ const CreateDataSiloSchema = z.object({
63
+ integrationName: z.string().describe("Catalog integration name (GraphQL `name`), e.g. \"server\", \"salesforce\", \"stripe\". Must match a Transcend catalog integrationName. When unknown, call inventory_list_catalog_integrations first (pass `text` to search)."),
64
+ title: z.string().optional().describe("Display title for the data system. When omitted, the API may assign a default (e.g. \"Server Webhook - created at …\")."),
65
+ description: z.string().optional().describe("Description for the data system")
66
+ });
67
+ function createInventoryCreateDataSiloTool(clients) {
68
+ const graphql = clients.graphql;
69
+ return defineTool({
70
+ name: "inventory_create_data_silo",
71
+ description: "Create a new data silo (data system or integration). Use inventory_update_data_silo afterward for vendor, purposes, owners, and other metadata.",
72
+ category: "Data Inventory",
73
+ readOnly: false,
74
+ annotations: {
75
+ readOnlyHint: false,
76
+ destructiveHint: true,
77
+ idempotentHint: false
78
+ },
79
+ zodSchema: CreateDataSiloSchema,
80
+ handler: async ({ integrationName, title, description }) => {
81
+ const result = await graphql.createDataSilo({
82
+ name: integrationName,
83
+ title,
84
+ description
85
+ });
86
+ return createToolResult(true, {
87
+ dataSilo: result,
88
+ message: `Data silo "${title ?? result.title}" created successfully`
89
+ });
90
+ }
91
+ });
92
+ }
93
+ //#endregion
94
+ //#region src/tools/inventory_get_data_silo.ts
95
+ const GetDataSiloSchema = z.object({ dataSiloId: z.string().describe("ID of the data silo to retrieve") });
96
+ function createInventoryGetDataSiloTool(clients) {
97
+ const graphql = clients.graphql;
98
+ return defineTool({
99
+ name: "inventory_get_data_silo",
100
+ description: "Get detailed information about a specific data silo (Data Systems row): vendor link, silo-level processing purposes, owners, teams, business entities, data subjects (allowlist + blocklist), contact/website/notes metadata, and identifiers. Use before inventory_update_data_silo to avoid overwriting existing assignments. For datapoints on this silo, call inventory_list_data_points with dataSiloId.",
101
+ category: "Data Inventory",
102
+ readOnly: true,
103
+ annotations: {
104
+ readOnlyHint: true,
105
+ destructiveHint: false,
106
+ idempotentHint: true
107
+ },
108
+ zodSchema: GetDataSiloSchema,
109
+ handler: async ({ dataSiloId }) => {
110
+ return createToolResult(true, await graphql.getDataSilo(dataSiloId));
111
+ }
112
+ });
113
+ }
114
+ //#endregion
115
+ //#region src/tools/inventory_list_business_entities.ts
116
+ const ListBusinessEntitiesSchema = z.object({
117
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
118
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip for pagination (default: 0)")
119
+ });
120
+ function createInventoryListBusinessEntitiesTool(clients) {
121
+ const graphql = clients.graphql;
122
+ return defineTool({
123
+ name: "inventory_list_business_entities",
124
+ description: "List business entities from Data Inventory. Use `title` values with inventory_update_data_silo `businessEntityTitles`. Paginate with `offset` until `hasNextPage` is false.",
125
+ category: "Data Inventory",
126
+ readOnly: true,
127
+ annotations: {
128
+ readOnlyHint: true,
129
+ destructiveHint: false,
130
+ idempotentHint: true
131
+ },
132
+ zodSchema: ListBusinessEntitiesSchema,
133
+ handler: async ({ limit, offset }) => {
134
+ const result = await graphql.listBusinessEntities({
135
+ first: limit,
136
+ offset
137
+ });
138
+ return createListResult(result.nodes, {
139
+ totalCount: result.totalCount,
140
+ hasNextPage: result.pageInfo?.hasNextPage
141
+ });
142
+ }
143
+ });
144
+ }
145
+ //#endregion
146
+ //#region src/tools/inventory_list_catalog_integrations.ts
147
+ const ListCatalogIntegrationsSchema = z.object({
148
+ text: z.string().optional().describe("Free-text search across catalog title and integrationName (GraphQL filterBy.text)"),
149
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
150
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip for pagination (default: 0)")
151
+ });
152
+ function createInventoryListCatalogIntegrationsTool(clients) {
153
+ const graphql = clients.graphql;
154
+ return defineTool({
155
+ name: "inventory_list_catalog_integrations",
156
+ description: "Search the Transcend integration catalog for valid `integrationName` values to pass to inventory_create_data_silo. Pass `text` to match title or integrationName (e.g. \"salesforce\"). Paginate with `offset` until `hasNextPage` is false; `totalCount` is the full count.",
157
+ category: "Data Inventory",
158
+ readOnly: true,
159
+ annotations: {
160
+ readOnlyHint: true,
161
+ destructiveHint: false,
162
+ idempotentHint: true
163
+ },
164
+ zodSchema: ListCatalogIntegrationsSchema,
165
+ handler: async ({ text, limit, offset }) => {
166
+ const result = await graphql.listCatalogs({
167
+ first: limit,
168
+ offset,
169
+ text
170
+ });
171
+ return createListResult(result.nodes, {
172
+ totalCount: result.totalCount,
173
+ hasNextPage: result.pageInfo?.hasNextPage
174
+ });
175
+ }
176
+ });
177
+ }
178
+ //#endregion
179
+ //#region src/tools/inventory_list_categories.ts
180
+ const ListCategoriesSchema = z.object({
181
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
182
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip for pagination (default: 0)")
183
+ });
184
+ function createInventoryListCategoriesTool(clients) {
185
+ const graphql = clients.graphql;
186
+ return defineTool({
187
+ name: "inventory_list_categories",
188
+ description: "List data categories (PII types) configured in your organization. Paginate with `offset` (increment by `limit`) until `hasNextPage` is false; `totalCount` is the full count.",
189
+ category: "Data Inventory",
190
+ readOnly: true,
191
+ annotations: {
192
+ readOnlyHint: true,
193
+ destructiveHint: false,
194
+ idempotentHint: true
195
+ },
196
+ zodSchema: ListCategoriesSchema,
197
+ handler: async ({ limit, offset }) => {
198
+ const result = await graphql.listDataCategories({
199
+ first: limit,
200
+ offset
201
+ });
202
+ return createListResult(result.nodes, {
203
+ totalCount: result.totalCount,
204
+ hasNextPage: result.pageInfo?.hasNextPage
205
+ });
206
+ }
207
+ });
208
+ }
209
+ //#endregion
210
+ //#region src/tools/inventory_list_data_points.ts
211
+ const ListDataPointsSchema = z.object({
212
+ dataSiloId: z.string().optional().describe("When set, only return datapoints belonging to this data silo (GraphQL filterBy.dataSilos). Strongly recommended for large inventories."),
213
+ text: z.string().optional().describe("Free-text search across datapoints (GraphQL filterBy.text)"),
214
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
215
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip for pagination (default: 0)")
216
+ });
217
+ function createInventoryListDataPointsTool(clients) {
218
+ const graphql = clients.graphql;
219
+ return defineTool({
220
+ name: "inventory_list_data_points",
221
+ description: "List data points (collections of personal data). Pass `dataSiloId` to scope to one data system (recommended) and/or `text` to search. Each row includes `dataSiloId`. Paginate with `offset` until `hasNextPage` is false. For field-level purposes/categories, follow up with inventory_list_sub_data_points.",
222
+ category: "Data Inventory",
223
+ readOnly: true,
224
+ annotations: {
225
+ readOnlyHint: true,
226
+ destructiveHint: false,
227
+ idempotentHint: true
228
+ },
229
+ zodSchema: ListDataPointsSchema,
230
+ handler: async ({ dataSiloId, text, limit, offset }) => {
231
+ const result = await graphql.listDataPoints(dataSiloId, {
232
+ first: limit,
233
+ offset,
234
+ text
235
+ });
236
+ return createListResult(result.nodes, {
237
+ totalCount: result.totalCount,
238
+ hasNextPage: result.pageInfo?.hasNextPage
239
+ });
240
+ }
241
+ });
242
+ }
243
+ //#endregion
244
+ //#region src/tools/inventory_list_data_silos.ts
245
+ const ListDataSilosSchema = z.object({
246
+ text: z.string().optional().describe("Free-text search across data silos (GraphQL filterBy.text)"),
247
+ titles: z.array(z.string()).optional().describe("Exact title matches (GraphQL filterBy.titles)"),
248
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
249
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip for pagination (default: 0)")
250
+ });
251
+ function createInventoryListDataSilosTool(clients) {
252
+ const graphql = clients.graphql;
253
+ return defineTool({
254
+ name: "inventory_list_data_silos",
255
+ description: "List data silos (data systems and integrations) in your organization. Pass `text` or `titles` to search/filter. Paginate with `offset` (increment by `limit`) until `hasNextPage` is false; `totalCount` is the full count.",
256
+ category: "Data Inventory",
257
+ readOnly: true,
258
+ annotations: {
259
+ readOnlyHint: true,
260
+ destructiveHint: false,
261
+ idempotentHint: true
262
+ },
263
+ zodSchema: ListDataSilosSchema,
264
+ handler: async ({ text, titles, limit, offset }) => {
265
+ const result = await graphql.listDataSilos({
266
+ first: limit,
267
+ offset,
268
+ text,
269
+ titles
270
+ });
271
+ return createListResult(result.nodes, {
272
+ totalCount: result.totalCount,
273
+ hasNextPage: result.pageInfo?.hasNextPage
274
+ });
275
+ }
276
+ });
277
+ }
278
+ //#endregion
279
+ //#region src/tools/inventory_list_data_subjects.ts
280
+ const ListDataSubjectsSchema = z.object({});
281
+ function createInventoryListDataSubjectsTool(clients) {
282
+ const graphql = clients.graphql;
283
+ return defineTool({
284
+ name: "inventory_list_data_subjects",
285
+ description: "List data subject types configured for the organization. Use `id` values with inventory_update_data_silo `dataSubjectBlockListIds` (IDs of subjects to *block* from the data system — inverse of an allowlist). Returns the full set (not paginated).",
286
+ category: "Data Inventory",
287
+ readOnly: true,
288
+ annotations: {
289
+ readOnlyHint: true,
290
+ destructiveHint: false,
291
+ idempotentHint: true
292
+ },
293
+ zodSchema: ListDataSubjectsSchema,
294
+ handler: async () => {
295
+ const result = await graphql.listDataSubjects();
296
+ return createListResult(result.nodes, {
297
+ totalCount: result.totalCount,
298
+ hasNextPage: result.pageInfo?.hasNextPage
299
+ });
300
+ }
301
+ });
302
+ }
303
+ //#endregion
304
+ //#region src/tools/inventory_list_identifiers.ts
305
+ const ListIdentifiersSchema = z.object({
306
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
307
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip for pagination (default: 0)")
308
+ });
309
+ function createInventoryListIdentifiersTool(clients) {
310
+ const graphql = clients.graphql;
311
+ return defineTool({
312
+ name: "inventory_list_identifiers",
313
+ description: "List identifier types (email, user ID, etc.) configured in your organization. Paginate with `offset` (increment by `limit`) until `hasNextPage` is false; `totalCount` is the full count.",
314
+ category: "Data Inventory",
315
+ readOnly: true,
316
+ annotations: {
317
+ readOnlyHint: true,
318
+ destructiveHint: false,
319
+ idempotentHint: true
320
+ },
321
+ zodSchema: ListIdentifiersSchema,
322
+ handler: async ({ limit, offset }) => {
323
+ const result = await graphql.listIdentifiers({
324
+ first: limit,
325
+ offset
326
+ });
327
+ return createListResult(result.nodes, {
328
+ totalCount: result.totalCount,
329
+ hasNextPage: result.pageInfo?.hasNextPage
330
+ });
331
+ }
332
+ });
333
+ }
334
+ //#endregion
335
+ //#region src/tools/inventory_list_processing_purposes.ts
336
+ const ListProcessingPurposesSchema = z.object({
337
+ text: z.string().optional().describe("Free-text search across processing purposes (GraphQL filterBy.text)"),
338
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
339
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip for pagination (default: 0)")
340
+ });
341
+ function createInventoryListProcessingPurposesTool(clients) {
342
+ const graphql = clients.graphql;
343
+ return defineTool({
344
+ name: "inventory_list_processing_purposes",
345
+ description: `List processing purpose subcategories from the Processing Purposes table in Data Inventory. Empty subcategory names are normalized to "${DefaultPurposeSubCategoryType.Other}" to match write-tool defaults. Use these IDs when assigning silo-level purposes via inventory_update_data_silo, or match \`purpose\`/\`name\` pairs when assigning field-level purposes via inventory_update_or_create_data_point.`,
346
+ category: "Data Inventory",
347
+ readOnly: true,
348
+ annotations: {
349
+ readOnlyHint: true,
350
+ destructiveHint: false,
351
+ idempotentHint: true
352
+ },
353
+ zodSchema: ListProcessingPurposesSchema,
354
+ handler: async ({ text, limit, offset }) => {
355
+ const result = await graphql.listProcessingPurposes({
356
+ first: limit,
357
+ offset,
358
+ text
359
+ });
360
+ return createListResult(result.nodes, {
361
+ totalCount: result.totalCount,
362
+ hasNextPage: result.pageInfo?.hasNextPage
363
+ });
364
+ }
365
+ });
366
+ }
367
+ //#endregion
368
+ //#region src/tools/inventory_list_sub_data_points.ts
369
+ const ListSubDataPointsSchema = z.object({
370
+ dataPointId: z.string().describe("ID of the parent data point"),
371
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
372
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip (default: 0)")
373
+ });
374
+ function createInventoryListSubDataPointsTool(clients) {
375
+ const graphql = clients.graphql;
376
+ return defineTool({
377
+ name: "inventory_list_sub_data_points",
378
+ description: `List sub-data points (individual data fields) for a specific data point, including purpose of processing and data category assignments. Empty subcategory names are normalized to "${DefaultPurposeSubCategoryType.Other}".`,
379
+ category: "Data Inventory",
380
+ readOnly: true,
381
+ annotations: {
382
+ readOnlyHint: true,
383
+ destructiveHint: false,
384
+ idempotentHint: true
385
+ },
386
+ zodSchema: ListSubDataPointsSchema,
387
+ handler: async ({ dataPointId, limit, offset }) => {
388
+ const result = await graphql.listSubDataPoints(dataPointId, {
389
+ first: limit,
390
+ offset
391
+ });
392
+ return createListResult(result.nodes, {
393
+ totalCount: result.totalCount,
394
+ hasNextPage: result.pageInfo?.hasNextPage
395
+ });
396
+ }
397
+ });
398
+ }
399
+ //#endregion
400
+ //#region src/tools/inventory_list_vendors.ts
401
+ const ListVendorsSchema = z.object({
402
+ text: z.string().optional().describe("Free-text search across vendors (GraphQL filterBy.text)"),
403
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
404
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip for pagination (default: 0)")
405
+ });
406
+ function createInventoryListVendorsTool(clients) {
407
+ const graphql = clients.graphql;
408
+ return defineTool({
409
+ name: "inventory_list_vendors",
410
+ description: "List vendors (third-party data processors) with contact, website, DPA link, address, and headquarters fields. Pass `text` to search. Paginate with `offset` until `hasNextPage` is false; `totalCount` is the full count.",
411
+ category: "Data Inventory",
412
+ readOnly: true,
413
+ annotations: {
414
+ readOnlyHint: true,
415
+ destructiveHint: false,
416
+ idempotentHint: true
417
+ },
418
+ zodSchema: ListVendorsSchema,
419
+ handler: async ({ text, limit, offset }) => {
420
+ const result = await graphql.listVendors({
421
+ first: limit,
422
+ offset,
423
+ text
424
+ });
425
+ return createListResult(result.nodes, {
426
+ totalCount: result.totalCount,
427
+ hasNextPage: result.pageInfo?.hasNextPage
428
+ });
429
+ }
430
+ });
431
+ }
432
+ //#endregion
433
+ //#region src/tools/inventory_update_data_silo.ts
434
+ const UpdateDataSiloSchema = z.object({
435
+ dataSiloId: z.string().describe("ID of the data silo to update"),
436
+ title: z.string().optional().describe("New title for the data silo"),
437
+ description: z.string().optional().describe("New description"),
438
+ ownerEmails: z.array(z.string()).optional().describe("Owner email addresses"),
439
+ teamNames: z.array(z.string()).optional().describe("Team names"),
440
+ vendorId: z.string().optional().describe("Linked vendor ID from the Vendors table"),
441
+ processingPurposeSubCategoryIds: z.array(z.string()).optional().describe("Silo-level purpose of processing IDs from inventory_list_processing_purposes"),
442
+ dataSubjectBlockListIds: z.array(z.string()).optional().describe("Data subject IDs to block on this system (not an allowlist). Resolve via inventory_list_data_subjects."),
443
+ country: z.string().optional().describe("ISO country code"),
444
+ countrySubDivision: z.string().optional().describe("ISO country subdivision"),
445
+ websiteUrl: z.string().optional().describe("Website URL"),
446
+ contactName: z.string().optional().describe("Primary contact name"),
447
+ contactEmail: z.string().optional().describe("Primary contact email"),
448
+ notes: z.string().optional().describe("Free-form notes"),
449
+ businessEntityTitles: z.array(z.string()).optional().describe("Business entity titles from inventory_list_business_entities"),
450
+ isLive: z.boolean().optional().describe("Whether the data silo is live for DSR processing")
451
+ });
452
+ function createInventoryUpdateDataSiloTool(clients) {
453
+ const graphql = clients.graphql;
454
+ return defineTool({
455
+ name: "inventory_update_data_silo",
456
+ description: "Update an existing data silo (Data Systems table). Supports title, description, owners, teams, vendor link, silo-level processing purposes, data subjects, and common metadata.",
457
+ category: "Data Inventory",
458
+ readOnly: false,
459
+ annotations: {
460
+ readOnlyHint: false,
461
+ destructiveHint: false,
462
+ idempotentHint: true
463
+ },
464
+ zodSchema: UpdateDataSiloSchema,
465
+ handler: async ({ dataSiloId, ...fields }) => {
466
+ return createToolResult(true, {
467
+ dataSilo: await graphql.updateDataSilo({
468
+ id: dataSiloId,
469
+ ...fields
470
+ }),
471
+ message: "Data silo updated successfully"
472
+ });
473
+ }
474
+ });
475
+ }
476
+ //#endregion
477
+ //#region src/tools/inventory_update_or_create_data_point.ts
478
+ const PurposeAssignmentSchema = z.object({
479
+ purpose: z.nativeEnum(ProcessingPurpose).describe("Processing purpose enum (e.g. ESSENTIAL, ANALYTICS)"),
480
+ name: z.string().optional().describe(`Processing purpose subcategory name (defaults to "${DefaultPurposeSubCategoryType.Other}")`)
481
+ });
482
+ const CategoryAssignmentSchema = z.object({
483
+ category: z.nativeEnum(DataCategoryType).describe("Data category type (e.g. CONTACT, ID)"),
484
+ name: z.string().describe("Data subcategory name (e.g. \"Email\", \"Other\")")
485
+ });
486
+ const SubDataPointInputSchema = z.object({
487
+ name: z.string().describe("Field name / key within the datapoint"),
488
+ description: z.string().optional().describe("Field description"),
489
+ purposes: z.array(PurposeAssignmentSchema).optional().describe("Purpose of processing assignments for this field"),
490
+ categories: z.array(CategoryAssignmentSchema).optional().describe("Data category assignments for this field")
491
+ });
492
+ const UpdateOrCreateDataPointSchema = z.object({
493
+ dataSiloId: z.string().describe("ID of the parent data silo"),
494
+ name: z.string().describe("Datapoint key / name (upsert key within the data silo)"),
495
+ title: z.string().optional().describe("Display title for the datapoint"),
496
+ description: z.string().optional().describe("Datapoint description"),
497
+ ownerEmails: z.array(z.string()).optional().describe("Owner email addresses"),
498
+ teamNames: z.array(z.string()).optional().describe("Team names"),
499
+ path: z.array(z.string()).optional().describe("Optional nested path segments"),
500
+ subDataPoints: z.array(SubDataPointInputSchema).optional().describe("Field-level sub-data points. Purpose of processing is assigned here as `purposes: [{ purpose, name }]`.")
501
+ });
502
+ function createInventoryUpdateOrCreateDataPointTool(clients) {
503
+ const graphql = clients.graphql;
504
+ return defineTool({
505
+ name: "inventory_update_or_create_data_point",
506
+ description: `Create or update a datapoint (and its fields / sub-data points) on a data silo. Use this to assign purpose of processing on fields via \`subDataPoints[].purposes\` (\`{ purpose, name }\`, name defaults to "${DefaultPurposeSubCategoryType.Other}"). Mirrors GraphQL updateOrCreateDataPoint.`,
507
+ category: "Data Inventory",
508
+ readOnly: false,
509
+ confirmationHint: "Creates or updates a datapoint and its field purpose assignments",
510
+ annotations: {
511
+ readOnlyHint: false,
512
+ destructiveHint: false,
513
+ idempotentHint: true
514
+ },
515
+ zodSchema: UpdateOrCreateDataPointSchema,
516
+ handler: async ({ dataSiloId, name, title, description, ownerEmails, teamNames, path, subDataPoints }) => {
517
+ return createToolResult(true, {
518
+ dataPoint: await graphql.updateOrCreateDataPoint({
519
+ dataSiloId,
520
+ name,
521
+ title,
522
+ description,
523
+ ownerEmails,
524
+ teamNames,
525
+ path,
526
+ subDataPoints: subDataPoints?.map((field) => ({
527
+ name: field.name,
528
+ description: field.description,
529
+ purposes: field.purposes?.map((p) => ({
530
+ purpose: p.purpose,
531
+ name: p.name || DefaultPurposeSubCategoryType.Other
532
+ })),
533
+ categories: field.categories?.map((c) => ({
534
+ category: c.category,
535
+ name: c.name
536
+ }))
537
+ }))
538
+ }),
539
+ message: "Data point upserted successfully"
540
+ });
541
+ }
542
+ });
543
+ }
544
+ //#endregion
545
+ //#region src/tools/inventory_write_processing_purpose.ts
546
+ const WriteProcessingPurposeSchema = z.object({
547
+ id: z.string().optional().describe("Existing processing purpose subcategory ID. When set, updates that row directly."),
548
+ name: z.string().optional().describe(`Subcategory display name (e.g. "${DefaultPurposeSubCategoryType.Other}", "Login"). Upsert key with purpose when id is omitted.`),
549
+ purpose: z.nativeEnum(ProcessingPurpose).optional().describe("Processing purpose enum (e.g. ESSENTIAL, ANALYTICS). Upsert key with name when id is omitted."),
550
+ description: z.string().optional().describe("Description of this processing purpose")
551
+ }).refine((data) => Boolean(data.id || data.name && data.purpose), { message: "Provide id to update, or both name and purpose to upsert" });
552
+ function createInventoryWriteProcessingPurposeTool(clients) {
553
+ const graphql = clients.graphql;
554
+ return defineTool({
555
+ name: "inventory_write_processing_purpose",
556
+ description: "Create or update a processing purpose subcategory in the Processing Purposes table. Pass `id` to update by ID, or `name` + `purpose` to upsert (creates when missing). The unique key is name + purpose (e.g. \"Other:ESSENTIAL\").",
557
+ category: "Data Inventory",
558
+ readOnly: false,
559
+ confirmationHint: "Creates or updates a processing purpose subcategory",
560
+ annotations: {
561
+ readOnlyHint: false,
562
+ destructiveHint: false,
563
+ idempotentHint: true
564
+ },
565
+ zodSchema: WriteProcessingPurposeSchema,
566
+ handler: async (input) => {
567
+ const { processingPurpose, created } = await graphql.writeProcessingPurpose({
568
+ id: input.id,
569
+ name: input.name,
570
+ purpose: input.purpose,
571
+ description: input.description
572
+ });
573
+ return createToolResult(true, {
574
+ processingPurpose,
575
+ created,
576
+ message: created ? "Processing purpose created successfully" : "Processing purpose updated successfully"
577
+ });
578
+ }
579
+ });
580
+ }
581
+ //#endregion
582
+ //#region src/tools/inventory_write_vendor.ts
583
+ const WriteVendorSchema = z.object({
584
+ vendorId: z.string().optional().describe("Existing vendor ID. When set, updates that vendor directly."),
585
+ title: z.string().optional().describe("Vendor display title. Upsert key when vendorId is omitted; required to create a new vendor."),
586
+ description: z.string().optional().describe("Vendor description (defaults to empty string on create)"),
587
+ dataProcessingAgreementLink: z.string().optional().describe("URL to the data processing agreement"),
588
+ contactName: z.string().optional().describe("Primary contact name"),
589
+ contactEmail: z.string().optional().describe("Primary contact email"),
590
+ contactPhone: z.string().optional().describe("Primary contact phone"),
591
+ websiteUrl: z.string().optional().describe("Vendor website URL"),
592
+ address: z.string().optional().describe("Physical address"),
593
+ headquarterCountry: z.string().optional().describe("Headquarters ISO country code"),
594
+ headquarterSubDivision: z.string().optional().describe("Headquarters country subdivision")
595
+ }).refine((data) => Boolean(data.vendorId || data.title), { message: "Provide vendorId to update, or title to upsert by title" });
596
+ function createInventoryWriteVendorTool(clients) {
597
+ const graphql = clients.graphql;
598
+ return defineTool({
599
+ name: "inventory_write_vendor",
600
+ description: "Create or update a vendor in the Vendors table. Pass `vendorId` to update by ID, or `title` to upsert by title (creates when missing). Mirrors CLI inventory vendor sync.",
601
+ category: "Data Inventory",
602
+ readOnly: false,
603
+ confirmationHint: "Creates or updates a vendor in the inventory",
604
+ annotations: {
605
+ readOnlyHint: false,
606
+ destructiveHint: false,
607
+ idempotentHint: true
608
+ },
609
+ zodSchema: WriteVendorSchema,
610
+ handler: async (input) => {
611
+ const { vendor, created } = await graphql.writeVendor({
612
+ id: input.vendorId,
613
+ title: input.title,
614
+ description: input.description,
615
+ dataProcessingAgreementLink: input.dataProcessingAgreementLink,
616
+ contactName: input.contactName,
617
+ contactEmail: input.contactEmail,
618
+ contactPhone: input.contactPhone,
619
+ websiteUrl: input.websiteUrl,
620
+ address: input.address,
621
+ headquarterCountry: input.headquarterCountry,
622
+ headquarterSubDivision: input.headquarterSubDivision
623
+ });
624
+ return createToolResult(true, {
625
+ vendor,
626
+ created,
627
+ message: created ? "Vendor created successfully" : "Vendor updated successfully"
628
+ });
629
+ }
630
+ });
631
+ }
632
+ //#endregion
633
+ //#region src/tools/index.ts
634
+ function getInventoryTools(clients) {
635
+ return [
636
+ createInventoryListDataSilosTool(clients),
637
+ createInventoryGetDataSiloTool(clients),
638
+ createInventoryListCatalogIntegrationsTool(clients),
639
+ createInventoryCreateDataSiloTool(clients),
640
+ createInventoryUpdateDataSiloTool(clients),
641
+ createInventoryListVendorsTool(clients),
642
+ createInventoryWriteVendorTool(clients),
643
+ createInventoryListDataPointsTool(clients),
644
+ createInventoryUpdateOrCreateDataPointTool(clients),
645
+ createInventoryListSubDataPointsTool(clients),
646
+ createInventoryListIdentifiersTool(clients),
647
+ createInventoryListCategoriesTool(clients),
648
+ createInventoryListProcessingPurposesTool(clients),
649
+ createInventoryWriteProcessingPurposeTool(clients),
650
+ createInventoryListBusinessEntitiesTool(clients),
651
+ createInventoryListDataSubjectsTool(clients),
652
+ createInventoryAnalyzeTool(clients)
653
+ ];
654
+ }
655
+ //#endregion
656
+ //#region src/scopes.ts
657
+ /** OAuth scopes required for Inventory MCP tools (offline_access added by base). */
658
+ const INVENTORY_OAUTH_SCOPES = [
659
+ ScopeName.ViewDataMap,
660
+ ScopeName.ViewAssignedIntegrations,
661
+ ScopeName.ManageDataMap,
662
+ ScopeName.ManageAssignedIntegrations,
663
+ ScopeName.ViewDataInventory,
664
+ ScopeName.ViewAssignedDataInventory,
665
+ ScopeName.ManageDataInventory,
666
+ ScopeName.ManageAssignedDataInventory
667
+ ];
668
+ //#endregion
669
+ //#region src/__generated__/gql.ts
670
+ const documents = {
671
+ "\n query InventoryGetDataSilo($id: String!) {\n dataSilo(id: $id) {\n id\n title\n type\n description\n link\n isLive\n outerType\n createdAt\n connectionState\n notes\n contactName\n contactEmail\n websiteUrl\n country\n countrySubDivision\n vendor {\n id\n title\n description\n contactName\n contactEmail\n websiteUrl\n dataProcessingAgreementLink\n }\n processingPurposeSubCategories {\n id\n name\n purpose\n description\n }\n owners {\n id\n email\n name\n }\n teams {\n id\n name\n }\n businessEntities {\n id\n title\n description\n }\n subjects {\n id\n type\n title {\n defaultMessage\n }\n }\n subjectBlocklist {\n id\n type\n title {\n defaultMessage\n }\n }\n identifiers {\n id\n name\n type\n isRequiredInForm\n }\n }\n }\n": {
672
+ "kind": "Document",
673
+ "definitions": [{
674
+ "kind": "OperationDefinition",
675
+ "operation": "query",
676
+ "name": {
677
+ "kind": "Name",
678
+ "value": "InventoryGetDataSilo"
679
+ },
680
+ "variableDefinitions": [{
681
+ "kind": "VariableDefinition",
682
+ "variable": {
683
+ "kind": "Variable",
684
+ "name": {
685
+ "kind": "Name",
686
+ "value": "id"
687
+ }
688
+ },
689
+ "type": {
690
+ "kind": "NonNullType",
691
+ "type": {
692
+ "kind": "NamedType",
693
+ "name": {
694
+ "kind": "Name",
695
+ "value": "String"
696
+ }
697
+ }
698
+ }
699
+ }],
700
+ "selectionSet": {
701
+ "kind": "SelectionSet",
702
+ "selections": [{
703
+ "kind": "Field",
704
+ "name": {
705
+ "kind": "Name",
706
+ "value": "dataSilo"
707
+ },
708
+ "arguments": [{
709
+ "kind": "Argument",
710
+ "name": {
711
+ "kind": "Name",
712
+ "value": "id"
713
+ },
714
+ "value": {
715
+ "kind": "Variable",
716
+ "name": {
717
+ "kind": "Name",
718
+ "value": "id"
719
+ }
720
+ }
721
+ }],
722
+ "selectionSet": {
723
+ "kind": "SelectionSet",
724
+ "selections": [
725
+ {
726
+ "kind": "Field",
727
+ "name": {
728
+ "kind": "Name",
729
+ "value": "id"
730
+ }
731
+ },
732
+ {
733
+ "kind": "Field",
734
+ "name": {
735
+ "kind": "Name",
736
+ "value": "title"
737
+ }
738
+ },
739
+ {
740
+ "kind": "Field",
741
+ "name": {
742
+ "kind": "Name",
743
+ "value": "type"
744
+ }
745
+ },
746
+ {
747
+ "kind": "Field",
748
+ "name": {
749
+ "kind": "Name",
750
+ "value": "description"
751
+ }
752
+ },
753
+ {
754
+ "kind": "Field",
755
+ "name": {
756
+ "kind": "Name",
757
+ "value": "link"
758
+ }
759
+ },
760
+ {
761
+ "kind": "Field",
762
+ "name": {
763
+ "kind": "Name",
764
+ "value": "isLive"
765
+ }
766
+ },
767
+ {
768
+ "kind": "Field",
769
+ "name": {
770
+ "kind": "Name",
771
+ "value": "outerType"
772
+ }
773
+ },
774
+ {
775
+ "kind": "Field",
776
+ "name": {
777
+ "kind": "Name",
778
+ "value": "createdAt"
779
+ }
780
+ },
781
+ {
782
+ "kind": "Field",
783
+ "name": {
784
+ "kind": "Name",
785
+ "value": "connectionState"
786
+ }
787
+ },
788
+ {
789
+ "kind": "Field",
790
+ "name": {
791
+ "kind": "Name",
792
+ "value": "notes"
793
+ }
794
+ },
795
+ {
796
+ "kind": "Field",
797
+ "name": {
798
+ "kind": "Name",
799
+ "value": "contactName"
800
+ }
801
+ },
802
+ {
803
+ "kind": "Field",
804
+ "name": {
805
+ "kind": "Name",
806
+ "value": "contactEmail"
807
+ }
808
+ },
809
+ {
810
+ "kind": "Field",
811
+ "name": {
812
+ "kind": "Name",
813
+ "value": "websiteUrl"
814
+ }
815
+ },
816
+ {
817
+ "kind": "Field",
818
+ "name": {
819
+ "kind": "Name",
820
+ "value": "country"
821
+ }
822
+ },
823
+ {
824
+ "kind": "Field",
825
+ "name": {
826
+ "kind": "Name",
827
+ "value": "countrySubDivision"
828
+ }
829
+ },
830
+ {
831
+ "kind": "Field",
832
+ "name": {
833
+ "kind": "Name",
834
+ "value": "vendor"
835
+ },
836
+ "selectionSet": {
837
+ "kind": "SelectionSet",
838
+ "selections": [
839
+ {
840
+ "kind": "Field",
841
+ "name": {
842
+ "kind": "Name",
843
+ "value": "id"
844
+ }
845
+ },
846
+ {
847
+ "kind": "Field",
848
+ "name": {
849
+ "kind": "Name",
850
+ "value": "title"
851
+ }
852
+ },
853
+ {
854
+ "kind": "Field",
855
+ "name": {
856
+ "kind": "Name",
857
+ "value": "description"
858
+ }
859
+ },
860
+ {
861
+ "kind": "Field",
862
+ "name": {
863
+ "kind": "Name",
864
+ "value": "contactName"
865
+ }
866
+ },
867
+ {
868
+ "kind": "Field",
869
+ "name": {
870
+ "kind": "Name",
871
+ "value": "contactEmail"
872
+ }
873
+ },
874
+ {
875
+ "kind": "Field",
876
+ "name": {
877
+ "kind": "Name",
878
+ "value": "websiteUrl"
879
+ }
880
+ },
881
+ {
882
+ "kind": "Field",
883
+ "name": {
884
+ "kind": "Name",
885
+ "value": "dataProcessingAgreementLink"
886
+ }
887
+ }
888
+ ]
889
+ }
890
+ },
891
+ {
892
+ "kind": "Field",
893
+ "name": {
894
+ "kind": "Name",
895
+ "value": "processingPurposeSubCategories"
896
+ },
897
+ "selectionSet": {
898
+ "kind": "SelectionSet",
899
+ "selections": [
900
+ {
901
+ "kind": "Field",
902
+ "name": {
903
+ "kind": "Name",
904
+ "value": "id"
905
+ }
906
+ },
907
+ {
908
+ "kind": "Field",
909
+ "name": {
910
+ "kind": "Name",
911
+ "value": "name"
912
+ }
913
+ },
914
+ {
915
+ "kind": "Field",
916
+ "name": {
917
+ "kind": "Name",
918
+ "value": "purpose"
919
+ }
920
+ },
921
+ {
922
+ "kind": "Field",
923
+ "name": {
924
+ "kind": "Name",
925
+ "value": "description"
926
+ }
927
+ }
928
+ ]
929
+ }
930
+ },
931
+ {
932
+ "kind": "Field",
933
+ "name": {
934
+ "kind": "Name",
935
+ "value": "owners"
936
+ },
937
+ "selectionSet": {
938
+ "kind": "SelectionSet",
939
+ "selections": [
940
+ {
941
+ "kind": "Field",
942
+ "name": {
943
+ "kind": "Name",
944
+ "value": "id"
945
+ }
946
+ },
947
+ {
948
+ "kind": "Field",
949
+ "name": {
950
+ "kind": "Name",
951
+ "value": "email"
952
+ }
953
+ },
954
+ {
955
+ "kind": "Field",
956
+ "name": {
957
+ "kind": "Name",
958
+ "value": "name"
959
+ }
960
+ }
961
+ ]
962
+ }
963
+ },
964
+ {
965
+ "kind": "Field",
966
+ "name": {
967
+ "kind": "Name",
968
+ "value": "teams"
969
+ },
970
+ "selectionSet": {
971
+ "kind": "SelectionSet",
972
+ "selections": [{
973
+ "kind": "Field",
974
+ "name": {
975
+ "kind": "Name",
976
+ "value": "id"
977
+ }
978
+ }, {
979
+ "kind": "Field",
980
+ "name": {
981
+ "kind": "Name",
982
+ "value": "name"
983
+ }
984
+ }]
985
+ }
986
+ },
987
+ {
988
+ "kind": "Field",
989
+ "name": {
990
+ "kind": "Name",
991
+ "value": "businessEntities"
992
+ },
993
+ "selectionSet": {
994
+ "kind": "SelectionSet",
995
+ "selections": [
996
+ {
997
+ "kind": "Field",
998
+ "name": {
999
+ "kind": "Name",
1000
+ "value": "id"
1001
+ }
1002
+ },
1003
+ {
1004
+ "kind": "Field",
1005
+ "name": {
1006
+ "kind": "Name",
1007
+ "value": "title"
1008
+ }
1009
+ },
1010
+ {
1011
+ "kind": "Field",
1012
+ "name": {
1013
+ "kind": "Name",
1014
+ "value": "description"
1015
+ }
1016
+ }
1017
+ ]
1018
+ }
1019
+ },
1020
+ {
1021
+ "kind": "Field",
1022
+ "name": {
1023
+ "kind": "Name",
1024
+ "value": "subjects"
1025
+ },
1026
+ "selectionSet": {
1027
+ "kind": "SelectionSet",
1028
+ "selections": [
1029
+ {
1030
+ "kind": "Field",
1031
+ "name": {
1032
+ "kind": "Name",
1033
+ "value": "id"
1034
+ }
1035
+ },
1036
+ {
1037
+ "kind": "Field",
1038
+ "name": {
1039
+ "kind": "Name",
1040
+ "value": "type"
1041
+ }
1042
+ },
1043
+ {
1044
+ "kind": "Field",
1045
+ "name": {
1046
+ "kind": "Name",
1047
+ "value": "title"
1048
+ },
1049
+ "selectionSet": {
1050
+ "kind": "SelectionSet",
1051
+ "selections": [{
1052
+ "kind": "Field",
1053
+ "name": {
1054
+ "kind": "Name",
1055
+ "value": "defaultMessage"
1056
+ }
1057
+ }]
1058
+ }
1059
+ }
1060
+ ]
1061
+ }
1062
+ },
1063
+ {
1064
+ "kind": "Field",
1065
+ "name": {
1066
+ "kind": "Name",
1067
+ "value": "subjectBlocklist"
1068
+ },
1069
+ "selectionSet": {
1070
+ "kind": "SelectionSet",
1071
+ "selections": [
1072
+ {
1073
+ "kind": "Field",
1074
+ "name": {
1075
+ "kind": "Name",
1076
+ "value": "id"
1077
+ }
1078
+ },
1079
+ {
1080
+ "kind": "Field",
1081
+ "name": {
1082
+ "kind": "Name",
1083
+ "value": "type"
1084
+ }
1085
+ },
1086
+ {
1087
+ "kind": "Field",
1088
+ "name": {
1089
+ "kind": "Name",
1090
+ "value": "title"
1091
+ },
1092
+ "selectionSet": {
1093
+ "kind": "SelectionSet",
1094
+ "selections": [{
1095
+ "kind": "Field",
1096
+ "name": {
1097
+ "kind": "Name",
1098
+ "value": "defaultMessage"
1099
+ }
1100
+ }]
1101
+ }
1102
+ }
1103
+ ]
1104
+ }
1105
+ },
1106
+ {
1107
+ "kind": "Field",
1108
+ "name": {
1109
+ "kind": "Name",
1110
+ "value": "identifiers"
1111
+ },
1112
+ "selectionSet": {
1113
+ "kind": "SelectionSet",
1114
+ "selections": [
1115
+ {
1116
+ "kind": "Field",
1117
+ "name": {
1118
+ "kind": "Name",
1119
+ "value": "id"
1120
+ }
1121
+ },
1122
+ {
1123
+ "kind": "Field",
1124
+ "name": {
1125
+ "kind": "Name",
1126
+ "value": "name"
1127
+ }
1128
+ },
1129
+ {
1130
+ "kind": "Field",
1131
+ "name": {
1132
+ "kind": "Name",
1133
+ "value": "type"
1134
+ }
1135
+ },
1136
+ {
1137
+ "kind": "Field",
1138
+ "name": {
1139
+ "kind": "Name",
1140
+ "value": "isRequiredInForm"
1141
+ }
1142
+ }
1143
+ ]
1144
+ }
1145
+ }
1146
+ ]
1147
+ }
1148
+ }]
1149
+ }
1150
+ }]
1151
+ },
1152
+ "\n mutation InventoryCreateDataSilos($input: [CreateDataSilosInput!]!) {\n createDataSilos(input: $input) {\n dataSilos {\n id\n title\n type\n description\n isLive\n createdAt\n }\n }\n }\n": {
1153
+ "kind": "Document",
1154
+ "definitions": [{
1155
+ "kind": "OperationDefinition",
1156
+ "operation": "mutation",
1157
+ "name": {
1158
+ "kind": "Name",
1159
+ "value": "InventoryCreateDataSilos"
1160
+ },
1161
+ "variableDefinitions": [{
1162
+ "kind": "VariableDefinition",
1163
+ "variable": {
1164
+ "kind": "Variable",
1165
+ "name": {
1166
+ "kind": "Name",
1167
+ "value": "input"
1168
+ }
1169
+ },
1170
+ "type": {
1171
+ "kind": "NonNullType",
1172
+ "type": {
1173
+ "kind": "ListType",
1174
+ "type": {
1175
+ "kind": "NonNullType",
1176
+ "type": {
1177
+ "kind": "NamedType",
1178
+ "name": {
1179
+ "kind": "Name",
1180
+ "value": "CreateDataSilosInput"
1181
+ }
1182
+ }
1183
+ }
1184
+ }
1185
+ }
1186
+ }],
1187
+ "selectionSet": {
1188
+ "kind": "SelectionSet",
1189
+ "selections": [{
1190
+ "kind": "Field",
1191
+ "name": {
1192
+ "kind": "Name",
1193
+ "value": "createDataSilos"
1194
+ },
1195
+ "arguments": [{
1196
+ "kind": "Argument",
1197
+ "name": {
1198
+ "kind": "Name",
1199
+ "value": "input"
1200
+ },
1201
+ "value": {
1202
+ "kind": "Variable",
1203
+ "name": {
1204
+ "kind": "Name",
1205
+ "value": "input"
1206
+ }
1207
+ }
1208
+ }],
1209
+ "selectionSet": {
1210
+ "kind": "SelectionSet",
1211
+ "selections": [{
1212
+ "kind": "Field",
1213
+ "name": {
1214
+ "kind": "Name",
1215
+ "value": "dataSilos"
1216
+ },
1217
+ "selectionSet": {
1218
+ "kind": "SelectionSet",
1219
+ "selections": [
1220
+ {
1221
+ "kind": "Field",
1222
+ "name": {
1223
+ "kind": "Name",
1224
+ "value": "id"
1225
+ }
1226
+ },
1227
+ {
1228
+ "kind": "Field",
1229
+ "name": {
1230
+ "kind": "Name",
1231
+ "value": "title"
1232
+ }
1233
+ },
1234
+ {
1235
+ "kind": "Field",
1236
+ "name": {
1237
+ "kind": "Name",
1238
+ "value": "type"
1239
+ }
1240
+ },
1241
+ {
1242
+ "kind": "Field",
1243
+ "name": {
1244
+ "kind": "Name",
1245
+ "value": "description"
1246
+ }
1247
+ },
1248
+ {
1249
+ "kind": "Field",
1250
+ "name": {
1251
+ "kind": "Name",
1252
+ "value": "isLive"
1253
+ }
1254
+ },
1255
+ {
1256
+ "kind": "Field",
1257
+ "name": {
1258
+ "kind": "Name",
1259
+ "value": "createdAt"
1260
+ }
1261
+ }
1262
+ ]
1263
+ }
1264
+ }]
1265
+ }
1266
+ }]
1267
+ }
1268
+ }]
1269
+ },
1270
+ "\n mutation InventoryUpdateDataSilos($input: UpdateDataSilosInput!) {\n updateDataSilos(input: $input) {\n dataSilos {\n id\n title\n type\n description\n isLive\n createdAt\n }\n }\n }\n": {
1271
+ "kind": "Document",
1272
+ "definitions": [{
1273
+ "kind": "OperationDefinition",
1274
+ "operation": "mutation",
1275
+ "name": {
1276
+ "kind": "Name",
1277
+ "value": "InventoryUpdateDataSilos"
1278
+ },
1279
+ "variableDefinitions": [{
1280
+ "kind": "VariableDefinition",
1281
+ "variable": {
1282
+ "kind": "Variable",
1283
+ "name": {
1284
+ "kind": "Name",
1285
+ "value": "input"
1286
+ }
1287
+ },
1288
+ "type": {
1289
+ "kind": "NonNullType",
1290
+ "type": {
1291
+ "kind": "NamedType",
1292
+ "name": {
1293
+ "kind": "Name",
1294
+ "value": "UpdateDataSilosInput"
1295
+ }
1296
+ }
1297
+ }
1298
+ }],
1299
+ "selectionSet": {
1300
+ "kind": "SelectionSet",
1301
+ "selections": [{
1302
+ "kind": "Field",
1303
+ "name": {
1304
+ "kind": "Name",
1305
+ "value": "updateDataSilos"
1306
+ },
1307
+ "arguments": [{
1308
+ "kind": "Argument",
1309
+ "name": {
1310
+ "kind": "Name",
1311
+ "value": "input"
1312
+ },
1313
+ "value": {
1314
+ "kind": "Variable",
1315
+ "name": {
1316
+ "kind": "Name",
1317
+ "value": "input"
1318
+ }
1319
+ }
1320
+ }],
1321
+ "selectionSet": {
1322
+ "kind": "SelectionSet",
1323
+ "selections": [{
1324
+ "kind": "Field",
1325
+ "name": {
1326
+ "kind": "Name",
1327
+ "value": "dataSilos"
1328
+ },
1329
+ "selectionSet": {
1330
+ "kind": "SelectionSet",
1331
+ "selections": [
1332
+ {
1333
+ "kind": "Field",
1334
+ "name": {
1335
+ "kind": "Name",
1336
+ "value": "id"
1337
+ }
1338
+ },
1339
+ {
1340
+ "kind": "Field",
1341
+ "name": {
1342
+ "kind": "Name",
1343
+ "value": "title"
1344
+ }
1345
+ },
1346
+ {
1347
+ "kind": "Field",
1348
+ "name": {
1349
+ "kind": "Name",
1350
+ "value": "type"
1351
+ }
1352
+ },
1353
+ {
1354
+ "kind": "Field",
1355
+ "name": {
1356
+ "kind": "Name",
1357
+ "value": "description"
1358
+ }
1359
+ },
1360
+ {
1361
+ "kind": "Field",
1362
+ "name": {
1363
+ "kind": "Name",
1364
+ "value": "isLive"
1365
+ }
1366
+ },
1367
+ {
1368
+ "kind": "Field",
1369
+ "name": {
1370
+ "kind": "Name",
1371
+ "value": "createdAt"
1372
+ }
1373
+ }
1374
+ ]
1375
+ }
1376
+ }]
1377
+ }
1378
+ }]
1379
+ }
1380
+ }]
1381
+ },
1382
+ "\n mutation InventoryUpdateOrCreateDataPoint($input: UpdateOrCreateDataPointInput!) {\n updateOrCreateDataPoint(input: $input) {\n dataPoint {\n id\n name\n }\n }\n }\n": {
1383
+ "kind": "Document",
1384
+ "definitions": [{
1385
+ "kind": "OperationDefinition",
1386
+ "operation": "mutation",
1387
+ "name": {
1388
+ "kind": "Name",
1389
+ "value": "InventoryUpdateOrCreateDataPoint"
1390
+ },
1391
+ "variableDefinitions": [{
1392
+ "kind": "VariableDefinition",
1393
+ "variable": {
1394
+ "kind": "Variable",
1395
+ "name": {
1396
+ "kind": "Name",
1397
+ "value": "input"
1398
+ }
1399
+ },
1400
+ "type": {
1401
+ "kind": "NonNullType",
1402
+ "type": {
1403
+ "kind": "NamedType",
1404
+ "name": {
1405
+ "kind": "Name",
1406
+ "value": "UpdateOrCreateDataPointInput"
1407
+ }
1408
+ }
1409
+ }
1410
+ }],
1411
+ "selectionSet": {
1412
+ "kind": "SelectionSet",
1413
+ "selections": [{
1414
+ "kind": "Field",
1415
+ "name": {
1416
+ "kind": "Name",
1417
+ "value": "updateOrCreateDataPoint"
1418
+ },
1419
+ "arguments": [{
1420
+ "kind": "Argument",
1421
+ "name": {
1422
+ "kind": "Name",
1423
+ "value": "input"
1424
+ },
1425
+ "value": {
1426
+ "kind": "Variable",
1427
+ "name": {
1428
+ "kind": "Name",
1429
+ "value": "input"
1430
+ }
1431
+ }
1432
+ }],
1433
+ "selectionSet": {
1434
+ "kind": "SelectionSet",
1435
+ "selections": [{
1436
+ "kind": "Field",
1437
+ "name": {
1438
+ "kind": "Name",
1439
+ "value": "dataPoint"
1440
+ },
1441
+ "selectionSet": {
1442
+ "kind": "SelectionSet",
1443
+ "selections": [{
1444
+ "kind": "Field",
1445
+ "name": {
1446
+ "kind": "Name",
1447
+ "value": "id"
1448
+ }
1449
+ }, {
1450
+ "kind": "Field",
1451
+ "name": {
1452
+ "kind": "Name",
1453
+ "value": "name"
1454
+ }
1455
+ }]
1456
+ }
1457
+ }]
1458
+ }
1459
+ }]
1460
+ }
1461
+ }]
1462
+ },
1463
+ "\n mutation InventoryCreateProcessingPurposeSubCategory(\n $input: CreateProcessingPurposeCategoryInput!\n ) {\n createProcessingPurposeSubCategory(input: $input) {\n processingPurposeSubCategory {\n id\n name\n purpose\n description\n }\n }\n }\n": {
1464
+ "kind": "Document",
1465
+ "definitions": [{
1466
+ "kind": "OperationDefinition",
1467
+ "operation": "mutation",
1468
+ "name": {
1469
+ "kind": "Name",
1470
+ "value": "InventoryCreateProcessingPurposeSubCategory"
1471
+ },
1472
+ "variableDefinitions": [{
1473
+ "kind": "VariableDefinition",
1474
+ "variable": {
1475
+ "kind": "Variable",
1476
+ "name": {
1477
+ "kind": "Name",
1478
+ "value": "input"
1479
+ }
1480
+ },
1481
+ "type": {
1482
+ "kind": "NonNullType",
1483
+ "type": {
1484
+ "kind": "NamedType",
1485
+ "name": {
1486
+ "kind": "Name",
1487
+ "value": "CreateProcessingPurposeCategoryInput"
1488
+ }
1489
+ }
1490
+ }
1491
+ }],
1492
+ "selectionSet": {
1493
+ "kind": "SelectionSet",
1494
+ "selections": [{
1495
+ "kind": "Field",
1496
+ "name": {
1497
+ "kind": "Name",
1498
+ "value": "createProcessingPurposeSubCategory"
1499
+ },
1500
+ "arguments": [{
1501
+ "kind": "Argument",
1502
+ "name": {
1503
+ "kind": "Name",
1504
+ "value": "input"
1505
+ },
1506
+ "value": {
1507
+ "kind": "Variable",
1508
+ "name": {
1509
+ "kind": "Name",
1510
+ "value": "input"
1511
+ }
1512
+ }
1513
+ }],
1514
+ "selectionSet": {
1515
+ "kind": "SelectionSet",
1516
+ "selections": [{
1517
+ "kind": "Field",
1518
+ "name": {
1519
+ "kind": "Name",
1520
+ "value": "processingPurposeSubCategory"
1521
+ },
1522
+ "selectionSet": {
1523
+ "kind": "SelectionSet",
1524
+ "selections": [
1525
+ {
1526
+ "kind": "Field",
1527
+ "name": {
1528
+ "kind": "Name",
1529
+ "value": "id"
1530
+ }
1531
+ },
1532
+ {
1533
+ "kind": "Field",
1534
+ "name": {
1535
+ "kind": "Name",
1536
+ "value": "name"
1537
+ }
1538
+ },
1539
+ {
1540
+ "kind": "Field",
1541
+ "name": {
1542
+ "kind": "Name",
1543
+ "value": "purpose"
1544
+ }
1545
+ },
1546
+ {
1547
+ "kind": "Field",
1548
+ "name": {
1549
+ "kind": "Name",
1550
+ "value": "description"
1551
+ }
1552
+ }
1553
+ ]
1554
+ }
1555
+ }]
1556
+ }
1557
+ }]
1558
+ }
1559
+ }]
1560
+ },
1561
+ "\n mutation InventoryUpdateProcessingPurposeSubCategories(\n $input: UpdateProcessingPurposeSubCategoriesInput!\n ) {\n updateProcessingPurposeSubCategories(input: $input) {\n processingPurposeSubCategories {\n id\n name\n purpose\n description\n }\n }\n }\n": {
1562
+ "kind": "Document",
1563
+ "definitions": [{
1564
+ "kind": "OperationDefinition",
1565
+ "operation": "mutation",
1566
+ "name": {
1567
+ "kind": "Name",
1568
+ "value": "InventoryUpdateProcessingPurposeSubCategories"
1569
+ },
1570
+ "variableDefinitions": [{
1571
+ "kind": "VariableDefinition",
1572
+ "variable": {
1573
+ "kind": "Variable",
1574
+ "name": {
1575
+ "kind": "Name",
1576
+ "value": "input"
1577
+ }
1578
+ },
1579
+ "type": {
1580
+ "kind": "NonNullType",
1581
+ "type": {
1582
+ "kind": "NamedType",
1583
+ "name": {
1584
+ "kind": "Name",
1585
+ "value": "UpdateProcessingPurposeSubCategoriesInput"
1586
+ }
1587
+ }
1588
+ }
1589
+ }],
1590
+ "selectionSet": {
1591
+ "kind": "SelectionSet",
1592
+ "selections": [{
1593
+ "kind": "Field",
1594
+ "name": {
1595
+ "kind": "Name",
1596
+ "value": "updateProcessingPurposeSubCategories"
1597
+ },
1598
+ "arguments": [{
1599
+ "kind": "Argument",
1600
+ "name": {
1601
+ "kind": "Name",
1602
+ "value": "input"
1603
+ },
1604
+ "value": {
1605
+ "kind": "Variable",
1606
+ "name": {
1607
+ "kind": "Name",
1608
+ "value": "input"
1609
+ }
1610
+ }
1611
+ }],
1612
+ "selectionSet": {
1613
+ "kind": "SelectionSet",
1614
+ "selections": [{
1615
+ "kind": "Field",
1616
+ "name": {
1617
+ "kind": "Name",
1618
+ "value": "processingPurposeSubCategories"
1619
+ },
1620
+ "selectionSet": {
1621
+ "kind": "SelectionSet",
1622
+ "selections": [
1623
+ {
1624
+ "kind": "Field",
1625
+ "name": {
1626
+ "kind": "Name",
1627
+ "value": "id"
1628
+ }
1629
+ },
1630
+ {
1631
+ "kind": "Field",
1632
+ "name": {
1633
+ "kind": "Name",
1634
+ "value": "name"
1635
+ }
1636
+ },
1637
+ {
1638
+ "kind": "Field",
1639
+ "name": {
1640
+ "kind": "Name",
1641
+ "value": "purpose"
1642
+ }
1643
+ },
1644
+ {
1645
+ "kind": "Field",
1646
+ "name": {
1647
+ "kind": "Name",
1648
+ "value": "description"
1649
+ }
1650
+ }
1651
+ ]
1652
+ }
1653
+ }]
1654
+ }
1655
+ }]
1656
+ }
1657
+ }]
1658
+ },
1659
+ "\n mutation InventoryCreateVendor($input: CreateVendorInput!) {\n createVendor(input: $input) {\n vendor {\n id\n title\n description\n dataProcessingAgreementLink\n contactName\n contactEmail\n contactPhone\n websiteUrl\n address\n headquarterCountry\n headquarterSubDivision\n createdAt\n }\n }\n }\n": {
1660
+ "kind": "Document",
1661
+ "definitions": [{
1662
+ "kind": "OperationDefinition",
1663
+ "operation": "mutation",
1664
+ "name": {
1665
+ "kind": "Name",
1666
+ "value": "InventoryCreateVendor"
1667
+ },
1668
+ "variableDefinitions": [{
1669
+ "kind": "VariableDefinition",
1670
+ "variable": {
1671
+ "kind": "Variable",
1672
+ "name": {
1673
+ "kind": "Name",
1674
+ "value": "input"
1675
+ }
1676
+ },
1677
+ "type": {
1678
+ "kind": "NonNullType",
1679
+ "type": {
1680
+ "kind": "NamedType",
1681
+ "name": {
1682
+ "kind": "Name",
1683
+ "value": "CreateVendorInput"
1684
+ }
1685
+ }
1686
+ }
1687
+ }],
1688
+ "selectionSet": {
1689
+ "kind": "SelectionSet",
1690
+ "selections": [{
1691
+ "kind": "Field",
1692
+ "name": {
1693
+ "kind": "Name",
1694
+ "value": "createVendor"
1695
+ },
1696
+ "arguments": [{
1697
+ "kind": "Argument",
1698
+ "name": {
1699
+ "kind": "Name",
1700
+ "value": "input"
1701
+ },
1702
+ "value": {
1703
+ "kind": "Variable",
1704
+ "name": {
1705
+ "kind": "Name",
1706
+ "value": "input"
1707
+ }
1708
+ }
1709
+ }],
1710
+ "selectionSet": {
1711
+ "kind": "SelectionSet",
1712
+ "selections": [{
1713
+ "kind": "Field",
1714
+ "name": {
1715
+ "kind": "Name",
1716
+ "value": "vendor"
1717
+ },
1718
+ "selectionSet": {
1719
+ "kind": "SelectionSet",
1720
+ "selections": [
1721
+ {
1722
+ "kind": "Field",
1723
+ "name": {
1724
+ "kind": "Name",
1725
+ "value": "id"
1726
+ }
1727
+ },
1728
+ {
1729
+ "kind": "Field",
1730
+ "name": {
1731
+ "kind": "Name",
1732
+ "value": "title"
1733
+ }
1734
+ },
1735
+ {
1736
+ "kind": "Field",
1737
+ "name": {
1738
+ "kind": "Name",
1739
+ "value": "description"
1740
+ }
1741
+ },
1742
+ {
1743
+ "kind": "Field",
1744
+ "name": {
1745
+ "kind": "Name",
1746
+ "value": "dataProcessingAgreementLink"
1747
+ }
1748
+ },
1749
+ {
1750
+ "kind": "Field",
1751
+ "name": {
1752
+ "kind": "Name",
1753
+ "value": "contactName"
1754
+ }
1755
+ },
1756
+ {
1757
+ "kind": "Field",
1758
+ "name": {
1759
+ "kind": "Name",
1760
+ "value": "contactEmail"
1761
+ }
1762
+ },
1763
+ {
1764
+ "kind": "Field",
1765
+ "name": {
1766
+ "kind": "Name",
1767
+ "value": "contactPhone"
1768
+ }
1769
+ },
1770
+ {
1771
+ "kind": "Field",
1772
+ "name": {
1773
+ "kind": "Name",
1774
+ "value": "websiteUrl"
1775
+ }
1776
+ },
1777
+ {
1778
+ "kind": "Field",
1779
+ "name": {
1780
+ "kind": "Name",
1781
+ "value": "address"
1782
+ }
1783
+ },
1784
+ {
1785
+ "kind": "Field",
1786
+ "name": {
1787
+ "kind": "Name",
1788
+ "value": "headquarterCountry"
1789
+ }
1790
+ },
1791
+ {
1792
+ "kind": "Field",
1793
+ "name": {
1794
+ "kind": "Name",
1795
+ "value": "headquarterSubDivision"
1796
+ }
1797
+ },
1798
+ {
1799
+ "kind": "Field",
1800
+ "name": {
1801
+ "kind": "Name",
1802
+ "value": "createdAt"
1803
+ }
1804
+ }
1805
+ ]
1806
+ }
1807
+ }]
1808
+ }
1809
+ }]
1810
+ }
1811
+ }]
1812
+ },
1813
+ "\n mutation InventoryUpdateVendors($input: UpdateVendorsInput!) {\n updateVendors(input: $input) {\n vendors {\n id\n title\n description\n dataProcessingAgreementLink\n contactName\n contactEmail\n contactPhone\n websiteUrl\n address\n headquarterCountry\n headquarterSubDivision\n createdAt\n }\n }\n }\n": {
1814
+ "kind": "Document",
1815
+ "definitions": [{
1816
+ "kind": "OperationDefinition",
1817
+ "operation": "mutation",
1818
+ "name": {
1819
+ "kind": "Name",
1820
+ "value": "InventoryUpdateVendors"
1821
+ },
1822
+ "variableDefinitions": [{
1823
+ "kind": "VariableDefinition",
1824
+ "variable": {
1825
+ "kind": "Variable",
1826
+ "name": {
1827
+ "kind": "Name",
1828
+ "value": "input"
1829
+ }
1830
+ },
1831
+ "type": {
1832
+ "kind": "NonNullType",
1833
+ "type": {
1834
+ "kind": "NamedType",
1835
+ "name": {
1836
+ "kind": "Name",
1837
+ "value": "UpdateVendorsInput"
1838
+ }
1839
+ }
1840
+ }
1841
+ }],
1842
+ "selectionSet": {
1843
+ "kind": "SelectionSet",
1844
+ "selections": [{
1845
+ "kind": "Field",
1846
+ "name": {
1847
+ "kind": "Name",
1848
+ "value": "updateVendors"
1849
+ },
1850
+ "arguments": [{
1851
+ "kind": "Argument",
1852
+ "name": {
1853
+ "kind": "Name",
1854
+ "value": "input"
1855
+ },
1856
+ "value": {
1857
+ "kind": "Variable",
1858
+ "name": {
1859
+ "kind": "Name",
1860
+ "value": "input"
1861
+ }
1862
+ }
1863
+ }],
1864
+ "selectionSet": {
1865
+ "kind": "SelectionSet",
1866
+ "selections": [{
1867
+ "kind": "Field",
1868
+ "name": {
1869
+ "kind": "Name",
1870
+ "value": "vendors"
1871
+ },
1872
+ "selectionSet": {
1873
+ "kind": "SelectionSet",
1874
+ "selections": [
1875
+ {
1876
+ "kind": "Field",
1877
+ "name": {
1878
+ "kind": "Name",
1879
+ "value": "id"
1880
+ }
1881
+ },
1882
+ {
1883
+ "kind": "Field",
1884
+ "name": {
1885
+ "kind": "Name",
1886
+ "value": "title"
1887
+ }
1888
+ },
1889
+ {
1890
+ "kind": "Field",
1891
+ "name": {
1892
+ "kind": "Name",
1893
+ "value": "description"
1894
+ }
1895
+ },
1896
+ {
1897
+ "kind": "Field",
1898
+ "name": {
1899
+ "kind": "Name",
1900
+ "value": "dataProcessingAgreementLink"
1901
+ }
1902
+ },
1903
+ {
1904
+ "kind": "Field",
1905
+ "name": {
1906
+ "kind": "Name",
1907
+ "value": "contactName"
1908
+ }
1909
+ },
1910
+ {
1911
+ "kind": "Field",
1912
+ "name": {
1913
+ "kind": "Name",
1914
+ "value": "contactEmail"
1915
+ }
1916
+ },
1917
+ {
1918
+ "kind": "Field",
1919
+ "name": {
1920
+ "kind": "Name",
1921
+ "value": "contactPhone"
1922
+ }
1923
+ },
1924
+ {
1925
+ "kind": "Field",
1926
+ "name": {
1927
+ "kind": "Name",
1928
+ "value": "websiteUrl"
1929
+ }
1930
+ },
1931
+ {
1932
+ "kind": "Field",
1933
+ "name": {
1934
+ "kind": "Name",
1935
+ "value": "address"
1936
+ }
1937
+ },
1938
+ {
1939
+ "kind": "Field",
1940
+ "name": {
1941
+ "kind": "Name",
1942
+ "value": "headquarterCountry"
1943
+ }
1944
+ },
1945
+ {
1946
+ "kind": "Field",
1947
+ "name": {
1948
+ "kind": "Name",
1949
+ "value": "headquarterSubDivision"
1950
+ }
1951
+ },
1952
+ {
1953
+ "kind": "Field",
1954
+ "name": {
1955
+ "kind": "Name",
1956
+ "value": "createdAt"
1957
+ }
1958
+ }
1959
+ ]
1960
+ }
1961
+ }]
1962
+ }
1963
+ }]
1964
+ }
1965
+ }]
1966
+ }
1967
+ };
1968
+ function graphql(source) {
1969
+ return documents[source] ?? {};
1970
+ }
1971
+ //#endregion
1972
+ //#region src/graphql.ts
1973
+ /**
1974
+ * Normalize empty / whitespace subcategory names to
1975
+ * {@link DefaultPurposeSubCategoryType.Other} so read keys match write-tool defaults.
1976
+ */
1977
+ function normalizeSubCategoryName(name) {
1978
+ return name && name.trim() ? name : DefaultPurposeSubCategoryType.Other;
1979
+ }
1980
+ function mapDataPurpose(node) {
1981
+ return {
1982
+ id: node.id,
1983
+ name: normalizeSubCategoryName(node.name),
1984
+ purpose: node.purpose,
1985
+ description: node.description ?? void 0
1986
+ };
1987
+ }
1988
+ function mapDataCategory(node) {
1989
+ return {
1990
+ id: node.id ?? "",
1991
+ name: normalizeSubCategoryName(node.name),
1992
+ category: node.category,
1993
+ description: node.description ?? void 0
1994
+ };
1995
+ }
1996
+ function mapDataSubject(node) {
1997
+ const title = typeof node.title === "string" ? node.title : node.title?.defaultMessage ?? void 0;
1998
+ return {
1999
+ id: node.id,
2000
+ type: node.type,
2001
+ title,
2002
+ active: node.active ?? void 0
2003
+ };
2004
+ }
2005
+ const GetDataSiloDoc = graphql(`
2006
+ query InventoryGetDataSilo($id: String!) {
2007
+ dataSilo(id: $id) {
2008
+ id
2009
+ title
2010
+ type
2011
+ description
2012
+ link
2013
+ isLive
2014
+ outerType
2015
+ createdAt
2016
+ connectionState
2017
+ notes
2018
+ contactName
2019
+ contactEmail
2020
+ websiteUrl
2021
+ country
2022
+ countrySubDivision
2023
+ vendor {
2024
+ id
2025
+ title
2026
+ description
2027
+ contactName
2028
+ contactEmail
2029
+ websiteUrl
2030
+ dataProcessingAgreementLink
2031
+ }
2032
+ processingPurposeSubCategories {
2033
+ id
2034
+ name
2035
+ purpose
2036
+ description
2037
+ }
2038
+ owners {
2039
+ id
2040
+ email
2041
+ name
2042
+ }
2043
+ teams {
2044
+ id
2045
+ name
2046
+ }
2047
+ businessEntities {
2048
+ id
2049
+ title
2050
+ description
2051
+ }
2052
+ subjects {
2053
+ id
2054
+ type
2055
+ title {
2056
+ defaultMessage
2057
+ }
2058
+ }
2059
+ subjectBlocklist {
2060
+ id
2061
+ type
2062
+ title {
2063
+ defaultMessage
2064
+ }
2065
+ }
2066
+ identifiers {
2067
+ id
2068
+ name
2069
+ type
2070
+ isRequiredInForm
2071
+ }
2072
+ }
2073
+ }
2074
+ `);
2075
+ const CreateDataSilosDoc = graphql(`
2076
+ mutation InventoryCreateDataSilos($input: [CreateDataSilosInput!]!) {
2077
+ createDataSilos(input: $input) {
2078
+ dataSilos {
2079
+ id
2080
+ title
2081
+ type
2082
+ description
2083
+ isLive
2084
+ createdAt
2085
+ }
2086
+ }
2087
+ }
2088
+ `);
2089
+ const UpdateDataSilosDoc = graphql(`
2090
+ mutation InventoryUpdateDataSilos($input: UpdateDataSilosInput!) {
2091
+ updateDataSilos(input: $input) {
2092
+ dataSilos {
2093
+ id
2094
+ title
2095
+ type
2096
+ description
2097
+ isLive
2098
+ createdAt
2099
+ }
2100
+ }
2101
+ }
2102
+ `);
2103
+ const UpdateOrCreateDataPointDoc = graphql(`
2104
+ mutation InventoryUpdateOrCreateDataPoint($input: UpdateOrCreateDataPointInput!) {
2105
+ updateOrCreateDataPoint(input: $input) {
2106
+ dataPoint {
2107
+ id
2108
+ name
2109
+ }
2110
+ }
2111
+ }
2112
+ `);
2113
+ const CreateProcessingPurposeSubCategoryDoc = graphql(`
2114
+ mutation InventoryCreateProcessingPurposeSubCategory(
2115
+ $input: CreateProcessingPurposeCategoryInput!
2116
+ ) {
2117
+ createProcessingPurposeSubCategory(input: $input) {
2118
+ processingPurposeSubCategory {
2119
+ id
2120
+ name
2121
+ purpose
2122
+ description
2123
+ }
2124
+ }
2125
+ }
2126
+ `);
2127
+ const UpdateProcessingPurposeSubCategoriesDoc = graphql(`
2128
+ mutation InventoryUpdateProcessingPurposeSubCategories(
2129
+ $input: UpdateProcessingPurposeSubCategoriesInput!
2130
+ ) {
2131
+ updateProcessingPurposeSubCategories(input: $input) {
2132
+ processingPurposeSubCategories {
2133
+ id
2134
+ name
2135
+ purpose
2136
+ description
2137
+ }
2138
+ }
2139
+ }
2140
+ `);
2141
+ const CreateVendorDoc = graphql(`
2142
+ mutation InventoryCreateVendor($input: CreateVendorInput!) {
2143
+ createVendor(input: $input) {
2144
+ vendor {
2145
+ id
2146
+ title
2147
+ description
2148
+ dataProcessingAgreementLink
2149
+ contactName
2150
+ contactEmail
2151
+ contactPhone
2152
+ websiteUrl
2153
+ address
2154
+ headquarterCountry
2155
+ headquarterSubDivision
2156
+ createdAt
2157
+ }
2158
+ }
2159
+ }
2160
+ `);
2161
+ const UpdateVendorsDoc = graphql(`
2162
+ mutation InventoryUpdateVendors($input: UpdateVendorsInput!) {
2163
+ updateVendors(input: $input) {
2164
+ vendors {
2165
+ id
2166
+ title
2167
+ description
2168
+ dataProcessingAgreementLink
2169
+ contactName
2170
+ contactEmail
2171
+ contactPhone
2172
+ websiteUrl
2173
+ address
2174
+ headquarterCountry
2175
+ headquarterSubDivision
2176
+ createdAt
2177
+ }
2178
+ }
2179
+ }
2180
+ `);
2181
+ function mapDataSilo(node) {
2182
+ return {
2183
+ id: node.id,
2184
+ title: node.title,
2185
+ type: node.type,
2186
+ description: node.description ?? void 0,
2187
+ isLive: node.isLive,
2188
+ createdAt: node.createdAt
2189
+ };
2190
+ }
2191
+ function mapVendorPreview(node) {
2192
+ return {
2193
+ id: node.id,
2194
+ title: node.title,
2195
+ description: node.description ?? void 0,
2196
+ dataProcessingAgreementLink: node.dataProcessingAgreementLink ?? void 0,
2197
+ contactName: node.contactName ?? void 0,
2198
+ contactEmail: node.contactEmail ?? void 0,
2199
+ contactPhone: node.contactPhone ?? void 0,
2200
+ websiteUrl: node.websiteUrl ?? void 0,
2201
+ address: node.address ?? void 0,
2202
+ headquarterCountry: node.headquarterCountry ?? void 0,
2203
+ headquarterSubDivision: node.headquarterSubDivision ?? void 0,
2204
+ createdAt: node.createdAt ?? void 0
2205
+ };
2206
+ }
2207
+ /** Build a GraphQL filterBy object, omitting empty/undefined keys. */
2208
+ function buildFilterBy(parts) {
2209
+ const filterBy = {};
2210
+ for (const [key, value] of Object.entries(parts)) {
2211
+ if (value === void 0 || value === null || value === "") continue;
2212
+ if (Array.isArray(value) && value.length === 0) continue;
2213
+ filterBy[key] = value;
2214
+ }
2215
+ return Object.keys(filterBy).length > 0 ? filterBy : void 0;
2216
+ }
2217
+ var InventoryMixin = class extends TranscendGraphQLBase {
2218
+ async listDataSilos(options) {
2219
+ const { text, titles, ...listOptions } = options ?? {};
2220
+ const filterBy = buildFilterBy({
2221
+ text,
2222
+ titles
2223
+ });
2224
+ return this.listConnection(`
2225
+ query ListDataSilos($first: Int, $offset: Int, $filterBy: DataSiloFiltersInput) {
2226
+ dataSilos(first: $first, offset: $offset, filterBy: $filterBy) {
2227
+ nodes {
2228
+ id
2229
+ title
2230
+ type
2231
+ isLive
2232
+ outerType
2233
+ createdAt
2234
+ }
2235
+ totalCount
2236
+ }
2237
+ }
2238
+ `, "dataSilos", listOptions, { variables: filterBy ? { filterBy } : {} });
2239
+ }
2240
+ async getDataSilo(id) {
2241
+ const silo = (await this.makeRequest(GetDataSiloDoc, { id })).dataSilo;
2242
+ return {
2243
+ id: silo.id,
2244
+ title: silo.title,
2245
+ type: silo.type,
2246
+ description: silo.description ?? void 0,
2247
+ link: silo.link ?? void 0,
2248
+ isLive: silo.isLive,
2249
+ outerType: silo.outerType ?? void 0,
2250
+ createdAt: silo.createdAt,
2251
+ notes: silo.notes ?? void 0,
2252
+ contactName: silo.contactName ?? void 0,
2253
+ contactEmail: silo.contactEmail ?? void 0,
2254
+ websiteUrl: silo.websiteUrl ?? void 0,
2255
+ country: silo.country ?? void 0,
2256
+ countrySubDivision: silo.countrySubDivision ?? void 0,
2257
+ vendor: silo.vendor ? {
2258
+ id: silo.vendor.id,
2259
+ title: silo.vendor.title,
2260
+ description: silo.vendor.description ?? void 0,
2261
+ contactName: silo.vendor.contactName ?? void 0,
2262
+ contactEmail: silo.vendor.contactEmail ?? void 0,
2263
+ websiteUrl: silo.vendor.websiteUrl ?? void 0,
2264
+ dataProcessingAgreementLink: silo.vendor.dataProcessingAgreementLink ?? void 0
2265
+ } : void 0,
2266
+ processingPurposeSubCategories: silo.processingPurposeSubCategories?.map(mapDataPurpose),
2267
+ owners: silo.owners?.map((owner) => ({
2268
+ id: owner.id,
2269
+ email: owner.email,
2270
+ name: owner.name ?? void 0
2271
+ })),
2272
+ teams: silo.teams?.map((team) => ({
2273
+ id: team.id,
2274
+ name: team.name
2275
+ })),
2276
+ businessEntities: silo.businessEntities?.map((entity) => ({
2277
+ id: entity.id,
2278
+ title: entity.title,
2279
+ description: entity.description ?? void 0
2280
+ })),
2281
+ subjects: silo.subjects?.map(mapDataSubject),
2282
+ subjectBlocklist: silo.subjectBlocklist?.map(mapDataSubject),
2283
+ identifiers: silo.identifiers?.map((idf) => ({
2284
+ id: idf.id,
2285
+ name: idf.name,
2286
+ type: idf.type,
2287
+ isRequiredInForm: idf.isRequiredInForm ?? void 0
2288
+ }))
2289
+ };
2290
+ }
2291
+ async listCatalogs(options) {
2292
+ const { text, ...listOptions } = options ?? {};
2293
+ const filterBy = buildFilterBy({ text }) ?? {};
2294
+ return this.listConnection(`
2295
+ query ListCatalogs($first: Int, $offset: Int, $filterBy: CatalogFiltersInput!) {
2296
+ catalogs(first: $first, offset: $offset, filterBy: $filterBy) {
2297
+ nodes {
2298
+ integrationName
2299
+ title
2300
+ description
2301
+ hasApiFunctionality
2302
+ hasAvcFunctionality
2303
+ alreadyConnected
2304
+ integrationCategory
2305
+ }
2306
+ totalCount
2307
+ }
2308
+ }
2309
+ `, "catalogs", listOptions, {
2310
+ variables: { filterBy },
2311
+ mapNode: (node) => ({
2312
+ integrationName: node.integrationName,
2313
+ title: node.title,
2314
+ description: node.description ?? void 0,
2315
+ hasApiFunctionality: node.hasApiFunctionality,
2316
+ hasAvcFunctionality: node.hasAvcFunctionality,
2317
+ alreadyConnected: node.alreadyConnected,
2318
+ integrationCategory: node.integrationCategory ?? void 0
2319
+ })
2320
+ });
2321
+ }
2322
+ async createDataSilo(input) {
2323
+ const created = (await this.makeRequest(CreateDataSilosDoc, { input: [input] })).createDataSilos.dataSilos[0];
2324
+ if (!created) throw new Error("createDataSilos returned an empty array");
2325
+ return mapDataSilo(created);
2326
+ }
2327
+ async updateDataSilo(input) {
2328
+ const updated = (await this.makeRequest(UpdateDataSilosDoc, { input: { dataSilos: [input] } })).updateDataSilos.dataSilos[0];
2329
+ if (!updated) throw new Error("updateDataSilos returned an empty array");
2330
+ return mapDataSilo(updated);
2331
+ }
2332
+ async listVendors(options) {
2333
+ const { text, ...listOptions } = options ?? {};
2334
+ const filterBy = buildFilterBy({ text });
2335
+ return this.listConnection(`
2336
+ query ListVendors($first: Int, $offset: Int, $filterBy: VendorsFiltersInput) {
2337
+ vendors(first: $first, offset: $offset, filterBy: $filterBy) {
2338
+ nodes {
2339
+ id
2340
+ title
2341
+ description
2342
+ dataProcessingAgreementLink
2343
+ contactName
2344
+ contactEmail
2345
+ contactPhone
2346
+ websiteUrl
2347
+ address
2348
+ headquarterCountry
2349
+ headquarterSubDivision
2350
+ createdAt
2351
+ }
2352
+ totalCount
2353
+ }
2354
+ }
2355
+ `, "vendors", listOptions, {
2356
+ variables: filterBy ? { filterBy } : {},
2357
+ mapNode: mapVendorPreview
2358
+ });
2359
+ }
2360
+ async createVendor(input) {
2361
+ return mapVendorPreview((await this.makeRequest(CreateVendorDoc, { input })).createVendor.vendor);
2362
+ }
2363
+ async updateVendor(input) {
2364
+ const updated = (await this.makeRequest(UpdateVendorsDoc, { input: { vendors: [input] } })).updateVendors.vendors[0];
2365
+ if (!updated) throw new Error("updateVendors returned an empty array");
2366
+ return mapVendorPreview(updated);
2367
+ }
2368
+ /**
2369
+ * Upsert a vendor: update by id when provided, otherwise look up by title
2370
+ * and create if missing (CLI sync semantics).
2371
+ */
2372
+ async writeVendor(input) {
2373
+ const fields = {
2374
+ title: input.title,
2375
+ description: input.description,
2376
+ dataProcessingAgreementLink: input.dataProcessingAgreementLink,
2377
+ contactName: input.contactName,
2378
+ contactEmail: input.contactEmail,
2379
+ contactPhone: input.contactPhone,
2380
+ websiteUrl: input.websiteUrl,
2381
+ address: input.address,
2382
+ headquarterCountry: input.headquarterCountry,
2383
+ headquarterSubDivision: input.headquarterSubDivision
2384
+ };
2385
+ if (input.id) return {
2386
+ vendor: await this.updateVendor({
2387
+ id: input.id,
2388
+ ...fields
2389
+ }),
2390
+ created: false
2391
+ };
2392
+ if (!input.title) throw new Error("writeVendor requires `id` or `title`");
2393
+ const match = (await this.listVendors({ all: true })).nodes.find((v) => v.title === input.title);
2394
+ if (match) return {
2395
+ vendor: await this.updateVendor({
2396
+ id: match.id,
2397
+ ...fields
2398
+ }),
2399
+ created: false
2400
+ };
2401
+ return {
2402
+ vendor: await this.createVendor({
2403
+ title: input.title,
2404
+ description: input.description ?? "",
2405
+ dataProcessingAgreementLink: input.dataProcessingAgreementLink,
2406
+ contactName: input.contactName,
2407
+ contactEmail: input.contactEmail,
2408
+ contactPhone: input.contactPhone,
2409
+ websiteUrl: input.websiteUrl,
2410
+ address: input.address,
2411
+ headquarterCountry: input.headquarterCountry,
2412
+ headquarterSubDivision: input.headquarterSubDivision
2413
+ }),
2414
+ created: true
2415
+ };
2416
+ }
2417
+ async listDataPoints(dataSiloId, options) {
2418
+ const { text, ...listOptions } = options ?? {};
2419
+ const filterBy = buildFilterBy({
2420
+ dataSilos: dataSiloId ? [dataSiloId] : void 0,
2421
+ text
2422
+ });
2423
+ const query = `
2424
+ query ListDataPoints($first: Int, $offset: Int, $filterBy: DataPointFiltersInput) {
2425
+ dataPoints(first: $first, offset: $offset, filterBy: $filterBy) {
2426
+ nodes {
2427
+ id
2428
+ name
2429
+ dataSiloId
2430
+ title {
2431
+ defaultMessage
2432
+ }
2433
+ description {
2434
+ defaultMessage
2435
+ }
2436
+ }
2437
+ totalCount
2438
+ }
2439
+ }
2440
+ `;
2441
+ const toDataPoint = (dp) => ({
2442
+ id: dp.id,
2443
+ name: dp.name,
2444
+ dataSiloId: dp.dataSiloId,
2445
+ title: dp.title?.defaultMessage,
2446
+ description: dp.description?.defaultMessage
2447
+ });
2448
+ return this.listConnection(query, "dataPoints", listOptions, {
2449
+ variables: filterBy ? { filterBy } : {},
2450
+ mapNode: toDataPoint
2451
+ });
2452
+ }
2453
+ async listSubDataPoints(dataPointId, options) {
2454
+ return this.listConnection(`
2455
+ query ListSubDataPoints($first: Int, $offset: Int, $filterBy: SubDataPointFiltersInput) {
2456
+ subDataPoints(first: $first, offset: $offset, filterBy: $filterBy) {
2457
+ nodes {
2458
+ id
2459
+ name
2460
+ description
2461
+ accessRequestVisibilityEnabled
2462
+ categories {
2463
+ id
2464
+ name
2465
+ category
2466
+ }
2467
+ purposes {
2468
+ id
2469
+ name
2470
+ purpose
2471
+ description
2472
+ }
2473
+ }
2474
+ totalCount
2475
+ }
2476
+ }
2477
+ `, "subDataPoints", options, {
2478
+ variables: { filterBy: { dataPoints: [dataPointId] } },
2479
+ mapNode: (node) => ({
2480
+ id: node.id,
2481
+ name: node.name,
2482
+ description: node.description ?? void 0,
2483
+ accessRequestVisibilityEnabled: node.accessRequestVisibilityEnabled,
2484
+ categories: node.categories.map(mapDataCategory),
2485
+ purposes: node.purposes.map(mapDataPurpose)
2486
+ })
2487
+ });
2488
+ }
2489
+ async listBusinessEntities(options) {
2490
+ return this.listConnection(`
2491
+ query ListBusinessEntities($first: Int, $offset: Int) {
2492
+ businessEntities(first: $first, offset: $offset) {
2493
+ nodes {
2494
+ id
2495
+ title
2496
+ description
2497
+ }
2498
+ totalCount
2499
+ }
2500
+ }
2501
+ `, "businessEntities", options, { mapNode: (node) => ({
2502
+ id: node.id,
2503
+ title: node.title,
2504
+ description: node.description ?? void 0
2505
+ }) });
2506
+ }
2507
+ /**
2508
+ * List org data subject types. Not offset-paginated at the GraphQL layer —
2509
+ * returns the full `internalSubjects` set in one request.
2510
+ */
2511
+ async listDataSubjects() {
2512
+ const nodes = (await this.makeRequest(`
2513
+ query ListDataSubjects {
2514
+ internalSubjects {
2515
+ id
2516
+ type
2517
+ active
2518
+ title {
2519
+ defaultMessage
2520
+ }
2521
+ }
2522
+ }
2523
+ `)).internalSubjects.map(mapDataSubject);
2524
+ return {
2525
+ nodes,
2526
+ totalCount: nodes.length,
2527
+ pageInfo: {
2528
+ hasNextPage: false,
2529
+ hasPreviousPage: false
2530
+ }
2531
+ };
2532
+ }
2533
+ async updateOrCreateDataPoint(input) {
2534
+ return (await this.makeRequest(UpdateOrCreateDataPointDoc, { input })).updateOrCreateDataPoint.dataPoint;
2535
+ }
2536
+ async listProcessingPurposes(options) {
2537
+ const { text, ...listOptions } = options ?? {};
2538
+ const filterBy = buildFilterBy({ text });
2539
+ return this.listConnection(`
2540
+ query ListProcessingPurposes(
2541
+ $first: Int
2542
+ $offset: Int
2543
+ $filterBy: ProcessingPurposeCategoryFiltersInput
2544
+ ) {
2545
+ processingPurposeSubCategories(first: $first, offset: $offset, filterBy: $filterBy) {
2546
+ nodes {
2547
+ id
2548
+ name
2549
+ purpose
2550
+ description
2551
+ }
2552
+ totalCount
2553
+ }
2554
+ }
2555
+ `, "processingPurposeSubCategories", listOptions, {
2556
+ variables: filterBy ? { filterBy } : {},
2557
+ mapNode: mapDataPurpose
2558
+ });
2559
+ }
2560
+ async createProcessingPurpose(input) {
2561
+ const created = (await this.makeRequest(CreateProcessingPurposeSubCategoryDoc, { input })).createProcessingPurposeSubCategory.processingPurposeSubCategory;
2562
+ return mapDataPurpose(created);
2563
+ }
2564
+ async updateProcessingPurpose(input) {
2565
+ const updated = (await this.makeRequest(UpdateProcessingPurposeSubCategoriesDoc, { input: { processingPurposeSubCategories: [input] } })).updateProcessingPurposeSubCategories.processingPurposeSubCategories[0];
2566
+ if (!updated) throw new Error("updateProcessingPurposeSubCategories returned an empty array");
2567
+ return mapDataPurpose(updated);
2568
+ }
2569
+ /**
2570
+ * Upsert a processing purpose subcategory: update by id when provided,
2571
+ * otherwise look up by `name:purpose` and create if missing (CLI sync semantics).
2572
+ * Empty API names are treated as {@link DefaultPurposeSubCategoryType.Other} when matching.
2573
+ */
2574
+ async writeProcessingPurpose(input) {
2575
+ if (input.id) return {
2576
+ processingPurpose: await this.updateProcessingPurpose({
2577
+ id: input.id,
2578
+ name: input.name,
2579
+ purpose: input.purpose,
2580
+ description: input.description
2581
+ }),
2582
+ created: false
2583
+ };
2584
+ if (!input.name || !input.purpose) throw new Error("writeProcessingPurpose requires `id`, or both `name` and `purpose`");
2585
+ const wantedName = normalizeSubCategoryName(input.name);
2586
+ const match = (await this.listProcessingPurposes({ all: true })).nodes.find((p) => normalizeSubCategoryName(p.name) === wantedName && p.purpose === input.purpose);
2587
+ if (match) return {
2588
+ processingPurpose: await this.updateProcessingPurpose({
2589
+ id: match.id,
2590
+ name: input.name,
2591
+ purpose: input.purpose,
2592
+ description: input.description
2593
+ }),
2594
+ created: false
2595
+ };
2596
+ return {
2597
+ processingPurpose: await this.createProcessingPurpose({
2598
+ name: input.name,
2599
+ purpose: input.purpose,
2600
+ description: input.description
2601
+ }),
2602
+ created: true
2603
+ };
2604
+ }
2605
+ async listIdentifiers(options) {
2606
+ return this.listConnection(`
2607
+ query ListIdentifiers($first: Int, $offset: Int) {
2608
+ identifiers(first: $first, offset: $offset) {
2609
+ nodes {
2610
+ id
2611
+ name
2612
+ type
2613
+ isRequiredInForm
2614
+ }
2615
+ totalCount
2616
+ }
2617
+ }
2618
+ `, "identifiers", options);
2619
+ }
2620
+ async listDataCategories(options) {
2621
+ return this.listConnection(`
2622
+ query ListDataCategories($first: Int, $offset: Int) {
2623
+ dataCategories(first: $first, offset: $offset) {
2624
+ nodes {
2625
+ name
2626
+ category
2627
+ }
2628
+ totalCount
2629
+ }
2630
+ }
2631
+ `, "dataCategories", options);
2632
+ }
2633
+ };
2634
+ //#endregion
2635
+ export { ListBusinessEntitiesSchema as _, WriteProcessingPurposeSchema as a, ListVendorsSchema as c, ListIdentifiersSchema as d, ListDataSubjectsSchema as f, ListCatalogIntegrationsSchema as g, ListCategoriesSchema as h, WriteVendorSchema as i, ListSubDataPointsSchema as l, ListDataPointsSchema as m, INVENTORY_OAUTH_SCOPES as n, UpdateOrCreateDataPointSchema as o, ListDataSilosSchema as p, getInventoryTools as r, UpdateDataSiloSchema as s, InventoryMixin as t, ListProcessingPurposesSchema as u, GetDataSiloSchema as v, CreateDataSiloSchema as y };
2636
+
2637
+ //# sourceMappingURL=graphql-CVYenij2.mjs.map