@transcend-io/cli 4.18.1 → 4.20.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 +189 -27
- package/build/cli-cron-mark-identifiers-completed.d.ts +3 -0
- package/build/cli-cron-mark-identifiers-completed.d.ts.map +1 -0
- package/build/cli-cron-mark-identifiers-completed.js +44 -0
- package/build/cli-cron-mark-identifiers-completed.js.map +1 -0
- package/build/cli-cron-pull-identifiers.d.ts +3 -0
- package/build/cli-cron-pull-identifiers.d.ts.map +1 -0
- package/build/{cli-pull-cron-identifiers.js → cli-cron-pull-identifiers.js} +3 -3
- package/build/{cli-pull-cron-identifiers.js.map → cli-cron-pull-identifiers.js.map} +1 -1
- package/build/cli-request-restart.d.ts +3 -0
- package/build/cli-request-restart.d.ts.map +1 -0
- package/build/cli-request-restart.js +96 -0
- package/build/cli-request-restart.js.map +1 -0
- package/build/cron/index.d.ts +2 -0
- package/build/cron/index.d.ts.map +1 -1
- package/build/cron/index.js +2 -0
- package/build/cron/index.js.map +1 -1
- package/build/cron/markCronIdentifierCompleted.d.ts +21 -0
- package/build/cron/markCronIdentifierCompleted.d.ts.map +1 -0
- package/build/cron/markCronIdentifierCompleted.js +55 -0
- package/build/cron/markCronIdentifierCompleted.js.map +1 -0
- package/build/cron/pushCronIdentifiersFromCsv.d.ts +21 -0
- package/build/cron/pushCronIdentifiersFromCsv.d.ts.map +1 -0
- package/build/cron/pushCronIdentifiersFromCsv.js +34 -0
- package/build/cron/pushCronIdentifiersFromCsv.js.map +1 -0
- package/build/graphql/fetchAllRequestIdentifiers.d.ts +25 -0
- package/build/graphql/fetchAllRequestIdentifiers.d.ts.map +1 -0
- package/build/graphql/fetchAllRequestIdentifiers.js +34 -0
- package/build/graphql/fetchAllRequestIdentifiers.js.map +1 -0
- package/build/graphql/fetchAllRequests.d.ts +45 -0
- package/build/graphql/fetchAllRequests.d.ts.map +1 -0
- package/build/graphql/fetchAllRequests.js +43 -0
- package/build/graphql/fetchAllRequests.js.map +1 -0
- package/build/graphql/fetchApiKeys.d.ts +1 -1
- package/build/graphql/gqls/RequestIdentifier.d.ts +2 -0
- package/build/graphql/gqls/RequestIdentifier.d.ts.map +1 -0
- package/build/graphql/gqls/RequestIdentifier.js +27 -0
- package/build/graphql/gqls/RequestIdentifier.js.map +1 -0
- package/build/graphql/gqls/index.d.ts +2 -0
- package/build/graphql/gqls/index.d.ts.map +1 -1
- package/build/graphql/gqls/index.js +2 -0
- package/build/graphql/gqls/index.js.map +1 -1
- package/build/graphql/gqls/request.d.ts +2 -0
- package/build/graphql/gqls/request.d.ts.map +1 -0
- package/build/graphql/gqls/request.js +36 -0
- package/build/graphql/gqls/request.js.map +1 -0
- package/build/graphql/index.d.ts +2 -0
- package/build/graphql/index.d.ts.map +1 -1
- package/build/graphql/index.js +2 -0
- package/build/graphql/index.js.map +1 -1
- package/build/requests/bulkRestartRequests.d.ts +35 -0
- package/build/requests/bulkRestartRequests.d.ts.map +1 -0
- package/build/requests/bulkRestartRequests.js +160 -0
- package/build/requests/bulkRestartRequests.js.map +1 -0
- package/build/requests/constants.d.ts +17 -3
- package/build/requests/constants.d.ts.map +1 -1
- package/build/requests/constants.js +14 -8
- package/build/requests/constants.js.map +1 -1
- package/build/requests/index.d.ts +2 -0
- package/build/requests/index.d.ts.map +1 -1
- package/build/requests/index.js +2 -0
- package/build/requests/index.js.map +1 -1
- package/build/requests/mapColumnsToIdentifiers.d.ts.map +1 -1
- package/build/requests/mapColumnsToIdentifiers.js +2 -3
- package/build/requests/mapColumnsToIdentifiers.js.map +1 -1
- package/build/requests/restartPrivacyRequest.d.ts +20 -0
- package/build/requests/restartPrivacyRequest.d.ts.map +1 -0
- package/build/requests/restartPrivacyRequest.js +86 -0
- package/build/requests/restartPrivacyRequest.js.map +1 -0
- package/build/requests/submitPrivacyRequest.d.ts +5 -5
- package/build/requests/uploadPrivacyRequestsFromCsv.d.ts.map +1 -1
- package/build/requests/uploadPrivacyRequestsFromCsv.js +1 -1
- package/build/requests/uploadPrivacyRequestsFromCsv.js.map +1 -1
- package/build/tsbuildinfo +1 -1
- package/package.json +4 -2
- package/build/cli-pull-cron-identifiers.d.ts +0 -3
- package/build/cli-pull-cron-identifiers.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pushCronIdentifiersFromCsv.d.ts","sourceRoot":"","sources":["../../src/cron/pushCronIdentifiersFromCsv.ts"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAAC,EAC/C,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,UAAU,EACV,WAAiB,EACjB,YAAyC,GAC1C,EAAE;IACD,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwBlB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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.pushCronIdentifiersFromCsv = void 0;
|
|
7
|
+
const bluebird_1 = require("bluebird");
|
|
8
|
+
const graphql_1 = require("../graphql");
|
|
9
|
+
const colors_1 = __importDefault(require("colors"));
|
|
10
|
+
const markCronIdentifierCompleted_1 = require("./markCronIdentifierCompleted");
|
|
11
|
+
const logger_1 = require("../logger");
|
|
12
|
+
const requests_1 = require("../requests");
|
|
13
|
+
/**
|
|
14
|
+
* Given a CSV of cron job outputs, mark all requests as completed in Transcend
|
|
15
|
+
*
|
|
16
|
+
* @param options - Options
|
|
17
|
+
* @returns Number of items marked as completed
|
|
18
|
+
*/
|
|
19
|
+
async function pushCronIdentifiersFromCsv({ file, dataSiloId, auth, sombraAuth, concurrency = 100, transcendUrl = 'https://api.transcend.io', }) {
|
|
20
|
+
// Create sombra instance to communicate with
|
|
21
|
+
const sombra = await (0, graphql_1.createSombraGotInstance)(transcendUrl, auth, sombraAuth);
|
|
22
|
+
// Read from CSV
|
|
23
|
+
logger_1.logger.info(colors_1.default.magenta(`Reading "${file}" from disk`));
|
|
24
|
+
const activeResults = (0, requests_1.readCsv)(file, markCronIdentifierCompleted_1.CronIdentifierPush);
|
|
25
|
+
// Notify Transcend
|
|
26
|
+
logger_1.logger.info(colors_1.default.magenta(`Notifying Transcend for data silo "${dataSiloId}" marking "${activeResults.length}" requests as completed.`));
|
|
27
|
+
await (0, bluebird_1.map)(activeResults, async (identifier) => {
|
|
28
|
+
await (0, markCronIdentifierCompleted_1.markCronIdentifierCompleted)(sombra, identifier);
|
|
29
|
+
}, { concurrency });
|
|
30
|
+
logger_1.logger.info(colors_1.default.green('Successfully notified Transcend!'));
|
|
31
|
+
return activeResults.length;
|
|
32
|
+
}
|
|
33
|
+
exports.pushCronIdentifiersFromCsv = pushCronIdentifiersFromCsv;
|
|
34
|
+
//# sourceMappingURL=pushCronIdentifiersFromCsv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pushCronIdentifiersFromCsv.js","sourceRoot":"","sources":["../../src/cron/pushCronIdentifiersFromCsv.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA+B;AAC/B,wCAAqD;AACrD,oDAA4B;AAC5B,+EAGuC;AACvC,sCAAmC;AACnC,0CAAsC;AAEtC;;;;;GAKG;AACI,KAAK,UAAU,0BAA0B,CAAC,EAC/C,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,UAAU,EACV,WAAW,GAAG,GAAG,EACjB,YAAY,GAAG,0BAA0B,GAc1C;IACC,6CAA6C;IAC7C,MAAM,MAAM,GAAG,MAAM,IAAA,iCAAuB,EAAC,YAAY,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;IAE7E,gBAAgB;IAChB,eAAM,CAAC,IAAI,CAAC,gBAAM,CAAC,OAAO,CAAC,YAAY,IAAI,aAAa,CAAC,CAAC,CAAC;IAC3D,MAAM,aAAa,GAAG,IAAA,kBAAO,EAAC,IAAI,EAAE,gDAAkB,CAAC,CAAC;IAExD,mBAAmB;IACnB,eAAM,CAAC,IAAI,CACT,gBAAM,CAAC,OAAO,CACZ,sCAAsC,UAAU,cAAc,aAAa,CAAC,MAAM,0BAA0B,CAC7G,CACF,CAAC;IACF,MAAM,IAAA,cAAG,EACP,aAAa,EACb,KAAK,EAAE,UAAU,EAAE,EAAE;QACnB,MAAM,IAAA,yDAA2B,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxD,CAAC,EACD,EAAE,WAAW,EAAE,CAChB,CAAC;IAEF,eAAM,CAAC,IAAI,CAAC,gBAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC,CAAC;IAC9D,OAAO,aAAa,CAAC,MAAM,CAAC;AAC9B,CAAC;AA5CD,gEA4CC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GraphQLClient } from 'graphql-request';
|
|
2
|
+
export interface RequestIdentifier {
|
|
3
|
+
/** ID of request */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Name of identifier */
|
|
6
|
+
name: string;
|
|
7
|
+
/** The underlying identifier value */
|
|
8
|
+
value: string;
|
|
9
|
+
/** Whether request identifier has been verified at least one */
|
|
10
|
+
isVerifiedAtLeastOnce: boolean;
|
|
11
|
+
/** Whether request identifier has been verified */
|
|
12
|
+
isVerified: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Fetch all request identifiers for a particular request
|
|
16
|
+
*
|
|
17
|
+
* @param client - GraphQL client
|
|
18
|
+
* @param options - Filter options
|
|
19
|
+
* @returns List of request identifiers
|
|
20
|
+
*/
|
|
21
|
+
export declare function fetchAllRequestIdentifiers(client: GraphQLClient, { requestId, }: {
|
|
22
|
+
/** ID of request to filter on */
|
|
23
|
+
requestId: string;
|
|
24
|
+
}): Promise<RequestIdentifier[]>;
|
|
25
|
+
//# sourceMappingURL=fetchAllRequestIdentifiers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchAllRequestIdentifiers.d.ts","sourceRoot":"","sources":["../../src/graphql/fetchAllRequestIdentifiers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,qBAAqB,EAAE,OAAO,CAAC;IAC/B,mDAAmD;IACnD,UAAU,EAAE,OAAO,CAAC;CACrB;AAID;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,aAAa,EACrB,EACE,SAAS,GACV,EAAE;IACD,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB,GACA,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAqB9B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchAllRequestIdentifiers = void 0;
|
|
4
|
+
const gqls_1 = require("./gqls");
|
|
5
|
+
const makeGraphQLRequest_1 = require("./makeGraphQLRequest");
|
|
6
|
+
const PAGE_SIZE = 50;
|
|
7
|
+
/**
|
|
8
|
+
* Fetch all request identifiers for a particular request
|
|
9
|
+
*
|
|
10
|
+
* @param client - GraphQL client
|
|
11
|
+
* @param options - Filter options
|
|
12
|
+
* @returns List of request identifiers
|
|
13
|
+
*/
|
|
14
|
+
async function fetchAllRequestIdentifiers(client, { requestId, }) {
|
|
15
|
+
const requestIdentifiers = [];
|
|
16
|
+
let offset = 0;
|
|
17
|
+
// Paginate
|
|
18
|
+
let shouldContinue = false;
|
|
19
|
+
do {
|
|
20
|
+
const { requestIdentifiers: { nodes },
|
|
21
|
+
// eslint-disable-next-line no-await-in-loop
|
|
22
|
+
} = await (0, makeGraphQLRequest_1.makeGraphQLRequest)(client, gqls_1.REQUEST_IDENTIFIERS, {
|
|
23
|
+
first: PAGE_SIZE,
|
|
24
|
+
offset,
|
|
25
|
+
requestId,
|
|
26
|
+
});
|
|
27
|
+
requestIdentifiers.push(...nodes);
|
|
28
|
+
offset += PAGE_SIZE;
|
|
29
|
+
shouldContinue = nodes.length === PAGE_SIZE;
|
|
30
|
+
} while (shouldContinue);
|
|
31
|
+
return requestIdentifiers;
|
|
32
|
+
}
|
|
33
|
+
exports.fetchAllRequestIdentifiers = fetchAllRequestIdentifiers;
|
|
34
|
+
//# sourceMappingURL=fetchAllRequestIdentifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchAllRequestIdentifiers.js","sourceRoot":"","sources":["../../src/graphql/fetchAllRequestIdentifiers.ts"],"names":[],"mappings":";;;AACA,iCAA6C;AAC7C,6DAA0D;AAe1D,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB;;;;;;GAMG;AACI,KAAK,UAAU,0BAA0B,CAC9C,MAAqB,EACrB,EACE,SAAS,GAIV;IAED,MAAM,kBAAkB,GAAwB,EAAE,CAAC;IACnD,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,WAAW;IACX,IAAI,cAAc,GAAG,KAAK,CAAC;IAC3B,GAAG;QACD,MAAM,EACJ,kBAAkB,EAAE,EAAE,KAAK,EAAE;QAC7B,4CAA4C;UAC7C,GAAG,MAAM,IAAA,uCAAkB,EAAC,MAAM,EAAE,0BAAmB,EAAE;YACxD,KAAK,EAAE,SAAS;YAChB,MAAM;YACN,SAAS;SACV,CAAC,CAAC;QACH,kBAAkB,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QAClC,MAAM,IAAI,SAAS,CAAC;QACpB,cAAc,GAAG,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC;KAC7C,QAAQ,cAAc,EAAE;IAEzB,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AA7BD,gEA6BC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import { RequestAction, RequestStatus, IsoCountryCode, IsoCountrySubdivisionCode } from '@transcend-io/privacy-types';
|
|
3
|
+
import { LanguageKey } from '@transcend-io/internationalization';
|
|
4
|
+
export interface PrivacyRequest {
|
|
5
|
+
/** ID of request */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Time request was made */
|
|
8
|
+
createdAt: string;
|
|
9
|
+
/** Email of request */
|
|
10
|
+
email: string;
|
|
11
|
+
/** Link for request */
|
|
12
|
+
link: string;
|
|
13
|
+
/** Whether request is in test mode */
|
|
14
|
+
isTest: boolean;
|
|
15
|
+
/** Request details */
|
|
16
|
+
details: string;
|
|
17
|
+
/** Locale of request */
|
|
18
|
+
locale: LanguageKey;
|
|
19
|
+
/** Whether request is in silent mode */
|
|
20
|
+
isSilent: boolean;
|
|
21
|
+
/** Core identifier of request */
|
|
22
|
+
coreIdentifier: string;
|
|
23
|
+
/** Type of request action */
|
|
24
|
+
type: RequestAction;
|
|
25
|
+
/** Type of data subject */
|
|
26
|
+
subjectType: string;
|
|
27
|
+
/** Country of request */
|
|
28
|
+
country?: IsoCountryCode | null;
|
|
29
|
+
/** Sub division of request */
|
|
30
|
+
countrySubDivision?: IsoCountrySubdivisionCode | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Fetch all requests matching a set of filters
|
|
34
|
+
*
|
|
35
|
+
* @param client - GraphQL client
|
|
36
|
+
* @param options - Filter options
|
|
37
|
+
* @returns List of requests
|
|
38
|
+
*/
|
|
39
|
+
export declare function fetchAllRequests(client: GraphQLClient, { actions, statuses, }: {
|
|
40
|
+
/** Actions to filter on */
|
|
41
|
+
actions: RequestAction[];
|
|
42
|
+
/** Statuses to filter on */
|
|
43
|
+
statuses: RequestStatus[];
|
|
44
|
+
}): Promise<PrivacyRequest[]>;
|
|
45
|
+
//# sourceMappingURL=fetchAllRequests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchAllRequests.d.ts","sourceRoot":"","sources":["../../src/graphql/fetchAllRequests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,EACd,yBAAyB,EAC1B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,oBAAoB;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,MAAM,EAAE,WAAW,CAAC;IACpB,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAC;IAClB,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,6BAA6B;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAChC,8BAA8B;IAC9B,kBAAkB,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAC;CACvD;AAID;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,aAAa,EACrB,EACE,OAAO,EACP,QAAQ,GACT,EAAE;IACD,2BAA2B;IAC3B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,4BAA4B;IAC5B,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B,GACA,OAAO,CAAC,cAAc,EAAE,CAAC,CA0B3B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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.fetchAllRequests = void 0;
|
|
7
|
+
const colors_1 = __importDefault(require("colors"));
|
|
8
|
+
const gqls_1 = require("./gqls");
|
|
9
|
+
const makeGraphQLRequest_1 = require("./makeGraphQLRequest");
|
|
10
|
+
const logger_1 = require("../logger");
|
|
11
|
+
const PAGE_SIZE = 50;
|
|
12
|
+
/**
|
|
13
|
+
* Fetch all requests matching a set of filters
|
|
14
|
+
*
|
|
15
|
+
* @param client - GraphQL client
|
|
16
|
+
* @param options - Filter options
|
|
17
|
+
* @returns List of requests
|
|
18
|
+
*/
|
|
19
|
+
async function fetchAllRequests(client, { actions, statuses, }) {
|
|
20
|
+
const requests = [];
|
|
21
|
+
let offset = 0;
|
|
22
|
+
// Paginate
|
|
23
|
+
let shouldContinue = false;
|
|
24
|
+
do {
|
|
25
|
+
const { requests: { nodes, totalCount },
|
|
26
|
+
// eslint-disable-next-line no-await-in-loop
|
|
27
|
+
} = await (0, makeGraphQLRequest_1.makeGraphQLRequest)(client, gqls_1.REQUESTS, {
|
|
28
|
+
first: PAGE_SIZE,
|
|
29
|
+
offset,
|
|
30
|
+
actions,
|
|
31
|
+
statuses,
|
|
32
|
+
});
|
|
33
|
+
if (offset === 0 && totalCount > PAGE_SIZE) {
|
|
34
|
+
logger_1.logger.info(colors_1.default.magenta(`Fetching ${totalCount} requests`));
|
|
35
|
+
}
|
|
36
|
+
requests.push(...nodes);
|
|
37
|
+
offset += PAGE_SIZE;
|
|
38
|
+
shouldContinue = nodes.length === PAGE_SIZE;
|
|
39
|
+
} while (shouldContinue);
|
|
40
|
+
return requests;
|
|
41
|
+
}
|
|
42
|
+
exports.fetchAllRequests = fetchAllRequests;
|
|
43
|
+
//# sourceMappingURL=fetchAllRequests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchAllRequests.js","sourceRoot":"","sources":["../../src/graphql/fetchAllRequests.ts"],"names":[],"mappings":";;;;;;AACA,oDAA4B;AAC5B,iCAAkC;AAClC,6DAA0D;AAO1D,sCAAmC;AAgCnC,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB;;;;;;GAMG;AACI,KAAK,UAAU,gBAAgB,CACpC,MAAqB,EACrB,EACE,OAAO,EACP,QAAQ,GAMT;IAED,MAAM,QAAQ,GAAqB,EAAE,CAAC;IACtC,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,WAAW;IACX,IAAI,cAAc,GAAG,KAAK,CAAC;IAC3B,GAAG;QACD,MAAM,EACJ,QAAQ,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE;QAC/B,4CAA4C;UAC7C,GAAG,MAAM,IAAA,uCAAkB,EAAC,MAAM,EAAE,eAAQ,EAAE;YAC7C,KAAK,EAAE,SAAS;YAChB,MAAM;YACN,OAAO;YACP,QAAQ;SACT,CAAC,CAAC;QACH,IAAI,MAAM,KAAK,CAAC,IAAI,UAAU,GAAG,SAAS,EAAE;YAC1C,eAAM,CAAC,IAAI,CAAC,gBAAM,CAAC,OAAO,CAAC,YAAY,UAAU,WAAW,CAAC,CAAC,CAAC;SAChE;QAED,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QACxB,MAAM,IAAI,SAAS,CAAC;QACpB,cAAc,GAAG,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC;KAC7C,QAAQ,cAAc,EAAE;IAEzB,OAAO,QAAQ,CAAC;AAClB,CAAC;AArCD,4CAqCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestIdentifier.d.ts","sourceRoot":"","sources":["../../../src/graphql/gqls/RequestIdentifier.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,QAqB/B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REQUEST_IDENTIFIERS = void 0;
|
|
4
|
+
const graphql_request_1 = require("graphql-request");
|
|
5
|
+
exports.REQUEST_IDENTIFIERS = (0, graphql_request_1.gql) `
|
|
6
|
+
query TranscendCliRequestIdentifiers(
|
|
7
|
+
$first: Int!
|
|
8
|
+
$offset: Int!
|
|
9
|
+
$requestId: ID!
|
|
10
|
+
) {
|
|
11
|
+
requestIdentifiers(
|
|
12
|
+
input: { requestId: $requestId }
|
|
13
|
+
first: $first
|
|
14
|
+
offset: $offset
|
|
15
|
+
) {
|
|
16
|
+
nodes {
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
value
|
|
20
|
+
isVerifiedAtLeastOnce
|
|
21
|
+
isVerified
|
|
22
|
+
}
|
|
23
|
+
totalCount
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
//# sourceMappingURL=RequestIdentifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestIdentifier.js","sourceRoot":"","sources":["../../../src/graphql/gqls/RequestIdentifier.ts"],"names":[],"mappings":";;;AAAA,qDAAsC;AAEzB,QAAA,mBAAmB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;CAqBrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graphql/gqls/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graphql/gqls/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC"}
|
|
@@ -20,4 +20,6 @@ __exportStar(require("./siloDiscovery"), exports);
|
|
|
20
20
|
__exportStar(require("./template"), exports);
|
|
21
21
|
__exportStar(require("./organization"), exports);
|
|
22
22
|
__exportStar(require("./attributeKey"), exports);
|
|
23
|
+
__exportStar(require("./request"), exports);
|
|
24
|
+
__exportStar(require("./RequestIdentifier"), exports);
|
|
23
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/graphql/gqls/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA4B;AAC5B,6CAA2B;AAC3B,6CAA2B;AAC3B,+CAA6B;AAC7B,gDAA8B;AAC9B,2CAAyB;AACzB,kDAAgC;AAChC,6CAA2B;AAC3B,iDAA+B;AAC/B,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/graphql/gqls/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA4B;AAC5B,6CAA2B;AAC3B,6CAA2B;AAC3B,+CAA6B;AAC7B,gDAA8B;AAC9B,2CAAyB;AACzB,kDAAgC;AAChC,6CAA2B;AAC3B,iDAA+B;AAC/B,iDAA+B;AAC/B,4CAA0B;AAC1B,sDAAoC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/graphql/gqls/request.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,QA8BpB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REQUESTS = void 0;
|
|
4
|
+
const graphql_request_1 = require("graphql-request");
|
|
5
|
+
exports.REQUESTS = (0, graphql_request_1.gql) `
|
|
6
|
+
query TranscendCliRequests(
|
|
7
|
+
$first: Int!
|
|
8
|
+
$offset: Int!
|
|
9
|
+
$actions: [RequestAction!]!
|
|
10
|
+
$statuses: [RequestStatus!]!
|
|
11
|
+
) {
|
|
12
|
+
requests(
|
|
13
|
+
filterBy: { type: $actions, status: $statuses }
|
|
14
|
+
first: $first
|
|
15
|
+
offset: $offset
|
|
16
|
+
) {
|
|
17
|
+
nodes {
|
|
18
|
+
id
|
|
19
|
+
createdAt
|
|
20
|
+
email
|
|
21
|
+
link
|
|
22
|
+
details
|
|
23
|
+
isTest
|
|
24
|
+
locale
|
|
25
|
+
isSilent
|
|
26
|
+
coreIdentifier
|
|
27
|
+
type
|
|
28
|
+
subjectType
|
|
29
|
+
country
|
|
30
|
+
countrySubDivision
|
|
31
|
+
}
|
|
32
|
+
totalCount
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B1B,CAAC"}
|
package/build/graphql/index.d.ts
CHANGED
|
@@ -13,4 +13,6 @@ export * from './createSombraGotInstance';
|
|
|
13
13
|
export * from './buildTranscendGraphQLClient';
|
|
14
14
|
export * from './gqls';
|
|
15
15
|
export * from './fetchAllAttributeKeys';
|
|
16
|
+
export * from './fetchAllRequests';
|
|
17
|
+
export * from './fetchAllRequestIdentifiers';
|
|
16
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graphql/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,QAAQ,CAAC;AACvB,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graphql/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,QAAQ,CAAC;AACvB,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC"}
|
package/build/graphql/index.js
CHANGED
|
@@ -25,4 +25,6 @@ __exportStar(require("./createSombraGotInstance"), exports);
|
|
|
25
25
|
__exportStar(require("./buildTranscendGraphQLClient"), exports);
|
|
26
26
|
__exportStar(require("./gqls"), exports);
|
|
27
27
|
__exportStar(require("./fetchAllAttributeKeys"), exports);
|
|
28
|
+
__exportStar(require("./fetchAllRequests"), exports);
|
|
29
|
+
__exportStar(require("./fetchAllRequestIdentifiers"), exports);
|
|
28
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graphql/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA6C;AAC7C,iDAA+B;AAC/B,sDAAoC;AACpC,qDAAmC;AACnC,+DAA6C;AAC7C,iEAA+C;AAC/C,kDAAgC;AAChC,kDAAgC;AAChC,+DAA6C;AAC7C,kDAAgC;AAChC,uDAAqC;AACrC,4DAA0C;AAC1C,gEAA8C;AAC9C,yCAAuB;AACvB,0DAAwC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graphql/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA6C;AAC7C,iDAA+B;AAC/B,sDAAoC;AACpC,qDAAmC;AACnC,+DAA6C;AAC7C,iEAA+C;AAC/C,kDAAgC;AAChC,kDAAgC;AAChC,+DAA6C;AAC7C,kDAAgC;AAChC,uDAAqC;AACrC,4DAA0C;AAC1C,gEAA8C;AAC9C,yCAAuB;AACvB,0DAAwC;AACxC,qDAAmC;AACnC,+DAA6C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';
|
|
2
|
+
/**
|
|
3
|
+
* Upload a set of privacy requests from CSV
|
|
4
|
+
*
|
|
5
|
+
* @param options - Options
|
|
6
|
+
*/
|
|
7
|
+
export declare function bulkRestartRequests({ requestReceiptFolder, auth, sombraAuth, requestActions, requestStatuses, transcendUrl, requestIds, createdAt, markSilent, sendEmailReceipt, copyIdentifiers, skipWaitingPeriod, concurrency, }: {
|
|
8
|
+
/** Actions to filter for */
|
|
9
|
+
requestActions: RequestAction[];
|
|
10
|
+
/** Statues to filter for */
|
|
11
|
+
requestStatuses: RequestStatus[];
|
|
12
|
+
/** File where request receipts are stored */
|
|
13
|
+
requestReceiptFolder: string;
|
|
14
|
+
/** Transcend API key authentication */
|
|
15
|
+
auth: string;
|
|
16
|
+
/** API URL for Transcend backend */
|
|
17
|
+
transcendUrl?: string;
|
|
18
|
+
/** Sombra API key authentication */
|
|
19
|
+
sombraAuth?: string;
|
|
20
|
+
/** Request IDs to filter for */
|
|
21
|
+
requestIds?: string[];
|
|
22
|
+
/** Filter for requests that were submitted before this date */
|
|
23
|
+
createdAt?: Date;
|
|
24
|
+
/** Requests that have been open for this length of time should be marked as silent mode */
|
|
25
|
+
markSilent?: Date;
|
|
26
|
+
/** Send an email receipt to the restarted requests */
|
|
27
|
+
sendEmailReceipt?: boolean;
|
|
28
|
+
/** Copy over all identifiers rather than restarting the request only with the core identifier */
|
|
29
|
+
copyIdentifiers?: boolean;
|
|
30
|
+
/** Skip the waiting period when restarting requests */
|
|
31
|
+
skipWaitingPeriod?: boolean;
|
|
32
|
+
/** Concurrency to upload requests at */
|
|
33
|
+
concurrency?: number;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
//# sourceMappingURL=bulkRestartRequests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulkRestartRequests.d.ts","sourceRoot":"","sources":["../../src/requests/bulkRestartRequests.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AA8B3E;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,oBAAoB,EACpB,IAAI,EACJ,UAAU,EACV,cAAc,EACd,eAAe,EACf,YAAyC,EACzC,UAAe,EACf,SAAsB,EACtB,UAAU,EACV,gBAAwB,EACxB,eAAuB,EACvB,iBAAyB,EACzB,WAAgB,GACjB,EAAE;IACD,4BAA4B;IAC5B,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,4BAA4B;IAC5B,eAAe,EAAE,aAAa,EAAE,CAAC;IACjC,6CAA6C;IAC7C,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,2FAA2F;IAC3F,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iGAAiG;IACjG,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uDAAuD;IACvD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0JhB"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.bulkRestartRequests = void 0;
|
|
26
|
+
const t = __importStar(require("io-ts"));
|
|
27
|
+
const difference_1 = __importDefault(require("lodash/difference"));
|
|
28
|
+
const bluebird_1 = require("bluebird");
|
|
29
|
+
const cli_progress_1 = __importDefault(require("cli-progress"));
|
|
30
|
+
const colors_1 = __importDefault(require("colors"));
|
|
31
|
+
const path_1 = require("path");
|
|
32
|
+
const persisted_state_1 = require("@transcend-io/persisted-state");
|
|
33
|
+
const logger_1 = require("../logger");
|
|
34
|
+
const restartPrivacyRequest_1 = require("./restartPrivacyRequest");
|
|
35
|
+
const graphql_1 = require("../graphql");
|
|
36
|
+
const extractClientError_1 = require("./extractClientError");
|
|
37
|
+
const constants_1 = require("./constants");
|
|
38
|
+
/** Minimal state we need to keep a list of requests */
|
|
39
|
+
const ErrorRequest = t.intersection([
|
|
40
|
+
constants_1.SuccessfulRequest,
|
|
41
|
+
t.type({
|
|
42
|
+
error: t.string,
|
|
43
|
+
}),
|
|
44
|
+
]);
|
|
45
|
+
/** Persist this data between runs of the script */
|
|
46
|
+
const CachedRequestState = t.type({
|
|
47
|
+
restartedRequests: t.array(constants_1.SuccessfulRequest),
|
|
48
|
+
failingRequests: t.array(ErrorRequest),
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Upload a set of privacy requests from CSV
|
|
52
|
+
*
|
|
53
|
+
* @param options - Options
|
|
54
|
+
*/
|
|
55
|
+
async function bulkRestartRequests({ requestReceiptFolder, auth, sombraAuth, requestActions, requestStatuses, transcendUrl = 'https://api.transcend.io', requestIds = [], createdAt = new Date(), markSilent, sendEmailReceipt = false, copyIdentifiers = false, skipWaitingPeriod = false, concurrency = 20, }) {
|
|
56
|
+
// Time duration
|
|
57
|
+
const t0 = new Date().getTime();
|
|
58
|
+
// create a new progress bar instance and use shades_classic theme
|
|
59
|
+
const progressBar = new cli_progress_1.default.SingleBar({}, cli_progress_1.default.Presets.shades_classic);
|
|
60
|
+
// Create a new state file to store the requests from this run
|
|
61
|
+
const cacheFile = (0, path_1.join)(requestReceiptFolder, `tr-request-restart-${new Date().toISOString()}`);
|
|
62
|
+
const state = new persisted_state_1.PersistedState(cacheFile, CachedRequestState, {
|
|
63
|
+
restartedRequests: [],
|
|
64
|
+
failingRequests: [],
|
|
65
|
+
});
|
|
66
|
+
// Create sombra instance to communicate with
|
|
67
|
+
const sombra = await (0, graphql_1.createSombraGotInstance)(transcendUrl, auth, sombraAuth);
|
|
68
|
+
// Find all requests made before createdAt that are in a removing data state
|
|
69
|
+
const client = (0, graphql_1.buildTranscendGraphQLClient)(transcendUrl, auth);
|
|
70
|
+
logger_1.logger.info(colors_1.default.magenta('Fetching requests to restart...'));
|
|
71
|
+
const allRequests = await (0, graphql_1.fetchAllRequests)(client, {
|
|
72
|
+
actions: requestActions,
|
|
73
|
+
statuses: requestStatuses,
|
|
74
|
+
});
|
|
75
|
+
const requests = allRequests.filter((request) => new Date(request.createdAt) < createdAt &&
|
|
76
|
+
(requestIds.length === 0 || requestIds.includes(request.id)));
|
|
77
|
+
logger_1.logger.info(`Found ${requests.length} requests to process`);
|
|
78
|
+
if (copyIdentifiers) {
|
|
79
|
+
logger_1.logger.info('copyIdentifiers detected - All Identifiers will be copied.');
|
|
80
|
+
}
|
|
81
|
+
if (sendEmailReceipt) {
|
|
82
|
+
logger_1.logger.info('sendEmailReceipt detected - Email receipts will be sent.');
|
|
83
|
+
}
|
|
84
|
+
if (skipWaitingPeriod) {
|
|
85
|
+
logger_1.logger.info('skipWaitingPeriod detected - Waiting period will be skipped.');
|
|
86
|
+
}
|
|
87
|
+
// Validate request IDs
|
|
88
|
+
if (requestIds.length > 0 && requestIds.length !== requests.length) {
|
|
89
|
+
const missingRequests = (0, difference_1.default)(requestIds, requests.map(({ id }) => id));
|
|
90
|
+
if (missingRequests.length > 0) {
|
|
91
|
+
logger_1.logger.error(colors_1.default.red(`Failed to find the following requests by ID: ${missingRequests.join(',')}.`));
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Map over the requests
|
|
96
|
+
let total = 0;
|
|
97
|
+
progressBar.start(requests.length, 0);
|
|
98
|
+
await (0, bluebird_1.map)(requests, async (request, ind) => {
|
|
99
|
+
var _a;
|
|
100
|
+
try {
|
|
101
|
+
// Pull the request identifiers
|
|
102
|
+
const requestIdentifiers = copyIdentifiers
|
|
103
|
+
? await (0, graphql_1.fetchAllRequestIdentifiers)(client, {
|
|
104
|
+
requestId: request.id,
|
|
105
|
+
})
|
|
106
|
+
: [];
|
|
107
|
+
// Make the GraphQL request to restart the request
|
|
108
|
+
const requestResponse = await (0, restartPrivacyRequest_1.restartPrivacyRequest)(sombra, {
|
|
109
|
+
...request,
|
|
110
|
+
// override silent mode
|
|
111
|
+
isSilent: !!markSilent && new Date(request.createdAt) < markSilent
|
|
112
|
+
? true
|
|
113
|
+
: request.isSilent,
|
|
114
|
+
}, {
|
|
115
|
+
requestIdentifiers,
|
|
116
|
+
skipWaitingPeriod,
|
|
117
|
+
sendEmailReceipt,
|
|
118
|
+
});
|
|
119
|
+
// Cache successful upload
|
|
120
|
+
const restartedRequests = state.getValue('restartedRequests');
|
|
121
|
+
restartedRequests.push({
|
|
122
|
+
id: requestResponse.id,
|
|
123
|
+
link: requestResponse.link,
|
|
124
|
+
rowIndex: ind,
|
|
125
|
+
coreIdentifier: requestResponse.coreIdentifier,
|
|
126
|
+
attemptedAt: new Date().toISOString(),
|
|
127
|
+
});
|
|
128
|
+
state.setValue(restartedRequests, 'restartedRequests');
|
|
129
|
+
}
|
|
130
|
+
catch (err) {
|
|
131
|
+
const msg = `${err.message} - ${JSON.stringify((_a = err.response) === null || _a === void 0 ? void 0 : _a.body, null, 2)}`;
|
|
132
|
+
const clientError = (0, extractClientError_1.extractClientError)(msg);
|
|
133
|
+
const failingRequests = state.getValue('failingRequests');
|
|
134
|
+
failingRequests.push({
|
|
135
|
+
id: request.id,
|
|
136
|
+
link: request.link,
|
|
137
|
+
rowIndex: ind,
|
|
138
|
+
coreIdentifier: request.coreIdentifier,
|
|
139
|
+
attemptedAt: new Date().toISOString(),
|
|
140
|
+
error: clientError || msg,
|
|
141
|
+
});
|
|
142
|
+
state.setValue(failingRequests, 'failingRequests');
|
|
143
|
+
}
|
|
144
|
+
total += 1;
|
|
145
|
+
progressBar.update(total);
|
|
146
|
+
}, { concurrency });
|
|
147
|
+
progressBar.stop();
|
|
148
|
+
const t1 = new Date().getTime();
|
|
149
|
+
const totalTime = t1 - t0;
|
|
150
|
+
// Log completion time
|
|
151
|
+
logger_1.logger.info(colors_1.default.green(`Completed restarting of requests in "${totalTime / 1000}" seconds.`));
|
|
152
|
+
// Log errors
|
|
153
|
+
if (state.getValue('failingRequests').length > 0) {
|
|
154
|
+
logger_1.logger.error(colors_1.default.red(`Encountered "${state.getValue('failingRequests').length}" errors. ` +
|
|
155
|
+
`See "${cacheFile}" to review the error messages and inputs.`));
|
|
156
|
+
process.exit(1);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.bulkRestartRequests = bulkRestartRequests;
|
|
160
|
+
//# sourceMappingURL=bulkRestartRequests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulkRestartRequests.js","sourceRoot":"","sources":["../../src/requests/bulkRestartRequests.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,mEAA2C;AAC3C,uCAA+B;AAC/B,gEAAuC;AACvC,oDAA4B;AAC5B,+BAA4B;AAE5B,mEAA+D;AAC/D,sCAAmC;AACnC,mEAAgE;AAChE,wCAKoB;AACpB,6DAA0D;AAC1D,2CAAgD;AAEhD,uDAAuD;AACvD,MAAM,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC;IAClC,6BAAiB;IACjB,CAAC,CAAC,IAAI,CAAC;QACL,KAAK,EAAE,CAAC,CAAC,MAAM;KAChB,CAAC;CACH,CAAC,CAAC;AAKH,mDAAmD;AACnD,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC;IAChC,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,6BAAiB,CAAC;IAC7C,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC;CACvC,CAAC,CAAC;AAEH;;;;GAIG;AACI,KAAK,UAAU,mBAAmB,CAAC,EACxC,oBAAoB,EACpB,IAAI,EACJ,UAAU,EACV,cAAc,EACd,eAAe,EACf,YAAY,GAAG,0BAA0B,EACzC,UAAU,GAAG,EAAE,EACf,SAAS,GAAG,IAAI,IAAI,EAAE,EACtB,UAAU,EACV,gBAAgB,GAAG,KAAK,EACxB,eAAe,GAAG,KAAK,EACvB,iBAAiB,GAAG,KAAK,EACzB,WAAW,GAAG,EAAE,GA4BjB;IACC,gBAAgB;IAChB,MAAM,EAAE,GAAG,IAAI,IAAI,EA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,CAAC;SACpD;QACD,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,sBAAsB;IACtB,eAAM,CAAC,IAAI,CACT,gBAAM,CAAC,KAAK,CACV,wCAAwC,SAAS,GAAG,IAAI,YAAY,CACrE,CACF,CAAC;IAEF,aAAa;IACb,IAAI,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QAChD,eAAM,CAAC,KAAK,CACV,gBAAM,CAAC,GAAG,CACR,gBAAgB,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,MAAM,YAAY;YAClE,QAAQ,SAAS,4CAA4C,CAChE,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC;AAnMD,kDAmMC"}
|
|
@@ -2,6 +2,8 @@ import * as t from 'io-ts';
|
|
|
2
2
|
export declare const NONE: "[NONE]";
|
|
3
3
|
export declare const BULK_APPLY: "[APPLY VALUE TO ALL ROWS]";
|
|
4
4
|
export declare const BLANK: "<blank>";
|
|
5
|
+
/** These are uploaded at the top level of the request */
|
|
6
|
+
export declare const IDENTIFIER_BLOCK_LIST: string[];
|
|
5
7
|
/**
|
|
6
8
|
* Column names to map
|
|
7
9
|
*/
|
|
@@ -145,7 +147,6 @@ export declare const CachedFileState: t.TypeC<{
|
|
|
145
147
|
regionToCountry: t.RecordC<t.StringC, t.KeyofC<{
|
|
146
148
|
HR: unknown;
|
|
147
149
|
ID: unknown;
|
|
148
|
-
"[NONE]": unknown;
|
|
149
150
|
AF: unknown;
|
|
150
151
|
AX: unknown;
|
|
151
152
|
AL: unknown;
|
|
@@ -395,10 +396,10 @@ export declare const CachedFileState: t.TypeC<{
|
|
|
395
396
|
ZM: unknown;
|
|
396
397
|
ZW: unknown;
|
|
397
398
|
EU: unknown;
|
|
399
|
+
"[NONE]": unknown;
|
|
398
400
|
}>>;
|
|
399
401
|
/** Mapping between region and country sub division code */
|
|
400
402
|
regionToCountrySubDivision: t.RecordC<t.StringC, t.KeyofC<{
|
|
401
|
-
"[NONE]": unknown;
|
|
402
403
|
"AD-02": unknown;
|
|
403
404
|
"AD-03": unknown;
|
|
404
405
|
"AD-04": unknown;
|
|
@@ -5532,19 +5533,32 @@ export declare const CachedFileState: t.TypeC<{
|
|
|
5532
5533
|
"ZW-MS": unknown;
|
|
5533
5534
|
"ZW-MV": unknown;
|
|
5534
5535
|
"ZW-MW": unknown;
|
|
5536
|
+
"[NONE]": unknown;
|
|
5535
5537
|
}>>;
|
|
5536
5538
|
/** Mapping between request status in import to Transcend request status */
|
|
5537
5539
|
statusToRequestStatus: t.RecordC<t.StringC, t.KeyofC<{
|
|
5538
|
-
"[NONE]": unknown;
|
|
5539
5540
|
FAILED_VERIFICATION: unknown;
|
|
5540
5541
|
COMPLETED: unknown;
|
|
5541
5542
|
CANCELED: unknown;
|
|
5542
5543
|
SECONDARY_COMPLETED: unknown;
|
|
5543
5544
|
REVOKED: unknown;
|
|
5545
|
+
"[NONE]": unknown;
|
|
5544
5546
|
}>>;
|
|
5545
5547
|
}>;
|
|
5546
5548
|
/** Type override */
|
|
5547
5549
|
export declare type CachedFileState = t.TypeOf<typeof CachedFileState>;
|
|
5550
|
+
/**
|
|
5551
|
+
* Successfully processed request
|
|
5552
|
+
*/
|
|
5553
|
+
export declare const SuccessfulRequest: t.TypeC<{
|
|
5554
|
+
id: t.StringC;
|
|
5555
|
+
link: t.StringC;
|
|
5556
|
+
rowIndex: t.NumberC;
|
|
5557
|
+
coreIdentifier: t.StringC;
|
|
5558
|
+
attemptedAt: t.StringC;
|
|
5559
|
+
}>;
|
|
5560
|
+
/** Type override */
|
|
5561
|
+
export declare type SuccessfulRequest = t.TypeOf<typeof SuccessfulRequest>;
|
|
5548
5562
|
export declare const CachedRequestState: t.TypeC<{
|
|
5549
5563
|
/** Set of privacy requests that failed to upload */
|
|
5550
5564
|
failingRequests: t.ArrayC<t.RecordC<t.StringC, t.AnyC>>;
|