@transcend-io/cli 4.99.0 → 4.101.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.
Files changed (49) hide show
  1. package/README.md +67 -10
  2. package/build/ai/TranscendAiPrompt.d.ts +3 -2
  3. package/build/ai/TranscendAiPrompt.d.ts.map +1 -1
  4. package/build/ai/TranscendAiPrompt.js +25 -4
  5. package/build/ai/TranscendAiPrompt.js.map +1 -1
  6. package/build/ai/getGitFilesThatChanged.d.ts +31 -0
  7. package/build/ai/getGitFilesThatChanged.d.ts.map +1 -0
  8. package/build/ai/getGitFilesThatChanged.js +56 -0
  9. package/build/ai/getGitFilesThatChanged.js.map +1 -0
  10. package/build/ai/index.d.ts +1 -0
  11. package/build/ai/index.d.ts.map +1 -1
  12. package/build/ai/index.js +1 -0
  13. package/build/ai/index.js.map +1 -1
  14. package/build/cli-upload-consent-preferences.d.ts +3 -0
  15. package/build/cli-upload-consent-preferences.d.ts.map +1 -0
  16. package/build/cli-upload-consent-preferences.js +72 -0
  17. package/build/cli-upload-consent-preferences.js.map +1 -0
  18. package/build/consent-manager/createConsentToken.d.ts +11 -0
  19. package/build/consent-manager/createConsentToken.d.ts.map +1 -0
  20. package/build/consent-manager/createConsentToken.js +67 -0
  21. package/build/consent-manager/createConsentToken.js.map +1 -0
  22. package/build/consent-manager/index.d.ts +1 -0
  23. package/build/consent-manager/index.d.ts.map +1 -1
  24. package/build/consent-manager/index.js +1 -0
  25. package/build/consent-manager/index.js.map +1 -1
  26. package/build/consent-manager/uploadConsentPreferences.d.ts +41 -0
  27. package/build/consent-manager/uploadConsentPreferences.d.ts.map +1 -0
  28. package/build/consent-manager/uploadConsentPreferences.js +115 -0
  29. package/build/consent-manager/uploadConsentPreferences.js.map +1 -0
  30. package/build/constants.d.ts +5 -0
  31. package/build/constants.d.ts.map +1 -1
  32. package/build/constants.js +6 -1
  33. package/build/constants.js.map +1 -1
  34. package/build/graphql/createTranscendConsentGotInstance.d.ts +10 -0
  35. package/build/graphql/createTranscendConsentGotInstance.d.ts.map +1 -0
  36. package/build/graphql/createTranscendConsentGotInstance.js +22 -0
  37. package/build/graphql/createTranscendConsentGotInstance.js.map +1 -0
  38. package/build/graphql/index.d.ts +5 -0
  39. package/build/graphql/index.d.ts.map +1 -1
  40. package/build/graphql/index.js +5 -0
  41. package/build/graphql/index.js.map +1 -1
  42. package/build/tests/TranscendAiPrompt.test.js +34 -7
  43. package/build/tests/TranscendAiPrompt.test.js.map +1 -1
  44. package/build/tests/getGitFilesThatChanged.test.d.ts +2 -0
  45. package/build/tests/getGitFilesThatChanged.test.d.ts.map +1 -0
  46. package/build/tests/getGitFilesThatChanged.test.js +24 -0
  47. package/build/tests/getGitFilesThatChanged.test.js.map +1 -0
  48. package/build/tsbuildinfo +1 -1
  49. package/package.json +4 -1
