@transcend-io/cli 5.2.1 → 5.3.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 +89 -21
- package/build/cli-request-enricher-restart.d.ts +3 -0
- package/build/cli-request-enricher-restart.d.ts.map +1 -0
- package/build/cli-request-enricher-restart.js +94 -0
- package/build/cli-request-enricher-restart.js.map +1 -0
- package/build/graphql/fetchAllRequestEnrichers.d.ts +2 -1
- package/build/graphql/fetchAllRequestEnrichers.d.ts.map +1 -1
- package/build/graphql/fetchAllRequestEnrichers.js.map +1 -1
- package/build/graphql/fetchAllRequestIdentifiers.d.ts +2 -0
- package/build/graphql/fetchAllRequestIdentifiers.d.ts.map +1 -1
- package/build/graphql/gqls/RequestEnricher.d.ts +1 -0
- package/build/graphql/gqls/RequestEnricher.d.ts.map +1 -1
- package/build/graphql/gqls/RequestEnricher.js +10 -1
- package/build/graphql/gqls/RequestEnricher.js.map +1 -1
- package/build/graphql/gqls/index.d.ts +1 -0
- package/build/graphql/gqls/index.d.ts.map +1 -1
- package/build/graphql/gqls/index.js +1 -0
- package/build/graphql/gqls/index.js.map +1 -1
- package/build/graphql/index.d.ts +1 -0
- package/build/graphql/index.d.ts.map +1 -1
- package/build/graphql/index.js +1 -0
- package/build/graphql/index.js.map +1 -1
- package/build/graphql/retryRequestEnricher.d.ts +9 -0
- package/build/graphql/retryRequestEnricher.d.ts.map +1 -0
- package/build/graphql/retryRequestEnricher.js +18 -0
- package/build/graphql/retryRequestEnricher.js.map +1 -0
- package/build/graphql/syncConsentManager.d.ts.map +1 -1
- package/build/graphql/syncConsentManager.js +2 -0
- package/build/graphql/syncConsentManager.js.map +1 -1
- package/build/graphql/syncDataFlows.d.ts.map +1 -1
- package/build/graphql/syncDataFlows.js +1 -0
- package/build/graphql/syncDataFlows.js.map +1 -1
- package/build/requests/bulkRetryEnrichers.d.ts +27 -0
- package/build/requests/bulkRetryEnrichers.d.ts.map +1 -0
- package/build/requests/bulkRetryEnrichers.js +70 -0
- package/build/requests/bulkRetryEnrichers.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 +3 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RequestAction, RequestEnricherStatus } from '@transcend-io/privacy-types';
|
|
2
|
+
/**
|
|
3
|
+
* Restart a bunch of request enrichers
|
|
4
|
+
*
|
|
5
|
+
* @param options - Options
|
|
6
|
+
*/
|
|
7
|
+
export declare function bulkRetryEnrichers({ auth, requestActions, createdAtBefore, createdAtAfter, transcendUrl, requestEnricherStatuses, requestIds, enricherId, concurrency, }: {
|
|
8
|
+
/** Actions to filter for */
|
|
9
|
+
requestActions?: RequestAction[];
|
|
10
|
+
/** Request enricher statuses to restart - defaults to all statuses */
|
|
11
|
+
requestEnricherStatuses?: RequestEnricherStatus[];
|
|
12
|
+
/** Transcend API key authentication */
|
|
13
|
+
auth: string;
|
|
14
|
+
/** The ID of the enricher to restart */
|
|
15
|
+
enricherId: string;
|
|
16
|
+
/** API URL for Transcend backend */
|
|
17
|
+
transcendUrl?: string;
|
|
18
|
+
/** Request IDs to filter for */
|
|
19
|
+
requestIds?: string[];
|
|
20
|
+
/** Filter for requests created before this date */
|
|
21
|
+
createdAtBefore?: Date;
|
|
22
|
+
/** Filter for requests created after this date */
|
|
23
|
+
createdAtAfter?: Date;
|
|
24
|
+
/** Concurrency to upload requests at */
|
|
25
|
+
concurrency?: number;
|
|
26
|
+
}): Promise<void>;
|
|
27
|
+
//# sourceMappingURL=bulkRetryEnrichers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulkRetryEnrichers.d.ts","sourceRoot":"","sources":["../../src/requests/bulkRetryEnrichers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,qBAAqB,EAEtB,MAAM,6BAA6B,CAAC;AAcrC;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,IAAI,EACJ,cAAmB,EACnB,eAAe,EACf,cAAc,EACd,YAAoC,EACpC,uBAA8D,EAC9D,UAAe,EACf,UAAU,EACV,WAAgB,GACjB,EAAE;IACD,4BAA4B;IAC5B,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;IACjC,sEAAsE;IACtE,uBAAuB,CAAC,EAAE,qBAAqB,EAAE,CAAC;IAClD,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,mDAAmD;IACnD,eAAe,CAAC,EAAE,IAAI,CAAC;IACvB,kDAAkD;IAClD,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqFhB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
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.bulkRetryEnrichers = void 0;
|
|
7
|
+
const privacy_types_1 = require("@transcend-io/privacy-types");
|
|
8
|
+
const bluebird_1 = require("bluebird");
|
|
9
|
+
const cli_progress_1 = __importDefault(require("cli-progress"));
|
|
10
|
+
const colors_1 = __importDefault(require("colors"));
|
|
11
|
+
const difference_1 = __importDefault(require("lodash/difference"));
|
|
12
|
+
const constants_1 = require("../constants");
|
|
13
|
+
const graphql_1 = require("../graphql");
|
|
14
|
+
const logger_1 = require("../logger");
|
|
15
|
+
/**
|
|
16
|
+
* Restart a bunch of request enrichers
|
|
17
|
+
*
|
|
18
|
+
* @param options - Options
|
|
19
|
+
*/
|
|
20
|
+
async function bulkRetryEnrichers({ auth, requestActions = [], createdAtBefore, createdAtAfter, transcendUrl = constants_1.DEFAULT_TRANSCEND_API, requestEnricherStatuses = Object.values(privacy_types_1.RequestEnricherStatus), requestIds = [], enricherId, concurrency = 20, }) {
|
|
21
|
+
// Time duration
|
|
22
|
+
const t0 = new Date().getTime();
|
|
23
|
+
// create a new progress bar instance and use shades_classic theme
|
|
24
|
+
const progressBar = new cli_progress_1.default.SingleBar({}, cli_progress_1.default.Presets.shades_classic);
|
|
25
|
+
// Find all requests made before createdAt that are in a removing data state
|
|
26
|
+
const client = (0, graphql_1.buildTranscendGraphQLClient)(transcendUrl, auth);
|
|
27
|
+
logger_1.logger.info(colors_1.default.magenta('Fetching requests to restart...'));
|
|
28
|
+
const allRequests = await (0, graphql_1.fetchAllRequests)(client, {
|
|
29
|
+
actions: requestActions,
|
|
30
|
+
statuses: [privacy_types_1.RequestStatus.Enriching],
|
|
31
|
+
createdAtBefore,
|
|
32
|
+
createdAtAfter,
|
|
33
|
+
});
|
|
34
|
+
const requests = allRequests.filter((request) => requestIds.length === 0 || requestIds.includes(request.id));
|
|
35
|
+
logger_1.logger.info(`Found ${requests.length} requests to process`);
|
|
36
|
+
let totalRestarted = 0;
|
|
37
|
+
// Validate request IDs
|
|
38
|
+
if (requestIds.length > 0 && requestIds.length !== requests.length) {
|
|
39
|
+
const missingRequests = (0, difference_1.default)(requestIds, requests.map(({ id }) => id));
|
|
40
|
+
if (missingRequests.length > 0) {
|
|
41
|
+
logger_1.logger.error(colors_1.default.red(`Failed to find the following requests by ID: ${missingRequests.join(',')}.`));
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Map over the requests
|
|
46
|
+
let total = 0;
|
|
47
|
+
progressBar.start(requests.length, 0);
|
|
48
|
+
await (0, bluebird_1.map)(requests, async (request) => {
|
|
49
|
+
// Pull the request identifiers
|
|
50
|
+
const requestEnrichers = await (0, graphql_1.fetchAllRequestEnrichers)(client, {
|
|
51
|
+
requestId: request.id,
|
|
52
|
+
});
|
|
53
|
+
const requestEnrichersToRestart = requestEnrichers.filter((requestEnricher) => requestEnricher.enricher.id === enricherId &&
|
|
54
|
+
requestEnricherStatuses.includes(requestEnricher.status));
|
|
55
|
+
await (0, bluebird_1.map)(requestEnrichersToRestart, async (requestEnricher) => {
|
|
56
|
+
await (0, graphql_1.retryRequestEnricher)(client, requestEnricher.id);
|
|
57
|
+
totalRestarted += 1;
|
|
58
|
+
});
|
|
59
|
+
// Cache successful upload
|
|
60
|
+
total += 1;
|
|
61
|
+
progressBar.update(total);
|
|
62
|
+
}, { concurrency });
|
|
63
|
+
progressBar.stop();
|
|
64
|
+
const t1 = new Date().getTime();
|
|
65
|
+
const totalTime = t1 - t0;
|
|
66
|
+
// Log completion time
|
|
67
|
+
logger_1.logger.info(colors_1.default.green(`Completed restarting of ${requests.length} requests and ${totalRestarted} enrichers in "${totalTime / 1000}" seconds.`));
|
|
68
|
+
}
|
|
69
|
+
exports.bulkRetryEnrichers = bulkRetryEnrichers;
|
|
70
|
+
//# sourceMappingURL=bulkRetryEnrichers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulkRetryEnrichers.js","sourceRoot":"","sources":["../../src/requests/bulkRetryEnrichers.ts"],"names":[],"mappings":";;;;;;AAAA,+DAIqC;AACrC,uCAA+B;AAC/B,gEAAuC;AACvC,oDAA4B;AAC5B,mEAA2C;AAC3C,4CAAqD;AACrD,wCAKoB;AACpB,sCAAmC;AAEnC;;;;GAIG;AACI,KAAK,UAAU,kBAAkB,CAAC,EACvC,IAAI,EACJ,cAAc,GAAG,EAAE,EACnB,eAAe,EACf,cAAc,EACd,YAAY,GAAG,iCAAqB,EACpC,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC,qCAAqB,CAAC,EAC9D,UAAU,GAAG,EAAE,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,QAAQ,CAAC,MACX,iBAAiB,cAAc,kBAC7B,SAAS,GAAG,IACd,YAAY,CACb,CACF,CAAC;AACJ,CAAC;AAlHD,gDAkHC"}
|
|
@@ -20,6 +20,7 @@ export * from './extractClientError';
|
|
|
20
20
|
export * from './uploadPrivacyRequestsFromCsv';
|
|
21
21
|
export * from './bulkRestartRequests';
|
|
22
22
|
export * from './restartPrivacyRequest';
|
|
23
|
+
export * from './bulkRetryEnrichers';
|
|
23
24
|
export * from './retryRequestDataSilos';
|
|
24
25
|
export * from './pullPrivacyRequests';
|
|
25
26
|
export * from './skipRequestDataSilos';
|
|
@@ -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,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uCAAuC,CAAC;AACtD,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,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,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,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uCAAuC,CAAC;AACtD,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,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
package/build/requests/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __exportStar(require("./extractClientError"), exports);
|
|
|
36
36
|
__exportStar(require("./uploadPrivacyRequestsFromCsv"), exports);
|
|
37
37
|
__exportStar(require("./bulkRestartRequests"), exports);
|
|
38
38
|
__exportStar(require("./restartPrivacyRequest"), exports);
|
|
39
|
+
__exportStar(require("./bulkRetryEnrichers"), exports);
|
|
39
40
|
__exportStar(require("./retryRequestDataSilos"), exports);
|
|
40
41
|
__exportStar(require("./pullPrivacyRequests"), exports);
|
|
41
42
|
__exportStar(require("./skipRequestDataSilos"), 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,8DAA4C;AAC5C,uDAAqC;AACrC,yDAAuC;AACvC,8DAA4C;AAC5C,yDAAuC;AACvC,2DAAyC;AACzC,wEAAsD;AACtD,4DAA0C;AAC1C,0DAAwC;AACxC,2DAAyC;AACzC,uDAAqC;AACrC,iEAA+C;AAC/C,wDAAsC;AACtC,0DAAwC;AACxC,0DAAwC;AACxC,wDAAsC;AACtC,yDAAuC"}
|
|
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,8DAA4C;AAC5C,uDAAqC;AACrC,yDAAuC;AACvC,8DAA4C;AAC5C,yDAAuC;AACvC,2DAAyC;AACzC,wEAAsD;AACtD,4DAA0C;AAC1C,0DAAwC;AACxC,2DAAyC;AACzC,uDAAqC;AACrC,iEAA+C;AAC/C,wDAAsC;AACtC,0DAAwC;AACxC,uDAAqC;AACrC,0DAAwC;AACxC,wDAAsC;AACtC,yDAAuC"}
|