@transcend-io/cli 4.74.0 → 4.75.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.
- package/README.md +112 -7
- package/build/cli-consent-managers-to-business-entities.js +1 -1
- package/build/cli-consent-managers-to-business-entities.js.map +1 -1
- package/build/cli-derive-data-silos-from-data-flows-cross-instance.d.ts +3 -0
- package/build/cli-derive-data-silos-from-data-flows-cross-instance.d.ts.map +1 -0
- package/build/cli-derive-data-silos-from-data-flows-cross-instance.js +148 -0
- package/build/cli-derive-data-silos-from-data-flows-cross-instance.js.map +1 -0
- package/build/cli-derive-data-silos-from-data-flows.d.ts +3 -0
- package/build/cli-derive-data-silos-from-data-flows.d.ts.map +1 -0
- package/build/cli-derive-data-silos-from-data-flows.js +88 -0
- package/build/cli-derive-data-silos-from-data-flows.js.map +1 -0
- package/build/consent-manager/dataFlowsToDataSilos.d.ts +19 -0
- package/build/consent-manager/dataFlowsToDataSilos.d.ts.map +1 -0
- package/build/consent-manager/dataFlowsToDataSilos.js +95 -0
- package/build/consent-manager/dataFlowsToDataSilos.js.map +1 -0
- package/build/graphql/fetchCatalogs.d.ts +20 -0
- package/build/graphql/fetchCatalogs.d.ts.map +1 -1
- package/build/graphql/fetchCatalogs.js +23 -1
- package/build/graphql/fetchCatalogs.js.map +1 -1
- package/build/tsbuildinfo +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -77,26 +77,34 @@
|
|
|
77
77
|
- [Authentication](#authentication-16)
|
|
78
78
|
- [Arguments](#arguments-16)
|
|
79
79
|
- [Usage](#usage-17)
|
|
80
|
-
- [tr-
|
|
80
|
+
- [tr-derive-data-silos-from-data-flows](#tr-derive-data-silos-from-data-flows)
|
|
81
81
|
- [Authentication](#authentication-17)
|
|
82
82
|
- [Arguments](#arguments-17)
|
|
83
83
|
- [Usage](#usage-18)
|
|
84
|
-
- [tr-
|
|
84
|
+
- [tr-derive-data-silos-from-data-flows-cross-instance](#tr-derive-data-silos-from-data-flows-cross-instance)
|
|
85
85
|
- [Authentication](#authentication-18)
|
|
86
86
|
- [Arguments](#arguments-18)
|
|
87
87
|
- [Usage](#usage-19)
|
|
88
|
-
- [tr-
|
|
88
|
+
- [tr-pull-consent-metrics](#tr-pull-consent-metrics)
|
|
89
89
|
- [Authentication](#authentication-19)
|
|
90
90
|
- [Arguments](#arguments-19)
|
|
91
91
|
- [Usage](#usage-20)
|
|
92
|
-
- [tr-
|
|
92
|
+
- [tr-upload-data-flows-from-csv](#tr-upload-data-flows-from-csv)
|
|
93
93
|
- [Authentication](#authentication-20)
|
|
94
94
|
- [Arguments](#arguments-20)
|
|
95
95
|
- [Usage](#usage-21)
|
|
96
|
-
- [tr-
|
|
96
|
+
- [tr-upload-cookies-from-csv](#tr-upload-cookies-from-csv)
|
|
97
97
|
- [Authentication](#authentication-21)
|
|
98
98
|
- [Arguments](#arguments-21)
|
|
99
99
|
- [Usage](#usage-22)
|
|
100
|
+
- [tr-generate-api-keys](#tr-generate-api-keys)
|
|
101
|
+
- [Authentication](#authentication-22)
|
|
102
|
+
- [Arguments](#arguments-22)
|
|
103
|
+
- [Usage](#usage-23)
|
|
104
|
+
- [tr-build-xdi-sync-endpoint](#tr-build-xdi-sync-endpoint)
|
|
105
|
+
- [Authentication](#authentication-23)
|
|
106
|
+
- [Arguments](#arguments-23)
|
|
107
|
+
- [Usage](#usage-24)
|
|
100
108
|
- [Proxy usage](#proxy-usage)
|
|
101
109
|
|
|
102
110
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
@@ -131,7 +139,9 @@ yarn tr-mark-request-data-silos-completed --auth=$TRANSCEND_API_KEY
|
|
|
131
139
|
yarn tr-skip-request-data-silos --auth=$TRANSCEND_API_KEY
|
|
132
140
|
yarn tr-retry-request-data-silos --auth=$TRANSCEND_API_KEY
|
|
133
141
|
yarn tr-update-consent-manager --auth=$TRANSCEND_API_KEY
|
|
134
|
-
yarn tr-consent-managers-to-business-entities
|
|
142
|
+
yarn tr-consent-managers-to-business-entities
|
|
143
|
+
yarn tr-derive-data-silos-from-data-flows --auth=$TRANSCEND_API_KEY
|
|
144
|
+
yarn tr-derive-data-silos-from-data-flows-cross-instance --auth=$TRANSCEND_API_KEY
|
|
135
145
|
yarn tr-pull-consent-metrics --auth=$TRANSCEND_API_KEY
|
|
136
146
|
yarn tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY
|
|
137
147
|
yarn tr-upload-cookies-from-csv --auth=$TRANSCEND_API_KEY
|
|
@@ -162,7 +172,9 @@ tr-skip-request-data-silos --auth=$TRANSCEND_API_KEY
|
|
|
162
172
|
tr-retry-request-data-silos --auth=$TRANSCEND_API_KEY
|
|
163
173
|
tr-update-consent-manager --auth=$TRANSCEND_API_KEY
|
|
164
174
|
tr-pull-consent-metrics --auth=$TRANSCEND_API_KEY
|
|
165
|
-
tr-consent-managers-to-business-entities
|
|
175
|
+
tr-consent-managers-to-business-entities
|
|
176
|
+
tr-derive-data-silos-from-data-flows --auth=$TRANSCEND_API_KEY
|
|
177
|
+
tr-derive-data-silos-from-data-flows-cross-instance --auth=$TRANSCEND_API_KEY
|
|
166
178
|
tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY
|
|
167
179
|
tr-generate-api-keys --auth=$TRANSCEND_API_KEY
|
|
168
180
|
tr-build-xdi-sync-endpoint --auth=$TRANSCEND_API_KEY
|
|
@@ -1497,6 +1509,99 @@ Specify custom output file
|
|
|
1497
1509
|
yarn tr-consent-managers-to-business-entities --consentManagerYmlFolder=./working/consent-managers/ --output=./custom.yml
|
|
1498
1510
|
```
|
|
1499
1511
|
|
|
1512
|
+
### tr-derive-data-silos-from-data-flows
|
|
1513
|
+
|
|
1514
|
+
Given a folder of data flow `transcend.yml` configurations, convert those configurations to set of data silo `transcend.yml` configurations.
|
|
1515
|
+
|
|
1516
|
+
#### Authentication
|
|
1517
|
+
|
|
1518
|
+
In order to use this cli, you will first need to generate an API key on the Transcend Admin Dashboard (https://app.transcend.io/infrastructure/api-keys).
|
|
1519
|
+
|
|
1520
|
+
The API does not need any scopes, any API key will work.
|
|
1521
|
+
|
|
1522
|
+
#### Arguments
|
|
1523
|
+
|
|
1524
|
+
| Argument | Description | Type | Default | Required |
|
|
1525
|
+
| ------------------ | ----------------------------------------------------------------------------- | -------------------- | ------------------------ | -------- |
|
|
1526
|
+
| auth | The Transcend API key with the scopes necessary for the command. | string | N/A | true |
|
|
1527
|
+
| dataFlowsYmlFolder | The folder that contains data flow yml files | string - folder-path | N/A | true |
|
|
1528
|
+
| dataSilosYmlFolder | The folder that contains data silo yml files | string - folder-path | N/A | true |
|
|
1529
|
+
| ignoreYmls | The set of yml files that should be skipped when uploading | string[] | [] | false |
|
|
1530
|
+
| transcendUrl | URL of the Transcend backend. Use https://api.us.transcend.io for US hosting. | string - URL | https://api.transcend.io | false |
|
|
1531
|
+
|
|
1532
|
+
#### Usage
|
|
1533
|
+
|
|
1534
|
+
Convert data flow configurations in folder `./working/data-flows/` to data silo configurations in folder `./working/data-silos/`
|
|
1535
|
+
|
|
1536
|
+
```sh
|
|
1537
|
+
yarn tr-derive-data-silos-from-data-flows --auth=$TRANSCEND_API_KEY \
|
|
1538
|
+
--dataFlowsYmlFolder=./working/data-flows/ \
|
|
1539
|
+
--dataSilosYmlFolder=./working/data-silos/
|
|
1540
|
+
```
|
|
1541
|
+
|
|
1542
|
+
Use with US backend
|
|
1543
|
+
|
|
1544
|
+
```sh
|
|
1545
|
+
yarn tr-derive-data-silos-from-data-flows --auth=$TRANSCEND_API_KEY --transcendUrl=https://api.us.transcend.io \
|
|
1546
|
+
--dataFlowsYmlFolder=./working/data-flows/ \
|
|
1547
|
+
--dataSilosYmlFolder=./working/data-silos/
|
|
1548
|
+
```
|
|
1549
|
+
|
|
1550
|
+
Skip a set of yml files
|
|
1551
|
+
|
|
1552
|
+
```sh
|
|
1553
|
+
yarn tr-derive-data-silos-from-data-flows --auth=$TRANSCEND_API_KEY --ignoreYmls="Skip.yml,Other.yml" \
|
|
1554
|
+
--dataFlowsYmlFolder=./working/data-flows/ \
|
|
1555
|
+
--dataSilosYmlFolder=./working/data-silos/
|
|
1556
|
+
```
|
|
1557
|
+
|
|
1558
|
+
### tr-derive-data-silos-from-data-flows-cross-instance
|
|
1559
|
+
|
|
1560
|
+
Given a folder of data flow `transcend.yml` configurations, convert those configurations to a single `transcend.yml` configurations of all related data silos.
|
|
1561
|
+
|
|
1562
|
+
#### Authentication
|
|
1563
|
+
|
|
1564
|
+
In order to use this cli, you will first need to generate an API key on the Transcend Admin Dashboard (https://app.transcend.io/infrastructure/api-keys).
|
|
1565
|
+
|
|
1566
|
+
The API does not need any scopes, any API key will work.
|
|
1567
|
+
|
|
1568
|
+
#### Arguments
|
|
1569
|
+
|
|
1570
|
+
| Argument | Description | Type | Default | Required |
|
|
1571
|
+
| ------------------ | ----------------------------------------------------------------------------- | -------------------- | ------------------------ | -------- |
|
|
1572
|
+
| auth | The Transcend API key with the scopes necessary for the command. | string | N/A | true |
|
|
1573
|
+
| dataFlowsYmlFolder | The folder that contains data flow yml files | string - folder-path | N/A | true |
|
|
1574
|
+
| output | The output transcend.yml file containing the data silo configurations | string - file-path | ./transcend.yml | false |
|
|
1575
|
+
| ignoreYmls | The set of yml files that should be skipped when uploading | string[] | [] | false |
|
|
1576
|
+
| transcendUrl | URL of the Transcend backend. Use https://api.us.transcend.io for US hosting. | string - URL | https://api.transcend.io | false |
|
|
1577
|
+
|
|
1578
|
+
#### Usage
|
|
1579
|
+
|
|
1580
|
+
Convert data flow configurations in folder `./working/data-flows/` to data silo configurations in file `./transcend.yml`
|
|
1581
|
+
|
|
1582
|
+
```sh
|
|
1583
|
+
yarn tr-derive-data-silos-from-data-flows-cross-instance --auth=$TRANSCEND_API_KEY --dataFlowsYmlFolder=./working/data-flows/
|
|
1584
|
+
```
|
|
1585
|
+
|
|
1586
|
+
Use with US backend
|
|
1587
|
+
|
|
1588
|
+
```sh
|
|
1589
|
+
yarn tr-derive-data-silos-from-data-flows-cross-instance --auth=$TRANSCEND_API_KEY --dataFlowsYmlFolder=./working/data-flows/ \
|
|
1590
|
+
--transcendUrl=https://api.us.transcend.io
|
|
1591
|
+
```
|
|
1592
|
+
|
|
1593
|
+
Skip a set of yml files
|
|
1594
|
+
|
|
1595
|
+
```sh
|
|
1596
|
+
yarn tr-derive-data-silos-from-data-flows-cross-instance --auth=$TRANSCEND_API_KEY --dataFlowsYmlFolder=./working/data-flows/ --ignoreYmls="Skip.yml,Other.yml"
|
|
1597
|
+
```
|
|
1598
|
+
|
|
1599
|
+
Convert data flow configurations in folder `./working/data-flows/` to data silo configurations in file `./output.yml`
|
|
1600
|
+
|
|
1601
|
+
```sh
|
|
1602
|
+
yarn tr-derive-data-silos-from-data-flows-cross-instance --auth=$TRANSCEND_API_KEY --dataFlowsYmlFolder=./working/data-flows/ --output=./output.yml
|
|
1603
|
+
```
|
|
1604
|
+
|
|
1500
1605
|
### tr-pull-consent-metrics
|
|
1501
1606
|
|
|
1502
1607
|
This command allows for pulling consent manager metrics for a Transcend account, or a set of Transcend accounts.
|
|
@@ -33,7 +33,7 @@ function main() {
|
|
|
33
33
|
logger_1.logger.error(colors_1.default.red('Missing required arg: --consentManagerYmlFolder=./working/consent-managers/'));
|
|
34
34
|
process.exit(1);
|
|
35
35
|
}
|
|
36
|
-
// Ensure
|
|
36
|
+
// Ensure folder is passed
|
|
37
37
|
if (!(0, fs_1.existsSync)(consentManagerYmlFolder) ||
|
|
38
38
|
!(0, fs_1.lstatSync)(consentManagerYmlFolder).isDirectory()) {
|
|
39
39
|
logger_1.logger.error(colors_1.default.red(`Folder does not exist: "${consentManagerYmlFolder}"`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-consent-managers-to-business-entities.js","sourceRoot":"","sources":["../src/cli-consent-managers-to-business-entities.ts"],"names":[],"mappings":";;;;;;AACA,yCAAuC;AACvC,uDAAsE;AACtE,2DAA4E;AAC5E,+BAA4B;AAC5B,gEAAiC;AACjC,oDAA4B;AAC5B,qCAAkC;AAClC,2BAA2C;AAE3C;;;;;;;;;;;;GAYG;AACH,SAAS,IAAI;IACX,+BAA+B;IAC/B,MAAM,EACJ,uBAAuB,EACvB,MAAM,GAAG,kCAAkC,GAC5C,GAAG,IAAA,sBAAK,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAA8B,CAAC;IAE9D,qDAAqD;IACrD,IAAI,CAAC,uBAAuB,EAAE;QAC5B,eAAM,CAAC,KAAK,CACV,gBAAM,CAAC,GAAG,CACR,6EAA6E,CAC9E,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,
|
|
1
|
+
{"version":3,"file":"cli-consent-managers-to-business-entities.js","sourceRoot":"","sources":["../src/cli-consent-managers-to-business-entities.ts"],"names":[],"mappings":";;;;;;AACA,yCAAuC;AACvC,uDAAsE;AACtE,2DAA4E;AAC5E,+BAA4B;AAC5B,gEAAiC;AACjC,oDAA4B;AAC5B,qCAAkC;AAClC,2BAA2C;AAE3C;;;;;;;;;;;;GAYG;AACH,SAAS,IAAI;IACX,+BAA+B;IAC/B,MAAM,EACJ,uBAAuB,EACvB,MAAM,GAAG,kCAAkC,GAC5C,GAAG,IAAA,sBAAK,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAA8B,CAAC;IAE9D,qDAAqD;IACrD,IAAI,CAAC,uBAAuB,EAAE;QAC5B,eAAM,CAAC,KAAK,CACV,gBAAM,CAAC,GAAG,CACR,6EAA6E,CAC9E,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,0BAA0B;IAC1B,IACE,CAAC,IAAA,eAAU,EAAC,uBAAuB,CAAC;QACpC,CAAC,IAAA,cAAS,EAAC,uBAAuB,CAAC,CAAC,WAAW,EAAE,EACjD;QACA,eAAM,CAAC,KAAK,CACV,gBAAM,CAAC,GAAG,CAAC,2BAA2B,uBAAuB,GAAG,CAAC,CAClE,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,6CAA6C;IAC7C,MAAM,MAAM,GAAG,IAAA,oBAAS,EAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QAClE,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,IAAA,qCAAiB,EAC7D,IAAA,WAAI,EAAC,uBAAuB,EAAE,SAAS,CAAC,CACzC,CAAC;QACF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,+BAA+B;IAC/B,MAAM,gBAAgB,GAAG,IAAA,mDAAiC,EAAC,MAAM,CAAC,CAAC;IAEnE,gBAAgB;IAChB,IAAA,sCAAkB,EAAC,MAAM,EAAE;QACzB,mBAAmB,EAAE,gBAAgB;KACtC,CAAC,CAAC;IAEH,eAAM,CAAC,IAAI,CACT,gBAAM,CAAC,KAAK,CACV,sBAAsB,gBAAgB,CAAC,MAAM,+BAA+B,MAAM,GAAG,CACtF,CACF,CAAC;AACJ,CAAC;AAED,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-derive-data-silos-from-data-flows-cross-instance.d.ts","sourceRoot":"","sources":["../src/cli-derive-data-silos-from-data-flows-cross-instance.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const graphql_1 = require("./graphql");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const yargs_parser_1 = __importDefault(require("yargs-parser"));
|
|
10
|
+
const difference_1 = __importDefault(require("lodash/difference"));
|
|
11
|
+
const colors_1 = __importDefault(require("colors"));
|
|
12
|
+
const logger_1 = require("./logger");
|
|
13
|
+
const constants_1 = require("./constants");
|
|
14
|
+
const dataFlowsToDataSilos_1 = require("./consent-manager/dataFlowsToDataSilos");
|
|
15
|
+
const fs_1 = require("fs");
|
|
16
|
+
const api_keys_1 = require("./api-keys");
|
|
17
|
+
const readTranscendYaml_1 = require("./readTranscendYaml");
|
|
18
|
+
const requests_1 = require("./requests");
|
|
19
|
+
/**
|
|
20
|
+
* Derive the set of data silos from a set of data flows.
|
|
21
|
+
*
|
|
22
|
+
* Requires an API key - no scope required on API key
|
|
23
|
+
*
|
|
24
|
+
* Dev Usage:
|
|
25
|
+
* yarn ts-node ./src/cli-derive-data-silos-from-data-flows-cross-instance.ts --auth=$TRANSCEND_API_KEY \
|
|
26
|
+
* --dataFlowsYmlFolder=./working/data-flows/ \
|
|
27
|
+
* --output=./transcend.yml
|
|
28
|
+
*
|
|
29
|
+
* Standard usage:
|
|
30
|
+
* yarn tr-derive-data-silos-from-data-flows-cross-instance --auth=$TRANSCEND_API_KEY \
|
|
31
|
+
* --dataFlowsYmlFolder=./working/data-flows/ \
|
|
32
|
+
* --output=./transcend.yml
|
|
33
|
+
*/
|
|
34
|
+
async function main() {
|
|
35
|
+
// Parse command line arguments
|
|
36
|
+
const { transcendUrl = constants_1.DEFAULT_TRANSCEND_API, auth, dataFlowsYmlFolder, output = 'transcend.yml', ignoreYmls = '', } = (0, yargs_parser_1.default)(process.argv.slice(2));
|
|
37
|
+
// Ensure auth is passed
|
|
38
|
+
if (!auth) {
|
|
39
|
+
logger_1.logger.error(colors_1.default.red('A Transcend API key must be provided. You can specify using --auth=$TRANSCEND_API_KEY'));
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
// Ensure folder is passed to dataFlowsYmlFolder
|
|
43
|
+
if (!dataFlowsYmlFolder) {
|
|
44
|
+
logger_1.logger.error(colors_1.default.red('Missing required arg: --dataFlowsYmlFolder=./working/data-flows/'));
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
// Ensure folder is passed
|
|
48
|
+
if (!(0, fs_1.existsSync)(dataFlowsYmlFolder) ||
|
|
49
|
+
!(0, fs_1.lstatSync)(dataFlowsYmlFolder).isDirectory()) {
|
|
50
|
+
logger_1.logger.error(colors_1.default.red(`Folder does not exist: "${dataFlowsYmlFolder}"`));
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
// Ignore the data flows in these yml files
|
|
54
|
+
const instancesToIgnore = (0, requests_1.splitCsvToList)(ignoreYmls).map((x) => x.split('.')[0]);
|
|
55
|
+
// Map over each data flow yml file and convert to data silo configurations
|
|
56
|
+
const dataSiloInputs = (0, api_keys_1.listFiles)(dataFlowsYmlFolder).map((directory) => {
|
|
57
|
+
// read in the data flows for a specific instance
|
|
58
|
+
const { 'data-flows': dataFlows = [] } = (0, readTranscendYaml_1.readTranscendYaml)((0, path_1.join)(dataFlowsYmlFolder, directory));
|
|
59
|
+
// map the data flows to data silos
|
|
60
|
+
const { adTechDataSilos, siteTechDataSilos } = (0, dataFlowsToDataSilos_1.dataFlowsToDataSilos)(dataFlows, {
|
|
61
|
+
serviceToSupportedIntegration,
|
|
62
|
+
serviceToTitle,
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
adTechDataSilos,
|
|
66
|
+
siteTechDataSilos,
|
|
67
|
+
organizationName: directory.split('.')[0],
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
// Mapping from service name to instances that have that service
|
|
71
|
+
const serviceToInstance = {};
|
|
72
|
+
dataSiloInputs.forEach(({ adTechDataSilos, siteTechDataSilos, organizationName }) => {
|
|
73
|
+
const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];
|
|
74
|
+
allDataSilos.forEach((dataSilo) => {
|
|
75
|
+
const service = dataSilo['outer-type'] || dataSilo.integrationName;
|
|
76
|
+
// create mapping to instance
|
|
77
|
+
if (!serviceToInstance[service]) {
|
|
78
|
+
serviceToInstance[service] = [];
|
|
79
|
+
}
|
|
80
|
+
serviceToInstance[service].push(organizationName);
|
|
81
|
+
serviceToInstance[service] = [...new Set(serviceToInstance[service])];
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
// List of ad tech integrations
|
|
85
|
+
const adTechIntegrations = [
|
|
86
|
+
...new Set(dataSiloInputs
|
|
87
|
+
.map(({ adTechDataSilos }) => adTechDataSilos.map((silo) => silo['outer-type'] || silo.integrationName))
|
|
88
|
+
.flat()),
|
|
89
|
+
];
|
|
90
|
+
// List of site tech integrations
|
|
91
|
+
const siteTechIntegrations = (0, difference_1.default)([
|
|
92
|
+
...new Set(dataSiloInputs
|
|
93
|
+
.map(({ siteTechDataSilos }) => siteTechDataSilos.map((silo) => silo['outer-type'] || silo.integrationName))
|
|
94
|
+
.flat()),
|
|
95
|
+
], adTechIntegrations);
|
|
96
|
+
// Mapping from service name to list of
|
|
97
|
+
const serviceToFoundOnDomain = {};
|
|
98
|
+
dataSiloInputs.forEach(({ adTechDataSilos, siteTechDataSilos }) => {
|
|
99
|
+
const allDataSilos = [...adTechDataSilos, ...siteTechDataSilos];
|
|
100
|
+
allDataSilos.forEach((dataSilo) => {
|
|
101
|
+
var _a;
|
|
102
|
+
const service = dataSilo['outer-type'] || dataSilo.integrationName;
|
|
103
|
+
const foundOnDomain = (_a = dataSilo.attributes) === null || _a === void 0 ? void 0 : _a.find((attr) => attr.key === 'Found On Domain');
|
|
104
|
+
// create mapping to instance
|
|
105
|
+
if (!serviceToFoundOnDomain[service]) {
|
|
106
|
+
serviceToFoundOnDomain[service] = [];
|
|
107
|
+
}
|
|
108
|
+
serviceToFoundOnDomain[service].push(...((foundOnDomain === null || foundOnDomain === void 0 ? void 0 : foundOnDomain.values) || []));
|
|
109
|
+
serviceToFoundOnDomain[service] = [
|
|
110
|
+
...new Set(serviceToFoundOnDomain[service]),
|
|
111
|
+
];
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
// Fetch all integrations in the catalog
|
|
115
|
+
const client = (0, graphql_1.buildTranscendGraphQLClient)(transcendUrl, auth);
|
|
116
|
+
const { serviceToTitle, serviceToSupportedIntegration } = await (0, graphql_1.fetchAndIndexCatalogs)(client);
|
|
117
|
+
// construct the aggregated data silo inputs
|
|
118
|
+
const dataSilos = [...adTechIntegrations, ...siteTechIntegrations].map((service) => ({
|
|
119
|
+
title: serviceToTitle[service],
|
|
120
|
+
...(serviceToSupportedIntegration[service]
|
|
121
|
+
? { integrationName: service }
|
|
122
|
+
: { integrationName: 'promptAPerson', 'outer-type': service }),
|
|
123
|
+
attributes: [
|
|
124
|
+
{
|
|
125
|
+
key: 'Tech Type',
|
|
126
|
+
values: ['Ad Tech'],
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
key: 'Business Units',
|
|
130
|
+
values: (0, difference_1.default)(serviceToInstance[service] || [], instancesToIgnore),
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
key: 'Found On Domain',
|
|
134
|
+
values: serviceToFoundOnDomain[service] || [],
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
}));
|
|
138
|
+
// Log output
|
|
139
|
+
logger_1.logger.log(`Total Services: ${dataSilos.length}`);
|
|
140
|
+
logger_1.logger.log(`Ad Tech Services: ${adTechIntegrations.length}`);
|
|
141
|
+
logger_1.logger.log(`Site Tech Services: ${siteTechIntegrations.length}`);
|
|
142
|
+
// Write to yaml
|
|
143
|
+
(0, readTranscendYaml_1.writeTranscendYaml)(output, {
|
|
144
|
+
'data-silos': dataSilos,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
main();
|
|
148
|
+
//# sourceMappingURL=cli-derive-data-silos-from-data-flows-cross-instance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-derive-data-silos-from-data-flows-cross-instance.js","sourceRoot":"","sources":["../src/cli-derive-data-silos-from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E,sBAAsB,CAAC,OAAO,CAAC,IAAI,EAAE;aAC9C;SACF;KACF,CAAC,CACH,CAAC;IAEF,aAAa;IACb,eAAM,CAAC,GAAG,CAAC,mBAAmB,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;IAClD,eAAM,CAAC,GAAG,CAAC,qBAAqB,kBAAkB,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7D,eAAM,CAAC,GAAG,CAAC,uBAAuB,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC;IAEjE,gBAAgB;IAChB,IAAA,sCAAkB,EAAC,MAAM,EAAE;QACzB,YAAY,EAAE,SAAS;KACxB,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-derive-data-silos-from-data-flows.d.ts","sourceRoot":"","sources":["../src/cli-derive-data-silos-from-data-flows.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const graphql_1 = require("./graphql");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const yargs_parser_1 = __importDefault(require("yargs-parser"));
|
|
10
|
+
const colors_1 = __importDefault(require("colors"));
|
|
11
|
+
const logger_1 = require("./logger");
|
|
12
|
+
const constants_1 = require("./constants");
|
|
13
|
+
const dataFlowsToDataSilos_1 = require("./consent-manager/dataFlowsToDataSilos");
|
|
14
|
+
const requests_1 = require("./requests");
|
|
15
|
+
const fs_1 = require("fs");
|
|
16
|
+
const api_keys_1 = require("./api-keys");
|
|
17
|
+
const readTranscendYaml_1 = require("./readTranscendYaml");
|
|
18
|
+
/**
|
|
19
|
+
* Derive the set of data silos that can be derived from a set of data flows.
|
|
20
|
+
*
|
|
21
|
+
* Requires an API key - no scope required on API key
|
|
22
|
+
*
|
|
23
|
+
* Dev Usage:
|
|
24
|
+
* yarn ts-node ./src/cli-derive-data-silos-from-data-flows.ts --auth=$TRANSCEND_API_KEY \
|
|
25
|
+
* --dataFlowsYmlFolder=./working/data-flows/ \
|
|
26
|
+
* --dataSilosYmlFolder=./working/data-silos/
|
|
27
|
+
*
|
|
28
|
+
* Standard usage:
|
|
29
|
+
* yarn tr-derive-data-silos-from-data-flows --auth=$TRANSCEND_API_KEY \
|
|
30
|
+
* --dataFlowsYmlFolder=./working/data-flows/ \
|
|
31
|
+
* --dataSilosYmlFolder=./working/data-silos/
|
|
32
|
+
*/
|
|
33
|
+
async function main() {
|
|
34
|
+
// Parse command line arguments
|
|
35
|
+
const { transcendUrl = constants_1.DEFAULT_TRANSCEND_API, auth, dataFlowsYmlFolder, dataSilosYmlFolder, ignoreYmls = '', } = (0, yargs_parser_1.default)(process.argv.slice(2));
|
|
36
|
+
// Ensure auth is passed
|
|
37
|
+
if (!auth) {
|
|
38
|
+
logger_1.logger.error(colors_1.default.red('A Transcend API key must be provided. You can specify using --auth=$TRANSCEND_API_KEY'));
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
// Ensure folder is passed to dataFlowsYmlFolder
|
|
42
|
+
if (!dataFlowsYmlFolder) {
|
|
43
|
+
logger_1.logger.error(colors_1.default.red('Missing required arg: --dataFlowsYmlFolder=./working/data-flows/'));
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
// Ensure folder is passed
|
|
47
|
+
if (!(0, fs_1.existsSync)(dataFlowsYmlFolder) ||
|
|
48
|
+
!(0, fs_1.lstatSync)(dataFlowsYmlFolder).isDirectory()) {
|
|
49
|
+
logger_1.logger.error(colors_1.default.red(`Folder does not exist: "${dataFlowsYmlFolder}"`));
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
// Ensure folder is passed to dataSilosYmlFolder
|
|
53
|
+
if (!dataSilosYmlFolder) {
|
|
54
|
+
logger_1.logger.error(colors_1.default.red('Missing required arg: --dataSilosYmlFolder=./working/data-silos/'));
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
// Ensure folder is passed
|
|
58
|
+
if (!(0, fs_1.existsSync)(dataSilosYmlFolder) ||
|
|
59
|
+
!(0, fs_1.lstatSync)(dataSilosYmlFolder).isDirectory()) {
|
|
60
|
+
logger_1.logger.error(colors_1.default.red(`Folder does not exist: "${dataSilosYmlFolder}"`));
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
// Ignore the data flows in these yml files
|
|
64
|
+
const ymlsToIgnore = (0, requests_1.splitCsvToList)(ignoreYmls);
|
|
65
|
+
// Fetch all integrations in the catalog
|
|
66
|
+
const client = (0, graphql_1.buildTranscendGraphQLClient)(transcendUrl, auth);
|
|
67
|
+
const { serviceToTitle, serviceToSupportedIntegration } = await (0, graphql_1.fetchAndIndexCatalogs)(client);
|
|
68
|
+
// List of each data flow yml file
|
|
69
|
+
(0, api_keys_1.listFiles)(dataFlowsYmlFolder).forEach((directory) => {
|
|
70
|
+
// read in the data flows for a specific instance
|
|
71
|
+
const { 'data-flows': dataFlows = [] } = (0, readTranscendYaml_1.readTranscendYaml)((0, path_1.join)(dataFlowsYmlFolder, directory));
|
|
72
|
+
// map the data flows to data silos
|
|
73
|
+
const { adTechDataSilos, siteTechDataSilos } = (0, dataFlowsToDataSilos_1.dataFlowsToDataSilos)(dataFlows, {
|
|
74
|
+
serviceToSupportedIntegration,
|
|
75
|
+
serviceToTitle,
|
|
76
|
+
});
|
|
77
|
+
// combine and write to yml file
|
|
78
|
+
const dataSilos = [...adTechDataSilos, ...siteTechDataSilos];
|
|
79
|
+
logger_1.logger.log(`Total Services: ${dataSilos.length}`);
|
|
80
|
+
logger_1.logger.log(`Ad Tech Services: ${adTechDataSilos.length}`);
|
|
81
|
+
logger_1.logger.log(`Site Tech Services: ${siteTechDataSilos.length}`);
|
|
82
|
+
(0, readTranscendYaml_1.writeTranscendYaml)((0, path_1.join)(dataSilosYmlFolder, directory), {
|
|
83
|
+
'data-silos': ymlsToIgnore.includes(directory) ? [] : dataSilos,
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
main();
|
|
88
|
+
//# sourceMappingURL=cli-derive-data-silos-from-data-flows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-derive-data-silos-from-data-flows.js","sourceRoot":"","sources":["../src/cli-derive-data-silos-from-data-flows.ts"],"names":[],"mappings":";;;;;;AACA,uCAA+E;AAC/E,+BAA4B;AAC5B,gEAAiC;AACjC,oDAA4B;AAE5B,qCAAkC;AAClC,2CAAoD;AACpD,iFAA8E;AAE9E,yCAA4C;AAC5C,2BAA2C;AAC3C,yCAAuC;AACvC,2DAA4E;AAE5E;;;;;;;;;;;;;;GAcG;AACH,KAAK,UAAU,IAAI;IACjB,+BAA+B;IAC/B,MAAM,EACJ,YAAY,GAAG,iCAAqB,EACpC,IAAI,EACJ,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,GAAG,EAAE,GAChB,GAAG,IAAA,sBAAK,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAA8B,CAAC;IAE9D,wBAAwB;IACxB,IAAI,CAAC,IAAI,EAAE;QACT,eAAM,CAAC,KAAK,CACV,gBAAM,CAAC,GAAG,CACR,uFAAuF,CACxF,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,gDAAgD;IAChD,IAAI,CAAC,kBAAkB,EAAE;QACvB,eAAM,CAAC,KAAK,CACV,gBAAM,CAAC,GAAG,CACR,kEAAkE,CACnE,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,0BAA0B;IAC1B,IACE,CAAC,IAAA,eAAU,EAAC,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AM,EAAE,eAAe,EAAE,iBAAiB,EAAE,GAAG,IAAA,2CAAoB,EACjE,SAA4B,EAC5B;YACE,6BAA6B;YAC7B,cAAc;SACf,CACF,CAAC;QAEF,gCAAgC;QAChC,MAAM,SAAS,GAAG,CAAC,GAAG,eAAe,EAAE,GAAG,iBAAiB,CAAC,CAAC;QAC7D,eAAM,CAAC,GAAG,CAAC,mBAAmB,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;QAClD,eAAM,CAAC,GAAG,CAAC,qBAAqB,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1D,eAAM,CAAC,GAAG,CAAC,uBAAuB,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9D,IAAA,sCAAkB,EAAC,IAAA,WAAI,EAAC,kBAAkB,EAAE,SAAS,CAAC,EAAE;YACtD,YAAY,EAAE,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;SAChE,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DataFlowInput, DataSiloInput } from '../codecs';
|
|
2
|
+
import { IndexedCatalogs } from '../graphql';
|
|
3
|
+
/**
|
|
4
|
+
* Convert data flow configurations into a set of data silo configurations
|
|
5
|
+
*
|
|
6
|
+
* @param inputs - Data flow input to convert to data silos
|
|
7
|
+
* @param options - Additional options
|
|
8
|
+
* @returns Business entity configuration input
|
|
9
|
+
*/
|
|
10
|
+
export declare function dataFlowsToDataSilos(inputs: DataFlowInput[], { adTechPurposes, serviceToTitle, serviceToSupportedIntegration, }: IndexedCatalogs & {
|
|
11
|
+
/** List of purposes that are considered "Ad Tech" */
|
|
12
|
+
adTechPurposes?: string[];
|
|
13
|
+
}): {
|
|
14
|
+
/** List of data silo configurations for site-tech services */
|
|
15
|
+
siteTechDataSilos: DataSiloInput[];
|
|
16
|
+
/** List of data silo configurations for ad-tech services */
|
|
17
|
+
adTechDataSilos: DataSiloInput[];
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=dataFlowsToDataSilos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataFlowsToDataSilos.d.ts","sourceRoot":"","sources":["../../src/consent-manager/dataFlowsToDataSilos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,aAAa,EAAE,EACvB,EACE,cAA+B,EAC/B,cAAc,EACd,6BAA6B,GAC9B,EAAE,eAAe,GAAG;IACnB,sDAAsD;IACtD,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,GACA;IACD,8DAA8D;IAC9D,iBAAiB,EAAE,aAAa,EAAE,CAAC;IACnC,4DAA4D;IAC5D,eAAe,EAAE,aAAa,EAAE,CAAC;CAClC,CAiGA"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.dataFlowsToDataSilos = void 0;
|
|
7
|
+
const union_1 = __importDefault(require("lodash/union"));
|
|
8
|
+
/**
|
|
9
|
+
* Convert data flow configurations into a set of data silo configurations
|
|
10
|
+
*
|
|
11
|
+
* @param inputs - Data flow input to convert to data silos
|
|
12
|
+
* @param options - Additional options
|
|
13
|
+
* @returns Business entity configuration input
|
|
14
|
+
*/
|
|
15
|
+
function dataFlowsToDataSilos(inputs, { adTechPurposes = ['SaleOfInfo'], serviceToTitle, serviceToSupportedIntegration, }) {
|
|
16
|
+
// List of site tech integrations
|
|
17
|
+
let siteTechIntegrations = [];
|
|
18
|
+
// List of ad tech integrations
|
|
19
|
+
const adTechIntegrations = [];
|
|
20
|
+
// Mapping from service name to list of
|
|
21
|
+
const serviceToFoundOnDomain = {};
|
|
22
|
+
// iterate over each flow
|
|
23
|
+
inputs.forEach((flow) => {
|
|
24
|
+
// process data flows with services
|
|
25
|
+
const { service, attributes = [] } = flow;
|
|
26
|
+
if (!service || service === 'internalService') {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// create mapping to found on domain
|
|
30
|
+
const foundOnDomain = attributes.find((attr) => attr.key === 'Found on Domain');
|
|
31
|
+
// Create a list of all domains where the data flow was found
|
|
32
|
+
if (foundOnDomain) {
|
|
33
|
+
if (!serviceToFoundOnDomain[service]) {
|
|
34
|
+
serviceToFoundOnDomain[service] = [];
|
|
35
|
+
}
|
|
36
|
+
serviceToFoundOnDomain[service].push(...foundOnDomain.values.map((v) => v.replace('https://', '').replace('http://', '')));
|
|
37
|
+
serviceToFoundOnDomain[service] = [
|
|
38
|
+
...new Set(serviceToFoundOnDomain[service]),
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
// Keep track of ad tech
|
|
42
|
+
if ((0, union_1.default)(flow.trackingPurposes, adTechPurposes).length > 0) {
|
|
43
|
+
// add service to ad tech list
|
|
44
|
+
adTechIntegrations.push(service);
|
|
45
|
+
// remove from site tech list
|
|
46
|
+
if (siteTechIntegrations.includes(service)) {
|
|
47
|
+
siteTechIntegrations = siteTechIntegrations.filter((s) => s !== service);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else if (!adTechIntegrations.includes(service)) {
|
|
51
|
+
// add to site tech list
|
|
52
|
+
siteTechIntegrations.push(service);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
// create the list of ad tech integrations
|
|
56
|
+
const adTechDataSilos = [...new Set(adTechIntegrations)].map((service) => ({
|
|
57
|
+
title: serviceToTitle[service],
|
|
58
|
+
...(serviceToSupportedIntegration[service]
|
|
59
|
+
? { integrationName: service }
|
|
60
|
+
: { integrationName: 'promptAPerson', 'outer-type': service }),
|
|
61
|
+
attributes: [
|
|
62
|
+
{
|
|
63
|
+
key: 'Tech Type',
|
|
64
|
+
values: ['Ad Tech'],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
key: 'Found On Domain',
|
|
68
|
+
values: serviceToFoundOnDomain[service] || [],
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
}));
|
|
72
|
+
// create the list of site tech integrations
|
|
73
|
+
const siteTechDataSilos = [...new Set(siteTechIntegrations)].map((service) => ({
|
|
74
|
+
title: serviceToTitle[service],
|
|
75
|
+
...(serviceToSupportedIntegration[service]
|
|
76
|
+
? { integrationName: service }
|
|
77
|
+
: { integrationName: 'promptAPerson', outerType: service }),
|
|
78
|
+
attributes: [
|
|
79
|
+
{
|
|
80
|
+
key: 'Tech Type',
|
|
81
|
+
values: ['Site Tech'],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
key: 'Found On Domain',
|
|
85
|
+
values: serviceToFoundOnDomain[service] || [],
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
}));
|
|
89
|
+
return {
|
|
90
|
+
siteTechDataSilos,
|
|
91
|
+
adTechDataSilos,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
exports.dataFlowsToDataSilos = dataFlowsToDataSilos;
|
|
95
|
+
//# sourceMappingURL=dataFlowsToDataSilos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataFlowsToDataSilos.js","sourceRoot":"","sources":["../../src/consent-manager/dataFlowsToDataSilos.ts"],"names":[],"mappings":";;;;;;AACA,yDAAiC;AAGjC;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAClC,MAAuB,EACvB,EACE,cAAc,GAAG,CAAC,YAAY,CAAC,EAC/B,cAAc,EACd,6BAA6B,GAI9B;IAOD,iCAAiC;IACjC,IAAI,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AC;QAC7D,UAAU,EAAE;YACV;gBACE,GAAG,EAAE,WAAW;gBAChB,MAAM,EAAE,CAAC,WAAW,CAAC;aACtB;YACD;gBACE,GAAG,EAAE,iBAAiB;gBACtB,MAAM,EAAE,sBAAsB,CAAC,OAAO,CAAC,IAAI,EAAE;aAC9C;SACF;KACF,CAAC,CACH,CAAC;IAEF,OAAO;QACL,iBAAiB;QACjB,eAAe;KAChB,CAAC;AACJ,CAAC;AAhHD,oDAgHC"}
|
|
@@ -14,4 +14,24 @@ export interface Catalog {
|
|
|
14
14
|
* @returns Integration catalogs
|
|
15
15
|
*/
|
|
16
16
|
export declare function fetchAllCatalogs(client: GraphQLClient): Promise<Catalog[]>;
|
|
17
|
+
export interface IndexedCatalogs {
|
|
18
|
+
/** Mapping from service name to service title */
|
|
19
|
+
serviceToTitle: {
|
|
20
|
+
[k in string]: string;
|
|
21
|
+
};
|
|
22
|
+
/** Mapping from service name to boolean indicate if service has API integration support */
|
|
23
|
+
serviceToSupportedIntegration: {
|
|
24
|
+
[k in string]: boolean;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Fetch all integration catalogs and index them for usage in common utility manners
|
|
29
|
+
*
|
|
30
|
+
* @param client - Client
|
|
31
|
+
* @returns Integration catalogs
|
|
32
|
+
*/
|
|
33
|
+
export declare function fetchAndIndexCatalogs(client: GraphQLClient): Promise<{
|
|
34
|
+
/** List of all catalogs */
|
|
35
|
+
catalogs: Catalog[];
|
|
36
|
+
} & IndexedCatalogs>;
|
|
17
37
|
//# sourceMappingURL=fetchCatalogs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchCatalogs.d.ts","sourceRoot":"","sources":["../../src/graphql/fetchCatalogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,MAAM,WAAW,OAAO;IACtB,uBAAuB;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAID;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,OAAO,EAAE,CAAC,CAyBpB"}
|
|
1
|
+
{"version":3,"file":"fetchCatalogs.d.ts","sourceRoot":"","sources":["../../src/graphql/fetchCatalogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,MAAM,WAAW,OAAO;IACtB,uBAAuB;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAID;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,OAAO,EAAE,CAAC,CAyBpB;AAED,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,cAAc,EAAE;SAAG,CAAC,IAAI,MAAM,GAAG,MAAM;KAAE,CAAC;IAC1C,2FAA2F;IAC3F,6BAA6B,EAAE;SAAG,CAAC,IAAI,MAAM,GAAG,OAAO;KAAE,CAAC;CAC3D;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CACzE;IACE,2BAA2B;IAC3B,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB,GAAG,eAAe,CACpB,CAyBA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchAllCatalogs = void 0;
|
|
3
|
+
exports.fetchAndIndexCatalogs = exports.fetchAllCatalogs = void 0;
|
|
4
4
|
const gqls_1 = require("./gqls");
|
|
5
5
|
const makeGraphQLRequest_1 = require("./makeGraphQLRequest");
|
|
6
6
|
const PAGE_SIZE = 100;
|
|
@@ -29,4 +29,26 @@ async function fetchAllCatalogs(client) {
|
|
|
29
29
|
return catalogs;
|
|
30
30
|
}
|
|
31
31
|
exports.fetchAllCatalogs = fetchAllCatalogs;
|
|
32
|
+
/**
|
|
33
|
+
* Fetch all integration catalogs and index them for usage in common utility manners
|
|
34
|
+
*
|
|
35
|
+
* @param client - Client
|
|
36
|
+
* @returns Integration catalogs
|
|
37
|
+
*/
|
|
38
|
+
async function fetchAndIndexCatalogs(client) {
|
|
39
|
+
// Fetch all integrations in the catalog
|
|
40
|
+
const catalogs = await fetchAllCatalogs(client);
|
|
41
|
+
// Create mapping from service name to service title
|
|
42
|
+
const serviceToTitle = catalogs.reduce((acc, catalog) => Object.assign(acc, { [catalog.integrationName]: catalog.title }), {});
|
|
43
|
+
// Create mapping from service name to boolean indicate if service has API integration support
|
|
44
|
+
const serviceToSupportedIntegration = catalogs.reduce((acc, catalog) => Object.assign(acc, {
|
|
45
|
+
[catalog.integrationName]: catalog.hasApiFunctionality,
|
|
46
|
+
}), {});
|
|
47
|
+
return {
|
|
48
|
+
catalogs,
|
|
49
|
+
serviceToTitle,
|
|
50
|
+
serviceToSupportedIntegration,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
exports.fetchAndIndexCatalogs = fetchAndIndexCatalogs;
|
|
32
54
|
//# sourceMappingURL=fetchCatalogs.js.map
|