@transcend-io/cli 4.48.1 → 4.50.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
@@ -29,38 +29,42 @@
29
29
  - [Authentication](#authentication-4)
30
30
  - [Arguments](#arguments-4)
31
31
  - [Usage](#usage-5)
32
- - [tr-cron-pull-identifiers](#tr-cron-pull-identifiers)
32
+ - [tr-request-export](#tr-request-export)
33
33
  - [Authentication](#authentication-5)
34
34
  - [Arguments](#arguments-5)
35
35
  - [Usage](#usage-6)
36
- - [tr-cron-mark-identifiers-completed](#tr-cron-mark-identifiers-completed)
36
+ - [tr-cron-pull-identifiers](#tr-cron-pull-identifiers)
37
37
  - [Authentication](#authentication-6)
38
38
  - [Arguments](#arguments-6)
39
39
  - [Usage](#usage-7)
40
- - [tr-manual-enrichment-pull-identifiers](#tr-manual-enrichment-pull-identifiers)
40
+ - [tr-cron-mark-identifiers-completed](#tr-cron-mark-identifiers-completed)
41
41
  - [Authentication](#authentication-7)
42
42
  - [Arguments](#arguments-7)
43
43
  - [Usage](#usage-8)
44
- - [tr-manual-enrichment-push-identifiers](#tr-manual-enrichment-push-identifiers)
44
+ - [tr-manual-enrichment-pull-identifiers](#tr-manual-enrichment-pull-identifiers)
45
45
  - [Authentication](#authentication-8)
46
46
  - [Arguments](#arguments-8)
47
47
  - [Usage](#usage-9)
48
- - [tr-mark-request-data-silos-completed](#tr-mark-request-data-silos-completed)
48
+ - [tr-manual-enrichment-push-identifiers](#tr-manual-enrichment-push-identifiers)
49
49
  - [Authentication](#authentication-9)
50
50
  - [Arguments](#arguments-9)
51
51
  - [Usage](#usage-10)
52
- - [tr-retry-request-data-silos](#tr-retry-request-data-silos)
52
+ - [tr-mark-request-data-silos-completed](#tr-mark-request-data-silos-completed)
53
53
  - [Authentication](#authentication-10)
54
54
  - [Arguments](#arguments-10)
55
55
  - [Usage](#usage-11)
56
- - [tr-update-consent-manager](#tr-update-consent-manager)
56
+ - [tr-retry-request-data-silos](#tr-retry-request-data-silos)
57
57
  - [Authentication](#authentication-11)
58
58
  - [Arguments](#arguments-11)
59
59
  - [Usage](#usage-12)
60
- - [tr-generate-api-keys](#tr-generate-api-keys)
60
+ - [tr-update-consent-manager](#tr-update-consent-manager)
61
61
  - [Authentication](#authentication-12)
62
62
  - [Arguments](#arguments-12)
63
63
  - [Usage](#usage-13)
64
+ - [tr-generate-api-keys](#tr-generate-api-keys)
65
+ - [Authentication](#authentication-13)
66
+ - [Arguments](#arguments-13)
67
+ - [Usage](#usage-14)
64
68
 
65
69
  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
66
70
 
@@ -83,9 +87,15 @@ yarn tr-pull --auth=$TRANSCEND_API_KEY
83
87
  yarn tr-push --auth=$TRANSCEND_API_KEY
84
88
  yarn tr-discover-silos --auth=$TRANSCEND_API_KEY
85
89
  yarn tr-request-upload --auth=$TRANSCEND_API_KEY
90
+ yarn tr-request-export --auth=$TRANSCEND_API_KEY
86
91
  yarn tr-request-restart --auth=$TRANSCEND_API_KEY
87
92
  yarn tr-cron-pull-identifiers --auth=$TRANSCEND_API_KEY
88
93
  yarn tr-cron-mark-identifiers-completed --auth=$TRANSCEND_API_KEY
94
+ yarn tr-manual-enrichment-pull-identifiers --auth=$TRANSCEND_API_KEY
95
+ yarn tr-mark-request-data-silos-completed --auth=$TRANSCEND_API_KEY
96
+ yarn tr-retry-request-data-silos --auth=$TRANSCEND_API_KEY
97
+ yarn tr-update-consent-manager --auth=$TRANSCEND_API_KEY
98
+ yarn tr-generate-api-keys --auth=$TRANSCEND_API_KEY
89
99
  ```
90
100
 
91
101
  or
@@ -99,9 +109,15 @@ tr-pull --auth=$TRANSCEND_API_KEY
99
109
  tr-push --auth=$TRANSCEND_API_KEY
100
110
  tr-discover-silos --auth=$TRANSCEND_API_KEY
101
111
  tr-request-upload --auth=$TRANSCEND_API_KEY
112
+ tr-request-export --auth=$TRANSCEND_API_KEY
102
113
  tr-request-restart --auth=$TRANSCEND_API_KEY
103
114
  tr-cron-pull-identifiers --auth=$TRANSCEND_API_KEY
104
115
  tr-cron-mark-identifiers-completed --auth=$TRANSCEND_API_KEY
116
+ tr-manual-enrichment-pull-identifiers --auth=$TRANSCEND_API_KEY
117
+ tr-mark-request-data-silos-completed --auth=$TRANSCEND_API_KEY
118
+ tr-retry-request-data-silos --auth=$TRANSCEND_API_KEY
119
+ tr-update-consent-manager --auth=$TRANSCEND_API_KEY
120
+ tr-generate-api-keys --auth=$TRANSCEND_API_KEY
105
121
  ```
106
122
 
107
123
  alternatively, you can install the cli globally on your machine:
@@ -253,15 +269,17 @@ _Note: The scopes for tr-push are comprehensive of the scopes for tr-pull_
253
269
 
254
270
  #### Arguments
255
271
 
256
- | Argument | Description | Type | Default | Required |
257
- | ------------ | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------- | -------- |
258
- | auth | The Transcend API capable of fetching the configuration | string (API key or path to tr-generate-api-keys JSON output) | N/A | true |
259
- | resources | The different resource types to pull in (see table above for breakdown of each resource) | string | apiKeys,templates,dataSilos,enrichers | false |
260
- | file | Path to the YAML file to pull into | string - file-path | ./transcend.yml | false |
261
- | transcendUrl | URL of the Transcend backend. Use https://api.us.transcend.io for US hosting. | string - URL | https://api.transcend.io | false |
262
- | dataSiloIds | The UUIDs of the data silos that should be pulled into the YAML file. | list(string - UUID) | N/A | false |
263
- | pageSize | The page size to use when paginating over the API | number | 50 | false |
264
- | debug | Set to true to include debug logs while pulling the configuration | boolean | false | false |
272
+ | Argument | Description | Type | Default | Required |
273
+ | ---------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------- | -------- |
274
+ | auth | The Transcend API capable of fetching the configuration | string (API key or path to tr-generate-api-keys JSON output) | N/A | true |
275
+ | resources | The different resource types to pull in (see table above for breakdown of each resource) | string | apiKeys,templates,dataSilos,enrichers | false |
276
+ | file | Path to the YAML file to pull into | string - file-path | ./transcend.yml | false |
277
+ | transcendUrl | URL of the Transcend backend. Use https://api.us.transcend.io for US hosting. | string - URL | https://api.transcend.io | false |
278
+ | dataSiloIds | The UUIDs of the data silos that should be pulled into the YAML file. | list(string - UUID) | N/A | false |
279
+ | integrationNames | The types of integrations to pull down | string[] | N/A | false |
280
+ | trackerStatuses | The statuses of consent manager trackers to pull down. (Triage, Approved or both) | ConsentTrackerStatus[] | LIVE,NEEDS_REVIEW | false |
281
+ | pageSize | The page size to use when paginating over the API | number | 50 | false |
282
+ | debug | Set to true to include debug logs while pulling the configuration | boolean | false | false |
265
283
 
266
284
  #### Usage
267
285
 
@@ -295,10 +313,10 @@ Specifying the resource types to pull in (the following resources are the defaul
295
313
  tr-pull --auth=$TRANSCEND_API_KEY --resources=apiKeys,templates,dataSilos,enrichers
296
314
  ```
297
315
 
298
- Pull in data flow and cookie resources instead (see [this example](./examples/data-flows-cookies.yml)):
316
+ Pull in data flow and cookie resources, filtering for specific tracker statuses (see [this example](./examples/data-flows-cookies.yml)):
299
317
 
300
318
  ```sh
301
- tr-pull --auth=$TRANSCEND_API_KEY --resources=dataFlows,cookies
319
+ tr-pull --auth=$TRANSCEND_API_KEY --resources=dataFlows,cookies --trackerStatuses=NEEDS_REVIEW,LIVE
302
320
  ```
303
321
 
304
322
  Pull in attribute definitions only (see [this example](./examples/attributes.yml)):
@@ -797,6 +815,77 @@ Skip queued state of request and go straight to compiling
797
815
  yarn tr-request-restart --auth=$TRANSCEND_API_KEY --statuses=COMPILING,ENRICHING --actions=ACCESS,ERASURE --skipWaitingPeriod=true
798
816
  ```
799
817
 
818
+ ### tr-request-export
819
+
820
+ Export privacy requests and request identifiers to a CSV file.
821
+
822
+ #### Authentication
823
+
824
+ 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).
825
+
826
+ The API key needs the following scopes:
827
+
828
+ - View Incoming Requests
829
+ - View the Request Compilation
830
+
831
+ #### Arguments
832
+
833
+ | Argument | Description | Type | Default | Required |
834
+ | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ------------------------------ | -------- |
835
+ | auth | The Transcend API capable of pulling privacy requests. | string | N/A | true |
836
+ | actions | The [request action](https://docs.transcend.io/docs/privacy-requests/configuring-requests/data-subject-requests#data-actions) to restart. | RequestAction[] | N/A | false |
837
+ | statuses | The [request statuses](https://docs.transcend.io/docs/privacy-requests/overview#request-statuses) to restart. | RequestStatus[] | N/A | false |
838
+ | transcendUrl | URL of the Transcend backend. Use https://api.us.transcend.io for US hosting. | string - URL | https://api.transcend.io | false |
839
+ | file | Path to the CSV file where identifiers will be written to. | string - file-path | ./transcend-request-export.csv | false |
840
+ | concurrency | The concurrency to use when uploading requests in parallel. | number | 100 | false |
841
+ | createdAtBefore | Pull requests that were submitted before this time | Date | N/A | false |
842
+ | createdAtAfter | Pull requests that were submitted after this time | Date | N/A | false |
843
+ | showTests | Filter for test requests or production requests - when not provided, pulls both | boolean | N/A | false |
844
+
845
+ #### Usage
846
+
847
+ Pull all requests:
848
+
849
+ ```sh
850
+ yarn tr-request-export --auth=$TRANSCEND_API_KEY
851
+ ```
852
+
853
+ Filter for specific actions and statuses:
854
+
855
+ ```sh
856
+ yarn tr-request-export --auth=$TRANSCEND_API_KEY --statuses=COMPILING,ENRICHING --actions=ACCESS,ERASURE
857
+ ```
858
+
859
+ Specifying the backend URL, needed for US hosted backend infrastructure.
860
+
861
+ ```sh
862
+ yarn tr-request-export --auth=$TRANSCEND_API_KEY --transcendUrl=https://api.us.transcend.io
863
+ ```
864
+
865
+ Increase the concurrency (defaults to 100)
866
+
867
+ ```sh
868
+ yarn tr-request-export --auth=$TRANSCEND_API_KEY --concurrency=500
869
+ ```
870
+
871
+ Filter for production requests only
872
+
873
+ ```sh
874
+ yarn tr-request-export --auth=$TRANSCEND_API_KEY --showTests=false
875
+ ```
876
+
877
+ Filter for requests within a date range
878
+
879
+ ```sh
880
+ yarn tr-request-export --auth=$TRANSCEND_API_KEY --createdAtBefore="04/05/2023" --createdAtAfter="02/21/2023"
881
+ ```
882
+
883
+ Write to a specific file location
884
+
885
+ ```sh
886
+ yarn tr-request-export --auth=$TRANSCEND_API_KEY --file=./path/to/file.csv
887
+ ```
888
+
800
889
  ### tr-cron-pull-identifiers
801
890
 
802
891
  If you are using the cron job integration, you can run this command to pull the outstanding identifiers
@@ -1139,7 +1228,7 @@ The API key must have the following scopes:
1139
1228
  yarn tr-update-consent-manager --auth=$TRANSCEND_API_KEY
1140
1229
  ```
1141
1230
 
1142
- Specifying the backend URL, needed for US hosted backend infrastructure.
1231
+ Specifying the backend URL, needed for US hosted backend infrastructu re.
1143
1232
 
1144
1233
  ```sh
1145
1234
  yarn tr-update-consent-manager --auth=$TRANSCEND_API_KEY --transcendUrl=https://api.us.transcend.io
package/build/cli-pull.js CHANGED
@@ -11,9 +11,11 @@ const bluebird_1 = require("bluebird");
11
11
  const path_1 = require("path");
12
12
  const fs_1 = __importDefault(require("fs"));
13
13
  const graphql_1 = require("./graphql");
14
+ const privacy_types_1 = require("@transcend-io/privacy-types");
14
15
  const api_keys_1 = require("./api-keys");
15
16
  const readTranscendYaml_1 = require("./readTranscendYaml");
16
17
  const constants_1 = require("./constants");
18
+ const requests_1 = require("./requests");
17
19
  const VALID_RESOURCES = Object.values(graphql_1.TranscendPullResource);
18
20
  /**
19
21
  * Sync data silo configuration from Transcend down locally to disk
@@ -26,9 +28,19 @@ const VALID_RESOURCES = Object.values(graphql_1.TranscendPullResource);
26
28
  */
27
29
  async function main() {
28
30
  // Parse command line arguments
29
- const { file = './transcend.yml', transcendUrl = 'https://api.transcend.io', dataSiloIds = '', integrationNames = '', resources = graphql_1.DEFAULT_TRANSCEND_PULL_RESOURCES.join(','), pageSize = '', debug = '', auth, } = (0, yargs_parser_1.default)(process.argv.slice(2));
31
+ const { file = './transcend.yml', transcendUrl = 'https://api.transcend.io', dataSiloIds = '', integrationNames = '', resources = graphql_1.DEFAULT_TRANSCEND_PULL_RESOURCES.join(','), pageSize = '', debug = '', auth, trackerStatuses = Object.values(privacy_types_1.ConsentTrackerStatus).join(','), } = (0, yargs_parser_1.default)(process.argv.slice(2));
30
32
  // Parse authentication as API key or path to list of API keys
31
33
  const apiKeyOrList = await (0, api_keys_1.validateTranscendAuth)(auth);
34
+ // Validate trackerStatuses
35
+ const parsedTrackerStatuses = (0, requests_1.splitCsvToList)(trackerStatuses);
36
+ const invalidTrackerStatuses = parsedTrackerStatuses.filter(
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ (type) => !Object.values(privacy_types_1.ConsentTrackerStatus).includes(type));
39
+ if (invalidTrackerStatuses.length > 0) {
40
+ logger_1.logger.error(colors_1.default.red(`Failed to parse trackerStatuses:"${invalidTrackerStatuses.join(',')}".\n` +
41
+ `Expected one of: \n${Object.values(privacy_types_1.ConsentTrackerStatus).join('\n')}`));
42
+ process.exit(1);
43
+ }
32
44
  // Parse request actions
33
45
  let splitResources = [];
34
46
  if (!resources) {
@@ -63,6 +75,7 @@ async function main() {
63
75
  resources: splitResources,
64
76
  pageSize: pageSizeParsed,
65
77
  debug: isDebug,
78
+ trackerStatuses: parsedTrackerStatuses,
66
79
  });
67
80
  logger_1.logger.info(colors_1.default.magenta(`Writing configuration to file "${file}"...`));
68
81
  (0, readTranscendYaml_1.writeTranscendYaml)(file, configuration);
@@ -91,6 +104,7 @@ async function main() {
91
104
  resources: splitResources,
92
105
  pageSize: pageSizeParsed,
93
106
  debug: isDebug,
107
+ trackerStatuses: parsedTrackerStatuses,
94
108
  });
95
109
  const filePath = (0, path_1.join)(file, `${apiKey.organizationName}.yml`);
96
110
  logger_1.logger.info(colors_1.default.magenta(`Writing configuration to file "${filePath}"...`));
@@ -1 +1 @@
1
- {"version":3,"file":"cli-pull.js","sourceRoot":"","sources":["../src/cli-pull.ts"],"names":[],"mappings":";;;;;;AAEA,gEAAiC;AACjC,qCAAkC;AAClC,oDAA4B;AAC5B,uCAAqC;AACrC,+BAA4B;AAC5B,4CAAoB;AACpB,uCAKmB;AACnB,yCAAmD;AAC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qB;iBACvC,CAAC,CAAC;gBAEH,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,IAAI,EAAE,GAAG,MAAM,CAAC,gBAAgB,MAAM,CAAC,CAAC;gBAC9D,eAAM,CAAC,IAAI,CACT,gBAAM,CAAC,OAAO,CAAC,kCAAkC,QAAQ,MAAM,CAAC,CACjE,CAAC;gBACF,IAAA,sCAAkB,EAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;gBAE5C,eAAM,CAAC,IAAI,CACT,gBAAM,CAAC,KAAK,CAAC,GAAG,MAAM,oCAAoC,CAAC,CAC5D,CAAC;aACH;YAAC,OAAO,GAAG,EAAE;gBACZ,eAAM,CAAC,KAAK,CAAC,gBAAM,CAAC,GAAG,CAAC,GAAG,MAAM,+BAA+B,CAAC,CAAC,CAAC;gBACnE,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;aACjD;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,eAAM,CAAC,IAAI,CACT,gBAAM,CAAC,GAAG,CACR,gCAAgC,iBAAiB,CAAC,IAAI,CACpD,GAAG,CACJ,2DAA2D,mCAAuB,EAAE,CACtF,CACF,CAAC;YAEF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;KACF;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli-request-export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-request-export.d.ts","sourceRoot":"","sources":["../src/cli-request-export.ts"],"names":[],"mappings":""}
@@ -0,0 +1,71 @@
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 privacy_types_1 = require("@transcend-io/privacy-types");
11
+ const requests_1 = require("./requests");
12
+ /**
13
+ * Pull down the metadata for a set of Privacy requests.
14
+ *
15
+ * Requires scopes:
16
+ * - View Incoming Requests
17
+ * - View the Request Compilation
18
+ *
19
+ * Dev Usage:
20
+ * yarn ts-node ./src/cli-request-export.ts --auth=asd123 \
21
+ * --requestType=ERASURE \
22
+ * --file=/Users/michaelfarrell/Desktop/test.csv
23
+ *
24
+ * Standard usage:
25
+ * yarn tr-request-export --auth=asd123 \
26
+ * --requestType=ERASURE \
27
+ * --file=/Users/michaelfarrell/Desktop/test.csv
28
+ */
29
+ async function main() {
30
+ // Parse command line arguments
31
+ const { file = './transcend-request-export.csv', transcendUrl = 'https://api.transcend.io', auth, actions = '', statuses = '', showTests, createdAtBefore, createdAtAfter, pageLimit = '100', } = (0, yargs_parser_1.default)(process.argv.slice(2));
32
+ // Ensure auth is passed
33
+ if (!auth) {
34
+ logger_1.logger.error(colors_1.default.red('A Transcend API key must be provided. You can specify using --auth=asd123'));
35
+ process.exit(1);
36
+ }
37
+ // Validate actions
38
+ const parsedActions = (0, requests_1.splitCsvToList)(actions);
39
+ const invalidActions = parsedActions.filter(
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
+ (type) => !Object.values(privacy_types_1.RequestAction).includes(type));
42
+ if (invalidActions.length > 0) {
43
+ logger_1.logger.error(colors_1.default.red(`Failed to parse actions:"${invalidActions.join(',')}".\n` +
44
+ `Expected one of: \n${Object.values(privacy_types_1.RequestAction).join('\n')}`));
45
+ process.exit(1);
46
+ }
47
+ // Validate statuses
48
+ const parsedStatuses = (0, requests_1.splitCsvToList)(statuses);
49
+ const invalidStatuses = parsedStatuses.filter(
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ (type) => !Object.values(privacy_types_1.RequestAction).includes(type));
52
+ if (invalidStatuses.length > 0) {
53
+ logger_1.logger.error(colors_1.default.red(`Failed to parse statuses:"${invalidStatuses.join(',')}".\n` +
54
+ `Expected one of: \n${Object.values(privacy_types_1.RequestStatus).join('\n')}`));
55
+ process.exit(1);
56
+ }
57
+ // Pull privacy requests
58
+ await (0, requests_1.pullRequestsToCsv)({
59
+ file,
60
+ transcendUrl,
61
+ pageLimit: parseInt(pageLimit, 10),
62
+ actions: parsedActions,
63
+ statuses: parsedStatuses,
64
+ auth,
65
+ createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,
66
+ createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,
67
+ showTests: showTests === 'true' ? true : showTests === 'false' ? false : undefined,
68
+ });
69
+ }
70
+ main();
71
+ //# sourceMappingURL=cli-request-export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-request-export.js","sourceRoot":"","sources":["../src/cli-request-export.ts"],"names":[],"mappings":";;;;;;AAEA,gEAAiC;AACjC,oDAA4B;AAE5B,qCAAkC;AAClC,+DAA2E;AAC3E,yCAA+D;AAE/D;;;;;;;;;;;;;;;;GAgBG;AACH,KAAK,UAAU,IAAI;IACjB,+BAA+B;IAC/B,MAAM,EACJ,IAAI,GAAG,gCAAgC,EACvC,YAAY,GAAG,0BAA0B,EACzC,IAAI,EACJ,OAAO,GAAG,EAAE,EACZ,QAAQ,GAAG,EAAE,EACb,SAAS,EACT,eAAe,EACf,cAAc,EACd,SAAS,GAAG,KAAK,GAClB,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,2EAA2E,CAC5E,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,mBAAmB;IACnB,MAAM,aAAa,GAAG,IAA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