@transcend-io/cli 4.102.0 → 4.103.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 CHANGED
@@ -101,26 +101,30 @@
101
101
  - [Authentication](#authentication-22)
102
102
  - [Arguments](#arguments-22)
103
103
  - [Usage](#usage-23)
104
- - [tr-upload-data-flows-from-csv](#tr-upload-data-flows-from-csv)
104
+ - [tr-pull-consent-preferences](#tr-pull-consent-preferences)
105
105
  - [Authentication](#authentication-23)
106
106
  - [Arguments](#arguments-23)
107
107
  - [Usage](#usage-24)
108
- - [tr-upload-cookies-from-csv](#tr-upload-cookies-from-csv)
108
+ - [tr-upload-data-flows-from-csv](#tr-upload-data-flows-from-csv)
109
109
  - [Authentication](#authentication-24)
110
110
  - [Arguments](#arguments-24)
111
111
  - [Usage](#usage-25)
112
- - [tr-generate-api-keys](#tr-generate-api-keys)
112
+ - [tr-upload-cookies-from-csv](#tr-upload-cookies-from-csv)
113
113
  - [Authentication](#authentication-25)
114
114
  - [Arguments](#arguments-25)
115
115
  - [Usage](#usage-26)
116
- - [tr-build-xdi-sync-endpoint](#tr-build-xdi-sync-endpoint)
116
+ - [tr-generate-api-keys](#tr-generate-api-keys)
117
117
  - [Authentication](#authentication-26)
118
118
  - [Arguments](#arguments-26)
119
119
  - [Usage](#usage-27)
120
- - [tr-create-assessment](#tr-create-assessment)
120
+ - [tr-build-xdi-sync-endpoint](#tr-build-xdi-sync-endpoint)
121
121
  - [Authentication](#authentication-27)
122
122
  - [Arguments](#arguments-27)
123
123
  - [Usage](#usage-28)
124
+ - [tr-create-assessment](#tr-create-assessment)
125
+ - [Authentication](#authentication-28)
126
+ - [Arguments](#arguments-28)
127
+ - [Usage](#usage-29)
124
128
  - [Proxy usage](#proxy-usage)
125
129
 
126
130
  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -162,6 +166,7 @@ yarn tr-derive-data-silos-from-data-flows --auth=$TRANSCEND_API_KEY
162
166
  yarn tr-derive-data-silos-from-data-flows-cross-instance --auth=$TRANSCEND_API_KEY
163
167
  yarn tr-pull-consent-metrics --auth=$TRANSCEND_API_KEY
164
168
  yarn tr-upload-consent-preferences --auth=$TRANSCEND_API_KEY
169
+ yarn tr-pull-consent-preferences --auth=$TRANSCEND_API_KEY
165
170
  yarn tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY
166
171
  yarn tr-upload-cookies-from-csv --auth=$TRANSCEND_API_KEY
167
172
  yarn tr-generate-api-keys --auth=$TRANSCEND_API_KEY
@@ -194,6 +199,7 @@ tr-retry-request-data-silos --auth=$TRANSCEND_API_KEY
194
199
  tr-update-consent-manager --auth=$TRANSCEND_API_KEY
195
200
  tr-pull-consent-metrics --auth=$TRANSCEND_API_KEY
196
201
  tr-upload-consent-preferences --auth=$TRANSCEND_API_KEY
202
+ tr-pull-consent-preferences --auth=$TRANSCEND_API_KEY
197
203
  tr-consent-managers-to-business-entities
198
204
  tr-consent-manager-service-json-to-yml
199
205
  tr-derive-data-silos-from-data-flows --auth=$TRANSCEND_API_KEY
@@ -1874,7 +1880,7 @@ to grab your encryption and signing keys.
1874
1880
  | ------------------- | --------------------------------------------------------------------------------- | ------------- | ---------------------------- | -------- |
1875
1881
  | base64EncryptionKey | The encyption key used to encrypt the userId | string | N/A | true |
1876
1882
  | base64SigningKey | The signing key used to prove authentication of consent request | string | N/A | true |
1877
- | partition | The partition key to upload consent preferences to | string | N/A | true |
1883
+ | partition | The partition key to download consent preferences to | string | N/A | true |
1878
1884
  | file | The file to pull consent preferences from | string - path | ./preferences.csv | false |
1879
1885
  | transcendUrl | URL of the Transcend backend. Use https://consent.us.transcend.io for US hosting. | string - URL | https://consent.transcend.io | false |
1880
1886
  | concurrency | The concurrency to use when uploading requests in parallel. | number | 100 | false |
@@ -1899,6 +1905,81 @@ Upload consent preferences to partition key `4d1c5daa-90b7-4d18-aa40-f86a43d2c72
1899
1905
  yarn tr-upload-consent-preferences --base64EncryptionKey=$TRANSCEND_CONSENT_ENCRYPTION_KEY --base64SigningKey=$TRANSCEND_CONSENT_SIGNING_KEY --partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726 --concurrency=200
1900
1906
  ```
1901
1907
 
1908
+ ### tr-pull-consent-preferences
1909
+
1910
+ This command allows for pull of consent preferences from the [Managed Consent Database](https://docs.transcend.io/docs/api-reference/POST/v1/consent-preferences).
1911
+
1912
+ Each row in the CSV will include:
1913
+
1914
+ | Argument | Description | Type | Default | Required |
1915
+ | -------------- | --------------------------------------------------------------------------------------------------------- | ------------------------- | ------- | -------- |
1916
+ | userId | Unique ID identifying the user that the preferences ar efor | string | N/A | true |
1917
+ | timestamp | Timestamp for when consent was collected for that user | string - timestamp | N/A | true |
1918
+ | purposes | JSON map from consent purpose name -> boolean indicating whether user has opted in or out of that purpose | {[k in string]: boolean } | {} | true |
1919
+ | usp | US Privacy string | string - USP | N/A | false |
1920
+ | airgapVersion | Version of airgap where consent was collected | string | N/A | false |
1921
+ | [purpose name] | Each consent purpose from `purposes` is also included in a column | boolean | N/A | false |
1922
+
1923
+ #### Authentication
1924
+
1925
+ 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).
1926
+
1927
+ The API key must have the following scopes:
1928
+
1929
+ - "View Managed Consent Database Admin API"
1930
+
1931
+ #### Arguments
1932
+
1933
+ | Argument | Description | Type | Default | Required |
1934
+ | --------------- | ------------------------------------------------------------------------------------ | ------------------ | ------------------------ | -------- |
1935
+ | auth | The Transcend API key with the scopes necessary for the command. | string | N/A | true |
1936
+ | partition | The partition key to upload consent preferences to | string | N/A | true |
1937
+ | sombraAuth | The sombra internal key, use for additional authentication when self-hosting sombra. | string | N/A | false |
1938
+ | file | Path to the CSV file to save preferences to | string - file-path | ./preferences.csv | false |
1939
+ | transcendUrl | URL of the Transcend backend. Use https://api.us.transcend.io for US hosting. | string - URL | https://api.transcend.io | false |
1940
+ | timestampBefore | Filter for consents updated this time | Date | N/A | false |
1941
+ | timestampAfter | Filter for consents updated after this time | Date | N/A | false |
1942
+ | identifiers | Filter for specific identifiers | string[] | N/A | false |
1943
+ | concurrency | The concurrency to use when downloading consents in parallel. | number | 100 | false |
1944
+
1945
+ #### Usage
1946
+
1947
+ Fetch all consent preferences from partition key `4d1c5daa-90b7-4d18-aa40-f86a43d2c726`
1948
+
1949
+ ```sh
1950
+ yarn tr-pull-consent-preferences --auth=$TRANSCEND_API_KEY --partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726
1951
+ ```
1952
+
1953
+ Fetch all consent preferences from partition key `4d1c5daa-90b7-4d18-aa40-f86a43d2c726` and save to ./consent.csv
1954
+
1955
+ ```sh
1956
+ yarn tr-pull-consent-preferences --auth=$TRANSCEND_API_KEY --partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726 --file=./consent.csv
1957
+ ```
1958
+
1959
+ Filter on consent updates before a date
1960
+
1961
+ ```sh
1962
+ yarn tr-pull-consent-preferences --auth=$TRANSCEND_API_KEY --partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726 --timestampBefore=04/03/2023
1963
+ ```
1964
+
1965
+ Filter on consent updates after a date
1966
+
1967
+ ```sh
1968
+ yarn tr-pull-consent-preferences --auth=$TRANSCEND_API_KEY --partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726 --timestampAfter=04/03/2023
1969
+ ```
1970
+
1971
+ For self-hosted sombras that use an internal key:
1972
+
1973
+ ```sh
1974
+ yarn tr-pull-consent-preferences --auth=$TRANSCEND_API_KEY --sombraAuth=$SOMBRA_INTERNAL_KEY --partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726
1975
+ ```
1976
+
1977
+ Specifying the backend URL, needed for US hosted backend infrastructure.
1978
+
1979
+ ```sh
1980
+ yarn tr-pull-consent-preferences --auth=$TRANSCEND_API_KEY --partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726 --transcendUrl=https://api.us.transcend.io
1981
+ ```
1982
+
1902
1983
  ### tr-upload-data-flows-from-csv
1903
1984
 
1904
1985
  This command allows for uploading of data flows from CSV.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli-pull-consent-preferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-pull-consent-preferences.d.ts","sourceRoot":"","sources":["../src/cli-pull-consent-preferences.ts"],"names":[],"mappings":""}
@@ -0,0 +1,83 @@
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 yargs_parser_1 = __importDefault(require("yargs-parser"));
8
+ const colors_1 = __importDefault(require("colors"));
9
+ const logger_1 = require("./logger");
10
+ const constants_1 = require("./constants");
11
+ const consent_manager_1 = require("./consent-manager");
12
+ const cron_1 = require("./cron");
13
+ const graphql_1 = require("./graphql");
14
+ const requests_1 = require("./requests");
15
+ /**
16
+ * Pull consent preferences from the managed consent database
17
+ *
18
+ * Requires following documentation found at:
19
+ * https://docs.transcend.io/docs/consent/reference/managed-consent-database
20
+ * https://docs.transcend.io/docs/api-reference/POST/v1/consent-preferences
21
+ *
22
+ * Dev Usage:
23
+ * yarn ts-node ./src/cli-pull-consent-preferences.ts --auth=$TRANSCEND_API_KEY
24
+ *
25
+ * Standard usage:
26
+ * yarn tr-pull-consent-preferences --auth=$TRANSCEND_API_KEY
27
+ */
28
+ async function main() {
29
+ // Parse command line arguments
30
+ const {
31
+ /** File to save preferences to */
32
+ file = 'preferences.csv',
33
+ /** Sombra API key */
34
+ sombraAuth,
35
+ /** Transcend URL */
36
+ transcendUrl = constants_1.DEFAULT_TRANSCEND_API,
37
+ /** API key */
38
+ auth,
39
+ /** Partition key */
40
+ partition,
41
+ /** Filter on specific identifiers */
42
+ identifiers = '',
43
+ /** Filter on consent preferences changed before this date */
44
+ timestampBefore,
45
+ /** Filter on consent preferences changed after this date */
46
+ timestampAfter,
47
+ /** Concurrency */
48
+ concurrency = '100', } = (0, yargs_parser_1.default)(process.argv.slice(2));
49
+ // Ensure auth is passed
50
+ if (!auth) {
51
+ logger_1.logger.error(colors_1.default.red('A Transcend API key must be provided. You can specify using --auth=$TRANSCEND_API_KEY'));
52
+ process.exit(1);
53
+ }
54
+ // Ensure partition
55
+ if (!partition) {
56
+ logger_1.logger.error(colors_1.default.red('A partition must be provided. ' +
57
+ 'You can specify using --partition=ee1a0845-694e-4820-9d51-50c7d0a23467'));
58
+ process.exit(1);
59
+ }
60
+ // Create sombra instance to communicate with
61
+ const sombra = await (0, graphql_1.createSombraGotInstance)(transcendUrl, auth, sombraAuth);
62
+ // Fetch preferences
63
+ const identifiersAsList = (0, requests_1.splitCsvToList)(identifiers);
64
+ const preferences = await (0, consent_manager_1.fetchConsentPreferences)(sombra, {
65
+ partition,
66
+ filterBy: {
67
+ ...(timestampBefore ? { timestampBefore } : {}),
68
+ ...(timestampAfter ? { timestampAfter } : {}),
69
+ ...(identifiersAsList.length > 0
70
+ ? { identifiers: identifiersAsList }
71
+ : {}),
72
+ },
73
+ limit: parseInt(concurrency, 10),
74
+ });
75
+ // Write to disk
76
+ (0, cron_1.writeCsv)(file, preferences.map((pref) => ({
77
+ ...pref,
78
+ purposes: JSON.stringify(pref.purposes),
79
+ ...pref.purposes,
80
+ })));
81
+ }
82
+ main();
83
+ //# sourceMappingURL=cli-pull-consent-preferences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-pull-consent-preferences.js","sourceRoot":"","sources":["../src/cli-pull-consent-preferences.ts"],"names":[],"mappings":";;;;;;AAEA,gEAAiC;AACjC,oDAA4B;AAE5B,qCAAkC;AAClC,2CAAoD;AACpD,uDAA4D;AAC5D,iCAAkC;AAClC,uCAAoD;AACpD,yCAA4C;AAE5C;;;;;;;;;;;;GAYG;AACH,KAAK,UAAU,IAAI;IACjB,+BAA+B;IAC/B,MAAM;IACJ,kCAAkC;IAClC,IA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gBAC9B,CAAC,CAAC,EAAE,WAAW,EAAE,iBAAiB,EAAE;gBACpC,CAAC,CAAC,EAAE,CAAC;SACR;QACD,KAAK,EAAE,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;KACjC,CAAC,CAAC;IAEH,gBAAgB;IAChB,IAAA,eAAQ,EACN,IAAI,EACJ,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACzB,GAAG,IAAI;QACP,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;QACvC,GAAG,IAAI,CAAC,QAAQ;KACjB,CAAC,CAAC,CACJ,CAAC;AACJ,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,48 @@
1
+ import * as t from 'io-ts';
2
+ import type { Got } from 'got';
3
+ export declare const ConsentPreference: t.TypeC<{
4
+ userId: t.StringC;
5
+ partition: t.StringC;
6
+ timestamp: t.StringC;
7
+ purposes: t.RecordC<t.StringC, t.BooleanC>;
8
+ }>;
9
+ /** Type override */
10
+ export type ConsentPreference = t.TypeOf<typeof ConsentPreference>;
11
+ export declare const ConsentPreferenceResponse: t.IntersectionC<[t.TypeC<{
12
+ nodes: t.ArrayC<t.TypeC<{
13
+ userId: t.StringC;
14
+ partition: t.StringC;
15
+ timestamp: t.StringC;
16
+ purposes: t.RecordC<t.StringC, t.BooleanC>;
17
+ }>>;
18
+ }>, t.PartialC<{
19
+ lastKey: t.PartialC<{
20
+ userId: t.StringC;
21
+ partition: t.StringC;
22
+ }>;
23
+ }>]>;
24
+ /** Type override */
25
+ export type ConsentPreferenceResponse = t.TypeOf<typeof ConsentPreferenceResponse>;
26
+ /**
27
+ * Fetch consent preferences for the managed consent database
28
+ *
29
+ * @param sombra - Sombra instance configured to make requests
30
+ * @param options - Additional options
31
+ * @returns The consent preferences
32
+ */
33
+ export declare function fetchConsentPreferences(sombra: Got, { partition, filterBy, limit, }: {
34
+ /** Partition key to fetch */
35
+ partition: string;
36
+ /** Filter consent preferences */
37
+ filterBy?: {
38
+ /** Fetch specific identifiers */
39
+ identifiers?: string[];
40
+ /** Filter before timestamp */
41
+ timestampBefore?: string;
42
+ /** Filter after timestamp */
43
+ timestampAfter?: string;
44
+ };
45
+ /** Number of items to pull back at once */
46
+ limit?: number;
47
+ }): Promise<ConsentPreference[]>;
48
+ //# sourceMappingURL=fetchConsentPreferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchConsentPreferences.d.ts","sourceRoot":"","sources":["../../src/consent-manager/fetchConsentPreferences.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAE3B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/B,eAAO,MAAM,iBAAiB;;;;;EAK5B,CAAC;AAEH,oBAAoB;AACpB,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEnE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;IAUpC,CAAC;AAEH,oBAAoB;AACpB,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAC9C,OAAO,yBAAyB,CACjC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,GAAG,EACX,EACE,SAAS,EACT,QAAa,EACb,KAAU,GACX,EAAE;IACD,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,QAAQ,CAAC,EAAE;QACT,iCAAiC;QACjC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,8BAA8B;QAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,6BAA6B;QAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACA,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAkC9B"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.fetchConsentPreferences = exports.ConsentPreferenceResponse = exports.ConsentPreference = void 0;
27
+ const t = __importStar(require("io-ts"));
28
+ const type_utils_1 = require("@transcend-io/type-utils");
29
+ exports.ConsentPreference = t.type({
30
+ userId: t.string,
31
+ partition: t.string,
32
+ timestamp: t.string,
33
+ purposes: t.record(t.string, t.boolean),
34
+ });
35
+ exports.ConsentPreferenceResponse = t.intersection([
36
+ t.type({
37
+ nodes: t.array(exports.ConsentPreference),
38
+ }),
39
+ t.partial({
40
+ lastKey: t.partial({
41
+ userId: t.string,
42
+ partition: t.string,
43
+ }),
44
+ }),
45
+ ]);
46
+ /**
47
+ * Fetch consent preferences for the managed consent database
48
+ *
49
+ * @param sombra - Sombra instance configured to make requests
50
+ * @param options - Additional options
51
+ * @returns The consent preferences
52
+ */
53
+ async function fetchConsentPreferences(sombra, { partition, filterBy = {}, limit = 50, }) {
54
+ let currentLastKey;
55
+ const data = [];
56
+ let shouldContinue = true;
57
+ while (shouldContinue) {
58
+ // eslint-disable-next-line no-await-in-loop
59
+ const response = await sombra
60
+ .post('v1/consent-preferences', {
61
+ json: {
62
+ partition,
63
+ ...(Object.values(filterBy).length > 0 ? { filterBy } : {}),
64
+ // using lastKey to paginate if it exists (will not for first iteration)
65
+ startKey: currentLastKey || undefined,
66
+ limit,
67
+ },
68
+ })
69
+ .json();
70
+ const { nodes, lastKey } = (0, type_utils_1.decodeCodec)(exports.ConsentPreferenceResponse, response);
71
+ if (!nodes || nodes.length === 0) {
72
+ break;
73
+ }
74
+ // Process the data received from the API call
75
+ // For example, push the new data into an array
76
+ data.push(...nodes);
77
+ // Extract the lastKey from the API response
78
+ currentLastKey = lastKey;
79
+ shouldContinue = !!lastKey && Object.keys(lastKey).length > 0;
80
+ }
81
+ return data;
82
+ }
83
+ exports.fetchConsentPreferences = fetchConsentPreferences;
84
+ //# sourceMappingURL=fetchConsentPreferences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchConsentPreferences.js","sourceRoot":"","sources":["../../src/consent-manager/fetchConsentPreferences.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,yDAAuD;AAG1C,QAAA,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC;IACtC,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB,SAAS,EAAE,CAAC,CAAC,MAAM;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM;IACnB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC;CACxC,CAAC,CAAC;AAKU,QAAA,yBAAyB,GAAG,CAAC,CAAC,YAAY,CAAC;IACtD,CAAC,CAAC,IAAI,CAAC;QACL,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,yBAAiB,CAAC;KAClC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;KAC/D;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAvDD,0DAuDC"}
@@ -6,4 +6,5 @@ export * from './buildXdiSyncEndpoint';
6
6
  export * from './consentManagersToBusinessEntities';
7
7
  export * from './domainToHost';
8
8
  export * from './createConsentToken';
9
+ export * from './fetchConsentPreferences';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/consent-manager/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC;AACtD,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qCAAqC,CAAC;AACpD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/consent-manager/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC;AACtD,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qCAAqC,CAAC;AACpD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC"}
@@ -22,4 +22,5 @@ __exportStar(require("./buildXdiSyncEndpoint"), exports);
22
22
  __exportStar(require("./consentManagersToBusinessEntities"), exports);
23
23
  __exportStar(require("./domainToHost"), exports);
24
24
  __exportStar(require("./createConsentToken"), exports);
25
+ __exportStar(require("./fetchConsentPreferences"), exports);
25
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/consent-manager/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wEAAsD;AACtD,2DAAyC;AACzC,yDAAuC;AACvC,8DAA4C;AAC5C,yDAAuC;AACvC,sEAAoD;AACpD,iDAA+B;AAC/B,uDAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/consent-manager/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wEAAsD;AACtD,2DAAyC;AACzC,yDAAuC;AACvC,8DAA4C;AAC5C,yDAAuC;AACvC,sEAAoD;AACpD,iDAA+B;AAC/B,uDAAqC;AACrC,4DAA0C"}