package/README.md CHANGED
@@ -97,27 +97,31 @@
97
97
  - [Authentication](#authentication-21)
98
98
  - [Arguments](#arguments-21)
99
99
  - [Usage](#usage-22)
100
- - [tr-upload-data-flows-from-csv](#tr-upload-data-flows-from-csv)
100
+ - [tr-upload-consent-preferences](#tr-upload-consent-preferences)
101
101
  - [Authentication](#authentication-22)
102
102
  - [Arguments](#arguments-22)
103
103
  - [Usage](#usage-23)
104
- - [tr-upload-cookies-from-csv](#tr-upload-cookies-from-csv)
104
+ - [tr-upload-data-flows-from-csv](#tr-upload-data-flows-from-csv)
105
105
  - [Authentication](#authentication-23)
106
106
  - [Arguments](#arguments-23)
107
107
  - [Usage](#usage-24)
108
- - [tr-generate-api-keys](#tr-generate-api-keys)
108
+ - [tr-upload-cookies-from-csv](#tr-upload-cookies-from-csv)
109
109
  - [Authentication](#authentication-24)
110
110
  - [Arguments](#arguments-24)
111
111
  - [Usage](#usage-25)
112
- - [tr-build-xdi-sync-endpoint](#tr-build-xdi-sync-endpoint)
112
+ - [tr-generate-api-keys](#tr-generate-api-keys)
113
113
  - [Authentication](#authentication-25)
114
114
  - [Arguments](#arguments-25)
115
115
  - [Usage](#usage-26)
116
- - [Proxy usage](#proxy-usage)
117
- - [tr-create-assessment](#tr-create-assessment)
116
+ - [tr-build-xdi-sync-endpoint](#tr-build-xdi-sync-endpoint)
118
117
  - [Authentication](#authentication-26)
119
118
  - [Arguments](#arguments-26)
120
119
  - [Usage](#usage-27)
120
+ - [tr-create-assessment](#tr-create-assessment)
121
+ - [Authentication](#authentication-27)
122
+ - [Arguments](#arguments-27)
123
+ - [Usage](#usage-28)
124
+ - [Proxy usage](#proxy-usage)
121
125
 
122
126
  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
123
127
 
@@ -157,6 +161,7 @@ yarn tr-consent-manager-service-json-to-yml
157
161
  yarn tr-derive-data-silos-from-data-flows --auth=$TRANSCEND_API_KEY
158
162
  yarn tr-derive-data-silos-from-data-flows-cross-instance --auth=$TRANSCEND_API_KEY
159
163
  yarn tr-pull-consent-metrics --auth=$TRANSCEND_API_KEY
164
+ yarn tr-upload-consent-preferences --auth=$TRANSCEND_API_KEY
160
165
  yarn tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY
161
166
  yarn tr-upload-cookies-from-csv --auth=$TRANSCEND_API_KEY
162
167
  yarn tr-generate-api-keys --auth=$TRANSCEND_API_KEY
@@ -188,6 +193,7 @@ tr-skip-request-data-silos --auth=$TRANSCEND_API_KEY
188
193
  tr-retry-request-data-silos --auth=$TRANSCEND_API_KEY
189
194
  tr-update-consent-manager --auth=$TRANSCEND_API_KEY
190
195
  tr-pull-consent-metrics --auth=$TRANSCEND_API_KEY
196
+ tr-upload-consent-preferences --auth=$TRANSCEND_API_KEY
191
197
  tr-consent-managers-to-business-entities
192
198
  tr-consent-manager-service-json-to-yml
193
199
  tr-derive-data-silos-from-data-flows --auth=$TRANSCEND_API_KEY
@@ -1842,6 +1848,57 @@ Bin data hourly vs daily
1842
1848
  yarn tr-pull-consent-metrics --auth=$TRANSCEND_API_KEY --start=01/01/2023 --bin=1h
1843
1849
  ```
1844
1850
 
1851
+ ### tr-upload-consent-preferences
1852
+
1853
+ This command allows for updating of consent preferences to the [Managed Consent Database](https://docs.transcend.io/docs/consent/reference/managed-consent-database).
1854
+
1855
+ Each row in the CSV must include:
1856
+
1857
+ | Argument | Description | Type | Default | Required |
1858
+ | --------- | --------------------------------------------------------------------------------------------------------- | ------------------------- | ------- | -------- |
1859
+ | userId | Unique ID identifying the user that the preferences ar efor | string | N/A | true |
1860
+ | timestamp | Timestamp for when consent was collected for that user | string - timestamp | N/A | true |
1861
+ | purposes | JSON map from consent purpose name -> boolean indicating whether user has opted in or out of that purpose | {[k in string]: boolean } | {} | false |
1862
+ | confirmed | Whether consent preferences have been explicitly confirmed or inferred | boolean | true | false |
1863
+ | updated | Time consent preferences were last updated | string - timestamp | N/A | false |
1864
+ | usp | US Privacy string | string - USP | N/A | false |
1865
+
1866
+ #### Authentication
1867
+
1868
+ In order to use this cli, you will first need to follow [this guide](https://docs.transcend.io/docs/consent/reference/managed-consent-database#authenticate-a-user's-consent) in order
1869
+ to grab your encryption and signing keys.
1870
+
1871
+ #### Arguments
1872
+
1873
+ | Argument | Description | Type | Default | Required |
1874
+ | ------------------- | --------------------------------------------------------------------------------- | ------------- | ---------------------------- | -------- |
1875
+ | base64EncryptionKey | The encyption key used to encrypt the userId | string | N/A | true |
1876
+ | 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 |
1878
+ | file | The file to pull consent preferences from | string - path | ./preferences.csv | false |
1879
+ | transcendUrl | URL of the Transcend backend. Use https://consent.us.transcend.io for US hosting. | string - URL | https://consent.transcend.io | false |
1880
+ | concurrency | The concurrency to use when uploading requests in parallel. | number | 100 | false |
1881
+
1882
+ #### Usage
1883
+
1884
+ Upload consent preferences to partition key `4d1c5daa-90b7-4d18-aa40-f86a43d2c726`
1885
+
1886
+ ```sh
1887
+ yarn tr-upload-consent-preferences --base64EncryptionKey=$TRANSCEND_CONSENT_ENCRYPTION_KEY --base64SigningKey=$TRANSCEND_CONSENT_SIGNING_KEY --partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726
1888
+ ```
1889
+
1890
+ Upload consent preferences to partition key `4d1c5daa-90b7-4d18-aa40-f86a43d2c726` from file `./consent.csv`
1891
+
1892
+ ```sh
1893
+ yarn tr-upload-consent-preferences --base64EncryptionKey=$TRANSCEND_CONSENT_ENCRYPTION_KEY --base64SigningKey=$TRANSCEND_CONSENT_SIGNING_KEY --partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726 --file=./consent.csv
1894
+ ```
1895
+
1896
+ Upload consent preferences to partition key `4d1c5daa-90b7-4d18-aa40-f86a43d2c726` and set concurrency
1897
+
1898
+ ```sh
1899
+ yarn tr-upload-consent-preferences --base64EncryptionKey=$TRANSCEND_CONSENT_ENCRYPTION_KEY --base64SigningKey=$TRANSCEND_CONSENT_SIGNING_KEY --partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726 --concurrency=200
1900
+ ```
1901
+
1845
1902
  ### tr-upload-data-flows-from-csv
1846
1903
 
1847
1904
  This command allows for uploading of data flows from CSV.
@@ -2103,10 +2160,6 @@ Override XDI allowed commands
2103
2160
  yarn tr-build-xdi-sync-endpoint --auth=$TRANSCEND_API_KEY --xdiLocation=https://cdn.your-site.com/xdi.js --xdiAllowedCommands="ExtractIdentifiers:Simple"
2104
2161
  ```
2105
2162
 
2106
- ## Proxy usage
2107
-
2108
- If you are trying to use the cli inside a corporate firewall and need to send traffic through a proxy, you can do so via the `http_proxy` environment variable or the `--httpProxy` flag, with a command like `yarn tr-pull --auth=$TRANSCEND_API_KEY --httpProxy="http://localhost:5051"`.
2109
-
2110
2163
  ### tr-create-assessment
2111
2164
 
2112
2165
  This command allows for creating a new assessment form an assessment template.
@@ -2149,3 +2202,7 @@ Configuring additional variables:
2149
2202
  ```sh
2150
2203
  yarn tr-create-assessment --auth=$TRANSCEND_API_KEY --title="Test" --template="[AI Prompt] Product Manager Notes Parsing" --variables=description:"testt test"
2151
2204
  ```
2205
+
2206
+ ## Proxy usage
2207
+
2208
+ If you are trying to use the cli inside a corporate firewall and need to send traffic through a proxy, you can do so via the `http_proxy` environment variable or the `--httpProxy` flag, with a command like `yarn tr-pull --auth=$TRANSCEND_API_KEY --httpProxy="http://localhost:5051"`.
@@ -4,6 +4,7 @@ import { Secret } from '@transcend-io/secret-value';
4
4
  import * as t from 'io-ts';
5
5
  import { HandlebarsInput } from './createHandlebarsWithHelpers';
6
6
  export declare const EXPECTED_ATTRIBUTE_PREFIX = "attribute-";
7
+ export declare const BUSINESS_ENTITIES_PREFIX = "businessEntities-";
7
8
  /**
8
9
  * Define an AI prompt that can be loaded from Transcend
9
10
  */
@@ -37,11 +38,11 @@ export declare class TranscendAiPrompt<TParams extends ObjByString, TOutputCodec
37
38
  * @param options - Additional options
38
39
  * @returns A function that can be used to call the prompt
39
40
  */
40
- fetchPromptFromTranscend({ fillTemplateWithAttributes, transcendUrl, transcendApiKey, requireApproval, }: {
41
+ fetchPromptFromTranscend({ fillTemplateFromInventory, transcendUrl, transcendApiKey, requireApproval, }: {
41
42
  /** The Transcend API key */
42
43
  transcendApiKey: string | Secret<string>;
43
44
  /** When true, template in any attribute definitions in the prompt */
44
- fillTemplateWithAttributes?: boolean;
45
+ fillTemplateFromInventory?: boolean;
45
46
  /** API of Transcend to call */
46
47
  transcendUrl?: string;
47
48
  /** When true, throw an error if the prompt is not approved */
@@ -1 +1 @@
1
- {"version":3,"file":"TranscendAiPrompt.d.ts","sourceRoot":"","sources":["../../src/ai/TranscendAiPrompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAK3B,OAAO,EACL,eAAe,EAEhB,MAAM,+BAA+B,CAAC;AAIvC,eAAO,MAAM,yBAAyB,e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GxC;;;;;OAKG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;CAM1D"}
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.TranscendAiPrompt = exports.EXPECTED_ATTRIBUTE_PREFIX = void 0;
6
+ exports.TranscendAiPrompt = exports.BUSINESS_ENTITIES_PREFIX = exports.EXPECTED_ATTRIBUTE_PREFIX = void 0;
7
7
  const type_utils_1 = require("@transcend-io/type-utils");
8
8
  const privacy_types_1 = require("@transcend-io/privacy-types");
9
9
  const fetchAssessments_1 = require("../graphql/fetchAssessments");
@@ -14,6 +14,7 @@ const createHandlebarsWithHelpers_1 = require("./createHandlebarsWithHelpers");
14
14
  const camelCase_1 = __importDefault(require("lodash/camelCase"));
15
15
  const keyBy_1 = __importDefault(require("lodash/keyBy"));
16
16
  exports.EXPECTED_ATTRIBUTE_PREFIX = 'attribute-';
17
+ exports.BUSINESS_ENTITIES_PREFIX = 'businessEntities-';
17
18
  /**
18
19
  * Define an AI prompt that can be loaded from Transcend
19
20
  */
@@ -37,7 +38,7 @@ class TranscendAiPrompt {
37
38
  * @param options - Additional options
38
39
  * @returns A function that can be used to call the prompt
39
40
  */
40
- async fetchPromptFromTranscend({ fillTemplateWithAttributes = true, transcendUrl = constants_1.DEFAULT_TRANSCEND_API, transcendApiKey, requireApproval, }) {
41
+ async fetchPromptFromTranscend({ fillTemplateFromInventory = true, transcendUrl = constants_1.DEFAULT_TRANSCEND_API, transcendApiKey, requireApproval, }) {
41
42
  // construct GraphQL client
42
43
  const client = (0, graphql_1.buildTranscendGraphQLClient)(transcendUrl, typeof transcendApiKey === 'string'
43
44
  ? transcendApiKey
@@ -58,8 +59,9 @@ class TranscendAiPrompt {
58
59
  throw new Error(`Assessment "${this.title}" cannot be used because it's in status: "${assessment.status}"`);
59
60
  }
60
61
  // Template attributes into the template string
61
- const extraParams = {};
62
- if (fillTemplateWithAttributes) {
62
+ let extraParams = {};
63
+ // Template in attributes
64
+ if (fillTemplateFromInventory) {
63
65
  // pull out the variables from the handlebar string
64
66
  const schema = (0, getVariablesFromHandlebarsTemplate_1.getVariablesFromHandlebarsTemplate)(assessment.content);
65
67
  // pull out the attributes to fetch
@@ -82,6 +84,25 @@ class TranscendAiPrompt {
82
84
  extraParams[attributeNameWithPrefix] = existingAttribute;
83
85
  });
84
86
  }
87
+ // pull out the attributes to fetch
88
+ const businessEntitiesToFetch = Object.keys(schema).filter((key) => key.startsWith(exports.BUSINESS_ENTITIES_PREFIX));
89
+ // Fetch business entities if there are template variables to fill
90
+ if (businessEntitiesToFetch.length > 0) {
91
+ // TODO: https://transcend.height.app/T-29886 - only fetch business needed
92
+ // and find a way to template when multiple entities
93
+ const businessEntities = await (0, graphql_1.fetchAllBusinessEntities)(client);
94
+ const businessEntity = businessEntities[0];
95
+ if (businessEntity) {
96
+ extraParams = {
97
+ ...extraParams,
98
+ ...Object.entries(businessEntity).reduce((acc, [key, value]) => Object.assign(acc, { [`businessEntities-${key}`]: value }), {}),
99
+ };
100
+ extraParams.dataProtectionOfficerName =
101
+ businessEntity.dataProtectionOfficerName;
102
+ extraParams.dataProtectionOfficerEmail =
103
+ businessEntity.dataProtectionOfficerEmail;
104
+ }
105
+ }
85
106
  }
86
107
  // Return function that can compile template with attributes
87
108
  // and provided parameters
@@ -1 +1 @@
1
- {"version":3,"file":"TranscendAiPrompt.js","sourceRoot":"","sources":["../../src/ai/TranscendAiPrompt.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAoE;AAEpE,+DAA+D;AAG/D,kEAAkE;AAClE,4CAAqD;AACrD,wCAA6E;AAC7E,sGAAmG;AACnG,+EAGuC;AACvC,iEAAyC;AACzC,yDAAiC;AAEpB,QAAA,yBAAyB,GAAG,YAAY,CAAC;AAEtD;;GAEG;AACH,MAAa,i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KG;IACH,eAAe,CAAC,QAAgB;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,mBAAmB;YACxC,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ;YAChE,CAAC,CAAC,QAAQ,CAAC;QACb,OAAO,IAAA,wBAAW,EAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC5C,CAAC;CACF;AAxLD,8CAwLC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Function thats gets the git files that have changed
3
+ * and returns the code
4
+ *
5
+ * @param options - Options
6
+ * @returns Changes files and diffs
7
+ */
8
+ export declare function getGitFilesThatChanged({ baseBranch, rootDirectory, githubRepo, excludedGlob, fileBlockList, }: {
9
+ /** Base branch */
10
+ baseBranch: string;
11
+ /** Github repo name */
12
+ githubRepo: string;
13
+ /** Root directory */
14
+ rootDirectory: string;
15
+ /** A glob that excludes files */
16
+ excludedGlob?: string[];
17
+ /** Block list of files to not process */
18
+ fileBlockList?: string[];
19
+ }): {
20
+ /** The list of files that changed */
21
+ changedFiles: string[];
22
+ /** Github repo name */
23
+ repoName: string;
24
+ /** Current commit */
25
+ commit: string;
26
+ /** File diffs */
27
+ fileDiffs: {
28
+ [k in string]: string;
29
+ };
30
+ };
31
+ //# sourceMappingURL=getGitFilesThatChanged.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGitFilesThatChanged.d.ts","sourceRoot":"","sources":["../../src/ai/getGitFilesThatChanged.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,UAAU,EACV,aAAa,EACb,UAAU,EACV,YAAiB,EACjB,aAAkB,GACnB,EAAE;IACD,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B,GAAG;IACF,qCAAqC;IACrC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB;IACjB,SAAS,EAAE;SAAG,CAAC,IAAI,MAAM,GAAG,MAAM;KAAE,CAAC;CACtC,CA0DA"}
@@ -0,0 +1,56 @@
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.getGitFilesThatChanged = void 0;
7
+ const difference_1 = __importDefault(require("lodash/difference"));
8
+ const fast_glob_1 = __importDefault(require("fast-glob"));
9
+ const child_process_1 = require("child_process");
10
+ /**
11
+ * Function thats gets the git files that have changed
12
+ * and returns the code
13
+ *
14
+ * @param options - Options
15
+ * @returns Changes files and diffs
16
+ */
17
+ function getGitFilesThatChanged({ baseBranch, rootDirectory, githubRepo, excludedGlob = [], fileBlockList = [], }) {
18
+ // Pull base branch
19
+ (0, child_process_1.execSync)(`git fetch origin ${baseBranch}`);
20
+ // Latest commit on base branch. If we are on the base branch, we take the prior commit
21
+ const latestBasedCommit = (0, child_process_1.execSync)(`git ls-remote ${githubRepo} "refs/heads/${baseBranch}" | cut -f 1`, { encoding: 'utf-8' }).split('\n')[0];
22
+ // This commit
23
+ const latestThisCommit = (0, child_process_1.execSync)('git rev-parse HEAD', {
24
+ encoding: 'utf-8',
25
+ }).split('\n')[0];
26
+ // Ensure commits are present
27
+ if (!latestBasedCommit || !latestThisCommit) {
28
+ throw new Error('FAILED TO FIND COMMIT RANGE');
29
+ }
30
+ // Get the diff between the given branch and base branch
31
+ const diff = (0, child_process_1.execSync)(`git fetch && git diff --name-only "${baseBranch || latestBasedCommit}...${latestThisCommit}" -- ${rootDirectory}`, { encoding: 'utf-8' });
32
+ // Filter out block list
33
+ const changedFiles = (0, difference_1.default)(diff.split('\n').filter((f) => f), fileBlockList);
34
+ // Filter out globs
35
+ const filteredChanges = excludedGlob.length > 0
36
+ ? fast_glob_1.default.sync(changedFiles, { ignore: excludedGlob })
37
+ : changedFiles;
38
+ // Get the contents of only the changed files
39
+ const fileDiffs = {};
40
+ filteredChanges.forEach((file) => {
41
+ const contents = (0, child_process_1.execSync)(`git show ${latestThisCommit}:${file}`, {
42
+ encoding: 'utf-8',
43
+ });
44
+ fileDiffs[file] = contents;
45
+ });
46
+ // Pull the github repo name
47
+ const repoName = githubRepo.split('/').pop().split('.')[0];
48
+ return {
49
+ changedFiles,
50
+ fileDiffs,
51
+ repoName,
52
+ commit: latestThisCommit,
53
+ };
54
+ }
55
+ exports.getGitFilesThatChanged = getGitFilesThatChanged;
56
+ //# sourceMappingURL=getGitFilesThatChanged.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGitFilesThatChanged.js","sourceRoot":"","sources":["../../src/ai/getGitFilesThatChanged.ts"],"names":[],"mappings":";;;;;;AAAA,mEAA2C;AAC3C,0DAAiC;AACjC,iDAAyC;AAEzC;;;;;;GAMG;AACH,SAAgB,sBAAsB,CAAC,EACrC,UAAU,EACV,aAAa,EACb,UAAU,EACV,YAAY,GAAG,EAAE,EACjB,aAAa,GAAG,EAAE,GAYnB;IAUC,mBAAmB;IACnB,IAAA,wBAAQ,EAAC,oBAAoB,UAAU,EAAE,CAAC,CAAC;IAE3C,uFAAuF;IACvF,MAAM,iBAAiB,GAAG,IAAA,wBAAQ,EAChC,iBAAiB,UAAU,gBAAgB,UAAU,cAAc,EACnE,EAAE,QAAQ,EAAE,OAAO,EAAE,CACtB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjB,cAAc;IAC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AC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAE5D,OAAO;QACL,YAAY;QACZ,SAAS;QACT,QAAQ;QACR,MAAM,EAAE,gBAAgB;KACzB,CAAC;AACJ,CAAC;AApFD,wDAoFC"}
@@ -3,4 +3,5 @@ export * from './TranscendAiPrompt';
3
3
  export * from './createHandlebarsWithHelpers';
4
4
  export * from './removeLinks';
5
5
  export * from './filterNullishValuesFromObject';
6
+ export * from './getGitFilesThatChanged';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,KAAQ,CAAC;AAE9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,KAAQ,CAAC;AAE9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC"}
package/build/ai/index.js CHANGED
@@ -21,4 +21,5 @@ __exportStar(require("./TranscendAiPrompt"), exports);
21
21
  __exportStar(require("./createHandlebarsWithHelpers"), exports);
22
22
  __exportStar(require("./removeLinks"), exports);
23
23
  __exportStar(require("./filterNullishValuesFromObject"), exports);
24
+ __exportStar(require("./getGitFilesThatChanged"), exports);
24
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEzB,QAAA,QAAQ,GAAG,KAAK,CAAC;AAE9B,sDAAoC;AACpC,gEAA8C;AAC9C,gDAA8B;AAC9B,kEAAgD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEzB,QAAA,QAAQ,GAAG,KAAK,CAAC;AAE9B,sDAAoC;AACpC,gEAA8C;AAC9C,gDAA8B;AAC9B,kEAAgD;AAChD,2DAAyC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli-upload-consent-preferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-upload-consent-preferences.d.ts","sourceRoot":"","sources":["../src/cli-upload-consent-preferences.ts"],"names":[],"mappings":""}
@@ -0,0 +1,72 @@
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 uploadConsentPreferences_1 = require("./consent-manager/uploadConsentPreferences");
12
+ const requests_1 = require("./requests");
13
+ /**
14
+ * Upload consent preferences to the managed consent database
15
+ *
16
+ * Requires following documentation found at:
17
+ * https://docs.transcend.io/docs/consent/reference/managed-consent-database
18
+ *
19
+ * Dev Usage:
20
+ * yarn ts-node ./src/cli-upload-consent-preferences.ts --base64EncryptionKey=$TRANSCEND_CONSENT_ENCRYPTION_KEY \
21
+ * --base64SigningKey=$TRANSCEND_CONSENT_SIGNING_KEY --partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726
22
+ *
23
+ * Standard usage:
24
+ * yarn tr-upload-consent-preferences --base64EncryptionKey=$TRANSCEND_CONSENT_ENCRYPTION_KEY \
25
+ * --base64SigningKey=$TRANSCEND_CONSENT_SIGNING_KEY --partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726
26
+ */
27
+ async function main() {
28
+ // Parse command line arguments
29
+ const {
30
+ /** File to load preferences from */
31
+ file = 'preferences.csv',
32
+ /** Transcend URL */
33
+ transcendUrl = constants_1.DEFAULT_TRANSCEND_CONSENT_API,
34
+ /** base64 encryption key */
35
+ base64EncryptionKey,
36
+ /** base64 signing key */
37
+ base64SigningKey,
38
+ /** Partition key to load into */
39
+ partition,
40
+ /** Concurrency */
41
+ concurrency = '100', } = (0, yargs_parser_1.default)(process.argv.slice(2));
42
+ // Ensure auth is passed
43
+ if (!base64EncryptionKey) {
44
+ logger_1.logger.error(colors_1.default.red('A base64EncryptionKey must be provided. ' +
45
+ 'You can specify using --base64EncryptionKey=$TRANSCEND_CONSENT_ENCRYPTION_KEY'));
46
+ process.exit(1);
47
+ }
48
+ if (!base64SigningKey) {
49
+ logger_1.logger.error(colors_1.default.red('A base64SigningKey must be provided. ' +
50
+ 'You can specify using --base64SigningKey=$TRANSCEND_CONSENT_SIGNING_KEY'));
51
+ process.exit(1);
52
+ }
53
+ // Ensure partition
54
+ if (!partition) {
55
+ logger_1.logger.error(colors_1.default.red('A partition must be provided. ' +
56
+ 'You can specify using --partition=ee1a0845-694e-4820-9d51-50c7d0a23467'));
57
+ process.exit(1);
58
+ }
59
+ // Load in preferences from csv
60
+ const preferences = (0, requests_1.readCsv)(file, uploadConsentPreferences_1.ManagedConsentDatabaseConsentPreference);
61
+ // Upload cookies
62
+ await (0, uploadConsentPreferences_1.uploadConsentPreferences)({
63
+ base64EncryptionKey,
64
+ base64SigningKey,
65
+ preferences,
66
+ partition,
67
+ concurrency: parseInt(concurrency, 10),
68
+ transcendUrl,
69
+ });
70
+ }
71
+ main();
72
+ //# sourceMappingURL=cli-upload-consent-preferences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-upload-consent-preferences.js","sourceRoot":"","sources":["../src/cli-upload-consent-preferences.ts"],"names":[],"mappings":";;;;;;AAEA,gEAAiC;AACjC,oDAA4B;AAE5B,qCAAkC;AAClC,2CAA4D;AAC5D,yFAGoD;AACpD,yCAAqC;AAErC;;;;;;;;;;;;;GAaG;AACH,KAAK,UAAU,IAAI;IACjB,+BAA+B;IAC/B,MAAM;IACJ,oCAAoC;IACpC,IAAI,GAAG,iBAAiB;IACxB,oBAAoB;IACpB,YAAY,GAAG,yCAA6B;IAC5C,4BAA4B;IAC5B,mBAAmB;IACnB,yBAAyB;IACzB,gBAAgB;IAChB,iCAAiC;IACjC,SAAS;IACT,kBAAkB;IAClB,WAAW,GAAG,KAAK,GACpB,GAAG,IAAA,sBAAK,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAA8B,CAAC;IAE9D,wBAAwB;IACxB,IAAI,CAAC,mBAAmB,EAAE;QACxB,eAAM,CAAC,KAAK,CACV,gBAAM,CAAC,GAAG,CACR,0CAA0C;YACxC,+EAA+E,CAClF,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IACD,IAAI,CAAC,gBAAgB,EAAE;QACrB,eAAM,CAAC,KAAK,CACV,gBAAM,CAAC,GAAG,CACR,uCAAuC;YACrC,yEAAyE,CAC5E,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,mBAAmB;IACnB,IAAI,CAAC,SAAS,EAAE;QACd,eAAM,CAAC,KAAK,CACV,gBAAM,CAAC,GAAG,CACR,gCAAgC;YAC9B,wEAAwE,CAC3E,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,+BAA+B;IAC/B,MAAM,WAAW,GAAG,IAAA,kBAAO,EAAC,IAAI,EAAE,kEAAuC,CAAC,CAAC;IAE3E,iBAAiB;IACjB,MAAM,IAAA,mDAAwB,EAAC;QAC7B,mBAAmB;QACnB,gBAAgB;QAChB,WAAW;QACX,SAAS;QACT,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;QACtC,YAAY;KACb,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Function to create a consent manager token
3
+ *
4
+ * @see https://docs.transcend.io/docs/consent/reference/managed-consent-database
5
+ * @param userId - User ID
6
+ * @param base64EncryptionKey - Encryption key
7
+ * @param base64SigningKey - Signing key
8
+ * @returns Token
9
+ */
10
+ export declare function createConsentToken(userId: string, base64EncryptionKey: string, base64SigningKey: string): string;
11
+ //# sourceMappingURL=createConsentToken.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createConsentToken.d.ts","sourceRoot":"","sources":["../../src/consent-manager/createConsentToken.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,mBAAmB,EAAE,MAAM,EAC3B,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAgCR"}
@@ -0,0 +1,67 @@
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.createConsentToken = void 0;
27
+ const crypto = __importStar(require("crypto"));
28
+ const jwt = __importStar(require("jsonwebtoken"));
29
+ /**
30
+ * Function to create a consent manager token
31
+ *
32
+ * @see https://docs.transcend.io/docs/consent/reference/managed-consent-database
33
+ * @param userId - User ID
34
+ * @param base64EncryptionKey - Encryption key
35
+ * @param base64SigningKey - Signing key
36
+ * @returns Token
37
+ */
38
+ function createConsentToken(userId, base64EncryptionKey, base64SigningKey) {
39
+ // Read on for where to find these keys
40
+ const signingKey = Buffer.from(base64SigningKey, 'base64');
41
+ const encryptionKey = Buffer.from(base64EncryptionKey, 'base64');
42
+ // NIST's AES-KWP implementation { aes 48 } - see https://tools.ietf.org/html/rfc5649
43
+ const encryptionAlgorithm = 'id-aes256-wrap-pad';
44
+ // Initial Value for AES-KWP integrity check - see https://tools.ietf.org/html/rfc5649#section-3
45
+ const iv = Buffer.from('A65959A6', 'hex');
46
+ // Set up encryption algorithm
47
+ const cipher = crypto.createCipheriv(encryptionAlgorithm, encryptionKey, iv);
48
+ // Encrypt the userId and base64-encode the result
49
+ const encryptedIdentifier = Buffer.concat([
50
+ cipher.update(userId),
51
+ cipher.final(),
52
+ ]).toString('base64');
53
+ // Create the JWT content - jwt.sign will add a 'iat' (issued at) field to the payload
54
+ // If you wanted to add something manually, consider
55
+ // const issued: Date = new Date();
56
+ // const isoDate = issued.toISOString();
57
+ const jwtPayload = {
58
+ encryptedIdentifier,
59
+ };
60
+ // Create a JSON web token and HMAC it with SHA-384
61
+ const consentToken = jwt.sign(jwtPayload, signingKey, {
62
+ algorithm: 'HS384',
63
+ });
64
+ return consentToken;
65
+ }
66
+ exports.createConsentToken = createConsentToken;
67
+ //# sourceMappingURL=createConsentToken.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createConsentToken.js","sourceRoot":"","sources":["../../src/consent-manager/createConsentToken.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,kDAAoC;AAEpC;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAChC,MAAc,EACd,mBAA2B,EAC3B,gBAAwB;IAExB,uCAAuC;IACvC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;IAC3D,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IAEjE,qFAAqF;IACrF,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;IACjD,gGAAgG;IAChG,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC1C,8BAA8B;IAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,mBAAmB,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC;IAE7E,kDAAkD;IAClD,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;QACxC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QACrB,MAAM,CAAC,KAAK,EAAE;KACf,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAEtB,sFAAsF;IACtF,oDAAoD;IACpD,mCAAmC;IACnC,wCAAwC;IACxC,MAAM,UAAU,GAAG;QACjB,mBAAmB;KACpB,CAAC;IAEF,mDAAmD;IACnD,MAAM,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE;QACpD,SAAS,EAAE,OAAO;KACnB,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC;AApCD,gDAoCC"}
@@ -5,4 +5,5 @@ export * from './pullConsentManagerMetrics';
5
5
  export * from './buildXdiSyncEndpoint';
6
6
  export * from './consentManagersToBusinessEntities';
7
7
  export * from './domainToHost';
8
+ export * from './createConsentToken';
8
9
  //# 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"}
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"}
@@ -21,4 +21,5 @@ __exportStar(require("./pullConsentManagerMetrics"), exports);
21
21
  __exportStar(require("./buildXdiSyncEndpoint"), exports);
22
22
  __exportStar(require("./consentManagersToBusinessEntities"), exports);
23
23
  __exportStar(require("./domainToHost"), exports);
24
+ __exportStar(require("./createConsentToken"), exports);
24
25
  //# 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"}
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"}
@@ -0,0 +1,41 @@
1
+ import * as t from 'io-ts';
2
+ export declare const USP_STRING_REGEX: RegExp;
3
+ export declare const ManagedConsentDatabaseConsentPreference: t.IntersectionC<[t.TypeC<{
4
+ /** User ID */
5
+ userId: t.StringC;
6
+ /** Has the consent been updated (including no-change confirmation) since default resolution */
7
+ timestamp: t.StringC;
8
+ }>, t.PartialC<{
9
+ /** Purpose map */
10
+ purposes: t.RecordC<t.StringC, t.UnionC<[t.BooleanC, t.LiteralC<"Auto">]>>;
11
+ /** Was tracking consent confirmed by the user? If this is false, the consent was resolved from defaults & is not yet confirmed */
12
+ confirmed: t.BooleanC;
13
+ /** Time updated */
14
+ updated: t.BooleanC;
15
+ /** Whether or not the UI has been shown to the end-user (undefined in older versions of airgap.js) */
16
+ prompted: t.BooleanC;
17
+ /** US Privacy (USP) String */
18
+ usp: t.StringC;
19
+ }>]>;
20
+ /** Type override */
21
+ export type ManagedConsentDatabaseConsentPreference = t.TypeOf<typeof ManagedConsentDatabaseConsentPreference>;
22
+ /**
23
+ * Upload a set of consent preferences
24
+ *
25
+ * @param options - Options
26
+ */
27
+ export declare function uploadConsentPreferences({ base64EncryptionKey, base64SigningKey, preferences, partition, concurrency, transcendUrl, }: {
28
+ /** base64 encryption key */
29
+ base64EncryptionKey: string;
30
+ /** base64 signing key */
31
+ base64SigningKey: string;
32
+ /** Partition key */
33
+ partition: string;
34
+ /** Sombra API key authentication */
35
+ preferences: ManagedConsentDatabaseConsentPreference[];
36
+ /** API URL for Transcend backend */
37
+ transcendUrl?: string;
38
+ /** Concurrency limit for approving */
39
+ concurrency?: number;
40
+ }): Promise<void>;
41
+ //# sourceMappingURL=uploadConsentPreferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploadConsentPreferences.d.ts","sourceRoot":"","sources":["../../src/consent-manager/uploadConsentPreferences.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAO3B,eAAO,MAAM,gBAAgB,QAA6B,CAAC;AAE3D,eAAO,MAAM,uCAAuC;IAEhD,cAAc;;IAEd,+FAA+F;;;IAI/F,kBAAkB;;IAElB,kIAAkI;;IAElI,mBAAmB;;IAEnB,sGAAsG;;IAEtG,8BAA8B;;IAGhC,CAAC;AAEH,oBAAoB;AACpB,MAAM,MAAM,uCAAuC,GAAG,CAAC,CAAC,MAAM,CAC5D,OAAO,uCAAuC,CAC/C,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,EAC7C,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,WAAiB,EACjB,YAA4C,GAC7C,EAAE;IACD,4BAA4B;IAC5B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yBAAyB;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,WAAW,EAAE,uCAAuC,EAAE,CAAC;IACvD,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoGhB"}