@transcend-io/cli 4.57.0 → 4.58.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 +82 -13
- package/build/cli-request-approve.js +1 -1
- package/build/cli-request-cancel.d.ts +3 -0
- package/build/cli-request-cancel.d.ts.map +1 -0
- package/build/cli-request-cancel.js +66 -0
- package/build/cli-request-cancel.js.map +1 -0
- package/build/graphql/gqls/request.d.ts +2 -1
- package/build/graphql/gqls/request.d.ts.map +1 -1
- package/build/graphql/gqls/request.js +11 -2
- package/build/graphql/gqls/request.js.map +1 -1
- package/build/graphql/gqls/template.d.ts.map +1 -1
- package/build/graphql/gqls/template.js +6 -0
- package/build/graphql/gqls/template.js.map +1 -1
- package/build/graphql/syncTemplates.d.ts +10 -0
- package/build/graphql/syncTemplates.d.ts.map +1 -1
- package/build/graphql/syncTemplates.js.map +1 -1
- package/build/requests/approvePrivacyRequests.js +5 -5
- package/build/requests/approvePrivacyRequests.js.map +1 -1
- package/build/requests/cancelPrivacyRequests.d.ts +24 -0
- package/build/requests/cancelPrivacyRequests.d.ts.map +1 -0
- package/build/requests/cancelPrivacyRequests.js +90 -0
- package/build/requests/cancelPrivacyRequests.js.map +1 -0
- package/build/requests/index.d.ts +1 -0
- package/build/requests/index.d.ts.map +1 -1
- package/build/requests/index.js +1 -0
- package/build/requests/index.js.map +1 -1
- package/build/tsbuildinfo +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -25,54 +25,58 @@
|
|
|
25
25
|
- [Authentication](#authentication-3)
|
|
26
26
|
- [Arguments](#arguments-3)
|
|
27
27
|
- [Usage](#usage-4)
|
|
28
|
-
- [tr-request-
|
|
28
|
+
- [tr-request-cancel](#tr-request-cancel)
|
|
29
29
|
- [Authentication](#authentication-4)
|
|
30
30
|
- [Arguments](#arguments-4)
|
|
31
31
|
- [Usage](#usage-5)
|
|
32
|
-
- [tr-request-
|
|
32
|
+
- [tr-request-upload](#tr-request-upload)
|
|
33
33
|
- [Authentication](#authentication-5)
|
|
34
34
|
- [Arguments](#arguments-5)
|
|
35
35
|
- [Usage](#usage-6)
|
|
36
|
-
- [tr-request-
|
|
36
|
+
- [tr-request-restart](#tr-request-restart)
|
|
37
37
|
- [Authentication](#authentication-6)
|
|
38
38
|
- [Arguments](#arguments-6)
|
|
39
39
|
- [Usage](#usage-7)
|
|
40
|
-
- [tr-
|
|
40
|
+
- [tr-request-export](#tr-request-export)
|
|
41
41
|
- [Authentication](#authentication-7)
|
|
42
42
|
- [Arguments](#arguments-7)
|
|
43
43
|
- [Usage](#usage-8)
|
|
44
|
-
- [tr-cron-
|
|
44
|
+
- [tr-cron-pull-identifiers](#tr-cron-pull-identifiers)
|
|
45
45
|
- [Authentication](#authentication-8)
|
|
46
46
|
- [Arguments](#arguments-8)
|
|
47
47
|
- [Usage](#usage-9)
|
|
48
|
-
- [tr-
|
|
48
|
+
- [tr-cron-mark-identifiers-completed](#tr-cron-mark-identifiers-completed)
|
|
49
49
|
- [Authentication](#authentication-9)
|
|
50
50
|
- [Arguments](#arguments-9)
|
|
51
51
|
- [Usage](#usage-10)
|
|
52
|
-
- [tr-manual-enrichment-
|
|
52
|
+
- [tr-manual-enrichment-pull-identifiers](#tr-manual-enrichment-pull-identifiers)
|
|
53
53
|
- [Authentication](#authentication-10)
|
|
54
54
|
- [Arguments](#arguments-10)
|
|
55
55
|
- [Usage](#usage-11)
|
|
56
|
-
- [tr-
|
|
56
|
+
- [tr-manual-enrichment-push-identifiers](#tr-manual-enrichment-push-identifiers)
|
|
57
57
|
- [Authentication](#authentication-11)
|
|
58
58
|
- [Arguments](#arguments-11)
|
|
59
59
|
- [Usage](#usage-12)
|
|
60
|
-
- [tr-
|
|
60
|
+
- [tr-mark-request-data-silos-completed](#tr-mark-request-data-silos-completed)
|
|
61
61
|
- [Authentication](#authentication-12)
|
|
62
62
|
- [Arguments](#arguments-12)
|
|
63
63
|
- [Usage](#usage-13)
|
|
64
|
-
- [tr-
|
|
64
|
+
- [tr-retry-request-data-silos](#tr-retry-request-data-silos)
|
|
65
65
|
- [Authentication](#authentication-13)
|
|
66
66
|
- [Arguments](#arguments-13)
|
|
67
67
|
- [Usage](#usage-14)
|
|
68
|
-
- [tr-
|
|
68
|
+
- [tr-update-consent-manager](#tr-update-consent-manager)
|
|
69
69
|
- [Authentication](#authentication-14)
|
|
70
70
|
- [Arguments](#arguments-14)
|
|
71
71
|
- [Usage](#usage-15)
|
|
72
|
-
- [tr-
|
|
72
|
+
- [tr-upload-data-flows-from-csv](#tr-upload-data-flows-from-csv)
|
|
73
73
|
- [Authentication](#authentication-15)
|
|
74
74
|
- [Arguments](#arguments-15)
|
|
75
75
|
- [Usage](#usage-16)
|
|
76
|
+
- [tr-generate-api-keys](#tr-generate-api-keys)
|
|
77
|
+
- [Authentication](#authentication-16)
|
|
78
|
+
- [Arguments](#arguments-16)
|
|
79
|
+
- [Usage](#usage-17)
|
|
76
80
|
|
|
77
81
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
78
82
|
|
|
@@ -95,6 +99,7 @@ yarn tr-pull --auth=$TRANSCEND_API_KEY
|
|
|
95
99
|
yarn tr-push --auth=$TRANSCEND_API_KEY
|
|
96
100
|
yarn tr-discover-silos --auth=$TRANSCEND_API_KEY
|
|
97
101
|
yarn tr-request-approve --auth=$TRANSCEND_API_KEY
|
|
102
|
+
yarn tr-request-cancel --auth=$TRANSCEND_API_KEY
|
|
98
103
|
yarn tr-request-upload --auth=$TRANSCEND_API_KEY
|
|
99
104
|
yarn tr-request-export --auth=$TRANSCEND_API_KEY
|
|
100
105
|
yarn tr-request-restart --auth=$TRANSCEND_API_KEY
|
|
@@ -119,6 +124,7 @@ tr-pull --auth=$TRANSCEND_API_KEY
|
|
|
119
124
|
tr-push --auth=$TRANSCEND_API_KEY
|
|
120
125
|
tr-discover-silos --auth=$TRANSCEND_API_KEY
|
|
121
126
|
tr-request-approve --auth=$TRANSCEND_API_KEY
|
|
127
|
+
tr-request-cancel --auth=$TRANSCEND_API_KEY
|
|
122
128
|
tr-request-upload --auth=$TRANSCEND_API_KEY
|
|
123
129
|
tr-request-export --auth=$TRANSCEND_API_KEY
|
|
124
130
|
tr-request-restart --auth=$TRANSCEND_API_KEY
|
|
@@ -639,7 +645,7 @@ Specifying the backend URL, needed for US hosted backend infrastructure.
|
|
|
639
645
|
yarn tr-request-approve --auth=$TRANSCEND_API_KEY --actions=ERASURE --transcendUrl=https://api.us.transcend.io
|
|
640
646
|
```
|
|
641
647
|
|
|
642
|
-
Approve all requests, but mark any request made before 05/03/2023 as silent mode to prevent emailing the
|
|
648
|
+
Approve all requests, but mark any request made before 05/03/2023 as silent mode to prevent emailing those requests. When not provided, the existing silent mode state of that request will be used to determine if emails are sent.
|
|
643
649
|
|
|
644
650
|
```sh
|
|
645
651
|
yarn tr-request-approve --auth=$TRANSCEND_API_KEY --actions=SALE_OPT_OUT --silentModeBefore=05/03/2023
|
|
@@ -651,6 +657,69 @@ Increase the concurrency (defaults to 100)
|
|
|
651
657
|
yarn tr-request-approve --auth=$TRANSCEND_API_KEY --actions=ERASURE --concurrency=500
|
|
652
658
|
```
|
|
653
659
|
|
|
660
|
+
### tr-request-cancel
|
|
661
|
+
|
|
662
|
+
Bulk cancel a set of privacy requests from the [Privacy Requests -> Incoming Requests](https://app.transcend.io/privacy-requests/incoming-requests) tab.
|
|
663
|
+
|
|
664
|
+
#### Authentication
|
|
665
|
+
|
|
666
|
+
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).
|
|
667
|
+
|
|
668
|
+
The API key needs the following scopes:
|
|
669
|
+
|
|
670
|
+
- Request Approval and Communication
|
|
671
|
+
- View Incoming Requests
|
|
672
|
+
|
|
673
|
+
#### Arguments
|
|
674
|
+
|
|
675
|
+
| Argument | Description | Type | Default | Required |
|
|
676
|
+
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | ---------------------------------------------------------------------------------------- | -------- |
|
|
677
|
+
| auth | The Transcend API key with the scopes necessary for the command. | string | N/A | true |
|
|
678
|
+
| actions | The [request actions](https://docs.transcend.io/docs/privacy-requests/configuring-requests/data-subject-requests#data-actions) to cancel. | RequestAction[] | N/A | true |
|
|
679
|
+
| statuses | The [request statuses](https://docs.transcend.io/docs/privacy-requests/overview#request-statuses) to cancel. | RequestStatus[] | REQUEST_MADE,WAITING.ENRICHING,COMPILING,DELAYED,APPROVING,SECONDARY,SECONDARY_APPROVING | false |
|
|
680
|
+
| silentModeBefore | Any requests made before this date should be marked as silent mode for canceling to skip email sending | Date | N/A | false |
|
|
681
|
+
| cancellationTitle | The title of the [email template](https://app.transcend.io/privacy-requests/email-templates) that should be sent to the requests upon cancelation. Any request in silent mode will not be emailed. | string | Request Canceled | false |
|
|
682
|
+
| transcendUrl | URL of the Transcend backend. Use https://api.us.transcend.io for US hosting. | string - URL | https://api.transcend.io | false |
|
|
683
|
+
| concurrency | The concurrency to use when uploading requests in parallel. | number | 100 | false |
|
|
684
|
+
|
|
685
|
+
#### Usage
|
|
686
|
+
|
|
687
|
+
Bulk cancel all open SALE_OPT_OUT and ERASURE requests.
|
|
688
|
+
|
|
689
|
+
```sh
|
|
690
|
+
yarn tr-request-cancel --auth=$TRANSCEND_API_KEY --actions=SALE_OPT_OUT,ERASURE
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
Specifying the backend URL, needed for US hosted backend infrastructure.
|
|
694
|
+
|
|
695
|
+
```sh
|
|
696
|
+
yarn tr-request-cancel --auth=$TRANSCEND_API_KEY --actions=ERASURE --transcendUrl=https://api.us.transcend.io
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
Bulk cancel all Erasure (request.type=ERASURE) requests that are in an enriching state (request.status=ENRICHING)
|
|
700
|
+
|
|
701
|
+
```sh
|
|
702
|
+
yarn tr-request-cancel --auth=$TRANSCEND_API_KEY --actions=ERASURE --statuses=ENRICHING
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
Send a specific email template to the request that are being canceled. When not provided, the default cancellation template is used ("Request Canceled").
|
|
706
|
+
|
|
707
|
+
```sh
|
|
708
|
+
yarn tr-request-cancel --auth=$TRANSCEND_API_KEY --actions=ERASURE --cancellationTitle="Custom Email Template"
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
Cancel all open SALE_OPT_OUT, but mark any request made before 05/03/2023 as silent mode to prevent emailing those requests. When not provided, the existing silent mode state of that request will be used to determine if emails are sent.
|
|
712
|
+
|
|
713
|
+
```sh
|
|
714
|
+
yarn tr-request-cancel --auth=$TRANSCEND_API_KEY --actions=SALE_OPT_OUT --silentModeBefore=05/03/2023
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
Increase the concurrency (defaults to 100)
|
|
718
|
+
|
|
719
|
+
```sh
|
|
720
|
+
yarn tr-request-cancel --auth=$TRANSCEND_API_KEY --actions=ERASURE --concurrency=500
|
|
721
|
+
```
|
|
722
|
+
|
|
654
723
|
### tr-request-upload
|
|
655
724
|
|
|
656
725
|
If you need to upload a set of requests from a CSV, you can run this command.
|
|
@@ -22,7 +22,7 @@ const requests_1 = require("./requests");
|
|
|
22
22
|
* --requestType=ERASURE --silentModeBefore=06/23/2023
|
|
23
23
|
*
|
|
24
24
|
* Standard usage:
|
|
25
|
-
* yarn tr-request-
|
|
25
|
+
* yarn tr-request-approve --auth=asd123 \
|
|
26
26
|
* --requestType=ERASURE --silentModeBefore=06/23/2023
|
|
27
27
|
*/
|
|
28
28
|
async function main() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-request-cancel.d.ts","sourceRoot":"","sources":["../src/cli-request-cancel.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
* Cancel requests based on some filter criteria
|
|
14
|
+
*
|
|
15
|
+
* Requires scopes:
|
|
16
|
+
* - Request Approval and Communication
|
|
17
|
+
*
|
|
18
|
+
* Dev Usage:
|
|
19
|
+
* yarn ts-node ./src/cli-request-cancel.ts --auth=asd123 \
|
|
20
|
+
* --requestType=ERASURE --silentModeBefore=06/23/2023
|
|
21
|
+
*
|
|
22
|
+
* Standard usage:
|
|
23
|
+
* yarn tr-request-cancel --auth=asd123 \
|
|
24
|
+
* --requestType=ERASURE --silentModeBefore=06/23/2023
|
|
25
|
+
*/
|
|
26
|
+
async function main() {
|
|
27
|
+
// Parse command line arguments
|
|
28
|
+
const { transcendUrl = 'https://api.transcend.io', auth, actions = '', statuses = '', silentModeBefore, cancellationTitle, concurrency = '100', } = (0, yargs_parser_1.default)(process.argv.slice(2));
|
|
29
|
+
// Ensure auth is passed
|
|
30
|
+
if (!auth) {
|
|
31
|
+
logger_1.logger.error(colors_1.default.red('A Transcend API key must be provided. You can specify using --auth=asd123'));
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
// Validate actions
|
|
35
|
+
const parsedActions = (0, requests_1.splitCsvToList)(actions);
|
|
36
|
+
const invalidActions = parsedActions.filter(
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
+
(type) => !Object.values(privacy_types_1.RequestAction).includes(type));
|
|
39
|
+
if (invalidActions.length > 0) {
|
|
40
|
+
logger_1.logger.error(colors_1.default.red(`Failed to parse actions:"${invalidActions.join(',')}".\n` +
|
|
41
|
+
`Expected one of: \n${Object.values(privacy_types_1.RequestAction).join('\n')}`));
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
// Validate statuses
|
|
45
|
+
const parsedStatuses = (0, requests_1.splitCsvToList)(statuses);
|
|
46
|
+
const invalidStatues = parsedStatuses.filter(
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
+
(type) => !Object.values(privacy_types_1.RequestStatus).includes(type));
|
|
49
|
+
if (invalidStatues.length > 0) {
|
|
50
|
+
logger_1.logger.error(colors_1.default.red(`Failed to parse statuses:"${invalidStatues.join(',')}".\n` +
|
|
51
|
+
`Expected one of: \n${Object.values(privacy_types_1.RequestStatus).join('\n')}`));
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
// Pull privacy requests
|
|
55
|
+
await (0, requests_1.cancelPrivacyRequests)({
|
|
56
|
+
transcendUrl,
|
|
57
|
+
requestActions: parsedActions,
|
|
58
|
+
auth,
|
|
59
|
+
cancellationTitle,
|
|
60
|
+
statuses: parsedStatuses.length > 0 ? parsedStatuses : undefined,
|
|
61
|
+
concurrency: parseInt(concurrency, 10),
|
|
62
|
+
silentModeBefore: silentModeBefore ? new Date(silentModeBefore) : undefined,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
main();
|
|
66
|
+
//# sourceMappingURL=cli-request-cancel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-request-cancel.js","sourceRoot":"","sources":["../src/cli-request-cancel.ts"],"names":[],"mappings":";;;;;;AAEA,gEAAiC;AACjC,oDAA4B;AAE5B,qCAAkC;AAClC,+DAA2E;AAC3E,yCAAmE;AAEnE;;;;;;;;;;;;;GAaG;AACH,KAAK,UAAU,IAAI;IACjB,+BAA+B;IAC/B,MAAM,EACJ,YAAY,GAAG,0BAA0B,EACzC,IAAI,EACJ,OAAO,GAAG,EAAE,EACZ,QAAQ,GAAG,EAAE,EACb,gBAAgB,EAChB,iBAAiB,EACjB,WAAW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AAI,CAAC,GAAG,CAAC,MAAM;YACzD,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,gCAAqB,EAAC;QAC1B,YAAY;QACZ,cAAc,EAAE,aAAa;QAC7B,IAAI;QACJ,iBAAiB;QACjB,QAAQ,EAAE,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS;QAChE,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,4 +1,5 @@
|
|
|
1
1
|
export declare const REQUESTS: string;
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const APPROVE_PRIVACY_REQUEST: string;
|
|
3
|
+
export declare const CANCEL_PRIVACY_REQUEST: string;
|
|
3
4
|
export declare const UPDATE_PRIVACY_REQUEST: string;
|
|
4
5
|
//# 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;AAEF,eAAO,MAAM,
|
|
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,uBAAuB,QAQnC,CAAC;AACF,eAAO,MAAM,sBAAsB,QAQlC,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.UPDATE_PRIVACY_REQUEST = exports.
|
|
3
|
+
exports.UPDATE_PRIVACY_REQUEST = exports.CANCEL_PRIVACY_REQUEST = exports.APPROVE_PRIVACY_REQUEST = 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,7 +38,7 @@ exports.REQUESTS = (0, graphql_request_1.gql) `
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
`;
|
|
41
|
-
exports.
|
|
41
|
+
exports.APPROVE_PRIVACY_REQUEST = (0, graphql_request_1.gql) `
|
|
42
42
|
mutation TranscendCliApprovePrivacyRequest($input: CommunicationInput!) {
|
|
43
43
|
approveRequest(input: $input) {
|
|
44
44
|
request {
|
|
@@ -47,6 +47,15 @@ exports.APPROVE_PRIVACY_REQUESTS = (0, graphql_request_1.gql) `
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
`;
|
|
50
|
+
exports.CANCEL_PRIVACY_REQUEST = (0, graphql_request_1.gql) `
|
|
51
|
+
mutation TranscendCliCancelPrivacyRequest($input: CommunicationInput!) {
|
|
52
|
+
cancelRequest(input: $input) {
|
|
53
|
+
request {
|
|
54
|
+
id
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
50
59
|
exports.UPDATE_PRIVACY_REQUEST = (0, graphql_request_1.gql) `
|
|
51
60
|
mutation TranscendCliUpdatePrivacyRequest($input: UpdateRequestInput!) {
|
|
52
61
|
updateRequest(input: $input) {
|
|
@@ -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;AAEW,QAAA,
|
|
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,uBAAuB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;CAQzC,CAAC;AACW,QAAA,sBAAsB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;CAQxC,CAAC;AAEW,QAAA,sBAAsB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;CAQxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../src/graphql/gqls/template.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../src/graphql/gqls/template.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,QAerB,CAAC;AAEF,eAAO,MAAM,eAAe,QAM3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/graphql/gqls/template.ts"],"names":[],"mappings":";;;AAAA,qDAAsC;AAEzB,QAAA,SAAS,GAAG,IAAA,qBAAG,EAAA
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/graphql/gqls/template.ts"],"names":[],"mappings":";;;AAAA,qDAAsC;AAEzB,QAAA,SAAS,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;CAe3B,CAAC;AAEW,QAAA,eAAe,GAAG,IAAA,qBAAG,EAAA;;;;;;CAMjC,CAAC"}
|
|
@@ -5,6 +5,16 @@ export interface Template {
|
|
|
5
5
|
id: string;
|
|
6
6
|
/** Title of Template */
|
|
7
7
|
title: string;
|
|
8
|
+
/** Template subject (e.g. email subject) */
|
|
9
|
+
subject: {
|
|
10
|
+
/** Default message for template subject */
|
|
11
|
+
defaultMessage: string;
|
|
12
|
+
};
|
|
13
|
+
/** Template body - rich text HTML */
|
|
14
|
+
template: {
|
|
15
|
+
/** Default message for template body */
|
|
16
|
+
defaultMessage: string;
|
|
17
|
+
};
|
|
8
18
|
}
|
|
9
19
|
/**
|
|
10
20
|
* Fetch all Templates in the organization
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncTemplates.d.ts","sourceRoot":"","sources":["../../src/graphql/syncTemplates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,MAAM,WAAW,QAAQ;IACvB,qBAAqB;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"syncTemplates.d.ts","sourceRoot":"","sources":["../../src/graphql/syncTemplates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,MAAM,WAAW,QAAQ;IACvB,qBAAqB;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,OAAO,EAAE;QACP,2CAA2C;QAC3C,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,qCAAqC;IACrC,QAAQ,EAAE;QACR,wCAAwC;QACxC,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAID;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,EACrB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,QAAQ,EAAE,CAAC,CA2BrB;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,IAAI,CAAC,CAaf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncTemplates.js","sourceRoot":"","sources":["../../src/graphql/syncTemplates.ts"],"names":[],"mappings":";;;AAEA,iCAAoD;AACpD,6DAA0D;
|
|
1
|
+
{"version":3,"file":"syncTemplates.js","sourceRoot":"","sources":["../../src/graphql/syncTemplates.ts"],"names":[],"mappings":";;;AAEA,iCAAoD;AACpD,6DAA0D;AAmB1D,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CACrC,MAAqB,EACrB,KAAc;IAEd,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,+CAA+C;IAC/C,IAAI,cAAc,GAAG,KAAK,CAAC;IAC3B,GAAG;QACD,MAAM,EACJ,SAAS,EAAE,EAAE,KAAK,EAAE;QACpB,4CAA4C;UAC7C,GAAG,MAAM,IAAA,uCAAkB,EAMzB,MAAM,EAAE,gBAAS,EAAE;YACpB,KAAK,EAAE,SAAS;YAChB,MAAM;YACN,KAAK;SACN,CAAC,CAAC;QACH,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QACzB,MAAM,IAAI,SAAS,CAAC;QACpB,cAAc,GAAG,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC;KAC7C,QAAQ,cAAc,EAAE;IAEzB,OAAO,SAAS,CAAC;AACnB,CAAC;AA9BD,8CA8BC;AAED;;;;;GAKG;AACI,KAAK,UAAU,YAAY,CAChC,QAAuB,EACvB,MAAqB;IAErB,+CAA+C;IAC/C,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChE,MAAM,gBAAgB,GAAG,OAAO,CAAC,IAAI,CACnC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CACxC,CAAC;IAEF,gCAAgC;IAChC,IAAI,CAAC,gBAAgB,EAAE;QACrB,MAAM,IAAA,uCAAkB,EAAC,MAAM,EAAE,sBAAe,EAAE;YAChD,KAAK,EAAE,QAAQ,CAAC,KAAK;SACtB,CAAC,CAAC;KACJ;AACH,CAAC;AAhBD,oCAgBC"}
|
|
@@ -32,21 +32,21 @@ async function approvePrivacyRequests({ requestActions, auth, silentModeBefore,
|
|
|
32
32
|
logger_1.logger.info(colors_1.default.magenta(`Approving "${allRequests.length}" requests.`));
|
|
33
33
|
let total = 0;
|
|
34
34
|
progressBar.start(allRequests.length, 0);
|
|
35
|
-
await (0, bluebird_1.map)(allRequests, async (
|
|
35
|
+
await (0, bluebird_1.map)(allRequests, async (requestToApprove) => {
|
|
36
36
|
// update request to silent mode if silentModeBefore is defined
|
|
37
37
|
// and the request was created before silentModeBefore
|
|
38
38
|
if (silentModeBefore &&
|
|
39
|
-
new Date(silentModeBefore) > new Date(
|
|
39
|
+
new Date(silentModeBefore) > new Date(requestToApprove.createdAt)) {
|
|
40
40
|
await (0, graphql_1.makeGraphQLRequest)(client, graphql_1.UPDATE_PRIVACY_REQUEST, {
|
|
41
41
|
input: {
|
|
42
|
-
id:
|
|
42
|
+
id: requestToApprove.id,
|
|
43
43
|
isSilent: true,
|
|
44
44
|
},
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
// approve the request
|
|
48
|
-
await (0, graphql_1.makeGraphQLRequest)(client, graphql_1.
|
|
49
|
-
input: { requestId:
|
|
48
|
+
await (0, graphql_1.makeGraphQLRequest)(client, graphql_1.APPROVE_PRIVACY_REQUEST, {
|
|
49
|
+
input: { requestId: requestToApprove.id },
|
|
50
50
|
});
|
|
51
51
|
total += 1;
|
|
52
52
|
progressBar.update(total);
|
|
@@ -1 +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,IA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|
|
4
|
+
*
|
|
5
|
+
* @param options - Options
|
|
6
|
+
* @returns The number of requests canceled
|
|
7
|
+
*/
|
|
8
|
+
export declare function cancelPrivacyRequests({ requestActions, cancellationTitle, auth, silentModeBefore, statuses, 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
|
+
/** The request statuses to cancel */
|
|
16
|
+
statuses?: RequestStatus[];
|
|
17
|
+
/** Mark these requests as silent mode if they were created before this date */
|
|
18
|
+
silentModeBefore?: Date;
|
|
19
|
+
/** API URL for Transcend backend */
|
|
20
|
+
transcendUrl?: string;
|
|
21
|
+
/** The email template to use when canceling the requests */
|
|
22
|
+
cancellationTitle?: string;
|
|
23
|
+
}): Promise<number>;
|
|
24
|
+
//# sourceMappingURL=cancelPrivacyRequests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelPrivacyRequests.d.ts","sourceRoot":"","sources":["../../src/requests/cancelPrivacyRequests.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAY3E;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,EAC1C,cAAc,EACd,iBAAiB,EACjB,IAAI,EACJ,gBAAgB,EAChB,QASC,EACD,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,qCAAqC;IACrC,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;IAC3B,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,IAAI,CAAC;IACxB,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GAAG,OAAO,CAAC,MAAM,CAAC,CAiGlB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
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.cancelPrivacyRequests = 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
|
+
* Cancel a set of privacy requests
|
|
15
|
+
*
|
|
16
|
+
* @param options - Options
|
|
17
|
+
* @returns The number of requests canceled
|
|
18
|
+
*/
|
|
19
|
+
async function cancelPrivacyRequests({ requestActions, cancellationTitle, auth, silentModeBefore, statuses = [
|
|
20
|
+
privacy_types_1.RequestStatus.Compiling,
|
|
21
|
+
privacy_types_1.RequestStatus.RequestMade,
|
|
22
|
+
privacy_types_1.RequestStatus.Delayed,
|
|
23
|
+
privacy_types_1.RequestStatus.Approving,
|
|
24
|
+
privacy_types_1.RequestStatus.Secondary,
|
|
25
|
+
privacy_types_1.RequestStatus.Enriching,
|
|
26
|
+
privacy_types_1.RequestStatus.Waiting,
|
|
27
|
+
privacy_types_1.RequestStatus.SecondaryApproving,
|
|
28
|
+
], concurrency = 100, transcendUrl = 'https://api.transcend.io', }) {
|
|
29
|
+
// Find all requests made before createdAt that are in a removing data state
|
|
30
|
+
const client = (0, graphql_1.buildTranscendGraphQLClient)(transcendUrl, auth);
|
|
31
|
+
// Time duration
|
|
32
|
+
const t0 = new Date().getTime();
|
|
33
|
+
// create a new progress bar instance and use shades_classic theme
|
|
34
|
+
const progressBar = new cli_progress_1.default.SingleBar({}, cli_progress_1.default.Presets.shades_classic);
|
|
35
|
+
// Grab the template with that title
|
|
36
|
+
let cancelationTemplate;
|
|
37
|
+
if (cancellationTitle) {
|
|
38
|
+
const matchingTemplates = await (0, graphql_1.fetchAllTemplates)(client, cancellationTitle);
|
|
39
|
+
const exactTitleMatch = matchingTemplates.find((template) => template.title === cancellationTitle);
|
|
40
|
+
if (!exactTitleMatch) {
|
|
41
|
+
throw new Error(`Failed to find a template with title: "${cancellationTitle}"`);
|
|
42
|
+
}
|
|
43
|
+
cancelationTemplate = exactTitleMatch;
|
|
44
|
+
}
|
|
45
|
+
// Pull in the requests
|
|
46
|
+
const allRequests = await (0, graphql_1.fetchAllRequests)(client, {
|
|
47
|
+
actions: requestActions,
|
|
48
|
+
statuses,
|
|
49
|
+
});
|
|
50
|
+
// Notify Transcend
|
|
51
|
+
logger_1.logger.info(colors_1.default.magenta(`Canceling "${allRequests.length}" requests${cancelationTemplate
|
|
52
|
+
? ` Using template: ${cancelationTemplate.title}`
|
|
53
|
+
: ''}.`));
|
|
54
|
+
let total = 0;
|
|
55
|
+
progressBar.start(allRequests.length, 0);
|
|
56
|
+
await (0, bluebird_1.map)(allRequests, async (requestToCancel) => {
|
|
57
|
+
// update request to silent mode if silentModeBefore is defined
|
|
58
|
+
// and the request was created before silentModeBefore
|
|
59
|
+
if (silentModeBefore &&
|
|
60
|
+
new Date(silentModeBefore) > new Date(requestToCancel.createdAt)) {
|
|
61
|
+
await (0, graphql_1.makeGraphQLRequest)(client, graphql_1.UPDATE_PRIVACY_REQUEST, {
|
|
62
|
+
input: {
|
|
63
|
+
id: requestToCancel.id,
|
|
64
|
+
isSilent: true,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
// cancel the request
|
|
69
|
+
await (0, graphql_1.makeGraphQLRequest)(client, graphql_1.CANCEL_PRIVACY_REQUEST, {
|
|
70
|
+
input: {
|
|
71
|
+
requestId: requestToCancel.id,
|
|
72
|
+
...(cancelationTemplate
|
|
73
|
+
? {
|
|
74
|
+
subject: `Re: ${cancelationTemplate.subject.defaultMessage}`,
|
|
75
|
+
template: cancelationTemplate.template.defaultMessage,
|
|
76
|
+
}
|
|
77
|
+
: {}),
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
total += 1;
|
|
81
|
+
progressBar.update(total);
|
|
82
|
+
}, { concurrency });
|
|
83
|
+
progressBar.stop();
|
|
84
|
+
const t1 = new Date().getTime();
|
|
85
|
+
const totalTime = t1 - t0;
|
|
86
|
+
logger_1.logger.info(colors_1.default.green(`Successfully canceled ${total} requests in "${totalTime / 1000}" seconds!`));
|
|
87
|
+
return allRequests.length;
|
|
88
|
+
}
|
|
89
|
+
exports.cancelPrivacyRequests = cancelPrivacyRequests;
|
|
90
|
+
//# sourceMappingURL=cancelPrivacyRequests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelPrivacyRequests.js","sourceRoot":"","sources":["../../src/requests/cancelPrivacyRequests.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA+B;AAC/B,oDAA4B;AAC5B,sCAAmC;AACnC,+DAA2E;AAC3E,wCAQoB;AACpB,gEAAuC;AAEvC;;;;;GAKG;AACI,KAAK,UAAU,qBAAqB,CAAC,EAC1C,cAAc,EACd,iBAAiB,EACjB,IAAI,EACJ,gBAAgB,EAChB,QAAQ,GAAG;IACT,6BAAa,CAAC,SAAS;IACvB,6BAAa,CAAC,WAAW;IACzB,6BAAa,CAAC,OAAO;IACrB,6BAAa,CAAC,SAAS;IACvB,6BAAa,CAAC,SAAS;IACvB,6BAAa,CAAC,SAAS;IACvB,6BAAa,CAAC,OAAO;IACrB,6BAAa,CAAC,kBAAkB;CACjC,EACD,WAAW,GAAG,GAAG,EACjB,YAAY,GAAG,0BAA0B,GAgB1C;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,+DAA+D;QAC/D,sDAAsD;QACtD,IACE,gBAAgB;YAChB,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,EAChE;YACA,MAAM,IAAA,4BAAkB,EAAC,MAAM,EAAE,gCAAsB,EAAE;gBACvD,KAAK,EAAE;oBACL,EAAE,EAAE,eAAe,CAAC,EAAE;oBACtB,QAAQ,EAAE,IAAI;iBACf;aACF,CAAC,CAAC;SACJ;QAED,qBAAqB;QACrB,MAAM,IAAA,4BAAkB,EAAC,MAAM,EAAE,gCAAsB,EAAE;YACvD,KAAK,EAAE;gBACL,SAAS,EAAE,eAAe,CAAC,EAAE;gBAC7B,GAAG,CAAC,mBAAmB;oBACrB,CAAC,CAAC;wBACE,OAAO,EAAE,OAAO,mBAAmB,CAAC,OAAO,CAAC,cAAc,EAAE;wBAC5D,QAAQ,EAAE,mBAAmB,CAAC,QAAQ,CAAC,cAAc;qBACtD;oBACH,CAAC,CAAC,EAAE,CAAC;aACR;SACF,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;AAjID,sDAiIC"}
|
|
@@ -12,6 +12,7 @@ export * from './mapCsvRowsToRequestInputs';
|
|
|
12
12
|
export * from './submitPrivacyRequest';
|
|
13
13
|
export * from './approvePrivacyRequests';
|
|
14
14
|
export * from './mapColumnsToIdentifiers';
|
|
15
|
+
export * from './cancelPrivacyRequests';
|
|
15
16
|
export * from './mapColumnsToAttributes';
|
|
16
17
|
export * from './extractClientError';
|
|
17
18
|
export * from './uploadPrivacyRequestsFromCsv';
|
|
@@ -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,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"}
|
|
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,yBAAyB,CAAC;AACxC,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"}
|
package/build/requests/index.js
CHANGED
|
@@ -28,6 +28,7 @@ __exportStar(require("./mapCsvRowsToRequestInputs"), exports);
|
|
|
28
28
|
__exportStar(require("./submitPrivacyRequest"), exports);
|
|
29
29
|
__exportStar(require("./approvePrivacyRequests"), exports);
|
|
30
30
|
__exportStar(require("./mapColumnsToIdentifiers"), exports);
|
|
31
|
+
__exportStar(require("./cancelPrivacyRequests"), exports);
|
|
31
32
|
__exportStar(require("./mapColumnsToAttributes"), exports);
|
|
32
33
|
__exportStar(require("./extractClientError"), exports);
|
|
33
34
|
__exportStar(require("./uploadPrivacyRequestsFromCsv"), 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,2DAAyC;AACzC,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,0DAAwC;AACxC,2DAAyC;AACzC,uDAAqC;AACrC,iEAA+C;AAC/C,wDAAsC;AACtC,0DAAwC;AACxC,0DAAwC;AACxC,sDAAoC"}
|