@transcend-io/mcp-server-inventory 0.3.4 → 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,951 @@
1
+ import { EmptySchema, TranscendGraphQLBase, createListResult, createToolResult, defineTool, groupBy, z } from "@transcend-io/mcp-server-base";
2
+ import { 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({ title: z.string().describe("Name/title of the data silo (must match an integrationName in the Transcend catalog, e.g. \"Salesforce\", \"Stripe\")") });
63
+ function createInventoryCreateDataSiloTool(clients) {
64
+ const graphql = clients.graphql;
65
+ return defineTool({
66
+ name: "inventory_create_data_silo",
67
+ description: "Create a new data silo (data system or integration). The name must match an integration name from the Transcend catalog.",
68
+ category: "Data Inventory",
69
+ readOnly: false,
70
+ confirmationHint: "Creates a new data silo in the inventory",
71
+ annotations: {
72
+ readOnlyHint: false,
73
+ destructiveHint: true,
74
+ idempotentHint: false
75
+ },
76
+ zodSchema: CreateDataSiloSchema,
77
+ handler: async ({ title }) => {
78
+ return createToolResult(true, {
79
+ dataSilo: await graphql.createDataSilo({ name: title }),
80
+ message: `Data silo "${title}" created successfully`
81
+ });
82
+ }
83
+ });
84
+ }
85
+ //#endregion
86
+ //#region src/tools/inventory_get_data_silo.ts
87
+ const GetDataSiloSchema = z.object({ dataSiloId: z.string().describe("ID of the data silo to retrieve") });
88
+ function createInventoryGetDataSiloTool(clients) {
89
+ const graphql = clients.graphql;
90
+ return defineTool({
91
+ name: "inventory_get_data_silo",
92
+ description: "Get detailed information about a specific data silo including its data points and identifiers",
93
+ category: "Data Inventory",
94
+ readOnly: true,
95
+ annotations: {
96
+ readOnlyHint: true,
97
+ destructiveHint: false,
98
+ idempotentHint: true
99
+ },
100
+ zodSchema: GetDataSiloSchema,
101
+ handler: async ({ dataSiloId }) => {
102
+ return createToolResult(true, await graphql.getDataSilo(dataSiloId));
103
+ }
104
+ });
105
+ }
106
+ //#endregion
107
+ //#region src/tools/inventory_list_categories.ts
108
+ const ListCategoriesSchema = z.object({
109
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
110
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip for pagination (default: 0)")
111
+ });
112
+ function createInventoryListCategoriesTool(clients) {
113
+ const graphql = clients.graphql;
114
+ return defineTool({
115
+ name: "inventory_list_categories",
116
+ 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.",
117
+ category: "Data Inventory",
118
+ readOnly: true,
119
+ annotations: {
120
+ readOnlyHint: true,
121
+ destructiveHint: false,
122
+ idempotentHint: true
123
+ },
124
+ zodSchema: ListCategoriesSchema,
125
+ handler: async ({ limit, offset }) => {
126
+ const result = await graphql.listDataCategories({
127
+ first: limit,
128
+ offset
129
+ });
130
+ return createListResult(result.nodes, {
131
+ totalCount: result.totalCount,
132
+ hasNextPage: result.pageInfo?.hasNextPage
133
+ });
134
+ }
135
+ });
136
+ }
137
+ //#endregion
138
+ //#region src/tools/inventory_list_data_points.ts
139
+ const ListDataPointsSchema = z.object({
140
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
141
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip for pagination (default: 0)")
142
+ });
143
+ function createInventoryListDataPointsTool(clients) {
144
+ const graphql = clients.graphql;
145
+ return defineTool({
146
+ name: "inventory_list_data_points",
147
+ description: "List data points (collections of personal data). Paginate with `offset` (increment by `limit`) until `hasNextPage` is false; `totalCount` is the full count. Note: data_silo filtering is not supported.",
148
+ category: "Data Inventory",
149
+ readOnly: true,
150
+ annotations: {
151
+ readOnlyHint: true,
152
+ destructiveHint: false,
153
+ idempotentHint: true
154
+ },
155
+ zodSchema: ListDataPointsSchema,
156
+ handler: async ({ limit, offset }) => {
157
+ const result = await graphql.listDataPoints(void 0, {
158
+ first: limit,
159
+ offset
160
+ });
161
+ return createListResult(result.nodes, {
162
+ totalCount: result.totalCount,
163
+ hasNextPage: result.pageInfo?.hasNextPage
164
+ });
165
+ }
166
+ });
167
+ }
168
+ //#endregion
169
+ //#region src/tools/inventory_list_data_silos.ts
170
+ const ListDataSilosSchema = z.object({
171
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
172
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip for pagination (default: 0)")
173
+ });
174
+ function createInventoryListDataSilosTool(clients) {
175
+ const graphql = clients.graphql;
176
+ return defineTool({
177
+ name: "inventory_list_data_silos",
178
+ description: "List data silos (data systems and integrations) in your organization. Paginate with `offset` (increment by `limit`) until `hasNextPage` is false, `totalCount` is the full count.",
179
+ category: "Data Inventory",
180
+ readOnly: true,
181
+ annotations: {
182
+ readOnlyHint: true,
183
+ destructiveHint: false,
184
+ idempotentHint: true
185
+ },
186
+ zodSchema: ListDataSilosSchema,
187
+ handler: async ({ limit, offset }) => {
188
+ const result = await graphql.listDataSilos({
189
+ first: limit,
190
+ offset
191
+ });
192
+ return createListResult(result.nodes, {
193
+ totalCount: result.totalCount,
194
+ hasNextPage: result.pageInfo?.hasNextPage
195
+ });
196
+ }
197
+ });
198
+ }
199
+ //#endregion
200
+ //#region src/tools/inventory_list_identifiers.ts
201
+ const ListIdentifiersSchema = z.object({
202
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
203
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip for pagination (default: 0)")
204
+ });
205
+ function createInventoryListIdentifiersTool(clients) {
206
+ const graphql = clients.graphql;
207
+ return defineTool({
208
+ name: "inventory_list_identifiers",
209
+ 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.",
210
+ category: "Data Inventory",
211
+ readOnly: true,
212
+ annotations: {
213
+ readOnlyHint: true,
214
+ destructiveHint: false,
215
+ idempotentHint: true
216
+ },
217
+ zodSchema: ListIdentifiersSchema,
218
+ handler: async ({ limit, offset }) => {
219
+ const result = await graphql.listIdentifiers({
220
+ first: limit,
221
+ offset
222
+ });
223
+ return createListResult(result.nodes, {
224
+ totalCount: result.totalCount,
225
+ hasNextPage: result.pageInfo?.hasNextPage
226
+ });
227
+ }
228
+ });
229
+ }
230
+ //#endregion
231
+ //#region src/tools/inventory_list_sub_data_points.ts
232
+ const ListSubDataPointsSchema = z.object({
233
+ dataPointId: z.string().describe("ID of the parent data point"),
234
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
235
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip (default: 0)")
236
+ });
237
+ function createInventoryListSubDataPointsTool(clients) {
238
+ const graphql = clients.graphql;
239
+ return defineTool({
240
+ name: "inventory_list_sub_data_points",
241
+ description: "List sub-data points (individual data fields) for a specific data point. Note: This feature may have limited availability.",
242
+ category: "Data Inventory",
243
+ readOnly: true,
244
+ annotations: {
245
+ readOnlyHint: true,
246
+ destructiveHint: false,
247
+ idempotentHint: true
248
+ },
249
+ zodSchema: ListSubDataPointsSchema,
250
+ handler: async ({ dataPointId, limit, offset }) => {
251
+ const result = await graphql.listSubDataPoints(dataPointId, {
252
+ first: limit,
253
+ offset
254
+ });
255
+ return createListResult(result.nodes, {
256
+ totalCount: result.totalCount,
257
+ hasNextPage: result.pageInfo?.hasNextPage
258
+ });
259
+ }
260
+ });
261
+ }
262
+ //#endregion
263
+ //#region src/tools/inventory_list_vendors.ts
264
+ const ListVendorsSchema = z.object({
265
+ limit: z.coerce.number().min(1).max(100).optional().default(50).describe("Results per page (1-100, default: 50)"),
266
+ offset: z.coerce.number().min(0).optional().default(0).describe("Number of results to skip for pagination (default: 0)")
267
+ });
268
+ function createInventoryListVendorsTool(clients) {
269
+ const graphql = clients.graphql;
270
+ return defineTool({
271
+ name: "inventory_list_vendors",
272
+ description: "List vendors (third-party data processors) in your organization. Paginate with `offset` (increment by `limit`) until `hasNextPage` is false; `totalCount` is the full count.",
273
+ category: "Data Inventory",
274
+ readOnly: true,
275
+ annotations: {
276
+ readOnlyHint: true,
277
+ destructiveHint: false,
278
+ idempotentHint: true
279
+ },
280
+ zodSchema: ListVendorsSchema,
281
+ handler: async ({ limit, offset }) => {
282
+ const result = await graphql.listVendors({
283
+ first: limit,
284
+ offset
285
+ });
286
+ return createListResult(result.nodes, {
287
+ totalCount: result.totalCount,
288
+ hasNextPage: result.pageInfo?.hasNextPage
289
+ });
290
+ }
291
+ });
292
+ }
293
+ //#endregion
294
+ //#region src/tools/inventory_update_data_silo.ts
295
+ const UpdateDataSiloSchema = z.object({
296
+ dataSiloId: z.string().describe("ID of the data silo to update"),
297
+ title: z.string().optional().describe("New title for the data silo"),
298
+ description: z.string().optional().describe("New description")
299
+ });
300
+ function createInventoryUpdateDataSiloTool(clients) {
301
+ const graphql = clients.graphql;
302
+ return defineTool({
303
+ name: "inventory_update_data_silo",
304
+ description: "Update an existing data silo",
305
+ category: "Data Inventory",
306
+ readOnly: false,
307
+ confirmationHint: "Updates the data silo configuration",
308
+ annotations: {
309
+ readOnlyHint: false,
310
+ destructiveHint: false,
311
+ idempotentHint: true
312
+ },
313
+ zodSchema: UpdateDataSiloSchema,
314
+ handler: async ({ dataSiloId, title, description }) => {
315
+ return createToolResult(true, {
316
+ dataSilo: await graphql.updateDataSilo({
317
+ id: dataSiloId,
318
+ title,
319
+ description
320
+ }),
321
+ message: "Data silo updated successfully"
322
+ });
323
+ }
324
+ });
325
+ }
326
+ //#endregion
327
+ //#region src/tools/index.ts
328
+ function getInventoryTools(clients) {
329
+ return [
330
+ createInventoryListDataSilosTool(clients),
331
+ createInventoryGetDataSiloTool(clients),
332
+ createInventoryCreateDataSiloTool(clients),
333
+ createInventoryUpdateDataSiloTool(clients),
334
+ createInventoryListVendorsTool(clients),
335
+ createInventoryListDataPointsTool(clients),
336
+ createInventoryListSubDataPointsTool(clients),
337
+ createInventoryListIdentifiersTool(clients),
338
+ createInventoryListCategoriesTool(clients),
339
+ createInventoryAnalyzeTool(clients)
340
+ ];
341
+ }
342
+ //#endregion
343
+ //#region src/scopes.ts
344
+ /** OAuth scopes required for Inventory MCP tools (offline_access added by base). */
345
+ const INVENTORY_OAUTH_SCOPES = [
346
+ ScopeName.ViewDataMap,
347
+ ScopeName.ViewAssignedIntegrations,
348
+ ScopeName.ManageDataMap,
349
+ ScopeName.ManageAssignedIntegrations,
350
+ ScopeName.ViewDataInventory,
351
+ ScopeName.ViewAssignedDataInventory,
352
+ ScopeName.ManageDataInventory,
353
+ ScopeName.ManageAssignedDataInventory
354
+ ];
355
+ //#endregion
356
+ //#region src/__generated__/gql.ts
357
+ const documents = {
358
+ "\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 identifiers {\n id\n name\n type\n isRequiredInForm\n }\n }\n }\n": {
359
+ "kind": "Document",
360
+ "definitions": [{
361
+ "kind": "OperationDefinition",
362
+ "operation": "query",
363
+ "name": {
364
+ "kind": "Name",
365
+ "value": "InventoryGetDataSilo"
366
+ },
367
+ "variableDefinitions": [{
368
+ "kind": "VariableDefinition",
369
+ "variable": {
370
+ "kind": "Variable",
371
+ "name": {
372
+ "kind": "Name",
373
+ "value": "id"
374
+ }
375
+ },
376
+ "type": {
377
+ "kind": "NonNullType",
378
+ "type": {
379
+ "kind": "NamedType",
380
+ "name": {
381
+ "kind": "Name",
382
+ "value": "String"
383
+ }
384
+ }
385
+ }
386
+ }],
387
+ "selectionSet": {
388
+ "kind": "SelectionSet",
389
+ "selections": [{
390
+ "kind": "Field",
391
+ "name": {
392
+ "kind": "Name",
393
+ "value": "dataSilo"
394
+ },
395
+ "arguments": [{
396
+ "kind": "Argument",
397
+ "name": {
398
+ "kind": "Name",
399
+ "value": "id"
400
+ },
401
+ "value": {
402
+ "kind": "Variable",
403
+ "name": {
404
+ "kind": "Name",
405
+ "value": "id"
406
+ }
407
+ }
408
+ }],
409
+ "selectionSet": {
410
+ "kind": "SelectionSet",
411
+ "selections": [
412
+ {
413
+ "kind": "Field",
414
+ "name": {
415
+ "kind": "Name",
416
+ "value": "id"
417
+ }
418
+ },
419
+ {
420
+ "kind": "Field",
421
+ "name": {
422
+ "kind": "Name",
423
+ "value": "title"
424
+ }
425
+ },
426
+ {
427
+ "kind": "Field",
428
+ "name": {
429
+ "kind": "Name",
430
+ "value": "type"
431
+ }
432
+ },
433
+ {
434
+ "kind": "Field",
435
+ "name": {
436
+ "kind": "Name",
437
+ "value": "description"
438
+ }
439
+ },
440
+ {
441
+ "kind": "Field",
442
+ "name": {
443
+ "kind": "Name",
444
+ "value": "link"
445
+ }
446
+ },
447
+ {
448
+ "kind": "Field",
449
+ "name": {
450
+ "kind": "Name",
451
+ "value": "isLive"
452
+ }
453
+ },
454
+ {
455
+ "kind": "Field",
456
+ "name": {
457
+ "kind": "Name",
458
+ "value": "outerType"
459
+ }
460
+ },
461
+ {
462
+ "kind": "Field",
463
+ "name": {
464
+ "kind": "Name",
465
+ "value": "createdAt"
466
+ }
467
+ },
468
+ {
469
+ "kind": "Field",
470
+ "name": {
471
+ "kind": "Name",
472
+ "value": "connectionState"
473
+ }
474
+ },
475
+ {
476
+ "kind": "Field",
477
+ "name": {
478
+ "kind": "Name",
479
+ "value": "identifiers"
480
+ },
481
+ "selectionSet": {
482
+ "kind": "SelectionSet",
483
+ "selections": [
484
+ {
485
+ "kind": "Field",
486
+ "name": {
487
+ "kind": "Name",
488
+ "value": "id"
489
+ }
490
+ },
491
+ {
492
+ "kind": "Field",
493
+ "name": {
494
+ "kind": "Name",
495
+ "value": "name"
496
+ }
497
+ },
498
+ {
499
+ "kind": "Field",
500
+ "name": {
501
+ "kind": "Name",
502
+ "value": "type"
503
+ }
504
+ },
505
+ {
506
+ "kind": "Field",
507
+ "name": {
508
+ "kind": "Name",
509
+ "value": "isRequiredInForm"
510
+ }
511
+ }
512
+ ]
513
+ }
514
+ }
515
+ ]
516
+ }
517
+ }]
518
+ }
519
+ }]
520
+ },
521
+ "\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": {
522
+ "kind": "Document",
523
+ "definitions": [{
524
+ "kind": "OperationDefinition",
525
+ "operation": "mutation",
526
+ "name": {
527
+ "kind": "Name",
528
+ "value": "InventoryCreateDataSilos"
529
+ },
530
+ "variableDefinitions": [{
531
+ "kind": "VariableDefinition",
532
+ "variable": {
533
+ "kind": "Variable",
534
+ "name": {
535
+ "kind": "Name",
536
+ "value": "input"
537
+ }
538
+ },
539
+ "type": {
540
+ "kind": "NonNullType",
541
+ "type": {
542
+ "kind": "ListType",
543
+ "type": {
544
+ "kind": "NonNullType",
545
+ "type": {
546
+ "kind": "NamedType",
547
+ "name": {
548
+ "kind": "Name",
549
+ "value": "CreateDataSilosInput"
550
+ }
551
+ }
552
+ }
553
+ }
554
+ }
555
+ }],
556
+ "selectionSet": {
557
+ "kind": "SelectionSet",
558
+ "selections": [{
559
+ "kind": "Field",
560
+ "name": {
561
+ "kind": "Name",
562
+ "value": "createDataSilos"
563
+ },
564
+ "arguments": [{
565
+ "kind": "Argument",
566
+ "name": {
567
+ "kind": "Name",
568
+ "value": "input"
569
+ },
570
+ "value": {
571
+ "kind": "Variable",
572
+ "name": {
573
+ "kind": "Name",
574
+ "value": "input"
575
+ }
576
+ }
577
+ }],
578
+ "selectionSet": {
579
+ "kind": "SelectionSet",
580
+ "selections": [{
581
+ "kind": "Field",
582
+ "name": {
583
+ "kind": "Name",
584
+ "value": "dataSilos"
585
+ },
586
+ "selectionSet": {
587
+ "kind": "SelectionSet",
588
+ "selections": [
589
+ {
590
+ "kind": "Field",
591
+ "name": {
592
+ "kind": "Name",
593
+ "value": "id"
594
+ }
595
+ },
596
+ {
597
+ "kind": "Field",
598
+ "name": {
599
+ "kind": "Name",
600
+ "value": "title"
601
+ }
602
+ },
603
+ {
604
+ "kind": "Field",
605
+ "name": {
606
+ "kind": "Name",
607
+ "value": "type"
608
+ }
609
+ },
610
+ {
611
+ "kind": "Field",
612
+ "name": {
613
+ "kind": "Name",
614
+ "value": "description"
615
+ }
616
+ },
617
+ {
618
+ "kind": "Field",
619
+ "name": {
620
+ "kind": "Name",
621
+ "value": "isLive"
622
+ }
623
+ },
624
+ {
625
+ "kind": "Field",
626
+ "name": {
627
+ "kind": "Name",
628
+ "value": "createdAt"
629
+ }
630
+ }
631
+ ]
632
+ }
633
+ }]
634
+ }
635
+ }]
636
+ }
637
+ }]
638
+ },
639
+ "\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": {
640
+ "kind": "Document",
641
+ "definitions": [{
642
+ "kind": "OperationDefinition",
643
+ "operation": "mutation",
644
+ "name": {
645
+ "kind": "Name",
646
+ "value": "InventoryUpdateDataSilos"
647
+ },
648
+ "variableDefinitions": [{
649
+ "kind": "VariableDefinition",
650
+ "variable": {
651
+ "kind": "Variable",
652
+ "name": {
653
+ "kind": "Name",
654
+ "value": "input"
655
+ }
656
+ },
657
+ "type": {
658
+ "kind": "NonNullType",
659
+ "type": {
660
+ "kind": "NamedType",
661
+ "name": {
662
+ "kind": "Name",
663
+ "value": "UpdateDataSilosInput"
664
+ }
665
+ }
666
+ }
667
+ }],
668
+ "selectionSet": {
669
+ "kind": "SelectionSet",
670
+ "selections": [{
671
+ "kind": "Field",
672
+ "name": {
673
+ "kind": "Name",
674
+ "value": "updateDataSilos"
675
+ },
676
+ "arguments": [{
677
+ "kind": "Argument",
678
+ "name": {
679
+ "kind": "Name",
680
+ "value": "input"
681
+ },
682
+ "value": {
683
+ "kind": "Variable",
684
+ "name": {
685
+ "kind": "Name",
686
+ "value": "input"
687
+ }
688
+ }
689
+ }],
690
+ "selectionSet": {
691
+ "kind": "SelectionSet",
692
+ "selections": [{
693
+ "kind": "Field",
694
+ "name": {
695
+ "kind": "Name",
696
+ "value": "dataSilos"
697
+ },
698
+ "selectionSet": {
699
+ "kind": "SelectionSet",
700
+ "selections": [
701
+ {
702
+ "kind": "Field",
703
+ "name": {
704
+ "kind": "Name",
705
+ "value": "id"
706
+ }
707
+ },
708
+ {
709
+ "kind": "Field",
710
+ "name": {
711
+ "kind": "Name",
712
+ "value": "title"
713
+ }
714
+ },
715
+ {
716
+ "kind": "Field",
717
+ "name": {
718
+ "kind": "Name",
719
+ "value": "type"
720
+ }
721
+ },
722
+ {
723
+ "kind": "Field",
724
+ "name": {
725
+ "kind": "Name",
726
+ "value": "description"
727
+ }
728
+ },
729
+ {
730
+ "kind": "Field",
731
+ "name": {
732
+ "kind": "Name",
733
+ "value": "isLive"
734
+ }
735
+ },
736
+ {
737
+ "kind": "Field",
738
+ "name": {
739
+ "kind": "Name",
740
+ "value": "createdAt"
741
+ }
742
+ }
743
+ ]
744
+ }
745
+ }]
746
+ }
747
+ }]
748
+ }
749
+ }]
750
+ }
751
+ };
752
+ function graphql(source) {
753
+ return documents[source] ?? {};
754
+ }
755
+ //#endregion
756
+ //#region src/graphql.ts
757
+ const GetDataSiloDoc = graphql(`
758
+ query InventoryGetDataSilo($id: String!) {
759
+ dataSilo(id: $id) {
760
+ id
761
+ title
762
+ type
763
+ description
764
+ link
765
+ isLive
766
+ outerType
767
+ createdAt
768
+ connectionState
769
+ identifiers {
770
+ id
771
+ name
772
+ type
773
+ isRequiredInForm
774
+ }
775
+ }
776
+ }
777
+ `);
778
+ const CreateDataSilosDoc = graphql(`
779
+ mutation InventoryCreateDataSilos($input: [CreateDataSilosInput!]!) {
780
+ createDataSilos(input: $input) {
781
+ dataSilos {
782
+ id
783
+ title
784
+ type
785
+ description
786
+ isLive
787
+ createdAt
788
+ }
789
+ }
790
+ }
791
+ `);
792
+ const UpdateDataSilosDoc = graphql(`
793
+ mutation InventoryUpdateDataSilos($input: UpdateDataSilosInput!) {
794
+ updateDataSilos(input: $input) {
795
+ dataSilos {
796
+ id
797
+ title
798
+ type
799
+ description
800
+ isLive
801
+ createdAt
802
+ }
803
+ }
804
+ }
805
+ `);
806
+ function mapDataSilo(node) {
807
+ return {
808
+ id: node.id,
809
+ title: node.title,
810
+ type: node.type,
811
+ description: node.description ?? void 0,
812
+ isLive: node.isLive,
813
+ createdAt: node.createdAt
814
+ };
815
+ }
816
+ var InventoryMixin = class extends TranscendGraphQLBase {
817
+ async listDataSilos(options) {
818
+ return this.listConnection(`
819
+ query ListDataSilos($first: Int, $offset: Int) {
820
+ dataSilos(first: $first, offset: $offset) {
821
+ nodes {
822
+ id
823
+ title
824
+ type
825
+ isLive
826
+ outerType
827
+ createdAt
828
+ }
829
+ totalCount
830
+ }
831
+ }
832
+ `, "dataSilos", options);
833
+ }
834
+ async getDataSilo(id) {
835
+ const silo = (await this.makeRequest(GetDataSiloDoc, { id })).dataSilo;
836
+ return {
837
+ id: silo.id,
838
+ title: silo.title,
839
+ type: silo.type,
840
+ description: silo.description ?? void 0,
841
+ link: silo.link ?? void 0,
842
+ isLive: silo.isLive,
843
+ outerType: silo.outerType ?? void 0,
844
+ createdAt: silo.createdAt,
845
+ identifiers: silo.identifiers?.map((idf) => ({
846
+ id: idf.id,
847
+ name: idf.name,
848
+ type: idf.type,
849
+ isRequiredInForm: idf.isRequiredInForm ?? void 0
850
+ }))
851
+ };
852
+ }
853
+ async createDataSilo(input) {
854
+ const created = (await this.makeRequest(CreateDataSilosDoc, { input: [input] })).createDataSilos.dataSilos[0];
855
+ if (!created) throw new Error("createDataSilos returned an empty array");
856
+ return mapDataSilo(created);
857
+ }
858
+ async updateDataSilo(input) {
859
+ const updated = (await this.makeRequest(UpdateDataSilosDoc, { input: { dataSilos: [input] } })).updateDataSilos.dataSilos[0];
860
+ if (!updated) throw new Error("updateDataSilos returned an empty array");
861
+ return mapDataSilo(updated);
862
+ }
863
+ async listVendors(options) {
864
+ return this.listConnection(`
865
+ query ListVendors($first: Int, $offset: Int) {
866
+ vendors(first: $first, offset: $offset) {
867
+ nodes {
868
+ id
869
+ title
870
+ }
871
+ totalCount
872
+ }
873
+ }
874
+ `, "vendors", options);
875
+ }
876
+ async listDataPoints(_dataSiloId, options) {
877
+ const query = `
878
+ query ListDataPoints($first: Int, $offset: Int) {
879
+ dataPoints(first: $first, offset: $offset) {
880
+ nodes {
881
+ id
882
+ name
883
+ title {
884
+ defaultMessage
885
+ }
886
+ description {
887
+ defaultMessage
888
+ }
889
+ }
890
+ totalCount
891
+ }
892
+ }
893
+ `;
894
+ const toDataPoint = (dp) => ({
895
+ id: dp.id,
896
+ name: dp.name,
897
+ title: dp.title?.defaultMessage,
898
+ description: dp.description?.defaultMessage,
899
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
900
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
901
+ });
902
+ return this.listConnection(query, "dataPoints", options, { mapNode: toDataPoint });
903
+ }
904
+ async listSubDataPoints(dataPointId, options) {
905
+ return this.listConnection(`
906
+ query ListSubDataPoints($first: Int, $offset: Int, $filterBy: SubDataPointFiltersInput) {
907
+ subDataPoints(first: $first, offset: $offset, filterBy: $filterBy) {
908
+ nodes {
909
+ id
910
+ name
911
+ description
912
+ accessRequestVisibilityEnabled
913
+ }
914
+ totalCount
915
+ }
916
+ }
917
+ `, "subDataPoints", options, { variables: { filterBy: { dataPoints: [dataPointId] } } });
918
+ }
919
+ async listIdentifiers(options) {
920
+ return this.listConnection(`
921
+ query ListIdentifiers($first: Int, $offset: Int) {
922
+ identifiers(first: $first, offset: $offset) {
923
+ nodes {
924
+ id
925
+ name
926
+ type
927
+ isRequiredInForm
928
+ }
929
+ totalCount
930
+ }
931
+ }
932
+ `, "identifiers", options);
933
+ }
934
+ async listDataCategories(options) {
935
+ return this.listConnection(`
936
+ query ListDataCategories($first: Int, $offset: Int) {
937
+ dataCategories(first: $first, offset: $offset) {
938
+ nodes {
939
+ name
940
+ category
941
+ }
942
+ totalCount
943
+ }
944
+ }
945
+ `, "dataCategories", options);
946
+ }
947
+ };
948
+ //#endregion
949
+ export { ListVendorsSchema as a, ListDataSilosSchema as c, GetDataSiloSchema as d, CreateDataSiloSchema as f, UpdateDataSiloSchema as i, ListDataPointsSchema as l, INVENTORY_OAUTH_SCOPES as n, ListSubDataPointsSchema as o, getInventoryTools as r, ListIdentifiersSchema as s, InventoryMixin as t, ListCategoriesSchema as u };
950
+
951
+ //# sourceMappingURL=graphql-BJIrpomr.mjs.map