@transcend-io/cli 6.23.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 CHANGED
@@ -90,71 +90,75 @@
90
90
  - [Authentication](#authentication-19)
91
91
  - [Arguments](#arguments-19)
92
92
  - [Usage](#usage-20)
93
- - [tr-retry-request-data-silos](#tr-retry-request-data-silos)
93
+ - [tr-skip-preflight-jobs](#tr-skip-preflight-jobs)
94
94
  - [Authentication](#authentication-20)
95
95
  - [Arguments](#arguments-20)
96
96
  - [Usage](#usage-21)
97
- - [tr-update-consent-manager](#tr-update-consent-manager)
97
+ - [tr-retry-request-data-silos](#tr-retry-request-data-silos)
98
98
  - [Authentication](#authentication-21)
99
99
  - [Arguments](#arguments-21)
100
100
  - [Usage](#usage-22)
101
- - [tr-consent-managers-to-business-entities](#tr-consent-managers-to-business-entities)
101
+ - [tr-update-consent-manager](#tr-update-consent-manager)
102
102
  - [Authentication](#authentication-22)
103
103
  - [Arguments](#arguments-22)
104
104
  - [Usage](#usage-23)
105
- - [tr-consent-manager-service-json-to-yml](#tr-consent-manager-service-json-to-yml)
105
+ - [tr-consent-managers-to-business-entities](#tr-consent-managers-to-business-entities)
106
106
  - [Authentication](#authentication-23)
107
107
  - [Arguments](#arguments-23)
108
108
  - [Usage](#usage-24)
109
- - [tr-derive-data-silos-from-data-flows](#tr-derive-data-silos-from-data-flows)
109
+ - [tr-consent-manager-service-json-to-yml](#tr-consent-manager-service-json-to-yml)
110
110
  - [Authentication](#authentication-24)
111
111
  - [Arguments](#arguments-24)
112
112
  - [Usage](#usage-25)
113
- - [tr-derive-data-silos-from-data-flows-cross-instance](#tr-derive-data-silos-from-data-flows-cross-instance)
113
+ - [tr-derive-data-silos-from-data-flows](#tr-derive-data-silos-from-data-flows)
114
114
  - [Authentication](#authentication-25)
115
115
  - [Arguments](#arguments-25)
116
116
  - [Usage](#usage-26)
117
- - [tr-pull-consent-metrics](#tr-pull-consent-metrics)
117
+ - [tr-derive-data-silos-from-data-flows-cross-instance](#tr-derive-data-silos-from-data-flows-cross-instance)
118
118
  - [Authentication](#authentication-26)
119
119
  - [Arguments](#arguments-26)
120
120
  - [Usage](#usage-27)
121
- - [tr-pull-datapoints](#tr-pull-datapoints)
121
+ - [tr-pull-consent-metrics](#tr-pull-consent-metrics)
122
122
  - [Authentication](#authentication-27)
123
123
  - [Arguments](#arguments-27)
124
124
  - [Usage](#usage-28)
125
- - [tr-pull-pull-unstructured-discovery-files](#tr-pull-pull-unstructured-discovery-files)
125
+ - [tr-pull-datapoints](#tr-pull-datapoints)
126
126
  - [Authentication](#authentication-28)
127
127
  - [Arguments](#arguments-28)
128
128
  - [Usage](#usage-29)
129
- - [tr-upload-preferences](#tr-upload-preferences)
129
+ - [tr-pull-pull-unstructured-discovery-files](#tr-pull-pull-unstructured-discovery-files)
130
130
  - [Authentication](#authentication-29)
131
- - [Authentication](#authentication-30)
132
131
  - [Arguments](#arguments-29)
133
132
  - [Usage](#usage-30)
134
- - [tr-upload-consent-preferences](#tr-upload-consent-preferences)
133
+ - [tr-upload-preferences](#tr-upload-preferences)
134
+ - [Authentication](#authentication-30)
135
135
  - [Authentication](#authentication-31)
136
136
  - [Arguments](#arguments-30)
137
137
  - [Usage](#usage-31)
138
- - [tr-pull-consent-preferences](#tr-pull-consent-preferences)
138
+ - [tr-upload-consent-preferences](#tr-upload-consent-preferences)
139
139
  - [Authentication](#authentication-32)
140
140
  - [Arguments](#arguments-31)
141
141
  - [Usage](#usage-32)
142
- - [tr-upload-data-flows-from-csv](#tr-upload-data-flows-from-csv)
142
+ - [tr-pull-consent-preferences](#tr-pull-consent-preferences)
143
143
  - [Authentication](#authentication-33)
144
144
  - [Arguments](#arguments-32)
145
145
  - [Usage](#usage-33)
146
- - [tr-upload-cookies-from-csv](#tr-upload-cookies-from-csv)
146
+ - [tr-upload-data-flows-from-csv](#tr-upload-data-flows-from-csv)
147
147
  - [Authentication](#authentication-34)
148
148
  - [Arguments](#arguments-33)
149
149
  - [Usage](#usage-34)
150
- - [tr-generate-api-keys](#tr-generate-api-keys)
150
+ - [tr-upload-cookies-from-csv](#tr-upload-cookies-from-csv)
151
151
  - [Authentication](#authentication-35)
152
152
  - [Arguments](#arguments-34)
153
153
  - [Usage](#usage-35)
154
- - [tr-build-xdi-sync-endpoint](#tr-build-xdi-sync-endpoint)
154
+ - [tr-generate-api-keys](#tr-generate-api-keys)
155
155
  - [Authentication](#authentication-36)
156
156
  - [Arguments](#arguments-35)
157
157
  - [Usage](#usage-36)
158
+ - [tr-build-xdi-sync-endpoint](#tr-build-xdi-sync-endpoint)
159
+ - [Authentication](#authentication-37)
160
+ - [Arguments](#arguments-36)
161
+ - [Usage](#usage-37)
158
162
  - [Prompt Manager](#prompt-manager)
159
163
  - [Proxy usage](#proxy-usage)
160
164
 
@@ -1995,6 +1999,39 @@ Set to status "RESOLVED" instead of status "SKIPPED"
1995
1999
  yarn tr-skip-request-data-silos --auth=$TRANSCEND_API_KEY --dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f --status=RESOLVED
1996
2000
  ```
1997
2001
 
2002
+ ### tr-skip-preflight-jobs
2003
+
2004
+ This command allows for bulk skipping preflight checks.
2005
+
2006
+ #### Authentication
2007
+
2008
+ 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).
2009
+
2010
+ The API key must have the following scopes:
2011
+
2012
+ - "Manage Request Compilation"
2013
+
2014
+ #### Arguments
2015
+
2016
+ | Argument | Description | Type | Default | Required |
2017
+ | ------------ | ----------------------------------------------------------------------------- | --------------- | ------------------------ | -------- |
2018
+ | auth | The Transcend API key with the scopes necessary for the command. | string | N/A | true |
2019
+ | enricherIds | The ID of the enrichers to skip privacy request jobs for. | string[] - UUID | N/A | true |
2020
+ | transcendUrl | URL of the Transcend backend. Use https://api.us.transcend.io for US hosting. | string - URL | https://api.transcend.io | false |
2021
+
2022
+ #### Usage
2023
+
2024
+ ```sh
2025
+ yarn tr-skip-preflight-jobs --auth=$TRANSCEND_API_KEY --enricherIds=70810f2e-cf90-43f6-9776-901a5950599f
2026
+ ```
2027
+
2028
+ Specifying the backend URL, needed for US hosted backend infrastructure.
2029
+
2030
+ ```sh
2031
+ yarn tr-skip-preflight-jobs --auth=$TRANSCEND_API_KEY --enricherIds=70810f2e-cf90-43f6-9776-901a5950599f,db1e64ba-cea6-43ff-ad27-5dc8122e5224 \
2032
+ --transcendUrl=https://api.us.transcend.io
2033
+ ```
2034
+
1998
2035
  ### tr-retry-request-data-silos
1999
2036
 
2000
2037
  This command allows for bulk restarting a set of data silos jobs for open privacy requests. This is equivalent to clicking the "Wipe and Retry" button for a particular data silo across a set of privacy requests.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli-skip-preflight-jobs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-skip-preflight-jobs.d.ts","sourceRoot":"","sources":["../src/cli-skip-preflight-jobs.ts"],"names":[],"mappings":""}
@@ -0,0 +1,53 @@
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 requests_1 = require("./requests");
11
+ const constants_1 = require("./constants");
12
+ /**
13
+ * Given an enricher ID, skip all active enrichment jobs that are open for that enricher
14
+ *
15
+ * Requires an API key with scope:
16
+ * - "Manage Request Compilation"
17
+ *
18
+ * Dev Usage:
19
+ * yarn ts-node ./src/cli-skip-preflight-jobs.ts --auth=$TRANSCEND_API_KEY \
20
+ * --enricherIds=92636cda-b7c6-48c6-b1b1-2df574596cbc
21
+ *
22
+ * Standard usage:
23
+ * yarn tr-skip-request-data-silos --auth=$TRANSCEND_API_KEY \
24
+ * --enricherIds=92636cda-b7c6-48c6-b1b1-2df574596cbc
25
+ */
26
+ async function main() {
27
+ // Parse command line arguments
28
+ const {
29
+ /** Transcend Backend URL */
30
+ transcendUrl = constants_1.DEFAULT_TRANSCEND_API,
31
+ /** API key */
32
+ auth,
33
+ /** Enricher ID to mark requests fpr */
34
+ enricherIds, } = (0, yargs_parser_1.default)(process.argv.slice(2));
35
+ // Ensure auth is passed
36
+ if (!auth) {
37
+ logger_1.logger.error(colors_1.default.red('A Transcend API key must be provided. You can specify using --auth=$TRANSCEND_API_KEY'));
38
+ process.exit(1);
39
+ }
40
+ // Ensure enricherIds is provided
41
+ if (!enricherIds) {
42
+ logger_1.logger.error(colors_1.default.red('An enricher ID must be provided. You can specify using --enricherIds=2560bb81-b837-4c6f-a57e-dcef87069d43'));
43
+ process.exit(1);
44
+ }
45
+ // Upload privacy requests
46
+ await (0, requests_1.skipPreflightJobs)({
47
+ transcendUrl,
48
+ auth,
49
+ enricherIds: (0, requests_1.splitCsvToList)(enricherIds),
50
+ });
51
+ }
52
+ main();
53
+ //# sourceMappingURL=cli-skip-preflight-jobs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-skip-preflight-jobs.js","sourceRoot":"","sources":["../src/cli-skip-preflight-jobs.ts"],"names":[],"mappings":";;;;;;AAEA,gEAAiC;AACjC,oDAA4B;AAE5B,qCAAkC;AAClC,yCAA+D;AAC/D,2CAAoD;AAEpD;;;;;;;;;;;;;GAaG;AACH,KAAK,UAAU,IAAI;IACjB,+BAA+B;IAC/B,MAAM;IACJ,4BAA4B;IAC5B,YAAY,GAAG,iCAAqB;IACpC,cAAc;IACd,IAAI;IACJ,uCAAuC;IACvC,WAAW,GACZ,GAAG,IAAA,sBAAK,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAA8B,CAAC;IAE9D,wBAAwB;IACxB,IAAI,CAAC,IAAI,EAAE;QACT,eAAM,CAAC,KAAK,CACV,gBAAM,CAAC,GAAG,CACR,uFAAuF,CACxF,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,iCAAiC;IACjC,IAAI,CAAC,WAAW,EAAE;QAChB,eAAM,CAAC,KAAK,CACV,gBAAM,CAAC,GAAG,CACR,2GAA2G,CAC5G,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,0BAA0B;IAC1B,MAAM,IAAA,4BAAiB,EAAC;QACtB,YAAY;QACZ,IAAI;QACJ,WAAW,EAAE,IAAA,yBAAc,EAAC,WAAW,CAAC;KACzC,CAAC,CAAC;AACL,CAAC;AACD,IAAI,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export declare const REQUEST_ENRICHERS: string;
2
2
  export declare const RETRY_REQUEST_ENRICHER: string;
3
+ export declare const SKIP_REQUEST_ENRICHER: string;
3
4
  //# sourceMappingURL=RequestEnricher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RequestEnricher.d.ts","sourceRoot":"","sources":["../../../src/graphql/gqls/RequestEnricher.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,QA4B7B,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAQlC,CAAC"}
1
+ {"version":3,"file":"RequestEnricher.d.ts","sourceRoot":"","sources":["../../../src/graphql/gqls/RequestEnricher.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,QA4B7B,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAQlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAQjC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RETRY_REQUEST_ENRICHER = exports.REQUEST_ENRICHERS = void 0;
3
+ exports.SKIP_REQUEST_ENRICHER = exports.RETRY_REQUEST_ENRICHER = exports.REQUEST_ENRICHERS = void 0;
4
4
  const graphql_request_1 = require("graphql-request");
5
5
  // TODO: https://transcend.height.app/T-27909 - enable optimizations
6
6
  // isExportCsv: true
@@ -42,4 +42,13 @@ exports.RETRY_REQUEST_ENRICHER = (0, graphql_request_1.gql) `
42
42
  }
43
43
  }
44
44
  `;
45
+ exports.SKIP_REQUEST_ENRICHER = (0, graphql_request_1.gql) `
46
+ mutation TranscendCliSkipRequestEnricher($requestEnricherId: ID!) {
47
+ skipRequestEnricher(id: $requestEnricherId) {
48
+ requestEnricher {
49
+ id
50
+ }
51
+ }
52
+ }
53
+ `;
45
54
  //# sourceMappingURL=RequestEnricher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RequestEnricher.js","sourceRoot":"","sources":["../../../src/graphql/gqls/RequestEnricher.ts"],"names":[],"mappings":";;;AAAA,qDAAsC;AAEtC,oEAAoE;AACpE,oBAAoB;AACP,QAAA,iBAAiB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BnC,CAAC;AAEW,QAAA,sBAAsB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;CAQxC,CAAC"}
1
+ {"version":3,"file":"RequestEnricher.js","sourceRoot":"","sources":["../../../src/graphql/gqls/RequestEnricher.ts"],"names":[],"mappings":";;;AAAA,qDAAsC;AAEtC,oEAAoE;AACpE,oBAAoB;AACP,QAAA,iBAAiB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BnC,CAAC;AAEW,QAAA,sBAAsB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;CAQxC,CAAC;AAEW,QAAA,qBAAqB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;CAQvC,CAAC"}
@@ -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 './skipPreflightJobs';
23
24
  export * from './bulkRetryEnrichers';
24
25
  export * from './retryRequestDataSilos';
25
26
  export * from './pullPrivacyRequests';
@@ -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,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sCAAsC,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,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sCAAsC,CAAC"}
@@ -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("./skipPreflightJobs"), exports);
39
40
  __exportStar(require("./bulkRetryEnrichers"), exports);
40
41
  __exportStar(require("./retryRequestDataSilos"), exports);
41
42
  __exportStar(require("./pullPrivacyRequests"), 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,uDAAqC;AACrC,0DAAwC;AACxC,wDAAsC;AACtC,yDAAuC;AACvC,uEAAqD"}
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,sDAAoC;AACpC,uDAAqC;AACrC,0DAAwC;AACxC,wDAAsC;AACtC,yDAAuC;AACvC,uEAAqD"}
@@ -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,wCAMoB;AACpB,gEAAuC;AACvC,+DAGqC;AACrC,4CAAqD;AAErD;;;;;GAKG;AACI,KAAK,UAAU,iBAAiB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