@transcend-io/cli 6.22.1 → 6.24.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 +54 -17
- package/build/cli-skip-preflight-jobs.d.ts +3 -0
- package/build/cli-skip-preflight-jobs.d.ts.map +1 -0
- package/build/cli-skip-preflight-jobs.js +53 -0
- package/build/cli-skip-preflight-jobs.js.map +1 -0
- package/build/codecs.d.ts +8 -0
- package/build/codecs.d.ts.map +1 -1
- package/build/codecs.js +4 -0
- package/build/codecs.js.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/dataSilo.d.ts.map +1 -1
- package/build/graphql/gqls/dataSilo.js +6 -0
- package/build/graphql/gqls/dataSilo.js.map +1 -1
- package/build/graphql/pullTranscendConfiguration.d.ts.map +1 -1
- package/build/graphql/pullTranscendConfiguration.js +9 -1
- package/build/graphql/pullTranscendConfiguration.js.map +1 -1
- package/build/graphql/syncDataSilos.d.ts +14 -0
- package/build/graphql/syncDataSilos.d.ts.map +1 -1
- package/build/graphql/syncDataSilos.js +1 -0
- package/build/graphql/syncDataSilos.js.map +1 -1
- 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/requests/skipPreflightJobs.d.ts +20 -0
- package/build/requests/skipPreflightJobs.d.ts.map +1 -0
- package/build/requests/skipPreflightJobs.js +73 -0
- package/build/requests/skipPreflightJobs.js.map +1 -0
- package/build/tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RequestStatus } from '@transcend-io/privacy-types';
|
|
2
|
+
/**
|
|
3
|
+
* Given an enricher ID, mark all open request enrichers as skipped
|
|
4
|
+
*
|
|
5
|
+
* @param options - Options
|
|
6
|
+
* @returns Number of items skipped
|
|
7
|
+
*/
|
|
8
|
+
export declare function skipPreflightJobs({ enricherIds, auth, concurrency, transcendUrl, }: {
|
|
9
|
+
/** Transcend API key authentication */
|
|
10
|
+
auth: string;
|
|
11
|
+
/** Enricher IDs to pull down jobs for */
|
|
12
|
+
enricherIds: string[];
|
|
13
|
+
/** Upload concurrency */
|
|
14
|
+
concurrency?: number;
|
|
15
|
+
/** API URL for Transcend backend */
|
|
16
|
+
transcendUrl?: string;
|
|
17
|
+
/** Request statuses to mark as completed */
|
|
18
|
+
requestStatuses?: RequestStatus[];
|
|
19
|
+
}): Promise<number>;
|
|
20
|
+
//# sourceMappingURL=skipPreflightJobs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skipPreflightJobs.d.ts","sourceRoot":"","sources":["../../src/requests/skipPreflightJobs.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,aAAa,EACd,MAAM,6BAA6B,CAAC;AAGrC;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,WAAW,EACX,IAAI,EACJ,WAAiB,EACjB,YAAoC,GACrC,EAAE;IACD,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,eAAe,CAAC,EAAE,aAAa,EAAE,CAAC;CACnC,GAAG,OAAO,CAAC,MAAM,CAAC,CAuFlB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
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.skipPreflightJobs = void 0;
|
|
7
|
+
const bluebird_1 = require("bluebird");
|
|
8
|
+
const colors_1 = __importDefault(require("colors"));
|
|
9
|
+
const logger_1 = require("../logger");
|
|
10
|
+
const graphql_1 = require("../graphql");
|
|
11
|
+
const cli_progress_1 = __importDefault(require("cli-progress"));
|
|
12
|
+
const privacy_types_1 = require("@transcend-io/privacy-types");
|
|
13
|
+
const constants_1 = require("../constants");
|
|
14
|
+
/**
|
|
15
|
+
* Given an enricher ID, mark all open request enrichers as skipped
|
|
16
|
+
*
|
|
17
|
+
* @param options - Options
|
|
18
|
+
* @returns Number of items skipped
|
|
19
|
+
*/
|
|
20
|
+
async function skipPreflightJobs({ enricherIds, auth, concurrency = 100, transcendUrl = constants_1.DEFAULT_TRANSCEND_API, }) {
|
|
21
|
+
// Find all requests made before createdAt that are in a removing data state
|
|
22
|
+
const client = (0, graphql_1.buildTranscendGraphQLClient)(transcendUrl, auth);
|
|
23
|
+
// Time duration
|
|
24
|
+
const t0 = new Date().getTime();
|
|
25
|
+
// fetch all RequestDataSilos that are open
|
|
26
|
+
const requests = await (0, graphql_1.fetchAllRequests)(client, {
|
|
27
|
+
statuses: [privacy_types_1.RequestStatus.Enriching],
|
|
28
|
+
});
|
|
29
|
+
// Notify Transcend
|
|
30
|
+
logger_1.logger.info(colors_1.default.magenta(`Processing enricher: "${enricherIds.join(',')}" fetched "${requests.length}" in enriching status.`));
|
|
31
|
+
// create a new progress bar instance and use shades_classic theme
|
|
32
|
+
const progressBar = new cli_progress_1.default.SingleBar({}, cli_progress_1.default.Presets.shades_classic);
|
|
33
|
+
let total = 0;
|
|
34
|
+
progressBar.start(requests.length, 0);
|
|
35
|
+
let totalSkipped = 0;
|
|
36
|
+
await (0, bluebird_1.map)(requests, async (request) => {
|
|
37
|
+
// FIXME dont pull all in
|
|
38
|
+
const requestEnrichers = await (0, graphql_1.fetchAllRequestEnrichers)(client, {
|
|
39
|
+
requestId: request.id,
|
|
40
|
+
});
|
|
41
|
+
const requestEnrichersFiltered = requestEnrichers.filter((enricher) => enricherIds.includes(enricher.enricher.id) &&
|
|
42
|
+
![
|
|
43
|
+
privacy_types_1.RequestEnricherStatus.Resolved,
|
|
44
|
+
privacy_types_1.RequestEnricherStatus.Skipped,
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
+
].includes(enricher.status));
|
|
47
|
+
// FIXME
|
|
48
|
+
if (requestEnrichersFiltered.length > 0) {
|
|
49
|
+
await (0, bluebird_1.mapSeries)(requestEnrichersFiltered, async (requestEnricher) => {
|
|
50
|
+
try {
|
|
51
|
+
await (0, graphql_1.makeGraphQLRequest)(client, graphql_1.SKIP_REQUEST_ENRICHER, {
|
|
52
|
+
requestEnricherId: requestEnricher.id,
|
|
53
|
+
});
|
|
54
|
+
totalSkipped += 1;
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
if (!err.message.includes('Client error: Cannot skip Request enricher because it has already completed')) {
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
total += 1;
|
|
64
|
+
progressBar.update(total);
|
|
65
|
+
}, { concurrency });
|
|
66
|
+
progressBar.stop();
|
|
67
|
+
const t1 = new Date().getTime();
|
|
68
|
+
const totalTime = t1 - t0;
|
|
69
|
+
logger_1.logger.info(colors_1.default.green(`Successfully skipped "${totalSkipped}" for "${requests.length}" requests in "${totalTime / 1000}" seconds!`));
|
|
70
|
+
return requests.length;
|
|
71
|
+
}
|
|
72
|
+
exports.skipPreflightJobs = skipPreflightJobs;
|
|
73
|
+
//# sourceMappingURL=skipPreflightJobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skipPreflightJobs.js","sourceRoot":"","sources":["../../src/requests/skipPreflightJobs.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0C;AAC1C,oDAA4B;AAC5B,sCAAmC;AACnC,wCAMo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