@transcend-io/cli 4.18.0 → 4.19.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.
Files changed (29) hide show
  1. package/README.md +72 -13
  2. package/build/cli-cron-mark-identifiers-completed.d.ts +3 -0
  3. package/build/cli-cron-mark-identifiers-completed.d.ts.map +1 -0
  4. package/build/cli-cron-mark-identifiers-completed.js +44 -0
  5. package/build/cli-cron-mark-identifiers-completed.js.map +1 -0
  6. package/build/cli-cron-pull-identifiers.d.ts +3 -0
  7. package/build/cli-cron-pull-identifiers.d.ts.map +1 -0
  8. package/build/{cli-pull-cron-identifiers.js → cli-cron-pull-identifiers.js} +3 -3
  9. package/build/{cli-pull-cron-identifiers.js.map → cli-cron-pull-identifiers.js.map} +1 -1
  10. package/build/cron/index.d.ts +2 -0
  11. package/build/cron/index.d.ts.map +1 -1
  12. package/build/cron/index.js +2 -0
  13. package/build/cron/index.js.map +1 -1
  14. package/build/cron/markCronIdentifierCompleted.d.ts +21 -0
  15. package/build/cron/markCronIdentifierCompleted.d.ts.map +1 -0
  16. package/build/cron/markCronIdentifierCompleted.js +55 -0
  17. package/build/cron/markCronIdentifierCompleted.js.map +1 -0
  18. package/build/cron/pullCronPageOfIdentifiers.d.ts +1 -0
  19. package/build/cron/pullCronPageOfIdentifiers.d.ts.map +1 -1
  20. package/build/cron/pullCronPageOfIdentifiers.js +1 -1
  21. package/build/cron/pullCronPageOfIdentifiers.js.map +1 -1
  22. package/build/cron/pushCronIdentifiersFromCsv.d.ts +21 -0
  23. package/build/cron/pushCronIdentifiersFromCsv.d.ts.map +1 -0
  24. package/build/cron/pushCronIdentifiersFromCsv.js +34 -0
  25. package/build/cron/pushCronIdentifiersFromCsv.js.map +1 -0
  26. package/build/tsbuildinfo +1 -1
  27. package/package.json +3 -2
  28. package/build/cli-pull-cron-identifiers.d.ts +0 -3
  29. package/build/cli-pull-cron-identifiers.d.ts.map +0 -1
