@transcend-io/cli 4.56.0 → 4.57.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
@@ -21,54 +21,58 @@
21
21
  - [Authentication](#authentication-2)
22
22
  - [Usage](#usage-3)
23
23
  - [Arguments](#arguments-2)
24
- - [tr-request-upload](#tr-request-upload)
24
+ - [tr-request-approve](#tr-request-approve)
25
25
  - [Authentication](#authentication-3)
26
26
  - [Arguments](#arguments-3)
27
27
  - [Usage](#usage-4)
28
- - [tr-request-restart](#tr-request-restart)
28
+ - [tr-request-upload](#tr-request-upload)
29
29
  - [Authentication](#authentication-4)
30
30
  - [Arguments](#arguments-4)
31
31
  - [Usage](#usage-5)
32
- - [tr-request-export](#tr-request-export)
32
+ - [tr-request-restart](#tr-request-restart)
33
33
  - [Authentication](#authentication-5)
34
34
  - [Arguments](#arguments-5)
35
35
  - [Usage](#usage-6)
36
- - [tr-cron-pull-identifiers](#tr-cron-pull-identifiers)
36
+ - [tr-request-export](#tr-request-export)
37
37
  - [Authentication](#authentication-6)
38
38
  - [Arguments](#arguments-6)
39
39
  - [Usage](#usage-7)
40
- - [tr-cron-mark-identifiers-completed](#tr-cron-mark-identifiers-completed)
40
+ - [tr-cron-pull-identifiers](#tr-cron-pull-identifiers)
41
41
  - [Authentication](#authentication-7)
42
42
  - [Arguments](#arguments-7)
43
43
  - [Usage](#usage-8)
44
- - [tr-manual-enrichment-pull-identifiers](#tr-manual-enrichment-pull-identifiers)
44
+ - [tr-cron-mark-identifiers-completed](#tr-cron-mark-identifiers-completed)
45
45
  - [Authentication](#authentication-8)
46
46
  - [Arguments](#arguments-8)
47
47
  - [Usage](#usage-9)
48
- - [tr-manual-enrichment-push-identifiers](#tr-manual-enrichment-push-identifiers)
48
+ - [tr-manual-enrichment-pull-identifiers](#tr-manual-enrichment-pull-identifiers)
49
49
  - [Authentication](#authentication-9)
50
50
  - [Arguments](#arguments-9)
51
51
  - [Usage](#usage-10)
52
- - [tr-mark-request-data-silos-completed](#tr-mark-request-data-silos-completed)
52
+ - [tr-manual-enrichment-push-identifiers](#tr-manual-enrichment-push-identifiers)
53
53
  - [Authentication](#authentication-10)
54
54
  - [Arguments](#arguments-10)
55
55
  - [Usage](#usage-11)
56
- - [tr-retry-request-data-silos](#tr-retry-request-data-silos)
56
+ - [tr-mark-request-data-silos-completed](#tr-mark-request-data-silos-completed)
57
57
  - [Authentication](#authentication-11)
58
58
  - [Arguments](#arguments-11)
59
59
  - [Usage](#usage-12)
60
- - [tr-upload-data-flows-from-csv](#tr-upload-data-flows-from-csv)
60
+ - [tr-retry-request-data-silos](#tr-retry-request-data-silos)
61
61
  - [Authentication](#authentication-12)
62
62
  - [Arguments](#arguments-12)
63
63
  - [Usage](#usage-13)
64
- - [tr-upload-data-flows-from-csv](#tr-upload-data-flows-from-csv-1)
64
+ - [tr-update-consent-manager](#tr-update-consent-manager)
65
65
  - [Authentication](#authentication-13)
66
66
  - [Arguments](#arguments-13)
67
67
  - [Usage](#usage-14)
68
- - [tr-generate-api-keys](#tr-generate-api-keys)
68
+ - [tr-upload-data-flows-from-csv](#tr-upload-data-flows-from-csv)
69
69
  - [Authentication](#authentication-14)
70
70
  - [Arguments](#arguments-14)
71
71
  - [Usage](#usage-15)
72
+ - [tr-generate-api-keys](#tr-generate-api-keys)
73
+ - [Authentication](#authentication-15)
74
+ - [Arguments](#arguments-15)
75
+ - [Usage](#usage-16)
72
76
 
73
77
  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
74
78
 
@@ -90,6 +94,7 @@ yarn add -D @transcend-io/cli
90
94
  yarn tr-pull --auth=$TRANSCEND_API_KEY
91
95
  yarn tr-push --auth=$TRANSCEND_API_KEY
92
96
  yarn tr-discover-silos --auth=$TRANSCEND_API_KEY
97
+ yarn tr-request-approve --auth=$TRANSCEND_API_KEY
93
98
  yarn tr-request-upload --auth=$TRANSCEND_API_KEY
94
99
  yarn tr-request-export --auth=$TRANSCEND_API_KEY
95
100
  yarn tr-request-restart --auth=$TRANSCEND_API_KEY
@@ -98,6 +103,7 @@ yarn tr-cron-mark-identifiers-completed --auth=$TRANSCEND_API_KEY
98
103
  yarn tr-manual-enrichment-pull-identifiers --auth=$TRANSCEND_API_KEY
99
104
  yarn tr-mark-request-data-silos-completed --auth=$TRANSCEND_API_KEY
100
105
  yarn tr-retry-request-data-silos --auth=$TRANSCEND_API_KEY
106
+ yarn tr-update-consent-manager --auth=$TRANSCEND_API_KEY
101
107
  yarn tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY
102
108
  yarn tr-generate-api-keys --auth=$TRANSCEND_API_KEY
103
109
  ```
@@ -112,6 +118,7 @@ npm i -D @transcend-io/cli
112
118
  tr-pull --auth=$TRANSCEND_API_KEY
113
119
  tr-push --auth=$TRANSCEND_API_KEY
114
120
  tr-discover-silos --auth=$TRANSCEND_API_KEY
121
+ tr-request-approve --auth=$TRANSCEND_API_KEY
115
122
  tr-request-upload --auth=$TRANSCEND_API_KEY
116
123
  tr-request-export --auth=$TRANSCEND_API_KEY
117
124
  tr-request-restart --auth=$TRANSCEND_API_KEY
@@ -120,6 +127,7 @@ tr-cron-mark-identifiers-completed --auth=$TRANSCEND_API_KEY
120
127
  tr-manual-enrichment-pull-identifiers --auth=$TRANSCEND_API_KEY
121
128
  tr-mark-request-data-silos-completed --auth=$TRANSCEND_API_KEY
122
129
  tr-retry-request-data-silos --auth=$TRANSCEND_API_KEY
130
+ tr-update-consent-manager --auth=$TRANSCEND_API_KEY
123
131
  tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY
124
132
  tr-generate-api-keys --auth=$TRANSCEND_API_KEY
125
133
  ```
@@ -132,12 +140,7 @@ npm i -g @transcend-io/cli
132
140
 
133
141
  # cli commands available everywhere on machine
134
142
  tr-pull --auth=$TRANSCEND_API_KEY
135
- tr-push --auth=$TRANSCEND_API_KEY
136
- tr-discover-silos --auth=$TRANSCEND_API_KEY
137
- tr-request-upload --auth=$TRANSCEND_API_KEY
138
- tr-request-restart --auth=$TRANSCEND_API_KEY
139
- tr-cron-pull-identifiers --auth=$TRANSCEND_API_KEY
140
- tr-cron-mark-identifiers-completed --auth=$TRANSCEND_API_KEY
143
+ ...
141
144
  ```
142
145
 
143
146
  Note:
@@ -598,6 +601,56 @@ You can include additional arguments as well:
598
601
  | auth | Transcend API key. | string | N/A | true |
599
602
  | fileGlobs | You can pass a [glob syntax pattern(s)](https://github.com/mrmlnc/fast-glob) to specify additional file paths to scan in addition to the default (ex: package.json). | string | N/A | false |
600
603
 
604
+ ### tr-request-approve
605
+
606
+ Bulk approve a set of privacy requests from the [Privacy Requests -> Incoming Requests](https://app.transcend.io/privacy-requests/incoming-requests) tab.
607
+
608
+ #### Authentication
609
+
610
+ 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).
611
+
612
+ The API key needs the following scopes:
613
+
614
+ - Request Approval and Communication
615
+ - View Incoming Requests
616
+ - Manage Request Compilation
617
+
618
+ #### Arguments
619
+
620
+ | Argument | Description | Type | Default | Required |
621
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | --------------- | ------------------------ | -------- |
622
+ | auth | The Transcend API key with the scopes necessary for the command. | string | N/A | true |
623
+ | actions | The [request actions](https://docs.transcend.io/docs/privacy-requests/configuring-requests/data-subject-requests#data-actions) to approve. | RequestAction[] | N/A | true |
624
+ | silentModeBefore | Any requests made before this date should be marked as silent mode | Date | N/A | false |
625
+ | transcendUrl | URL of the Transcend backend. Use https://api.us.transcend.io for US hosting. | string - URL | https://api.transcend.io | false |
626
+ | concurrency | The concurrency to use when uploading requests in parallel. | number | 100 | false |
627
+
628
+ #### Usage
629
+
630
+ Bulk approve all SALE_OPT_OUT and ERASURE requests
631
+
632
+ ```sh
633
+ yarn tr-request-approve --auth=$TRANSCEND_API_KEY --actions=SALE_OPT_OUT,ERASURE
634
+ ```
635
+
636
+ Specifying the backend URL, needed for US hosted backend infrastructure.
637
+
638
+ ```sh
639
+ yarn tr-request-approve --auth=$TRANSCEND_API_KEY --actions=ERASURE --transcendUrl=https://api.us.transcend.io
640
+ ```
641
+
642
+ Approve all requests, but mark any request made before 05/03/2023 as silent mode to prevent emailing the individual.
643
+
644
+ ```sh
645
+ yarn tr-request-approve --auth=$TRANSCEND_API_KEY --actions=SALE_OPT_OUT --silentModeBefore=05/03/2023
646
+ ```
647
+
648
+ Increase the concurrency (defaults to 100)
649
+
650
+ ```sh
651
+ yarn tr-request-approve --auth=$TRANSCEND_API_KEY --actions=ERASURE --concurrency=500
652
+ ```
653
+
601
654
  ### tr-request-upload
602
655
 
603
656
  If you need to upload a set of requests from a CSV, you can run this command.
@@ -1205,7 +1258,7 @@ yarn tr-retry-request-data-silos --auth=$TRANSCEND_API_KEY --dataSiloId=70810f2e
1205
1258
  --transcendUrl=https://api.us.transcend.io
1206
1259
  ```
1207
1260
 
1208
- ### tr-upload-data-flows-from-csv
1261
+ ### tr-update-consent-manager
1209
1262
 
1210
1263
  This command allows for updating Consent Manager to latest version. The consent manager bundle can also be deployed using this commannd.
1211
1264
 
@@ -1229,40 +1282,40 @@ The API key must have the following scopes:
1229
1282
  #### Usage
1230
1283
 
1231
1284
  ```sh
1232
- yarn tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY
1285
+ yarn tr-update-consent-manager --auth=$TRANSCEND_API_KEY
1233
1286
  ```
1234
1287
 
1235
- Specifying the backend URL, needed for US hosted backend infrastructure.
1288
+ Specifying the backend URL, needed for US hosted backend infrastructu re.
1236
1289
 
1237
1290
  ```sh
1238
- yarn tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY --transcendUrl=https://api.us.transcend.io
1291
+ yarn tr-update-consent-manager --auth=$TRANSCEND_API_KEY --transcendUrl=https://api.us.transcend.io
1239
1292
  ```
1240
1293
 
1241
1294
  Update version and deploy bundles.
1242
1295
 
1243
1296
  ```sh
1244
- yarn tr-upload-data-flows-from-csv -auth=$TRANSCEND_API_KEY --deploy=true
1297
+ yarn tr-update-consent-manager -auth=$TRANSCEND_API_KEY --deploy=true
1245
1298
  ```
1246
1299
 
1247
1300
  Update just the TEST bundle
1248
1301
 
1249
1302
  ```sh
1250
- yarn tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY --bundleTypes=TEST
1303
+ yarn tr-update-consent-manager --auth=$TRANSCEND_API_KEY --bundleTypes=TEST
1251
1304
  ```
1252
1305
 
1253
1306
  Update just the PRODUCTION bundle
1254
1307
 
1255
1308
  ```sh
1256
- yarn tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY --bundleTypes=PRODUCTION
1309
+ yarn tr-update-consent-manager --auth=$TRANSCEND_API_KEY --bundleTypes=PRODUCTION
1257
1310
  ```
1258
1311
 
1259
1312
  Update multiple organizations at once
1260
1313
 
1261
1314
  ```sh
1262
- yarn tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY --bundleTypes=PRODUCTION
1315
+ yarn tr-update-consent-manager --auth=$TRANSCEND_API_KEY --bundleTypes=PRODUCTION
1263
1316
 
1264
1317
  tr-generate-api-keys --email=test@transcend.io --password=$TRANSCEND_PASSWORD --scopes="Manage Consent Manager" --apiKeyTitle="CLI Usage Cross Instance Sync" --file=./transcend-api-keys.json
1265
- yarn tr-upload-data-flows-from-csv --auth=./transcend-api-keys.json --deploy=true
1318
+ yarn tr-update-consent-manager --auth=./transcend-api-keys.json --deploy=true
1266
1319
  ```
1267
1320
 
1268
1321
  ### tr-upload-data-flows-from-csv
@@ -1274,6 +1327,7 @@ Step 1) Download the CSV of data flows that you want to edit from the Admin Dash
1274
1327
  <img width="1464" alt="Screenshot 2023-06-22 at 6 05 36 PM" src="https://github.com/transcend-io/cli/assets/10264973/c4b65b31-2cf3-49c9-b543-041567c7aff8">
1275
1328
 
1276
1329
  Step 2) You can edit the contents of the CSV file as needed. You may adjust the "Purpose" column, adjust the "Notes" column, add "Owners" and "Teams" or even add custom columns with additional metadata.
1330
+
1277
1331
  Step 3) Upload the modified CSV file back into the dashboard with the command `yarn tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY --file=./approved-flows.csv --trackerStatus=LIVE`
1278
1332
 
1279
1333
  #### Authentication
@@ -1325,7 +1379,7 @@ yarn tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY --trackerStatus=LIV
1325
1379
  Specifying the backend URL, needed for US hosted backend infrastructure.
1326
1380
 
1327
1381
  ```sh
1328
- yarn tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY --trackerStatus=LIVE
1382
+ yarn tr-upload-data-flows-from-csv --auth=$TRANSCEND_API_KEY --transcendUrl=https://api.us.transcend.io
1329
1383
  ```
1330
1384
 
1331
1385
  ### tr-generate-api-keys
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli-request-approve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-request-approve.d.ts","sourceRoot":"","sources":["../src/cli-request-approve.ts"],"names":[],"mappings":""}
@@ -0,0 +1,56 @@
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
+ * Restart requests based on some filter criteria
14
+ *
15
+ * Requires scopes:
16
+ * - Request Approval and Communication
17
+ * - View Incoming Requests
18
+ * - Manage Request Compilation
19
+ *
20
+ * Dev Usage:
21
+ * yarn ts-node ./src/cli-request-approve.ts --auth=asd123 \
22
+ * --requestType=ERASURE --silentModeBefore=06/23/2023
23
+ *
24
+ * Standard usage:
25
+ * yarn tr-request-export --auth=asd123 \
26
+ * --requestType=ERASURE --silentModeBefore=06/23/2023
27
+ */
28
+ async function main() {
29
+ // Parse command line arguments
30
+ const { transcendUrl = 'https://api.transcend.io', auth, actions = '', silentModeBefore, concurrency = '100', } = (0, yargs_parser_1.default)(process.argv.slice(2));
31
+ // Ensure auth is passed
32
+ if (!auth) {
33
+ logger_1.logger.error(colors_1.default.red('A Transcend API key must be provided. You can specify using --auth=asd123'));
34
+ process.exit(1);
35
+ }
36
+ // Validate actions
37
+ const parsedActions = (0, requests_1.splitCsvToList)(actions);
38
+ const invalidActions = parsedActions.filter(
39
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
+ (type) => !Object.values(privacy_types_1.RequestAction).includes(type));
41
+ if (invalidActions.length > 0) {
42
+ logger_1.logger.error(colors_1.default.red(`Failed to parse actions:"${invalidActions.join(',')}".\n` +
43
+ `Expected one of: \n${Object.values(privacy_types_1.RequestAction).join('\n')}`));
44
+ process.exit(1);
45
+ }
46
+ // Pull privacy requests
47
+ await (0, requests_1.approvePrivacyRequests)({
48
+ transcendUrl,
49
+ requestActions: parsedActions,
50
+ auth,
51
+ concurrency: parseInt(concurrency, 10),
52
+ silentModeBefore: silentModeBefore ? new Date(silentModeBefore) : undefined,
53
+ });
54
+ }
55
+ main();
56
+ //# sourceMappingURL=cli-request-approve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-request-approve.js","sourceRoot":"","sources":["../src/cli-request-approve.ts"],"names":[],"mappings":";;;;;;AAEA,gEAAiC;AACjC,oDAA4B;AAE5B,qCAAkC;AAClC,+DAA4D;AAC5D,yCAAoE;AAEpE;;;;;;;;;;;;;;;GAeG;AACH,KAAK,UAAU,IAAI;IACjB,+BAA+B;IAC/B,MAAM,EACJ,YAAY,GAAG,0BAA0B,EACzC,IAAI,EACJ,OAAO,GAAG,EAAE,EACZ,gBAAgB,EAChB,WAAW,GAAG,KAAK,GACpB,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,IAAA,yBAAc,EAAC,OAAO,CAAoB,CAAC;IACjE,MAAM,cAAc,GAAG,aAAa,CAAC,MAAM;IACzC,8DAA8D;IAC9D,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,6BAAa,CAAC,CAAC,QAAQ,CAAC,IAAW,CAAC,CAC9D,CAAC;IACF,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;QAC7B,eAAM,CAAC,KAAK,CACV,gBAAM,CAAC,GAAG,CACR,4BAA4B,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM;YACxD,sBAAsB,MAAM,CAAC,MAAM,CAAC,6BAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClE,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,wBAAwB;IACxB,MAAM,IAAA,iCAAsB,EAAC;QAC3B,YAAY;QACZ,cAAc,EAAE,aAAa;QAC7B,IAAI;QACJ,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;QACtC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS;KAC5E,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -1,2 +1,4 @@
1
1
  export declare const REQUESTS: string;
2
+ export declare const APPROVE_PRIVACY_REQUESTS: string;
3
+ export declare const UPDATE_PRIVACY_REQUEST: string;
2
4
  //# sourceMappingURL=request.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/graphql/gqls/request.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,QAmCpB,CAAC"}
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/graphql/gqls/request.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,QAmCpB,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAQpC,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAQlC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REQUESTS = void 0;
3
+ exports.UPDATE_PRIVACY_REQUEST = exports.APPROVE_PRIVACY_REQUESTS = exports.REQUESTS = void 0;
4
4
  const graphql_request_1 = require("graphql-request");
5
5
  exports.REQUESTS = (0, graphql_request_1.gql) `
6
6
  query TranscendCliRequests(
@@ -38,4 +38,22 @@ exports.REQUESTS = (0, graphql_request_1.gql) `
38
38
  }
39
39
  }
40
40
  `;
41
+ exports.APPROVE_PRIVACY_REQUESTS = (0, graphql_request_1.gql) `
42
+ mutation TranscendCliApprovePrivacyRequest($input: CommunicationInput!) {
43
+ approveRequest(input: $input) {
44
+ request {
45
+ id
46
+ }
47
+ }
48
+ }
49
+ `;
50
+ exports.UPDATE_PRIVACY_REQUEST = (0, graphql_request_1.gql) `
51
+ mutation TranscendCliUpdatePrivacyRequest($input: UpdateRequestInput!) {
52
+ updateRequest(input: $input) {
53
+ request {
54
+ id
55
+ }
56
+ }
57
+ }
58
+ `;
41
59
  //# sourceMappingURL=request.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/graphql/gqls/request.ts"],"names":[],"mappings":";;;AAAA,qDAAsC;AAEzB,QAAA,QAAQ,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC1B,CAAC"}
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/graphql/gqls/request.ts"],"names":[],"mappings":";;;AAAA,qDAAsC;AAEzB,QAAA,QAAQ,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC1B,CAAC;AAEW,QAAA,wBAAwB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;CAQ1C,CAAC;AAEW,QAAA,sBAAsB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;CAQxC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { RequestAction } from '@transcend-io/privacy-types';
2
+ /**
3
+ * Approve a set of privacy requests
4
+ *
5
+ * @param options - Options
6
+ * @returns The number of requests approved
7
+ */
8
+ export declare function approvePrivacyRequests({ requestActions, auth, silentModeBefore, concurrency, transcendUrl, }: {
9
+ /** The request actions that should be restarted */
10
+ requestActions: RequestAction[];
11
+ /** Transcend API key authentication */
12
+ auth: string;
13
+ /** Concurrency limit for approving */
14
+ concurrency?: number;
15
+ /** Mark these requests as silent mode if they were created before this date */
16
+ silentModeBefore?: Date;
17
+ /** API URL for Transcend backend */
18
+ transcendUrl?: string;
19
+ }): Promise<number>;
20
+ //# sourceMappingURL=approvePrivacyRequests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approvePrivacyRequests.d.ts","sourceRoot":"","sources":["../../src/requests/approvePrivacyRequests.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAiB,MAAM,6BAA6B,CAAC;AAU3E;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,EAC3C,cAAc,EACd,IAAI,EACJ,gBAAgB,EAChB,WAAiB,EACjB,YAAyC,GAC1C,EAAE;IACD,mDAAmD;IACnD,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,IAAI,CAAC;IACxB,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,CA+DlB"}
@@ -0,0 +1,61 @@
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.approvePrivacyRequests = void 0;
7
+ const bluebird_1 = require("bluebird");
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 graphql_1 = require("../graphql");
12
+ const cli_progress_1 = __importDefault(require("cli-progress"));
13
+ /**
14
+ * Approve a set of privacy requests
15
+ *
16
+ * @param options - Options
17
+ * @returns The number of requests approved
18
+ */
19
+ async function approvePrivacyRequests({ requestActions, auth, silentModeBefore, concurrency = 100, transcendUrl = 'https://api.transcend.io', }) {
20
+ // Find all requests made before createdAt that are in a removing data state
21
+ const client = (0, graphql_1.buildTranscendGraphQLClient)(transcendUrl, auth);
22
+ // Time duration
23
+ const t0 = new Date().getTime();
24
+ // create a new progress bar instance and use shades_classic theme
25
+ const progressBar = new cli_progress_1.default.SingleBar({}, cli_progress_1.default.Presets.shades_classic);
26
+ // Pull in the requests
27
+ const allRequests = await (0, graphql_1.fetchAllRequests)(client, {
28
+ actions: requestActions,
29
+ statuses: [privacy_types_1.RequestStatus.Approving],
30
+ });
31
+ // Notify Transcend
32
+ logger_1.logger.info(colors_1.default.magenta(`Approving "${allRequests.length}" requests.`));
33
+ let total = 0;
34
+ progressBar.start(allRequests.length, 0);
35
+ await (0, bluebird_1.map)(allRequests, async (requestToRestart) => {
36
+ // update request to silent mode if silentModeBefore is defined
37
+ // and the request was created before silentModeBefore
38
+ if (silentModeBefore &&
39
+ new Date(silentModeBefore) > new Date(requestToRestart.createdAt)) {
40
+ await (0, graphql_1.makeGraphQLRequest)(client, graphql_1.UPDATE_PRIVACY_REQUEST, {
41
+ input: {
42
+ id: requestToRestart.id,
43
+ isSilent: true,
44
+ },
45
+ });
46
+ }
47
+ // approve the request
48
+ await (0, graphql_1.makeGraphQLRequest)(client, graphql_1.APPROVE_PRIVACY_REQUESTS, {
49
+ input: { requestId: requestToRestart.id },
50
+ });
51
+ total += 1;
52
+ progressBar.update(total);
53
+ }, { concurrency });
54
+ progressBar.stop();
55
+ const t1 = new Date().getTime();
56
+ const totalTime = t1 - t0;
57
+ logger_1.logger.info(colors_1.default.green(`Successfully approved ${total} requests in "${totalTime / 1000}" seconds!`));
58
+ return allRequests.length;
59
+ }
60
+ exports.approvePrivacyRequests = approvePrivacyRequests;
61
+ //# sourceMappingURL=approvePrivacyRequests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approvePrivacyRequests.js","sourceRoot":"","sources":["../../src/requests/approvePrivacyRequests.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA+B;AAC/B,oDAA4B;AAC5B,sCAAmC;AACnC,+DAA2E;AAC3E,wCAMoB;AACpB,gEAAuC;AAEvC;;;;;GAKG;AACI,KAAK,UAAU,sBAAsB,CAAC,EAC3C,cAAc,EACd,IAAI,EACJ,gBAAgB,EAChB,WAAW,GAAG,GAAG,EACjB,YAAY,GAAG,0BAA0B,GAY1C;IACC,4EAA4E;IAC5E,MAAM,MAAM,GAAG,IAAA,qCAA2B,EAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAE/D,gBAAgB;IAChB,MAAM,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IAChC,kEAAkE;IAClE,MAAM,WAAW,GAAG,IAAI,sBAAW,CAAC,SAAS,CAC3C,EAAE,EACF,sBAAW,CAAC,OAAO,CAAC,cAAc,CACnC,CAAC;IAEF,uBAAuB;IACvB,MAAM,WAAW,GAAG,MAAM,IAAA,0BAAgB,EAAC,MAAM,EAAE;QACjD,OAAO,EAAE,cAAc;QACvB,QAAQ,EAAE,CAAC,6BAAa,CAAC,SAAS,CAAC;KACpC,CAAC,CAAC;IAEH,mBAAmB;IACnB,eAAM,CAAC,IAAI,CAAC,gBAAM,CAAC,OAAO,CAAC,cAAc,WAAW,CAAC,MAAM,aAAa,CAAC,CAAC,CAAC;IAE3E,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACzC,MAAM,IAAA,cAAG,EACP,WAAW,EACX,KAAK,EAAE,gBAAgB,EAAE,EAAE;QACzB,+DAA+D;QAC/D,sDAAsD;QACtD,IACE,gBAAgB;YAChB,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,IAAI,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,EACjE;YACA,MAAM,IAAA,4BAAkB,EAAC,MAAM,EAAE,gCAAsB,EAAE;gBACvD,KAAK,EAAE;oBACL,EAAE,EAAE,gBAAgB,CAAC,EAAE;oBACvB,QAAQ,EAAE,IAAI;iBACf;aACF,CAAC,CAAC;SACJ;QAED,sBAAsB;QACtB,MAAM,IAAA,4BAAkB,EAAC,MAAM,EAAE,kCAAwB,EAAE;YACzD,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,CAAC,EAAE,EAAE;SAC1C,CAAC,CAAC;QAEH,KAAK,IAAI,CAAC,CAAC;QACX,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,EACD,EAAE,WAAW,EAAE,CAChB,CAAC;IAEF,WAAW,CAAC,IAAI,EAAE,CAAC;IACnB,MAAM,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IAChC,MAAM,SAAS,GAAG,EAAE,GAAG,EAAE,CAAC;IAE1B,eAAM,CAAC,IAAI,CACT,gBAAM,CAAC,KAAK,CACV,yBAAyB,KAAK,iBAC5B,SAAS,GAAG,IACd,YAAY,CACb,CACF,CAAC;IACF,OAAO,WAAW,CAAC,MAAM,CAAC;AAC5B,CAAC;AAhFD,wDAgFC"}
@@ -10,6 +10,7 @@ export * from './mapCsvColumnsToApi';
10
10
  export * from './mapRequestEnumValues';
11
11
  export * from './mapCsvRowsToRequestInputs';
12
12
  export * from './submitPrivacyRequest';
13
+ export * from './approvePrivacyRequests';
13
14
  export * from './mapColumnsToIdentifiers';
14
15
  export * from './mapColumnsToAttributes';
15
16
  export * from './extractClientError';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/requests/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,WAAW,CAAC;AAC1B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/requests/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,WAAW,CAAC;AAC1B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC"}
@@ -26,6 +26,7 @@ __exportStar(require("./mapCsvColumnsToApi"), exports);
26
26
  __exportStar(require("./mapRequestEnumValues"), exports);
27
27
  __exportStar(require("./mapCsvRowsToRequestInputs"), exports);
28
28
  __exportStar(require("./submitPrivacyRequest"), exports);
29
+ __exportStar(require("./approvePrivacyRequests"), exports);
29
30
  __exportStar(require("./mapColumnsToIdentifiers"), exports);
30
31
  __exportStar(require("./mapColumnsToAttributes"), exports);
31
32
  __exportStar(require("./extractClientError"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,8CAA4B;AAC5B,kDAAgC;AAChC,mDAAiC;AACjC,8DAA4C;AAC5C,4CAA0B;AAC1B,6DAA2C;AAC3C,+CAA6B;AAC7B,uDAAqC;AACrC,yDAAuC;AACvC,8DAA4C;AAC5C,yDAAuC;AACvC,4DAA0C;AAC1C,2DAAyC;AACzC,uDAAqC;AACrC,iEAA+C;AAC/C,wDAAsC;AACtC,0DAAwC;AACxC,0DAAwC;AACxC,sDAAoC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,8CAA4B;AAC5B,kDAAgC;AAChC,mDAAiC;AACjC,8DAA4C;AAC5C,4CAA0B;AAC1B,6DAA2C;AAC3C,+CAA6B;AAC7B,uDAAqC;AACrC,yDAAuC;AACvC,8DAA4C;AAC5C,yDAAuC;AACvC,2DAAyC;AACzC,4DAA0C;AAC1C,2DAAyC;AACzC,uDAAqC;AACrC,iEAA+C;AAC/C,wDAAsC;AACtC,0DAAwC;AACxC,0DAAwC;AACxC,sDAAoC"}