package/README.md CHANGED
@@ -25,10 +25,14 @@
25
25
  - [Authentication](#authentication-3)
26
26
  - [Arguments](#arguments-3)
27
27
  - [Usage](#usage-4)
28
- - [tr-pull-cron-identifiers](#tr-pull-cron-identifiers)
28
+ - [tr-cron-pull-identifiers](#tr-cron-pull-identifiers)
29
29
  - [Authentication](#authentication-4)
30
30
  - [Arguments](#arguments-4)
31
31
  - [Usage](#usage-5)
32
+ - [tr-cron-mark-identifiers-completed](#tr-cron-mark-identifiers-completed)
33
+ - [Authentication](#authentication-5)
34
+ - [Arguments](#arguments-5)
35
+ - [Usage](#usage-6)
32
36
 
33
37
  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
34
38
 
@@ -51,7 +55,7 @@ yarn tr-pull --auth=xxx
51
55
  yarn tr-push --auth=xxx
52
56
  yarn tr-discover-silos --auth=xxx
53
57
  yarn tr-request-upload --auth=xxx
54
- yarn tr-pull-cron-identifiers --auth=xxx
58
+ yarn tr-cron-pull-identifiers --auth=xxx
55
59
  ```
56
60
 
57
61
  or
@@ -65,7 +69,7 @@ tr-pull --auth=xxx
65
69
  tr-push --auth=xxx
66
70
  tr-discover-silos --auth=xxx
67
71
  tr-request-upload --auth=xxx
68
- tr-pull-cron-identifiers --auth=xxx
72
+ tr-cron-pull-identifiers --auth=xxx
69
73
  ```
70
74
 
71
75
  alternatively, you can install the cli globally on your machine:
@@ -229,7 +233,7 @@ tr-pull --auth=$TRANSCEND_API_KEY --file=./custom/location.yml
229
233
  Or a specific data silo(s) can be pulled in:
230
234
 
231
235
  ```sh
232
- tr-pull --auth=$TRANSCEND_API_KEY --dataSiloIds=710fec3c-7bcc-4c9e-baff-bf39f9bec43e
236
+ tr-pull --auth=$TRANSCEND_API_KEY ---dataSiloIds=710fec3c-7bcc-4c9e-baff-bf39f9bec43e
233
237
  ```
234
238
 
235
239
  Or a specific types of data silo(s) can be pulled in:
@@ -406,7 +410,7 @@ Then, you'll need to grab that `dataSiloId` and a Transcend API key and pass it
406
410
 
407
411
  ```sh
408
412
  # Scan a javascript project (package.json files) to look for new data silos
409
- yarn tr-discover-silos --scanPath=./myJavascriptProject --auth={{api_key}} --dataSiloId=abcdefg
413
+ yarn tr-discover-silos --scanPath=./myJavascriptProject --auth={{api_key}} ---dataSiloId=abcdefg
410
414
  ```
411
415
 
412
416
  This call will look for all the package.json files that in the scan path `./myJavascriptProject`, parse each of the dependencies into their individual package names, and send it to our Transcend backend for classification. These classifications can then be viewed [here](https://app.transcend.io/data-map/data-inventory/silo-discovery/triage). The process is the same for scanning requirements.txt, podfiles and build.gradle files.
@@ -544,7 +548,7 @@ Include debug logs - warning, this logs out personal data.
544
548
  yarn tr-request-upload --auth=$TRANSCEND_API_KEY --file=/Users/transcend/Desktop/test.csv --debug=true
545
549
  ```
546
550
 
547
- ### tr-pull-cron-identifiers
551
+ ### tr-cron-pull-identifiers
548
552
 
549
553
  If you are using the cron job integration, you can run this command to pull the outstanding identifiers
550
554
  for the data silo to a CSV.
@@ -574,34 +578,89 @@ The API key must be associated to the ID of the integration/data silo that is be
574
578
  ### Usage
575
579
 
576
580
  ```sh
577
- yarn tr-pull-cron-identifiers --auth=$TRANSCEND_API_KEY -dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f \
578
- --requestType=ERASURE
581
+ yarn tr-cron-pull-identifiers --auth=$TRANSCEND_API_KEY --dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f --requestType=ERASURE
579
582
  ```
580
583
 
581
584
  Pull to a specific file location
582
585
 
583
586
  ```sh
584
- yarn tr-pull-cron-identifiers --auth=$TRANSCEND_API_KEY -dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f --requestType=ERASURE \
587
+ yarn tr-cron-pull-identifiers --auth=$TRANSCEND_API_KEY --dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f --requestType=ERASURE \
585
588
  --file=/Users/transcend/Desktop/test.csv
586
589
  ```
587
590
 
588
591
  For self-hosted sombras that use an internal key:
589
592
 
590
593
  ```sh
591
- yarn tr-pull-cron-identifiers --auth=$TRANSCEND_API_KEY -dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f \
592
- --requestType=ERASURE --sombraAuth=$SOMBRA_INTERNAL_KEY
594
+ yarn tr-cron-pull-identifiers --auth=$TRANSCEND_API_KEY --dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f --requestType=ERASURE \
595
+ --sombraAuth=$SOMBRA_INTERNAL_KEY
593
596
  ```
594
597
 
595
598
  Specifying the backend URL, needed for US hosted backend infrastructure.
596
599
 
597
600
  ```sh
598
- yarn tr-pull-cron-identifiers --auth=$TRANSCEND_API_KEY --sombraAuth=$SOMBRA_INTERNAL_KEY --file=/Users/transcend/Desktop/test.csv \
601
+ yarn tr-cron-pull-identifiers --auth=$TRANSCEND_API_KEY --dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f --requestType=ERASURE \
599
602
  --transcendUrl=https://api.us.transcend.io
600
603
  ```
601
604
 
602
605
  Specifying the page limit, defaults to 100.
603
606
 
604
607
  ```sh
605
- yarn tr-pull-cron-identifiers --auth=$TRANSCEND_API_KEY --sombraAuth=$SOMBRA_INTERNAL_KEY --file=/Users/transcend/Desktop/test.csv \
608
+ yarn tr-cron-pull-identifiers --auth=$TRANSCEND_API_KEY --dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f --requestType=ERASURE \
606
609
  --pageLimit=300
607
610
  ```
611
+
612
+ ### tr-cron-mark-identifiers-completed
613
+
614
+ This command takes the output of `tr-cron-pull-identifiers` and notifies Transcend that all of the requests in the CSV have been processed.
615
+ This is used in the workflow like:
616
+
617
+ 1. Pull identifiers to CSV:
618
+ `yarn tr-cron-pull-identifiers --auth=$TRANSCEND_API_KEY --dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f --requestType=ERASURE --file=./outstanding-requests.csv`
619
+ 2. Run your process to operate on that CSV of requests.
620
+ 3. Notify Transcend of completion
621
+ `yarn tr-cron-mark-identifiers-completed --auth=$TRANSCEND_API_KEY --dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f --file=./outstanding-requests.csv`
622
+
623
+ Read more at https://docs.transcend.io/docs/integrations/cron-job-integration.
624
+
625
+ #### Authentication
626
+
627
+ 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).
628
+
629
+ The API key must be associated to the ID of the integration/data silo that is being operated on.
630
+
631
+ #### Arguments
632
+
633
+ | Argument | Description | Type | Default | Required |
634
+ | ------------ | ------------------------------------------------------------------------------------ | ------------------ | ------------------------ | -------- |
635
+ | auth | The Transcend API capable of pulling the cron identifiers. | string | N/A | true |
636
+ | dataSiloId | The ID of the data silo to pull in. | string - UUID | N/A | true |
637
+ | file | Path to the CSV file where identifiers will be written to. | string - file-path | ./cron-identifiers.csv | false |
638
+ | transcendUrl | URL of the Transcend backend. Use https://api.us.transcend.io for US hosting. | string - URL | https://api.transcend.io | false |
639
+ | sombraAuth | The sombra internal key, use for additional authentication when self-hosting sombra. | string | N/A | false |
640
+
641
+ ### Usage
642
+
643
+ ```sh
644
+ yarn tr-cron-mark-identifiers-completed --auth=$TRANSCEND_API_KEY --dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f
645
+ ```
646
+
647
+ Pull to a specific file location
648
+
649
+ ```sh
650
+ yarn tr-cron-mark-identifiers-completed --auth=$TRANSCEND_API_KEY --dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f \
651
+ --file=/Users/transcend/Desktop/test.csv
652
+ ```
653
+
654
+ For self-hosted sombras that use an internal key:
655
+
656
+ ```sh
657
+ yarn tr-cron-mark-identifiers-completed --auth=$TRANSCEND_API_KEY --dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f \
658
+ --sombraAuth=$SOMBRA_INTERNAL_KEY
659
+ ```
660
+
661
+ Specifying the backend URL, needed for US hosted backend infrastructure.
662
+
663
+ ```sh
664
+ yarn tr-cron-mark-identifiers-completed --auth=$TRANSCEND_API_KEY --dataSiloId=70810f2e-cf90-43f6-9776-901a5950599f \
665
+ --transcendUrl=https://api.us.transcend.io
666
+ ```
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli-cron-mark-identifiers-completed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-cron-mark-identifiers-completed.d.ts","sourceRoot":"","sources":["../src/cli-cron-mark-identifiers-completed.ts"],"names":[],"mappings":""}
@@ -0,0 +1,44 @@
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 cron_1 = require("./cron");
11
+ /**
12
+ * Mark all of the identifiers in a cron job CSV as completed.
13
+ *
14
+ * Requires an API key with scope for the cron integration being checked on.
15
+ *
16
+ * Dev Usage:
17
+ * yarn ts-node ./src/cli-cron-mark-identifiers-completed.ts --auth=asd123 \
18
+ * --dataSiloId=92636cda-b7c6-48c6-b1b1-2df574596cbc \
19
+ * --file=/Users/michaelfarrell/Desktop/test.csv
20
+ *
21
+ * Standard usage:
22
+ * yarn tr-pull-cron-mark-identifiers-completed --auth=asd123 \
23
+ * --dataSiloId=92636cda-b7c6-48c6-b1b1-2df574596cbc \
24
+ * --file=/Users/michaelfarrell/Desktop/test.csv
25
+ */
26
+ async function main() {
27
+ // Parse command line arguments
28
+ const { file = './cron-identifiers.csv', transcendUrl = 'https://api.transcend.io', auth, sombraAuth, dataSiloId, } = (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
+ // Upload privacy requests
35
+ await (0, cron_1.pushCronIdentifiersFromCsv)({
36
+ file,
37
+ transcendUrl,
38
+ auth,
39
+ sombraAuth,
40
+ dataSiloId,
41
+ });
42
+ }
43
+ main();
44
+ //# sourceMappingURL=cli-cron-mark-identifiers-completed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-cron-mark-identifiers-completed.js","sourceRoot":"","sources":["../src/cli-cron-mark-identifiers-completed.ts"],"names":[],"mappings":";;;;;;AAEA,gEAAiC;AACjC,oDAA4B;AAE5B,qCAAkC;AAClC,iCAAoD;AAEpD;;;;;;;;;;;;;;GAcG;AACH,KAAK,UAAU,IAAI;IACjB,+BAA+B;IAC/B,MAAM,EACJ,IAAI,GAAG,wBAAwB,EAC/B,YAAY,GAAG,0BAA0B,EACzC,IAAI,EACJ,UAAU,EACV,UAAU,GACX,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,2EAA2E,CAC5E,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,0BAA0B;IAC1B,MAAM,IAAA,iCAA0B,EAAC;QAC/B,IAAI;QACJ,YAAY;QACZ,IAAI;QACJ,UAAU;QACV,UAAU;KACX,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli-cron-pull-identifiers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-cron-pull-identifiers.d.ts","sourceRoot":"","sources":["../src/cli-cron-pull-identifiers.ts"],"names":[],"mappings":""}
@@ -15,13 +15,13 @@ const privacy_types_1 = require("@transcend-io/privacy-types");
15
15
  * Requires an API key with scope for the cron integration being checked on.
16
16
  *
17
17
  * Dev Usage:
18
- * yarn ts-node ./src/cli-pull-cron-identifiers.ts --auth=asd123 \
18
+ * yarn ts-node ./src/cli-cron-pull-identifiers.ts --auth=asd123 \
19
19
  * --dataSiloId=92636cda-b7c6-48c6-b1b1-2df574596cbc \
20
20
  * --requestType=ERASURE \
21
21
  * --file=/Users/michaelfarrell/Desktop/test.csv
22
22
  *
23
23
  * Standard usage:
24
- * yarn tr-pull-cron-identifiers --auth=asd123 \
24
+ * yarn tr-cron-pull-identifiers --auth=asd123 \
25
25
  * --dataSiloId=92636cda-b7c6-48c6-b1b1-2df574596cbc \
26
26
  * --requestType=ERASURE \
27
27
  * --file=/Users/michaelfarrell/Desktop/test.csv
@@ -53,4 +53,4 @@ async function main() {
53
53
  });
54
54
  }
55
55
  main();
56
- //# sourceMappingURL=cli-pull-cron-identifiers.js.map
56
+ //# sourceMappingURL=cli-cron-pull-identifiers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-pull-cron-identifiers.js","sourceRoot":"","sources":["../src/cli-pull-cron-identifiers.ts"],"names":[],"mappings":";;;;;;AAEA,gEAAiC;AACjC,oDAA4B;AAE5B,qCAAkC;AAClC,iCAAkD;AAClD,+DAA4D;AAE5D;;;;;;;;;;;;;;;;GAgBG;AACH,KAAK,UAAU,IAAI;IACjB,+BAA+B;IAC/B,MAAM,EACJ,IAAI,GAAG,wBAAwB,EAC/B,YAAY,GAAG,0BAA0B,EACzC,IAAI,EACJ,UAAU,EACV,UAAU,EACV,WAAW,EACX,SAAS,GAAG,KAAK,GAClB,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,2EAA2E,CAC5E,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,wBAAwB;IACxB,8DAA8D;IAC9D,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,6BAAa,CAA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BAAa,CAAC,CAAC,QAAQ,CAAC,WAAkB,CAAC,EAAE;QAC9D,eAAM,CAAC,KAAK,CACV,gBAAM,CAAC,GAAG,CACR,gCAAgC,WAAW,MAAM;YAC/C,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,0BAA0B;IAC1B,MAAM,IAAA,+BAAwB,EAAC;QAC7B,IAAI;QACJ,YAAY;QACZ,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC;QAClC,WAAW,EAAE,WAA4B;QACzC,IAAI;QACJ,UAAU;QACV,UAAU;KACX,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export * from './pullCronIdentifiersToCsv';
2
2
  export * from './pullCronPageOfIdentifiers';
3
3
  export * from './writeCsv';
4
+ export * from './pushCronIdentifiersFromCsv';
5
+ export * from './markCronIdentifierCompleted';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cron/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cron/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,YAAY,CAAC;AAC3B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC"}
@@ -13,4 +13,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./pullCronIdentifiersToCsv"), exports);
14
14
  __exportStar(require("./pullCronPageOfIdentifiers"), exports);
15
15
  __exportStar(require("./writeCsv"), exports);
16
+ __exportStar(require("./pushCronIdentifiersFromCsv"), exports);
17
+ __exportStar(require("./markCronIdentifierCompleted"), exports);
16
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cron/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAA2C;AAC3C,8DAA4C;AAC5C,6CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cron/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAA2C;AAC3C,8DAA4C;AAC5C,6CAA2B;AAC3B,+DAA6C;AAC7C,gEAA8C"}
@@ -0,0 +1,21 @@
1
+ import type { Got } from 'got';
2
+ import * as t from 'io-ts';
3
+ /**
4
+ * Minimal set required to mark as completed
5
+ */
6
+ export declare const CronIdentifierPush: t.TypeC<{
7
+ nonce: t.StringC;
8
+ identifier: t.StringC;
9
+ }>;
10
+ /** Type override */
11
+ export declare type CronIdentifierPush = t.TypeOf<typeof CronIdentifierPush>;
12
+ /**
13
+ * Mark an identifier output by the cron job as completed.
14
+ *
15
+ * @see https://docs.transcend.io/docs/api-reference/PUT/v1/data-silo
16
+ * @param sombra - Sombra instance configured to make requests
17
+ * @param options - Additional options
18
+ * @returns Successfully submitted request
19
+ */
20
+ export declare function markCronIdentifierCompleted(sombra: Got, { nonce, identifier }: CronIdentifierPush): Promise<void>;
21
+ //# sourceMappingURL=markCronIdentifierCompleted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markCronIdentifierCompleted.d.ts","sourceRoot":"","sources":["../../src/cron/markCronIdentifierCompleted.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAE3B;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;EAG7B,CAAC;AAEH,oBAAoB;AACpB,oBAAY,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAErE;;;;;;;GAOG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,GAAG,EACX,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,kBAAkB,GACxC,OAAO,CAAC,IAAI,CAAC,CAcf"}
@@ -0,0 +1,55 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.markCronIdentifierCompleted = exports.CronIdentifierPush = void 0;
23
+ const t = __importStar(require("io-ts"));
24
+ /**
25
+ * Minimal set required to mark as completed
26
+ */
27
+ exports.CronIdentifierPush = t.type({
28
+ nonce: t.string,
29
+ identifier: t.string,
30
+ });
31
+ /**
32
+ * Mark an identifier output by the cron job as completed.
33
+ *
34
+ * @see https://docs.transcend.io/docs/api-reference/PUT/v1/data-silo
35
+ * @param sombra - Sombra instance configured to make requests
36
+ * @param options - Additional options
37
+ * @returns Successfully submitted request
38
+ */
39
+ async function markCronIdentifierCompleted(sombra, { nonce, identifier }) {
40
+ // Make the GraphQL request
41
+ await sombra.put('v1/data-silo', {
42
+ headers: {
43
+ 'x-transcend-nonce': nonce,
44
+ },
45
+ json: {
46
+ profiles: [
47
+ {
48
+ profileId: identifier,
49
+ },
50
+ ],
51
+ },
52
+ });
53
+ }
54
+ exports.markCronIdentifierCompleted = markCronIdentifierCompleted;
55
+ //# sourceMappingURL=markCronIdentifierCompleted.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markCronIdentifierCompleted.js","sourceRoot":"","sources":["../../src/cron/markCronIdentifierCompleted.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,yCAA2B;AAE3B;;GAEG;AACU,QAAA,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC;IACvC,KAAK,EAAE,CAAC,CAAC,MAAM;IACf,UAAU,EAAE,CAAC,CAAC,MAAM;CACrB,CAAC,CAAC;AAKH;;;;;;;GAOG;AACI,KAAK,UAAU,2BAA2B,CAC/C,MAAW,EACX,EAAE,KAAK,EAAE,UAAU,EAAsB;IAEzC,2BAA2B;IAC3B,MAAM,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE;QAC/B,OAAO,EAAE;YACP,mBAAmB,EAAE,KAAK;SAC3B;QACD,IAAI,EAAE;YACJ,QAAQ,EAAE;gBACR;oBACE,SAAS,EAAE,UAAU;iBACtB;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAjBD,kEAiBC"}
@@ -15,6 +15,7 @@ export declare const CronIdentifier: t.TypeC<{
15
15
  /** The request nonce */
16
16
  nonce: t.StringC;
17
17
  /** The time the request was created */
18
+ requestCreatedAt: t.StringC;
18
19
  /** The number of days until the request is overdue */
19
20
  daysUntilOverdue: t.NumberC;
20
21
  /** Request attributes */
@@ -1 +1 @@
1
- {"version":3,"file":"pullCronPageOfIdentifiers.d.ts","sourceRoot":"","sources":["../../src/cron/pullCronPageOfIdentifiers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC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D;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,GAAG,EACX,EACE,UAAU,EACV,KAAW,EACX,MAAU,EACV,WAAW,GACZ,EAAE;IACD,mBAAmB;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,WAAW,EAAE,aAAa,CAAC;IAC3B,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAAC,cAAc,EAAE,CAAC,CAkB3B"}
@@ -36,7 +36,7 @@ exports.CronIdentifier = t.type({
36
36
  /** The request nonce */
37
37
  nonce: t.string,
38
38
  /** The time the request was created */
39
- // requestCreatedAt: t.string, TODO
39
+ requestCreatedAt: t.string,
40
40
  /** The number of days until the request is overdue */
41
41
  daysUntilOverdue: t.number,
42
42
  /** Request attributes */
@@ -1 +1 @@
1
- {"version":3,"file":"pullCronPageOfIdentifiers.js","sourceRoot":"","sources":["../../src/cron/pullCronPageOfIdentifiers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,yDAAuD;AAI1C,QAAA,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC;IACnC,2BAA2B;IAC3B,UAAU,EAAE,CAAC,CAAC,MAAM;IACpB,6BAA6B;IAC7B,IAAI,EAAE,CAAC,CAAC,MAAM;IACd,yCAAyC;IACzC,cAAc,EAAE,CAAC,CAAC,MAAM;IACxB,yCAAyC;IACzC,UAAU,EAAE,CAAC,CAAC,MAAM;IACpB,uCAAuC;IACvC,SAAS,EAAE,CAAC,CAAC,MAAM;IACnB,wBAAwB;IACxB,KAAK,EAAE,CAAC,CAAC,MAAM;IACf,uCAAuC;IACvC,mCAAmC;IACnC,sDAAsD;IACtD,gBAAgB,EAAE,CAAC,CAAC,MAAM;IAC1B,yBAAyB;IACzB,UAAU,EAAE,CAAC,CAAC,KAAK,CACjB,CAAC,CA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gB,EAAE,CAAC,CAAC,MAAM;IAC1B,sDAAsD;IACtD,gBAAgB,EAAE,CAAC,CAAC,MAAM;IAC1B,yBAAyB;IACzB,UAAU,EAAE,CAAC,CAAC,KAAK,CACjB,CAAC,CAAC,IAAI,CAAC;QACL,GAAG,EAAE,CAAC,CAAC,MAAM;QACb,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;KAC1B,CAAC,CACH;CACF,CAAC,CAAC;AAKH;;;;;;;GAOG;AACI,KAAK,UAAU,yBAAyB,CAC7C,MAAW,EACX,EACE,UAAU,EACV,KAAK,GAAG,GAAG,EACX,MAAM,GAAG,CAAC,EACV,WAAW,GAUZ;IAED,2BAA2B;IAC3B,MAAM,QAAQ,GAAG,MAAM,MAAM;SAC1B,GAAG,CAAC,gBAAgB,UAAU,qBAAqB,WAAW,EAAE,EAAE;QACjE,YAAY,EAAE;YACZ,MAAM;YACN,KAAK;SACN;KACF,CAAC;SACD,IAAI,EAAE,CAAC;IAEV,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,wBAAW,EAC3B,CAAC,CAAC,IAAI,CAAC;QACL,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAc,CAAC;KAC/B,CAAC,EACF,QAAQ,CACT,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAAC;AAnCD,8DAmCC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Given a CSV of cron job outputs, mark all requests as completed in Transcend
3
+ *
4
+ * @param options - Options
5
+ * @returns Number of items marked as completed
6
+ */
7
+ export declare function pushCronIdentifiersFromCsv({ file, dataSiloId, auth, sombraAuth, concurrency, transcendUrl, }: {
8
+ /** CSV file path */
9
+ file: string;
10
+ /** Transcend API key authentication */
11
+ auth: string;
12
+ /** Data Silo ID to pull down jobs for */
13
+ dataSiloId: string;
14
+ /** Upload concurrency */
15
+ concurrency?: number;
16
+ /** API URL for Transcend backend */
17
+ transcendUrl?: string;
18
+ /** Sombra API key authentication */
19
+ sombraAuth?: string;
20
+ }): Promise<number>;
21
+ //# sourceMappingURL=pushCronIdentifiersFromCsv.d.ts.map
@@ -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"}